id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
198,100 | betasyntax/Betasyntax-Framework-Core | src/Betasyntax/Router/Router.php | Router.fakeUrl | public function fakeUrl($route, $params)
{
if (preg_match_all('/\[[\s\S]+?]/', $route, $matches, PREG_SET_ORDER)) {
for ($i=0;$i<count($matches);$i++) {
$route = preg_replace('/\[[\s\S]+?]/', $params[$i], $route);
}
}
return($route);
} | php | public function fakeUrl($route, $params)
{
if (preg_match_all('/\[[\s\S]+?]/', $route, $matches, PREG_SET_ORDER)) {
for ($i=0;$i<count($matches);$i++) {
$route = preg_replace('/\[[\s\S]+?]/', $params[$i], $route);
}
}
return($route);
} | [
"public",
"function",
"fakeUrl",
"(",
"$",
"route",
",",
"$",
"params",
")",
"{",
"if",
"(",
"preg_match_all",
"(",
"'/\\[[\\s\\S]+?]/'",
",",
"$",
"route",
",",
"$",
"matches",
",",
"PREG_SET_ORDER",
")",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";... | Return the real url genereted from a named route
@param string $route The untouched route from the link_to function
@param array $params Data to be injected into the route
@return string Return the generated url from the named route provided to the link_to function | [
"Return",
"the",
"real",
"url",
"genereted",
"from",
"a",
"named",
"route"
] | 2d135ec1f7dd98e6ef21512a069ac2595f1eb78e | https://github.com/betasyntax/Betasyntax-Framework-Core/blob/2d135ec1f7dd98e6ef21512a069ac2595f1eb78e/src/Betasyntax/Router/Router.php#L174-L182 |
198,101 | cubicmushroom/valueobjects | src/Number/Complex.php | Complex.fromNative | public static function fromNative()
{
$args = \func_get_args();
if (\count($args) != 2) {
throw new \BadMethodCallException('You must provide 2 arguments: 1) real part, 2) imaginary part');
}
$real = Real::fromNative($args[0]);
$im = Real::fromNative($ar... | php | public static function fromNative()
{
$args = \func_get_args();
if (\count($args) != 2) {
throw new \BadMethodCallException('You must provide 2 arguments: 1) real part, 2) imaginary part');
}
$real = Real::fromNative($args[0]);
$im = Real::fromNative($ar... | [
"public",
"static",
"function",
"fromNative",
"(",
")",
"{",
"$",
"args",
"=",
"\\",
"func_get_args",
"(",
")",
";",
"if",
"(",
"\\",
"count",
"(",
"$",
"args",
")",
"!=",
"2",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"'You must p... | Returns a new Complex object from native PHP arguments
@param float $real Real part of the complex number
@param float $im Imaginary part of the complex number
@return Complex|ValueObjectInterface
@throws \BadMethodCallException | [
"Returns",
"a",
"new",
"Complex",
"object",
"from",
"native",
"PHP",
"arguments"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Number/Complex.php#L24-L37 |
198,102 | cubicmushroom/valueobjects | src/Number/Complex.php | Complex.fromPolar | public static function fromPolar(Real $modulus, Real $argument)
{
$realValue = $modulus->toNative() * \cos($argument->toNative());
$imValue = $modulus->toNative() * \sin($argument->toNative());
$real = new Real($realValue);
$im = new Real($imValue);
$complex =... | php | public static function fromPolar(Real $modulus, Real $argument)
{
$realValue = $modulus->toNative() * \cos($argument->toNative());
$imValue = $modulus->toNative() * \sin($argument->toNative());
$real = new Real($realValue);
$im = new Real($imValue);
$complex =... | [
"public",
"static",
"function",
"fromPolar",
"(",
"Real",
"$",
"modulus",
",",
"Real",
"$",
"argument",
")",
"{",
"$",
"realValue",
"=",
"$",
"modulus",
"->",
"toNative",
"(",
")",
"*",
"\\",
"cos",
"(",
"$",
"argument",
"->",
"toNative",
"(",
")",
"... | Returns a Complex given polar coordinates
@param Real $modulus
@param Real $argument
@return Complex | [
"Returns",
"a",
"Complex",
"given",
"polar",
"coordinates"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Number/Complex.php#L46-L55 |
198,103 | stubbles/stubbles-peer | src/main/php/http/AcceptHeader.php | AcceptHeader.parse | public static function parse(string $headerValue): self
{
$self = new self();
foreach (explode(',', $headerValue) as $acceptable) {
// seems to be impossible to parse acceptables with regular
// expressions or even scanf(), so we do some string crunching here
if (... | php | public static function parse(string $headerValue): self
{
$self = new self();
foreach (explode(',', $headerValue) as $acceptable) {
// seems to be impossible to parse acceptables with regular
// expressions or even scanf(), so we do some string crunching here
if (... | [
"public",
"static",
"function",
"parse",
"(",
"string",
"$",
"headerValue",
")",
":",
"self",
"{",
"$",
"self",
"=",
"new",
"self",
"(",
")",
";",
"foreach",
"(",
"explode",
"(",
"','",
",",
"$",
"headerValue",
")",
"as",
"$",
"acceptable",
")",
"{",... | method to create an instance from a string header value
@param string $headerValue
@return \stubbles\peer\http\AcceptHeader | [
"method",
"to",
"create",
"an",
"instance",
"from",
"a",
"string",
"header",
"value"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/AcceptHeader.php#L32-L54 |
198,104 | stubbles/stubbles-peer | src/main/php/http/AcceptHeader.php | AcceptHeader.addAcceptable | public function addAcceptable(string $acceptable, float $priority = 1.0): self
{
if (0 > $priority || 1.0 < $priority) {
throw new \InvalidArgumentException(
'Invalid priority, must be between 0 and 1.0'
);
}
$this->acceptables[$acceptable] = $pri... | php | public function addAcceptable(string $acceptable, float $priority = 1.0): self
{
if (0 > $priority || 1.0 < $priority) {
throw new \InvalidArgumentException(
'Invalid priority, must be between 0 and 1.0'
);
}
$this->acceptables[$acceptable] = $pri... | [
"public",
"function",
"addAcceptable",
"(",
"string",
"$",
"acceptable",
",",
"float",
"$",
"priority",
"=",
"1.0",
")",
":",
"self",
"{",
"if",
"(",
"0",
">",
"$",
"priority",
"||",
"1.0",
"<",
"$",
"priority",
")",
"{",
"throw",
"new",
"\\",
"Inval... | add an acceptable to the list
@param string $acceptable
@param float $priority defaults to 1.0
@return \stubbles\peer\http\AcceptHeader
@throws \InvalidArgumentException | [
"add",
"an",
"acceptable",
"to",
"the",
"list"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/AcceptHeader.php#L74-L84 |
198,105 | stubbles/stubbles-peer | src/main/php/http/AcceptHeader.php | AcceptHeader.priorityFor | public function priorityFor(string $mimeType): float
{
if (!isset($this->acceptables[$mimeType])) {
if ($this->count() === 0) {
return 1.0;
} elseif (isset($this->acceptables['*/*'])) {
return $this->acceptables['*/*'];
}
list(... | php | public function priorityFor(string $mimeType): float
{
if (!isset($this->acceptables[$mimeType])) {
if ($this->count() === 0) {
return 1.0;
} elseif (isset($this->acceptables['*/*'])) {
return $this->acceptables['*/*'];
}
list(... | [
"public",
"function",
"priorityFor",
"(",
"string",
"$",
"mimeType",
")",
":",
"float",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"acceptables",
"[",
"$",
"mimeType",
"]",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"count",
"(",
")",
... | returns priority for given acceptable
If returned priority is 0 the requested acceptable is not in the list. In
case no acceptables were added before every requested acceptable has a
priority of 1.0.
@param string $mimeType
@return float | [
"returns",
"priority",
"for",
"given",
"acceptable"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/AcceptHeader.php#L96-L110 |
198,106 | stubbles/stubbles-peer | src/main/php/http/AcceptHeader.php | AcceptHeader.asString | public function asString(): string
{
$parts = [];
foreach ($this->acceptables as $acceptable => $priority) {
if (1.0 === $priority) {
$parts[] = $acceptable;
} else {
$parts[] = $acceptable . ';q=' . $priority;
}
}
... | php | public function asString(): string
{
$parts = [];
foreach ($this->acceptables as $acceptable => $priority) {
if (1.0 === $priority) {
$parts[] = $acceptable;
} else {
$parts[] = $acceptable . ';q=' . $priority;
}
}
... | [
"public",
"function",
"asString",
"(",
")",
":",
"string",
"{",
"$",
"parts",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"acceptables",
"as",
"$",
"acceptable",
"=>",
"$",
"priority",
")",
"{",
"if",
"(",
"1.0",
"===",
"$",
"priority",
... | returns current list as string
@return string | [
"returns",
"current",
"list",
"as",
"string"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/AcceptHeader.php#L211-L223 |
198,107 | miaoxing/plugin | src/Model/CastTrait.php | CastTrait.castToPhp | protected function castToPhp($value, $column)
{
if ($value !== null && $this->hasCast($column) && !$this->isIgnoreCast($value)) {
$value = $this->toPhpType($value, $this->casts[$column]);
}
return $value;
} | php | protected function castToPhp($value, $column)
{
if ($value !== null && $this->hasCast($column) && !$this->isIgnoreCast($value)) {
$value = $this->toPhpType($value, $this->casts[$column]);
}
return $value;
} | [
"protected",
"function",
"castToPhp",
"(",
"$",
"value",
",",
"$",
"column",
")",
"{",
"if",
"(",
"$",
"value",
"!==",
"null",
"&&",
"$",
"this",
"->",
"hasCast",
"(",
"$",
"column",
")",
"&&",
"!",
"$",
"this",
"->",
"isIgnoreCast",
"(",
"$",
"val... | Cast column value to PHP type
@param mixed $value
@param string $column
@return mixed
@throws \Exception | [
"Cast",
"column",
"value",
"to",
"PHP",
"type"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Model/CastTrait.php#L33-L40 |
198,108 | miaoxing/plugin | src/Model/CastTrait.php | CastTrait.castToDb | protected function castToDb($value, $column)
{
if ($this->hasCast($column) && !$this->isIgnoreCast($value)) {
$value = $this->toDbType($value, $this->casts[$column]);
}
return $value;
} | php | protected function castToDb($value, $column)
{
if ($this->hasCast($column) && !$this->isIgnoreCast($value)) {
$value = $this->toDbType($value, $this->casts[$column]);
}
return $value;
} | [
"protected",
"function",
"castToDb",
"(",
"$",
"value",
",",
"$",
"column",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasCast",
"(",
"$",
"column",
")",
"&&",
"!",
"$",
"this",
"->",
"isIgnoreCast",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
... | Cast column value for saving to database
@param mixed $value
@param string $column
@return mixed | [
"Cast",
"column",
"value",
"for",
"saving",
"to",
"database"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Model/CastTrait.php#L49-L56 |
198,109 | miaoxing/plugin | src/Model/CastTrait.php | CastTrait.toDbType | protected function toDbType($value, $type)
{
switch ($type) {
case 'int':
return (int) $value;
case 'bool':
return (bool) $value;
case 'string':
case 'datetime': // Coverts by database
case 'date':
case... | php | protected function toDbType($value, $type)
{
switch ($type) {
case 'int':
return (int) $value;
case 'bool':
return (bool) $value;
case 'string':
case 'datetime': // Coverts by database
case 'date':
case... | [
"protected",
"function",
"toDbType",
"(",
"$",
"value",
",",
"$",
"type",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"'int'",
":",
"return",
"(",
"int",
")",
"$",
"value",
";",
"case",
"'bool'",
":",
"return",
"(",
"bool",
")",
"$",
... | Cast value for saving to database
@param mixed $value
@param string $type
@return mixed | [
"Cast",
"value",
"for",
"saving",
"to",
"database"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Model/CastTrait.php#L114-L136 |
198,110 | miaoxing/plugin | src/Model/CastTrait.php | CastTrait.cacheJsonDecode | protected function cacheJsonDecode($value, $assoc = false)
{
if (!isset(static::$castCache[$value][$assoc])) {
static::$castCache[$value][$assoc] = json_decode($value, $assoc);
}
return static::$castCache[$value][$assoc];
} | php | protected function cacheJsonDecode($value, $assoc = false)
{
if (!isset(static::$castCache[$value][$assoc])) {
static::$castCache[$value][$assoc] = json_decode($value, $assoc);
}
return static::$castCache[$value][$assoc];
} | [
"protected",
"function",
"cacheJsonDecode",
"(",
"$",
"value",
",",
"$",
"assoc",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"castCache",
"[",
"$",
"value",
"]",
"[",
"$",
"assoc",
"]",
")",
")",
"{",
"static",
"::",... | Cache json decode value
@param string $value
@param bool $assoc
@return mixed | [
"Cache",
"json",
"decode",
"value"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Model/CastTrait.php#L145-L152 |
198,111 | web-chefs/LaraAppSpawn | src/ApplicationResolver.php | ApplicationResolver.makeApp | static public function makeApp($envPath = null, array $config = [], $kernel = null)
{
$envPath = is_null($envPath) ? static::getRuntimePath() : $envPath;
$kernel = is_null($kernel) ? static::defaultKernel() : $kernel;
$config = empty($config) ? static::defaultConfig() : $config;
... | php | static public function makeApp($envPath = null, array $config = [], $kernel = null)
{
$envPath = is_null($envPath) ? static::getRuntimePath() : $envPath;
$kernel = is_null($kernel) ? static::defaultKernel() : $kernel;
$config = empty($config) ? static::defaultConfig() : $config;
... | [
"static",
"public",
"function",
"makeApp",
"(",
"$",
"envPath",
"=",
"null",
",",
"array",
"$",
"config",
"=",
"[",
"]",
",",
"$",
"kernel",
"=",
"null",
")",
"{",
"$",
"envPath",
"=",
"is_null",
"(",
"$",
"envPath",
")",
"?",
"static",
"::",
"getR... | Static factor constructor.
@param string $kernel
@param string $envPath
@param array $segments
@return Kernel instance | [
"Static",
"factor",
"constructor",
"."
] | 0eda486590fe7ca450836b9927a2498ff853cba6 | https://github.com/web-chefs/LaraAppSpawn/blob/0eda486590fe7ca450836b9927a2498ff853cba6/src/ApplicationResolver.php#L58-L65 |
198,112 | web-chefs/LaraAppSpawn | src/ApplicationResolver.php | ApplicationResolver.config | public function config()
{
if ($this->appConfig) {
return $this->appConfig;
}
return $this->appConfig = $this->app->make('config');
} | php | public function config()
{
if ($this->appConfig) {
return $this->appConfig;
}
return $this->appConfig = $this->app->make('config');
} | [
"public",
"function",
"config",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"appConfig",
")",
"{",
"return",
"$",
"this",
"->",
"appConfig",
";",
"}",
"return",
"$",
"this",
"->",
"appConfig",
"=",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"'co... | Get application config repository;
@return Repository | [
"Get",
"application",
"config",
"repository",
";"
] | 0eda486590fe7ca450836b9927a2498ff853cba6 | https://github.com/web-chefs/LaraAppSpawn/blob/0eda486590fe7ca450836b9927a2498ff853cba6/src/ApplicationResolver.php#L142-L149 |
198,113 | web-chefs/LaraAppSpawn | src/ApplicationResolver.php | ApplicationResolver.bootComponents | protected function bootComponents()
{
$config = $this->config();
foreach ($this->componentInstances as $instance) {
$instance->boot($this->app, $config);
}
} | php | protected function bootComponents()
{
$config = $this->config();
foreach ($this->componentInstances as $instance) {
$instance->boot($this->app, $config);
}
} | [
"protected",
"function",
"bootComponents",
"(",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"componentInstances",
"as",
"$",
"instance",
")",
"{",
"$",
"instance",
"->",
"boot",
"(",
"$",... | Boot setup components.
@return void | [
"Boot",
"setup",
"components",
"."
] | 0eda486590fe7ca450836b9927a2498ff853cba6 | https://github.com/web-chefs/LaraAppSpawn/blob/0eda486590fe7ca450836b9927a2498ff853cba6/src/ApplicationResolver.php#L156-L163 |
198,114 | web-chefs/LaraAppSpawn | src/ApplicationResolver.php | ApplicationResolver.setupComponents | protected function setupComponents()
{
$components = Arr::get($this->config, 'components');
foreach ($components as $component) {
$instance = new $component($this->config);
$instance->setup();
$this->componentInstances[ $component ] = $instance;
}
} | php | protected function setupComponents()
{
$components = Arr::get($this->config, 'components');
foreach ($components as $component) {
$instance = new $component($this->config);
$instance->setup();
$this->componentInstances[ $component ] = $instance;
}
} | [
"protected",
"function",
"setupComponents",
"(",
")",
"{",
"$",
"components",
"=",
"Arr",
"::",
"get",
"(",
"$",
"this",
"->",
"config",
",",
"'components'",
")",
";",
"foreach",
"(",
"$",
"components",
"as",
"$",
"component",
")",
"{",
"$",
"instance",
... | Build component instances and run setup method.
@return void | [
"Build",
"component",
"instances",
"and",
"run",
"setup",
"method",
"."
] | 0eda486590fe7ca450836b9927a2498ff853cba6 | https://github.com/web-chefs/LaraAppSpawn/blob/0eda486590fe7ca450836b9927a2498ff853cba6/src/ApplicationResolver.php#L170-L179 |
198,115 | web-chefs/LaraAppSpawn | src/ApplicationResolver.php | ApplicationResolver.buildAppConfig | protected function buildAppConfig($configPath)
{
$config = require($configPath);
$callback = Arr::get($this->config, 'callback.vendor_config');
if ($callback instanceof Closure) {
$config = call_user_func($callback, $config);
}
return $config;
} | php | protected function buildAppConfig($configPath)
{
$config = require($configPath);
$callback = Arr::get($this->config, 'callback.vendor_config');
if ($callback instanceof Closure) {
$config = call_user_func($callback, $config);
}
return $config;
} | [
"protected",
"function",
"buildAppConfig",
"(",
"$",
"configPath",
")",
"{",
"$",
"config",
"=",
"require",
"(",
"$",
"configPath",
")",
";",
"$",
"callback",
"=",
"Arr",
"::",
"get",
"(",
"$",
"this",
"->",
"config",
",",
"'callback.vendor_config'",
")",
... | Include and add our Service Provider to the App config.
@param string $configPath
@return array | [
"Include",
"and",
"add",
"our",
"Service",
"Provider",
"to",
"the",
"App",
"config",
"."
] | 0eda486590fe7ca450836b9927a2498ff853cba6 | https://github.com/web-chefs/LaraAppSpawn/blob/0eda486590fe7ca450836b9927a2498ff853cba6/src/ApplicationResolver.php#L238-L248 |
198,116 | web-chefs/LaraAppSpawn | src/ApplicationResolver.php | ApplicationResolver.getRuntimePath | static public function getRuntimePath($depth = 2)
{
$stack = debug_backtrace();
$frame = $stack[count($stack) - $depth];
return dirname($frame['file']);
} | php | static public function getRuntimePath($depth = 2)
{
$stack = debug_backtrace();
$frame = $stack[count($stack) - $depth];
return dirname($frame['file']);
} | [
"static",
"public",
"function",
"getRuntimePath",
"(",
"$",
"depth",
"=",
"2",
")",
"{",
"$",
"stack",
"=",
"debug_backtrace",
"(",
")",
";",
"$",
"frame",
"=",
"$",
"stack",
"[",
"count",
"(",
"$",
"stack",
")",
"-",
"$",
"depth",
"]",
";",
"retur... | Get the file location of the calling file.
@param integer $depth
@return string | [
"Get",
"the",
"file",
"location",
"of",
"the",
"calling",
"file",
"."
] | 0eda486590fe7ca450836b9927a2498ff853cba6 | https://github.com/web-chefs/LaraAppSpawn/blob/0eda486590fe7ca450836b9927a2498ff853cba6/src/ApplicationResolver.php#L320-L325 |
198,117 | bazzline/php_component_template | source/ExpressiveTemplateAdapter.php | ExpressiveTemplateAdapter.addDefaultParam | public function addDefaultParam($templateName, $param, $value)
{
$isDefaultForAllTemplates = ($templateName === self::TEMPLATE_ALL);
if ($isDefaultForAllTemplates) {
$this->defaultParameters[$param] = $value;
$this->defaultParametersProvided = true;
} else {
... | php | public function addDefaultParam($templateName, $param, $value)
{
$isDefaultForAllTemplates = ($templateName === self::TEMPLATE_ALL);
if ($isDefaultForAllTemplates) {
$this->defaultParameters[$param] = $value;
$this->defaultParametersProvided = true;
} else {
... | [
"public",
"function",
"addDefaultParam",
"(",
"$",
"templateName",
",",
"$",
"param",
",",
"$",
"value",
")",
"{",
"$",
"isDefaultForAllTemplates",
"=",
"(",
"$",
"templateName",
"===",
"self",
"::",
"TEMPLATE_ALL",
")",
";",
"if",
"(",
"$",
"isDefaultForAll... | Add a default parameter to use with a template.
Use this method to provide a default parameter to use when a template is
rendered. The parameter may be overridden by providing it when calling
`render()`, or by calling this method again with a null value.
The parameter will be specific to the template name provided. T... | [
"Add",
"a",
"default",
"parameter",
"to",
"use",
"with",
"a",
"template",
"."
] | 1e0e2b83a7336c457f6e6d38e7d4e091bf2521f4 | https://github.com/bazzline/php_component_template/blob/1e0e2b83a7336c457f6e6d38e7d4e091bf2521f4/source/ExpressiveTemplateAdapter.php#L119-L129 |
198,118 | comodojo/foundation | src/Comodojo/Foundation/Utils/UniqueId.php | UniqueId.generateCustom | public static function generateCustom($prefix, $length=128) {
if ( $length <= (strlen($prefix)+1) ) {
throw new InvalidArgumentException("Uid length cannot be smaller than prefix length +1");
}
return "$prefix-".self::generate($length-(strlen($prefix)+1));
} | php | public static function generateCustom($prefix, $length=128) {
if ( $length <= (strlen($prefix)+1) ) {
throw new InvalidArgumentException("Uid length cannot be smaller than prefix length +1");
}
return "$prefix-".self::generate($length-(strlen($prefix)+1));
} | [
"public",
"static",
"function",
"generateCustom",
"(",
"$",
"prefix",
",",
"$",
"length",
"=",
"128",
")",
"{",
"if",
"(",
"$",
"length",
"<=",
"(",
"strlen",
"(",
"$",
"prefix",
")",
"+",
"1",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",... | Generate a custom uid starting from a prefix
The result uid format will be $string-[random]
@param string $prefix
@param int $length
@return string | [
"Generate",
"a",
"custom",
"uid",
"starting",
"from",
"a",
"prefix"
] | 21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a | https://github.com/comodojo/foundation/blob/21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a/src/Comodojo/Foundation/Utils/UniqueId.php#L32-L41 |
198,119 | comodojo/foundation | src/Comodojo/Foundation/Utils/UniqueId.php | UniqueId.generate | public static function generate($length=128) {
if ($length < 32) {
return substr(self::getUid(), 0, $length);
} else if ($length == 32) {
return self::getUid();
} else {
$numString = (int)($length/32) + 1;
$randNum = "";
for ($i ... | php | public static function generate($length=128) {
if ($length < 32) {
return substr(self::getUid(), 0, $length);
} else if ($length == 32) {
return self::getUid();
} else {
$numString = (int)($length/32) + 1;
$randNum = "";
for ($i ... | [
"public",
"static",
"function",
"generate",
"(",
"$",
"length",
"=",
"128",
")",
"{",
"if",
"(",
"$",
"length",
"<",
"32",
")",
"{",
"return",
"substr",
"(",
"self",
"::",
"getUid",
"(",
")",
",",
"0",
",",
"$",
"length",
")",
";",
"}",
"else",
... | Generate an uid
@param int $length
@return string | [
"Generate",
"an",
"uid"
] | 21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a | https://github.com/comodojo/foundation/blob/21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a/src/Comodojo/Foundation/Utils/UniqueId.php#L49-L69 |
198,120 | stubbles/stubbles-image | src/main/php/Image.php | Image.load | public static function load(string $fileName, ImageDriver $driver = null): self
{
$self = new self($fileName, $driver);
$self->handle = $self->driver->load($fileName);
return $self;
} | php | public static function load(string $fileName, ImageDriver $driver = null): self
{
$self = new self($fileName, $driver);
$self->handle = $self->driver->load($fileName);
return $self;
} | [
"public",
"static",
"function",
"load",
"(",
"string",
"$",
"fileName",
",",
"ImageDriver",
"$",
"driver",
"=",
"null",
")",
":",
"self",
"{",
"$",
"self",
"=",
"new",
"self",
"(",
"$",
"fileName",
",",
"$",
"driver",
")",
";",
"$",
"self",
"->",
"... | loads image from file
@param string $fileName file name of image to load
@param \stubbles\img\ImageDriver $driver optional defaults to PngDriver
@return \stubbles\img\Image | [
"loads",
"image",
"from",
"file"
] | 5ae6488a94c7b2eb97e042875a19ba43efc414fa | https://github.com/stubbles/stubbles-image/blob/5ae6488a94c7b2eb97e042875a19ba43efc414fa/src/main/php/Image.php#L66-L71 |
198,121 | stubbles/stubbles-image | src/main/php/Image.php | Image.store | public function store(string $fileName): self
{
$this->driver->store($fileName, $this->handle);
return $this;
} | php | public function store(string $fileName): self
{
$this->driver->store($fileName, $this->handle);
return $this;
} | [
"public",
"function",
"store",
"(",
"string",
"$",
"fileName",
")",
":",
"self",
"{",
"$",
"this",
"->",
"driver",
"->",
"store",
"(",
"$",
"fileName",
",",
"$",
"this",
"->",
"handle",
")",
";",
"return",
"$",
"this",
";",
"}"
] | stores image under given file name
@param string $fileName
@return \stubbles\img\Image | [
"stores",
"image",
"under",
"given",
"file",
"name"
] | 5ae6488a94c7b2eb97e042875a19ba43efc414fa | https://github.com/stubbles/stubbles-image/blob/5ae6488a94c7b2eb97e042875a19ba43efc414fa/src/main/php/Image.php#L99-L103 |
198,122 | agentmedia/phine-core | src/Core/Logic/Util/MembergroupUtil.php | MembergroupUtil.MemberCheckList | static function MemberCheckList($name, Member $member)
{
$field = new CheckList($name);
self::AddMembergroupOptions($field);
$groupIDs = Membergroup::GetKeyList(self::MemberMembergroups($member));
$field->SetValue($groupIDs);
return $field;
} | php | static function MemberCheckList($name, Member $member)
{
$field = new CheckList($name);
self::AddMembergroupOptions($field);
$groupIDs = Membergroup::GetKeyList(self::MemberMembergroups($member));
$field->SetValue($groupIDs);
return $field;
} | [
"static",
"function",
"MemberCheckList",
"(",
"$",
"name",
",",
"Member",
"$",
"member",
")",
"{",
"$",
"field",
"=",
"new",
"CheckList",
"(",
"$",
"name",
")",
";",
"self",
"::",
"AddMembergroupOptions",
"(",
"$",
"field",
")",
";",
"$",
"groupIDs",
"... | Creates a check list field for groups of a member
@param string $name The field name
@param Member $member The member
@return CheckList Returns the check list | [
"Creates",
"a",
"check",
"list",
"field",
"for",
"groups",
"of",
"a",
"member"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/MembergroupUtil.php#L27-L34 |
198,123 | agentmedia/phine-core | src/Core/Logic/Util/MembergroupUtil.php | MembergroupUtil.PageCheckList | static function PageCheckList($name, Page $page)
{
$field = new CheckList($name);
self::AddMembergroupOptions($field);
$groupIDs = Membergroup::GetKeyList(self::PageMembergroups($page));
$field->SetValue($groupIDs);
return $field;
} | php | static function PageCheckList($name, Page $page)
{
$field = new CheckList($name);
self::AddMembergroupOptions($field);
$groupIDs = Membergroup::GetKeyList(self::PageMembergroups($page));
$field->SetValue($groupIDs);
return $field;
} | [
"static",
"function",
"PageCheckList",
"(",
"$",
"name",
",",
"Page",
"$",
"page",
")",
"{",
"$",
"field",
"=",
"new",
"CheckList",
"(",
"$",
"name",
")",
";",
"self",
"::",
"AddMembergroupOptions",
"(",
"$",
"field",
")",
";",
"$",
"groupIDs",
"=",
... | Creates a check list field for groups of a page
@param string $name The field name
@param Page $page The page
@return CheckList Returns the check list | [
"Creates",
"a",
"check",
"list",
"field",
"for",
"groups",
"of",
"a",
"page"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/MembergroupUtil.php#L42-L49 |
198,124 | agentmedia/phine-core | src/Core/Logic/Util/MembergroupUtil.php | MembergroupUtil.ContentCheckList | static function ContentCheckList($name, Content $content)
{
$field = new CheckList($name);
self::AddMembergroupOptions($field);
$groupIDs = Membergroup::GetKeyList(self::ContentMembergroups($content));
$field->SetValue($groupIDs);
return $field;
} | php | static function ContentCheckList($name, Content $content)
{
$field = new CheckList($name);
self::AddMembergroupOptions($field);
$groupIDs = Membergroup::GetKeyList(self::ContentMembergroups($content));
$field->SetValue($groupIDs);
return $field;
} | [
"static",
"function",
"ContentCheckList",
"(",
"$",
"name",
",",
"Content",
"$",
"content",
")",
"{",
"$",
"field",
"=",
"new",
"CheckList",
"(",
"$",
"name",
")",
";",
"self",
"::",
"AddMembergroupOptions",
"(",
"$",
"field",
")",
";",
"$",
"groupIDs",
... | Creates a check list field for groups of a content
@param string $name The field name
@param Content $content The content
@return CheckList Returns the check list | [
"Creates",
"a",
"check",
"list",
"field",
"for",
"groups",
"of",
"a",
"content"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/MembergroupUtil.php#L57-L64 |
198,125 | agentmedia/phine-core | src/Core/Logic/Util/MembergroupUtil.php | MembergroupUtil.MemberMembergroups | static function MemberMembergroups(Member $member)
{
if (!$member->Exists())
{
return array();
}
$sql = Access::SqlBuilder();
$tblMmg = MemberMembergroup::Schema()->Table();
$tblMg = Membergroup::Schema()->Table();
$join = $sql->Join($tblMmg);
... | php | static function MemberMembergroups(Member $member)
{
if (!$member->Exists())
{
return array();
}
$sql = Access::SqlBuilder();
$tblMmg = MemberMembergroup::Schema()->Table();
$tblMg = Membergroup::Schema()->Table();
$join = $sql->Join($tblMmg);
... | [
"static",
"function",
"MemberMembergroups",
"(",
"Member",
"$",
"member",
")",
"{",
"if",
"(",
"!",
"$",
"member",
"->",
"Exists",
"(",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"sql",
"=",
"Access",
"::",
"SqlBuilder",
"(",
")",
"... | Gets the member's member groups
@param Member $member
@return Membergroup[] Returns the member groups assigned to the user | [
"Gets",
"the",
"member",
"s",
"member",
"groups"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/MembergroupUtil.php#L72-L87 |
198,126 | agentmedia/phine-core | src/Core/Logic/Util/MembergroupUtil.php | MembergroupUtil.PageMembergroups | static function PageMembergroups(Page $page)
{
if (!$page->Exists())
{
return array();
}
$sql = Access::SqlBuilder();
$tblPmg = PageMembergroup::Schema()->Table();
$tblMg = Membergroup::Schema()->Table();
$join = $sql->Join($tblPmg);
$joinC... | php | static function PageMembergroups(Page $page)
{
if (!$page->Exists())
{
return array();
}
$sql = Access::SqlBuilder();
$tblPmg = PageMembergroup::Schema()->Table();
$tblMg = Membergroup::Schema()->Table();
$join = $sql->Join($tblPmg);
$joinC... | [
"static",
"function",
"PageMembergroups",
"(",
"Page",
"$",
"page",
")",
"{",
"if",
"(",
"!",
"$",
"page",
"->",
"Exists",
"(",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"sql",
"=",
"Access",
"::",
"SqlBuilder",
"(",
")",
";",
"$... | Gets the page's member groups
@param Page $page
@return Membergroup[] Returns the member groups assigned to the page | [
"Gets",
"the",
"page",
"s",
"member",
"groups"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/MembergroupUtil.php#L94-L109 |
198,127 | agentmedia/phine-core | src/Core/Logic/Util/MembergroupUtil.php | MembergroupUtil.ContentMembergroups | static function ContentMembergroups(Content $content)
{
if (!$content->Exists())
{
return array();
}
$sql = Access::SqlBuilder();
$tblCmg = ContentMembergroup::Schema()->Table();
$tblMg = Membergroup::Schema()->Table();
$join = $sql->Join($tblCmg);... | php | static function ContentMembergroups(Content $content)
{
if (!$content->Exists())
{
return array();
}
$sql = Access::SqlBuilder();
$tblCmg = ContentMembergroup::Schema()->Table();
$tblMg = Membergroup::Schema()->Table();
$join = $sql->Join($tblCmg);... | [
"static",
"function",
"ContentMembergroups",
"(",
"Content",
"$",
"content",
")",
"{",
"if",
"(",
"!",
"$",
"content",
"->",
"Exists",
"(",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"sql",
"=",
"Access",
"::",
"SqlBuilder",
"(",
")",... | Gets the content's member groups
@param Content $content
@return Membergroup[] Returns the member groups assigned to the content | [
"Gets",
"the",
"content",
"s",
"member",
"groups"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/MembergroupUtil.php#L116-L131 |
198,128 | agentmedia/phine-core | src/Core/Logic/Util/MembergroupUtil.php | MembergroupUtil.AddMembergroupOptions | private static function AddMembergroupOptions(CheckList $field)
{
$sql = Access::SqlBuilder();
$tbl = Membergroup::Schema()->Table();
$orderBy = $sql->OrderList($sql->OrderAsc($tbl->Field('Name')));
$groups = Membergroup::Schema()->Fetch(false, null, $orderBy);
foreach ($grou... | php | private static function AddMembergroupOptions(CheckList $field)
{
$sql = Access::SqlBuilder();
$tbl = Membergroup::Schema()->Table();
$orderBy = $sql->OrderList($sql->OrderAsc($tbl->Field('Name')));
$groups = Membergroup::Schema()->Fetch(false, null, $orderBy);
foreach ($grou... | [
"private",
"static",
"function",
"AddMembergroupOptions",
"(",
"CheckList",
"$",
"field",
")",
"{",
"$",
"sql",
"=",
"Access",
"::",
"SqlBuilder",
"(",
")",
";",
"$",
"tbl",
"=",
"Membergroup",
"::",
"Schema",
"(",
")",
"->",
"Table",
"(",
")",
";",
"$... | Adds the member group options to the checklist
@param CheckList $field | [
"Adds",
"the",
"member",
"group",
"options",
"to",
"the",
"checklist"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/MembergroupUtil.php#L137-L147 |
198,129 | wobblecode/WobbleCodeUserBundle | Document/User.php | User.getRoles | public function getRoles()
{
$roles = $this->roles;
foreach ($this->getGroups() as $group) {
$roles = array_merge($roles, $group->getRoles());
}
$newRoles = [];
if ($this->getActiveRole()) {
$newRoles = $this->getActiveRole()->getRoles();
}
... | php | public function getRoles()
{
$roles = $this->roles;
foreach ($this->getGroups() as $group) {
$roles = array_merge($roles, $group->getRoles());
}
$newRoles = [];
if ($this->getActiveRole()) {
$newRoles = $this->getActiveRole()->getRoles();
}
... | [
"public",
"function",
"getRoles",
"(",
")",
"{",
"$",
"roles",
"=",
"$",
"this",
"->",
"roles",
";",
"foreach",
"(",
"$",
"this",
"->",
"getGroups",
"(",
")",
"as",
"$",
"group",
")",
"{",
"$",
"roles",
"=",
"array_merge",
"(",
"$",
"roles",
",",
... | Returns the user roles
@return array The roles | [
"Returns",
"the",
"user",
"roles"
] | 7b8206f8b4a50fbc61f7bfe4f83eb466cad96440 | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/User.php#L299-L319 |
198,130 | linguisticteam/xml-sitemap | src/news.php | SitemapNews.build | public function build()
{
$values = array( 'access' => false,
'genres' => false,
'publication_date' => false,
'title' => true,
'keywords' => true,
... | php | public function build()
{
$values = array( 'access' => false,
'genres' => false,
'publication_date' => false,
'title' => true,
'keywords' => true,
... | [
"public",
"function",
"build",
"(",
")",
"{",
"$",
"values",
"=",
"array",
"(",
"'access'",
"=>",
"false",
",",
"'genres'",
"=>",
"false",
",",
"'publication_date'",
"=>",
"false",
",",
"'title'",
"=>",
"true",
",",
"'keywords'",
"=>",
"true",
",",
"'sto... | Adds all the nodes in our news sitemap, with some values being escaped. | [
"Adds",
"all",
"the",
"nodes",
"in",
"our",
"news",
"sitemap",
"with",
"some",
"values",
"being",
"escaped",
"."
] | b600a31ad9c1c136fa6f3d3b6a394002121d42f0 | https://github.com/linguisticteam/xml-sitemap/blob/b600a31ad9c1c136fa6f3d3b6a394002121d42f0/src/news.php#L161-L175 |
198,131 | Aviogram/Common | src/PHPClass/Element/DocBlock/TagColumnLength.php | TagColumnLength.setMaxLengths | public function setMaxLengths($column1 = null, $column2 = null, $_ = null)
{
foreach (func_get_args() as $index => $argument) {
$length = strlen((string) $argument);
if ($this->columns->offsetExists($index) === false || $this->columns->offsetGet($index) < $length) {
... | php | public function setMaxLengths($column1 = null, $column2 = null, $_ = null)
{
foreach (func_get_args() as $index => $argument) {
$length = strlen((string) $argument);
if ($this->columns->offsetExists($index) === false || $this->columns->offsetGet($index) < $length) {
... | [
"public",
"function",
"setMaxLengths",
"(",
"$",
"column1",
"=",
"null",
",",
"$",
"column2",
"=",
"null",
",",
"$",
"_",
"=",
"null",
")",
"{",
"foreach",
"(",
"func_get_args",
"(",
")",
"as",
"$",
"index",
"=>",
"$",
"argument",
")",
"{",
"$",
"l... | Set the max column lengths for later use
@param null $column1
@param null $column2
@param null $_
@return self | [
"Set",
"the",
"max",
"column",
"lengths",
"for",
"later",
"use"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/PHPClass/Element/DocBlock/TagColumnLength.php#L30-L41 |
198,132 | Aviogram/Common | src/PHPClass/Element/DocBlock/TagColumnLength.php | TagColumnLength.getColumnPaddingLength | public function getColumnPaddingLength($columnIndex, $columnValue)
{
if ($this->columns->offsetExists($columnIndex) === false) {
return 0;
}
return $this->columns->offsetGet($columnIndex) - strlen($columnValue);
} | php | public function getColumnPaddingLength($columnIndex, $columnValue)
{
if ($this->columns->offsetExists($columnIndex) === false) {
return 0;
}
return $this->columns->offsetGet($columnIndex) - strlen($columnValue);
} | [
"public",
"function",
"getColumnPaddingLength",
"(",
"$",
"columnIndex",
",",
"$",
"columnValue",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"columns",
"->",
"offsetExists",
"(",
"$",
"columnIndex",
")",
"===",
"false",
")",
"{",
"return",
"0",
";",
"}",
"r... | Get the padding needed based on the max column length and the column value given
@param integer $columnIndex
@param string $columnValue
@return integer | [
"Get",
"the",
"padding",
"needed",
"based",
"on",
"the",
"max",
"column",
"length",
"and",
"the",
"column",
"value",
"given"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/PHPClass/Element/DocBlock/TagColumnLength.php#L51-L58 |
198,133 | Programie/PHPCurl | src/main/php/com/selfcoders/phpcurl/CurlMulti.php | CurlMulti.addInstance | public function addInstance(Curl $curlInstance, $name = null)
{
if ($name) {
$this->curlInstances[$name] = $curlInstance;
} else {
$this->curlInstances[] = $curlInstance;
}
end($this->curlInstances);
return key($this->curlInstances);
} | php | public function addInstance(Curl $curlInstance, $name = null)
{
if ($name) {
$this->curlInstances[$name] = $curlInstance;
} else {
$this->curlInstances[] = $curlInstance;
}
end($this->curlInstances);
return key($this->curlInstances);
} | [
"public",
"function",
"addInstance",
"(",
"Curl",
"$",
"curlInstance",
",",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"curlInstances",
"[",
"$",
"name",
"]",
"=",
"$",
"curlInstance",
";",
"}",
"else",
... | Add a Curl instance to this Curl Multi instance
@param Curl $curlInstance Instance of Curl
@param string|null $name An optional name which will be used as key in the instance array
@return mixed The name of the instance (same as $name or the index in array if name is not given) | [
"Add",
"a",
"Curl",
"instance",
"to",
"this",
"Curl",
"Multi",
"instance"
] | 54ef8bba19e87654906f74b14646c1f322ea7241 | https://github.com/Programie/PHPCurl/blob/54ef8bba19e87654906f74b14646c1f322ea7241/src/main/php/com/selfcoders/phpcurl/CurlMulti.php#L19-L29 |
198,134 | Programie/PHPCurl | src/main/php/com/selfcoders/phpcurl/CurlMulti.php | CurlMulti.setOpt | public function setOpt($option, $value)
{
/**
* @var Curl $instance
*/
foreach ($this->curlInstances as $instance) {
$instance->setOpt($option, $value);
}
} | php | public function setOpt($option, $value)
{
/**
* @var Curl $instance
*/
foreach ($this->curlInstances as $instance) {
$instance->setOpt($option, $value);
}
} | [
"public",
"function",
"setOpt",
"(",
"$",
"option",
",",
"$",
"value",
")",
"{",
"/**\n * @var Curl $instance\n */",
"foreach",
"(",
"$",
"this",
"->",
"curlInstances",
"as",
"$",
"instance",
")",
"{",
"$",
"instance",
"->",
"setOpt",
"(",
"$",... | Set the given cURL option for all previously added cURL instances.
@param int $option The cURL option to set (CURLOPT_* constants)
@param mixed $value The new value for the option
@see curl_setopt | [
"Set",
"the",
"given",
"cURL",
"option",
"for",
"all",
"previously",
"added",
"cURL",
"instances",
"."
] | 54ef8bba19e87654906f74b14646c1f322ea7241 | https://github.com/Programie/PHPCurl/blob/54ef8bba19e87654906f74b14646c1f322ea7241/src/main/php/com/selfcoders/phpcurl/CurlMulti.php#L39-L47 |
198,135 | Programie/PHPCurl | src/main/php/com/selfcoders/phpcurl/CurlMulti.php | CurlMulti.subExec | private function subExec($instances, $retryCount = 0, $retryWait = 0)
{
$curlMultiInstance = curl_multi_init();
foreach ($instances as $name => $curlInstance) {
curl_multi_add_handle($curlMultiInstance, $curlInstance->getHandle());
}
do {
curl_multi_exec($cu... | php | private function subExec($instances, $retryCount = 0, $retryWait = 0)
{
$curlMultiInstance = curl_multi_init();
foreach ($instances as $name => $curlInstance) {
curl_multi_add_handle($curlMultiInstance, $curlInstance->getHandle());
}
do {
curl_multi_exec($cu... | [
"private",
"function",
"subExec",
"(",
"$",
"instances",
",",
"$",
"retryCount",
"=",
"0",
",",
"$",
"retryWait",
"=",
"0",
")",
"{",
"$",
"curlMultiInstance",
"=",
"curl_multi_init",
"(",
")",
";",
"foreach",
"(",
"$",
"instances",
"as",
"$",
"name",
... | Execute the requests of all given Curl instances
@param Curl[] $instances An array of Curl instances (key = name of instance)
@param int $retryCount The maximum number of retries
@param int $retryWait Time in seconds to wait between each try | [
"Execute",
"the",
"requests",
"of",
"all",
"given",
"Curl",
"instances"
] | 54ef8bba19e87654906f74b14646c1f322ea7241 | https://github.com/Programie/PHPCurl/blob/54ef8bba19e87654906f74b14646c1f322ea7241/src/main/php/com/selfcoders/phpcurl/CurlMulti.php#L73-L110 |
198,136 | Programie/PHPCurl | src/main/php/com/selfcoders/phpcurl/CurlMulti.php | CurlMulti.exec | public function exec($maxRequests = null, $retryCount = 0, $retryWait = 0, $waitBetweenChunks = 0)
{
if ($maxRequests == null or $maxRequests <= 0) {
$this->subExec($this->curlInstances, $retryCount, $retryWait);
return;
}
$instanceChunks = array_chunk($this->curlIns... | php | public function exec($maxRequests = null, $retryCount = 0, $retryWait = 0, $waitBetweenChunks = 0)
{
if ($maxRequests == null or $maxRequests <= 0) {
$this->subExec($this->curlInstances, $retryCount, $retryWait);
return;
}
$instanceChunks = array_chunk($this->curlIns... | [
"public",
"function",
"exec",
"(",
"$",
"maxRequests",
"=",
"null",
",",
"$",
"retryCount",
"=",
"0",
",",
"$",
"retryWait",
"=",
"0",
",",
"$",
"waitBetweenChunks",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"maxRequests",
"==",
"null",
"or",
"$",
"maxRequ... | Execute the requests of all added Curl instances
@param int|null $maxRequests The maximum number of concurrent requests (null = infinite)
@param int $retryCount The maximum number of retries
@param int $retryWait Time in seconds to wait between each try
@param int $waitBetweenChunks Time in seconds to wait between eac... | [
"Execute",
"the",
"requests",
"of",
"all",
"added",
"Curl",
"instances"
] | 54ef8bba19e87654906f74b14646c1f322ea7241 | https://github.com/Programie/PHPCurl/blob/54ef8bba19e87654906f74b14646c1f322ea7241/src/main/php/com/selfcoders/phpcurl/CurlMulti.php#L120-L137 |
198,137 | Programie/PHPCurl | src/main/php/com/selfcoders/phpcurl/CurlMulti.php | CurlMulti.removeInstance | public function removeInstance($instanceName)
{
$curlInstance = $this->curlInstances[$instanceName];
unset($this->curlInstances[$instanceName]);
return $curlInstance;
} | php | public function removeInstance($instanceName)
{
$curlInstance = $this->curlInstances[$instanceName];
unset($this->curlInstances[$instanceName]);
return $curlInstance;
} | [
"public",
"function",
"removeInstance",
"(",
"$",
"instanceName",
")",
"{",
"$",
"curlInstance",
"=",
"$",
"this",
"->",
"curlInstances",
"[",
"$",
"instanceName",
"]",
";",
"unset",
"(",
"$",
"this",
"->",
"curlInstances",
"[",
"$",
"instanceName",
"]",
"... | Remove the specified instance given by the name
@param mixed $instanceName The name of the instances as returned by addInstance
@return Curl The removed instance | [
"Remove",
"the",
"specified",
"instance",
"given",
"by",
"the",
"name"
] | 54ef8bba19e87654906f74b14646c1f322ea7241 | https://github.com/Programie/PHPCurl/blob/54ef8bba19e87654906f74b14646c1f322ea7241/src/main/php/com/selfcoders/phpcurl/CurlMulti.php#L194-L201 |
198,138 | Programie/PHPCurl | src/main/php/com/selfcoders/phpcurl/CurlMulti.php | CurlMulti.retryFailed | public function retryFailed($curlInstances)
{
$failed = 0;
$curlMultiInstance = new CurlMulti();
/**
* @var $curlInstance Curl
*/
foreach ($curlInstances as $curlInstance) {
if ($curlInstance->isSuccessful()) {
continue;
}
... | php | public function retryFailed($curlInstances)
{
$failed = 0;
$curlMultiInstance = new CurlMulti();
/**
* @var $curlInstance Curl
*/
foreach ($curlInstances as $curlInstance) {
if ($curlInstance->isSuccessful()) {
continue;
}
... | [
"public",
"function",
"retryFailed",
"(",
"$",
"curlInstances",
")",
"{",
"$",
"failed",
"=",
"0",
";",
"$",
"curlMultiInstance",
"=",
"new",
"CurlMulti",
"(",
")",
";",
"/**\n * @var $curlInstance Curl\n */",
"foreach",
"(",
"$",
"curlInstances",
... | Retry all failed requests of the given array of Curl instances.
@param array $curlInstances An array of Curl instances of which failed ones should be retried
@return int The number of failed requests which were retried. | [
"Retry",
"all",
"failed",
"requests",
"of",
"the",
"given",
"array",
"of",
"Curl",
"instances",
"."
] | 54ef8bba19e87654906f74b14646c1f322ea7241 | https://github.com/Programie/PHPCurl/blob/54ef8bba19e87654906f74b14646c1f322ea7241/src/main/php/com/selfcoders/phpcurl/CurlMulti.php#L210-L234 |
198,139 | guni12/comment | src/Comments/ShowOneService.php | ShowOneService.getDecode | public function getDecode(Comm $item, $lead = null)
{
$comt = json_decode($item->comment);
if ($comt->frontmatter->title) {
$til = $comt->frontmatter->title;
} else {
$til = $item->title;
}
$comt = $comt->text;
if ($lead) {
return '... | php | public function getDecode(Comm $item, $lead = null)
{
$comt = json_decode($item->comment);
if ($comt->frontmatter->title) {
$til = $comt->frontmatter->title;
} else {
$til = $item->title;
}
$comt = $comt->text;
if ($lead) {
return '... | [
"public",
"function",
"getDecode",
"(",
"Comm",
"$",
"item",
",",
"$",
"lead",
"=",
"null",
")",
"{",
"$",
"comt",
"=",
"json_decode",
"(",
"$",
"item",
"->",
"comment",
")",
";",
"if",
"(",
"$",
"comt",
"->",
"frontmatter",
"->",
"title",
")",
"{"... | Returns json_decoded title and text
If lead text, headline is larger font
@param object $item
@return string htmlcode | [
"Returns",
"json_decoded",
"title",
"and",
"text",
"If",
"lead",
"text",
"headline",
"is",
"larger",
"font"
] | f9c2f3e2093fea414867f548c5f5e07f96c55bfd | https://github.com/guni12/comment/blob/f9c2f3e2093fea414867f548c5f5e07f96c55bfd/src/Comments/ShowOneService.php#L107-L120 |
198,140 | guni12/comment | src/Comments/ShowOneService.php | ShowOneService.getEdit | public function getEdit($isadmin, $userid, $commid, $htmlcomment)
{
$update = $this->setUrlCreator("comm/update");
if ($isadmin || $userid == $this->sess['id']) {
$edit = '<p><a href="' . $update . '/' . $commid . '">Redigera</a> | ';
$edit .= $htmlcomment;
} else {
... | php | public function getEdit($isadmin, $userid, $commid, $htmlcomment)
{
$update = $this->setUrlCreator("comm/update");
if ($isadmin || $userid == $this->sess['id']) {
$edit = '<p><a href="' . $update . '/' . $commid . '">Redigera</a> | ';
$edit .= $htmlcomment;
} else {
... | [
"public",
"function",
"getEdit",
"(",
"$",
"isadmin",
",",
"$",
"userid",
",",
"$",
"commid",
",",
"$",
"htmlcomment",
")",
"{",
"$",
"update",
"=",
"$",
"this",
"->",
"setUrlCreator",
"(",
"\"comm/update\"",
")",
";",
"if",
"(",
"$",
"isadmin",
"||",
... | If loggedin allowed to edit
@param boolean $isadmin
@param string $userid
@param string $commid
@param string $htmlcomment, link
@return string htmlcode | [
"If",
"loggedin",
"allowed",
"to",
"edit"
] | f9c2f3e2093fea414867f548c5f5e07f96c55bfd | https://github.com/guni12/comment/blob/f9c2f3e2093fea414867f548c5f5e07f96c55bfd/src/Comments/ShowOneService.php#L173-L183 |
198,141 | SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/ImageSizeReducerCollection.php | ImageSizeReducerCollection.writeXML | public function writeXML( \XMLWriter $w, string $elementName = 'ImageSizeReducers' )
{
if ( ! empty( $elementName ) )
{
$w->startElement( $elementName );
}
foreach ( $this as $reducer )
{
if ( \is_null( $reducer ) || ! ( $reducer instanceof ImageSizeReduc... | php | public function writeXML( \XMLWriter $w, string $elementName = 'ImageSizeReducers' )
{
if ( ! empty( $elementName ) )
{
$w->startElement( $elementName );
}
foreach ( $this as $reducer )
{
if ( \is_null( $reducer ) || ! ( $reducer instanceof ImageSizeReduc... | [
"public",
"function",
"writeXML",
"(",
"\\",
"XMLWriter",
"$",
"w",
",",
"string",
"$",
"elementName",
"=",
"'ImageSizeReducers'",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"elementName",
")",
")",
"{",
"$",
"w",
"->",
"startElement",
"(",
"$",
"ele... | Writes the current instance data to defined XMLWriter.
@param \XMLWriter $w
@param string $elementName | [
"Writes",
"the",
"current",
"instance",
"data",
"to",
"defined",
"XMLWriter",
"."
] | 9c82874cf4ec68cb0af78757b65f19783540004a | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/ImageSizeReducerCollection.php#L86-L108 |
198,142 | story75/MultiEventDispatcher | src/ListenerState.php | ListenerState.dispatch | public function dispatch()
{
if ($this->isDispatchable()) {
$sorted = [];
foreach($this->attachedToEvents as $eventName)
{
$sorted[$eventName] = $this->dispatchedEvents[$eventName];
}
call_user_func($this->listener, $sorted);
... | php | public function dispatch()
{
if ($this->isDispatchable()) {
$sorted = [];
foreach($this->attachedToEvents as $eventName)
{
$sorted[$eventName] = $this->dispatchedEvents[$eventName];
}
call_user_func($this->listener, $sorted);
... | [
"public",
"function",
"dispatch",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isDispatchable",
"(",
")",
")",
"{",
"$",
"sorted",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"attachedToEvents",
"as",
"$",
"eventName",
")",
"{",
"$",
"s... | Try to dispatch the event and clear the event cache
@return void | [
"Try",
"to",
"dispatch",
"the",
"event",
"and",
"clear",
"the",
"event",
"cache"
] | 02d6821dbb4a1d05a356b97befb9e286e7c5fd19 | https://github.com/story75/MultiEventDispatcher/blob/02d6821dbb4a1d05a356b97befb9e286e7c5fd19/src/ListenerState.php#L132-L148 |
198,143 | Dhii/config | src/NormalizePathCapableTrait.php | NormalizePathCapableTrait._normalizePath | protected function _normalizePath($path, $separator)
{
try {
return $this->_normalizeIterable($path);
} catch (InvalidArgumentException $e) {
return $this->_stringableSplit($path, $separator);
}
} | php | protected function _normalizePath($path, $separator)
{
try {
return $this->_normalizeIterable($path);
} catch (InvalidArgumentException $e) {
return $this->_stringableSplit($path, $separator);
}
} | [
"protected",
"function",
"_normalizePath",
"(",
"$",
"path",
",",
"$",
"separator",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"_normalizeIterable",
"(",
"$",
"path",
")",
";",
"}",
"catch",
"(",
"InvalidArgumentException",
"$",
"e",
")",
"{",
"r... | Normalizes a path.
Will try to normalize to a list of path segments. If this is not possible, will try to normalize to a string,
and the split that string into segments using the specified separator.
@since [*next-version*]
@param array|stdClass|Traversable|string|Stringable $path The path to normalize.
@param ... | [
"Normalizes",
"a",
"path",
"."
] | 1ab9a7ccf9c0ebd7c6fcbce600b4c00b52b2fdcf | https://github.com/Dhii/config/blob/1ab9a7ccf9c0ebd7c6fcbce600b4c00b52b2fdcf/src/NormalizePathCapableTrait.php#L30-L37 |
198,144 | miguelibero/meinhof | src/Meinhof/Command/Helper/DialogHelper.php | DialogHelper.askForArray | public function askForArray(OutputInterface $output, $question, $default)
{
$result = $this->ask($output, $question, $default);
if (is_string($result)) {
$result = explode(',', $result);
}
if (!is_array($result)) {
$result = array();
}
$result ... | php | public function askForArray(OutputInterface $output, $question, $default)
{
$result = $this->ask($output, $question, $default);
if (is_string($result)) {
$result = explode(',', $result);
}
if (!is_array($result)) {
$result = array();
}
$result ... | [
"public",
"function",
"askForArray",
"(",
"OutputInterface",
"$",
"output",
",",
"$",
"question",
",",
"$",
"default",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"ask",
"(",
"$",
"output",
",",
"$",
"question",
",",
"$",
"default",
")",
";",
"i... | Asks for a list of values, the response is split to return an array
@param OutputInterface $output the command line output
@param string $question the question to ask
@param string $default the default answer
@return array the array of resposne values | [
"Asks",
"for",
"a",
"list",
"of",
"values",
"the",
"response",
"is",
"split",
"to",
"return",
"an",
"array"
] | 3a090f08485dc0da3e27463cf349dba374201072 | https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/Command/Helper/DialogHelper.php#L78-L90 |
198,145 | stubbles/stubbles-date | src/main/php/span/AbstractDatespan.php | AbstractDatespan.amountOfDays | public function amountOfDays(): int
{
return $this->end->handle()->diff($this->start->handle())->days + 1;
} | php | public function amountOfDays(): int
{
return $this->end->handle()->diff($this->start->handle())->days + 1;
} | [
"public",
"function",
"amountOfDays",
"(",
")",
":",
"int",
"{",
"return",
"$",
"this",
"->",
"end",
"->",
"handle",
"(",
")",
"->",
"diff",
"(",
"$",
"this",
"->",
"start",
"->",
"handle",
"(",
")",
")",
"->",
"days",
"+",
"1",
";",
"}"
] | returns amount of days in this datespan
@return int | [
"returns",
"amount",
"of",
"days",
"in",
"this",
"datespan"
] | 98553392bec03affc53a6e3eb7f88408c2720d1c | https://github.com/stubbles/stubbles-date/blob/98553392bec03affc53a6e3eb7f88408c2720d1c/src/main/php/span/AbstractDatespan.php#L144-L147 |
198,146 | stubbles/stubbles-date | src/main/php/span/AbstractDatespan.php | AbstractDatespan.isInFuture | public function isInFuture(): bool
{
$today = mktime(23, 59, 59, (int) date('m'), (int) date('d'), (int) date('Y'));
if ($this->start->timestamp() > $today) {
return true;
}
return false;
} | php | public function isInFuture(): bool
{
$today = mktime(23, 59, 59, (int) date('m'), (int) date('d'), (int) date('Y'));
if ($this->start->timestamp() > $today) {
return true;
}
return false;
} | [
"public",
"function",
"isInFuture",
"(",
")",
":",
"bool",
"{",
"$",
"today",
"=",
"mktime",
"(",
"23",
",",
"59",
",",
"59",
",",
"(",
"int",
")",
"date",
"(",
"'m'",
")",
",",
"(",
"int",
")",
"date",
"(",
"'d'",
")",
",",
"(",
"int",
")",
... | checks whether the DateSpan is in the future compared to current date
@return bool | [
"checks",
"whether",
"the",
"DateSpan",
"is",
"in",
"the",
"future",
"compared",
"to",
"current",
"date"
] | 98553392bec03affc53a6e3eb7f88408c2720d1c | https://github.com/stubbles/stubbles-date/blob/98553392bec03affc53a6e3eb7f88408c2720d1c/src/main/php/span/AbstractDatespan.php#L154-L162 |
198,147 | stubbles/stubbles-date | src/main/php/span/AbstractDatespan.php | AbstractDatespan.containsDate | public function containsDate($date): bool
{
$date = Date::castFrom($date);
if (!$this->start->isBefore($date) && !$this->start->equals($date)) {
return false;
}
if (!$this->end->isAfter($date) && !$this->end->equals($date)) {
return false;
}
... | php | public function containsDate($date): bool
{
$date = Date::castFrom($date);
if (!$this->start->isBefore($date) && !$this->start->equals($date)) {
return false;
}
if (!$this->end->isAfter($date) && !$this->end->equals($date)) {
return false;
}
... | [
"public",
"function",
"containsDate",
"(",
"$",
"date",
")",
":",
"bool",
"{",
"$",
"date",
"=",
"Date",
"::",
"castFrom",
"(",
"$",
"date",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"start",
"->",
"isBefore",
"(",
"$",
"date",
")",
"&&",
"!",... | checks whether the span contains the given date
@param int|string|\DateTime|\stubbles\date\Date $date
@return bool | [
"checks",
"whether",
"the",
"span",
"contains",
"the",
"given",
"date"
] | 98553392bec03affc53a6e3eb7f88408c2720d1c | https://github.com/stubbles/stubbles-date/blob/98553392bec03affc53a6e3eb7f88408c2720d1c/src/main/php/span/AbstractDatespan.php#L170-L182 |
198,148 | cubicmushroom/hexagonal-components | src/Command/AbstractCommandHandler.php | AbstractCommandHandler.handle | final public function handle(CommandInterface $command)
{
$this->validateCommand($command);
try {
// @todo - Update this to return the succes event object, rather than using the getSuccessEvent() method
$this->_handle($command);
} catch (\Exception $exception) {
... | php | final public function handle(CommandInterface $command)
{
$this->validateCommand($command);
try {
// @todo - Update this to return the succes event object, rather than using the getSuccessEvent() method
$this->_handle($command);
} catch (\Exception $exception) {
... | [
"final",
"public",
"function",
"handle",
"(",
"CommandInterface",
"$",
"command",
")",
"{",
"$",
"this",
"->",
"validateCommand",
"(",
"$",
"command",
")",
";",
"try",
"{",
"// @todo - Update this to return the succes event object, rather than using the getSuccessEvent() me... | Processes the associated command
@param CommandInterface $command
@return void
@throws \Exception if _handler() throws an error | [
"Processes",
"the",
"associated",
"command"
] | bc622ad0efc9884ce584ffd84c785e7d51fba981 | https://github.com/cubicmushroom/hexagonal-components/blob/bc622ad0efc9884ce584ffd84c785e7d51fba981/src/Command/AbstractCommandHandler.php#L76-L100 |
198,149 | cubicmushroom/hexagonal-components | src/Command/AbstractCommandHandler.php | AbstractCommandHandler.logError | function logError($errorMessage, \Exception $exception)
{
if ($this->logger instanceof LoggerInterface) {
$this->logger->error($errorMessage . "\n" . $exception->getTraceAsString());
}
} | php | function logError($errorMessage, \Exception $exception)
{
if ($this->logger instanceof LoggerInterface) {
$this->logger->error($errorMessage . "\n" . $exception->getTraceAsString());
}
} | [
"function",
"logError",
"(",
"$",
"errorMessage",
",",
"\\",
"Exception",
"$",
"exception",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"logger",
"instanceof",
"LoggerInterface",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"error",
"(",
"$",
"errorMessage",
... | Logs an error, if the error logger is available
@param string $errorMessage
@param \Exception $exception | [
"Logs",
"an",
"error",
"if",
"the",
"error",
"logger",
"is",
"available"
] | bc622ad0efc9884ce584ffd84c785e7d51fba981 | https://github.com/cubicmushroom/hexagonal-components/blob/bc622ad0efc9884ce584ffd84c785e7d51fba981/src/Command/AbstractCommandHandler.php#L131-L136 |
198,150 | twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.Link | public function Link($action = null)
{
if ($this->currentRecord) {
return Controller::join_links($this->parentController->Link(), "/{$this->currentRecord->ID}/{$action}");
} else {
return $this->parentController->Link();
}
} | php | public function Link($action = null)
{
if ($this->currentRecord) {
return Controller::join_links($this->parentController->Link(), "/{$this->currentRecord->ID}/{$action}");
} else {
return $this->parentController->Link();
}
} | [
"public",
"function",
"Link",
"(",
"$",
"action",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"currentRecord",
")",
"{",
"return",
"Controller",
"::",
"join_links",
"(",
"$",
"this",
"->",
"parentController",
"->",
"Link",
"(",
")",
",",
"\"/{... | Link fragment - appends the current record ID to the URL.
@param string $action Optional action
@return string | [
"Link",
"fragment",
"-",
"appends",
"the",
"current",
"record",
"ID",
"to",
"the",
"URL",
"."
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L112-L120 |
198,151 | twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.view | public function view($request)
{
if (!$this->currentRecord) {
return $this->httpError(404, "{$this->recordType} not found");
}
if (!$this->currentRecord->canView()) {
return $this->httpError(403, "You do not have permission to view this {$this->recordType}");
... | php | public function view($request)
{
if (!$this->currentRecord) {
return $this->httpError(404, "{$this->recordType} not found");
}
if (!$this->currentRecord->canView()) {
return $this->httpError(403, "You do not have permission to view this {$this->recordType}");
... | [
"public",
"function",
"view",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"currentRecord",
")",
"{",
"return",
"$",
"this",
"->",
"httpError",
"(",
"404",
",",
"\"{$this->recordType} not found\"",
")",
";",
"}",
"if",
"(",
"!",
"$... | Returns the view of the record | [
"Returns",
"the",
"view",
"of",
"the",
"record"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L145-L157 |
198,152 | twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.edit | public function edit($request)
{
if (!$this->currentRecord) {
return $this->httpError(404, "{$this->recordType} not found");
}
if (!$this->currentRecord->canEdit()) {
return $this->httpError(403, "You do not have permission to edit this {$this->recordType}");
... | php | public function edit($request)
{
if (!$this->currentRecord) {
return $this->httpError(404, "{$this->recordType} not found");
}
if (!$this->currentRecord->canEdit()) {
return $this->httpError(403, "You do not have permission to edit this {$this->recordType}");
... | [
"public",
"function",
"edit",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"currentRecord",
")",
"{",
"return",
"$",
"this",
"->",
"httpError",
"(",
"404",
",",
"\"{$this->recordType} not found\"",
")",
";",
"}",
"if",
"(",
"!",
"$... | Returns a form for editing the record | [
"Returns",
"a",
"form",
"for",
"editing",
"the",
"record"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L162-L172 |
198,153 | twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.getViewer | function getViewer($action)
{
if ($this->parentController) {
if (is_numeric($action)) {
$action = 'view';
}
$viewer = $this->parentController->getViewer($action);
$layoutTemplate = null;
// action-specific template with template ide... | php | function getViewer($action)
{
if ($this->parentController) {
if (is_numeric($action)) {
$action = 'view';
}
$viewer = $this->parentController->getViewer($action);
$layoutTemplate = null;
// action-specific template with template ide... | [
"function",
"getViewer",
"(",
"$",
"action",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"parentController",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"action",
")",
")",
"{",
"$",
"action",
"=",
"'view'",
";",
"}",
"$",
"viewer",
"=",
"$",
"this",
... | If a parentcontroller exists, use its main template,
and mix in specific collectioncontroller subtemplates. | [
"If",
"a",
"parentcontroller",
"exists",
"use",
"its",
"main",
"template",
"and",
"mix",
"in",
"specific",
"collectioncontroller",
"subtemplates",
"."
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L194-L226 |
198,154 | twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.Form | public function Form()
{
if ($this->currentRecord) {
$fields = $this->currentRecord->getFrontEndFields();
$required = $this->currentRecord->getRequiredFields();
} else {
$fields = singleton($this->recordType)->getFrontEndFields();
$required = singleton... | php | public function Form()
{
if ($this->currentRecord) {
$fields = $this->currentRecord->getFrontEndFields();
$required = $this->currentRecord->getRequiredFields();
} else {
$fields = singleton($this->recordType)->getFrontEndFields();
$required = singleton... | [
"public",
"function",
"Form",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"currentRecord",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"currentRecord",
"->",
"getFrontEndFields",
"(",
")",
";",
"$",
"required",
"=",
"$",
"this",
"->",
"currentRec... | Scaffolds the fields required for editing the record
@return Form | [
"Scaffolds",
"the",
"fields",
"required",
"for",
"editing",
"the",
"record"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L233-L249 |
198,155 | twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.doSave | public function doSave($data, $form)
{
if (!$this->currentRecord) {
$this->currentRecord = new $this->recordType();
}
$form->saveInto($this->currentRecord);
$this->currentRecord->write();
$this->redirect($this->Link());
} | php | public function doSave($data, $form)
{
if (!$this->currentRecord) {
$this->currentRecord = new $this->recordType();
}
$form->saveInto($this->currentRecord);
$this->currentRecord->write();
$this->redirect($this->Link());
} | [
"public",
"function",
"doSave",
"(",
"$",
"data",
",",
"$",
"form",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"currentRecord",
")",
"{",
"$",
"this",
"->",
"currentRecord",
"=",
"new",
"$",
"this",
"->",
"recordType",
"(",
")",
";",
"}",
"$",
... | Save the record | [
"Save",
"the",
"record"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L254-L262 |
198,156 | twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.httpError | public function httpError($code, $message = null)
{
if ($this->request->isMedia() || !$response = ErrorPage::response_for($code)) {
parent::httpError($code, $message);
} else {
throw new HTTPResponse_Exception($response);
}
} | php | public function httpError($code, $message = null)
{
if ($this->request->isMedia() || !$response = ErrorPage::response_for($code)) {
parent::httpError($code, $message);
} else {
throw new HTTPResponse_Exception($response);
}
} | [
"public",
"function",
"httpError",
"(",
"$",
"code",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"request",
"->",
"isMedia",
"(",
")",
"||",
"!",
"$",
"response",
"=",
"ErrorPage",
"::",
"response_for",
"(",
"$",
"code",... | Show a pretty error, if possible
@uses ErrorPage::response_for() | [
"Show",
"a",
"pretty",
"error",
"if",
"possible"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L277-L284 |
198,157 | twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.addCrumb | public function addCrumb($title, $link = null)
{
$this->Title = $title;
if ($link) {
array_push($this->crumbs, "<a href=\"$link\">$title</a>");
} else {
array_push($this->crumbs, $title);
}
} | php | public function addCrumb($title, $link = null)
{
$this->Title = $title;
if ($link) {
array_push($this->crumbs, "<a href=\"$link\">$title</a>");
} else {
array_push($this->crumbs, $title);
}
} | [
"public",
"function",
"addCrumb",
"(",
"$",
"title",
",",
"$",
"link",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"Title",
"=",
"$",
"title",
";",
"if",
"(",
"$",
"link",
")",
"{",
"array_push",
"(",
"$",
"this",
"->",
"crumbs",
",",
"\"<a href=\\\"... | Adds a breadcrumb action | [
"Adds",
"a",
"breadcrumb",
"action"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L289-L297 |
198,158 | twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.Breadcrumbs | public function Breadcrumbs()
{
$parts = explode(self::$breadcrumbs_delimiter, $this->parentController->Breadcrumbs());
// The last part is never a link, need to recreate
array_pop($parts);
array_push($parts,
'<a href="' . $this->parentController->Link() . '">' . $this->p... | php | public function Breadcrumbs()
{
$parts = explode(self::$breadcrumbs_delimiter, $this->parentController->Breadcrumbs());
// The last part is never a link, need to recreate
array_pop($parts);
array_push($parts,
'<a href="' . $this->parentController->Link() . '">' . $this->p... | [
"public",
"function",
"Breadcrumbs",
"(",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"self",
"::",
"$",
"breadcrumbs_delimiter",
",",
"$",
"this",
"->",
"parentController",
"->",
"Breadcrumbs",
"(",
")",
")",
";",
"// The last part is never a link, need to recre... | Build on the breadcrumbs to show the nested actions
@return array | [
"Build",
"on",
"the",
"breadcrumbs",
"to",
"show",
"the",
"nested",
"actions"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L304-L319 |
198,159 | bhrdn/Diactoros | src/Diactoros.php | DiactorosEngine.addReplacer | public function addReplacer(array $replacer)
{
foreach ($replacer as $key => $value) {
Unicode::$char[$key] = $value;
}
} | php | public function addReplacer(array $replacer)
{
foreach ($replacer as $key => $value) {
Unicode::$char[$key] = $value;
}
} | [
"public",
"function",
"addReplacer",
"(",
"array",
"$",
"replacer",
")",
"{",
"foreach",
"(",
"$",
"replacer",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"Unicode",
"::",
"$",
"char",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"}"
] | Add array list for replacer
@param array $replacer | [
"Add",
"array",
"list",
"for",
"replacer"
] | 9b894241e4c502d1131ba3c90197f74bc70ffed8 | https://github.com/bhrdn/Diactoros/blob/9b894241e4c502d1131ba3c90197f74bc70ffed8/src/Diactoros.php#L34-L39 |
198,160 | bhrdn/Diactoros | src/Diactoros.php | DiactorosEngine.replaceText | public function replaceText(string $str) : string
{
foreach (Unicode::$char as $key => $value) {
if ($key === $str) {
$result = ((count($value) > 1) ? Unicode::$char[$key][random_int(0, count($value)-1)] : Unicode::$char[$key][0]);
}
}
return $result ?? $str;
} | php | public function replaceText(string $str) : string
{
foreach (Unicode::$char as $key => $value) {
if ($key === $str) {
$result = ((count($value) > 1) ? Unicode::$char[$key][random_int(0, count($value)-1)] : Unicode::$char[$key][0]);
}
}
return $result ?? $str;
} | [
"public",
"function",
"replaceText",
"(",
"string",
"$",
"str",
")",
":",
"string",
"{",
"foreach",
"(",
"Unicode",
"::",
"$",
"char",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"key",
"===",
"$",
"str",
")",
"{",
"$",
"resul... | Replace text with unicode character
@param string $str
@return string | [
"Replace",
"text",
"with",
"unicode",
"character"
] | 9b894241e4c502d1131ba3c90197f74bc70ffed8 | https://github.com/bhrdn/Diactoros/blob/9b894241e4c502d1131ba3c90197f74bc70ffed8/src/Diactoros.php#L47-L56 |
198,161 | bhrdn/Diactoros | src/Diactoros.php | Diactoros.encode | public function encode()
{
foreach ($this->body as $key => $value) {
$result[] = $this->replaceText($value);
}
return implode('', $result);
} | php | public function encode()
{
foreach ($this->body as $key => $value) {
$result[] = $this->replaceText($value);
}
return implode('', $result);
} | [
"public",
"function",
"encode",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"body",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"result",
"[",
"]",
"=",
"$",
"this",
"->",
"replaceText",
"(",
"$",
"value",
")",
";",
"}",
"return",
... | Replace character with new unicode character
@return unicode character | [
"Replace",
"character",
"with",
"new",
"unicode",
"character"
] | 9b894241e4c502d1131ba3c90197f74bc70ffed8 | https://github.com/bhrdn/Diactoros/blob/9b894241e4c502d1131ba3c90197f74bc70ffed8/src/Diactoros.php#L66-L73 |
198,162 | wb-crowdfusion/crowdfusion | system/core/classes/libraries/database/Query.php | Query.build | public function build($sql='')
{
$sql .= "\n";
if (!empty($this->selectParams[self::SELECT])) {
$sql = "SELECT ".implode(",\n", $this->selectParams[self::SELECT]);
}
if (!empty($this->selectParams[self::FROM])) {
$sql .= "\nFROM ".implode(",\n", $this->select... | php | public function build($sql='')
{
$sql .= "\n";
if (!empty($this->selectParams[self::SELECT])) {
$sql = "SELECT ".implode(",\n", $this->selectParams[self::SELECT]);
}
if (!empty($this->selectParams[self::FROM])) {
$sql .= "\nFROM ".implode(",\n", $this->select... | [
"public",
"function",
"build",
"(",
"$",
"sql",
"=",
"''",
")",
"{",
"$",
"sql",
".=",
"\"\\n\"",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"selectParams",
"[",
"self",
"::",
"SELECT",
"]",
")",
")",
"{",
"$",
"sql",
"=",
"\"SELECT \"... | Creates the SQL query
@param string $sql A prefix, or string that will be pre-pended to the generated query.
@return string A SQL query string | [
"Creates",
"the",
"SQL",
"query"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/database/Query.php#L62-L109 |
198,163 | wb-crowdfusion/crowdfusion | system/core/classes/libraries/database/Query.php | Query.limit | public function limit($limit)
{
if(!empty($limit))
$this->selectParams[self::LIMIT] = $limit;
else
unset($this->selectParams[self::LIMIT]);
return $this;
} | php | public function limit($limit)
{
if(!empty($limit))
$this->selectParams[self::LIMIT] = $limit;
else
unset($this->selectParams[self::LIMIT]);
return $this;
} | [
"public",
"function",
"limit",
"(",
"$",
"limit",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"limit",
")",
")",
"$",
"this",
"->",
"selectParams",
"[",
"self",
"::",
"LIMIT",
"]",
"=",
"$",
"limit",
";",
"else",
"unset",
"(",
"$",
"this",
"->",... | Sets the LIMIT clause for the query.
If a NULL value is specified, the limit is removed from the query.
@param string $limit The limit to use. If NULL, the limit is cleared.
@return this | [
"Sets",
"the",
"LIMIT",
"clause",
"for",
"the",
"query",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/database/Query.php#L248-L255 |
198,164 | wb-crowdfusion/crowdfusion | system/core/classes/libraries/database/Query.php | Query.offset | public function offset($offset)
{
if(!empty($offset))
$this->selectParams[self::OFFSET] = $offset;
return $this;
} | php | public function offset($offset)
{
if(!empty($offset))
$this->selectParams[self::OFFSET] = $offset;
return $this;
} | [
"public",
"function",
"offset",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"offset",
")",
")",
"$",
"this",
"->",
"selectParams",
"[",
"self",
"::",
"OFFSET",
"]",
"=",
"$",
"offset",
";",
"return",
"$",
"this",
";",
"}"
] | Sets or clears the offset for the query.
If null is specified, the offset is cleared.
@param string $offset The offset to use. If NULL, the offset is cleared.
@return this | [
"Sets",
"or",
"clears",
"the",
"offset",
"for",
"the",
"query",
".",
"If",
"null",
"is",
"specified",
"the",
"offset",
"is",
"cleared",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/database/Query.php#L265-L270 |
198,165 | wb-crowdfusion/crowdfusion | system/core/classes/libraries/database/Query.php | Query.setClause | protected function setClause($section, $clause)
{
if(!isset($this->selectParams[$section]))
$this->selectParams[$section] = array();
if(empty($clause))
unset($this->selectParams[$section]);
else if(is_array($clause))
$this->selectParams[$section] = array_... | php | protected function setClause($section, $clause)
{
if(!isset($this->selectParams[$section]))
$this->selectParams[$section] = array();
if(empty($clause))
unset($this->selectParams[$section]);
else if(is_array($clause))
$this->selectParams[$section] = array_... | [
"protected",
"function",
"setClause",
"(",
"$",
"section",
",",
"$",
"clause",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"selectParams",
"[",
"$",
"section",
"]",
")",
")",
"$",
"this",
"->",
"selectParams",
"[",
"$",
"section",
"]",... | The setter used internally in this function to build each clause.
If {@link $clause} is an array, it uses the value of clause to set the section.
Otherwise, {@link $clause} is appended to the section.
@param string $section The section to update
@param mixed $clause The clause to use.
@return void | [
"The",
"setter",
"used",
"internally",
"in",
"this",
"function",
"to",
"build",
"each",
"clause",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/database/Query.php#L283-L295 |
198,166 | lasallecms/lasallecms-l5-lasallecmsapi-pkg | src/Repositories/UserRepository.php | UserRepository.validatePasswordNotUseWordPassword | public function validatePasswordNotUseWordPassword($password) {
$washedPassword = trim($password);
$washedPassword = strtolower($password);
// if the word "password" resides within the password, then no good
if (strpos($washedPassword, "password") !== false) {
return false;
... | php | public function validatePasswordNotUseWordPassword($password) {
$washedPassword = trim($password);
$washedPassword = strtolower($password);
// if the word "password" resides within the password, then no good
if (strpos($washedPassword, "password") !== false) {
return false;
... | [
"public",
"function",
"validatePasswordNotUseWordPassword",
"(",
"$",
"password",
")",
"{",
"$",
"washedPassword",
"=",
"trim",
"(",
"$",
"password",
")",
";",
"$",
"washedPassword",
"=",
"strtolower",
"(",
"$",
"password",
")",
";",
"// if the word \"password\" r... | Password should not use the word "password"
I am countering a pet peeve!
@param text $password
@return bool | [
"Password",
"should",
"not",
"use",
"the",
"word",
"password"
] | 05083be19645d52be86d8ba4f322773db348a11d | https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/UserRepository.php#L271-L281 |
198,167 | lasallecms/lasallecms-l5-lasallecmsapi-pkg | src/Repositories/UserRepository.php | UserRepository.validatePasswordNotUseUsername | public function validatePasswordNotUseUsername($username, $password) {
$washedPassword = trim($password);
$washedPassword = strtolower($password);
$washedUsername = trim($username);
$washedUsername = strtolower($username);
if ($washedPassword == $washedUsername) {
r... | php | public function validatePasswordNotUseUsername($username, $password) {
$washedPassword = trim($password);
$washedPassword = strtolower($password);
$washedUsername = trim($username);
$washedUsername = strtolower($username);
if ($washedPassword == $washedUsername) {
r... | [
"public",
"function",
"validatePasswordNotUseUsername",
"(",
"$",
"username",
",",
"$",
"password",
")",
"{",
"$",
"washedPassword",
"=",
"trim",
"(",
"$",
"password",
")",
";",
"$",
"washedPassword",
"=",
"strtolower",
"(",
"$",
"password",
")",
";",
"$",
... | Password should not be the username
In my experience, some bots use the username as the password
@param text $username
@param text $password
@return bool | [
"Password",
"should",
"not",
"be",
"the",
"username"
] | 05083be19645d52be86d8ba4f322773db348a11d | https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/UserRepository.php#L292-L325 |
198,168 | lasallecms/lasallecms-l5-lasallecmsapi-pkg | src/Repositories/UserRepository.php | UserRepository.getPeopleIdForIndexListing | public function getPeopleIdForIndexListing($id) {
// Does the PEOPLES table exist?
if (Schema::hasTable('peoples')) {
$person = DB::table('peoples')->where('user_id', '=', $id)->first();
if (!$person) return "Not in LaSalleCRM";
$full_url = route('admin.crmpeoples.e... | php | public function getPeopleIdForIndexListing($id) {
// Does the PEOPLES table exist?
if (Schema::hasTable('peoples')) {
$person = DB::table('peoples')->where('user_id', '=', $id)->first();
if (!$person) return "Not in LaSalleCRM";
$full_url = route('admin.crmpeoples.e... | [
"public",
"function",
"getPeopleIdForIndexListing",
"(",
"$",
"id",
")",
"{",
"// Does the PEOPLES table exist?",
"if",
"(",
"Schema",
"::",
"hasTable",
"(",
"'peoples'",
")",
")",
"{",
"$",
"person",
"=",
"DB",
"::",
"table",
"(",
"'peoples'",
")",
"->",
"w... | Get the ID from the PEOPLES table
@param int $id Users table ID
@return mixed | [
"Get",
"the",
"ID",
"from",
"the",
"PEOPLES",
"table"
] | 05083be19645d52be86d8ba4f322773db348a11d | https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/UserRepository.php#L489-L508 |
198,169 | sndsgd/sndsgd-event | src/event/Target.php | Target.on | public function on($event, $handler, $prepend = false)
{
if (!is_string($event)) {
throw new InvalidArgumentException(
"invalid value provided for 'event'; ".
"expecting an event name as string"
);
}
$handler = new Handler($event, $handler);
if ($pre... | php | public function on($event, $handler, $prepend = false)
{
if (!is_string($event)) {
throw new InvalidArgumentException(
"invalid value provided for 'event'; ".
"expecting an event name as string"
);
}
$handler = new Handler($event, $handler);
if ($pre... | [
"public",
"function",
"on",
"(",
"$",
"event",
",",
"$",
"handler",
",",
"$",
"prepend",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"event",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"invalid value provided for '... | Add an event handler
@param string $event The name of the event
@param string|callable $handler The function that handles the event
@param boolean $prepend Add the handler at the top of the stack
@return sndsgd\event\Target
@throws InvalidArgumentException If the event isn't a string | [
"Add",
"an",
"event",
"handler"
] | 531bd348fd77db6a27346aa6dfec43e99ecd3eef | https://github.com/sndsgd/sndsgd-event/blob/531bd348fd77db6a27346aa6dfec43e99ecd3eef/src/event/Target.php#L40-L58 |
198,170 | sndsgd/sndsgd-event | src/event/Target.php | Target.off | public function off($event)
{
list($type, $namespace) = Event::split($event);
for ($i=count($this->eventHandlers)-1; $i>-1; $i--) {
$h = $this->eventHandlers[$i];
if ($type !== null && $h->getType() !== $type) {
continue;
}
else if ($namespace !== null && ... | php | public function off($event)
{
list($type, $namespace) = Event::split($event);
for ($i=count($this->eventHandlers)-1; $i>-1; $i--) {
$h = $this->eventHandlers[$i];
if ($type !== null && $h->getType() !== $type) {
continue;
}
else if ($namespace !== null && ... | [
"public",
"function",
"off",
"(",
"$",
"event",
")",
"{",
"list",
"(",
"$",
"type",
",",
"$",
"namespace",
")",
"=",
"Event",
"::",
"split",
"(",
"$",
"event",
")",
";",
"for",
"(",
"$",
"i",
"=",
"count",
"(",
"$",
"this",
"->",
"eventHandlers",... | Remove one or more event handlers
@param string $event An event type/namespace combo
@return sndsgd\event\Target | [
"Remove",
"one",
"or",
"more",
"event",
"handlers"
] | 531bd348fd77db6a27346aa6dfec43e99ecd3eef | https://github.com/sndsgd/sndsgd-event/blob/531bd348fd77db6a27346aa6dfec43e99ecd3eef/src/event/Target.php#L66-L83 |
198,171 | sndsgd/sndsgd-event | src/event/Target.php | Target.fire | public function fire($event, array $data = [])
{
if (is_string($event)) {
$event = new Event($event);
$event->setData($data);
}
else if ($event instanceof Event) {
if ($data) {
$event->addData($data);
}
}
else {
throw new InvalidA... | php | public function fire($event, array $data = [])
{
if (is_string($event)) {
$event = new Event($event);
$event->setData($data);
}
else if ($event instanceof Event) {
if ($data) {
$event->addData($data);
}
}
else {
throw new InvalidA... | [
"public",
"function",
"fire",
"(",
"$",
"event",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"event",
")",
")",
"{",
"$",
"event",
"=",
"new",
"Event",
"(",
"$",
"event",
")",
";",
"$",
"event",
"->",
... | Call all handlers for a given event
Note: if a handler returns boolean false, any remaining handlers are skipped
@param sndsgd\Event|string $event An event, or a type/namespace combo
@param array.<string,mixed> $data Data to add to the event
@return boolean
@return boolean:false A handler returned false
@return boolea... | [
"Call",
"all",
"handlers",
"for",
"a",
"given",
"event"
] | 531bd348fd77db6a27346aa6dfec43e99ecd3eef | https://github.com/sndsgd/sndsgd-event/blob/531bd348fd77db6a27346aa6dfec43e99ecd3eef/src/event/Target.php#L96-L125 |
198,172 | agentmedia/phine-core | src/Core/Modules/Backend/TemplateList.php | TemplateList.BeforeInit | protected function BeforeInit()
{
if ($this->RemoveTemplate())
{
Response::Redirect(Request::Uri());
return true;
}
parent::BeforeInit();
} | php | protected function BeforeInit()
{
if ($this->RemoveTemplate())
{
Response::Redirect(Request::Uri());
return true;
}
parent::BeforeInit();
} | [
"protected",
"function",
"BeforeInit",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"RemoveTemplate",
"(",
")",
")",
"{",
"Response",
"::",
"Redirect",
"(",
"Request",
"::",
"Uri",
"(",
")",
")",
";",
"return",
"true",
";",
"}",
"parent",
"::",
"Befo... | Removes the template if necessary | [
"Removes",
"the",
"template",
"if",
"necessary"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/TemplateList.php#L24-L32 |
198,173 | agentmedia/phine-core | src/Core/Modules/Backend/TemplateList.php | TemplateList.InitBundles | protected function InitBundles()
{
$bundles = PathUtil::Bundles();
$this->bundles = array();
foreach ($bundles as $bundle)
{
if (count($this->BundleModules($bundle)) > 0)
{
$this->bundles[] = $bundle;
}
}
} | php | protected function InitBundles()
{
$bundles = PathUtil::Bundles();
$this->bundles = array();
foreach ($bundles as $bundle)
{
if (count($this->BundleModules($bundle)) > 0)
{
$this->bundles[] = $bundle;
}
}
} | [
"protected",
"function",
"InitBundles",
"(",
")",
"{",
"$",
"bundles",
"=",
"PathUtil",
"::",
"Bundles",
"(",
")",
";",
"$",
"this",
"->",
"bundles",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"bundles",
"as",
"$",
"bundle",
")",
"{",
"if",
... | Initializes the bundle names by fetching those containing modules with adjustable templates | [
"Initializes",
"the",
"bundle",
"names",
"by",
"fetching",
"those",
"containing",
"modules",
"with",
"adjustable",
"templates"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/TemplateList.php#L45-L56 |
198,174 | agentmedia/phine-core | src/Core/Modules/Backend/TemplateList.php | TemplateList.ModuleTemplates | protected function ModuleTemplates($module)
{
$folder = PathUtil::ModuleCustomTemplatesFolder($module);
if (!Folder::Exists($folder))
{
return array();
}
$templates = Folder::GetFiles($folder);
$result = array();
foreach ($templates as $template)
... | php | protected function ModuleTemplates($module)
{
$folder = PathUtil::ModuleCustomTemplatesFolder($module);
if (!Folder::Exists($folder))
{
return array();
}
$templates = Folder::GetFiles($folder);
$result = array();
foreach ($templates as $template)
... | [
"protected",
"function",
"ModuleTemplates",
"(",
"$",
"module",
")",
"{",
"$",
"folder",
"=",
"PathUtil",
"::",
"ModuleCustomTemplatesFolder",
"(",
"$",
"module",
")",
";",
"if",
"(",
"!",
"Folder",
"::",
"Exists",
"(",
"$",
"folder",
")",
")",
"{",
"ret... | Gets the module templates
@param FrontendModule $module The frontend module
@return string[] Returns the template files | [
"Gets",
"the",
"module",
"templates"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/TemplateList.php#L85-L102 |
198,175 | agentmedia/phine-core | src/Core/Modules/Backend/TemplateList.php | TemplateList.RemovalTemplateModule | protected function RemovalTemplateModule(array $idParts)
{
if (count($idParts) != 2)
{
return null;
}
$module = ClassFinder::CreateFrontendModule($idParts[0]);
return ($module instanceof FrontendModule && $module->AllowCustomTemplates()) ? $module : null;
} | php | protected function RemovalTemplateModule(array $idParts)
{
if (count($idParts) != 2)
{
return null;
}
$module = ClassFinder::CreateFrontendModule($idParts[0]);
return ($module instanceof FrontendModule && $module->AllowCustomTemplates()) ? $module : null;
} | [
"protected",
"function",
"RemovalTemplateModule",
"(",
"array",
"$",
"idParts",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"idParts",
")",
"!=",
"2",
")",
"{",
"return",
"null",
";",
"}",
"$",
"module",
"=",
"ClassFinder",
"::",
"CreateFrontendModule",
"(",
... | The removel template module
@param array $idParts
@return FrontendModule | [
"The",
"removel",
"template",
"module"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/TemplateList.php#L117-L125 |
198,176 | Vectrex/vxPHP | src/Form/FormElement/FormElementWithOptions/MultipleSelectElement.php | MultipleSelectElement.setValue | public function setValue($value = null)
{
if(isset($value)) {
//ENT_QUOTES not set
$this->value = array_map('htmlspecialchars', (array) $value);
}
foreach($this->options as $o) {
$v = $this->getValue();
if(is_array($v) && in_array($o->getValue(), $v)) {
$o->select();
}
else {
$... | php | public function setValue($value = null)
{
if(isset($value)) {
//ENT_QUOTES not set
$this->value = array_map('htmlspecialchars', (array) $value);
}
foreach($this->options as $o) {
$v = $this->getValue();
if(is_array($v) && in_array($o->getValue(), $v)) {
$o->select();
}
else {
$... | [
"public",
"function",
"setValue",
"(",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"value",
")",
")",
"{",
"//ENT_QUOTES not set",
"$",
"this",
"->",
"value",
"=",
"array_map",
"(",
"'htmlspecialchars'",
",",
"(",
"array",
")",
"... | set value of select element
value can be either a primitive or an array
@param mixed $value
@return MultipleSelectElement | [
"set",
"value",
"of",
"select",
"element",
"value",
"can",
"be",
"either",
"a",
"primitive",
"or",
"an",
"array"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/FormElement/FormElementWithOptions/MultipleSelectElement.php#L66-L90 |
198,177 | ScaraMVC/Framework | src/Scara/Http/Groups/Auth.php | Auth.init | public function init($options = [])
{
$auth = new Authentication();
if (!$auth->check()) {
$url = (isset($options['auth_login_url']))
? $options['auth_login_url']
: '/auth/login';
$this->redirect = $url;
}
} | php | public function init($options = [])
{
$auth = new Authentication();
if (!$auth->check()) {
$url = (isset($options['auth_login_url']))
? $options['auth_login_url']
: '/auth/login';
$this->redirect = $url;
}
} | [
"public",
"function",
"init",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"auth",
"=",
"new",
"Authentication",
"(",
")",
";",
"if",
"(",
"!",
"$",
"auth",
"->",
"check",
"(",
")",
")",
"{",
"$",
"url",
"=",
"(",
"isset",
"(",
"$",
"op... | Group init function.
@param array $options
@return void | [
"Group",
"init",
"function",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/Groups/Auth.php#L21-L32 |
198,178 | ingro/Rest | src/Ingruz/Rest/Helpers/DBQueryHelper.php | DBQueryHelper.getData | public function getData()
{
/**
* Eloquent's built in "paginate" method does not work well when the query contains "join", "having", or "groupby"
* so to make things work more reliably we just create the paginator object by hand after running the query
* TODO: find a way to not us... | php | public function getData()
{
/**
* Eloquent's built in "paginate" method does not work well when the query contains "join", "having", or "groupby"
* so to make things work more reliably we just create the paginator object by hand after running the query
* TODO: find a way to not us... | [
"public",
"function",
"getData",
"(",
")",
"{",
"/**\n * Eloquent's built in \"paginate\" method does not work well when the query contains \"join\", \"having\", or \"groupby\"\n * so to make things work more reliably we just create the paginator object by hand after running the query\n ... | Return the data filter by the options
@return array | [
"Return",
"the",
"data",
"filter",
"by",
"the",
"options"
] | 922bed071b8ea41feb067d97a3e283f944a86cb8 | https://github.com/ingro/Rest/blob/922bed071b8ea41feb067d97a3e283f944a86cb8/src/Ingruz/Rest/Helpers/DBQueryHelper.php#L150-L170 |
198,179 | cubicmushroom/valueobjects | src/Number/Integer.php | Integer.sameValueAs | public function sameValueAs(ValueObjectInterface $integer)
{
if (false === Util::classEquals($this, $integer)) {
return false;
}
return $this->toNative() === $integer->toNative();
} | php | public function sameValueAs(ValueObjectInterface $integer)
{
if (false === Util::classEquals($this, $integer)) {
return false;
}
return $this->toNative() === $integer->toNative();
} | [
"public",
"function",
"sameValueAs",
"(",
"ValueObjectInterface",
"$",
"integer",
")",
"{",
"if",
"(",
"false",
"===",
"Util",
"::",
"classEquals",
"(",
"$",
"this",
",",
"$",
"integer",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
... | Tells whether two Integer are equal by comparing their values
@param ValueObjectInterface $integer
@return bool | [
"Tells",
"whether",
"two",
"Integer",
"are",
"equal",
"by",
"comparing",
"their",
"values"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Number/Integer.php#L33-L40 |
198,180 | rollerworks/search-core | Input/StringLexer.php | StringLexer.stringValue | public function stringValue(string $allowedNext = ',;)'): string
{
$value = '';
if ($this->isEnd()) {
throw $this->createSyntaxException('StringValue');
}
if ('"' === $this->data[$this->cursor]) {
$this->moveCursor('"');
while ("\n" !== $c = mb_... | php | public function stringValue(string $allowedNext = ',;)'): string
{
$value = '';
if ($this->isEnd()) {
throw $this->createSyntaxException('StringValue');
}
if ('"' === $this->data[$this->cursor]) {
$this->moveCursor('"');
while ("\n" !== $c = mb_... | [
"public",
"function",
"stringValue",
"(",
"string",
"$",
"allowedNext",
"=",
"',;)'",
")",
":",
"string",
"{",
"$",
"value",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"isEnd",
"(",
")",
")",
"{",
"throw",
"$",
"this",
"->",
"createSyntaxException",... | Expect a StringValue.
A StringValue consists of non-special characters in any scripture (language)
or a QuotedValue. Trailing whitespace are skipped. | [
"Expect",
"a",
"StringValue",
"."
] | 6b5671b8c4d6298906ded768261b0a59845140fb | https://github.com/rollerworks/search-core/blob/6b5671b8c4d6298906ded768261b0a59845140fb/Input/StringLexer.php#L201-L274 |
198,181 | pryley/castor-framework | src/Services/Email.php | Email.stripHtmlTags | protected function stripHtmlTags( $string )
{
$string = preg_replace( '@<(embed|head|noembed|noscript|object|script|style)[^>]*?>.*?</\\1>@siu', '', $string );
$string = preg_replace( '@</(div|h[1-9]|p|pre|tr)@iu', "\r\n\$0", $string );
$string = preg_replace( '@</(td|th)@iu', " \$0", $string );
$string = preg... | php | protected function stripHtmlTags( $string )
{
$string = preg_replace( '@<(embed|head|noembed|noscript|object|script|style)[^>]*?>.*?</\\1>@siu', '', $string );
$string = preg_replace( '@</(div|h[1-9]|p|pre|tr)@iu', "\r\n\$0", $string );
$string = preg_replace( '@</(td|th)@iu', " \$0", $string );
$string = preg... | [
"protected",
"function",
"stripHtmlTags",
"(",
"$",
"string",
")",
"{",
"$",
"string",
"=",
"preg_replace",
"(",
"'@<(embed|head|noembed|noscript|object|script|style)[^>]*?>.*?</\\\\1>@siu'",
",",
"''",
",",
"$",
"string",
")",
";",
"$",
"string",
"=",
"preg_replace",... | - remove invisible elements
- replace certain elements with a line-break
- replace certain table elements with a space
- add a placeholder for plain-text bullets to list elements
- strip all remaining HTML tags
@return string | [
"-",
"remove",
"invisible",
"elements",
"-",
"replace",
"certain",
"elements",
"with",
"a",
"line",
"-",
"break",
"-",
"replace",
"certain",
"table",
"elements",
"with",
"a",
"space",
"-",
"add",
"a",
"placeholder",
"for",
"plain",
"-",
"text",
"bullets",
... | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Email.php#L254-L265 |
198,182 | pluf/tenant | src/Tenant/SpaService.php | Tenant_SpaService.installFromFile | public static function installFromFile($path, $deleteFile = false)
{
// crate spa
$spa = new Tenant_SPA();
$spa->path = 'not/set';
$spa->name = 'spa-' . rand();
$spa->create();
try {
return self::updateFromFile($spa, $path, $deleteFile);
} catch (E... | php | public static function installFromFile($path, $deleteFile = false)
{
// crate spa
$spa = new Tenant_SPA();
$spa->path = 'not/set';
$spa->name = 'spa-' . rand();
$spa->create();
try {
return self::updateFromFile($spa, $path, $deleteFile);
} catch (E... | [
"public",
"static",
"function",
"installFromFile",
"(",
"$",
"path",
",",
"$",
"deleteFile",
"=",
"false",
")",
"{",
"// crate spa",
"$",
"spa",
"=",
"new",
"Tenant_SPA",
"(",
")",
";",
"$",
"spa",
"->",
"path",
"=",
"'not/set'",
";",
"$",
"spa",
"->",... | Install spa from file into the tenant.
@param String $path
@param string $deleteFile
@throws Pluf_Exception | [
"Install",
"spa",
"from",
"file",
"into",
"the",
"tenant",
"."
] | a06359c52b9a257b5a0a186264e8770acfc54b73 | https://github.com/pluf/tenant/blob/a06359c52b9a257b5a0a186264e8770acfc54b73/src/Tenant/SpaService.php#L47-L60 |
198,183 | theias/infoblox | src/Infoblox.php | Infoblox.getAddressInfo | public function getAddressInfo($ipAddress)
{
// This test is a trick to determine if we have a valid IPv4 address, the
// only kind we can handle at the moment.
$long = ip2long($ipAddress);
if ($long == -1 || $long === false) {
return null;
}
$result = $th... | php | public function getAddressInfo($ipAddress)
{
// This test is a trick to determine if we have a valid IPv4 address, the
// only kind we can handle at the moment.
$long = ip2long($ipAddress);
if ($long == -1 || $long === false) {
return null;
}
$result = $th... | [
"public",
"function",
"getAddressInfo",
"(",
"$",
"ipAddress",
")",
"{",
"// This test is a trick to determine if we have a valid IPv4 address, the",
"// only kind we can handle at the moment.",
"$",
"long",
"=",
"ip2long",
"(",
"$",
"ipAddress",
")",
";",
"if",
"(",
"$",
... | Looks up an IP Address and returns whatever Infoblox knows about it.
@param string $ipAddress
@return array|null | [
"Looks",
"up",
"an",
"IP",
"Address",
"and",
"returns",
"whatever",
"Infoblox",
"knows",
"about",
"it",
"."
] | b1273225128a5cd491306dfadbe638bcc5b16036 | https://github.com/theias/infoblox/blob/b1273225128a5cd491306dfadbe638bcc5b16036/src/Infoblox.php#L37-L50 |
198,184 | theias/infoblox | src/Infoblox.php | Infoblox.getMacFilterInfo | public function getMacFilterInfo($macAddress)
{
$result = $this->gateway->get(
'macfilteraddress',
[
'filter' => $this->filter,
'mac' => $macAddress,
'_max_results' => 1
]
);
return (isset($result[0])) ? $resul... | php | public function getMacFilterInfo($macAddress)
{
$result = $this->gateway->get(
'macfilteraddress',
[
'filter' => $this->filter,
'mac' => $macAddress,
'_max_results' => 1
]
);
return (isset($result[0])) ? $resul... | [
"public",
"function",
"getMacFilterInfo",
"(",
"$",
"macAddress",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"gateway",
"->",
"get",
"(",
"'macfilteraddress'",
",",
"[",
"'filter'",
"=>",
"$",
"this",
"->",
"filter",
",",
"'mac'",
"=>",
"$",
"macAd... | Returns whatever Infoblox knows about a MAC address filter address.
@param string $macAddress
@return array|null | [
"Returns",
"whatever",
"Infoblox",
"knows",
"about",
"a",
"MAC",
"address",
"filter",
"address",
"."
] | b1273225128a5cd491306dfadbe638bcc5b16036 | https://github.com/theias/infoblox/blob/b1273225128a5cd491306dfadbe638bcc5b16036/src/Infoblox.php#L59-L70 |
198,185 | theias/infoblox | src/Infoblox.php | Infoblox.getRegistrations | public function getRegistrations($username)
{
$params = [];
$params['filter'] = $this->filter;
$params['username'] = $username;
$params['_return_fields+'] = 'fingerprint,extattrs';
return $this->gateway->get('macfilteraddress', $params);
} | php | public function getRegistrations($username)
{
$params = [];
$params['filter'] = $this->filter;
$params['username'] = $username;
$params['_return_fields+'] = 'fingerprint,extattrs';
return $this->gateway->get('macfilteraddress', $params);
} | [
"public",
"function",
"getRegistrations",
"(",
"$",
"username",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"$",
"params",
"[",
"'filter'",
"]",
"=",
"$",
"this",
"->",
"filter",
";",
"$",
"params",
"[",
"'username'",
"]",
"=",
"$",
"username",
";",... | Returns MAC address filter registrations for a given user.
@param string $username
@throws \Exception
@return array|null | [
"Returns",
"MAC",
"address",
"filter",
"registrations",
"for",
"a",
"given",
"user",
"."
] | b1273225128a5cd491306dfadbe638bcc5b16036 | https://github.com/theias/infoblox/blob/b1273225128a5cd491306dfadbe638bcc5b16036/src/Infoblox.php#L106-L113 |
198,186 | theias/infoblox | src/Infoblox.php | Infoblox.formatMacAddress | public static function formatMacAddress($validAddress)
{
if (strlen($validAddress) == 12) {
$formattedAddress = substr($validAddress, 0, 2);
for ($i=2; $i<12; $i+=2) {
$formattedAddress .= ':'.substr($validAddress, $i, 2);
}
return $formattedAd... | php | public static function formatMacAddress($validAddress)
{
if (strlen($validAddress) == 12) {
$formattedAddress = substr($validAddress, 0, 2);
for ($i=2; $i<12; $i+=2) {
$formattedAddress .= ':'.substr($validAddress, $i, 2);
}
return $formattedAd... | [
"public",
"static",
"function",
"formatMacAddress",
"(",
"$",
"validAddress",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"validAddress",
")",
"==",
"12",
")",
"{",
"$",
"formattedAddress",
"=",
"substr",
"(",
"$",
"validAddress",
",",
"0",
",",
"2",
")",
... | Formats a MAC Address.
This function accepts MAC addresses in one of the following valid
formats:
- aabbccddeeff
- aa-bb-cc-dd-ee-ff
- aa:bb:cc:dd:ee:ff
It returns the address formatted like this: aa:bb:cc:dd:ee:ff.
@param string $validAddress
@return string|null | [
"Formats",
"a",
"MAC",
"Address",
"."
] | b1273225128a5cd491306dfadbe638bcc5b16036 | https://github.com/theias/infoblox/blob/b1273225128a5cd491306dfadbe638bcc5b16036/src/Infoblox.php#L145-L158 |
198,187 | Xiphe/Base | src/Xiphe/Base.php | Base.i | public static function i()
{
$class = get_called_class();
$initArgs = func_get_args();
if (count($initArgs) === 1) {
$initArgs = $initArgs[0];
}
if (!empty(self::$_baseInstances[$class])) {
$inst = self::$_baseInstances[$class];
if (!empty... | php | public static function i()
{
$class = get_called_class();
$initArgs = func_get_args();
if (count($initArgs) === 1) {
$initArgs = $initArgs[0];
}
if (!empty(self::$_baseInstances[$class])) {
$inst = self::$_baseInstances[$class];
if (!empty... | [
"public",
"static",
"function",
"i",
"(",
")",
"{",
"$",
"class",
"=",
"get_called_class",
"(",
")",
";",
"$",
"initArgs",
"=",
"func_get_args",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"initArgs",
")",
"===",
"1",
")",
"{",
"$",
"initArgs",
"=... | Direct static constructor and singleton getter.
@return object | [
"Direct",
"static",
"constructor",
"and",
"singleton",
"getter",
"."
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L123-L141 |
198,188 | Xiphe/Base | src/Xiphe/Base.php | Base.initConfig | public function initConfig($config)
{
if (is_string($config)) {
if (file_exists(($configFile = $config)) ||
file_exists(($configFile = dirname(dirname(__FILE__)).self::DS.$config))
) {
$config = $this->loadConfig($configFile);
}
}... | php | public function initConfig($config)
{
if (is_string($config)) {
if (file_exists(($configFile = $config)) ||
file_exists(($configFile = dirname(dirname(__FILE__)).self::DS.$config))
) {
$config = $this->loadConfig($configFile);
}
}... | [
"public",
"function",
"initConfig",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"config",
")",
")",
"{",
"if",
"(",
"file_exists",
"(",
"(",
"$",
"configFile",
"=",
"$",
"config",
")",
")",
"||",
"file_exists",
"(",
"(",
"$",
"c... | Initiate class configuration
@param mixed $config a filename or array/object of config values
@return object | [
"Initiate",
"class",
"configuration"
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L180-L197 |
198,189 | Xiphe/Base | src/Xiphe/Base.php | Base.mergeConfig | public function mergeConfig($new = array())
{
$config = (object) array_merge(
(array) $this->_defaultConfiguration,
(array) $this->_configuration,
(array) $new
);
foreach ($config as $key => $value) {
$this->setConfig($key, $value);
}
... | php | public function mergeConfig($new = array())
{
$config = (object) array_merge(
(array) $this->_defaultConfiguration,
(array) $this->_configuration,
(array) $new
);
foreach ($config as $key => $value) {
$this->setConfig($key, $value);
}
... | [
"public",
"function",
"mergeConfig",
"(",
"$",
"new",
"=",
"array",
"(",
")",
")",
"{",
"$",
"config",
"=",
"(",
"object",
")",
"array_merge",
"(",
"(",
"array",
")",
"$",
"this",
"->",
"_defaultConfiguration",
",",
"(",
"array",
")",
"$",
"this",
"-... | Merge new data into the current defaults and configuration
@param mixed $new new data for configuration
@return object | [
"Merge",
"new",
"data",
"into",
"the",
"current",
"defaults",
"and",
"configuration"
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L206-L219 |
198,190 | Xiphe/Base | src/Xiphe/Base.php | Base.loadConfig | public function loadConfig($file)
{
$config;
switch (pathinfo($file, PATHINFO_EXTENSION)) {
case 'json':
$config = json_decode(file_get_contents($file));
break;
case 'php':
$config = include $file;
break;
default:
r... | php | public function loadConfig($file)
{
$config;
switch (pathinfo($file, PATHINFO_EXTENSION)) {
case 'json':
$config = json_decode(file_get_contents($file));
break;
case 'php':
$config = include $file;
break;
default:
r... | [
"public",
"function",
"loadConfig",
"(",
"$",
"file",
")",
"{",
"$",
"config",
";",
"switch",
"(",
"pathinfo",
"(",
"$",
"file",
",",
"PATHINFO_EXTENSION",
")",
")",
"{",
"case",
"'json'",
":",
"$",
"config",
"=",
"json_decode",
"(",
"file_get_contents",
... | Loads the configuration from a json or php file
@param string $file the full path to the configuration file
@return object | [
"Loads",
"the",
"configuration",
"from",
"a",
"json",
"or",
"php",
"file"
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L229-L247 |
198,191 | Xiphe/Base | src/Xiphe/Base.php | Base.getCallbackKey | public function getCallbackKey($callback)
{
if (is_array($callback)) {
if (is_object($callback[0])) {
$callback[0] = spl_object_hash($callback[0]);
}
} elseif ((function(){} instanceof $callback)) {
$callback = spl_object_hash($callback);
}... | php | public function getCallbackKey($callback)
{
if (is_array($callback)) {
if (is_object($callback[0])) {
$callback[0] = spl_object_hash($callback[0]);
}
} elseif ((function(){} instanceof $callback)) {
$callback = spl_object_hash($callback);
}... | [
"public",
"function",
"getCallbackKey",
"(",
"$",
"callback",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"callback",
")",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"callback",
"[",
"0",
"]",
")",
")",
"{",
"$",
"callback",
"[",
"0",
"]",
"=",
"... | Generates unique hashes for callback functions
@param mixed $callback
@return sting | [
"Generates",
"unique",
"hashes",
"for",
"callback",
"functions"
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L304-L315 |
198,192 | Xiphe/Base | src/Xiphe/Base.php | Base.doCallback | public function doCallback($name, array $values = array(), $getResult = false)
{
$values = array_merge(
$values,
array($name, $this)
);
if ($getResult) {
$result = $values[0];
}
/*
* Hook into Wordpress if wanted.
*/
... | php | public function doCallback($name, array $values = array(), $getResult = false)
{
$values = array_merge(
$values,
array($name, $this)
);
if ($getResult) {
$result = $values[0];
}
/*
* Hook into Wordpress if wanted.
*/
... | [
"public",
"function",
"doCallback",
"(",
"$",
"name",
",",
"array",
"$",
"values",
"=",
"array",
"(",
")",
",",
"$",
"getResult",
"=",
"false",
")",
"{",
"$",
"values",
"=",
"array_merge",
"(",
"$",
"values",
",",
"array",
"(",
"$",
"name",
",",
"$... | Executes callbacks for a hook
@param string $name
@param array $values
@return object | [
"Executes",
"callbacks",
"for",
"a",
"hook"
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L325-L366 |
198,193 | Xiphe/Base | src/Xiphe/Base.php | Base.addCallback | public function addCallback($name, $callback, $prio = 10)
{
if (!is_callable($callback)) {
throw new \Exception("Callback not callable.", 3);
return false;
}
$key = $this->getCallbackKey($callback);
if (!isset(self::$_baseRealCallbacks[$key])) {
se... | php | public function addCallback($name, $callback, $prio = 10)
{
if (!is_callable($callback)) {
throw new \Exception("Callback not callable.", 3);
return false;
}
$key = $this->getCallbackKey($callback);
if (!isset(self::$_baseRealCallbacks[$key])) {
se... | [
"public",
"function",
"addCallback",
"(",
"$",
"name",
",",
"$",
"callback",
",",
"$",
"prio",
"=",
"10",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Callback not callable.\"",
... | Adds a callback listener
@param string $name the hook name
@param function $callback
@param integer $prio higher means later
return object | [
"Adds",
"a",
"callback",
"listener"
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L377-L392 |
198,194 | Xiphe/Base | src/Xiphe/Base.php | Base.removeCallback | public function removeCallback($name, $callback, $prio = 10)
{
$key = $this->getCallbackKey($callback);
if (in_array($key, $this->_callbacks[$name][$prio])) {
while(false !== $k = array_search($key, $this->_callbacks[$name][$prio])) {
unset($this->_callbacks[$name][$prio... | php | public function removeCallback($name, $callback, $prio = 10)
{
$key = $this->getCallbackKey($callback);
if (in_array($key, $this->_callbacks[$name][$prio])) {
while(false !== $k = array_search($key, $this->_callbacks[$name][$prio])) {
unset($this->_callbacks[$name][$prio... | [
"public",
"function",
"removeCallback",
"(",
"$",
"name",
",",
"$",
"callback",
",",
"$",
"prio",
"=",
"10",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getCallbackKey",
"(",
"$",
"callback",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"key",
","... | Removes the callback from the specific hook at the specific priority
@param string $name the hook name
@param function $callback
@param integer $prio
@return object | [
"Removes",
"the",
"callback",
"from",
"the",
"specific",
"hook",
"at",
"the",
"specific",
"priority"
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L403-L420 |
198,195 | Xiphe/Base | src/Xiphe/Base.php | Base.killCallback | public function killCallback($callback)
{
$key = $this->getCallbackKey($callback);
self::$_baseRealCallbacks[$key] = false;
return $this;
} | php | public function killCallback($callback)
{
$key = $this->getCallbackKey($callback);
self::$_baseRealCallbacks[$key] = false;
return $this;
} | [
"public",
"function",
"killCallback",
"(",
"$",
"callback",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getCallbackKey",
"(",
"$",
"callback",
")",
";",
"self",
"::",
"$",
"_baseRealCallbacks",
"[",
"$",
"key",
"]",
"=",
"false",
";",
"return",
"$",... | Globally disables the passed function from being called by any hook.
@param mixed $callback
@return object | [
"Globally",
"disables",
"the",
"passed",
"function",
"from",
"being",
"called",
"by",
"any",
"hook",
"."
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L429-L436 |
198,196 | Xiphe/Base | src/Xiphe/Base.php | Base.reanimateCallback | public function reanimateCallback($callback)
{
$key = $this->getCallbackKey($callback);
self::$_baseRealCallbacks[$key] = $callback;
return $this;
} | php | public function reanimateCallback($callback)
{
$key = $this->getCallbackKey($callback);
self::$_baseRealCallbacks[$key] = $callback;
return $this;
} | [
"public",
"function",
"reanimateCallback",
"(",
"$",
"callback",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getCallbackKey",
"(",
"$",
"callback",
")",
";",
"self",
"::",
"$",
"_baseRealCallbacks",
"[",
"$",
"key",
"]",
"=",
"$",
"callback",
";",
"... | Globally enables the passed function to receive callback calls.
Happens automatically when using addCallback().
Use this to re enable callbacks disabled by detachCallbackFunction()
@param mixed $callback
@return object | [
"Globally",
"enables",
"the",
"passed",
"function",
"to",
"receive",
"callback",
"calls",
"."
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L448-L455 |
198,197 | Xiphe/Base | src/Xiphe/Base.php | Base._exit | public function _exit($status = null, $msg = null, $errorCode = null)
{
foreach (array('status', 'msg', 'errorCode') as $k) {
if ($$k !== null) {
self::$_baseR[$k] = $$k;
}
}
echo serialize(self::$_baseR);
exit;
} | php | public function _exit($status = null, $msg = null, $errorCode = null)
{
foreach (array('status', 'msg', 'errorCode') as $k) {
if ($$k !== null) {
self::$_baseR[$k] = $$k;
}
}
echo serialize(self::$_baseR);
exit;
} | [
"public",
"function",
"_exit",
"(",
"$",
"status",
"=",
"null",
",",
"$",
"msg",
"=",
"null",
",",
"$",
"errorCode",
"=",
"null",
")",
"{",
"foreach",
"(",
"array",
"(",
"'status'",
",",
"'msg'",
",",
"'errorCode'",
")",
"as",
"$",
"k",
")",
"{",
... | Killer function stops the script and echoes the serialized response
@access public
@param string $status short string describing the status (error|ok|...)
@param string $msg longer description of the status, error msg etc.
@param int $errorCode unique number for the error.
@return void | [
"Killer",
"function",
"stops",
"the",
"script",
"and",
"echoes",
"the",
"serialized",
"response"
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L471-L481 |
198,198 | cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Iterator/SdkResultIterator.php | SdkResultIterator.search | public function search($expression)
{
// Apply JMESPath expression on each result, but as a flat sequence.
return \Aws\flatmap($this, function (\Aws\ResultInterface $result) use ($expression) {
return (array)$result->search($expression);
});
} | php | public function search($expression)
{
// Apply JMESPath expression on each result, but as a flat sequence.
return \Aws\flatmap($this, function (\Aws\ResultInterface $result) use ($expression) {
return (array)$result->search($expression);
});
} | [
"public",
"function",
"search",
"(",
"$",
"expression",
")",
"{",
"// Apply JMESPath expression on each result, but as a flat sequence.",
"return",
"\\",
"Aws",
"\\",
"flatmap",
"(",
"$",
"this",
",",
"function",
"(",
"\\",
"Aws",
"\\",
"ResultInterface",
"$",
"resu... | Returns an iterator that iterates over the values of applying a JMESPath
search to each wrapped \Aws\ResultInterface as a flat sequence.
@param string $expression JMESPath expression to apply to each result.
@return \Iterator | [
"Returns",
"an",
"iterator",
"that",
"iterates",
"over",
"the",
"values",
"of",
"applying",
"a",
"JMESPath",
"search",
"to",
"each",
"wrapped",
"\\",
"Aws",
"\\",
"ResultInterface",
"as",
"a",
"flat",
"sequence",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Iterator/SdkResultIterator.php#L18-L24 |
198,199 | Vectrex/vxPHP | src/Debug/ExceptionHandler.php | ExceptionHandler.register | public static function register($debug = TRUE, $charset = 'UTF-8') {
if(self::$handler) {
throw new \RuntimeException('Exception handler already registered.');
}
self::$handler = new static($debug, $charset);
set_exception_handler(array(self::$handler, 'handle'));
return self::$handler;
} | php | public static function register($debug = TRUE, $charset = 'UTF-8') {
if(self::$handler) {
throw new \RuntimeException('Exception handler already registered.');
}
self::$handler = new static($debug, $charset);
set_exception_handler(array(self::$handler, 'handle'));
return self::$handler;
} | [
"public",
"static",
"function",
"register",
"(",
"$",
"debug",
"=",
"TRUE",
",",
"$",
"charset",
"=",
"'UTF-8'",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"handler",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Exception handler already registere... | register custom exception handler
@param string $debug
@param string $charset
@throws \RuntimeException | [
"register",
"custom",
"exception",
"handler"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Debug/ExceptionHandler.php#L49-L61 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.