repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
phossa/phossa-cache | src/Phossa/Cache/Driver/CompositeDriver.php | CompositeDriver.has | public function has(/*# string */ $key)/*# : int */
{
// try front-end cache first
$res = $this->frontHas($key);
if ($res) {
return $res;
}
// try backend cache
return $this->backHas($key);
} | php | public function has(/*# string */ $key)/*# : int */
{
// try front-end cache first
$res = $this->frontHas($key);
if ($res) {
return $res;
}
// try backend cache
return $this->backHas($key);
} | [
"public",
"function",
"has",
"(",
"/*# string */",
"$",
"key",
")",
"/*# : int */",
"{",
"// try front-end cache first",
"$",
"res",
"=",
"$",
"this",
"->",
"frontHas",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"res",
")",
"{",
"return",
"$",
"res",
"... | Either end has is ok
{inheritDoc} | [
"Either",
"end",
"has",
"is",
"ok"
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Driver/CompositeDriver.php#L169-L179 | train |
phossa/phossa-cache | src/Phossa/Cache/Driver/CompositeDriver.php | CompositeDriver.clear | public function clear()/*# : bool */
{
$ends = [ $this->front, $this->back ];
foreach ($ends as $end) {
if (!$end->clear()) {
return $this->falseAndSetError(
$end->getError(),
$end->getErrorCode()
);
}
... | php | public function clear()/*# : bool */
{
$ends = [ $this->front, $this->back ];
foreach ($ends as $end) {
if (!$end->clear()) {
return $this->falseAndSetError(
$end->getError(),
$end->getErrorCode()
);
}
... | [
"public",
"function",
"clear",
"(",
")",
"/*# : bool */",
"{",
"$",
"ends",
"=",
"[",
"$",
"this",
"->",
"front",
",",
"$",
"this",
"->",
"back",
"]",
";",
"foreach",
"(",
"$",
"ends",
"as",
"$",
"end",
")",
"{",
"if",
"(",
"!",
"$",
"end",
"->... | Need both ends clear ok
{@inheritDoc} | [
"Need",
"both",
"ends",
"clear",
"ok"
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Driver/CompositeDriver.php#L186-L198 | train |
phossa/phossa-cache | src/Phossa/Cache/Driver/CompositeDriver.php | CompositeDriver.delete | public function delete(/*# string */ $key)/*# : bool */
{
$ends = [ $this->front, $this->back ];
foreach ($ends as $end) {
if (!$end->delete($key)) {
return $this->falseAndSetError(
$end->getError(),
$end->getErrorCode()
... | php | public function delete(/*# string */ $key)/*# : bool */
{
$ends = [ $this->front, $this->back ];
foreach ($ends as $end) {
if (!$end->delete($key)) {
return $this->falseAndSetError(
$end->getError(),
$end->getErrorCode()
... | [
"public",
"function",
"delete",
"(",
"/*# string */",
"$",
"key",
")",
"/*# : bool */",
"{",
"$",
"ends",
"=",
"[",
"$",
"this",
"->",
"front",
",",
"$",
"this",
"->",
"back",
"]",
";",
"foreach",
"(",
"$",
"ends",
"as",
"$",
"end",
")",
"{",
"if",... | Need both ends delete ok
{@inheritDoc} | [
"Need",
"both",
"ends",
"delete",
"ok"
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Driver/CompositeDriver.php#L205-L217 | train |
phossa/phossa-cache | src/Phossa/Cache/Driver/CompositeDriver.php | CompositeDriver.commit | public function commit()/*# : bool */
{
$ends = [ $this->front, $this->back ];
$res = false;
foreach ($ends as $end) {
// commit failed, set error
if (!$end->commit()) {
$this->setError(
$end->getError(),
$end-... | php | public function commit()/*# : bool */
{
$ends = [ $this->front, $this->back ];
$res = false;
foreach ($ends as $end) {
// commit failed, set error
if (!$end->commit()) {
$this->setError(
$end->getError(),
$end-... | [
"public",
"function",
"commit",
"(",
")",
"/*# : bool */",
"{",
"$",
"ends",
"=",
"[",
"$",
"this",
"->",
"front",
",",
"$",
"this",
"->",
"back",
"]",
";",
"$",
"res",
"=",
"false",
";",
"foreach",
"(",
"$",
"ends",
"as",
"$",
"end",
")",
"{",
... | One end commit ok is ok
{@inheritDoc} | [
"One",
"end",
"commit",
"ok",
"is",
"ok"
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Driver/CompositeDriver.php#L240-L260 | train |
phossa/phossa-cache | src/Phossa/Cache/Driver/CompositeDriver.php | CompositeDriver.purge | public function purge(/*# int */ $maxlife)/*# : bool */
{
$ends = [ $this->front, $this->back ];
foreach ($ends as $end) {
if (!$end->purge($maxlife)) {
return $this->falseAndSetError(
$end->getError(),
$end->getErrorCode()
... | php | public function purge(/*# int */ $maxlife)/*# : bool */
{
$ends = [ $this->front, $this->back ];
foreach ($ends as $end) {
if (!$end->purge($maxlife)) {
return $this->falseAndSetError(
$end->getError(),
$end->getErrorCode()
... | [
"public",
"function",
"purge",
"(",
"/*# int */",
"$",
"maxlife",
")",
"/*# : bool */",
"{",
"$",
"ends",
"=",
"[",
"$",
"this",
"->",
"front",
",",
"$",
"this",
"->",
"back",
"]",
";",
"foreach",
"(",
"$",
"ends",
"as",
"$",
"end",
")",
"{",
"if",... | Need both ends purge ok
{@inheritDoc} | [
"Need",
"both",
"ends",
"purge",
"ok"
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Driver/CompositeDriver.php#L267-L279 | train |
phossa/phossa-cache | src/Phossa/Cache/Driver/CompositeDriver.php | CompositeDriver.protectedSave | protected function protectedSave(
CacheItemInterface $item,
$function = 'save'
)/*# : bool */ {
// write to both ?
$func = $this->tester;
$both = $func($item);
// if $both is true, write to front
$res1 = false;
if ($both) {
if ($this->fron... | php | protected function protectedSave(
CacheItemInterface $item,
$function = 'save'
)/*# : bool */ {
// write to both ?
$func = $this->tester;
$both = $func($item);
// if $both is true, write to front
$res1 = false;
if ($both) {
if ($this->fron... | [
"protected",
"function",
"protectedSave",
"(",
"CacheItemInterface",
"$",
"item",
",",
"$",
"function",
"=",
"'save'",
")",
"/*# : bool */",
"{",
"// write to both ?",
"$",
"func",
"=",
"$",
"this",
"->",
"tester",
";",
"$",
"both",
"=",
"$",
"func",
"(",
... | local save method, one end save ok is ok
@param CacheItemInterface $item
@param string $function save or saveDeferred
@return bool
@access protected | [
"local",
"save",
"method",
"one",
"end",
"save",
"ok",
"is",
"ok"
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Driver/CompositeDriver.php#L299-L332 | train |
PascalKleindienst/simple-api-client | src/Model.php | Model.fill | private function fill($attributes)
{
// json
if (is_string($attributes)) {
$attributes = json_decode($attributes, true);
}
// check if attributes are valid
if (!is_array($attributes)) {
throw new \InvalidArgumentException('Attributes must be of type a... | php | private function fill($attributes)
{
// json
if (is_string($attributes)) {
$attributes = json_decode($attributes, true);
}
// check if attributes are valid
if (!is_array($attributes)) {
throw new \InvalidArgumentException('Attributes must be of type a... | [
"private",
"function",
"fill",
"(",
"$",
"attributes",
")",
"{",
"// json",
"if",
"(",
"is_string",
"(",
"$",
"attributes",
")",
")",
"{",
"$",
"attributes",
"=",
"json_decode",
"(",
"$",
"attributes",
",",
"true",
")",
";",
"}",
"// check if attributes ar... | Fill the attributes
@param string|array $attributes
@return void | [
"Fill",
"the",
"attributes"
] | f4e20aa65bb9c340b8aff78acaede7dc62cd2105 | https://github.com/PascalKleindienst/simple-api-client/blob/f4e20aa65bb9c340b8aff78acaede7dc62cd2105/src/Model.php#L35-L50 | train |
PascalKleindienst/simple-api-client | src/Model.php | Model.makeCollection | public function makeCollection(array $values, $class = null)
{
$collection = new Collection($values);
if (!is_null($class) && class_exists($class)) {
$model = new $class();
if ($model instanceof Model) {
foreach ($collection as $key => $item) {
... | php | public function makeCollection(array $values, $class = null)
{
$collection = new Collection($values);
if (!is_null($class) && class_exists($class)) {
$model = new $class();
if ($model instanceof Model) {
foreach ($collection as $key => $item) {
... | [
"public",
"function",
"makeCollection",
"(",
"array",
"$",
"values",
",",
"$",
"class",
"=",
"null",
")",
"{",
"$",
"collection",
"=",
"new",
"Collection",
"(",
"$",
"values",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"class",
")",
"&&",
"class_... | Transform an array of values into a collection of models
@param array $values
@param null $class
@return \Illuminate\Support\Collection | [
"Transform",
"an",
"array",
"of",
"values",
"into",
"a",
"collection",
"of",
"models"
] | f4e20aa65bb9c340b8aff78acaede7dc62cd2105 | https://github.com/PascalKleindienst/simple-api-client/blob/f4e20aa65bb9c340b8aff78acaede7dc62cd2105/src/Model.php#L161-L176 | train |
MichaelRShelton/attribute-translator | src/Providers/AttributeTranslatorServiceProvider.php | AttributeTranslatorServiceProvider.registerService | public function registerService()
{
$this->app->bind('mrs.attributes.translator', function ($attributeMap = []) {
return new AttributeTranslator($attributeMap);
});
$this->app->alias('mrs.attributes.translator', 'attributes.translator');
$this->app->alias('mrs.attributes.... | php | public function registerService()
{
$this->app->bind('mrs.attributes.translator', function ($attributeMap = []) {
return new AttributeTranslator($attributeMap);
});
$this->app->alias('mrs.attributes.translator', 'attributes.translator');
$this->app->alias('mrs.attributes.... | [
"public",
"function",
"registerService",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"'mrs.attributes.translator'",
",",
"function",
"(",
"$",
"attributeMap",
"=",
"[",
"]",
")",
"{",
"return",
"new",
"AttributeTranslator",
"(",
"$",
"attribu... | Register services to the application container. | [
"Register",
"services",
"to",
"the",
"application",
"container",
"."
] | 48a0ef01058647eeeeeeb8954f93b479bd713b82 | https://github.com/MichaelRShelton/attribute-translator/blob/48a0ef01058647eeeeeeb8954f93b479bd713b82/src/Providers/AttributeTranslatorServiceProvider.php#L46-L53 | train |
Palmabit-IT/library | src/Palmabit/Library/ImportExport/CsvFileReader.php | CsvFileReader.readElement | public function readElement()
{
$csv_line_data = $this->spl_file_object->fgetcsv();
if($csv_line_data)
{
$csv_line_data[0] = $this->convertToUtf8($csv_line_data);
if($this->isValidLine($csv_line_data))
{
$csv_line = array_combine($this->columns_name, $csv_line_data);
... | php | public function readElement()
{
$csv_line_data = $this->spl_file_object->fgetcsv();
if($csv_line_data)
{
$csv_line_data[0] = $this->convertToUtf8($csv_line_data);
if($this->isValidLine($csv_line_data))
{
$csv_line = array_combine($this->columns_name, $csv_line_data);
... | [
"public",
"function",
"readElement",
"(",
")",
"{",
"$",
"csv_line_data",
"=",
"$",
"this",
"->",
"spl_file_object",
"->",
"fgetcsv",
"(",
")",
";",
"if",
"(",
"$",
"csv_line_data",
")",
"{",
"$",
"csv_line_data",
"[",
"0",
"]",
"=",
"$",
"this",
"->",... | Reads a single element from the source
then return a Object instance
@return \StdClass|false object instance | [
"Reads",
"a",
"single",
"element",
"from",
"the",
"source",
"then",
"return",
"a",
"Object",
"instance"
] | ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9 | https://github.com/Palmabit-IT/library/blob/ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9/src/Palmabit/Library/ImportExport/CsvFileReader.php#L50-L65 | train |
Palmabit-IT/library | src/Palmabit/Library/ImportExport/CsvFileReader.php | CsvFileReader.readElements | public function readElements()
{
$iterator = new ArrayIterator;
do
{
$object = $this->readElement();
if($object) $iterator->append($object);
} while((boolean)$object);
$this->objects = $iterator;
return $this->objects;
} | php | public function readElements()
{
$iterator = new ArrayIterator;
do
{
$object = $this->readElement();
if($object) $iterator->append($object);
} while((boolean)$object);
$this->objects = $iterator;
return $this->objects;
} | [
"public",
"function",
"readElements",
"(",
")",
"{",
"$",
"iterator",
"=",
"new",
"ArrayIterator",
";",
"do",
"{",
"$",
"object",
"=",
"$",
"this",
"->",
"readElement",
"(",
")",
";",
"if",
"(",
"$",
"object",
")",
"$",
"iterator",
"->",
"append",
"(... | Read all the objects from the source
@return \ArrayIterator | [
"Read",
"all",
"the",
"objects",
"from",
"the",
"source"
] | ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9 | https://github.com/Palmabit-IT/library/blob/ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9/src/Palmabit/Library/ImportExport/CsvFileReader.php#L81-L92 | train |
Aviogram/Common | src/Hydrator/ByConfigBuilder.php | ByConfigBuilder.addField | public function addField($fieldName, $getMethod, $setMethod, ByConfigBuilder $include = null, $formatter = null)
{
if (method_exists($this->getEntityPrototype(), $getMethod) === false) {
throw new Exception\ConfigFailed(sprintf($this->exceptions[2], $getMethod, $this->entityClassName), 2);
... | php | public function addField($fieldName, $getMethod, $setMethod, ByConfigBuilder $include = null, $formatter = null)
{
if (method_exists($this->getEntityPrototype(), $getMethod) === false) {
throw new Exception\ConfigFailed(sprintf($this->exceptions[2], $getMethod, $this->entityClassName), 2);
... | [
"public",
"function",
"addField",
"(",
"$",
"fieldName",
",",
"$",
"getMethod",
",",
"$",
"setMethod",
",",
"ByConfigBuilder",
"$",
"include",
"=",
"null",
",",
"$",
"formatter",
"=",
"null",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
"->",
... | Set a mapping
@param string $fieldName
@param string $getMethod
@param string $setMethod
@param ByConfigBuilder $include
@param Closure $formatter
@return $this | [
"Set",
"a",
"mapping"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/Hydrator/ByConfigBuilder.php#L91-L109 | train |
Aviogram/Common | src/Hydrator/ByConfigBuilder.php | ByConfigBuilder.isInclude | public function isInclude($fieldName)
{
if ($this->hasField($fieldName) === false) {
return false;
}
$class = __CLASS__;
return ($this->mapping[$fieldName]['include'] instanceof $class);
} | php | public function isInclude($fieldName)
{
if ($this->hasField($fieldName) === false) {
return false;
}
$class = __CLASS__;
return ($this->mapping[$fieldName]['include'] instanceof $class);
} | [
"public",
"function",
"isInclude",
"(",
"$",
"fieldName",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasField",
"(",
"$",
"fieldName",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"$",
"class",
"=",
"__CLASS__",
";",
"return",
"(",
"$",
... | Check if the given fieldName is an include
@param string $fieldName
@return bool TRUE on include | FALSE when field does not exists or field is not a include | [
"Check",
"if",
"the",
"given",
"fieldName",
"is",
"an",
"include"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/Hydrator/ByConfigBuilder.php#L130-L139 | train |
Aviogram/Common | src/Hydrator/ByConfigBuilder.php | ByConfigBuilder.getSetter | public function getSetter($fieldName)
{
if ($this->hasField($fieldName) === false) {
return false;
}
return $this->mapping[$fieldName]['setter'];
} | php | public function getSetter($fieldName)
{
if ($this->hasField($fieldName) === false) {
return false;
}
return $this->mapping[$fieldName]['setter'];
} | [
"public",
"function",
"getSetter",
"(",
"$",
"fieldName",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasField",
"(",
"$",
"fieldName",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"mapping",
"[",
"$",
"fieldN... | Return the setter name
@param string $fieldName
@return string | bool FALSE when field does not exists | [
"Return",
"the",
"setter",
"name"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/Hydrator/ByConfigBuilder.php#L148-L155 | train |
Aviogram/Common | src/Hydrator/ByConfigBuilder.php | ByConfigBuilder.getGetter | public function getGetter($fieldName)
{
if ($this->hasField($fieldName) === false)
{
return false;
}
return $this->mapping[$fieldName]['getter'];
} | php | public function getGetter($fieldName)
{
if ($this->hasField($fieldName) === false)
{
return false;
}
return $this->mapping[$fieldName]['getter'];
} | [
"public",
"function",
"getGetter",
"(",
"$",
"fieldName",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasField",
"(",
"$",
"fieldName",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"mapping",
"[",
"$",
"fieldN... | Return the getter name
@param string $fieldName
@return string | bool FALSE when field does not exists | [
"Return",
"the",
"getter",
"name"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/Hydrator/ByConfigBuilder.php#L164-L171 | train |
Aviogram/Common | src/Hydrator/ByConfigBuilder.php | ByConfigBuilder.getInclude | public function getInclude($fieldName)
{
if ($this->isInclude($fieldName) === false) {
return false;
}
return $this->mapping[$fieldName]['include'];
} | php | public function getInclude($fieldName)
{
if ($this->isInclude($fieldName) === false) {
return false;
}
return $this->mapping[$fieldName]['include'];
} | [
"public",
"function",
"getInclude",
"(",
"$",
"fieldName",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isInclude",
"(",
"$",
"fieldName",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"mapping",
"[",
"$",
"fiel... | Get the include config
@param string $fieldName
@return ByConfigBuilder | bool FALSE when fieldName is not a include | [
"Get",
"the",
"include",
"config"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/Hydrator/ByConfigBuilder.php#L180-L187 | train |
Aviogram/Common | src/Hydrator/ByConfigBuilder.php | ByConfigBuilder.setCatchAllSetter | public function setCatchAllSetter($setMethod)
{
if (method_exists($this->getEntityPrototype(), $setMethod) === false) {
throw new Exception\ConfigFailed(sprintf($this->exceptions[2], $setMethod, $this->entityClassName), 2);
}
$this->catchAllSetter = $setMethod;
... | php | public function setCatchAllSetter($setMethod)
{
if (method_exists($this->getEntityPrototype(), $setMethod) === false) {
throw new Exception\ConfigFailed(sprintf($this->exceptions[2], $setMethod, $this->entityClassName), 2);
}
$this->catchAllSetter = $setMethod;
... | [
"public",
"function",
"setCatchAllSetter",
"(",
"$",
"setMethod",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
"->",
"getEntityPrototype",
"(",
")",
",",
"$",
"setMethod",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"Config... | Sets an catchall Setter
@param string $setMethod
@return $this | [
"Sets",
"an",
"catchall",
"Setter"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/Hydrator/ByConfigBuilder.php#L244-L253 | train |
ScaraMVC/Framework | src/Scara/Session/SessionInitializer.php | SessionInitializer.init | public static function init()
{
$c = new Configuration();
$cc = $c->from('app')->get('session');
if (strtolower($cc) == 'session') {
return new Session();
} elseif (strtolower($cc) == 'file') {
return new File();
} elseif (strtolower($cc) == 'cookie')... | php | public static function init()
{
$c = new Configuration();
$cc = $c->from('app')->get('session');
if (strtolower($cc) == 'session') {
return new Session();
} elseif (strtolower($cc) == 'file') {
return new File();
} elseif (strtolower($cc) == 'cookie')... | [
"public",
"static",
"function",
"init",
"(",
")",
"{",
"$",
"c",
"=",
"new",
"Configuration",
"(",
")",
";",
"$",
"cc",
"=",
"$",
"c",
"->",
"from",
"(",
"'app'",
")",
"->",
"get",
"(",
"'session'",
")",
";",
"if",
"(",
"strtolower",
"(",
"$",
... | Initializes session handler.
@return mixed | [
"Initializes",
"session",
"handler",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Session/SessionInitializer.php#L17-L31 | train |
kambalabs/KmbPuppetDb | src/KmbPuppetDb/Service/Node.php | Node.getByName | public function getByName($name)
{
$response = $this->getPuppetDbClient()->send(new KmbPuppetDb\Request('/nodes/' . $name));
return $this->createNodeFromData($response->getData());
} | php | public function getByName($name)
{
$response = $this->getPuppetDbClient()->send(new KmbPuppetDb\Request('/nodes/' . $name));
return $this->createNodeFromData($response->getData());
} | [
"public",
"function",
"getByName",
"(",
"$",
"name",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getPuppetDbClient",
"(",
")",
"->",
"send",
"(",
"new",
"KmbPuppetDb",
"\\",
"Request",
"(",
"'/nodes/'",
".",
"$",
"name",
")",
")",
";",
"return"... | Retrieves a node by its name.
@param string $name
@return Model\NodeInterface
@throws InvalidArgumentException | [
"Retrieves",
"a",
"node",
"by",
"its",
"name",
"."
] | df56a275cf00f4402cf121a2e99149168f1f8b2d | https://github.com/kambalabs/KmbPuppetDb/blob/df56a275cf00f4402cf121a2e99149168f1f8b2d/src/KmbPuppetDb/Service/Node.php#L59-L63 | train |
romm/configuration_object | Classes/Core/Service/CacheService.php | CacheService.registerInternalCache | public function registerInternalCache()
{
$cacheManager = $this->getCacheManager();
if (false === $cacheManager->hasCache(self::CACHE_IDENTIFIER)) {
$cacheManager->setCacheConfigurations([self::CACHE_IDENTIFIER => $this->cacheOptions]);
}
} | php | public function registerInternalCache()
{
$cacheManager = $this->getCacheManager();
if (false === $cacheManager->hasCache(self::CACHE_IDENTIFIER)) {
$cacheManager->setCacheConfigurations([self::CACHE_IDENTIFIER => $this->cacheOptions]);
}
} | [
"public",
"function",
"registerInternalCache",
"(",
")",
"{",
"$",
"cacheManager",
"=",
"$",
"this",
"->",
"getCacheManager",
"(",
")",
";",
"if",
"(",
"false",
"===",
"$",
"cacheManager",
"->",
"hasCache",
"(",
"self",
"::",
"CACHE_IDENTIFIER",
")",
")",
... | Function called from `ext_localconf` file which will register the
internal cache earlier.
@internal | [
"Function",
"called",
"from",
"ext_localconf",
"file",
"which",
"will",
"register",
"the",
"internal",
"cache",
"earlier",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Core/Service/CacheService.php#L50-L57 | train |
romm/configuration_object | Classes/Core/Service/CacheService.php | CacheService.registerDynamicCaches | public function registerDynamicCaches()
{
$dynamicCaches = $this->getCache()->getByTag(self::CACHE_TAG_DYNAMIC_CACHE);
foreach ($dynamicCaches as $cacheData) {
$identifier = $cacheData['identifier'];
$options = $cacheData['options'];
$this->registerCacheInternal... | php | public function registerDynamicCaches()
{
$dynamicCaches = $this->getCache()->getByTag(self::CACHE_TAG_DYNAMIC_CACHE);
foreach ($dynamicCaches as $cacheData) {
$identifier = $cacheData['identifier'];
$options = $cacheData['options'];
$this->registerCacheInternal... | [
"public",
"function",
"registerDynamicCaches",
"(",
")",
"{",
"$",
"dynamicCaches",
"=",
"$",
"this",
"->",
"getCache",
"(",
")",
"->",
"getByTag",
"(",
"self",
"::",
"CACHE_TAG_DYNAMIC_CACHE",
")",
";",
"foreach",
"(",
"$",
"dynamicCaches",
"as",
"$",
"cach... | This function will take care of initializing all caches that were defined
previously by the `CacheService` which allows dynamic caches to be used
for every configuration object type.
@see \Romm\ConfigurationObject\Service\Items\Cache\CacheService::initialize()
@internal | [
"This",
"function",
"will",
"take",
"care",
"of",
"initializing",
"all",
"caches",
"that",
"were",
"defined",
"previously",
"by",
"the",
"CacheService",
"which",
"allows",
"dynamic",
"caches",
"to",
"be",
"used",
"for",
"every",
"configuration",
"object",
"type"... | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Core/Service/CacheService.php#L67-L77 | train |
Wedeto/HTML | src/AssetManager.php | AssetManager.injectInstance | public static function injectInstance(Resolver $resolver)
{
$sub = $resolver->getResolver('assets');
return $sub !== null ? new static($sub) : null;
} | php | public static function injectInstance(Resolver $resolver)
{
$sub = $resolver->getResolver('assets');
return $sub !== null ? new static($sub) : null;
} | [
"public",
"static",
"function",
"injectInstance",
"(",
"Resolver",
"$",
"resolver",
")",
"{",
"$",
"sub",
"=",
"$",
"resolver",
"->",
"getResolver",
"(",
"'assets'",
")",
";",
"return",
"$",
"sub",
"!==",
"null",
"?",
"new",
"static",
"(",
"$",
"sub",
... | Generate an instance for the injector | [
"Generate",
"an",
"instance",
"for",
"the",
"injector"
] | 9e725288098c42d0d2953a929faebe628ff4e389 | https://github.com/Wedeto/HTML/blob/9e725288098c42d0d2953a929faebe628ff4e389/src/AssetManager.php#L96-L100 | train |
Wedeto/HTML | src/AssetManager.php | AssetManager.addScript | public function addScript(string $script, $depends = null)
{
$script = $this->stripSuffix($script, ".min", ".js");
$this->scripts[$script] = array("path" => $script, "depends" => $depends);
return $this;
} | php | public function addScript(string $script, $depends = null)
{
$script = $this->stripSuffix($script, ".min", ".js");
$this->scripts[$script] = array("path" => $script, "depends" => $depends);
return $this;
} | [
"public",
"function",
"addScript",
"(",
"string",
"$",
"script",
",",
"$",
"depends",
"=",
"null",
")",
"{",
"$",
"script",
"=",
"$",
"this",
"->",
"stripSuffix",
"(",
"$",
"script",
",",
"\".min\"",
",",
"\".js\"",
")",
";",
"$",
"this",
"->",
"scri... | Add a javascript file to be loaded. This will strip the .min and .js suffixes
and add them to the stack of included scripts.
@param string $script The script to be loaded
@return AssetManager Provides fluent interface | [
"Add",
"a",
"javascript",
"file",
"to",
"be",
"loaded",
".",
"This",
"will",
"strip",
"the",
".",
"min",
"and",
".",
"js",
"suffixes",
"and",
"add",
"them",
"to",
"the",
"stack",
"of",
"included",
"scripts",
"."
] | 9e725288098c42d0d2953a929faebe628ff4e389 | https://github.com/Wedeto/HTML/blob/9e725288098c42d0d2953a929faebe628ff4e389/src/AssetManager.php#L167-L172 | train |
Wedeto/HTML | src/AssetManager.php | AssetManager.addCSS | public function addCSS(string $stylesheet, $media = "screen")
{
$stylesheet = $this->stripSuffix($stylesheet, ".min", ".css");
$this->CSS[$stylesheet] = array("path" => $stylesheet, "media" => $media);
return $this;
} | php | public function addCSS(string $stylesheet, $media = "screen")
{
$stylesheet = $this->stripSuffix($stylesheet, ".min", ".css");
$this->CSS[$stylesheet] = array("path" => $stylesheet, "media" => $media);
return $this;
} | [
"public",
"function",
"addCSS",
"(",
"string",
"$",
"stylesheet",
",",
"$",
"media",
"=",
"\"screen\"",
")",
"{",
"$",
"stylesheet",
"=",
"$",
"this",
"->",
"stripSuffix",
"(",
"$",
"stylesheet",
",",
"\".min\"",
",",
"\".css\"",
")",
";",
"$",
"this",
... | Add a CSS stylesheet to be loaded. This will strip the .min and .css suffixes
and add them to the stack of included stylesheets.
@param string $style The style sheet to be loaded
@return AssetManager Provides fluent interface | [
"Add",
"a",
"CSS",
"stylesheet",
"to",
"be",
"loaded",
".",
"This",
"will",
"strip",
"the",
".",
"min",
"and",
".",
"css",
"suffixes",
"and",
"add",
"them",
"to",
"the",
"stack",
"of",
"included",
"stylesheets",
"."
] | 9e725288098c42d0d2953a929faebe628ff4e389 | https://github.com/Wedeto/HTML/blob/9e725288098c42d0d2953a929faebe628ff4e389/src/AssetManager.php#L189-L194 | train |
Wedeto/HTML | src/AssetManager.php | AssetManager.addVariable | public function addVariable(string $name, $value)
{
// Convert value to something usable in the output
if (WF::is_array_like($value))
{
$value = WF::to_array($value);
}
elseif (is_subclass_of($value, JSONSerializable::class))
{
$value = $value-... | php | public function addVariable(string $name, $value)
{
// Convert value to something usable in the output
if (WF::is_array_like($value))
{
$value = WF::to_array($value);
}
elseif (is_subclass_of($value, JSONSerializable::class))
{
$value = $value-... | [
"public",
"function",
"addVariable",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
"{",
"// Convert value to something usable in the output",
"if",
"(",
"WF",
"::",
"is_array_like",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"WF",
"::",
"to_a... | Add a javascript variable to be added to the output document. A script will
be generated to definie these variables on page load.
@param string $name The name of the variable. Must be a valid javascript
variable name.
@param mixed The value to set. Should be scalar, array or JSONSerializable | [
"Add",
"a",
"javascript",
"variable",
"to",
"be",
"added",
"to",
"the",
"output",
"document",
".",
"A",
"script",
"will",
"be",
"generated",
"to",
"definie",
"these",
"variables",
"on",
"page",
"load",
"."
] | 9e725288098c42d0d2953a929faebe628ff4e389 | https://github.com/Wedeto/HTML/blob/9e725288098c42d0d2953a929faebe628ff4e389/src/AssetManager.php#L231-L249 | train |
Wedeto/HTML | src/AssetManager.php | AssetManager.stripSuffix | protected function stripSuffix(string $path, string $suffix1, string $suffix2)
{
if (substr($path, -strlen($suffix2)) === $suffix2)
$path = substr($path, 0, -strlen($suffix2));
if (substr($path, -strlen($suffix1)) === $suffix1)
$path = substr($path, 0, -strlen($suffix1));
... | php | protected function stripSuffix(string $path, string $suffix1, string $suffix2)
{
if (substr($path, -strlen($suffix2)) === $suffix2)
$path = substr($path, 0, -strlen($suffix2));
if (substr($path, -strlen($suffix1)) === $suffix1)
$path = substr($path, 0, -strlen($suffix1));
... | [
"protected",
"function",
"stripSuffix",
"(",
"string",
"$",
"path",
",",
"string",
"$",
"suffix1",
",",
"string",
"$",
"suffix2",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"path",
",",
"-",
"strlen",
"(",
"$",
"suffix2",
")",
")",
"===",
"$",
"suffix2... | Remove the suffix from a file name, such as .min.css or .min.js
@param string $path The file to strip
@param string $suffix1 One suffix to strip. This one is stripped after
the second, so it should come second-last.
This probably should be .min
@param string $suffix2 Another suffix to strip. This one is stripped
from t... | [
"Remove",
"the",
"suffix",
"from",
"a",
"file",
"name",
"such",
"as",
".",
"min",
".",
"css",
"or",
".",
"min",
".",
"js"
] | 9e725288098c42d0d2953a929faebe628ff4e389 | https://github.com/Wedeto/HTML/blob/9e725288098c42d0d2953a929faebe628ff4e389/src/AssetManager.php#L270-L277 | train |
Wedeto/HTML | src/AssetManager.php | AssetManager.executeHook | public function executeHook(Dictionary $params)
{
$responder = $params['responder'] ?? null;
$mime = $params['mime'] ?? null;
$result = empty($responder) ? null : $responder->getResult();
$response = empty($result) ? null : $result->getResponse();
if ($response instanceof H... | php | public function executeHook(Dictionary $params)
{
$responder = $params['responder'] ?? null;
$mime = $params['mime'] ?? null;
$result = empty($responder) ? null : $responder->getResult();
$response = empty($result) ? null : $result->getResponse();
if ($response instanceof H... | [
"public",
"function",
"executeHook",
"(",
"Dictionary",
"$",
"params",
")",
"{",
"$",
"responder",
"=",
"$",
"params",
"[",
"'responder'",
"]",
"??",
"null",
";",
"$",
"mime",
"=",
"$",
"params",
"[",
"'mime'",
"]",
"??",
"null",
";",
"$",
"result",
... | Execute the hook to replace the Javascript and CSS tokens in the HTTP Responder. This will
be called by Wedeto\Util\Hook through Wedeto\HTTP. It can be called directly
when you want to replace the content at a different time.
@param Dictionary $params The parameters. Should contain a key 'response' and 'mime'. The res | [
"Execute",
"the",
"hook",
"to",
"replace",
"the",
"Javascript",
"and",
"CSS",
"tokens",
"in",
"the",
"HTTP",
"Responder",
".",
"This",
"will",
"be",
"called",
"by",
"Wedeto",
"\\",
"Util",
"\\",
"Hook",
"through",
"Wedeto",
"\\",
"HTTP",
".",
"It",
"can"... | 9e725288098c42d0d2953a929faebe628ff4e389 | https://github.com/Wedeto/HTML/blob/9e725288098c42d0d2953a929faebe628ff4e389/src/AssetManager.php#L529-L546 | train |
Ydle/HubBundle | Controller/RestRoomController.php | RestRoomController.getRoomsListAction | public function getRoomsListAction(ParamFetcher $paramFetcher)
{
$page = $paramFetcher->get('page');
$count = $paramFetcher->get('count');
$pager = $this->getRoomManager()->getPager($this->filterCriteria($paramFetcher), $page, $count);
return $pager;
} | php | public function getRoomsListAction(ParamFetcher $paramFetcher)
{
$page = $paramFetcher->get('page');
$count = $paramFetcher->get('count');
$pager = $this->getRoomManager()->getPager($this->filterCriteria($paramFetcher), $page, $count);
return $pager;
} | [
"public",
"function",
"getRoomsListAction",
"(",
"ParamFetcher",
"$",
"paramFetcher",
")",
"{",
"$",
"page",
"=",
"$",
"paramFetcher",
"->",
"get",
"(",
"'page'",
")",
";",
"$",
"count",
"=",
"$",
"paramFetcher",
"->",
"get",
"(",
"'count'",
")",
";",
"$... | Retrieve the list of available rooms
@QueryParam(name="page", requirements="\d+", default="0", description="Number of page")
@QueryParam(name="count", requirements="\d+", default="0", description="Number of room by page")
@param ParamFetcher $paramFetcher | [
"Retrieve",
"the",
"list",
"of",
"available",
"rooms"
] | 7fa423241246bcfd115f2ed3ad3997b4b63adb01 | https://github.com/Ydle/HubBundle/blob/7fa423241246bcfd115f2ed3ad3997b4b63adb01/Controller/RestRoomController.php#L38-L46 | train |
hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.query | public function query($statement, $params=array())
{
if (!is_array($params)) {
$params = array($params);
}
return $this->_link->query($statement, $params);
} | php | public function query($statement, $params=array())
{
if (!is_array($params)) {
$params = array($params);
}
return $this->_link->query($statement, $params);
} | [
"public",
"function",
"query",
"(",
"$",
"statement",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"params",
")",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"$",
"params",
")",
";",
"}",
"return",
... | Run database query and return complete result set
This method is intended to be used internally by NADA. Application code
should preferrably use methods from the underlying database abstraction
layer.
This method is intended for SELECT and similar commands that return a
result set. The result is returned as a 2-dimen... | [
"Run",
"database",
"query",
"and",
"return",
"complete",
"result",
"set"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L196-L202 | train |
hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.exec | public function exec($statement, $params=array())
{
if (!is_array($params)) {
$params = array($params);
}
return $this->_link->exec($statement, $params);
} | php | public function exec($statement, $params=array())
{
if (!is_array($params)) {
$params = array($params);
}
return $this->_link->exec($statement, $params);
} | [
"public",
"function",
"exec",
"(",
"$",
"statement",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"params",
")",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"$",
"params",
")",
";",
"}",
"return",
... | Execute a database statement that does not return a result set
This method is intended to be used internally by NADA. Application code
should preferrably use methods from the underlying database abstraction
layer.
SQL commands like UPDATE, INSERT, DELETE, SET etc. don't return a result
set. This method is intended fo... | [
"Execute",
"a",
"database",
"statement",
"that",
"does",
"not",
"return",
"a",
"result",
"set"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L220-L226 | train |
hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.prepareValue | public function prepareValue($value, $datatype)
{
if ($value === null) {
return 'NULL';
}
switch ($datatype) {
case Column::TYPE_INTEGER:
// Filter explicitly because some DBAL silently convert/truncate to integer
$filtered = filter_va... | php | public function prepareValue($value, $datatype)
{
if ($value === null) {
return 'NULL';
}
switch ($datatype) {
case Column::TYPE_INTEGER:
// Filter explicitly because some DBAL silently convert/truncate to integer
$filtered = filter_va... | [
"public",
"function",
"prepareValue",
"(",
"$",
"value",
",",
"$",
"datatype",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"'NULL'",
";",
"}",
"switch",
"(",
"$",
"datatype",
")",
"{",
"case",
"Column",
"::",
"TYPE_INTEGER",
... | Prepare a literal value for insertion into an SQL statement
@param mixed $value Value to prepare
@param string $datatype The value's datatype
@return string Value, processed, quoted and escaped if necessary | [
"Prepare",
"a",
"literal",
"value",
"for",
"insertion",
"into",
"an",
"SQL",
"statement"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L464-L501 | train |
hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.getName | public function getName()
{
if (!$this->_name) {
$result = $this->query(
'select catalog_name from information_schema.information_schema_catalog_name'
);
$this->_name = $result[0]['catalog_name'];
}
return $this->_name;
} | php | public function getName()
{
if (!$this->_name) {
$result = $this->query(
'select catalog_name from information_schema.information_schema_catalog_name'
);
$this->_name = $result[0]['catalog_name'];
}
return $this->_name;
} | [
"public",
"function",
"getName",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_name",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"query",
"(",
"'select catalog_name from information_schema.information_schema_catalog_name'",
")",
";",
"$",
"this",
"... | Return name of the database that the current connection points to
@return string Database name | [
"Return",
"name",
"of",
"the",
"database",
"that",
"the",
"current",
"connection",
"points",
"to"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L535-L544 | train |
hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.getTable | public function getTable($name)
{
if ($name != strtolower($name)) {
throw new \DomainException('Table name must be lowercase: ' . $name);
}
if (!isset($this->_tables[$name])) {
$class = 'Nada\Table\\' . $this->getDbmsSuffix();
$this->_tables[$name] = new ... | php | public function getTable($name)
{
if ($name != strtolower($name)) {
throw new \DomainException('Table name must be lowercase: ' . $name);
}
if (!isset($this->_tables[$name])) {
$class = 'Nada\Table\\' . $this->getDbmsSuffix();
$this->_tables[$name] = new ... | [
"public",
"function",
"getTable",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"name",
"!=",
"strtolower",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"DomainException",
"(",
"'Table name must be lowercase: '",
".",
"$",
"name",
")",
";",
"}",
... | Get access to a specific table
The returned object provides access to the given table and its associated
database objects (columns etc.). The result is cached internally, so that
subsequent calls won't hurt performance.
@param string $name Table name (lowercase). An exception gets thrown if the name does not exist.
@r... | [
"Get",
"access",
"to",
"a",
"specific",
"table"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L556-L567 | train |
hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.getTables | public function getTables()
{
if (!$this->_allTablesFetched) { // Fetch only once
$tables = $this->getTableNames();
// Fetch missing tables
foreach ($tables as $table) {
$this->getTable($table); // Discard result, still available in cache
}
... | php | public function getTables()
{
if (!$this->_allTablesFetched) { // Fetch only once
$tables = $this->getTableNames();
// Fetch missing tables
foreach ($tables as $table) {
$this->getTable($table); // Discard result, still available in cache
}
... | [
"public",
"function",
"getTables",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_allTablesFetched",
")",
"{",
"// Fetch only once",
"$",
"tables",
"=",
"$",
"this",
"->",
"getTableNames",
"(",
")",
";",
"// Fetch missing tables",
"foreach",
"(",
"$",
... | Return all tables
The result is cached internally, so that subsequent calls won't hurt performance.
@return array Array with table names as keys and \Nada\Table\AbstractTable objects as values | [
"Return",
"all",
"tables"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L576-L590 | train |
hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.getViewNames | public function getViewNames()
{
$names = $this->query(
'SELECT table_name FROM information_schema.tables WHERE table_schema=? AND table_type=?',
array(
$this->getTableSchema(),
'VIEW'
)
);
// Flatten array
foreach (... | php | public function getViewNames()
{
$names = $this->query(
'SELECT table_name FROM information_schema.tables WHERE table_schema=? AND table_type=?',
array(
$this->getTableSchema(),
'VIEW'
)
);
// Flatten array
foreach (... | [
"public",
"function",
"getViewNames",
"(",
")",
"{",
"$",
"names",
"=",
"$",
"this",
"->",
"query",
"(",
"'SELECT table_name FROM information_schema.tables WHERE table_schema=? AND table_type=?'",
",",
"array",
"(",
"$",
"this",
"->",
"getTableSchema",
"(",
")",
",",
... | Return list of all view names
The default implementation queries information_schema. This can be
overridden where information_schema is not available.
@return array | [
"Return",
"list",
"of",
"all",
"view",
"names"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L624-L638 | train |
hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.getNativeDatatype | public function getNativeDatatype($type, $length=null, $cast=false)
{
switch ($type) {
case Column::TYPE_INTEGER:
if ($length === null) {
$length = Column::DEFAULT_LENGTH_INTEGER;
}
switch ($length) {
case 16... | php | public function getNativeDatatype($type, $length=null, $cast=false)
{
switch ($type) {
case Column::TYPE_INTEGER:
if ($length === null) {
$length = Column::DEFAULT_LENGTH_INTEGER;
}
switch ($length) {
case 16... | [
"public",
"function",
"getNativeDatatype",
"(",
"$",
"type",
",",
"$",
"length",
"=",
"null",
",",
"$",
"cast",
"=",
"false",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"Column",
"::",
"TYPE_INTEGER",
":",
"if",
"(",
"$",
"length",
"==="... | Get DBMS-specific datatype for abstract NADA datatype
@param string $type One of \Nada\Column\AbstractColumn's TYPE_* constants
@param mixed $length Optional length modifier (default provided for some datatypes)
@param bool $cast The result is used for a typecast operation. Some DBMS require different specifiers for ca... | [
"Get",
"DBMS",
"-",
"specific",
"datatype",
"for",
"abstract",
"NADA",
"datatype"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L681-L731 | train |
hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.createColumn | public function createColumn(
$name,
$type,
$length=null,
$notnull=false,
$default=null,
$autoIncrement=false,
$comment=null
)
{
$column = $this->createColumnObject();
$column->constructNew($this, $name, $type, $length, $notnull, $default, ... | php | public function createColumn(
$name,
$type,
$length=null,
$notnull=false,
$default=null,
$autoIncrement=false,
$comment=null
)
{
$column = $this->createColumnObject();
$column->constructNew($this, $name, $type, $length, $notnull, $default, ... | [
"public",
"function",
"createColumn",
"(",
"$",
"name",
",",
"$",
"type",
",",
"$",
"length",
"=",
"null",
",",
"$",
"notnull",
"=",
"false",
",",
"$",
"default",
"=",
"null",
",",
"$",
"autoIncrement",
"=",
"false",
",",
"$",
"comment",
"=",
"null",... | Construct a new column
Input is not validated at this point, i.e. this method always succeeds.
Invalid input is detected once the column data is actually used.
The returned object is not linked to a table. It should only be used for
adding it to a table. It can be discarded afterwards.
@param string $name Column name... | [
"Construct",
"a",
"new",
"column"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L761-L774 | train |
hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.createColumnFromArray | public function createColumnFromArray(array $data)
{
return $this->createColumn(
$data['name'],
$data['type'],
$data['length'],
!empty($data['notnull']),
@$data['default'],
!empty($data['autoincrement']),
@$data['comment']
... | php | public function createColumnFromArray(array $data)
{
return $this->createColumn(
$data['name'],
$data['type'],
$data['length'],
!empty($data['notnull']),
@$data['default'],
!empty($data['autoincrement']),
@$data['comment']
... | [
"public",
"function",
"createColumnFromArray",
"(",
"array",
"$",
"data",
")",
"{",
"return",
"$",
"this",
"->",
"createColumn",
"(",
"$",
"data",
"[",
"'name'",
"]",
",",
"$",
"data",
"[",
"'type'",
"]",
",",
"$",
"data",
"[",
"'length'",
"]",
",",
... | Construct a new column with data from an array
This is a wrapper around createColumn() which gets column data from an
associative array.
The "name", "type" and "length" elements must always be present. The
"notnull" and "autoincrement" elements default to FALSE if not given. The
"default" and "comment" elements defau... | [
"Construct",
"a",
"new",
"column",
"with",
"data",
"from",
"an",
"array"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L789-L800 | train |
hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.createTable | public function createTable($name, array $columns, $primaryKey=null)
{
$name = strtolower($name);
if (strpos($name, 'sqlite_') === 0) {
throw new \InvalidArgumentException('Created table name must not begin with sqlite_');
}
if (empty($columns)) {
throw new \I... | php | public function createTable($name, array $columns, $primaryKey=null)
{
$name = strtolower($name);
if (strpos($name, 'sqlite_') === 0) {
throw new \InvalidArgumentException('Created table name must not begin with sqlite_');
}
if (empty($columns)) {
throw new \I... | [
"public",
"function",
"createTable",
"(",
"$",
"name",
",",
"array",
"$",
"columns",
",",
"$",
"primaryKey",
"=",
"null",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"name",
",",
"'sqlite_'",
... | Create a table
Some constraints are checked before the creation is attempted:
- There can be at most 1 autoincrement column.
- If there is an autoincrement column, it must be the primary key.
- Otherwise, $primaryKey must not be empty.
- Table names must not begin with sqlite_. For maximum compatibility,
this constra... | [
"Create",
"a",
"table"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L824-L879 | train |
hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase._getTablePkDeclaration | protected function _getTablePkDeclaration(array $primaryKey, $autoIncrement)
{
foreach ($primaryKey as &$column) {
$column = $this->prepareIdentifier($column);
}
return ",\nPRIMARY KEY (" . implode(', ', $primaryKey) . ')';
} | php | protected function _getTablePkDeclaration(array $primaryKey, $autoIncrement)
{
foreach ($primaryKey as &$column) {
$column = $this->prepareIdentifier($column);
}
return ",\nPRIMARY KEY (" . implode(', ', $primaryKey) . ')';
} | [
"protected",
"function",
"_getTablePkDeclaration",
"(",
"array",
"$",
"primaryKey",
",",
"$",
"autoIncrement",
")",
"{",
"foreach",
"(",
"$",
"primaryKey",
"as",
"&",
"$",
"column",
")",
"{",
"$",
"column",
"=",
"$",
"this",
"->",
"prepareIdentifier",
"(",
... | Get the declaration for a table's primary key
This is called by createTable() to get the PRIMARY KEY declaration to be
inserted into a CREATE TABLE statement. The default implementation
unconditionally returns ", PRIMARY KEY ($column[,$column...])". Other
implementations may override this, depending on $autoIncrement.... | [
"Get",
"the",
"declaration",
"for",
"a",
"table",
"s",
"primary",
"key"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L893-L899 | train |
geoffadams/bedrest-core | library/BedRest/Mapping/Driver/AbstractAnnotationDriver.php | AbstractAnnotationDriver.indexAnnotationsByType | protected function indexAnnotationsByType(array $annotations)
{
$indexed = array();
// if we are receiving annotations indexed by number, transform it to by class name
if ($annotations && is_numeric(key($annotations))) {
foreach ($annotations as $annotation) {
$a... | php | protected function indexAnnotationsByType(array $annotations)
{
$indexed = array();
// if we are receiving annotations indexed by number, transform it to by class name
if ($annotations && is_numeric(key($annotations))) {
foreach ($annotations as $annotation) {
$a... | [
"protected",
"function",
"indexAnnotationsByType",
"(",
"array",
"$",
"annotations",
")",
"{",
"$",
"indexed",
"=",
"array",
"(",
")",
";",
"// if we are receiving annotations indexed by number, transform it to by class name",
"if",
"(",
"$",
"annotations",
"&&",
"is_nume... | Indexes a numerically-indexed array of annotation instances by their class names.
@param array $annotations
@return array | [
"Indexes",
"a",
"numerically",
"-",
"indexed",
"array",
"of",
"annotation",
"instances",
"by",
"their",
"class",
"names",
"."
] | a77bf8b7492dfbfb720b201f7ec91a4f03417b5c | https://github.com/geoffadams/bedrest-core/blob/a77bf8b7492dfbfb720b201f7ec91a4f03417b5c/library/BedRest/Mapping/Driver/AbstractAnnotationDriver.php#L56-L76 | train |
johnkrovitch/Sam | Filter/FilterBuilder.php | FilterBuilder.build | public function build(array $filterConfigurations)
{
$resolver = new OptionsResolver();
$filters = [];
foreach ($filterConfigurations as $filterName => $filterConfiguration) {
$resolver->clear();
if ($filterConfiguration === null) {
$filterConfigurat... | php | public function build(array $filterConfigurations)
{
$resolver = new OptionsResolver();
$filters = [];
foreach ($filterConfigurations as $filterName => $filterConfiguration) {
$resolver->clear();
if ($filterConfiguration === null) {
$filterConfigurat... | [
"public",
"function",
"build",
"(",
"array",
"$",
"filterConfigurations",
")",
"{",
"$",
"resolver",
"=",
"new",
"OptionsResolver",
"(",
")",
";",
"$",
"filters",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"filterConfigurations",
"as",
"$",
"filterName",
"=>... | Build the filter with the given configuration.
@param array $filterConfigurations
@return FilterInterface[]
@throws Exception | [
"Build",
"the",
"filter",
"with",
"the",
"given",
"configuration",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Filter/FilterBuilder.php#L54-L86 | train |
johnkrovitch/Sam | Filter/FilterBuilder.php | FilterBuilder.getFilterConfiguration | protected function getFilterConfiguration($filter)
{
if (!array_key_exists($filter, $this->mapping)) {
throw new Exception($filter.' filter not found in assets mapping. Check your configuration');
}
$class = $this->mapping[$filter].'Configuration';
if (!class_exists($cla... | php | protected function getFilterConfiguration($filter)
{
if (!array_key_exists($filter, $this->mapping)) {
throw new Exception($filter.' filter not found in assets mapping. Check your configuration');
}
$class = $this->mapping[$filter].'Configuration';
if (!class_exists($cla... | [
"protected",
"function",
"getFilterConfiguration",
"(",
"$",
"filter",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"filter",
",",
"$",
"this",
"->",
"mapping",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"$",
"filter",
".",
"' filter not f... | Return filter configuration instance using the configured mapping.
@param $filter
@return ConfigurationInterface
@throws Exception | [
"Return",
"filter",
"configuration",
"instance",
"using",
"the",
"configured",
"mapping",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Filter/FilterBuilder.php#L95-L112 | train |
codeinchq/psr7-responses | src/JsonResponse.php | JsonResponse.getDecodedJson | public function getDecodedJson():array
{
if (!($array = json_decode($this->json, true))) {
throw new \RuntimeException("Unable to decode the response's JSON");
}
return json_decode($this->json, true);
} | php | public function getDecodedJson():array
{
if (!($array = json_decode($this->json, true))) {
throw new \RuntimeException("Unable to decode the response's JSON");
}
return json_decode($this->json, true);
} | [
"public",
"function",
"getDecodedJson",
"(",
")",
":",
"array",
"{",
"if",
"(",
"!",
"(",
"$",
"array",
"=",
"json_decode",
"(",
"$",
"this",
"->",
"json",
",",
"true",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"Unable to dec... | Returns the decoded JSON string.
@uses json_decode()
@return array | [
"Returns",
"the",
"decoded",
"JSON",
"string",
"."
] | d4bb6bc9b4219694e7c1f5ee9b40b75b22362fce | https://github.com/codeinchq/psr7-responses/blob/d4bb6bc9b4219694e7c1f5ee9b40b75b22362fce/src/JsonResponse.php#L113-L119 | train |
DreadLabs/VantomasWebsite | src/ThreatDefense/ReCaptchaResponse.php | ReCaptchaResponse.fromString | public static function fromString($string)
{
if (is_null($string) || empty($string) || !is_string($string)) {
throw new \InvalidArgumentException('The given ReCaptcha response data is invalid.', 1452283305);
}
$value = (string) $string;
$value = filter_var(
... | php | public static function fromString($string)
{
if (is_null($string) || empty($string) || !is_string($string)) {
throw new \InvalidArgumentException('The given ReCaptcha response data is invalid.', 1452283305);
}
$value = (string) $string;
$value = filter_var(
... | [
"public",
"static",
"function",
"fromString",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"string",
")",
"||",
"empty",
"(",
"$",
"string",
")",
"||",
"!",
"is_string",
"(",
"$",
"string",
")",
")",
"{",
"throw",
"new",
"\\",
"Inv... | Creates the ReCaptchaResponse data object
@param string $string The value
@return self
@throws \InvalidArgumentException | [
"Creates",
"the",
"ReCaptchaResponse",
"data",
"object"
] | 7f85f2b45bdf5ed9fa9d320c805c416bf99cd668 | https://github.com/DreadLabs/VantomasWebsite/blob/7f85f2b45bdf5ed9fa9d320c805c416bf99cd668/src/ThreatDefense/ReCaptchaResponse.php#L48-L69 | train |
buflix/SimpleCollection | src/SimpleCollection/Entity/AbstractEntity.php | AbstractEntity.toArray | public function toArray()
{
$aReturn = array();
foreach (get_object_vars($this) as $sKey => $mValue) {
if (is_object($mValue) and true === method_exists($mValue, 'toArray')) {
$aReturn[$sKey] = $mValue->toArray();
} else {
$aReturn[$sKey] = $m... | php | public function toArray()
{
$aReturn = array();
foreach (get_object_vars($this) as $sKey => $mValue) {
if (is_object($mValue) and true === method_exists($mValue, 'toArray')) {
$aReturn[$sKey] = $mValue->toArray();
} else {
$aReturn[$sKey] = $m... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"aReturn",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"get_object_vars",
"(",
"$",
"this",
")",
"as",
"$",
"sKey",
"=>",
"$",
"mValue",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"mValue",
")"... | return this entity as array
@see EntityInterface::toArray
@return array | [
"return",
"this",
"entity",
"as",
"array"
] | 405504d8be6415a872a5a49ce8223c22a932831a | https://github.com/buflix/SimpleCollection/blob/405504d8be6415a872a5a49ce8223c22a932831a/src/SimpleCollection/Entity/AbstractEntity.php#L19-L32 | train |
Vectrex/vxPHP | src/Form/FormElement/FormElementFactory.php | FormElementFactory.create | public static function create($type, $name, $value = null, array $attributes = [], array $options = [], $required = false, array $modifiers = [], array $validators = [], $validationErrorMessage = null) {
$type = strtolower($type);
if(is_array($value) && $type !== 'multipleselect') {
$elem = self::createSingleE... | php | public static function create($type, $name, $value = null, array $attributes = [], array $options = [], $required = false, array $modifiers = [], array $validators = [], $validationErrorMessage = null) {
$type = strtolower($type);
if(is_array($value) && $type !== 'multipleselect') {
$elem = self::createSingleE... | [
"public",
"static",
"function",
"create",
"(",
"$",
"type",
",",
"$",
"name",
",",
"$",
"value",
"=",
"null",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"required",
"=",
"false",
",",
"a... | create either single FormElement or array of FormElements
@param string $type , type of element
@param string $name , name of element
@param mixed $value
@param array $attributes
@param array $options , array for initializing SelectOptionElements or RadioOptionElements
@param boolean $required
@param array $modifiers
... | [
"create",
"either",
"single",
"FormElement",
"or",
"array",
"of",
"FormElements"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/FormElement/FormElementFactory.php#L47-L72 | train |
Vectrex/vxPHP | src/Form/FormElement/FormElementFactory.php | FormElementFactory.createSingleElement | private static function createSingleElement($type, $name, $value, $attributes, $options, $required, $modifiers, $validators, $validationErrorMessage) {
switch($type) {
case 'input':
$elem = new InputElement($name);
break;
case 'file':
$elem = new FileInputElement($name);
... | php | private static function createSingleElement($type, $name, $value, $attributes, $options, $required, $modifiers, $validators, $validationErrorMessage) {
switch($type) {
case 'input':
$elem = new InputElement($name);
break;
case 'file':
$elem = new FileInputElement($name);
... | [
"private",
"static",
"function",
"createSingleElement",
"(",
"$",
"type",
",",
"$",
"name",
",",
"$",
"value",
",",
"$",
"attributes",
",",
"$",
"options",
",",
"$",
"required",
",",
"$",
"modifiers",
",",
"$",
"validators",
",",
"$",
"validationErrorMessa... | generate a single form element
@param $type
@param $name
@param $value
@param $attributes
@param $options
@param $required
@param $modifiers
@param $validators
@param $validationErrorMessage
@return ButtonElement|CheckboxElement|ImageElement|InputElement|PasswordInputElement|SubmitInputElement|TextareaElement
@throws... | [
"generate",
"a",
"single",
"form",
"element"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/FormElement/FormElementFactory.php#L90-L164 | train |
anime-db/shikimori-related-items-widget-bundle | src/Controller/WidgetController.php | WidgetController.filter | protected function filter(array $list)
{
$tmp = [];
foreach ($list as $item) {
if ($item['anime']) {
$tmp[] = $item;
}
}
return $tmp;
} | php | protected function filter(array $list)
{
$tmp = [];
foreach ($list as $item) {
if ($item['anime']) {
$tmp[] = $item;
}
}
return $tmp;
} | [
"protected",
"function",
"filter",
"(",
"array",
"$",
"list",
")",
"{",
"$",
"tmp",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"list",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"item",
"[",
"'anime'",
"]",
")",
"{",
"$",
"tmp",
"[",
"]",
"="... | Filter a list items
@param array $list
@return array | [
"Filter",
"a",
"list",
"items"
] | ee77d08513efe0f099790ef899ba6080a11abdb3 | https://github.com/anime-db/shikimori-related-items-widget-bundle/blob/ee77d08513efe0f099790ef899ba6080a11abdb3/src/Controller/WidgetController.php#L94-L103 | train |
fardus/CRUDBundle | Fardus/Bundle/CrudBundle/Controller/ApiController.php | ApiController.deleteAction | public function deleteAction($entity, $id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($entity)->find($id);
if (!$entity) {
throw $this->createNotFoundException("Unable to find $entity entity.");
}
$em->remove($entity);
$em->... | php | public function deleteAction($entity, $id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($entity)->find($id);
if (!$entity) {
throw $this->createNotFoundException("Unable to find $entity entity.");
}
$em->remove($entity);
$em->... | [
"public",
"function",
"deleteAction",
"(",
"$",
"entity",
",",
"$",
"id",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"entity",
"=",
"$",
"em",
"->",
"getRepository",
"(",
"$",
"enti... | Delete any entity.
@param string $entity
@param int $id
@return Response
@throws NotFoundHttpException | [
"Delete",
"any",
"entity",
"."
] | 5d4180f2a1f30da0fc4cbb16a70f656e9e083c5c | https://github.com/fardus/CRUDBundle/blob/5d4180f2a1f30da0fc4cbb16a70f656e9e083c5c/Fardus/Bundle/CrudBundle/Controller/ApiController.php#L24-L46 | train |
bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.FromFloat | public static function FromFloat( $value, $detail = true )
{
if ( $value instanceof XPath2Item )
{
$value = $value->getTypedValue();
}
if ( $value instanceof DecimalValue ) return $value;
if ( ( ! is_numeric( $value ) ) || is_infinite( $value ) || is_nan( $value ) )
{
throw XPath2Exception... | php | public static function FromFloat( $value, $detail = true )
{
if ( $value instanceof XPath2Item )
{
$value = $value->getTypedValue();
}
if ( $value instanceof DecimalValue ) return $value;
if ( ( ! is_numeric( $value ) ) || is_infinite( $value ) || is_nan( $value ) )
{
throw XPath2Exception... | [
"public",
"static",
"function",
"FromFloat",
"(",
"$",
"value",
",",
"$",
"detail",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"XPath2Item",
")",
"{",
"$",
"value",
"=",
"$",
"value",
"->",
"getTypedValue",
"(",
")",
";",
"}",
"if"... | Creates an instance from a Float value
@param float $value
@param bool $detail (optional: default = true) Expand the number to the most digits | [
"Creates",
"an",
"instance",
"from",
"a",
"Float",
"value"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L159-L199 | train |
bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.Compare | public function Compare( $number, $scale = false )
{
if ( ! is_numeric( $number ) )
{
if ( ! $number instanceof DecimalValue && ! $number instanceof Integer )
{
return false;
}
$number = $number->getValue();
}
if ( $scale === false )
{
$scale = max( $this->getScale(), $this... | php | public function Compare( $number, $scale = false )
{
if ( ! is_numeric( $number ) )
{
if ( ! $number instanceof DecimalValue && ! $number instanceof Integer )
{
return false;
}
$number = $number->getValue();
}
if ( $scale === false )
{
$scale = max( $this->getScale(), $this... | [
"public",
"function",
"Compare",
"(",
"$",
"number",
",",
"$",
"scale",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"number",
")",
")",
"{",
"if",
"(",
"!",
"$",
"number",
"instanceof",
"DecimalValue",
"&&",
"!",
"$",
"number",
... | Compares this number with another number
@param string $number
@param int $scale
@return int 0 if the number is the same as this number, 1 if this number is larger than the supplied number, -1 otherwise. | [
"Compares",
"this",
"number",
"with",
"another",
"number"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L253-L271 | train |
bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.normalize | private function normalize( $number = null )
{
if ( is_null( $number ) ) $number =& $this->_value;
// Handle the case of -0
if ( $this->_value == "-0" ) $this->_value = "0";
if ( strpos( $this->_value, '.' ) === false ) return;
$number = trim( $number );
$number = rtrim( $number, '0');
$num... | php | private function normalize( $number = null )
{
if ( is_null( $number ) ) $number =& $this->_value;
// Handle the case of -0
if ( $this->_value == "-0" ) $this->_value = "0";
if ( strpos( $this->_value, '.' ) === false ) return;
$number = trim( $number );
$number = rtrim( $number, '0');
$num... | [
"private",
"function",
"normalize",
"(",
"$",
"number",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"number",
")",
")",
"$",
"number",
"=",
"&",
"$",
"this",
"->",
"_value",
";",
"// Handle the case of -0\r",
"if",
"(",
"$",
"this",
"->",
... | Remove spaces and any trailing zeros
@param string $number
@return string | [
"Remove",
"spaces",
"and",
"any",
"trailing",
"zeros"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L446-L466 | train |
bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.getIsDecimal | public function getIsDecimal( $number = false )
{
return strpos( $number === false ? $this->_value : $number, "." ) !== false &&
trim( substr( $number === false ? $this->_value : $number, strpos( $number === false ? $this->_value : $number, "." ) + 1 ), "0" );
} | php | public function getIsDecimal( $number = false )
{
return strpos( $number === false ? $this->_value : $number, "." ) !== false &&
trim( substr( $number === false ? $this->_value : $number, strpos( $number === false ? $this->_value : $number, "." ) + 1 ), "0" );
} | [
"public",
"function",
"getIsDecimal",
"(",
"$",
"number",
"=",
"false",
")",
"{",
"return",
"strpos",
"(",
"$",
"number",
"===",
"false",
"?",
"$",
"this",
"->",
"_value",
":",
"$",
"number",
",",
"\".\"",
")",
"!==",
"false",
"&&",
"trim",
"(",
"sub... | True if the number has a fractional part and it is not zero
@param double $number
@return bool | [
"True",
"if",
"the",
"number",
"has",
"a",
"fractional",
"part",
"and",
"it",
"is",
"not",
"zero"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L482-L486 | train |
bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.getCeil | public function getCeil()
{
if ( $this->getIsDecimal() === false )
{
return $this;
}
if ( $this->getIsNegative() === true )
{
return new DecimalValue( bcadd( $this->_value, '0', 0 ) );
}
return new DecimalValue( bcadd( $this->_value, '1', 0 ) ); // Add one and truncate
} | php | public function getCeil()
{
if ( $this->getIsDecimal() === false )
{
return $this;
}
if ( $this->getIsNegative() === true )
{
return new DecimalValue( bcadd( $this->_value, '0', 0 ) );
}
return new DecimalValue( bcadd( $this->_value, '1', 0 ) ); // Add one and truncate
} | [
"public",
"function",
"getCeil",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getIsDecimal",
"(",
")",
"===",
"false",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getIsNegative",
"(",
")",
"===",
"true",
")",
"{",
"... | Get the ceiling value of the decimal number
@return DecimalValue | [
"Get",
"the",
"ceiling",
"value",
"of",
"the",
"decimal",
"number"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L501-L514 | train |
bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.getFloor | public function getFloor( $scale = false )
{
if ( $this->getIsDecimal() === false )
{
return $this;
}
if ( $this->getIsNegative() === true )
{
return new DecimalValue( bcadd( $this->_value, '-1', 0 ) ); // Subtract 1 and truncate
}
return new DecimalValue( bcadd( $this->_value, '0', 0... | php | public function getFloor( $scale = false )
{
if ( $this->getIsDecimal() === false )
{
return $this;
}
if ( $this->getIsNegative() === true )
{
return new DecimalValue( bcadd( $this->_value, '-1', 0 ) ); // Subtract 1 and truncate
}
return new DecimalValue( bcadd( $this->_value, '0', 0... | [
"public",
"function",
"getFloor",
"(",
"$",
"scale",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getIsDecimal",
"(",
")",
"===",
"false",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getIsNegative",
"(",
")",... | Get the number that is one
@param int $scale
@return DecimalValue | [
"Get",
"the",
"number",
"that",
"is",
"one"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L521-L534 | train |
bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.roundDigit | private function roundDigit( $scale, $mode = PHP_ROUND_HALF_UP )
{
if ( $this->getIsCloserToNext( $scale, $mode ) )
{
return bcadd( $this->_value, $this->getIsNegative() ? -1 : 1, 0 );
}
return bcadd( $this->_value, '0', 0 );
} | php | private function roundDigit( $scale, $mode = PHP_ROUND_HALF_UP )
{
if ( $this->getIsCloserToNext( $scale, $mode ) )
{
return bcadd( $this->_value, $this->getIsNegative() ? -1 : 1, 0 );
}
return bcadd( $this->_value, '0', 0 );
} | [
"private",
"function",
"roundDigit",
"(",
"$",
"scale",
",",
"$",
"mode",
"=",
"PHP_ROUND_HALF_UP",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getIsCloserToNext",
"(",
"$",
"scale",
",",
"$",
"mode",
")",
")",
"{",
"return",
"bcadd",
"(",
"$",
"this",
... | Round the value to the required precision and using the required mode
@param $scale The scale to use for rounding. The digit at this position will
be rounded in the decimal part of the number will be rounded.
@param int $mode PHP_ROUND_HALF_UP (default), PHP_ROUND_HALF_DOWN, PHP_ROUND_HALF_EVEN, PHP_ROUND_HALF_ODD
@re... | [
"Round",
"the",
"value",
"to",
"the",
"required",
"precision",
"and",
"using",
"the",
"required",
"mode"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L676-L684 | train |
bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.getIntegerPart | public function getIntegerPart()
{
if ( ! $this->getIsDecimal() ) return $this->_value;
return substr( $this->_value, 0, strpos( $this->_value, "." ) );
} | php | public function getIntegerPart()
{
if ( ! $this->getIsDecimal() ) return $this->_value;
return substr( $this->_value, 0, strpos( $this->_value, "." ) );
} | [
"public",
"function",
"getIntegerPart",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getIsDecimal",
"(",
")",
")",
"return",
"$",
"this",
"->",
"_value",
";",
"return",
"substr",
"(",
"$",
"this",
"->",
"_value",
",",
"0",
",",
"strpos",
"(",
... | Return the part of the number before the decimal point
Does not taken into account the size of any fraction.
@return string | [
"Return",
"the",
"part",
"of",
"the",
"number",
"before",
"the",
"decimal",
"point",
"Does",
"not",
"taken",
"into",
"account",
"the",
"size",
"of",
"any",
"fraction",
"."
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L712-L716 | train |
bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.getDecimalIsHalf | public function getDecimalIsHalf( $scale = false )
{
if ( ! $this->getIsDecimal() ) {
return false;
}
if ( $scale === false ) $scale = $this->scale( $this->_value );
if ( $scale < 0 ) $scale = $scale = 0;
$decimalPart = $this->getDecimalPart();
if ( $scale >= strlen( $decimalPart ) ) return ... | php | public function getDecimalIsHalf( $scale = false )
{
if ( ! $this->getIsDecimal() ) {
return false;
}
if ( $scale === false ) $scale = $this->scale( $this->_value );
if ( $scale < 0 ) $scale = $scale = 0;
$decimalPart = $this->getDecimalPart();
if ( $scale >= strlen( $decimalPart ) ) return ... | [
"public",
"function",
"getDecimalIsHalf",
"(",
"$",
"scale",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getIsDecimal",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"scale",
"===",
"false",
")",
"$",
"scale",
"="... | Test to see if the digit at scale + 1 is a 5
@param int $scale
@return bool | [
"Test",
"to",
"see",
"if",
"the",
"digit",
"at",
"scale",
"+",
"1",
"is",
"a",
"5"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L723-L738 | train |
bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.getIsDecimalEven | public function getIsDecimalEven( $precision = false )
{
if ( ! $this->getIsDecimal() ) {
return false;
}
if ( $precision === false ) $precision = $this->scale( $this->_value );
if ( $precision < 0 ) $precision = $precision = 0;
$decimalPart = $this->getDecimalPart();
if ( $precision >= strl... | php | public function getIsDecimalEven( $precision = false )
{
if ( ! $this->getIsDecimal() ) {
return false;
}
if ( $precision === false ) $precision = $this->scale( $this->_value );
if ( $precision < 0 ) $precision = $precision = 0;
$decimalPart = $this->getDecimalPart();
if ( $precision >= strl... | [
"public",
"function",
"getIsDecimalEven",
"(",
"$",
"precision",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getIsDecimal",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"precision",
"===",
"false",
")",
"$",
"preci... | Returns true if the digit at the required level of precision is even
@param string $precision
@return bool | [
"Returns",
"true",
"if",
"the",
"digit",
"at",
"the",
"required",
"level",
"of",
"precision",
"is",
"even"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L764-L779 | train |
bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.getIsCloserToNext | public function getIsCloserToNext( $precision = false, $mode = PHP_ROUND_HALF_UP )
{
if ( ! $this->getIsDecimal() ) {
return false;
}
if ( $precision === false ) $precision = $this->scale( $this->_value );
if ( $precision < 0 ) $precision = $precision = 0;
$decimalPart = $this->getDecimalPart()... | php | public function getIsCloserToNext( $precision = false, $mode = PHP_ROUND_HALF_UP )
{
if ( ! $this->getIsDecimal() ) {
return false;
}
if ( $precision === false ) $precision = $this->scale( $this->_value );
if ( $precision < 0 ) $precision = $precision = 0;
$decimalPart = $this->getDecimalPart()... | [
"public",
"function",
"getIsCloserToNext",
"(",
"$",
"precision",
"=",
"false",
",",
"$",
"mode",
"=",
"PHP_ROUND_HALF_UP",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getIsDecimal",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
... | Returns true if the number at the scale position in the decimal part of the number is closer to the next power.
@param int $precision
@param int $mode PHP_ROUND_HALF_UP (default), PHP_ROUND_HALF_DOWN, PHP_ROUND_HALF_EVEN, PHP_ROUND_HALF_ODD
@return bool | [
"Returns",
"true",
"if",
"the",
"number",
"at",
"the",
"scale",
"position",
"in",
"the",
"decimal",
"part",
"of",
"the",
"number",
"is",
"closer",
"to",
"the",
"next",
"power",
"."
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L787-L803 | train |
bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.dec2bin | private function dec2bin( $decimal )
{
bcscale(0);
$binary = '';
do
{
$binary = bcmod( $decimal, '2' ) . $binary;
$decimal = bcdiv( $decimal, '2' );
} while ( bccomp( $decimal, '0' ) );
return( $binary );
} | php | private function dec2bin( $decimal )
{
bcscale(0);
$binary = '';
do
{
$binary = bcmod( $decimal, '2' ) . $binary;
$decimal = bcdiv( $decimal, '2' );
} while ( bccomp( $decimal, '0' ) );
return( $binary );
} | [
"private",
"function",
"dec2bin",
"(",
"$",
"decimal",
")",
"{",
"bcscale",
"(",
"0",
")",
";",
"$",
"binary",
"=",
"''",
";",
"do",
"{",
"$",
"binary",
"=",
"bcmod",
"(",
"$",
"decimal",
",",
"'2'",
")",
".",
"$",
"binary",
";",
"$",
"decimal",
... | Create a binary representation of the current value
@param string $decimal The number to be converted
@return string | [
"Create",
"a",
"binary",
"representation",
"of",
"the",
"current",
"value"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L989-L1000 | train |
naucon/Utility | src/CollectionAbstract.php | CollectionAbstract.getIterator | public function getIterator()
{
if (is_null($this->_iterator)) {
$this->_iterator = new Iterator($this->_items);
}
return $this->_iterator;
} | php | public function getIterator()
{
if (is_null($this->_iterator)) {
$this->_iterator = new Iterator($this->_items);
}
return $this->_iterator;
} | [
"public",
"function",
"getIterator",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_iterator",
")",
")",
"{",
"$",
"this",
"->",
"_iterator",
"=",
"new",
"Iterator",
"(",
"$",
"this",
"->",
"_items",
")",
";",
"}",
"return",
"$",
"t... | return a iterator
@return IteratorInterface | [
"return",
"a",
"iterator"
] | d225bb5d09d82400917f710c9d502949a66442c4 | https://github.com/naucon/Utility/blob/d225bb5d09d82400917f710c9d502949a66442c4/src/CollectionAbstract.php#L100-L106 | train |
naucon/Utility | src/CollectionAbstract.php | CollectionAbstract.remove | public function remove($element)
{
$index = $this->indexOf($element);
if ($index !== false) {
unset($this->_items[$index]);
$this->_items = array_values($this->_items);
$this->_iterator = null;
return true;
}
return false;
} | php | public function remove($element)
{
$index = $this->indexOf($element);
if ($index !== false) {
unset($this->_items[$index]);
$this->_items = array_values($this->_items);
$this->_iterator = null;
return true;
}
return false;
} | [
"public",
"function",
"remove",
"(",
"$",
"element",
")",
"{",
"$",
"index",
"=",
"$",
"this",
"->",
"indexOf",
"(",
"$",
"element",
")",
";",
"if",
"(",
"$",
"index",
"!==",
"false",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"_items",
"[",
"$",... | remove a specified element from the collection
@param mixed $element element
@return bool | [
"remove",
"a",
"specified",
"element",
"from",
"the",
"collection"
] | d225bb5d09d82400917f710c9d502949a66442c4 | https://github.com/naucon/Utility/blob/d225bb5d09d82400917f710c9d502949a66442c4/src/CollectionAbstract.php#L124-L135 | train |
fuelphp-storage/security | src/Filter/Base.php | Base.clean | public function clean($input)
{
// Nothing to escape for non-string scalars, or for already processed values
if (is_bool($input) or is_int($input) or is_float($input) or $this->parent->isCleaned($input))
{
return $input;
}
if (is_string($input))
{
$input = $this->cleanString($input);
}
elseif (... | php | public function clean($input)
{
// Nothing to escape for non-string scalars, or for already processed values
if (is_bool($input) or is_int($input) or is_float($input) or $this->parent->isCleaned($input))
{
return $input;
}
if (is_string($input))
{
$input = $this->cleanString($input);
}
elseif (... | [
"public",
"function",
"clean",
"(",
"$",
"input",
")",
"{",
"// Nothing to escape for non-string scalars, or for already processed values",
"if",
"(",
"is_bool",
"(",
"$",
"input",
")",
"or",
"is_int",
"(",
"$",
"input",
")",
"or",
"is_float",
"(",
"$",
"input",
... | Cleans string, object or array
@param mixed $input
@return mixed
@throws \RuntimeException if the variable passed can not be cleaned | [
"Cleans",
"string",
"object",
"or",
"array"
] | 2cad42a8432bc9c9de46486623b71e105ff84b1b | https://github.com/fuelphp-storage/security/blob/2cad42a8432bc9c9de46486623b71e105ff84b1b/src/Filter/Base.php#L39-L88 | train |
fuelphp-storage/security | src/Filter/Base.php | Base.cleanArray | protected function cleanArray($input)
{
// add to the cleaned list when object
if (is_object($input))
{
$this->parent->isClean($input);
}
foreach ($input as $k => $v)
{
$input[$k] = $this->clean($v);
}
return $input;
} | php | protected function cleanArray($input)
{
// add to the cleaned list when object
if (is_object($input))
{
$this->parent->isClean($input);
}
foreach ($input as $k => $v)
{
$input[$k] = $this->clean($v);
}
return $input;
} | [
"protected",
"function",
"cleanArray",
"(",
"$",
"input",
")",
"{",
"// add to the cleaned list when object",
"if",
"(",
"is_object",
"(",
"$",
"input",
")",
")",
"{",
"$",
"this",
"->",
"parent",
"->",
"isClean",
"(",
"$",
"input",
")",
";",
"}",
"foreach... | cleanArray base method
@param string $input
@return string | [
"cleanArray",
"base",
"method"
] | 2cad42a8432bc9c9de46486623b71e105ff84b1b | https://github.com/fuelphp-storage/security/blob/2cad42a8432bc9c9de46486623b71e105ff84b1b/src/Filter/Base.php#L109-L123 | train |
fuelphp-storage/security | src/Filter/Base.php | Base.cleanObject | protected function cleanObject($input)
{
// add to the cleaned list
$this->parent->isClean($input);
foreach ($value as $k => $v)
{
$value->{$k} = $this->clean($v);
}
return $input;
} | php | protected function cleanObject($input)
{
// add to the cleaned list
$this->parent->isClean($input);
foreach ($value as $k => $v)
{
$value->{$k} = $this->clean($v);
}
return $input;
} | [
"protected",
"function",
"cleanObject",
"(",
"$",
"input",
")",
"{",
"// add to the cleaned list",
"$",
"this",
"->",
"parent",
"->",
"isClean",
"(",
"$",
"input",
")",
";",
"foreach",
"(",
"$",
"value",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
... | cleanObject base method. Not defined as abstract become some filters might not implement cleaning objects
@param object $input
@return object | [
"cleanObject",
"base",
"method",
".",
"Not",
"defined",
"as",
"abstract",
"become",
"some",
"filters",
"might",
"not",
"implement",
"cleaning",
"objects"
] | 2cad42a8432bc9c9de46486623b71e105ff84b1b | https://github.com/fuelphp-storage/security/blob/2cad42a8432bc9c9de46486623b71e105ff84b1b/src/Filter/Base.php#L132-L142 | train |
mullanaphy/variable | src/PHY/Variable/AVar.php | AVar.complete | public function complete()
{
$chain = $this->chain;
$this->chaining = false;
$this->chain = null;
return $chain;
} | php | public function complete()
{
$chain = $this->chain;
$this->chaining = false;
$this->chain = null;
return $chain;
} | [
"public",
"function",
"complete",
"(",
")",
"{",
"$",
"chain",
"=",
"$",
"this",
"->",
"chain",
";",
"$",
"this",
"->",
"chaining",
"=",
"false",
";",
"$",
"this",
"->",
"chain",
"=",
"null",
";",
"return",
"$",
"chain",
";",
"}"
] | Complete a chain and return it's result.
@return mixed | [
"Complete",
"a",
"chain",
"and",
"return",
"it",
"s",
"result",
"."
] | e4eb274a1799a25e33e5e21cd260603c74628031 | https://github.com/mullanaphy/variable/blob/e4eb274a1799a25e33e5e21cd260603c74628031/src/PHY/Variable/AVar.php#L84-L90 | train |
mullanaphy/variable | src/PHY/Variable/AVar.php | AVar.update | public function update($value)
{
$this->validate($value);
if ($this->chaining) {
$this->chain = $value;
} else {
$this->current = $value;
}
return $this;
} | php | public function update($value)
{
$this->validate($value);
if ($this->chaining) {
$this->chain = $value;
} else {
$this->current = $value;
}
return $this;
} | [
"public",
"function",
"update",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"validate",
"(",
"$",
"value",
")",
";",
"if",
"(",
"$",
"this",
"->",
"chaining",
")",
"{",
"$",
"this",
"->",
"chain",
"=",
"$",
"value",
";",
"}",
"else",
"{",
"... | Update a value.
@param mixed $value
@return \PHY\Variable\AVar | [
"Update",
"a",
"value",
"."
] | e4eb274a1799a25e33e5e21cd260603c74628031 | https://github.com/mullanaphy/variable/blob/e4eb274a1799a25e33e5e21cd260603c74628031/src/PHY/Variable/AVar.php#L98-L107 | train |
mullanaphy/variable | src/PHY/Variable/AVar.php | AVar.reset | public function reset()
{
$this->current = $this->original;
$this->chaining = false;
$this->chain = null;
return $this;
} | php | public function reset()
{
$this->current = $this->original;
$this->chaining = false;
$this->chain = null;
return $this;
} | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"current",
"=",
"$",
"this",
"->",
"original",
";",
"$",
"this",
"->",
"chaining",
"=",
"false",
";",
"$",
"this",
"->",
"chain",
"=",
"null",
";",
"return",
"$",
"this",
";",
"}"
] | Reset the variable back to it's original value.
@return \PHY\Variable\AVar | [
"Reset",
"the",
"variable",
"back",
"to",
"it",
"s",
"original",
"value",
"."
] | e4eb274a1799a25e33e5e21cd260603c74628031 | https://github.com/mullanaphy/variable/blob/e4eb274a1799a25e33e5e21cd260603c74628031/src/PHY/Variable/AVar.php#L157-L163 | train |
mullanaphy/variable | src/PHY/Variable/AVar.php | AVar.validate | public function validate($value)
{
if (!in_array(gettype($value), $this->types)) {
throw new Exception('Type of value "'.gettype($value)."' is not compatible with ".get_class($this));
}
} | php | public function validate($value)
{
if (!in_array(gettype($value), $this->types)) {
throw new Exception('Type of value "'.gettype($value)."' is not compatible with ".get_class($this));
}
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"gettype",
"(",
"$",
"value",
")",
",",
"$",
"this",
"->",
"types",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Type of value \"'",
".",
"gettype",
... | Validate a variables type to make sure our class can use it.
@param string $value
@throws Exception | [
"Validate",
"a",
"variables",
"type",
"to",
"make",
"sure",
"our",
"class",
"can",
"use",
"it",
"."
] | e4eb274a1799a25e33e5e21cd260603c74628031 | https://github.com/mullanaphy/variable/blob/e4eb274a1799a25e33e5e21cd260603c74628031/src/PHY/Variable/AVar.php#L171-L176 | train |
OpenConext/Stepup-bundle | src/Value/GssfConfig.php | GssfConfig.getLoaMap | public function getLoaMap()
{
$loaMap = [];
foreach ($this->config as $key => $config) {
if (array_key_exists('loa', $config)) {
$loaMap[$key] = $config['loa'];
}
}
return $loaMap;
} | php | public function getLoaMap()
{
$loaMap = [];
foreach ($this->config as $key => $config) {
if (array_key_exists('loa', $config)) {
$loaMap[$key] = $config['loa'];
}
}
return $loaMap;
} | [
"public",
"function",
"getLoaMap",
"(",
")",
"{",
"$",
"loaMap",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"config",
"as",
"$",
"key",
"=>",
"$",
"config",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'loa'",
",",
"$",
"config",
")",... | Flattens the config and returns key value pairs where the key is the SF type and the value is the LOA level | [
"Flattens",
"the",
"config",
"and",
"returns",
"key",
"value",
"pairs",
"where",
"the",
"key",
"is",
"the",
"SF",
"type",
"and",
"the",
"value",
"is",
"the",
"LOA",
"level"
] | 94178ddb421889df9e068109293a8da880793ed2 | https://github.com/OpenConext/Stepup-bundle/blob/94178ddb421889df9e068109293a8da880793ed2/src/Value/GssfConfig.php#L48-L57 | train |
PenoaksDev/Milky-Framework | src/Milky/Database/Eloquent/Nested/Generators/ModelGenerator.php | ModelGenerator.create | public function create( $name, $path )
{
$path = $this->getPath( $name, $path );
$stub = $this->getStub( 'model' );
$this->files->put( $path, $this->parseStub( $stub, [
'table' => $this->tableize( $name ),
'class' => $this->classify( $name )
] ) );
return $path;
} | php | public function create( $name, $path )
{
$path = $this->getPath( $name, $path );
$stub = $this->getStub( 'model' );
$this->files->put( $path, $this->parseStub( $stub, [
'table' => $this->tableize( $name ),
'class' => $this->classify( $name )
] ) );
return $path;
} | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getPath",
"(",
"$",
"name",
",",
"$",
"path",
")",
";",
"$",
"stub",
"=",
"$",
"this",
"->",
"getStub",
"(",
"'model'",
")",
";"... | Create a new model at the given path.
@param string $name
@param string $path
@return string | [
"Create",
"a",
"new",
"model",
"at",
"the",
"given",
"path",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/Generators/ModelGenerator.php#L12-L24 | train |
ScaraMVC/Framework | src/Scara/Validation/Errors.php | Errors.get | public function get($key)
{
$res = $this->_errors[$key];
if (!is_array($res)) {
return [$res];
}
return $res;
} | php | public function get($key)
{
$res = $this->_errors[$key];
if (!is_array($res)) {
return [$res];
}
return $res;
} | [
"public",
"function",
"get",
"(",
"$",
"key",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"_errors",
"[",
"$",
"key",
"]",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"res",
")",
")",
"{",
"return",
"[",
"$",
"res",
"]",
";",
"}",
"return",
... | Gets a specific error.
@param string $key - The error we're looking for
@return string - The error message | [
"Gets",
"a",
"specific",
"error",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Validation/Errors.php#L36-L44 | train |
ScaraMVC/Framework | src/Scara/Validation/Errors.php | Errors.first | public function first($key)
{
if ($this->has($key)) {
$err = $this->_errors[$key];
if (is_array($err)) {
for ($i = 0; $i < count($err); $i++) {
if (!empty($err[$i])) {
return $err[$i];
}
}... | php | public function first($key)
{
if ($this->has($key)) {
$err = $this->_errors[$key];
if (is_array($err)) {
for ($i = 0; $i < count($err); $i++) {
if (!empty($err[$i])) {
return $err[$i];
}
}... | [
"public",
"function",
"first",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"$",
"err",
"=",
"$",
"this",
"->",
"_errors",
"[",
"$",
"key",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"err",
... | Gets the first message for a specific error.
@param string $key - The error we're looking for
@return string - The error message | [
"Gets",
"the",
"first",
"message",
"for",
"a",
"specific",
"error",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Validation/Errors.php#L53-L69 | train |
ScaraMVC/Framework | src/Scara/Validation/Errors.php | Errors.add | public function add($data)
{
$ea = (array) $data;
foreach ($ea as $key => $value) {
if (is_array($value)) {
foreach ($value as $k => $v) {
if (is_null($v)) {
unset($value[$k]);
}
}
... | php | public function add($data)
{
$ea = (array) $data;
foreach ($ea as $key => $value) {
if (is_array($value)) {
foreach ($value as $k => $v) {
if (is_null($v)) {
unset($value[$k]);
}
}
... | [
"public",
"function",
"add",
"(",
"$",
"data",
")",
"{",
"$",
"ea",
"=",
"(",
"array",
")",
"$",
"data",
";",
"foreach",
"(",
"$",
"ea",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
... | Adds all error data. Also clears out any null values.
@param array $data - The error data to load into | [
"Adds",
"all",
"error",
"data",
".",
"Also",
"clears",
"out",
"any",
"null",
"values",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Validation/Errors.php#L76-L92 | train |
WellCommerce/LayoutBundle | Renderer/LayoutBoxRenderer.php | LayoutBoxRenderer.resolveControllerAction | private function resolveControllerAction(BoxControllerInterface $controller)
{
$currentAction = $this->routerHelper->getCurrentAction();
if ($this->routerHelper->hasControllerAction($controller, $currentAction)) {
return $currentAction;
}
return 'indexAc... | php | private function resolveControllerAction(BoxControllerInterface $controller)
{
$currentAction = $this->routerHelper->getCurrentAction();
if ($this->routerHelper->hasControllerAction($controller, $currentAction)) {
return $currentAction;
}
return 'indexAc... | [
"private",
"function",
"resolveControllerAction",
"(",
"BoxControllerInterface",
"$",
"controller",
")",
"{",
"$",
"currentAction",
"=",
"$",
"this",
"->",
"routerHelper",
"->",
"getCurrentAction",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"routerHelper",
"->... | Resolves action which can be used in controller method call
@param BoxControllerInterface $controller
@return string | [
"Resolves",
"action",
"which",
"can",
"be",
"used",
"in",
"controller",
"method",
"call"
] | 470efd187d19827058f88317221cb875b4c9ced3 | https://github.com/WellCommerce/LayoutBundle/blob/470efd187d19827058f88317221cb875b4c9ced3/Renderer/LayoutBoxRenderer.php#L111-L120 | train |
WellBloud/sovacore-core | src/model/FrontModule/repository/BaseRepository.php | BaseRepository.findPublishedItems | public function findPublishedItems(
array $where,
$orderBy = null,
$limit = null
)
{
return $this->repository->findBy(array_merge($where, ['published' => true]), $orderBy, $limit);
} | php | public function findPublishedItems(
array $where,
$orderBy = null,
$limit = null
)
{
return $this->repository->findBy(array_merge($where, ['published' => true]), $orderBy, $limit);
} | [
"public",
"function",
"findPublishedItems",
"(",
"array",
"$",
"where",
",",
"$",
"orderBy",
"=",
"null",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"repository",
"->",
"findBy",
"(",
"array_merge",
"(",
"$",
"where",
",",
"... | Method which finds published items in the repository according to the where clause
@param array $where
@param array $orderBy
@param int $limit
@return array | [
"Method",
"which",
"finds",
"published",
"items",
"in",
"the",
"repository",
"according",
"to",
"the",
"where",
"clause"
] | 1816a0d7cd3ec4a90d64e301fc2469d171ad217f | https://github.com/WellBloud/sovacore-core/blob/1816a0d7cd3ec4a90d64e301fc2469d171ad217f/src/model/FrontModule/repository/BaseRepository.php#L26-L33 | train |
agentmedia/phine-core | src/Core/Logic/Module/FrontendModule.php | FrontendModule.TemplateFile | public function TemplateFile()
{
if (!$this->AllowCustomTemplates() ||
!$this->content || !$this->content->GetTemplate())
{
return $this->BuiltInTemplateFile();
}
$file = Path::Combine(PathUtil::ModuleCustomTemplatesFolder($this), $this->content->GetTempla... | php | public function TemplateFile()
{
if (!$this->AllowCustomTemplates() ||
!$this->content || !$this->content->GetTemplate())
{
return $this->BuiltInTemplateFile();
}
$file = Path::Combine(PathUtil::ModuleCustomTemplatesFolder($this), $this->content->GetTempla... | [
"public",
"function",
"TemplateFile",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"AllowCustomTemplates",
"(",
")",
"||",
"!",
"$",
"this",
"->",
"content",
"||",
"!",
"$",
"this",
"->",
"content",
"->",
"GetTemplate",
"(",
")",
")",
"{",
"retu... | The template file
@return string | [
"The",
"template",
"file"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Module/FrontendModule.php#L47-L56 | train |
agentmedia/phine-core | src/Core/Logic/Module/FrontendModule.php | FrontendModule.SetTreeItem | public function SetTreeItem(IContentTreeProvider $tree, $item)
{
$this->tree = $tree;
$this->item = $item;
$this->content = $this->tree->ContentByItem($item);
} | php | public function SetTreeItem(IContentTreeProvider $tree, $item)
{
$this->tree = $tree;
$this->item = $item;
$this->content = $this->tree->ContentByItem($item);
} | [
"public",
"function",
"SetTreeItem",
"(",
"IContentTreeProvider",
"$",
"tree",
",",
"$",
"item",
")",
"{",
"$",
"this",
"->",
"tree",
"=",
"$",
"tree",
";",
"$",
"this",
"->",
"item",
"=",
"$",
"item",
";",
"$",
"this",
"->",
"content",
"=",
"$",
"... | Sets tree and tree item
@param IContentTreeProvider $tree
@param mixed $item The tree item containing the render content | [
"Sets",
"tree",
"and",
"tree",
"item"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Module/FrontendModule.php#L81-L86 | train |
agentmedia/phine-core | src/Core/Logic/Module/FrontendModule.php | FrontendModule.BackendName | public function BackendName()
{
if ($this->ContentForm())
{
$this->ContentForm()->ReadTranslations();
}
return Trans($this->MyBundle() . '.' . $this->MyName() . '.BackendName');
} | php | public function BackendName()
{
if ($this->ContentForm())
{
$this->ContentForm()->ReadTranslations();
}
return Trans($this->MyBundle() . '.' . $this->MyName() . '.BackendName');
} | [
"public",
"function",
"BackendName",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"ContentForm",
"(",
")",
")",
"{",
"$",
"this",
"->",
"ContentForm",
"(",
")",
"->",
"ReadTranslations",
"(",
")",
";",
"}",
"return",
"Trans",
"(",
"$",
"this",
"->",
... | Gets a display name for backend issues, can be overridden
@return string The display name | [
"Gets",
"a",
"display",
"name",
"for",
"backend",
"issues",
"can",
"be",
"overridden"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Module/FrontendModule.php#L92-L99 | train |
agentmedia/phine-core | src/Core/Logic/Module/FrontendModule.php | FrontendModule.BeforeInit | protected function BeforeInit()
{
//todo: check access rights
$cacheFile = PathUtil::ContentCacheFile($this);
$this->fileCacher = new FileCacher($cacheFile, $this->content->GetCacheLifetime());
if ($this->fileCacher->MustUseCache())
{
$this->output = $this->fileCa... | php | protected function BeforeInit()
{
//todo: check access rights
$cacheFile = PathUtil::ContentCacheFile($this);
$this->fileCacher = new FileCacher($cacheFile, $this->content->GetCacheLifetime());
if ($this->fileCacher->MustUseCache())
{
$this->output = $this->fileCa... | [
"protected",
"function",
"BeforeInit",
"(",
")",
"{",
"//todo: check access rights",
"$",
"cacheFile",
"=",
"PathUtil",
"::",
"ContentCacheFile",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"fileCacher",
"=",
"new",
"FileCacher",
"(",
"$",
"cacheFile",
",",... | Gets cache content if necessary
@return boolean | [
"Gets",
"cache",
"content",
"if",
"necessary"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Module/FrontendModule.php#L197-L208 | train |
agentmedia/phine-core | src/Core/Logic/Module/FrontendModule.php | FrontendModule.AfterGather | protected function AfterGather()
{
if ($this->fileCacher->MustStoreToCache())
{
$this->fileCacher->StoreToCache($this->output);
}
parent::AfterGather();
} | php | protected function AfterGather()
{
if ($this->fileCacher->MustStoreToCache())
{
$this->fileCacher->StoreToCache($this->output);
}
parent::AfterGather();
} | [
"protected",
"function",
"AfterGather",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"fileCacher",
"->",
"MustStoreToCache",
"(",
")",
")",
"{",
"$",
"this",
"->",
"fileCacher",
"->",
"StoreToCache",
"(",
"$",
"this",
"->",
"output",
")",
";",
"}",
"pa... | Stores to cache if necessary | [
"Stores",
"to",
"cache",
"if",
"necessary"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Module/FrontendModule.php#L212-L219 | train |
CalderaWP/caldera-interop | src/Collections/Attributes.php | Attributes.addAttribute | public function addAttribute(Attribute$attribute) : Attributes
{
$this->getItems();//max sure is array
$this->attributes[$attribute->getName()] = $attribute;
return $this;
} | php | public function addAttribute(Attribute$attribute) : Attributes
{
$this->getItems();//max sure is array
$this->attributes[$attribute->getName()] = $attribute;
return $this;
} | [
"public",
"function",
"addAttribute",
"(",
"Attribute",
"$",
"attribute",
")",
":",
"Attributes",
"{",
"$",
"this",
"->",
"getItems",
"(",
")",
";",
"//max sure is array",
"$",
"this",
"->",
"attributes",
"[",
"$",
"attribute",
"->",
"getName",
"(",
")",
"... | Add attribute to collection
@param Attribute $attribute
@return Attributes | [
"Add",
"attribute",
"to",
"collection"
] | d25c4bc930200b314fbd42d084080b5d85261c94 | https://github.com/CalderaWP/caldera-interop/blob/d25c4bc930200b314fbd42d084080b5d85261c94/src/Collections/Attributes.php#L36-L41 | train |
PenoaksDev/Milky-Framework | src/Milky/Facades/Log.php | Log.log | public static function log( $level, $message, array $context = [] )
{
return static::__do( __FUNCTION__, args_with_keys( func_get_args(), __CLASS__, __FUNCTION__ ) );
} | php | public static function log( $level, $message, array $context = [] )
{
return static::__do( __FUNCTION__, args_with_keys( func_get_args(), __CLASS__, __FUNCTION__ ) );
} | [
"public",
"static",
"function",
"log",
"(",
"$",
"level",
",",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"return",
"static",
"::",
"__do",
"(",
"__FUNCTION__",
",",
"args_with_keys",
"(",
"func_get_args",
"(",
")",
",",
"__... | Logging a message to the logs.
@param string $level
@param string $message
@param array $context | [
"Logging",
"a",
"message",
"to",
"the",
"logs",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Facades/Log.php#L115-L118 | train |
internetofvoice/vsms-core | src/Controller/AbstractSkillController.php | AbstractSkillController.createAlexaRequest | protected function createAlexaRequest($request) {
$this->voiceInterface = 'Alexa';
// Create AlexaRequest from HTTP request
$this->alexaRequest = new AlexaRequest(
$request->getBody()->getContents(),
$this->askApplicationIds,
$request->getHeaderLine('Signaturecertc... | php | protected function createAlexaRequest($request) {
$this->voiceInterface = 'Alexa';
// Create AlexaRequest from HTTP request
$this->alexaRequest = new AlexaRequest(
$request->getBody()->getContents(),
$this->askApplicationIds,
$request->getHeaderLine('Signaturecertc... | [
"protected",
"function",
"createAlexaRequest",
"(",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"voiceInterface",
"=",
"'Alexa'",
";",
"// Create AlexaRequest from HTTP request",
"$",
"this",
"->",
"alexaRequest",
"=",
"new",
"AlexaRequest",
"(",
"$",
"request",
... | Create Alexa Request from Slim Request
@param \Slim\Http\Request $request Slim request
@access protected
@author a.schmidt@internet-of-voice.de | [
"Create",
"Alexa",
"Request",
"from",
"Slim",
"Request"
] | bd1eb6ca90a55f4928c35b9f0742a5cc922298ef | https://github.com/internetofvoice/vsms-core/blob/bd1eb6ca90a55f4928c35b9f0742a5cc922298ef/src/Controller/AbstractSkillController.php#L60-L80 | train |
zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php | GraphvizDumper.dump | public function dump(array $options = array())
{
foreach (array('graph', 'node', 'edge', 'node.instance', 'node.definition', 'node.missing') as $key) {
if (isset($options[$key])) {
$this->options[$key] = array_merge($this->options[$key], $options[$key]);
}
}
... | php | public function dump(array $options = array())
{
foreach (array('graph', 'node', 'edge', 'node.instance', 'node.definition', 'node.missing') as $key) {
if (isset($options[$key])) {
$this->options[$key] = array_merge($this->options[$key], $options[$key]);
}
}
... | [
"public",
"function",
"dump",
"(",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"array",
"(",
"'graph'",
",",
"'node'",
",",
"'edge'",
",",
"'node.instance'",
",",
"'node.definition'",
",",
"'node.missing'",
")",
"as",
"$",
... | Dumps the service container as a graphviz graph.
Available options:
* graph: The default options for the whole graph
* node: The default options for nodes
* edge: The default options for edges
* node.instance: The default options for services that are defined directly by object instances
* node.definition: The defaul... | [
"Dumps",
"the",
"service",
"container",
"as",
"a",
"graphviz",
"graph",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php#L58-L84 | train |
zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php | GraphvizDumper.startDot | private function startDot()
{
return sprintf("digraph sc {\n %s\n node [%s];\n edge [%s];\n\n",
$this->addOptions($this->options['graph']),
$this->addOptions($this->options['node']),
$this->addOptions($this->options['edge'])
);
} | php | private function startDot()
{
return sprintf("digraph sc {\n %s\n node [%s];\n edge [%s];\n\n",
$this->addOptions($this->options['graph']),
$this->addOptions($this->options['node']),
$this->addOptions($this->options['edge'])
);
} | [
"private",
"function",
"startDot",
"(",
")",
"{",
"return",
"sprintf",
"(",
"\"digraph sc {\\n %s\\n node [%s];\\n edge [%s];\\n\\n\"",
",",
"$",
"this",
"->",
"addOptions",
"(",
"$",
"this",
"->",
"options",
"[",
"'graph'",
"]",
")",
",",
"$",
"this",
"->",
... | Returns the start dot.
@return string The string representation of a start dot | [
"Returns",
"the",
"start",
"dot",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php#L220-L227 | train |
gplcart/cli | controllers/commands/Status.php | Status.cmdStatusStatus | public function cmdStatusStatus()
{
$result = $this->report->getStatus();
$this->outputFormat($result);
$this->outputFormatTableStatus($result);
$this->output();
} | php | public function cmdStatusStatus()
{
$result = $this->report->getStatus();
$this->outputFormat($result);
$this->outputFormatTableStatus($result);
$this->output();
} | [
"public",
"function",
"cmdStatusStatus",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"report",
"->",
"getStatus",
"(",
")",
";",
"$",
"this",
"->",
"outputFormat",
"(",
"$",
"result",
")",
";",
"$",
"this",
"->",
"outputFormatTableStatus",
"(",... | Callback for "status" command | [
"Callback",
"for",
"status",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Status.php#L40-L46 | train |
ekyna/Resource | Doctrine/ORM/Util/ResourceRepositoryTrait.php | ResourceRepositoryTrait.find | public function find($id)
{
return $this
->getQueryBuilder()
->andWhere($this->getAlias().'.id = '.intval($id))
->getQuery()
->getOneOrNullResult()
;
} | php | public function find($id)
{
return $this
->getQueryBuilder()
->andWhere($this->getAlias().'.id = '.intval($id))
->getQuery()
->getOneOrNullResult()
;
} | [
"public",
"function",
"find",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"getQueryBuilder",
"(",
")",
"->",
"andWhere",
"(",
"$",
"this",
"->",
"getAlias",
"(",
")",
".",
"'.id = '",
".",
"intval",
"(",
"$",
"id",
")",
")",
"->",
"getQu... | Finds the resource by his ID.
@param int $id
@return null|object | [
"Finds",
"the",
"resource",
"by",
"his",
"ID",
"."
] | 96ee3d28e02bd9513705408e3bb7f88a76e52f56 | https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Doctrine/ORM/Util/ResourceRepositoryTrait.php#L44-L52 | train |
ekyna/Resource | Doctrine/ORM/Util/ResourceRepositoryTrait.php | ResourceRepositoryTrait.findBy | public function findBy(array $criteria, array $sorting = null, $limit = null, $offset = null)
{
$queryBuilder = $this->getCollectionQueryBuilder();
$this->applyCriteria($queryBuilder, $criteria);
$this->applySorting($queryBuilder, (array) $sorting);
if (null !== $limit) {
... | php | public function findBy(array $criteria, array $sorting = null, $limit = null, $offset = null)
{
$queryBuilder = $this->getCollectionQueryBuilder();
$this->applyCriteria($queryBuilder, $criteria);
$this->applySorting($queryBuilder, (array) $sorting);
if (null !== $limit) {
... | [
"public",
"function",
"findBy",
"(",
"array",
"$",
"criteria",
",",
"array",
"$",
"sorting",
"=",
"null",
",",
"$",
"limit",
"=",
"null",
",",
"$",
"offset",
"=",
"null",
")",
"{",
"$",
"queryBuilder",
"=",
"$",
"this",
"->",
"getCollectionQueryBuilder",... | Finds resources by criteria, sorting, limit and offset.
@param array $criteria
@param array $sorting
@param int $limit
@param int $offset
@return array|\Doctrine\ORM\Tools\Pagination\Paginator | [
"Finds",
"resources",
"by",
"criteria",
"sorting",
"limit",
"and",
"offset",
"."
] | 96ee3d28e02bd9513705408e3bb7f88a76e52f56 | https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Doctrine/ORM/Util/ResourceRepositoryTrait.php#L97-L119 | train |
ekyna/Resource | Doctrine/ORM/Util/ResourceRepositoryTrait.php | ResourceRepositoryTrait.findRandomOneBy | public function findRandomOneBy(array $criteria)
{
$queryBuilder = $this->getQueryBuilder();
$this->applyCriteria($queryBuilder, $criteria);
return $queryBuilder
->addSelect('RAND() as HIDDEN rand')
->orderBy('rand')
->setMaxResults(1)
->getQ... | php | public function findRandomOneBy(array $criteria)
{
$queryBuilder = $this->getQueryBuilder();
$this->applyCriteria($queryBuilder, $criteria);
return $queryBuilder
->addSelect('RAND() as HIDDEN rand')
->orderBy('rand')
->setMaxResults(1)
->getQ... | [
"public",
"function",
"findRandomOneBy",
"(",
"array",
"$",
"criteria",
")",
"{",
"$",
"queryBuilder",
"=",
"$",
"this",
"->",
"getQueryBuilder",
"(",
")",
";",
"$",
"this",
"->",
"applyCriteria",
"(",
"$",
"queryBuilder",
",",
"$",
"criteria",
")",
";",
... | Finds a random resource by criteria.
@param array $criteria
@return null|object | [
"Finds",
"a",
"random",
"resource",
"by",
"criteria",
"."
] | 96ee3d28e02bd9513705408e3bb7f88a76e52f56 | https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Doctrine/ORM/Util/ResourceRepositoryTrait.php#L128-L141 | train |
ekyna/Resource | Doctrine/ORM/Util/ResourceRepositoryTrait.php | ResourceRepositoryTrait.findRandomBy | public function findRandomBy(array $criteria, $limit)
{
$limit = intval($limit);
if ($limit <= 1) {
throw new \InvalidArgumentException('Please use `findRandomOneBy()` for single result.');
}
$queryBuilder = $this->getCollectionQueryBuilder();
$this->applyCriter... | php | public function findRandomBy(array $criteria, $limit)
{
$limit = intval($limit);
if ($limit <= 1) {
throw new \InvalidArgumentException('Please use `findRandomOneBy()` for single result.');
}
$queryBuilder = $this->getCollectionQueryBuilder();
$this->applyCriter... | [
"public",
"function",
"findRandomBy",
"(",
"array",
"$",
"criteria",
",",
"$",
"limit",
")",
"{",
"$",
"limit",
"=",
"intval",
"(",
"$",
"limit",
")",
";",
"if",
"(",
"$",
"limit",
"<=",
"1",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
... | Finds random resource by criteria and limit.
@param array $criteria
@param int $limit
@return array|\Doctrine\ORM\Tools\Pagination\Paginator | [
"Finds",
"random",
"resource",
"by",
"criteria",
"and",
"limit",
"."
] | 96ee3d28e02bd9513705408e3bb7f88a76e52f56 | https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Doctrine/ORM/Util/ResourceRepositoryTrait.php#L151-L170 | train |
ekyna/Resource | Doctrine/ORM/Util/ResourceRepositoryTrait.php | ResourceRepositoryTrait.createPager | public function createPager(array $criteria = [], array $sorting = [])
{
$queryBuilder = $this->getCollectionQueryBuilder();
$this->applyCriteria($queryBuilder, $criteria);
$this->applySorting($queryBuilder, $sorting);
return $this->getPager($queryBuilder);
} | php | public function createPager(array $criteria = [], array $sorting = [])
{
$queryBuilder = $this->getCollectionQueryBuilder();
$this->applyCriteria($queryBuilder, $criteria);
$this->applySorting($queryBuilder, $sorting);
return $this->getPager($queryBuilder);
} | [
"public",
"function",
"createPager",
"(",
"array",
"$",
"criteria",
"=",
"[",
"]",
",",
"array",
"$",
"sorting",
"=",
"[",
"]",
")",
"{",
"$",
"queryBuilder",
"=",
"$",
"this",
"->",
"getCollectionQueryBuilder",
"(",
")",
";",
"$",
"this",
"->",
"apply... | Creates a pager.
@param array $criteria
@param array $sorting
@return Pagerfanta | [
"Creates",
"a",
"pager",
"."
] | 96ee3d28e02bd9513705408e3bb7f88a76e52f56 | https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Doctrine/ORM/Util/ResourceRepositoryTrait.php#L180-L188 | train |
ekyna/Resource | Doctrine/ORM/Util/ResourceRepositoryTrait.php | ResourceRepositoryTrait.applyCriteria | protected function applyCriteria(QueryBuilder $queryBuilder, array $criteria = [])
{
foreach ($criteria as $property => $value) {
$name = $this->getPropertyName($property);
if (null === $value) {
$queryBuilder->andWhere($queryBuilder->expr()->isNull($name));
... | php | protected function applyCriteria(QueryBuilder $queryBuilder, array $criteria = [])
{
foreach ($criteria as $property => $value) {
$name = $this->getPropertyName($property);
if (null === $value) {
$queryBuilder->andWhere($queryBuilder->expr()->isNull($name));
... | [
"protected",
"function",
"applyCriteria",
"(",
"QueryBuilder",
"$",
"queryBuilder",
",",
"array",
"$",
"criteria",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"criteria",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
"$",
"name",
"=",
"$",
"th... | Applies the criteria to the query builder.
@param QueryBuilder $queryBuilder
@param array $criteria | [
"Applies",
"the",
"criteria",
"to",
"the",
"query",
"builder",
"."
] | 96ee3d28e02bd9513705408e3bb7f88a76e52f56 | https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Doctrine/ORM/Util/ResourceRepositoryTrait.php#L265-L281 | train |
ekyna/Resource | Doctrine/ORM/Util/ResourceRepositoryTrait.php | ResourceRepositoryTrait.getCachePrefix | public function getCachePrefix()
{
if ($this->cachePrefix) {
return $this->cachePrefix;
}
$class = $this->getClassName();
if (!in_array(TaggedEntityInterface::class, class_implements($class))) {
throw new \RuntimeException(sprintf(
'The entit... | php | public function getCachePrefix()
{
if ($this->cachePrefix) {
return $this->cachePrefix;
}
$class = $this->getClassName();
if (!in_array(TaggedEntityInterface::class, class_implements($class))) {
throw new \RuntimeException(sprintf(
'The entit... | [
"public",
"function",
"getCachePrefix",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cachePrefix",
")",
"{",
"return",
"$",
"this",
"->",
"cachePrefix",
";",
"}",
"$",
"class",
"=",
"$",
"this",
"->",
"getClassName",
"(",
")",
";",
"if",
"(",
"!",
... | Returns the cache prefix.
@return string | [
"Returns",
"the",
"cache",
"prefix",
"."
] | 96ee3d28e02bd9513705408e3bb7f88a76e52f56 | https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Doctrine/ORM/Util/ResourceRepositoryTrait.php#L330-L346 | train |
itkg/core | src/Itkg/Core/Cache/Factory.php | Factory.create | public function create($adapterType, array $config)
{
if (!array_key_exists($adapterType, $this->adapters)) {
throw new \InvalidArgumentException(
sprintf('Cache Adapter\'s key %s does not exist', $adapterType)
);
}
/**
* @fixme : Active this... | php | public function create($adapterType, array $config)
{
if (!array_key_exists($adapterType, $this->adapters)) {
throw new \InvalidArgumentException(
sprintf('Cache Adapter\'s key %s does not exist', $adapterType)
);
}
/**
* @fixme : Active this... | [
"public",
"function",
"create",
"(",
"$",
"adapterType",
",",
"array",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"adapterType",
",",
"$",
"this",
"->",
"adapters",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException"... | Create an adapter
@param string $adapterType
@return AdapterInterface
@throws \InvalidArgumentException | [
"Create",
"an",
"adapter"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Cache/Factory.php#L41-L59 | train |
Dhii/regex-abstract | src/QuoteRegexCapablePcreTrait.php | QuoteRegexCapablePcreTrait._quoteRegex | protected function _quoteRegex($string, $delimiter = null)
{
$string = $this->_normalizeString($string);
$delimiter = is_null($delimiter) ? null : $this->_normalizeString($delimiter);
return preg_quote($string, $delimiter);
} | php | protected function _quoteRegex($string, $delimiter = null)
{
$string = $this->_normalizeString($string);
$delimiter = is_null($delimiter) ? null : $this->_normalizeString($delimiter);
return preg_quote($string, $delimiter);
} | [
"protected",
"function",
"_quoteRegex",
"(",
"$",
"string",
",",
"$",
"delimiter",
"=",
"null",
")",
"{",
"$",
"string",
"=",
"$",
"this",
"->",
"_normalizeString",
"(",
"$",
"string",
")",
";",
"$",
"delimiter",
"=",
"is_null",
"(",
"$",
"delimiter",
... | Escapes special characters in a string such that it is interpreted literally by a PCRE parser.
@since [*next-version*]
@param string|Stringable $string The string to quote.
@param string|Stringable|null $delimiter The delimiter that will be used in the expression, if any.
If specified, this delimiter will be ... | [
"Escapes",
"special",
"characters",
"in",
"a",
"string",
"such",
"that",
"it",
"is",
"interpreted",
"literally",
"by",
"a",
"PCRE",
"parser",
"."
] | 0751f9c91a6f86d5f901b6b7f3613dc80bb69a8a | https://github.com/Dhii/regex-abstract/blob/0751f9c91a6f86d5f901b6b7f3613dc80bb69a8a/src/QuoteRegexCapablePcreTrait.php#L28-L34 | train |
SahilDude89ss/PyntaxFramework | src/Pyntax/DAO/Bean/Column/Column.php | Column.getValueFromDefinition | protected function getValueFromDefinition($key)
{
return (isset($this->definition) && !empty($this->definition[$key])) ? $this->definition[$key] : false;
} | php | protected function getValueFromDefinition($key)
{
return (isset($this->definition) && !empty($this->definition[$key])) ? $this->definition[$key] : false;
} | [
"protected",
"function",
"getValueFromDefinition",
"(",
"$",
"key",
")",
"{",
"return",
"(",
"isset",
"(",
"$",
"this",
"->",
"definition",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"definition",
"[",
"$",
"key",
"]",
")",
")",
"?",
"$",
"this... | This function returns the value of the key from the column definitions.
@param $key
@return bool|string | [
"This",
"function",
"returns",
"the",
"value",
"of",
"the",
"key",
"from",
"the",
"column",
"definitions",
"."
] | 045cca87d24eb2b6405734966c64344e00224c7b | https://github.com/SahilDude89ss/PyntaxFramework/blob/045cca87d24eb2b6405734966c64344e00224c7b/src/Pyntax/DAO/Bean/Column/Column.php#L121-L124 | train |
Wedeto/Util | src/Cache/Item.php | Item.serialize | public function serialize()
{
return serialize([
'key' => $this->key,
'value' => $this->value,
'expires' => $this->expires,
'hit' => $this->hit
]);
} | php | public function serialize()
{
return serialize([
'key' => $this->key,
'value' => $this->value,
'expires' => $this->expires,
'hit' => $this->hit
]);
} | [
"public",
"function",
"serialize",
"(",
")",
"{",
"return",
"serialize",
"(",
"[",
"'key'",
"=>",
"$",
"this",
"->",
"key",
",",
"'value'",
"=>",
"$",
"this",
"->",
"value",
",",
"'expires'",
"=>",
"$",
"this",
"->",
"expires",
",",
"'hit'",
"=>",
"$... | Serialize the item. Required for storing in the containing cache | [
"Serialize",
"the",
"item",
".",
"Required",
"for",
"storing",
"in",
"the",
"containing",
"cache"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/Cache/Item.php#L190-L198 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.