repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
markwatkinson/luminous | src/Luminous/Scanners/PythonScanner.php | PythonScanner.importLine | private function importLine()
{
$import = false;
$from = false;
while (!$this->eol()) {
$c = $this->peek();
$tok = null;
$m = null;
if ($c === '\\') {
$m = $this->get(2);
} elseif ($this->scan('/[,\\.;\\*]+/')) {
... | php | private function importLine()
{
$import = false;
$from = false;
while (!$this->eol()) {
$c = $this->peek();
$tok = null;
$m = null;
if ($c === '\\') {
$m = $this->get(2);
} elseif ($this->scan('/[,\\.;\\*]+/')) {
... | [
"private",
"function",
"importLine",
"(",
")",
"{",
"$",
"import",
"=",
"false",
";",
"$",
"from",
"=",
"false",
";",
"while",
"(",
"!",
"$",
"this",
"->",
"eol",
"(",
")",
")",
"{",
"$",
"c",
"=",
"$",
"this",
"->",
"peek",
"(",
")",
";",
"$... | mini-scanner to handle highlighting module names in import lines | [
"mini",
"-",
"scanner",
"to",
"handle",
"highlighting",
"module",
"names",
"in",
"import",
"lines"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/PythonScanner.php#L296-L334 |
mimmi20/Wurfl | src/Handlers/WebOSHandler.php | WebOSHandler.applyConclusiveMatch | public function applyConclusiveMatch($userAgent)
{
$delimiterIndex = strpos($userAgent, WurflConstants::RIS_DELIMITER);
if ($delimiterIndex !== false) {
$tolerance = $delimiterIndex + strlen(WurflConstants::RIS_DELIMITER);
return $this->getDeviceIDFromRIS($userAgent, $toler... | php | public function applyConclusiveMatch($userAgent)
{
$delimiterIndex = strpos($userAgent, WurflConstants::RIS_DELIMITER);
if ($delimiterIndex !== false) {
$tolerance = $delimiterIndex + strlen(WurflConstants::RIS_DELIMITER);
return $this->getDeviceIDFromRIS($userAgent, $toler... | [
"public",
"function",
"applyConclusiveMatch",
"(",
"$",
"userAgent",
")",
"{",
"$",
"delimiterIndex",
"=",
"strpos",
"(",
"$",
"userAgent",
",",
"WurflConstants",
"::",
"RIS_DELIMITER",
")",
";",
"if",
"(",
"$",
"delimiterIndex",
"!==",
"false",
")",
"{",
"$... | @param string $userAgent
@return null|string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/WebOSHandler.php#L60-L71 |
jclaveau/phpunit-profile-asserts | src/Framework/Constraint/MemoryUsageBelow.php | MemoryUsageBelow.bytesToInt | public static function bytesToInt($byteString)
{
if (is_numeric($byteString)) {
return $byteString;
}
elseif (is_string($byteString) && preg_match('/^\s*([0-9.]+)\s*([KMGTPE])B?\s*$/i', $byteString, $matches)) {
$number = (float) $matches[1];
$index = str... | php | public static function bytesToInt($byteString)
{
if (is_numeric($byteString)) {
return $byteString;
}
elseif (is_string($byteString) && preg_match('/^\s*([0-9.]+)\s*([KMGTPE])B?\s*$/i', $byteString, $matches)) {
$number = (float) $matches[1];
$index = str... | [
"public",
"static",
"function",
"bytesToInt",
"(",
"$",
"byteString",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"byteString",
")",
")",
"{",
"return",
"$",
"byteString",
";",
"}",
"elseif",
"(",
"is_string",
"(",
"$",
"byteString",
")",
"&&",
"preg_ma... | @param decimal|string
@return int
@throws \InvalidArgumentException | [
"@param",
"decimal|string",
"@return",
"int"
] | train | https://github.com/jclaveau/phpunit-profile-asserts/blob/e3261b44f446cfcdaef8550700fc4e01549a40e6/src/Framework/Constraint/MemoryUsageBelow.php#L65-L85 |
liip/LiipDrupalConnectorModule | src/Liip/Drupal/Modules/DrupalConnector/Filter.php | Filter.check_markup | public function check_markup($text, $format_id = null, $langcode = '', $cache = FALSE)
{
return check_markup($text, $format_id, $langcode, $cache);
} | php | public function check_markup($text, $format_id = null, $langcode = '', $cache = FALSE)
{
return check_markup($text, $format_id, $langcode, $cache);
} | [
"public",
"function",
"check_markup",
"(",
"$",
"text",
",",
"$",
"format_id",
"=",
"null",
",",
"$",
"langcode",
"=",
"''",
",",
"$",
"cache",
"=",
"FALSE",
")",
"{",
"return",
"check_markup",
"(",
"$",
"text",
",",
"$",
"format_id",
",",
"$",
"lang... | Run all the enabled filters on a piece of text.
Note: Because filters can inject JavaScript or execute PHP code, security is
vital here. When a user supplies a text format, you should validate it using
filter_access() before accepting/using it. This is normally done in the
validation stage of the Form API. You should ... | [
"Run",
"all",
"the",
"enabled",
"filters",
"on",
"a",
"piece",
"of",
"text",
"."
] | train | https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Filter.php#L319-L322 |
liip/LiipDrupalConnectorModule | src/Liip/Drupal/Modules/DrupalConnector/Filter.php | Filter.filter_dom_serialize_escape_cdata_element | public function filter_dom_serialize_escape_cdata_element($dom_document, $dom_element, $comment_start = '//', $comment_end = '')
{
return filter_dom_serialize_escape_cdata_element($dom_document, $dom_element, $comment_start, $comment_end);
} | php | public function filter_dom_serialize_escape_cdata_element($dom_document, $dom_element, $comment_start = '//', $comment_end = '')
{
return filter_dom_serialize_escape_cdata_element($dom_document, $dom_element, $comment_start, $comment_end);
} | [
"public",
"function",
"filter_dom_serialize_escape_cdata_element",
"(",
"$",
"dom_document",
",",
"$",
"dom_element",
",",
"$",
"comment_start",
"=",
"'//'",
",",
"$",
"comment_end",
"=",
"''",
")",
"{",
"return",
"filter_dom_serialize_escape_cdata_element",
"(",
"$",... | Adds comments around the <!CDATA section in a dom element.
DOMDocument::loadHTML in filter_dom_load() makes CDATA sections from the
contents of inline script and style tags. This can cause HTML 4 browsers to
throw exceptions.
This function attempts to solve the problem by creating a DocumentFragment
and imitating th... | [
"Adds",
"comments",
"around",
"the",
"<!CDATA",
"section",
"in",
"a",
"dom",
"element",
"."
] | train | https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Filter.php#L462-L465 |
mimmi20/Wurfl | src/Handlers/Normalizer/Generic/UCWEB.php | UCWEB.normalize | public function normalize($userAgent)
{
// Starts with 'JUC' or 'Mozilla/5.0(Linux;U;Android'
if (strpos($userAgent, 'JUC') === 0 || strpos($userAgent, 'Mozilla/5.0(Linux;U;Android') === 0) {
$userAgent = preg_replace('/^(JUC \(Linux; U;)(?= \d)/', '$1 Android', $userAgent);
... | php | public function normalize($userAgent)
{
// Starts with 'JUC' or 'Mozilla/5.0(Linux;U;Android'
if (strpos($userAgent, 'JUC') === 0 || strpos($userAgent, 'Mozilla/5.0(Linux;U;Android') === 0) {
$userAgent = preg_replace('/^(JUC \(Linux; U;)(?= \d)/', '$1 Android', $userAgent);
... | [
"public",
"function",
"normalize",
"(",
"$",
"userAgent",
")",
"{",
"// Starts with 'JUC' or 'Mozilla/5.0(Linux;U;Android'",
"if",
"(",
"strpos",
"(",
"$",
"userAgent",
",",
"'JUC'",
")",
"===",
"0",
"||",
"strpos",
"(",
"$",
"userAgent",
",",
"'Mozilla/5.0(Linux;... | This method remove the 'UP.Link' substring from user agent string.
@param string $userAgent
@return string Normalized user agent | [
"This",
"method",
"remove",
"the",
"UP",
".",
"Link",
"substring",
"from",
"user",
"agent",
"string",
"."
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Normalizer/Generic/UCWEB.php#L35-L44 |
unimapper/unimapper | src/Mapper.php | Mapper.mapValue | public function mapValue(Entity\Reflection\Property $property, $value)
{
// Call adapter's mapping if needed
if (!$property->getReflection()->hasAdapter()) {
throw new Exception\InvalidArgumentException(
"Entity " . $property->getReflection()->getClassName()
... | php | public function mapValue(Entity\Reflection\Property $property, $value)
{
// Call adapter's mapping if needed
if (!$property->getReflection()->hasAdapter()) {
throw new Exception\InvalidArgumentException(
"Entity " . $property->getReflection()->getClassName()
... | [
"public",
"function",
"mapValue",
"(",
"Entity",
"\\",
"Reflection",
"\\",
"Property",
"$",
"property",
",",
"$",
"value",
")",
"{",
"// Call adapter's mapping if needed",
"if",
"(",
"!",
"$",
"property",
"->",
"getReflection",
"(",
")",
"->",
"hasAdapter",
"(... | Convert value to defined property format
@param Entity\Reflection\Property $property
@param mixed $value
@return mixed
@throws Exception\InvalidArgumentException | [
"Convert",
"value",
"to",
"defined",
"property",
"format"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Mapper.php#L35-L138 |
unimapper/unimapper | src/Mapper.php | Mapper.unmapEntity | public function unmapEntity(Entity $entity)
{
$output = [];
foreach ($entity->getData() as $name => $value) {
$property = $entity::getReflection()->getProperty($name);
// Skip associations & readonly & disabled mapping
if ($property->hasOption(Reflection\Propert... | php | public function unmapEntity(Entity $entity)
{
$output = [];
foreach ($entity->getData() as $name => $value) {
$property = $entity::getReflection()->getProperty($name);
// Skip associations & readonly & disabled mapping
if ($property->hasOption(Reflection\Propert... | [
"public",
"function",
"unmapEntity",
"(",
"Entity",
"$",
"entity",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"entity",
"->",
"getData",
"(",
")",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"property",
"=",
"$",
... | Convert entity to simple array
@param Entity $entity
@return array | [
"Convert",
"entity",
"to",
"simple",
"array"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Mapper.php#L210-L229 |
unimapper/unimapper | src/Mapper.php | Mapper.unmapCollection | public function unmapCollection(Entity\Collection $collection)
{
$data = [];
foreach ($collection as $index => $entity) {
$data[$index] = $this->unmapEntity($entity);
}
return $data;
} | php | public function unmapCollection(Entity\Collection $collection)
{
$data = [];
foreach ($collection as $index => $entity) {
$data[$index] = $this->unmapEntity($entity);
}
return $data;
} | [
"public",
"function",
"unmapCollection",
"(",
"Entity",
"\\",
"Collection",
"$",
"collection",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"collection",
"as",
"$",
"index",
"=>",
"$",
"entity",
")",
"{",
"$",
"data",
"[",
"$",
"in... | Convert entity to simple array
@param Entity\Collection $collection
@return array | [
"Convert",
"entity",
"to",
"simple",
"array"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Mapper.php#L278-L285 |
unimapper/unimapper | src/Mapper.php | Mapper.unmapFilter | public function unmapFilter(Reflection $reflection, array $filter)
{
$result = [];
if (Filter::isGroup($filter)) {
foreach ($filter as $modifier => $item) {
$result[$modifier] = $this->unmapFilter($reflection, $item);
}
} else {
foreach ... | php | public function unmapFilter(Reflection $reflection, array $filter)
{
$result = [];
if (Filter::isGroup($filter)) {
foreach ($filter as $modifier => $item) {
$result[$modifier] = $this->unmapFilter($reflection, $item);
}
} else {
foreach ... | [
"public",
"function",
"unmapFilter",
"(",
"Reflection",
"$",
"reflection",
",",
"array",
"$",
"filter",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"if",
"(",
"Filter",
"::",
"isGroup",
"(",
"$",
"filter",
")",
")",
"{",
"foreach",
"(",
"$",
"filter... | @param Reflection $reflection
@param array $filter
@return array | [
"@param",
"Reflection",
"$reflection",
"@param",
"array",
"$filter"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Mapper.php#L293-L336 |
DevGroup-ru/yii2-data-structure-tools | src/propertyStorage/EAV.php | EAV.fillForBackend | private static function fillForBackend($propertyRows, $property, $textAreaHandlerId)
{
$carry = [];
$column = static::dataTypeToEavColumn($property->data_type);
foreach ($propertyRows as $row) {
$value = Property::castValueToDataType($row[$column], $property->data_type);
... | php | private static function fillForBackend($propertyRows, $property, $textAreaHandlerId)
{
$carry = [];
$column = static::dataTypeToEavColumn($property->data_type);
foreach ($propertyRows as $row) {
$value = Property::castValueToDataType($row[$column], $property->data_type);
... | [
"private",
"static",
"function",
"fillForBackend",
"(",
"$",
"propertyRows",
",",
"$",
"property",
",",
"$",
"textAreaHandlerId",
")",
"{",
"$",
"carry",
"=",
"[",
"]",
";",
"$",
"column",
"=",
"static",
"::",
"dataTypeToEavColumn",
"(",
"$",
"property",
"... | @param array $propertyRows
@param Property $property
@param int | false $textAreaHandlerId
@return array | string | [
"@param",
"array",
"$propertyRows",
"@param",
"Property",
"$property",
"@param",
"int",
"|",
"false",
"$textAreaHandlerId"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyStorage/EAV.php#L87-L117 |
DevGroup-ru/yii2-data-structure-tools | src/propertyStorage/EAV.php | EAV.fillForFrontend | private static function fillForFrontend($propertyRows, $property)
{
$carry = '';
$column = static::dataTypeToEavColumn($property->data_type);
foreach ($propertyRows as $row) {
$value = Property::castValueToDataType($row[$column], $property->data_type);
if ($property->... | php | private static function fillForFrontend($propertyRows, $property)
{
$carry = '';
$column = static::dataTypeToEavColumn($property->data_type);
foreach ($propertyRows as $row) {
$value = Property::castValueToDataType($row[$column], $property->data_type);
if ($property->... | [
"private",
"static",
"function",
"fillForFrontend",
"(",
"$",
"propertyRows",
",",
"$",
"property",
")",
"{",
"$",
"carry",
"=",
"''",
";",
"$",
"column",
"=",
"static",
"::",
"dataTypeToEavColumn",
"(",
"$",
"property",
"->",
"data_type",
")",
";",
"forea... | @param array $propertyRows
@param Property $property
@return array|string | [
"@param",
"array",
"$propertyRows",
"@param",
"Property",
"$property"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyStorage/EAV.php#L125-L140 |
DevGroup-ru/yii2-data-structure-tools | src/propertyStorage/EAV.php | EAV.storeValues | public function storeValues(&$models)
{
if (count($models) === 0) {
return true;
}
$insertRows = [];
$deleteRows = [];
/** @var ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $firstModel */
$firstModel = reset($models);
foreach ($model... | php | public function storeValues(&$models)
{
if (count($models) === 0) {
return true;
}
$insertRows = [];
$deleteRows = [];
/** @var ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $firstModel */
$firstModel = reset($models);
foreach ($model... | [
"public",
"function",
"storeValues",
"(",
"&",
"$",
"models",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"models",
")",
"===",
"0",
")",
"{",
"return",
"true",
";",
"}",
"$",
"insertRows",
"=",
"[",
"]",
";",
"$",
"deleteRows",
"=",
"[",
"]",
";",
... | @param ActiveRecord[]|\DevGroup\DataStructure\traits\PropertiesTrait[] $models
@return bool
@throws \Exception
@throws bool | [
"@param",
"ActiveRecord",
"[]",
"|",
"\\",
"DevGroup",
"\\",
"DataStructure",
"\\",
"traits",
"\\",
"PropertiesTrait",
"[]",
"$models"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyStorage/EAV.php#L170-L231 |
DevGroup-ru/yii2-data-structure-tools | src/propertyStorage/EAV.php | EAV.saveModelPropertyRow | private static function saveModelPropertyRow(ActiveRecord $model, Property $propertyModel)
{
$modelId = $model->id;
$propertyId = $propertyModel->id;
$key = $propertyModel->key;
$values = (array) $model->$key;
if (count($values) === 0) {
return [];
}
... | php | private static function saveModelPropertyRow(ActiveRecord $model, Property $propertyModel)
{
$modelId = $model->id;
$propertyId = $propertyModel->id;
$key = $propertyModel->key;
$values = (array) $model->$key;
if (count($values) === 0) {
return [];
}
... | [
"private",
"static",
"function",
"saveModelPropertyRow",
"(",
"ActiveRecord",
"$",
"model",
",",
"Property",
"$",
"propertyModel",
")",
"{",
"$",
"modelId",
"=",
"$",
"model",
"->",
"id",
";",
"$",
"propertyId",
"=",
"$",
"propertyModel",
"->",
"id",
";",
... | @param ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $model
@param Property $propertyModel
@return array | [
"@param",
"ActiveRecord|",
"\\",
"DevGroup",
"\\",
"DataStructure",
"\\",
"traits",
"\\",
"PropertiesTrait",
"$model",
"@param",
"Property",
"$propertyModel"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyStorage/EAV.php#L239-L258 |
DevGroup-ru/yii2-data-structure-tools | src/propertyStorage/EAV.php | EAV.prepareRows | private static function prepareRows($values, $modelId, $propertyId, $valueField, $langId = 0)
{
if (true === empty($values)) {
return [];
}
$rows = [];
foreach ((array) $values as $index => $value) {
if ($value !== 0 && true === empty($value)) {
... | php | private static function prepareRows($values, $modelId, $propertyId, $valueField, $langId = 0)
{
if (true === empty($values)) {
return [];
}
$rows = [];
foreach ((array) $values as $index => $value) {
if ($value !== 0 && true === empty($value)) {
... | [
"private",
"static",
"function",
"prepareRows",
"(",
"$",
"values",
",",
"$",
"modelId",
",",
"$",
"propertyId",
",",
"$",
"valueField",
",",
"$",
"langId",
"=",
"0",
")",
"{",
"if",
"(",
"true",
"===",
"empty",
"(",
"$",
"values",
")",
")",
"{",
"... | @param $values
@param $modelId
@param $propertyId
@param $valueField
@param int $langId
@return array | [
"@param",
"$values",
"@param",
"$modelId",
"@param",
"$propertyId",
"@param",
"$valueField",
"@param",
"int",
"$langId"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyStorage/EAV.php#L269-L291 |
DevGroup-ru/yii2-data-structure-tools | src/propertyStorage/EAV.php | EAV.dataTypeToEavColumn | public static function dataTypeToEavColumn($type)
{
switch ($type) {
case Property::DATA_TYPE_FLOAT:
return 'value_float';
break;
case Property::DATA_TYPE_BOOLEAN:
case Property::DATA_TYPE_INTEGER:
return 'value_integer';
... | php | public static function dataTypeToEavColumn($type)
{
switch ($type) {
case Property::DATA_TYPE_FLOAT:
return 'value_float';
break;
case Property::DATA_TYPE_BOOLEAN:
case Property::DATA_TYPE_INTEGER:
return 'value_integer';
... | [
"public",
"static",
"function",
"dataTypeToEavColumn",
"(",
"$",
"type",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"Property",
"::",
"DATA_TYPE_FLOAT",
":",
"return",
"'value_float'",
";",
"break",
";",
"case",
"Property",
"::",
"DATA_TYPE_BOOLEA... | Returns EAV column by property data type.
@param integer $type
@return string | [
"Returns",
"EAV",
"column",
"by",
"property",
"data",
"type",
"."
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyStorage/EAV.php#L300-L323 |
DevGroup-ru/yii2-data-structure-tools | src/propertyStorage/EAV.php | EAV.updateDataType | private static function updateDataType($property, $old, $className)
{
$oldColumn = self::dataTypeToEavColumn($old);
$newColumn = self::dataTypeToEavColumn($property->data_type);
$valueToOldColumn = Property::castValueToDataType('', $old);
$canTranslate = $property->canTranslate();
... | php | private static function updateDataType($property, $old, $className)
{
$oldColumn = self::dataTypeToEavColumn($old);
$newColumn = self::dataTypeToEavColumn($property->data_type);
$valueToOldColumn = Property::castValueToDataType('', $old);
$canTranslate = $property->canTranslate();
... | [
"private",
"static",
"function",
"updateDataType",
"(",
"$",
"property",
",",
"$",
"old",
",",
"$",
"className",
")",
"{",
"$",
"oldColumn",
"=",
"self",
"::",
"dataTypeToEavColumn",
"(",
"$",
"old",
")",
";",
"$",
"newColumn",
"=",
"self",
"::",
"dataTy... | Moves EAV values from one column to another with theirs auto converting.
Will add duplicate values for all defined languages if property values can be translated
Note if you move TEXT to STRING you will get only first 255 symbols due to field type limitations
@param Property $property
@param int $old
@param ActiveReco... | [
"Moves",
"EAV",
"values",
"from",
"one",
"column",
"to",
"another",
"with",
"theirs",
"auto",
"converting",
".",
"Will",
"add",
"duplicate",
"values",
"for",
"all",
"defined",
"languages",
"if",
"property",
"values",
"can",
"be",
"translated",
"Note",
"if",
... | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyStorage/EAV.php#L374-L468 |
chippyash/Strong-Type | src/Chippyash/Type/AbstractMultiValueType.php | AbstractMultiValueType.setFromTypes | protected function setFromTypes(array $params)
{
if (count($params) != count($this->valueMap)) {
$numParams = count($params);
$expectedParams = count($this->valueMap);
throw new \InvalidArgumentException("Expected {$expectedParams} parameters, got {$numParams}");
... | php | protected function setFromTypes(array $params)
{
if (count($params) != count($this->valueMap)) {
$numParams = count($params);
$expectedParams = count($this->valueMap);
throw new \InvalidArgumentException("Expected {$expectedParams} parameters, got {$numParams}");
... | [
"protected",
"function",
"setFromTypes",
"(",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"params",
")",
"!=",
"count",
"(",
"$",
"this",
"->",
"valueMap",
")",
")",
"{",
"$",
"numParams",
"=",
"count",
"(",
"$",
"params",
")",
... | Maps values passed in as parameters to constructor and set methods into
the value array
@param array $params
@return void
@throws \InvalidArgumentException | [
"Maps",
"values",
"passed",
"in",
"as",
"parameters",
"to",
"constructor",
"and",
"set",
"methods",
"into",
"the",
"value",
"array"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/AbstractMultiValueType.php#L149-L172 |
liuguangw/mvc | src/db/Connection.php | Connection.getPdo | private function getPdo(string $configName): \PDO
{
if ($configName == '') {
$configName = Application::$app->config->getValue('DB_CONFIG');
}
$configPath = APP_CONFIG_PATH . '/./db/' . $configName . '.php';
if (! is_file($configPath)) {
throw new \Exception('... | php | private function getPdo(string $configName): \PDO
{
if ($configName == '') {
$configName = Application::$app->config->getValue('DB_CONFIG');
}
$configPath = APP_CONFIG_PATH . '/./db/' . $configName . '.php';
if (! is_file($configPath)) {
throw new \Exception('... | [
"private",
"function",
"getPdo",
"(",
"string",
"$",
"configName",
")",
":",
"\\",
"PDO",
"{",
"if",
"(",
"$",
"configName",
"==",
"''",
")",
"{",
"$",
"configName",
"=",
"Application",
"::",
"$",
"app",
"->",
"config",
"->",
"getValue",
"(",
"'DB_CONF... | 工厂方法
@param string $configName
配置名
@return Connection
@throws \Exception | [
"工厂方法"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/db/Connection.php#L48-L64 |
liuguangw/mvc | src/db/Connection.php | Connection.fetch | public function fetch(): array
{
$sql = $this->builder->buildSql();
$this->builder = new QueryBuilder($this->pdo);
return $this->fetchBySql($sql);
} | php | public function fetch(): array
{
$sql = $this->builder->buildSql();
$this->builder = new QueryBuilder($this->pdo);
return $this->fetchBySql($sql);
} | [
"public",
"function",
"fetch",
"(",
")",
":",
"array",
"{",
"$",
"sql",
"=",
"$",
"this",
"->",
"builder",
"->",
"buildSql",
"(",
")",
";",
"$",
"this",
"->",
"builder",
"=",
"new",
"QueryBuilder",
"(",
"$",
"this",
"->",
"pdo",
")",
";",
"return",... | 获取第一条记录
@return array
@throws \Exception | [
"获取第一条记录"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/db/Connection.php#L167-L172 |
liuguangw/mvc | src/db/Connection.php | Connection.fetchAll | public function fetchAll(): array
{
$sql = $this->builder->buildSql();
$this->builder = new QueryBuilder($this->pdo);
return $this->fetchAllBySql($sql);
} | php | public function fetchAll(): array
{
$sql = $this->builder->buildSql();
$this->builder = new QueryBuilder($this->pdo);
return $this->fetchAllBySql($sql);
} | [
"public",
"function",
"fetchAll",
"(",
")",
":",
"array",
"{",
"$",
"sql",
"=",
"$",
"this",
"->",
"builder",
"->",
"buildSql",
"(",
")",
";",
"$",
"this",
"->",
"builder",
"=",
"new",
"QueryBuilder",
"(",
"$",
"this",
"->",
"pdo",
")",
";",
"retur... | 获取所有记录
@return array
@throws \Exception | [
"获取所有记录"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/db/Connection.php#L180-L185 |
liuguangw/mvc | src/db/Connection.php | Connection.update | public function update(array $data): int
{
$this->builder->setUpdateData($data);
$sql = $this->builder->buildSql();
$this->builder = new QueryBuilder($this->pdo);
return $this->execSql($sql);
} | php | public function update(array $data): int
{
$this->builder->setUpdateData($data);
$sql = $this->builder->buildSql();
$this->builder = new QueryBuilder($this->pdo);
return $this->execSql($sql);
} | [
"public",
"function",
"update",
"(",
"array",
"$",
"data",
")",
":",
"int",
"{",
"$",
"this",
"->",
"builder",
"->",
"setUpdateData",
"(",
"$",
"data",
")",
";",
"$",
"sql",
"=",
"$",
"this",
"->",
"builder",
"->",
"buildSql",
"(",
")",
";",
"$",
... | 更新表
@param array $data
@return int | [
"更新表"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/db/Connection.php#L193-L199 |
liuguangw/mvc | src/db/Connection.php | Connection.insert | public function insert(array $data): int
{
$this->builder->setInsertData($data);
$sql = $this->builder->buildSql();
$this->builder = new QueryBuilder($this->pdo);
return $this->execSql($sql);
} | php | public function insert(array $data): int
{
$this->builder->setInsertData($data);
$sql = $this->builder->buildSql();
$this->builder = new QueryBuilder($this->pdo);
return $this->execSql($sql);
} | [
"public",
"function",
"insert",
"(",
"array",
"$",
"data",
")",
":",
"int",
"{",
"$",
"this",
"->",
"builder",
"->",
"setInsertData",
"(",
"$",
"data",
")",
";",
"$",
"sql",
"=",
"$",
"this",
"->",
"builder",
"->",
"buildSql",
"(",
")",
";",
"$",
... | 插入表数据
@param array $data
@return int | [
"插入表数据"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/db/Connection.php#L207-L213 |
liuguangw/mvc | src/db/Connection.php | Connection.delete | public function delete(): int
{
$this->builder->setDeleteAction();
$sql = $this->builder->buildSql();
$this->builder = new QueryBuilder($this->pdo);
return $this->execSql($sql);
} | php | public function delete(): int
{
$this->builder->setDeleteAction();
$sql = $this->builder->buildSql();
$this->builder = new QueryBuilder($this->pdo);
return $this->execSql($sql);
} | [
"public",
"function",
"delete",
"(",
")",
":",
"int",
"{",
"$",
"this",
"->",
"builder",
"->",
"setDeleteAction",
"(",
")",
";",
"$",
"sql",
"=",
"$",
"this",
"->",
"builder",
"->",
"buildSql",
"(",
")",
";",
"$",
"this",
"->",
"builder",
"=",
"new... | 删除表数据
@return int | [
"删除表数据"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/db/Connection.php#L220-L226 |
liuguangw/mvc | src/db/Connection.php | Connection.execSql | public function execSql(string $sql): int
{
$result = $this->pdo->exec($sql);
if ($result === false) {
$err = $this->errorInfo();
throw new \Exception('['.$err[0].']'.$err[2]);
}
return $result;
} | php | public function execSql(string $sql): int
{
$result = $this->pdo->exec($sql);
if ($result === false) {
$err = $this->errorInfo();
throw new \Exception('['.$err[0].']'.$err[2]);
}
return $result;
} | [
"public",
"function",
"execSql",
"(",
"string",
"$",
"sql",
")",
":",
"int",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"pdo",
"->",
"exec",
"(",
"$",
"sql",
")",
";",
"if",
"(",
"$",
"result",
"===",
"false",
")",
"{",
"$",
"err",
"=",
"$",
... | 执行SQL语句
@param string $sql
@return int 受修改或删除 SQL 语句影响的行数
@throws \Exception | [
"执行SQL语句"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/db/Connection.php#L259-L267 |
liuguangw/mvc | src/db/Connection.php | Connection.getQueryStatement | private function getQueryStatement(string $sql): \PDOStatement
{
$result = $this->pdo->query($sql);
if ($result === false) {
$err = $this->errorInfo();
throw new \Exception('['.$err[0].']'.$err[2]);
}
return $result;
} | php | private function getQueryStatement(string $sql): \PDOStatement
{
$result = $this->pdo->query($sql);
if ($result === false) {
$err = $this->errorInfo();
throw new \Exception('['.$err[0].']'.$err[2]);
}
return $result;
} | [
"private",
"function",
"getQueryStatement",
"(",
"string",
"$",
"sql",
")",
":",
"\\",
"PDOStatement",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"pdo",
"->",
"query",
"(",
"$",
"sql",
")",
";",
"if",
"(",
"$",
"result",
"===",
"false",
")",
"{",
... | 执行SQL查询
@param string $sql
@return \PDOStatement
@throws \Exception | [
"执行SQL查询"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/db/Connection.php#L276-L284 |
ipunkt/social-auth | src/Ipunkt/SocialAuth/ProfileRegisterInfo.php | ProfileRegisterInfo.getInfo | public function getInfo($info_name) {
$value = null;
if($info_name == 'provider')
$value = $this->provider;
else if(property_exists($this->profile, $info_name))
$value = $this->profile->$info_name;
return $value;
} | php | public function getInfo($info_name) {
$value = null;
if($info_name == 'provider')
$value = $this->provider;
else if(property_exists($this->profile, $info_name))
$value = $this->profile->$info_name;
return $value;
} | [
"public",
"function",
"getInfo",
"(",
"$",
"info_name",
")",
"{",
"$",
"value",
"=",
"null",
";",
"if",
"(",
"$",
"info_name",
"==",
"'provider'",
")",
"$",
"value",
"=",
"$",
"this",
"->",
"provider",
";",
"else",
"if",
"(",
"property_exists",
"(",
... | Query the info for a specific value
@param string $info_name
@return mixed | [
"Query",
"the",
"info",
"for",
"a",
"specific",
"value"
] | train | https://github.com/ipunkt/social-auth/blob/28723a8e449612789a2cd7d21137996c48b62229/src/Ipunkt/SocialAuth/ProfileRegisterInfo.php#L63-L70 |
ipunkt/social-auth | src/Ipunkt/SocialAuth/ProfileRegisterInfo.php | ProfileRegisterInfo.success | public function success(UserInterface $user) {
$repository = App::make('Ipunkt\SocialAuth\Repositories\SocialLoginRepository');
/**
* @var SocialLoginRepository $repository
*/
$login = $repository->create();
$login->setIdentifier($this->identifier);
$login->setP... | php | public function success(UserInterface $user) {
$repository = App::make('Ipunkt\SocialAuth\Repositories\SocialLoginRepository');
/**
* @var SocialLoginRepository $repository
*/
$login = $repository->create();
$login->setIdentifier($this->identifier);
$login->setP... | [
"public",
"function",
"success",
"(",
"UserInterface",
"$",
"user",
")",
"{",
"$",
"repository",
"=",
"App",
"::",
"make",
"(",
"'Ipunkt\\SocialAuth\\Repositories\\SocialLoginRepository'",
")",
";",
"/**\n * @var SocialLoginRepository $repository\n */",
"$",
... | Notify the provider of the RegisterInfo that the user was now successfuly registered.
Attaches the social-auth user to the newly created user | [
"Notify",
"the",
"provider",
"of",
"the",
"RegisterInfo",
"that",
"the",
"user",
"was",
"now",
"successfuly",
"registered",
"."
] | train | https://github.com/ipunkt/social-auth/blob/28723a8e449612789a2cd7d21137996c48b62229/src/Ipunkt/SocialAuth/ProfileRegisterInfo.php#L81-L94 |
dphn/ScContent | src/ScContent/Listener/Back/ContentListDelete.php | ContentListDelete.process | public function process(EventInterface $event)
{
$events = $this->getEventManager();
$mapper = $this->getMapper();
$optionsProvider = $this->getOptionsProvider();
$translator = $this->getTranslator();
$pane = $event->getParam('pane');
if (! $optionsProvider->hasIdenti... | php | public function process(EventInterface $event)
{
$events = $this->getEventManager();
$mapper = $this->getMapper();
$optionsProvider = $this->getOptionsProvider();
$translator = $this->getTranslator();
$pane = $event->getParam('pane');
if (! $optionsProvider->hasIdenti... | [
"public",
"function",
"process",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"$",
"events",
"=",
"$",
"this",
"->",
"getEventManager",
"(",
")",
";",
"$",
"mapper",
"=",
"$",
"this",
"->",
"getMapper",
"(",
")",
";",
"$",
"optionsProvider",
"=",
"$"... | To permanently delete elements from the trash
@param \Zend\EventManager\EventInterface $event
@return null|\Zend\Http\Response | [
"To",
"permanently",
"delete",
"elements",
"from",
"the",
"trash"
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Listener/Back/ContentListDelete.php#L61-L112 |
todstoychev/icr | src/Manipulator/Crop.php | Crop.manipulate | public function manipulate(AbstractImage $image, $width, $height)
{
$this->createCropPoint($image, $width, $height);
$this->box->setHeight($height)
->setWidth($width);
return $image->crop($this->point, $this->box);
} | php | public function manipulate(AbstractImage $image, $width, $height)
{
$this->createCropPoint($image, $width, $height);
$this->box->setHeight($height)
->setWidth($width);
return $image->crop($this->point, $this->box);
} | [
"public",
"function",
"manipulate",
"(",
"AbstractImage",
"$",
"image",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"$",
"this",
"->",
"createCropPoint",
"(",
"$",
"image",
",",
"$",
"width",
",",
"$",
"height",
")",
";",
"$",
"this",
"->",
"box... | {@inheritdoc} | [
"{"
] | train | https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Manipulator/Crop.php#L18-L25 |
wangsir0624/queue | src/Consumer.php | Consumer.addQueue | public function addQueue($queue)
{
if(!in_array($queue, $this->queuesWorkedOn)) {
$this->queuesWorkedOn[] = $queue;
}
return $this;
} | php | public function addQueue($queue)
{
if(!in_array($queue, $this->queuesWorkedOn)) {
$this->queuesWorkedOn[] = $queue;
}
return $this;
} | [
"public",
"function",
"addQueue",
"(",
"$",
"queue",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"queue",
",",
"$",
"this",
"->",
"queuesWorkedOn",
")",
")",
"{",
"$",
"this",
"->",
"queuesWorkedOn",
"[",
"]",
"=",
"$",
"queue",
";",
"}",
"retu... | add a worked queue
@param string $queue
@return $this | [
"add",
"a",
"worked",
"queue"
] | train | https://github.com/wangsir0624/queue/blob/10541f9694b5d9759329ae908033dd3097ce6923/src/Consumer.php#L47-L54 |
attm2x/m2x-php | src/M2X.php | M2X.get | public function get($path, $params = array(), $vars = array()) {
$request = $this->request();
$request = $this->prepareRequest($request);
$response = $request->get($this->endpoint . $path, $params, $vars);
return $this->handleResponse($response);
} | php | public function get($path, $params = array(), $vars = array()) {
$request = $this->request();
$request = $this->prepareRequest($request);
$response = $request->get($this->endpoint . $path, $params, $vars);
return $this->handleResponse($response);
} | [
"public",
"function",
"get",
"(",
"$",
"path",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"vars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"request",
"(",
")",
";",
"$",
"request",
"=",
"$",
"this",
... | Perform a GET request to the API.
@param string $path
@param array $params query parameters
@param array $vars request body
@return HttpResponse
@throws M2XException | [
"Perform",
"a",
"GET",
"request",
"to",
"the",
"API",
"."
] | train | https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/M2X.php#L315-L321 |
attm2x/m2x-php | src/M2X.php | M2X.post | public function post($path, $vars = array()) {
$request = $this->request();
$request = $this->prepareRequest($request);
$response = $request->post($this->endpoint . $path, $vars);
return $this->handleResponse($response);
} | php | public function post($path, $vars = array()) {
$request = $this->request();
$request = $this->prepareRequest($request);
$response = $request->post($this->endpoint . $path, $vars);
return $this->handleResponse($response);
} | [
"public",
"function",
"post",
"(",
"$",
"path",
",",
"$",
"vars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"request",
"(",
")",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"prepareRequest",
"(",
"$",
"request",
"... | Perform a POST request to the API.
@param string $path
@param array $vars
@return HttpResponse
@throws M2XException | [
"Perform",
"a",
"POST",
"request",
"to",
"the",
"API",
"."
] | train | https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/M2X.php#L331-L337 |
attm2x/m2x-php | src/M2X.php | M2X.delete | public function delete($path, $params = array()) {
$request = $this->request();
$request = $this->prepareRequest($request);
$response = $request->delete($this->endpoint . $path, $params);
return $this->handleResponse($response);
} | php | public function delete($path, $params = array()) {
$request = $this->request();
$request = $this->prepareRequest($request);
$response = $request->delete($this->endpoint . $path, $params);
return $this->handleResponse($response);
} | [
"public",
"function",
"delete",
"(",
"$",
"path",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"request",
"(",
")",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"prepareRequest",
"(",
"$",
"request",... | Perform a DELETE request to the API.
@param string $path
@param array $params
@return HttpResponse
@throws M2XException | [
"Perform",
"a",
"DELETE",
"request",
"to",
"the",
"API",
"."
] | train | https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/M2X.php#L363-L369 |
attm2x/m2x-php | src/M2X.php | M2X.prepareRequest | protected function prepareRequest($request) {
$request->header('X-M2X-KEY', $this->apiKey);
$request->header('User-Agent', $this->userAgent);
return $request;
} | php | protected function prepareRequest($request) {
$request->header('X-M2X-KEY', $this->apiKey);
$request->header('User-Agent', $this->userAgent);
return $request;
} | [
"protected",
"function",
"prepareRequest",
"(",
"$",
"request",
")",
"{",
"$",
"request",
"->",
"header",
"(",
"'X-M2X-KEY'",
",",
"$",
"this",
"->",
"apiKey",
")",
";",
"$",
"request",
"->",
"header",
"(",
"'User-Agent'",
",",
"$",
"this",
"->",
"userAg... | Sets the common headers for each request to the API.
@param HttpRequest $request
@return HttpRequest | [
"Sets",
"the",
"common",
"headers",
"for",
"each",
"request",
"to",
"the",
"API",
"."
] | train | https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/M2X.php#L377-L381 |
attm2x/m2x-php | src/M2X.php | M2X.handleResponse | protected function handleResponse(HttpResponse $response) {
$this->lastResponse = $response;
if ($response->success()) {
return $response;
}
throw new M2XException($response);
} | php | protected function handleResponse(HttpResponse $response) {
$this->lastResponse = $response;
if ($response->success()) {
return $response;
}
throw new M2XException($response);
} | [
"protected",
"function",
"handleResponse",
"(",
"HttpResponse",
"$",
"response",
")",
"{",
"$",
"this",
"->",
"lastResponse",
"=",
"$",
"response",
";",
"if",
"(",
"$",
"response",
"->",
"success",
"(",
")",
")",
"{",
"return",
"$",
"response",
";",
"}",... | Checks the HttpResponse for errors and throws an exception, if
no errors are encountered, the HttpResponse is returned.
@param HttpResponse $response
@return HttpResponse
@throws M2XException | [
"Checks",
"the",
"HttpResponse",
"for",
"errors",
"and",
"throws",
"an",
"exception",
"if",
"no",
"errors",
"are",
"encountered",
"the",
"HttpResponse",
"is",
"returned",
"."
] | train | https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/M2X.php#L391-L399 |
markwatkinson/luminous | src/Luminous/Scanners/RubyScanner.php | RubyScanner.doHeredoc | protected function doHeredoc()
{
assert(!empty($this->heredocs));
$start = $this->pos();
for ($i = 0; $i < count($this->heredocs);) {
$top = $this->heredocs[$i];
list($ident, $identable, $interpolatable) = $top;
$searches = array(sprintf('/^%s%s\\b/m', $... | php | protected function doHeredoc()
{
assert(!empty($this->heredocs));
$start = $this->pos();
for ($i = 0; $i < count($this->heredocs);) {
$top = $this->heredocs[$i];
list($ident, $identable, $interpolatable) = $top;
$searches = array(sprintf('/^%s%s\\b/m', $... | [
"protected",
"function",
"doHeredoc",
"(",
")",
"{",
"assert",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"heredocs",
")",
")",
";",
"$",
"start",
"=",
"$",
"this",
"->",
"pos",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<... | not empty | [
"not",
"empty"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/RubyScanner.php#L333-L382 |
markwatkinson/luminous | src/Luminous/Scanners/RubyScanner.php | RubyScanner.doString | protected function doString($strData)
{
list($type, $openDelimiter, $closeDelimiter, $pos, $interpolation, $fancyDelim, $split) = $strData;
$balanced = $openDelimiter !== $closeDelimiter;
$template = '/(?<!\\\\)((?:\\\\\\\\)*)(%s)/';
$patterns = array();
$patterns['term'] = s... | php | protected function doString($strData)
{
list($type, $openDelimiter, $closeDelimiter, $pos, $interpolation, $fancyDelim, $split) = $strData;
$balanced = $openDelimiter !== $closeDelimiter;
$template = '/(?<!\\\\)((?:\\\\\\\\)*)(%s)/';
$patterns = array();
$patterns['term'] = s... | [
"protected",
"function",
"doString",
"(",
"$",
"strData",
")",
"{",
"list",
"(",
"$",
"type",
",",
"$",
"openDelimiter",
",",
"$",
"closeDelimiter",
",",
"$",
"pos",
",",
"$",
"interpolation",
",",
"$",
"fancyDelim",
",",
"$",
"split",
")",
"=",
"$",
... | TODO: proper docs | [
"TODO",
":",
"proper",
"docs"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/RubyScanner.php#L404-L472 |
mimmi20/Wurfl | src/Handlers/Normalizer/Specific/UcwebU2.php | UcwebU2.normalize | public function normalize($userAgent)
{
$ucbVersion = UcwebU3Handler::getUcBrowserVersion($userAgent);
if ($ucbVersion === null) {
return $userAgent;
}
//Android U2K Mobile + Tablet
if (Utils::checkIfContains($userAgent, 'Adr ')) {
$model = UcwebU3... | php | public function normalize($userAgent)
{
$ucbVersion = UcwebU3Handler::getUcBrowserVersion($userAgent);
if ($ucbVersion === null) {
return $userAgent;
}
//Android U2K Mobile + Tablet
if (Utils::checkIfContains($userAgent, 'Adr ')) {
$model = UcwebU3... | [
"public",
"function",
"normalize",
"(",
"$",
"userAgent",
")",
"{",
"$",
"ucbVersion",
"=",
"UcwebU3Handler",
"::",
"getUcBrowserVersion",
"(",
"$",
"userAgent",
")",
";",
"if",
"(",
"$",
"ucbVersion",
"===",
"null",
")",
"{",
"return",
"$",
"userAgent",
"... | @param string $userAgent
@return string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Normalizer/Specific/UcwebU2.php#L36-L102 |
eloquent/constance | src/AbstractGlobalConstant.php | AbstractGlobalConstant.initializeMembers | final protected static function initializeMembers()
{
if (null === static::CONSTANCE_PATTERN) {
foreach (get_defined_constants() as $key => $value) {
new static($key, $value);
}
} else {
foreach (get_defined_constants() as $key => $value) {
... | php | final protected static function initializeMembers()
{
if (null === static::CONSTANCE_PATTERN) {
foreach (get_defined_constants() as $key => $value) {
new static($key, $value);
}
} else {
foreach (get_defined_constants() as $key => $value) {
... | [
"final",
"protected",
"static",
"function",
"initializeMembers",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"static",
"::",
"CONSTANCE_PATTERN",
")",
"{",
"foreach",
"(",
"get_defined_constants",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"new... | Initializes the available constants.
@throws Exception\UndefinedClassException If the specified class does not exist. | [
"Initializes",
"the",
"available",
"constants",
"."
] | train | https://github.com/eloquent/constance/blob/4af52e02bb4b074201003b952bb0269cd9e536d5/src/AbstractGlobalConstant.php#L36-L49 |
myzero1/yii2-theme-layui | src/models/search/Z1UserSearch.php | Z1UserSearch.search | public function search($params)
{
$query = Z1User::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSize' => 10,
],
'sort' => [
... | php | public function search($params)
{
$query = Z1User::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSize' => 10,
],
'sort' => [
... | [
"public",
"function",
"search",
"(",
"$",
"params",
")",
"{",
"$",
"query",
"=",
"Z1User",
"::",
"find",
"(",
")",
";",
"// add conditions that should always apply here",
"$",
"dataProvider",
"=",
"new",
"ActiveDataProvider",
"(",
"[",
"'query'",
"=>",
"$",
"q... | Creates data provider instance with search query applied
@param array $params
@return ActiveDataProvider | [
"Creates",
"data",
"provider",
"instance",
"with",
"search",
"query",
"applied"
] | train | https://github.com/myzero1/yii2-theme-layui/blob/47e4796b35b8354e50359a489499ee598edd68e1/src/models/search/Z1UserSearch.php#L43-L84 |
myzero1/yii2-theme-layui | src/models/search/Z1UserSearch.php | Z1UserSearch.sqlSearch | public function sqlSearch($params)
{
$this->load($params);
$where =[
'id' => sprintf('id = "%s"',$this->id),
'status' => sprintf('status = "%s"',$this->status),
'created_at' => sprintf('created_at = "%s"',$this->created_at),
'updated_at' => sprintf('updat... | php | public function sqlSearch($params)
{
$this->load($params);
$where =[
'id' => sprintf('id = "%s"',$this->id),
'status' => sprintf('status = "%s"',$this->status),
'created_at' => sprintf('created_at = "%s"',$this->created_at),
'updated_at' => sprintf('updat... | [
"public",
"function",
"sqlSearch",
"(",
"$",
"params",
")",
"{",
"$",
"this",
"->",
"load",
"(",
"$",
"params",
")",
";",
"$",
"where",
"=",
"[",
"'id'",
"=>",
"sprintf",
"(",
"'id = \"%s\"'",
",",
"$",
"this",
"->",
"id",
")",
",",
"'status'",
"=>... | Creates data provider instance with search query and sql applied
@param array $params
@return SqlDataProvider | [
"Creates",
"data",
"provider",
"instance",
"with",
"search",
"query",
"and",
"sql",
"applied"
] | train | https://github.com/myzero1/yii2-theme-layui/blob/47e4796b35b8354e50359a489499ee598edd68e1/src/models/search/Z1UserSearch.php#L93-L153 |
DevGroup-ru/yii2-data-structure-tools | src/propertyHandler/DatePickerField.php | DatePickerField.getValidationRules | public function getValidationRules(Property $property)
{
$key = $property->key;
if ($property->allow_multiple_values) {
return [
[$key, 'each', 'rule' => ['date']],
[$key, 'each', 'rule' => ['default', 'value' => null]],
];
} else {
... | php | public function getValidationRules(Property $property)
{
$key = $property->key;
if ($property->allow_multiple_values) {
return [
[$key, 'each', 'rule' => ['date']],
[$key, 'each', 'rule' => ['default', 'value' => null]],
];
} else {
... | [
"public",
"function",
"getValidationRules",
"(",
"Property",
"$",
"property",
")",
"{",
"$",
"key",
"=",
"$",
"property",
"->",
"key",
";",
"if",
"(",
"$",
"property",
"->",
"allow_multiple_values",
")",
"{",
"return",
"[",
"[",
"$",
"key",
",",
"'each'"... | Get validation rules for a property.
@param Property $property
@return array of ActiveRecord validation rules | [
"Get",
"validation",
"rules",
"for",
"a",
"property",
"."
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyHandler/DatePickerField.php#L42-L56 |
DevGroup-ru/yii2-data-structure-tools | src/propertyHandler/DatePickerField.php | DatePickerField.beforePropertyModelSave | public function beforePropertyModelSave(Property &$property, $insert)
{
if ($property->canTranslate()) {
$property->data_type = Property::DATA_TYPE_INVARIANT_STRING;
}
return parent::beforePropertyModelSave($property, $insert);
} | php | public function beforePropertyModelSave(Property &$property, $insert)
{
if ($property->canTranslate()) {
$property->data_type = Property::DATA_TYPE_INVARIANT_STRING;
}
return parent::beforePropertyModelSave($property, $insert);
} | [
"public",
"function",
"beforePropertyModelSave",
"(",
"Property",
"&",
"$",
"property",
",",
"$",
"insert",
")",
"{",
"if",
"(",
"$",
"property",
"->",
"canTranslate",
"(",
")",
")",
"{",
"$",
"property",
"->",
"data_type",
"=",
"Property",
"::",
"DATA_TYP... | @param Property $property
@param bool $insert
@return bool | [
"@param",
"Property",
"$property",
"@param",
"bool",
"$insert"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyHandler/DatePickerField.php#L64-L70 |
terdia/legato-framework | src/Validation/ErrorHandler.php | ErrorHandler.set | public static function set($error, $key = null)
{
if ($key) {
static::$error[$key][] = $error;
} else {
static::$error[] = $error;
}
} | php | public static function set($error, $key = null)
{
if ($key) {
static::$error[$key][] = $error;
} else {
static::$error[] = $error;
}
} | [
"public",
"static",
"function",
"set",
"(",
"$",
"error",
",",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"key",
")",
"{",
"static",
"::",
"$",
"error",
"[",
"$",
"key",
"]",
"[",
"]",
"=",
"$",
"error",
";",
"}",
"else",
"{",
"static... | Set specific error.
@param $error
@param null $key | [
"Set",
"specific",
"error",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Validation/ErrorHandler.php#L25-L32 |
terdia/legato-framework | src/Validation/ErrorHandler.php | ErrorHandler.getValidationMessages | public static function getValidationMessages($custom = [])
{
$default = (array) require_once __DIR__.'/messages.php';
foreach ($custom as $key => $value) {
if (array_key_exists($key, $default)) {
$default[$key] = $value;
}
}
return $default;
... | php | public static function getValidationMessages($custom = [])
{
$default = (array) require_once __DIR__.'/messages.php';
foreach ($custom as $key => $value) {
if (array_key_exists($key, $default)) {
$default[$key] = $value;
}
}
return $default;
... | [
"public",
"static",
"function",
"getValidationMessages",
"(",
"$",
"custom",
"=",
"[",
"]",
")",
"{",
"$",
"default",
"=",
"(",
"array",
")",
"require_once",
"",
"__DIR__",
".",
"'/messages.php'",
";",
"foreach",
"(",
"$",
"custom",
"as",
"$",
"key",
"=>... | Set and returns default custom validation messages.
@param array $custom
@return array | [
"Set",
"and",
"returns",
"default",
"custom",
"validation",
"messages",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Validation/ErrorHandler.php#L61-L72 |
pantera-digital/yii2-seo | models/SeoNotFoundSearch.php | SeoNotFoundSearch.search | public function search($params)
{
$query = SeoNotFound::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => [
'defaultOrder' => ['id' => SORT_DESC],
],
]);
... | php | public function search($params)
{
$query = SeoNotFound::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => [
'defaultOrder' => ['id' => SORT_DESC],
],
]);
... | [
"public",
"function",
"search",
"(",
"$",
"params",
")",
"{",
"$",
"query",
"=",
"SeoNotFound",
"::",
"find",
"(",
")",
";",
"// add conditions that should always apply here",
"$",
"dataProvider",
"=",
"new",
"ActiveDataProvider",
"(",
"[",
"'query'",
"=>",
"$",... | Creates data provider instance with search query applied
@param array $params
@return ActiveDataProvider | [
"Creates",
"data",
"provider",
"instance",
"with",
"search",
"query",
"applied"
] | train | https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/models/SeoNotFoundSearch.php#L38-L70 |
liip/LiipDrupalConnectorModule | src/Liip/Drupal/Modules/DrupalConnector/Database.php | Database.db_add_field | public function db_add_field($table, $field, $spec, $keys_new = array())
{
db_add_field($table, $field, $spec, $keys_new);
} | php | public function db_add_field($table, $field, $spec, $keys_new = array())
{
db_add_field($table, $field, $spec, $keys_new);
} | [
"public",
"function",
"db_add_field",
"(",
"$",
"table",
",",
"$",
"field",
",",
"$",
"spec",
",",
"$",
"keys_new",
"=",
"array",
"(",
")",
")",
"{",
"db_add_field",
"(",
"$",
"table",
",",
"$",
"field",
",",
"$",
"spec",
",",
"$",
"keys_new",
")",... | Adds a new field to a table.
@param $table
Name of the table to be altered.
@param $field
Name of the field to be added.
@param $spec
The field specification array, as taken from a schema definition. The
specification may also contain the key 'initial'; the newly-created field
will be set to the value of the key in al... | [
"Adds",
"a",
"new",
"field",
"to",
"a",
"table",
"."
] | train | https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Database.php#L42-L45 |
liip/LiipDrupalConnectorModule | src/Liip/Drupal/Modules/DrupalConnector/Database.php | Database.db_change_field | public function db_change_field($table, $field, $field_new, $spec, $keys_new = array())
{
db_change_field($table, $field, $field_new, $spec, $keys_new);
} | php | public function db_change_field($table, $field, $field_new, $spec, $keys_new = array())
{
db_change_field($table, $field, $field_new, $spec, $keys_new);
} | [
"public",
"function",
"db_change_field",
"(",
"$",
"table",
",",
"$",
"field",
",",
"$",
"field_new",
",",
"$",
"spec",
",",
"$",
"keys_new",
"=",
"array",
"(",
")",
")",
"{",
"db_change_field",
"(",
"$",
"table",
",",
"$",
"field",
",",
"$",
"field_... | Changes a field definition.
IMPORTANT NOTE: To maintain database portability, you have to explicitly
recreate all indices and primary keys that are using the changed field.
That means that you have to drop all affected keys and indexes with
db_drop_{primary_key,unique_key,index}() before calling db_change_field().
To r... | [
"Changes",
"a",
"field",
"definition",
".",
"IMPORTANT",
"NOTE",
":",
"To",
"maintain",
"database",
"portability",
"you",
"have",
"to",
"explicitly",
"recreate",
"all",
"indices",
"and",
"primary",
"keys",
"that",
"are",
"using",
"the",
"changed",
"field",
"."... | train | https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Database.php#L156-L159 |
liip/LiipDrupalConnectorModule | src/Liip/Drupal/Modules/DrupalConnector/Database.php | Database.db_query_range | public function db_query_range($query, $from, $count, array $args = array(), array $options = array())
{
return db_query_range($query, $from, $count, $args, $options);
} | php | public function db_query_range($query, $from, $count, array $args = array(), array $options = array())
{
return db_query_range($query, $from, $count, $args, $options);
} | [
"public",
"function",
"db_query_range",
"(",
"$",
"query",
",",
"$",
"from",
",",
"$",
"count",
",",
"array",
"$",
"args",
"=",
"array",
"(",
")",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"return",
"db_query_range",
"(",
"$",
... | Executes a query against the active database, restricted to a range.
@param $query
The prepared statement query to run. Although it will accept both named and
unnamed placeholders, named placeholders are strongly preferred as they are
more self-documenting.
@param $from
The first record from the result set to return.
... | [
"Executes",
"a",
"query",
"against",
"the",
"active",
"database",
"restricted",
"to",
"a",
"range",
"."
] | train | https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Database.php#L588-L591 |
mamuz/MamuzBlog | src/MamuzBlog/View/Helper/HashIdFactory.php | HashIdFactory.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
if ($serviceLocator instanceof ServiceLocatorAwareInterface) {
$serviceLocator = $serviceLocator->getServiceLocator();
}
/** @var ServiceLocatorInterface $domainManager */
$domainManager = $serviceLo... | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
if ($serviceLocator instanceof ServiceLocatorAwareInterface) {
$serviceLocator = $serviceLocator->getServiceLocator();
}
/** @var ServiceLocatorInterface $domainManager */
$domainManager = $serviceLo... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"if",
"(",
"$",
"serviceLocator",
"instanceof",
"ServiceLocatorAwareInterface",
")",
"{",
"$",
"serviceLocator",
"=",
"$",
"serviceLocator",
"->",
"getServiceLocator"... | {@inheritdoc}
@return \Zend\View\Helper\HelperInterface | [
"{"
] | train | https://github.com/mamuz/MamuzBlog/blob/cb43be5c39031e3dcc939283e284824c4d07da38/src/MamuzBlog/View/Helper/HashIdFactory.php#L15-L27 |
yosmanyga/validation | src/Yosmanyga/Validation/Resource/Definition/ValueDefinition.php | ValueDefinition.createValidator | public function createValidator()
{
return new ObjectValidator([
'allowNull' => new ScalarValidator([
'allowNull' => true,
'type' => 'boolean',
]),
'type' => new ScalarValidator([
'allowNull' => true,
't... | php | public function createValidator()
{
return new ObjectValidator([
'allowNull' => new ScalarValidator([
'allowNull' => true,
'type' => 'boolean',
]),
'type' => new ScalarValidator([
'allowNull' => true,
't... | [
"public",
"function",
"createValidator",
"(",
")",
"{",
"return",
"new",
"ObjectValidator",
"(",
"[",
"'allowNull'",
"=>",
"new",
"ScalarValidator",
"(",
"[",
"'allowNull'",
"=>",
"true",
",",
"'type'",
"=>",
"'boolean'",
",",
"]",
")",
",",
"'type'",
"=>",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Resource/Definition/ValueDefinition.php#L126-L153 |
christophe-brachet/aspi-framework | src/Framework/Routing/RouteGenerator/I18nRouteGenerator.php | I18nRouteGenerator.generateCollection | public function generateCollection($prefix, RouteCollection $baseCollection)
{
$collection = clone $baseCollection;
if (is_array($prefix)) {
$prefixes = array();
foreach ($prefix as $locale => $localePrefix) {
$prefixes[$locale] = trim(trim($localePrefix), '/'... | php | public function generateCollection($prefix, RouteCollection $baseCollection)
{
$collection = clone $baseCollection;
if (is_array($prefix)) {
$prefixes = array();
foreach ($prefix as $locale => $localePrefix) {
$prefixes[$locale] = trim(trim($localePrefix), '/'... | [
"public",
"function",
"generateCollection",
"(",
"$",
"prefix",
",",
"RouteCollection",
"$",
"baseCollection",
")",
"{",
"$",
"collection",
"=",
"clone",
"$",
"baseCollection",
";",
"if",
"(",
"is_array",
"(",
"$",
"prefix",
")",
")",
"{",
"$",
"prefixes",
... | Generate a localized version of the given route collection.
@param array|string $prefix
@param RouteCollection $baseCollection
@return RouteCollection | [
"Generate",
"a",
"localized",
"version",
"of",
"the",
"given",
"route",
"collection",
"."
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Routing/RouteGenerator/I18nRouteGenerator.php#L69-L86 |
christophe-brachet/aspi-framework | src/Framework/Routing/RouteGenerator/I18nRouteGenerator.php | I18nRouteGenerator.localizeCollection | protected function localizeCollection(array $prefixes, RouteCollection $collection)
{
$removeRoutes = array();
$newRoutes = new RouteCollection();
foreach ($collection->all() as $name => $route) {
$routeLocale = $route->getDefault(self::LOCALE_PARAM);
if ($routeLocale... | php | protected function localizeCollection(array $prefixes, RouteCollection $collection)
{
$removeRoutes = array();
$newRoutes = new RouteCollection();
foreach ($collection->all() as $name => $route) {
$routeLocale = $route->getDefault(self::LOCALE_PARAM);
if ($routeLocale... | [
"protected",
"function",
"localizeCollection",
"(",
"array",
"$",
"prefixes",
",",
"RouteCollection",
"$",
"collection",
")",
"{",
"$",
"removeRoutes",
"=",
"array",
"(",
")",
";",
"$",
"newRoutes",
"=",
"new",
"RouteCollection",
"(",
")",
";",
"foreach",
"(... | Localize a route collection.
@param array $prefixes
@param RouteCollection $collection | [
"Localize",
"a",
"route",
"collection",
"."
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Routing/RouteGenerator/I18nRouteGenerator.php#L93-L121 |
christophe-brachet/aspi-framework | src/Framework/Routing/RouteGenerator/I18nRouteGenerator.php | I18nRouteGenerator.localizeCollectionLocaleParameter | protected function localizeCollectionLocaleParameter($prefix, RouteCollection $collection)
{
$localizedPrefixes = array();
foreach ($collection->all() as $name => $route) {
$locale = $route->getDefault(self::LOCALE_PARAM);
if ($locale === null) {
// No locale ... | php | protected function localizeCollectionLocaleParameter($prefix, RouteCollection $collection)
{
$localizedPrefixes = array();
foreach ($collection->all() as $name => $route) {
$locale = $route->getDefault(self::LOCALE_PARAM);
if ($locale === null) {
// No locale ... | [
"protected",
"function",
"localizeCollectionLocaleParameter",
"(",
"$",
"prefix",
",",
"RouteCollection",
"$",
"collection",
")",
"{",
"$",
"localizedPrefixes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"collection",
"->",
"all",
"(",
")",
"as",
"$",
... | Localize the prefix `_locale` of all routes.
@param string $prefix A prefix containing _locale
@param RouteCollection $collection A RouteCollection instance | [
"Localize",
"the",
"prefix",
"_locale",
"of",
"all",
"routes",
"."
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Routing/RouteGenerator/I18nRouteGenerator.php#L128-L145 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Generator.php | HTMLPurifier_Generator.generateFromToken | public function generateFromToken($token) {
if (!$token instanceof HTMLPurifier_Token) {
trigger_error('Cannot generate HTML from non-HTMLPurifier_Token object', E_USER_WARNING);
return '';
} elseif ($token instanceof HTMLPurifier_Token_Start) {
$attr = $this->genera... | php | public function generateFromToken($token) {
if (!$token instanceof HTMLPurifier_Token) {
trigger_error('Cannot generate HTML from non-HTMLPurifier_Token object', E_USER_WARNING);
return '';
} elseif ($token instanceof HTMLPurifier_Token_Start) {
$attr = $this->genera... | [
"public",
"function",
"generateFromToken",
"(",
"$",
"token",
")",
"{",
"if",
"(",
"!",
"$",
"token",
"instanceof",
"HTMLPurifier_Token",
")",
"{",
"trigger_error",
"(",
"'Cannot generate HTML from non-HTMLPurifier_Token object'",
",",
"E_USER_WARNING",
")",
";",
"ret... | Generates HTML from a single token.
@param $token HTMLPurifier_Token object.
@return Generated HTML | [
"Generates",
"HTML",
"from",
"a",
"single",
"token",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Generator.php#L100-L127 |
DevGroup-ru/yii2-data-structure-tools | src/commands/ElasticIndexController.php | ElasticIndexController.actionFillIndex | public function actionFillIndex()
{
try {
$this->client->ping();
} catch (NoNodesAvailableException $e) {
$this->stderr($e->getMessage() . ', maybe you first need to configure and run elasticsearch' . PHP_EOL);
return;
}
/** @var HasProperties | Pr... | php | public function actionFillIndex()
{
try {
$this->client->ping();
} catch (NoNodesAvailableException $e) {
$this->stderr($e->getMessage() . ', maybe you first need to configure and run elasticsearch' . PHP_EOL);
return;
}
/** @var HasProperties | Pr... | [
"public",
"function",
"actionFillIndex",
"(",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"client",
"->",
"ping",
"(",
")",
";",
"}",
"catch",
"(",
"NoNodesAvailableException",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"stderr",
"(",
"$",
"e",
"->",
"getMe... | Creates and fills in indices
@throws \yii\base\InvalidConfigException | [
"Creates",
"and",
"fills",
"in",
"indices"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/commands/ElasticIndexController.php#L274-L299 |
DevGroup-ru/yii2-data-structure-tools | src/commands/ElasticIndexController.php | ElasticIndexController.prepareIndexConfig | private static function prepareIndexConfig()
{
foreach (self::$storage as $className => $id) {
$key = IndexHelper::storageClassToType($className);
$config = self::prepareMapping($className);
if (false === empty($config)) {
self::$indexConfig['body']['mappi... | php | private static function prepareIndexConfig()
{
foreach (self::$storage as $className => $id) {
$key = IndexHelper::storageClassToType($className);
$config = self::prepareMapping($className);
if (false === empty($config)) {
self::$indexConfig['body']['mappi... | [
"private",
"static",
"function",
"prepareIndexConfig",
"(",
")",
"{",
"foreach",
"(",
"self",
"::",
"$",
"storage",
"as",
"$",
"className",
"=>",
"$",
"id",
")",
"{",
"$",
"key",
"=",
"IndexHelper",
"::",
"storageClassToType",
"(",
"$",
"className",
")",
... | Prepares config for all applicable property storage
@return array | [
"Prepares",
"config",
"for",
"all",
"applicable",
"property",
"storage"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/commands/ElasticIndexController.php#L306-L316 |
DevGroup-ru/yii2-data-structure-tools | src/commands/ElasticIndexController.php | ElasticIndexController.prepareMapping | private static function prepareMapping($className)
{
$mapping = [];
foreach (self::$languages as $iso_639_2t) {
if (true === isset(self::$langToAnalyzer[$iso_639_2t])) {
switch ($className) {
case StaticValues::class :
self::$st... | php | private static function prepareMapping($className)
{
$mapping = [];
foreach (self::$languages as $iso_639_2t) {
if (true === isset(self::$langToAnalyzer[$iso_639_2t])) {
switch ($className) {
case StaticValues::class :
self::$st... | [
"private",
"static",
"function",
"prepareMapping",
"(",
"$",
"className",
")",
"{",
"$",
"mapping",
"=",
"[",
"]",
";",
"foreach",
"(",
"self",
"::",
"$",
"languages",
"as",
"$",
"iso_639_2t",
")",
"{",
"if",
"(",
"true",
"===",
"isset",
"(",
"self",
... | Prepares language based index mappings according to languages defined in app config multilingual
@param string $className PropertyStorage class name
@return array | [
"Prepares",
"language",
"based",
"index",
"mappings",
"according",
"to",
"languages",
"defined",
"in",
"app",
"config",
"multilingual"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/commands/ElasticIndexController.php#L324-L346 |
DevGroup-ru/yii2-data-structure-tools | src/commands/ElasticIndexController.php | ElasticIndexController.buildPsvData | private static function buildPsvData($bindingsTable, $index, $type, $props)
{
$res = ['body' => []];
$propIds = array_column($props, 'id');
$propValues = (new Query())->from(StaticValue::tableName())
->select(['id', 'property_id', 'packed_json_params'])
->indexBy('id'... | php | private static function buildPsvData($bindingsTable, $index, $type, $props)
{
$res = ['body' => []];
$propIds = array_column($props, 'id');
$propValues = (new Query())->from(StaticValue::tableName())
->select(['id', 'property_id', 'packed_json_params'])
->indexBy('id'... | [
"private",
"static",
"function",
"buildPsvData",
"(",
"$",
"bindingsTable",
",",
"$",
"index",
",",
"$",
"type",
",",
"$",
"props",
")",
"{",
"$",
"res",
"=",
"[",
"'body'",
"=>",
"[",
"]",
"]",
";",
"$",
"propIds",
"=",
"array_column",
"(",
"$",
"... | Collects data and builds multidimensional array for store in elasticsearch index
@param string $bindingsTable
@param string $index
@param string $type
@param $props
@return array | [
"Collects",
"data",
"and",
"builds",
"multidimensional",
"array",
"for",
"store",
"in",
"elasticsearch",
"index"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/commands/ElasticIndexController.php#L384-L464 |
eddiriarte/console-select | src/Inputs/RadioInput.php | RadioInput.select | public function select(string $option): void
{
if (empty(array_intersect($this->options, [$option]))) {
throw new UnknownOption($option);
}
$this->selections = $this->isSelected($option) ? [] : [$option];
} | php | public function select(string $option): void
{
if (empty(array_intersect($this->options, [$option]))) {
throw new UnknownOption($option);
}
$this->selections = $this->isSelected($option) ? [] : [$option];
} | [
"public",
"function",
"select",
"(",
"string",
"$",
"option",
")",
":",
"void",
"{",
"if",
"(",
"empty",
"(",
"array_intersect",
"(",
"$",
"this",
"->",
"options",
",",
"[",
"$",
"option",
"]",
")",
")",
")",
"{",
"throw",
"new",
"UnknownOption",
"("... | {@inheritdoc} | [
"{"
] | train | https://github.com/eddiriarte/console-select/blob/76a6818c128571dfed8f0546a6ac5dd15e64f1ad/src/Inputs/RadioInput.php#L18-L25 |
mimmi20/Wurfl | src/Handlers/XboxHandler.php | XboxHandler.applyRecoveryMatch | public function applyRecoveryMatch($userAgent)
{
if (Utils::checkIfContains($userAgent, 'MSIE 10.0') && Utils::checkIfContains(
$userAgent,
'Xbox One'
)
) {
return 'microsoft_xboxone_ver1';
}
if (Utils::checkIfContains($userAgent, 'MSIE 10... | php | public function applyRecoveryMatch($userAgent)
{
if (Utils::checkIfContains($userAgent, 'MSIE 10.0') && Utils::checkIfContains(
$userAgent,
'Xbox One'
)
) {
return 'microsoft_xboxone_ver1';
}
if (Utils::checkIfContains($userAgent, 'MSIE 10... | [
"public",
"function",
"applyRecoveryMatch",
"(",
"$",
"userAgent",
")",
"{",
"if",
"(",
"Utils",
"::",
"checkIfContains",
"(",
"$",
"userAgent",
",",
"'MSIE 10.0'",
")",
"&&",
"Utils",
"::",
"checkIfContains",
"(",
"$",
"userAgent",
",",
"'Xbox One'",
")",
"... | @param string $userAgent
@return string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/XboxHandler.php#L68-L83 |
astronati/php-fantasy-football-quotations-parser | src/Map/Row/Normalizer/Field/Type/GoalsNormalizer.php | GoalsNormalizer.getBonusByRole | public static function getBonusByRole(string $role): float
{
switch ($role) {
// To know the number of goals scored by goalkeeper, it needs to be extracted from the MagicPoints
case Row::GOALKEEPER:
return GoalsNormalizer::STANDARD_GOALKEEPER_MALUS;
case R... | php | public static function getBonusByRole(string $role): float
{
switch ($role) {
// To know the number of goals scored by goalkeeper, it needs to be extracted from the MagicPoints
case Row::GOALKEEPER:
return GoalsNormalizer::STANDARD_GOALKEEPER_MALUS;
case R... | [
"public",
"static",
"function",
"getBonusByRole",
"(",
"string",
"$",
"role",
")",
":",
"float",
"{",
"switch",
"(",
"$",
"role",
")",
"{",
"// To know the number of goals scored by goalkeeper, it needs to be extracted from the MagicPoints",
"case",
"Row",
"::",
"GOALKEEP... | Returns the goal bonus given the role
@param string $role
@return float | [
"Returns",
"the",
"goal",
"bonus",
"given",
"the",
"role"
] | train | https://github.com/astronati/php-fantasy-football-quotations-parser/blob/1214f313c325ac7e9fc4d5218b85b3d7234f7bf3/src/Map/Row/Normalizer/Field/Type/GoalsNormalizer.php#L55-L71 |
OXID-eSales/oxideshop-demodata-installer | src/DemoDataInstaller.php | DemoDataInstaller.execute | public function execute()
{
try {
$this->filesystem->mirror($this->demoDataPath, $this->outPath);
} catch (IOException $exception) {
$items = [
"Error occurred while copying files:",
$exception->getMessage(),
"\n"
];... | php | public function execute()
{
try {
$this->filesystem->mirror($this->demoDataPath, $this->outPath);
} catch (IOException $exception) {
$items = [
"Error occurred while copying files:",
$exception->getMessage(),
"\n"
];... | [
"public",
"function",
"execute",
"(",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"filesystem",
"->",
"mirror",
"(",
"$",
"this",
"->",
"demoDataPath",
",",
"$",
"this",
"->",
"outPath",
")",
";",
"}",
"catch",
"(",
"IOException",
"$",
"exception",
")",
... | Copies DemoData images from vendor directory of needed edition
to the OXID eShop ``OUT`` directory.
@return int error code | [
"Copies",
"DemoData",
"images",
"from",
"vendor",
"directory",
"of",
"needed",
"edition",
"to",
"the",
"OXID",
"eShop",
"OUT",
"directory",
"."
] | train | https://github.com/OXID-eSales/oxideshop-demodata-installer/blob/977e7529b5f408d0095b663b6447e0d3d1c12b0f/src/DemoDataInstaller.php#L61-L76 |
kriskbx/mikado | src/Manager.php | Manager.format | public function format($data, $multiple = false)
{
if ($multiple === true || $data instanceof Collection) {
foreach ($data as $key => $value) {
$data[$key] = $this->runFormatters($value);
}
} else {
$data = $this->runFormatters($data);
}
... | php | public function format($data, $multiple = false)
{
if ($multiple === true || $data instanceof Collection) {
foreach ($data as $key => $value) {
$data[$key] = $this->runFormatters($value);
}
} else {
$data = $this->runFormatters($data);
}
... | [
"public",
"function",
"format",
"(",
"$",
"data",
",",
"$",
"multiple",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"multiple",
"===",
"true",
"||",
"$",
"data",
"instanceof",
"Collection",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
... | Format the given data.
@param array|object $data
@param bool $multiple
@return array|object | [
"Format",
"the",
"given",
"data",
"."
] | train | https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Manager.php#L40-L51 |
kriskbx/mikado | src/Manager.php | Manager.runFormatters | protected function runFormatters($data)
{
$data = self::formatAble($data);
foreach ($this->formatters as $formatter) {
$data = $formatter->format($data);
}
return $data->getObject();
} | php | protected function runFormatters($data)
{
$data = self::formatAble($data);
foreach ($this->formatters as $formatter) {
$data = $formatter->format($data);
}
return $data->getObject();
} | [
"protected",
"function",
"runFormatters",
"(",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"self",
"::",
"formatAble",
"(",
"$",
"data",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"formatters",
"as",
"$",
"formatter",
")",
"{",
"$",
"data",
"=",
"$",
... | Run the Formatters on the given data.
@param array|object $data
@return FormatAble|object | [
"Run",
"the",
"Formatters",
"on",
"the",
"given",
"data",
"."
] | train | https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Manager.php#L82-L91 |
mimmi20/Wurfl | src/Handlers/Normalizer/Specific/UcwebU3.php | UcwebU3.normalize | public function normalize($userAgent)
{
$ucbVersion = UcwebU3Handler::getUcBrowserVersion($userAgent);
if ($ucbVersion === null) {
return $userAgent;
}
// Windows Phone goes before Android
if (Utils::checkIfContains($userAgent, 'Windows Phone')) {
//... | php | public function normalize($userAgent)
{
$ucbVersion = UcwebU3Handler::getUcBrowserVersion($userAgent);
if ($ucbVersion === null) {
return $userAgent;
}
// Windows Phone goes before Android
if (Utils::checkIfContains($userAgent, 'Windows Phone')) {
//... | [
"public",
"function",
"normalize",
"(",
"$",
"userAgent",
")",
"{",
"$",
"ucbVersion",
"=",
"UcwebU3Handler",
"::",
"getUcBrowserVersion",
"(",
"$",
"userAgent",
")",
";",
"if",
"(",
"$",
"ucbVersion",
"===",
"null",
")",
"{",
"return",
"$",
"userAgent",
"... | @param string $userAgent
@return string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Normalizer/Specific/UcwebU3.php#L38-L94 |
mimmi20/Wurfl | src/Handlers/MitsubishiHandler.php | MitsubishiHandler.applyConclusiveMatch | public function applyConclusiveMatch($userAgent)
{
$tolerance = Utils::firstSpace($userAgent);
return $this->getDeviceIDFromRIS($userAgent, $tolerance);
} | php | public function applyConclusiveMatch($userAgent)
{
$tolerance = Utils::firstSpace($userAgent);
return $this->getDeviceIDFromRIS($userAgent, $tolerance);
} | [
"public",
"function",
"applyConclusiveMatch",
"(",
"$",
"userAgent",
")",
"{",
"$",
"tolerance",
"=",
"Utils",
"::",
"firstSpace",
"(",
"$",
"userAgent",
")",
";",
"return",
"$",
"this",
"->",
"getDeviceIDFromRIS",
"(",
"$",
"userAgent",
",",
"$",
"tolerance... | @param string $userAgent
@return null|string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/MitsubishiHandler.php#L53-L58 |
mamuz/MamuzBlog | src/MamuzBlog/Controller/PostQueryController.php | PostQueryController.publishedPostsAction | public function publishedPostsAction()
{
$this->routeParam()->mapPageTo($this->queryService);
if ($tag = $this->params()->fromRoute('tag')) {
$collection = $this->queryService->findPublishedPostsByTag($tag);
} else {
$collection = $this->queryService->findPublishedPo... | php | public function publishedPostsAction()
{
$this->routeParam()->mapPageTo($this->queryService);
if ($tag = $this->params()->fromRoute('tag')) {
$collection = $this->queryService->findPublishedPostsByTag($tag);
} else {
$collection = $this->queryService->findPublishedPo... | [
"public",
"function",
"publishedPostsAction",
"(",
")",
"{",
"$",
"this",
"->",
"routeParam",
"(",
")",
"->",
"mapPageTo",
"(",
"$",
"this",
"->",
"queryService",
")",
";",
"if",
"(",
"$",
"tag",
"=",
"$",
"this",
"->",
"params",
"(",
")",
"->",
"fro... | Published post entries retrieval
@return ModelInterface | [
"Published",
"post",
"entries",
"retrieval"
] | train | https://github.com/mamuz/MamuzBlog/blob/cb43be5c39031e3dcc939283e284824c4d07da38/src/MamuzBlog/Controller/PostQueryController.php#L41-L52 |
mamuz/MamuzBlog | src/MamuzBlog/Controller/PostQueryController.php | PostQueryController.publishedPostAction | public function publishedPostAction()
{
$encryptedId = $this->params()->fromRoute('id');
if ($decryptedId = $this->cryptEngine->decrypt($encryptedId)) {
$post = $this->queryService->findPublishedPostById($decryptedId);
}
if (!isset($post)) {
return $this->nul... | php | public function publishedPostAction()
{
$encryptedId = $this->params()->fromRoute('id');
if ($decryptedId = $this->cryptEngine->decrypt($encryptedId)) {
$post = $this->queryService->findPublishedPostById($decryptedId);
}
if (!isset($post)) {
return $this->nul... | [
"public",
"function",
"publishedPostAction",
"(",
")",
"{",
"$",
"encryptedId",
"=",
"$",
"this",
"->",
"params",
"(",
")",
"->",
"fromRoute",
"(",
"'id'",
")",
";",
"if",
"(",
"$",
"decryptedId",
"=",
"$",
"this",
"->",
"cryptEngine",
"->",
"decrypt",
... | Published post entry retrieval
@return ModelInterface|null|\Zend\Http\Response | [
"Published",
"post",
"entry",
"retrieval"
] | train | https://github.com/mamuz/MamuzBlog/blob/cb43be5c39031e3dcc939283e284824c4d07da38/src/MamuzBlog/Controller/PostQueryController.php#L59-L82 |
incraigulous/contentful-sdk | src/RequestDecorator.php | RequestDecorator.buildPayload | function buildPayload(&$payload)
{
if (is_array($payload)) {
$payload = $this->array_map_deep($payload, array($this, 'buildPayloadItemInfo'));
} else {
$payload = $this->makePayloadBuilder($payload);
$this->buildPayload($payload);
}
return $payloa... | php | function buildPayload(&$payload)
{
if (is_array($payload)) {
$payload = $this->array_map_deep($payload, array($this, 'buildPayloadItemInfo'));
} else {
$payload = $this->makePayloadBuilder($payload);
$this->buildPayload($payload);
}
return $payloa... | [
"function",
"buildPayload",
"(",
"&",
"$",
"payload",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"payload",
")",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"array_map_deep",
"(",
"$",
"payload",
",",
"array",
"(",
"$",
"this",
",",
"'buildPayl... | Parse the payload to check for PayloadBuilder objects and make them.
@param $payload
@return array | [
"Parse",
"the",
"payload",
"to",
"check",
"for",
"PayloadBuilder",
"objects",
"and",
"make",
"them",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/RequestDecorator.php#L77-L87 |
incraigulous/contentful-sdk | src/RequestDecorator.php | RequestDecorator.array_map_deep | function array_map_deep($array, $callback) {
$new = array();
if(is_array($array)) foreach ($array as $key => $val) {
if (is_array($val)) {
$new[$key] = $this->array_map_deep($val, $callback);
} else {
$item = call_user_func($callback, $key, $val);
... | php | function array_map_deep($array, $callback) {
$new = array();
if(is_array($array)) foreach ($array as $key => $val) {
if (is_array($val)) {
$new[$key] = $this->array_map_deep($val, $callback);
} else {
$item = call_user_func($callback, $key, $val);
... | [
"function",
"array_map_deep",
"(",
"$",
"array",
",",
"$",
"callback",
")",
"{",
"$",
"new",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"array",
")",
")",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
... | Helper function: Applies the callback to each level of array.
@param $array
@param $callback
@return array|mixed | [
"Helper",
"function",
":",
"Applies",
"the",
"callback",
"to",
"each",
"level",
"of",
"array",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/RequestDecorator.php#L96-L108 |
incraigulous/contentful-sdk | src/RequestDecorator.php | RequestDecorator.buildPayloadItemInfo | function buildPayloadItemInfo($key, $item)
{
if (is_object($item)) {
$key = ($this->getPayloadBuilderKey($item)) ? $this->getPayloadBuilderKey($item) : $key;
$item = $this->makePayloadBuilder($item);
}
return array(
'key' => $key,
'item' => $it... | php | function buildPayloadItemInfo($key, $item)
{
if (is_object($item)) {
$key = ($this->getPayloadBuilderKey($item)) ? $this->getPayloadBuilderKey($item) : $key;
$item = $this->makePayloadBuilder($item);
}
return array(
'key' => $key,
'item' => $it... | [
"function",
"buildPayloadItemInfo",
"(",
"$",
"key",
",",
"$",
"item",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"item",
")",
")",
"{",
"$",
"key",
"=",
"(",
"$",
"this",
"->",
"getPayloadBuilderKey",
"(",
"$",
"item",
")",
")",
"?",
"$",
"this",... | The array_map_deep callback for buildPayload. If the array part is an object, it attempts to make payloadBuilder.
@param $item
@return array | [
"The",
"array_map_deep",
"callback",
"for",
"buildPayload",
".",
"If",
"the",
"array",
"part",
"is",
"an",
"object",
"it",
"attempts",
"to",
"make",
"payloadBuilder",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/RequestDecorator.php#L116-L126 |
incraigulous/contentful-sdk | src/RequestDecorator.php | RequestDecorator.makeQuery | function makeQuery()
{
$query = array();
foreach($this->query as $paramater) {
$operator = ($paramater[1] != '=') ? $paramater[1] : '' ;
$query[$paramater[0] . $operator] = $paramater[2];
}
return $query;
} | php | function makeQuery()
{
$query = array();
foreach($this->query as $paramater) {
$operator = ($paramater[1] != '=') ? $paramater[1] : '' ;
$query[$paramater[0] . $operator] = $paramater[2];
}
return $query;
} | [
"function",
"makeQuery",
"(",
")",
"{",
"$",
"query",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"query",
"as",
"$",
"paramater",
")",
"{",
"$",
"operator",
"=",
"(",
"$",
"paramater",
"[",
"1",
"]",
"!=",
"'='",
")",
"?",
... | Return an array ready to be http encoded.
@return array | [
"Return",
"an",
"array",
"ready",
"to",
"be",
"http",
"encoded",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/RequestDecorator.php#L152-L160 |
incraigulous/contentful-sdk | src/RequestDecorator.php | RequestDecorator.makeResource | function makeResource()
{
$resource = $this->resource;
if ($this->id) $resource .= '/' . $this->id;
return $resource;
} | php | function makeResource()
{
$resource = $this->resource;
if ($this->id) $resource .= '/' . $this->id;
return $resource;
} | [
"function",
"makeResource",
"(",
")",
"{",
"$",
"resource",
"=",
"$",
"this",
"->",
"resource",
";",
"if",
"(",
"$",
"this",
"->",
"id",
")",
"$",
"resource",
".=",
"'/'",
".",
"$",
"this",
"->",
"id",
";",
"return",
"$",
"resource",
";",
"}"
] | Return the resource url part.
@return string | [
"Return",
"the",
"resource",
"url",
"part",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/RequestDecorator.php#L182-L187 |
mamuz/MamuzBlog | src/MamuzBlog/View/Helper/TagListFactory.php | TagListFactory.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
if ($serviceLocator instanceof ServiceLocatorAwareInterface) {
$serviceLocator = $serviceLocator->getServiceLocator();
}
/** @var \Zend\Mvc\Application $application */
$application = $serviceLocator... | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
if ($serviceLocator instanceof ServiceLocatorAwareInterface) {
$serviceLocator = $serviceLocator->getServiceLocator();
}
/** @var \Zend\Mvc\Application $application */
$application = $serviceLocator... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"if",
"(",
"$",
"serviceLocator",
"instanceof",
"ServiceLocatorAwareInterface",
")",
"{",
"$",
"serviceLocator",
"=",
"$",
"serviceLocator",
"->",
"getServiceLocator"... | {@inheritdoc}
@return \Zend\View\Helper\HelperInterface | [
"{"
] | train | https://github.com/mamuz/MamuzBlog/blob/cb43be5c39031e3dcc939283e284824c4d07da38/src/MamuzBlog/View/Helper/TagListFactory.php#L15-L31 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StatefulScanner.php | StatefulScanner.pushState | public function pushState($stateData)
{
$tokenNode = array('token_name' => $stateData[0], 'children' => array());
$this->pushChild($tokenNode);
$this->push($stateData);
} | php | public function pushState($stateData)
{
$tokenNode = array('token_name' => $stateData[0], 'children' => array());
$this->pushChild($tokenNode);
$this->push($stateData);
} | [
"public",
"function",
"pushState",
"(",
"$",
"stateData",
")",
"{",
"$",
"tokenNode",
"=",
"array",
"(",
"'token_name'",
"=>",
"$",
"stateData",
"[",
"0",
"]",
",",
"'children'",
"=>",
"array",
"(",
")",
")",
";",
"$",
"this",
"->",
"pushChild",
"(",
... | @brief Pushes a state
@param $state_data A tuple of ($name, $open_pattern, $teminate_pattern).
This should be as it is stored in LuminousStatefulScanner::patterns
This actually causes two push operations. One is onto the token_tree_stack,
and the other is onto the actual stack. The former creates a new token,
the lat... | [
"@brief",
"Pushes",
"a",
"state"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StatefulScanner.php#L117-L122 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StatefulScanner.php | StatefulScanner.popState | public function popState()
{
$c = count($this->tokenTreeStack);
if ($c <= 1) {
throw new Exception('Attempted to pop the initial state');
}
$s = array_pop($this->tokenTreeStack);
// -2 because we popped once since counting
$this->tokenTreeStack[$c - 2]['ch... | php | public function popState()
{
$c = count($this->tokenTreeStack);
if ($c <= 1) {
throw new Exception('Attempted to pop the initial state');
}
$s = array_pop($this->tokenTreeStack);
// -2 because we popped once since counting
$this->tokenTreeStack[$c - 2]['ch... | [
"public",
"function",
"popState",
"(",
")",
"{",
"$",
"c",
"=",
"count",
"(",
"$",
"this",
"->",
"tokenTreeStack",
")",
";",
"if",
"(",
"$",
"c",
"<=",
"1",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Attempted to pop the initial state'",
")",
";",
"... | @brief Pops a state from the stack.
The top token on the token_tree_stack is popped and appended as a child to
the new top token.
The top state on the state stack is popped and discarded.
@throw Exception if there is only the initial state on the stack
(we cannot pop the initial state, because then we have no state a... | [
"@brief",
"Pops",
"a",
"state",
"from",
"the",
"stack",
"."
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StatefulScanner.php#L134-L144 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StatefulScanner.php | StatefulScanner.addTransition | public function addTransition($from, $to)
{
if (!isset($this->transitions[$from])) {
$this->transitions[$from] = array();
}
$this->transitions[$from][] = $to;
} | php | public function addTransition($from, $to)
{
if (!isset($this->transitions[$from])) {
$this->transitions[$from] = array();
}
$this->transitions[$from][] = $to;
} | [
"public",
"function",
"addTransition",
"(",
"$",
"from",
",",
"$",
"to",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"transitions",
"[",
"$",
"from",
"]",
")",
")",
"{",
"$",
"this",
"->",
"transitions",
"[",
"$",
"from",
"]",
"=",... | @brief Adds a state transition
This is a helper function for LuminousStatefulScanner::transitions, you
can specify it directly instead
@param $from The parent state
@param $to The child state | [
"@brief",
"Adds",
"a",
"state",
"transition"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StatefulScanner.php#L154-L160 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StatefulScanner.php | StatefulScanner.addPattern | public function addPattern($name, $pattern, $end = null, $consume = true)
{
$this->patterns[] = array($name, $pattern, $end, $consume);
} | php | public function addPattern($name, $pattern, $end = null, $consume = true)
{
$this->patterns[] = array($name, $pattern, $end, $consume);
} | [
"public",
"function",
"addPattern",
"(",
"$",
"name",
",",
"$",
"pattern",
",",
"$",
"end",
"=",
"null",
",",
"$",
"consume",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"patterns",
"[",
"]",
"=",
"array",
"(",
"$",
"name",
",",
"$",
"pattern",
","... | @brief Adds a pattern
@param $name the name of the pattern/state
@param $pattern Either the entire pattern, or just its opening delimiter
@param $end If $pattern was just the opening delimiter, $end is the closing
delimiter. Separating the two delimiters like this makes the state flexible
length, as state transitions ... | [
"@brief",
"Adds",
"a",
"pattern"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StatefulScanner.php#L187-L190 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StatefulScanner.php | StatefulScanner.loadTransitions | public function loadTransitions()
{
$stateName = $this->stateName();
if ($this->lastState === $stateName) {
return;
}
$this->lastState = $stateName;
if (isset($this->transitions[$stateName])) {
$this->legalTransitions = $this->transitions[$this->stateN... | php | public function loadTransitions()
{
$stateName = $this->stateName();
if ($this->lastState === $stateName) {
return;
}
$this->lastState = $stateName;
if (isset($this->transitions[$stateName])) {
$this->legalTransitions = $this->transitions[$this->stateN... | [
"public",
"function",
"loadTransitions",
"(",
")",
"{",
"$",
"stateName",
"=",
"$",
"this",
"->",
"stateName",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"lastState",
"===",
"$",
"stateName",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"lastSt... | @brief Loads legal state transitions for the current state
Loads in legal state transitions into the legal_transitions array
according to the current state | [
"@brief",
"Loads",
"legal",
"state",
"transitions",
"for",
"the",
"current",
"state"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StatefulScanner.php#L198-L210 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StatefulScanner.php | StatefulScanner.nextEndData | public function nextEndData()
{
$stateData = $this->state();
if ($stateData === null) {
return array(-1, null); // init/root state
}
$termPattern = $stateData[2];
assert($termPattern !== null);
$data = $this->getNext(array($termPattern));
return $d... | php | public function nextEndData()
{
$stateData = $this->state();
if ($stateData === null) {
return array(-1, null); // init/root state
}
$termPattern = $stateData[2];
assert($termPattern !== null);
$data = $this->getNext(array($termPattern));
return $d... | [
"public",
"function",
"nextEndData",
"(",
")",
"{",
"$",
"stateData",
"=",
"$",
"this",
"->",
"state",
"(",
")",
";",
"if",
"(",
"$",
"stateData",
"===",
"null",
")",
"{",
"return",
"array",
"(",
"-",
"1",
",",
"null",
")",
";",
"// init/root state",... | @brief Looks for the next state-pop sequence (close/end) for the current state
@returns Data in the same format as get_next: a tuple of (next, matches).
If no match is found, next is -1 and matches is null | [
"@brief",
"Looks",
"for",
"the",
"next",
"state",
"-",
"pop",
"sequence",
"(",
"close",
"/",
"end",
")",
"for",
"the",
"current",
"state"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StatefulScanner.php#L218-L228 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StatefulScanner.php | StatefulScanner.nextStartData | public function nextStartData()
{
$patterns = array();
$states = array();
$sn = $this->stateName();
// at the moment we are using get_next_named, so we have to convert
// our patterns into key=>pattern so it can return to us a key. We use
// numerical indices which al... | php | public function nextStartData()
{
$patterns = array();
$states = array();
$sn = $this->stateName();
// at the moment we are using get_next_named, so we have to convert
// our patterns into key=>pattern so it can return to us a key. We use
// numerical indices which al... | [
"public",
"function",
"nextStartData",
"(",
")",
"{",
"$",
"patterns",
"=",
"array",
"(",
")",
";",
"$",
"states",
"=",
"array",
"(",
")",
";",
"$",
"sn",
"=",
"$",
"this",
"->",
"stateName",
"(",
")",
";",
"// at the moment we are using get_next_named, so... | @brief Looks for the next legal state transition
@returns A tuple of (pattern_data, next, matches).
If no match is found, next is -1 and pattern_data and matches is null | [
"@brief",
"Looks",
"for",
"the",
"next",
"legal",
"state",
"transition"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StatefulScanner.php#L236-L266 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StatefulScanner.php | StatefulScanner.setup | protected function setup()
{
if ($this->setup) {
return;
}
$this->setup = true;
if (!isset($this->transitions['initial'])) {
$initial = array();
foreach ($this->patterns as $p) {
$initial[] = $p[0];
}
$this->... | php | protected function setup()
{
if ($this->setup) {
return;
}
$this->setup = true;
if (!isset($this->transitions['initial'])) {
$initial = array();
foreach ($this->patterns as $p) {
$initial[] = $p[0];
}
$this->... | [
"protected",
"function",
"setup",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"setup",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"setup",
"=",
"true",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"transitions",
"[",
"'initial'",
... | @brief Sets up the FSM
If the caller has omitted to specify an initial state then one is created,
with valid transitions to all other known states. We also push the
initial state onto the tree stack, and add a type mapping from the initial
type to @c NULL. | [
"@brief",
"Sets",
"up",
"the",
"FSM"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StatefulScanner.php#L276-L291 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StatefulScanner.php | StatefulScanner.record | public function record($str, $dummy1 = null, $dummy2 = null)
{
if ($dummy1 !== null || $dummy2 !== null) {
throw new Exception(
'Luminous\\Core\\Scanners\\StatefulScanner::record does not currently observe its second and third '
. 'parameters'
);
... | php | public function record($str, $dummy1 = null, $dummy2 = null)
{
if ($dummy1 !== null || $dummy2 !== null) {
throw new Exception(
'Luminous\\Core\\Scanners\\StatefulScanner::record does not currently observe its second and third '
. 'parameters'
);
... | [
"public",
"function",
"record",
"(",
"$",
"str",
",",
"$",
"dummy1",
"=",
"null",
",",
"$",
"dummy2",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"dummy1",
"!==",
"null",
"||",
"$",
"dummy2",
"!==",
"null",
")",
"{",
"throw",
"new",
"Exception",
"(",
... | Records a string as a child of the currently active token
@warning the second and third parameters are not applicable to this
method, they are only present to suppress PHP warnings. If you set them,
an exception is thrown. | [
"Records",
"a",
"string",
"as",
"a",
"child",
"of",
"the",
"currently",
"active",
"token"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StatefulScanner.php#L299-L311 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StatefulScanner.php | StatefulScanner.recordToken | public function recordToken($str, $type)
{
$stateData = array($type);
$this->pushState($stateData);
$this->record($str);
$this->popState();
} | php | public function recordToken($str, $type)
{
$stateData = array($type);
$this->pushState($stateData);
$this->record($str);
$this->popState();
} | [
"public",
"function",
"recordToken",
"(",
"$",
"str",
",",
"$",
"type",
")",
"{",
"$",
"stateData",
"=",
"array",
"(",
"$",
"type",
")",
";",
"$",
"this",
"->",
"pushState",
"(",
"$",
"stateData",
")",
";",
"$",
"this",
"->",
"record",
"(",
"$",
... | @brief Records a complete token
This is shorthand for pushing a new node onto the stack, recording its
text, and then popping it
@param $str the string
@param $type the token type | [
"@brief",
"Records",
"a",
"complete",
"token",
"This",
"is",
"shorthand",
"for",
"pushing",
"a",
"new",
"node",
"onto",
"the",
"stack",
"recording",
"its",
"text",
"and",
"then",
"popping",
"it"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StatefulScanner.php#L321-L327 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StatefulScanner.php | StatefulScanner.main | public function main()
{
$this->setup();
while (!$this->eos()) {
$p = $this->pos();
$state = $this->stateName();
$this->loadTransitions();
list($nextPatternData, $nextPatternIndex, $nextPatternMatches) = $this->nextStartData();
list($endIn... | php | public function main()
{
$this->setup();
while (!$this->eos()) {
$p = $this->pos();
$state = $this->stateName();
$this->loadTransitions();
list($nextPatternData, $nextPatternIndex, $nextPatternMatches) = $this->nextStartData();
list($endIn... | [
"public",
"function",
"main",
"(",
")",
"{",
"$",
"this",
"->",
"setup",
"(",
")",
";",
"while",
"(",
"!",
"$",
"this",
"->",
"eos",
"(",
")",
")",
"{",
"$",
"p",
"=",
"$",
"this",
"->",
"pos",
"(",
")",
";",
"$",
"state",
"=",
"$",
"this",... | Generic main function which observes the transition table | [
"Generic",
"main",
"function",
"which",
"observes",
"the",
"transition",
"table"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StatefulScanner.php#L361-L424 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StatefulScanner.php | StatefulScanner.collapseTokenTree | protected function collapseTokenTree($node)
{
$text = '';
foreach ($node['children'] as $c) {
if (is_string($c)) {
$text .= Utils::escapeString($c);
} else {
$text .= $this->collapseTokenTree($c);
}
}
$tokenName = $n... | php | protected function collapseTokenTree($node)
{
$text = '';
foreach ($node['children'] as $c) {
if (is_string($c)) {
$text .= Utils::escapeString($c);
} else {
$text .= $this->collapseTokenTree($c);
}
}
$tokenName = $n... | [
"protected",
"function",
"collapseTokenTree",
"(",
"$",
"node",
")",
"{",
"$",
"text",
"=",
"''",
";",
"foreach",
"(",
"$",
"node",
"[",
"'children'",
"]",
"as",
"$",
"c",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"c",
")",
")",
"{",
"$",
"text... | Recursive function to collapse the token tree into XML
@internal | [
"Recursive",
"function",
"to",
"collapse",
"the",
"token",
"tree",
"into",
"XML"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StatefulScanner.php#L430-L453 |
christophe-brachet/aspi-framework | src/Framework/Form/Element/Input/Csrf.php | Csrf.createNewToken | public function createNewToken($value, $expire = 300)
{
$this->token = [
'value' => sha1(rand(10000, getrandmax()) . $value),
'expire' => (int)$expire,
'start' => time()
];
$_SESSION['pop_csrf'] = serialize($this->token);
return $this;
} | php | public function createNewToken($value, $expire = 300)
{
$this->token = [
'value' => sha1(rand(10000, getrandmax()) . $value),
'expire' => (int)$expire,
'start' => time()
];
$_SESSION['pop_csrf'] = serialize($this->token);
return $this;
} | [
"public",
"function",
"createNewToken",
"(",
"$",
"value",
",",
"$",
"expire",
"=",
"300",
")",
"{",
"$",
"this",
"->",
"token",
"=",
"[",
"'value'",
"=>",
"sha1",
"(",
"rand",
"(",
"10000",
",",
"getrandmax",
"(",
")",
")",
".",
"$",
"value",
")",... | Set the token of the csrf form element
@param string $value
@param int $expire
@return Csrf | [
"Set",
"the",
"token",
"of",
"the",
"csrf",
"form",
"element"
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/Input/Csrf.php#L63-L72 |
christophe-brachet/aspi-framework | src/Framework/Form/Element/Input/Csrf.php | Csrf.setValidator | protected function setValidator()
{
// Get query data
if (!isset($_SERVER['REQUEST_METHOD'])) {
throw new Exception('Error: The server request method is not set.');
}
$queryData = [];
switch ($_SERVER['REQUEST_METHOD']) {
case 'GET':
$q... | php | protected function setValidator()
{
// Get query data
if (!isset($_SERVER['REQUEST_METHOD'])) {
throw new Exception('Error: The server request method is not set.');
}
$queryData = [];
switch ($_SERVER['REQUEST_METHOD']) {
case 'GET':
$q... | [
"protected",
"function",
"setValidator",
"(",
")",
"{",
"// Get query data",
"if",
"(",
"!",
"isset",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_METHOD'",
"]",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Error: The server request method is not set.'",
")",
";",
... | Set the validator
@throws Exception
@return void | [
"Set",
"the",
"validator"
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/Input/Csrf.php#L79-L106 |
sifophp/sifo-common-instance | controllers/shared/head.php | SharedHeadController.assignMedia | protected function assignMedia()
{
// On development create all the packed files on the fly:
if ( \Sifo\Domains::getInstance()->getDevMode() )
{
$packer = new \Sifo\JsPacker();
$packer->packMedia();
$packer = new \Sifo\CssPacker();
$packer->packMedia();
}
$this->assign( 'media', \Sifo\Config::g... | php | protected function assignMedia()
{
// On development create all the packed files on the fly:
if ( \Sifo\Domains::getInstance()->getDevMode() )
{
$packer = new \Sifo\JsPacker();
$packer->packMedia();
$packer = new \Sifo\CssPacker();
$packer->packMedia();
}
$this->assign( 'media', \Sifo\Config::g... | [
"protected",
"function",
"assignMedia",
"(",
")",
"{",
"// On development create all the packed files on the fly:",
"if",
"(",
"\\",
"Sifo",
"\\",
"Domains",
"::",
"getInstance",
"(",
")",
"->",
"getDevMode",
"(",
")",
")",
"{",
"$",
"packer",
"=",
"new",
"\\",
... | Assign a variable to the tpl with the HTML code to load the JS and CSS files. | [
"Assign",
"a",
"variable",
"to",
"the",
"tpl",
"with",
"the",
"HTML",
"code",
"to",
"load",
"the",
"JS",
"and",
"CSS",
"files",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/shared/head.php#L48-L67 |
eddiejaoude/zf2-logger | src/Zf2Logger/Listener/Response.php | Response.removeListener | public function removeListener($index)
{
if (!empty($this->listeners[$index])) {
unset($this->listeners[$index]);
return true;
}
return false;
} | php | public function removeListener($index)
{
if (!empty($this->listeners[$index])) {
unset($this->listeners[$index]);
return true;
}
return false;
} | [
"public",
"function",
"removeListener",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"index",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"index",
"]",
")",
"... | @param int $index
@return bool | [
"@param",
"int",
"$index"
] | train | https://github.com/eddiejaoude/zf2-logger/blob/8c7ae273e41e851fe2d525051206541cb1bf6b60/src/Zf2Logger/Listener/Response.php#L109-L118 |
DevGroup-ru/yii2-data-structure-tools | src/models/Property.php | Property.search | public function search($propertyGroupId, $params, $showHidden = false)
{
$query = self::find();
if ($propertyGroupId !== null) {
$query
->innerJoin(
'{{%property_property_group}}',
'property_property_group.property_id = id'
... | php | public function search($propertyGroupId, $params, $showHidden = false)
{
$query = self::find();
if ($propertyGroupId !== null) {
$query
->innerJoin(
'{{%property_property_group}}',
'property_property_group.property_id = id'
... | [
"public",
"function",
"search",
"(",
"$",
"propertyGroupId",
",",
"$",
"params",
",",
"$",
"showHidden",
"=",
"false",
")",
"{",
"$",
"query",
"=",
"self",
"::",
"find",
"(",
")",
";",
"if",
"(",
"$",
"propertyGroupId",
"!==",
"null",
")",
"{",
"$",
... | @param $propertyGroupId
@param $params
@param $showHidden
@return \yii\data\ActiveDataProvider
@codeCoverageIgnore | [
"@param",
"$propertyGroupId",
"@param",
"$params",
"@param",
"$showHidden"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/models/Property.php#L177-L223 |
DevGroup-ru/yii2-data-structure-tools | src/models/Property.php | Property.beforeSave | public function beforeSave($insert)
{
$result = parent::beforeSave($insert);
if ($result === false) {
return false;
}
$storage = PropertyStorageHelper::storageById($this->storage_id);
$status = $insert ? $storage->beforePropertyAdd($this) : $storage->beforePrope... | php | public function beforeSave($insert)
{
$result = parent::beforeSave($insert);
if ($result === false) {
return false;
}
$storage = PropertyStorageHelper::storageById($this->storage_id);
$status = $insert ? $storage->beforePropertyAdd($this) : $storage->beforePrope... | [
"public",
"function",
"beforeSave",
"(",
"$",
"insert",
")",
"{",
"$",
"result",
"=",
"parent",
"::",
"beforeSave",
"(",
"$",
"insert",
")",
";",
"if",
"(",
"$",
"result",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"$",
"storage",
"=",
... | Perform beforeSave events and do other needed stuff:
- send event to property handler(he may want to force is_numeric for example)
@param bool $insert
@return bool
@throws \Exception | [
"Perform",
"beforeSave",
"events",
"and",
"do",
"other",
"needed",
"stuff",
":",
"-",
"send",
"event",
"to",
"property",
"handler",
"(",
"he",
"may",
"want",
"to",
"force",
"is_numeric",
"for",
"example",
")"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/models/Property.php#L234-L250 |
DevGroup-ru/yii2-data-structure-tools | src/models/Property.php | Property.afterSave | public function afterSave($insert, $changedAttributes)
{
parent::afterSave($insert, $changedAttributes);
if (isset($changedAttributes['key'])) {
Yii::$app->cache->delete("PropertyKeyForId:{$this->id}");
}
$handler = PropertyHandlerHelper::getInstance()->handlerById($this-... | php | public function afterSave($insert, $changedAttributes)
{
parent::afterSave($insert, $changedAttributes);
if (isset($changedAttributes['key'])) {
Yii::$app->cache->delete("PropertyKeyForId:{$this->id}");
}
$handler = PropertyHandlerHelper::getInstance()->handlerById($this-... | [
"public",
"function",
"afterSave",
"(",
"$",
"insert",
",",
"$",
"changedAttributes",
")",
"{",
"parent",
"::",
"afterSave",
"(",
"$",
"insert",
",",
"$",
"changedAttributes",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"changedAttributes",
"[",
"'key'",
"]",
... | Perform afterSave events:
- flush needed caches
- trigger afterPropertyModelSave event of corresponding PropertyHandler
@param bool $insert
@param array $changedAttributes | [
"Perform",
"afterSave",
"events",
":",
"-",
"flush",
"needed",
"caches",
"-",
"trigger",
"afterPropertyModelSave",
"event",
"of",
"corresponding",
"PropertyHandler"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/models/Property.php#L260-L282 |
DevGroup-ru/yii2-data-structure-tools | src/models/Property.php | Property.beforeDelete | public function beforeDelete()
{
if (parent::beforeDelete() === false) {
return false;
}
$storage = PropertyStorageHelper::storageById($this->storage_id);
return $storage->beforePropertyDelete($this);
} | php | public function beforeDelete()
{
if (parent::beforeDelete() === false) {
return false;
}
$storage = PropertyStorageHelper::storageById($this->storage_id);
return $storage->beforePropertyDelete($this);
} | [
"public",
"function",
"beforeDelete",
"(",
")",
"{",
"if",
"(",
"parent",
"::",
"beforeDelete",
"(",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"$",
"storage",
"=",
"PropertyStorageHelper",
"::",
"storageById",
"(",
"$",
"this",
"->",
"s... | Perform beforeDelete events
@return bool events status
@throws ServerErrorHttpException | [
"Perform",
"beforeDelete",
"events"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/models/Property.php#L290-L297 |
DevGroup-ru/yii2-data-structure-tools | src/models/Property.php | Property.beforeValidate | public function beforeValidate()
{
$validation = parent::beforeValidate();
return $validation && PropertyStorageHelper::storageById($this->storage_id)->beforePropertyValidate($this);
} | php | public function beforeValidate()
{
$validation = parent::beforeValidate();
return $validation && PropertyStorageHelper::storageById($this->storage_id)->beforePropertyValidate($this);
} | [
"public",
"function",
"beforeValidate",
"(",
")",
"{",
"$",
"validation",
"=",
"parent",
"::",
"beforeValidate",
"(",
")",
";",
"return",
"$",
"validation",
"&&",
"PropertyStorageHelper",
"::",
"storageById",
"(",
"$",
"this",
"->",
"storage_id",
")",
"->",
... | Perform beforeValidate events
@return bool
@throws ServerErrorHttpException | [
"Perform",
"beforeValidate",
"events"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/models/Property.php#L314-L318 |
DevGroup-ru/yii2-data-structure-tools | src/models/Property.php | Property.afterFind | public function afterFind()
{
parent::afterFind();
static::$propertyIdToKey[$this->id] = $this->key;
static::$identityMap[$this->id] = $this;
// cast scalar values
$this->allow_multiple_values = (bool) $this->allow_multiple_values;
$this->is_internal = (bool) $this->... | php | public function afterFind()
{
parent::afterFind();
static::$propertyIdToKey[$this->id] = $this->key;
static::$identityMap[$this->id] = $this;
// cast scalar values
$this->allow_multiple_values = (bool) $this->allow_multiple_values;
$this->is_internal = (bool) $this->... | [
"public",
"function",
"afterFind",
"(",
")",
"{",
"parent",
"::",
"afterFind",
"(",
")",
";",
"static",
"::",
"$",
"propertyIdToKey",
"[",
"$",
"this",
"->",
"id",
"]",
"=",
"$",
"this",
"->",
"key",
";",
"static",
"::",
"$",
"identityMap",
"[",
"$",... | Perform afterFind events, fill static variable(per-process memory cache) | [
"Perform",
"afterFind",
"events",
"fill",
"static",
"variable",
"(",
"per",
"-",
"process",
"memory",
"cache",
")"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/models/Property.php#L333-L344 |
DevGroup-ru/yii2-data-structure-tools | src/models/Property.php | Property.propertyKeyForId | public static function propertyKeyForId($propertyId)
{
if (isset(static::$identityMap[$propertyId])) {
return static::$identityMap[$propertyId]->key;
}
if (isset(static::$propertyIdToKey[$propertyId])) {
return static::$propertyIdToKey[$propertyId];
}
... | php | public static function propertyKeyForId($propertyId)
{
if (isset(static::$identityMap[$propertyId])) {
return static::$identityMap[$propertyId]->key;
}
if (isset(static::$propertyIdToKey[$propertyId])) {
return static::$propertyIdToKey[$propertyId];
}
... | [
"public",
"static",
"function",
"propertyKeyForId",
"(",
"$",
"propertyId",
")",
"{",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"identityMap",
"[",
"$",
"propertyId",
"]",
")",
")",
"{",
"return",
"static",
"::",
"$",
"identityMap",
"[",
"$",
"proper... | Returns property key by property id.
Uses identityMap, $propertyIdToKey static variable(per-process memory cache), lazy cache for db query
@param int $propertyId
@return string|null | [
"Returns",
"property",
"key",
"by",
"property",
"id",
".",
"Uses",
"identityMap",
"$propertyIdToKey",
"static",
"variable",
"(",
"per",
"-",
"process",
"memory",
"cache",
")",
"lazy",
"cache",
"for",
"db",
"query"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/models/Property.php#L364-L386 |
DevGroup-ru/yii2-data-structure-tools | src/models/Property.php | Property.castValueToDataType | public static function castValueToDataType($value, $type)
{
switch ($type) {
case Property::DATA_TYPE_FLOAT:
return empty($value) ? null : (float) $value;
break;
case Property::DATA_TYPE_BOOLEAN:
return empty($value) ? null : (bool) $v... | php | public static function castValueToDataType($value, $type)
{
switch ($type) {
case Property::DATA_TYPE_FLOAT:
return empty($value) ? null : (float) $value;
break;
case Property::DATA_TYPE_BOOLEAN:
return empty($value) ? null : (bool) $v... | [
"public",
"static",
"function",
"castValueToDataType",
"(",
"$",
"value",
",",
"$",
"type",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"Property",
"::",
"DATA_TYPE_FLOAT",
":",
"return",
"empty",
"(",
"$",
"value",
")",
"?",
"null",
":",
"... | Casts value to data type
@param mixed $value
@param integer $type
@return mixed | [
"Casts",
"value",
"to",
"data",
"type"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/models/Property.php#L407-L426 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.