id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
192,700 | LartTyler/PHP-DaybreakCommons | src/DaybreakStudios/Common/IO/CsvFileReader.php | CsvFileReader.addField | public function addField($name, $transformer = null, $pos = null) {
if ($pos === null)
$pos = sizeof($this->fields);
$this->fields[$pos] = $name;
if (is_callable($transformer))
$this->transformers[$pos] = $transformer;
else if ($transformer !== null)
throw new InvalidArgumentException('The tra... | php | public function addField($name, $transformer = null, $pos = null) {
if ($pos === null)
$pos = sizeof($this->fields);
$this->fields[$pos] = $name;
if (is_callable($transformer))
$this->transformers[$pos] = $transformer;
else if ($transformer !== null)
throw new InvalidArgumentException('The tra... | [
"public",
"function",
"addField",
"(",
"$",
"name",
",",
"$",
"transformer",
"=",
"null",
",",
"$",
"pos",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"pos",
"===",
"null",
")",
"$",
"pos",
"=",
"sizeof",
"(",
"$",
"this",
"->",
"fields",
")",
";",
... | Adds a named field to a CSV row.
@param string $name the name of the field
@param callable $transformer optional; a callback that can be used to transform the field value
@param int $pos optional; the column number of the field, if not specified it will append the
colum name to the list
@return C... | [
"Adds",
"a",
"named",
"field",
"to",
"a",
"CSV",
"row",
"."
] | db25b5d6cea9b5a1d5afc4c5548a2cbc3018bc0d | https://github.com/LartTyler/PHP-DaybreakCommons/blob/db25b5d6cea9b5a1d5afc4c5548a2cbc3018bc0d/src/DaybreakStudios/Common/IO/CsvFileReader.php#L19-L31 |
192,701 | LartTyler/PHP-DaybreakCommons | src/DaybreakStudios/Common/IO/CsvFileReader.php | CsvFileReader.addFields | public function addFields(array $fields) {
foreach ($fields as $k => $v)
if (is_string($k))
$this->addField($k, $v);
else
$this->addField($v);
return $this;
} | php | public function addFields(array $fields) {
foreach ($fields as $k => $v)
if (is_string($k))
$this->addField($k, $v);
else
$this->addField($v);
return $this;
} | [
"public",
"function",
"addFields",
"(",
"array",
"$",
"fields",
")",
"{",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"if",
"(",
"is_string",
"(",
"$",
"k",
")",
")",
"$",
"this",
"->",
"addField",
"(",
"$",
"k",
",",
"$... | Adds multiple fields with an optional transformer to a CSV row.
@param array $fields the fields to add; can either be an array of string names, or an associative array where
the array key is the field name, and the value is the transformer to use for that column
@return CsvFileReader an object reference for method cha... | [
"Adds",
"multiple",
"fields",
"with",
"an",
"optional",
"transformer",
"to",
"a",
"CSV",
"row",
"."
] | db25b5d6cea9b5a1d5afc4c5548a2cbc3018bc0d | https://github.com/LartTyler/PHP-DaybreakCommons/blob/db25b5d6cea9b5a1d5afc4c5548a2cbc3018bc0d/src/DaybreakStudios/Common/IO/CsvFileReader.php#L40-L48 |
192,702 | CraryPrimitiveMan/php-resque | src/InitTrait.php | InitTrait.run | public function run()
{
if (empty($this->queues)) {
die('Set queues var containing the list of queues to work.' . PHP_EOL);
}
Resque::setBackend($this->redisBackend, $this->database, $this->password);
if ($this->count > 1) {
for ($i = 0; $i < $this->count; +... | php | public function run()
{
if (empty($this->queues)) {
die('Set queues var containing the list of queues to work.' . PHP_EOL);
}
Resque::setBackend($this->redisBackend, $this->database, $this->password);
if ($this->count > 1) {
for ($i = 0; $i < $this->count; +... | [
"public",
"function",
"run",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"queues",
")",
")",
"{",
"die",
"(",
"'Set queues var containing the list of queues to work.'",
".",
"PHP_EOL",
")",
";",
"}",
"Resque",
"::",
"setBackend",
"(",
"$",
"... | Run to start workers | [
"Run",
"to",
"start",
"workers"
] | eff3beba81b7f5e8d6fddb8d24c8dcde6553e209 | https://github.com/CraryPrimitiveMan/php-resque/blob/eff3beba81b7f5e8d6fddb8d24c8dcde6553e209/src/InitTrait.php#L62-L89 |
192,703 | CraryPrimitiveMan/php-resque | src/InitTrait.php | InitTrait._startWorker | protected function _startWorker()
{
$worker = new Worker($this->queues);
$worker->logLevel = $this->logLevel;
fwrite(STDOUT, '*** Starting worker ' . $worker . PHP_EOL);
$worker->work($this->interval);
} | php | protected function _startWorker()
{
$worker = new Worker($this->queues);
$worker->logLevel = $this->logLevel;
fwrite(STDOUT, '*** Starting worker ' . $worker . PHP_EOL);
$worker->work($this->interval);
} | [
"protected",
"function",
"_startWorker",
"(",
")",
"{",
"$",
"worker",
"=",
"new",
"Worker",
"(",
"$",
"this",
"->",
"queues",
")",
";",
"$",
"worker",
"->",
"logLevel",
"=",
"$",
"this",
"->",
"logLevel",
";",
"fwrite",
"(",
"STDOUT",
",",
"'*** Start... | Start a worker | [
"Start",
"a",
"worker"
] | eff3beba81b7f5e8d6fddb8d24c8dcde6553e209 | https://github.com/CraryPrimitiveMan/php-resque/blob/eff3beba81b7f5e8d6fddb8d24c8dcde6553e209/src/InitTrait.php#L94-L100 |
192,704 | hamlet-framework/http | src/Entities/JsonEntity.php | JsonEntity.getKey | public function getKey(): string
{
if ($this->key === null) {
$this->key = md5($this->getContent());
}
return $this->key;
} | php | public function getKey(): string
{
if ($this->key === null) {
$this->key = md5($this->getContent());
}
return $this->key;
} | [
"public",
"function",
"getKey",
"(",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"key",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"key",
"=",
"md5",
"(",
"$",
"this",
"->",
"getContent",
"(",
")",
")",
";",
"}",
"return",
"$",
"thi... | Get the entity key, 304 response needs a proper key value
@return string | [
"Get",
"the",
"entity",
"key",
"304",
"response",
"needs",
"a",
"proper",
"key",
"value"
] | 1d3f2a05d2914b678bf05bb53effccace82787c1 | https://github.com/hamlet-framework/http/blob/1d3f2a05d2914b678bf05bb53effccace82787c1/src/Entities/JsonEntity.php#L34-L40 |
192,705 | stubbles/stubbles-dbal | src/main/php/QueryResultIterator.php | QueryResultIterator.next | public function next()
{
$this->key++;
if (\PDO::FETCH_COLUMN !== $this->fetchMode) {
$this->current = $this->queryResult->fetch(
$this->fetchMode,
$this->driverOptions
);
} else {
$this->current = $this->queryResult... | php | public function next()
{
$this->key++;
if (\PDO::FETCH_COLUMN !== $this->fetchMode) {
$this->current = $this->queryResult->fetch(
$this->fetchMode,
$this->driverOptions
);
} else {
$this->current = $this->queryResult... | [
"public",
"function",
"next",
"(",
")",
"{",
"$",
"this",
"->",
"key",
"++",
";",
"if",
"(",
"\\",
"PDO",
"::",
"FETCH_COLUMN",
"!==",
"$",
"this",
"->",
"fetchMode",
")",
"{",
"$",
"this",
"->",
"current",
"=",
"$",
"this",
"->",
"queryResult",
"-... | iterates to next result element | [
"iterates",
"to",
"next",
"result",
"element"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/QueryResultIterator.php#L92-L105 |
192,706 | aVigorousDev/numbers | src/drmyersii/NumberSegmentFactory.php | NumberSegmentFactory.SplitIntoSegments | public static function SplitIntoSegments($number)
{
$number_str = $number->GetStringValue();
$segments = [];
$NumberSegments = [];
while (strlen($number_str) > 0)
{
if (strlen($number_str) < 3)
{
$segments[] = $number_str;
break;
}
$segment = substr($number_str, -3);
$number_str = s... | php | public static function SplitIntoSegments($number)
{
$number_str = $number->GetStringValue();
$segments = [];
$NumberSegments = [];
while (strlen($number_str) > 0)
{
if (strlen($number_str) < 3)
{
$segments[] = $number_str;
break;
}
$segment = substr($number_str, -3);
$number_str = s... | [
"public",
"static",
"function",
"SplitIntoSegments",
"(",
"$",
"number",
")",
"{",
"$",
"number_str",
"=",
"$",
"number",
"->",
"GetStringValue",
"(",
")",
";",
"$",
"segments",
"=",
"[",
"]",
";",
"$",
"NumberSegments",
"=",
"[",
"]",
";",
"while",
"(... | This will split the number into chunks and then turn them each into NumberSegments.
@param $number NumberW
@return string[] | [
"This",
"will",
"split",
"the",
"number",
"into",
"chunks",
"and",
"then",
"turn",
"them",
"each",
"into",
"NumberSegments",
"."
] | 02124e75286758d216a22d1d963946dab9e8582b | https://github.com/aVigorousDev/numbers/blob/02124e75286758d216a22d1d963946dab9e8582b/src/drmyersii/NumberSegmentFactory.php#L29-L51 |
192,707 | aVigorousDev/numbers | src/drmyersii/NumberSegmentFactory.php | NumberSegmentFactory.MakeNumberSegments | public static function MakeNumberSegments($segments)
{
$NumberSegments = [];
foreach ($segments as $segment)
{
$NumberSegments[] = new NumberSegment($segment);
}
return $NumberSegments;
} | php | public static function MakeNumberSegments($segments)
{
$NumberSegments = [];
foreach ($segments as $segment)
{
$NumberSegments[] = new NumberSegment($segment);
}
return $NumberSegments;
} | [
"public",
"static",
"function",
"MakeNumberSegments",
"(",
"$",
"segments",
")",
"{",
"$",
"NumberSegments",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"segments",
"as",
"$",
"segment",
")",
"{",
"$",
"NumberSegments",
"[",
"]",
"=",
"new",
"NumberSegment",
... | This is the actual factory method that converts regular string segments into
the number segment types we need to work with.
@param $segments string[]
@return NumberSegment[] | [
"This",
"is",
"the",
"actual",
"factory",
"method",
"that",
"converts",
"regular",
"string",
"segments",
"into",
"the",
"number",
"segment",
"types",
"we",
"need",
"to",
"work",
"with",
"."
] | 02124e75286758d216a22d1d963946dab9e8582b | https://github.com/aVigorousDev/numbers/blob/02124e75286758d216a22d1d963946dab9e8582b/src/drmyersii/NumberSegmentFactory.php#L60-L70 |
192,708 | Kris-Kuiper/sFire-Framework | src/Escaper/Escape.php | Escape.setEncoding | public static function setEncoding($encoding) {
if(false === is_string($encoding) || 0 === strlen($encoding)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($encoding)), E_USER_ERROR);
}
$encoding = strtolower($encoding);
if(f... | php | public static function setEncoding($encoding) {
if(false === is_string($encoding) || 0 === strlen($encoding)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($encoding)), E_USER_ERROR);
}
$encoding = strtolower($encoding);
if(f... | [
"public",
"static",
"function",
"setEncoding",
"(",
"$",
"encoding",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"encoding",
")",
"||",
"0",
"===",
"strlen",
"(",
"$",
"encoding",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
... | Set a new encoding
@param string $encoding | [
"Set",
"a",
"new",
"encoding"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Escaper/Escape.php#L51-L64 |
192,709 | Kris-Kuiper/sFire-Framework | src/Escaper/Escape.php | Escape.cssMatcher | private static function cssMatcher($matches) {
$chr = $matches[0];
if(1 === strlen($chr)) {
$ord = ord($chr);
}
else {
$chr = static :: convert($chr, 'UTF-8', 'UTF-32BE');
$ord = hexdec(bin2hex($chr));
}
ret... | php | private static function cssMatcher($matches) {
$chr = $matches[0];
if(1 === strlen($chr)) {
$ord = ord($chr);
}
else {
$chr = static :: convert($chr, 'UTF-8', 'UTF-32BE');
$ord = hexdec(bin2hex($chr));
}
ret... | [
"private",
"static",
"function",
"cssMatcher",
"(",
"$",
"matches",
")",
"{",
"$",
"chr",
"=",
"$",
"matches",
"[",
"0",
"]",
";",
"if",
"(",
"1",
"===",
"strlen",
"(",
"$",
"chr",
")",
")",
"{",
"$",
"ord",
"=",
"ord",
"(",
"$",
"chr",
")",
... | Callback function for preg_replace_callback that applies CSS escaping to all matches.
@param array $matches
@return string | [
"Callback",
"function",
"for",
"preg_replace_callback",
"that",
"applies",
"CSS",
"escaping",
"to",
"all",
"matches",
"."
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Escaper/Escape.php#L291-L305 |
192,710 | Kris-Kuiper/sFire-Framework | src/Escaper/Escape.php | Escape.convert | private static function convert($string, $from, $to) {
if(true === function_exists('iconv')) {
$result = iconv($from, $to, $string);
}
elseif(true === function_exists('mb_convert_encoding')) {
$result = mb_convert_encoding($string, $to, $from);
}
... | php | private static function convert($string, $from, $to) {
if(true === function_exists('iconv')) {
$result = iconv($from, $to, $string);
}
elseif(true === function_exists('mb_convert_encoding')) {
$result = mb_convert_encoding($string, $to, $from);
}
... | [
"private",
"static",
"function",
"convert",
"(",
"$",
"string",
",",
"$",
"from",
",",
"$",
"to",
")",
"{",
"if",
"(",
"true",
"===",
"function_exists",
"(",
"'iconv'",
")",
")",
"{",
"$",
"result",
"=",
"iconv",
"(",
"$",
"from",
",",
"$",
"to",
... | Converts string from encoding to another encoding
@param string $string
@param array|string $from
@param string $to
@return string | [
"Converts",
"string",
"from",
"encoding",
"to",
"another",
"encoding"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Escaper/Escape.php#L315-L332 |
192,711 | Kris-Kuiper/sFire-Framework | src/Escaper/Escape.php | Escape.toUtf8 | private static function toUtf8($string) {
if(static :: getEncoding() === 'utf-8') {
$result = $string;
}
else {
$result = static :: convert($string, static :: getEncoding(), 'UTF-8');
}
if(false === static :: isUtf8($result)) {
retu... | php | private static function toUtf8($string) {
if(static :: getEncoding() === 'utf-8') {
$result = $string;
}
else {
$result = static :: convert($string, static :: getEncoding(), 'UTF-8');
}
if(false === static :: isUtf8($result)) {
retu... | [
"private",
"static",
"function",
"toUtf8",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"static",
"::",
"getEncoding",
"(",
")",
"===",
"'utf-8'",
")",
"{",
"$",
"result",
"=",
"$",
"string",
";",
"}",
"else",
"{",
"$",
"result",
"=",
"static",
"::",
"... | Converts a string from UTF-8 to the base encoding
@param string $string
@return string | [
"Converts",
"a",
"string",
"from",
"UTF",
"-",
"8",
"to",
"the",
"base",
"encoding"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Escaper/Escape.php#L340-L354 |
192,712 | 1HappyPlace/ansi-terminal | src/ANSI/TerminalState.php | TerminalState.clear | public function clear() {
// set bold and underscore to false
$this->bold = false;
$this->underscore = false;
// set the text and fill color to empty colors
$this->textColor = new Color();
$this->fillColor = new Color();
} | php | public function clear() {
// set bold and underscore to false
$this->bold = false;
$this->underscore = false;
// set the text and fill color to empty colors
$this->textColor = new Color();
$this->fillColor = new Color();
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"// set bold and underscore to false",
"$",
"this",
"->",
"bold",
"=",
"false",
";",
"$",
"this",
"->",
"underscore",
"=",
"false",
";",
"// set the text and fill color to empty colors",
"$",
"this",
"->",
"textColor",
... | Set the state to clear, no styling | [
"Set",
"the",
"state",
"to",
"clear",
"no",
"styling"
] | 3a550eadb21bb87a6909436c3b961919d2731923 | https://github.com/1HappyPlace/ansi-terminal/blob/3a550eadb21bb87a6909436c3b961919d2731923/src/ANSI/TerminalState.php#L58-L67 |
192,713 | 1HappyPlace/ansi-terminal | src/ANSI/TerminalState.php | TerminalState.findChanges | public function findChanges(TerminalStateInterface $desired) {
// create a Terminal State object that will hold the changes needed to achieve the desired state
$ret = new self();
// bold is currently off, and the desired is to turn it on
if (!$this->isBold() && $desired... | php | public function findChanges(TerminalStateInterface $desired) {
// create a Terminal State object that will hold the changes needed to achieve the desired state
$ret = new self();
// bold is currently off, and the desired is to turn it on
if (!$this->isBold() && $desired... | [
"public",
"function",
"findChanges",
"(",
"TerminalStateInterface",
"$",
"desired",
")",
"{",
"// create a Terminal State object that will hold the changes needed to achieve the desired state",
"$",
"ret",
"=",
"new",
"self",
"(",
")",
";",
"// bold is currently off, and the desi... | Compare the desired state and capture any things that are going from off to on, if something is going
from on to off, then a clear needs to be sent along with all the desired state, in this case
this function returns null
@param TerminalStateInterface $desired
@return null | TerminalState - returns null if a clear is ... | [
"Compare",
"the",
"desired",
"state",
"and",
"capture",
"any",
"things",
"that",
"are",
"going",
"from",
"off",
"to",
"on",
"if",
"something",
"is",
"going",
"from",
"on",
"to",
"off",
"then",
"a",
"clear",
"needs",
"to",
"be",
"sent",
"along",
"with",
... | 3a550eadb21bb87a6909436c3b961919d2731923 | https://github.com/1HappyPlace/ansi-terminal/blob/3a550eadb21bb87a6909436c3b961919d2731923/src/ANSI/TerminalState.php#L203-L294 |
192,714 | TeaLabs/collections | src/Arr.php | Arr.toArray | public static function toArray($object)
{
if(is_array($object))
return $object;
elseif(!is_object($object))
return (array) $object;
elseif ($object instanceof IlluminateCollection)
return $object->all();
elseif ($object instanceof IlluminateArrayable)
return $object->toArray();
elseif(method_exis... | php | public static function toArray($object)
{
if(is_array($object))
return $object;
elseif(!is_object($object))
return (array) $object;
elseif ($object instanceof IlluminateCollection)
return $object->all();
elseif ($object instanceof IlluminateArrayable)
return $object->toArray();
elseif(method_exis... | [
"public",
"static",
"function",
"toArray",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"object",
")",
")",
"return",
"$",
"object",
";",
"elseif",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
")",
"return",
"(",
"array",
")",
... | Cast the given object to an array
@param mixed $object
@return array | [
"Cast",
"the",
"given",
"object",
"to",
"an",
"array"
] | 5d8885b2799791c0bcbff4e6cbacddb270b4288e | https://github.com/TeaLabs/collections/blob/5d8885b2799791c0bcbff4e6cbacddb270b4288e/src/Arr.php#L294-L314 |
192,715 | phpffcms/ffcms-core | src/Arch/ActiveModel.php | ActiveModel.getLocaled | public function getLocaled(string $attribute)
{
// if always decoded
if (Any::isArray($this->{$attribute})) {
return $this->{$attribute}[App::$Request->getLanguage()];
}
if (!Any::isStr($attribute) || Str::likeEmpty($this->{$attribute})) {
return null;
... | php | public function getLocaled(string $attribute)
{
// if always decoded
if (Any::isArray($this->{$attribute})) {
return $this->{$attribute}[App::$Request->getLanguage()];
}
if (!Any::isStr($attribute) || Str::likeEmpty($this->{$attribute})) {
return null;
... | [
"public",
"function",
"getLocaled",
"(",
"string",
"$",
"attribute",
")",
"{",
"// if always decoded",
"if",
"(",
"Any",
"::",
"isArray",
"(",
"$",
"this",
"->",
"{",
"$",
"attribute",
"}",
")",
")",
"{",
"return",
"$",
"this",
"->",
"{",
"$",
"attribu... | Special function for locale stored attributes under serialization.
@param string $attribute
@return array|null|string | [
"Special",
"function",
"for",
"locale",
"stored",
"attributes",
"under",
"serialization",
"."
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Arch/ActiveModel.php#L55-L67 |
192,716 | phpffcms/ffcms-core | src/Arch/ActiveModel.php | ActiveModel.setAttribute | public function setAttribute($key, $value)
{
if ($value !== null && $this->isSerializeCastable($key)) {
$value = $this->asSerialize($value);
}
return parent::setAttribute($key, $value);
} | php | public function setAttribute($key, $value)
{
if ($value !== null && $this->isSerializeCastable($key)) {
$value = $this->asSerialize($value);
}
return parent::setAttribute($key, $value);
} | [
"public",
"function",
"setAttribute",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"!==",
"null",
"&&",
"$",
"this",
"->",
"isSerializeCastable",
"(",
"$",
"key",
")",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"asSer... | Set model attribute. Extend laravel attribute casting mutators by serialized array
@param string $key
@param mixed $value
@return LaravelModel | [
"Set",
"model",
"attribute",
".",
"Extend",
"laravel",
"attribute",
"casting",
"mutators",
"by",
"serialized",
"array"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Arch/ActiveModel.php#L75-L82 |
192,717 | phpffcms/ffcms-core | src/Arch/ActiveModel.php | ActiveModel.castAttribute | protected function castAttribute($key, $value)
{
if ($value === null) {
return $value;
}
if ($this->getCastType($key) === 'serialize') {
return $this->fromSerialize($value);
}
return parent::castAttribute($key, $value);
} | php | protected function castAttribute($key, $value)
{
if ($value === null) {
return $value;
}
if ($this->getCastType($key) === 'serialize') {
return $this->fromSerialize($value);
}
return parent::castAttribute($key, $value);
} | [
"protected",
"function",
"castAttribute",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"$",
"value",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getCastType",
"(",
"$",
"key",
")",
"===",
... | Cast model attribute. Extend laravel attribute casting mutators by serialized array
@param string $key
@param mixed $value
@return mixed | [
"Cast",
"model",
"attribute",
".",
"Extend",
"laravel",
"attribute",
"casting",
"mutators",
"by",
"serialized",
"array"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Arch/ActiveModel.php#L90-L101 |
192,718 | the-eater/odango.php | src/NyaaTorrent.php | NyaaTorrent.fromSimpleXml | public static function fromSimpleXml($xml, $userId = null)
{
$torrent = new NyaaTorrent();
$torrent->title = (string)$xml->title;
$torrent->setInfoFromDescription((string)$xml->description);
$torrent->meta = NyaaMeta::createFromTitle($torrent->title);
$torrent->torrentUrl = (string)$xml->link;
... | php | public static function fromSimpleXml($xml, $userId = null)
{
$torrent = new NyaaTorrent();
$torrent->title = (string)$xml->title;
$torrent->setInfoFromDescription((string)$xml->description);
$torrent->meta = NyaaMeta::createFromTitle($torrent->title);
$torrent->torrentUrl = (string)$xml->link;
... | [
"public",
"static",
"function",
"fromSimpleXml",
"(",
"$",
"xml",
",",
"$",
"userId",
"=",
"null",
")",
"{",
"$",
"torrent",
"=",
"new",
"NyaaTorrent",
"(",
")",
";",
"$",
"torrent",
"->",
"title",
"=",
"(",
"string",
")",
"$",
"xml",
"->",
"title",
... | Creates a new NyaaTorrent instance from a simple xml element
@param \SimpleXmlElement $xml The SimpleXmlElement from the Nyaa feed containing the torrent info
@param int $userId The userid of this torrent
@return NyaaTorrent | [
"Creates",
"a",
"new",
"NyaaTorrent",
"instance",
"from",
"a",
"simple",
"xml",
"element"
] | 6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f | https://github.com/the-eater/odango.php/blob/6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f/src/NyaaTorrent.php#L31-L45 |
192,719 | the-eater/odango.php | src/NyaaTorrent.php | NyaaTorrent.setInfoFromDescription | public function setInfoFromDescription($description)
{
// 1 seeder(s), 20 leecher(s), 63 download(s) - 793.9 MiB
if (!preg_match('~([0-9]+) seeder\(s\), ([0-9]+) leecher\(s\), ([0-9]+) download\(s\)(?: - ([0-9]+(\.[0-9]+)))?~i', $description, $match)) {
return;
}
$this->seeds = intval($match[1]... | php | public function setInfoFromDescription($description)
{
// 1 seeder(s), 20 leecher(s), 63 download(s) - 793.9 MiB
if (!preg_match('~([0-9]+) seeder\(s\), ([0-9]+) leecher\(s\), ([0-9]+) download\(s\)(?: - ([0-9]+(\.[0-9]+)))?~i', $description, $match)) {
return;
}
$this->seeds = intval($match[1]... | [
"public",
"function",
"setInfoFromDescription",
"(",
"$",
"description",
")",
"{",
"// 1 seeder(s), 20 leecher(s), 63 download(s) - 793.9 MiB",
"if",
"(",
"!",
"preg_match",
"(",
"'~([0-9]+) seeder\\(s\\), ([0-9]+) leecher\\(s\\), ([0-9]+) download\\(s\\)(?: - ([0-9]+(\\.[0-9]+)))?~i'",
... | Sets the torrent info from the description string
@param string $description The description to parse info from | [
"Sets",
"the",
"torrent",
"info",
"from",
"the",
"description",
"string"
] | 6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f | https://github.com/the-eater/odango.php/blob/6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f/src/NyaaTorrent.php#L72-L86 |
192,720 | the-eater/odango.php | src/NyaaTorrent.php | NyaaTorrent.getUserId | public function getUserId()
{
if ($this->userId === null) {
$this->userId = $this->fetchUserId();
}
return $this->userId;
} | php | public function getUserId()
{
if ($this->userId === null) {
$this->userId = $this->fetchUserId();
}
return $this->userId;
} | [
"public",
"function",
"getUserId",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"userId",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"userId",
"=",
"$",
"this",
"->",
"fetchUserId",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"userId",
";",
... | Gets the user id for this torrent
@return int | [
"Gets",
"the",
"user",
"id",
"for",
"this",
"torrent"
] | 6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f | https://github.com/the-eater/odango.php/blob/6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f/src/NyaaTorrent.php#L159-L166 |
192,721 | the-eater/odango.php | src/NyaaTorrent.php | NyaaTorrent.getTorrentId | public function getTorrentId()
{
if ($this->torrentId === null) {
$this->torrentId = false;
if (preg_match('~tid=([0-9]+)~', $this->torrentUrl, $match)) {
$this->torrentId = intval($match[1]);
}
}
return $this->torrentId;
} | php | public function getTorrentId()
{
if ($this->torrentId === null) {
$this->torrentId = false;
if (preg_match('~tid=([0-9]+)~', $this->torrentUrl, $match)) {
$this->torrentId = intval($match[1]);
}
}
return $this->torrentId;
} | [
"public",
"function",
"getTorrentId",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"torrentId",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"torrentId",
"=",
"false",
";",
"if",
"(",
"preg_match",
"(",
"'~tid=([0-9]+)~'",
",",
"$",
"this",
"->",
"torre... | Get the id of this torrent
@return int | [
"Get",
"the",
"id",
"of",
"this",
"torrent"
] | 6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f | https://github.com/the-eater/odango.php/blob/6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f/src/NyaaTorrent.php#L172-L183 |
192,722 | the-eater/odango.php | src/NyaaTorrent.php | NyaaTorrent.fetchUserId | private function fetchUserId()
{
$pool = Registry::getStash();
$cache = $pool->getItem('nyaa/user/'.$this->getTorrentId());
if ($cache->isMiss()) {
// sadly we have to use the site since nothing provides the user id
$userId = false;
$html = file_get_contents($this->siteUrl);
// ... | php | private function fetchUserId()
{
$pool = Registry::getStash();
$cache = $pool->getItem('nyaa/user/'.$this->getTorrentId());
if ($cache->isMiss()) {
// sadly we have to use the site since nothing provides the user id
$userId = false;
$html = file_get_contents($this->siteUrl);
// ... | [
"private",
"function",
"fetchUserId",
"(",
")",
"{",
"$",
"pool",
"=",
"Registry",
"::",
"getStash",
"(",
")",
";",
"$",
"cache",
"=",
"$",
"pool",
"->",
"getItem",
"(",
"'nyaa/user/'",
".",
"$",
"this",
"->",
"getTorrentId",
"(",
")",
")",
";",
"if"... | Gets the user id by getting the overview of the torrent page and looking for the user id there
@return int | [
"Gets",
"the",
"user",
"id",
"by",
"getting",
"the",
"overview",
"of",
"the",
"torrent",
"page",
"and",
"looking",
"for",
"the",
"user",
"id",
"there"
] | 6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f | https://github.com/the-eater/odango.php/blob/6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f/src/NyaaTorrent.php#L189-L209 |
192,723 | the-eater/odango.php | src/NyaaTorrent.php | NyaaTorrent.getMeta | public function getMeta($meta = null)
{
if ($meta === null) {
return $this->meta;
}
return $this->meta->get($meta);
} | php | public function getMeta($meta = null)
{
if ($meta === null) {
return $this->meta;
}
return $this->meta->get($meta);
} | [
"public",
"function",
"getMeta",
"(",
"$",
"meta",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"meta",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"meta",
";",
"}",
"return",
"$",
"this",
"->",
"meta",
"->",
"get",
"(",
"$",
"meta",
")",
"... | Gets the NyaaMeta object or a meta value from the meta object if an argument is given
@param string $meta Meta name to get
@return mixed | [
"Gets",
"the",
"NyaaMeta",
"object",
"or",
"a",
"meta",
"value",
"from",
"the",
"meta",
"object",
"if",
"an",
"argument",
"is",
"given"
] | 6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f | https://github.com/the-eater/odango.php/blob/6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f/src/NyaaTorrent.php#L216-L223 |
192,724 | irfantoor/collection | src/Collection.php | Collection.has | public function has($id)
{
if (strpos($id, '.') !== false) {
$k = '$this->data' . "['" . str_replace('.', "']['", $id) . "']";
eval('$has = isset(' . $k . ');');
return $has;
} else {
return (is_string($id)) ? array_key_exists($id, $this->data) : false... | php | public function has($id)
{
if (strpos($id, '.') !== false) {
$k = '$this->data' . "['" . str_replace('.', "']['", $id) . "']";
eval('$has = isset(' . $k . ');');
return $has;
} else {
return (is_string($id)) ? array_key_exists($id, $this->data) : false... | [
"public",
"function",
"has",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"id",
",",
"'.'",
")",
"!==",
"false",
")",
"{",
"$",
"k",
"=",
"'$this->data'",
".",
"\"['\"",
".",
"str_replace",
"(",
"'.'",
",",
"\"']['\"",
",",
"$",
"id",... | Returns true if the collection can return an entry for the given
identifier, returns false otherwise.
`has($id)` returning true does not mean that `get($id)` will not throw
an exception.
It does however mean that `get($id)` will not throw a
`NotFoundExceptionInterface`.
@param String $id Identifier of the entry to lo... | [
"Returns",
"true",
"if",
"the",
"collection",
"can",
"return",
"an",
"entry",
"for",
"the",
"given",
"identifier",
"returns",
"false",
"otherwise",
"."
] | 1a69d9f09e9960bce33e00bf985ca47aa0566cf9 | https://github.com/irfantoor/collection/blob/1a69d9f09e9960bce33e00bf985ca47aa0566cf9/src/Collection.php#L154-L163 |
192,725 | irfantoor/collection | src/Collection.php | Collection.get | public function get($id, $default = null)
{
if (strpos($id, '.') !== false) {
$k = '$this->data' . "['" . str_replace('.', "']['", $id) . "']";
eval('$has = isset(' . $k . ');');
if ($has) {
eval('$value = ' . $k . ';');
return $value;
... | php | public function get($id, $default = null)
{
if (strpos($id, '.') !== false) {
$k = '$this->data' . "['" . str_replace('.', "']['", $id) . "']";
eval('$has = isset(' . $k . ');');
if ($has) {
eval('$value = ' . $k . ';');
return $value;
... | [
"public",
"function",
"get",
"(",
"$",
"id",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"id",
",",
"'.'",
")",
"!==",
"false",
")",
"{",
"$",
"k",
"=",
"'$this->data'",
".",
"\"['\"",
".",
"str_replace",
"(",
"'.'"... | Finds an entry of the collection by its identifier and returns it.
@param String $id Identifier of the entry to look for.
@param Mixed $default A default value.
@return Mixed Entry. | [
"Finds",
"an",
"entry",
"of",
"the",
"collection",
"by",
"its",
"identifier",
"and",
"returns",
"it",
"."
] | 1a69d9f09e9960bce33e00bf985ca47aa0566cf9 | https://github.com/irfantoor/collection/blob/1a69d9f09e9960bce33e00bf985ca47aa0566cf9/src/Collection.php#L173-L187 |
192,726 | irfantoor/collection | src/Collection.php | Collection.remove | public function remove($id)
{
if ($this->locked) {
return false;
}
if (strpos($id, '.') !== false) {
$k = '$this->data' . "['" . str_replace('.', "']['", $id) . "']";
eval('$has = isset(' . $k . ');');
if ($has) {
eval('unset('... | php | public function remove($id)
{
if ($this->locked) {
return false;
}
if (strpos($id, '.') !== false) {
$k = '$this->data' . "['" . str_replace('.', "']['", $id) . "']";
eval('$has = isset(' . $k . ');');
if ($has) {
eval('unset('... | [
"public",
"function",
"remove",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"locked",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"id",
",",
"'.'",
")",
"!==",
"false",
")",
"{",
"$",
"k",
"=",
"'$this->dat... | Removes the value from identified by an identifier from the colection
@param String $id identifier
@return boolval true if successful in removing, false otherwise | [
"Removes",
"the",
"value",
"from",
"identified",
"by",
"an",
"identifier",
"from",
"the",
"colection"
] | 1a69d9f09e9960bce33e00bf985ca47aa0566cf9 | https://github.com/irfantoor/collection/blob/1a69d9f09e9960bce33e00bf985ca47aa0566cf9/src/Collection.php#L196-L217 |
192,727 | kapitchi/KapitchiIdentity | src/KapitchiIdentity/Service/Auth.php | Auth.clearIdentity | public function clearIdentity()
{
$this->getStorage()->clear();
//all identies go - it's done that way now at least
$ids = $this->getContainer()->getIdentities();
$sessionIds = array();
foreach($ids as $id) {
$sessionIds[] = $id->getSessionId();
}
... | php | public function clearIdentity()
{
$this->getStorage()->clear();
//all identies go - it's done that way now at least
$ids = $this->getContainer()->getIdentities();
$sessionIds = array();
foreach($ids as $id) {
$sessionIds[] = $id->getSessionId();
}
... | [
"public",
"function",
"clearIdentity",
"(",
")",
"{",
"$",
"this",
"->",
"getStorage",
"(",
")",
"->",
"clear",
"(",
")",
";",
"//all identies go - it's done that way now at least",
"$",
"ids",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"getIdenti... | Clears the identity from persistent storage
@return array AuthIdentity | [
"Clears",
"the",
"identity",
"from",
"persistent",
"storage"
] | 744bd4341079045d067993eab0c63486d2693caa | https://github.com/kapitchi/KapitchiIdentity/blob/744bd4341079045d067993eab0c63486d2693caa/src/KapitchiIdentity/Service/Auth.php#L149-L166 |
192,728 | DaGhostman/codewave | src/Application/AspectsKernel.php | AspectsKernel.addAspect | public function addAspect(Aspect $aspect)
{
if ($this->container !== null) {
$this->container->registerAspect($aspect);
}
return $this;
} | php | public function addAspect(Aspect $aspect)
{
if ($this->container !== null) {
$this->container->registerAspect($aspect);
}
return $this;
} | [
"public",
"function",
"addAspect",
"(",
"Aspect",
"$",
"aspect",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"container",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"container",
"->",
"registerAspect",
"(",
"$",
"aspect",
")",
";",
"}",
"return",
"$",
"... | Registers an aspect to the aspects kernel
@param Aspect $aspect
@return $this | [
"Registers",
"an",
"aspect",
"to",
"the",
"aspects",
"kernel"
] | f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8 | https://github.com/DaGhostman/codewave/blob/f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8/src/Application/AspectsKernel.php#L47-L54 |
192,729 | Emagedev/Utils | app/code/community/Emagedev/Utils/Helper/Curl.php | Emagedev_Utils_Helper_Curl.dispatchResponse | public function dispatchResponse($response)
{
$parts = explode("\r\n\r\n", $response, 2);
if (count($parts) < 2) {
$this->throwException();
}
list($headersAsString, $body) = $parts;
$headers = explode("\r\n", $headersAsString);
list($code, $status) = $t... | php | public function dispatchResponse($response)
{
$parts = explode("\r\n\r\n", $response, 2);
if (count($parts) < 2) {
$this->throwException();
}
list($headersAsString, $body) = $parts;
$headers = explode("\r\n", $headersAsString);
list($code, $status) = $t... | [
"public",
"function",
"dispatchResponse",
"(",
"$",
"response",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"\"\\r\\n\\r\\n\"",
",",
"$",
"response",
",",
"2",
")",
";",
"if",
"(",
"count",
"(",
"$",
"parts",
")",
"<",
"2",
")",
"{",
"$",
"this",
... | Get response code, headers, status, body
@param string $response
@return Omedrec_Welcome_Model_Curl_Response | [
"Get",
"response",
"code",
"headers",
"status",
"body"
] | 1a9b40fef401e19c94cc6d7bfb14a42bda720273 | https://github.com/Emagedev/Utils/blob/1a9b40fef401e19c94cc6d7bfb14a42bda720273/app/code/community/Emagedev/Utils/Helper/Curl.php#L54-L80 |
192,730 | Emagedev/Utils | app/code/community/Emagedev/Utils/Helper/Curl.php | Emagedev_Utils_Helper_Curl.dispatchHttpStatus | protected function dispatchHttpStatus($header)
{
$statuses = array();
$result = preg_match('/^http\/[1|2]\.\d (\d{3}) (.*)$/i', $header, $statuses);
if ($result < 1) {
$this->throwException();
}
// Code, status text
return array((int)$statuses[1],... | php | protected function dispatchHttpStatus($header)
{
$statuses = array();
$result = preg_match('/^http\/[1|2]\.\d (\d{3}) (.*)$/i', $header, $statuses);
if ($result < 1) {
$this->throwException();
}
// Code, status text
return array((int)$statuses[1],... | [
"protected",
"function",
"dispatchHttpStatus",
"(",
"$",
"header",
")",
"{",
"$",
"statuses",
"=",
"array",
"(",
")",
";",
"$",
"result",
"=",
"preg_match",
"(",
"'/^http\\/[1|2]\\.\\d (\\d{3}) (.*)$/i'",
",",
"$",
"header",
",",
"$",
"statuses",
")",
";",
"... | Get HTTP status and code from first header
@param string $header
@return array | [
"Get",
"HTTP",
"status",
"and",
"code",
"from",
"first",
"header"
] | 1a9b40fef401e19c94cc6d7bfb14a42bda720273 | https://github.com/Emagedev/Utils/blob/1a9b40fef401e19c94cc6d7bfb14a42bda720273/app/code/community/Emagedev/Utils/Helper/Curl.php#L89-L100 |
192,731 | Emagedev/Utils | app/code/community/Emagedev/Utils/Helper/Curl.php | Emagedev_Utils_Helper_Curl.dispatchHeaders | protected function dispatchHeaders($headersAsString)
{
$headers = array();
foreach ($headersAsString as $header) {
$headerData = $this->dispatchHeaderValue($header);
if (is_null($headerData)) {
continue;
}
$headers[$headerData['name'... | php | protected function dispatchHeaders($headersAsString)
{
$headers = array();
foreach ($headersAsString as $header) {
$headerData = $this->dispatchHeaderValue($header);
if (is_null($headerData)) {
continue;
}
$headers[$headerData['name'... | [
"protected",
"function",
"dispatchHeaders",
"(",
"$",
"headersAsString",
")",
"{",
"$",
"headers",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"headersAsString",
"as",
"$",
"header",
")",
"{",
"$",
"headerData",
"=",
"$",
"this",
"->",
"dispatchHeade... | Get headers an values
@param $headersAsString
@return array | [
"Get",
"headers",
"an",
"values"
] | 1a9b40fef401e19c94cc6d7bfb14a42bda720273 | https://github.com/Emagedev/Utils/blob/1a9b40fef401e19c94cc6d7bfb14a42bda720273/app/code/community/Emagedev/Utils/Helper/Curl.php#L109-L124 |
192,732 | Emagedev/Utils | app/code/community/Emagedev/Utils/Helper/Curl.php | Emagedev_Utils_Helper_Curl.dispatchHeaderValue | protected function dispatchHeaderValue($header)
{
$header = explode(':', $header, 2);
if (count($header) < 2) {
return null;
}
return array(
'name' => trim($header[0]),
'value' => trim($header[1]),
);
} | php | protected function dispatchHeaderValue($header)
{
$header = explode(':', $header, 2);
if (count($header) < 2) {
return null;
}
return array(
'name' => trim($header[0]),
'value' => trim($header[1]),
);
} | [
"protected",
"function",
"dispatchHeaderValue",
"(",
"$",
"header",
")",
"{",
"$",
"header",
"=",
"explode",
"(",
"':'",
",",
"$",
"header",
",",
"2",
")",
";",
"if",
"(",
"count",
"(",
"$",
"header",
")",
"<",
"2",
")",
"{",
"return",
"null",
";",... | Get key-value array
@see https://stackoverflow.com/questions/9183178/can-php-curl-retrieve-response-headers-and-body-in-a-single-request
@param $header
@return array|null | [
"Get",
"key",
"-",
"value",
"array"
] | 1a9b40fef401e19c94cc6d7bfb14a42bda720273 | https://github.com/Emagedev/Utils/blob/1a9b40fef401e19c94cc6d7bfb14a42bda720273/app/code/community/Emagedev/Utils/Helper/Curl.php#L135-L147 |
192,733 | dms-org/common.structure | src/Money/Money.php | Money.asString | public function asString() : string
{
$fractionDigits = $this->currency->getDefaultFractionDigits();
$wholePart = substr((string)$this->amount, 0, -$fractionDigits) ?: '0';
$fractionalPart = str_pad(substr((string)$this->amount, -$fractionDigits), $fractionDigits, '0', STR_PAD_RIGHT);
... | php | public function asString() : string
{
$fractionDigits = $this->currency->getDefaultFractionDigits();
$wholePart = substr((string)$this->amount, 0, -$fractionDigits) ?: '0';
$fractionalPart = str_pad(substr((string)$this->amount, -$fractionDigits), $fractionDigits, '0', STR_PAD_RIGHT);
... | [
"public",
"function",
"asString",
"(",
")",
":",
"string",
"{",
"$",
"fractionDigits",
"=",
"$",
"this",
"->",
"currency",
"->",
"getDefaultFractionDigits",
"(",
")",
";",
"$",
"wholePart",
"=",
"substr",
"(",
"(",
"string",
")",
"$",
"this",
"->",
"amou... | Returns the monetary value as string.
@return string | [
"Returns",
"the",
"monetary",
"value",
"as",
"string",
"."
] | 23f122182f60df5ec847047a81a39c8aab019ff1 | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/Money/Money.php#L190-L199 |
192,734 | jabernardo/lollipop-php | Library/Cache.php | Cache.getDriver | static private function getDriver() {
if (self::$_driver != null) return self::$_driver;
$driver = Utils::spare(Config::get('cache.driver'), 'file');
switch (strtolower($driver)) {
case 'memcached':
self::$_driver = new \Lollipop\Cache\MemcachedAdapte... | php | static private function getDriver() {
if (self::$_driver != null) return self::$_driver;
$driver = Utils::spare(Config::get('cache.driver'), 'file');
switch (strtolower($driver)) {
case 'memcached':
self::$_driver = new \Lollipop\Cache\MemcachedAdapte... | [
"static",
"private",
"function",
"getDriver",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"_driver",
"!=",
"null",
")",
"return",
"self",
"::",
"$",
"_driver",
";",
"$",
"driver",
"=",
"Utils",
"::",
"spare",
"(",
"Config",
"::",
"get",
"(",
"'cache... | Get cache driver
@return object | [
"Get",
"cache",
"driver"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/Cache.php#L32-L49 |
192,735 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/Metadata/Driver/DoctrineMongoDBDriver.php | DoctrineMongoDBDriver.setAttributes | private function setAttributes(ClassMetadataInfo $metadata, Metadata\AttributeInterface $entity)
{
foreach ($metadata->fieldMappings as $fieldKey => $mapping) {
if (isset($mapping['id'])) {
// Id field. Skip.
continue;
}
if (isset($mapping[... | php | private function setAttributes(ClassMetadataInfo $metadata, Metadata\AttributeInterface $entity)
{
foreach ($metadata->fieldMappings as $fieldKey => $mapping) {
if (isset($mapping['id'])) {
// Id field. Skip.
continue;
}
if (isset($mapping[... | [
"private",
"function",
"setAttributes",
"(",
"ClassMetadataInfo",
"$",
"metadata",
",",
"Metadata",
"\\",
"AttributeInterface",
"$",
"entity",
")",
"{",
"foreach",
"(",
"$",
"metadata",
"->",
"fieldMappings",
"as",
"$",
"fieldKey",
"=>",
"$",
"mapping",
")",
"... | Sets the entity attribute metadata from the Doctrine class metadata.
@todo Validate data types / handle Doctrine to Modlr conversion.
@todo Handle complex attribute types like objects and arrays (embededded docs?)
@param ClassMetadataInfo $metadata
@param Metadata\AttributeInterface $entity
@return... | [
"Sets",
"the",
"entity",
"attribute",
"metadata",
"from",
"the",
"Doctrine",
"class",
"metadata",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Metadata/Driver/DoctrineMongoDBDriver.php#L78-L122 |
192,736 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/Metadata/Driver/DoctrineMongoDBDriver.php | DoctrineMongoDBDriver.setRelationships | private function setRelationships(ClassMetadataInfo $metadata, Metadata\EntityMetadata $entity)
{
$allTypes = $this->getAllTypeNames();
foreach ($metadata->fieldMappings as $fieldKey => $mapping) {
if (!isset($mapping['reference'])) {
// Not a relationship. Skip.
... | php | private function setRelationships(ClassMetadataInfo $metadata, Metadata\EntityMetadata $entity)
{
$allTypes = $this->getAllTypeNames();
foreach ($metadata->fieldMappings as $fieldKey => $mapping) {
if (!isset($mapping['reference'])) {
// Not a relationship. Skip.
... | [
"private",
"function",
"setRelationships",
"(",
"ClassMetadataInfo",
"$",
"metadata",
",",
"Metadata",
"\\",
"EntityMetadata",
"$",
"entity",
")",
"{",
"$",
"allTypes",
"=",
"$",
"this",
"->",
"getAllTypeNames",
"(",
")",
";",
"foreach",
"(",
"$",
"metadata",
... | Sets the entity relationship metadata from the Doctrine class metadata.
@param ClassMetadataInfo $metadata
@param Metadata\EntityMetadata $entity
@return Metadata\EntityMetadata
@throws RuntimeException If the Doctrine target document metadata was not found. | [
"Sets",
"the",
"entity",
"relationship",
"metadata",
"from",
"the",
"Doctrine",
"class",
"metadata",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Metadata/Driver/DoctrineMongoDBDriver.php#L132-L158 |
192,737 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/Metadata/Driver/DoctrineMongoDBDriver.php | DoctrineMongoDBDriver.getDataType | private function getDataType($doctrineType)
{
$map = $this->getDoctrineTypeMap();
if (!isset($map[$doctrineType])) {
throw new InvalidArgumentException(sprintf('The Doctrine type "%s" is currenty not implemented by the API.', $doctrineType));
}
return $map[$doctrineType];... | php | private function getDataType($doctrineType)
{
$map = $this->getDoctrineTypeMap();
if (!isset($map[$doctrineType])) {
throw new InvalidArgumentException(sprintf('The Doctrine type "%s" is currenty not implemented by the API.', $doctrineType));
}
return $map[$doctrineType];... | [
"private",
"function",
"getDataType",
"(",
"$",
"doctrineType",
")",
"{",
"$",
"map",
"=",
"$",
"this",
"->",
"getDoctrineTypeMap",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"map",
"[",
"$",
"doctrineType",
"]",
")",
")",
"{",
"throw",
"new",... | Gets the Modlr field data type from a Doctrine data type.
@todo This should be handled by having something register custom data types?
@param string $doctrineType
@param string
@throws InvalidArgumentException If a Doctrine-to-Modlr type conversion was not implemented. | [
"Gets",
"the",
"Modlr",
"field",
"data",
"type",
"from",
"a",
"Doctrine",
"data",
"type",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Metadata/Driver/DoctrineMongoDBDriver.php#L168-L175 |
192,738 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/Metadata/Driver/DoctrineMongoDBDriver.php | DoctrineMongoDBDriver.isPolymorphicType | private function isPolymorphicType(ClassMetadataInfo $metadata)
{
return in_array($metadata->inheritanceType, $this->getPolymorphicTypes()) && null === $metadata->discriminatorValue;
} | php | private function isPolymorphicType(ClassMetadataInfo $metadata)
{
return in_array($metadata->inheritanceType, $this->getPolymorphicTypes()) && null === $metadata->discriminatorValue;
} | [
"private",
"function",
"isPolymorphicType",
"(",
"ClassMetadataInfo",
"$",
"metadata",
")",
"{",
"return",
"in_array",
"(",
"$",
"metadata",
"->",
"inheritanceType",
",",
"$",
"this",
"->",
"getPolymorphicTypes",
"(",
")",
")",
"&&",
"null",
"===",
"$",
"metad... | Determines if a Doctrine object is polymorphic, based on its class metadata.
@param ClassMetadataInfo $metadata
@return bool | [
"Determines",
"if",
"a",
"Doctrine",
"object",
"is",
"polymorphic",
"based",
"on",
"its",
"class",
"metadata",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Metadata/Driver/DoctrineMongoDBDriver.php#L207-L210 |
192,739 | tamago-db/TamagoTipsManagerBundle | Controller/TipsManagerController.php | TipsManagerController.getTipTransUnit | private function getTipTransUnit($locale, $domain, $identifier)
{
$storage = $this->get('lexik_translation.translation_storage');
try {
// Note that getAllByLocaleAndDomain return arrays rather than entities; presumably for performance reasons
$transUnits = $storage->getTrans... | php | private function getTipTransUnit($locale, $domain, $identifier)
{
$storage = $this->get('lexik_translation.translation_storage');
try {
// Note that getAllByLocaleAndDomain return arrays rather than entities; presumably for performance reasons
$transUnits = $storage->getTrans... | [
"private",
"function",
"getTipTransUnit",
"(",
"$",
"locale",
",",
"$",
"domain",
",",
"$",
"identifier",
")",
"{",
"$",
"storage",
"=",
"$",
"this",
"->",
"get",
"(",
"'lexik_translation.translation_storage'",
")",
";",
"try",
"{",
"// Note that getAllByLocaleA... | Retrieve a random tip from the Lexik translations. Increment view count.
@param Request $request
@param $domain
@param $identifier
@return TransUnit | [
"Retrieve",
"a",
"random",
"tip",
"from",
"the",
"Lexik",
"translations",
".",
"Increment",
"view",
"count",
"."
] | 3ce3be82061298426a9278682e859fde9140540a | https://github.com/tamago-db/TamagoTipsManagerBundle/blob/3ce3be82061298426a9278682e859fde9140540a/Controller/TipsManagerController.php#L30-L62 |
192,740 | tamago-db/TamagoTipsManagerBundle | Controller/TipsManagerController.php | TipsManagerController.indexAction | public function indexAction(Request $request, $domain, $identifier)
{
$locale = substr($request->getLocale(), 0, 2); // Make sure to use only the two character locale
try {
$transUnit = $this->getTipTransUnit($locale, $domain, $identifier);
$translatedTip = $transUnit->getTr... | php | public function indexAction(Request $request, $domain, $identifier)
{
$locale = substr($request->getLocale(), 0, 2); // Make sure to use only the two character locale
try {
$transUnit = $this->getTipTransUnit($locale, $domain, $identifier);
$translatedTip = $transUnit->getTr... | [
"public",
"function",
"indexAction",
"(",
"Request",
"$",
"request",
",",
"$",
"domain",
",",
"$",
"identifier",
")",
"{",
"$",
"locale",
"=",
"substr",
"(",
"$",
"request",
"->",
"getLocale",
"(",
")",
",",
"0",
",",
"2",
")",
";",
"// Make sure to us... | Render tip page with style and JavaScript.
@param Request $request
@param $domain
@param $identifier
@return Response | [
"Render",
"tip",
"page",
"with",
"style",
"and",
"JavaScript",
"."
] | 3ce3be82061298426a9278682e859fde9140540a | https://github.com/tamago-db/TamagoTipsManagerBundle/blob/3ce3be82061298426a9278682e859fde9140540a/Controller/TipsManagerController.php#L73-L86 |
192,741 | tamago-db/TamagoTipsManagerBundle | Controller/TipsManagerController.php | TipsManagerController.feedbackAction | public function feedbackAction(Request $request, $id, $feedback, $domain, $identifier)
{
$locale = substr($request->getLocale(), 0, 2); // Make sure to use only the two character locale
$om = $this->getObjectManager();
$repository = $om->getRepository('TamagoTipsManagerBundle:TamagoTransUn... | php | public function feedbackAction(Request $request, $id, $feedback, $domain, $identifier)
{
$locale = substr($request->getLocale(), 0, 2); // Make sure to use only the two character locale
$om = $this->getObjectManager();
$repository = $om->getRepository('TamagoTipsManagerBundle:TamagoTransUn... | [
"public",
"function",
"feedbackAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
",",
"$",
"feedback",
",",
"$",
"domain",
",",
"$",
"identifier",
")",
"{",
"$",
"locale",
"=",
"substr",
"(",
"$",
"request",
"->",
"getLocale",
"(",
")",
",",
"... | Record feedback for given tip and return a new tip div block to be rendered via jQuery.
@param Request $request
@param $id
@param $feedback
@param $domain
@param $identifier
@return Response | [
"Record",
"feedback",
"for",
"given",
"tip",
"and",
"return",
"a",
"new",
"tip",
"div",
"block",
"to",
"be",
"rendered",
"via",
"jQuery",
"."
] | 3ce3be82061298426a9278682e859fde9140540a | https://github.com/tamago-db/TamagoTipsManagerBundle/blob/3ce3be82061298426a9278682e859fde9140540a/Controller/TipsManagerController.php#L98-L122 |
192,742 | tamago-db/TamagoTipsManagerBundle | Controller/TipsManagerController.php | TipsManagerController.statsAction | public function statsAction()
{
$om = $this->getObjectManager();
$repository = $om->getRepository('TamagoTipsManagerBundle:TamagoTransUnitMeta');
$stats = $repository->stats();
return $this->render('TamagoTipsManagerBundle:Default:stats.html.twig', ['stats' => $stats]);
} | php | public function statsAction()
{
$om = $this->getObjectManager();
$repository = $om->getRepository('TamagoTipsManagerBundle:TamagoTransUnitMeta');
$stats = $repository->stats();
return $this->render('TamagoTipsManagerBundle:Default:stats.html.twig', ['stats' => $stats]);
} | [
"public",
"function",
"statsAction",
"(",
")",
"{",
"$",
"om",
"=",
"$",
"this",
"->",
"getObjectManager",
"(",
")",
";",
"$",
"repository",
"=",
"$",
"om",
"->",
"getRepository",
"(",
"'TamagoTipsManagerBundle:TamagoTransUnitMeta'",
")",
";",
"$",
"stats",
... | Render stats page.
@return Response | [
"Render",
"stats",
"page",
"."
] | 3ce3be82061298426a9278682e859fde9140540a | https://github.com/tamago-db/TamagoTipsManagerBundle/blob/3ce3be82061298426a9278682e859fde9140540a/Controller/TipsManagerController.php#L129-L136 |
192,743 | bseddon/XPath20 | Proxy/ValueProxy.php | ValueProxy.OperatorPlus | public static function OperatorPlus( $val1, $val2 )
{
if ( ! $val1 instanceof ValueProxy )
{
/**
* @var ValueProxyFactory $f
*/
$f = isset( ValueProxy::$valueFactory[ Type::FromValue( $val1 )->getTypeName() ] )
? ValueProxy::$valueFactory[ Type::FromValue( $val1 )->getTypeName() ]
: ... | php | public static function OperatorPlus( $val1, $val2 )
{
if ( ! $val1 instanceof ValueProxy )
{
/**
* @var ValueProxyFactory $f
*/
$f = isset( ValueProxy::$valueFactory[ Type::FromValue( $val1 )->getTypeName() ] )
? ValueProxy::$valueFactory[ Type::FromValue( $val1 )->getTypeName() ]
: ... | [
"public",
"static",
"function",
"OperatorPlus",
"(",
"$",
"val1",
",",
"$",
"val2",
")",
"{",
"if",
"(",
"!",
"$",
"val1",
"instanceof",
"ValueProxy",
")",
"{",
"/**\r\n\t\t\t * @var ValueProxyFactory $f\r\n\t\t\t */",
"$",
"f",
"=",
"isset",
"(",
"ValueProxy",
... | Equivalent of the '+' operator
@param ValueProxy $val1
@param ValueProxy $val2
@return \lyquidity\XPath2\Proxy\ValueProxy | [
"Equivalent",
"of",
"the",
"+",
"operator"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Proxy/ValueProxy.php#L637-L690 |
192,744 | gplcart/export | controllers/Export.php | Export.doExport | public function doExport()
{
$this->downloadCsvExport();
$settings = $this->module->getSettings('export');
if (empty($settings['columns'])) {
$settings['columns'] = array_keys($settings['header']);
}
$this->setData('settings', $settings);
$this->setData... | php | public function doExport()
{
$this->downloadCsvExport();
$settings = $this->module->getSettings('export');
if (empty($settings['columns'])) {
$settings['columns'] = array_keys($settings['header']);
}
$this->setData('settings', $settings);
$this->setData... | [
"public",
"function",
"doExport",
"(",
")",
"{",
"$",
"this",
"->",
"downloadCsvExport",
"(",
")",
";",
"$",
"settings",
"=",
"$",
"this",
"->",
"module",
"->",
"getSettings",
"(",
"'export'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"settings",
"[",
... | Route callback to display the export page | [
"Route",
"callback",
"to",
"display",
"the",
"export",
"page"
] | b4d93c7a2bd6653f12231fb30d36601ea00fc926 | https://github.com/gplcart/export/blob/b4d93c7a2bd6653f12231fb30d36601ea00fc926/controllers/Export.php#L41-L60 |
192,745 | gplcart/export | controllers/Export.php | Export.validateFileExport | protected function validateFileExport()
{
$directory = gplcart_file_private_module('export');
if (!file_exists($directory) && !mkdir($directory, 0775, true)) {
$this->setError('file', $this->text('Unable to create @name', array('@name' => $directory)));
return false;
... | php | protected function validateFileExport()
{
$directory = gplcart_file_private_module('export');
if (!file_exists($directory) && !mkdir($directory, 0775, true)) {
$this->setError('file', $this->text('Unable to create @name', array('@name' => $directory)));
return false;
... | [
"protected",
"function",
"validateFileExport",
"(",
")",
"{",
"$",
"directory",
"=",
"gplcart_file_private_module",
"(",
"'export'",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"directory",
")",
"&&",
"!",
"mkdir",
"(",
"$",
"directory",
",",
"0775",
... | Validates destination directory and file
@return boolean | [
"Validates",
"destination",
"directory",
"and",
"file"
] | b4d93c7a2bd6653f12231fb30d36601ea00fc926 | https://github.com/gplcart/export/blob/b4d93c7a2bd6653f12231fb30d36601ea00fc926/controllers/Export.php#L118-L137 |
192,746 | gplcart/export | controllers/Export.php | Export.setJobExport | protected function setJobExport()
{
$submitted = $this->getSubmitted();
$settings = $this->module->getSettings('export');
$settings['columns'] = $submitted['columns'];
$settings['options'] = $submitted['options'];
$this->module->setSettings('export', $settings);
$d... | php | protected function setJobExport()
{
$submitted = $this->getSubmitted();
$settings = $this->module->getSettings('export');
$settings['columns'] = $submitted['columns'];
$settings['options'] = $submitted['options'];
$this->module->setSettings('export', $settings);
$d... | [
"protected",
"function",
"setJobExport",
"(",
")",
"{",
"$",
"submitted",
"=",
"$",
"this",
"->",
"getSubmitted",
"(",
")",
";",
"$",
"settings",
"=",
"$",
"this",
"->",
"module",
"->",
"getSettings",
"(",
"'export'",
")",
";",
"$",
"settings",
"[",
"'... | Sets up export job | [
"Sets",
"up",
"export",
"job"
] | b4d93c7a2bd6653f12231fb30d36601ea00fc926 | https://github.com/gplcart/export/blob/b4d93c7a2bd6653f12231fb30d36601ea00fc926/controllers/Export.php#L142-L171 |
192,747 | gplcart/export | controllers/Export.php | Export.downloadCsvExport | protected function downloadCsvExport()
{
$file = $this->getQuery('download');
if (!empty($file)) {
$this->download(gplcart_string_decode($file));
}
} | php | protected function downloadCsvExport()
{
$file = $this->getQuery('download');
if (!empty($file)) {
$this->download(gplcart_string_decode($file));
}
} | [
"protected",
"function",
"downloadCsvExport",
"(",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"getQuery",
"(",
"'download'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"file",
")",
")",
"{",
"$",
"this",
"->",
"download",
"(",
"gplcart_string_dec... | Download a created CSV file | [
"Download",
"a",
"created",
"CSV",
"file"
] | b4d93c7a2bd6653f12231fb30d36601ea00fc926 | https://github.com/gplcart/export/blob/b4d93c7a2bd6653f12231fb30d36601ea00fc926/controllers/Export.php#L176-L183 |
192,748 | rollerworks-graveyard/metadata | src/Driver/MappingDriverChain.php | MappingDriverChain.loadMetadataForClass | public function loadMetadataForClass(\ReflectionClass $class)
{
foreach ($this->drivers as $driver) {
if (null !== $metadata = $driver->loadMetadataForClass($class)) {
return $metadata;
}
}
} | php | public function loadMetadataForClass(\ReflectionClass $class)
{
foreach ($this->drivers as $driver) {
if (null !== $metadata = $driver->loadMetadataForClass($class)) {
return $metadata;
}
}
} | [
"public",
"function",
"loadMetadataForClass",
"(",
"\\",
"ReflectionClass",
"$",
"class",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"drivers",
"as",
"$",
"driver",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"metadata",
"=",
"$",
"driver",
"->",
"loadMet... | Gets class metadata for the given class name.
@param \ReflectionClass $class
@return ClassMetadata|null Returns null when no metadata is found. | [
"Gets",
"class",
"metadata",
"for",
"the",
"given",
"class",
"name",
"."
] | 5b07f564aad87709ca0d0b3e140e4dc4edf9d375 | https://github.com/rollerworks-graveyard/metadata/blob/5b07f564aad87709ca0d0b3e140e4dc4edf9d375/src/Driver/MappingDriverChain.php#L38-L45 |
192,749 | rollerworks-graveyard/metadata | src/Driver/MappingDriverChain.php | MappingDriverChain.isTransient | public function isTransient($className)
{
foreach ($this->drivers as $driver) {
if (false !== $driver->isTransient($className)) {
return true;
}
}
return false;
} | php | public function isTransient($className)
{
foreach ($this->drivers as $driver) {
if (false !== $driver->isTransient($className)) {
return true;
}
}
return false;
} | [
"public",
"function",
"isTransient",
"(",
"$",
"className",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"drivers",
"as",
"$",
"driver",
")",
"{",
"if",
"(",
"false",
"!==",
"$",
"driver",
"->",
"isTransient",
"(",
"$",
"className",
")",
")",
"{",
"r... | Returns whether the class with the specified name should have
its metadata loaded.
This can be used for cache warming, where all the class metadata
gets loaded during the deployment process.
@param string $className
@return bool | [
"Returns",
"whether",
"the",
"class",
"with",
"the",
"specified",
"name",
"should",
"have",
"its",
"metadata",
"loaded",
"."
] | 5b07f564aad87709ca0d0b3e140e4dc4edf9d375 | https://github.com/rollerworks-graveyard/metadata/blob/5b07f564aad87709ca0d0b3e140e4dc4edf9d375/src/Driver/MappingDriverChain.php#L74-L83 |
192,750 | comodojo/foundation | src/Comodojo/Foundation/Base/AbstractVersion.php | AbstractVersion.getFullDescription | public function getFullDescription() {
return strtr($this->template, [
"{name}" => $this->getName(),
"{description}" => $this->getDescription(),
"{version}" => $this->getVersion(),
"{ascii}" => $this->getAscii()
]);
} | php | public function getFullDescription() {
return strtr($this->template, [
"{name}" => $this->getName(),
"{description}" => $this->getDescription(),
"{version}" => $this->getVersion(),
"{ascii}" => $this->getAscii()
]);
} | [
"public",
"function",
"getFullDescription",
"(",
")",
"{",
"return",
"strtr",
"(",
"$",
"this",
"->",
"template",
",",
"[",
"\"{name}\"",
"=>",
"$",
"this",
"->",
"getName",
"(",
")",
",",
"\"{description}\"",
"=>",
"$",
"this",
"->",
"getDescription",
"("... | Return a composed-version of nominal values
@return string | [
"Return",
"a",
"composed",
"-",
"version",
"of",
"nominal",
"values"
] | 21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a | https://github.com/comodojo/foundation/blob/21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a/src/Comodojo/Foundation/Base/AbstractVersion.php#L137-L146 |
192,751 | agentmedia/phine-builtin | src/BuiltIn/Modules/Backend/ChangePasswordForm.php | ChangePasswordForm.AddMailSubjectField | private function AddMailSubjectField()
{
$name = 'MailSubject';
$field = Input::Text($name, $this->changePassword->GetMailSubject());
$this->AddField($field);
$this->SetRequired($name);
} | php | private function AddMailSubjectField()
{
$name = 'MailSubject';
$field = Input::Text($name, $this->changePassword->GetMailSubject());
$this->AddField($field);
$this->SetRequired($name);
} | [
"private",
"function",
"AddMailSubjectField",
"(",
")",
"{",
"$",
"name",
"=",
"'MailSubject'",
";",
"$",
"field",
"=",
"Input",
"::",
"Text",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"changePassword",
"->",
"GetMailSubject",
"(",
")",
")",
";",
"$",
... | Adds the field for e-mail field label | [
"Adds",
"the",
"field",
"for",
"e",
"-",
"mail",
"field",
"label"
] | 4dd05bc406a71e997bd4eaa16b12e23dbe62a456 | https://github.com/agentmedia/phine-builtin/blob/4dd05bc406a71e997bd4eaa16b12e23dbe62a456/src/BuiltIn/Modules/Backend/ChangePasswordForm.php#L88-L94 |
192,752 | romm/configuration_object | Classes/Core/Service/ObjectService.php | ObjectService.getObjectProperty | public function getObjectProperty($object, $property)
{
$result = null;
try {
$result = ObjectAccess::getProperty($object, $property);
} catch (\Exception $exception) {
if (false === $exception instanceof SilentExceptionInterface) {
throw $exception;
... | php | public function getObjectProperty($object, $property)
{
$result = null;
try {
$result = ObjectAccess::getProperty($object, $property);
} catch (\Exception $exception) {
if (false === $exception instanceof SilentExceptionInterface) {
throw $exception;
... | [
"public",
"function",
"getObjectProperty",
"(",
"$",
"object",
",",
"$",
"property",
")",
"{",
"$",
"result",
"=",
"null",
";",
"try",
"{",
"$",
"result",
"=",
"ObjectAccess",
"::",
"getProperty",
"(",
"$",
"object",
",",
"$",
"property",
")",
";",
"}"... | This function will try to get a given property for a given object.
Its particularity is that if the getter method for this property is used,
the method may throw an exception that implements the interface
`SilentExceptionInterface`. In that case, the exception is catch and
`null` is returned.
This allows more flexibi... | [
"This",
"function",
"will",
"try",
"to",
"get",
"a",
"given",
"property",
"for",
"a",
"given",
"object",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Core/Service/ObjectService.php#L42-L55 |
192,753 | Polosa/shade-framework-core | app/ServiceContainer.php | ServiceContainer.isRegistered | public function isRegistered($name)
{
return
array_key_exists($name, $this->services)
|| (
isset($this->serviceProviders[$name])
&& $this->serviceProviders[$name] instanceof ServiceProviderInterface
);
} | php | public function isRegistered($name)
{
return
array_key_exists($name, $this->services)
|| (
isset($this->serviceProviders[$name])
&& $this->serviceProviders[$name] instanceof ServiceProviderInterface
);
} | [
"public",
"function",
"isRegistered",
"(",
"$",
"name",
")",
"{",
"return",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"services",
")",
"||",
"(",
"isset",
"(",
"$",
"this",
"->",
"serviceProviders",
"[",
"$",
"name",
"]",
")",
"&&",... | Check if service is registered
@param string $name Service name
@return bool | [
"Check",
"if",
"service",
"is",
"registered"
] | d735d3e8e0616fb9cf4ffc25b8425762ed07940f | https://github.com/Polosa/shade-framework-core/blob/d735d3e8e0616fb9cf4ffc25b8425762ed07940f/app/ServiceContainer.php#L121-L129 |
192,754 | rtens/mockster | src/Mockster.php | Mockster.createFactory | public static function createFactory(callable $configureMockProvider = null) {
$factory = new Factory();
$provider = new MockProvider($factory);
if ($configureMockProvider) {
$configureMockProvider($provider);
}
$factory->setProvider('StdClass', $provider);
... | php | public static function createFactory(callable $configureMockProvider = null) {
$factory = new Factory();
$provider = new MockProvider($factory);
if ($configureMockProvider) {
$configureMockProvider($provider);
}
$factory->setProvider('StdClass', $provider);
... | [
"public",
"static",
"function",
"createFactory",
"(",
"callable",
"$",
"configureMockProvider",
"=",
"null",
")",
"{",
"$",
"factory",
"=",
"new",
"Factory",
"(",
")",
";",
"$",
"provider",
"=",
"new",
"MockProvider",
"(",
"$",
"factory",
")",
";",
"if",
... | Creates a Factory with MockProvider set as default Provider
@param callable $configureMockProvider Receives the MockProvider to be configured
@return Factory | [
"Creates",
"a",
"Factory",
"with",
"MockProvider",
"set",
"as",
"default",
"Provider"
] | 712a8a8384d7bda03ca5dea2b82d7a7a47b131fe | https://github.com/rtens/mockster/blob/712a8a8384d7bda03ca5dea2b82d7a7a47b131fe/src/Mockster.php#L50-L61 |
192,755 | Talis90/HtmlMediaFinder | library/HtmlMediaFinder/ProviderHandler/streamcloud.eu/Provider.php | Provider.getDownloadUrl | function getDownloadUrl() {
$inputs = self::remoteXpathQuery($this->videoUrl, '/html/body/div[3]/div[2]/div[2]/div[7]/form/input[@name]');
$postFields = [];
foreach ($inputs as $input) {
$postFields[$input->getAttribute('name')] = $input->getAttribute('value');
}
sleep(11); //10 sek wait-time is requ... | php | function getDownloadUrl() {
$inputs = self::remoteXpathQuery($this->videoUrl, '/html/body/div[3]/div[2]/div[2]/div[7]/form/input[@name]');
$postFields = [];
foreach ($inputs as $input) {
$postFields[$input->getAttribute('name')] = $input->getAttribute('value');
}
sleep(11); //10 sek wait-time is requ... | [
"function",
"getDownloadUrl",
"(",
")",
"{",
"$",
"inputs",
"=",
"self",
"::",
"remoteXpathQuery",
"(",
"$",
"this",
"->",
"videoUrl",
",",
"'/html/body/div[3]/div[2]/div[2]/div[7]/form/input[@name]'",
")",
";",
"$",
"postFields",
"=",
"[",
"]",
";",
"foreach",
... | Special provider implementation
@return string | [
"Special",
"provider",
"implementation"
] | fd19212a88d5d3f78d20aeea1accf7be427643b0 | https://github.com/Talis90/HtmlMediaFinder/blob/fd19212a88d5d3f78d20aeea1accf7be427643b0/library/HtmlMediaFinder/ProviderHandler/streamcloud.eu/Provider.php#L16-L31 |
192,756 | miaoxing/plugin | src/BaseModel.php | BaseModel.selectExcept | public function selectExcept($fields)
{
$fields = array_diff($this->getFields(), is_array($fields) ? $fields : [$fields]);
return $this->select($fields);
} | php | public function selectExcept($fields)
{
$fields = array_diff($this->getFields(), is_array($fields) ? $fields : [$fields]);
return $this->select($fields);
} | [
"public",
"function",
"selectExcept",
"(",
"$",
"fields",
")",
"{",
"$",
"fields",
"=",
"array_diff",
"(",
"$",
"this",
"->",
"getFields",
"(",
")",
",",
"is_array",
"(",
"$",
"fields",
")",
"?",
"$",
"fields",
":",
"[",
"$",
"fields",
"]",
")",
";... | Specifies an item that is not to be returned in the query result.
Replaces any previously specified selections, if any.
@param string|array $fields
@return $this | [
"Specifies",
"an",
"item",
"that",
"is",
"not",
"to",
"be",
"returned",
"in",
"the",
"query",
"result",
".",
"Replaces",
"any",
"previously",
"specified",
"selections",
"if",
"any",
"."
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/BaseModel.php#L527-L532 |
192,757 | miaoxing/plugin | src/BaseModel.php | BaseModel.load | public function load($names)
{
foreach ((array) $names as $name) {
// 1. Load relation config
$parts = explode('.', $name, 2);
$name = $parts[0];
$next = isset($parts[1]) ? $parts[1] : null;
if (isset($this->loadedRelations[$name])) {
... | php | public function load($names)
{
foreach ((array) $names as $name) {
// 1. Load relation config
$parts = explode('.', $name, 2);
$name = $parts[0];
$next = isset($parts[1]) ? $parts[1] : null;
if (isset($this->loadedRelations[$name])) {
... | [
"public",
"function",
"load",
"(",
"$",
"names",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"names",
"as",
"$",
"name",
")",
"{",
"// 1. Load relation config",
"$",
"parts",
"=",
"explode",
"(",
"'.'",
",",
"$",
"name",
",",
"2",
")",
";",
"... | Eager load relations
@param string|array $names
@return $this|$this[] | [
"Eager",
"load",
"relations"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/BaseModel.php#L722-L768 |
192,758 | miaoxing/plugin | src/BaseModel.php | BaseModel.snake | protected function snake($input)
{
if (isset(static::$snakeCache[$input])) {
return static::$snakeCache[$input];
}
$value = $input;
if (!ctype_lower($input)) {
$value = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $input));
}
return static... | php | protected function snake($input)
{
if (isset(static::$snakeCache[$input])) {
return static::$snakeCache[$input];
}
$value = $input;
if (!ctype_lower($input)) {
$value = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $input));
}
return static... | [
"protected",
"function",
"snake",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"snakeCache",
"[",
"$",
"input",
"]",
")",
")",
"{",
"return",
"static",
"::",
"$",
"snakeCache",
"[",
"$",
"input",
"]",
";",
"}",
"$",
... | Convert a input to snake case
@param string $input
@return string | [
"Convert",
"a",
"input",
"to",
"snake",
"case"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/BaseModel.php#L840-L852 |
192,759 | miaoxing/plugin | src/BaseModel.php | BaseModel.camel | protected function camel($input)
{
if (isset(static::$camelCache[$input])) {
return static::$camelCache[$input];
}
return static::$camelCache[$input] = lcfirst(str_replace(' ', '', ucwords(strtr($input, '_-', ' '))));
} | php | protected function camel($input)
{
if (isset(static::$camelCache[$input])) {
return static::$camelCache[$input];
}
return static::$camelCache[$input] = lcfirst(str_replace(' ', '', ucwords(strtr($input, '_-', ' '))));
} | [
"protected",
"function",
"camel",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"camelCache",
"[",
"$",
"input",
"]",
")",
")",
"{",
"return",
"static",
"::",
"$",
"camelCache",
"[",
"$",
"input",
"]",
";",
"}",
"return... | Convert a input to camel case
@param string $input
@return string | [
"Convert",
"a",
"input",
"to",
"camel",
"case"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/BaseModel.php#L860-L867 |
192,760 | miaoxing/plugin | src/BaseModel.php | BaseModel.hasColumn | public function hasColumn($name)
{
$name = $this->filterInputColumn($name);
return in_array($name, $this->getFields());
} | php | public function hasColumn($name)
{
$name = $this->filterInputColumn($name);
return in_array($name, $this->getFields());
} | [
"public",
"function",
"hasColumn",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"filterInputColumn",
"(",
"$",
"name",
")",
";",
"return",
"in_array",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"getFields",
"(",
")",
")",
";",
"}... | Check if column name exists
@param string $name
@return bool | [
"Check",
"if",
"column",
"name",
"exists"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/BaseModel.php#L963-L968 |
192,761 | miaoxing/plugin | src/BaseModel.php | BaseModel.isChanged | public function isChanged($field = null)
{
if ($field) {
$field = $this->filterInputColumn($field);
return array_key_exists($field, $this->changedData);
}
return $this->isChanged;
} | php | public function isChanged($field = null)
{
if ($field) {
$field = $this->filterInputColumn($field);
return array_key_exists($field, $this->changedData);
}
return $this->isChanged;
} | [
"public",
"function",
"isChanged",
"(",
"$",
"field",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"field",
")",
"{",
"$",
"field",
"=",
"$",
"this",
"->",
"filterInputColumn",
"(",
"$",
"field",
")",
";",
"return",
"array_key_exists",
"(",
"$",
"field",
"... | Check if the record's data or specified field is changed
@param string $field
@return bool | [
"Check",
"if",
"the",
"record",
"s",
"data",
"or",
"specified",
"field",
"is",
"changed"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/BaseModel.php#L1058-L1065 |
192,762 | miaoxing/plugin | src/BaseModel.php | BaseModel.toRet | public function toRet(array $merge = [])
{
if ($this->isColl()) {
return $this->suc($merge + [
'data' => $this,
'page' => $this->getSqlPart('page'),
'rows' => $this->getSqlPart('limit'),
'records' => $this->count(),
... | php | public function toRet(array $merge = [])
{
if ($this->isColl()) {
return $this->suc($merge + [
'data' => $this,
'page' => $this->getSqlPart('page'),
'rows' => $this->getSqlPart('limit'),
'records' => $this->count(),
... | [
"public",
"function",
"toRet",
"(",
"array",
"$",
"merge",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isColl",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"suc",
"(",
"$",
"merge",
"+",
"[",
"'data'",
"=>",
"$",
"this",
",",
... | Returns the success result with model data
@param array $merge
@return array | [
"Returns",
"the",
"success",
"result",
"with",
"model",
"data"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/BaseModel.php#L1118-L1130 |
192,763 | DreadLabs/VantomasWebsite | src/Disqus/Resource/AbstractResource.php | AbstractResource.getPath | public function getPath(array $parameters)
{
foreach ($parameters as $parameterName => $parameterValue) {
$parameterMethod = 'set' . ucfirst($parameterName);
$this->$parameterMethod($parameterValue);
}
return $this->buildPath();
} | php | public function getPath(array $parameters)
{
foreach ($parameters as $parameterName => $parameterValue) {
$parameterMethod = 'set' . ucfirst($parameterName);
$this->$parameterMethod($parameterValue);
}
return $this->buildPath();
} | [
"public",
"function",
"getPath",
"(",
"array",
"$",
"parameters",
")",
"{",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"parameterName",
"=>",
"$",
"parameterValue",
")",
"{",
"$",
"parameterMethod",
"=",
"'set'",
".",
"ucfirst",
"(",
"$",
"parameterName",... | returns the resource path which is usable by a client
@param array $parameters
@return string A API query string | [
"returns",
"the",
"resource",
"path",
"which",
"is",
"usable",
"by",
"a",
"client"
] | 7f85f2b45bdf5ed9fa9d320c805c416bf99cd668 | https://github.com/DreadLabs/VantomasWebsite/blob/7f85f2b45bdf5ed9fa9d320c805c416bf99cd668/src/Disqus/Resource/AbstractResource.php#L51-L60 |
192,764 | DreadLabs/VantomasWebsite | src/Disqus/Resource/AbstractResource.php | AbstractResource.buildPath | protected function buildPath()
{
$urlParameters = array();
$parameters = get_object_vars($this);
foreach ($parameters as $parameterName => $parameterValue) {
if (true === is_null($parameterValue)) {
continue;
}
if ($parameterName === 'api... | php | protected function buildPath()
{
$urlParameters = array();
$parameters = get_object_vars($this);
foreach ($parameters as $parameterName => $parameterValue) {
if (true === is_null($parameterValue)) {
continue;
}
if ($parameterName === 'api... | [
"protected",
"function",
"buildPath",
"(",
")",
"{",
"$",
"urlParameters",
"=",
"array",
"(",
")",
";",
"$",
"parameters",
"=",
"get_object_vars",
"(",
"$",
"this",
")",
";",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"parameterName",
"=>",
"$",
"para... | builds a API query string path
@return string | [
"builds",
"a",
"API",
"query",
"string",
"path"
] | 7f85f2b45bdf5ed9fa9d320c805c416bf99cd668 | https://github.com/DreadLabs/VantomasWebsite/blob/7f85f2b45bdf5ed9fa9d320c805c416bf99cd668/src/Disqus/Resource/AbstractResource.php#L67-L85 |
192,765 | DreadLabs/VantomasWebsite | src/Disqus/Resource/AbstractResource.php | AbstractResource.getArrayPathParameter | protected function getArrayPathParameter($parameterName, array $parameterValue)
{
$urlParameter = array();
foreach ($parameterValue as $parameterValueValue) {
$urlParameter[] = $this->getPathParameter($parameterName, $parameterValueValue);
}
return implode('&', $urlPara... | php | protected function getArrayPathParameter($parameterName, array $parameterValue)
{
$urlParameter = array();
foreach ($parameterValue as $parameterValueValue) {
$urlParameter[] = $this->getPathParameter($parameterName, $parameterValueValue);
}
return implode('&', $urlPara... | [
"protected",
"function",
"getArrayPathParameter",
"(",
"$",
"parameterName",
",",
"array",
"$",
"parameterValue",
")",
"{",
"$",
"urlParameter",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"parameterValue",
"as",
"$",
"parameterValueValue",
")",
"{",
"$"... | iterates over an array parameter value
@param string $parameterName
@param array $parameterValue
@return string | [
"iterates",
"over",
"an",
"array",
"parameter",
"value"
] | 7f85f2b45bdf5ed9fa9d320c805c416bf99cd668 | https://github.com/DreadLabs/VantomasWebsite/blob/7f85f2b45bdf5ed9fa9d320c805c416bf99cd668/src/Disqus/Resource/AbstractResource.php#L158-L167 |
192,766 | Palmabit-IT/library | src/Palmabit/Library/Models/SingleTableInheritance.php | SingleTableInheritance.prepareAllAttributes | protected function prepareAllAttributes() {
static::$all_attributes = static::$my_attributes;
$parent = get_class($this);
while (($parent = get_parent_class($parent)) != 'Palmabit\Library\Models\SingleTableInheritance') {
static::$all_attributes = array_merge(static::$all_attributes, $parent::$my_attr... | php | protected function prepareAllAttributes() {
static::$all_attributes = static::$my_attributes;
$parent = get_class($this);
while (($parent = get_parent_class($parent)) != 'Palmabit\Library\Models\SingleTableInheritance') {
static::$all_attributes = array_merge(static::$all_attributes, $parent::$my_attr... | [
"protected",
"function",
"prepareAllAttributes",
"(",
")",
"{",
"static",
"::",
"$",
"all_attributes",
"=",
"static",
"::",
"$",
"my_attributes",
";",
"$",
"parent",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"while",
"(",
"(",
"$",
"parent",
"=",
"ge... | Fill the array containing all the attributes that belongs to the class
@return void | [
"Fill",
"the",
"array",
"containing",
"all",
"the",
"attributes",
"that",
"belongs",
"to",
"the",
"class"
] | ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9 | https://github.com/Palmabit-IT/library/blob/ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9/src/Palmabit/Library/Models/SingleTableInheritance.php#L67-L73 |
192,767 | Palmabit-IT/library | src/Palmabit/Library/Models/SingleTableInheritance.php | SingleTableInheritance.newQuery | public function newQuery($excludeDeleted = true) {
$builder = parent::newQuery($excludeDeleted);
$builder->where(static::$table_type_field, '=', $this->table_type);
return $builder;
} | php | public function newQuery($excludeDeleted = true) {
$builder = parent::newQuery($excludeDeleted);
$builder->where(static::$table_type_field, '=', $this->table_type);
return $builder;
} | [
"public",
"function",
"newQuery",
"(",
"$",
"excludeDeleted",
"=",
"true",
")",
"{",
"$",
"builder",
"=",
"parent",
"::",
"newQuery",
"(",
"$",
"excludeDeleted",
")",
";",
"$",
"builder",
"->",
"where",
"(",
"static",
"::",
"$",
"table_type_field",
",",
... | Update newQuery to fetch data of the right type
@param boolean $getOnlyMyType
@param bool $excludeDeleted
@return \Illuminate\Database\Eloquent\Builder|static | [
"Update",
"newQuery",
"to",
"fetch",
"data",
"of",
"the",
"right",
"type"
] | ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9 | https://github.com/Palmabit-IT/library/blob/ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9/src/Palmabit/Library/Models/SingleTableInheritance.php#L122-L127 |
192,768 | gingerwfms/ginger-core | src/GingerCore/Repository/AbstractCrudRepository.php | AbstractCrudRepository.delete | public function delete(Resource\ResourceId $resourceId)
{
$this->crudRepositoryAdapter->deleteResource($this->resourceType, $resourceId);
} | php | public function delete(Resource\ResourceId $resourceId)
{
$this->crudRepositoryAdapter->deleteResource($this->resourceType, $resourceId);
} | [
"public",
"function",
"delete",
"(",
"Resource",
"\\",
"ResourceId",
"$",
"resourceId",
")",
"{",
"$",
"this",
"->",
"crudRepositoryAdapter",
"->",
"deleteResource",
"(",
"$",
"this",
"->",
"resourceType",
",",
"$",
"resourceId",
")",
";",
"}"
] | Delete Resource by it's resource id
@param Resource\ResourceId $resourceId
@return void
@throws \GingerCore\Exception\RuntimeException If deletion could not be performed | [
"Delete",
"Resource",
"by",
"it",
"s",
"resource",
"id"
] | 178e699dd1a912ec7b8b4e21f7de51edd2a1c1e8 | https://github.com/gingerwfms/ginger-core/blob/178e699dd1a912ec7b8b4e21f7de51edd2a1c1e8/src/GingerCore/Repository/AbstractCrudRepository.php#L66-L69 |
192,769 | gingerwfms/ginger-core | src/GingerCore/Repository/AbstractCrudRepository.php | AbstractCrudRepository.update | public function update(Resource\ResourceData $resourceData)
{
return $this->crudRepositoryAdapter->updateResource($this->resourceType, $resourceData);
} | php | public function update(Resource\ResourceData $resourceData)
{
return $this->crudRepositoryAdapter->updateResource($this->resourceType, $resourceData);
} | [
"public",
"function",
"update",
"(",
"Resource",
"\\",
"ResourceData",
"$",
"resourceData",
")",
"{",
"return",
"$",
"this",
"->",
"crudRepositoryAdapter",
"->",
"updateResource",
"(",
"$",
"this",
"->",
"resourceType",
",",
"$",
"resourceData",
")",
";",
"}"
... | Update resource data
@param Resource\ResourceData $resourceData Contains all data that should be updated
@return Resource\ResourceData All data of resource including the updated properties
@throws \GingerCore\Exception\RuntimeException If update could not be performed | [
"Update",
"resource",
"data"
] | 178e699dd1a912ec7b8b4e21f7de51edd2a1c1e8 | https://github.com/gingerwfms/ginger-core/blob/178e699dd1a912ec7b8b4e21f7de51edd2a1c1e8/src/GingerCore/Repository/AbstractCrudRepository.php#L80-L83 |
192,770 | gingerwfms/ginger-core | src/GingerCore/Repository/AbstractCrudRepository.php | AbstractCrudRepository.read | public function read(Resource\ResourceId $resourceId)
{
return $this->crudRepositoryAdapter->getResource($this->resourceType, $resourceId);
} | php | public function read(Resource\ResourceId $resourceId)
{
return $this->crudRepositoryAdapter->getResource($this->resourceType, $resourceId);
} | [
"public",
"function",
"read",
"(",
"Resource",
"\\",
"ResourceId",
"$",
"resourceId",
")",
"{",
"return",
"$",
"this",
"->",
"crudRepositoryAdapter",
"->",
"getResource",
"(",
"$",
"this",
"->",
"resourceType",
",",
"$",
"resourceId",
")",
";",
"}"
] | Read data for a single resource
@param Resource\ResourceId $resourceId
@return ResourceData|null | [
"Read",
"data",
"for",
"a",
"single",
"resource"
] | 178e699dd1a912ec7b8b4e21f7de51edd2a1c1e8 | https://github.com/gingerwfms/ginger-core/blob/178e699dd1a912ec7b8b4e21f7de51edd2a1c1e8/src/GingerCore/Repository/AbstractCrudRepository.php#L92-L95 |
192,771 | stubbles/stubbles-dbal | src/main/php/pdo/PdoQueryResult.php | PdoQueryResult.bindColumn | public function bindColumn($column, &$variable, $type = null): bool
{
try {
return $this->pdoStatement->bindColumn($column, $variable, $type, null, null);
} catch (PDOException $pdoe) {
throw new DatabaseException($pdoe->getMessage(), $pdoe);
}
} | php | public function bindColumn($column, &$variable, $type = null): bool
{
try {
return $this->pdoStatement->bindColumn($column, $variable, $type, null, null);
} catch (PDOException $pdoe) {
throw new DatabaseException($pdoe->getMessage(), $pdoe);
}
} | [
"public",
"function",
"bindColumn",
"(",
"$",
"column",
",",
"&",
"$",
"variable",
",",
"$",
"type",
"=",
"null",
")",
":",
"bool",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"pdoStatement",
"->",
"bindColumn",
"(",
"$",
"column",
",",
"$",
"varia... | bind a result column to a variable
@param int|string $column column number or name to bind the variable to
@param mixed &$variable the variable to bind to the column
@param int|string $type optional type of the binded variable
@return bool true on success, false on failure
@throws \s... | [
"bind",
"a",
"result",
"column",
"to",
"a",
"variable"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/pdo/PdoQueryResult.php#L50-L57 |
192,772 | stubbles/stubbles-dbal | src/main/php/pdo/PdoQueryResult.php | PdoQueryResult.fetch | public function fetch(int $fetchMode = null, array $driverOptions = [])
{
if (null === $fetchMode) {
$fetchMode = PDO::FETCH_ASSOC;
}
try {
return $this->pdoStatement->fetch(
$fetchMode,
$driverOptions['cursorOrientation'] ?? n... | php | public function fetch(int $fetchMode = null, array $driverOptions = [])
{
if (null === $fetchMode) {
$fetchMode = PDO::FETCH_ASSOC;
}
try {
return $this->pdoStatement->fetch(
$fetchMode,
$driverOptions['cursorOrientation'] ?? n... | [
"public",
"function",
"fetch",
"(",
"int",
"$",
"fetchMode",
"=",
"null",
",",
"array",
"$",
"driverOptions",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"fetchMode",
")",
"{",
"$",
"fetchMode",
"=",
"PDO",
"::",
"FETCH_ASSOC",
";",
"}",
... | fetch a result
@param int $fetchMode optional the mode to use for fetching the data
@param array $driverOptions optional driver specific arguments
@return mixed
@throws \stubbles\db\DatabaseException
@see http://php.net/pdostatement-fetch | [
"fetch",
"a",
"result"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/pdo/PdoQueryResult.php#L68-L83 |
192,773 | stubbles/stubbles-dbal | src/main/php/pdo/PdoQueryResult.php | PdoQueryResult.fetchOne | public function fetchOne(int $columnNumber = 0)
{
try {
return $this->pdoStatement->fetchColumn($columnNumber);
} catch (PDOException $pdoe) {
throw new DatabaseException($pdoe->getMessage(), $pdoe);
}
} | php | public function fetchOne(int $columnNumber = 0)
{
try {
return $this->pdoStatement->fetchColumn($columnNumber);
} catch (PDOException $pdoe) {
throw new DatabaseException($pdoe->getMessage(), $pdoe);
}
} | [
"public",
"function",
"fetchOne",
"(",
"int",
"$",
"columnNumber",
"=",
"0",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"pdoStatement",
"->",
"fetchColumn",
"(",
"$",
"columnNumber",
")",
";",
"}",
"catch",
"(",
"PDOException",
"$",
"pdoe",
")",
... | fetch single column from the next row from a result set
@param int $columnNumber optional the column number to fetch, default is first column
@return string|false
@throws \stubbles\db\DatabaseException
@see http://php.net/pdostatement-fetchColumn | [
"fetch",
"single",
"column",
"from",
"the",
"next",
"row",
"from",
"a",
"result",
"set"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/pdo/PdoQueryResult.php#L93-L100 |
192,774 | stubbles/stubbles-dbal | src/main/php/pdo/PdoQueryResult.php | PdoQueryResult.fetchAll | public function fetchAll(int $fetchMode = null, array $driverOptions = []): array
{
try {
if (null === $fetchMode) {
return $this->pdoStatement->fetchAll();
}
if (PDO::FETCH_COLUMN == $fetchMode) {
return $this->pdoStatement->fetchAll(
... | php | public function fetchAll(int $fetchMode = null, array $driverOptions = []): array
{
try {
if (null === $fetchMode) {
return $this->pdoStatement->fetchAll();
}
if (PDO::FETCH_COLUMN == $fetchMode) {
return $this->pdoStatement->fetchAll(
... | [
"public",
"function",
"fetchAll",
"(",
"int",
"$",
"fetchMode",
"=",
"null",
",",
"array",
"$",
"driverOptions",
"=",
"[",
"]",
")",
":",
"array",
"{",
"try",
"{",
"if",
"(",
"null",
"===",
"$",
"fetchMode",
")",
"{",
"return",
"$",
"this",
"->",
"... | returns an array containing all of the result set rows
@param int $fetchMode optional the mode to use for fetching the data
@param array $driverOptions optional driver specific arguments
@return array
@throws \stubbles\db\DatabaseException
@throws \InvalidArgumentException
@see http://php.net/pd... | [
"returns",
"an",
"array",
"containing",
"all",
"of",
"the",
"result",
"set",
"rows"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/pdo/PdoQueryResult.php#L112-L153 |
192,775 | stubbles/stubbles-dbal | src/main/php/pdo/PdoQueryResult.php | PdoQueryResult.next | public function next(): bool
{
try {
return $this->pdoStatement->nextRowset();
} catch (PDOException $pdoe) {
throw new DatabaseException($pdoe->getMessage(), $pdoe);
}
} | php | public function next(): bool
{
try {
return $this->pdoStatement->nextRowset();
} catch (PDOException $pdoe) {
throw new DatabaseException($pdoe->getMessage(), $pdoe);
}
} | [
"public",
"function",
"next",
"(",
")",
":",
"bool",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"pdoStatement",
"->",
"nextRowset",
"(",
")",
";",
"}",
"catch",
"(",
"PDOException",
"$",
"pdoe",
")",
"{",
"throw",
"new",
"DatabaseException",
"(",
"$... | moves the internal result pointer to the next result row
@return bool true on success, false on failure
@throws \stubbles\db\DatabaseException
@see http://php.net/pdostatement-nextRowset | [
"moves",
"the",
"internal",
"result",
"pointer",
"to",
"the",
"next",
"result",
"row"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/pdo/PdoQueryResult.php#L162-L169 |
192,776 | stubbles/stubbles-dbal | src/main/php/pdo/PdoQueryResult.php | PdoQueryResult.count | public function count(): int
{
try {
return $this->pdoStatement->rowCount();
} catch (PDOException $pdoe) {
throw new DatabaseException($pdoe->getMessage(), $pdoe);
}
} | php | public function count(): int
{
try {
return $this->pdoStatement->rowCount();
} catch (PDOException $pdoe) {
throw new DatabaseException($pdoe->getMessage(), $pdoe);
}
} | [
"public",
"function",
"count",
"(",
")",
":",
"int",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"pdoStatement",
"->",
"rowCount",
"(",
")",
";",
"}",
"catch",
"(",
"PDOException",
"$",
"pdoe",
")",
"{",
"throw",
"new",
"DatabaseException",
"(",
"$",... | returns the number of rows affected by the last SQL statement
@return int
@throws \stubbles\db\DatabaseException
@see http://php.net/pdostatement-rowCount | [
"returns",
"the",
"number",
"of",
"rows",
"affected",
"by",
"the",
"last",
"SQL",
"statement"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/pdo/PdoQueryResult.php#L178-L185 |
192,777 | stubbles/stubbles-dbal | src/main/php/pdo/PdoQueryResult.php | PdoQueryResult.free | public function free(): bool
{
try {
return $this->pdoStatement->closeCursor();
} catch (PDOException $pdoe) {
throw new DatabaseException($pdoe->getMessage(), $pdoe);
}
} | php | public function free(): bool
{
try {
return $this->pdoStatement->closeCursor();
} catch (PDOException $pdoe) {
throw new DatabaseException($pdoe->getMessage(), $pdoe);
}
} | [
"public",
"function",
"free",
"(",
")",
":",
"bool",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"pdoStatement",
"->",
"closeCursor",
"(",
")",
";",
"}",
"catch",
"(",
"PDOException",
"$",
"pdoe",
")",
"{",
"throw",
"new",
"DatabaseException",
"(",
"... | releases resources allocated of the result set
@return bool true on success, false on failure
@throws \stubbles\db\DatabaseException
@see http://php.net/pdostatement-closeCursor | [
"releases",
"resources",
"allocated",
"of",
"the",
"result",
"set"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/pdo/PdoQueryResult.php#L194-L201 |
192,778 | PenoaksDev/Milky-Framework | src/Milky/Http/View/ViewFactory.php | ViewFactory.parseClassEvent | protected function parseClassEvent( $class, $prefix )
{
if ( Str::contains( $class, '@' ) )
return explode( '@', $class );
$method = Str::contains( $prefix, 'composing' ) ? 'compose' : 'create';
return [$class, $method];
} | php | protected function parseClassEvent( $class, $prefix )
{
if ( Str::contains( $class, '@' ) )
return explode( '@', $class );
$method = Str::contains( $prefix, 'composing' ) ? 'compose' : 'create';
return [$class, $method];
} | [
"protected",
"function",
"parseClassEvent",
"(",
"$",
"class",
",",
"$",
"prefix",
")",
"{",
"if",
"(",
"Str",
"::",
"contains",
"(",
"$",
"class",
",",
"'@'",
")",
")",
"return",
"explode",
"(",
"'@'",
",",
"$",
"class",
")",
";",
"$",
"method",
"... | Parse a class based composer name.
@param string $class
@param string $prefix
@return array | [
"Parse",
"a",
"class",
"based",
"composer",
"name",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Http/View/ViewFactory.php#L495-L503 |
192,779 | Dhii/placeholder-template | src/AbstractBasePlaceholderTemplate.php | AbstractBasePlaceholderTemplate._render | protected function _render($context = null)
{
if (is_null($context)) {
$context = [];
}
return $this->_replaceTokens($this->_getPlaceholderTemplate(), $context, $this->_getTokenStart(), $this->_getTokenEnd(), $this->_getDefaultPlaceholderValue());
} | php | protected function _render($context = null)
{
if (is_null($context)) {
$context = [];
}
return $this->_replaceTokens($this->_getPlaceholderTemplate(), $context, $this->_getTokenStart(), $this->_getTokenEnd(), $this->_getDefaultPlaceholderValue());
} | [
"protected",
"function",
"_render",
"(",
"$",
"context",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"context",
")",
")",
"{",
"$",
"context",
"=",
"[",
"]",
";",
"}",
"return",
"$",
"this",
"->",
"_replaceTokens",
"(",
"$",
"this",
"->"... | Renders this template with context.
@since [*next-version*]
@param BaseContainerInterface|array|ArrayAccess|stdClass|null $context The context, which contains values for this tempalte to render with.
@return string The result of rendering. | [
"Renders",
"this",
"template",
"with",
"context",
"."
] | ab6eb2f98b085dfdf22cf86fd243cd7e6ee68525 | https://github.com/Dhii/placeholder-template/blob/ab6eb2f98b085dfdf22cf86fd243cd7e6ee68525/src/AbstractBasePlaceholderTemplate.php#L73-L80 |
192,780 | zenodorus-tools/core | src/ZenodorusArguments.php | ZenodorusArguments.setProp | protected function setProp(string $property, $value)
{
if (\property_exists($this, $property)) {
$this->{$property} = $value;
}
} | php | protected function setProp(string $property, $value)
{
if (\property_exists($this, $property)) {
$this->{$property} = $value;
}
} | [
"protected",
"function",
"setProp",
"(",
"string",
"$",
"property",
",",
"$",
"value",
")",
"{",
"if",
"(",
"\\",
"property_exists",
"(",
"$",
"this",
",",
"$",
"property",
")",
")",
"{",
"$",
"this",
"->",
"{",
"$",
"property",
"}",
"=",
"$",
"val... | Set a property on the ZenodorusArguments object.
@param string $property
@param mixed $value
@return void | [
"Set",
"a",
"property",
"on",
"the",
"ZenodorusArguments",
"object",
"."
] | 09ce94f460841c1337bb57fc246e74872f5c3aa1 | https://github.com/zenodorus-tools/core/blob/09ce94f460841c1337bb57fc246e74872f5c3aa1/src/ZenodorusArguments.php#L23-L28 |
192,781 | zenodorus-tools/core | src/ZenodorusArguments.php | ZenodorusArguments.get | public function get(string $property, $callback = false)
{
if (isset($this->processed[$property])) {
if ($callback) {
return \call_user_func($callback, $this->processed[$property]);
}
return $this->processed[$property];
}
return false;
... | php | public function get(string $property, $callback = false)
{
if (isset($this->processed[$property])) {
if ($callback) {
return \call_user_func($callback, $this->processed[$property]);
}
return $this->processed[$property];
}
return false;
... | [
"public",
"function",
"get",
"(",
"string",
"$",
"property",
",",
"$",
"callback",
"=",
"false",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"processed",
"[",
"$",
"property",
"]",
")",
")",
"{",
"if",
"(",
"$",
"callback",
")",
"{",
"r... | Get a specific value.
You can optionally pass a callback to process this value.
@param string $property
@param string|function $callback
@return mixed | [
"Get",
"a",
"specific",
"value",
"."
] | 09ce94f460841c1337bb57fc246e74872f5c3aa1 | https://github.com/zenodorus-tools/core/blob/09ce94f460841c1337bb57fc246e74872f5c3aa1/src/ZenodorusArguments.php#L52-L63 |
192,782 | danielgp/common-lib | source/MySQLiByDanielGP.php | MySQLiByDanielGP.connectToMySql | protected function connectToMySql($mySQLconfig)
{
if (is_null($this->mySQLconnection)) {
extract($mySQLconfig);
$this->mySQLconnection = new \mysqli($host, $username, $password, $database, $port);
if ($this->mySQLconnection->connect_error) {
$this->mySQLco... | php | protected function connectToMySql($mySQLconfig)
{
if (is_null($this->mySQLconnection)) {
extract($mySQLconfig);
$this->mySQLconnection = new \mysqli($host, $username, $password, $database, $port);
if ($this->mySQLconnection->connect_error) {
$this->mySQLco... | [
"protected",
"function",
"connectToMySql",
"(",
"$",
"mySQLconfig",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"mySQLconnection",
")",
")",
"{",
"extract",
"(",
"$",
"mySQLconfig",
")",
";",
"$",
"this",
"->",
"mySQLconnection",
"=",
"new",
... | Initiates connection to MySQL
@param array $mySQLconfig
$mySQLconfig = [
'host' => MYSQL_HOST,
'port' => MYSQL_PORT,
'username' => MYSQL_USERNAME,
'password' => MYSQL_PASSWORD,
'database' => MYSQL_DATABASE,
];
@return string | [
"Initiates",
"connection",
"to",
"MySQL"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGP.php#L57-L71 |
192,783 | danielgp/common-lib | source/MySQLiByDanielGP.php | MySQLiByDanielGP.getFieldOutputDate | protected function getFieldOutputDate($value)
{
$defaultValue = $this->getFieldValue($value);
if ($defaultValue == 'NULL') {
$defaultValue = date('Y-m-d');
}
$inA = [
'type' => 'text',
'name' => $value['COLUMN_NAME'],
'id' ... | php | protected function getFieldOutputDate($value)
{
$defaultValue = $this->getFieldValue($value);
if ($defaultValue == 'NULL') {
$defaultValue = date('Y-m-d');
}
$inA = [
'type' => 'text',
'name' => $value['COLUMN_NAME'],
'id' ... | [
"protected",
"function",
"getFieldOutputDate",
"(",
"$",
"value",
")",
"{",
"$",
"defaultValue",
"=",
"$",
"this",
"->",
"getFieldValue",
"(",
"$",
"value",
")",
";",
"if",
"(",
"$",
"defaultValue",
"==",
"'NULL'",
")",
"{",
"$",
"defaultValue",
"=",
"da... | Returns a Date field 2 use in a form
@param array $value
@return string | [
"Returns",
"a",
"Date",
"field",
"2",
"use",
"in",
"a",
"form"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGP.php#L79-L98 |
192,784 | danielgp/common-lib | source/MySQLiByDanielGP.php | MySQLiByDanielGP.getMySQLqueryWithParameterIdentifier | protected function getMySQLqueryWithParameterIdentifier($sQuery, $paramIdentifier)
{
$sReturn = true;
if (strpos($sQuery, $paramIdentifier) === false) {
$sReturn = false;
}
return $sReturn;
} | php | protected function getMySQLqueryWithParameterIdentifier($sQuery, $paramIdentifier)
{
$sReturn = true;
if (strpos($sQuery, $paramIdentifier) === false) {
$sReturn = false;
}
return $sReturn;
} | [
"protected",
"function",
"getMySQLqueryWithParameterIdentifier",
"(",
"$",
"sQuery",
",",
"$",
"paramIdentifier",
")",
"{",
"$",
"sReturn",
"=",
"true",
";",
"if",
"(",
"strpos",
"(",
"$",
"sQuery",
",",
"$",
"paramIdentifier",
")",
"===",
"false",
")",
"{",... | Provides a detection if given Query does contain a Parameter
that may require statement processing later on
@param string $sQuery
@param string $paramIdentifier
@return boolean | [
"Provides",
"a",
"detection",
"if",
"given",
"Query",
"does",
"contain",
"a",
"Parameter",
"that",
"may",
"require",
"statement",
"processing",
"later",
"on"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGP.php#L120-L127 |
192,785 | danielgp/common-lib | source/MySQLiByDanielGP.php | MySQLiByDanielGP.setMySQLquery2Server | protected function setMySQLquery2Server($sQuery, $sReturnType = null, $ftrs = null)
{
if (is_null($sReturnType)) {
$this->mySQLconnection->query(html_entity_decode($sQuery));
return '';
} elseif (is_null($this->mySQLconnection)) {
return ['customError' => $this->l... | php | protected function setMySQLquery2Server($sQuery, $sReturnType = null, $ftrs = null)
{
if (is_null($sReturnType)) {
$this->mySQLconnection->query(html_entity_decode($sQuery));
return '';
} elseif (is_null($this->mySQLconnection)) {
return ['customError' => $this->l... | [
"protected",
"function",
"setMySQLquery2Server",
"(",
"$",
"sQuery",
",",
"$",
"sReturnType",
"=",
"null",
",",
"$",
"ftrs",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"sReturnType",
")",
")",
"{",
"$",
"this",
"->",
"mySQLconnection",
"->",
... | Transmit Query to MySQL server and get results back
@param string $sQuery
@param string $sReturnType
@param array $ftrs
@return boolean|array|string | [
"Transmit",
"Query",
"to",
"MySQL",
"server",
"and",
"get",
"results",
"back"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGP.php#L137-L152 |
192,786 | ZeeCoder/good-to-know | src/ZeeCoder/GoodToKnow/ParameterInjector.php | ParameterInjector.addParameter | public function addParameter($key, $data)
{
if (!is_string($key)) {
throw new \RuntimeException('Only strings can be given as parameter keys. Got "' . gettype($key) . '".');
}
if (!is_string($data) && !is_callable($data)) {
throw new \RuntimeException('The "data" par... | php | public function addParameter($key, $data)
{
if (!is_string($key)) {
throw new \RuntimeException('Only strings can be given as parameter keys. Got "' . gettype($key) . '".');
}
if (!is_string($data) && !is_callable($data)) {
throw new \RuntimeException('The "data" par... | [
"public",
"function",
"addParameter",
"(",
"$",
"key",
",",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Only strings can be given as parameter keys. Got \"'",
".",
"gettyp... | Adds a parameter that can occur in Fact texts.
@param string $key This is the key which will be searched for in the text.
@param string|Callable $data
@throws \RuntimeException if a parameter with the given $key was already
added.
@return $this | [
"Adds",
"a",
"parameter",
"that",
"can",
"occur",
"in",
"Fact",
"texts",
"."
] | 53a8ea6ab4a2cb0f2fd8e1371e7a4a4841be5ede | https://github.com/ZeeCoder/good-to-know/blob/53a8ea6ab4a2cb0f2fd8e1371e7a4a4841be5ede/src/ZeeCoder/GoodToKnow/ParameterInjector.php#L54-L71 |
192,787 | anime-db/catalog-bundle | src/Plugin/Fill/Search/Search.php | Search.getCatalogItem | public function getCatalogItem($name)
{
if (!($this->getFiller() instanceof FillerInterface)) {
return;
}
try {
$list = $this->search(['name' => $name]);
if (count($list) == 1) {
return $this->getFiller()->fillFromSearchResult(array_pop($l... | php | public function getCatalogItem($name)
{
if (!($this->getFiller() instanceof FillerInterface)) {
return;
}
try {
$list = $this->search(['name' => $name]);
if (count($list) == 1) {
return $this->getFiller()->fillFromSearchResult(array_pop($l... | [
"public",
"function",
"getCatalogItem",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"getFiller",
"(",
")",
"instanceof",
"FillerInterface",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"$",
"list",
"=",
"$",
"this",
"->",
... | Try search item by name and fill it if can.
@param string $name
@return EntityItem|null | [
"Try",
"search",
"item",
"by",
"name",
"and",
"fill",
"it",
"if",
"can",
"."
] | 631b6f92a654e91bee84f46218c52cf42bdb8606 | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Plugin/Fill/Search/Search.php#L124-L139 |
192,788 | Sectorr/Core | Sectorr/Core/Auth/Auth.php | Auth.user | public static function user()
{
if (Session::has('user')) {
$userModel = Config::get('user');
$model = new $userModel();
return $model->find(Session::get('user'));
}
return false;
} | php | public static function user()
{
if (Session::has('user')) {
$userModel = Config::get('user');
$model = new $userModel();
return $model->find(Session::get('user'));
}
return false;
} | [
"public",
"static",
"function",
"user",
"(",
")",
"{",
"if",
"(",
"Session",
"::",
"has",
"(",
"'user'",
")",
")",
"{",
"$",
"userModel",
"=",
"Config",
"::",
"get",
"(",
"'user'",
")",
";",
"$",
"model",
"=",
"new",
"$",
"userModel",
"(",
")",
"... | Returns the logged in user's data as an object.
@return bool|object | [
"Returns",
"the",
"logged",
"in",
"user",
"s",
"data",
"as",
"an",
"object",
"."
] | 31df852dc6cc61642b0b87d9f0ae56c8e7da5a27 | https://github.com/Sectorr/Core/blob/31df852dc6cc61642b0b87d9f0ae56c8e7da5a27/Sectorr/Core/Auth/Auth.php#L18-L27 |
192,789 | Sectorr/Core | Sectorr/Core/Auth/Auth.php | Auth.attempt | public static function attempt($input)
{
$userModel = Config::get('user');
$model = new $userModel();
$count = 0;
foreach ($input as $field => $value) {
if ($field == '_') {
unset($input[$field]);
} else {
$count++;
... | php | public static function attempt($input)
{
$userModel = Config::get('user');
$model = new $userModel();
$count = 0;
foreach ($input as $field => $value) {
if ($field == '_') {
unset($input[$field]);
} else {
$count++;
... | [
"public",
"static",
"function",
"attempt",
"(",
"$",
"input",
")",
"{",
"$",
"userModel",
"=",
"Config",
"::",
"get",
"(",
"'user'",
")",
";",
"$",
"model",
"=",
"new",
"$",
"userModel",
"(",
")",
";",
"$",
"count",
"=",
"0",
";",
"foreach",
"(",
... | Attempt to login the user.
If succeeds, create a user session.
@param $input
@return bool | [
"Attempt",
"to",
"login",
"the",
"user",
".",
"If",
"succeeds",
"create",
"a",
"user",
"session",
"."
] | 31df852dc6cc61642b0b87d9f0ae56c8e7da5a27 | https://github.com/Sectorr/Core/blob/31df852dc6cc61642b0b87d9f0ae56c8e7da5a27/Sectorr/Core/Auth/Auth.php#L36-L64 |
192,790 | ARCANESOFT/Auth | src/Http/Requests/Admin/Users/UserFormRequest.php | UserFormRequest.sanitizeUsername | protected function sanitizeUsername()
{
$username = $this->has('username')
? $this->get('username')
: $this->get('first_name').' '.$this->get('last_name');
return Str::slug($username, config('arcanesoft.auth.slug-separator', '.'));
} | php | protected function sanitizeUsername()
{
$username = $this->has('username')
? $this->get('username')
: $this->get('first_name').' '.$this->get('last_name');
return Str::slug($username, config('arcanesoft.auth.slug-separator', '.'));
} | [
"protected",
"function",
"sanitizeUsername",
"(",
")",
"{",
"$",
"username",
"=",
"$",
"this",
"->",
"has",
"(",
"'username'",
")",
"?",
"$",
"this",
"->",
"get",
"(",
"'username'",
")",
":",
"$",
"this",
"->",
"get",
"(",
"'first_name'",
")",
".",
"... | Sanitize the username.
@return string | [
"Sanitize",
"the",
"username",
"."
] | b33ca82597a76b1e395071f71ae3e51f1ec67e62 | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/Http/Requests/Admin/Users/UserFormRequest.php#L70-L77 |
192,791 | MichaelJ2324/PHP-REST-Client | src/Endpoint/Abstracts/AbstractSmartEndpoint.php | AbstractSmartEndpoint.configureDataProperties | protected function configureDataProperties(){
if (isset($this->properties[self::PROPERTY_DATA])){
$this->data->setProperties($this->properties['data']);
}
return $this;
} | php | protected function configureDataProperties(){
if (isset($this->properties[self::PROPERTY_DATA])){
$this->data->setProperties($this->properties['data']);
}
return $this;
} | [
"protected",
"function",
"configureDataProperties",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"properties",
"[",
"self",
"::",
"PROPERTY_DATA",
"]",
")",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"setProperties",
"(",
"$",
"this",
"->",... | Passes Data properties to Endpoint Data object
@return $this | [
"Passes",
"Data",
"properties",
"to",
"Endpoint",
"Data",
"object"
] | b8a2caaf6456eccaa845ba5c5098608aa9645c92 | https://github.com/MichaelJ2324/PHP-REST-Client/blob/b8a2caaf6456eccaa845ba5c5098608aa9645c92/src/Endpoint/Abstracts/AbstractSmartEndpoint.php#L92-L97 |
192,792 | ScaraMVC/Framework | src/Scara/Console/ClearCache.php | ClearCache.clear | private function clear($directory, OutputInterface $output)
{
$handle = opendir($directory);
$ignore = ['.', '..', '.gitkeep'];
while ($file = readdir($handle)) {
if (!in_array($file, $ignore)) {
$output->writeln("Clearing file {$file} from the cache");
... | php | private function clear($directory, OutputInterface $output)
{
$handle = opendir($directory);
$ignore = ['.', '..', '.gitkeep'];
while ($file = readdir($handle)) {
if (!in_array($file, $ignore)) {
$output->writeln("Clearing file {$file} from the cache");
... | [
"private",
"function",
"clear",
"(",
"$",
"directory",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"handle",
"=",
"opendir",
"(",
"$",
"directory",
")",
";",
"$",
"ignore",
"=",
"[",
"'.'",
",",
"'..'",
",",
"'.gitkeep'",
"]",
";",
"while",
... | Handles clearning out files from given location.
@param string $directory
@param \Symfony\Component\Console\Output\OutputInterface $output
@return void | [
"Handles",
"clearning",
"out",
"files",
"from",
"given",
"location",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Console/ClearCache.php#L53-L63 |
192,793 | agentmedia/phine-builtin | src/BuiltIn/Logic/Hooks/DeletePageNavigation.php | DeletePageNavigation.BeforeDelete | public function BeforeDelete($item)
{
$navPages = NavigationPage::Schema()->FetchByPage(false, $item);
foreach ($navPages as $navPage)
{
$item = $navPage->GetItem();
$tree = new TreeBuilder(new NavigationTreeProvider($item->GetNavigation()));
$tree->Remove... | php | public function BeforeDelete($item)
{
$navPages = NavigationPage::Schema()->FetchByPage(false, $item);
foreach ($navPages as $navPage)
{
$item = $navPage->GetItem();
$tree = new TreeBuilder(new NavigationTreeProvider($item->GetNavigation()));
$tree->Remove... | [
"public",
"function",
"BeforeDelete",
"(",
"$",
"item",
")",
"{",
"$",
"navPages",
"=",
"NavigationPage",
"::",
"Schema",
"(",
")",
"->",
"FetchByPage",
"(",
"false",
",",
"$",
"item",
")",
";",
"foreach",
"(",
"$",
"navPages",
"as",
"$",
"navPage",
")... | Deletes the navi items related to the page
@param Page $item The page to be deleted | [
"Deletes",
"the",
"navi",
"items",
"related",
"to",
"the",
"page"
] | 4dd05bc406a71e997bd4eaa16b12e23dbe62a456 | https://github.com/agentmedia/phine-builtin/blob/4dd05bc406a71e997bd4eaa16b12e23dbe62a456/src/BuiltIn/Logic/Hooks/DeletePageNavigation.php#L19-L28 |
192,794 | ComPHPPuebla/restful-extensions | src/ComPHPPuebla/Doctrine/TableGateway/EventListener/HasTimestampListener.php | HasTimestampListener.onInsert | public function onInsert(EventInterface $event)
{
$values = $event->getParam('values');
$now = new DateTime();
$now = $now->format('Y-m-d h:i:s');
$values['created_at'] = $now;
$values['last_updated_at'] = $now;
$event->setParam('values', $values);
} | php | public function onInsert(EventInterface $event)
{
$values = $event->getParam('values');
$now = new DateTime();
$now = $now->format('Y-m-d h:i:s');
$values['created_at'] = $now;
$values['last_updated_at'] = $now;
$event->setParam('values', $values);
} | [
"public",
"function",
"onInsert",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"$",
"values",
"=",
"$",
"event",
"->",
"getParam",
"(",
"'values'",
")",
";",
"$",
"now",
"=",
"new",
"DateTime",
"(",
")",
";",
"$",
"now",
"=",
"$",
"now",
"->",
"f... | Add current `DateTime` value for fields `created_at` and `last_updated_at`
@param EventInterface $event | [
"Add",
"current",
"DateTime",
"value",
"for",
"fields",
"created_at",
"and",
"last_updated_at"
] | 3dc5e554d7ebe1305eed4cd4ec71a6944316199c | https://github.com/ComPHPPuebla/restful-extensions/blob/3dc5e554d7ebe1305eed4cd4ec71a6944316199c/src/ComPHPPuebla/Doctrine/TableGateway/EventListener/HasTimestampListener.php#L25-L36 |
192,795 | ComPHPPuebla/restful-extensions | src/ComPHPPuebla/Doctrine/TableGateway/EventListener/HasTimestampListener.php | HasTimestampListener.onUpdate | public function onUpdate(EventInterface $event)
{
$values = $event->getParam('values');
$now = new DateTime();
$values['last_updated_at'] = $now->format('Y-m-d h:i:s');
$event->setParam('values', $values);
} | php | public function onUpdate(EventInterface $event)
{
$values = $event->getParam('values');
$now = new DateTime();
$values['last_updated_at'] = $now->format('Y-m-d h:i:s');
$event->setParam('values', $values);
} | [
"public",
"function",
"onUpdate",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"$",
"values",
"=",
"$",
"event",
"->",
"getParam",
"(",
"'values'",
")",
";",
"$",
"now",
"=",
"new",
"DateTime",
"(",
")",
";",
"$",
"values",
"[",
"'last_updated_at'",
... | Add current `DateTime` value for field `last_updated_at`
@param EventInterface $event | [
"Add",
"current",
"DateTime",
"value",
"for",
"field",
"last_updated_at"
] | 3dc5e554d7ebe1305eed4cd4ec71a6944316199c | https://github.com/ComPHPPuebla/restful-extensions/blob/3dc5e554d7ebe1305eed4cd4ec71a6944316199c/src/ComPHPPuebla/Doctrine/TableGateway/EventListener/HasTimestampListener.php#L43-L51 |
192,796 | stubbles/stubbles-date | src/main/php/span/Days.php | Days.rewind | public function rewind()
{
if ($this->datespan instanceof Day) {
$this->current = $this->datespan;
} else {
$this->current = new Day($this->datespan->start());
}
} | php | public function rewind()
{
if ($this->datespan instanceof Day) {
$this->current = $this->datespan;
} else {
$this->current = new Day($this->datespan->start());
}
} | [
"public",
"function",
"rewind",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"datespan",
"instanceof",
"Day",
")",
"{",
"$",
"this",
"->",
"current",
"=",
"$",
"this",
"->",
"datespan",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"current",
"=",
"new... | returns iteration back to first day of datespan | [
"returns",
"iteration",
"back",
"to",
"first",
"day",
"of",
"datespan"
] | 98553392bec03affc53a6e3eb7f88408c2720d1c | https://github.com/stubbles/stubbles-date/blob/98553392bec03affc53a6e3eb7f88408c2720d1c/src/main/php/span/Days.php#L85-L92 |
192,797 | Vectrex/vxPHP | src/Http/HeaderBag.php | HeaderBag.contains | public function contains($key, $value) {
return in_array($value, $this->get($key, NULL, FALSE));
} | php | public function contains($key, $value) {
return in_array($value, $this->get($key, NULL, FALSE));
} | [
"public",
"function",
"contains",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"return",
"in_array",
"(",
"$",
"value",
",",
"$",
"this",
"->",
"get",
"(",
"$",
"key",
",",
"NULL",
",",
"FALSE",
")",
")",
";",
"}"
] | Returns TRUE if the given HTTP header contains the given value.
@param string $key The HTTP header name
@param string $value The HTTP value
@return Boolean TRUE if the value is contained in the header, FALSE otherwise | [
"Returns",
"TRUE",
"if",
"the",
"given",
"HTTP",
"header",
"contains",
"the",
"given",
"value",
"."
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/HeaderBag.php#L189-L193 |
192,798 | horntell/php-sdk | lib/guzzle/GuzzleHttp/Query.php | Query.fromString | public static function fromString($query, $urlEncoding = true)
{
static $qp;
if (!$qp) {
$qp = new QueryParser();
}
$q = new static();
if ($urlEncoding !== true) {
$q->setEncodingType($urlEncoding);
}
$qp->parseInto($q, $query, $urlE... | php | public static function fromString($query, $urlEncoding = true)
{
static $qp;
if (!$qp) {
$qp = new QueryParser();
}
$q = new static();
if ($urlEncoding !== true) {
$q->setEncodingType($urlEncoding);
}
$qp->parseInto($q, $query, $urlE... | [
"public",
"static",
"function",
"fromString",
"(",
"$",
"query",
",",
"$",
"urlEncoding",
"=",
"true",
")",
"{",
"static",
"$",
"qp",
";",
"if",
"(",
"!",
"$",
"qp",
")",
"{",
"$",
"qp",
"=",
"new",
"QueryParser",
"(",
")",
";",
"}",
"$",
"q",
... | Parse a query string into a Query object
$urlEncoding is used to control how the query string is parsed and how
it is ultimately serialized. The value can be set to one of the
following:
- true: (default) Parse query strings using RFC 3986 while still
converting "+" to " ".
- false: Disables URL decoding of the input... | [
"Parse",
"a",
"query",
"string",
"into",
"a",
"Query",
"object"
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Query.php#L38-L54 |
192,799 | horntell/php-sdk | lib/guzzle/GuzzleHttp/Query.php | Query.duplicateAggregator | public static function duplicateAggregator()
{
return function (array $data) {
return self::walkQuery($data, '', function ($key, $prefix) {
return is_int($key) ? $prefix : "{$prefix}[{$key}]";
});
};
} | php | public static function duplicateAggregator()
{
return function (array $data) {
return self::walkQuery($data, '', function ($key, $prefix) {
return is_int($key) ? $prefix : "{$prefix}[{$key}]";
});
};
} | [
"public",
"static",
"function",
"duplicateAggregator",
"(",
")",
"{",
"return",
"function",
"(",
"array",
"$",
"data",
")",
"{",
"return",
"self",
"::",
"walkQuery",
"(",
"$",
"data",
",",
"''",
",",
"function",
"(",
"$",
"key",
",",
"$",
"prefix",
")"... | Query string aggregator that does not aggregate nested query string
values and allows duplicates in the resulting array.
Example: http://test.com?q=1&q=2
@return callable | [
"Query",
"string",
"aggregator",
"that",
"does",
"not",
"aggregate",
"nested",
"query",
"string",
"values",
"and",
"allows",
"duplicates",
"in",
"the",
"resulting",
"array",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Query.php#L155-L162 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.