_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q236800
MongoDBRegistry.hydrateEntity
train
private function hydrateEntity($document) { $class = $this->entityClass; $reflectionClass = new \ReflectionClass(AbstractDocument::class); $entity = new $class(); if (!($entity instanceof AbstractDocument)) { throw new \Exception(sprintf('"%s" is not a subclass of "%s"',...
php
{ "resource": "" }
q236801
Breadcrumb.buildItem
train
protected function buildItem($position, array $item) { $position +=1; list($title, $aAttr, $liAttr) = $item; $base = $this->baseAttr; $esc = $this->escaper->attr; $meta = $base['meta']; $meta['content'] = $position; $liAttr = $esc(array_merge_recursive...
php
{ "resource": "" }
q236802
Breadcrumb.buildActive
train
protected function buildActive(array $active) { $active[2] = array_merge_recursive( $active[2], ['class' => 'active'] ); $this->buildItem(count($this->stack), $active); }
php
{ "resource": "" }
q236803
Breadcrumb.item
train
public function item($title, $uri = '#', $liAttr = []) { $this->stack[] = [ $this->escaper->html($title), ['href' => $uri], $liAttr, ]; return $this; }
php
{ "resource": "" }
q236804
Breadcrumb.rawItem
train
public function rawItem($title, $uri = '#', $liAttr = []) { $this->stack[] = [$title, ['href' => $uri], $liAttr]; return $this; }
php
{ "resource": "" }
q236805
Breadcrumb.items
train
public function items(array $items) { foreach ($items as $uri => $title) { list($title, $uri, $liAttr) = $this->fixData($uri, $title); $this->item($title, $uri, $liAttr); } return $this; }
php
{ "resource": "" }
q236806
Breadcrumb.rawItems
train
public function rawItems(array $items) { foreach ($items as $uri => $title) { list($title, $uri, $liAttr) = $this->fixData($uri, $title); $this->rawItem($title, $uri, $liAttr); } return $this; }
php
{ "resource": "" }
q236807
Breadcrumb.fixData
train
protected function fixData($uri, $title) { $liAttr = []; if (is_int($uri)) { $uri = '#'; } if (is_array($title)) { $liAttr = $title; $title = array_shift($liAttr); } return [$title, $uri, $liAttr]; }
php
{ "resource": "" }
q236808
Container.raw
train
public function raw($key) { if (!is_string($key)) { throw new \Calf\Exception\InvalidArgument('Key must be string.'); } if (!isset($this->_keys[$key])) { throw new \Calf\Exception\Runtime('Key doesn\'t exists: ' . $key); } return $this->_values[$key]; ...
php
{ "resource": "" }
q236809
AutogeneratedResponseTrait.generateAutomaticResponseContent
train
public function generateAutomaticResponseContent($code, $reasonPhrase, $title = null, $description = null) { if ($title === null) { $title = $code . ' ' . $reasonPhrase; } return sprintf($this->template, $title, $code, $reasonPhrase, $description); }
php
{ "resource": "" }
q236810
Route.addMethod
train
public function addMethod($method) { // Capitalise method $method = strtoupper($method); if (!in_array($method, self::$availableMethods)) { throw new InvalidArgumentException(sprintf('Invalid method for route with path "%s". Method must be one of: ' . implode(', ', self::$availa...
php
{ "resource": "" }
q236811
Repository.getAll
train
public function getAll() { $collection = new Collection; $keys = $this->database->keys($this->namespace.':*'); foreach ($keys as $key) { list($namespace, $name) = explode(':', $key); if ( ! $collection->has($name)) { $collection->put($name, $this->get($name)); } } return $collection; }
php
{ "resource": "" }
q236812
Repository.get
train
public function get($name) { $namespaced = $this->namespace.':'.$name; $queued = $this->length($namespaced, 'list'); $delayed = $this->length($namespaced.':delayed', 'zset'); $reserved = $this->length($namespaced.':reserved', 'zset'); return array('queued' => $queued, 'delayed' => $delayed, 'reserved' =...
php
{ "resource": "" }
q236813
Repository.getItems
train
public function getItems($name, $type) { $namespaced = $this->namespace.':'.$name; $key = ($type === 'queued') ? $namespaced : $namespaced.':'.$type; if ( ! $this->exists($key)) throw new QueueNotFoundException($key); $type = $this->type($key); $length = $this->length($key, $type); $method = 'get'.ucwo...
php
{ "resource": "" }
q236814
Repository.getListItems
train
protected function getListItems($key, $total, $offset = 0) { $items = array(); for ($i = $offset; $i < $total; $i++) { $items[$i] = $this->database->lindex($key, $i); } return $items; }
php
{ "resource": "" }
q236815
Repository.type
train
public function type($key) { if (Str::endsWith($key, ':queued')) { $key = str_replace(':queued', '', $key); } return $this->database->type($key); }
php
{ "resource": "" }
q236816
Repository.length
train
public function length($key, $type = null) { if (is_null($type)) $type = $this->type($key); switch ($type) { case 'list': return $this->database->llen($key); case 'zset': return $this->database->zcard($key); default: throw new UnexpectedValueException("List type '{$type}' not supported.")...
php
{ "resource": "" }
q236817
Repository.remove
train
public function remove($key, $value, $type = null) { if (is_null($type)) $type = $this->type($key); switch ($type) { case 'list': $key = str_replace(':queued', '', $key); $random = Str::quickRandom(64); $this->database->lset($key, $value, $random); return $this->database->lrem($key, 1, $...
php
{ "resource": "" }
q236818
Service.read
train
static public function read(Smd $smd, $classname) { $reflectedclass = new \ReflectionClass($classname); return self::isValid($smd, $reflectedclass) ? new Service($smd, $reflectedclass) : false; }
php
{ "resource": "" }
q236819
Service.isValid
train
static protected function isValid(Smd $smd, \ReflectionClass $reflectedclass) { $validator = $smd->getServiceValidator(); if ($validator && is_callable($validator)) { if ( call_user_func_array($validator, [$reflectedclass]) === false ) { return false; } ...
php
{ "resource": "" }
q236820
Service.toArrayPlain
train
protected function toArrayPlain() { $classname = $this->resolveClassname(); $methods = array(); foreach ($this->getMethods() as $method) { $method_fullname = $classname . '.' . $method->getName(); $methods[$method_fullname] = $method->toArray(); } retu...
php
{ "resource": "" }
q236821
Service.buildLevel
train
protected function buildLevel($classname) { $parts = explode('.', $classname); $lastLevel = &$this->methods; foreach ($parts as $part) { $lastLevel[$part] = array(); $lastLevel = &$lastLevel[$part]; } return $lastLevel; }
php
{ "resource": "" }
q236822
Service.toArrayTree
train
protected function toArrayTree() { $classname = $this->getDottedClassname(); $lastLevel = $this->buildLevel($classname); foreach ($this->getMethods() as $method) { $lastLevel[$method->getName()] = $method->toArray(); } return $this->methods; ...
php
{ "resource": "" }
q236823
Service.toArray
train
public function toArray() { $fn = 'toArray' . ucfirst($this->presentation); if (!method_exists($this, $fn)) { throw new \Exception('There is no method ' . $fn . '.'); } return $this->$fn(); }
php
{ "resource": "" }
q236824
StreamHandler.openStream
train
protected function openStream(/*# string */ $path) { if (is_string($path)) { if (false !== strpos($path, '://')) { $path = 'file://' . $path; } return fopen($path, 'a'); } return $path; }
php
{ "resource": "" }
q236825
File.prepare
train
public static function prepare($data, $forceWindows = false) { $lineBreak = "\n"; if (DS === '\\' || $forceWindows === true) { $lineBreak = "\r\n"; } return strtr($data, array("\r\n" => $lineBreak, "\n" => $lineBreak, "\r" => $lineBreak)); }
php
{ "resource": "" }
q236826
File.mime
train
public function mime() { if (!$this->exists()) { return false; } if (function_exists('finfo_open')) { $finfo = finfo_open(FILEINFO_MIME); $finfo = finfo_file($finfo, $this->pwd()); if (!$finfo) { return false; } ...
php
{ "resource": "" }
q236827
DemoCommandController.setupCommand
train
public function setupCommand() { $serverPublicKeyString = Files::getFileContents('resource://Flowpack.SingleSignOn.DemoInstance/Private/Fixtures/DemoServer.pub', FILE_TEXT); if ($serverPublicKeyString === FALSE) { $this->outputLine('Could not open resource://Flowpack.SingleSignOn.DemoInstance/Private/Fixtures/De...
php
{ "resource": "" }
q236828
Client.recv
train
public function recv() { // receive a message from the socket $message = $this->ws->receive(); // is the message is empty? if (empty($message)) { return; } // decode the message (json_decode + error checking) $message = $this->decodeMessage($message); // injest and route the message $this->in...
php
{ "resource": "" }
q236829
Client.suscribe
train
public function suscribe($events, Closure $handler) { if (is_string($events)) $events = [$events]; // store the handler for each of the events it represents foreach ($events as $event) { // check that we have a place to store the handler if (! array_key_exists($event, $this->handlers[static::MESSAGE_TYP...
php
{ "resource": "" }
q236830
Client.reply
train
public function reply($requestId, $replyClientId, Array $payload) { $m = $this->bareMessage(static::MESSAGE_TYPE_REPLY); $m->ReplyClientId = $replyClientId; $m->RequestId = $requestId; $m->Payload = $payload; $this->send($m); }
php
{ "resource": "" }
q236831
Client.request
train
public function request($requestClientId, Array $payload, Closure $handler) { // generate a new requestId $requestId = $this->uuid(); // store the handler $this->handlers[static::MESSAGE_TYPE_REPLY][$requestId] = $handler; $m = $this->bareMessage(static::MESSAGE_TYPE_REQUEST); $m->RequestClientId = $requ...
php
{ "resource": "" }
q236832
Client.emit
train
public function emit($event, Array $payload) { $m = $this->bareMessage(static::MESSAGE_TYPE_STANDARD); $m->Event = $event; $m->Payload = $payload; $this->send($m); }
php
{ "resource": "" }
q236833
Client.serverRequest
train
protected function serverRequest($path, $context) { if (strpos($path, '/') === 0) { $path = substr($path, 1); } $url = sprintf('http://%s/%s', $this->serverUrl, $path); $context = stream_context_create($context); $result = @file_get_contents($url, false, $context); if ($result === false) { thr...
php
{ "resource": "" }
q236834
Client.connectWs
train
protected function connectWs() { $wsUrl = sprintf('ws://%s/v1/clients/%s/ws', $this->serverUrl, $this->getId()); $this->ws = new WebsocketClient($wsUrl, ['timeout' => 30]); $this->ws->setTimeout(30); }
php
{ "resource": "" }
q236835
Client.bareMessage
train
protected function bareMessage($type) { $m = [ 'MessageType' => $type, 'Event' => null, 'RequestId' => null, 'ReplyClientId' => null, 'RequestClientId' => null, 'Payload' => [], 'Error' => null, ]; return (object) $m; }
php
{ "resource": "" }
q236836
Client.send
train
protected function send($message) { $message = $this->encodeMessage($message); $this->ws->send($message); }
php
{ "resource": "" }
q236837
Client.injest
train
protected function injest($message) { switch($message->MessageType) { case static::MESSAGE_TYPE_BROADCAST: $this->handleBroadcast($message); break; case static::MESSAGE_TYPE_STANDARD: $this->handleStandard($message); break; case static::MESSAGE_TYPE_REQUEST: $this->handleRequest($messa...
php
{ "resource": "" }
q236838
Client.handleReply
train
protected function handleReply($message) { // if we dont have a handler for this request, then something is wrong if (!array_key_exists($message->RequestId, $this->handlers[static::MESSAGE_TYPE_REPLY])) { throw new ClientException("Request handler not found"); } // handle the event $this->handlers[stat...
php
{ "resource": "" }
q236839
BaseRepository.getFirstWorkEmail
train
public function getFirstWorkEmail($id) { $people = $this->model->findOrfail($id); // The first email that is type "work" foreach ($people->email as $email) { if ($email->email_type_id == 3) { return $email->title; } } return "there is ...
php
{ "resource": "" }
q236840
BaseRepository.getFirstWorkTelephone
train
public function getFirstWorkTelephone($id) { $people = $this->model->findOrfail($id); // The first telephone number that is they type "work" foreach ($people->telephone as $telephone) { if ($telephone->telephone_type_id == 1) { return $telephone->title; ...
php
{ "resource": "" }
q236841
Base.setupBuildProperties
train
protected function setupBuildProperties(BuildInterface $build) { $project = $build->getProject(); $build->setProperty('project.name', $project->getName()); $build->setProperty('build.number', $build->getNumber()); $build->setProperty('build.label', $build->getLabel()); }
php
{ "resource": "" }
q236842
Base.validateTask
train
protected function validateTask($taskObject) { try { if (!$taskObject->validate($msg)) { $this->log->warn("Task {$taskObject->getName()} is invalid.". ($msg ? "\nError message: $msg" : '') ); return false; } ...
php
{ "resource": "" }
q236843
NickNameTrait.getNickName
train
public function getNickName() : ?string { if ( ! $this->hasNickName()) { $this->setNickName($this->getDefaultNickName()); } return $this->nickName; }
php
{ "resource": "" }
q236844
OngletObject.init
train
function init($idBuilder="0", $tabOnglets=array()) { $this->ongletsArray=$tabOnglets; $this->typeOngletsArray=array(); $this->optionsOngletParType = array(); $this->idOngletBuilder=$idBuilder; $this->largeurTotale=680; $this->largeurEtiquette=150; $this->numOn...
php
{ "resource": "" }
q236845
OngletObject.addContent
train
function addContent( $ongletName="default", $content="", $isSelected=false, $type="default", $optionsParType="" ) { $this->ongletsArray[$ongletName]=$content; $this->typeOngletsArray[$ongletName]=$type; $this->optionsOngletParType[$ongletName]=$optionsParType; ...
php
{ "resource": "" }
q236846
OngletObject.getHTMLNoDiv
train
function getHTMLNoDiv() { $html=""; if ($this->getCountOnglets()>0) { /* * Assignation des styles en dur : a changer à terme, * les styles sont les memes que pour le site en ligne * => a ajouter dans la feuille de style * */ ...
php
{ "resource": "" }
q236847
Editor.find
train
public function find($keyword, $comp = null, $type = self::FIND_TYPE_KEY_ONLY){ $this->_targetLineNumber = null; $items = $this->getTargetLines(); foreach ($items as $lineNumber => $line){ $line = trim(trim($line),','); $arr = explode('=>', $line); foreach ($a...
php
{ "resource": "" }
q236848
Editor.save
train
public function save(){ $this->_contentArray = array_merge($this->_codesBeforeEditArea, $this->_editArea, $this->_codesAfterEditArea); return $this; }
php
{ "resource": "" }
q236849
FormTagList.getName
train
protected static function getName( ElementInterface $element ) { $name = $element->getName(); if ( $name === null || $name === '' ) { throw new Exception\DomainException( sprintf( '%s requires that the element has an assigned name; none discovered', ...
php
{ "resource": "" }
q236850
Commands.startCommandsPlugin
train
protected function startCommandsPlugin($app) { $this->onRegister('commands', function ($app) { /** @var \Illuminate\Foundation\Application $app */ // Commands if ($app->runningInConsole()) { foreach ($this->findCommands as $path) { $dir...
php
{ "resource": "" }
q236851
Commands.findCommandsIn
train
protected function findCommandsIn($path, $recursive = false) { $classes = []; foreach ($this->findCommandsFiles($path) as $filePath) { //$class = $classFinder->findClass($filePath); $class = Util::getClassNameFromFile($filePath); if ($class !== null) { ...
php
{ "resource": "" }
q236852
Client.getEventTalks
train
public function getEventTalks($eventId, array $options = array()) { $talks = $this->runCommand( 'event.talks.get', array('eventId' => $eventId), $options ); return $this->assignIdsFromUri($talks); }
php
{ "resource": "" }
q236853
Client.factory
train
public static function factory($config = array()) { $defaults = array( 'base_url' => self::API_URL, 'version' => 'v2.1', 'command.params' => array( 'command.on_complete' => function($command) { $response = $command->getResult(); ...
php
{ "resource": "" }
q236854
Client.runCommand
train
protected function runCommand($command, array $defaultOptions = array(), array $options = array()) { $command = $this->getCommand($command, array_merge( $defaultOptions, $options )); $command->execute(); return $command->getResult(); }
php
{ "resource": "" }
q236855
Client.assignIdsFromUri
train
protected function assignIdsFromUri($entries) { foreach ($entries as &$entry) { $entry['id'] = (int) preg_replace('#.*?(\d+)$#', '$1', $entry['uri']); } return $entries; }
php
{ "resource": "" }
q236856
Helper.camelCase
train
public static function camelCase($str, $firstChar = 'lcfirst') { $str = str_replace(['-', '_', '.'], ' ', $str); $str = mb_convert_case($str, MB_CASE_TITLE); $str = str_replace(' ', '', $str); //ucwords('ghjkiol|ghjklo', "|"); if (!function_exists($firstChar)) { ...
php
{ "resource": "" }
q236857
Helper.base64Encode
train
public static function base64Encode($str, $stripEgal = true) { $str64 = base64_encode($str); if ($stripEgal) { return rtrim(strtr($str64, '+/', '-_'), '='); } return $str64; }
php
{ "resource": "" }
q236858
UrlGeneratorAwareTrait.path
train
public function path($route, $parameters = array()) { return $this->urlGenerator->generate($route, $parameters, UrlGeneratorInterface::ABSOLUTE_PATH); }
php
{ "resource": "" }
q236859
UrlGeneratorAwareTrait.url
train
public function url($route, $parameters = array()) { return $this->urlGenerator->generate($route, $parameters, UrlGeneratorInterface::ABSOLUTE_URL); }
php
{ "resource": "" }
q236860
InvalidArgumentException.invalidArgument
train
public static function invalidArgument( string $class, string $method, string $arg, \Exception $previous = null ): self { return new self( "invalid value of argument \"{$arg}\" in {$class}::{$method}", self::INVALID_ARGUMENT, $previous ...
php
{ "resource": "" }
q236861
RequireJsHelper.setBaseUrl
train
public function setBaseUrl($url, $replace = true) { if ($replace || !$this->baseUrl) { $this->baseUrl = $url; } return $this; }
php
{ "resource": "" }
q236862
RequireJsHelper.addModule
train
public function addModule($name, $location, $replace = false) { if ($name == '') { throw new exception\InvalidArgumentException('The require.js module name must not be empty'); } if ($replace || !isset($this->modules[$name])) { $this->modules[$name] = (string)$locati...
php
{ "resource": "" }
q236863
RequireJsHelper.addPackage
train
public function addPackage($name, $location = null, $main = null) { $name = (string)$name; if ($name == '') { throw new exception\InvalidArgumentException('The require.js package name must not be empty'); } if (!$location && !$main) { $this->packages[$name] ...
php
{ "resource": "" }
q236864
RequireJsHelper.addBundle
train
public function addBundle($name, array $deps) { if ($name == '') { throw new exception\InvalidArgumentException('The require.js bundle name must not be empty'); } $this->bundles[$name] = []; $this->addToBundle($name, $deps); return $this; }
php
{ "resource": "" }
q236865
RequireJsHelper.addToBundle
train
public function addToBundle($name, $deps) { if ($name == '') { throw new exception\InvalidArgumentException('The require.js bundle name must not be empty'); } if (!is_array($deps) && !($deps instanceof \Traversable)) { $deps = [ $deps ]; } if (!isset...
php
{ "resource": "" }
q236866
MongoDbConnection.connectionString
train
public function connectionString() { if (empty($this->username) || empty($this->password)) { return sprintf( "mongodb://%s:%d/%s", $this->host, $this->port, $this->db ); } return sprintf( "mon...
php
{ "resource": "" }
q236867
Apc._key
train
private function _key($identifier) { extract($identifier); $arg_string = ""; return md5(serialize($class . $method . implode('~', $args))); }
php
{ "resource": "" }
q236868
NumericBuilder.isNegative
train
public function isNegative( $binaryString ){ $firstBit = $binaryString[0]; $negativeFlag = $firstBit & "\x80"; $isNegative = ord($negativeFlag) == 128; return $isNegative; }
php
{ "resource": "" }
q236869
NumericBuilder.addOneToBytePreserveCarry
train
public function addOneToBytePreserveCarry($currentByte, &$carry) { for( $i = 0; $i < 8; $i++ ){ $bitMaskValue = pow( 2, $i ); $mask = chr( $bitMaskValue ); $filteredBit = $currentByte & $mask; if( $carry == 1 && ord( $filteredBit ) == 0 ){ $current...
php
{ "resource": "" }
q236870
Importer.import
train
public static function import() { if (count(func_get_args()) >= 2 && func_get_arg(1) !== null) { extract(func_get_arg(1)); } if (count(func_get_args()) < 3 || func_get_arg(2) === true) { $exports = require func_get_arg(0); } else ...
php
{ "resource": "" }
q236871
Serpent.init
train
public function init($namespace) { // extract template path from class namespace $namespace = trim($namespace, '\\'); $namespace_array = explode('\\', $namespace); $this->template_path = implode('/', array_slice($namespace_array, 1, 2)); $this->template_path .= '/templates/'; // get template name from temp...
php
{ "resource": "" }
q236872
SkillVersionTableMap.doDelete
train
public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SkillVersionTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $cr...
php
{ "resource": "" }
q236873
SkillVersionTableMap.doInsert
train
public static function doInsert($criteria, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SkillVersionTableMap::DATABASE_NAME); } if ($criteria instanceof Criteria) { $criteria = clone $criteria; // re...
php
{ "resource": "" }
q236874
Editbox.addAction
train
public function addAction(Action $action): Editbox { switch ($action->getType()) { case Action::SAVE: $this->actions[0] = $action; break; case Action::CANCEL: $this->actions[1] = $action; break; case Actio...
php
{ "resource": "" }
q236875
Editbox.&
train
public function &createAction(string $type, string $text, string $href = '', bool $ajax = false, string $confirm = ''): Action { $action = new Action(); $action->setType($type); $action->setText($text); if (!empty($href)) { $action->setHref($href); } $a...
php
{ "resource": "" }
q236876
Editbox.generateActions
train
public function generateActions(array $actions): Editbox { foreach ($actions as $action) { $action_object = new Action(); if (empty($action['type'])) { $action['type'] = 'context'; } $action_object->setType($action['type']); if ...
php
{ "resource": "" }
q236877
QueryBuilder.getFilter
train
public function getFilter(string $fieldName): ?Condition { [$name, $filters] = $this->getArrayAndKeyName($fieldName, 'filters'); return array_first($filters, function ($filter) use ($name) { return $filter->getName() === $name; }); }
php
{ "resource": "" }
q236878
QueryBuilder.getSort
train
public function getSort($sortName): ?OrderBy { [$name, $sorts] = $this->getArrayAndKeyName($sortName, 'sorts'); return array_first($sorts, function ($sort) use ($name) { return $sort->getName() === $name; }); }
php
{ "resource": "" }
q236879
QueryBuilder.where
train
public function where(string $key, string $operation, $value) { if (str_contains($key, '.')) { $fullPath = explode('.', $key); $relationPath = implode('.', array_slice($fullPath, 0, -1)); $relationKey = last($fullPath); $result ...
php
{ "resource": "" }
q236880
QueryBuilder.orderBy
train
public function orderBy(string $key, string $direction) { if (str_contains($key, '.')) { $fullPath = explode('.', $key); $relationPath = implode('.', array_slice($fullPath, 0, -1)); $relationKey = last($fullPath); $result = array...
php
{ "resource": "" }
q236881
QueryBuilder.applyFilters
train
public function applyFilters(Builder $query, string $alias = null) { foreach ($this->getFilters() as $filter) { $filter->apply($query, $alias); } }
php
{ "resource": "" }
q236882
QueryBuilder.applyRelationFilters
train
public function applyRelationFilters(string $relationName, string $alias, Builder $query) { foreach ($this->getRelationFilters($relationName) as $filter) { $filter->apply($query, $alias); } }
php
{ "resource": "" }
q236883
QueryBuilder.applySorts
train
public function applySorts(Builder $query, string $alias = null) { foreach ($this->getSorts() as $sort) { $sort->apply($query, $alias); } }
php
{ "resource": "" }
q236884
QueryBuilder.applyRelationSorts
train
public function applyRelationSorts(string $relationName, string $alias, Builder $query) { foreach ($this->getRelationSorts($relationName) as $sorts) { $sorts->apply($query, $alias); } }
php
{ "resource": "" }
q236885
QueryBuilder.getArrayAndKeyName
train
protected function getArrayAndKeyName(string $fieldName, string $key): array { if (!in_array($key, ['filters', 'sorts'], true)) { throw new InvalidArgumentException('Key must be one of [filters, sorts]'); } if (str_contains($fieldName, '.')) { $path = explode(...
php
{ "resource": "" }
q236886
PlatformAdminConsoleApplication.getResolvedArtisanCommand
train
public function getResolvedArtisanCommand(InputInterface $input = null) { $name = $this->getCommandName($input); try { $command = $this->find($name); } catch (Exception $e) { EventLog::logError('command.notFound', $e, ['name' => $name]); return null; }...
php
{ "resource": "" }
q236887
Config.toArray
train
public function toArray($recursive = true) { $array = []; $data = $this->data; /** @var self $value */ foreach ($data as $key => $value) { if ($recursive && $value instanceof self) { $array[$key] = $value->toArray(); } else { ...
php
{ "resource": "" }
q236888
Config._convertedValue
train
private function _convertedValue($value, $key, $prefix) { if($this->getTransformsToConfig()) { if(is_iterable($value)) $value = new static($value, $prefix ? "$prefix.$key" : $key, true); } return $value; }
php
{ "resource": "" }
q236889
Factory.createWriter
train
public static function createWriter($type) { switch ($type) { case self::JSON: return new Impl\Json(); case self::YAML: return new Impl\Yaml(); case self::INI: return new Impl\Ini(); case self::COLUMNS: ...
php
{ "resource": "" }
q236890
Factory.supportedTypes
train
public static function supportedTypes() { return [ self::YAML, self::JSON, self::INI, self::COLUMNS, self::TABLE, self::MARKDOWN, self::DUMP ]; }
php
{ "resource": "" }
q236891
IncassoAccount.setHolder
train
public function setHolder($holder) { if(!is_string($holder) || strlen(trim($holder)) == 0) throw new InvalidArgumentException(__METHOD__ . '; Invalid holder, must be a non empty string'); $this->holder = $holder; }
php
{ "resource": "" }
q236892
IncassoAccount.setNumber
train
public function setNumber($number) { if(!is_string($number) || strlen(trim($number)) == 0) throw new InvalidArgumentException(__METHOD__ . '; Invalid number, must be a non empty string'); $this->number = $number; }
php
{ "resource": "" }
q236893
IncassoAccount.setCity
train
public function setCity($city) { if(!is_string($city) || strlen(trim($city)) == 0) throw new InvalidArgumentException(__METHOD__ . '; Invalid city, must be a non empty string'); $this->city = $city; }
php
{ "resource": "" }
q236894
ModularRouter.getRouteCollectionForType
train
public function getRouteCollectionForType($type) { if (isset($this->collections[$type])) { return $this->collections[$type]; } if (!$this->metadataFactory->hasMetadataFor($type)) { throw new ResourceNotFoundException(sprintf('No metadata found for module type "%s".',...
php
{ "resource": "" }
q236895
ModularRouter.getGeneratorForModule
train
public function getGeneratorForModule(ModuleInterface $module) { $type = $module->getModularType(); $collection = $this->getRouteCollectionForType($type); if (array_key_exists($type, $this->generators)) { return $this->generators[$type]; } if (null === $th...
php
{ "resource": "" }
q236896
ModularRouter.getModuleByRequest
train
public function getModuleByRequest(Request $request) { $parameters = $this->getInitialMatcher()->matchRequest($request); // Since a matcher throws an exception on failure, this will only be reached // if the match was successful. return $this->provider->loadModuleByRequest($request...
php
{ "resource": "" }
q236897
ModularRouter.getInitialMatcher
train
public function getInitialMatcher() { if (null !== $this->initialMatcher) { return $this->initialMatcher; } $route = sprintf('%s/{_modular_path}', $this->routePrefix['path']); $collection = new RouteCollection; $collection->add('modular', new Route( ...
php
{ "resource": "" }
q236898
FileLogger.getLogFileName
train
private function getLogFileName() : string { $file_name = $this->file_name; if ($this->filename_processor){ $file_name = $this->filename_processor->process($file_name); } $file_name = self::escapeFileName($file_name); return $file_name; }
php
{ "resource": "" }
q236899
Router._initialize
train
protected function _initialize(){ // Fetch the complete URI string $this->uri->_fetch_uri_string(); // Do we need to remove the URL suffix? $this->uri->_remove_url_suffix(); // Compile the segments into an array $this->uri->_explode_segments(); // Set Segments $this->segments = $this->uri->segment...
php
{ "resource": "" }