repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
alexpts/psr15-middlewares
src/StaticHeader.php
StaticHeader.withStaticHeaders
protected function withStaticHeaders(ResponseInterface $response, array $headers): ResponseInterface { foreach ($headers as $name => $header) { $response = $response->withAddedHeader($name, $header); } return $response; }
php
protected function withStaticHeaders(ResponseInterface $response, array $headers): ResponseInterface { foreach ($headers as $name => $header) { $response = $response->withAddedHeader($name, $header); } return $response; }
[ "protected", "function", "withStaticHeaders", "(", "ResponseInterface", "$", "response", ",", "array", "$", "headers", ")", ":", "ResponseInterface", "{", "foreach", "(", "$", "headers", "as", "$", "name", "=>", "$", "header", ")", "{", "$", "response", "=",...
@param ResponseInterface $response @param array $headers - header is array of values or string value @return ResponseInterface @throws \InvalidArgumentException
[ "@param", "ResponseInterface", "$response", "@param", "array", "$headers", "-", "header", "is", "array", "of", "values", "or", "string", "value" ]
train
https://github.com/alexpts/psr15-middlewares/blob/bff2887d5af01c54d9288fd19c20f0f593b69358/src/StaticHeader.php#L43-L50
WebDevTmas/date-repetition
src/DateRepetition/DailyDateRepetition.php
DailyDateRepetition.newFromTimeString
public static function newFromTimeString($timeString) { try { $dateTime = new DateTime($timeString); } catch(\Exception $e) { throw new InvalidArgumentException('Time string must be valid, see DateTime for documentation'); } return new self($dateTime->format('G'), $dateTime-...
php
public static function newFromTimeString($timeString) { try { $dateTime = new DateTime($timeString); } catch(\Exception $e) { throw new InvalidArgumentException('Time string must be valid, see DateTime for documentation'); } return new self($dateTime->format('G'), $dateTime-...
[ "public", "static", "function", "newFromTimeString", "(", "$", "timeString", ")", "{", "try", "{", "$", "dateTime", "=", "new", "DateTime", "(", "$", "timeString", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "throw", "new", "Inv...
Creates new DailyDateRepetition from string readable by DateTime @param string time string @return DailyDateRepetition
[ "Creates", "new", "DailyDateRepetition", "from", "string", "readable", "by", "DateTime" ]
train
https://github.com/WebDevTmas/date-repetition/blob/3ebd59f4ab3aab4b7497ebd767a57fad08277c6d/src/DateRepetition/DailyDateRepetition.php#L34-L42
WebDevTmas/date-repetition
src/DateRepetition/DailyDateRepetition.php
DailyDateRepetition.setHour
public function setHour($hour) { if(! in_array($hour, range(0, 23))) { throw new InvalidArgumentException('Hour must be between 0 and 23'); } $this->hour = $hour; return $this; }
php
public function setHour($hour) { if(! in_array($hour, range(0, 23))) { throw new InvalidArgumentException('Hour must be between 0 and 23'); } $this->hour = $hour; return $this; }
[ "public", "function", "setHour", "(", "$", "hour", ")", "{", "if", "(", "!", "in_array", "(", "$", "hour", ",", "range", "(", "0", ",", "23", ")", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Hour must be between 0 and 23'", ")", ";"...
Sets hour of repetition @param integer hour @return this
[ "Sets", "hour", "of", "repetition" ]
train
https://github.com/WebDevTmas/date-repetition/blob/3ebd59f4ab3aab4b7497ebd767a57fad08277c6d/src/DateRepetition/DailyDateRepetition.php#L60-L67
alexpts/psr15-middlewares
src/PhpInputToBody.php
PhpInputToBody.process
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface { $body = $this->parseBody($request); $parsedBody = $request->getParsedBody(); $request = $request->withParsedBody(array_merge($body, $parsedBody)); return $handler->hand...
php
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface { $body = $this->parseBody($request); $parsedBody = $request->getParsedBody(); $request = $request->withParsedBody(array_merge($body, $parsedBody)); return $handler->hand...
[ "public", "function", "process", "(", "ServerRequestInterface", "$", "request", ",", "RequestHandlerInterface", "$", "handler", ")", ":", "ResponseInterface", "{", "$", "body", "=", "$", "this", "->", "parseBody", "(", "$", "request", ")", ";", "$", "parsedBod...
@param ServerRequestInterface $request @param RequestHandlerInterface $handler @return ResponseInterface @throws \InvalidArgumentException @throws \RuntimeException
[ "@param", "ServerRequestInterface", "$request", "@param", "RequestHandlerInterface", "$handler" ]
train
https://github.com/alexpts/psr15-middlewares/blob/bff2887d5af01c54d9288fd19c20f0f593b69358/src/PhpInputToBody.php#L22-L30
alexpts/psr15-middlewares
src/PhpInputToBody.php
PhpInputToBody.parseBody
protected function parseBody(ServerRequestInterface $request): array { $body = []; parse_str($request->getBody()->getContents(), $body); return $body; }
php
protected function parseBody(ServerRequestInterface $request): array { $body = []; parse_str($request->getBody()->getContents(), $body); return $body; }
[ "protected", "function", "parseBody", "(", "ServerRequestInterface", "$", "request", ")", ":", "array", "{", "$", "body", "=", "[", "]", ";", "parse_str", "(", "$", "request", "->", "getBody", "(", ")", "->", "getContents", "(", ")", ",", "$", "body", ...
@param ServerRequestInterface $request @return array @throws \RuntimeException
[ "@param", "ServerRequestInterface", "$request" ]
train
https://github.com/alexpts/psr15-middlewares/blob/bff2887d5af01c54d9288fd19c20f0f593b69358/src/PhpInputToBody.php#L39-L45
bigpaulie/yii2-fancybox
src/Widget.php
Widget.registerScripts
protected function registerScripts(\yii\web\View $view){ if ($this->clientOptions !== false) { $options = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions); $js = "jQuery('#{$this->id}').fancybox($options);"; $view->registerJs($js , View::POS_READY); ...
php
protected function registerScripts(\yii\web\View $view){ if ($this->clientOptions !== false) { $options = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions); $js = "jQuery('#{$this->id}').fancybox($options);"; $view->registerJs($js , View::POS_READY); ...
[ "protected", "function", "registerScripts", "(", "\\", "yii", "\\", "web", "\\", "View", "$", "view", ")", "{", "if", "(", "$", "this", "->", "clientOptions", "!==", "false", ")", "{", "$", "options", "=", "empty", "(", "$", "this", "->", "clientOption...
Register scripts @param View $view
[ "Register", "scripts" ]
train
https://github.com/bigpaulie/yii2-fancybox/blob/a961789a9ab94b0ebb129f3c6c57489d1298525b/src/Widget.php#L41-L47
czim/laravel-pxlcms
src/Generator/Analyzer/Steps/AnalyzeModels.php
AnalyzeModels.processModule
protected function processModule($moduleId, array $moduleData) { $this->resetTemporaryModelCache(); // fill cache with current module's data $this->moduleId = $moduleId; $this->module = $moduleData; // set default model data $this->model = [ 'module' ...
php
protected function processModule($moduleId, array $moduleData) { $this->resetTemporaryModelCache(); // fill cache with current module's data $this->moduleId = $moduleId; $this->module = $moduleData; // set default model data $this->model = [ 'module' ...
[ "protected", "function", "processModule", "(", "$", "moduleId", ",", "array", "$", "moduleData", ")", "{", "$", "this", "->", "resetTemporaryModelCache", "(", ")", ";", "// fill cache with current module's data", "$", "this", "->", "moduleId", "=", "$", "moduleId"...
Process a single module (to model) @param int $moduleId @param array $moduleData @throws Exception
[ "Process", "a", "single", "module", "(", "to", "model", ")" ]
train
https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Analyzer/Steps/AnalyzeModels.php#L85-L148
czim/laravel-pxlcms
src/Generator/Analyzer/Steps/AnalyzeModels.php
AnalyzeModels.processModuleSorting
protected function processModuleSorting() { $this->model['is_listified'] = false; $this->model['ordered_by'] = []; // if there can be only 1 entry, it makes no sense to listify or order in any case if ($this->module['max_entries'] == 1) { return; } // ...
php
protected function processModuleSorting() { $this->model['is_listified'] = false; $this->model['ordered_by'] = []; // if there can be only 1 entry, it makes no sense to listify or order in any case if ($this->module['max_entries'] == 1) { return; } // ...
[ "protected", "function", "processModuleSorting", "(", ")", "{", "$", "this", "->", "model", "[", "'is_listified'", "]", "=", "false", ";", "$", "this", "->", "model", "[", "'ordered_by'", "]", "=", "[", "]", ";", "// if there can be only 1 entry, it makes no sen...
Determines and stores information about the sorting configuration found for entries of the module
[ "Determines", "and", "stores", "information", "about", "the", "sorting", "configuration", "found", "for", "entries", "of", "the", "module" ]
train
https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Analyzer/Steps/AnalyzeModels.php#L181-L218
czim/laravel-pxlcms
src/Generator/Analyzer/Steps/AnalyzeModels.php
AnalyzeModels.prepareModelOverrides
protected function prepareModelOverrides() { $this->overrides = $this->getOverrideConfigForModel($this->moduleId); // determine name to use, handle pluralization and check database table override if (array_key_exists('name', $this->overrides)) { $name = $this->overrides['name']...
php
protected function prepareModelOverrides() { $this->overrides = $this->getOverrideConfigForModel($this->moduleId); // determine name to use, handle pluralization and check database table override if (array_key_exists('name', $this->overrides)) { $name = $this->overrides['name']...
[ "protected", "function", "prepareModelOverrides", "(", ")", "{", "$", "this", "->", "overrides", "=", "$", "this", "->", "getOverrideConfigForModel", "(", "$", "this", "->", "moduleId", ")", ";", "// determine name to use, handle pluralization and check database table ove...
Prepares override cache for current model being assembled
[ "Prepares", "override", "cache", "for", "current", "model", "being", "assembled" ]
train
https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Analyzer/Steps/AnalyzeModels.php#L223-L279
czim/laravel-pxlcms
src/Generator/Analyzer/Steps/AnalyzeModels.php
AnalyzeModels.processModuleFields
protected function processModuleFields() { $overrideCasts = array_get($this->overrides, 'attributes.casts', []); $removeCasts = array_get($this->overrides, 'attributes.casts-remove', []); foreach ($this->module['fields'] as $fieldId => $fieldData) { $attributeName = $this->n...
php
protected function processModuleFields() { $overrideCasts = array_get($this->overrides, 'attributes.casts', []); $removeCasts = array_get($this->overrides, 'attributes.casts-remove', []); foreach ($this->module['fields'] as $fieldId => $fieldData) { $attributeName = $this->n...
[ "protected", "function", "processModuleFields", "(", ")", "{", "$", "overrideCasts", "=", "array_get", "(", "$", "this", "->", "overrides", ",", "'attributes.casts'", ",", "[", "]", ")", ";", "$", "removeCasts", "=", "array_get", "(", "$", "this", "->", "o...
Processes field data from the module
[ "Processes", "field", "data", "from", "the", "module" ]
train
https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Analyzer/Steps/AnalyzeModels.php#L284-L559
czim/laravel-pxlcms
src/Generator/Analyzer/Steps/AnalyzeModels.php
AnalyzeModels.applyOverridesForRelationships
protected function applyOverridesForRelationships() { $overrides = array_get($this->overrides, 'relationships'); if (empty($overrides)) return; $removeRelations = []; foreach ($overrides as $overrideName => $override) { // find the relationship foreach (['...
php
protected function applyOverridesForRelationships() { $overrides = array_get($this->overrides, 'relationships'); if (empty($overrides)) return; $removeRelations = []; foreach ($overrides as $overrideName => $override) { // find the relationship foreach (['...
[ "protected", "function", "applyOverridesForRelationships", "(", ")", "{", "$", "overrides", "=", "array_get", "(", "$", "this", "->", "overrides", ",", "'relationships'", ")", ";", "if", "(", "empty", "(", "$", "overrides", ")", ")", "return", ";", "$", "r...
Applies overrides set in the config for analyzed relationships
[ "Applies", "overrides", "set", "in", "the", "config", "for", "analyzed", "relationships" ]
train
https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Analyzer/Steps/AnalyzeModels.php#L564-L618
czim/laravel-pxlcms
src/Generator/Analyzer/Steps/AnalyzeModels.php
AnalyzeModels.generateReversedRelationships
protected function generateReversedRelationships() { foreach ($this->context->output['models'] as $modelFromKey => $modelFrom) { foreach ($modelFrom['relationships']['normal'] as $relationName => $relationship) { // skip negative references for now, don't reverse them ...
php
protected function generateReversedRelationships() { foreach ($this->context->output['models'] as $modelFromKey => $modelFrom) { foreach ($modelFrom['relationships']['normal'] as $relationName => $relationship) { // skip negative references for now, don't reverse them ...
[ "protected", "function", "generateReversedRelationships", "(", ")", "{", "foreach", "(", "$", "this", "->", "context", "->", "output", "[", "'models'", "]", "as", "$", "modelFromKey", "=>", "$", "modelFrom", ")", "{", "foreach", "(", "$", "modelFrom", "[", ...
Generates model data for reversed relationships, for all available models
[ "Generates", "model", "data", "for", "reversed", "relationships", "for", "all", "available", "models" ]
train
https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Analyzer/Steps/AnalyzeModels.php#L624-L773
czim/laravel-pxlcms
src/Generator/Analyzer/Steps/AnalyzeModels.php
AnalyzeModels.multipleBelongsToRelationsBetweenModels
protected function multipleBelongsToRelationsBetweenModels($fromModuleId, $toModuleId) { $count = 0; foreach ($this->context->output['models'][ $fromModuleId ]['relationships']['normal'] as $relationship) { if ( $relationship['model'] == $toModuleId && $relationship...
php
protected function multipleBelongsToRelationsBetweenModels($fromModuleId, $toModuleId) { $count = 0; foreach ($this->context->output['models'][ $fromModuleId ]['relationships']['normal'] as $relationship) { if ( $relationship['model'] == $toModuleId && $relationship...
[ "protected", "function", "multipleBelongsToRelationsBetweenModels", "(", "$", "fromModuleId", ",", "$", "toModuleId", ")", "{", "$", "count", "=", "0", ";", "foreach", "(", "$", "this", "->", "context", "->", "output", "[", "'models'", "]", "[", "$", "fromMo...
Returns whether there are multiple relationships from one model to the other @param int $fromModuleId @param int $toModuleId @return bool
[ "Returns", "whether", "there", "are", "multiple", "relationships", "from", "one", "model", "to", "the", "other" ]
train
https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Analyzer/Steps/AnalyzeModels.php#L783-L798
czim/laravel-pxlcms
src/Generator/Analyzer/Steps/AnalyzeModels.php
AnalyzeModels.getImageResizesForField
protected function getImageResizesForField($fieldId) { if ( ! array_key_exists('resizes', $this->data->rawData['fields'][ $fieldId ]) || ! count($this->data->rawData['fields'][ $fieldId ]['resizes']) ) { return []; } $resizes = []; foreach ($this...
php
protected function getImageResizesForField($fieldId) { if ( ! array_key_exists('resizes', $this->data->rawData['fields'][ $fieldId ]) || ! count($this->data->rawData['fields'][ $fieldId ]['resizes']) ) { return []; } $resizes = []; foreach ($this...
[ "protected", "function", "getImageResizesForField", "(", "$", "fieldId", ")", "{", "if", "(", "!", "array_key_exists", "(", "'resizes'", ",", "$", "this", "->", "data", "->", "rawData", "[", "'fields'", "]", "[", "$", "fieldId", "]", ")", "||", "!", "cou...
Returns data about resizes for an image field @param int $fieldId @return array
[ "Returns", "data", "about", "resizes", "for", "an", "image", "field" ]
train
https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Analyzer/Steps/AnalyzeModels.php#L806-L833
czim/laravel-pxlcms
src/Generator/Analyzer/Steps/AnalyzeModels.php
AnalyzeModels.checkForReservedClassName
protected function checkForReservedClassName($name) { $name = trim(strtolower($name)); if (in_array($name, config('pxlcms.generator.reserved', []))) { throw new \InvalidArgumentException("Cannot use {$name} as a module name, it is reserved!"); } }
php
protected function checkForReservedClassName($name) { $name = trim(strtolower($name)); if (in_array($name, config('pxlcms.generator.reserved', []))) { throw new \InvalidArgumentException("Cannot use {$name} as a module name, it is reserved!"); } }
[ "protected", "function", "checkForReservedClassName", "(", "$", "name", ")", "{", "$", "name", "=", "trim", "(", "strtolower", "(", "$", "name", ")", ")", ";", "if", "(", "in_array", "(", "$", "name", ",", "config", "(", "'pxlcms.generator.reserved'", ",",...
Checks whether a given name is on the reserved list @param string $name
[ "Checks", "whether", "a", "given", "name", "is", "on", "the", "reserved", "list" ]
train
https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Analyzer/Steps/AnalyzeModels.php#L840-L847
czim/laravel-pxlcms
src/Generator/Analyzer/Steps/AnalyzeModels.php
AnalyzeModels.dutchSingularize
protected function dutchSingularize($name) { if (empty($this->dutchHelper)) return $name; return $this->dutchHelper->singularize($name); }
php
protected function dutchSingularize($name) { if (empty($this->dutchHelper)) return $name; return $this->dutchHelper->singularize($name); }
[ "protected", "function", "dutchSingularize", "(", "$", "name", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "dutchHelper", ")", ")", "return", "$", "name", ";", "return", "$", "this", "->", "dutchHelper", "->", "singularize", "(", "$", "name", ...
Singularizes a noun/name for Dutch content @param string $name @return string
[ "Singularizes", "a", "noun", "/", "name", "for", "Dutch", "content" ]
train
https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Analyzer/Steps/AnalyzeModels.php#L866-L871
czim/laravel-pxlcms
src/Generator/Analyzer/Steps/AnalyzeModels.php
AnalyzeModels.dutchPluralize
protected function dutchPluralize($name) { if (empty($this->dutchHelper)) return $name; return $this->dutchHelper->pluralize($name); }
php
protected function dutchPluralize($name) { if (empty($this->dutchHelper)) return $name; return $this->dutchHelper->pluralize($name); }
[ "protected", "function", "dutchPluralize", "(", "$", "name", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "dutchHelper", ")", ")", "return", "$", "name", ";", "return", "$", "this", "->", "dutchHelper", "->", "pluralize", "(", "$", "name", ")"...
Pluralizes a noun/name for Dutch content @param string $name @return string
[ "Pluralizes", "a", "noun", "/", "name", "for", "Dutch", "content" ]
train
https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Analyzer/Steps/AnalyzeModels.php#L879-L884
ellipsephp/container
src/Container/CompositeServiceFactory.php
CompositeServiceFactory.extended
private function extended(callable $previous = null, callable $current): callable { return is_null($previous) ? $current : new Extension($current, $previous); }
php
private function extended(callable $previous = null, callable $current): callable { return is_null($previous) ? $current : new Extension($current, $previous); }
[ "private", "function", "extended", "(", "callable", "$", "previous", "=", "null", ",", "callable", "$", "current", ")", ":", "callable", "{", "return", "is_null", "(", "$", "previous", ")", "?", "$", "current", ":", "new", "Extension", "(", "$", "current...
Return the previous service factory extended with the current service factory. @param callable $previous @param callable $current @return callable
[ "Return", "the", "previous", "service", "factory", "extended", "with", "the", "current", "service", "factory", "." ]
train
https://github.com/ellipsephp/container/blob/ae0836b071fa1751f41b50fc33e3196fcbced6bf/src/Container/CompositeServiceFactory.php#L47-L50
bfitech/zapcore
src/Header.php
Header.get_header_string
final public static function get_header_string(int $code) { if (!isset(self::$header_string[$code])) $code = 404; return [ 'code' => $code, 'msg' => self::$header_string[$code], ]; }
php
final public static function get_header_string(int $code) { if (!isset(self::$header_string[$code])) $code = 404; return [ 'code' => $code, 'msg' => self::$header_string[$code], ]; }
[ "final", "public", "static", "function", "get_header_string", "(", "int", "$", "code", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "header_string", "[", "$", "code", "]", ")", ")", "$", "code", "=", "404", ";", "return", "[", "'code'",...
Get HTTP code. @param int $code HTTP code. @return array A dict containing code and message if `$code` is valid, 404 dict otherwise.
[ "Get", "HTTP", "code", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Header.php#L76-L83
bfitech/zapcore
src/Header.php
Header.start_header
public static function start_header( int $code=200, int $cache=0, array $headers=[] ) { $msg = 'OK'; extract(self::get_header_string($code)); $proto = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1'; static::header("$proto $code $msg"); if ($cache) { $cache = intval($ca...
php
public static function start_header( int $code=200, int $cache=0, array $headers=[] ) { $msg = 'OK'; extract(self::get_header_string($code)); $proto = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1'; static::header("$proto $code $msg"); if ($cache) { $cache = intval($ca...
[ "public", "static", "function", "start_header", "(", "int", "$", "code", "=", "200", ",", "int", "$", "cache", "=", "0", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "msg", "=", "'OK'", ";", "extract", "(", "self", "::", "get_header_...
Start sending response headers. @param int $code HTTP code. @param int $cache Cache age, 0 for no cache. @param array $headers Additional headers.
[ "Start", "sending", "response", "headers", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Header.php#L144-L174
bfitech/zapcore
src/Header.php
Header.send_file
public static function send_file( string $fpath, $disposition=null, int $code=200, int $cache=0, array $headers=[], bool $xsendfile=null, callable $callback_notfound=null ) { if (!file_exists($fpath) || is_dir($fpath)) { static::start_header(404, 0, $headers); if (is_callable($callback_notfound)) { ...
php
public static function send_file( string $fpath, $disposition=null, int $code=200, int $cache=0, array $headers=[], bool $xsendfile=null, callable $callback_notfound=null ) { if (!file_exists($fpath) || is_dir($fpath)) { static::start_header(404, 0, $headers); if (is_callable($callback_notfound)) { ...
[ "public", "static", "function", "send_file", "(", "string", "$", "fpath", ",", "$", "disposition", "=", "null", ",", "int", "$", "code", "=", "200", ",", "int", "$", "cache", "=", "0", ",", "array", "$", "headers", "=", "[", "]", ",", "bool", "$", ...
Send file. Using higher-level Route::static_file_default is enough for standard usage. Wrap this in Route::static_file_custom to make a more elaborate static file serving instead of calling it directly. @param string $fpath Path to file. @param mixed $disposition If set as string, this will be used as filename on con...
[ "Send", "file", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Header.php#L201-L236
bfitech/zapcore
src/Header.php
Header.print_json
final public static function print_json( int $errno=0, $data=null, int $http_code=200, int $cache=0 ) { $json = json_encode(compact('errno', 'data')); self::start_header($http_code, $cache, [ 'Content-Length: ' . strlen($json), 'Content-Type: application/json', ]); static::halt($json); }
php
final public static function print_json( int $errno=0, $data=null, int $http_code=200, int $cache=0 ) { $json = json_encode(compact('errno', 'data')); self::start_header($http_code, $cache, [ 'Content-Length: ' . strlen($json), 'Content-Type: application/json', ]); static::halt($json); }
[ "final", "public", "static", "function", "print_json", "(", "int", "$", "errno", "=", "0", ",", "$", "data", "=", "null", ",", "int", "$", "http_code", "=", "200", ",", "int", "$", "cache", "=", "0", ")", "{", "$", "json", "=", "json_encode", "(", ...
Convenience method for JSON response. @param int $errno Error number to return. @param array $data Data to return. @param int $http_code Valid HTTP response code. @param int $cache Cache duration in seconds. 0 for no cache.
[ "Convenience", "method", "for", "JSON", "response", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Header.php#L246-L255
bfitech/zapcore
src/Header.php
Header.pj
final public static function pj( $retval, int $forbidden_code=null, int $cache=0 ) { $http_code = 200; if (!is_array($retval)) { $retval = [-1, null]; $forbidden_code = 500; } if ($retval[0] !== 0) { $http_code = 401; if ($forbidden_code) $http_code = $forbidden_code; } if (!isset($retval...
php
final public static function pj( $retval, int $forbidden_code=null, int $cache=0 ) { $http_code = 200; if (!is_array($retval)) { $retval = [-1, null]; $forbidden_code = 500; } if ($retval[0] !== 0) { $http_code = 401; if ($forbidden_code) $http_code = $forbidden_code; } if (!isset($retval...
[ "final", "public", "static", "function", "pj", "(", "$", "retval", ",", "int", "$", "forbidden_code", "=", "null", ",", "int", "$", "cache", "=", "0", ")", "{", "$", "http_code", "=", "200", ";", "if", "(", "!", "is_array", "(", "$", "retval", ")",...
Even shorter JSON response formatter. @param array $retval Return value of typical Zap HTTP response. Invalid format will send 500 HTTP error. @param int $forbidden_code If `$retval[0] == 0`, HTTP code is 200. Otherwise it defaults to 401 which we can override with this parameter, e.g. 403. @param int $cache Cache dur...
[ "Even", "shorter", "JSON", "response", "formatter", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Header.php#L272-L288
aindong/pluggables
src/Aindong/Pluggables/Pluggables.php
Pluggables.registerServiceProvider
protected function registerServiceProvider($pluggable) { $pluggable = Str::studly($pluggable['slug']); $file = $this->getPath()."/{$pluggable}/Providers/{$pluggable}ServiceProvider.php"; $namespace = $this->getNamespace()."{$pluggable}\\Providers\\{$pluggable}ServiceProvider"; if (!...
php
protected function registerServiceProvider($pluggable) { $pluggable = Str::studly($pluggable['slug']); $file = $this->getPath()."/{$pluggable}/Providers/{$pluggable}ServiceProvider.php"; $namespace = $this->getNamespace()."{$pluggable}\\Providers\\{$pluggable}ServiceProvider"; if (!...
[ "protected", "function", "registerServiceProvider", "(", "$", "pluggable", ")", "{", "$", "pluggable", "=", "Str", "::", "studly", "(", "$", "pluggable", "[", "'slug'", "]", ")", ";", "$", "file", "=", "$", "this", "->", "getPath", "(", ")", ".", "\"/{...
Register the module service provider. @param $pluggable @throws FileNotFoundException
[ "Register", "the", "module", "service", "provider", "." ]
train
https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Pluggables.php#L59-L72
aindong/pluggables
src/Aindong/Pluggables/Pluggables.php
Pluggables.all
public function all() { $pluggables = []; $allPlugs = $this->getAllBaseNames(); foreach ($allPlugs as $plug) { $pluggables[] = $this->getJsonContents($plug); } return new Collection($this->sortByOrder($pluggables)); }
php
public function all() { $pluggables = []; $allPlugs = $this->getAllBaseNames(); foreach ($allPlugs as $plug) { $pluggables[] = $this->getJsonContents($plug); } return new Collection($this->sortByOrder($pluggables)); }
[ "public", "function", "all", "(", ")", "{", "$", "pluggables", "=", "[", "]", ";", "$", "allPlugs", "=", "$", "this", "->", "getAllBaseNames", "(", ")", ";", "foreach", "(", "$", "allPlugs", "as", "$", "plug", ")", "{", "$", "pluggables", "[", "]",...
Get all the pluggables. @return Collection
[ "Get", "all", "the", "pluggables", "." ]
train
https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Pluggables.php#L79-L89
aindong/pluggables
src/Aindong/Pluggables/Pluggables.php
Pluggables.getAllBaseNames
protected function getAllBaseNames() { $pluggables = []; $path = $this->getPath(); if (!is_dir($path)) { return $pluggables; } $folders = $this->files->directories($path); foreach ($folders as $plug) { $pluggables[] = basename($plug); ...
php
protected function getAllBaseNames() { $pluggables = []; $path = $this->getPath(); if (!is_dir($path)) { return $pluggables; } $folders = $this->files->directories($path); foreach ($folders as $plug) { $pluggables[] = basename($plug); ...
[ "protected", "function", "getAllBaseNames", "(", ")", "{", "$", "pluggables", "=", "[", "]", ";", "$", "path", "=", "$", "this", "->", "getPath", "(", ")", ";", "if", "(", "!", "is_dir", "(", "$", "path", ")", ")", "{", "return", "$", "pluggables",...
Get all pluggable basenames. @return array
[ "Get", "all", "pluggable", "basenames", "." ]
train
https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Pluggables.php#L96-L113
aindong/pluggables
src/Aindong/Pluggables/Pluggables.php
Pluggables.getAllSlugs
protected function getAllSlugs() { $pluggables = $this->all(); $slugs = []; foreach ($pluggables as $plug) { $slugs[] = $plug['slug']; } return $slugs; }
php
protected function getAllSlugs() { $pluggables = $this->all(); $slugs = []; foreach ($pluggables as $plug) { $slugs[] = $plug['slug']; } return $slugs; }
[ "protected", "function", "getAllSlugs", "(", ")", "{", "$", "pluggables", "=", "$", "this", "->", "all", "(", ")", ";", "$", "slugs", "=", "[", "]", ";", "foreach", "(", "$", "pluggables", "as", "$", "plug", ")", "{", "$", "slugs", "[", "]", "=",...
Get all pluggable slugs. @return array
[ "Get", "all", "pluggable", "slugs", "." ]
train
https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Pluggables.php#L120-L129
aindong/pluggables
src/Aindong/Pluggables/Pluggables.php
Pluggables.pathExists
protected function pathExists($folder) { $folder = Str::studly($folder); return in_array($folder, $this->getAllBaseNames()); }
php
protected function pathExists($folder) { $folder = Str::studly($folder); return in_array($folder, $this->getAllBaseNames()); }
[ "protected", "function", "pathExists", "(", "$", "folder", ")", "{", "$", "folder", "=", "Str", "::", "studly", "(", "$", "folder", ")", ";", "return", "in_array", "(", "$", "folder", ",", "$", "this", "->", "getAllBaseNames", "(", ")", ")", ";", "}"...
Check if given pluggable path exists. @param string $folder @return bool
[ "Check", "if", "given", "pluggable", "path", "exists", "." ]
train
https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Pluggables.php#L138-L143
aindong/pluggables
src/Aindong/Pluggables/Pluggables.php
Pluggables.getPluggablePath
public function getPluggablePath($slug, $allowNotExists = false) { $pluggable = Str::studly($slug); if (!$this->pathExists($pluggable) && $allowNotExists === false) { return; } return $this->getPath()."/{$pluggable}/"; }
php
public function getPluggablePath($slug, $allowNotExists = false) { $pluggable = Str::studly($slug); if (!$this->pathExists($pluggable) && $allowNotExists === false) { return; } return $this->getPath()."/{$pluggable}/"; }
[ "public", "function", "getPluggablePath", "(", "$", "slug", ",", "$", "allowNotExists", "=", "false", ")", "{", "$", "pluggable", "=", "Str", "::", "studly", "(", "$", "slug", ")", ";", "if", "(", "!", "$", "this", "->", "pathExists", "(", "$", "plug...
Get path for the specified pluggable. @param string $slug @return string
[ "Get", "path", "for", "the", "specified", "pluggable", "." ]
train
https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Pluggables.php#L210-L219
aindong/pluggables
src/Aindong/Pluggables/Pluggables.php
Pluggables.getProperty
public function getProperty($property, $default = null) { list($pluggable, $key) = explode('::', $property); return array_get($this->getJsonContents($pluggable), $key, $default); }
php
public function getProperty($property, $default = null) { list($pluggable, $key) = explode('::', $property); return array_get($this->getJsonContents($pluggable), $key, $default); }
[ "public", "function", "getProperty", "(", "$", "property", ",", "$", "default", "=", "null", ")", "{", "list", "(", "$", "pluggable", ",", "$", "key", ")", "=", "explode", "(", "'::'", ",", "$", "property", ")", ";", "return", "array_get", "(", "$", ...
Get a pluggable property value. @param string $property @param mixed $default @return mixed
[ "Get", "a", "pluggable", "property", "value", "." ]
train
https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Pluggables.php#L241-L246
aindong/pluggables
src/Aindong/Pluggables/Pluggables.php
Pluggables.setProperty
public function setProperty($property, $value) { list($pluggable, $key) = explode('::', $property); $content = $this->getJsonContents($pluggable); if (count($content)) { if (isset($content[$key])) { unset($content[$key]); } $content[$key...
php
public function setProperty($property, $value) { list($pluggable, $key) = explode('::', $property); $content = $this->getJsonContents($pluggable); if (count($content)) { if (isset($content[$key])) { unset($content[$key]); } $content[$key...
[ "public", "function", "setProperty", "(", "$", "property", ",", "$", "value", ")", "{", "list", "(", "$", "pluggable", ",", "$", "key", ")", "=", "explode", "(", "'::'", ",", "$", "property", ")", ";", "$", "content", "=", "$", "this", "->", "getJs...
Set a pluggale property value. @param string $property @param mixed $value @return bool
[ "Set", "a", "pluggale", "property", "value", "." ]
train
https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Pluggables.php#L256-L274
aindong/pluggables
src/Aindong/Pluggables/Pluggables.php
Pluggables.getByEnabled
public function getByEnabled($enabled = true) { $disabledPluggables = []; $enabledPluggables = []; $pluggables = $this->all(); // Iterate through each pluggable foreach ($pluggables as $pluggable) { if ($this->isEnabled($pluggable['slug'])) { $en...
php
public function getByEnabled($enabled = true) { $disabledPluggables = []; $enabledPluggables = []; $pluggables = $this->all(); // Iterate through each pluggable foreach ($pluggables as $pluggable) { if ($this->isEnabled($pluggable['slug'])) { $en...
[ "public", "function", "getByEnabled", "(", "$", "enabled", "=", "true", ")", "{", "$", "disabledPluggables", "=", "[", "]", ";", "$", "enabledPluggables", "=", "[", "]", ";", "$", "pluggables", "=", "$", "this", "->", "all", "(", ")", ";", "// Iterate ...
Find a pluggable with enabled status given. @param bool $enabled @return array
[ "Find", "a", "pluggable", "with", "enabled", "status", "given", "." ]
train
https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Pluggables.php#L283-L304
aindong/pluggables
src/Aindong/Pluggables/Pluggables.php
Pluggables.getJsonContents
protected function getJsonContents($pluggable) { $pluggable = Str::studly($pluggable); $default = []; if (!$this->pathExists($pluggable)) { return $default; } $path = $this->getJsonPath($pluggable); if ($this->files->exists($path)) { $conten...
php
protected function getJsonContents($pluggable) { $pluggable = Str::studly($pluggable); $default = []; if (!$this->pathExists($pluggable)) { return $default; } $path = $this->getJsonPath($pluggable); if ($this->files->exists($path)) { $conten...
[ "protected", "function", "getJsonContents", "(", "$", "pluggable", ")", "{", "$", "pluggable", "=", "Str", "::", "studly", "(", "$", "pluggable", ")", ";", "$", "default", "=", "[", "]", ";", "if", "(", "!", "$", "this", "->", "pathExists", "(", "$",...
Get pluggable JSON content as an array. @param string $pluggable @throws FileNotFoundException @return array|mixed
[ "Get", "pluggable", "JSON", "content", "as", "an", "array", "." ]
train
https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Pluggables.php#L383-L403
aindong/pluggables
src/Aindong/Pluggables/Pluggables.php
Pluggables.sortByOrder
public function sortByOrder($pluggables) { $orderedPluggables = []; foreach ($pluggables as $pluggable) { if (!isset($pluggable['order'])) { $pluggable['order'] = 9001; // It's over 9000! } $orderedPluggables[] = $pluggable; } if...
php
public function sortByOrder($pluggables) { $orderedPluggables = []; foreach ($pluggables as $pluggable) { if (!isset($pluggable['order'])) { $pluggable['order'] = 9001; // It's over 9000! } $orderedPluggables[] = $pluggable; } if...
[ "public", "function", "sortByOrder", "(", "$", "pluggables", ")", "{", "$", "orderedPluggables", "=", "[", "]", ";", "foreach", "(", "$", "pluggables", "as", "$", "pluggable", ")", "{", "if", "(", "!", "isset", "(", "$", "pluggable", "[", "'order'", "]...
Sort pluggables by order. @param array $pluggables @return array
[ "Sort", "pluggables", "by", "order", "." ]
train
https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Pluggables.php#L440-L456
aindong/pluggables
src/Aindong/Pluggables/Pluggables.php
Pluggables.arrayOrderBy
protected function arrayOrderBy() { $arguments = func_get_args(); $data = array_shift($arguments); foreach ($arguments as $argument => $field) { if (is_string($field)) { $temp = []; foreach ($data as $key => $row) { $temp[$key] ...
php
protected function arrayOrderBy() { $arguments = func_get_args(); $data = array_shift($arguments); foreach ($arguments as $argument => $field) { if (is_string($field)) { $temp = []; foreach ($data as $key => $row) { $temp[$key] ...
[ "protected", "function", "arrayOrderBy", "(", ")", "{", "$", "arguments", "=", "func_get_args", "(", ")", ";", "$", "data", "=", "array_shift", "(", "$", "arguments", ")", ";", "foreach", "(", "$", "arguments", "as", "$", "argument", "=>", "$", "field", ...
Helper method to order multiple values easily. @return array
[ "Helper", "method", "to", "order", "multiple", "values", "easily", "." ]
train
https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Pluggables.php#L463-L480
darkwebdesign/doctrine-unit-testing
src/Mocks/UnitOfWorkMock.php
UnitOfWorkMock.getEntityPersister
public function getEntityPersister($entityName) { return isset($this->_persisterMock[$entityName]) ? $this->_persisterMock[$entityName] : parent::getEntityPersister($entityName); }
php
public function getEntityPersister($entityName) { return isset($this->_persisterMock[$entityName]) ? $this->_persisterMock[$entityName] : parent::getEntityPersister($entityName); }
[ "public", "function", "getEntityPersister", "(", "$", "entityName", ")", "{", "return", "isset", "(", "$", "this", "->", "_persisterMock", "[", "$", "entityName", "]", ")", "?", "$", "this", "->", "_persisterMock", "[", "$", "entityName", "]", ":", "parent...
{@inheritdoc}
[ "{" ]
train
https://github.com/darkwebdesign/doctrine-unit-testing/blob/0daf50359563bc0679925e573a7105d6cd57168a/src/Mocks/UnitOfWorkMock.php#L25-L30
darkwebdesign/doctrine-unit-testing
src/Mocks/UnitOfWorkMock.php
UnitOfWorkMock.&
public function & getEntityChangeSet($entity) { $oid = spl_object_hash($entity); if (isset($this->_mockDataChangeSets[$oid])) { return $this->_mockDataChangeSets[$oid]; } $data = parent::getEntityChangeSet($entity); return $data; }
php
public function & getEntityChangeSet($entity) { $oid = spl_object_hash($entity); if (isset($this->_mockDataChangeSets[$oid])) { return $this->_mockDataChangeSets[$oid]; } $data = parent::getEntityChangeSet($entity); return $data; }
[ "public", "function", "&", "getEntityChangeSet", "(", "$", "entity", ")", "{", "$", "oid", "=", "spl_object_hash", "(", "$", "entity", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "_mockDataChangeSets", "[", "$", "oid", "]", ")", ")", "{", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/darkwebdesign/doctrine-unit-testing/blob/0daf50359563bc0679925e573a7105d6cd57168a/src/Mocks/UnitOfWorkMock.php#L35-L46
okvpn/fixture-bundle
src/Migration/DataFixturesExecutor.php
DataFixturesExecutor.execute
public function execute(array $fixtures, $fixturesType) { $event = new DataFixturesEvent($this->em, $fixturesType, $this->logger); $this->eventDispatcher->dispatch(FixturesEvents::DATA_FIXTURES_PRE_LOAD, $event); $executor = new ORMExecutor($this->em); if (null !== $this->logger) { ...
php
public function execute(array $fixtures, $fixturesType) { $event = new DataFixturesEvent($this->em, $fixturesType, $this->logger); $this->eventDispatcher->dispatch(FixturesEvents::DATA_FIXTURES_PRE_LOAD, $event); $executor = new ORMExecutor($this->em); if (null !== $this->logger) { ...
[ "public", "function", "execute", "(", "array", "$", "fixtures", ",", "$", "fixturesType", ")", "{", "$", "event", "=", "new", "DataFixturesEvent", "(", "$", "this", "->", "em", ",", "$", "fixturesType", ",", "$", "this", "->", "logger", ")", ";", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Migration/DataFixturesExecutor.php#L37-L49
verschoof/bunq-api
src/Resource/PaymentResource.php
PaymentResource.listPayments
public function listPayments($userId, $monetaryAccountId) { $payments = $this->client->get($this->getResourceEndpoint($userId, $monetaryAccountId)); foreach ($payments['Response'] as $key => $payment) { $payments['Response'][$key]['Payment']['amount']['value'] = $this->floatToCents($paym...
php
public function listPayments($userId, $monetaryAccountId) { $payments = $this->client->get($this->getResourceEndpoint($userId, $monetaryAccountId)); foreach ($payments['Response'] as $key => $payment) { $payments['Response'][$key]['Payment']['amount']['value'] = $this->floatToCents($paym...
[ "public", "function", "listPayments", "(", "$", "userId", ",", "$", "monetaryAccountId", ")", "{", "$", "payments", "=", "$", "this", "->", "client", "->", "get", "(", "$", "this", "->", "getResourceEndpoint", "(", "$", "userId", ",", "$", "monetaryAccount...
Lists all payments. @param integer $userId @param integer $monetaryAccountId @return array
[ "Lists", "all", "payments", "." ]
train
https://github.com/verschoof/bunq-api/blob/df9aa19f384275f4f0deb26de0cb5e5f8b45ffcd/src/Resource/PaymentResource.php#L30-L38
verschoof/bunq-api
src/Resource/PaymentResource.php
PaymentResource.getPayment
public function getPayment($userId, $monetaryAccountId, $id) { $paymentResponse = $this->client->get($this->getResourceEndpoint($userId, $monetaryAccountId) . '/' . (int)$id); $payment = $paymentResponse['Response'][0]['Payment']; $payment['amount']['value'] = $this->floatToCents($payment[...
php
public function getPayment($userId, $monetaryAccountId, $id) { $paymentResponse = $this->client->get($this->getResourceEndpoint($userId, $monetaryAccountId) . '/' . (int)$id); $payment = $paymentResponse['Response'][0]['Payment']; $payment['amount']['value'] = $this->floatToCents($payment[...
[ "public", "function", "getPayment", "(", "$", "userId", ",", "$", "monetaryAccountId", ",", "$", "id", ")", "{", "$", "paymentResponse", "=", "$", "this", "->", "client", "->", "get", "(", "$", "this", "->", "getResourceEndpoint", "(", "$", "userId", ","...
Gets a user its payment information. @param integer $userId @param integer $monetaryAccountId @param integer $id @return array
[ "Gets", "a", "user", "its", "payment", "information", "." ]
train
https://github.com/verschoof/bunq-api/blob/df9aa19f384275f4f0deb26de0cb5e5f8b45ffcd/src/Resource/PaymentResource.php#L49-L58
prooph/link-app-core
src/Controller/ConfigurationController.php
ConfigurationController.changeNodeNameAction
public function changeNodeNameAction() { $nodeName = $this->bodyParam('node_name'); if (! is_string($nodeName) || strlen($nodeName) < 3) { return new ApiProblemResponse(new ApiProblem(422, $this->translator->translate('The node name must be at least 3 characters long'))); } ...
php
public function changeNodeNameAction() { $nodeName = $this->bodyParam('node_name'); if (! is_string($nodeName) || strlen($nodeName) < 3) { return new ApiProblemResponse(new ApiProblem(422, $this->translator->translate('The node name must be at least 3 characters long'))); } ...
[ "public", "function", "changeNodeNameAction", "(", ")", "{", "$", "nodeName", "=", "$", "this", "->", "bodyParam", "(", "'node_name'", ")", ";", "if", "(", "!", "is_string", "(", "$", "nodeName", ")", "||", "strlen", "(", "$", "nodeName", ")", "<", "3"...
Handles a POST request that want to change the node name
[ "Handles", "a", "POST", "request", "that", "want", "to", "change", "the", "node", "name" ]
train
https://github.com/prooph/link-app-core/blob/835a5945dfa7be7b2cebfa6e84e757ecfd783357/src/Controller/ConfigurationController.php#L37-L51
prooph/link-app-core
src/Controller/ConfigurationController.php
ConfigurationController.configureJavascriptTickerAction
public function configureJavascriptTickerAction() { $tickerEnabled = $this->bodyParam('enabled'); $tickerInterval = $this->bodyParam('interval'); if (! is_bool($tickerEnabled)) { return new ApiProblemResponse(new ApiProblem(422, $this->translator->translate('The enabled flag sho...
php
public function configureJavascriptTickerAction() { $tickerEnabled = $this->bodyParam('enabled'); $tickerInterval = $this->bodyParam('interval'); if (! is_bool($tickerEnabled)) { return new ApiProblemResponse(new ApiProblem(422, $this->translator->translate('The enabled flag sho...
[ "public", "function", "configureJavascriptTickerAction", "(", ")", "{", "$", "tickerEnabled", "=", "$", "this", "->", "bodyParam", "(", "'enabled'", ")", ";", "$", "tickerInterval", "=", "$", "this", "->", "bodyParam", "(", "'interval'", ")", ";", "if", "(",...
Handles a POST request to configure the javascript ticker
[ "Handles", "a", "POST", "request", "to", "configure", "the", "javascript", "ticker" ]
train
https://github.com/prooph/link-app-core/blob/835a5945dfa7be7b2cebfa6e84e757ecfd783357/src/Controller/ConfigurationController.php#L56-L78
prooph/link-app-core
src/Controller/ConfigurationController.php
ConfigurationController.configureWorkflowProcessorMessageQueueAction
public function configureWorkflowProcessorMessageQueueAction() { $queueEnabled = $this->bodyParam('enabled'); if (! is_bool($queueEnabled)) { return new ApiProblemResponse(new ApiProblem(422, $this->translator->translate('The enabled flag should be a boolean value'))); } ...
php
public function configureWorkflowProcessorMessageQueueAction() { $queueEnabled = $this->bodyParam('enabled'); if (! is_bool($queueEnabled)) { return new ApiProblemResponse(new ApiProblem(422, $this->translator->translate('The enabled flag should be a boolean value'))); } ...
[ "public", "function", "configureWorkflowProcessorMessageQueueAction", "(", ")", "{", "$", "queueEnabled", "=", "$", "this", "->", "bodyParam", "(", "'enabled'", ")", ";", "if", "(", "!", "is_bool", "(", "$", "queueEnabled", ")", ")", "{", "return", "new", "A...
Handles a POST request to enable or disable the workflow processor message queue
[ "Handles", "a", "POST", "request", "to", "enable", "or", "disable", "the", "workflow", "processor", "message", "queue" ]
train
https://github.com/prooph/link-app-core/blob/835a5945dfa7be7b2cebfa6e84e757ecfd783357/src/Controller/ConfigurationController.php#L83-L102
esperecyan/dictionary-php
src/serializer/PictsenseSerializer.php
PictsenseSerializer.serializeWord
protected function serializeWord(array $word): string { if (!isset($word['type'][0]) || $word['type'][0] !== 'selection') { $answers = $this->getOrderedAnswers($word); if ($answers) { $pictsenseParser = new PictsenseParser(); foreach ($answers as $answ...
php
protected function serializeWord(array $word): string { if (!isset($word['type'][0]) || $word['type'][0] !== 'selection') { $answers = $this->getOrderedAnswers($word); if ($answers) { $pictsenseParser = new PictsenseParser(); foreach ($answers as $answ...
[ "protected", "function", "serializeWord", "(", "array", "$", "word", ")", ":", "string", "{", "if", "(", "!", "isset", "(", "$", "word", "[", "'type'", "]", "[", "0", "]", ")", "||", "$", "word", "[", "'type'", "]", "[", "0", "]", "!==", "'select...
一つのお題を表す配列を直列化します。 @param (string|string[]|float)[][] $word @return string 末尾に改行は含みません。直列化できないお題だった場合は空文字列を返します。
[ "一つのお題を表す配列を直列化します。" ]
train
https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/serializer/PictsenseSerializer.php#L18-L41
etki/opencart-core-installer
src/DebugPrinter.php
DebugPrinter.log
public static function log($message, $args = null) { if (getenv('DEBUG') || getenv('OPENCART_INSTALLER_DEBUG')) { if ($args) { if (!is_array($args)) { $args = array($args); } $message = vsprintf($message, $args); } ...
php
public static function log($message, $args = null) { if (getenv('DEBUG') || getenv('OPENCART_INSTALLER_DEBUG')) { if ($args) { if (!is_array($args)) { $args = array($args); } $message = vsprintf($message, $args); } ...
[ "public", "static", "function", "log", "(", "$", "message", ",", "$", "args", "=", "null", ")", "{", "if", "(", "getenv", "(", "'DEBUG'", ")", "||", "getenv", "(", "'OPENCART_INSTALLER_DEBUG'", ")", ")", "{", "if", "(", "$", "args", ")", "{", "if", ...
Writes debug message to stdout. @param string $message Message to be shown. @param array|string|null $args Additional arguments for message formatting. @return void @since 0.1.0
[ "Writes", "debug", "message", "to", "stdout", "." ]
train
https://github.com/etki/opencart-core-installer/blob/e651c94982afe966cd36977bbdc2ff4f7e785475/src/DebugPrinter.php#L24-L35
darkwebdesign/doctrine-unit-testing
src/Mocks/DriverMock.php
DriverMock.getSchemaManager
public function getSchemaManager(Connection $conn) { if ($this->_schemaManagerMock == null) { return new SchemaManagerMock($conn); } return $this->_schemaManagerMock; }
php
public function getSchemaManager(Connection $conn) { if ($this->_schemaManagerMock == null) { return new SchemaManagerMock($conn); } return $this->_schemaManagerMock; }
[ "public", "function", "getSchemaManager", "(", "Connection", "$", "conn", ")", "{", "if", "(", "$", "this", "->", "_schemaManagerMock", "==", "null", ")", "{", "return", "new", "SchemaManagerMock", "(", "$", "conn", ")", ";", "}", "return", "$", "this", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/darkwebdesign/doctrine-unit-testing/blob/0daf50359563bc0679925e573a7105d6cd57168a/src/Mocks/DriverMock.php#L47-L54
o2system/session
src/Handlers/FileHandler.php
FileHandler.open
public function open($save_path, $name) { $this->path = $this->config[ 'filePath' ]; if ($this->isSupported() === false) { if ($this->logger instanceof LoggerInterface) { $this->logger->error('SESSION_E_FILE_UNSUPPORTED', [$this->path]); } ...
php
public function open($save_path, $name) { $this->path = $this->config[ 'filePath' ]; if ($this->isSupported() === false) { if ($this->logger instanceof LoggerInterface) { $this->logger->error('SESSION_E_FILE_UNSUPPORTED', [$this->path]); } ...
[ "public", "function", "open", "(", "$", "save_path", ",", "$", "name", ")", "{", "$", "this", "->", "path", "=", "$", "this", "->", "config", "[", "'filePath'", "]", ";", "if", "(", "$", "this", "->", "isSupported", "(", ")", "===", "false", ")", ...
FileHandler::open Initialize session @link http://php.net/manual/en/sessionhandlerinterface.open.php @param string $save_path The path where to store/retrieve the session. @param string $name The session name. @return bool <p> The return value (usually TRUE on success, FALSE on failure). Note this value is re...
[ "FileHandler", "::", "open" ]
train
https://github.com/o2system/session/blob/49f2af67b876a58c0895ac80fc64a01b27ea6a6d/src/Handlers/FileHandler.php#L81-L98
o2system/session
src/Handlers/FileHandler.php
FileHandler.isSupported
public function isSupported() { if ( ! is_writable($this->path)) { @mkdir($this->path, 0777, true); } return (bool)is_writable($this->path); }
php
public function isSupported() { if ( ! is_writable($this->path)) { @mkdir($this->path, 0777, true); } return (bool)is_writable($this->path); }
[ "public", "function", "isSupported", "(", ")", "{", "if", "(", "!", "is_writable", "(", "$", "this", "->", "path", ")", ")", "{", "@", "mkdir", "(", "$", "this", "->", "path", ",", "0777", ",", "true", ")", ";", "}", "return", "(", "bool", ")", ...
FileHandler::isSupported Checks if this platform is supported on this system. @return bool Returns FALSE if unsupported.
[ "FileHandler", "::", "isSupported" ]
train
https://github.com/o2system/session/blob/49f2af67b876a58c0895ac80fc64a01b27ea6a6d/src/Handlers/FileHandler.php#L109-L116
o2system/session
src/Handlers/FileHandler.php
FileHandler.destroy
public function destroy($session_id) { if ($this->close()) { return file_exists($this->filePath . $session_id) ? (unlink($this->filePath . $session_id) && $this->destroyCookie()) : true; } elseif ($this->filePath !== null) { clearstatcac...
php
public function destroy($session_id) { if ($this->close()) { return file_exists($this->filePath . $session_id) ? (unlink($this->filePath . $session_id) && $this->destroyCookie()) : true; } elseif ($this->filePath !== null) { clearstatcac...
[ "public", "function", "destroy", "(", "$", "session_id", ")", "{", "if", "(", "$", "this", "->", "close", "(", ")", ")", "{", "return", "file_exists", "(", "$", "this", "->", "filePath", ".", "$", "session_id", ")", "?", "(", "unlink", "(", "$", "t...
FileHandler::destroy Destroy a session @link http://php.net/manual/en/sessionhandlerinterface.destroy.php @param string $session_id The session ID being destroyed. @return bool <p> The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing. </p> @sinc...
[ "FileHandler", "::", "destroy" ]
train
https://github.com/o2system/session/blob/49f2af67b876a58c0895ac80fc64a01b27ea6a6d/src/Handlers/FileHandler.php#L135-L150
o2system/session
src/Handlers/FileHandler.php
FileHandler.close
public function close() { if (is_resource($this->file)) { flock($this->file, LOCK_UN); fclose($this->file); $this->file = $this->isNewFile = $this->sessionId = null; return true; } return true; }
php
public function close() { if (is_resource($this->file)) { flock($this->file, LOCK_UN); fclose($this->file); $this->file = $this->isNewFile = $this->sessionId = null; return true; } return true; }
[ "public", "function", "close", "(", ")", "{", "if", "(", "is_resource", "(", "$", "this", "->", "file", ")", ")", "{", "flock", "(", "$", "this", "->", "file", ",", "LOCK_UN", ")", ";", "fclose", "(", "$", "this", "->", "file", ")", ";", "$", "...
FileHandler::close Close the session @link http://php.net/manual/en/sessionhandlerinterface.close.php @return bool <p> The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing. </p> @since 5.4.0
[ "FileHandler", "::", "close" ]
train
https://github.com/o2system/session/blob/49f2af67b876a58c0895ac80fc64a01b27ea6a6d/src/Handlers/FileHandler.php#L166-L178
o2system/session
src/Handlers/FileHandler.php
FileHandler.gc
public function gc($maxlifetime) { if ( ! is_dir($this->path) || ($directory = opendir($this->path)) === false) { if ($this->logger instanceof LoggerInterface) { $this->logger->error('SESSION_E_FILE_ON_GC', [$this->path]); } return false; ...
php
public function gc($maxlifetime) { if ( ! is_dir($this->path) || ($directory = opendir($this->path)) === false) { if ($this->logger instanceof LoggerInterface) { $this->logger->error('SESSION_E_FILE_ON_GC', [$this->path]); } return false; ...
[ "public", "function", "gc", "(", "$", "maxlifetime", ")", "{", "if", "(", "!", "is_dir", "(", "$", "this", "->", "path", ")", "||", "(", "$", "directory", "=", "opendir", "(", "$", "this", "->", "path", ")", ")", "===", "false", ")", "{", "if", ...
FileHandler::gc Cleanup old sessions @link http://php.net/manual/en/sessionhandlerinterface.gc.php @param int $maxlifetime <p> Sessions that have not updated for the last maxlifetime seconds will be removed. </p> @return bool <p> The return value (usually TRUE on success, FALSE on failure). Note this value is retu...
[ "FileHandler", "::", "gc" ]
train
https://github.com/o2system/session/blob/49f2af67b876a58c0895ac80fc64a01b27ea6a6d/src/Handlers/FileHandler.php#L200-L228
o2system/session
src/Handlers/FileHandler.php
FileHandler.write
public function write($session_id, $session_data) { // If the two IDs don't match, we have a session_regenerate_id() call // and we need to close the old handle and open a new one if ($session_id !== $this->sessionId && ( ! $this->close() || $this->read($session_id) === false)) { ...
php
public function write($session_id, $session_data) { // If the two IDs don't match, we have a session_regenerate_id() call // and we need to close the old handle and open a new one if ($session_id !== $this->sessionId && ( ! $this->close() || $this->read($session_id) === false)) { ...
[ "public", "function", "write", "(", "$", "session_id", ",", "$", "session_data", ")", "{", "// If the two IDs don't match, we have a session_regenerate_id() call\r", "// and we need to close the old handle and open a new one\r", "if", "(", "$", "session_id", "!==", "$", "this",...
FileHandler::write Write session data @link http://php.net/manual/en/sessionhandlerinterface.write.php @param string $session_id The session id. @param string $session_data <p> The encoded session data. This data is the result of the PHP internally encoding the $_SESSION superglobal to a serialized string and pas...
[ "FileHandler", "::", "write" ]
train
https://github.com/o2system/session/blob/49f2af67b876a58c0895ac80fc64a01b27ea6a6d/src/Handlers/FileHandler.php#L254-L296
o2system/session
src/Handlers/FileHandler.php
FileHandler.read
public function read($session_id) { // This might seem weird, but PHP 5.6 introduced session_reset(), // which re-reads session data if ($this->file === null) { if (($this->file = fopen($this->filePath . $session_id, 'c+b')) === false) { if ($this->logger in...
php
public function read($session_id) { // This might seem weird, but PHP 5.6 introduced session_reset(), // which re-reads session data if ($this->file === null) { if (($this->file = fopen($this->filePath . $session_id, 'c+b')) === false) { if ($this->logger in...
[ "public", "function", "read", "(", "$", "session_id", ")", "{", "// This might seem weird, but PHP 5.6 introduced session_reset(),\r", "// which re-reads session data\r", "if", "(", "$", "this", "->", "file", "===", "null", ")", "{", "if", "(", "(", "$", "this", "->...
FileHandler::read Read session data @link http://php.net/manual/en/sessionhandlerinterface.read.php @param string $session_id The session id to read data for. @return string <p> Returns an encoded string of the read data. If nothing was read, it must return an empty string. Note this value is returned internally t...
[ "FileHandler", "::", "read" ]
train
https://github.com/o2system/session/blob/49f2af67b876a58c0895ac80fc64a01b27ea6a6d/src/Handlers/FileHandler.php#L316-L368
ryanwachtl/silverstripe-foundation-forms
code/pagetypes/FoundationFormPage.php
FoundationFormPage_Controller.submitFoundationForm
function submitFoundationForm($data, $form) { if(isset($data['SecurityID'])) { unset($data['SecurityID']); } Session::set('FoundationForm' . $this->ID, $data); return $this->redirect($this->Link()); }
php
function submitFoundationForm($data, $form) { if(isset($data['SecurityID'])) { unset($data['SecurityID']); } Session::set('FoundationForm' . $this->ID, $data); return $this->redirect($this->Link()); }
[ "function", "submitFoundationForm", "(", "$", "data", ",", "$", "form", ")", "{", "if", "(", "isset", "(", "$", "data", "[", "'SecurityID'", "]", ")", ")", "{", "unset", "(", "$", "data", "[", "'SecurityID'", "]", ")", ";", "}", "Session", "::", "s...
submit the form and redirect back to the form
[ "submit", "the", "form", "and", "redirect", "back", "to", "the", "form" ]
train
https://github.com/ryanwachtl/silverstripe-foundation-forms/blob/9055449fcb895811187124d81e57b7c93948403f/code/pagetypes/FoundationFormPage.php#L145-L152
crossjoin/Css
src/Crossjoin/Css/Format/Rule/AtImport/ImportRule.php
ImportRule.parseRuleString
protected function parseRuleString($ruleString) { $charset = $this->getCharset(); // Remove at-rule and unnecessary white-spaces $ruleString = preg_replace('/^[ \r\n\t\f]*@import[ \r\n\t\f]+/i', '', $ruleString); $ruleString = trim($ruleString, " \r\n\t\f"); // Remove trail...
php
protected function parseRuleString($ruleString) { $charset = $this->getCharset(); // Remove at-rule and unnecessary white-spaces $ruleString = preg_replace('/^[ \r\n\t\f]*@import[ \r\n\t\f]+/i', '', $ruleString); $ruleString = trim($ruleString, " \r\n\t\f"); // Remove trail...
[ "protected", "function", "parseRuleString", "(", "$", "ruleString", ")", "{", "$", "charset", "=", "$", "this", "->", "getCharset", "(", ")", ";", "// Remove at-rule and unnecessary white-spaces", "$", "ruleString", "=", "preg_replace", "(", "'/^[ \\r\\n\\t\\f]*@impor...
Parses the import rule. @param string $ruleString
[ "Parses", "the", "import", "rule", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtImport/ImportRule.php#L109-L186
shawnsandy/ui-pages
src/Classes/Markdown.php
Markdown.markdown
public function markdown($markdown, $page = null) { $file = $markdown . '.md'; if (isset($page)) { $file = $page . '/' . $markdown . '.md'; } if (!Storage::disk('markdown')->exists($file)) { return false; } $array = $this->markdownToArray($...
php
public function markdown($markdown, $page = null) { $file = $markdown . '.md'; if (isset($page)) { $file = $page . '/' . $markdown . '.md'; } if (!Storage::disk('markdown')->exists($file)) { return false; } $array = $this->markdownToArray($...
[ "public", "function", "markdown", "(", "$", "markdown", ",", "$", "page", "=", "null", ")", "{", "$", "file", "=", "$", "markdown", ".", "'.md'", ";", "if", "(", "isset", "(", "$", "page", ")", ")", "{", "$", "file", "=", "$", "page", ".", "'/'...
Parses and output a markdown file @param string $markdown File name @param null $page File directory @return string
[ "Parses", "and", "output", "a", "markdown", "file" ]
train
https://github.com/shawnsandy/ui-pages/blob/11584c12fa3e2b9a5c513f4ec9e2eaf78c206ca8/src/Classes/Markdown.php#L44-L60
shawnsandy/ui-pages
src/Classes/Markdown.php
Markdown.markdownLink
public function markdownLink($file_path, $type = '') { $array = explode('/', $file_path); $dir = $array[0]; $replace = array('-', '_'); $url = trim($dir, '.md'); $display_name = str_replace($replace, ' ', trim($dir, '.md')); if (count($array) > 1) { $n...
php
public function markdownLink($file_path, $type = '') { $array = explode('/', $file_path); $dir = $array[0]; $replace = array('-', '_'); $url = trim($dir, '.md'); $display_name = str_replace($replace, ' ', trim($dir, '.md')); if (count($array) > 1) { $n...
[ "public", "function", "markdownLink", "(", "$", "file_path", ",", "$", "type", "=", "''", ")", "{", "$", "array", "=", "explode", "(", "'/'", ",", "$", "file_path", ")", ";", "$", "dir", "=", "$", "array", "[", "0", "]", ";", "$", "replace", "=",...
Converts a give md file path to a link @param string $file_path file path @param string $type url/link @return mixed
[ "Converts", "a", "give", "md", "file", "path", "to", "a", "link" ]
train
https://github.com/shawnsandy/ui-pages/blob/11584c12fa3e2b9a5c513f4ec9e2eaf78c206ca8/src/Classes/Markdown.php#L94-L116
shawnsandy/ui-pages
src/Classes/Markdown.php
Markdown.markdownMenu
public function markdownMenu($dir = null) { $md_files = $this->markdownFiles($dir); $links = []; foreach ($md_files as $file) { $links[] = $this->markdownLink($file, $this->type); } return $links; }
php
public function markdownMenu($dir = null) { $md_files = $this->markdownFiles($dir); $links = []; foreach ($md_files as $file) { $links[] = $this->markdownLink($file, $this->type); } return $links; }
[ "public", "function", "markdownMenu", "(", "$", "dir", "=", "null", ")", "{", "$", "md_files", "=", "$", "this", "->", "markdownFiles", "(", "$", "dir", ")", ";", "$", "links", "=", "[", "]", ";", "foreach", "(", "$", "md_files", "as", "$", "file",...
Returns an list or directory of array of markdown files @param string $dir file dir @return array
[ "Returns", "an", "list", "or", "directory", "of", "array", "of", "markdown", "files" ]
train
https://github.com/shawnsandy/ui-pages/blob/11584c12fa3e2b9a5c513f4ec9e2eaf78c206ca8/src/Classes/Markdown.php#L125-L136
shawnsandy/ui-pages
src/Classes/Markdown.php
Markdown.markdownPosts
public function markdownPosts($dir = null) { $source = collect($this->markdownFiles($dir)); if (empty($source)) { return false; } //map files $files = $source->map( function ($file) { $array = $this->markdownToArray($file); ...
php
public function markdownPosts($dir = null) { $source = collect($this->markdownFiles($dir)); if (empty($source)) { return false; } //map files $files = $source->map( function ($file) { $array = $this->markdownToArray($file); ...
[ "public", "function", "markdownPosts", "(", "$", "dir", "=", "null", ")", "{", "$", "source", "=", "collect", "(", "$", "this", "->", "markdownFiles", "(", "$", "dir", ")", ")", ";", "if", "(", "empty", "(", "$", "source", ")", ")", "{", "return", ...
Return and array of markdown @param string $dir location of md directory @return mixed
[ "Return", "and", "array", "of", "markdown" ]
train
https://github.com/shawnsandy/ui-pages/blob/11584c12fa3e2b9a5c513f4ec9e2eaf78c206ca8/src/Classes/Markdown.php#L157-L185
shawnsandy/ui-pages
src/Classes/Markdown.php
Markdown.markdownToArray
public function markdownToArray($file) { $markdown = $this->markdown->transform( Storage::disk('markdown') ->get($file) ); $array = explode("\n", $markdown); $data['url'] = $this->markdownLink($file, 'url'); $data['last_modified'] = date( ...
php
public function markdownToArray($file) { $markdown = $this->markdown->transform( Storage::disk('markdown') ->get($file) ); $array = explode("\n", $markdown); $data['url'] = $this->markdownLink($file, 'url'); $data['last_modified'] = date( ...
[ "public", "function", "markdownToArray", "(", "$", "file", ")", "{", "$", "markdown", "=", "$", "this", "->", "markdown", "->", "transform", "(", "Storage", "::", "disk", "(", "'markdown'", ")", "->", "get", "(", "$", "file", ")", ")", ";", "$", "arr...
Takes a markdown and converts it to array @param string $file @return array
[ "Takes", "a", "markdown", "and", "converts", "it", "to", "array" ]
train
https://github.com/shawnsandy/ui-pages/blob/11584c12fa3e2b9a5c513f4ec9e2eaf78c206ca8/src/Classes/Markdown.php#L194-L218
drupol/valuewrapper
src/Type/ArrayType.php
ArrayType.hash
public function hash(): string { if ($string = \json_encode($this->value())) { return $this->doHash($string); } throw new \Exception('Unable to encode the value.'); }
php
public function hash(): string { if ($string = \json_encode($this->value())) { return $this->doHash($string); } throw new \Exception('Unable to encode the value.'); }
[ "public", "function", "hash", "(", ")", ":", "string", "{", "if", "(", "$", "string", "=", "\\", "json_encode", "(", "$", "this", "->", "value", "(", ")", ")", ")", "{", "return", "$", "this", "->", "doHash", "(", "$", "string", ")", ";", "}", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/drupol/valuewrapper/blob/49cc07e4d0284718c24ba6e9cf524c1f4226694e/src/Type/ArrayType.php#L25-L32
FrenchFrogs/framework
src/Filterer/Filterer.php
Filterer.setFilters
public function setFilters($filters) { if (!is_array($filters)) { $this->clearFilters(); foreach(explode('|', $filters) as $filter) { // searching for optional params $params = []; if (strpos($filter, ':')) { list(...
php
public function setFilters($filters) { if (!is_array($filters)) { $this->clearFilters(); foreach(explode('|', $filters) as $filter) { // searching for optional params $params = []; if (strpos($filter, ':')) { list(...
[ "public", "function", "setFilters", "(", "$", "filters", ")", "{", "if", "(", "!", "is_array", "(", "$", "filters", ")", ")", "{", "$", "this", "->", "clearFilters", "(", ")", ";", "foreach", "(", "explode", "(", "'|'", ",", "$", "filters", ")", "a...
Set all filter as an array @param $filters @return $this
[ "Set", "all", "filter", "as", "an", "array" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Filterer/Filterer.php#L43-L64
FrenchFrogs/framework
src/Filterer/Filterer.php
Filterer.addFilter
public function addFilter($index, $method = null, ...$params) { $this->filters[$index] = [$method, $params]; return $this; }
php
public function addFilter($index, $method = null, ...$params) { $this->filters[$index] = [$method, $params]; return $this; }
[ "public", "function", "addFilter", "(", "$", "index", ",", "$", "method", "=", "null", ",", "...", "$", "params", ")", "{", "$", "this", "->", "filters", "[", "$", "index", "]", "=", "[", "$", "method", ",", "$", "params", "]", ";", "return", "$"...
Add a single filter to the filters container @param $index @param null $method @param ...$params @return $this
[ "Add", "a", "single", "filter", "to", "the", "filters", "container" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Filterer/Filterer.php#L74-L78
FrenchFrogs/framework
src/Filterer/Filterer.php
Filterer.getFilter
public function getFilter($index) { if (!$this->hasFilter($index)) { throw new \Exception('Impossible de trouver le filtre : ' . $index); } return $this->filters[$index]; }
php
public function getFilter($index) { if (!$this->hasFilter($index)) { throw new \Exception('Impossible de trouver le filtre : ' . $index); } return $this->filters[$index]; }
[ "public", "function", "getFilter", "(", "$", "index", ")", "{", "if", "(", "!", "$", "this", "->", "hasFilter", "(", "$", "index", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'Impossible de trouver le filtre : '", ".", "$", "index", ")", ";",...
Return the filter from the filters container from the filter container @param $index @return mixed @throws \Exception
[ "Return", "the", "filter", "from", "the", "filters", "container", "from", "the", "filter", "container" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Filterer/Filterer.php#L129-L136
FrenchFrogs/framework
src/Filterer/Filterer.php
Filterer.filter
public function filter($value) { foreach($this->getFilters() as $index => $filter) { // Extract the params list($method, $params) = $filter; // If method is null, we use the index as the method name $method = is_null($method) ? $index : $method; ...
php
public function filter($value) { foreach($this->getFilters() as $index => $filter) { // Extract the params list($method, $params) = $filter; // If method is null, we use the index as the method name $method = is_null($method) ? $index : $method; ...
[ "public", "function", "filter", "(", "$", "value", ")", "{", "foreach", "(", "$", "this", "->", "getFilters", "(", ")", "as", "$", "index", "=>", "$", "filter", ")", "{", "// Extract the params", "list", "(", "$", "method", ",", "$", "params", ")", "...
Filter de value Main method of the class @param $value @return mixed @throws \Exception
[ "Filter", "de", "value" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Filterer/Filterer.php#L159-L188
FrenchFrogs/framework
src/Filterer/Filterer.php
Filterer.dateFormat
public function dateFormat($value, $format = 'd/m/Y') { if (!empty($value)) { // passage de la date en datetime if (strlen($value) == 10) { $value .= ' 00:00:00'; } // gestion d'une date vide if ($value == '0000-00-00 00:00:00') {...
php
public function dateFormat($value, $format = 'd/m/Y') { if (!empty($value)) { // passage de la date en datetime if (strlen($value) == 10) { $value .= ' 00:00:00'; } // gestion d'une date vide if ($value == '0000-00-00 00:00:00') {...
[ "public", "function", "dateFormat", "(", "$", "value", ",", "$", "format", "=", "'d/m/Y'", ")", "{", "if", "(", "!", "empty", "(", "$", "value", ")", ")", "{", "// passage de la date en datetime", "if", "(", "strlen", "(", "$", "value", ")", "==", "10"...
Format a date @param $value @param string $format @return string
[ "Format", "a", "date" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Filterer/Filterer.php#L232-L254
FrenchFrogs/framework
src/Filterer/Filterer.php
Filterer.wrap
public function wrap($value, $size, $replacement = '...') { if (strlen($value) > ($size - strlen($replacement))) { $value = substr($value, 0, $size) .$replacement; } return $value; }
php
public function wrap($value, $size, $replacement = '...') { if (strlen($value) > ($size - strlen($replacement))) { $value = substr($value, 0, $size) .$replacement; } return $value; }
[ "public", "function", "wrap", "(", "$", "value", ",", "$", "size", ",", "$", "replacement", "=", "'...'", ")", "{", "if", "(", "strlen", "(", "$", "value", ")", ">", "(", "$", "size", "-", "strlen", "(", "$", "replacement", ")", ")", ")", "{", ...
Wrap string @param $value @param $size @param string $replacement
[ "Wrap", "string" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Filterer/Filterer.php#L369-L376
comelyio/comely
src/Comely/IO/Cache/Cache.php
Cache.addServer
public function addServer(int $engine, string $host = "127.0.0.1", int $port = 0): Server { $this->servers[] = new Server($engine, $host, $port); return end($this->servers); }
php
public function addServer(int $engine, string $host = "127.0.0.1", int $port = 0): Server { $this->servers[] = new Server($engine, $host, $port); return end($this->servers); }
[ "public", "function", "addServer", "(", "int", "$", "engine", ",", "string", "$", "host", "=", "\"127.0.0.1\"", ",", "int", "$", "port", "=", "0", ")", ":", "Server", "{", "$", "this", "->", "servers", "[", "]", "=", "new", "Server", "(", "$", "eng...
Add a server to connection queue Multiple cache servers may be added before connection, if connection fails with first server then Comely Cache component will try to connect to next server. @param int $engine @param string $host @param int $port @return Server @throws ConnectionException
[ "Add", "a", "server", "to", "connection", "queue" ]
train
https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Cache/Cache.php#L84-L88
comelyio/comely
src/Comely/IO/Cache/Cache.php
Cache.connect
public function connect(): void { /** @var $server Server */ $attempts = 0; foreach ($this->servers as $server) { try { $attempts++; if ($server->engine === self::REDIS) { $engine = new Redis($server); } elseif (...
php
public function connect(): void { /** @var $server Server */ $attempts = 0; foreach ($this->servers as $server) { try { $attempts++; if ($server->engine === self::REDIS) { $engine = new Redis($server); } elseif (...
[ "public", "function", "connect", "(", ")", ":", "void", "{", "/** @var $server Server */", "$", "attempts", "=", "0", ";", "foreach", "(", "$", "this", "->", "servers", "as", "$", "server", ")", "{", "try", "{", "$", "attempts", "++", ";", "if", "(", ...
Establish connection with cache server(s) This method will try to establish connection with servers in order they were added. Each failed connection will trigger an error message (E_USER_WARNING), and if all of the connections fail then a ConnectionException will be thrown. @throws ConnectionException
[ "Establish", "connection", "with", "cache", "server", "(", "s", ")" ]
train
https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Cache/Cache.php#L109-L136
comelyio/comely
src/Comely/IO/Cache/Cache.php
Cache.disconnect
public function disconnect(): void { if ($this->engine) { $this->engine->disconnect(); } $this->engine = null; }
php
public function disconnect(): void { if ($this->engine) { $this->engine->disconnect(); } $this->engine = null; }
[ "public", "function", "disconnect", "(", ")", ":", "void", "{", "if", "(", "$", "this", "->", "engine", ")", "{", "$", "this", "->", "engine", "->", "disconnect", "(", ")", ";", "}", "$", "this", "->", "engine", "=", "null", ";", "}" ]
Disconnect from currently connected cache server/engine
[ "Disconnect", "from", "currently", "connected", "cache", "server", "/", "engine" ]
train
https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Cache/Cache.php#L141-L148
comelyio/comely
src/Comely/IO/Cache/Cache.php
Cache.isConnected
public function isConnected(): bool { if ($this->engine) { $connected = $this->engine->isConnected(); if (!$connected) { $this->engine = null; } return $connected; } return false; }
php
public function isConnected(): bool { if ($this->engine) { $connected = $this->engine->isConnected(); if (!$connected) { $this->engine = null; } return $connected; } return false; }
[ "public", "function", "isConnected", "(", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "engine", ")", "{", "$", "connected", "=", "$", "this", "->", "engine", "->", "isConnected", "(", ")", ";", "if", "(", "!", "$", "connected", ")", "{", ...
Check connection status @return bool
[ "Check", "connection", "status" ]
train
https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Cache/Cache.php#L154-L166
comelyio/comely
src/Comely/IO/Cache/Cache.php
Cache.ping
public function ping(bool $reconnect = false): bool { if ($this->engine) { $ping = $this->engine->ping(); if (!$ping) { $this->engine = null; if ($reconnect) { $this->connect(); } } return $p...
php
public function ping(bool $reconnect = false): bool { if ($this->engine) { $ping = $this->engine->ping(); if (!$ping) { $this->engine = null; if ($reconnect) { $this->connect(); } } return $p...
[ "public", "function", "ping", "(", "bool", "$", "reconnect", "=", "false", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "engine", ")", "{", "$", "ping", "=", "$", "this", "->", "engine", "->", "ping", "(", ")", ";", "if", "(", "!", "$",...
Ping Cache Server This method will not only check the connection status, but also attempt to ping cache server. On failure, cache component will be disconnected with cache server/engine. Optional $reconnect param. may be passed to attempt reconnection on failure. @param bool $reconnect @return bool @throws Connection...
[ "Ping", "Cache", "Server" ]
train
https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Cache/Cache.php#L180-L195
comelyio/comely
src/Comely/IO/Cache/Cache.php
Cache.set
public function set(string $key, $value, int $ttl = 0): bool { $this->checkConnection(__METHOD__); // Get type of value being stored $valueType = gettype($value); // Floats are evil, they should be converted to strings if ($valueType === "double") { $valueType =...
php
public function set(string $key, $value, int $ttl = 0): bool { $this->checkConnection(__METHOD__); // Get type of value being stored $valueType = gettype($value); // Floats are evil, they should be converted to strings if ($valueType === "double") { $valueType =...
[ "public", "function", "set", "(", "string", "$", "key", ",", "$", "value", ",", "int", "$", "ttl", "=", "0", ")", ":", "bool", "{", "$", "this", "->", "checkConnection", "(", "__METHOD__", ")", ";", "// Get type of value being stored", "$", "valueType", ...
Store a key/value on cache engine/server Long strings, objects, arrays, NULL and booleans are first encoded as CacheItem and then stored serialized. @param string $key @param $value @param int $ttl @return bool @throws CacheException @throws EngineException
[ "Store", "a", "key", "/", "value", "on", "cache", "engine", "/", "server" ]
train
https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Cache/Cache.php#L209-L249
comelyio/comely
src/Comely/IO/Cache/Cache.php
Cache.get
public function get(string $key, bool $returnCacheable = false) { $this->checkConnection(__METHOD__); $value = $this->engine->get($key); if (is_string($value)) { $value = trim($value); // trim if (strlen($value) >= $this->cacheableLengthFrom) { if (su...
php
public function get(string $key, bool $returnCacheable = false) { $this->checkConnection(__METHOD__); $value = $this->engine->get($key); if (is_string($value)) { $value = trim($value); // trim if (strlen($value) >= $this->cacheableLengthFrom) { if (su...
[ "public", "function", "get", "(", "string", "$", "key", ",", "bool", "$", "returnCacheable", "=", "false", ")", "{", "$", "this", "->", "checkConnection", "(", "__METHOD__", ")", ";", "$", "value", "=", "$", "this", "->", "engine", "->", "get", "(", ...
Get value for provided key from cache engine/server This method will return NULL if key doesn't exist on cache server. An exception is thrown if there was an error communicating with cache engine. If value is stored after encoding as CacheItem/CacheableInterface object then the actual stored value will be returned, op...
[ "Get", "value", "for", "provided", "key", "from", "cache", "engine", "/", "server" ]
train
https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Cache/Cache.php#L265-L285
comelyio/comely
src/Comely/IO/Cache/Cache.php
Cache.has
public function has(string $key): bool { $this->checkConnection(__METHOD__); return $this->engine->has($key); }
php
public function has(string $key): bool { $this->checkConnection(__METHOD__); return $this->engine->has($key); }
[ "public", "function", "has", "(", "string", "$", "key", ")", ":", "bool", "{", "$", "this", "->", "checkConnection", "(", "__METHOD__", ")", ";", "return", "$", "this", "->", "engine", "->", "has", "(", "$", "key", ")", ";", "}" ]
Checks if a data exists on cache server corresponding to provided key @param string $key @return bool @throws CacheException @throws EngineException
[ "Checks", "if", "a", "data", "exists", "on", "cache", "server", "corresponding", "to", "provided", "key" ]
train
https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Cache/Cache.php#L295-L299
comelyio/comely
src/Comely/IO/Cache/Cache.php
Cache.delete
public function delete(string $key): bool { $this->checkConnection(__METHOD__); $delete = $this->engine->delete($key); if ($delete && $this->index) { $this->index->events() ->trigger(Indexing::EVENT_ON_DELETE) ->params($key) ->fire(...
php
public function delete(string $key): bool { $this->checkConnection(__METHOD__); $delete = $this->engine->delete($key); if ($delete && $this->index) { $this->index->events() ->trigger(Indexing::EVENT_ON_DELETE) ->params($key) ->fire(...
[ "public", "function", "delete", "(", "string", "$", "key", ")", ":", "bool", "{", "$", "this", "->", "checkConnection", "(", "__METHOD__", ")", ";", "$", "delete", "=", "$", "this", "->", "engine", "->", "delete", "(", "$", "key", ")", ";", "if", "...
Delete an stored item with provided key on cache server @param string $key @return bool @throws CacheException @throws EngineException
[ "Delete", "an", "stored", "item", "with", "provided", "key", "on", "cache", "server" ]
train
https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Cache/Cache.php#L309-L321
comelyio/comely
src/Comely/IO/Cache/Cache.php
Cache.flush
public function flush(): bool { $this->checkConnection(__METHOD__); $flush = $this->engine->flush(); if ($flush && $this->index) { $this->index->events()->trigger(Indexing::EVENT_ON_FLUSH) ->fire(); } return $flush; }
php
public function flush(): bool { $this->checkConnection(__METHOD__); $flush = $this->engine->flush(); if ($flush && $this->index) { $this->index->events()->trigger(Indexing::EVENT_ON_FLUSH) ->fire(); } return $flush; }
[ "public", "function", "flush", "(", ")", ":", "bool", "{", "$", "this", "->", "checkConnection", "(", "__METHOD__", ")", ";", "$", "flush", "=", "$", "this", "->", "engine", "->", "flush", "(", ")", ";", "if", "(", "$", "flush", "&&", "$", "this", ...
Flushes all stored data from cache server @return bool @throws CacheException @throws EngineException
[ "Flushes", "all", "stored", "data", "from", "cache", "server" ]
train
https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Cache/Cache.php#L330-L340
comelyio/comely
src/Comely/IO/Cache/Cache.php
Cache.countUp
public function countUp(string $key, int $inc = 1): int { $this->checkConnection(__METHOD__); return $this->engine->countUp($key, $inc); }
php
public function countUp(string $key, int $inc = 1): int { $this->checkConnection(__METHOD__); return $this->engine->countUp($key, $inc); }
[ "public", "function", "countUp", "(", "string", "$", "key", ",", "int", "$", "inc", "=", "1", ")", ":", "int", "{", "$", "this", "->", "checkConnection", "(", "__METHOD__", ")", ";", "return", "$", "this", "->", "engine", "->", "countUp", "(", "$", ...
Increase stored integer value If key doesn't already exist, a new key will be created with value 0 before increment @param string $key @param int $inc @return int @throws CacheException @throws EngineException
[ "Increase", "stored", "integer", "value", "If", "key", "doesn", "t", "already", "exist", "a", "new", "key", "will", "be", "created", "with", "value", "0", "before", "increment" ]
train
https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Cache/Cache.php#L352-L356
comelyio/comely
src/Comely/IO/Cache/Cache.php
Cache.countDown
public function countDown(string $key, int $dec = 1): int { $this->checkConnection(__METHOD__); return $this->engine->countDown($key, $dec); }
php
public function countDown(string $key, int $dec = 1): int { $this->checkConnection(__METHOD__); return $this->engine->countDown($key, $dec); }
[ "public", "function", "countDown", "(", "string", "$", "key", ",", "int", "$", "dec", "=", "1", ")", ":", "int", "{", "$", "this", "->", "checkConnection", "(", "__METHOD__", ")", ";", "return", "$", "this", "->", "engine", "->", "countDown", "(", "$...
Decrease stored integer value If key doesn't already exist, a new key will be created with value 0 before decrement @param string $key @param int $dec @return int @throws CacheException @throws EngineException
[ "Decrease", "stored", "integer", "value", "If", "key", "doesn", "t", "already", "exist", "a", "new", "key", "will", "be", "created", "with", "value", "0", "before", "decrement" ]
train
https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Cache/Cache.php#L368-L372
comelyio/comely
src/Comely/IO/Cache/Cache.php
Cache.setCacheableIdentifier
public function setCacheableIdentifier(string $id = null, int $length = null): self { if ($id) { if (!preg_match('/^[a-zA-Z0-9\_\-\~\.]{8,32}$/', $id)) { throw new CacheException('Invalid value passed to "setCacheableIdentifier" method'); } $this->cacheab...
php
public function setCacheableIdentifier(string $id = null, int $length = null): self { if ($id) { if (!preg_match('/^[a-zA-Z0-9\_\-\~\.]{8,32}$/', $id)) { throw new CacheException('Invalid value passed to "setCacheableIdentifier" method'); } $this->cacheab...
[ "public", "function", "setCacheableIdentifier", "(", "string", "$", "id", "=", "null", ",", "int", "$", "length", "=", "null", ")", ":", "self", "{", "if", "(", "$", "id", ")", "{", "if", "(", "!", "preg_match", "(", "'/^[a-zA-Z0-9\\_\\-\\~\\.]{8,32}$/'", ...
Set custom identifier for objects extending CacheableInterface @param string|null $id @param int|null $length @return Cache @throws CacheException
[ "Set", "custom", "identifier", "for", "objects", "extending", "CacheableInterface" ]
train
https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Cache/Cache.php#L431-L451
yishixincheng/Xl_WeApp_SDK
src/Service/PayService.php
PayService.orderQuery
public function orderQuery($params,$timeOut=6){ $url='https://api.mch.weixin.qq.com/pay/orderquery'; $inputObj=new WxPayParam(); $inputObj->setValues($params); //置入参数 if(!$inputObj->isKeySet("transaction_id")&&!$inputObj->isKeySet("out_trade_no")){ throw new \Exception...
php
public function orderQuery($params,$timeOut=6){ $url='https://api.mch.weixin.qq.com/pay/orderquery'; $inputObj=new WxPayParam(); $inputObj->setValues($params); //置入参数 if(!$inputObj->isKeySet("transaction_id")&&!$inputObj->isKeySet("out_trade_no")){ throw new \Exception...
[ "public", "function", "orderQuery", "(", "$", "params", ",", "$", "timeOut", "=", "6", ")", "{", "$", "url", "=", "'https://api.mch.weixin.qq.com/pay/orderquery'", ";", "$", "inputObj", "=", "new", "WxPayParam", "(", ")", ";", "$", "inputObj", "->", "setValu...
订单查询 https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_2
[ "订单查询", "https", ":", "//", "pay", ".", "weixin", ".", "qq", ".", "com", "/", "wiki", "/", "doc", "/", "api", "/", "wxa", "/", "wxa_api", ".", "php?chapter", "=", "9_2" ]
train
https://github.com/yishixincheng/Xl_WeApp_SDK/blob/26e58154e2aceccd6ffb92c4ed2b1c5a0b6414da/src/Service/PayService.php#L75-L102
yishixincheng/Xl_WeApp_SDK
src/Service/PayService.php
PayService.postXmlCurl
private static function postXmlCurl($xml, $url, $useCert = false, $second = 30) { $ch = curl_init(); //设置超时 curl_setopt($ch, CURLOPT_TIMEOUT, $second); //如果有配置代理这里就设置代理 if(Config::getCURL_PROXY_HOST() != "0.0.0.0" && Config::getCURL_PROXY_PORT() != 0){ curl_setop...
php
private static function postXmlCurl($xml, $url, $useCert = false, $second = 30) { $ch = curl_init(); //设置超时 curl_setopt($ch, CURLOPT_TIMEOUT, $second); //如果有配置代理这里就设置代理 if(Config::getCURL_PROXY_HOST() != "0.0.0.0" && Config::getCURL_PROXY_PORT() != 0){ curl_setop...
[ "private", "static", "function", "postXmlCurl", "(", "$", "xml", ",", "$", "url", ",", "$", "useCert", "=", "false", ",", "$", "second", "=", "30", ")", "{", "$", "ch", "=", "curl_init", "(", ")", ";", "//设置超时", "curl_setopt", "(", "$", "ch", ",", ...
以post方式提交xml到对应的接口url @param string $xml 需要post的xml数据 @param string $url url @param bool $useCert 是否需要证书,默认不需要 @param int $second url执行超时时间,默认30s @throws WxPayException
[ "以post方式提交xml到对应的接口url" ]
train
https://github.com/yishixincheng/Xl_WeApp_SDK/blob/26e58154e2aceccd6ffb92c4ed2b1c5a0b6414da/src/Service/PayService.php#L347-L388
braincrafted/arrayquery
src/Braincrafted/ArrayQuery/QueryBuilder.php
QueryBuilder.getSelectEvaluation
protected function getSelectEvaluation($selectEvaluation = null) { if (null !== $selectEvaluation && false === ($selectEvaluation instanceof SelectEvaluation)) { throw new \InvalidArgumentException('Argument "selectEvaluation" must be an instance of SelectEvaluation.'); } if (nul...
php
protected function getSelectEvaluation($selectEvaluation = null) { if (null !== $selectEvaluation && false === ($selectEvaluation instanceof SelectEvaluation)) { throw new \InvalidArgumentException('Argument "selectEvaluation" must be an instance of SelectEvaluation.'); } if (nul...
[ "protected", "function", "getSelectEvaluation", "(", "$", "selectEvaluation", "=", "null", ")", "{", "if", "(", "null", "!==", "$", "selectEvaluation", "&&", "false", "===", "(", "$", "selectEvaluation", "instanceof", "SelectEvaluation", ")", ")", "{", "throw", ...
@param SelectEvaluation $selectEvaluation @return SelectEvaluation
[ "@param", "SelectEvaluation", "$selectEvaluation" ]
train
https://github.com/braincrafted/arrayquery/blob/8b0c44ee76cea796589422f52e2f7130676b9bd1/src/Braincrafted/ArrayQuery/QueryBuilder.php#L56-L70
braincrafted/arrayquery
src/Braincrafted/ArrayQuery/QueryBuilder.php
QueryBuilder.getWhereEvaluation
protected function getWhereEvaluation($whereEvaluation = null) { if (null !== $whereEvaluation && false === ($whereEvaluation instanceof WhereEvaluation)) { throw new \InvalidArgumentException('Argument "whereEvaluation" must be an instance of WhereEvaluation.'); } if (null === $...
php
protected function getWhereEvaluation($whereEvaluation = null) { if (null !== $whereEvaluation && false === ($whereEvaluation instanceof WhereEvaluation)) { throw new \InvalidArgumentException('Argument "whereEvaluation" must be an instance of WhereEvaluation.'); } if (null === $...
[ "protected", "function", "getWhereEvaluation", "(", "$", "whereEvaluation", "=", "null", ")", "{", "if", "(", "null", "!==", "$", "whereEvaluation", "&&", "false", "===", "(", "$", "whereEvaluation", "instanceof", "WhereEvaluation", ")", ")", "{", "throw", "ne...
@param WhereEvaluation $whereEvaluation @return WhereEvaluation
[ "@param", "WhereEvaluation", "$whereEvaluation" ]
train
https://github.com/braincrafted/arrayquery/blob/8b0c44ee76cea796589422f52e2f7130676b9bd1/src/Braincrafted/ArrayQuery/QueryBuilder.php#L77-L94
blackprism/serializer
src/Blackprism/Serializer/Json/Deserialize.php
Deserialize.decodeJson
private function decodeJson(string $serialized) { $objectsAsArray = json_decode($serialized, true); if (json_last_error() !== JSON_ERROR_NONE) { throw new InvalidJson(json_last_error_msg()); } return $objectsAsArray; }
php
private function decodeJson(string $serialized) { $objectsAsArray = json_decode($serialized, true); if (json_last_error() !== JSON_ERROR_NONE) { throw new InvalidJson(json_last_error_msg()); } return $objectsAsArray; }
[ "private", "function", "decodeJson", "(", "string", "$", "serialized", ")", "{", "$", "objectsAsArray", "=", "json_decode", "(", "$", "serialized", ",", "true", ")", ";", "if", "(", "json_last_error", "(", ")", "!==", "JSON_ERROR_NONE", ")", "{", "throw", ...
@param string $serialized @return mixed @throws InvalidJson
[ "@param", "string", "$serialized" ]
train
https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Deserialize.php#L42-L51
blackprism/serializer
src/Blackprism/Serializer/Json/Deserialize.php
Deserialize.deserialize
public function deserialize(string $serialized, ClassName $className = null) { $objectsAsArray = $this->decodeJson($serialized); if ($className !== null) { return $this->setObjectForClass($className, $objectsAsArray); } return $this->setObject($objectsAsArray); }
php
public function deserialize(string $serialized, ClassName $className = null) { $objectsAsArray = $this->decodeJson($serialized); if ($className !== null) { return $this->setObjectForClass($className, $objectsAsArray); } return $this->setObject($objectsAsArray); }
[ "public", "function", "deserialize", "(", "string", "$", "serialized", ",", "ClassName", "$", "className", "=", "null", ")", "{", "$", "objectsAsArray", "=", "$", "this", "->", "decodeJson", "(", "$", "serialized", ")", ";", "if", "(", "$", "className", ...
Deserialize string with class as the root object @param string $serialized @param ClassName $className @return object|object[] @throws InvalidJson @throws UndefinedIdentifierAttribute @throws MissingIdentifierAttribute
[ "Deserialize", "string", "with", "class", "as", "the", "root", "object" ]
train
https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Deserialize.php#L64-L73
blackprism/serializer
src/Blackprism/Serializer/Json/Deserialize.php
Deserialize.deserializeCollection
public function deserializeCollection(string $serialized, ClassName $className) { $objectsAsArray = $this->decodeJson($serialized); $objects = []; foreach ($objectsAsArray as $attribute => $object) { $objects[$attribute] = $this->setObjectForClass($className, $object); }...
php
public function deserializeCollection(string $serialized, ClassName $className) { $objectsAsArray = $this->decodeJson($serialized); $objects = []; foreach ($objectsAsArray as $attribute => $object) { $objects[$attribute] = $this->setObjectForClass($className, $object); }...
[ "public", "function", "deserializeCollection", "(", "string", "$", "serialized", ",", "ClassName", "$", "className", ")", "{", "$", "objectsAsArray", "=", "$", "this", "->", "decodeJson", "(", "$", "serialized", ")", ";", "$", "objects", "=", "[", "]", ";"...
Deserialize string with class as the root object @param string $serialized @param ClassName $className @return object[] @throws InvalidJson @throws UndefinedIdentifierAttribute @throws MissingIdentifierAttribute
[ "Deserialize", "string", "with", "class", "as", "the", "root", "object" ]
train
https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Deserialize.php#L86-L96
blackprism/serializer
src/Blackprism/Serializer/Json/Deserialize.php
Deserialize.setObject
private function setObject(array $data) { $identifierAttribute = $this->configuration->getIdentifierAttribute(); if ($identifierAttribute === null) { throw new UndefinedIdentifierAttribute(); } // We found an identifier attribute, $data is a json object if (isse...
php
private function setObject(array $data) { $identifierAttribute = $this->configuration->getIdentifierAttribute(); if ($identifierAttribute === null) { throw new UndefinedIdentifierAttribute(); } // We found an identifier attribute, $data is a json object if (isse...
[ "private", "function", "setObject", "(", "array", "$", "data", ")", "{", "$", "identifierAttribute", "=", "$", "this", "->", "configuration", "->", "getIdentifierAttribute", "(", ")", ";", "if", "(", "$", "identifierAttribute", "===", "null", ")", "{", "thro...
Create class object with data @param mixed[] $data @return object|object[] @throws UndefinedIdentifierAttribute @throws MissingIdentifierAttribute
[ "Create", "class", "object", "with", "data" ]
train
https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Deserialize.php#L107-L122
blackprism/serializer
src/Blackprism/Serializer/Json/Deserialize.php
Deserialize.setObjectForObjectData
private function setObjectForObjectData(string $identifierAttribute, array $data) { $configurationObject = $this->configuration ->getConfigurationObjectForIdentifier($data[$identifierAttribute]); $className = $configurationObject->getClassName(); $fqdnClass = $className->getValue...
php
private function setObjectForObjectData(string $identifierAttribute, array $data) { $configurationObject = $this->configuration ->getConfigurationObjectForIdentifier($data[$identifierAttribute]); $className = $configurationObject->getClassName(); $fqdnClass = $className->getValue...
[ "private", "function", "setObjectForObjectData", "(", "string", "$", "identifierAttribute", ",", "array", "$", "data", ")", "{", "$", "configurationObject", "=", "$", "this", "->", "configuration", "->", "getConfigurationObjectForIdentifier", "(", "$", "data", "[", ...
@param string $identifierAttribute @param array $data @return mixed
[ "@param", "string", "$identifierAttribute", "@param", "array", "$data" ]
train
https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Deserialize.php#L130-L148
blackprism/serializer
src/Blackprism/Serializer/Json/Deserialize.php
Deserialize.setObjectForCollectionData
private function setObjectForCollectionData(array $data) { $objects = []; foreach ($data as $attribute => $object) { if (is_array($object) === false) { throw new MissingIdentifierAttribute(); } $objects[$attribute] = $this->setObject($object); ...
php
private function setObjectForCollectionData(array $data) { $objects = []; foreach ($data as $attribute => $object) { if (is_array($object) === false) { throw new MissingIdentifierAttribute(); } $objects[$attribute] = $this->setObject($object); ...
[ "private", "function", "setObjectForCollectionData", "(", "array", "$", "data", ")", "{", "$", "objects", "=", "[", "]", ";", "foreach", "(", "$", "data", "as", "$", "attribute", "=>", "$", "object", ")", "{", "if", "(", "is_array", "(", "$", "object",...
@param mixed[] $data @return object[] @throws MissingIdentifierAttribute @throws UndefinedIdentifierAttribute
[ "@param", "mixed", "[]", "$data" ]
train
https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Deserialize.php#L158-L170
blackprism/serializer
src/Blackprism/Serializer/Json/Deserialize.php
Deserialize.setObjectForClass
private function setObjectForClass(ClassName $className, array $data) { $fqdnClass = $className->getValue(); $object = new $fqdnClass(); foreach ($data as $attribute => $value) { $configurationObject = $this->configuration->getConfigurationObjectForClass($className); ...
php
private function setObjectForClass(ClassName $className, array $data) { $fqdnClass = $className->getValue(); $object = new $fqdnClass(); foreach ($data as $attribute => $value) { $configurationObject = $this->configuration->getConfigurationObjectForClass($className); ...
[ "private", "function", "setObjectForClass", "(", "ClassName", "$", "className", ",", "array", "$", "data", ")", "{", "$", "fqdnClass", "=", "$", "className", "->", "getValue", "(", ")", ";", "$", "object", "=", "new", "$", "fqdnClass", "(", ")", ";", "...
Create $className object with data @param ClassName $className @param mixed[] $data @return object|object[]
[ "Create", "$className", "object", "with", "data" ]
train
https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Deserialize.php#L180-L193
blackprism/serializer
src/Blackprism/Serializer/Json/Deserialize.php
Deserialize.processDeserializeTypeMethod
private function processDeserializeTypeMethod(Type\Method $method, $object, $value): self { $object->{$method->setter()}($value); return $this; }
php
private function processDeserializeTypeMethod(Type\Method $method, $object, $value): self { $object->{$method->setter()}($value); return $this; }
[ "private", "function", "processDeserializeTypeMethod", "(", "Type", "\\", "Method", "$", "method", ",", "$", "object", ",", "$", "value", ")", ":", "self", "{", "$", "object", "->", "{", "$", "method", "->", "setter", "(", ")", "}", "(", "$", "value", ...
@param Type\Method $method @param object $object @param mixed $value @return Deserialize
[ "@param", "Type", "\\", "Method", "$method", "@param", "object", "$object", "@param", "mixed", "$value" ]
train
https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Deserialize.php#L224-L229
blackprism/serializer
src/Blackprism/Serializer/Json/Deserialize.php
Deserialize.processDeserializeTypeObject
private function processDeserializeTypeObject(Type\Object $objectType, $object, $value): self { $object->{$objectType->setter()}($this->setObjectForClass($objectType->className(), $value)); return $this; }
php
private function processDeserializeTypeObject(Type\Object $objectType, $object, $value): self { $object->{$objectType->setter()}($this->setObjectForClass($objectType->className(), $value)); return $this; }
[ "private", "function", "processDeserializeTypeObject", "(", "Type", "\\", "Object", "$", "objectType", ",", "$", "object", ",", "$", "value", ")", ":", "self", "{", "$", "object", "->", "{", "$", "objectType", "->", "setter", "(", ")", "}", "(", "$", "...
@param Type\Object $objectType @param object $object @param mixed $value @return Deserialize
[ "@param", "Type", "\\", "Object", "$objectType", "@param", "object", "$object", "@param", "mixed", "$value" ]
train
https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Deserialize.php#L238-L243
blackprism/serializer
src/Blackprism/Serializer/Json/Deserialize.php
Deserialize.processDeserializeTypeCollectionObject
private function processDeserializeTypeCollectionObject(Type\Collection\Object $objectType, $object, array $values) { $objects = []; foreach ($values as $key => $objectFromValue) { $objects[$key] = $this->setObjectForClass($objectType->className(), $objectFromValue); } $...
php
private function processDeserializeTypeCollectionObject(Type\Collection\Object $objectType, $object, array $values) { $objects = []; foreach ($values as $key => $objectFromValue) { $objects[$key] = $this->setObjectForClass($objectType->className(), $objectFromValue); } $...
[ "private", "function", "processDeserializeTypeCollectionObject", "(", "Type", "\\", "Collection", "\\", "Object", "$", "objectType", ",", "$", "object", ",", "array", "$", "values", ")", "{", "$", "objects", "=", "[", "]", ";", "foreach", "(", "$", "values",...
@param Type\Collection\Object $objectType @param object $object @param array $values @return Deserialize
[ "@param", "Type", "\\", "Collection", "\\", "Object", "$objectType", "@param", "object", "$object", "@param", "array", "$values" ]
train
https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Deserialize.php#L252-L262
blackprism/serializer
src/Blackprism/Serializer/Json/Deserialize.php
Deserialize.processDeserializeTypeIdentifiedObject
private function processDeserializeTypeIdentifiedObject(Type\IdentifiedObject $objectType, $object, $value): self { $identifierAttribute = $this->configuration->getIdentifierAttribute(); if (isset($value[$identifierAttribute]) === false) { return $this; } $configuration...
php
private function processDeserializeTypeIdentifiedObject(Type\IdentifiedObject $objectType, $object, $value): self { $identifierAttribute = $this->configuration->getIdentifierAttribute(); if (isset($value[$identifierAttribute]) === false) { return $this; } $configuration...
[ "private", "function", "processDeserializeTypeIdentifiedObject", "(", "Type", "\\", "IdentifiedObject", "$", "objectType", ",", "$", "object", ",", "$", "value", ")", ":", "self", "{", "$", "identifierAttribute", "=", "$", "this", "->", "configuration", "->", "g...
@param Type\IdentifiedObject $objectType @param object $object @param mixed $value @return Deserialize
[ "@param", "Type", "\\", "IdentifiedObject", "$objectType", "@param", "object", "$object", "@param", "mixed", "$value" ]
train
https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Deserialize.php#L271-L288
blackprism/serializer
src/Blackprism/Serializer/Json/Deserialize.php
Deserialize.processDeserializeTypeCollectionIdentifiedObject
private function processDeserializeTypeCollectionIdentifiedObject( Type\Collection\IdentifiedObject $objectType, $object, array $values ): self { $identifierAttribute = $this->configuration->getIdentifierAttribute(); $objects = []; foreach ($values as $key => $object...
php
private function processDeserializeTypeCollectionIdentifiedObject( Type\Collection\IdentifiedObject $objectType, $object, array $values ): self { $identifierAttribute = $this->configuration->getIdentifierAttribute(); $objects = []; foreach ($values as $key => $object...
[ "private", "function", "processDeserializeTypeCollectionIdentifiedObject", "(", "Type", "\\", "Collection", "\\", "IdentifiedObject", "$", "objectType", ",", "$", "object", ",", "array", "$", "values", ")", ":", "self", "{", "$", "identifierAttribute", "=", "$", "...
@param Type\Collection\IdentifiedObject $objectType @param object $object @param array $values @return Deserialize
[ "@param", "Type", "\\", "Collection", "\\", "IdentifiedObject", "$objectType", "@param", "object", "$object", "@param", "array", "$values" ]
train
https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Deserialize.php#L297-L323
blackprism/serializer
src/Blackprism/Serializer/Json/Deserialize.php
Deserialize.processDeserializeTypeHandler
private function processDeserializeTypeHandler(Type\Handler $handler, $object, $value): self { $handler->deserializer()->deserialize($object, $value); return $this; }
php
private function processDeserializeTypeHandler(Type\Handler $handler, $object, $value): self { $handler->deserializer()->deserialize($object, $value); return $this; }
[ "private", "function", "processDeserializeTypeHandler", "(", "Type", "\\", "Handler", "$", "handler", ",", "$", "object", ",", "$", "value", ")", ":", "self", "{", "$", "handler", "->", "deserializer", "(", ")", "->", "deserialize", "(", "$", "object", ","...
@param Type\Handler $handler @param object $object @param mixed $value @return Deserialize
[ "@param", "Type", "\\", "Handler", "$handler", "@param", "object", "$object", "@param", "mixed", "$value" ]
train
https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Deserialize.php#L332-L337
FrenchFrogs/framework
src/Html/Element/Button.php
Button.icon
public function icon($icon, $is_icon_only = true) { $this->setIcon($icon); ($is_icon_only) ? $this->enableIconOnly() : $this->disableIconOnly(); return $this; }
php
public function icon($icon, $is_icon_only = true) { $this->setIcon($icon); ($is_icon_only) ? $this->enableIconOnly() : $this->disableIconOnly(); return $this; }
[ "public", "function", "icon", "(", "$", "icon", ",", "$", "is_icon_only", "=", "true", ")", "{", "$", "this", "->", "setIcon", "(", "$", "icon", ")", ";", "(", "$", "is_icon_only", ")", "?", "$", "this", "->", "enableIconOnly", "(", ")", ":", "$", ...
Fast setting for icon @param $icon @param bool|true $is_icon_only @return $this
[ "Fast", "setting", "for", "icon" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Html/Element/Button.php#L48-L53
phpmob/twig-modify-bundle
DependencyInjection/PhpMobTwigModifyExtension.php
PhpMobTwigModifyExtension.load
public function load(array $configs, ContainerBuilder $container) { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); $container->setParameter('phpmob_twig_modify.enabled', $config['enabled']); $loader = new Loader\XmlFileLoader(...
php
public function load(array $configs, ContainerBuilder $container) { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); $container->setParameter('phpmob_twig_modify.enabled', $config['enabled']); $loader = new Loader\XmlFileLoader(...
[ "public", "function", "load", "(", "array", "$", "configs", ",", "ContainerBuilder", "$", "container", ")", "{", "$", "configuration", "=", "new", "Configuration", "(", ")", ";", "$", "config", "=", "$", "this", "->", "processConfiguration", "(", "$", "con...
{@inheritdoc}
[ "{" ]
train
https://github.com/phpmob/twig-modify-bundle/blob/30b70ca3ea7b902f2f29c8457cd4f8da45b1d29e/DependencyInjection/PhpMobTwigModifyExtension.php#L36-L54
yosmanyga/resource
src/Yosmanyga/Resource/Reader/Iterator/InMemoryReader.php
InMemoryReader.open
public function open(Resource $resource) { $this->data = $resource->getMetadata('data'); if (!is_array($this->data)) { throw new \InvalidArgumentException('Resource "data" metadata is not an array'); } }
php
public function open(Resource $resource) { $this->data = $resource->getMetadata('data'); if (!is_array($this->data)) { throw new \InvalidArgumentException('Resource "data" metadata is not an array'); } }
[ "public", "function", "open", "(", "Resource", "$", "resource", ")", "{", "$", "this", "->", "data", "=", "$", "resource", "->", "getMetadata", "(", "'data'", ")", ";", "if", "(", "!", "is_array", "(", "$", "this", "->", "data", ")", ")", "{", "thr...
{@inheritdoc}
[ "{" ]
train
https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Reader/Iterator/InMemoryReader.php#L38-L45