repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
psecio/propauth | src/Enforcer.php | Enforcer.denies | public function denies($policyName, $subject, array $addl = array())
{
if (!is_array($policyName)) {
$policyName = [$policyName];
}
foreach ($policyName as $name) {
if (!isset($this->policySet[$name])) {
throw new \InvalidArgumentException('Policy name... | php | public function denies($policyName, $subject, array $addl = array())
{
if (!is_array($policyName)) {
$policyName = [$policyName];
}
foreach ($policyName as $name) {
if (!isset($this->policySet[$name])) {
throw new \InvalidArgumentException('Policy name... | [
"public",
"function",
"denies",
"(",
"$",
"policyName",
",",
"$",
"subject",
",",
"array",
"$",
"addl",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"policyName",
")",
")",
"{",
"$",
"policyName",
"=",
"[",
"$",
"policyNa... | Locate a policy by name and evaluate if the subject is denied
by matching against its properties
@param string $policyName Policy key name
@param object $subject Subject to evluate against
@throws \InvalidArgumentException If policy name is not found
@return boolean Pass/fail of evluation | [
"Locate",
"a",
"policy",
"by",
"name",
"and",
"evaluate",
"if",
"the",
"subject",
"is",
"denied",
"by",
"matching",
"against",
"its",
"properties"
] | train | https://github.com/psecio/propauth/blob/cb24fcc0a3fa459f2ef40a867c334951aabf7b83/src/Enforcer.php#L83-L98 |
psecio/propauth | src/Enforcer.php | Enforcer.evaluate | public function evaluate($subject, Policy $policy, array $addl = array())
{
$addl = array_merge([$subject], $addl);
$checks = $policy->getChecks();
if (empty($checks)) {
trigger_error('Policy evaluation was perfomed with no checks', E_USER_WARNING);
}
foreach ($... | php | public function evaluate($subject, Policy $policy, array $addl = array())
{
$addl = array_merge([$subject], $addl);
$checks = $policy->getChecks();
if (empty($checks)) {
trigger_error('Policy evaluation was perfomed with no checks', E_USER_WARNING);
}
foreach ($... | [
"public",
"function",
"evaluate",
"(",
"$",
"subject",
",",
"Policy",
"$",
"policy",
",",
"array",
"$",
"addl",
"=",
"array",
"(",
")",
")",
"{",
"$",
"addl",
"=",
"array_merge",
"(",
"[",
"$",
"subject",
"]",
",",
"$",
"addl",
")",
";",
"$",
"ch... | Given a subject and a policy, evaluate the pass/fail result of the matching
@param object $subject Subject to match against
@param \Psecio\PropAuth\Policy $policy Policy to evaluate
@throws \InvalidArgumentException If the property value is invalid (null)
@return boolean Pass/fail status of evaluation | [
"Given",
"a",
"subject",
"and",
"a",
"policy",
"evaluate",
"the",
"pass",
"/",
"fail",
"result",
"of",
"the",
"matching"
] | train | https://github.com/psecio/propauth/blob/cb24fcc0a3fa459f2ef40a867c334951aabf7b83/src/Enforcer.php#L108-L141 |
psecio/propauth | src/Enforcer.php | Enforcer.resolvePath | public function resolvePath($type, $subject, $path)
{
$resolve = new Resolve($subject);
$resolvedSet = $resolve->execute($path);
$set = [];
if (is_array($resolvedSet)) {
foreach ($resolvedSet as $item) {
$set[] = $this->getPropertyValue($type, $item);
... | php | public function resolvePath($type, $subject, $path)
{
$resolve = new Resolve($subject);
$resolvedSet = $resolve->execute($path);
$set = [];
if (is_array($resolvedSet)) {
foreach ($resolvedSet as $item) {
$set[] = $this->getPropertyValue($type, $item);
... | [
"public",
"function",
"resolvePath",
"(",
"$",
"type",
",",
"$",
"subject",
",",
"$",
"path",
")",
"{",
"$",
"resolve",
"=",
"new",
"Resolve",
"(",
"$",
"subject",
")",
";",
"$",
"resolvedSet",
"=",
"$",
"resolve",
"->",
"execute",
"(",
"$",
"path",
... | Resolve the provided path using a Resolver object instance
@param string $type The "type" of value to look for (key name)
@param mixed $subject The subject of the search
@param string $path The string path to the data requested (ex: permissions.tests.name)
@return array Set of results | [
"Resolve",
"the",
"provided",
"path",
"using",
"a",
"Resolver",
"object",
"instance"
] | train | https://github.com/psecio/propauth/blob/cb24fcc0a3fa459f2ef40a867c334951aabf7b83/src/Enforcer.php#L151-L165 |
javanile/light-pdf | src/Javanile/LightPDF/classes/gif.php | CGIFLZW.CGIFLZW | function CGIFLZW()
{
$this->MAX_LZW_BITS = 12;
unSet($this->Next);
unSet($this->Vals);
unSet($this->Stack);
unSet($this->Buf);
$this->Next = range(0, (1 << $this->MAX_LZW_BITS) - 1);
$this->Vals = range(0, (1 << $this->MAX_LZW_BITS) - 1);
$this->Stack = range(0, (1 << ($this->MAX_LZW_BIT... | php | function CGIFLZW()
{
$this->MAX_LZW_BITS = 12;
unSet($this->Next);
unSet($this->Vals);
unSet($this->Stack);
unSet($this->Buf);
$this->Next = range(0, (1 << $this->MAX_LZW_BITS) - 1);
$this->Vals = range(0, (1 << $this->MAX_LZW_BITS) - 1);
$this->Stack = range(0, (1 << ($this->MAX_LZW_BIT... | [
"function",
"CGIFLZW",
"(",
")",
"{",
"$",
"this",
"->",
"MAX_LZW_BITS",
"=",
"12",
";",
"unSet",
"(",
"$",
"this",
"->",
"Next",
")",
";",
"unSet",
"(",
"$",
"this",
"->",
"Vals",
")",
";",
"unSet",
"(",
"$",
"this",
"->",
"Stack",
")",
";",
"... | CONSTRUCTOR | [
"CONSTRUCTOR"
] | train | https://github.com/javanile/light-pdf/blob/e89d317b96a28fcdfa050db588477b75cb3b908a/src/Javanile/LightPDF/classes/gif.php#L33-L45 |
javanile/light-pdf | src/Javanile/LightPDF/classes/gif.php | CGIFFILEHEADER.CGIFFILEHEADER | function CGIFFILEHEADER()
{
unSet($this->m_lpVer);
unSet($this->m_nWidth);
unSet($this->m_nHeight);
unSet($this->m_bGlobalClr);
unSet($this->m_nColorRes);
unSet($this->m_bSorted);
unSet($this->m_nTableSize);
unSet($this->m_nBgColor);
unSet($this->m_nPixelRatio);
unSet($this->m_colorTable);
} | php | function CGIFFILEHEADER()
{
unSet($this->m_lpVer);
unSet($this->m_nWidth);
unSet($this->m_nHeight);
unSet($this->m_bGlobalClr);
unSet($this->m_nColorRes);
unSet($this->m_bSorted);
unSet($this->m_nTableSize);
unSet($this->m_nBgColor);
unSet($this->m_nPixelRatio);
unSet($this->m_colorTable);
} | [
"function",
"CGIFFILEHEADER",
"(",
")",
"{",
"unSet",
"(",
"$",
"this",
"->",
"m_lpVer",
")",
";",
"unSet",
"(",
"$",
"this",
"->",
"m_nWidth",
")",
";",
"unSet",
"(",
"$",
"this",
"->",
"m_nHeight",
")",
";",
"unSet",
"(",
"$",
"this",
"->",
"m_bG... | CONSTRUCTOR | [
"CONSTRUCTOR"
] | train | https://github.com/javanile/light-pdf/blob/e89d317b96a28fcdfa050db588477b75cb3b908a/src/Javanile/LightPDF/classes/gif.php#L334-L346 |
javanile/light-pdf | src/Javanile/LightPDF/classes/gif.php | CGIFIMAGEHEADER.CGIFIMAGEHEADER | function CGIFIMAGEHEADER()
{
unSet($this->m_nLeft);
unSet($this->m_nTop);
unSet($this->m_nWidth);
unSet($this->m_nHeight);
unSet($this->m_bLocalClr);
unSet($this->m_bInterlace);
unSet($this->m_bSorted);
unSet($this->m_nTableSize);
unSet($this->m_colorTable);
} | php | function CGIFIMAGEHEADER()
{
unSet($this->m_nLeft);
unSet($this->m_nTop);
unSet($this->m_nWidth);
unSet($this->m_nHeight);
unSet($this->m_bLocalClr);
unSet($this->m_bInterlace);
unSet($this->m_bSorted);
unSet($this->m_nTableSize);
unSet($this->m_colorTable);
} | [
"function",
"CGIFIMAGEHEADER",
"(",
")",
"{",
"unSet",
"(",
"$",
"this",
"->",
"m_nLeft",
")",
";",
"unSet",
"(",
"$",
"this",
"->",
"m_nTop",
")",
";",
"unSet",
"(",
"$",
"this",
"->",
"m_nWidth",
")",
";",
"unSet",
"(",
"$",
"this",
"->",
"m_nHei... | CONSTRUCTOR | [
"CONSTRUCTOR"
] | train | https://github.com/javanile/light-pdf/blob/e89d317b96a28fcdfa050db588477b75cb3b908a/src/Javanile/LightPDF/classes/gif.php#L410-L421 |
javanile/light-pdf | src/Javanile/LightPDF/classes/gif.php | CGIFIMAGE.CGIFIMAGE | function CGIFIMAGE()
{
unSet($this->m_disp);
unSet($this->m_bUser);
unSet($this->m_bTrans);
unSet($this->m_nDelay);
unSet($this->m_nTrans);
unSet($this->m_lpComm);
unSet($this->m_data);
$this->m_gih = new CGIFIMAGEHEADER();
$this->m_lzw = new CGIFLZW();
} | php | function CGIFIMAGE()
{
unSet($this->m_disp);
unSet($this->m_bUser);
unSet($this->m_bTrans);
unSet($this->m_nDelay);
unSet($this->m_nTrans);
unSet($this->m_lpComm);
unSet($this->m_data);
$this->m_gih = new CGIFIMAGEHEADER();
$this->m_lzw = new CGIFLZW();
} | [
"function",
"CGIFIMAGE",
"(",
")",
"{",
"unSet",
"(",
"$",
"this",
"->",
"m_disp",
")",
";",
"unSet",
"(",
"$",
"this",
"->",
"m_bUser",
")",
";",
"unSet",
"(",
"$",
"this",
"->",
"m_bTrans",
")",
";",
"unSet",
"(",
"$",
"this",
"->",
"m_nDelay",
... | ///////////////////////////////////////////////////////////////////////// | [
"/////////////////////////////////////////////////////////////////////////"
] | train | https://github.com/javanile/light-pdf/blob/e89d317b96a28fcdfa050db588477b75cb3b908a/src/Javanile/LightPDF/classes/gif.php#L480-L491 |
javanile/light-pdf | src/Javanile/LightPDF/classes/gif.php | CGIF.CGIF | function CGIF()
{
$this->m_gfh = new CGIFFILEHEADER();
$this->m_img = new CGIFIMAGE();
$this->m_lpData = "";
$this->m_bLoaded = false;
} | php | function CGIF()
{
$this->m_gfh = new CGIFFILEHEADER();
$this->m_img = new CGIFIMAGE();
$this->m_lpData = "";
$this->m_bLoaded = false;
} | [
"function",
"CGIF",
"(",
")",
"{",
"$",
"this",
"->",
"m_gfh",
"=",
"new",
"CGIFFILEHEADER",
"(",
")",
";",
"$",
"this",
"->",
"m_img",
"=",
"new",
"CGIFIMAGE",
"(",
")",
";",
"$",
"this",
"->",
"m_lpData",
"=",
"\"\"",
";",
"$",
"this",
"->",
"m... | CONSTRUCTOR | [
"CONSTRUCTOR"
] | train | https://github.com/javanile/light-pdf/blob/e89d317b96a28fcdfa050db588477b75cb3b908a/src/Javanile/LightPDF/classes/gif.php#L654-L660 |
wpup/digster | src/extensions/class-function-extensions.php | Function_Extensions.call_function | public function call_function() {
$args = func_get_args();
$name = array_shift( $args );
return call_user_func_array( trim( $name ), $args );
} | php | public function call_function() {
$args = func_get_args();
$name = array_shift( $args );
return call_user_func_array( trim( $name ), $args );
} | [
"public",
"function",
"call_function",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"name",
"=",
"array_shift",
"(",
"$",
"args",
")",
";",
"return",
"call_user_func_array",
"(",
"trim",
"(",
"$",
"name",
")",
",",
"$",
"args",... | Call PHP function.
@return mixed | [
"Call",
"PHP",
"function",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/extensions/class-function-extensions.php#L12-L17 |
wpup/digster | src/extensions/class-function-extensions.php | Function_Extensions.call_static | public function call_static() {
$args = func_get_args();
$class = array_shift( $args );
$name = array_shift( $args );
return call_user_func_array( [$class, $name], $args );
} | php | public function call_static() {
$args = func_get_args();
$class = array_shift( $args );
$name = array_shift( $args );
return call_user_func_array( [$class, $name], $args );
} | [
"public",
"function",
"call_static",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"class",
"=",
"array_shift",
"(",
"$",
"args",
")",
";",
"$",
"name",
"=",
"array_shift",
"(",
"$",
"args",
")",
";",
"return",
"call_user_func_a... | Call static method on class.
@return mixed | [
"Call",
"static",
"method",
"on",
"class",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/extensions/class-function-extensions.php#L24-L30 |
wpup/digster | src/extensions/class-function-extensions.php | Function_Extensions.getFunctions | public function getFunctions() {
$callables = [
'__' => '__',
'_n' => '_n',
'action' => 'do_action',
'apply_filters' => 'apply_filters',
'body_class' => 'body_class',
'esc_html__' => 'esc_html__',
'esc_attr__' => 'esc... | php | public function getFunctions() {
$callables = [
'__' => '__',
'_n' => '_n',
'action' => 'do_action',
'apply_filters' => 'apply_filters',
'body_class' => 'body_class',
'esc_html__' => 'esc_html__',
'esc_attr__' => 'esc... | [
"public",
"function",
"getFunctions",
"(",
")",
"{",
"$",
"callables",
"=",
"[",
"'__'",
"=>",
"'__'",
",",
"'_n'",
"=>",
"'_n'",
",",
"'action'",
"=>",
"'do_action'",
",",
"'apply_filters'",
"=>",
"'apply_filters'",
",",
"'body_class'",
"=>",
"'body_class'",
... | Get functions.
@return array | [
"Get",
"functions",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/extensions/class-function-extensions.php#L37-L74 |
cauditor/php-analyzer | src/Utils.php | Utils.getopts | public static function getopts($options)
{
$opts = getopt(implode('', array_keys($options)), $options);
$result = array();
foreach ($options as $short => $long) {
$short = trim($short, ':');
$long = trim($long, ':');
if (isset($opts[$short])) {
... | php | public static function getopts($options)
{
$opts = getopt(implode('', array_keys($options)), $options);
$result = array();
foreach ($options as $short => $long) {
$short = trim($short, ':');
$long = trim($long, ':');
if (isset($opts[$short])) {
... | [
"public",
"static",
"function",
"getopts",
"(",
"$",
"options",
")",
"{",
"$",
"opts",
"=",
"getopt",
"(",
"implode",
"(",
"''",
",",
"array_keys",
"(",
"$",
"options",
")",
")",
",",
"$",
"options",
")",
";",
"$",
"result",
"=",
"array",
"(",
")",... | `getopts` is very convenient, but annoying how one has to check for both
the long & short versions for values; this will always return an array
with the long opt as key, even if the user passed it as short.
@param array $options [short => long]
@return array | [
"getopts",
"is",
"very",
"convenient",
"but",
"annoying",
"how",
"one",
"has",
"to",
"check",
"for",
"both",
"the",
"long",
"&",
"short",
"versions",
"for",
"values",
";",
"this",
"will",
"always",
"return",
"an",
"array",
"with",
"the",
"long",
"opt",
"... | train | https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Utils.php#L21-L38 |
incraigulous/contentful-sdk | src/ManagementResources/IsArchivable.php | IsArchivable.archive | function archive($id)
{
$this->requestDecorator->setId($id . '/archived');
$result = $this->client->put($this->requestDecorator->makeResource(), $this->requestDecorator->makePayload(), $this->requestDecorator->makeHeaders());
$this->refresh();
return $result;
} | php | function archive($id)
{
$this->requestDecorator->setId($id . '/archived');
$result = $this->client->put($this->requestDecorator->makeResource(), $this->requestDecorator->makePayload(), $this->requestDecorator->makeHeaders());
$this->refresh();
return $result;
} | [
"function",
"archive",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"requestDecorator",
"->",
"setId",
"(",
"$",
"id",
".",
"'/archived'",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"client",
"->",
"put",
"(",
"$",
"this",
"->",
"requestDecorat... | Archive a record.
@param $id
@return mixed | [
"Archive",
"a",
"record",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/ManagementResources/IsArchivable.php#L13-L19 |
fostam/php-getopts | src/Config/Option.php | Option.short | public function short($short) {
$this->validated = false;
if (!self::validateShort($short)) {
throw new OptionConfigException('short option must be a single character: ' . $short);
}
$this->config[self::SHORT] = $short;
return $this;
} | php | public function short($short) {
$this->validated = false;
if (!self::validateShort($short)) {
throw new OptionConfigException('short option must be a single character: ' . $short);
}
$this->config[self::SHORT] = $short;
return $this;
} | [
"public",
"function",
"short",
"(",
"$",
"short",
")",
"{",
"$",
"this",
"->",
"validated",
"=",
"false",
";",
"if",
"(",
"!",
"self",
"::",
"validateShort",
"(",
"$",
"short",
")",
")",
"{",
"throw",
"new",
"OptionConfigException",
"(",
"'short option m... | set the option's short name
@param string $short
@return $this | [
"set",
"the",
"option",
"s",
"short",
"name"
] | train | https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Config/Option.php#L50-L57 |
fostam/php-getopts | src/Config/Option.php | Option.long | public function long($long) {
$this->validated = false;
if (!self::validateLong($long)) {
throw new OptionConfigException('invalid long option format: ' . $long);
}
$this->config[self::LONG] = $long;
return $this;
} | php | public function long($long) {
$this->validated = false;
if (!self::validateLong($long)) {
throw new OptionConfigException('invalid long option format: ' . $long);
}
$this->config[self::LONG] = $long;
return $this;
} | [
"public",
"function",
"long",
"(",
"$",
"long",
")",
"{",
"$",
"this",
"->",
"validated",
"=",
"false",
";",
"if",
"(",
"!",
"self",
"::",
"validateLong",
"(",
"$",
"long",
")",
")",
"{",
"throw",
"new",
"OptionConfigException",
"(",
"'invalid long optio... | set the option's long name
@param string $long
@return $this | [
"set",
"the",
"option",
"s",
"long",
"name"
] | train | https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Config/Option.php#L65-L72 |
fostam/php-getopts | src/Config/Option.php | Option.argument | public function argument($name) {
$this->validated = false;
if (!preg_match('#^[a-zA-Z0-9\-\_]+$#', $name)) {
throw new OptionConfigException('illegal characters in name: ' . $name);
}
$this->config[self::ARGUMENT] = $name;
return $this;
} | php | public function argument($name) {
$this->validated = false;
if (!preg_match('#^[a-zA-Z0-9\-\_]+$#', $name)) {
throw new OptionConfigException('illegal characters in name: ' . $name);
}
$this->config[self::ARGUMENT] = $name;
return $this;
} | [
"public",
"function",
"argument",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"validated",
"=",
"false",
";",
"if",
"(",
"!",
"preg_match",
"(",
"'#^[a-zA-Z0-9\\-\\_]+$#'",
",",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"OptionConfigException",
"(",
... | let the option require an argument with the given name
@param string $name
@return $this | [
"let",
"the",
"option",
"require",
"an",
"argument",
"with",
"the",
"given",
"name"
] | train | https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Config/Option.php#L91-L98 |
fostam/php-getopts | src/Config/Option.php | Option.negatable | public function negatable() {
$this->validated = false;
$this->config[self::NEGATABLE] = true;
return $this;
} | php | public function negatable() {
$this->validated = false;
$this->config[self::NEGATABLE] = true;
return $this;
} | [
"public",
"function",
"negatable",
"(",
")",
"{",
"$",
"this",
"->",
"validated",
"=",
"false",
";",
"$",
"this",
"->",
"config",
"[",
"self",
"::",
"NEGATABLE",
"]",
"=",
"true",
";",
"return",
"$",
"this",
";",
"}"
] | allow a negated version of the option (argumentless options only)
@return $this | [
"allow",
"a",
"negated",
"version",
"of",
"the",
"option",
"(",
"argumentless",
"options",
"only",
")"
] | train | https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Config/Option.php#L139-L143 |
fostam/php-getopts | src/Config/Option.php | Option.incrementable | public function incrementable($increment = 1) {
$this->validated = false;
$this->config[self::INCREMENTABLE] = $increment;
return $this;
} | php | public function incrementable($increment = 1) {
$this->validated = false;
$this->config[self::INCREMENTABLE] = $increment;
return $this;
} | [
"public",
"function",
"incrementable",
"(",
"$",
"increment",
"=",
"1",
")",
"{",
"$",
"this",
"->",
"validated",
"=",
"false",
";",
"$",
"this",
"->",
"config",
"[",
"self",
"::",
"INCREMENTABLE",
"]",
"=",
"$",
"increment",
";",
"return",
"$",
"this"... | set the argument to incremental (increased by $increment when given multiple times)
@param int $increment
@return $this | [
"set",
"the",
"argument",
"to",
"incremental",
"(",
"increased",
"by",
"$increment",
"when",
"given",
"multiple",
"times",
")"
] | train | https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Config/Option.php#L151-L155 |
fostam/php-getopts | src/Config/Option.php | Option.get | public function get($param = '') {
$this->validate();
if ($param) {
if (array_key_exists($param, $this->config)) {
return $this->config[$param];
}
else {
throw new OptionConfigException('option param not valid: ' . $param);
... | php | public function get($param = '') {
$this->validate();
if ($param) {
if (array_key_exists($param, $this->config)) {
return $this->config[$param];
}
else {
throw new OptionConfigException('option param not valid: ' . $param);
... | [
"public",
"function",
"get",
"(",
"$",
"param",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"validate",
"(",
")",
";",
"if",
"(",
"$",
"param",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"param",
",",
"$",
"this",
"->",
"config",
")",
")",
... | return full option configuration, or a specific parameter of the configuration
@param string $param
@return mixed | [
"return",
"full",
"option",
"configuration",
"or",
"a",
"specific",
"parameter",
"of",
"the",
"configuration"
] | train | https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Config/Option.php#L174-L187 |
ptlis/conneg | src/Negotiator/Negotiator.php | Negotiator.matchClientPreferences | private function matchClientPreferences($fromField, array $clientPrefList, array $matchingList)
{
foreach ($clientPrefList as $clientPref) {
$matchingList = $this->matchSingleClientPreference($fromField, $clientPref, $matchingList);
}
return $matchingList;
} | php | private function matchClientPreferences($fromField, array $clientPrefList, array $matchingList)
{
foreach ($clientPrefList as $clientPref) {
$matchingList = $this->matchSingleClientPreference($fromField, $clientPref, $matchingList);
}
return $matchingList;
} | [
"private",
"function",
"matchClientPreferences",
"(",
"$",
"fromField",
",",
"array",
"$",
"clientPrefList",
",",
"array",
"$",
"matchingList",
")",
"{",
"foreach",
"(",
"$",
"clientPrefList",
"as",
"$",
"clientPref",
")",
"{",
"$",
"matchingList",
"=",
"$",
... | Match client variants to server variants.
@param string $fromField
@param PreferenceInterface[] $clientPrefList
@param MatchedPreferenceInterface[] $matchingList
@return MatchedPreferenceInterface[] | [
"Match",
"client",
"variants",
"to",
"server",
"variants",
"."
] | train | https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Negotiator/Negotiator.php#L129-L136 |
ptlis/conneg | src/Negotiator/Negotiator.php | Negotiator.matchSingleClientPreference | private function matchSingleClientPreference($fromField, PreferenceInterface $clientPreference, array $matchingList)
{
foreach ($this->matcherList as $matcher) {
if ($matcher->hasMatch($fromField, $matchingList, $clientPreference)) {
$matchingList = $matcher->match($fromField, $m... | php | private function matchSingleClientPreference($fromField, PreferenceInterface $clientPreference, array $matchingList)
{
foreach ($this->matcherList as $matcher) {
if ($matcher->hasMatch($fromField, $matchingList, $clientPreference)) {
$matchingList = $matcher->match($fromField, $m... | [
"private",
"function",
"matchSingleClientPreference",
"(",
"$",
"fromField",
",",
"PreferenceInterface",
"$",
"clientPreference",
",",
"array",
"$",
"matchingList",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"matcherList",
"as",
"$",
"matcher",
")",
"{",
"if",... | Match a single client variant to the server variants.
@param string $fromField
@param PreferenceInterface $clientPreference
@param MatchedPreferenceInterface[] $matchingList
@return MatchedPreferenceInterface[] | [
"Match",
"a",
"single",
"client",
"variant",
"to",
"the",
"server",
"variants",
"."
] | train | https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Negotiator/Negotiator.php#L147-L158 |
myzero1/yii2-theme-layui | src/controllers/Z1UserController.php | Z1UserController.actionIndex | public function actionIndex()
{
$searchModel = new Z1UserSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$pageSize = intval(trim(Yii::$app->request->get('per-page')));
if ($pageSize) {
$dataProvider->pagination->pageSize = $pageSize;
... | php | public function actionIndex()
{
$searchModel = new Z1UserSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$pageSize = intval(trim(Yii::$app->request->get('per-page')));
if ($pageSize) {
$dataProvider->pagination->pageSize = $pageSize;
... | [
"public",
"function",
"actionIndex",
"(",
")",
"{",
"$",
"searchModel",
"=",
"new",
"Z1UserSearch",
"(",
")",
";",
"$",
"dataProvider",
"=",
"$",
"searchModel",
"->",
"search",
"(",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"queryParams",
")",
";",... | Lists all Z1User models.
@return mixed | [
"Lists",
"all",
"Z1User",
"models",
"."
] | train | https://github.com/myzero1/yii2-theme-layui/blob/47e4796b35b8354e50359a489499ee598edd68e1/src/controllers/Z1UserController.php#L44-L59 |
myzero1/yii2-theme-layui | src/controllers/Z1UserController.php | Z1UserController.actionCreate | public function actionCreate()
{
$model = new Z1User();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
Yii::$app->getSession()->setFlash('success', '添加成功');
return \myzero1\layui\helpers\Tool::redirectParent(['index']);
} else {
return ... | php | public function actionCreate()
{
$model = new Z1User();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
Yii::$app->getSession()->setFlash('success', '添加成功');
return \myzero1\layui\helpers\Tool::redirectParent(['index']);
} else {
return ... | [
"public",
"function",
"actionCreate",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"Z1User",
"(",
")",
";",
"if",
"(",
"$",
"model",
"->",
"load",
"(",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"post",
"(",
")",
")",
"&&",
"$",
"model",
"->",
... | Creates a new Z1User model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed | [
"Creates",
"a",
"new",
"Z1User",
"model",
".",
"If",
"creation",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"view",
"page",
"."
] | train | https://github.com/myzero1/yii2-theme-layui/blob/47e4796b35b8354e50359a489499ee598edd68e1/src/controllers/Z1UserController.php#L78-L90 |
myzero1/yii2-theme-layui | src/controllers/Z1UserController.php | Z1UserController.actionUpdate | public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
Yii::$app->getSession()->setFlash('success', '修改成功');
return \myzero1\layui\helpers\Tool::redirectParent(['index']);
} else {
... | php | public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
Yii::$app->getSession()->setFlash('success', '修改成功');
return \myzero1\layui\helpers\Tool::redirectParent(['index']);
} else {
... | [
"public",
"function",
"actionUpdate",
"(",
"$",
"id",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"findModel",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"model",
"->",
"load",
"(",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"post",
"(",
... | Updates an existing Z1User model.
If update is successful, the browser will be redirected to the 'view' page.
@param integer $id
@return mixed | [
"Updates",
"an",
"existing",
"Z1User",
"model",
".",
"If",
"update",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"view",
"page",
"."
] | train | https://github.com/myzero1/yii2-theme-layui/blob/47e4796b35b8354e50359a489499ee598edd68e1/src/controllers/Z1UserController.php#L98-L110 |
myzero1/yii2-theme-layui | src/controllers/Z1UserController.php | Z1UserController.actionDeleteSelected | public function actionDeleteSelected($z1selected)
{
if (empty($z1selected)) {
return 'z1selected 不能为空。';
} else {
Z1User::deleteAll(['id' => explode(',', $z1selected)]);
Yii::$app->getSession()->setFlash('success', '批量删除成功');
return $this->redirect([... | php | public function actionDeleteSelected($z1selected)
{
if (empty($z1selected)) {
return 'z1selected 不能为空。';
} else {
Z1User::deleteAll(['id' => explode(',', $z1selected)]);
Yii::$app->getSession()->setFlash('success', '批量删除成功');
return $this->redirect([... | [
"public",
"function",
"actionDeleteSelected",
"(",
"$",
"z1selected",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"z1selected",
")",
")",
"{",
"return",
"'z1selected 不能为空。';",
"",
"}",
"else",
"{",
"Z1User",
"::",
"deleteAll",
"(",
"[",
"'id'",
"=>",
"explode"... | Deletes an existing Z1User model.
If deletion is successful, the browser will be redirected to the 'index' page.
@param integer $id
@return mixed | [
"Deletes",
"an",
"existing",
"Z1User",
"model",
".",
"If",
"deletion",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"index",
"page",
"."
] | train | https://github.com/myzero1/yii2-theme-layui/blob/47e4796b35b8354e50359a489499ee598edd68e1/src/controllers/Z1UserController.php#L132-L143 |
DanSmith83/laravel5-foundation | src/FoundationFormServiceProvider.php | FoundationFormServiceProvider.registerFormBuilder | protected function registerFormBuilder()
{
$this->app->singleton('form', function($app)
{
$form = new FoundationFiveFormBuilder(
$app['html'],
$app['url'],
$app->make('Illuminate\View\Factory'),
$app['session.store']->getTok... | php | protected function registerFormBuilder()
{
$this->app->singleton('form', function($app)
{
$form = new FoundationFiveFormBuilder(
$app['html'],
$app['url'],
$app->make('Illuminate\View\Factory'),
$app['session.store']->getTok... | [
"protected",
"function",
"registerFormBuilder",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'form'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"form",
"=",
"new",
"FoundationFiveFormBuilder",
"(",
"$",
"app",
"[",
"'html'",
"... | Register the form builder instance.
@return void | [
"Register",
"the",
"form",
"builder",
"instance",
"."
] | train | https://github.com/DanSmith83/laravel5-foundation/blob/69d37d885accec6d6186ce0be4e4e0b784ae7505/src/FoundationFormServiceProvider.php#L23-L37 |
reinvanoyen/aegis | lib/Aegis/Compiler.php | Compiler.compile | public function compile(Node $node) : string
{
$this->head = $this->body = '';
$node->compile($this);
return $this->getResult();
} | php | public function compile(Node $node) : string
{
$this->head = $this->body = '';
$node->compile($this);
return $this->getResult();
} | [
"public",
"function",
"compile",
"(",
"Node",
"$",
"node",
")",
":",
"string",
"{",
"$",
"this",
"->",
"head",
"=",
"$",
"this",
"->",
"body",
"=",
"''",
";",
"$",
"node",
"->",
"compile",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
"->",
... | Compiles a node into a string
@param Node $node
@return string | [
"Compiles",
"a",
"node",
"into",
"a",
"string"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Compiler.php#L28-L33 |
dphn/ScContent | src/ScContent/Entity/Back/WidgetConfig.php | WidgetConfig.setRoles | public function setRoles($roles)
{
$widget = $this->widget;
$newRoles = [];
foreach ($this->availableRoles as $role) {
$newRoles[$role] = in_array($role, $roles);
}
$widget->setOption('roles', $newRoles);
} | php | public function setRoles($roles)
{
$widget = $this->widget;
$newRoles = [];
foreach ($this->availableRoles as $role) {
$newRoles[$role] = in_array($role, $roles);
}
$widget->setOption('roles', $newRoles);
} | [
"public",
"function",
"setRoles",
"(",
"$",
"roles",
")",
"{",
"$",
"widget",
"=",
"$",
"this",
"->",
"widget",
";",
"$",
"newRoles",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"availableRoles",
"as",
"$",
"role",
")",
"{",
"$",
"newRol... | This data comes from the form. It is the applicable roles list.
@param string[] $roles
@return void | [
"This",
"data",
"comes",
"from",
"the",
"form",
".",
"It",
"is",
"the",
"applicable",
"roles",
"list",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Entity/Back/WidgetConfig.php#L85-L93 |
dphn/ScContent | src/ScContent/Entity/Back/WidgetConfig.php | WidgetConfig.findApplicableRoles | public function findApplicableRoles()
{
$widget = $this->widget;
$array = [];
foreach ($this->availableRoles as $role) {
if ($widget->isApplicable($role)) {
$array[] = $role;
}
}
return $array;
} | php | public function findApplicableRoles()
{
$widget = $this->widget;
$array = [];
foreach ($this->availableRoles as $role) {
if ($widget->isApplicable($role)) {
$array[] = $role;
}
}
return $array;
} | [
"public",
"function",
"findApplicableRoles",
"(",
")",
"{",
"$",
"widget",
"=",
"$",
"this",
"->",
"widget",
";",
"$",
"array",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"availableRoles",
"as",
"$",
"role",
")",
"{",
"if",
"(",
"$",
"w... | Find applicable roles.
@return string[] | [
"Find",
"applicable",
"roles",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Entity/Back/WidgetConfig.php#L110-L120 |
serverdensity/sd-php-wrapper | lib/serverdensity/Api/Tags.php | Tags.find | public function find($name)
{
$tags = $this->all();
$found = array();
foreach ($tags as $tag){
if ($tag['name'] === $name){
$found = $tag;
break;
}
}
return $found;
} | php | public function find($name)
{
$tags = $this->all();
$found = array();
foreach ($tags as $tag){
if ($tag['name'] === $name){
$found = $tag;
break;
}
}
return $found;
} | [
"public",
"function",
"find",
"(",
"$",
"name",
")",
"{",
"$",
"tags",
"=",
"$",
"this",
"->",
"all",
"(",
")",
";",
"$",
"found",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"tags",
"as",
"$",
"tag",
")",
"{",
"if",
"(",
"$",
"tag",
... | Find a tag by name
@param string $name of the tag
@return an array of the tag in question or an empty array if not found | [
"Find",
"a",
"tag",
"by",
"name"
] | train | https://github.com/serverdensity/sd-php-wrapper/blob/9c742a9ee61e32a9bc4ed17b5fe0eca1f4c3015e/lib/serverdensity/Api/Tags.php#L49-L61 |
serverdensity/sd-php-wrapper | lib/serverdensity/Api/Tags.php | Tags.findAll | public function findAll(array $names)
{
$tags = $this->all();
$transformTags = function($array) {
$newArray = array();
foreach($array as $entry){
$newArray[$entry['name']] = $entry;
}
return $newArray;
};... | php | public function findAll(array $names)
{
$tags = $this->all();
$transformTags = function($array) {
$newArray = array();
foreach($array as $entry){
$newArray[$entry['name']] = $entry;
}
return $newArray;
};... | [
"public",
"function",
"findAll",
"(",
"array",
"$",
"names",
")",
"{",
"$",
"tags",
"=",
"$",
"this",
"->",
"all",
"(",
")",
";",
"$",
"transformTags",
"=",
"function",
"(",
"$",
"array",
")",
"{",
"$",
"newArray",
"=",
"array",
"(",
")",
";",
"f... | Find all tags by name
@param array names tag names in an array
@return an array of array objects. | [
"Find",
"all",
"tags",
"by",
"name"
] | train | https://github.com/serverdensity/sd-php-wrapper/blob/9c742a9ee61e32a9bc4ed17b5fe0eca1f4c3015e/lib/serverdensity/Api/Tags.php#L68-L91 |
serverdensity/sd-php-wrapper | lib/serverdensity/Api/Tags.php | Tags.format | public function format($tags, $type)
{
$formattedTags = array();
if ($type === 'user'){
$formattedTags['tags'] = array();
foreach($tags as $tag){
$formattedTags['tags'][$tag['_id']] = array(
'mode' => 'readWrite'
);
... | php | public function format($tags, $type)
{
$formattedTags = array();
if ($type === 'user'){
$formattedTags['tags'] = array();
foreach($tags as $tag){
$formattedTags['tags'][$tag['_id']] = array(
'mode' => 'readWrite'
);
... | [
"public",
"function",
"format",
"(",
"$",
"tags",
",",
"$",
"type",
")",
"{",
"$",
"formattedTags",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"type",
"===",
"'user'",
")",
"{",
"$",
"formattedTags",
"[",
"'tags'",
"]",
"=",
"array",
"(",
")",
... | Format tags to be inserted
@param array tags an array of tags
@param string type either user or other
@return formatted tags | [
"Format",
"tags",
"to",
"be",
"inserted"
] | train | https://github.com/serverdensity/sd-php-wrapper/blob/9c742a9ee61e32a9bc4ed17b5fe0eca1f4c3015e/lib/serverdensity/Api/Tags.php#L99-L118 |
serverdensity/sd-php-wrapper | lib/serverdensity/Api/Tags.php | Tags.create | public function create($name, $hexColor = null)
{
if (empty($hexColor)){
# generates random hexcode.
$hexColor = "#".substr(md5(rand()), 0, 6);
}
$fields = array(
"name" => $name,
"color" => $hexColor
);
return $this->post('inve... | php | public function create($name, $hexColor = null)
{
if (empty($hexColor)){
# generates random hexcode.
$hexColor = "#".substr(md5(rand()), 0, 6);
}
$fields = array(
"name" => $name,
"color" => $hexColor
);
return $this->post('inve... | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"hexColor",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"hexColor",
")",
")",
"{",
"# generates random hexcode.",
"$",
"hexColor",
"=",
"\"#\"",
".",
"substr",
"(",
"md5",
"(",
"rand"... | Create a tag
@link https://developer.serverdensity.com/docs/tags
@param string $name name of tag
@param string $hexColor hexcolor of tag
@return an array with the fields of the tag that got created | [
"Create",
"a",
"tag"
] | train | https://github.com/serverdensity/sd-php-wrapper/blob/9c742a9ee61e32a9bc4ed17b5fe0eca1f4c3015e/lib/serverdensity/Api/Tags.php#L127-L138 |
incraigulous/contentful-sdk | src/PayloadBuilders/EntryField.php | EntryField.addLanguage | function addLanguage($languageKey, $content) {
//If the langage exists and it's an array, add to it instead of replacing it.
if (is_array($this->getLanguage($languageKey))) {
$this->languages[$languageKey][] = $content[0];
return;
}
$this->languages[$languageKey] ... | php | function addLanguage($languageKey, $content) {
//If the langage exists and it's an array, add to it instead of replacing it.
if (is_array($this->getLanguage($languageKey))) {
$this->languages[$languageKey][] = $content[0];
return;
}
$this->languages[$languageKey] ... | [
"function",
"addLanguage",
"(",
"$",
"languageKey",
",",
"$",
"content",
")",
"{",
"//If the langage exists and it's an array, add to it instead of replacing it.",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"getLanguage",
"(",
"$",
"languageKey",
")",
")",
")",
... | Add a language to the field.
@param $languageKey
@param $content
@return $this | [
"Add",
"a",
"language",
"to",
"the",
"field",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/PayloadBuilders/EntryField.php#L31-L39 |
incraigulous/contentful-sdk | src/PayloadBuilders/EntryField.php | EntryField.addMultiLink | function addMultiLink($id, $linkType = 'Entry', $languageKey = null) {
if (!$languageKey) {
$languageKey = $this->language;
}
$this->links[$languageKey][] = ['sys' => [
'type' => 'Link',
'linkType' => $linkType,
'id' => $id
... | php | function addMultiLink($id, $linkType = 'Entry', $languageKey = null) {
if (!$languageKey) {
$languageKey = $this->language;
}
$this->links[$languageKey][] = ['sys' => [
'type' => 'Link',
'linkType' => $linkType,
'id' => $id
... | [
"function",
"addMultiLink",
"(",
"$",
"id",
",",
"$",
"linkType",
"=",
"'Entry'",
",",
"$",
"languageKey",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"languageKey",
")",
"{",
"$",
"languageKey",
"=",
"$",
"this",
"->",
"language",
";",
"}",
"$",
"... | Create relationships to a list of resources.
@param $id
@param string $linkType
@param null $languageKey
@return $this | [
"Create",
"relationships",
"to",
"a",
"list",
"of",
"resources",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/PayloadBuilders/EntryField.php#L52-L63 |
incraigulous/contentful-sdk | src/PayloadBuilders/EntryField.php | EntryField.addLink | function addLink($id, $linkType = 'Entry', $languageKey = null) {
if (!$languageKey) {
$languageKey = $this->language;
}
$this->link[$languageKey] = ['sys' => [
'type' => 'Link',
'linkType' => $linkType,
'id' => $id
]
];
ret... | php | function addLink($id, $linkType = 'Entry', $languageKey = null) {
if (!$languageKey) {
$languageKey = $this->language;
}
$this->link[$languageKey] = ['sys' => [
'type' => 'Link',
'linkType' => $linkType,
'id' => $id
]
];
ret... | [
"function",
"addLink",
"(",
"$",
"id",
",",
"$",
"linkType",
"=",
"'Entry'",
",",
"$",
"languageKey",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"languageKey",
")",
"{",
"$",
"languageKey",
"=",
"$",
"this",
"->",
"language",
";",
"}",
"$",
"this"... | Create relationships to a list of resources.
@param $id
@param string $linkType
@param null $languageKey
@return $this | [
"Create",
"relationships",
"to",
"a",
"list",
"of",
"resources",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/PayloadBuilders/EntryField.php#L72-L83 |
incraigulous/contentful-sdk | src/PayloadBuilders/EntryField.php | EntryField.parseContent | protected function parseContent($content) {
if(is_bool($content)) {
$this->addLanguage($this->language, $content);
return;
}
if (!$content) {
return;
}
if (is_string($content)) {
$this->addLanguage($this->language, $content);
... | php | protected function parseContent($content) {
if(is_bool($content)) {
$this->addLanguage($this->language, $content);
return;
}
if (!$content) {
return;
}
if (is_string($content)) {
$this->addLanguage($this->language, $content);
... | [
"protected",
"function",
"parseContent",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"content",
")",
")",
"{",
"$",
"this",
"->",
"addLanguage",
"(",
"$",
"this",
"->",
"language",
",",
"$",
"content",
")",
";",
"return",
";",
"}",... | Parse loaded content. Tests to see if it's a link or if languages are provided and handle appropriately.
@param $content | [
"Parse",
"loaded",
"content",
".",
"Tests",
"to",
"see",
"if",
"it",
"s",
"a",
"link",
"or",
"if",
"languages",
"are",
"provided",
"and",
"handle",
"appropriately",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/PayloadBuilders/EntryField.php#L89-L114 |
incraigulous/contentful-sdk | src/PayloadBuilders/EntryField.php | EntryField.make | function make()
{
if ($this->links) {
return $this->links;
} elseif ($this->link) {
return $this->link;
}
return $this->languages;
} | php | function make()
{
if ($this->links) {
return $this->links;
} elseif ($this->link) {
return $this->link;
}
return $this->languages;
} | [
"function",
"make",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"links",
")",
"{",
"return",
"$",
"this",
"->",
"links",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"link",
")",
"{",
"return",
"$",
"this",
"->",
"link",
";",
"}",
"return",
"$"... | Return the payload builder array part. If links are provided, return them instead of languages.
@return array | [
"Return",
"the",
"payload",
"builder",
"array",
"part",
".",
"If",
"links",
"are",
"provided",
"return",
"them",
"instead",
"of",
"languages",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/PayloadBuilders/EntryField.php#L119-L127 |
euro-ix/ixf-client-php | lib/IXF/Util.php | Util.isList | public static function isList($array)
{
if( !is_array( $array ) )
return false;
// using Stripe's library as a base for this was a cluster fuck of an idea.
// why? figure this out:
$keys = array_keys( $array );
foreach( array_keys( $array ) as $i )
if... | php | public static function isList($array)
{
if( !is_array( $array ) )
return false;
// using Stripe's library as a base for this was a cluster fuck of an idea.
// why? figure this out:
$keys = array_keys( $array );
foreach( array_keys( $array ) as $i )
if... | [
"public",
"static",
"function",
"isList",
"(",
"$",
"array",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"array",
")",
")",
"return",
"false",
";",
"// using Stripe's library as a base for this was a cluster fuck of an idea.",
"// why? figure this out:",
"$",
"key... | Whether the provided array (or other) is a list rather than a dictionary.
@param array|mixed $array
@return boolean True if the given object is a list. | [
"Whether",
"the",
"provided",
"array",
"(",
"or",
"other",
")",
"is",
"a",
"list",
"rather",
"than",
"a",
"dictionary",
"."
] | train | https://github.com/euro-ix/ixf-client-php/blob/dd39f5c17dc2d3795fcacf5d06793ca28886f3c1/lib/IXF/Util.php#L22-L35 |
euro-ix/ixf-client-php | lib/IXF/Util.php | Util.convertIxfObjectToArray | public static function convertIxfObjectToArray($values)
{
$results = array();
foreach ($values as $k => $v)
{
// FIXME: this is an encapsulation violation
if ($k[0] == '_') {
continue;
}
if ($v instanceof Object) {
... | php | public static function convertIxfObjectToArray($values)
{
$results = array();
foreach ($values as $k => $v)
{
// FIXME: this is an encapsulation violation
if ($k[0] == '_') {
continue;
}
if ($v instanceof Object) {
... | [
"public",
"static",
"function",
"convertIxfObjectToArray",
"(",
"$",
"values",
")",
"{",
"$",
"results",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"values",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"// FIXME: this is an encapsulation violation",
"if... | Recursively converts the PHP IXF object to an array.
@param array $values The PHP IXF object to convert.
@return array | [
"Recursively",
"converts",
"the",
"PHP",
"IXF",
"object",
"to",
"an",
"array",
"."
] | train | https://github.com/euro-ix/ixf-client-php/blob/dd39f5c17dc2d3795fcacf5d06793ca28886f3c1/lib/IXF/Util.php#L43-L62 |
euro-ix/ixf-client-php | lib/IXF/Util.php | Util.convertToIxfObject | public static function convertToIxfObject($resp)
{
if( self::isList( $resp ) )
{
$mapped = array();
foreach( $resp as $k => $i )
array_push( $mapped, self::convertToIxfObject($i) );
return $mapped;
}
elseif( is_array( $resp ) )
... | php | public static function convertToIxfObject($resp)
{
if( self::isList( $resp ) )
{
$mapped = array();
foreach( $resp as $k => $i )
array_push( $mapped, self::convertToIxfObject($i) );
return $mapped;
}
elseif( is_array( $resp ) )
... | [
"public",
"static",
"function",
"convertToIxfObject",
"(",
"$",
"resp",
")",
"{",
"if",
"(",
"self",
"::",
"isList",
"(",
"$",
"resp",
")",
")",
"{",
"$",
"mapped",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"resp",
"as",
"$",
"k",
"=>",
"... | Converts a response from the IXF API to the corresponding PHP object.
@param array $resp The response from the IXF API.
@return Object|array | [
"Converts",
"a",
"response",
"from",
"the",
"IXF",
"API",
"to",
"the",
"corresponding",
"PHP",
"object",
"."
] | train | https://github.com/euro-ix/ixf-client-php/blob/dd39f5c17dc2d3795fcacf5d06793ca28886f3c1/lib/IXF/Util.php#L70-L92 |
skeeks-semenov/yii2-dadata-suggest-api | helpers/SuggestAddressModel.php | SuggestAddressModel.getUnrestrictedValue | public function getUnrestrictedValue()
{
if ($this->unrestricted_value)
{
return $this->unrestricted_value;
}
//Оно может быть не сохранено если определяли по ip
$result = [];
$result[] = ArrayHelper::getValue($this->data, 'region_with_type');
$r... | php | public function getUnrestrictedValue()
{
if ($this->unrestricted_value)
{
return $this->unrestricted_value;
}
//Оно может быть не сохранено если определяли по ip
$result = [];
$result[] = ArrayHelper::getValue($this->data, 'region_with_type');
$r... | [
"public",
"function",
"getUnrestrictedValue",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"unrestricted_value",
")",
"{",
"return",
"$",
"this",
"->",
"unrestricted_value",
";",
"}",
"//Оно может быть не сохранено если определяли по ip",
"$",
"result",
"=",
"[",
... | Полный адрес одной строкой
@return string Адрес одной строкой (полный, от региона) | [
"Полный",
"адрес",
"одной",
"строкой"
] | train | https://github.com/skeeks-semenov/yii2-dadata-suggest-api/blob/9ff6e7af54344d059dce0ed08797880142d0ff6b/helpers/SuggestAddressModel.php#L125-L152 |
skeeks-semenov/yii2-dadata-suggest-api | helpers/SuggestAddressModel.php | SuggestAddressModel.getRegionString | public function getRegionString()
{
//Оно может быть не сохранено если определяли по ip
$result = [];
$result[] = ArrayHelper::getValue($this->data, 'region_with_type');
$result[] = ArrayHelper::getValue($this->data, 'area_with_type');
$result[] = ArrayHelper::getValue($this... | php | public function getRegionString()
{
//Оно может быть не сохранено если определяли по ip
$result = [];
$result[] = ArrayHelper::getValue($this->data, 'region_with_type');
$result[] = ArrayHelper::getValue($this->data, 'area_with_type');
$result[] = ArrayHelper::getValue($this... | [
"public",
"function",
"getRegionString",
"(",
")",
"{",
"//Оно может быть не сохранено если определяли по ip",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"result",
"[",
"]",
"=",
"ArrayHelper",
"::",
"getValue",
"(",
"$",
"this",
"->",
"data",
",",
"'region_with_ty... | Строка региона, без адреса
Регион, район, город, поселение
@return string | [
"Строка",
"региона",
"без",
"адреса",
"Регион",
"район",
"город",
"поселение"
] | train | https://github.com/skeeks-semenov/yii2-dadata-suggest-api/blob/9ff6e7af54344d059dce0ed08797880142d0ff6b/helpers/SuggestAddressModel.php#L168-L189 |
skeeks-semenov/yii2-dadata-suggest-api | helpers/SuggestAddressModel.php | SuggestAddressModel.getShortAddressString | public function getShortAddressString()
{
//Оно может быть не сохранено если определяли по ip
$result = [];
$result[] = ArrayHelper::getValue($this->data, 'street_with_type');
if (ArrayHelper::getValue($this->data, 'house'))
{
$result[] = ArrayHelper::getValue($... | php | public function getShortAddressString()
{
//Оно может быть не сохранено если определяли по ip
$result = [];
$result[] = ArrayHelper::getValue($this->data, 'street_with_type');
if (ArrayHelper::getValue($this->data, 'house'))
{
$result[] = ArrayHelper::getValue($... | [
"public",
"function",
"getShortAddressString",
"(",
")",
"{",
"//Оно может быть не сохранено если определяли по ip",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"result",
"[",
"]",
"=",
"ArrayHelper",
"::",
"getValue",
"(",
"$",
"this",
"->",
"data",
",",
"'street_w... | Короткий адрес, без города
Улица, дом, квартира
@return string | [
"Короткий",
"адрес",
"без",
"города",
"Улица",
"дом",
"квартира"
] | train | https://github.com/skeeks-semenov/yii2-dadata-suggest-api/blob/9ff6e7af54344d059dce0ed08797880142d0ff6b/helpers/SuggestAddressModel.php#L226-L253 |
yosmanyga/validation | src/Yosmanyga/Validation/Resource/Compiler/ExpressionCompiler.php | ExpressionCompiler.compile | public function compile($definition)
{
$validator = $this->createValidator($definition);
$validator->validate($definition);
$options = $definition->export();
$expression = $options['expression'];
unset($options['expression']);
return new ExpressionPropertyValidator(... | php | public function compile($definition)
{
$validator = $this->createValidator($definition);
$validator->validate($definition);
$options = $definition->export();
$expression = $options['expression'];
unset($options['expression']);
return new ExpressionPropertyValidator(... | [
"public",
"function",
"compile",
"(",
"$",
"definition",
")",
"{",
"$",
"validator",
"=",
"$",
"this",
"->",
"createValidator",
"(",
"$",
"definition",
")",
";",
"$",
"validator",
"->",
"validate",
"(",
"$",
"definition",
")",
";",
"$",
"options",
"=",
... | @param \Yosmanyga\Validation\Resource\Definition\ExpressionDefinition $definition
@return \Yosmanyga\Validation\Validator\ExpressionPropertyValidator | [
"@param",
"\\",
"Yosmanyga",
"\\",
"Validation",
"\\",
"Resource",
"\\",
"Definition",
"\\",
"ExpressionDefinition",
"$definition"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Resource/Compiler/ExpressionCompiler.php#L29-L39 |
ptlis/conneg | src/Negotiator/Matcher/SubtypeWildcardMatcher.php | SubtypeWildcardMatcher.getMatchingIndexes | private function getMatchingIndexes(array $matchingList, PreferenceInterface $clientPref)
{
$matchingIndexList = array();
foreach ($matchingList as $key => $matching) {
$serverPref = $matching->getServerPreference();
list($clientMimeType) = explode('/', $clientPref->getVaria... | php | private function getMatchingIndexes(array $matchingList, PreferenceInterface $clientPref)
{
$matchingIndexList = array();
foreach ($matchingList as $key => $matching) {
$serverPref = $matching->getServerPreference();
list($clientMimeType) = explode('/', $clientPref->getVaria... | [
"private",
"function",
"getMatchingIndexes",
"(",
"array",
"$",
"matchingList",
",",
"PreferenceInterface",
"$",
"clientPref",
")",
"{",
"$",
"matchingIndexList",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"matchingList",
"as",
"$",
"key",
"=>",
"$",
... | Returns an array of indexes for of matches of higher precedence than the existing pairing.
@param MatchedPreferenceInterface[] $matchingList
@param PreferenceInterface $clientPref
@return int[] | [
"Returns",
"an",
"array",
"of",
"indexes",
"for",
"of",
"matches",
"of",
"higher",
"precedence",
"than",
"the",
"existing",
"pairing",
"."
] | train | https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Negotiator/Matcher/SubtypeWildcardMatcher.php#L56-L72 |
ipunkt/social-auth | src/Ipunkt/SocialAuth/SocialAuthObject.php | SocialAuthObject.getProviders | public function getProviders() {
$hybridAuthProviders = $this->hybridAuth->getProviders();
$providerList = [];
foreach($hybridAuthProviders as $providerName => $config)
$providerList[] = $providerName;
$providers = $this->makeProviders($providerList);
return $providers;
} | php | public function getProviders() {
$hybridAuthProviders = $this->hybridAuth->getProviders();
$providerList = [];
foreach($hybridAuthProviders as $providerName => $config)
$providerList[] = $providerName;
$providers = $this->makeProviders($providerList);
return $providers;
} | [
"public",
"function",
"getProviders",
"(",
")",
"{",
"$",
"hybridAuthProviders",
"=",
"$",
"this",
"->",
"hybridAuth",
"->",
"getProviders",
"(",
")",
";",
"$",
"providerList",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"hybridAuthProviders",
"as",
"$",
"pro... | Returns all enabled provider from the config
@return ProviderInterface[] | [
"Returns",
"all",
"enabled",
"provider",
"from",
"the",
"config"
] | train | https://github.com/ipunkt/social-auth/blob/28723a8e449612789a2cd7d21137996c48b62229/src/Ipunkt/SocialAuth/SocialAuthObject.php#L77-L86 |
ipunkt/social-auth | src/Ipunkt/SocialAuth/SocialAuthObject.php | SocialAuthObject.getConnectedProviders | public function getConnectedProviders() {
$hybridAuthProviders = $this->hybridAuth->getConnectedProviders();
$providers = $this->makeProviders($hybridAuthProviders);
return $providers;
} | php | public function getConnectedProviders() {
$hybridAuthProviders = $this->hybridAuth->getConnectedProviders();
$providers = $this->makeProviders($hybridAuthProviders);
return $providers;
} | [
"public",
"function",
"getConnectedProviders",
"(",
")",
"{",
"$",
"hybridAuthProviders",
"=",
"$",
"this",
"->",
"hybridAuth",
"->",
"getConnectedProviders",
"(",
")",
";",
"$",
"providers",
"=",
"$",
"this",
"->",
"makeProviders",
"(",
"$",
"hybridAuthProvider... | Returns only currently connected providers
@return mixed | [
"Returns",
"only",
"currently",
"connected",
"providers"
] | train | https://github.com/ipunkt/social-auth/blob/28723a8e449612789a2cd7d21137996c48b62229/src/Ipunkt/SocialAuth/SocialAuthObject.php#L93-L99 |
granulephp/util | lib/Collection/MutableArrayCollection.php | MutableArrayCollection.add | public function add($element): bool {
$this->validateElement($element);
if ($this->contains($element)) {
return false;
}
$this->elements[] = $element;
return true;
} | php | public function add($element): bool {
$this->validateElement($element);
if ($this->contains($element)) {
return false;
}
$this->elements[] = $element;
return true;
} | [
"public",
"function",
"add",
"(",
"$",
"element",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"validateElement",
"(",
"$",
"element",
")",
";",
"if",
"(",
"$",
"this",
"->",
"contains",
"(",
"$",
"element",
")",
")",
"{",
"return",
"false",
";",
"}",... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Collection/MutableArrayCollection.php#L33-L41 |
granulephp/util | lib/Collection/MutableArrayCollection.php | MutableArrayCollection.addAll | public function addAll(Collection $collection): bool {
$changed = false;
foreach ($collection as $item) {
if ($this->add($item)) {
$changed = true;
}
}
return $changed;
} | php | public function addAll(Collection $collection): bool {
$changed = false;
foreach ($collection as $item) {
if ($this->add($item)) {
$changed = true;
}
}
return $changed;
} | [
"public",
"function",
"addAll",
"(",
"Collection",
"$",
"collection",
")",
":",
"bool",
"{",
"$",
"changed",
"=",
"false",
";",
"foreach",
"(",
"$",
"collection",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"add",
"(",
"$",
"item",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Collection/MutableArrayCollection.php#L44-L53 |
granulephp/util | lib/Collection/MutableArrayCollection.php | MutableArrayCollection.remove | public function remove($element): bool {
$index = $this->indexOf($element);
if ($index !== null) {
unset($this->elements[$index]);
return true;
}
return false;
} | php | public function remove($element): bool {
$index = $this->indexOf($element);
if ($index !== null) {
unset($this->elements[$index]);
return true;
}
return false;
} | [
"public",
"function",
"remove",
"(",
"$",
"element",
")",
":",
"bool",
"{",
"$",
"index",
"=",
"$",
"this",
"->",
"indexOf",
"(",
"$",
"element",
")",
";",
"if",
"(",
"$",
"index",
"!==",
"null",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"elemen... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Collection/MutableArrayCollection.php#L61-L70 |
granulephp/util | lib/Collection/MutableArrayCollection.php | MutableArrayCollection.removeAll | public function removeAll(Collection $collection): bool {
$changed = false;
foreach ($collection as $element) {
if ($this->remove($element)) {
$changed = true;
}
}
return $changed;
} | php | public function removeAll(Collection $collection): bool {
$changed = false;
foreach ($collection as $element) {
if ($this->remove($element)) {
$changed = true;
}
}
return $changed;
} | [
"public",
"function",
"removeAll",
"(",
"Collection",
"$",
"collection",
")",
":",
"bool",
"{",
"$",
"changed",
"=",
"false",
";",
"foreach",
"(",
"$",
"collection",
"as",
"$",
"element",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"remove",
"(",
"$",
"e... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Collection/MutableArrayCollection.php#L73-L82 |
granulephp/util | lib/Collection/MutableArrayCollection.php | MutableArrayCollection.removeIf | public function removeIf(callable $filter): bool {
$count = count($this->elements);
$this->elements = array_filter($this->elements, function ($v, $k) use ($filter) {
return !$filter($v, $k);
}, ARRAY_FILTER_USE_BOTH);
return $count !== count($this->elements);
} | php | public function removeIf(callable $filter): bool {
$count = count($this->elements);
$this->elements = array_filter($this->elements, function ($v, $k) use ($filter) {
return !$filter($v, $k);
}, ARRAY_FILTER_USE_BOTH);
return $count !== count($this->elements);
} | [
"public",
"function",
"removeIf",
"(",
"callable",
"$",
"filter",
")",
":",
"bool",
"{",
"$",
"count",
"=",
"count",
"(",
"$",
"this",
"->",
"elements",
")",
";",
"$",
"this",
"->",
"elements",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"elements",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Collection/MutableArrayCollection.php#L85-L92 |
granulephp/util | lib/Collection/MutableArrayCollection.php | MutableArrayCollection.retainAll | public function retainAll(Collection $collection): bool {
$changed = false;
$retained = $collection->toArray();
foreach ($this->elements as $key => $element) {
if (!in_array($element, $retained)) {
unset($this->elements[$key]);
$changed = true;
... | php | public function retainAll(Collection $collection): bool {
$changed = false;
$retained = $collection->toArray();
foreach ($this->elements as $key => $element) {
if (!in_array($element, $retained)) {
unset($this->elements[$key]);
$changed = true;
... | [
"public",
"function",
"retainAll",
"(",
"Collection",
"$",
"collection",
")",
":",
"bool",
"{",
"$",
"changed",
"=",
"false",
";",
"$",
"retained",
"=",
"$",
"collection",
"->",
"toArray",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"elements",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Collection/MutableArrayCollection.php#L95-L107 |
granulephp/util | lib/Collection/MutableArrayCollection.php | MutableArrayCollection.offsetSet | public function offsetSet($offset, $value): void {
if ($offset === null) {
$this->add($value);
} else {
throw new \BadMethodCallException('Unable to set collection by index');
}
} | php | public function offsetSet($offset, $value): void {
if ($offset === null) {
$this->add($value);
} else {
throw new \BadMethodCallException('Unable to set collection by index');
}
} | [
"public",
"function",
"offsetSet",
"(",
"$",
"offset",
",",
"$",
"value",
")",
":",
"void",
"{",
"if",
"(",
"$",
"offset",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"add",
"(",
"$",
"value",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Collection/MutableArrayCollection.php#L110-L116 |
granulephp/util | lib/Collection/MutableArrayCollection.php | MutableArrayCollection.offsetUnset | public function offsetUnset($offset): void {
if (!is_integer($offset)) {
throw new \TypeError(
sprintf('Expected integer type, provided: %s', gettype($offset))
);
}
unset($this->elements[$offset]);
} | php | public function offsetUnset($offset): void {
if (!is_integer($offset)) {
throw new \TypeError(
sprintf('Expected integer type, provided: %s', gettype($offset))
);
}
unset($this->elements[$offset]);
} | [
"public",
"function",
"offsetUnset",
"(",
"$",
"offset",
")",
":",
"void",
"{",
"if",
"(",
"!",
"is_integer",
"(",
"$",
"offset",
")",
")",
"{",
"throw",
"new",
"\\",
"TypeError",
"(",
"sprintf",
"(",
"'Expected integer type, provided: %s'",
",",
"gettype",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Collection/MutableArrayCollection.php#L119-L127 |
mimmi20/Wurfl | src/Handlers/Utils.php | Utils.reset | public static function reset()
{
self::$isDesktopBrowser = null;
self::$isMobileBrowser = null;
self::$isSmartTv = null;
self::$isRobot = null;
} | php | public static function reset()
{
self::$isDesktopBrowser = null;
self::$isMobileBrowser = null;
self::$isSmartTv = null;
self::$isRobot = null;
} | [
"public",
"static",
"function",
"reset",
"(",
")",
"{",
"self",
"::",
"$",
"isDesktopBrowser",
"=",
"null",
";",
"self",
"::",
"$",
"isMobileBrowser",
"=",
"null",
";",
"self",
"::",
"$",
"isSmartTv",
"=",
"null",
";",
"self",
"::",
"$",
"isRobot",
"="... | Resets cached detection variables for performance | [
"Resets",
"cached",
"detection",
"variables",
"for",
"performance"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Utils.php#L197-L203 |
mimmi20/Wurfl | src/Handlers/Utils.php | Utils.risMatch | public static function risMatch($collection, $needle, $tolerance)
{
return Matcher\RISMatcher::getInstance()->match($collection, $needle, $tolerance);
} | php | public static function risMatch($collection, $needle, $tolerance)
{
return Matcher\RISMatcher::getInstance()->match($collection, $needle, $tolerance);
} | [
"public",
"static",
"function",
"risMatch",
"(",
"$",
"collection",
",",
"$",
"needle",
",",
"$",
"tolerance",
")",
"{",
"return",
"Matcher",
"\\",
"RISMatcher",
"::",
"getInstance",
"(",
")",
"->",
"match",
"(",
"$",
"collection",
",",
"$",
"needle",
",... | Alias of \Wurfl\Handlers\Matcher\RISMatcher::match()
@param array $collection
@param string $needle
@param int $tolerance
@return string Matched user agent
@see \Wurfl\Handlers\Matcher\RISMatcher::match() | [
"Alias",
"of",
"\\",
"Wurfl",
"\\",
"Handlers",
"\\",
"Matcher",
"\\",
"RISMatcher",
"::",
"match",
"()"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Utils.php#L215-L218 |
mimmi20/Wurfl | src/Handlers/Utils.php | Utils.indexOfOrLength | public static function indexOfOrLength($haystack, $needle, $startingIndex = 0)
{
$length = strlen($haystack);
if ($startingIndex === false || $startingIndex > $length) {
return $length;
}
$pos = strpos($haystack, $needle, $startingIndex);
return ($pos === false... | php | public static function indexOfOrLength($haystack, $needle, $startingIndex = 0)
{
$length = strlen($haystack);
if ($startingIndex === false || $startingIndex > $length) {
return $length;
}
$pos = strpos($haystack, $needle, $startingIndex);
return ($pos === false... | [
"public",
"static",
"function",
"indexOfOrLength",
"(",
"$",
"haystack",
",",
"$",
"needle",
",",
"$",
"startingIndex",
"=",
"0",
")",
"{",
"$",
"length",
"=",
"strlen",
"(",
"$",
"haystack",
")",
";",
"if",
"(",
"$",
"startingIndex",
"===",
"false",
"... | Returns the character position (index) of the $target in $string, starting from a given index.
If target is not found, returns length of user agent.
@param string $haystack Haystack to be searched in
@param string $needle Target string to search for
@param int $startingIndex Character postition to start... | [
"Returns",
"the",
"character",
"position",
"(",
"index",
")",
"of",
"the",
"$target",
"in",
"$string",
"starting",
"from",
"a",
"given",
"index",
".",
"If",
"target",
"is",
"not",
"found",
"returns",
"length",
"of",
"user",
"agent",
"."
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Utils.php#L230-L241 |
mimmi20/Wurfl | src/Handlers/Utils.php | Utils.indexOfAnyOrLength | public static function indexOfAnyOrLength($userAgent, $needles = array(), $startingIndex = 0)
{
$length = strlen($userAgent);
if (count($needles) === 0) {
return $length;
}
if ($startingIndex === false || $startingIndex > $length) {
return $length;
}... | php | public static function indexOfAnyOrLength($userAgent, $needles = array(), $startingIndex = 0)
{
$length = strlen($userAgent);
if (count($needles) === 0) {
return $length;
}
if ($startingIndex === false || $startingIndex > $length) {
return $length;
}... | [
"public",
"static",
"function",
"indexOfAnyOrLength",
"(",
"$",
"userAgent",
",",
"$",
"needles",
"=",
"array",
"(",
")",
",",
"$",
"startingIndex",
"=",
"0",
")",
"{",
"$",
"length",
"=",
"strlen",
"(",
"$",
"userAgent",
")",
";",
"if",
"(",
"count",
... | Lowest char index of the first instance of any of the $needles found in $userAgent, starting at $startIndex;
if no match is found, the length of the string is returned
@param string $userAgent haystack
@param array $needles Array of (string)needles to search for in $userAgent
@param int $startingIndex Ch... | [
"Lowest",
"char",
"index",
"of",
"the",
"first",
"instance",
"of",
"any",
"of",
"the",
"$needles",
"found",
"in",
"$userAgent",
"starting",
"at",
"$startIndex",
";",
"if",
"no",
"match",
"is",
"found",
"the",
"length",
"of",
"the",
"string",
"is",
"returne... | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Utils.php#L253-L274 |
mimmi20/Wurfl | src/Handlers/Utils.php | Utils.isMobileBrowser | public static function isMobileBrowser($userAgent)
{
$userAgent_lower = strtolower($userAgent);
if (self::$isMobileBrowser === null) {
if (self::isDesktopBrowser($userAgent)) {
self::$isMobileBrowser = false;
} elseif (self::checkIfContainsAnyOf($userAgent_low... | php | public static function isMobileBrowser($userAgent)
{
$userAgent_lower = strtolower($userAgent);
if (self::$isMobileBrowser === null) {
if (self::isDesktopBrowser($userAgent)) {
self::$isMobileBrowser = false;
} elseif (self::checkIfContainsAnyOf($userAgent_low... | [
"public",
"static",
"function",
"isMobileBrowser",
"(",
"$",
"userAgent",
")",
"{",
"$",
"userAgent_lower",
"=",
"strtolower",
"(",
"$",
"userAgent",
")",
";",
"if",
"(",
"self",
"::",
"$",
"isMobileBrowser",
"===",
"null",
")",
"{",
"if",
"(",
"self",
"... | Returns true if the give $userAgent is from a mobile device
@param string $userAgent
@return bool | [
"Returns",
"true",
"if",
"the",
"give",
"$userAgent",
"is",
"from",
"a",
"mobile",
"device"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Utils.php#L283-L299 |
mimmi20/Wurfl | src/Handlers/Utils.php | Utils.isDesktopBrowser | public static function isDesktopBrowser($userAgent)
{
if (self::$isDesktopBrowser !== null) {
return self::$isDesktopBrowser;
}
self::$isDesktopBrowser = false;
$userAgent = strtolower($userAgent);
foreach (self::$desktopBrowsers as $key) {
... | php | public static function isDesktopBrowser($userAgent)
{
if (self::$isDesktopBrowser !== null) {
return self::$isDesktopBrowser;
}
self::$isDesktopBrowser = false;
$userAgent = strtolower($userAgent);
foreach (self::$desktopBrowsers as $key) {
... | [
"public",
"static",
"function",
"isDesktopBrowser",
"(",
"$",
"userAgent",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"isDesktopBrowser",
"!==",
"null",
")",
"{",
"return",
"self",
"::",
"$",
"isDesktopBrowser",
";",
"}",
"self",
"::",
"$",
"isDesktopBrowser",
... | Returns true if the give $userAgent is from a desktop device
@param string $userAgent
@return bool | [
"Returns",
"true",
"if",
"the",
"give",
"$userAgent",
"is",
"from",
"a",
"desktop",
"device"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Utils.php#L308-L325 |
mimmi20/Wurfl | src/Handlers/Utils.php | Utils.isRobot | public static function isRobot($userAgent)
{
self::$isRobot = false;
$userAgent = strtolower($userAgent);
foreach (self::$robots as $key) {
if (strpos($userAgent, $key) !== false) {
self::$isRobot = true;
break;
}
}
... | php | public static function isRobot($userAgent)
{
self::$isRobot = false;
$userAgent = strtolower($userAgent);
foreach (self::$robots as $key) {
if (strpos($userAgent, $key) !== false) {
self::$isRobot = true;
break;
}
}
... | [
"public",
"static",
"function",
"isRobot",
"(",
"$",
"userAgent",
")",
"{",
"self",
"::",
"$",
"isRobot",
"=",
"false",
";",
"$",
"userAgent",
"=",
"strtolower",
"(",
"$",
"userAgent",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"robots",
"as",
"$",
... | Returns true if the give $userAgent is from a robot
@param string $userAgent
@return bool | [
"Returns",
"true",
"if",
"the",
"give",
"$userAgent",
"is",
"from",
"a",
"robot"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Utils.php#L334-L347 |
mimmi20/Wurfl | src/Handlers/Utils.php | Utils.isDesktopBrowserHeavyDutyAnalysis | public static function isDesktopBrowserHeavyDutyAnalysis($userAgent)
{
// Check Smart TV keywords
if (self::isSmartTV($userAgent)) {
return false;
}
//WP Desktop - Edge Mode
if (self::checkIfContainsAll($userAgent, array('Mozilla/5.0 (Windows NT ', ' ARM;', ' Edg... | php | public static function isDesktopBrowserHeavyDutyAnalysis($userAgent)
{
// Check Smart TV keywords
if (self::isSmartTV($userAgent)) {
return false;
}
//WP Desktop - Edge Mode
if (self::checkIfContainsAll($userAgent, array('Mozilla/5.0 (Windows NT ', ' ARM;', ' Edg... | [
"public",
"static",
"function",
"isDesktopBrowserHeavyDutyAnalysis",
"(",
"$",
"userAgent",
")",
"{",
"// Check Smart TV keywords",
"if",
"(",
"self",
"::",
"isSmartTV",
"(",
"$",
"userAgent",
")",
")",
"{",
"return",
"false",
";",
"}",
"//WP Desktop - Edge Mode",
... | Is the given user agent very likely to be a desktop browser
@param string $userAgent
@return bool | [
"Is",
"the",
"given",
"user",
"agent",
"very",
"likely",
"to",
"be",
"a",
"desktop",
"browser"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Utils.php#L356-L429 |
mimmi20/Wurfl | src/Handlers/Utils.php | Utils.isSmartTV | public static function isSmartTV($userAgent)
{
if (self::$isSmartTv !== null) {
return self::$isSmartTv;
}
self::$isSmartTv = false;
$userAgent = strtolower($userAgent);
foreach (self::$smartTVBrowsers as $key) {
if (strpos($userAgent, $key) !== ... | php | public static function isSmartTV($userAgent)
{
if (self::$isSmartTv !== null) {
return self::$isSmartTv;
}
self::$isSmartTv = false;
$userAgent = strtolower($userAgent);
foreach (self::$smartTVBrowsers as $key) {
if (strpos($userAgent, $key) !== ... | [
"public",
"static",
"function",
"isSmartTV",
"(",
"$",
"userAgent",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"isSmartTv",
"!==",
"null",
")",
"{",
"return",
"self",
"::",
"$",
"isSmartTv",
";",
"}",
"self",
"::",
"$",
"isSmartTv",
"=",
"false",
";",
"... | Returns true if the give $userAgent is from a mobile device
@param string $userAgent
@return bool | [
"Returns",
"true",
"if",
"the",
"give",
"$userAgent",
"is",
"from",
"a",
"mobile",
"device"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Utils.php#L438-L453 |
mimmi20/Wurfl | src/Handlers/Utils.php | Utils.firstMatchOrLength | public static function firstMatchOrLength($string, $toMatch)
{
$firstMatch = strpos($string, $toMatch);
return ($firstMatch === false) ? strlen($string) : $firstMatch;
} | php | public static function firstMatchOrLength($string, $toMatch)
{
$firstMatch = strpos($string, $toMatch);
return ($firstMatch === false) ? strlen($string) : $firstMatch;
} | [
"public",
"static",
"function",
"firstMatchOrLength",
"(",
"$",
"string",
",",
"$",
"toMatch",
")",
"{",
"$",
"firstMatch",
"=",
"strpos",
"(",
"$",
"string",
",",
"$",
"toMatch",
")",
";",
"return",
"(",
"$",
"firstMatch",
"===",
"false",
")",
"?",
"s... | First occurance of $toMatch string or length
@param string $string Haystack
@param string $toMatch Needle
@return int Char index | [
"First",
"occurance",
"of",
"$toMatch",
"string",
"or",
"length"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Utils.php#L609-L614 |
mimmi20/Wurfl | src/Handlers/Utils.php | Utils.toleranceToRisDelimeter | public static function toleranceToRisDelimeter($userAgent)
{
$tolerance = strpos($userAgent, WurflConstants::RIS_DELIMITER);
if ($tolerance === false) {
return false;
}
// Push the tolerance to the *end* of the RIS Delimiter
return $tolerance + strlen(WurflConsta... | php | public static function toleranceToRisDelimeter($userAgent)
{
$tolerance = strpos($userAgent, WurflConstants::RIS_DELIMITER);
if ($tolerance === false) {
return false;
}
// Push the tolerance to the *end* of the RIS Delimiter
return $tolerance + strlen(WurflConsta... | [
"public",
"static",
"function",
"toleranceToRisDelimeter",
"(",
"$",
"userAgent",
")",
"{",
"$",
"tolerance",
"=",
"strpos",
"(",
"$",
"userAgent",
",",
"WurflConstants",
"::",
"RIS_DELIMITER",
")",
";",
"if",
"(",
"$",
"tolerance",
"===",
"false",
")",
"{",... | Returns the string position of the end of the RIS delimiter, or false if there is no RIS delimiter
@param string $userAgent
@return int|bool | [
"Returns",
"the",
"string",
"position",
"of",
"the",
"end",
"of",
"the",
"RIS",
"delimiter",
"or",
"false",
"if",
"there",
"is",
"no",
"RIS",
"delimiter"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Utils.php#L734-L743 |
mimmi20/Wurfl | src/Handlers/Utils.php | Utils.findCharPosition | public static function findCharPosition($string, $char, $startAt = 0)
{
$position = strpos($string, $char, $startAt);
return ($position !== false) ? $position + 1 : null;
} | php | public static function findCharPosition($string, $char, $startAt = 0)
{
$position = strpos($string, $char, $startAt);
return ($position !== false) ? $position + 1 : null;
} | [
"public",
"static",
"function",
"findCharPosition",
"(",
"$",
"string",
",",
"$",
"char",
",",
"$",
"startAt",
"=",
"0",
")",
"{",
"$",
"position",
"=",
"strpos",
"(",
"$",
"string",
",",
"$",
"char",
",",
"$",
"startAt",
")",
";",
"return",
"(",
"... | The character position in a string. If not present, returns null
@param string $string
@param string $char
@param int $startAt
@return null|int Character position | [
"The",
"character",
"position",
"in",
"a",
"string",
".",
"If",
"not",
"present",
"returns",
"null"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Utils.php#L778-L783 |
mimmi20/Wurfl | src/Handlers/Utils.php | Utils.regexContains | public static function regexContains($string, $find)
{
if (is_array($find)) {
foreach ($find as $part) {
if (preg_match($part, $string)) {
return true;
}
}
return false;
} else {
return (preg_match($... | php | public static function regexContains($string, $find)
{
if (is_array($find)) {
foreach ($find as $part) {
if (preg_match($part, $string)) {
return true;
}
}
return false;
} else {
return (preg_match($... | [
"public",
"static",
"function",
"regexContains",
"(",
"$",
"string",
",",
"$",
"find",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"find",
")",
")",
"{",
"foreach",
"(",
"$",
"find",
"as",
"$",
"part",
")",
"{",
"if",
"(",
"preg_match",
"(",
"$",
... | Check if value contains another string using PCRE (Perl Compatible Reqular Expressions)
@param $string
@param string|array $find Target regex string or array of regex strings
@return bool | [
"Check",
"if",
"value",
"contains",
"another",
"string",
"using",
"PCRE",
"(",
"Perl",
"Compatible",
"Reqular",
"Expressions",
")"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Utils.php#L791-L804 |
cpliakas/search-framework | src/Search/Framework/CollectionAgentAbstract.php | CollectionAgentAbstract.dispatchEvent | public function dispatchEvent($name, SearchEvent $event, array $context = array())
{
$log = $this->getLogger();
$context['event'] = $name;
$log->debug('Throwing event', $context);
$this->getDispatcher()->dispatch($name, $event);
$log->debug('Event thrown', $context);
} | php | public function dispatchEvent($name, SearchEvent $event, array $context = array())
{
$log = $this->getLogger();
$context['event'] = $name;
$log->debug('Throwing event', $context);
$this->getDispatcher()->dispatch($name, $event);
$log->debug('Event thrown', $context);
} | [
"public",
"function",
"dispatchEvent",
"(",
"$",
"name",
",",
"SearchEvent",
"$",
"event",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"$",
"log",
"=",
"$",
"this",
"->",
"getLogger",
"(",
")",
";",
"$",
"context",
"[",
"'event'",... | Dispatches an event, wraps with debug messages.
@param string $name
The name of the event to dispatch.
@param SearchEvent $event
The event to pass to the event handlers/listeners.
@param array $context
Optional context to pass to the logger. | [
"Dispatches",
"an",
"event",
"wraps",
"with",
"debug",
"messages",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/CollectionAgentAbstract.php#L108-L115 |
cpliakas/search-framework | src/Search/Framework/CollectionAgentAbstract.php | CollectionAgentAbstract.attachCollection | public function attachCollection(CollectionAbstract $collection)
{
$id = $collection->getId();
if (isset($this->_collections[$id])) {
throw new \InvalidArgumentException('Collection already attached: ' . $id);
}
$this->_collections[$id] = $collection;
$this->cle... | php | public function attachCollection(CollectionAbstract $collection)
{
$id = $collection->getId();
if (isset($this->_collections[$id])) {
throw new \InvalidArgumentException('Collection already attached: ' . $id);
}
$this->_collections[$id] = $collection;
$this->cle... | [
"public",
"function",
"attachCollection",
"(",
"CollectionAbstract",
"$",
"collection",
")",
"{",
"$",
"id",
"=",
"$",
"collection",
"->",
"getId",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_collections",
"[",
"$",
"id",
"]",
")",
")"... | Relates a collection to the object.
@param SearchCollectionAbstract $collection
The collection being related to this object.
@return CollectionAgentAbstract
@throws \InvalidArgumentException
Thrown when a collection with the same identifier is already attached. | [
"Relates",
"a",
"collection",
"to",
"the",
"object",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/CollectionAgentAbstract.php#L141-L155 |
cpliakas/search-framework | src/Search/Framework/CollectionAgentAbstract.php | CollectionAgentAbstract.getCollection | public function getCollection($id)
{
if (!isset($this->_collections[$id])) {
throw new \InvalidArgumentException('Collection not attached: ' . $id);
}
return $this->_collections;
} | php | public function getCollection($id)
{
if (!isset($this->_collections[$id])) {
throw new \InvalidArgumentException('Collection not attached: ' . $id);
}
return $this->_collections;
} | [
"public",
"function",
"getCollection",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_collections",
"[",
"$",
"id",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Collection not attached: '",
".",... | Returns a collection given it's unique identifier.
@param string $id
The unique identifier of the collection.
@return CollectionAbstract
@throws \InvalidArgumentException
Thrown when the collection is not attached. | [
"Returns",
"a",
"collection",
"given",
"it",
"s",
"unique",
"identifier",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/CollectionAgentAbstract.php#L185-L191 |
cpliakas/search-framework | src/Search/Framework/CollectionAgentAbstract.php | CollectionAgentAbstract.removeCollection | public function removeCollection($id)
{
unset($this->_collections[$id]);
$this->clearSchema();
$this->getLogger()->debug('Collection removed', array('collection' => $id));
return $this;
} | php | public function removeCollection($id)
{
unset($this->_collections[$id]);
$this->clearSchema();
$this->getLogger()->debug('Collection removed', array('collection' => $id));
return $this;
} | [
"public",
"function",
"removeCollection",
"(",
"$",
"id",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"_collections",
"[",
"$",
"id",
"]",
")",
";",
"$",
"this",
"->",
"clearSchema",
"(",
")",
";",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"de... | Removes a collection from this server.
@param string $id
The unique identifier of the collection.
@return CollectionAgentAbstract | [
"Removes",
"a",
"collection",
"from",
"this",
"server",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/CollectionAgentAbstract.php#L211-L219 |
cpliakas/search-framework | src/Search/Framework/CollectionAgentAbstract.php | CollectionAgentAbstract.getSchema | public function getSchema()
{
if (!isset($this->_schema)) {
$this->_schema = $this->loadSchemata();
}
return $this->_schema;
} | php | public function getSchema()
{
if (!isset($this->_schema)) {
$this->_schema = $this->loadSchemata();
}
return $this->_schema;
} | [
"public",
"function",
"getSchema",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_schema",
")",
")",
"{",
"$",
"this",
"->",
"_schema",
"=",
"$",
"this",
"->",
"loadSchemata",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"_... | Returns the fused schema for all collections attached to this agent.
@return Schema | [
"Returns",
"the",
"fused",
"schema",
"for",
"all",
"collections",
"attached",
"to",
"this",
"agent",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/CollectionAgentAbstract.php#L245-L251 |
cpliakas/search-framework | src/Search/Framework/CollectionAgentAbstract.php | CollectionAgentAbstract.loadSchemata | public function loadSchemata()
{
$fused_options = array();
foreach ($this->_collections as $collection) {
$context = array('collection' => $collection->getId());
$schema_options = $this->loadCollectionSchema($collection)->toArray();
// Just set the schema option... | php | public function loadSchemata()
{
$fused_options = array();
foreach ($this->_collections as $collection) {
$context = array('collection' => $collection->getId());
$schema_options = $this->loadCollectionSchema($collection)->toArray();
// Just set the schema option... | [
"public",
"function",
"loadSchemata",
"(",
")",
"{",
"$",
"fused_options",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_collections",
"as",
"$",
"collection",
")",
"{",
"$",
"context",
"=",
"array",
"(",
"'collection'",
"=>",
"$",
... | Loads and fuses the schemata for all collections attached to this agent.
@return Schema | [
"Loads",
"and",
"fuses",
"the",
"schemata",
"for",
"all",
"collections",
"attached",
"to",
"this",
"agent",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/CollectionAgentAbstract.php#L258-L299 |
ignasbernotas/console | src/UI/Drawer.php | Drawer.fitText | public function fitText($width, $text = '', $padding = 0)
{
$spaces = $width - strlen($text) - $padding;
return $text . str_repeat(' ', $spaces < 0 ? 0 : $spaces);
} | php | public function fitText($width, $text = '', $padding = 0)
{
$spaces = $width - strlen($text) - $padding;
return $text . str_repeat(' ', $spaces < 0 ? 0 : $spaces);
} | [
"public",
"function",
"fitText",
"(",
"$",
"width",
",",
"$",
"text",
"=",
"''",
",",
"$",
"padding",
"=",
"0",
")",
"{",
"$",
"spaces",
"=",
"$",
"width",
"-",
"strlen",
"(",
"$",
"text",
")",
"-",
"$",
"padding",
";",
"return",
"$",
"text",
"... | Append spaces to the string to fit the whole terminal window
@param int $width
@param string $text
@param int $padding
@return string | [
"Append",
"spaces",
"to",
"the",
"string",
"to",
"fit",
"the",
"whole",
"terminal",
"window"
] | train | https://github.com/ignasbernotas/console/blob/909e613b140413062424d6a465da08aac355be55/src/UI/Drawer.php#L74-L79 |
ignasbernotas/console | src/UI/Drawer.php | Drawer.getTitle | public function getTitle($title)
{
return sprintf($this->style['title'], $this->fitText($this->window->getWidth(), $title));
} | php | public function getTitle($title)
{
return sprintf($this->style['title'], $this->fitText($this->window->getWidth(), $title));
} | [
"public",
"function",
"getTitle",
"(",
"$",
"title",
")",
"{",
"return",
"sprintf",
"(",
"$",
"this",
"->",
"style",
"[",
"'title'",
"]",
",",
"$",
"this",
"->",
"fitText",
"(",
"$",
"this",
"->",
"window",
"->",
"getWidth",
"(",
")",
",",
"$",
"ti... | Returns title
@param $title
@return string | [
"Returns",
"title"
] | train | https://github.com/ignasbernotas/console/blob/909e613b140413062424d6a465da08aac355be55/src/UI/Drawer.php#L87-L90 |
ignasbernotas/console | src/UI/Drawer.php | Drawer.getFormattedChoices | public function getFormattedChoices(array $choices, $position, $selected)
{
$lines = [];
foreach ($choices as $index => $choice) {
$state = in_array($choice, $selected)
? self::CHOICE_SELECTED
: self::CHOICE_NORMAL;
$cursor = $index === $posi... | php | public function getFormattedChoices(array $choices, $position, $selected)
{
$lines = [];
foreach ($choices as $index => $choice) {
$state = in_array($choice, $selected)
? self::CHOICE_SELECTED
: self::CHOICE_NORMAL;
$cursor = $index === $posi... | [
"public",
"function",
"getFormattedChoices",
"(",
"array",
"$",
"choices",
",",
"$",
"position",
",",
"$",
"selected",
")",
"{",
"$",
"lines",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"choices",
"as",
"$",
"index",
"=>",
"$",
"choice",
")",
"{",
"$",... | Returns an array of styled options
@param $choices
@param $position
@param $selected
@return array | [
"Returns",
"an",
"array",
"of",
"styled",
"options"
] | train | https://github.com/ignasbernotas/console/blob/909e613b140413062424d6a465da08aac355be55/src/UI/Drawer.php#L100-L123 |
ignasbernotas/console | src/UI/Drawer.php | Drawer.drawWindow | public function drawWindow($title, $choices, $position, $answers)
{
$this->window->clearScreen();
$this->output->writeln($this->getTitle($title));
$this->output->writeln("");
$lines = $this->getFormattedChoices($choices, $position, $answers);
foreach ($lines as $line) {
... | php | public function drawWindow($title, $choices, $position, $answers)
{
$this->window->clearScreen();
$this->output->writeln($this->getTitle($title));
$this->output->writeln("");
$lines = $this->getFormattedChoices($choices, $position, $answers);
foreach ($lines as $line) {
... | [
"public",
"function",
"drawWindow",
"(",
"$",
"title",
",",
"$",
"choices",
",",
"$",
"position",
",",
"$",
"answers",
")",
"{",
"$",
"this",
"->",
"window",
"->",
"clearScreen",
"(",
")",
";",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",
"$",
... | Draw the window
@param $title
@param $choices
@param $position
@param $answers
@return $this | [
"Draw",
"the",
"window"
] | train | https://github.com/ignasbernotas/console/blob/909e613b140413062424d6a465da08aac355be55/src/UI/Drawer.php#L134-L148 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/AttrTypes.php | HTMLPurifier_AttrTypes.get | public function get($type) {
// determine if there is any extra info tacked on
if (strpos($type, '#') !== false) list($type, $string) = explode('#', $type, 2);
else $string = '';
if (!isset($this->info[$type])) {
trigger_error('Cannot retrieve undefined attribute type ' . $... | php | public function get($type) {
// determine if there is any extra info tacked on
if (strpos($type, '#') !== false) list($type, $string) = explode('#', $type, 2);
else $string = '';
if (!isset($this->info[$type])) {
trigger_error('Cannot retrieve undefined attribute type ' . $... | [
"public",
"function",
"get",
"(",
"$",
"type",
")",
"{",
"// determine if there is any extra info tacked on",
"if",
"(",
"strpos",
"(",
"$",
"type",
",",
"'#'",
")",
"!==",
"false",
")",
"list",
"(",
"$",
"type",
",",
"$",
"string",
")",
"=",
"explode",
... | Retrieves a type
@param $type String type name
@return Object AttrDef for type | [
"Retrieves",
"a",
"type"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/AttrTypes.php#L52-L65 |
mimmi20/Wurfl | src/Device/DeviceRepositoryBuilder.php | DeviceRepositoryBuilder.build | public function build($wurflFile, array $wurflPatches = array(), array $capabilityFilter = array())
{
if (!$this->isRepositoryBuilt()) {
if (!empty($capabilityFilter)) {
$capabilityFilter = array_unique(
array_merge(
$capabilityFilter,
... | php | public function build($wurflFile, array $wurflPatches = array(), array $capabilityFilter = array())
{
if (!$this->isRepositoryBuilt()) {
if (!empty($capabilityFilter)) {
$capabilityFilter = array_unique(
array_merge(
$capabilityFilter,
... | [
"public",
"function",
"build",
"(",
"$",
"wurflFile",
",",
"array",
"$",
"wurflPatches",
"=",
"array",
"(",
")",
",",
"array",
"$",
"capabilityFilter",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isRepositoryBuilt",
"(",
")",
... | Builds DeviceRepositoryInterface in PersistenceProvider from $wurflFile and $wurflPatches using $capabilityFilter
@param string $wurflFile Filename of wurfl.xml or other complete WURFL file
@param array $wurflPatches Array of WURFL patch files
@param array $capabilityFilter Array of capabilities to be inc... | [
"Builds",
"DeviceRepositoryInterface",
"in",
"PersistenceProvider",
"from",
"$wurflFile",
"and",
"$wurflPatches",
"using",
"$capabilityFilter"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/DeviceRepositoryBuilder.php#L110-L172 |
mimmi20/Wurfl | src/Device/DeviceRepositoryBuilder.php | DeviceRepositoryBuilder.toPatchIterators | private function toPatchIterators(array $wurflPatches = array(), array $capabilityFilter = array())
{
$patchIterators = array();
if (is_array($wurflPatches)) {
foreach ($wurflPatches as $wurflPatch) {
try {
$patchIterators[] = new DeviceIterator($wurf... | php | private function toPatchIterators(array $wurflPatches = array(), array $capabilityFilter = array())
{
$patchIterators = array();
if (is_array($wurflPatches)) {
foreach ($wurflPatches as $wurflPatch) {
try {
$patchIterators[] = new DeviceIterator($wurf... | [
"private",
"function",
"toPatchIterators",
"(",
"array",
"$",
"wurflPatches",
"=",
"array",
"(",
")",
",",
"array",
"$",
"capabilityFilter",
"=",
"array",
"(",
")",
")",
"{",
"$",
"patchIterators",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_array",
"(",... | Returns an array of Xml\DeviceIterator for the given $wurflPatches and $capabilitiesToUse
@param string[] $wurflPatches Array of (string)filenames
@param string[] $capabilityFilter Array of (string) WURFL capabilities
@return \Wurfl\Device\Xml\DeviceIterator[] | [
"Returns",
"an",
"array",
"of",
"Xml",
"\\",
"DeviceIterator",
"for",
"the",
"given",
"$wurflPatches",
"and",
"$capabilitiesToUse"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/DeviceRepositoryBuilder.php#L213-L228 |
mimmi20/Wurfl | src/Device/DeviceRepositoryBuilder.php | DeviceRepositoryBuilder.deviceClassificationNames | private function deviceClassificationNames()
{
$deviceClusterNames = array();
foreach ($this->userAgentHandlerChain->getHandlers() as $userAgentHandler) {
/* @var $userAgentHandler \Wurfl\Handlers\AbstractHandler */
$deviceClusterNames[] = $userAgentHandler->getPrefix();
... | php | private function deviceClassificationNames()
{
$deviceClusterNames = array();
foreach ($this->userAgentHandlerChain->getHandlers() as $userAgentHandler) {
/* @var $userAgentHandler \Wurfl\Handlers\AbstractHandler */
$deviceClusterNames[] = $userAgentHandler->getPrefix();
... | [
"private",
"function",
"deviceClassificationNames",
"(",
")",
"{",
"$",
"deviceClusterNames",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"userAgentHandlerChain",
"->",
"getHandlers",
"(",
")",
"as",
"$",
"userAgentHandler",
")",
"{",
"/* @... | @return array Array of (string)User Agent Handler prefixes
@see WURFL_Handlers_Handler::getPrefix() | [
"@return",
"array",
"Array",
"of",
"(",
"string",
")",
"User",
"Agent",
"Handler",
"prefixes"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/DeviceRepositoryBuilder.php#L253-L263 |
mimmi20/Wurfl | src/Device/DeviceRepositoryBuilder.php | DeviceRepositoryBuilder.persistWurflInfo | private function persistWurflInfo(VersionIterator $wurflInfoIterator)
{
foreach ($wurflInfoIterator as $info) {
$this->persistenceProvider->save(Info::PERSISTENCE_KEY, $info);
return;
}
} | php | private function persistWurflInfo(VersionIterator $wurflInfoIterator)
{
foreach ($wurflInfoIterator as $info) {
$this->persistenceProvider->save(Info::PERSISTENCE_KEY, $info);
return;
}
} | [
"private",
"function",
"persistWurflInfo",
"(",
"VersionIterator",
"$",
"wurflInfoIterator",
")",
"{",
"foreach",
"(",
"$",
"wurflInfoIterator",
"as",
"$",
"info",
")",
"{",
"$",
"this",
"->",
"persistenceProvider",
"->",
"save",
"(",
"Info",
"::",
"PERSISTENCE_... | Save Loaded WURFL info in the persistence provider
@param \Wurfl\Device\Xml\VersionIterator $wurflInfoIterator | [
"Save",
"Loaded",
"WURFL",
"info",
"in",
"the",
"persistence",
"provider"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/DeviceRepositoryBuilder.php#L280-L287 |
mimmi20/Wurfl | src/Device/DeviceRepositoryBuilder.php | DeviceRepositoryBuilder.process | private function process(DeviceIterator $deviceIterator, array $patchingDevices = array())
{
$usedPatches = array();
foreach ($deviceIterator as $device) {
/* @var $device \Wurfl\Device\ModelDeviceInterface */
$toPatch = isset($patchingDevices[$device->id]);
if ... | php | private function process(DeviceIterator $deviceIterator, array $patchingDevices = array())
{
$usedPatches = array();
foreach ($deviceIterator as $device) {
/* @var $device \Wurfl\Device\ModelDeviceInterface */
$toPatch = isset($patchingDevices[$device->id]);
if ... | [
"private",
"function",
"process",
"(",
"DeviceIterator",
"$",
"deviceIterator",
",",
"array",
"$",
"patchingDevices",
"=",
"array",
"(",
")",
")",
"{",
"$",
"usedPatches",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"deviceIterator",
"as",
"$",
"devi... | Process device iterator
@param \Wurfl\Device\Xml\DeviceIterator $deviceIterator
@param array $patchingDevices | [
"Process",
"device",
"iterator"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/DeviceRepositoryBuilder.php#L295-L313 |
mimmi20/Wurfl | src/Device/DeviceRepositoryBuilder.php | DeviceRepositoryBuilder.validateDevice | private function validateDevice(ModelDeviceInterface $device)
{
// Must have a valid wurfl ID
if (strlen($device->id) === 0) {
return false;
}
// Must have a valid User Agent unless it's "generic"
if (strlen($device->userAgent) === 0 && $device->id !== 'generic')... | php | private function validateDevice(ModelDeviceInterface $device)
{
// Must have a valid wurfl ID
if (strlen($device->id) === 0) {
return false;
}
// Must have a valid User Agent unless it's "generic"
if (strlen($device->userAgent) === 0 && $device->id !== 'generic')... | [
"private",
"function",
"validateDevice",
"(",
"ModelDeviceInterface",
"$",
"device",
")",
"{",
"// Must have a valid wurfl ID",
"if",
"(",
"strlen",
"(",
"$",
"device",
"->",
"id",
")",
"===",
"0",
")",
"{",
"return",
"false",
";",
"}",
"// Must have a valid Use... | @param \Wurfl\Device\ModelDeviceInterface $device
@return bool | [
"@param",
"\\",
"Wurfl",
"\\",
"Device",
"\\",
"ModelDeviceInterface",
"$device"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/DeviceRepositoryBuilder.php#L332-L345 |
mimmi20/Wurfl | src/Device/DeviceRepositoryBuilder.php | DeviceRepositoryBuilder.patchDevice | private function patchDevice(ModelDeviceInterface $device, ModelDeviceInterface $patchingDevice)
{
return $this->devicePatcher->patch($device, $patchingDevice);
} | php | private function patchDevice(ModelDeviceInterface $device, ModelDeviceInterface $patchingDevice)
{
return $this->devicePatcher->patch($device, $patchingDevice);
} | [
"private",
"function",
"patchDevice",
"(",
"ModelDeviceInterface",
"$",
"device",
",",
"ModelDeviceInterface",
"$",
"patchingDevice",
")",
"{",
"return",
"$",
"this",
"->",
"devicePatcher",
"->",
"patch",
"(",
"$",
"device",
",",
"$",
"patchingDevice",
")",
";",... | @param \Wurfl\Device\ModelDeviceInterface $device
@param \Wurfl\Device\ModelDeviceInterface $patchingDevice
@return \Wurfl\Device\ModelDeviceInterface | [
"@param",
"\\",
"Wurfl",
"\\",
"Device",
"\\",
"ModelDeviceInterface",
"$device",
"@param",
"\\",
"Wurfl",
"\\",
"Device",
"\\",
"ModelDeviceInterface",
"$patchingDevice"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/DeviceRepositoryBuilder.php#L387-L390 |
mimmi20/Wurfl | src/Device/DeviceRepositoryBuilder.php | DeviceRepositoryBuilder.toListOfPatchingDevices | private function toListOfPatchingDevices($patchingDeviceIterators)
{
if (!is_array($patchingDeviceIterators)) {
return array();
}
$currentPatchingDevices = array();
foreach ($patchingDeviceIterators as $deviceIterator) {
$newPatchingDevices = $this->toArray(... | php | private function toListOfPatchingDevices($patchingDeviceIterators)
{
if (!is_array($patchingDeviceIterators)) {
return array();
}
$currentPatchingDevices = array();
foreach ($patchingDeviceIterators as $deviceIterator) {
$newPatchingDevices = $this->toArray(... | [
"private",
"function",
"toListOfPatchingDevices",
"(",
"$",
"patchingDeviceIterators",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"patchingDeviceIterators",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"currentPatchingDevices",
"=",
"array",
... | @param \Wurfl\Device\Xml\DeviceIterator[] $patchingDeviceIterators Array of Wurfl\Xml\DeviceIterators
@return array Merged array of current patch devices | [
"@param",
"\\",
"Wurfl",
"\\",
"Device",
"\\",
"Xml",
"\\",
"DeviceIterator",
"[]",
"$patchingDeviceIterators",
"Array",
"of",
"Wurfl",
"\\",
"Xml",
"\\",
"DeviceIterators"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/DeviceRepositoryBuilder.php#L397-L411 |
mimmi20/Wurfl | src/Device/DeviceRepositoryBuilder.php | DeviceRepositoryBuilder.patchDevices | private function patchDevices(array &$currentPatchingDevices, array $newPatchingDevices)
{
foreach ($newPatchingDevices as $deviceId => $newPatchingDevice) {
if (isset($currentPatchingDevices[$deviceId])) {
$currentPatchingDevices[$deviceId] = $this->patchDevice(
... | php | private function patchDevices(array &$currentPatchingDevices, array $newPatchingDevices)
{
foreach ($newPatchingDevices as $deviceId => $newPatchingDevice) {
if (isset($currentPatchingDevices[$deviceId])) {
$currentPatchingDevices[$deviceId] = $this->patchDevice(
... | [
"private",
"function",
"patchDevices",
"(",
"array",
"&",
"$",
"currentPatchingDevices",
",",
"array",
"$",
"newPatchingDevices",
")",
"{",
"foreach",
"(",
"$",
"newPatchingDevices",
"as",
"$",
"deviceId",
"=>",
"$",
"newPatchingDevice",
")",
"{",
"if",
"(",
"... | Adds the given $newPatchingDevices to the $currentPatchingDevices array
@param \Wurfl\Device\ModelDeviceInterface[] $currentPatchingDevices REFERENCE to array of current devices to be patches
@param \Wurfl\Device\ModelDeviceInterface[] $newPatchingDevices Array of new devices to be patched in | [
"Adds",
"the",
"given",
"$newPatchingDevices",
"to",
"the",
"$currentPatchingDevices",
"array"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/DeviceRepositoryBuilder.php#L419-L431 |
mimmi20/Wurfl | src/Device/DeviceRepositoryBuilder.php | DeviceRepositoryBuilder.toArray | private function toArray(DeviceIterator $deviceIterator)
{
$patchingDevices = array();
foreach ($deviceIterator as $device) {
/* @var $device \Wurfl\Device\ModelDeviceInterface */
$patchingDevices[$device->id] = $device;
}
return $patchingDevices;
} | php | private function toArray(DeviceIterator $deviceIterator)
{
$patchingDevices = array();
foreach ($deviceIterator as $device) {
/* @var $device \Wurfl\Device\ModelDeviceInterface */
$patchingDevices[$device->id] = $device;
}
return $patchingDevices;
} | [
"private",
"function",
"toArray",
"(",
"DeviceIterator",
"$",
"deviceIterator",
")",
"{",
"$",
"patchingDevices",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"deviceIterator",
"as",
"$",
"device",
")",
"{",
"/* @var $device \\Wurfl\\Device\\ModelDeviceInterfac... | Returns an array of devices in the form 'WURFL_Device::id => WURFL_Device'
@param \Wurfl\Device\Xml\DeviceIterator $deviceIterator
@return ModelDeviceInterface[] | [
"Returns",
"an",
"array",
"of",
"devices",
"in",
"the",
"form",
"WURFL_Device",
"::",
"id",
"=",
">",
"WURFL_Device"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/DeviceRepositoryBuilder.php#L440-L450 |
opis/validation | src/Validator.php | Validator.validate | public function validate($field, $value, callable $callback = null)
{
$key = $field;
if (is_array($field)) {
$key = key($field);
$field = current($field);
}
if ($callback !== null) {
$value = $callback($value);
}
while (!empty($t... | php | public function validate($field, $value, callable $callback = null)
{
$key = $field;
if (is_array($field)) {
$key = key($field);
$field = current($field);
}
if ($callback !== null) {
$value = $callback($value);
}
while (!empty($t... | [
"public",
"function",
"validate",
"(",
"$",
"field",
",",
"$",
"value",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"key",
"=",
"$",
"field",
";",
"if",
"(",
"is_array",
"(",
"$",
"field",
")",
")",
"{",
"$",
"key",
"=",
"key",
... | @param string|array $field
@param mixed $value
@param callable|null $callback
@return mixed | [
"@param",
"string|array",
"$field",
"@param",
"mixed",
"$value",
"@param",
"callable|null",
"$callback"
] | train | https://github.com/opis/validation/blob/1a1a306100e3f4fbb65bbf939300532302f9e3ea/src/Validator.php#L92-L126 |
DevGroup-ru/yii2-data-structure-tools | src/search/base/AbstractSearcher.php | AbstractSearcher.newResponse | protected static function newResponse($returnType = BaseSearch::SEARCH_RESULT)
{
switch ($returnType) {
case BaseSearch::SEARCH_COUNT:
return new CountResponse();
break;
case BaseSearch::SEARCH_RESULT:
return new ResultResponse();
... | php | protected static function newResponse($returnType = BaseSearch::SEARCH_RESULT)
{
switch ($returnType) {
case BaseSearch::SEARCH_COUNT:
return new CountResponse();
break;
case BaseSearch::SEARCH_RESULT:
return new ResultResponse();
... | [
"protected",
"static",
"function",
"newResponse",
"(",
"$",
"returnType",
"=",
"BaseSearch",
"::",
"SEARCH_RESULT",
")",
"{",
"switch",
"(",
"$",
"returnType",
")",
"{",
"case",
"BaseSearch",
"::",
"SEARCH_COUNT",
":",
"return",
"new",
"CountResponse",
"(",
")... | @param int $returnType
@return SearchResponse | [
"@param",
"int",
"$returnType"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/search/base/AbstractSearcher.php#L41-L58 |
fostam/php-getopts | src/Handler.php | Handler.addOption | public function addOption($name, Option $opt = null) {
if (isset($this->configOpts[$name]) || isset($this->configArgs[$name])) {
throw new ConfigException('option/argument already set: ' . $name);
}
if (is_null($opt)) {
$opt = new Option();
}
$t... | php | public function addOption($name, Option $opt = null) {
if (isset($this->configOpts[$name]) || isset($this->configArgs[$name])) {
throw new ConfigException('option/argument already set: ' . $name);
}
if (is_null($opt)) {
$opt = new Option();
}
$t... | [
"public",
"function",
"addOption",
"(",
"$",
"name",
",",
"Option",
"$",
"opt",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"configOpts",
"[",
"$",
"name",
"]",
")",
"||",
"isset",
"(",
"$",
"this",
"->",
"configArgs",
"[",
... | add a new option
@param string $name
@param Option $opt
@return Option
@throws ConfigException | [
"add",
"a",
"new",
"option"
] | train | https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Handler.php#L46-L57 |
fostam/php-getopts | src/Handler.php | Handler.addArgument | public function addArgument($name, Argument $arg = null) {
if (isset($this->configOpts[$name]) || isset($this->configArgs[$name])) {
throw new ConfigException('option/argument already set: ' . $name);
}
if (is_null($arg)) {
$arg = new Argument();
}
... | php | public function addArgument($name, Argument $arg = null) {
if (isset($this->configOpts[$name]) || isset($this->configArgs[$name])) {
throw new ConfigException('option/argument already set: ' . $name);
}
if (is_null($arg)) {
$arg = new Argument();
}
... | [
"public",
"function",
"addArgument",
"(",
"$",
"name",
",",
"Argument",
"$",
"arg",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"configOpts",
"[",
"$",
"name",
"]",
")",
"||",
"isset",
"(",
"$",
"this",
"->",
"configArgs",
"[... | add a new argument
@param $name
@param Argument $arg
@return Argument
@throws ConfigException | [
"add",
"a",
"new",
"argument"
] | train | https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Handler.php#L67-L78 |
fostam/php-getopts | src/Handler.php | Handler.setHelpOptionLong | public function setHelpOptionLong($str) {
if (!Option::validateLong($str)) {
throw new ConfigException('long help option has invalid format');
}
$this->helpLong = $str;
return $this;
} | php | public function setHelpOptionLong($str) {
if (!Option::validateLong($str)) {
throw new ConfigException('long help option has invalid format');
}
$this->helpLong = $str;
return $this;
} | [
"public",
"function",
"setHelpOptionLong",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"!",
"Option",
"::",
"validateLong",
"(",
"$",
"str",
")",
")",
"{",
"throw",
"new",
"ConfigException",
"(",
"'long help option has invalid format'",
")",
";",
"}",
"$",
"this",... | set the long option for help handling
@param string $str
@return $this | [
"set",
"the",
"long",
"option",
"for",
"help",
"handling"
] | train | https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Handler.php#L86-L92 |
fostam/php-getopts | src/Handler.php | Handler.setHelpOptionShort | public function setHelpOptionShort($str) {
if (!Option::validateShort($str)) {
throw new ConfigException('short help option must be a single character');
}
$this->helpShort = $str;
return $this;
} | php | public function setHelpOptionShort($str) {
if (!Option::validateShort($str)) {
throw new ConfigException('short help option must be a single character');
}
$this->helpShort = $str;
return $this;
} | [
"public",
"function",
"setHelpOptionShort",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"!",
"Option",
"::",
"validateShort",
"(",
"$",
"str",
")",
")",
"{",
"throw",
"new",
"ConfigException",
"(",
"'short help option must be a single character'",
")",
";",
"}",
"$"... | set the short option for help handling
@param string $str
@return $this | [
"set",
"the",
"short",
"option",
"for",
"help",
"handling"
] | train | https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Handler.php#L100-L106 |
fostam/php-getopts | src/Handler.php | Handler.parse | public function parse($inputArgs = null) {
$args = $this->getCommandLineArgs($inputArgs);
if (count($args)) {
$this->scriptName = array_shift($args);
}
// build help option
$helpOpt = false;
if ($this->helpLong) {
$helpOpt = new Option();... | php | public function parse($inputArgs = null) {
$args = $this->getCommandLineArgs($inputArgs);
if (count($args)) {
$this->scriptName = array_shift($args);
}
// build help option
$helpOpt = false;
if ($this->helpLong) {
$helpOpt = new Option();... | [
"public",
"function",
"parse",
"(",
"$",
"inputArgs",
"=",
"null",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"getCommandLineArgs",
"(",
"$",
"inputArgs",
")",
";",
"if",
"(",
"count",
"(",
"$",
"args",
")",
")",
"{",
"$",
"this",
"->",
"script... | parse arguments
the first element in the array is treated as script name
@param array $inputArgs
@throws UsageException | [
"parse",
"arguments",
"the",
"first",
"element",
"in",
"the",
"array",
"is",
"treated",
"as",
"script",
"name"
] | train | https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Handler.php#L146-L186 |
fostam/php-getopts | src/Handler.php | Handler.getOptions | public function getOptions() {
if (is_null($this->result)) {
$this->parse();
}
return $this->result[Parser::RESULT_OPTIONS];
} | php | public function getOptions() {
if (is_null($this->result)) {
$this->parse();
}
return $this->result[Parser::RESULT_OPTIONS];
} | [
"public",
"function",
"getOptions",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"result",
")",
")",
"{",
"$",
"this",
"->",
"parse",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"result",
"[",
"Parser",
"::",
"RESULT_OPTIONS",
... | get the parsed options and their values
@return array
@throws \LogicException | [
"get",
"the",
"parsed",
"options",
"and",
"their",
"values"
] | train | https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Handler.php#L218-L223 |
fostam/php-getopts | src/Handler.php | Handler.getArguments | public function getArguments() {
if (is_null($this->result)) {
$this->parse();
}
return $this->result[Parser::RESULT_ARGUMENTS];
} | php | public function getArguments() {
if (is_null($this->result)) {
$this->parse();
}
return $this->result[Parser::RESULT_ARGUMENTS];
} | [
"public",
"function",
"getArguments",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"result",
")",
")",
"{",
"$",
"this",
"->",
"parse",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"result",
"[",
"Parser",
"::",
"RESULT_ARGUMENTS"... | get parsed argument values
@return array
@throws \LogicException | [
"get",
"parsed",
"argument",
"values"
] | train | https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Handler.php#L231-L236 |
vi-kon/laravel-parser | src/ViKon/Parser/renderer/Renderer.php | Renderer.render | public function render(TokenList $tokenList, $skin = 'default') {
if (!array_key_exists($skin, $this->ruleRenderers)) {
throw new ParserException('Skin ' . $skin . ' not found');
}
if (!array_key_exists($skin, $this->tokenRenderers)) {
$this->tokenRenderers[$skin] = [];
... | php | public function render(TokenList $tokenList, $skin = 'default') {
if (!array_key_exists($skin, $this->ruleRenderers)) {
throw new ParserException('Skin ' . $skin . ' not found');
}
if (!array_key_exists($skin, $this->tokenRenderers)) {
$this->tokenRenderers[$skin] = [];
... | [
"public",
"function",
"render",
"(",
"TokenList",
"$",
"tokenList",
",",
"$",
"skin",
"=",
"'default'",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"skin",
",",
"$",
"this",
"->",
"ruleRenderers",
")",
")",
"{",
"throw",
"new",
"ParserExcepti... | Render token list
@param \ViKon\Parser\TokenList $tokenList parsed token list
@param string $skin renderer skin
@return bool|string FALSE on failure otherwise output
@throws \ViKon\Parser\ParserException | [
"Render",
"token",
"list"
] | train | https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/renderer/Renderer.php#L54-L81 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.