_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q240400 | MString.split | train | public function split($regex = '//u', $limit = -1){
if(!\is_string($regex)){
throw new \InvalidArgumentException('$regex is not a string');
}
if(!\is_numeric($limit)){
throw new \InvalidArgumentException('$limit is not a number');
}
return \preg_split($regex, $this->_Value, $limit, \PREG_SPLIT_... | php | {
"resource": ""
} |
q240401 | MString.startsWith | train | public function startsWith(self $str, MStringComparison $cmp = null){
if($str->isNullOrEmpty()){
throw new \InvalidArgumentException('$str is empty');
}
if($str->count() > $this->count()){
throw new \InvalidArgumentException('$str is longer than $this');
}
if($cmp === null || $cmp->getValue() =... | php | {
"resource": ""
} |
q240402 | MString.toCharArray | train | public function toCharArray(){
$arr = array();
for($i = 0, $l = $this->count(); $i < $l; ++$i){
$arr[] = \mb_substr($this->_Value, $i, 1, $this->_Encoding);
}
return $arr;
} | php | {
"resource": ""
} |
q240403 | MString.trim | train | public function trim(array $chars = null){
if($chars === null){
return new static(\trim($this->_Value), $this->_Encoding);
}
$chars = \preg_quote(\implode(static::NONE, $chars));
$str = \preg_replace(
\sprintf('/(^[%s]+)|([%s]+$)/us', $chars, $chars),
static::NONE,
$this->_Value);
re... | php | {
"resource": ""
} |
q240404 | MString.trimEnd | train | public function trimEnd(array $chars = null){
if($chars === null){
return new static(\rtrim($this->_Value), $this->_Encoding);
}
$chars = \preg_quote(\implode(static::NONE, $chars));
$str = \preg_replace(
\sprintf('/[%s]+$/us', $chars),
static::NONE,
$this->_Value);
return new stati... | php | {
"resource": ""
} |
q240405 | MString.trimStart | train | public function trimStart(array $chars = null){
if($chars === null){
return new static(\ltrim($this->_Value), $this->_Encoding);
}
$chars = \preg_quote(\implode(static::NONE, $chars));
$str = \preg_replace(
\sprintf('/^[%s]+/us', $chars),
static::NONE,
$this->_Value);
return new sta... | php | {
"resource": ""
} |
q240406 | MString.ucfirst | train | public function ucfirst(){
if($this->isNullOrWhitespace()){
return clone $this;
}
else if($this->count() === 1){
return new static(\mb_strtoupper($this->_Value, $this->_Encoding),
$this->_Encoding);
}
$str = $this[0]->ucfirst() . $this->substring(1);
return new static($str, $this->_Encod... | php | {
"resource": ""
} |
q240407 | MString.unserialize | train | public function unserialize($serialized) {
$arr = \unserialize($serialized);
$this->_Value = $arr[0];
$this->_Encoding = $arr[1];
} | php | {
"resource": ""
} |
q240408 | File.download | train | public function download($pathToFile, $name = null, array $headers = array())
{
$response = StaticClient::get($this->offsetGet('_downloadURL'), array(
'headers' => $headers,
'timeout' => $this->timeout,
'save_to' => $pathToFile,
));
file_put_contents($pathToFile, $response->getBody()->getStream());
} | php | {
"resource": ""
} |
q240409 | Response.withType | train | public function withType($value)
{
$new = clone $this;
$new->headers[Header\ContentType::name()] = [];
$new->headers[Header\ContentType::name()][] = $value;
return $new;
} | php | {
"resource": ""
} |
q240410 | Response.withLanguage | train | public function withLanguage($value)
{
$new = clone $this;
$new->headers[Header\Language::name()] = [];
$new->headers[Header\Language::name()][] = $value;
return $new;
} | php | {
"resource": ""
} |
q240411 | Response.withTypeNegotiation | train | public function withTypeNegotiation($strongNegotiation = false)
{
$negotiation = array_intersect(Request\AcceptType::getContent(), Support\TypeSupport::getSupport());
$content = '';
if(count($negotiation) > 0) {
$content = current($negotiation);
}
else {
if($strongNegotiation) {
$this->failTyp... | php | {
"resource": ""
} |
q240412 | Response.withAddedType | train | public function withAddedType($value)
{
$new = clone $this;
if (empty($new->headers[Header\ContentType::name()])) {
$new->headers[Header\ContentType::name()] = [];
}
$new->headers[Header\ContentType::name()][] = $value;
return $new;
} | php | {
"resource": ""
} |
q240413 | Response.withAddedLanguage | train | public function withAddedLanguage($value)
{
$new = clone $this;
if (empty($new->headers[Header\Language::name()])) {
$new->headers[Header\Language::name()] = [];
}
$new->headers[Header\Language::name()][] = $value;
return $new;
} | php | {
"resource": ""
} |
q240414 | Response.failTypeNegotiation | train | protected function failTypeNegotiation()
{
$supported = Request\TypeSupport::getSupport();
$clientSupport = Request\AcceptType::getContent();
$supported = implode(',', $supported);
$clientSupport = implode(',',$clientSupport);
$this->withStatus(406)->withType(Response\ContentType::TEXT)
->write("NOT... | php | {
"resource": ""
} |
q240415 | Response.overwrite | train | public function overwrite($data)
{
$body = $this->getBody();
$body->rewind();
$body->write($data);
return $this;
} | php | {
"resource": ""
} |
q240416 | Response.send | train | public function send()
{
header($this->getStatusStr());
foreach($this->headers as $header => $value) {
header(sprintf("%s: %s", $header, implode(',', $value)));
}
$body = $this->getBody();
if ($body->isAttached()) {
$body->rewind();
whil... | php | {
"resource": ""
} |
q240417 | NextrasDbal.dropDatabase | train | public function dropDatabase(): void
{
$tables = $this->getTables();
if (!empty($tables)) {
$this->connection->query('SET foreign_key_checks = 0');
foreach ($tables as $table) {
$this->connection->query('DROP TABLE %table', $table);
}
$this->connection->query('SET foreign_key_checks = 1');
}
} | php | {
"resource": ""
} |
q240418 | VinceTBaseExtension.camelizeBundle | train | public function camelizeBundle($string)
{
$string = $this->camelize($string);
$string = str_replace('_bundle', '', $string);
return $string;
} | php | {
"resource": ""
} |
q240419 | StatusController.indexAction | train | public function indexAction(Request $request)
{
$query = $request->query->get('query');
$limit = $request->query->get('limit');
$start = $request->query->get('start');
$searchProviders = $this->get('search.providers');
$content = '';
$content .= '<h3>Registered Sear... | php | {
"resource": ""
} |
q240420 | Assets.loadSiteScripts | train | public function loadSiteScripts()
{
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
$mainHandle = 'site';
$this->loadMainScriptByHandle($mainHandle);
$viewHandle = $this->getViewHandle();
if... | php | {
"resource": ""
} |
q240421 | Assets.loadSiteStyles | train | public function loadSiteStyles()
{
$this->loadCdnStyles();
$mainHandle = 'site';
$this->loadMainStyleByHandle($mainHandle);
$viewHandle = $this->getViewHandle();
if (file_exists(sprintf('%s/css/views/%s.css', $this->paths->getThemeAssetsDir(), $viewHandle))) {
... | php | {
"resource": ""
} |
q240422 | Assets.loadCustomizeScript | train | public function loadCustomizeScript()
{
$handle = 'novusopress_customize';
$url = sprintf('%s/js/customize.js', $this->paths->getBaseAssetsUri());
$deps = ['jquery', 'customize-preview'];
$this->loadScript($handle, $url, $deps, true);
} | php | {
"resource": ""
} |
q240423 | Assets.loadCdnStyles | train | protected function loadCdnStyles()
{
if (file_exists(sprintf('%s/cdn-styles.json', $this->paths->getThemeConfigDir()))) {
$cdnContent = file_get_contents(sprintf('%s/cdn-styles.json', $this->paths->getThemeConfigDir()));
$cdnStyles = json_decode($cdnContent, true);
for ($... | php | {
"resource": ""
} |
q240424 | Assets.loadMainScriptByHandle | train | protected function loadMainScriptByHandle($mainHandle)
{
$deps = $this->getScriptDeps($mainHandle);
if (file_exists(sprintf('%s/js/%s.js', $this->paths->getThemeAssetsDir(), $mainHandle))) {
$mainSrc = sprintf('%s/js/%s.js', $this->paths->getThemeAssetsUri(), $mainHandle);
} els... | php | {
"resource": ""
} |
q240425 | Assets.loadMainStyleByHandle | train | protected function loadMainStyleByHandle($mainHandle)
{
$deps = $this->getStyleDeps($mainHandle);
if (file_exists(sprintf('%s/css/%s.css', $this->paths->getThemeAssetsDir(), $mainHandle))) {
$mainSrc = sprintf('%s/css/%s.css', $this->paths->getThemeAssetsUri(), $mainHandle);
} e... | php | {
"resource": ""
} |
q240426 | Assets.getScriptDeps | train | protected function getScriptDeps($section)
{
$dependencies = $this->getDependencies();
$deps = isset($dependencies['scripts']) ? $dependencies['scripts'] : [];
return isset($deps[$section]) ? $deps[$section] : [];
} | php | {
"resource": ""
} |
q240427 | Assets.getStyleDeps | train | protected function getStyleDeps($section)
{
$dependencies = $this->getDependencies();
$deps = isset($dependencies['styles']) ? $dependencies['styles'] : [];
return isset($deps[$section]) ? $deps[$section] : [];
} | php | {
"resource": ""
} |
q240428 | Assets.getDependencies | train | protected function getDependencies()
{
if (null === $this->dependencies) {
if (file_exists(sprintf('%s/dependencies.json', $this->paths->getThemeConfigDir()))) {
$depsContent = file_get_contents(sprintf('%s/dependencies.json', $this->paths->getThemeConfigDir()));
} el... | php | {
"resource": ""
} |
q240429 | Assets.getViewHandle | train | protected function getViewHandle()
{
if (is_front_page() && is_home()) {
return 'index';
} elseif (is_front_page()) {
return 'front-page';
} elseif (is_home()) {
return 'index';
} elseif (is_page_template()) {
global $wp_query;
... | php | {
"resource": ""
} |
q240430 | Router.group | train | public static function group(array $properties, array $routes)
{
// Translate a single filter to an array of one filter
if (isset($properties['filter'])) {
if (!is_array($properties['filter'])) {
$properties['filter'] = [$properties['filter']];
}
} els... | php | {
"resource": ""
} |
q240431 | Router.route | train | public static function route(Http\Request $request)
{
$path = $request->REQUEST_URI;
$key = $request->getMethod().'@'.$path;
$keyAny = 'ANY@'.$path;
$matchedRoute = null;
$matchedScore = 0;
if (isset(self::$routes[$key])) {
$matchedRoute = self::$routes[... | php | {
"resource": ""
} |
q240432 | ServiceProvider.fullBoot | train | public function fullBoot($package, $dir)
{
$this->mapRoutes($dir);
if (file_exists($dir.'/views')) {
$this->loadViewsFrom($dir.'/views', $package);
}
if (file_exists($dir.'/migrations')) {
$this->publishes([
$dir.'/migrations' => base_path('d... | php | {
"resource": ""
} |
q240433 | ArrayQueue.reindex | train | private function reindex(int $capacity): void
{
$temp = [];
for ($i = 0; $i < $this->count; $i++) {
$temp[$i] = $this->items[($i + $this->front) % $this->cap];
}
$this->items = $temp;
$this->cap = $capacity;
$this->front = 0;
$this->end = $this->co... | php | {
"resource": ""
} |
q240434 | GD.jpegToWbmp | train | public function jpegToWbmp(String $jpegFile, String $wbmpFile, Array $settings = []) : Bool
{
if( is_file($jpegFile) )
{
$height = $settings['height'] ?? $this->height ?? 0;
$width = $settings['width'] ?? $this->width ?? 0;
$threshold = $setti... | php | {
"resource": ""
} |
q240435 | GD.pngToWbmp | train | public function pngToWbmp(String $pngFile, String $wbmpFile, Array $settings = []) : Bool
{
if( is_file($pngFile) )
{
$height = $settings['height'] ?? 0;
$width = $settings['width'] ?? 0;
$threshold = $settings['threshold'] ?? 0;
return ... | php | {
"resource": ""
} |
q240436 | GD.alphaBlending | train | public function alphaBlending(Bool $blendMode = NULL) : GD
{
imagealphablending($this->canvas, (bool) $blendMode);
return $this;
} | php | {
"resource": ""
} |
q240437 | GD.saveAlpha | train | public function saveAlpha(Bool $save = true) : GD
{
imagesavealpha($this->canvas, $save);
return $this;
} | php | {
"resource": ""
} |
q240438 | GD.pixelIndex | train | public function pixelIndex(Int $x, Int $y) : Int
{
return imagecolorat($this->canvas, $x, $y);
} | php | {
"resource": ""
} |
q240439 | GD.line | train | public function line(Array $settings = []) : GD
{
$x1 = $settings['x1'] ?? $this->x1 ?? 0;
$y1 = $settings['y1'] ?? $this->y1 ?? 0;
$x2 = $settings['x2'] ?? $this->x2 ?? 0;
$y2 = $settings['y2'] ?? $this->y2 ?? 0;
$rgb = $settings['color'] ?? ... | php | {
"resource": ""
} |
q240440 | GD.windowDisplay | train | public function windowDisplay(Int $window, Int $clientArea = 0) : GD
{
$this->canvas = imagegrabwindow($window, $clientArea);
return $this;
} | php | {
"resource": ""
} |
q240441 | GD.layerEffect | train | public function layerEffect(String $effect = 'normal') : GD
{
imagelayereffect($this->canvas, Helper::toConstant($effect, 'IMG_EFFECT_'));
return $this;
} | php | {
"resource": ""
} |
q240442 | GD.loadFont | train | public function loadFont(String $file) : Int
{
if( ! is_file($file) )
{
throw new InvalidArgumentException(NULL, '[file]');
}
return imageloadfont($file);
} | php | {
"resource": ""
} |
q240443 | GD.copyPalette | train | public function copyPalette($source)
{
if( ! is_resource($source) )
{
throw new InvalidArgumentException(NULL, '[resource]');
}
imagepalettecopy($this->canvas, $source);
} | php | {
"resource": ""
} |
q240444 | GD.createImageCanvas | train | protected function createImageCanvas($image)
{
$this->type = $this->mime->type($image, 1);
$this->imageSize = ! isset($this->width) ? getimagesize($image) : [$this->width ?? 0, $this->height ?? 0];
$this->canvas = $this->createFrom($image,
[
# For type gd2p
... | php | {
"resource": ""
} |
q240445 | GD.createEmptyCanvas | train | protected function createEmptyCanvas($width, $height, $rgb, $real)
{
$width = $this->width ?? $width;
$height = $this->height ?? $height;
$rgb = $this->color ?? $rgb;
$real = $this->real ?? $real;
$this->imageSize = [$width, $height];
if( $real === false )... | php | {
"resource": ""
} |
q240446 | GD.alignImageWatermark | train | protected function alignImageWatermark($source)
{
if( is_string($this->target ?? NULL) )
{
$size = getimagesize($source);
$this->width = $this->width ?? $size[0];
$this->height = $this->height ?? $size[1];
$return = WatermarkImageAligner::align($th... | php | {
"resource": ""
} |
q240447 | GD.getImageColor | train | public function getImageColor($rgb, $function)
{
$rgb = explode('|', $rgb);
$red = $rgb[0] ?? 0;
$green = $rgb[1] ?? 0;
$blue = $rgb[2] ?? 0;
$alpha = $rgb[3] ?? 0;
return $function($this->canvas, $red, $green, $blue, $alpha);
} | php | {
"resource": ""
} |
q240448 | GD.defaultVariables | train | protected function defaultVariables()
{
$this->canvas = NULL;
$this->save = NULL;
$this->output = true;
$this->quality = NULL;
} | php | {
"resource": ""
} |
q240449 | QueryBuilder.select | train | public function select($fields = '*')
{
$query = new Query\SelectQuery();
if ($this->pdo) {
$query->setPDO($this->pdo);
}
return $query->select($fields);
} | php | {
"resource": ""
} |
q240450 | QueryBuilder.insert | train | public function insert(array $values)
{
$query = new Query\InsertQuery();
if ($this->pdo) {
$query->setPDO($this->pdo);
}
return $query->values($values);
} | php | {
"resource": ""
} |
q240451 | QueryBuilder.update | train | public function update($table)
{
$query = new Query\UpdateQuery();
if ($this->pdo) {
$query->setPDO($this->pdo);
}
return $query->table($table);
} | php | {
"resource": ""
} |
q240452 | QueryBuilder.delete | train | public function delete($from)
{
$query = new Query\DeleteQuery();
if ($this->pdo) {
$query->setPDO($this->pdo);
}
return $query->from($from);
} | php | {
"resource": ""
} |
q240453 | QueryBuilder.raw | train | public function raw($sql)
{
$query = new Query\SqlQuery();
if ($this->pdo) {
$query->setPDO($this->pdo);
}
return $query->raw($sql);
} | php | {
"resource": ""
} |
q240454 | Database_Query_Builder_Select.select | train | public function select($columns = null)
{
$columns = func_get_args();
$this->_select = array_merge($this->_select, $columns);
return $this;
} | php | {
"resource": ""
} |
q240455 | Database_Query_Builder_Select.select_array | train | public function select_array(array $columns, $reset = false)
{
$this->_select = $reset ? $columns : array_merge($this->_select, $columns);
return $this;
} | php | {
"resource": ""
} |
q240456 | Database_Query_Builder_Select.from | train | public function from($tables)
{
$tables = func_get_args();
$this->_from = array_merge($this->_from, $tables);
return $this;
} | php | {
"resource": ""
} |
q240457 | Database_Query_Builder_Select.and_on | train | public function and_on($c1, $op, $c2)
{
$this->_last_join->and_on($c1, $op, $c2);
return $this;
} | php | {
"resource": ""
} |
q240458 | Database_Query_Builder_Select.or_on | train | public function or_on($c1, $op, $c2)
{
$this->_last_join->or_on($c1, $op, $c2);
return $this;
} | php | {
"resource": ""
} |
q240459 | Version.compare | train | public static function compare(Version $a, Version $b)
{
$aValues = $a->numeric();
$bValues = $b->numeric();
foreach (array_keys(self::$ordinality) as $key) {
$aVal = $aValues[$key];
$bVal = $bValues[$key];
if ($aVal < $bVal) {
return -1;... | php | {
"resource": ""
} |
q240460 | Version.increment | train | public function increment($part)
{
foreach (array_reverse(self::$ordinality) as $currentPart) {
if ($currentPart === $part) {
switch ($part) {
case self::STABILITY:
$this->set(
$currentPart,
... | php | {
"resource": ""
} |
q240461 | Version.set | train | private function set($part, $value)
{
if (null === $value && isset(self::$defaults[$part])) {
$value = self::$defaults[$part];
}
$this->parts[$part] = $value;
return $this;
} | php | {
"resource": ""
} |
q240462 | Version.format | train | public function format()
{
$ret = '';
foreach (self::$formats as $key => $format) {
$value = $this->get($key);
// -stable is not added to the version, it is implied
if ($key == self::STABILITY && $value == end(self::$stabilities)) {
break;
... | php | {
"resource": ""
} |
q240463 | Version.numeric | train | public function numeric()
{
$ret = array();
foreach (self::$ordinality as $part) {
if ($part === self::STABILITY) {
$ret[]= array_search($this->get($part), self::$stabilities);
} else {
$ret[]= $this->get($part);
}
}
... | php | {
"resource": ""
} |
q240464 | ResponseBuilder.setBody | train | public function setBody($responseBody)
{
if($this->initialized !== true)
throw new \Exception('ResponseBuilder not initialized. Call init() first');
// TODO make sure, this can only be a string or a BaseObject
// TODO throws an error when not valid JSON - how to deal with this?
if(gettype($respons... | php | {
"resource": ""
} |
q240465 | Inspector.checkFilter | train | public static function checkFilter($comment_string)
{
//define the regular expression pattern to use for string matching
$pattern = "#(@[a-zA-Z]+\s*[a-zA-Z0-9, ()_].*)#";
//perform the regular expression on the string provided
preg_match_all($pattern, $comment_string, $matches, PREG_PATTERN_ORDER);
//get t... | php | {
"resource": ""
} |
q240466 | MemoryCache.get | train | public function get($key)
{
if (!isset($this->records[$key])) {
return null;
}
$record = $this->records[$key];
if ($record['expire'] < time()) {
unset($this->records[$key]);
return null;
}
return $record['nodes'];
} | php | {
"resource": ""
} |
q240467 | MemoryCache.expires | train | public function expires($key)
{
if (!isset($this->records[$key])) {
return 0;
}
return (int) max(0, $this->records[$key]['expire'] - time());
} | php | {
"resource": ""
} |
q240468 | FlashMessenger.init | train | public function init()
{
$container = $this->getSessionContainer();
//get the messages and data that was set in the previous request
//clear them afterwards
if (isset($container->messages)) {
$this->messages = $container->messages;
unset($container->messages);... | php | {
"resource": ""
} |
q240469 | FlashMessenger.addMessage | train | public function addMessage(string $type, $message, string $channel = FlashMessengerInterface::DEFAULT_CHANNEL)
{
if (!is_string($message) && !is_array($message)) {
throw new InvalidArgumentException('Flash message must be a string or an array of strings');
}
$container = $this->... | php | {
"resource": ""
} |
q240470 | Reporting.report | train | public function report() : ReportingResult
{
$sets = [];
$errors = [];
foreach ($this->collectors as $collector) {
$sets[] = $set = $collector->flush();
$errors[] = $this->reportOn($set);
}
return new ReportingResult($sets, array_merge(...$errors));
... | php | {
"resource": ""
} |
q240471 | Reporting.reportOn | train | private function reportOn(MetricSet $set) : array
{
$errors = [];
foreach ($this->reporters as $reporter) {
try {
$reporter->reportOn($set);
} catch (\Exception $e) {
$errors[] = $e;
}
}
return $errors;
} | php | {
"resource": ""
} |
q240472 | Zend_Loader_ClassMapAutoloader.registerAutoloadMap | train | public function registerAutoloadMap($map)
{
if (is_string($map)) {
$location = $map;
if ($this === ($map = $this->loadMapFromFile($location))) {
return $this;
}
}
if (!is_array($map)) {
throw new Zend_Loader_Exception_InvalidA... | php | {
"resource": ""
} |
q240473 | Zend_Loader_ClassMapAutoloader.registerAutoloadMaps | train | public function registerAutoloadMaps($locations)
{
if (!is_array($locations) && !($locations instanceof Traversable)) {
throw new Zend_Loader_Exception_InvalidArgumentException('Map list must be an array or implement Traversable');
}
foreach ($locations as $location) {
... | php | {
"resource": ""
} |
q240474 | Zend_Loader_ClassMapAutoloader.register | train | public function register()
{
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
spl_autoload_register(array($this, 'autoload'), true, true);
} else {
spl_autoload_register(array($this, 'autoload'), true);
}
} | php | {
"resource": ""
} |
q240475 | Zend_Loader_ClassMapAutoloader.loadMapFromFile | train | protected function loadMapFromFile($location)
{
if (!file_exists($location)) {
throw new Zend_Loader_Exception_InvalidArgumentException('Map file provided does not exist');
}
if (!$path = self::realPharPath($location)) {
$path = realpath($location);
}
... | php | {
"resource": ""
} |
q240476 | Zend_Loader_ClassMapAutoloader.resolvePharParentPath | train | public static function resolvePharParentPath($value, $key, &$parts)
{
if ($value !== '...') {
return;
}
unset($parts[$key], $parts[$key-1]);
$parts = array_values($parts);
} | php | {
"resource": ""
} |
q240477 | Callback.setCallback | train | public function setCallback(callable $callback, array $params = [])
{
if ($this->hasCallback()) {
throw new ArchException('Callback already defined');
}
$this->callback = $callback;
$this->callbackParams = $params;
return $this;
} | php | {
"resource": ""
} |
q240478 | GetTermTypeRendererContainerTrait._getTermTypeRenderer | train | protected function _getTermTypeRenderer($termType, $context = null)
{
$container = $this->_getTermTypeRendererContainer();
return $this->_containerGet($container, $termType);
} | php | {
"resource": ""
} |
q240479 | Loader.ensureFileIsReadable | train | protected function ensureFileIsReadable()
{
$filePath = $this->filePath;
if (!is_readable($filePath) || !is_file($filePath)) {
throw new InvalidArgumentException(sprintf(
'Dotenv: Environment file .env not found or not readable. '.
'Create file with your e... | php | {
"resource": ""
} |
q240480 | Loader.normaliseEnvironmentVariable | train | protected function normaliseEnvironmentVariable($name, $value)
{
list($name, $value) = $this->splitCompoundStringIntoParts($name, $value);
return array($name, $value);
} | php | {
"resource": ""
} |
q240481 | Loader.readLinesFromFile | train | protected function readLinesFromFile($filePath)
{
// Read file into an array of lines with auto-detected line endings
$autodetect = ini_get('auto_detect_line_endings');
ini_set('auto_detect_line_endings', '1');
$lines = file($filePath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
... | php | {
"resource": ""
} |
q240482 | File.getName | train | public function getName( $suffix = NULL ) : string
{
$name = $suffix ? basename( $this->path, $suffix ) : basename( $this->path );
return $name;
} | php | {
"resource": ""
} |
q240483 | File.putContents | train | public function putContents( $contents, $ex_lock = false ) : int
{
$flags = $ex_lock ? LOCK_EX : 0;
$res = file_put_contents( $this->path, $contents, $flags );
if ($res === FALSE){
throw new FileOutputException($this);
}
return $res;
} | php | {
"resource": ""
} |
q240484 | File.rename | train | public function rename( $new_file )
{
$res = @rename( $this->path, $new_file->getPath() );
if ( $res === FALSE ){
throw new FileRenameException($this, $new_file);
}
} | php | {
"resource": ""
} |
q240485 | File.makeDirectory | train | public function makeDirectory( $mode = NULL )
{
$mode = $mode ? $mode : 0777;
if ( file_exists($this->path) ){
if ( is_file($this->path) ){
throw new MakeDirectoryException($this);
}
return;
}
$parent_dir = $this->getParent();
... | php | {
"resource": ""
} |
q240486 | File.listFiles | train | public function listFiles( $filter = NULL ) : array
{
$path = $this->path;
if ( !file_exists($path) ) return NULL;
if ( !is_readable($path) ) return NULL;
if ( is_file($path) ) return NULL;
$files = array();
$dh = opendir($path);
while( ($file_na... | php | {
"resource": ""
} |
q240487 | File.touch | train | public function touch( $time = NULL ) : bool
{
if ( $time === NULL ){
return touch( $this->path );
}
return touch( $this->path, $time );
} | php | {
"resource": ""
} |
q240488 | PermissionVoter.supportsAnyAttribute | train | private function supportsAnyAttribute($attributes)
{
foreach ($attributes as $attribute) {
if ($this->supportsAttribute($attribute)) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q240489 | PermissionVoter.getRouteRoles | train | private function getRouteRoles()
{
$router = $this->router;
$cache = $this->getConfigCacheFactory()->cache(
$this->options['cache_dir'].'/tenside_roles.php',
function (ConfigCacheInterface $cache) use ($router) {
$routes = $router->getRouteCollection();
... | php | {
"resource": ""
} |
q240490 | Raw.createNew | train | public function createNew(
int $sourceId,
string $collectionName,
array $data
) : array {
return $this->sendPost(
sprintf('/profiles/%s/raw', $this->userName),
[],
[
'source_id' => $sourceId,
'collection' => $collec... | php | {
"resource": ""
} |
q240491 | Raw.upsertOne | train | public function upsertOne(
int $sourceId,
string $collectionName,
array $data
) : array {
return $this->sendPut(
sprintf('/profiles/%s/raw', $this->userName),
[],
[
'source_id' => $sourceId,
'collection' => $collect... | php | {
"resource": ""
} |
q240492 | ClientBuilder.get | train | public function get($name, $throwAway = false)
{
$client = parent::get($name, $throwAway);
if ($client instanceof ApiKeyClientInterface) {
$client->setApiKey(self::$apiKey);
}
return $client;
} | php | {
"resource": ""
} |
q240493 | AdminProductItemFieldDataController.showAction | train | public function showAction(ProductItemFieldData $productitemfielddata)
{
$editForm = $this->createForm($this->get("amulen.shop.form.product.item.field.data"), $productitemfielddata, array(
'action' => $this->generateUrl('admin_productitemfielddata_update', array('id' => $productitemfielddata->ge... | php | {
"resource": ""
} |
q240494 | AdminProductItemFieldDataController.newAction | train | public function newAction()
{
$productitemfielddata = new ProductItemFieldData();
$form = $this->createForm($this->get("amulen.shop.form.product.item.field.data"), $productitemfielddata);
return array(
'productitemfielddata' => $productitemfielddata,
'form' => $form-... | php | {
"resource": ""
} |
q240495 | AdminProductItemFieldDataController.createAction | train | public function createAction(Request $request)
{
$productitemfielddata = new ProductItemFieldData();
$form = $this->createForm($this->get("amulen.shop.form.product.item.field.data"), $productitemfielddata);
if ($form->handleRequest($request)->isValid()) {
$em = $this->getDoctrine... | php | {
"resource": ""
} |
q240496 | AdminProductItemFieldDataController.updateAction | train | public function updateAction(ProductItemFieldData $productitemfielddata, Request $request)
{
$editForm = $this->createForm($this->get("amulen.shop.form.product.item.field.data"), $productitemfielddata, array(
'action' => $this->generateUrl('admin_productitemfielddata_update', array('id' => $prod... | php | {
"resource": ""
} |
q240497 | Router.route | train | public function route()
{
$batch = array();
foreach ($this->request->getCalls() as $call) {
$batch[] = $this->dispatch($call);
}
return $this->response->encode($batch);
} | php | {
"resource": ""
} |
q240498 | Router.dispatch | train | private function dispatch($call)
{
$path = $call->getAction();
$method = $call->getMethod();
$matches = preg_split('/(?=[A-Z])/',$path);
$route = strtolower(implode('/', $matches));
$route .= "/".$method;
$request = $this->app['request'];
$files = $this->f... | php | {
"resource": ""
} |
q240499 | Gdn_Session.CheckPermission | train | public function CheckPermission($Permission, $FullMatch = TRUE, $JunctionTable = '', $JunctionID = '') {
if (is_object($this->User)) {
if ($this->User->Banned || GetValue('Deleted', $this->User))
return FALSE;
elseif ($this->User->Admin)
return TRUE;
}
// All... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.