repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
bartonlp/site-class
includes/database-engines/dbMysql.class.php
dbMysql.maketbodyrows
public function maketbodyrows($query, $rowdesc, $callback=null, &$retresult=false, $delim=false) { // $rowdesc is the <tr>...</tr> for this row // <tr><td>fieldname</td>...</tr> list($result, $num) = $this->query($query, true); if(!$num) { return false; } if($retresult !== false) $...
php
public function maketbodyrows($query, $rowdesc, $callback=null, &$retresult=false, $delim=false) { // $rowdesc is the <tr>...</tr> for this row // <tr><td>fieldname</td>...</tr> list($result, $num) = $this->query($query, true); if(!$num) { return false; } if($retresult !== false) $...
[ "public", "function", "maketbodyrows", "(", "$", "query", ",", "$", "rowdesc", ",", "$", "callback", "=", "null", ",", "&", "$", "retresult", "=", "false", ",", "$", "delim", "=", "false", ")", "{", "// $rowdesc is the <tr>...</tr> for this row", "// <tr><td>f...
Make Tbody Row Make a table row given the query and a template of the row Call back function looks like: callback(&$row, &$rowdesc) it can modify $row and $rowdesc and returns true if we should skip (continue) or false to process. @param string $query the mysql query @param string $rowdesc the tbody row description @p...
[ "Make", "Tbody", "Row" ]
9095b101701ef0ae12ea9a2b4587a18072d04438
https://github.com/bartonlp/site-class/blob/9095b101701ef0ae12ea9a2b4587a18072d04438/includes/database-engines/dbMysql.class.php#L209-L259
train
bartonlp/site-class
includes/database-engines/dbMysql.class.php
dbMysql.maketable
public function maketable($query, array $extra=null) { $table = "<table"; if($extra['attr']) { $attr = $extra['attr']; foreach($attr as $k=>$v) { $table .= " $k='$v'"; } } $table .= ">\n<thead>\n<tr>%<th>*</th>%</tr>\n</thead>"; $rowdesc = "<tr><td>*</td></tr>"; $delim ...
php
public function maketable($query, array $extra=null) { $table = "<table"; if($extra['attr']) { $attr = $extra['attr']; foreach($attr as $k=>$v) { $table .= " $k='$v'"; } } $table .= ">\n<thead>\n<tr>%<th>*</th>%</tr>\n</thead>"; $rowdesc = "<tr><td>*</td></tr>"; $delim ...
[ "public", "function", "maketable", "(", "$", "query", ",", "array", "$", "extra", "=", "null", ")", "{", "$", "table", "=", "\"<table\"", ";", "if", "(", "$", "extra", "[", "'attr'", "]", ")", "{", "$", "attr", "=", "$", "extra", "[", "'attr'", "...
Make a full table @param string $query : the table query @param array $extra : optional. $extra is an optional assoc array: $extra['callback'], $extra['callback2'], $extra['footer'] and $extra['attr']. $extra['attr'] is an assoc array that can have attributes for the <table> tag, like 'id', 'title', 'class', 'style' e...
[ "Make", "a", "full", "table" ]
9095b101701ef0ae12ea9a2b4587a18072d04438
https://github.com/bartonlp/site-class/blob/9095b101701ef0ae12ea9a2b4587a18072d04438/includes/database-engines/dbMysql.class.php#L436-L472
train
Dhii/validation-base
src/Exception/ValidationFailedException.php
ValidationFailedException._initParent
protected function _initParent($message = '', $code = 0, RootException $previous = null) { parent::__construct($message, $code, $previous); }
php
protected function _initParent($message = '', $code = 0, RootException $previous = null) { parent::__construct($message, $code, $previous); }
[ "protected", "function", "_initParent", "(", "$", "message", "=", "''", ",", "$", "code", "=", "0", ",", "RootException", "$", "previous", "=", "null", ")", "{", "parent", "::", "__construct", "(", "$", "message", ",", "$", "code", ",", "$", "previous"...
Calls the parent constructor. @param string $message The error message. @param int $code The error code. @param RootException $previous The inner exception, if any. @since [*next-version*]
[ "Calls", "the", "parent", "constructor", "." ]
9e75c5f886a2403c6989c36c2d4ffcfae158172e
https://github.com/Dhii/validation-base/blob/9e75c5f886a2403c6989c36c2d4ffcfae158172e/src/Exception/ValidationFailedException.php#L97-L100
train
danielgp/common-lib
source/CommonPermissions.php
CommonPermissions.explainPerms
public function explainPerms($permissionNumber) { $firstFlag = $this->matchFirstFlagSingle($permissionNumber); $permissionsString = substr(sprintf('%o', $permissionNumber), -4); $numericalPermissions = $this->numericalPermissionsArray(); return [ 'Permission...
php
public function explainPerms($permissionNumber) { $firstFlag = $this->matchFirstFlagSingle($permissionNumber); $permissionsString = substr(sprintf('%o', $permissionNumber), -4); $numericalPermissions = $this->numericalPermissionsArray(); return [ 'Permission...
[ "public", "function", "explainPerms", "(", "$", "permissionNumber", ")", "{", "$", "firstFlag", "=", "$", "this", "->", "matchFirstFlagSingle", "(", "$", "permissionNumber", ")", ";", "$", "permissionsString", "=", "substr", "(", "sprintf", "(", "'%o'", ",", ...
Returns an array with meaningfull content of permissions @param int $permissionNumber @return array
[ "Returns", "an", "array", "with", "meaningfull", "content", "of", "permissions" ]
627b99b4408414c7cd21a6c8016f6468dc9216b2
https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/CommonPermissions.php#L45-L65
train
jitesoft/php-container
src/Injector.php
Injector.create
public function create(string $className, array $bindings = []) { try { $class = new ReflectionClass($className); } catch (ReflectionException $ex) { throw new ContainerException('Failed to create reflection class from given class name.'); } $out = null; ...
php
public function create(string $className, array $bindings = []) { try { $class = new ReflectionClass($className); } catch (ReflectionException $ex) { throw new ContainerException('Failed to create reflection class from given class name.'); } $out = null; ...
[ "public", "function", "create", "(", "string", "$", "className", ",", "array", "$", "bindings", "=", "[", "]", ")", "{", "try", "{", "$", "class", "=", "new", "ReflectionClass", "(", "$", "className", ")", ";", "}", "catch", "(", "ReflectionException", ...
Create a instance of given class name. The injector will try to handle constructor injection, if it fails, it will throw an exception. If a binding array is passed through this method and a container already exists, the bindings will take precedence over the container. @param string $className @param array $bindings ...
[ "Create", "a", "instance", "of", "given", "class", "name", ".", "The", "injector", "will", "try", "to", "handle", "constructor", "injection", "if", "it", "fails", "it", "will", "throw", "an", "exception", "." ]
e24af8e089f5b46219316f9a9c0e0b2193c256b7
https://github.com/jitesoft/php-container/blob/e24af8e089f5b46219316f9a9c0e0b2193c256b7/src/Injector.php#L56-L90
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/PrepareForPersist.php
PrepareForPersist.prepareTitleForPersist
public function prepareTitleForPersist($title) { // Strip whitespace (or other characters) from the beginning and end of a string $transformedTitle = trim($title); // Strip HTML and PHP tags from a string $transformedTitle = strip_tags($transformedTitle); // Strip tags, opt...
php
public function prepareTitleForPersist($title) { // Strip whitespace (or other characters) from the beginning and end of a string $transformedTitle = trim($title); // Strip HTML and PHP tags from a string $transformedTitle = strip_tags($transformedTitle); // Strip tags, opt...
[ "public", "function", "prepareTitleForPersist", "(", "$", "title", ")", "{", "// Strip whitespace (or other characters) from the beginning and end of a string", "$", "transformedTitle", "=", "trim", "(", "$", "title", ")", ";", "// Strip HTML and PHP tags from a string", "$", ...
Transform title for persist. @param text $title @return text
[ "Transform", "title", "for", "persist", "." ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/PrepareForPersist.php#L188-L204
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/PrepareForPersist.php
PrepareForPersist.prepareDescriptionForPersist
public function prepareDescriptionForPersist($description) { $description = html_entity_decode($description); $description = strip_tags($description); $description = filter_var($description, FILTER_SANITIZE_STRING); // remove the encoded blank chars $description = str_replac...
php
public function prepareDescriptionForPersist($description) { $description = html_entity_decode($description); $description = strip_tags($description); $description = filter_var($description, FILTER_SANITIZE_STRING); // remove the encoded blank chars $description = str_replac...
[ "public", "function", "prepareDescriptionForPersist", "(", "$", "description", ")", "{", "$", "description", "=", "html_entity_decode", "(", "$", "description", ")", ";", "$", "description", "=", "strip_tags", "(", "$", "description", ")", ";", "$", "description...
Transform description for persist. @param string $descriptions @return text
[ "Transform", "description", "for", "persist", "." ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/PrepareForPersist.php#L213-L224
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/PrepareForPersist.php
PrepareForPersist.prepareSlugForPersist
public function prepareSlugForPersist($title, $slug, $id=false) { $separator = '-'; if ($slug == "") { // No slug.. so this is a "create" form; or, the slug was deleted accidentally and so needs to be regenerated // Convert all dashes/underscores into separator ...
php
public function prepareSlugForPersist($title, $slug, $id=false) { $separator = '-'; if ($slug == "") { // No slug.. so this is a "create" form; or, the slug was deleted accidentally and so needs to be regenerated // Convert all dashes/underscores into separator ...
[ "public", "function", "prepareSlugForPersist", "(", "$", "title", ",", "$", "slug", ",", "$", "id", "=", "false", ")", "{", "$", "separator", "=", "'-'", ";", "if", "(", "$", "slug", "==", "\"\"", ")", "{", "// No slug.. so this is a \"create\" form; or, the...
Prepare slug for persist. @param text $title @param text $slug @param int $id The id of the record (eg, of the posts table) that is currently being edited @return text
[ "Prepare", "slug", "for", "persist", "." ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/PrepareForPersist.php#L235-L312
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/PrepareForPersist.php
PrepareForPersist.isManuallyChangedSlugInEditForm
public function isManuallyChangedSlugInEditForm($slug, $id=false) { // If there is no $id, then there's nothing to figure out! if (!$id) return false; $record = DB::table($this->model->table) ->where('id', $id) ->first() ; if ($record->slug == $slug)...
php
public function isManuallyChangedSlugInEditForm($slug, $id=false) { // If there is no $id, then there's nothing to figure out! if (!$id) return false; $record = DB::table($this->model->table) ->where('id', $id) ->first() ; if ($record->slug == $slug)...
[ "public", "function", "isManuallyChangedSlugInEditForm", "(", "$", "slug", ",", "$", "id", "=", "false", ")", "{", "// If there is no $id, then there's nothing to figure out!", "if", "(", "!", "$", "id", ")", "return", "false", ";", "$", "record", "=", "DB", "::...
Was the slug changed in the edit form? @param text $slug @param int $id The id of the record (eg, of the posts table) that is currently being edited @return bool
[ "Was", "the", "slug", "changed", "in", "the", "edit", "form?" ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/PrepareForPersist.php#L322-L342
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/PrepareForPersist.php
PrepareForPersist.doesSlugAlreadyExist
public function doesSlugAlreadyExist($slug) { $rowCount = DB::table($this->model->table) ->where('slug', $slug) ->count(); if ($rowCount > 0) return $rowCount; return 0; }
php
public function doesSlugAlreadyExist($slug) { $rowCount = DB::table($this->model->table) ->where('slug', $slug) ->count(); if ($rowCount > 0) return $rowCount; return 0; }
[ "public", "function", "doesSlugAlreadyExist", "(", "$", "slug", ")", "{", "$", "rowCount", "=", "DB", "::", "table", "(", "$", "this", "->", "model", "->", "table", ")", "->", "where", "(", "'slug'", ",", "$", "slug", ")", "->", "count", "(", ")", ...
Does the slug already exist in the table? @param text $slug @return int
[ "Does", "the", "slug", "already", "exist", "in", "the", "table?" ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/PrepareForPersist.php#L351-L359
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/PrepareForPersist.php
PrepareForPersist.prepareCanonicalURLForPersist
public function prepareCanonicalURLForPersist($slug) { $baseURL = rtrim(config('app.url'), "/"); if ($this->model->table == "posts") $type = "blog"; // July 15, 2015: do *NOT* want type! //return $baseURL.'/'.$type.'/'.$slug; return $baseURL.'/'.$slug; }
php
public function prepareCanonicalURLForPersist($slug) { $baseURL = rtrim(config('app.url'), "/"); if ($this->model->table == "posts") $type = "blog"; // July 15, 2015: do *NOT* want type! //return $baseURL.'/'.$type.'/'.$slug; return $baseURL.'/'.$slug; }
[ "public", "function", "prepareCanonicalURLForPersist", "(", "$", "slug", ")", "{", "$", "baseURL", "=", "rtrim", "(", "config", "(", "'app.url'", ")", ",", "\"/\"", ")", ";", "if", "(", "$", "this", "->", "model", "->", "table", "==", "\"posts\"", ")", ...
Transform canonical_url for persist. @param text $slug @return text
[ "Transform", "canonical_url", "for", "persist", "." ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/PrepareForPersist.php#L368-L379
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/PrepareForPersist.php
PrepareForPersist.prepareURLForPersist
public function prepareURLForPersist($url) { if (substr($url, 0, 7 ) == "http://") return $url; if (substr($url, 0, 8 ) == "https://") return $url; $washedUrl = "http://"; $washedUrl .= $url; return $url; }
php
public function prepareURLForPersist($url) { if (substr($url, 0, 7 ) == "http://") return $url; if (substr($url, 0, 8 ) == "https://") return $url; $washedUrl = "http://"; $washedUrl .= $url; return $url; }
[ "public", "function", "prepareURLForPersist", "(", "$", "url", ")", "{", "if", "(", "substr", "(", "$", "url", ",", "0", ",", "7", ")", "==", "\"http://\"", ")", "return", "$", "url", ";", "if", "(", "substr", "(", "$", "url", ",", "0", ",", "8",...
Wash URL for persist. Does *not* test for a .com or .ca or other TLD @param text $url @return text
[ "Wash", "URL", "for", "persist", "." ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/PrepareForPersist.php#L390-L400
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/PrepareForPersist.php
PrepareForPersist.prepareExcerptForPersist
public function prepareExcerptForPersist($excerpt="", $content) { $chars_to_excerpt = config('lasallecmsapi.how_many_initial_chars_of_content_field_for_excerpt'); if ($excerpt == "") { $excerpt = $content; $excerpt = html_entity_decode($excerpt); $excerp...
php
public function prepareExcerptForPersist($excerpt="", $content) { $chars_to_excerpt = config('lasallecmsapi.how_many_initial_chars_of_content_field_for_excerpt'); if ($excerpt == "") { $excerpt = $content; $excerpt = html_entity_decode($excerpt); $excerp...
[ "public", "function", "prepareExcerptForPersist", "(", "$", "excerpt", "=", "\"\"", ",", "$", "content", ")", "{", "$", "chars_to_excerpt", "=", "config", "(", "'lasallecmsapi.how_many_initial_chars_of_content_field_for_excerpt'", ")", ";", "if", "(", "$", "excerpt", ...
Transform excerpt for persist. @param text $excerpt @return text
[ "Transform", "excerpt", "for", "persist", "." ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/PrepareForPersist.php#L422-L453
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/PrepareForPersist.php
PrepareForPersist.prepareMetaDescriptionForPersist
public function prepareMetaDescriptionForPersist($meta_description="", $excerpt) { if ($meta_description == "") return $excerpt; $meta_description = html_entity_decode($meta_description); $meta_description = strip_tags($meta_description); $meta_description = filter_var($meta_descrip...
php
public function prepareMetaDescriptionForPersist($meta_description="", $excerpt) { if ($meta_description == "") return $excerpt; $meta_description = html_entity_decode($meta_description); $meta_description = strip_tags($meta_description); $meta_description = filter_var($meta_descrip...
[ "public", "function", "prepareMetaDescriptionForPersist", "(", "$", "meta_description", "=", "\"\"", ",", "$", "excerpt", ")", "{", "if", "(", "$", "meta_description", "==", "\"\"", ")", "return", "$", "excerpt", ";", "$", "meta_description", "=", "html_entity_d...
Transform meta_description for persist. @param text $meta_description @param text $excerpt @return text
[ "Transform", "meta_description", "for", "persist", "." ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/PrepareForPersist.php#L463-L476
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/PrepareForPersist.php
PrepareForPersist.prepareCompositeTitleForPersist
public function prepareCompositeTitleForPersist($fieldsToConcatenate, $data) { $composite_title = ""; // count to determine spacing between fields $count = count($fieldsToConcatenate); $i = 1; foreach ($fieldsToConcatenate as $fieldToConcatenate) { // I...
php
public function prepareCompositeTitleForPersist($fieldsToConcatenate, $data) { $composite_title = ""; // count to determine spacing between fields $count = count($fieldsToConcatenate); $i = 1; foreach ($fieldsToConcatenate as $fieldToConcatenate) { // I...
[ "public", "function", "prepareCompositeTitleForPersist", "(", "$", "fieldsToConcatenate", ",", "$", "data", ")", "{", "$", "composite_title", "=", "\"\"", ";", "// count to determine spacing between fields", "$", "count", "=", "count", "(", "$", "fieldsToConcatenate", ...
Concatenate fields for the composite Title field @param array $fieldsToConcatenate @param array $data @return string
[ "Concatenate", "fields", "for", "the", "composite", "Title", "field" ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/PrepareForPersist.php#L593-L619
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/PrepareForPersist.php
PrepareForPersist.prepareRelatedTableForPersist
public function prepareRelatedTableForPersist($field, $data) { // If the field is nullable, then having associated records is optional. if ( ( ($data == "") || ($data == null) || (!$data) || (empty($data)) ) && ...
php
public function prepareRelatedTableForPersist($field, $data) { // If the field is nullable, then having associated records is optional. if ( ( ($data == "") || ($data == null) || (!$data) || (empty($data)) ) && ...
[ "public", "function", "prepareRelatedTableForPersist", "(", "$", "field", ",", "$", "data", ")", "{", "// If the field is nullable, then having associated records is optional.", "if", "(", "(", "(", "$", "data", "==", "\"\"", ")", "||", "(", "$", "data", "==", "nu...
Prepare foreign key field for persist. This is for "one" relationships only, where there is an actual field for the related table's ID in the primary table. Basically, the purpose here is to set the data to "null" when there is no value, and the field is nullable. @param array $fields @param array $data @ret...
[ "Prepare", "foreign", "key", "field", "for", "persist", "." ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/PrepareForPersist.php#L635-L651
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/PrepareForPersist.php
PrepareForPersist.genericWashText
public function genericWashText($text) { // http://php.net/manual/en/function.strip-tags.php $text = strip_tags($text); // http://php.net/manual/en/filter.filters.sanitize.php $text = filter_var($text, FILTER_SANITIZE_STRING); // remove the encoded blank chars $text = ...
php
public function genericWashText($text) { // http://php.net/manual/en/function.strip-tags.php $text = strip_tags($text); // http://php.net/manual/en/filter.filters.sanitize.php $text = filter_var($text, FILTER_SANITIZE_STRING); // remove the encoded blank chars $text = ...
[ "public", "function", "genericWashText", "(", "$", "text", ")", "{", "// http://php.net/manual/en/function.strip-tags.php", "$", "text", "=", "strip_tags", "(", "$", "text", ")", ";", "// http://php.net/manual/en/filter.filters.sanitize.php", "$", "text", "=", "filter_var...
A generic wash of plain ol' text. The hope is to rid a string of HTML tags and PHP tags My admin form automation does not call this method, but I concocted it for my email package, and thought, gee, it would be nice to have it in this class for other custom form field processing. @param string $text @return string
[ "A", "generic", "wash", "of", "plain", "ol", "text", "." ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/PrepareForPersist.php#L665-L683
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/PrepareForPersist.php
PrepareForPersist.genericCreateSlug
public function genericCreateSlug($text) { // Define a separator $separator = '-'; // Convert all dashes/underscores into separator $flip = $separator == '-' ? '_' : '-'; // Wash the $text, although it should already be washed $slug = $this->genericWashText($text); ...
php
public function genericCreateSlug($text) { // Define a separator $separator = '-'; // Convert all dashes/underscores into separator $flip = $separator == '-' ? '_' : '-'; // Wash the $text, although it should already be washed $slug = $this->genericWashText($text); ...
[ "public", "function", "genericCreateSlug", "(", "$", "text", ")", "{", "// Define a separator", "$", "separator", "=", "'-'", ";", "// Convert all dashes/underscores into separator", "$", "flip", "=", "$", "separator", "==", "'-'", "?", "'_'", ":", "'-'", ";", "...
A generic method to create a slug based on any string. The prepareSlugForPersis() method creates a slug from the "title" field. This method let's you create a slug from any string, not just from the "title" field. My admin form automation does not call this method, but I concocted it for my email package, and thought...
[ "A", "generic", "method", "to", "create", "a", "slug", "based", "on", "any", "string", "." ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/PrepareForPersist.php#L697-L717
train
nattreid/tracking
src/Model/Tracking/TrackingMapper.php
TrackingMapper.onlineUsers
public function onlineUsers(): int { $builder = $this->builder() ->addSelect('COUNT(DISTINCT([uid])) count') ->andWhere('[inserted] > %dt', (new \DateTime)->modify('-' . $this->onlineTime . ' minute')) ->andWhere('[timeOnPage] IS NOT null'); return $this->execute($builder)->fetch()->count; }
php
public function onlineUsers(): int { $builder = $this->builder() ->addSelect('COUNT(DISTINCT([uid])) count') ->andWhere('[inserted] > %dt', (new \DateTime)->modify('-' . $this->onlineTime . ' minute')) ->andWhere('[timeOnPage] IS NOT null'); return $this->execute($builder)->fetch()->count; }
[ "public", "function", "onlineUsers", "(", ")", ":", "int", "{", "$", "builder", "=", "$", "this", "->", "builder", "(", ")", "->", "addSelect", "(", "'COUNT(DISTINCT([uid])) count'", ")", "->", "andWhere", "(", "'[inserted] > %dt'", ",", "(", "new", "\\", ...
Vrati online uzivatele @return int @throws QueryException
[ "Vrati", "online", "uzivatele" ]
5fc7c993c08774945405c79a393584ef2ed589f7
https://github.com/nattreid/tracking/blob/5fc7c993c08774945405c79a393584ef2ed589f7/src/Model/Tracking/TrackingMapper.php#L105-L112
train
nattreid/tracking
src/Model/Tracking/TrackingMapper.php
TrackingMapper.findVisitsHours
public function findVisitsHours(Range $interval, bool $useTime = false): ?Result { $date = $useTime ? '%dt' : 'DATE(%dt)'; $subQuery = 'SELECT ' . 'DATE_FORMAT([inserted], "%%Y-%%m-%%d %%H:00:00") datefield, ' . 'COUNT([uid]) visits ' . 'FROM %table ' . 'WHERE ' . ($useTime ? '[inserted]' : 'DATE([ins...
php
public function findVisitsHours(Range $interval, bool $useTime = false): ?Result { $date = $useTime ? '%dt' : 'DATE(%dt)'; $subQuery = 'SELECT ' . 'DATE_FORMAT([inserted], "%%Y-%%m-%%d %%H:00:00") datefield, ' . 'COUNT([uid]) visits ' . 'FROM %table ' . 'WHERE ' . ($useTime ? '[inserted]' : 'DATE([ins...
[ "public", "function", "findVisitsHours", "(", "Range", "$", "interval", ",", "bool", "$", "useTime", "=", "false", ")", ":", "?", "Result", "{", "$", "date", "=", "$", "useTime", "?", "'%dt'", ":", "'DATE(%dt)'", ";", "$", "subQuery", "=", "'SELECT '", ...
Vrati navstevy po hodinach @param Range $interval @param bool $useTime ma se pouzit cas v intervalu @return Result|null @throws QueryException
[ "Vrati", "navstevy", "po", "hodinach" ]
5fc7c993c08774945405c79a393584ef2ed589f7
https://github.com/nattreid/tracking/blob/5fc7c993c08774945405c79a393584ef2ed589f7/src/Model/Tracking/TrackingMapper.php#L121-L132
train
mwyatt/core
src/Iterator/Model/User.php
User.getByNameFirst
public function getByNameFirst($value) { $users = []; foreach ($this as $user) { if ($user->get('nameFirst')) { $users[] = $user; } } return new $this($users); }
php
public function getByNameFirst($value) { $users = []; foreach ($this as $user) { if ($user->get('nameFirst')) { $users[] = $user; } } return new $this($users); }
[ "public", "function", "getByNameFirst", "(", "$", "value", ")", "{", "$", "users", "=", "[", "]", ";", "foreach", "(", "$", "this", "as", "$", "user", ")", "{", "if", "(", "$", "user", "->", "get", "(", "'nameFirst'", ")", ")", "{", "$", "users",...
example usage of more specific iterator will tidy the controllers even further @param string $value @return array users
[ "example", "usage", "of", "more", "specific", "iterator", "will", "tidy", "the", "controllers", "even", "further" ]
8ea9d67cc84fe6aff17a469c703d5492dbcd93ed
https://github.com/mwyatt/core/blob/8ea9d67cc84fe6aff17a469c703d5492dbcd93ed/src/Iterator/Model/User.php#L15-L24
train
RhubarbPHP/Module.Leaf.Table
src/Leaves/Table.php
Table.inflateColumns
protected function inflateColumns($columns) { $inflatedColumns = []; foreach ($columns as $key => $value) { $tableColumn = $value; $label = !is_numeric($key) ? $key : null; if (is_string($tableColumn)) { $value = (string)$value; ...
php
protected function inflateColumns($columns) { $inflatedColumns = []; foreach ($columns as $key => $value) { $tableColumn = $value; $label = !is_numeric($key) ? $key : null; if (is_string($tableColumn)) { $value = (string)$value; ...
[ "protected", "function", "inflateColumns", "(", "$", "columns", ")", "{", "$", "inflatedColumns", "=", "[", "]", ";", "foreach", "(", "$", "columns", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "tableColumn", "=", "$", "value", ";", "$", "la...
Expands the columns array, creating TableColumn objects where needed. @param array $columns @return TableColumn[]
[ "Expands", "the", "columns", "array", "creating", "TableColumn", "objects", "where", "needed", "." ]
1de09307177cc809ca6b2a50093ccad06ab49e45
https://github.com/RhubarbPHP/Module.Leaf.Table/blob/1de09307177cc809ca6b2a50093ccad06ab49e45/src/Leaves/Table.php#L343-L378
train
RhubarbPHP/Module.Leaf.Table
src/Leaves/Table.php
Table.getDataForPresenter
protected function getDataForPresenter($dataKey, $viewIndex = false) { if (!isset($this->currentRow[$dataKey])) { return $this->model->getBoundValue($dataKey, $viewIndex); } $value = $this->currentRow[$dataKey]; if ($value instanceof Model) { return $value->...
php
protected function getDataForPresenter($dataKey, $viewIndex = false) { if (!isset($this->currentRow[$dataKey])) { return $this->model->getBoundValue($dataKey, $viewIndex); } $value = $this->currentRow[$dataKey]; if ($value instanceof Model) { return $value->...
[ "protected", "function", "getDataForPresenter", "(", "$", "dataKey", ",", "$", "viewIndex", "=", "false", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "currentRow", "[", "$", "dataKey", "]", ")", ")", "{", "return", "$", "this", "->", "...
Provides model data to the requesting presenter. This implementation ensures the LeafColumns are able to receive data from the row's model @param string $dataKey @param bool|int $viewIndex @return mixed
[ "Provides", "model", "data", "to", "the", "requesting", "presenter", "." ]
1de09307177cc809ca6b2a50093ccad06ab49e45
https://github.com/RhubarbPHP/Module.Leaf.Table/blob/1de09307177cc809ca6b2a50093ccad06ab49e45/src/Leaves/Table.php#L389-L402
train
mwyatt/core
src/AbstractView.php
AbstractView.getTemplate
public function getTemplate($templatePath) { $absoluteTemplateFilePath = $this->getTemplateFilePath($templatePath); if (!$absoluteTemplateFilePath) { return; } extract($this->getArrayCopy()); ob_start(); include $absoluteTemplateFilePath; $content ...
php
public function getTemplate($templatePath) { $absoluteTemplateFilePath = $this->getTemplateFilePath($templatePath); if (!$absoluteTemplateFilePath) { return; } extract($this->getArrayCopy()); ob_start(); include $absoluteTemplateFilePath; $content ...
[ "public", "function", "getTemplate", "(", "$", "templatePath", ")", "{", "$", "absoluteTemplateFilePath", "=", "$", "this", "->", "getTemplateFilePath", "(", "$", "templatePath", ")", ";", "if", "(", "!", "$", "absoluteTemplateFilePath", ")", "{", "return", ";...
converts stored key values in iterator to output from template path requested @param string $templatePath @return string
[ "converts", "stored", "key", "values", "in", "iterator", "to", "output", "from", "template", "path", "requested" ]
8ea9d67cc84fe6aff17a469c703d5492dbcd93ed
https://github.com/mwyatt/core/blob/8ea9d67cc84fe6aff17a469c703d5492dbcd93ed/src/AbstractView.php#L47-L59
train
praxigento/mobi_mod_downline
Block/Adminhtml/Customer/Edit/Tabs/Mobi/Info.php
Info.loadCustomerData
private function loadCustomerData() { $custId = $this->registry->registry(\Magento\Customer\Controller\RegistryConstants::CURRENT_CUSTOMER_ID); if ($custId) { $query = $this->qLoad->build(); $conn = $query->getConnection(); $bind = [ QLoad::BND_CUS...
php
private function loadCustomerData() { $custId = $this->registry->registry(\Magento\Customer\Controller\RegistryConstants::CURRENT_CUSTOMER_ID); if ($custId) { $query = $this->qLoad->build(); $conn = $query->getConnection(); $bind = [ QLoad::BND_CUS...
[ "private", "function", "loadCustomerData", "(", ")", "{", "$", "custId", "=", "$", "this", "->", "registry", "->", "registry", "(", "\\", "Magento", "\\", "Customer", "\\", "Controller", "\\", "RegistryConstants", "::", "CURRENT_CUSTOMER_ID", ")", ";", "if", ...
Load block's working data before rendering.
[ "Load", "block", "s", "working", "data", "before", "rendering", "." ]
0f3c276dfff1aa029f9fd205ccfc56f207a2e75b
https://github.com/praxigento/mobi_mod_downline/blob/0f3c276dfff1aa029f9fd205ccfc56f207a2e75b/Block/Adminhtml/Customer/Edit/Tabs/Mobi/Info.php#L146-L158
train
pixelpolishers/makedocs
src/MakeDocs/Generator/SourceFile.php
SourceFile.getContent
public function getContent() { foreach ($this->dom->documentElement->childNodes as $node) { if ($node->nodeName == 'content') { return $node; } } return null; }
php
public function getContent() { foreach ($this->dom->documentElement->childNodes as $node) { if ($node->nodeName == 'content') { return $node; } } return null; }
[ "public", "function", "getContent", "(", ")", "{", "foreach", "(", "$", "this", "->", "dom", "->", "documentElement", "->", "childNodes", "as", "$", "node", ")", "{", "if", "(", "$", "node", "->", "nodeName", "==", "'content'", ")", "{", "return", "$",...
Gets the content section. @return DOMElement
[ "Gets", "the", "content", "section", "." ]
1fa243b52565b5de417ef2dbdfbcae9896b6b483
https://github.com/pixelpolishers/makedocs/blob/1fa243b52565b5de417ef2dbdfbcae9896b6b483/src/MakeDocs/Generator/SourceFile.php#L63-L72
train
freialib/hlin.tools
src/Logger/File.php
FileLogger.log
function log($message, $type = null, $explicit = false) { try { $time = date('Y-m-d|H:i:s'); if ($type === null) { $this->appendToFile(date('Y/m/d'), "[$time] $message", $explicit); } else { // type !== null $this->appendToFile($type, "[$time] $message", $explicit); } } catch (\Exception $e...
php
function log($message, $type = null, $explicit = false) { try { $time = date('Y-m-d|H:i:s'); if ($type === null) { $this->appendToFile(date('Y/m/d'), "[$time] $message", $explicit); } else { // type !== null $this->appendToFile($type, "[$time] $message", $explicit); } } catch (\Exception $e...
[ "function", "log", "(", "$", "message", ",", "$", "type", "=", "null", ",", "$", "explicit", "=", "false", ")", "{", "try", "{", "$", "time", "=", "date", "(", "'Y-m-d|H:i:s'", ")", ";", "if", "(", "$", "type", "===", "null", ")", "{", "$", "th...
Logs a message. The type can be used as a hint to the logger on how to log the message. If the logger doesn't understand the type a file with the type name will be created as default behavior. Types should not use illegal file characters.
[ "Logs", "a", "message", ".", "The", "type", "can", "be", "used", "as", "a", "hint", "to", "the", "logger", "on", "how", "to", "log", "the", "message", ".", "If", "the", "logger", "doesn", "t", "understand", "the", "type", "a", "file", "with", "the", ...
42ad9e9fe081918d2ee5d52b72d174ccdcf7cbe7
https://github.com/freialib/hlin.tools/blob/42ad9e9fe081918d2ee5d52b72d174ccdcf7cbe7/src/Logger/File.php#L56-L69
train
freialib/hlin.tools
src/Logger/File.php
FileLogger.appendToFile
protected function appendToFile($logfile, $logstring, $explicit = false) { $class = \hlin\PHP::unn(__CLASS__); # logging signatures are intended to prevent duplication PER REQUEST # on a per logger instance basis, not cull duplicate messages per log $sig = crc32($logstring); $filesig = crc32($sig.$logfile)...
php
protected function appendToFile($logfile, $logstring, $explicit = false) { $class = \hlin\PHP::unn(__CLASS__); # logging signatures are intended to prevent duplication PER REQUEST # on a per logger instance basis, not cull duplicate messages per log $sig = crc32($logstring); $filesig = crc32($sig.$logfile)...
[ "protected", "function", "appendToFile", "(", "$", "logfile", ",", "$", "logstring", ",", "$", "explicit", "=", "false", ")", "{", "$", "class", "=", "\\", "hlin", "\\", "PHP", "::", "unn", "(", "__CLASS__", ")", ";", "# logging signatures are intended to pr...
Appeds to the logfile. The logfile is relative to the logs directory. If the logfile doesn't exist yet the system will create it. The '.log' extention is automatically appended, along with a single newline character.
[ "Appeds", "to", "the", "logfile", ".", "The", "logfile", "is", "relative", "to", "the", "logs", "directory", ".", "If", "the", "logfile", "doesn", "t", "exist", "yet", "the", "system", "will", "create", "it", ".", "The", ".", "log", "extention", "is", ...
42ad9e9fe081918d2ee5d52b72d174ccdcf7cbe7
https://github.com/freialib/hlin.tools/blob/42ad9e9fe081918d2ee5d52b72d174ccdcf7cbe7/src/Logger/File.php#L89-L159
train
RocketPropelledTortoise/Core
src/Entities/Field.php
Field.setValueAttribute
public function setValueAttribute($value) { if (!$this->isValid($value)) { throw new InvalidValueException("The value in the field '" . get_class($this) . "' is invalid"); } $this->attributes['value'] = $this->prepareValue($value); }
php
public function setValueAttribute($value) { if (!$this->isValid($value)) { throw new InvalidValueException("The value in the field '" . get_class($this) . "' is invalid"); } $this->attributes['value'] = $this->prepareValue($value); }
[ "public", "function", "setValueAttribute", "(", "$", "value", ")", "{", "if", "(", "!", "$", "this", "->", "isValid", "(", "$", "value", ")", ")", "{", "throw", "new", "InvalidValueException", "(", "\"The value in the field '\"", ".", "get_class", "(", "$", ...
Validate and set the value @param mixed $value
[ "Validate", "and", "set", "the", "value" ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Field.php#L50-L57
train
danielgp/browser-agent-info
source/BrowserAgentInfosByDanielGP.php
BrowserAgentInfosByDanielGP.getArchitectureFromUserAgent
public function getArchitectureFromUserAgent($userAgent, $targetToAnalyze = 'os') { switch ($targetToAnalyze) { case 'browser': $aReturn = $this->getArchitectureFromUserAgentBrowser($userAgent); break; case 'os': $aReturn = $this->getAr...
php
public function getArchitectureFromUserAgent($userAgent, $targetToAnalyze = 'os') { switch ($targetToAnalyze) { case 'browser': $aReturn = $this->getArchitectureFromUserAgentBrowser($userAgent); break; case 'os': $aReturn = $this->getAr...
[ "public", "function", "getArchitectureFromUserAgent", "(", "$", "userAgent", ",", "$", "targetToAnalyze", "=", "'os'", ")", "{", "switch", "(", "$", "targetToAnalyze", ")", "{", "case", "'browser'", ":", "$", "aReturn", "=", "$", "this", "->", "getArchitecture...
Return CPU architecture details from given user agent @param string $userAgent @param string $targetToAnalyze @return array
[ "Return", "CPU", "architecture", "details", "from", "given", "user", "agent" ]
5e4b2c01793ee47ce517be2c799d64abe78d7f8a
https://github.com/danielgp/browser-agent-info/blob/5e4b2c01793ee47ce517be2c799d64abe78d7f8a/source/BrowserAgentInfosByDanielGP.php#L59-L73
train
danielgp/browser-agent-info
source/BrowserAgentInfosByDanielGP.php
BrowserAgentInfosByDanielGP.getClientBrowser
private function getClientBrowser(\DeviceDetector\DeviceDetector $deviceDetectorClass, $userAgent) { $this->autoPopulateSuperGlobals(); $browserInfoArray = [ 'architecture' => $this->getArchitectureFromUserAgent($userAgent, 'browser'), 'connection' => $this->brServerGloba...
php
private function getClientBrowser(\DeviceDetector\DeviceDetector $deviceDetectorClass, $userAgent) { $this->autoPopulateSuperGlobals(); $browserInfoArray = [ 'architecture' => $this->getArchitectureFromUserAgent($userAgent, 'browser'), 'connection' => $this->brServerGloba...
[ "private", "function", "getClientBrowser", "(", "\\", "DeviceDetector", "\\", "DeviceDetector", "$", "deviceDetectorClass", ",", "$", "userAgent", ")", "{", "$", "this", "->", "autoPopulateSuperGlobals", "(", ")", ";", "$", "browserInfoArray", "=", "[", "'architec...
Provides details about browser @param \DeviceDetector\DeviceDetector $deviceDetectorClass @param string $userAgent @return array
[ "Provides", "details", "about", "browser" ]
5e4b2c01793ee47ce517be2c799d64abe78d7f8a
https://github.com/danielgp/browser-agent-info/blob/5e4b2c01793ee47ce517be2c799d64abe78d7f8a/source/BrowserAgentInfosByDanielGP.php#L82-L97
train
danielgp/browser-agent-info
source/BrowserAgentInfosByDanielGP.php
BrowserAgentInfosByDanielGP.getClientBrowserAccepted
private function getClientBrowserAccepted() { $this->autoPopulateSuperGlobals(); $sReturn = [ 'accept' => $this->brServerGlobals->server->get('HTTP_ACCEPT'), 'accept_encoding' => $this->brServerGlobals->server->get('HTTP_ACCEPT_ENCODING'), ]; if (!is_...
php
private function getClientBrowserAccepted() { $this->autoPopulateSuperGlobals(); $sReturn = [ 'accept' => $this->brServerGlobals->server->get('HTTP_ACCEPT'), 'accept_encoding' => $this->brServerGlobals->server->get('HTTP_ACCEPT_ENCODING'), ]; if (!is_...
[ "private", "function", "getClientBrowserAccepted", "(", ")", "{", "$", "this", "->", "autoPopulateSuperGlobals", "(", ")", ";", "$", "sReturn", "=", "[", "'accept'", "=>", "$", "this", "->", "brServerGlobals", "->", "server", "->", "get", "(", "'HTTP_ACCEPT'",...
Returns accepted things setting from the client browser @return array
[ "Returns", "accepted", "things", "setting", "from", "the", "client", "browser" ]
5e4b2c01793ee47ce517be2c799d64abe78d7f8a
https://github.com/danielgp/browser-agent-info/blob/5e4b2c01793ee47ce517be2c799d64abe78d7f8a/source/BrowserAgentInfosByDanielGP.php#L104-L119
train
danielgp/browser-agent-info
source/BrowserAgentInfosByDanielGP.php
BrowserAgentInfosByDanielGP.getClientBrowserDetails
public function getClientBrowserDetails($returnType = ['Browser', 'Device', 'OS'], $tmpFolder = null) { $userAgent = $this->getUserAgentByCommonLib(); $devDetectClass = new \DeviceDetector\DeviceDetector($userAgent); if (is_null($tmpFolder)) { $tmpFolder = '../../tmp/Doctrin...
php
public function getClientBrowserDetails($returnType = ['Browser', 'Device', 'OS'], $tmpFolder = null) { $userAgent = $this->getUserAgentByCommonLib(); $devDetectClass = new \DeviceDetector\DeviceDetector($userAgent); if (is_null($tmpFolder)) { $tmpFolder = '../../tmp/Doctrin...
[ "public", "function", "getClientBrowserDetails", "(", "$", "returnType", "=", "[", "'Browser'", ",", "'Device'", ",", "'OS'", "]", ",", "$", "tmpFolder", "=", "null", ")", "{", "$", "userAgent", "=", "$", "this", "->", "getUserAgentByCommonLib", "(", ")", ...
Provides various details about browser based on user agent @param array $returnType @return array
[ "Provides", "various", "details", "about", "browser", "based", "on", "user", "agent" ]
5e4b2c01793ee47ce517be2c799d64abe78d7f8a
https://github.com/danielgp/browser-agent-info/blob/5e4b2c01793ee47ce517be2c799d64abe78d7f8a/source/BrowserAgentInfosByDanielGP.php#L127-L143
train
danielgp/browser-agent-info
source/BrowserAgentInfosByDanielGP.php
BrowserAgentInfosByDanielGP.getClientBrowserDevice
private function getClientBrowserDevice(\DeviceDetector\DeviceDetector $deviceDetectorClass) { $this->autoPopulateSuperGlobals(); $clientIp = $this->brServerGlobals->getClientIp(); return [ 'brand' => $deviceDetectorClass->getDeviceName(), 'ip' => $clientIp...
php
private function getClientBrowserDevice(\DeviceDetector\DeviceDetector $deviceDetectorClass) { $this->autoPopulateSuperGlobals(); $clientIp = $this->brServerGlobals->getClientIp(); return [ 'brand' => $deviceDetectorClass->getDeviceName(), 'ip' => $clientIp...
[ "private", "function", "getClientBrowserDevice", "(", "\\", "DeviceDetector", "\\", "DeviceDetector", "$", "deviceDetectorClass", ")", "{", "$", "this", "->", "autoPopulateSuperGlobals", "(", ")", ";", "$", "clientIp", "=", "$", "this", "->", "brServerGlobals", "-...
Returns client device details from client browser @param class $deviceDetectorClass @return array
[ "Returns", "client", "device", "details", "from", "client", "browser" ]
5e4b2c01793ee47ce517be2c799d64abe78d7f8a
https://github.com/danielgp/browser-agent-info/blob/5e4b2c01793ee47ce517be2c799d64abe78d7f8a/source/BrowserAgentInfosByDanielGP.php#L175-L188
train
danielgp/browser-agent-info
source/BrowserAgentInfosByDanielGP.php
BrowserAgentInfosByDanielGP.getClientBrowserOperatingSystem
private function getClientBrowserOperatingSystem(\DeviceDetector\DeviceDetector $deviceDetectorClass, $userAgent) { $aReturn = $deviceDetectorClass->getOs(); $aReturn['architecture'] = $this->getArchitectureFromUserAgent($userAgent, 'os'); $operatingSystem = new \Devi...
php
private function getClientBrowserOperatingSystem(\DeviceDetector\DeviceDetector $deviceDetectorClass, $userAgent) { $aReturn = $deviceDetectorClass->getOs(); $aReturn['architecture'] = $this->getArchitectureFromUserAgent($userAgent, 'os'); $operatingSystem = new \Devi...
[ "private", "function", "getClientBrowserOperatingSystem", "(", "\\", "DeviceDetector", "\\", "DeviceDetector", "$", "deviceDetectorClass", ",", "$", "userAgent", ")", "{", "$", "aReturn", "=", "$", "deviceDetectorClass", "->", "getOs", "(", ")", ";", "$", "aReturn...
Returns client operating system details from client browser @param class $deviceDetectorClass @param string $userAgent @return array
[ "Returns", "client", "operating", "system", "details", "from", "client", "browser" ]
5e4b2c01793ee47ce517be2c799d64abe78d7f8a
https://github.com/danielgp/browser-agent-info/blob/5e4b2c01793ee47ce517be2c799d64abe78d7f8a/source/BrowserAgentInfosByDanielGP.php#L204-L213
train
danielgp/browser-agent-info
source/BrowserAgentInfosByDanielGP.php
BrowserAgentInfosByDanielGP.getUserAgentByCommonLib
public function getUserAgentByCommonLib() { $this->autoPopulateSuperGlobals(); if (!is_null($this->brServerGlobals->get('ua'))) { return $this->brServerGlobals->get('ua'); } return $this->getUserAgentByCommonLibDetection(); }
php
public function getUserAgentByCommonLib() { $this->autoPopulateSuperGlobals(); if (!is_null($this->brServerGlobals->get('ua'))) { return $this->brServerGlobals->get('ua'); } return $this->getUserAgentByCommonLibDetection(); }
[ "public", "function", "getUserAgentByCommonLib", "(", ")", "{", "$", "this", "->", "autoPopulateSuperGlobals", "(", ")", ";", "if", "(", "!", "is_null", "(", "$", "this", "->", "brServerGlobals", "->", "get", "(", "'ua'", ")", ")", ")", "{", "return", "$...
Captures the user agent @return string
[ "Captures", "the", "user", "agent" ]
5e4b2c01793ee47ce517be2c799d64abe78d7f8a
https://github.com/danielgp/browser-agent-info/blob/5e4b2c01793ee47ce517be2c799d64abe78d7f8a/source/BrowserAgentInfosByDanielGP.php#L231-L238
train
mosbth/phpmvc-comment
src/Comment/CommentController.php
CommentController.viewAction
public function viewAction() { $comments = new \Phpmvc\Comment\CommentsInSession(); $comments->setDI($this->di); $all = $comments->findAll(); $this->views->add('comment/comments', [ 'comments' => $all, ]); }
php
public function viewAction() { $comments = new \Phpmvc\Comment\CommentsInSession(); $comments->setDI($this->di); $all = $comments->findAll(); $this->views->add('comment/comments', [ 'comments' => $all, ]); }
[ "public", "function", "viewAction", "(", ")", "{", "$", "comments", "=", "new", "\\", "Phpmvc", "\\", "Comment", "\\", "CommentsInSession", "(", ")", ";", "$", "comments", "->", "setDI", "(", "$", "this", "->", "di", ")", ";", "$", "all", "=", "$", ...
View all comments. @return void
[ "View", "all", "comments", "." ]
ea5c43e8bb3f723d6fb69c892500d26c7390eb37
https://github.com/mosbth/phpmvc-comment/blob/ea5c43e8bb3f723d6fb69c892500d26c7390eb37/src/Comment/CommentController.php#L20-L30
train
mosbth/phpmvc-comment
src/Comment/CommentController.php
CommentController.removeAllAction
public function removeAllAction() { $isPosted = $this->request->getPost('doRemoveAll'); if (!$isPosted) { $this->response->redirect($this->request->getPost('redirect')); } $comments = new \Phpmvc\Comment\CommentsInSession(); $comments->setDI($this->di); ...
php
public function removeAllAction() { $isPosted = $this->request->getPost('doRemoveAll'); if (!$isPosted) { $this->response->redirect($this->request->getPost('redirect')); } $comments = new \Phpmvc\Comment\CommentsInSession(); $comments->setDI($this->di); ...
[ "public", "function", "removeAllAction", "(", ")", "{", "$", "isPosted", "=", "$", "this", "->", "request", "->", "getPost", "(", "'doRemoveAll'", ")", ";", "if", "(", "!", "$", "isPosted", ")", "{", "$", "this", "->", "response", "->", "redirect", "("...
Remove all comments. @return void
[ "Remove", "all", "comments", "." ]
ea5c43e8bb3f723d6fb69c892500d26c7390eb37
https://github.com/mosbth/phpmvc-comment/blob/ea5c43e8bb3f723d6fb69c892500d26c7390eb37/src/Comment/CommentController.php#L71-L85
train
PenoaksDev/Milky-Framework
src/Milky/Http/Routing/UrlGenerator.php
UrlGenerator.addQueryString
protected function addQueryString( $uri, array $parameters ) { // If the URI has a fragment, we will move it to the end of this URI since it will // need to come after any query string that may be added to the URL else it is // not going to be available. We will remove it then append it back on here. if ( !is_...
php
protected function addQueryString( $uri, array $parameters ) { // If the URI has a fragment, we will move it to the end of this URI since it will // need to come after any query string that may be added to the URL else it is // not going to be available. We will remove it then append it back on here. if ( !is_...
[ "protected", "function", "addQueryString", "(", "$", "uri", ",", "array", "$", "parameters", ")", "{", "// If the URI has a fragment, we will move it to the end of this URI since it will", "// need to come after any query string that may be added to the URL else it is", "// not going to ...
Add a query string to the URI. @param string $uri @param array $parameters @return mixed|string
[ "Add", "a", "query", "string", "to", "the", "URI", "." ]
8afd7156610a70371aa5b1df50b8a212bf7b142c
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Http/Routing/UrlGenerator.php#L435-L448
train
PenoaksDev/Milky-Framework
src/Milky/Http/Routing/UrlGenerator.php
UrlGenerator.getRouteScheme
protected function getRouteScheme( $route ) { if ( $route->httpOnly() ) { return $this->getScheme( false ); } elseif ( $route->httpsOnly() ) { return $this->getScheme( true ); } return $this->getScheme( null ); }
php
protected function getRouteScheme( $route ) { if ( $route->httpOnly() ) { return $this->getScheme( false ); } elseif ( $route->httpsOnly() ) { return $this->getScheme( true ); } return $this->getScheme( null ); }
[ "protected", "function", "getRouteScheme", "(", "$", "route", ")", "{", "if", "(", "$", "route", "->", "httpOnly", "(", ")", ")", "{", "return", "$", "this", "->", "getScheme", "(", "false", ")", ";", "}", "elseif", "(", "$", "route", "->", "httpsOnl...
Get the scheme for the given route. @param Route $route @return string
[ "Get", "the", "scheme", "for", "the", "given", "route", "." ]
8afd7156610a70371aa5b1df50b8a212bf7b142c
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Http/Routing/UrlGenerator.php#L608-L620
train
PenoaksDev/Milky-Framework
src/Milky/Http/Routing/UrlGenerator.php
UrlGenerator.isValidUrl
public function isValidUrl( $path ) { if ( Str::startsWith( $path, ['#', '//', 'mailto:', 'tel:', 'http://', 'https://'] ) ) return true; return filter_var( $path, FILTER_VALIDATE_URL ) !== false; }
php
public function isValidUrl( $path ) { if ( Str::startsWith( $path, ['#', '//', 'mailto:', 'tel:', 'http://', 'https://'] ) ) return true; return filter_var( $path, FILTER_VALIDATE_URL ) !== false; }
[ "public", "function", "isValidUrl", "(", "$", "path", ")", "{", "if", "(", "Str", "::", "startsWith", "(", "$", "path", ",", "[", "'#'", ",", "'//'", ",", "'mailto:'", ",", "'tel:'", ",", "'http://'", ",", "'https://'", "]", ")", ")", "return", "true...
Determine if the given path is a valid URL. @param string $path @return bool
[ "Determine", "if", "the", "given", "path", "is", "a", "valid", "URL", "." ]
8afd7156610a70371aa5b1df50b8a212bf7b142c
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Http/Routing/UrlGenerator.php#L693-L699
train
xelax90/learning-context-client
src/LearningContextClient/ContextData.php
ContextData.genNonce
protected function genNonce() { $chars = '1234567890abcdefghijklmnopqrstuvwxyz'; $rnd_string = ''; $num_chars = strlen($chars); $size = mt_rand(41, 59); for($i=0; $i<$size; $i++) { $rnd_string .= $chars[mt_rand(0, $num_chars - 1)]; } return $rnd_string; }
php
protected function genNonce() { $chars = '1234567890abcdefghijklmnopqrstuvwxyz'; $rnd_string = ''; $num_chars = strlen($chars); $size = mt_rand(41, 59); for($i=0; $i<$size; $i++) { $rnd_string .= $chars[mt_rand(0, $num_chars - 1)]; } return $rnd_string; }
[ "protected", "function", "genNonce", "(", ")", "{", "$", "chars", "=", "'1234567890abcdefghijklmnopqrstuvwxyz'", ";", "$", "rnd_string", "=", "''", ";", "$", "num_chars", "=", "strlen", "(", "$", "chars", ")", ";", "$", "size", "=", "mt_rand", "(", "41", ...
Generating a random string which will be used as nonce @return string
[ "Generating", "a", "random", "string", "which", "will", "be", "used", "as", "nonce" ]
f167584eaa3dcfd6f1a48497fcc9c4b98411c601
https://github.com/xelax90/learning-context-client/blob/f167584eaa3dcfd6f1a48497fcc9c4b98411c601/src/LearningContextClient/ContextData.php#L49-L58
train
xelax90/learning-context-client
src/LearningContextClient/ContextData.php
ContextData.genHash
protected function genHash($data, $nonce) { $token = $this->getConfig()->getStorage()->getAccessToken()->getAccessToken(); return sha1(urlencode($data) . $this->getConfig()->getAppId() . urlencode(sha1($token)) . urlencode($nonce) . $this->getConfig()->getAppSecret() . $token); }
php
protected function genHash($data, $nonce) { $token = $this->getConfig()->getStorage()->getAccessToken()->getAccessToken(); return sha1(urlencode($data) . $this->getConfig()->getAppId() . urlencode(sha1($token)) . urlencode($nonce) . $this->getConfig()->getAppSecret() . $token); }
[ "protected", "function", "genHash", "(", "$", "data", ",", "$", "nonce", ")", "{", "$", "token", "=", "$", "this", "->", "getConfig", "(", ")", "->", "getStorage", "(", ")", "->", "getAccessToken", "(", ")", "->", "getAccessToken", "(", ")", ";", "re...
Generating the required hash value from the data, nonce and the other information that is nearly static @param string $data @param string $nonce @return string
[ "Generating", "the", "required", "hash", "value", "from", "the", "data", "nonce", "and", "the", "other", "information", "that", "is", "nearly", "static" ]
f167584eaa3dcfd6f1a48497fcc9c4b98411c601
https://github.com/xelax90/learning-context-client/blob/f167584eaa3dcfd6f1a48497fcc9c4b98411c601/src/LearningContextClient/ContextData.php#L66-L69
train
smalldb/smalldb-rest
class/Router.php
Router.handle
public function handle($server, $get, $post) { $smalldb = null; // Convert current path to array and to string (result: $path is array, $path_str is string) $path = trim(isset($server['PATH_INFO']) ? $server['PATH_INFO'] : '', '/'); $path = ($path == '' ? array() : explode('/', $path)); // Get '!action' ...
php
public function handle($server, $get, $post) { $smalldb = null; // Convert current path to array and to string (result: $path is array, $path_str is string) $path = trim(isset($server['PATH_INFO']) ? $server['PATH_INFO'] : '', '/'); $path = ($path == '' ? array() : explode('/', $path)); // Get '!action' ...
[ "public", "function", "handle", "(", "$", "server", ",", "$", "get", ",", "$", "post", ")", "{", "$", "smalldb", "=", "null", ";", "// Convert current path to array and to string (result: $path is array, $path_str is string)", "$", "path", "=", "trim", "(", "isset",...
Interpret the HTTP request
[ "Interpret", "the", "HTTP", "request" ]
ff393ee39060b4524d41835921e86ed40af006fe
https://github.com/smalldb/smalldb-rest/blob/ff393ee39060b4524d41835921e86ed40af006fe/class/Router.php#L42-L89
train
BapCat/Remodel
src/GrammarWrapper.php
GrammarWrapper.compileSelect
public function compileSelect(Builder $query) { $this->beforeGet($query); return $this->grammar->compileSelect($query); }
php
public function compileSelect(Builder $query) { $this->beforeGet($query); return $this->grammar->compileSelect($query); }
[ "public", "function", "compileSelect", "(", "Builder", "$", "query", ")", "{", "$", "this", "->", "beforeGet", "(", "$", "query", ")", ";", "return", "$", "this", "->", "grammar", "->", "compileSelect", "(", "$", "query", ")", ";", "}" ]
Compile a select query into SQL @param Builder $query @return string
[ "Compile", "a", "select", "query", "into", "SQL" ]
80fcdec8bca22b88c5af9a0a93622c796cf3e7b1
https://github.com/BapCat/Remodel/blob/80fcdec8bca22b88c5af9a0a93622c796cf3e7b1/src/GrammarWrapper.php#L64-L67
train
BapCat/Remodel
src/GrammarWrapper.php
GrammarWrapper.compileInsert
public function compileInsert(Builder $query, array $values) { foreach($values as &$row) { $this->beforePut($row); } unset($row); $this->remapWheres($query); $sql = $this->grammar->compileInsert($query, $values); if($this->replace_into) { $sql = preg_replace('/^insert into/i', 're...
php
public function compileInsert(Builder $query, array $values) { foreach($values as &$row) { $this->beforePut($row); } unset($row); $this->remapWheres($query); $sql = $this->grammar->compileInsert($query, $values); if($this->replace_into) { $sql = preg_replace('/^insert into/i', 're...
[ "public", "function", "compileInsert", "(", "Builder", "$", "query", ",", "array", "$", "values", ")", "{", "foreach", "(", "$", "values", "as", "&", "$", "row", ")", "{", "$", "this", "->", "beforePut", "(", "$", "row", ")", ";", "}", "unset", "("...
Compile an insert statement into SQL @param Builder $query @param mixed[] $values @return string
[ "Compile", "an", "insert", "statement", "into", "SQL" ]
80fcdec8bca22b88c5af9a0a93622c796cf3e7b1
https://github.com/BapCat/Remodel/blob/80fcdec8bca22b88c5af9a0a93622c796cf3e7b1/src/GrammarWrapper.php#L88-L104
train
BapCat/Remodel
src/GrammarWrapper.php
GrammarWrapper.compileInsertGetId
public function compileInsertGetId(Builder $query, $values, $sequence) { $this->beforePut($values); $this->remapWheres($query); $sql = $this->grammar->compileInsertGetId($query, $values, $sequence); if($this->replace_into) { $sql = preg_replace('/^insert into/i', 'replace into', $sql); $thi...
php
public function compileInsertGetId(Builder $query, $values, $sequence) { $this->beforePut($values); $this->remapWheres($query); $sql = $this->grammar->compileInsertGetId($query, $values, $sequence); if($this->replace_into) { $sql = preg_replace('/^insert into/i', 'replace into', $sql); $thi...
[ "public", "function", "compileInsertGetId", "(", "Builder", "$", "query", ",", "$", "values", ",", "$", "sequence", ")", "{", "$", "this", "->", "beforePut", "(", "$", "values", ")", ";", "$", "this", "->", "remapWheres", "(", "$", "query", ")", ";", ...
Compile an insert and get ID statement into SQL @param Builder $query @param mixed[] $values @param string $sequence @return string
[ "Compile", "an", "insert", "and", "get", "ID", "statement", "into", "SQL" ]
80fcdec8bca22b88c5af9a0a93622c796cf3e7b1
https://github.com/BapCat/Remodel/blob/80fcdec8bca22b88c5af9a0a93622c796cf3e7b1/src/GrammarWrapper.php#L115-L126
train
BapCat/Remodel
src/GrammarWrapper.php
GrammarWrapper.compileUpdate
public function compileUpdate(Builder $query, $values) { $this->beforePut($values); $this->remapWheres($query); return $this->grammar->compileUpdate($query, $values); }
php
public function compileUpdate(Builder $query, $values) { $this->beforePut($values); $this->remapWheres($query); return $this->grammar->compileUpdate($query, $values); }
[ "public", "function", "compileUpdate", "(", "Builder", "$", "query", ",", "$", "values", ")", "{", "$", "this", "->", "beforePut", "(", "$", "values", ")", ";", "$", "this", "->", "remapWheres", "(", "$", "query", ")", ";", "return", "$", "this", "->...
Compile an update statement into SQL @param Builder $query @param array $values @return string
[ "Compile", "an", "update", "statement", "into", "SQL" ]
80fcdec8bca22b88c5af9a0a93622c796cf3e7b1
https://github.com/BapCat/Remodel/blob/80fcdec8bca22b88c5af9a0a93622c796cf3e7b1/src/GrammarWrapper.php#L136-L140
train
BapCat/Remodel
src/GrammarWrapper.php
GrammarWrapper.compileDelete
public function compileDelete(Builder $query) { $this->remapWheres($query); return $this->grammar->compileDelete($query); }
php
public function compileDelete(Builder $query) { $this->remapWheres($query); return $this->grammar->compileDelete($query); }
[ "public", "function", "compileDelete", "(", "Builder", "$", "query", ")", "{", "$", "this", "->", "remapWheres", "(", "$", "query", ")", ";", "return", "$", "this", "->", "grammar", "->", "compileDelete", "(", "$", "query", ")", ";", "}" ]
Compile a delete statement into SQL @param Builder $query @return string
[ "Compile", "a", "delete", "statement", "into", "SQL" ]
80fcdec8bca22b88c5af9a0a93622c796cf3e7b1
https://github.com/BapCat/Remodel/blob/80fcdec8bca22b88c5af9a0a93622c796cf3e7b1/src/GrammarWrapper.php#L149-L152
train
Torann/skosh-generator
src/Console/Application.php
Application.registerEvents
private function registerEvents() { foreach ($this->getSetting('events', []) as $event => $listeners) { foreach ($listeners as $listener) { Event::bind($event, $listener); } } }
php
private function registerEvents() { foreach ($this->getSetting('events', []) as $event => $listeners) { foreach ($listeners as $listener) { Event::bind($event, $listener); } } }
[ "private", "function", "registerEvents", "(", ")", "{", "foreach", "(", "$", "this", "->", "getSetting", "(", "'events'", ",", "[", "]", ")", "as", "$", "event", "=>", "$", "listeners", ")", "{", "foreach", "(", "$", "listeners", "as", "$", "listener",...
Register custom events.
[ "Register", "custom", "events", "." ]
ea60e037d92398d7c146eb2349735d5692e3c48c
https://github.com/Torann/skosh-generator/blob/ea60e037d92398d7c146eb2349735d5692e3c48c/src/Console/Application.php#L87-L94
train
mossphp/moss-storage
Moss/Storage/Query/AbstractQuery.php
AbstractQuery.resetBinds
protected function resetBinds($prefix = null) { if ($prefix === null) { $this->builder->setParameters([]); return; } $params = (array) $this->builder->getParameters(); $types = (array) $this->builder->getParameterTypes(); foreach (array_keys($params...
php
protected function resetBinds($prefix = null) { if ($prefix === null) { $this->builder->setParameters([]); return; } $params = (array) $this->builder->getParameters(); $types = (array) $this->builder->getParameterTypes(); foreach (array_keys($params...
[ "protected", "function", "resetBinds", "(", "$", "prefix", "=", "null", ")", "{", "if", "(", "$", "prefix", "===", "null", ")", "{", "$", "this", "->", "builder", "->", "setParameters", "(", "[", "]", ")", ";", "return", ";", "}", "$", "params", "=...
Removes bound values by their prefix If prefix is null - clears all bound values @param null|string $prefix
[ "Removes", "bound", "values", "by", "their", "prefix", "If", "prefix", "is", "null", "-", "clears", "all", "bound", "values" ]
0d123e7ae6bbfce1e2a18e73bf70997277b430c1
https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/AbstractQuery.php#L127-L145
train
PenoaksDev/Milky-Framework
src/Milky/Database/Schema/Blueprint.php
Blueprint.addFluentIndexes
protected function addFluentIndexes() { foreach ( $this->columns as $column ) { foreach ( ['primary', 'unique', 'index'] as $index ) { // If the index has been specified on the given column, but is simply // equal to "true" (boolean), no name has been specified for this // index, so we will simpl...
php
protected function addFluentIndexes() { foreach ( $this->columns as $column ) { foreach ( ['primary', 'unique', 'index'] as $index ) { // If the index has been specified on the given column, but is simply // equal to "true" (boolean), no name has been specified for this // index, so we will simpl...
[ "protected", "function", "addFluentIndexes", "(", ")", "{", "foreach", "(", "$", "this", "->", "columns", "as", "$", "column", ")", "{", "foreach", "(", "[", "'primary'", ",", "'unique'", ",", "'index'", "]", "as", "$", "index", ")", "{", "// If the inde...
Add the index commands fluently specified on columns. @return void
[ "Add", "the", "index", "commands", "fluently", "specified", "on", "columns", "." ]
8afd7156610a70371aa5b1df50b8a212bf7b142c
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Schema/Blueprint.php#L144-L171
train
DreadLabs/VantomasWebsite
src/CodeSnippet/SyntaxHighlighterBrush.php
SyntaxHighlighterBrush.fromIdentifierOrAlias
public static function fromIdentifierOrAlias($identifierOrAlias) { $alias = $identifierOrAlias; $identifier = 'Plain'; if (isset(self::$aliasToIdentifierMap[$identifierOrAlias])) { $identifier = self::$aliasToIdentifierMap[$identifierOrAlias]; } return new stati...
php
public static function fromIdentifierOrAlias($identifierOrAlias) { $alias = $identifierOrAlias; $identifier = 'Plain'; if (isset(self::$aliasToIdentifierMap[$identifierOrAlias])) { $identifier = self::$aliasToIdentifierMap[$identifierOrAlias]; } return new stati...
[ "public", "static", "function", "fromIdentifierOrAlias", "(", "$", "identifierOrAlias", ")", "{", "$", "alias", "=", "$", "identifierOrAlias", ";", "$", "identifier", "=", "'Plain'", ";", "if", "(", "isset", "(", "self", "::", "$", "aliasToIdentifierMap", "[",...
Instantiates the brush by identifier or alias. @param string $identifierOrAlias @return BrushInterface
[ "Instantiates", "the", "brush", "by", "identifier", "or", "alias", "." ]
7f85f2b45bdf5ed9fa9d320c805c416bf99cd668
https://github.com/DreadLabs/VantomasWebsite/blob/7f85f2b45bdf5ed9fa9d320c805c416bf99cd668/src/CodeSnippet/SyntaxHighlighterBrush.php#L74-L84
train
nails/module-blog
admin/controllers/Settings.php
Settings.permissions
public static function permissions(): array { $permissions = parent::permissions(); // Fetch the blogs, each blog should have its own permission $ci =& get_instance(); $ci->load->model('blog/blog_model'); $blogs = $ci->blog_model->getAll(); $out = array(); ...
php
public static function permissions(): array { $permissions = parent::permissions(); // Fetch the blogs, each blog should have its own permission $ci =& get_instance(); $ci->load->model('blog/blog_model'); $blogs = $ci->blog_model->getAll(); $out = array(); ...
[ "public", "static", "function", "permissions", "(", ")", ":", "array", "{", "$", "permissions", "=", "parent", "::", "permissions", "(", ")", ";", "// Fetch the blogs, each blog should have its own permission", "$", "ci", "=", "&", "get_instance", "(", ")", ";", ...
Returns an array of permissions which can be configured for the user @return array
[ "Returns", "an", "array", "of", "permissions", "which", "can", "be", "configured", "for", "the", "user" ]
7b369c5209f4343fff7c7e2a22c237d5a95c8c24
https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/admin/controllers/Settings.php#L52-L70
train
porkchopsandwiches/doctrine-utilities
lib/src/PorkChopSandwiches/Doctrine/Utilities/EntityManager/Generator.php
Generator.manufacture
static public function manufacture ($conn, Cache $cache_driver, Reader $annotation_reader, array $entity_paths, $autogenerate_strategy = false, $ensure_production_settings = false, $doctrine_annotations_file_path = self::DOCTRINE_ANNOTATIONS_FILE_PATH, $proxy_namespace = "Doctrine\\Proxies", $proxy_dir = "/lib/src/Doct...
php
static public function manufacture ($conn, Cache $cache_driver, Reader $annotation_reader, array $entity_paths, $autogenerate_strategy = false, $ensure_production_settings = false, $doctrine_annotations_file_path = self::DOCTRINE_ANNOTATIONS_FILE_PATH, $proxy_namespace = "Doctrine\\Proxies", $proxy_dir = "/lib/src/Doct...
[ "static", "public", "function", "manufacture", "(", "$", "conn", ",", "Cache", "$", "cache_driver", ",", "Reader", "$", "annotation_reader", ",", "array", "$", "entity_paths", ",", "$", "autogenerate_strategy", "=", "false", ",", "$", "ensure_production_settings",...
Manufactures an EntityManager instance using the passed configuration. @param array|Connection $conn @param Cache $cache_driver @param Reader $annotation_reader @param array $entity_paths @param boolean [$autogenerate_strategy] @param boolean [$ensure_production_settings] @param string [$doctrine_...
[ "Manufactures", "an", "EntityManager", "instance", "using", "the", "passed", "configuration", "." ]
cc5e4268bac36c68af62d69d9512a0dd01ee310f
https://github.com/porkchopsandwiches/doctrine-utilities/blob/cc5e4268bac36c68af62d69d9512a0dd01ee310f/lib/src/PorkChopSandwiches/Doctrine/Utilities/EntityManager/Generator.php#L45-L93
train
azhai/code-refactor
src/CodeRefactor/CodeBlock.php
CodeBlock.insertStmts
public function insertStmts(array $stmts, $offset = 0, $remove = 0) { if (false === $offset) { $offset = count($this->stmts); } elseif (false === $remove) { $remove = count($this->stmts); } array_splice($this->stmts, $offset, $remove, $stmts); return $...
php
public function insertStmts(array $stmts, $offset = 0, $remove = 0) { if (false === $offset) { $offset = count($this->stmts); } elseif (false === $remove) { $remove = count($this->stmts); } array_splice($this->stmts, $offset, $remove, $stmts); return $...
[ "public", "function", "insertStmts", "(", "array", "$", "stmts", ",", "$", "offset", "=", "0", ",", "$", "remove", "=", "0", ")", "{", "if", "(", "false", "===", "$", "offset", ")", "{", "$", "offset", "=", "count", "(", "$", "this", "->", "stmts...
Insert or replace some statements.
[ "Insert", "or", "replace", "some", "statements", "." ]
cddb437d72f8239957daeba8211dda5e9366d6ca
https://github.com/azhai/code-refactor/blob/cddb437d72f8239957daeba8211dda5e9366d6ca/src/CodeRefactor/CodeBlock.php#L42-L51
train
bseddon/XPath20
XPath2NodeIterator/XPath2NodeIteratorDebugView.php
XPath2NodeIteratorDebugView.getItems
public function getItems() { /** * @var array $res */ $res = array(); foreach ( $this->iter as /** @var XPathItem $item */ $item ) { if ( count( $res ) == 10) break; $res[] = $item->CloneInstance(); } return $res; }
php
public function getItems() { /** * @var array $res */ $res = array(); foreach ( $this->iter as /** @var XPathItem $item */ $item ) { if ( count( $res ) == 10) break; $res[] = $item->CloneInstance(); } return $res; }
[ "public", "function", "getItems", "(", ")", "{", "/**\r\n\t\t * @var array $res\r\n\t\t */", "$", "res", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "iter", "as", "/** @var XPathItem $item */", "$", "item", ")", "{", "if", "(", "count", "...
Return the first 10 items of the iterator @var XPathItem[] $Items
[ "Return", "the", "first", "10", "items", "of", "the", "iterator" ]
69882b6efffaa5470a819d5fdd2f6473ddeb046d
https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/XPath2NodeIterator/XPath2NodeIteratorDebugView.php#L60-L75
train
CroudTech/laravel-repositories
src/BaseRepository.php
BaseRepository.findBy
public function findBy($field, $value) { $model_class = $this->getModelName(); return $model_class::where($field, $value)->first(); }
php
public function findBy($field, $value) { $model_class = $this->getModelName(); return $model_class::where($field, $value)->first(); }
[ "public", "function", "findBy", "(", "$", "field", ",", "$", "value", ")", "{", "$", "model_class", "=", "$", "this", "->", "getModelName", "(", ")", ";", "return", "$", "model_class", "::", "where", "(", "$", "field", ",", "$", "value", ")", "->", ...
Find a record by a custom field @method findBy @param string $field The field to search by @param mixed $value The field value @return Model | null
[ "Find", "a", "record", "by", "a", "custom", "field" ]
3146285be911728fe7b00cf27d2494ad22b773dc
https://github.com/CroudTech/laravel-repositories/blob/3146285be911728fe7b00cf27d2494ad22b773dc/src/BaseRepository.php#L115-L119
train
CroudTech/laravel-repositories
src/BaseRepository.php
BaseRepository.create
public function create(array $data) : Model { $model_class = $this->getModelName(); return $this->postCreate($data, $model_class::create($this->preCreate($this->parseData($data)))); }
php
public function create(array $data) : Model { $model_class = $this->getModelName(); return $this->postCreate($data, $model_class::create($this->preCreate($this->parseData($data)))); }
[ "public", "function", "create", "(", "array", "$", "data", ")", ":", "Model", "{", "$", "model_class", "=", "$", "this", "->", "getModelName", "(", ")", ";", "return", "$", "this", "->", "postCreate", "(", "$", "data", ",", "$", "model_class", "::", ...
Create and return the model object @method create @param array $data array @return Model
[ "Create", "and", "return", "the", "model", "object" ]
3146285be911728fe7b00cf27d2494ad22b773dc
https://github.com/CroudTech/laravel-repositories/blob/3146285be911728fe7b00cf27d2494ad22b773dc/src/BaseRepository.php#L128-L132
train
CroudTech/laravel-repositories
src/BaseRepository.php
BaseRepository.delete
public function delete($id) { if ($record = $this->find($id)) { if ($this->preDelete($id, $record)) { return $this->postDelete($id, $record->delete(), $record); } } else { $this->throwModelNotFoundException($id); } }
php
public function delete($id) { if ($record = $this->find($id)) { if ($this->preDelete($id, $record)) { return $this->postDelete($id, $record->delete(), $record); } } else { $this->throwModelNotFoundException($id); } }
[ "public", "function", "delete", "(", "$", "id", ")", "{", "if", "(", "$", "record", "=", "$", "this", "->", "find", "(", "$", "id", ")", ")", "{", "if", "(", "$", "this", "->", "preDelete", "(", "$", "id", ",", "$", "record", ")", ")", "{", ...
Delete a record by ID @method delete @param integer $id The ID of the record @return boolean
[ "Delete", "a", "record", "by", "ID" ]
3146285be911728fe7b00cf27d2494ad22b773dc
https://github.com/CroudTech/laravel-repositories/blob/3146285be911728fe7b00cf27d2494ad22b773dc/src/BaseRepository.php#L208-L217
train
CroudTech/laravel-repositories
src/BaseRepository.php
BaseRepository.parseData
public function parseData(array $data) : array { if ($this->getTransformer() instanceof RequestTransformerContract) { return $this->getTransformer()->transformRequestData($data); } return $data; }
php
public function parseData(array $data) : array { if ($this->getTransformer() instanceof RequestTransformerContract) { return $this->getTransformer()->transformRequestData($data); } return $data; }
[ "public", "function", "parseData", "(", "array", "$", "data", ")", ":", "array", "{", "if", "(", "$", "this", "->", "getTransformer", "(", ")", "instanceof", "RequestTransformerContract", ")", "{", "return", "$", "this", "->", "getTransformer", "(", ")", "...
Parse the data using the 'request' method of the transformer if it exists @method parseData @param array $data The data to parse @return array The parsed data
[ "Parse", "the", "data", "using", "the", "request", "method", "of", "the", "transformer", "if", "it", "exists" ]
3146285be911728fe7b00cf27d2494ad22b773dc
https://github.com/CroudTech/laravel-repositories/blob/3146285be911728fe7b00cf27d2494ad22b773dc/src/BaseRepository.php#L290-L297
train
CroudTech/laravel-repositories
src/BaseRepository.php
BaseRepository.transformItem
public function transformItem(Model $item, $includes = [], TransformerContract $transformer = null) { $this->fractal_manager->parseIncludes($includes); $transformer = is_null($transformer) ? $this->getTransformer() : $transformer; $resource = new Item($item, $transformer, $this->getModelName...
php
public function transformItem(Model $item, $includes = [], TransformerContract $transformer = null) { $this->fractal_manager->parseIncludes($includes); $transformer = is_null($transformer) ? $this->getTransformer() : $transformer; $resource = new Item($item, $transformer, $this->getModelName...
[ "public", "function", "transformItem", "(", "Model", "$", "item", ",", "$", "includes", "=", "[", "]", ",", "TransformerContract", "$", "transformer", "=", "null", ")", "{", "$", "this", "->", "fractal_manager", "->", "parseIncludes", "(", "$", "includes", ...
Pass a model through the transformer @method transformItem @param Model $item The model to transform @param array $includes Any transformer includes to use @param TransformerContract $transformer Override the transformer @return array
[ "Pass", "a", "model", "through", "the", "transformer" ]
3146285be911728fe7b00cf27d2494ad22b773dc
https://github.com/CroudTech/laravel-repositories/blob/3146285be911728fe7b00cf27d2494ad22b773dc/src/BaseRepository.php#L340-L346
train
CroudTech/laravel-repositories
src/BaseRepository.php
BaseRepository.newQuery
public function newQuery() : QueryBuilder { $model = $this->container->make($this->getModelName()); if (!$model instanceof Model) { throw new RepositoryException("Class {$this->model()} must be an instance of " . Model::class); } return $model->newQuery(); }
php
public function newQuery() : QueryBuilder { $model = $this->container->make($this->getModelName()); if (!$model instanceof Model) { throw new RepositoryException("Class {$this->model()} must be an instance of " . Model::class); } return $model->newQuery(); }
[ "public", "function", "newQuery", "(", ")", ":", "QueryBuilder", "{", "$", "model", "=", "$", "this", "->", "container", "->", "make", "(", "$", "this", "->", "getModelName", "(", ")", ")", ";", "if", "(", "!", "$", "model", "instanceof", "Model", ")...
Create a new query instance @method newQuery @return QueryBuilder [description]
[ "Create", "a", "new", "query", "instance" ]
3146285be911728fe7b00cf27d2494ad22b773dc
https://github.com/CroudTech/laravel-repositories/blob/3146285be911728fe7b00cf27d2494ad22b773dc/src/BaseRepository.php#L387-L396
train
CroudTech/laravel-repositories
src/BaseRepository.php
BaseRepository.throwModelNotFoundException
protected function throwModelNotFoundException($id) { throw new ModelNotFoundException('Model not found for ID ' . $id . ' on table ' . $this->container->make($this->getModelName())->getTable()); }
php
protected function throwModelNotFoundException($id) { throw new ModelNotFoundException('Model not found for ID ' . $id . ' on table ' . $this->container->make($this->getModelName())->getTable()); }
[ "protected", "function", "throwModelNotFoundException", "(", "$", "id", ")", "{", "throw", "new", "ModelNotFoundException", "(", "'Model not found for ID '", ".", "$", "id", ".", "' on table '", ".", "$", "this", "->", "container", "->", "make", "(", "$", "this"...
Throw an exception when a model is not found @method throwModelNotFoundException @param integer $id
[ "Throw", "an", "exception", "when", "a", "model", "is", "not", "found" ]
3146285be911728fe7b00cf27d2494ad22b773dc
https://github.com/CroudTech/laravel-repositories/blob/3146285be911728fe7b00cf27d2494ad22b773dc/src/BaseRepository.php#L404-L407
train
MindyPHP/OrmNestedSet
TreeQuerySet.php
TreeQuerySet.parent
public function parent() { return $this->filter([ 'lft__lt' => $this->getModel()->lft, 'rgt__gt' => $this->getModel()->rgt, 'level' => $this->getModel()->level - 1, 'root' => $this->getModel()->root, ]); }
php
public function parent() { return $this->filter([ 'lft__lt' => $this->getModel()->lft, 'rgt__gt' => $this->getModel()->rgt, 'level' => $this->getModel()->level - 1, 'root' => $this->getModel()->root, ]); }
[ "public", "function", "parent", "(", ")", "{", "return", "$", "this", "->", "filter", "(", "[", "'lft__lt'", "=>", "$", "this", "->", "getModel", "(", ")", "->", "lft", ",", "'rgt__gt'", "=>", "$", "this", "->", "getModel", "(", ")", "->", "rgt", "...
Named scope. Gets parent of node. @return QuerySet
[ "Named", "scope", ".", "Gets", "parent", "of", "node", "." ]
8231c55f9b95314789983c0b0ec83a9eb70adf79
https://github.com/MindyPHP/OrmNestedSet/blob/8231c55f9b95314789983c0b0ec83a9eb70adf79/TreeQuerySet.php#L125-L133
train
MindyPHP/OrmNestedSet
TreeQuerySet.php
TreeQuerySet.rebuildLftRgt
protected function rebuildLftRgt(string $table) { $builder = QueryBuilderFactory::getQueryBuilder($this->getConnection()); $subQuerySql = (clone $builder) ->clear() ->select('tt.parent_id') ->table($table, 'tt') ->where('tt.parent_id=t.id') ...
php
protected function rebuildLftRgt(string $table) { $builder = QueryBuilderFactory::getQueryBuilder($this->getConnection()); $subQuerySql = (clone $builder) ->clear() ->select('tt.parent_id') ->table($table, 'tt') ->where('tt.parent_id=t.id') ...
[ "protected", "function", "rebuildLftRgt", "(", "string", "$", "table", ")", "{", "$", "builder", "=", "QueryBuilderFactory", "::", "getQueryBuilder", "(", "$", "this", "->", "getConnection", "(", ")", ")", ";", "$", "subQuerySql", "=", "(", "clone", "$", "...
Find and delete broken branches without root, parent and with incorrect lft, rgt. sql: SELECT id, root, lft, rgt, (rgt-lft-1) AS move FROM tbl t WHERE NOT t.lft = (t.rgt-1) AND NOT id IN ( SELECT tc.parent_id FROM tbl tc WHERE tc.parent_id = t.id ) ORDER BY rgt DESC @param $table @throws \Doctrine\DBAL\DBALException...
[ "Find", "and", "delete", "broken", "branches", "without", "root", "parent", "and", "with", "incorrect", "lft", "rgt", "." ]
8231c55f9b95314789983c0b0ec83a9eb70adf79
https://github.com/MindyPHP/OrmNestedSet/blob/8231c55f9b95314789983c0b0ec83a9eb70adf79/TreeQuerySet.php#L347-L434
train
MindyPHP/OrmNestedSet
TreeQuerySet.php
TreeQuerySet.toHierarchy
public function toHierarchy($collection): array { // Trees mapped $trees = []; if (count($collection) > 0) { // Node Stack. Used to help building the hierarchy $stack = []; foreach ($collection as $item) { $item[$this->treeKey] = []; ...
php
public function toHierarchy($collection): array { // Trees mapped $trees = []; if (count($collection) > 0) { // Node Stack. Used to help building the hierarchy $stack = []; foreach ($collection as $item) { $item[$this->treeKey] = []; ...
[ "public", "function", "toHierarchy", "(", "$", "collection", ")", ":", "array", "{", "// Trees mapped", "$", "trees", "=", "[", "]", ";", "if", "(", "count", "(", "$", "collection", ")", ">", "0", ")", "{", "// Node Stack. Used to help building the hierarchy",...
Make hierarchy array by level. @param $collection Model[] @return array
[ "Make", "hierarchy", "array", "by", "level", "." ]
8231c55f9b95314789983c0b0ec83a9eb70adf79
https://github.com/MindyPHP/OrmNestedSet/blob/8231c55f9b95314789983c0b0ec83a9eb70adf79/TreeQuerySet.php#L505-L537
train
phpffcms/ffcms-core
src/Helper/FileSystem/Directory.php
Directory.writable
public static function writable($path) { $path = Normalize::diskFullPath($path); if (!self::exist($path)) { return false; } return (is_dir($path) && is_writable($path)); }
php
public static function writable($path) { $path = Normalize::diskFullPath($path); if (!self::exist($path)) { return false; } return (is_dir($path) && is_writable($path)); }
[ "public", "static", "function", "writable", "(", "$", "path", ")", "{", "$", "path", "=", "Normalize", "::", "diskFullPath", "(", "$", "path", ")", ";", "if", "(", "!", "self", "::", "exist", "(", "$", "path", ")", ")", "{", "return", "false", ";",...
Check if directory is writable @param string $path @return bool
[ "Check", "if", "directory", "is", "writable" ]
44a309553ef9f115ccfcfd71f2ac6e381c612082
https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/FileSystem/Directory.php#L32-L41
train
phpffcms/ffcms-core
src/Helper/FileSystem/Directory.php
Directory.create
public static function create($path, $chmod = 0755) { $path = Normalize::diskFullPath($path); if (self::exist($path)) { return false; } return @mkdir($path, $chmod, true); }
php
public static function create($path, $chmod = 0755) { $path = Normalize::diskFullPath($path); if (self::exist($path)) { return false; } return @mkdir($path, $chmod, true); }
[ "public", "static", "function", "create", "(", "$", "path", ",", "$", "chmod", "=", "0755", ")", "{", "$", "path", "=", "Normalize", "::", "diskFullPath", "(", "$", "path", ")", ";", "if", "(", "self", "::", "exist", "(", "$", "path", ")", ")", "...
Create directory with recursive support. @param string $path @param int $chmod @return bool
[ "Create", "directory", "with", "recursive", "support", "." ]
44a309553ef9f115ccfcfd71f2ac6e381c612082
https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/FileSystem/Directory.php#L49-L58
train
phpffcms/ffcms-core
src/Helper/FileSystem/Directory.php
Directory.remove
public static function remove($path) { $path = Normalize::diskFullPath($path); if (!self::exist($path)) { return false; } foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST)...
php
public static function remove($path) { $path = Normalize::diskFullPath($path); if (!self::exist($path)) { return false; } foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST)...
[ "public", "static", "function", "remove", "(", "$", "path", ")", "{", "$", "path", "=", "Normalize", "::", "diskFullPath", "(", "$", "path", ")", ";", "if", "(", "!", "self", "::", "exist", "(", "$", "path", ")", ")", "{", "return", "false", ";", ...
Remove directory recursive. @param string $path @return bool
[ "Remove", "directory", "recursive", "." ]
44a309553ef9f115ccfcfd71f2ac6e381c612082
https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/FileSystem/Directory.php#L65-L77
train
phpffcms/ffcms-core
src/Helper/FileSystem/Directory.php
Directory.scan
public static function scan($path, $mod = GLOB_ONLYDIR, $returnRelative = false) { $path = Normalize::diskFullPath($path); if (!self::exist($path)) { return false; } $pattern = rtrim($path, '/') . '/*'; $entry = glob($pattern, $mod); if ($returnRelative...
php
public static function scan($path, $mod = GLOB_ONLYDIR, $returnRelative = false) { $path = Normalize::diskFullPath($path); if (!self::exist($path)) { return false; } $pattern = rtrim($path, '/') . '/*'; $entry = glob($pattern, $mod); if ($returnRelative...
[ "public", "static", "function", "scan", "(", "$", "path", ",", "$", "mod", "=", "GLOB_ONLYDIR", ",", "$", "returnRelative", "=", "false", ")", "{", "$", "path", "=", "Normalize", "::", "diskFullPath", "(", "$", "path", ")", ";", "if", "(", "!", "self...
Scan files in directory and return full or relative path @param string $path @param int $mod @param bool|false $returnRelative @return array|bool
[ "Scan", "files", "in", "directory", "and", "return", "full", "or", "relative", "path" ]
44a309553ef9f115ccfcfd71f2ac6e381c612082
https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/FileSystem/Directory.php#L86-L104
train
phpffcms/ffcms-core
src/Helper/FileSystem/Directory.php
Directory.recursiveChmod
public static function recursiveChmod($path, $mod = 0777) { $path = Normalize::diskFullPath($path); if (!self::exist($path)) { return; } $dir = new \DirectoryIterator($path); foreach ($dir as $item) { // change chmod for folders and files ...
php
public static function recursiveChmod($path, $mod = 0777) { $path = Normalize::diskFullPath($path); if (!self::exist($path)) { return; } $dir = new \DirectoryIterator($path); foreach ($dir as $item) { // change chmod for folders and files ...
[ "public", "static", "function", "recursiveChmod", "(", "$", "path", ",", "$", "mod", "=", "0777", ")", "{", "$", "path", "=", "Normalize", "::", "diskFullPath", "(", "$", "path", ")", ";", "if", "(", "!", "self", "::", "exist", "(", "$", "path", ")...
Change chmod recursive inside defined folder @param string $path @param int $mod
[ "Change", "chmod", "recursive", "inside", "defined", "folder" ]
44a309553ef9f115ccfcfd71f2ac6e381c612082
https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/FileSystem/Directory.php#L135-L153
train
eureka-framework/component-response
src/Response/Json/Api.php
Api.getContent
public function getContent() { $json = new \stdClass(); $json->isSuccess = $this->isSuccess(); $json->errorCode = $this->getErrorCode(); $json->errorMessage = $this->getErrorMessage(); $json->data = $this->content; return $json; }
php
public function getContent() { $json = new \stdClass(); $json->isSuccess = $this->isSuccess(); $json->errorCode = $this->getErrorCode(); $json->errorMessage = $this->getErrorMessage(); $json->data = $this->content; return $json; }
[ "public", "function", "getContent", "(", ")", "{", "$", "json", "=", "new", "\\", "stdClass", "(", ")", ";", "$", "json", "->", "isSuccess", "=", "$", "this", "->", "isSuccess", "(", ")", ";", "$", "json", "->", "errorCode", "=", "$", "this", "->",...
Over getContent response. Add specific content to the response. @return string
[ "Over", "getContent", "response", ".", "Add", "specific", "content", "to", "the", "response", "." ]
f34aea3a0aa67b88c5e7f8a3b86af29c550fa99a
https://github.com/eureka-framework/component-response/blob/f34aea3a0aa67b88c5e7f8a3b86af29c550fa99a/src/Response/Json/Api.php#L39-L49
train
eureka-framework/component-response
src/Response/Json/Api.php
Api.setErrorMessage
final public function setErrorMessage($message) { $this->errorMessage = (string) $message; if (empty($this->errorMessage)) { throw new \RuntimeException('Error message cannot be empty !'); } return $this; }
php
final public function setErrorMessage($message) { $this->errorMessage = (string) $message; if (empty($this->errorMessage)) { throw new \RuntimeException('Error message cannot be empty !'); } return $this; }
[ "final", "public", "function", "setErrorMessage", "(", "$", "message", ")", "{", "$", "this", "->", "errorMessage", "=", "(", "string", ")", "$", "message", ";", "if", "(", "empty", "(", "$", "this", "->", "errorMessage", ")", ")", "{", "throw", "new",...
Set error message. @param string $message @return self @throws \RuntimeException
[ "Set", "error", "message", "." ]
f34aea3a0aa67b88c5e7f8a3b86af29c550fa99a
https://github.com/eureka-framework/component-response/blob/f34aea3a0aa67b88c5e7f8a3b86af29c550fa99a/src/Response/Json/Api.php#L114-L123
train
eureka-framework/component-response
src/Response/Json/Api.php
Api.appendContent
public function appendContent($key, $value) { if ($this->content === null) { $this->content = array(); } if (!is_array($this->content)) { throw new \InvalidArgumentException('Cannot append response content: Current content is not an array !'); } $thi...
php
public function appendContent($key, $value) { if ($this->content === null) { $this->content = array(); } if (!is_array($this->content)) { throw new \InvalidArgumentException('Cannot append response content: Current content is not an array !'); } $thi...
[ "public", "function", "appendContent", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "$", "this", "->", "content", "===", "null", ")", "{", "$", "this", "->", "content", "=", "array", "(", ")", ";", "}", "if", "(", "!", "is_array", "("...
Append content for the response. @param string $key @param mixed $value @return self @throws \InvalidArgumentException
[ "Append", "content", "for", "the", "response", "." ]
f34aea3a0aa67b88c5e7f8a3b86af29c550fa99a
https://github.com/eureka-framework/component-response/blob/f34aea3a0aa67b88c5e7f8a3b86af29c550fa99a/src/Response/Json/Api.php#L133-L146
train
nativgames-old/pegase
src/Pegase/Core/Router/Service/Router.php
Router.get
public function get($route_name) { $route = null; if(!array_key_exists($route_name, $this->routes)) echo "Router: error: the array key $route_name doesn't exists.<br />"; else { $route_infos = $this->routes[$route_name]; if($route_controller = $this->instancy_controller($route_inf...
php
public function get($route_name) { $route = null; if(!array_key_exists($route_name, $this->routes)) echo "Router: error: the array key $route_name doesn't exists.<br />"; else { $route_infos = $this->routes[$route_name]; if($route_controller = $this->instancy_controller($route_inf...
[ "public", "function", "get", "(", "$", "route_name", ")", "{", "$", "route", "=", "null", ";", "if", "(", "!", "array_key_exists", "(", "$", "route_name", ",", "$", "this", "->", "routes", ")", ")", "echo", "\"Router: error: the array key $route_name doesn't e...
returns the controller with 'route_name'
[ "returns", "the", "controller", "with", "route_name" ]
9a00e09a26f391c988aadecd7640c72316eaa521
https://github.com/nativgames-old/pegase/blob/9a00e09a26f391c988aadecd7640c72316eaa521/src/Pegase/Core/Router/Service/Router.php#L49-L63
train
afroware/jwtauth
src/JwT.php
JwT.check
public function check($getPayload = false) { try { $payload = $this->checkOrFail(); } catch (JwTException $e) { return false; } return $getPayload ? $payload : true; }
php
public function check($getPayload = false) { try { $payload = $this->checkOrFail(); } catch (JwTException $e) { return false; } return $getPayload ? $payload : true; }
[ "public", "function", "check", "(", "$", "getPayload", "=", "false", ")", "{", "try", "{", "$", "payload", "=", "$", "this", "->", "checkOrFail", "(", ")", ";", "}", "catch", "(", "JwTException", "$", "e", ")", "{", "return", "false", ";", "}", "re...
Check that the token is valid. @param bool $getPayload @return \Afroware\JwTauth\Payload|bool
[ "Check", "that", "the", "token", "is", "valid", "." ]
54a0aebd811d87bfdd2b3668696fd53f50490cc1
https://github.com/afroware/jwtauth/blob/54a0aebd811d87bfdd2b3668696fd53f50490cc1/src/JwT.php#L139-L148
train
brightnucleus/options-store
src/OptionRepository/AggregateOptionRepository.php
AggregateOptionRepository.has
public function has(string $key): bool { foreach ($this->repositories as $repository) { if ($repository->has($key)) { return true; } } return false; }
php
public function has(string $key): bool { foreach ($this->repositories as $repository) { if ($repository->has($key)) { return true; } } return false; }
[ "public", "function", "has", "(", "string", "$", "key", ")", ":", "bool", "{", "foreach", "(", "$", "this", "->", "repositories", "as", "$", "repository", ")", "{", "if", "(", "$", "repository", "->", "has", "(", "$", "key", ")", ")", "{", "return"...
Check whether the repository contains a given key. @since 0.1.0 @param string $key Key to check for. @return bool Whether the repository contained the requested key.
[ "Check", "whether", "the", "repository", "contains", "a", "given", "key", "." ]
9a9ef2a160bbacd69fe3e9db0be8ed89e6905ef1
https://github.com/brightnucleus/options-store/blob/9a9ef2a160bbacd69fe3e9db0be8ed89e6905ef1/src/OptionRepository/AggregateOptionRepository.php#L72-L81
train
koolkode/security
src/Authentication/Token/HttpDigestToken.php
HttpDigestToken.isValidResponse
public function isValidResponse($ha1) { if($this->opaque === NULL) { return false; } if(!SecurityUtil::timingSafeEquals($this->auth->getOpaque(), $this->opaque)) { return false; } $args = [ $ha1, $this->nonce, $this->nc, $this->cnonce, $this->auth->getQualityOfProtection(), ...
php
public function isValidResponse($ha1) { if($this->opaque === NULL) { return false; } if(!SecurityUtil::timingSafeEquals($this->auth->getOpaque(), $this->opaque)) { return false; } $args = [ $ha1, $this->nonce, $this->nc, $this->cnonce, $this->auth->getQualityOfProtection(), ...
[ "public", "function", "isValidResponse", "(", "$", "ha1", ")", "{", "if", "(", "$", "this", "->", "opaque", "===", "NULL", ")", "{", "return", "false", ";", "}", "if", "(", "!", "SecurityUtil", "::", "timingSafeEquals", "(", "$", "this", "->", "auth", ...
Check if the response is valid using the given HA1 value. @param string $ha1 @return boolean
[ "Check", "if", "the", "response", "is", "valid", "using", "the", "given", "HA1", "value", "." ]
d3d8d42392f520754847d29b6df19aaa38c79e8e
https://github.com/koolkode/security/blob/d3d8d42392f520754847d29b6df19aaa38c79e8e/src/Authentication/Token/HttpDigestToken.php#L235-L257
train
theopera/framework
src/Component/WebApplication/RouteCollection.php
RouteCollection.addRoute
public function addRoute(string $path, string $controller, string $action = 'index', string $method = Request::METHOD_GET) : self { $endPoint = new RouteEndpoint($this->namespace, $controller, $action, $method); $this->routes[] = new Route($path, $endPoint); return $this; }
php
public function addRoute(string $path, string $controller, string $action = 'index', string $method = Request::METHOD_GET) : self { $endPoint = new RouteEndpoint($this->namespace, $controller, $action, $method); $this->routes[] = new Route($path, $endPoint); return $this; }
[ "public", "function", "addRoute", "(", "string", "$", "path", ",", "string", "$", "controller", ",", "string", "$", "action", "=", "'index'", ",", "string", "$", "method", "=", "Request", "::", "METHOD_GET", ")", ":", "self", "{", "$", "endPoint", "=", ...
Add a new route to the collection @param string $path @param string $controller @param string $action @param string $method @return $this
[ "Add", "a", "new", "route", "to", "the", "collection" ]
fa6165d3891a310faa580c81dee49a63c150c711
https://github.com/theopera/framework/blob/fa6165d3891a310faa580c81dee49a63c150c711/src/Component/WebApplication/RouteCollection.php#L50-L56
train
pluf/tenant
src/Tenant/Views/SpaRun.php
Tenant_Views_SpaRun.defaultSpa
public function defaultSpa($request, $match) { $name = Tenant_Service::setting('spa.default', 'not-found'); $spa = Tenant_SPA::getSpaByName($name); if (! isset($spa)) { $spa = Tenant_SpaService::getNotfoundSpa(); } // $resPath = $spa->getMainPagePath(); //...
php
public function defaultSpa($request, $match) { $name = Tenant_Service::setting('spa.default', 'not-found'); $spa = Tenant_SPA::getSpaByName($name); if (! isset($spa)) { $spa = Tenant_SpaService::getNotfoundSpa(); } // $resPath = $spa->getMainPagePath(); //...
[ "public", "function", "defaultSpa", "(", "$", "request", ",", "$", "match", ")", "{", "$", "name", "=", "Tenant_Service", "::", "setting", "(", "'spa.default'", ",", "'not-found'", ")", ";", "$", "spa", "=", "Tenant_SPA", "::", "getSpaByName", "(", "$", ...
Load default spa @param Pluf_HTTP_Request $request @param array $match @return Pluf_HTTP_Response_File|Pluf_HTTP_Response
[ "Load", "default", "spa" ]
a06359c52b9a257b5a0a186264e8770acfc54b73
https://github.com/pluf/tenant/blob/a06359c52b9a257b5a0a186264e8770acfc54b73/src/Tenant/Views/SpaRun.php#L41-L53
train
pluf/tenant
src/Tenant/Views/SpaRun.php
Tenant_Views_SpaRun.defaultSpaRobotsTxt
public function defaultSpaRobotsTxt($request, $match) { $name = Tenant_Service::setting('spa.default', 'not-found'); $spa = Tenant_SPA::getSpaByName($name); if (! isset($spa)) { $spa = Tenant_SpaService::getNotfoundSpa(); } $resourcePath = $spa->getResourcePath('r...
php
public function defaultSpaRobotsTxt($request, $match) { $name = Tenant_Service::setting('spa.default', 'not-found'); $spa = Tenant_SPA::getSpaByName($name); if (! isset($spa)) { $spa = Tenant_SpaService::getNotfoundSpa(); } $resourcePath = $spa->getResourcePath('r...
[ "public", "function", "defaultSpaRobotsTxt", "(", "$", "request", ",", "$", "match", ")", "{", "$", "name", "=", "Tenant_Service", "::", "setting", "(", "'spa.default'", ",", "'not-found'", ")", ";", "$", "spa", "=", "Tenant_SPA", "::", "getSpaByName", "(", ...
Load robots.txt of default spa @param Pluf_HTTP_Request $request @param array $match @return Pluf_HTTP_Response_File|Pluf_HTTP_Response
[ "Load", "robots", ".", "txt", "of", "default", "spa" ]
a06359c52b9a257b5a0a186264e8770acfc54b73
https://github.com/pluf/tenant/blob/a06359c52b9a257b5a0a186264e8770acfc54b73/src/Tenant/Views/SpaRun.php#L62-L72
train
pluf/tenant
src/Tenant/Views/SpaRun.php
Tenant_Views_SpaRun.loadResource
public function loadResource($request, $match) { // First part of path $firstPart = $match['firstPart']; // Remain part of path $remainPart = ''; if (array_key_exists('remainPart', $match)) { $remainPart = $match['remainPart']; } $spa = Tenant_SPA...
php
public function loadResource($request, $match) { // First part of path $firstPart = $match['firstPart']; // Remain part of path $remainPart = ''; if (array_key_exists('remainPart', $match)) { $remainPart = $match['remainPart']; } $spa = Tenant_SPA...
[ "public", "function", "loadResource", "(", "$", "request", ",", "$", "match", ")", "{", "// First part of path", "$", "firstPart", "=", "$", "match", "[", "'firstPart'", "]", ";", "// Remain part of path", "$", "remainPart", "=", "''", ";", "if", "(", "array...
Load a resource from SPA @param Pluf_HTTP_Request $request @param array $match @return Pluf_HTTP_Response_File|Pluf_HTTP_Response
[ "Load", "a", "resource", "from", "SPA" ]
a06359c52b9a257b5a0a186264e8770acfc54b73
https://github.com/pluf/tenant/blob/a06359c52b9a257b5a0a186264e8770acfc54b73/src/Tenant/Views/SpaRun.php#L81-L130
train
pluf/tenant
src/Tenant/Views/SpaRun.php
Tenant_Views_SpaRun.findTenantResource
private function findTenantResource($path) { $q = new Pluf_SQL('path=%s', array( $path )); $item = new Tenant_Resource(); $item = $item->getList(array( 'filter' => $q->gen() )); if (isset($item) && $item->count() == 1) { return $ite...
php
private function findTenantResource($path) { $q = new Pluf_SQL('path=%s', array( $path )); $item = new Tenant_Resource(); $item = $item->getList(array( 'filter' => $q->gen() )); if (isset($item) && $item->count() == 1) { return $ite...
[ "private", "function", "findTenantResource", "(", "$", "path", ")", "{", "$", "q", "=", "new", "Pluf_SQL", "(", "'path=%s'", ",", "array", "(", "$", "path", ")", ")", ";", "$", "item", "=", "new", "Tenant_Resource", "(", ")", ";", "$", "item", "=", ...
Finds tenant resource with path @param string $path of the resource @return Tenant_Resource the resource
[ "Finds", "tenant", "resource", "with", "path" ]
a06359c52b9a257b5a0a186264e8770acfc54b73
https://github.com/pluf/tenant/blob/a06359c52b9a257b5a0a186264e8770acfc54b73/src/Tenant/Views/SpaRun.php#L139-L152
train
balintsera/evista-perform
src/Form/TranspiledForm.php
TranspiledForm.transpile
public function transpile() { // Form /** * @var Form form */ $this->form = $this->transpiler->instantiateFormObject(); // Fields $fields = $this->transpiler->findFields(); if (!is_array($fields)) { throw new \Exception("No fields found"); } ...
php
public function transpile() { // Form /** * @var Form form */ $this->form = $this->transpiler->instantiateFormObject(); // Fields $fields = $this->transpiler->findFields(); if (!is_array($fields)) { throw new \Exception("No fields found"); } ...
[ "public", "function", "transpile", "(", ")", "{", "// Form", "/**\n * @var Form form\n*/", "$", "this", "->", "form", "=", "$", "this", "->", "transpiler", "->", "instantiateFormObject", "(", ")", ";", "// Fields", "$", "fields", "=", "$", "this", "->", "tra...
Convert a markup to a BaseForm objet @return mixed
[ "Convert", "a", "markup", "to", "a", "BaseForm", "objet" ]
2b8723852ebe824ed721f30293e1e0d2c14f4b21
https://github.com/balintsera/evista-perform/blob/2b8723852ebe824ed721f30293e1e0d2c14f4b21/src/Form/TranspiledForm.php#L38-L62
train
larakit/lk-validatebuilder
src/ValidateBuilder.php
ValidateBuilder.ruleBefore
function ruleBefore($date, $error_message = null) { if (!strtotime($date)) { throw new \Exception('Incorrect date'); } return $this->_rule('before:' . $date, $error_message); }
php
function ruleBefore($date, $error_message = null) { if (!strtotime($date)) { throw new \Exception('Incorrect date'); } return $this->_rule('before:' . $date, $error_message); }
[ "function", "ruleBefore", "(", "$", "date", ",", "$", "error_message", "=", "null", ")", "{", "if", "(", "!", "strtotime", "(", "$", "date", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'Incorrect date'", ")", ";", "}", "return", "$", "thi...
The field under validation must be a value preceding the given date. The dates will be passed into the PHP strtotime function. @param $date @param null $error_message @return ValidateBuilder @throws \Exception
[ "The", "field", "under", "validation", "must", "be", "a", "value", "preceding", "the", "given", "date", ".", "The", "dates", "will", "be", "passed", "into", "the", "PHP", "strtotime", "function", "." ]
6cee7ccd3df570e9b043975859aad7ee501e5ab9
https://github.com/larakit/lk-validatebuilder/blob/6cee7ccd3df570e9b043975859aad7ee501e5ab9/src/ValidateBuilder.php#L409-L415
train
larakit/lk-validatebuilder
src/ValidateBuilder.php
ValidateBuilder.ruleBetween
function ruleBetween($min, $max, $error_message = null) { if (!is_numeric($min)) { throw new \Exception('Incorrect parameter MIN in rule between'); } if (!is_numeric($max)) { throw new \Exception('Incorrect parameter MAX in rule between'); } retur...
php
function ruleBetween($min, $max, $error_message = null) { if (!is_numeric($min)) { throw new \Exception('Incorrect parameter MIN in rule between'); } if (!is_numeric($max)) { throw new \Exception('Incorrect parameter MAX in rule between'); } retur...
[ "function", "ruleBetween", "(", "$", "min", ",", "$", "max", ",", "$", "error_message", "=", "null", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "min", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'Incorrect parameter MIN in rule between'"...
The field under validation must have a size between the given min and max. Strings, numerics, and files are evaluated in the same fashion as the size rule. @param int $min @param int $max @param null $error_message @return ValidateBuilder @throws \Exception
[ "The", "field", "under", "validation", "must", "have", "a", "size", "between", "the", "given", "min", "and", "max", ".", "Strings", "numerics", "and", "files", "are", "evaluated", "in", "the", "same", "fashion", "as", "the", "size", "rule", "." ]
6cee7ccd3df570e9b043975859aad7ee501e5ab9
https://github.com/larakit/lk-validatebuilder/blob/6cee7ccd3df570e9b043975859aad7ee501e5ab9/src/ValidateBuilder.php#L457-L466
train
larakit/lk-validatebuilder
src/ValidateBuilder.php
ValidateBuilder.ruleMin
function ruleMin($min, $error_message = null) { if (!is_numeric($min)) { throw new \Exception('Incorrect parameter MIN in rule min'); } return $this->_rule('min:' . $min, $error_message); }
php
function ruleMin($min, $error_message = null) { if (!is_numeric($min)) { throw new \Exception('Incorrect parameter MIN in rule min'); } return $this->_rule('min:' . $min, $error_message); }
[ "function", "ruleMin", "(", "$", "min", ",", "$", "error_message", "=", "null", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "min", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'Incorrect parameter MIN in rule min'", ")", ";", "}", "retur...
The field under validation must have a minimum value. Strings, numerics, and files are evaluated in the same fashion as the size rule. @param $min @param null $error_message @return ValidateBuilder @throws \Exception
[ "The", "field", "under", "validation", "must", "have", "a", "minimum", "value", ".", "Strings", "numerics", "and", "files", "are", "evaluated", "in", "the", "same", "fashion", "as", "the", "size", "rule", "." ]
6cee7ccd3df570e9b043975859aad7ee501e5ab9
https://github.com/larakit/lk-validatebuilder/blob/6cee7ccd3df570e9b043975859aad7ee501e5ab9/src/ValidateBuilder.php#L1075-L1081
train
larakit/lk-validatebuilder
src/ValidateBuilder.php
ValidateBuilder.ruleRequiredIf
function ruleRequiredIf($anotherfield, $value, $error_message = null) { return $this->_rule('required_if:' . $anotherfield . ',' . $value, $error_message); }
php
function ruleRequiredIf($anotherfield, $value, $error_message = null) { return $this->_rule('required_if:' . $anotherfield . ',' . $value, $error_message); }
[ "function", "ruleRequiredIf", "(", "$", "anotherfield", ",", "$", "value", ",", "$", "error_message", "=", "null", ")", "{", "return", "$", "this", "->", "_rule", "(", "'required_if:'", ".", "$", "anotherfield", ".", "','", ".", "$", "value", ",", "$", ...
The field under validation must be present if the anotherfield field is equal to any value. @param $anotherfield @param $value @param null $error_message @return ValidateBuilder @throws \Exception
[ "The", "field", "under", "validation", "must", "be", "present", "if", "the", "anotherfield", "field", "is", "equal", "to", "any", "value", "." ]
6cee7ccd3df570e9b043975859aad7ee501e5ab9
https://github.com/larakit/lk-validatebuilder/blob/6cee7ccd3df570e9b043975859aad7ee501e5ab9/src/ValidateBuilder.php#L1217-L1219
train
larakit/lk-validatebuilder
src/ValidateBuilder.php
ValidateBuilder.ruleRequiredUnless
function ruleRequiredUnless($anotherfield, $value, $error_message = null) { return $this->_rule('required_unless:' . $anotherfield . ',' . $value, $error_message); }
php
function ruleRequiredUnless($anotherfield, $value, $error_message = null) { return $this->_rule('required_unless:' . $anotherfield . ',' . $value, $error_message); }
[ "function", "ruleRequiredUnless", "(", "$", "anotherfield", ",", "$", "value", ",", "$", "error_message", "=", "null", ")", "{", "return", "$", "this", "->", "_rule", "(", "'required_unless:'", ".", "$", "anotherfield", ".", "','", ".", "$", "value", ",", ...
The field under validation must be present unless the anotherfield field is equal to any value. @param $anotherfield @param $value @param null $error_message @return ValidateBuilder @throws \Exception
[ "The", "field", "under", "validation", "must", "be", "present", "unless", "the", "anotherfield", "field", "is", "equal", "to", "any", "value", "." ]
6cee7ccd3df570e9b043975859aad7ee501e5ab9
https://github.com/larakit/lk-validatebuilder/blob/6cee7ccd3df570e9b043975859aad7ee501e5ab9/src/ValidateBuilder.php#L1241-L1243
train
larakit/lk-validatebuilder
src/ValidateBuilder.php
ValidateBuilder.ruleRequiredWith
function ruleRequiredWith($anotherfields, $error_message = null) { if (is_array($anotherfields)) { $anotherfields = implode(',', $anotherfields); } return $this->_rule('required_with:' . $anotherfields, $error_message); }
php
function ruleRequiredWith($anotherfields, $error_message = null) { if (is_array($anotherfields)) { $anotherfields = implode(',', $anotherfields); } return $this->_rule('required_with:' . $anotherfields, $error_message); }
[ "function", "ruleRequiredWith", "(", "$", "anotherfields", ",", "$", "error_message", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "anotherfields", ")", ")", "{", "$", "anotherfields", "=", "implode", "(", "','", ",", "$", "anotherfields", ")", ...
The field under validation must be present only if any of the other specified fields are present. @param $anotherfield @param $value @param null $error_message @return ValidateBuilder @throws \Exception
[ "The", "field", "under", "validation", "must", "be", "present", "only", "if", "any", "of", "the", "other", "specified", "fields", "are", "present", "." ]
6cee7ccd3df570e9b043975859aad7ee501e5ab9
https://github.com/larakit/lk-validatebuilder/blob/6cee7ccd3df570e9b043975859aad7ee501e5ab9/src/ValidateBuilder.php#L1265-L1271
train
larakit/lk-validatebuilder
src/ValidateBuilder.php
ValidateBuilder.ruleRequiredWithout
function ruleRequiredWithout($anotherfields, $error_message = null) { if (is_array($anotherfields)) { $anotherfields = implode(',', $anotherfields); } return $this->_rule('required_without:' . $anotherfields, $error_message); }
php
function ruleRequiredWithout($anotherfields, $error_message = null) { if (is_array($anotherfields)) { $anotherfields = implode(',', $anotherfields); } return $this->_rule('required_without:' . $anotherfields, $error_message); }
[ "function", "ruleRequiredWithout", "(", "$", "anotherfields", ",", "$", "error_message", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "anotherfields", ")", ")", "{", "$", "anotherfields", "=", "implode", "(", "','", ",", "$", "anotherfields", ")...
The field under validation must be present only when any of the other specified fields are not present. @param $anotherfields @param null $error_message @return ValidateBuilder @throws \Exception
[ "The", "field", "under", "validation", "must", "be", "present", "only", "when", "any", "of", "the", "other", "specified", "fields", "are", "not", "present", "." ]
6cee7ccd3df570e9b043975859aad7ee501e5ab9
https://github.com/larakit/lk-validatebuilder/blob/6cee7ccd3df570e9b043975859aad7ee501e5ab9/src/ValidateBuilder.php#L1315-L1321
train
larakit/lk-validatebuilder
src/ValidateBuilder.php
ValidateBuilder.ruleRequiredWithoutAll
function ruleRequiredWithoutAll($anotherfields, $error_message = null) { if (is_array($anotherfields)) { $anotherfields = implode(',', $anotherfields); } return $this->_rule('required_without_all:' . $anotherfields, $error_message); }
php
function ruleRequiredWithoutAll($anotherfields, $error_message = null) { if (is_array($anotherfields)) { $anotherfields = implode(',', $anotherfields); } return $this->_rule('required_without_all:' . $anotherfields, $error_message); }
[ "function", "ruleRequiredWithoutAll", "(", "$", "anotherfields", ",", "$", "error_message", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "anotherfields", ")", ")", "{", "$", "anotherfields", "=", "implode", "(", "','", ",", "$", "anotherfields", ...
The field under validation must be present only when all of the other specified fields are not present. @param $anotherfields @param null $error_message @return ValidateBuilder @throws \Exception
[ "The", "field", "under", "validation", "must", "be", "present", "only", "when", "all", "of", "the", "other", "specified", "fields", "are", "not", "present", "." ]
6cee7ccd3df570e9b043975859aad7ee501e5ab9
https://github.com/larakit/lk-validatebuilder/blob/6cee7ccd3df570e9b043975859aad7ee501e5ab9/src/ValidateBuilder.php#L1342-L1348
train
LartTyler/PHP-DaybreakCommons
src/DaybreakStudios/Common/DateTime/AbstractDateTimeAwareComparator.php
AbstractDateTimeAwareComparator.copyAndNormalize
protected function copyAndNormalize(/* ... $args */) { if ($this->utcTimezone === null) $this->utcTimezone = new DateTimeZone('UTC'); $args = func_get_args(); foreach ($args as $i => $dt) if ($dt instanceof DateTime) { $dt = clone $dt; $dt->setTimezone($this->utcTimezone); $args[$i] ...
php
protected function copyAndNormalize(/* ... $args */) { if ($this->utcTimezone === null) $this->utcTimezone = new DateTimeZone('UTC'); $args = func_get_args(); foreach ($args as $i => $dt) if ($dt instanceof DateTime) { $dt = clone $dt; $dt->setTimezone($this->utcTimezone); $args[$i] ...
[ "protected", "function", "copyAndNormalize", "(", "/* ... $args */", ")", "{", "if", "(", "$", "this", "->", "utcTimezone", "===", "null", ")", "$", "this", "->", "utcTimezone", "=", "new", "DateTimeZone", "(", "'UTC'", ")", ";", "$", "args", "=", "func_ge...
Copies any number of DateTime objects and normalizes their timezones. @param DateTime $args,... a varargs list of DateTime objects @return array an array containing the cloned and normalized DateTime objects
[ "Copies", "any", "number", "of", "DateTime", "objects", "and", "normalizes", "their", "timezones", "." ]
db25b5d6cea9b5a1d5afc4c5548a2cbc3018bc0d
https://github.com/LartTyler/PHP-DaybreakCommons/blob/db25b5d6cea9b5a1d5afc4c5548a2cbc3018bc0d/src/DaybreakStudios/Common/DateTime/AbstractDateTimeAwareComparator.php#L34-L51
train
AuronConsultingOSS/PhpConsoleLogger
src/Console.php
Console.log
public function log($level, $message, array $context = []) { // Do not allow users to supply nonsense on the log level if (array_key_exists($level, $this->logPrefixesPerLevel) === false) { throw new InvalidArgumentException('Console method not recognised'); } // Parse me...
php
public function log($level, $message, array $context = []) { // Do not allow users to supply nonsense on the log level if (array_key_exists($level, $this->logPrefixesPerLevel) === false) { throw new InvalidArgumentException('Console method not recognised'); } // Parse me...
[ "public", "function", "log", "(", "$", "level", ",", "$", "message", ",", "array", "$", "context", "=", "[", "]", ")", "{", "// Do not allow users to supply nonsense on the log level", "if", "(", "array_key_exists", "(", "$", "level", ",", "$", "this", "->", ...
Logs to an arbitrary log level. We only recognise info/notice/debug/warning/alert/error/emergency/critical levels, anything else will throw an InvalidArgumentException. Please provide log level via Psr\Log\LogLevel constants to ensure goodness. Message must be a string-able value. Context is optional and can contain...
[ "Logs", "to", "an", "arbitrary", "log", "level", "." ]
312fae19b9cf8dfa3237f9ca24d18b8da85043ef
https://github.com/AuronConsultingOSS/PhpConsoleLogger/blob/312fae19b9cf8dfa3237f9ca24d18b8da85043ef/src/Console.php#L63-L78
train
AuronConsultingOSS/PhpConsoleLogger
src/Console.php
Console.parseMessage
private function parseMessage($message) { $parsedMessage = null; /** * According to PSR-3 we can accept string-like values (eg stuff we can parse easily into a string, such as obviously * strings and numbers, and objects that can be cast to strings). */ switch (ge...
php
private function parseMessage($message) { $parsedMessage = null; /** * According to PSR-3 we can accept string-like values (eg stuff we can parse easily into a string, such as obviously * strings and numbers, and objects that can be cast to strings). */ switch (ge...
[ "private", "function", "parseMessage", "(", "$", "message", ")", "{", "$", "parsedMessage", "=", "null", ";", "/**\n * According to PSR-3 we can accept string-like values (eg stuff we can parse easily into a string, such as obviously\n * strings and numbers, and objects tha...
Parses the log message and returns as a useable string, or Psr\Log\InvalidArgumentException if non parseable. We only recognise info/notice/debug/warning/alert/error/emergency/critical levels, anything else will throw an InvalidArgumentException. @param mixed $message @return string @throws InvalidArgumentException...
[ "Parses", "the", "log", "message", "and", "returns", "as", "a", "useable", "string", "or", "Psr", "\\", "Log", "\\", "InvalidArgumentException", "if", "non", "parseable", "." ]
312fae19b9cf8dfa3237f9ca24d18b8da85043ef
https://github.com/AuronConsultingOSS/PhpConsoleLogger/blob/312fae19b9cf8dfa3237f9ca24d18b8da85043ef/src/Console.php#L94-L123
train
cubicmushroom/routing-annotations
src/Parser/DocumentationAnnotationParser.php
DocumentationAnnotationParser.parse
public function parse(array $classes) { $APIAnnotations = []; foreach ($classes as $class) { $reflectionClass = new \ReflectionClass($class); foreach ($reflectionClass->getMethods() as $reflectionMethod) { $annotations = $this->getReader()->getMethodAnnotatio...
php
public function parse(array $classes) { $APIAnnotations = []; foreach ($classes as $class) { $reflectionClass = new \ReflectionClass($class); foreach ($reflectionClass->getMethods() as $reflectionMethod) { $annotations = $this->getReader()->getMethodAnnotatio...
[ "public", "function", "parse", "(", "array", "$", "classes", ")", "{", "$", "APIAnnotations", "=", "[", "]", ";", "foreach", "(", "$", "classes", "as", "$", "class", ")", "{", "$", "reflectionClass", "=", "new", "\\", "ReflectionClass", "(", "$", "clas...
Parses the files provided by the SeekableIterator @param array $classes Array of classes to parse @return array
[ "Parses", "the", "files", "provided", "by", "the", "SeekableIterator" ]
e8ea0b8c55b7d4ca42baeca64302e8d8ae573408
https://github.com/cubicmushroom/routing-annotations/blob/e8ea0b8c55b7d4ca42baeca64302e8d8ae573408/src/Parser/DocumentationAnnotationParser.php#L60-L94
train
fridge-project/dbal
src/Fridge/DBAL/Query/Rewriter/AbstractQueryRewriter.php
AbstractQueryRewriter.extractType
protected static function extractType($type) { if (substr($type, -2) === Connection::PARAM_ARRAY) { return substr($type, 0, strlen($type) - 2); } return false; }
php
protected static function extractType($type) { if (substr($type, -2) === Connection::PARAM_ARRAY) { return substr($type, 0, strlen($type) - 2); } return false; }
[ "protected", "static", "function", "extractType", "(", "$", "type", ")", "{", "if", "(", "substr", "(", "$", "type", ",", "-", "2", ")", "===", "Connection", "::", "PARAM_ARRAY", ")", "{", "return", "substr", "(", "$", "type", ",", "0", ",", "strlen"...
Extracts the fridge type from the expanded type. @param string $type The type. @return string|boolean The fridge type or false if the type is not an expanded one.
[ "Extracts", "the", "fridge", "type", "from", "the", "expanded", "type", "." ]
d0b8c3551922d696836487aa0eb1bd74014edcd4
https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Query/Rewriter/AbstractQueryRewriter.php#L30-L37
train
sourceboxio/sdk
src/Register/Register.php
Register.autoload
public static function autoload() { // Vendor path $dir_base = realpath(__DIR__ . '/../../../../'); $finder = new Finder(); $finder->files() ->ignoreVCS(true) ->ignoreDotFiles(false) ->name('service.yml') ->exclude('Tests') ...
php
public static function autoload() { // Vendor path $dir_base = realpath(__DIR__ . '/../../../../'); $finder = new Finder(); $finder->files() ->ignoreVCS(true) ->ignoreDotFiles(false) ->name('service.yml') ->exclude('Tests') ...
[ "public", "static", "function", "autoload", "(", ")", "{", "// Vendor path", "$", "dir_base", "=", "realpath", "(", "__DIR__", ".", "'/../../../../'", ")", ";", "$", "finder", "=", "new", "Finder", "(", ")", ";", "$", "finder", "->", "files", "(", ")", ...
Auto register services. @return void
[ "Auto", "register", "services", "." ]
e16e9e92580d48c2a348d119c2829a8d38528681
https://github.com/sourceboxio/sdk/blob/e16e9e92580d48c2a348d119c2829a8d38528681/src/Register/Register.php#L42-L59
train
sourceboxio/sdk
src/Register/Register.php
Register.autoloadFile
protected static function autoloadFile(SplFileInfo $file) { $yml = Yaml::parse(file_get_contents($file->getRealPath()), true); $service = Arr::get($yml, 'micro-service'); if (is_null($service)) { return; } sbox()->add(new MicroService($service, $yml)); }
php
protected static function autoloadFile(SplFileInfo $file) { $yml = Yaml::parse(file_get_contents($file->getRealPath()), true); $service = Arr::get($yml, 'micro-service'); if (is_null($service)) { return; } sbox()->add(new MicroService($service, $yml)); }
[ "protected", "static", "function", "autoloadFile", "(", "SplFileInfo", "$", "file", ")", "{", "$", "yml", "=", "Yaml", "::", "parse", "(", "file_get_contents", "(", "$", "file", "->", "getRealPath", "(", ")", ")", ",", "true", ")", ";", "$", "service", ...
Carregar arquivo. @param SplFileInfo $file @return void
[ "Carregar", "arquivo", "." ]
e16e9e92580d48c2a348d119c2829a8d38528681
https://github.com/sourceboxio/sdk/blob/e16e9e92580d48c2a348d119c2829a8d38528681/src/Register/Register.php#L66-L76
train