id int32 0 241k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
196,000 | native5/native5-sdk-client-php | src/Native5/Route/DeviceDetection/DeviceManager.php | DeviceManager._lookupDB | private function _lookupDB($ua)
{
$browser = new Browser();
$browser->setGrade(Grades::UNSUPPORTED);
$conn = new \Mongo('mongodb://'.DeviceManager::HOST);
$collection = $conn->selectDB(DeviceManager::DB)->devices;
// Determine Regex fitting the U/A Category.
$patte... | php | private function _lookupDB($ua)
{
$browser = new Browser();
$browser->setGrade(Grades::UNSUPPORTED);
$conn = new \Mongo('mongodb://'.DeviceManager::HOST);
$collection = $conn->selectDB(DeviceManager::DB)->devices;
// Determine Regex fitting the U/A Category.
$patte... | [
"private",
"function",
"_lookupDB",
"(",
"$",
"ua",
")",
"{",
"$",
"browser",
"=",
"new",
"Browser",
"(",
")",
";",
"$",
"browser",
"->",
"setGrade",
"(",
"Grades",
"::",
"UNSUPPORTED",
")",
";",
"$",
"conn",
"=",
"new",
"\\",
"Mongo",
"(",
"'mongodb... | Finds closest match given the user agent
@param mixed $ua : User Agent Object parsed using UA
@access private
@return void | [
"Finds",
"closest",
"match",
"given",
"the",
"user",
"agent"
] | e1f598cf27654d81bb5facace1990b737242a2f9 | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Route/DeviceDetection/DeviceManager.php#L139-L171 |
196,001 | OliverMonneke/pennePHP | src/Datatype/Number.php | Number.random | public static function random($min, $max = null)
{
if (String::isEmpty($max) ||
$max > getrandmax()) {
$max = getrandmax();
}
return rand($min, $max);
} | php | public static function random($min, $max = null)
{
if (String::isEmpty($max) ||
$max > getrandmax()) {
$max = getrandmax();
}
return rand($min, $max);
} | [
"public",
"static",
"function",
"random",
"(",
"$",
"min",
",",
"$",
"max",
"=",
"null",
")",
"{",
"if",
"(",
"String",
"::",
"isEmpty",
"(",
"$",
"max",
")",
"||",
"$",
"max",
">",
"getrandmax",
"(",
")",
")",
"{",
"$",
"max",
"=",
"getrandmax",... | Generate random number
@param int $min Minimum value
@param int $max Maximum value
@return int | [
"Generate",
"random",
"number"
] | dd0de7944685a3f1947157e1254fc54b55ff9942 | https://github.com/OliverMonneke/pennePHP/blob/dd0de7944685a3f1947157e1254fc54b55ff9942/src/Datatype/Number.php#L210-L218 |
196,002 | lasallecms/lasallecms-l5-lasallecmsapi-pkg | src/Repositories/Traits/PostUpdates.php | PostUpdates.postIdOfPostupdate | public function postIdOfPostupdate($id)
{
// $record is a stdClass
$record = DB::table('postupdates')
->select('post_id')
->where('id', '=', $id)
->first()
;
return $record->post_id;
} | php | public function postIdOfPostupdate($id)
{
// $record is a stdClass
$record = DB::table('postupdates')
->select('post_id')
->where('id', '=', $id)
->first()
;
return $record->post_id;
} | [
"public",
"function",
"postIdOfPostupdate",
"(",
"$",
"id",
")",
"{",
"// $record is a stdClass",
"$",
"record",
"=",
"DB",
"::",
"table",
"(",
"'postupdates'",
")",
"->",
"select",
"(",
"'post_id'",
")",
"->",
"where",
"(",
"'id'",
",",
"'='",
",",
"$",
... | What is the post_id of a given postupdate?
@param int $id The ID of a postupdate
@return mixed | [
"What",
"is",
"the",
"post_id",
"of",
"a",
"given",
"postupdate?"
] | 05083be19645d52be86d8ba4f322773db348a11d | https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/PostUpdates.php#L71-L81 |
196,003 | lasallecms/lasallecms-l5-lasallecmsapi-pkg | src/Repositories/Traits/PostUpdates.php | PostUpdates.postupdateNotExist | public function postupdateNotExist($post_id)
{
if ($this->countPostUpdates($post_id) == 0)
{
DB::table('posts')
->where('id', '=', $post_id)
->update(['postupdate' => 0])
;
}
} | php | public function postupdateNotExist($post_id)
{
if ($this->countPostUpdates($post_id) == 0)
{
DB::table('posts')
->where('id', '=', $post_id)
->update(['postupdate' => 0])
;
}
} | [
"public",
"function",
"postupdateNotExist",
"(",
"$",
"post_id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"countPostUpdates",
"(",
"$",
"post_id",
")",
"==",
"0",
")",
"{",
"DB",
"::",
"table",
"(",
"'posts'",
")",
"->",
"where",
"(",
"'id'",
",",
"'=... | When a post update is deleted, and no more post updates exist for that post, then update the
POSTS table to indicate that no post updates for that post exist.
@param int $post_id The ID of the post that the post update pertains.
@return void | [
"When",
"a",
"post",
"update",
"is",
"deleted",
"and",
"no",
"more",
"post",
"updates",
"exist",
"for",
"that",
"post",
"then",
"update",
"the",
"POSTS",
"table",
"to",
"indicate",
"that",
"no",
"post",
"updates",
"for",
"that",
"post",
"exist",
"."
] | 05083be19645d52be86d8ba4f322773db348a11d | https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/PostUpdates.php#L91-L100 |
196,004 | dmitrya2e/filtration-bundle | Filter/Filter/AbstractFilter.php | AbstractFilter.hasAppliedValue | public function hasAppliedValue()
{
$customFunction = $this->getHasAppliedValueFunction();
if (is_callable($customFunction)) {
$result = call_user_func($customFunction, $this);
if (!is_bool($result)) {
throw new FilterException('Returned value from c... | php | public function hasAppliedValue()
{
$customFunction = $this->getHasAppliedValueFunction();
if (is_callable($customFunction)) {
$result = call_user_func($customFunction, $this);
if (!is_bool($result)) {
throw new FilterException('Returned value from c... | [
"public",
"function",
"hasAppliedValue",
"(",
")",
"{",
"$",
"customFunction",
"=",
"$",
"this",
"->",
"getHasAppliedValueFunction",
"(",
")",
";",
"if",
"(",
"is_callable",
"(",
"$",
"customFunction",
")",
")",
"{",
"$",
"result",
"=",
"call_user_func",
"("... | Checks if the filter value was applied.
Note, that the converted value is used for checking.
If there is a custom function for checking if the filter value is applied,
it will be executed instead of default checking.
Note, that custom function must return boolean result of checking if the filter value has been applied... | [
"Checks",
"if",
"the",
"filter",
"value",
"was",
"applied",
".",
"Note",
"that",
"the",
"converted",
"value",
"is",
"used",
"for",
"checking",
"."
] | fed5764af4e43871835744fb84957b2a76e9a215 | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Filter/Filter/AbstractFilter.php#L358-L386 |
196,005 | dmitrya2e/filtration-bundle | Filter/Filter/AbstractFilter.php | AbstractFilter.setApplyFilterFunction | public function setApplyFilterFunction(callable $function)
{
$validator = $this->getCallableValidatorApplyFilters();
$validator->setCallableFunction($function);
if ($validator->isValid() === false) {
throw $validator->getException();
}
$this->applyFilte... | php | public function setApplyFilterFunction(callable $function)
{
$validator = $this->getCallableValidatorApplyFilters();
$validator->setCallableFunction($function);
if ($validator->isValid() === false) {
throw $validator->getException();
}
$this->applyFilte... | [
"public",
"function",
"setApplyFilterFunction",
"(",
"callable",
"$",
"function",
")",
"{",
"$",
"validator",
"=",
"$",
"this",
"->",
"getCallableValidatorApplyFilters",
"(",
")",
";",
"$",
"validator",
"->",
"setCallableFunction",
"(",
"$",
"function",
")",
";"... | Sets custom "apply filter" function.
@param callable $function
@see ApplyFiltersFunctionValidator
@return static
@throws CallableFunctionValidatorException On invalid callable arguments | [
"Sets",
"custom",
"apply",
"filter",
"function",
"."
] | fed5764af4e43871835744fb84957b2a76e9a215 | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Filter/Filter/AbstractFilter.php#L556-L568 |
196,006 | dmitrya2e/filtration-bundle | Filter/Filter/AbstractFilter.php | AbstractFilter.setAppendFormFieldsFunction | public function setAppendFormFieldsFunction(callable $function)
{
$validator = $this->getCallableValidatorAppendFormFields();
$validator->setCallableFunction($function);
if ($validator->isValid() === false) {
throw $validator->getException();
}
$this->a... | php | public function setAppendFormFieldsFunction(callable $function)
{
$validator = $this->getCallableValidatorAppendFormFields();
$validator->setCallableFunction($function);
if ($validator->isValid() === false) {
throw $validator->getException();
}
$this->a... | [
"public",
"function",
"setAppendFormFieldsFunction",
"(",
"callable",
"$",
"function",
")",
"{",
"$",
"validator",
"=",
"$",
"this",
"->",
"getCallableValidatorAppendFormFields",
"(",
")",
";",
"$",
"validator",
"->",
"setCallableFunction",
"(",
"$",
"function",
"... | Sets custom "append form fields" function.
@param callable $function
@see AppendFormFieldsFunctionValidator
@return static
@throws CallableFunctionValidatorException On invalid callable arguments | [
"Sets",
"custom",
"append",
"form",
"fields",
"function",
"."
] | fed5764af4e43871835744fb84957b2a76e9a215 | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Filter/Filter/AbstractFilter.php#L590-L602 |
196,007 | dmitrya2e/filtration-bundle | Filter/Filter/AbstractFilter.php | AbstractFilter.setConvertValueFunction | public function setConvertValueFunction(callable $function)
{
$validator = $this->getCallableValidatorConvertValue();
$validator->setCallableFunction($function);
if ($validator->isValid() === false) {
throw $validator->getException();
}
$this->convertVa... | php | public function setConvertValueFunction(callable $function)
{
$validator = $this->getCallableValidatorConvertValue();
$validator->setCallableFunction($function);
if ($validator->isValid() === false) {
throw $validator->getException();
}
$this->convertVa... | [
"public",
"function",
"setConvertValueFunction",
"(",
"callable",
"$",
"function",
")",
"{",
"$",
"validator",
"=",
"$",
"this",
"->",
"getCallableValidatorConvertValue",
"(",
")",
";",
"$",
"validator",
"->",
"setCallableFunction",
"(",
"$",
"function",
")",
";... | Sets custom "convert value" function.
@param callable $function
@see ConvertValueFunctionValidator
@return static
@throws CallableFunctionValidatorException On invalid callable arguments | [
"Sets",
"custom",
"convert",
"value",
"function",
"."
] | fed5764af4e43871835744fb84957b2a76e9a215 | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Filter/Filter/AbstractFilter.php#L624-L636 |
196,008 | dmitrya2e/filtration-bundle | Filter/Filter/AbstractFilter.php | AbstractFilter.setValuePropertyName | public function setValuePropertyName($valuePropertyName)
{
if (!is_string($valuePropertyName) || $valuePropertyName === '') {
throw new InvalidArgumentException('"Value property name" argument must be a string and must not empty.');
}
if (!property_exists($this, $valueProp... | php | public function setValuePropertyName($valuePropertyName)
{
if (!is_string($valuePropertyName) || $valuePropertyName === '') {
throw new InvalidArgumentException('"Value property name" argument must be a string and must not empty.');
}
if (!property_exists($this, $valueProp... | [
"public",
"function",
"setValuePropertyName",
"(",
"$",
"valuePropertyName",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"valuePropertyName",
")",
"||",
"$",
"valuePropertyName",
"===",
"''",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'\"Va... | Sets the name of the property which contains the raw value.
@param string $valuePropertyName
@return static
@throws InvalidArgumentException On invalid argument | [
"Sets",
"the",
"name",
"of",
"the",
"property",
"which",
"contains",
"the",
"raw",
"value",
"."
] | fed5764af4e43871835744fb84957b2a76e9a215 | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Filter/Filter/AbstractFilter.php#L734-L747 |
196,009 | dmitrya2e/filtration-bundle | Filter/Filter/AbstractFilter.php | AbstractFilter.setFormFieldType | public function setFormFieldType($formFieldType)
{
if (!is_string($formFieldType) || $formFieldType === '') {
throw new InvalidArgumentException('"Form field type" argument must be a string and must not empty.');
}
$this->formFieldType = $formFieldType;
return $... | php | public function setFormFieldType($formFieldType)
{
if (!is_string($formFieldType) || $formFieldType === '') {
throw new InvalidArgumentException('"Form field type" argument must be a string and must not empty.');
}
$this->formFieldType = $formFieldType;
return $... | [
"public",
"function",
"setFormFieldType",
"(",
"$",
"formFieldType",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"formFieldType",
")",
"||",
"$",
"formFieldType",
"===",
"''",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'\"Form field type\" ... | Sets form field type.
@param string $formFieldType
@return static
@throws InvalidArgumentException On invalid argument | [
"Sets",
"form",
"field",
"type",
"."
] | fed5764af4e43871835744fb84957b2a76e9a215 | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Filter/Filter/AbstractFilter.php#L777-L786 |
196,010 | itkg/core | src/Itkg/Core/Response/Processor/CompressProcessor.php | CompressProcessor.process | public function process(Response $response)
{
$content = preg_replace('/<!\-\-.[^(\-\-\>)]*?\-\->/i', '', $response->getContent());
$content = str_replace("\t", " ", $content);
$content = preg_replace('/(\s)\/\/(.*)(\s)/', '\\1/* \\2 */\\3', $content);
$search = array(
'... | php | public function process(Response $response)
{
$content = preg_replace('/<!\-\-.[^(\-\-\>)]*?\-\->/i', '', $response->getContent());
$content = str_replace("\t", " ", $content);
$content = preg_replace('/(\s)\/\/(.*)(\s)/', '\\1/* \\2 */\\3', $content);
$search = array(
'... | [
"public",
"function",
"process",
"(",
"Response",
"$",
"response",
")",
"{",
"$",
"content",
"=",
"preg_replace",
"(",
"'/<!\\-\\-.[^(\\-\\-\\>)]*?\\-\\->/i'",
",",
"''",
",",
"$",
"response",
"->",
"getContent",
"(",
")",
")",
";",
"$",
"content",
"=",
"str... | Drop comments & compress response content
@param Response $response | [
"Drop",
"comments",
"&",
"compress",
"response",
"content"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Response/Processor/CompressProcessor.php#L25-L44 |
196,011 | rollerworks/search-doctrine-orm | DqlConditionGenerator.php | DqlConditionGenerator.getQueryHintValue | public function getQueryHintValue(): SqlConversionInfo
{
if (null === $this->whereClause) {
throw new BadMethodCallException(
'Unable to get query-hint value for ConditionGenerator. Call getWhereClause() before calling this method.'
);
}
return new Sq... | php | public function getQueryHintValue(): SqlConversionInfo
{
if (null === $this->whereClause) {
throw new BadMethodCallException(
'Unable to get query-hint value for ConditionGenerator. Call getWhereClause() before calling this method.'
);
}
return new Sq... | [
"public",
"function",
"getQueryHintValue",
"(",
")",
":",
"SqlConversionInfo",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"whereClause",
")",
"{",
"throw",
"new",
"BadMethodCallException",
"(",
"'Unable to get query-hint value for ConditionGenerator. Call getWhereC... | Returns the Query-hint value for the query object.
The Query hint is used for conversions. | [
"Returns",
"the",
"Query",
"-",
"hint",
"value",
"for",
"the",
"query",
"object",
"."
] | d4d7e9cfc6591d34e9d00f084c35f109f971ac4f | https://github.com/rollerworks/search-doctrine-orm/blob/d4d7e9cfc6591d34e9d00f084c35f109f971ac4f/DqlConditionGenerator.php#L144-L153 |
196,012 | SahilDude89ss/PyntaxFramework-Config | src/Pyntax/Config/ConfigAbstract.php | ConfigAbstract.read | public static function read($key = false)
{
if(is_array($key) && !empty($key)) {
$_value_to_be_returned = self::$_config;
foreach(array_values($key) as $key => $_val) {
$_value_to_be_returned = $_value_to_be_returned[$_val];
}
return $_value_t... | php | public static function read($key = false)
{
if(is_array($key) && !empty($key)) {
$_value_to_be_returned = self::$_config;
foreach(array_values($key) as $key => $_val) {
$_value_to_be_returned = $_value_to_be_returned[$_val];
}
return $_value_t... | [
"public",
"static",
"function",
"read",
"(",
"$",
"key",
"=",
"false",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"key",
")",
"&&",
"!",
"empty",
"(",
"$",
"key",
")",
")",
"{",
"$",
"_value_to_be_returned",
"=",
"self",
"::",
"$",
"_config",
";",
... | This function returns the value of the key in the config.
@param bool|false $key
@return mixed | [
"This",
"function",
"returns",
"the",
"value",
"of",
"the",
"key",
"in",
"the",
"config",
"."
] | 4d7d336d2f83c4141583765fcc42a16002f5345e | https://github.com/SahilDude89ss/PyntaxFramework-Config/blob/4d7d336d2f83c4141583765fcc42a16002f5345e/src/Pyntax/Config/ConfigAbstract.php#L60-L72 |
196,013 | SahilDude89ss/PyntaxFramework-Config | src/Pyntax/Config/ConfigAbstract.php | ConfigAbstract.loadConfigFiles | public static function loadConfigFiles($configPath = false)
{
if(!is_dir($configPath)) {
throw new \Exception("Config directory {$configPath} not found!");
}
$filesToBeLoaded = scandir($configPath);
foreach($filesToBeLoaded as $_file) {
if(preg_match('/.*\.ph... | php | public static function loadConfigFiles($configPath = false)
{
if(!is_dir($configPath)) {
throw new \Exception("Config directory {$configPath} not found!");
}
$filesToBeLoaded = scandir($configPath);
foreach($filesToBeLoaded as $_file) {
if(preg_match('/.*\.ph... | [
"public",
"static",
"function",
"loadConfigFiles",
"(",
"$",
"configPath",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"configPath",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Config directory {$configPath} not found!\"",
")",
";... | This function is loads all the files in a particular folder, this is meant to the config folder.
@param bool|false $configPath
@return bool
@throws \Exception | [
"This",
"function",
"is",
"loads",
"all",
"the",
"files",
"in",
"a",
"particular",
"folder",
"this",
"is",
"meant",
"to",
"the",
"config",
"folder",
"."
] | 4d7d336d2f83c4141583765fcc42a16002f5345e | https://github.com/SahilDude89ss/PyntaxFramework-Config/blob/4d7d336d2f83c4141583765fcc42a16002f5345e/src/Pyntax/Config/ConfigAbstract.php#L93-L107 |
196,014 | agentmedia/phine-builtin | src/BuiltIn/Modules/Backend/HtmlCodeForm.php | HtmlCodeForm.InitForm | protected function InitForm()
{
$this->htmlCode = $this->LoadElement();
$name = 'Code';
$this->AddField(new Textarea($name, $this->htmlCode->GetCode()));
$this->SetRequired($name);
$this->AddCssClassField();
$this->AddCssIDField();
$this->AddSubmit();
} | php | protected function InitForm()
{
$this->htmlCode = $this->LoadElement();
$name = 'Code';
$this->AddField(new Textarea($name, $this->htmlCode->GetCode()));
$this->SetRequired($name);
$this->AddCssClassField();
$this->AddCssIDField();
$this->AddSubmit();
} | [
"protected",
"function",
"InitForm",
"(",
")",
"{",
"$",
"this",
"->",
"htmlCode",
"=",
"$",
"this",
"->",
"LoadElement",
"(",
")",
";",
"$",
"name",
"=",
"'Code'",
";",
"$",
"this",
"->",
"AddField",
"(",
"new",
"Textarea",
"(",
"$",
"name",
",",
... | Initializes the html code content form | [
"Initializes",
"the",
"html",
"code",
"content",
"form"
] | 4dd05bc406a71e997bd4eaa16b12e23dbe62a456 | https://github.com/agentmedia/phine-builtin/blob/4dd05bc406a71e997bd4eaa16b12e23dbe62a456/src/BuiltIn/Modules/Backend/HtmlCodeForm.php#L38-L47 |
196,015 | eureka-framework/component-orm | src/Orm/Config/Config.php | Config.init | public function init($config, $global)
{
//~ Comment
$this->author = $global['comment']['author'];
$this->version = $global['comment']['version'];
//~ Class
$this->classname = $config['class']['classname'];
$this->namespace = $config['class']['namespace'];
... | php | public function init($config, $global)
{
//~ Comment
$this->author = $global['comment']['author'];
$this->version = $global['comment']['version'];
//~ Class
$this->classname = $config['class']['classname'];
$this->namespace = $config['class']['namespace'];
... | [
"public",
"function",
"init",
"(",
"$",
"config",
",",
"$",
"global",
")",
"{",
"//~ Comment",
"$",
"this",
"->",
"author",
"=",
"$",
"global",
"[",
"'comment'",
"]",
"[",
"'author'",
"]",
";",
"$",
"this",
"->",
"version",
"=",
"$",
"global",
"[",
... | Initialize config.
@param array $config
@param array $global
@return self | [
"Initialize",
"config",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Config/Config.php#L26-L48 |
196,016 | kreta/SimpleApiDocBundle | src/Kreta/SimpleApiDocBundle/Parser/ValidationParser.php | ValidationParser.getValidations | public function getValidations($class = null)
{
$reflectionClass = $class ? new \ReflectionClass($class) : false;
if ($reflectionClass === false) {
return [];
}
$result = $this->buildValidation($class);
$validations = [];
foreach ($result as $keyElement =>... | php | public function getValidations($class = null)
{
$reflectionClass = $class ? new \ReflectionClass($class) : false;
if ($reflectionClass === false) {
return [];
}
$result = $this->buildValidation($class);
$validations = [];
foreach ($result as $keyElement =>... | [
"public",
"function",
"getValidations",
"(",
"$",
"class",
"=",
"null",
")",
"{",
"$",
"reflectionClass",
"=",
"$",
"class",
"?",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"class",
")",
":",
"false",
";",
"if",
"(",
"$",
"reflectionClass",
"===",
"false"... | Gets the validations.
@param string|null $class The class namespace
@return array | [
"Gets",
"the",
"validations",
"."
] | 786aa9310cdf087253f65f68165a0a0c8ad5c816 | https://github.com/kreta/SimpleApiDocBundle/blob/786aa9310cdf087253f65f68165a0a0c8ad5c816/src/Kreta/SimpleApiDocBundle/Parser/ValidationParser.php#L55-L80 |
196,017 | kreta/SimpleApiDocBundle | src/Kreta/SimpleApiDocBundle/Parser/ValidationParser.php | ValidationParser.buildValidation | protected function buildValidation($class = null)
{
$validations = [];
$metadata = $this->validator->getMetadataFor($class);
$entityConstraints = [];
foreach ($metadata->getConstraints() as $constraint) {
$class = new \ReflectionClass($constraint);
$fields = $... | php | protected function buildValidation($class = null)
{
$validations = [];
$metadata = $this->validator->getMetadataFor($class);
$entityConstraints = [];
foreach ($metadata->getConstraints() as $constraint) {
$class = new \ReflectionClass($constraint);
$fields = $... | [
"protected",
"function",
"buildValidation",
"(",
"$",
"class",
"=",
"null",
")",
"{",
"$",
"validations",
"=",
"[",
"]",
";",
"$",
"metadata",
"=",
"$",
"this",
"->",
"validator",
"->",
"getMetadataFor",
"(",
"$",
"class",
")",
";",
"$",
"entityConstrain... | Parses and builds the validation.
@param string|null $class The class namespace
@return array | [
"Parses",
"and",
"builds",
"the",
"validation",
"."
] | 786aa9310cdf087253f65f68165a0a0c8ad5c816 | https://github.com/kreta/SimpleApiDocBundle/blob/786aa9310cdf087253f65f68165a0a0c8ad5c816/src/Kreta/SimpleApiDocBundle/Parser/ValidationParser.php#L89-L129 |
196,018 | kreta/SimpleApiDocBundle | src/Kreta/SimpleApiDocBundle/Parser/ValidationParser.php | ValidationParser.constraintMessages | protected function constraintMessages(Constraint $constraint)
{
$result = [];
if (isset($constraint->min) && $constraint->min !== null) {
$count = new Count(['min' => $constraint->min]);
$length = new Length(['min' => $constraint->min]);
$result[] = $constraint->m... | php | protected function constraintMessages(Constraint $constraint)
{
$result = [];
if (isset($constraint->min) && $constraint->min !== null) {
$count = new Count(['min' => $constraint->min]);
$length = new Length(['min' => $constraint->min]);
$result[] = $constraint->m... | [
"protected",
"function",
"constraintMessages",
"(",
"Constraint",
"$",
"constraint",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"constraint",
"->",
"min",
")",
"&&",
"$",
"constraint",
"->",
"min",
"!==",
"null",
")",
"{... | Parses the constraint message.
@param \Symfony\Component\Validator\Constraint $constraint The constraint
@return array | [
"Parses",
"the",
"constraint",
"message",
"."
] | 786aa9310cdf087253f65f68165a0a0c8ad5c816 | https://github.com/kreta/SimpleApiDocBundle/blob/786aa9310cdf087253f65f68165a0a0c8ad5c816/src/Kreta/SimpleApiDocBundle/Parser/ValidationParser.php#L138-L159 |
196,019 | gplcart/cli | controllers/commands/CollectionItem.php | CollectionItem.cmdGetCollectionItem | public function cmdGetCollectionItem()
{
$result = $this->getListCollectionItem();
$this->outputFormat($result);
$this->outputFormatTableCollectionItem($result);
$this->output();
} | php | public function cmdGetCollectionItem()
{
$result = $this->getListCollectionItem();
$this->outputFormat($result);
$this->outputFormatTableCollectionItem($result);
$this->output();
} | [
"public",
"function",
"cmdGetCollectionItem",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getListCollectionItem",
"(",
")",
";",
"$",
"this",
"->",
"outputFormat",
"(",
"$",
"result",
")",
";",
"$",
"this",
"->",
"outputFormatTableCollectionItem",
... | Callback for "collection-item-get" command | [
"Callback",
"for",
"collection",
"-",
"item",
"-",
"get",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/CollectionItem.php#L40-L46 |
196,020 | gplcart/cli | controllers/commands/CollectionItem.php | CollectionItem.cmdDeleteCollectionItem | public function cmdDeleteCollectionItem()
{
$id = $this->getParam(0);
if (empty($id) || !is_numeric($id)) {
$this->errorAndExit($this->text('Invalid command'));
}
$condition = $id;
if ($this->getParam('collection')) {
$condition = array('collection_i... | php | public function cmdDeleteCollectionItem()
{
$id = $this->getParam(0);
if (empty($id) || !is_numeric($id)) {
$this->errorAndExit($this->text('Invalid command'));
}
$condition = $id;
if ($this->getParam('collection')) {
$condition = array('collection_i... | [
"public",
"function",
"cmdDeleteCollectionItem",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"id",
")",
"||",
"!",
"is_numeric",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",... | Callback for "collection-item-delete" command | [
"Callback",
"for",
"collection",
"-",
"item",
"-",
"delete",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/CollectionItem.php#L51-L71 |
196,021 | gplcart/cli | controllers/commands/CollectionItem.php | CollectionItem.cmdUpdateCollectionItem | public function cmdUpdateCollectionItem()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!is_numeric($params[0])) {
$this->errorAndExit($this->text('Invalid argument'))... | php | public function cmdUpdateCollectionItem()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!is_numeric($params[0])) {
$this->errorAndExit($this->text('Invalid argument'))... | [
"public",
"function",
"cmdUpdateCollectionItem",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getParam",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"params",
"[",
"0",
"]",
")",
"||",
"count",
"(",
"$",
"params",
")",
"<",
"2",
")",
"... | Callback for "collection-item-update" command | [
"Callback",
"for",
"collection",
"-",
"item",
"-",
"update",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/CollectionItem.php#L90-L108 |
196,022 | gplcart/cli | controllers/commands/CollectionItem.php | CollectionItem.addCollectionItem | protected function addCollectionItem()
{
if (!$this->isError()) {
$id = $this->collection_item->add($this->getSubmitted());
if (empty($id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($id);
}
} | php | protected function addCollectionItem()
{
if (!$this->isError()) {
$id = $this->collection_item->add($this->getSubmitted());
if (empty($id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($id);
}
} | [
"protected",
"function",
"addCollectionItem",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isError",
"(",
")",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"collection_item",
"->",
"add",
"(",
"$",
"this",
"->",
"getSubmitted",
"(",
")",
")",
... | Add a new collection item | [
"Add",
"a",
"new",
"collection",
"item"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/CollectionItem.php#L171-L180 |
196,023 | gplcart/cli | controllers/commands/CollectionItem.php | CollectionItem.updateCollectionItem | protected function updateCollectionItem($collection_item_id)
{
if (!$this->isError() && !$this->collection_item->update($collection_item_id, $this->getSubmitted())) {
$this->errorAndExit($this->text('Unexpected result'));
}
} | php | protected function updateCollectionItem($collection_item_id)
{
if (!$this->isError() && !$this->collection_item->update($collection_item_id, $this->getSubmitted())) {
$this->errorAndExit($this->text('Unexpected result'));
}
} | [
"protected",
"function",
"updateCollectionItem",
"(",
"$",
"collection_item_id",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isError",
"(",
")",
"&&",
"!",
"$",
"this",
"->",
"collection_item",
"->",
"update",
"(",
"$",
"collection_item_id",
",",
"$",
"t... | Updates a collection item
@param string $collection_item_id | [
"Updates",
"a",
"collection",
"item"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/CollectionItem.php#L186-L191 |
196,024 | gplcart/cli | controllers/commands/CollectionItem.php | CollectionItem.submitAddCollectionItem | protected function submitAddCollectionItem()
{
$this->setSubmitted(null, $this->getParam());
$this->validateComponent('collection_item');
$this->addCollectionItem();
} | php | protected function submitAddCollectionItem()
{
$this->setSubmitted(null, $this->getParam());
$this->validateComponent('collection_item');
$this->addCollectionItem();
} | [
"protected",
"function",
"submitAddCollectionItem",
"(",
")",
"{",
"$",
"this",
"->",
"setSubmitted",
"(",
"null",
",",
"$",
"this",
"->",
"getParam",
"(",
")",
")",
";",
"$",
"this",
"->",
"validateComponent",
"(",
"'collection_item'",
")",
";",
"$",
"thi... | Add a new collection item at once | [
"Add",
"a",
"new",
"collection",
"item",
"at",
"once"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/CollectionItem.php#L196-L201 |
196,025 | gplcart/cli | controllers/commands/CollectionItem.php | CollectionItem.wizardAddCollectionItem | protected function wizardAddCollectionItem()
{
$this->validatePrompt('collection_id', $this->text('Collection ID'), 'collection_item');
$this->validatePrompt('entity_id', $this->text('Entity ID'), 'collection_item');
$this->validatePrompt('weight', $this->text('Weight'), 'collection_item', 0... | php | protected function wizardAddCollectionItem()
{
$this->validatePrompt('collection_id', $this->text('Collection ID'), 'collection_item');
$this->validatePrompt('entity_id', $this->text('Entity ID'), 'collection_item');
$this->validatePrompt('weight', $this->text('Weight'), 'collection_item', 0... | [
"protected",
"function",
"wizardAddCollectionItem",
"(",
")",
"{",
"$",
"this",
"->",
"validatePrompt",
"(",
"'collection_id'",
",",
"$",
"this",
"->",
"text",
"(",
"'Collection ID'",
")",
",",
"'collection_item'",
")",
";",
"$",
"this",
"->",
"validatePrompt",
... | Add a collection item step by step | [
"Add",
"a",
"collection",
"item",
"step",
"by",
"step"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/CollectionItem.php#L206-L216 |
196,026 | attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Map/MediaTableMap.php | MediaTableMap.doDelete | public static function doDelete($values, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(MediaTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria ... | php | public static function doDelete($values, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(MediaTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria ... | [
"public",
"static",
"function",
"doDelete",
"(",
"$",
"values",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"con",
")",
"{",
"$",
"con",
"=",
"Propel",
"::",
"getServiceContainer",
"(",
")",
"->",
"getW... | Performs a DELETE on the database, given a Media or Criteria object OR a primary key value.
@param mixed $values Criteria or Media object or primary key or array of primary keys
which is used to create the DELETE statement
@param ConnectionInterface $con the connection to use
@return int The... | [
"Performs",
"a",
"DELETE",
"on",
"the",
"database",
"given",
"a",
"Media",
"or",
"Criteria",
"object",
"OR",
"a",
"primary",
"key",
"value",
"."
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Map/MediaTableMap.php#L602-L630 |
196,027 | helsingborg-stad/custom-short-links | source/php/Shortlinks.php | Shortlinks.registerPostType | public function registerPostType()
{
$nameSingular = 'Shortlink';
$namePlural = 'Shortlinks';
$description = 'Create shortlinks to your posts or pages';
$labels = array(
'name' => _x($nameSingular, 'post type general name', 'custom-short-links'),
... | php | public function registerPostType()
{
$nameSingular = 'Shortlink';
$namePlural = 'Shortlinks';
$description = 'Create shortlinks to your posts or pages';
$labels = array(
'name' => _x($nameSingular, 'post type general name', 'custom-short-links'),
... | [
"public",
"function",
"registerPostType",
"(",
")",
"{",
"$",
"nameSingular",
"=",
"'Shortlink'",
";",
"$",
"namePlural",
"=",
"'Shortlinks'",
";",
"$",
"description",
"=",
"'Create shortlinks to your posts or pages'",
";",
"$",
"labels",
"=",
"array",
"(",
"'name... | Register shortlinks posttype
@return void | [
"Register",
"shortlinks",
"posttype"
] | 3b82a090eb2318470278c9f888e37527f31ddecc | https://github.com/helsingborg-stad/custom-short-links/blob/3b82a090eb2318470278c9f888e37527f31ddecc/source/php/Shortlinks.php#L21-L66 |
196,028 | helsingborg-stad/custom-short-links | source/php/Shortlinks.php | Shortlinks.simpleRedirect | public function simpleRedirect()
{
global $wp;
if (!$request = $wp->request) {
return;
}
$currentSlug = add_query_arg(array(), $request);
$post = get_page_by_title($currentSlug, 'OBJECT', 'custom-short-link');
if (!$post) {
return;
}
... | php | public function simpleRedirect()
{
global $wp;
if (!$request = $wp->request) {
return;
}
$currentSlug = add_query_arg(array(), $request);
$post = get_page_by_title($currentSlug, 'OBJECT', 'custom-short-link');
if (!$post) {
return;
}
... | [
"public",
"function",
"simpleRedirect",
"(",
")",
"{",
"global",
"$",
"wp",
";",
"if",
"(",
"!",
"$",
"request",
"=",
"$",
"wp",
"->",
"request",
")",
"{",
"return",
";",
"}",
"$",
"currentSlug",
"=",
"add_query_arg",
"(",
"array",
"(",
")",
",",
"... | Make a simple PHP redirect to the target page
@return void | [
"Make",
"a",
"simple",
"PHP",
"redirect",
"to",
"the",
"target",
"page"
] | 3b82a090eb2318470278c9f888e37527f31ddecc | https://github.com/helsingborg-stad/custom-short-links/blob/3b82a090eb2318470278c9f888e37527f31ddecc/source/php/Shortlinks.php#L131-L171 |
196,029 | itcreator/custom-cmf | Module/Url/src/Cmf/Url/Builder/Adapter/Short.php | Short.validateUrlData | protected function validateUrlData($urlData, $i)
{
$part1 = isset($urlData[$i]) ? explode('~', $urlData[$i]) : [];
$part2 = isset($urlData[$i + 1]) ? explode('~', $urlData[$i + 1]) : [];
$part3 = isset($urlData[$i + 2]) ? explode('~', $urlData[$i + 2]) : [];
if (count($part1) == 1) {... | php | protected function validateUrlData($urlData, $i)
{
$part1 = isset($urlData[$i]) ? explode('~', $urlData[$i]) : [];
$part2 = isset($urlData[$i + 1]) ? explode('~', $urlData[$i + 1]) : [];
$part3 = isset($urlData[$i + 2]) ? explode('~', $urlData[$i + 2]) : [];
if (count($part1) == 1) {... | [
"protected",
"function",
"validateUrlData",
"(",
"$",
"urlData",
",",
"$",
"i",
")",
"{",
"$",
"part1",
"=",
"isset",
"(",
"$",
"urlData",
"[",
"$",
"i",
"]",
")",
"?",
"explode",
"(",
"'~'",
",",
"$",
"urlData",
"[",
"$",
"i",
"]",
")",
":",
"... | This function check for duplicate of page
It's need for SEO
@param array $urlData
@param int $i
@return bool | [
"This",
"function",
"check",
"for",
"duplicate",
"of",
"page",
"It",
"s",
"need",
"for",
"SEO"
] | 42fc0535dfa0f641856f06673f6ab596b2020c40 | https://github.com/itcreator/custom-cmf/blob/42fc0535dfa0f641856f06673f6ab596b2020c40/Module/Url/src/Cmf/Url/Builder/Adapter/Short.php#L101-L138 |
196,030 | shgysk8zer0/core_api | traits/mime_type.php | Mime_Type.getMimeTypeFromFile | public function getMimeTypeFromFile($file)
{
$extension = strtolower(pathinfo($file, PATHINFO_EXTENSION));
if (array_key_exists($extension, $this->_alt_mime_types)) {
return $this->_alt_mime_types[$extension];
} else {
return (new \Finfo(FILEINFO_MIME_TYPE))->file($file);
}
} | php | public function getMimeTypeFromFile($file)
{
$extension = strtolower(pathinfo($file, PATHINFO_EXTENSION));
if (array_key_exists($extension, $this->_alt_mime_types)) {
return $this->_alt_mime_types[$extension];
} else {
return (new \Finfo(FILEINFO_MIME_TYPE))->file($file);
}
} | [
"public",
"function",
"getMimeTypeFromFile",
"(",
"$",
"file",
")",
"{",
"$",
"extension",
"=",
"strtolower",
"(",
"pathinfo",
"(",
"$",
"file",
",",
"PATHINFO_EXTENSION",
")",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"extension",
",",
"$",
"this... | Get mime-type from file.
Checks extensions array first, then attempts to get mime-type using Finfo
@param string $file Path to file
@return string Mime-type | [
"Get",
"mime",
"-",
"type",
"from",
"file",
".",
"Checks",
"extensions",
"array",
"first",
"then",
"attempts",
"to",
"get",
"mime",
"-",
"type",
"using",
"Finfo"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/mime_type.php#L65-L73 |
196,031 | cmsgears/module-community | common/models/mappers/Friend.php | Friend.getFriend | public function getFriend() {
$userTable = CoreTables::getTableName( CoreTables::TABLE_USER );
return $this->hasOne( User::class, [ 'id' => 'friendId' ] )->from( "$userTable as friend" );
} | php | public function getFriend() {
$userTable = CoreTables::getTableName( CoreTables::TABLE_USER );
return $this->hasOne( User::class, [ 'id' => 'friendId' ] )->from( "$userTable as friend" );
} | [
"public",
"function",
"getFriend",
"(",
")",
"{",
"$",
"userTable",
"=",
"CoreTables",
"::",
"getTableName",
"(",
"CoreTables",
"::",
"TABLE_USER",
")",
";",
"return",
"$",
"this",
"->",
"hasOne",
"(",
"User",
"::",
"class",
",",
"[",
"'id'",
"=>",
"'fri... | Return user who got friendship invite.
@return \cmsgears\core\common\models\entities\User | [
"Return",
"user",
"who",
"got",
"friendship",
"invite",
"."
] | 0ca9cf0aa0cee395a4788bd6085f291e10728555 | https://github.com/cmsgears/module-community/blob/0ca9cf0aa0cee395a4788bd6085f291e10728555/common/models/mappers/Friend.php#L196-L201 |
196,032 | infusephp/cron | src/Libs/Run.php | Run.writeOutput | public function writeOutput($str)
{
if (empty($str)) {
return $this;
}
$this->output[] = $str;
if ($this->consoleOutput) {
$this->consoleOutput->writeln($str);
}
return $this;
} | php | public function writeOutput($str)
{
if (empty($str)) {
return $this;
}
$this->output[] = $str;
if ($this->consoleOutput) {
$this->consoleOutput->writeln($str);
}
return $this;
} | [
"public",
"function",
"writeOutput",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"str",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"this",
"->",
"output",
"[",
"]",
"=",
"$",
"str",
";",
"if",
"(",
"$",
"this",
"->",
"c... | Writes output to the run.
@param string $str
@return self | [
"Writes",
"output",
"to",
"the",
"run",
"."
] | 783f6078b455a48415efeba0a6ee97ab17a3a903 | https://github.com/infusephp/cron/blob/783f6078b455a48415efeba0a6ee97ab17a3a903/src/Libs/Run.php#L44-L57 |
196,033 | ScaraMVC/Framework | src/Scara/Console/Database/Migrate.php | Migrate.changeMigrationTable | private function changeMigrationTable($migration)
{
$table = $this->_cap->table('migrations');
$dbm = $table->where('migration', '=', $migration);
if ($dbm->count() > 0) {
$item = $dbm->first();
$item->updated_at = date('Y-m-d h:i:s');
$item->migrated = ... | php | private function changeMigrationTable($migration)
{
$table = $this->_cap->table('migrations');
$dbm = $table->where('migration', '=', $migration);
if ($dbm->count() > 0) {
$item = $dbm->first();
$item->updated_at = date('Y-m-d h:i:s');
$item->migrated = ... | [
"private",
"function",
"changeMigrationTable",
"(",
"$",
"migration",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"_cap",
"->",
"table",
"(",
"'migrations'",
")",
";",
"$",
"dbm",
"=",
"$",
"table",
"->",
"where",
"(",
"'migration'",
",",
"'='",
",... | Update migrations table to reflect the migration push.
@param string $migration
@return void | [
"Update",
"migrations",
"table",
"to",
"reflect",
"the",
"migration",
"push",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Console/Database/Migrate.php#L111-L129 |
196,034 | ScaraMVC/Framework | src/Scara/Console/Database/Migrate.php | Migrate.isMigrated | private function isMigrated($migration, OutputInterface $output = null)
{
if ($this->_db->schema()->hasTable('migrations')) {
$table = $this->_cap->table('migrations');
$m = $table->where('migration', '=', $migration);
if ($m->count() > 0) {
$item = $m->fi... | php | private function isMigrated($migration, OutputInterface $output = null)
{
if ($this->_db->schema()->hasTable('migrations')) {
$table = $this->_cap->table('migrations');
$m = $table->where('migration', '=', $migration);
if ($m->count() > 0) {
$item = $m->fi... | [
"private",
"function",
"isMigrated",
"(",
"$",
"migration",
",",
"OutputInterface",
"$",
"output",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_db",
"->",
"schema",
"(",
")",
"->",
"hasTable",
"(",
"'migrations'",
")",
")",
"{",
"$",
"table",... | Check whether a migration is in the database or not.
@param string $migration
@param \Symfony\Component\Console\Output\OutputInterface $output
@return bool | [
"Check",
"whether",
"a",
"migration",
"is",
"in",
"the",
"database",
"or",
"not",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Console/Database/Migrate.php#L139-L157 |
196,035 | ScaraMVC/Framework | src/Scara/Console/Database/Migrate.php | Migrate.createMigrationsTable | private function createMigrationsTable(OutputInterface $output = null)
{
if (!is_null($output)) {
$output->writeln('<info>Creating migrations table</info>');
}
$m = new CreateMigrationsTable();
$m->up();
} | php | private function createMigrationsTable(OutputInterface $output = null)
{
if (!is_null($output)) {
$output->writeln('<info>Creating migrations table</info>');
}
$m = new CreateMigrationsTable();
$m->up();
} | [
"private",
"function",
"createMigrationsTable",
"(",
"OutputInterface",
"$",
"output",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"output",
")",
")",
"{",
"$",
"output",
"->",
"writeln",
"(",
"'<info>Creating migrations table</info>'",
")",
";... | Creates the migration table if it doesn't exist.
@param \Symfony\Component\Console\Output\OutputInterface $output
@return void | [
"Creates",
"the",
"migration",
"table",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Console/Database/Migrate.php#L166-L173 |
196,036 | ScaraMVC/Framework | src/Scara/Console/Database/Migrate.php | CreateMigrationsTable.up | public function up()
{
$this->create('migrations', function ($table) {
// Place table rows here
$table->increments('id');
$table->string('migration');
$table->integer('migrated');
$table->timestamps();
});
} | php | public function up()
{
$this->create('migrations', function ($table) {
// Place table rows here
$table->increments('id');
$table->string('migration');
$table->integer('migrated');
$table->timestamps();
});
} | [
"public",
"function",
"up",
"(",
")",
"{",
"$",
"this",
"->",
"create",
"(",
"'migrations'",
",",
"function",
"(",
"$",
"table",
")",
"{",
"// Place table rows here",
"$",
"table",
"->",
"increments",
"(",
"'id'",
")",
";",
"$",
"table",
"->",
"string",
... | For pushing migrations up.
@return void | [
"For",
"pushing",
"migrations",
"up",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Console/Database/Migrate.php#L186-L195 |
196,037 | PatrolServer/patrolsdk-php | lib/Util.php | Util.isIterator | public static function isIterator($arr) {
if (!is_array($arr)) {
return false;
}
foreach (array_keys($arr) as $key) {
if (!is_numeric($key)) {
return false;
}
}
return true;
} | php | public static function isIterator($arr) {
if (!is_array($arr)) {
return false;
}
foreach (array_keys($arr) as $key) {
if (!is_numeric($key)) {
return false;
}
}
return true;
} | [
"public",
"static",
"function",
"isIterator",
"(",
"$",
"arr",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"arr",
")",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"array_keys",
"(",
"$",
"arr",
")",
"as",
"$",
"key",
")",
"{",
"if"... | Check if param is an array and can be iterated on,
indicating this is a collection
@param object $arr
@return boolean | [
"Check",
"if",
"param",
"is",
"an",
"array",
"and",
"can",
"be",
"iterated",
"on",
"indicating",
"this",
"is",
"a",
"collection"
] | 2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2 | https://github.com/PatrolServer/patrolsdk-php/blob/2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2/lib/Util.php#L15-L27 |
196,038 | PatrolServer/patrolsdk-php | lib/Util.php | Util.parseResponseToPatrolObject | public static function parseResponseToPatrolObject(Patrol $patrol, $data, $class = null, $defaults = null) {
if (self::isIterator($data)) {
$parsed = [];
foreach ($data as $item) {
$parsed[] = self::parseResponseToPatrolObject($patrol, $item, $class, $defaults);
... | php | public static function parseResponseToPatrolObject(Patrol $patrol, $data, $class = null, $defaults = null) {
if (self::isIterator($data)) {
$parsed = [];
foreach ($data as $item) {
$parsed[] = self::parseResponseToPatrolObject($patrol, $item, $class, $defaults);
... | [
"public",
"static",
"function",
"parseResponseToPatrolObject",
"(",
"Patrol",
"$",
"patrol",
",",
"$",
"data",
",",
"$",
"class",
"=",
"null",
",",
"$",
"defaults",
"=",
"null",
")",
"{",
"if",
"(",
"self",
"::",
"isIterator",
"(",
"$",
"data",
")",
")... | Parses a response to PatrolModel
@param Patrol $patrol
@param object $data
@param string $class
@param array $defaults
@return object Can be an array (if response is a collection), a PatrolModel object or the default data (if primitive data type) | [
"Parses",
"a",
"response",
"to",
"PatrolModel"
] | 2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2 | https://github.com/PatrolServer/patrolsdk-php/blob/2451f0d2ba2bb5bc3d7e47cfc110f7f272620db2/lib/Util.php#L50-L63 |
196,039 | OxfordInfoLabs/kinikit-core | src/Util/Multithreading/ThreadManager.php | ThreadManager.runThreads | public function runThreads($maximumConcurrency = 10, $waitForCompletion = false) {
$remainingThreads = $this->threads;
$activeThreads = array();
do {
// Check to see if threads have completed and remove these.
foreach ($activeThreads as $pid => $thread) {
... | php | public function runThreads($maximumConcurrency = 10, $waitForCompletion = false) {
$remainingThreads = $this->threads;
$activeThreads = array();
do {
// Check to see if threads have completed and remove these.
foreach ($activeThreads as $pid => $thread) {
... | [
"public",
"function",
"runThreads",
"(",
"$",
"maximumConcurrency",
"=",
"10",
",",
"$",
"waitForCompletion",
"=",
"false",
")",
"{",
"$",
"remainingThreads",
"=",
"$",
"this",
"->",
"threads",
";",
"$",
"activeThreads",
"=",
"array",
"(",
")",
";",
"do",
... | Run all threads defined within this thread manager, enforcing the maximum concurrency
flag and optionally waiting for threads to complete.
@param int $maximumConcurrency | [
"Run",
"all",
"threads",
"defined",
"within",
"this",
"thread",
"manager",
"enforcing",
"the",
"maximum",
"concurrency",
"flag",
"and",
"optionally",
"waiting",
"for",
"threads",
"to",
"complete",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Multithreading/ThreadManager.php#L44-L88 |
196,040 | CurtisBarogla/User | src/Role/RoleHierarchy.php | RoleHierarchy.addRole | public function addRole(string $role, ?array $parents = null): void
{
$this->roles[] = $role;
if(null !== $parents) {
$map = [];
foreach ($parents as $parent) {
$map[] = $parent;
$map = \array_merge($map, $this->getRoles($paren... | php | public function addRole(string $role, ?array $parents = null): void
{
$this->roles[] = $role;
if(null !== $parents) {
$map = [];
foreach ($parents as $parent) {
$map[] = $parent;
$map = \array_merge($map, $this->getRoles($paren... | [
"public",
"function",
"addRole",
"(",
"string",
"$",
"role",
",",
"?",
"array",
"$",
"parents",
"=",
"null",
")",
":",
"void",
"{",
"$",
"this",
"->",
"roles",
"[",
"]",
"=",
"$",
"role",
";",
"if",
"(",
"null",
"!==",
"$",
"parents",
")",
"{",
... | Add a role into the hierarchy
@param string $role
Role to add
@param array|null $parents
Parents for this role. Leave to null if none
@throws UndefinedRoleException
When a parent role cannot be resolved | [
"Add",
"a",
"role",
"into",
"the",
"hierarchy"
] | e26d934e4c06608abd29483701abddcfcc19ec29 | https://github.com/CurtisBarogla/User/blob/e26d934e4c06608abd29483701abddcfcc19ec29/src/Role/RoleHierarchy.php#L63-L77 |
196,041 | kaiohken1982/Neobazaar | src/Neobazaar/Entity/Repository/DocumentRepository.php | DocumentRepository.getPaginator | public function getPaginator($params)
{
$limit = isset($params['limit']) ? (int) $params['limit'] : 10;
$offset = isset($params['offset']) ? (int) $params['offset'] : 0;
// @todo (re)setting limit and offset, make it better...
$params['limit'] = $limit;
$params['offset... | php | public function getPaginator($params)
{
$limit = isset($params['limit']) ? (int) $params['limit'] : 10;
$offset = isset($params['offset']) ? (int) $params['offset'] : 0;
// @todo (re)setting limit and offset, make it better...
$params['limit'] = $limit;
$params['offset... | [
"public",
"function",
"getPaginator",
"(",
"$",
"params",
")",
"{",
"$",
"limit",
"=",
"isset",
"(",
"$",
"params",
"[",
"'limit'",
"]",
")",
"?",
"(",
"int",
")",
"$",
"params",
"[",
"'limit'",
"]",
":",
"10",
";",
"$",
"offset",
"=",
"isset",
"... | Create paginator Object
@return Zend\Paginator\Paginator | [
"Create",
"paginator",
"Object"
] | 288c972dea981d715c4e136edb5dba0318c9e6cb | https://github.com/kaiohken1982/Neobazaar/blob/288c972dea981d715c4e136edb5dba0318c9e6cb/src/Neobazaar/Entity/Repository/DocumentRepository.php#L36-L111 |
196,042 | kaiohken1982/Neobazaar | src/Neobazaar/Entity/Repository/DocumentRepository.php | DocumentRepository.getList | public function getList($params = array(), ServiceManager $sm)
{
//var_dump($params); exit();
$paginator = $this->getPaginator($params);
$data = array();
foreach($paginator as $post) {
$data[] = $this->get($post, $sm); // verificare che cazzo fa sto get!!!!!
}
// Denormalizzazione parametri per cre... | php | public function getList($params = array(), ServiceManager $sm)
{
//var_dump($params); exit();
$paginator = $this->getPaginator($params);
$data = array();
foreach($paginator as $post) {
$data[] = $this->get($post, $sm); // verificare che cazzo fa sto get!!!!!
}
// Denormalizzazione parametri per cre... | [
"public",
"function",
"getList",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"ServiceManager",
"$",
"sm",
")",
"{",
"//var_dump($params); exit();",
"$",
"paginator",
"=",
"$",
"this",
"->",
"getPaginator",
"(",
"$",
"params",
")",
";",
"$",
"data",
... | Return a normalized representation of a set of document
@todo do not pass controller, create an utils service
@param array $params
@param object $controller
@return array | [
"Return",
"a",
"normalized",
"representation",
"of",
"a",
"set",
"of",
"document"
] | 288c972dea981d715c4e136edb5dba0318c9e6cb | https://github.com/kaiohken1982/Neobazaar/blob/288c972dea981d715c4e136edb5dba0318c9e6cb/src/Neobazaar/Entity/Repository/DocumentRepository.php#L195-L228 |
196,043 | kaiohken1982/Neobazaar | src/Neobazaar/Entity/Repository/DocumentRepository.php | DocumentRepository.getPaginationData | public function getPaginationData(ServiceManager $sm, $paginator, $data, $routeName, $routeParams, $queryParams)
{
$mainService = $sm->get('neobazaar.service.main');
return array(
'data' => $data,
'paginationData' => Json::decode($mainService->getView()->paginationControl(
$paginator,
'Sliding',
... | php | public function getPaginationData(ServiceManager $sm, $paginator, $data, $routeName, $routeParams, $queryParams)
{
$mainService = $sm->get('neobazaar.service.main');
return array(
'data' => $data,
'paginationData' => Json::decode($mainService->getView()->paginationControl(
$paginator,
'Sliding',
... | [
"public",
"function",
"getPaginationData",
"(",
"ServiceManager",
"$",
"sm",
",",
"$",
"paginator",
",",
"$",
"data",
",",
"$",
"routeName",
",",
"$",
"routeParams",
",",
"$",
"queryParams",
")",
"{",
"$",
"mainService",
"=",
"$",
"sm",
"->",
"get",
"(",... | Get a pagination JSON data.
@todo Find how to better manage this | [
"Get",
"a",
"pagination",
"JSON",
"data",
"."
] | 288c972dea981d715c4e136edb5dba0318c9e6cb | https://github.com/kaiohken1982/Neobazaar/blob/288c972dea981d715c4e136edb5dba0318c9e6cb/src/Neobazaar/Entity/Repository/DocumentRepository.php#L235-L251 |
196,044 | mirkhamidov/yii2-alert-autohide | Alert.php | Alert.initAutoHide | protected function initAutoHide()
{
if ($this->getIsDelayed() === false) {
return null;
}
/** @var \yii\web\View $view */
$view = $this->getView();
$view->registerJs($this->makeJs(), View::POS_READY);
AlertAssets::register($view);
} | php | protected function initAutoHide()
{
if ($this->getIsDelayed() === false) {
return null;
}
/** @var \yii\web\View $view */
$view = $this->getView();
$view->registerJs($this->makeJs(), View::POS_READY);
AlertAssets::register($view);
} | [
"protected",
"function",
"initAutoHide",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getIsDelayed",
"(",
")",
"===",
"false",
")",
"{",
"return",
"null",
";",
"}",
"/** @var \\yii\\web\\View $view */",
"$",
"view",
"=",
"$",
"this",
"->",
"getView",
"(",... | Initialize javascript function for autoHide | [
"Initialize",
"javascript",
"function",
"for",
"autoHide"
] | ec93e170e3014cabccd9532c0289d990dcd4c91e | https://github.com/mirkhamidov/yii2-alert-autohide/blob/ec93e170e3014cabccd9532c0289d990dcd4c91e/Alert.php#L99-L111 |
196,045 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.fields | public function fields($fields = [])
{
$this->builder->select([]);
$this->casts = [];
if (empty($fields)) {
foreach ($this->model->fields() as $field) {
$this->assignField($field);
}
return $this;
}
foreach ($fields as $f... | php | public function fields($fields = [])
{
$this->builder->select([]);
$this->casts = [];
if (empty($fields)) {
foreach ($this->model->fields() as $field) {
$this->assignField($field);
}
return $this;
}
foreach ($fields as $f... | [
"public",
"function",
"fields",
"(",
"$",
"fields",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"builder",
"->",
"select",
"(",
"[",
"]",
")",
";",
"$",
"this",
"->",
"casts",
"=",
"[",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"fields",
")",
"... | Sets field names which will be read
@param array $fields
@return $this | [
"Sets",
"field",
"names",
"which",
"will",
"be",
"read"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L79-L97 |
196,046 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.assignField | protected function assignField(FieldInterface $field)
{
if ($field->mapping() !== null) {
$this->builder->addSelect(
sprintf(
'%s AS %s',
$this->connection->quoteIdentifier($field->mapping()),
$this->connection->quoteIde... | php | protected function assignField(FieldInterface $field)
{
if ($field->mapping() !== null) {
$this->builder->addSelect(
sprintf(
'%s AS %s',
$this->connection->quoteIdentifier($field->mapping()),
$this->connection->quoteIde... | [
"protected",
"function",
"assignField",
"(",
"FieldInterface",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"field",
"->",
"mapping",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"builder",
"->",
"addSelect",
"(",
"sprintf",
"(",
"'%s AS %s'",
",",
... | Assigns field to query
@param FieldInterface $field | [
"Assigns",
"field",
"to",
"query"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L118-L133 |
196,047 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.buildSingularFieldCondition | protected function buildSingularFieldCondition($field, $value, $comparison)
{
$field = $this->model()->field($field);
return $this->buildConditionString(
$this->connection()->quoteIdentifier($field->mappedName()),
$value === null ? null : $this->bindValues($field->mappedName... | php | protected function buildSingularFieldCondition($field, $value, $comparison)
{
$field = $this->model()->field($field);
return $this->buildConditionString(
$this->connection()->quoteIdentifier($field->mappedName()),
$value === null ? null : $this->bindValues($field->mappedName... | [
"protected",
"function",
"buildSingularFieldCondition",
"(",
"$",
"field",
",",
"$",
"value",
",",
"$",
"comparison",
")",
"{",
"$",
"field",
"=",
"$",
"this",
"->",
"model",
"(",
")",
"->",
"field",
"(",
"$",
"field",
")",
";",
"return",
"$",
"this",
... | Builds condition for singular field
@param string $field
@param mixed $value
@param string $comparison
@return array | [
"Builds",
"condition",
"for",
"singular",
"field"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L193-L202 |
196,048 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.buildMultipleFieldsCondition | protected function buildMultipleFieldsCondition($fields, $value, $comparison, $logical)
{
$conditions = [];
foreach ((array) $fields as $field) {
$field = $this->model()->field($field);
$fieldName = $field->mappedName();
$conditions[] = $this->buildConditionStrin... | php | protected function buildMultipleFieldsCondition($fields, $value, $comparison, $logical)
{
$conditions = [];
foreach ((array) $fields as $field) {
$field = $this->model()->field($field);
$fieldName = $field->mappedName();
$conditions[] = $this->buildConditionStrin... | [
"protected",
"function",
"buildMultipleFieldsCondition",
"(",
"$",
"fields",
",",
"$",
"value",
",",
"$",
"comparison",
",",
"$",
"logical",
")",
"{",
"$",
"conditions",
"=",
"[",
"]",
";",
"foreach",
"(",
"(",
"array",
")",
"$",
"fields",
"as",
"$",
"... | Builds conditions for multiple fields
@param array $fields
@param mixed $value
@param string $comparison
@param string $logical
@return array | [
"Builds",
"conditions",
"for",
"multiple",
"fields"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L214-L233 |
196,049 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.buildConditionString | protected function buildConditionString($field, $bind, $operator)
{
if (is_array($bind)) {
foreach ($bind as &$val) {
$val = $this->buildConditionString($field, $val, $operator);
unset($val);
}
$logical = $operator === '!=' ? ' and ' : ' o... | php | protected function buildConditionString($field, $bind, $operator)
{
if (is_array($bind)) {
foreach ($bind as &$val) {
$val = $this->buildConditionString($field, $val, $operator);
unset($val);
}
$logical = $operator === '!=' ? ' and ' : ' o... | [
"protected",
"function",
"buildConditionString",
"(",
"$",
"field",
",",
"$",
"bind",
",",
"$",
"operator",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"bind",
")",
")",
"{",
"foreach",
"(",
"$",
"bind",
"as",
"&",
"$",
"val",
")",
"{",
"$",
"val",
... | Builds condition string
@param string $field
@param string|array $bind
@param string $operator
@return string | [
"Builds",
"condition",
"string"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L244-L266 |
196,050 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.normalizeComparison | protected function normalizeComparison($operator)
{
switch (strtolower($operator)) {
case '<':
case 'lt':
return '<';
case '<=':
case 'lte':
return '<=';
case '>':
case 'gt':
return '>';
... | php | protected function normalizeComparison($operator)
{
switch (strtolower($operator)) {
case '<':
case 'lt':
return '<';
case '<=':
case 'lte':
return '<=';
case '>':
case 'gt':
return '>';
... | [
"protected",
"function",
"normalizeComparison",
"(",
"$",
"operator",
")",
"{",
"switch",
"(",
"strtolower",
"(",
"$",
"operator",
")",
")",
"{",
"case",
"'<'",
":",
"case",
"'lt'",
":",
"return",
"'<'",
";",
"case",
"'<='",
":",
"case",
"'lte'",
":",
... | Asserts correct comparison operator
@param string $operator
@return string
@throws QueryException | [
"Asserts",
"correct",
"comparison",
"operator"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L276-L315 |
196,051 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.normalizeLogical | protected function normalizeLogical($operator)
{
switch (strtolower($operator)) {
case '&&':
case 'and':
return 'and';
case '||':
case 'or':
return 'or';
default:
throw new QueryException(sprintf('Que... | php | protected function normalizeLogical($operator)
{
switch (strtolower($operator)) {
case '&&':
case 'and':
return 'and';
case '||':
case 'or':
return 'or';
default:
throw new QueryException(sprintf('Que... | [
"protected",
"function",
"normalizeLogical",
"(",
"$",
"operator",
")",
"{",
"switch",
"(",
"strtolower",
"(",
"$",
"operator",
")",
")",
"{",
"case",
"'&&'",
":",
"case",
"'and'",
":",
"return",
"'and'",
";",
"case",
"'||'",
":",
"case",
"'or'",
":",
... | Asserts correct logical operation
@param string $operator
@return string
@throws QueryException | [
"Asserts",
"correct",
"logical",
"operation"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L325-L337 |
196,052 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.bindValues | protected function bindValues($name, $type, $values)
{
if (!is_array($values)) {
return $this->builder->createNamedParameter($values, $type);
}
foreach ($values as $key => $value) {
$values[$key] = $this->bindValues($name, $type, $value);
}
return $v... | php | protected function bindValues($name, $type, $values)
{
if (!is_array($values)) {
return $this->builder->createNamedParameter($values, $type);
}
foreach ($values as $key => $value) {
$values[$key] = $this->bindValues($name, $type, $value);
}
return $v... | [
"protected",
"function",
"bindValues",
"(",
"$",
"name",
",",
"$",
"type",
",",
"$",
"values",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"values",
")",
")",
"{",
"return",
"$",
"this",
"->",
"builder",
"->",
"createNamedParameter",
"(",
"$",
"v... | Binds condition value to key
@param string $name
@param string $type
@param mixed $values
@return string | [
"Binds",
"condition",
"value",
"to",
"key"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L348-L359 |
196,053 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.order | public function order($field, $order = 'desc')
{
$field = $this->model->field($field);
$order = $this->normalizeOrder($order);
$this->builder->addOrderBy($this->connection->quoteIdentifier($field->mappedName()), $order);
return $this;
} | php | public function order($field, $order = 'desc')
{
$field = $this->model->field($field);
$order = $this->normalizeOrder($order);
$this->builder->addOrderBy($this->connection->quoteIdentifier($field->mappedName()), $order);
return $this;
} | [
"public",
"function",
"order",
"(",
"$",
"field",
",",
"$",
"order",
"=",
"'desc'",
")",
"{",
"$",
"field",
"=",
"$",
"this",
"->",
"model",
"->",
"field",
"(",
"$",
"field",
")",
";",
"$",
"order",
"=",
"$",
"this",
"->",
"normalizeOrder",
"(",
... | Adds sorting to query
@param string $field
@param string $order
@return $this | [
"Adds",
"sorting",
"to",
"query"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L369-L377 |
196,054 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.normalizeOrder | protected function normalizeOrder($order)
{
switch (strtolower($order)) {
case 'asc':
return 'asc';
case 'desc':
return 'desc';
default:
throw new QueryException(sprintf('Unsupported sorting method "%s" in query "%s"', $this... | php | protected function normalizeOrder($order)
{
switch (strtolower($order)) {
case 'asc':
return 'asc';
case 'desc':
return 'desc';
default:
throw new QueryException(sprintf('Unsupported sorting method "%s" in query "%s"', $this... | [
"protected",
"function",
"normalizeOrder",
"(",
"$",
"order",
")",
"{",
"switch",
"(",
"strtolower",
"(",
"$",
"order",
")",
")",
"{",
"case",
"'asc'",
":",
"return",
"'asc'",
";",
"case",
"'desc'",
":",
"return",
"'desc'",
";",
"default",
":",
"throw",
... | Asserts correct order
@param string $order
@return string
@throws QueryException | [
"Asserts",
"correct",
"order"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L387-L398 |
196,055 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.limit | public function limit($limit, $offset = null)
{
if ($offset !== null) {
$this->builder->setFirstResult((int) $offset);
}
$this->builder->setMaxResults((int) $limit);
return $this;
} | php | public function limit($limit, $offset = null)
{
if ($offset !== null) {
$this->builder->setFirstResult((int) $offset);
}
$this->builder->setMaxResults((int) $limit);
return $this;
} | [
"public",
"function",
"limit",
"(",
"$",
"limit",
",",
"$",
"offset",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"offset",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"builder",
"->",
"setFirstResult",
"(",
"(",
"int",
")",
"$",
"offset",
")",
";",
"... | Sets limits to query
@param int $limit
@param null|int $offset
@return $this | [
"Sets",
"limits",
"to",
"query"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L408-L417 |
196,056 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.count | public function count()
{
if (empty($this->queryString)) {
$builder = clone $this->builder;
$builder->resetQueryPart('orderBy');
$stmt = $builder->execute();
} else {
$stmt = $this->connection->executeQuery($this->queryString, $this->queryParams);
... | php | public function count()
{
if (empty($this->queryString)) {
$builder = clone $this->builder;
$builder->resetQueryPart('orderBy');
$stmt = $builder->execute();
} else {
$stmt = $this->connection->executeQuery($this->queryString, $this->queryParams);
... | [
"public",
"function",
"count",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"queryString",
")",
")",
"{",
"$",
"builder",
"=",
"clone",
"$",
"this",
"->",
"builder",
";",
"$",
"builder",
"->",
"resetQueryPart",
"(",
"'orderBy'",
")",
";... | Returns number of entities that will be read
@return int | [
"Returns",
"number",
"of",
"entities",
"that",
"will",
"be",
"read"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L424-L435 |
196,057 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.query | public function query($query, array $params = [])
{
$this->queryString = $query;
$this->queryParams = $params;
return $this;
} | php | public function query($query, array $params = [])
{
$this->queryString = $query;
$this->queryParams = $params;
return $this;
} | [
"public",
"function",
"query",
"(",
"$",
"query",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"queryString",
"=",
"$",
"query",
";",
"$",
"this",
"->",
"queryParams",
"=",
"$",
"params",
";",
"return",
"$",
"this",
";",... | Sets custom query to be executed instead of one based on entity structure
@param string $query
@param array $params
@return $this | [
"Sets",
"custom",
"query",
"to",
"be",
"executed",
"instead",
"of",
"one",
"based",
"on",
"entity",
"structure"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L445-L451 |
196,058 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.executeQuery | protected function executeQuery()
{
if (empty($this->queryString)) {
return $this->builder->execute();
}
return $this->connection->executeQuery($this->queryString, $this->queryParams);
} | php | protected function executeQuery()
{
if (empty($this->queryString)) {
return $this->builder->execute();
}
return $this->connection->executeQuery($this->queryString, $this->queryParams);
} | [
"protected",
"function",
"executeQuery",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"queryString",
")",
")",
"{",
"return",
"$",
"this",
"->",
"builder",
"->",
"execute",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"connection",
... | Executes query - from builder or custom
@return Statement
@throws \Doctrine\DBAL\DBALException | [
"Executes",
"query",
"-",
"from",
"builder",
"or",
"custom"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L482-L489 |
196,059 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.fetchAsAssoc | protected function fetchAsAssoc(Statement $stmt)
{
$stmt->setFetchMode(\PDO::FETCH_ASSOC);
return $stmt->fetchAll(\PDO::FETCH_ASSOC);
} | php | protected function fetchAsAssoc(Statement $stmt)
{
$stmt->setFetchMode(\PDO::FETCH_ASSOC);
return $stmt->fetchAll(\PDO::FETCH_ASSOC);
} | [
"protected",
"function",
"fetchAsAssoc",
"(",
"Statement",
"$",
"stmt",
")",
"{",
"$",
"stmt",
"->",
"setFetchMode",
"(",
"\\",
"PDO",
"::",
"FETCH_ASSOC",
")",
";",
"return",
"$",
"stmt",
"->",
"fetchAll",
"(",
"\\",
"PDO",
"::",
"FETCH_ASSOC",
")",
";"... | Fetches result as associative array, mostly for pivot tables
@param Statement $stmt
@return array | [
"Fetches",
"result",
"as",
"associative",
"array",
"mostly",
"for",
"pivot",
"tables"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L498-L503 |
196,060 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.fetchAsObject | protected function fetchAsObject(Statement $stmt)
{
$stmt->setFetchMode(\PDO::FETCH_CLASS, $this->model->entity());
$result = $stmt->fetchAll();
$ref = new \ReflectionClass($this->model->entity());
foreach ($result as $entity) {
$this->restoreObject($entity, $this->casts... | php | protected function fetchAsObject(Statement $stmt)
{
$stmt->setFetchMode(\PDO::FETCH_CLASS, $this->model->entity());
$result = $stmt->fetchAll();
$ref = new \ReflectionClass($this->model->entity());
foreach ($result as $entity) {
$this->restoreObject($entity, $this->casts... | [
"protected",
"function",
"fetchAsObject",
"(",
"Statement",
"$",
"stmt",
")",
"{",
"$",
"stmt",
"->",
"setFetchMode",
"(",
"\\",
"PDO",
"::",
"FETCH_CLASS",
",",
"$",
"this",
"->",
"model",
"->",
"entity",
"(",
")",
")",
";",
"$",
"result",
"=",
"$",
... | Fetches result as entity object
@param Statement $stmt
@return array | [
"Fetches",
"result",
"as",
"entity",
"object"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L512-L523 |
196,061 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.restoreObject | protected function restoreObject($entity, array $restore, \ReflectionClass $ref)
{
foreach ($restore as $field => $type) {
if (is_array($entity)) {
if (!isset($entity[$field])) {
continue;
}
$entity[$field] = $this->convertToPH... | php | protected function restoreObject($entity, array $restore, \ReflectionClass $ref)
{
foreach ($restore as $field => $type) {
if (is_array($entity)) {
if (!isset($entity[$field])) {
continue;
}
$entity[$field] = $this->convertToPH... | [
"protected",
"function",
"restoreObject",
"(",
"$",
"entity",
",",
"array",
"$",
"restore",
",",
"\\",
"ReflectionClass",
"$",
"ref",
")",
"{",
"foreach",
"(",
"$",
"restore",
"as",
"$",
"field",
"=>",
"$",
"type",
")",
"{",
"if",
"(",
"is_array",
"(",... | Restores entity values from their stored representation
@param object $entity
@param array $restore
@param \ReflectionClass $ref
@return mixed | [
"Restores",
"entity",
"values",
"from",
"their",
"stored",
"representation"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L534-L564 |
196,062 | mossphp/moss-storage | Moss/Storage/Query/ReadQuery.php | ReadQuery.convertToPHPValue | protected function convertToPHPValue($value, $type)
{
return Type::getType($type)->convertToPHPValue($value, $this->connection->getDatabasePlatform());
} | php | protected function convertToPHPValue($value, $type)
{
return Type::getType($type)->convertToPHPValue($value, $this->connection->getDatabasePlatform());
} | [
"protected",
"function",
"convertToPHPValue",
"(",
"$",
"value",
",",
"$",
"type",
")",
"{",
"return",
"Type",
"::",
"getType",
"(",
"$",
"type",
")",
"->",
"convertToPHPValue",
"(",
"$",
"value",
",",
"$",
"this",
"->",
"connection",
"->",
"getDatabasePla... | Converts read value to its php representation
@param mixed $value
@param string $type
@return mixed
@throws \Doctrine\DBAL\DBALException | [
"Converts",
"read",
"value",
"to",
"its",
"php",
"representation"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/ReadQuery.php#L575-L578 |
196,063 | pdyn/filesystem | fileuploader/FileUploader.php | FileUploader.set_restrictions | public function set_restrictions(array $restrictions) {
$this->restrictions = array();
foreach ($restrictions as $k => $v) {
switch ($k) {
case 'maxsize':
if (is_int($v)) {
$this->restrictions['maxsize'] = $v;
}
break;
case 'mediatype':
if (is_array($v)) {
$this->restric... | php | public function set_restrictions(array $restrictions) {
$this->restrictions = array();
foreach ($restrictions as $k => $v) {
switch ($k) {
case 'maxsize':
if (is_int($v)) {
$this->restrictions['maxsize'] = $v;
}
break;
case 'mediatype':
if (is_array($v)) {
$this->restric... | [
"public",
"function",
"set_restrictions",
"(",
"array",
"$",
"restrictions",
")",
"{",
"$",
"this",
"->",
"restrictions",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"restrictions",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"switch",
"(",
"$",
... | Set restrictions on file uploads.
@param array $restrictions An array of restrictions. Possible keys are:
maxsize (int) A maximum size (in bytes) for the uploaded file.
mediatype (array) An array of allowed mediatypes.
mimetype (array) An array of allowed mimetypes.
extension (array) An array of allowed file extensions... | [
"Set",
"restrictions",
"on",
"file",
"uploads",
"."
] | e2f780eac166aa60071e601d600133b860ace594 | https://github.com/pdyn/filesystem/blob/e2f780eac166aa60071e601d600133b860ace594/fileuploader/FileUploader.php#L42-L73 |
196,064 | pdyn/filesystem | fileuploader/FileUploader.php | FileUploader.validate_upload | public function validate_upload(UploadedFile $file) {
foreach ($this->restrictions as $k => $v) {
switch ($k) {
case 'maxsize':
if ($v < $file->get_size()) {
throw new Exception('Received file was too large.', Exception::ERR_BAD_REQUEST);
}
break;
case 'mediatype':
if (!in_array(... | php | public function validate_upload(UploadedFile $file) {
foreach ($this->restrictions as $k => $v) {
switch ($k) {
case 'maxsize':
if ($v < $file->get_size()) {
throw new Exception('Received file was too large.', Exception::ERR_BAD_REQUEST);
}
break;
case 'mediatype':
if (!in_array(... | [
"public",
"function",
"validate_upload",
"(",
"UploadedFile",
"$",
"file",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"restrictions",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"switch",
"(",
"$",
"k",
")",
"{",
"case",
"'maxsize'",
":",
"if",
"(",
... | Validate an UploadedFile object against the list of restrictions.
@param UploadedFile $file An UploadedFile object to validate.
@return bool True if successful. | [
"Validate",
"an",
"UploadedFile",
"object",
"against",
"the",
"list",
"of",
"restrictions",
"."
] | e2f780eac166aa60071e601d600133b860ace594 | https://github.com/pdyn/filesystem/blob/e2f780eac166aa60071e601d600133b860ace594/fileuploader/FileUploader.php#L81-L110 |
196,065 | pdyn/filesystem | fileuploader/FileUploader.php | FileUploader.handleupload | public function handleupload($savedir, $savefilename = null, $quotadata = array()) {
if (!isset($_FILES['pdynfileuploader'])) {
throw new Exception('No file received.', Exception::ERR_BAD_REQUEST);
}
if (empty($savedir) || !is_string($savedir)) {
throw new Exception('Invalid save path received', Exception:... | php | public function handleupload($savedir, $savefilename = null, $quotadata = array()) {
if (!isset($_FILES['pdynfileuploader'])) {
throw new Exception('No file received.', Exception::ERR_BAD_REQUEST);
}
if (empty($savedir) || !is_string($savedir)) {
throw new Exception('Invalid save path received', Exception:... | [
"public",
"function",
"handleupload",
"(",
"$",
"savedir",
",",
"$",
"savefilename",
"=",
"null",
",",
"$",
"quotadata",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"_FILES",
"[",
"'pdynfileuploader'",
"]",
")",
")",
"{",
"th... | Receive an uploaded file, validate it, and save it.
@param string $savedir A directory to save the file.
@param string $savefilename (Optional) A filename to save the file as, if empty, a unique name will be generated.
@return UploadedFile The resulting UploadedFile object. | [
"Receive",
"an",
"uploaded",
"file",
"validate",
"it",
"and",
"save",
"it",
"."
] | e2f780eac166aa60071e601d600133b860ace594 | https://github.com/pdyn/filesystem/blob/e2f780eac166aa60071e601d600133b860ace594/fileuploader/FileUploader.php#L119-L156 |
196,066 | wevrem/dStruct | src/dStruct.php | dStruct.fieldDefs | static function fieldDefs($childs=null) {
$gname = get_called_class();
$key = $gname . ( $childs ? '::' . $childs : '' );
if (key_exists($key, static::$fieldDefCache)) { return static::$fieldDefCache[$key]; }
$defs = static::selfFieldDefs($key);
foreach (class_uses($gname) as $trait) {
if ('dt' != substr($... | php | static function fieldDefs($childs=null) {
$gname = get_called_class();
$key = $gname . ( $childs ? '::' . $childs : '' );
if (key_exists($key, static::$fieldDefCache)) { return static::$fieldDefCache[$key]; }
$defs = static::selfFieldDefs($key);
foreach (class_uses($gname) as $trait) {
if ('dt' != substr($... | [
"static",
"function",
"fieldDefs",
"(",
"$",
"childs",
"=",
"null",
")",
"{",
"$",
"gname",
"=",
"get_called_class",
"(",
")",
";",
"$",
"key",
"=",
"$",
"gname",
".",
"(",
"$",
"childs",
"?",
"'::'",
".",
"$",
"childs",
":",
"''",
")",
";",
"if"... | their traits). Caches results for faster lookup. | [
"their",
"traits",
")",
".",
"Caches",
"results",
"for",
"faster",
"lookup",
"."
] | 6ede2c26a377475f48de043536d1f46e8863d8b3 | https://github.com/wevrem/dStruct/blob/6ede2c26a377475f48de043536d1f46e8863d8b3/src/dStruct.php#L126-L142 |
196,067 | wevrem/dStruct | src/dStruct.php | dStruct.refDefs | static protected function refDefs($childs=null) {
$gname = get_called_class();
$key = $gname . ( $childs ? '::' . $childs : '' );
if (key_exists($key, static::$refDefCache)) { return static::$refDefCache[$key]; }
$defs = static::selfRefDefs($key);
foreach (class_uses($gname) as $trait) {
if ('dt' != substr... | php | static protected function refDefs($childs=null) {
$gname = get_called_class();
$key = $gname . ( $childs ? '::' . $childs : '' );
if (key_exists($key, static::$refDefCache)) { return static::$refDefCache[$key]; }
$defs = static::selfRefDefs($key);
foreach (class_uses($gname) as $trait) {
if ('dt' != substr... | [
"static",
"protected",
"function",
"refDefs",
"(",
"$",
"childs",
"=",
"null",
")",
"{",
"$",
"gname",
"=",
"get_called_class",
"(",
")",
";",
"$",
"key",
"=",
"$",
"gname",
".",
"(",
"$",
"childs",
"?",
"'::'",
".",
"$",
"childs",
":",
"''",
")",
... | results for faster lookup. | [
"results",
"for",
"faster",
"lookup",
"."
] | 6ede2c26a377475f48de043536d1f46e8863d8b3 | https://github.com/wevrem/dStruct/blob/6ede2c26a377475f48de043536d1f46e8863d8b3/src/dStruct.php#L148-L164 |
196,068 | wevrem/dStruct | src/dStruct.php | dStruct.ownsRef | static function ownsRef($fname) {
$refDefs = static::refDefs();
$owns = $refDefs[$fname][static::OWNS];
if ($owns === null) {
throw new \Exception("Invalid fname `$fname` called for ownsRef");
}
return $owns;
} | php | static function ownsRef($fname) {
$refDefs = static::refDefs();
$owns = $refDefs[$fname][static::OWNS];
if ($owns === null) {
throw new \Exception("Invalid fname `$fname` called for ownsRef");
}
return $owns;
} | [
"static",
"function",
"ownsRef",
"(",
"$",
"fname",
")",
"{",
"$",
"refDefs",
"=",
"static",
"::",
"refDefs",
"(",
")",
";",
"$",
"owns",
"=",
"$",
"refDefs",
"[",
"$",
"fname",
"]",
"[",
"static",
"::",
"OWNS",
"]",
";",
"if",
"(",
"$",
"owns",
... | Throws an exception if `fname` is unrecognized. | [
"Throws",
"an",
"exception",
"if",
"fname",
"is",
"unrecognized",
"."
] | 6ede2c26a377475f48de043536d1f46e8863d8b3 | https://github.com/wevrem/dStruct/blob/6ede2c26a377475f48de043536d1f46e8863d8b3/src/dStruct.php#L169-L176 |
196,069 | wevrem/dStruct | src/dStruct.php | dStruct.gnameForRef | static function gnameForRef($fname) {
$refDefs = static::refDefs();
$gname = $refDefs[$fname][static::GNAME];
if ($gname === null) {
throw new \Exception("Invalid fname `$fname` called for gnameForRef");
}
return $gname;
} | php | static function gnameForRef($fname) {
$refDefs = static::refDefs();
$gname = $refDefs[$fname][static::GNAME];
if ($gname === null) {
throw new \Exception("Invalid fname `$fname` called for gnameForRef");
}
return $gname;
} | [
"static",
"function",
"gnameForRef",
"(",
"$",
"fname",
")",
"{",
"$",
"refDefs",
"=",
"static",
"::",
"refDefs",
"(",
")",
";",
"$",
"gname",
"=",
"$",
"refDefs",
"[",
"$",
"fname",
"]",
"[",
"static",
"::",
"GNAME",
"]",
";",
"if",
"(",
"$",
"g... | class. Throws an exception if `fname` is unrecognized. | [
"class",
".",
"Throws",
"an",
"exception",
"if",
"fname",
"is",
"unrecognized",
"."
] | 6ede2c26a377475f48de043536d1f46e8863d8b3 | https://github.com/wevrem/dStruct/blob/6ede2c26a377475f48de043536d1f46e8863d8b3/src/dStruct.php#L181-L188 |
196,070 | wevrem/dStruct | src/dStruct.php | dStruct.setKey | function setKey($key) {
$this->cnxn->confirmTransaction('setKey');
$currKey = $this->key;
if (!is_null($currKey) && is_null($key)) {
$this->cnxn->unregisterStructWithKey($this, $currKey);
} else if (is_null($currKey) && !is_null($key)) {
$this->cnxn->registerStructWithKey($this, $key);
} else if ($currK... | php | function setKey($key) {
$this->cnxn->confirmTransaction('setKey');
$currKey = $this->key;
if (!is_null($currKey) && is_null($key)) {
$this->cnxn->unregisterStructWithKey($this, $currKey);
} else if (is_null($currKey) && !is_null($key)) {
$this->cnxn->registerStructWithKey($this, $key);
} else if ($currK... | [
"function",
"setKey",
"(",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"cnxn",
"->",
"confirmTransaction",
"(",
"'setKey'",
")",
";",
"$",
"currKey",
"=",
"$",
"this",
"->",
"key",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"currKey",
")",
"&&",
"is_nu... | Subclasses can override to indicate the connection should look for a key when the struct is fetched. | [
"Subclasses",
"can",
"override",
"to",
"indicate",
"the",
"connection",
"should",
"look",
"for",
"a",
"key",
"when",
"the",
"struct",
"is",
"fetched",
"."
] | 6ede2c26a377475f48de043536d1f46e8863d8b3 | https://github.com/wevrem/dStruct/blob/6ede2c26a377475f48de043536d1f46e8863d8b3/src/dStruct.php#L220-L232 |
196,071 | MARCspec/php-marc-spec | src/Field.php | Field.validateTag | private function validateTag($tag)
{
if (!preg_match('/[.0-9a-z]{3,3}|[.0-9A-Z]{3,3}/', $tag)) {
throw new InvalidMARCspecException(
InvalidMARCspecException::FS.
InvalidMARCspecException::FTAG,
$tag
);
}
return true;
... | php | private function validateTag($tag)
{
if (!preg_match('/[.0-9a-z]{3,3}|[.0-9A-Z]{3,3}/', $tag)) {
throw new InvalidMARCspecException(
InvalidMARCspecException::FS.
InvalidMARCspecException::FTAG,
$tag
);
}
return true;
... | [
"private",
"function",
"validateTag",
"(",
"$",
"tag",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"'/[.0-9a-z]{3,3}|[.0-9A-Z]{3,3}/'",
",",
"$",
"tag",
")",
")",
"{",
"throw",
"new",
"InvalidMARCspecException",
"(",
"InvalidMARCspecException",
"::",
"FS",
".",... | validate a field tag.
@internal
@param string $tag The MARC spec as string field tag
@throws InvalidMARCspecException
@return true if string is a valid field tag | [
"validate",
"a",
"field",
"tag",
"."
] | 853d77ad3d510ce05c33535bfa3f1068dccdeef6 | https://github.com/MARCspec/php-marc-spec/blob/853d77ad3d510ce05c33535bfa3f1068dccdeef6/src/Field.php#L145-L156 |
196,072 | Aviogram/Common | src/PHPClass/ClassFile.php | ClassFile.addMethod | public function addMethod($name, $overrideOnDefined = false)
{
if ($this->methods->offsetExists($name) === true) {
if ($overrideOnDefined === false) {
throw Exception\ClassFile::methodAlreadyDefined($this->className, $name);
}
$this->methods->offsetUnset(... | php | public function addMethod($name, $overrideOnDefined = false)
{
if ($this->methods->offsetExists($name) === true) {
if ($overrideOnDefined === false) {
throw Exception\ClassFile::methodAlreadyDefined($this->className, $name);
}
$this->methods->offsetUnset(... | [
"public",
"function",
"addMethod",
"(",
"$",
"name",
",",
"$",
"overrideOnDefined",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"methods",
"->",
"offsetExists",
"(",
"$",
"name",
")",
"===",
"true",
")",
"{",
"if",
"(",
"$",
"overrideOnDefine... | Create a new class method
@param string $name
@param bool $overrideOnDefined
@return Element\Method
@throws Exception\ClassFile When the method is already defined and $overrideOnDefined = false | [
"Create",
"a",
"new",
"class",
"method"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/PHPClass/ClassFile.php#L206-L224 |
196,073 | Aviogram/Common | src/PHPClass/ClassFile.php | ClassFile.addConstant | public function addConstant($name, $value, $overrideOnDefined = false)
{
if ($this->classConstants->offsetExists($name) === true) {
if ($overrideOnDefined === false) {
throw Exception\ClassFile::constantAlreadyDefined($this->className, $name);
}
$this->cl... | php | public function addConstant($name, $value, $overrideOnDefined = false)
{
if ($this->classConstants->offsetExists($name) === true) {
if ($overrideOnDefined === false) {
throw Exception\ClassFile::constantAlreadyDefined($this->className, $name);
}
$this->cl... | [
"public",
"function",
"addConstant",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"overrideOnDefined",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"classConstants",
"->",
"offsetExists",
"(",
"$",
"name",
")",
"===",
"true",
")",
"{",
"if",... | Add a new class constant
@param string $name
@param string $value
@param bool $overrideOnDefined
@return Element\ClassConstant
@throws Exception\ClassFile | [
"Add",
"a",
"new",
"class",
"constant"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/PHPClass/ClassFile.php#L267-L288 |
196,074 | Aviogram/Common | src/PHPClass/ClassFile.php | ClassFile.addTrait | public function addTrait($trait)
{
if ($this->isTraitDefined($trait) === false) {
throw Exception\Type::isNotDefined($trait);
}
$trait = new Element\ClassTrait($this, $trait);
$this->classTraits->append($trait);
return $trait;
} | php | public function addTrait($trait)
{
if ($this->isTraitDefined($trait) === false) {
throw Exception\Type::isNotDefined($trait);
}
$trait = new Element\ClassTrait($this, $trait);
$this->classTraits->append($trait);
return $trait;
} | [
"public",
"function",
"addTrait",
"(",
"$",
"trait",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isTraitDefined",
"(",
"$",
"trait",
")",
"===",
"false",
")",
"{",
"throw",
"Exception",
"\\",
"Type",
"::",
"isNotDefined",
"(",
"$",
"trait",
")",
";",
"}... | Create a new trait
@param $trait
@return Element\ClassTrait
@throws Exception\ClassFile | [
"Create",
"a",
"new",
"trait"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/PHPClass/ClassFile.php#L298-L308 |
196,075 | Aviogram/Common | src/PHPClass/ClassFile.php | ClassFile.createSetter | public function createSetter($name, $type = self::PHP_TYPE_MIXED, $default = null)
{
return $this->internalCreateGetterAndOrSetter($name, $type, $default, true, false);
} | php | public function createSetter($name, $type = self::PHP_TYPE_MIXED, $default = null)
{
return $this->internalCreateGetterAndOrSetter($name, $type, $default, true, false);
} | [
"public",
"function",
"createSetter",
"(",
"$",
"name",
",",
"$",
"type",
"=",
"self",
"::",
"PHP_TYPE_MIXED",
",",
"$",
"default",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"internalCreateGetterAndOrSetter",
"(",
"$",
"name",
",",
"$",
"type",
... | Create property and setter method for the given name
@param string $name The name of the property
@param string $type The type of the property see (self::PHP_TYPE_* or use class string)
@param null $default The default value of the property. For strings use ''
@return $this | [
"Create",
"property",
"and",
"setter",
"method",
"for",
"the",
"given",
"name"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/PHPClass/ClassFile.php#L319-L322 |
196,076 | nails/module-blog | admin/controllers/Blog.php | Blog.index | public function index()
{
$this->data['page']->title = 'Manage Blogs';
// --------------------------------------------------------------------------
// Get blogs
$this->data['blogs'] = $this->blog_model->getAll();
if (empty($this->data['blogs'])) {
if (!userH... | php | public function index()
{
$this->data['page']->title = 'Manage Blogs';
// --------------------------------------------------------------------------
// Get blogs
$this->data['blogs'] = $this->blog_model->getAll();
if (empty($this->data['blogs'])) {
if (!userH... | [
"public",
"function",
"index",
"(",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'page'",
"]",
"->",
"title",
"=",
"'Manage Blogs'",
";",
"// --------------------------------------------------------------------------",
"// Get blogs",
"$",
"this",
"->",
"data",
"[",
... | Browse existing blogs
@return void | [
"Browse",
"existing",
"blogs"
] | 7b369c5209f4343fff7c7e2a22c237d5a95c8c24 | https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/admin/controllers/Blog.php#L97-L133 |
196,077 | nails/module-blog | admin/controllers/Blog.php | Blog.edit | public function edit()
{
if (!userHasPermission('admin:blog:blog:edit')) {
unauthorised();
}
// --------------------------------------------------------------------------
$this->data['blog'] = $this->blog_model->getById($this->uri->segment(5));
if (empty($this... | php | public function edit()
{
if (!userHasPermission('admin:blog:blog:edit')) {
unauthorised();
}
// --------------------------------------------------------------------------
$this->data['blog'] = $this->blog_model->getById($this->uri->segment(5));
if (empty($this... | [
"public",
"function",
"edit",
"(",
")",
"{",
"if",
"(",
"!",
"userHasPermission",
"(",
"'admin:blog:blog:edit'",
")",
")",
"{",
"unauthorised",
"(",
")",
";",
"}",
"// --------------------------------------------------------------------------",
"$",
"this",
"->",
"dat... | Edit an existing blog
@return void | [
"Edit",
"an",
"existing",
"blog"
] | 7b369c5209f4343fff7c7e2a22c237d5a95c8c24 | https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/admin/controllers/Blog.php#L202-L261 |
196,078 | nails/module-blog | admin/controllers/Blog.php | Blog.delete | public function delete()
{
if (!userHasPermission('admin:blog:blog:delete')) {
unauthorised();
}
// --------------------------------------------------------------------------
$blog = $this->blog_model->getById($this->uri->segment(5));
if (empty($blog)) {
... | php | public function delete()
{
if (!userHasPermission('admin:blog:blog:delete')) {
unauthorised();
}
// --------------------------------------------------------------------------
$blog = $this->blog_model->getById($this->uri->segment(5));
if (empty($blog)) {
... | [
"public",
"function",
"delete",
"(",
")",
"{",
"if",
"(",
"!",
"userHasPermission",
"(",
"'admin:blog:blog:delete'",
")",
")",
"{",
"unauthorised",
"(",
")",
";",
"}",
"// --------------------------------------------------------------------------",
"$",
"blog",
"=",
"... | Delete an existing blog
@return void | [
"Delete",
"an",
"existing",
"blog"
] | 7b369c5209f4343fff7c7e2a22c237d5a95c8c24 | https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/admin/controllers/Blog.php#L269-L298 |
196,079 | rzajac/phptools | src/Api/HttpCodes.php | HttpCodes.mayHaveBody | public static function mayHaveBody($code)
{
return
// True if not in 100s
($code < self::HTTP_CONTINUE || $code >= self::HTTP_OK)
&& // and not 204 NO CONTENT
$code != self::HTTP_NO_CONTENT
&& // and not 304 NOT MODIFIED
$code != ... | php | public static function mayHaveBody($code)
{
return
// True if not in 100s
($code < self::HTTP_CONTINUE || $code >= self::HTTP_OK)
&& // and not 204 NO CONTENT
$code != self::HTTP_NO_CONTENT
&& // and not 304 NOT MODIFIED
$code != ... | [
"public",
"static",
"function",
"mayHaveBody",
"(",
"$",
"code",
")",
"{",
"return",
"// True if not in 100s",
"(",
"$",
"code",
"<",
"self",
"::",
"HTTP_CONTINUE",
"||",
"$",
"code",
">=",
"self",
"::",
"HTTP_OK",
")",
"&&",
"// and not 204 NO CONTENT",
"$",
... | Returns true for HTTP response codes that may have body.
@param int $code The HTTP response code
@return bool | [
"Returns",
"true",
"for",
"HTTP",
"response",
"codes",
"that",
"may",
"have",
"body",
"."
] | 3cbece7645942d244603c14ba897d8a676ee3088 | https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Api/HttpCodes.php#L205-L220 |
196,080 | RichardTrujilloTorres/validators | src/Validators/Types/Type.php | Type.isValid | public function isValid(array $values)
{
foreach ($values as $value) {
if (!$this->checkType($value)) {
return false;
}
}
return true;
} | php | public function isValid(array $values)
{
foreach ($values as $value) {
if (!$this->checkType($value)) {
return false;
}
}
return true;
} | [
"public",
"function",
"isValid",
"(",
"array",
"$",
"values",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"checkType",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"}... | Is the value a valid one?
@param array $values The values to be checked
@return bool | [
"Is",
"the",
"value",
"a",
"valid",
"one?"
] | e29ff479d816c3f8a931bfbefedd0642dc50ea91 | https://github.com/RichardTrujilloTorres/validators/blob/e29ff479d816c3f8a931bfbefedd0642dc50ea91/src/Validators/Types/Type.php#L46-L55 |
196,081 | RichardTrujilloTorres/validators | src/Validators/Types/Type.php | Type.setValue | protected function setValue($value)
{
if (!isset($this->value) || null === $this->value) {
$this->value = $value;
}
return $this;
} | php | protected function setValue($value)
{
if (!isset($this->value) || null === $this->value) {
$this->value = $value;
}
return $this;
} | [
"protected",
"function",
"setValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"value",
")",
"||",
"null",
"===",
"$",
"this",
"->",
"value",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"$",
"value",
";",
"}",
... | Sets the value of value.
@param mixed $value the value
@return self | [
"Sets",
"the",
"value",
"of",
"value",
"."
] | e29ff479d816c3f8a931bfbefedd0642dc50ea91 | https://github.com/RichardTrujilloTorres/validators/blob/e29ff479d816c3f8a931bfbefedd0642dc50ea91/src/Validators/Types/Type.php#L74-L81 |
196,082 | RichardTrujilloTorres/validators | src/Validators/Types/Type.php | Type.setValid | protected function setValid($valid)
{
if (!isset($this->valid) || true === $this->valid) {
$this->valid = $valid;
}
return $this;
} | php | protected function setValid($valid)
{
if (!isset($this->valid) || true === $this->valid) {
$this->valid = $valid;
}
return $this;
} | [
"protected",
"function",
"setValid",
"(",
"$",
"valid",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"valid",
")",
"||",
"true",
"===",
"$",
"this",
"->",
"valid",
")",
"{",
"$",
"this",
"->",
"valid",
"=",
"$",
"valid",
";",
"}",
... | Sets the value of valid.
@param mixed $valid the valid
@return self | [
"Sets",
"the",
"value",
"of",
"valid",
"."
] | e29ff479d816c3f8a931bfbefedd0642dc50ea91 | https://github.com/RichardTrujilloTorres/validators/blob/e29ff479d816c3f8a931bfbefedd0642dc50ea91/src/Validators/Types/Type.php#L124-L131 |
196,083 | shrink0r/php-schema | src/Property/FqcnProperty.php | FqcnProperty.validate | public function validate($value)
{
return class_exists($value) || interface_exists($value) ? Ok::unit() : Error::unit([ Error::CLASS_NOT_EXISTS ]);
} | php | public function validate($value)
{
return class_exists($value) || interface_exists($value) ? Ok::unit() : Error::unit([ Error::CLASS_NOT_EXISTS ]);
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"return",
"class_exists",
"(",
"$",
"value",
")",
"||",
"interface_exists",
"(",
"$",
"value",
")",
"?",
"Ok",
"::",
"unit",
"(",
")",
":",
"Error",
"::",
"unit",
"(",
"[",
"Error",
"::",... | Tells if a given value is a fully qualified class name of an existing php class.
@param mixed $value
@return ResultInterface Returns Ok if the value is valid, otherwise an Error is returned. | [
"Tells",
"if",
"a",
"given",
"value",
"is",
"a",
"fully",
"qualified",
"class",
"name",
"of",
"an",
"existing",
"php",
"class",
"."
] | 94293fe897af376dd9d05962e2c516079409dd29 | https://github.com/shrink0r/php-schema/blob/94293fe897af376dd9d05962e2c516079409dd29/src/Property/FqcnProperty.php#L18-L21 |
196,084 | rawphp/RawBase | lib/Component.php | Component.init | public function init( $config = NULL )
{
$this->config = $config;
if ( isset( $config[ 'debug' ] ) )
{
$this->debug = $config[ 'debug' ];
}
$this->log = $this->filter( self::ON_SET_LOG_FILTER, NULL );
$this->doAction( self::ON_COMPONENT_INIT_ACTION );
... | php | public function init( $config = NULL )
{
$this->config = $config;
if ( isset( $config[ 'debug' ] ) )
{
$this->debug = $config[ 'debug' ];
}
$this->log = $this->filter( self::ON_SET_LOG_FILTER, NULL );
$this->doAction( self::ON_COMPONENT_INIT_ACTION );
... | [
"public",
"function",
"init",
"(",
"$",
"config",
"=",
"NULL",
")",
"{",
"$",
"this",
"->",
"config",
"=",
"$",
"config",
";",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'debug'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"debug",
"=",
"$",
"co... | Initialises the component.
NOTE: All components SHOULD call <code>init()</code>, even without
passing a value.
@param array $config configuration array
@filter ON_SET_LOG_FILTER(1)
@action ON_COMPONENT_INIT_ACTION | [
"Initialises",
"the",
"component",
"."
] | 509843f6338bbd8323b685d0ed5e80717a54c2ff | https://github.com/rawphp/RawBase/blob/509843f6338bbd8323b685d0ed5e80717a54c2ff/lib/Component.php#L112-L124 |
196,085 | rawphp/RawBase | lib/Component.php | Component.addAction | public function addAction( $action, $callback, $priority = 10 )
{
if ( !isset( $this->actions[ $action ] ) )
{
$this->actions[ $action ] = array();
}
$this->actions[ $action ][] = array(
'priority' => $priority,
'callback' => $callback,
);... | php | public function addAction( $action, $callback, $priority = 10 )
{
if ( !isset( $this->actions[ $action ] ) )
{
$this->actions[ $action ] = array();
}
$this->actions[ $action ][] = array(
'priority' => $priority,
'callback' => $callback,
);... | [
"public",
"function",
"addAction",
"(",
"$",
"action",
",",
"$",
"callback",
",",
"$",
"priority",
"=",
"10",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"actions",
"[",
"$",
"action",
"]",
")",
")",
"{",
"$",
"this",
"->",
"action... | Add a callback to execute on an action.
@param string $action the action name
@param mixed $callback the callback [ function name, array ]
@param int $priority the callback priority | [
"Add",
"a",
"callback",
"to",
"execute",
"on",
"an",
"action",
"."
] | 509843f6338bbd8323b685d0ed5e80717a54c2ff | https://github.com/rawphp/RawBase/blob/509843f6338bbd8323b685d0ed5e80717a54c2ff/lib/Component.php#L133-L157 |
196,086 | rawphp/RawBase | lib/Component.php | Component.removeAction | public function removeAction( $action, $callback )
{
$i = 0;
foreach( $this->actions as $key => $value )
{
if ( $action === $key )
{
foreach( $value as $a => $call )
{
if ( get_class( $callback[ 0 ] ) === get_class(... | php | public function removeAction( $action, $callback )
{
$i = 0;
foreach( $this->actions as $key => $value )
{
if ( $action === $key )
{
foreach( $value as $a => $call )
{
if ( get_class( $callback[ 0 ] ) === get_class(... | [
"public",
"function",
"removeAction",
"(",
"$",
"action",
",",
"$",
"callback",
")",
"{",
"$",
"i",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"actions",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"action",
"===",
"$",... | Removes a callback for an action.
@param string $action the action name
@param mixed $callback the callback [ function name, array ]
@return bool TRUE on success, FALSE on failure | [
"Removes",
"a",
"callback",
"for",
"an",
"action",
"."
] | 509843f6338bbd8323b685d0ed5e80717a54c2ff | https://github.com/rawphp/RawBase/blob/509843f6338bbd8323b685d0ed5e80717a54c2ff/lib/Component.php#L167-L201 |
196,087 | rawphp/RawBase | lib/Component.php | Component.doAction | public function doAction( $action, $params = array() )
{
if ( isset( $this->actions[ $action ] ) )
{
foreach( $this->actions[ $action ] as $callback )
{
call_user_func_array( $callback[ 'callback' ], $params );
if ( $this->debug )
... | php | public function doAction( $action, $params = array() )
{
if ( isset( $this->actions[ $action ] ) )
{
foreach( $this->actions[ $action ] as $callback )
{
call_user_func_array( $callback[ 'callback' ], $params );
if ( $this->debug )
... | [
"public",
"function",
"doAction",
"(",
"$",
"action",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"actions",
"[",
"$",
"action",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"actions... | Executes callbacks for an action.
@param string $action action name
@param array $params callback parameters | [
"Executes",
"callbacks",
"for",
"an",
"action",
"."
] | 509843f6338bbd8323b685d0ed5e80717a54c2ff | https://github.com/rawphp/RawBase/blob/509843f6338bbd8323b685d0ed5e80717a54c2ff/lib/Component.php#L209-L226 |
196,088 | rawphp/RawBase | lib/Component.php | Component.addFilter | public function addFilter( $filter, $callback, $priority = 10 )
{
if ( !isset( $this->filters[ $filter ] ) )
{
$this->filters[ $filter ] = array();
}
$this->filters[ $filter ][] = array(
'priority' => $priority,
'callback' => $callback,
);... | php | public function addFilter( $filter, $callback, $priority = 10 )
{
if ( !isset( $this->filters[ $filter ] ) )
{
$this->filters[ $filter ] = array();
}
$this->filters[ $filter ][] = array(
'priority' => $priority,
'callback' => $callback,
);... | [
"public",
"function",
"addFilter",
"(",
"$",
"filter",
",",
"$",
"callback",
",",
"$",
"priority",
"=",
"10",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"filters",
"[",
"$",
"filter",
"]",
")",
")",
"{",
"$",
"this",
"->",
"filter... | Add a callback to execute to filter content.
@param string $filter the filter name
@param mixed $callback the callback [ function name, array ]
@param int $priority the callback priority | [
"Add",
"a",
"callback",
"to",
"execute",
"to",
"filter",
"content",
"."
] | 509843f6338bbd8323b685d0ed5e80717a54c2ff | https://github.com/rawphp/RawBase/blob/509843f6338bbd8323b685d0ed5e80717a54c2ff/lib/Component.php#L235-L258 |
196,089 | rawphp/RawBase | lib/Component.php | Component.removeFilter | public function removeFilter( $filter, $callback )
{
$i = 0;
foreach( $this->filters as $key => $value )
{
if ( $filter === $key )
{
foreach( $value as $f => $call )
{
if ( get_class( $callback[ 0 ] ) === get_class(... | php | public function removeFilter( $filter, $callback )
{
$i = 0;
foreach( $this->filters as $key => $value )
{
if ( $filter === $key )
{
foreach( $value as $f => $call )
{
if ( get_class( $callback[ 0 ] ) === get_class(... | [
"public",
"function",
"removeFilter",
"(",
"$",
"filter",
",",
"$",
"callback",
")",
"{",
"$",
"i",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"filters",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"filter",
"===",
"$",... | Removes a callback for a filter.
@param string $filter the filter name
@param mixed $callback the callback [ function name, array ]
@return bool TRUE on success, FALSE on failure | [
"Removes",
"a",
"callback",
"for",
"a",
"filter",
"."
] | 509843f6338bbd8323b685d0ed5e80717a54c2ff | https://github.com/rawphp/RawBase/blob/509843f6338bbd8323b685d0ed5e80717a54c2ff/lib/Component.php#L268-L302 |
196,090 | rawphp/RawBase | lib/Component.php | Component.filter | public function filter( $filter, $params )
{
$argList = func_get_args( );
array_shift( $argList );
if ( isset( $this->filters[ $filter ] ) )
{
foreach( $this->filters[ $filter ] as $callback )
{
$argList[ 0 ] = call_user_func_array( $callback... | php | public function filter( $filter, $params )
{
$argList = func_get_args( );
array_shift( $argList );
if ( isset( $this->filters[ $filter ] ) )
{
foreach( $this->filters[ $filter ] as $callback )
{
$argList[ 0 ] = call_user_func_array( $callback... | [
"public",
"function",
"filter",
"(",
"$",
"filter",
",",
"$",
"params",
")",
"{",
"$",
"argList",
"=",
"func_get_args",
"(",
")",
";",
"array_shift",
"(",
"$",
"argList",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"filters",
"[",
"$",
"f... | Executes callbacks for a filter and returns the result.
@param string $filter filter name
@param mixed $params callback
@return mixed the filtered content | [
"Executes",
"callbacks",
"for",
"a",
"filter",
"and",
"returns",
"the",
"result",
"."
] | 509843f6338bbd8323b685d0ed5e80717a54c2ff | https://github.com/rawphp/RawBase/blob/509843f6338bbd8323b685d0ed5e80717a54c2ff/lib/Component.php#L312-L335 |
196,091 | rawphp/RawBase | lib/Component.php | Component.validIndex | public static function validIndex( $index, $value )
{
if ( is_array( $value ) )
{
return ( count( $value ) > $index && $index >= 0 );
}
elseif ( is_string( $value ) )
{
return ( strlen( $value ) > $index && $index >= 0 );
}
return FALS... | php | public static function validIndex( $index, $value )
{
if ( is_array( $value ) )
{
return ( count( $value ) > $index && $index >= 0 );
}
elseif ( is_string( $value ) )
{
return ( strlen( $value ) > $index && $index >= 0 );
}
return FALS... | [
"public",
"static",
"function",
"validIndex",
"(",
"$",
"index",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"return",
"(",
"count",
"(",
"$",
"value",
")",
">",
"$",
"index",
"&&",
"$",
"index",
">=",
"0... | Checks whether the value index position is valid.
Returns FALSE if an object or resource is passed in.
@param int $index the array position to check
@param mixed $value array or string
@return bool TRUE if valid index, else FALSE | [
"Checks",
"whether",
"the",
"value",
"index",
"position",
"is",
"valid",
"."
] | 509843f6338bbd8323b685d0ed5e80717a54c2ff | https://github.com/rawphp/RawBase/blob/509843f6338bbd8323b685d0ed5e80717a54c2ff/lib/Component.php#L369-L381 |
196,092 | rawphp/RawBase | lib/Component.php | Component._serializeCallback | private function _serializeCallback( $callback )
{
$retVal = $callback;
if ( is_array( $callback ) && 2 === count( $callback ) )
{
$retVal = get_class( $callback[ 0 ] ) . '/' . $callback[ 1 ];
}
return $retVal;
} | php | private function _serializeCallback( $callback )
{
$retVal = $callback;
if ( is_array( $callback ) && 2 === count( $callback ) )
{
$retVal = get_class( $callback[ 0 ] ) . '/' . $callback[ 1 ];
}
return $retVal;
} | [
"private",
"function",
"_serializeCallback",
"(",
"$",
"callback",
")",
"{",
"$",
"retVal",
"=",
"$",
"callback",
";",
"if",
"(",
"is_array",
"(",
"$",
"callback",
")",
"&&",
"2",
"===",
"count",
"(",
"$",
"callback",
")",
")",
"{",
"$",
"retVal",
"=... | Helper method to serialize a callback.
@param mixed $callback the callback string or array
@return string the serialized callback | [
"Helper",
"method",
"to",
"serialize",
"a",
"callback",
"."
] | 509843f6338bbd8323b685d0ed5e80717a54c2ff | https://github.com/rawphp/RawBase/blob/509843f6338bbd8323b685d0ed5e80717a54c2ff/lib/Component.php#L390-L400 |
196,093 | phpffcms/ffcms-core | src/Helper/FileSystem/File.php | File.read | public static function read($path)
{
$path = Normalize::diskFullPath($path);
if (!self::exist($path)) {
return false;
}
return @file_get_contents($path);
} | php | public static function read($path)
{
$path = Normalize::diskFullPath($path);
if (!self::exist($path)) {
return false;
}
return @file_get_contents($path);
} | [
"public",
"static",
"function",
"read",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"Normalize",
"::",
"diskFullPath",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"self",
"::",
"exist",
"(",
"$",
"path",
")",
")",
"{",
"return",
"false",
";",
"... | Read file content from local storage
@param $path
@return bool|string | [
"Read",
"file",
"content",
"from",
"local",
"storage"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/FileSystem/File.php#L20-L29 |
196,094 | phpffcms/ffcms-core | src/Helper/FileSystem/File.php | File.executable | public static function executable($path)
{
$path = Normalize::diskFullPath($path);
if (!self::exist($path)) {
return false;
}
return is_executable($path);
} | php | public static function executable($path)
{
$path = Normalize::diskFullPath($path);
if (!self::exist($path)) {
return false;
}
return is_executable($path);
} | [
"public",
"static",
"function",
"executable",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"Normalize",
"::",
"diskFullPath",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"self",
"::",
"exist",
"(",
"$",
"path",
")",
")",
"{",
"return",
"false",
";... | Check is file executable
@param string $path
@return bool | [
"Check",
"is",
"file",
"executable"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/FileSystem/File.php#L73-L82 |
196,095 | phpffcms/ffcms-core | src/Helper/FileSystem/File.php | File.copy | public static function copy($source, $target)
{
$source = Normalize::diskFullPath($source);
$target = Normalize::diskFullPath($target);
// check if target directory exist & create new if not
$targetArray = explode(DIRECTORY_SEPARATOR, $target);
array_pop($targetArray);
... | php | public static function copy($source, $target)
{
$source = Normalize::diskFullPath($source);
$target = Normalize::diskFullPath($target);
// check if target directory exist & create new if not
$targetArray = explode(DIRECTORY_SEPARATOR, $target);
array_pop($targetArray);
... | [
"public",
"static",
"function",
"copy",
"(",
"$",
"source",
",",
"$",
"target",
")",
"{",
"$",
"source",
"=",
"Normalize",
"::",
"diskFullPath",
"(",
"$",
"source",
")",
";",
"$",
"target",
"=",
"Normalize",
"::",
"diskFullPath",
"(",
"$",
"target",
")... | Copy file from source to target destination
@param string $source
@param string $target
@return bool | [
"Copy",
"file",
"from",
"source",
"to",
"target",
"destination"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/FileSystem/File.php#L111-L125 |
196,096 | phpffcms/ffcms-core | src/Helper/FileSystem/File.php | File.inc | public static function inc($path, $return = false, $once = false)
{
$path = Normalize::diskFullPath($path);
if (!self::exist($path)) {
return false;
}
if ($return) {
return $once === true ? require_once($path) : require $path;
} else {
($... | php | public static function inc($path, $return = false, $once = false)
{
$path = Normalize::diskFullPath($path);
if (!self::exist($path)) {
return false;
}
if ($return) {
return $once === true ? require_once($path) : require $path;
} else {
($... | [
"public",
"static",
"function",
"inc",
"(",
"$",
"path",
",",
"$",
"return",
"=",
"false",
",",
"$",
"once",
"=",
"false",
")",
"{",
"$",
"path",
"=",
"Normalize",
"::",
"diskFullPath",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"self",
"::",
"e... | Alternative of functions include, require, include_once and etc in 1 function
@param string $path
@param bool|false $return
@param bool|false $once
@return bool|mixed | [
"Alternative",
"of",
"functions",
"include",
"require",
"include_once",
"and",
"etc",
"in",
"1",
"function"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/FileSystem/File.php#L150-L163 |
196,097 | phpffcms/ffcms-core | src/Helper/FileSystem/File.php | File.mTime | public static function mTime($path)
{
$path = Normalize::diskFullPath($path);
if (!self::exist($path)) {
return 0;
}
return filemtime($path);
} | php | public static function mTime($path)
{
$path = Normalize::diskFullPath($path);
if (!self::exist($path)) {
return 0;
}
return filemtime($path);
} | [
"public",
"static",
"function",
"mTime",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"Normalize",
"::",
"diskFullPath",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"self",
"::",
"exist",
"(",
"$",
"path",
")",
")",
"{",
"return",
"0",
";",
"}",... | Get file make time in unix timestamp
@param string $path
@return int | [
"Get",
"file",
"make",
"time",
"in",
"unix",
"timestamp"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/FileSystem/File.php#L170-L178 |
196,098 | phpffcms/ffcms-core | src/Helper/FileSystem/File.php | File.getMd5 | public static function getMd5($path)
{
$path = Normalize::diskFullPath($path);
if (!self::exist($path)) {
return false;
}
return md5_file($path);
} | php | public static function getMd5($path)
{
$path = Normalize::diskFullPath($path);
if (!self::exist($path)) {
return false;
}
return md5_file($path);
} | [
"public",
"static",
"function",
"getMd5",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"Normalize",
"::",
"diskFullPath",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"self",
"::",
"exist",
"(",
"$",
"path",
")",
")",
"{",
"return",
"false",
";",
... | Get file md5 hash
@param string $path
@return bool|string | [
"Get",
"file",
"md5",
"hash"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/FileSystem/File.php#L238-L247 |
196,099 | prolic/HumusMvc | src/HumusMvc/View/HelperPluginManager.php | HelperPluginManager.injectView | public function injectView($helper)
{
$view = $this->getView();
if (null === $view) {
return;
}
$helper->setView($view);
} | php | public function injectView($helper)
{
$view = $this->getView();
if (null === $view) {
return;
}
$helper->setView($view);
} | [
"public",
"function",
"injectView",
"(",
"$",
"helper",
")",
"{",
"$",
"view",
"=",
"$",
"this",
"->",
"getView",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"view",
")",
"{",
"return",
";",
"}",
"$",
"helper",
"->",
"setView",
"(",
"$",
"view"... | Inject a helper instance with the registered view
@param $helper fix issue: Removed ViewHelperInterface cause not every helper implement it (Look at PaginationControl).
Let validatePlugin do the work for us.
@return void | [
"Inject",
"a",
"helper",
"instance",
"with",
"the",
"registered",
"view"
] | 09e8c6422d84b57745cc643047e10761be2a21a7 | https://github.com/prolic/HumusMvc/blob/09e8c6422d84b57745cc643047e10761be2a21a7/src/HumusMvc/View/HelperPluginManager.php#L157-L164 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.