repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
SpoonX/SxBootstrap | src/SxBootstrap/View/Helper/Bootstrap/Form/Row.php | Row.renderError | protected function renderError(ElementInterface $element)
{
$messages = $element->getMessages();
if (empty($messages)) {
return null;
}
$errorPlugin = $this->getView()->plugin('sxb_form_errors');
return $errorPlugin($element);
} | php | protected function renderError(ElementInterface $element)
{
$messages = $element->getMessages();
if (empty($messages)) {
return null;
}
$errorPlugin = $this->getView()->plugin('sxb_form_errors');
return $errorPlugin($element);
} | [
"protected",
"function",
"renderError",
"(",
"ElementInterface",
"$",
"element",
")",
"{",
"$",
"messages",
"=",
"$",
"element",
"->",
"getMessages",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"messages",
")",
")",
"{",
"return",
"null",
";",
"}",
"$... | Render errors.
@param ElementInterface $element
@return null|\SxBootstrap\View\Helper\Bootstrap\Form\Errors | [
"Render",
"errors",
"."
] | 768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6 | https://github.com/SpoonX/SxBootstrap/blob/768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6/src/SxBootstrap/View/Helper/Bootstrap/Form/Row.php#L134-L145 | train |
ben-gibson/foursquare-venue-client | src/Factory/Tip/TipGroupFactory.php | TipGroupFactory.getTips | private function getTips(Description $description)
{
return array_map(
function (\stdClass $tipDescription) {
return $this->tipFactory->create(new Description($tipDescription));
},
$description->getOptionalProperty('items', [])
);
} | php | private function getTips(Description $description)
{
return array_map(
function (\stdClass $tipDescription) {
return $this->tipFactory->create(new Description($tipDescription));
},
$description->getOptionalProperty('items', [])
);
} | [
"private",
"function",
"getTips",
"(",
"Description",
"$",
"description",
")",
"{",
"return",
"array_map",
"(",
"function",
"(",
"\\",
"stdClass",
"$",
"tipDescription",
")",
"{",
"return",
"$",
"this",
"->",
"tipFactory",
"->",
"create",
"(",
"new",
"Descri... | Get the venue tips.
@param Description $description The tip group description.
@return Tip[] | [
"Get",
"the",
"venue",
"tips",
"."
] | ce5e7c308f87d5ccc28ab8d27a9cb51bd106d969 | https://github.com/ben-gibson/foursquare-venue-client/blob/ce5e7c308f87d5ccc28ab8d27a9cb51bd106d969/src/Factory/Tip/TipGroupFactory.php#L49-L57 | train |
imatic/controller-bundle | Resource/ConfigurationProcessor.php | ConfigurationProcessor.arrayMap | public static function arrayMap(callable $callback, array $array)
{
foreach ($array as $key => $value) {
$array[$key] = \call_user_func($callback, $value, $key);
}
return $array;
} | php | public static function arrayMap(callable $callback, array $array)
{
foreach ($array as $key => $value) {
$array[$key] = \call_user_func($callback, $value, $key);
}
return $array;
} | [
"public",
"static",
"function",
"arrayMap",
"(",
"callable",
"$",
"callback",
",",
"array",
"$",
"array",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"array",
"[",
"$",
"key",
"]",
"=",
"\\",
"call_u... | - array keys are available in callback
- array keys have not been changed | [
"-",
"array",
"keys",
"are",
"available",
"in",
"callback",
"-",
"array",
"keys",
"have",
"not",
"been",
"changed"
] | df71c12166928f9d4f1548d4ee1e09a183a68eb6 | https://github.com/imatic/controller-bundle/blob/df71c12166928f9d4f1548d4ee1e09a183a68eb6/Resource/ConfigurationProcessor.php#L203-L210 | train |
danhanly/signalert | src/Signalert/Config.php | Config.expandConfigDirectories | private function expandConfigDirectories()
{
$newPaths = [];
foreach ($this->configDirectories as $filePath) {
$newPaths[] = __DIR__ . '/../../../../../' . $filePath;
}
$this->configDirectories = $newPaths;
} | php | private function expandConfigDirectories()
{
$newPaths = [];
foreach ($this->configDirectories as $filePath) {
$newPaths[] = __DIR__ . '/../../../../../' . $filePath;
}
$this->configDirectories = $newPaths;
} | [
"private",
"function",
"expandConfigDirectories",
"(",
")",
"{",
"$",
"newPaths",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"configDirectories",
"as",
"$",
"filePath",
")",
"{",
"$",
"newPaths",
"[",
"]",
"=",
"__DIR__",
".",
"'/../../../../..... | Ensures that config directories are relative paths | [
"Ensures",
"that",
"config",
"directories",
"are",
"relative",
"paths"
] | 21ee50e3fc0352306a2966b555984b5c9eada582 | https://github.com/danhanly/signalert/blob/21ee50e3fc0352306a2966b555984b5c9eada582/src/Signalert/Config.php#L114-L121 | train |
neneaX/IoC | src/Container.php | Container.register | public function register($alias, $binding, $shared = false)
{
$this->registry[$alias] = new Resolver(new Builder($binding), $shared);
} | php | public function register($alias, $binding, $shared = false)
{
$this->registry[$alias] = new Resolver(new Builder($binding), $shared);
} | [
"public",
"function",
"register",
"(",
"$",
"alias",
",",
"$",
"binding",
",",
"$",
"shared",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"registry",
"[",
"$",
"alias",
"]",
"=",
"new",
"Resolver",
"(",
"new",
"Builder",
"(",
"$",
"binding",
")",
",... | Register a binding with the registry
@param string $alias The alias used for registering the binding
@param \Closure|object|string|null $binding The binding requested to register
@param boolean $shared The type of the binding: shared (singleton) or not | [
"Register",
"a",
"binding",
"with",
"the",
"registry"
] | 404888c3252880f8bb48253f9aa636cd7c396416 | https://github.com/neneaX/IoC/blob/404888c3252880f8bb48253f9aa636cd7c396416/src/Container.php#L108-L111 | train |
neneaX/IoC | src/Container.php | Container.resolve | public function resolve($alias, array $parameters = array(), $force = false)
{
if ($this->registered($alias)) {
$resolver = $this->registry[$alias];
return $resolver->execute($parameters, $force);
}
throw new \Exception('No class found registered with that name:... | php | public function resolve($alias, array $parameters = array(), $force = false)
{
if ($this->registered($alias)) {
$resolver = $this->registry[$alias];
return $resolver->execute($parameters, $force);
}
throw new \Exception('No class found registered with that name:... | [
"public",
"function",
"resolve",
"(",
"$",
"alias",
",",
"array",
"$",
"parameters",
"=",
"array",
"(",
")",
",",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"registered",
"(",
"$",
"alias",
")",
")",
"{",
"$",
"resolver",
... | Execute the Resolver and return the requested binding instance
@param string $alias The registered binding's alias
@param array $parameters
@param boolean $force Force the overriding of the "shared" option and return a new instance of the requested binding
@return object
@throws \Exception When no resolver is found f... | [
"Execute",
"the",
"Resolver",
"and",
"return",
"the",
"requested",
"binding",
"instance"
] | 404888c3252880f8bb48253f9aa636cd7c396416 | https://github.com/neneaX/IoC/blob/404888c3252880f8bb48253f9aa636cd7c396416/src/Container.php#L134-L143 | train |
acacha/forge-publish | src/Console/Commands/PublishUpdateAssignment.php | PublishUpdateAssignment.updateAssignment | protected function updateAssignment()
{
$uri = str_replace('{assignment}', $this->assignment, config('forge-publish.update_assignment_uri'));
$url = config('forge-publish.url') . $uri;
try {
$response = $this->http->put($url, [
'form_params' => [
... | php | protected function updateAssignment()
{
$uri = str_replace('{assignment}', $this->assignment, config('forge-publish.update_assignment_uri'));
$url = config('forge-publish.url') . $uri;
try {
$response = $this->http->put($url, [
'form_params' => [
... | [
"protected",
"function",
"updateAssignment",
"(",
")",
"{",
"$",
"uri",
"=",
"str_replace",
"(",
"'{assignment}'",
",",
"$",
"this",
"->",
"assignment",
",",
"config",
"(",
"'forge-publish.update_assignment_uri'",
")",
")",
";",
"$",
"url",
"=",
"config",
"(",... | Update assignment.
@return array|mixed | [
"Update",
"assignment",
"."
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/PublishUpdateAssignment.php#L130-L154 | train |
austinkregel/formmodel | src/FormModel/Frameworks/Bootstrap.php | Bootstrap.form | public function form(array $options = [])
{
$method = empty($options['method']) ? $options['method'] : '';
if (in_array(strtolower($method), ['get', 'post'])) {
$real_method = $method;
} else {
$real_method = 'POST';
}
$options['method'] = $real_method... | php | public function form(array $options = [])
{
$method = empty($options['method']) ? $options['method'] : '';
if (in_array(strtolower($method), ['get', 'post'])) {
$real_method = $method;
} else {
$real_method = 'POST';
}
$options['method'] = $real_method... | [
"public",
"function",
"form",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"method",
"=",
"empty",
"(",
"$",
"options",
"[",
"'method'",
"]",
")",
"?",
"$",
"options",
"[",
"'method'",
"]",
":",
"''",
";",
"if",
"(",
"in_array",
"(... | Generate the form.
@param array $options
@return string | [
"Generate",
"the",
"form",
"."
] | 49943a8f563d2e9028f6bc992708e104f9be22e3 | https://github.com/austinkregel/formmodel/blob/49943a8f563d2e9028f6bc992708e104f9be22e3/src/FormModel/Frameworks/Bootstrap.php#L14-L28 | train |
selikhovleonid/nadir | src/core/Headers.php | Headers.add | public function add($sHeader)
{
foreach ($this->headerList as $sTmp) {
if ($sTmp == $sHeader) {
throw new Exception("The '{$sHeader}' header has already been added.");
}
}
$this->headerList[] = $sHeader;
return self::$instance;
} | php | public function add($sHeader)
{
foreach ($this->headerList as $sTmp) {
if ($sTmp == $sHeader) {
throw new Exception("The '{$sHeader}' header has already been added.");
}
}
$this->headerList[] = $sHeader;
return self::$instance;
} | [
"public",
"function",
"add",
"(",
"$",
"sHeader",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"headerList",
"as",
"$",
"sTmp",
")",
"{",
"if",
"(",
"$",
"sTmp",
"==",
"$",
"sHeader",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"The '{$sHeader}' head... | It adds the header to the stack.
@param string $sHeader The page header.
@return self.
@throws \core\Exception It throws if passed header was already added earlier. | [
"It",
"adds",
"the",
"header",
"to",
"the",
"stack",
"."
] | 47545fccd8516c8f0a20c02ba62f68269c7199da | https://github.com/selikhovleonid/nadir/blob/47545fccd8516c8f0a20c02ba62f68269c7199da/src/core/Headers.php#L136-L145 | train |
selikhovleonid/nadir | src/core/Headers.php | Headers.addByHttpCode | public function addByHttpCode($nCode)
{
$sProtocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL']
: 'HTTP/1.1';
$sHeader = "{$sProtocol} {$nCode} "
.self::getHTTPExplanationByCode($nCode);
return $this->add($sHeader);
} | php | public function addByHttpCode($nCode)
{
$sProtocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL']
: 'HTTP/1.1';
$sHeader = "{$sProtocol} {$nCode} "
.self::getHTTPExplanationByCode($nCode);
return $this->add($sHeader);
} | [
"public",
"function",
"addByHttpCode",
"(",
"$",
"nCode",
")",
"{",
"$",
"sProtocol",
"=",
"isset",
"(",
"$",
"_SERVER",
"[",
"'SERVER_PROTOCOL'",
"]",
")",
"?",
"$",
"_SERVER",
"[",
"'SERVER_PROTOCOL'",
"]",
":",
"'HTTP/1.1'",
";",
"$",
"sHeader",
"=",
... | It adds the header to the stack by HTTP code.
@param integer $nCode The code.
@return self. | [
"It",
"adds",
"the",
"header",
"to",
"the",
"stack",
"by",
"HTTP",
"code",
"."
] | 47545fccd8516c8f0a20c02ba62f68269c7199da | https://github.com/selikhovleonid/nadir/blob/47545fccd8516c8f0a20c02ba62f68269c7199da/src/core/Headers.php#L152-L159 | train |
selikhovleonid/nadir | src/core/Headers.php | Headers.run | public function run()
{
$this->isRan = true;
foreach ($this->headerList as $sHeader) {
header($sHeader);
}
} | php | public function run()
{
$this->isRan = true;
foreach ($this->headerList as $sHeader) {
header($sHeader);
}
} | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"isRan",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"headerList",
"as",
"$",
"sHeader",
")",
"{",
"header",
"(",
"$",
"sHeader",
")",
";",
"}",
"}"
] | The main execution method. It sets all added headers into the page.
@return void. | [
"The",
"main",
"execution",
"method",
".",
"It",
"sets",
"all",
"added",
"headers",
"into",
"the",
"page",
"."
] | 47545fccd8516c8f0a20c02ba62f68269c7199da | https://github.com/selikhovleonid/nadir/blob/47545fccd8516c8f0a20c02ba62f68269c7199da/src/core/Headers.php#L183-L189 | train |
andyburton/Sonic-Framework | src/Controller/Tools.php | Tools.clearcache | public function clearcache ()
{
if ($this->view instanceof \Sonic\View\Smarty)
{
$this->view->clearCompiledTemplate ();
$this->view->clearAllCache ();
}
new \Sonic\Message ('success', 'Cache Cleared');
$this->template = 'tools/index.tpl';
} | php | public function clearcache ()
{
if ($this->view instanceof \Sonic\View\Smarty)
{
$this->view->clearCompiledTemplate ();
$this->view->clearAllCache ();
}
new \Sonic\Message ('success', 'Cache Cleared');
$this->template = 'tools/index.tpl';
} | [
"public",
"function",
"clearcache",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"view",
"instanceof",
"\\",
"Sonic",
"\\",
"View",
"\\",
"Smarty",
")",
"{",
"$",
"this",
"->",
"view",
"->",
"clearCompiledTemplate",
"(",
")",
";",
"$",
"this",
"->",
... | Clear the view cache | [
"Clear",
"the",
"view",
"cache"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Controller/Tools.php#L41-L53 | train |
Phpillip/phpillip | src/Service/Pygments.php | Pygments.highlight | public function highlight($value, $language)
{
$path = tempnam($this->tmp, 'pyg');
if ($language === 'php' && substr($value, 0, 5) !== '<?php') {
$value = '<?php ' . PHP_EOL . $value;
}
$this->files->dumpFile($path, $value);
$value = $this->pygmentize($path, $l... | php | public function highlight($value, $language)
{
$path = tempnam($this->tmp, 'pyg');
if ($language === 'php' && substr($value, 0, 5) !== '<?php') {
$value = '<?php ' . PHP_EOL . $value;
}
$this->files->dumpFile($path, $value);
$value = $this->pygmentize($path, $l... | [
"public",
"function",
"highlight",
"(",
"$",
"value",
",",
"$",
"language",
")",
"{",
"$",
"path",
"=",
"tempnam",
"(",
"$",
"this",
"->",
"tmp",
",",
"'pyg'",
")",
";",
"if",
"(",
"$",
"language",
"===",
"'php'",
"&&",
"substr",
"(",
"$",
"value",... | Highlight a portion of code with pygmentize
@param string $value
@param string $language
@return string | [
"Highlight",
"a",
"portion",
"of",
"code",
"with",
"pygmentize"
] | c37afaafb536361e7e0b564659f1cd5b80b98be9 | https://github.com/Phpillip/phpillip/blob/c37afaafb536361e7e0b564659f1cd5b80b98be9/src/Service/Pygments.php#L47-L66 | train |
Phpillip/phpillip | src/Service/Pygments.php | Pygments.pygmentize | public function pygmentize($path, $language)
{
$process = new Process(sprintf('pygmentize -f html -l %s %s', $language, $path));
$process->run();
if (!$process->isSuccessful()) {
throw new RuntimeException($process->getErrorOutput());
}
return trim($process->ge... | php | public function pygmentize($path, $language)
{
$process = new Process(sprintf('pygmentize -f html -l %s %s', $language, $path));
$process->run();
if (!$process->isSuccessful()) {
throw new RuntimeException($process->getErrorOutput());
}
return trim($process->ge... | [
"public",
"function",
"pygmentize",
"(",
"$",
"path",
",",
"$",
"language",
")",
"{",
"$",
"process",
"=",
"new",
"Process",
"(",
"sprintf",
"(",
"'pygmentize -f html -l %s %s'",
",",
"$",
"language",
",",
"$",
"path",
")",
")",
";",
"$",
"process",
"->"... | Run 'pygmentize' command on the given file
@param string $path
@param string $language
@return string | [
"Run",
"pygmentize",
"command",
"on",
"the",
"given",
"file"
] | c37afaafb536361e7e0b564659f1cd5b80b98be9 | https://github.com/Phpillip/phpillip/blob/c37afaafb536361e7e0b564659f1cd5b80b98be9/src/Service/Pygments.php#L76-L87 | train |
stonedz/pff2 | src/modules/auth/Auth.php | Auth.checkAuth | public function checkAuth() {
if (isset($_SESSION[$this->_sessionVarName]) &&
$_SESSION[$this->_sessionVarName] == 1
) {
return true;
} else {
return false;
}
} | php | public function checkAuth() {
if (isset($_SESSION[$this->_sessionVarName]) &&
$_SESSION[$this->_sessionVarName] == 1
) {
return true;
} else {
return false;
}
} | [
"public",
"function",
"checkAuth",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"_sessionVarName",
"]",
")",
"&&",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"_sessionVarName",
"]",
"==",
"1",
")",
"{",
"return",
"tr... | Checks if a client is logged-in
@return bool | [
"Checks",
"if",
"a",
"client",
"is",
"logged",
"-",
"in"
] | ec3b087d4d4732816f61ac487f0cb25511e0da88 | https://github.com/stonedz/pff2/blob/ec3b087d4d4732816f61ac487f0cb25511e0da88/src/modules/auth/Auth.php#L119-L127 | train |
oliwierptak/Everon1 | src/Everon/Helper/Asserts/IsNull.php | IsNull.assertIsNull | public function assertIsNull($value, $message='Unexpected null value: %s', $exception='Asserts')
{
if (is_null($value)) {
$value = 'NULL';
$this->throwException($exception, $message, $value);
}
} | php | public function assertIsNull($value, $message='Unexpected null value: %s', $exception='Asserts')
{
if (is_null($value)) {
$value = 'NULL';
$this->throwException($exception, $message, $value);
}
} | [
"public",
"function",
"assertIsNull",
"(",
"$",
"value",
",",
"$",
"message",
"=",
"'Unexpected null value: %s'",
",",
"$",
"exception",
"=",
"'Asserts'",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"'NULL'",
";",... | Verifies that the specified condition is not null.
The assertion fails if the condition is null.
@param mixed $value
@param string $message
@param string $exception
@throws \Everon\Exception\Asserts | [
"Verifies",
"that",
"the",
"specified",
"condition",
"is",
"not",
"null",
".",
"The",
"assertion",
"fails",
"if",
"the",
"condition",
"is",
"null",
"."
] | ac93793d1fa517a8394db5f00062f1925dc218a3 | https://github.com/oliwierptak/Everon1/blob/ac93793d1fa517a8394db5f00062f1925dc218a3/src/Everon/Helper/Asserts/IsNull.php#L23-L29 | train |
schpill/thin | src/Html/Row.php | Row.row | public function row(array $attributes = array())
{
$row = new self();
if (count($attributes)) {
$row->setAttributes($attributes);
}
return $row;
} | php | public function row(array $attributes = array())
{
$row = new self();
if (count($attributes)) {
$row->setAttributes($attributes);
}
return $row;
} | [
"public",
"function",
"row",
"(",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
")",
"{",
"$",
"row",
"=",
"new",
"self",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"attributes",
")",
")",
"{",
"$",
"row",
"->",
"setAttributes",
"(",
"$",... | Generates a new table row
@param array $attributes
@return Row | [
"Generates",
"a",
"new",
"table",
"row"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Row.php#L38-L47 | train |
schpill/thin | src/Html/Row.php | Row.add | public function add($value, array $attributes = null)
{
$cell = $value;
if (is_string($value)) {
$cell = new Cell($value, $attributes);
}
$this->_cells[] = $cell;
return $this;
} | php | public function add($value, array $attributes = null)
{
$cell = $value;
if (is_string($value)) {
$cell = new Cell($value, $attributes);
}
$this->_cells[] = $cell;
return $this;
} | [
"public",
"function",
"add",
"(",
"$",
"value",
",",
"array",
"$",
"attributes",
"=",
"null",
")",
"{",
"$",
"cell",
"=",
"$",
"value",
";",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"$",
"cell",
"=",
"new",
"Cell",
"(",
"$",
"v... | Adds a cell to the row
@param string|Cell $cell
@param array $attributes | [
"Adds",
"a",
"cell",
"to",
"the",
"row"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Row.php#L97-L107 | train |
schpill/thin | src/Html/Row.php | Row.isHeader | public function isHeader($isHeader = true)
{
foreach ($this->_cells as $cell) {
$cell->isHeader($isHeader);
}
return $this;
} | php | public function isHeader($isHeader = true)
{
foreach ($this->_cells as $cell) {
$cell->isHeader($isHeader);
}
return $this;
} | [
"public",
"function",
"isHeader",
"(",
"$",
"isHeader",
"=",
"true",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_cells",
"as",
"$",
"cell",
")",
"{",
"$",
"cell",
"->",
"isHeader",
"(",
"$",
"isHeader",
")",
";",
"}",
"return",
"$",
"this",
";",... | Set whether this row should be a table header or not
@param bool $isHeader
@return Row | [
"Set",
"whether",
"this",
"row",
"should",
"be",
"a",
"table",
"header",
"or",
"not"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Row.php#L116-L123 | train |
schpill/thin | src/Html/Row.php | Row.setState | public function setState($state = null)
{
if (null === $state) {
$this->_state = $state;
return $this;
}
if (in_array($state, array(static::STATE_SUCCESS, static::STATE_ERROR, static::STATE_INFO))) {
$this->_state = $state;
... | php | public function setState($state = null)
{
if (null === $state) {
$this->_state = $state;
return $this;
}
if (in_array($state, array(static::STATE_SUCCESS, static::STATE_ERROR, static::STATE_INFO))) {
$this->_state = $state;
... | [
"public",
"function",
"setState",
"(",
"$",
"state",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"state",
")",
"{",
"$",
"this",
"->",
"_state",
"=",
"$",
"state",
";",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"in_array",
"(",
"$",
... | Sets the row state
@param string $state
@return Row | [
"Sets",
"the",
"row",
"state"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Row.php#L132-L144 | train |
ekyna/AdminBundle | Dashboard/Widget/Registry.php | Registry.hasType | public function hasType($nameOrType)
{
$name = $nameOrType instanceof WidgetTypeInterface ? $nameOrType->getName() : $nameOrType;
return array_key_exists($name, $this->types);
} | php | public function hasType($nameOrType)
{
$name = $nameOrType instanceof WidgetTypeInterface ? $nameOrType->getName() : $nameOrType;
return array_key_exists($name, $this->types);
} | [
"public",
"function",
"hasType",
"(",
"$",
"nameOrType",
")",
"{",
"$",
"name",
"=",
"$",
"nameOrType",
"instanceof",
"WidgetTypeInterface",
"?",
"$",
"nameOrType",
"->",
"getName",
"(",
")",
":",
"$",
"nameOrType",
";",
"return",
"array_key_exists",
"(",
"$... | Returns whether the widget type is registered or not.
@param $nameOrType
@return bool | [
"Returns",
"whether",
"the",
"widget",
"type",
"is",
"registered",
"or",
"not",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/Dashboard/Widget/Registry.php#L36-L41 | train |
ekyna/AdminBundle | Dashboard/Widget/Registry.php | Registry.addType | public function addType(WidgetTypeInterface $widget)
{
if (!$this->hasType($widget)) {
$this->types[$widget->getName()] = $widget;
} else {
throw new \InvalidArgumentException(sprintf('Widget type "%s" is already registered.', $widget->getName()));
}
} | php | public function addType(WidgetTypeInterface $widget)
{
if (!$this->hasType($widget)) {
$this->types[$widget->getName()] = $widget;
} else {
throw new \InvalidArgumentException(sprintf('Widget type "%s" is already registered.', $widget->getName()));
}
} | [
"public",
"function",
"addType",
"(",
"WidgetTypeInterface",
"$",
"widget",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasType",
"(",
"$",
"widget",
")",
")",
"{",
"$",
"this",
"->",
"types",
"[",
"$",
"widget",
"->",
"getName",
"(",
")",
"]",
"... | Adds the widget type.
@param WidgetTypeInterface $widget
@throws \InvalidArgumentException | [
"Adds",
"the",
"widget",
"type",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/Dashboard/Widget/Registry.php#L49-L56 | train |
ekyna/AdminBundle | Dashboard/Widget/Registry.php | Registry.getType | public function getType($name)
{
if ($this->hasType($name)) {
return $this->types[$name];
} else {
throw new \InvalidArgumentException(sprintf('Widget type "%s" not found.', $name));
}
} | php | public function getType($name)
{
if ($this->hasType($name)) {
return $this->types[$name];
} else {
throw new \InvalidArgumentException(sprintf('Widget type "%s" not found.', $name));
}
} | [
"public",
"function",
"getType",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasType",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"this",
"->",
"types",
"[",
"$",
"name",
"]",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"In... | Returns the widget type by name.
@param string $name
@return WidgetTypeInterface
@throws \InvalidArgumentException | [
"Returns",
"the",
"widget",
"type",
"by",
"name",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/Dashboard/Widget/Registry.php#L65-L72 | train |
mobtexting/php-http-client | src/Client.php | Client.parseResponse | protected function parseResponse($channel, $content)
{
$headerSize = curl_getinfo($channel, CURLINFO_HEADER_SIZE);
$statusCode = curl_getinfo($channel, CURLINFO_HTTP_CODE);
$responseBody = substr($content, $headerSize);
$responseHeaders = substr($content, 0, $headerSize);
$re... | php | protected function parseResponse($channel, $content)
{
$headerSize = curl_getinfo($channel, CURLINFO_HEADER_SIZE);
$statusCode = curl_getinfo($channel, CURLINFO_HTTP_CODE);
$responseBody = substr($content, $headerSize);
$responseHeaders = substr($content, 0, $headerSize);
$re... | [
"protected",
"function",
"parseResponse",
"(",
"$",
"channel",
",",
"$",
"content",
")",
"{",
"$",
"headerSize",
"=",
"curl_getinfo",
"(",
"$",
"channel",
",",
"CURLINFO_HEADER_SIZE",
")",
";",
"$",
"statusCode",
"=",
"curl_getinfo",
"(",
"$",
"channel",
","... | Prepare response object
@param resource $channel the curl resource
@param string $content
@return Response object | [
"Prepare",
"response",
"object"
] | 3925e841cfa0f8fcc35f57a6c0c0935076c7e6e3 | https://github.com/mobtexting/php-http-client/blob/3925e841cfa0f8fcc35f57a6c0c0935076c7e6e3/src/Client.php#L252-L262 | train |
Dhii/output-renderer-abstract | src/ContextAwareTrait.php | ContextAwareTrait._setContext | protected function _setContext($context)
{
$this->context = ($context !== null)
? $this->_normalizeContainer($context)
: null;
} | php | protected function _setContext($context)
{
$this->context = ($context !== null)
? $this->_normalizeContainer($context)
: null;
} | [
"protected",
"function",
"_setContext",
"(",
"$",
"context",
")",
"{",
"$",
"this",
"->",
"context",
"=",
"(",
"$",
"context",
"!==",
"null",
")",
"?",
"$",
"this",
"->",
"_normalizeContainer",
"(",
"$",
"context",
")",
":",
"null",
";",
"}"
] | Sets the context for this instance.
@since 0.1
@param array|ArrayAccess|stdClass|ContainerInterface|null $context The context instance, or null. | [
"Sets",
"the",
"context",
"for",
"this",
"instance",
"."
] | 0f6e5eed940025332dd1986d6c771e10f7197b1a | https://github.com/Dhii/output-renderer-abstract/blob/0f6e5eed940025332dd1986d6c771e10f7197b1a/src/ContextAwareTrait.php#L45-L50 | train |
buse974/Dal | src/Dal/Model/AbstractModel.php | AbstractModel.toArray | public function toArray()
{
$hydrator = new ClassMethods();
$vars = $hydrator->extract($this);
foreach ($vars as $key => &$value) {
if ($value === null) {
unset($vars[$key]);
} elseif (is_object($value) && ! $value instanceof \ArrayObject) {
... | php | public function toArray()
{
$hydrator = new ClassMethods();
$vars = $hydrator->extract($this);
foreach ($vars as $key => &$value) {
if ($value === null) {
unset($vars[$key]);
} elseif (is_object($value) && ! $value instanceof \ArrayObject) {
... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"hydrator",
"=",
"new",
"ClassMethods",
"(",
")",
";",
"$",
"vars",
"=",
"$",
"hydrator",
"->",
"extract",
"(",
"$",
"this",
")",
";",
"foreach",
"(",
"$",
"vars",
"as",
"$",
"key",
"=>",
"&",
... | Convert the model to an array.
@return array | [
"Convert",
"the",
"model",
"to",
"an",
"array",
"."
] | faeac9e260c5e675bc7ed1fcea77c7ba251bf8ab | https://github.com/buse974/Dal/blob/faeac9e260c5e675bc7ed1fcea77c7ba251bf8ab/src/Dal/Model/AbstractModel.php#L108-L135 | train |
buse974/Dal | src/Dal/Model/AbstractModel.php | AbstractModel.isRepeatRelational | protected function isRepeatRelational()
{
$is_repeat = false;
if (array_count_values($this->getParentArray())[$this->prefix] > 1) {
$is_repeat = true;
}
return $is_repeat;
} | php | protected function isRepeatRelational()
{
$is_repeat = false;
if (array_count_values($this->getParentArray())[$this->prefix] > 1) {
$is_repeat = true;
}
return $is_repeat;
} | [
"protected",
"function",
"isRepeatRelational",
"(",
")",
"{",
"$",
"is_repeat",
"=",
"false",
";",
"if",
"(",
"array_count_values",
"(",
"$",
"this",
"->",
"getParentArray",
"(",
")",
")",
"[",
"$",
"this",
"->",
"prefix",
"]",
">",
"1",
")",
"{",
"$",... | Return true if relation is boucle infinie.
@return bool | [
"Return",
"true",
"if",
"relation",
"is",
"boucle",
"infinie",
"."
] | faeac9e260c5e675bc7ed1fcea77c7ba251bf8ab | https://github.com/buse974/Dal/blob/faeac9e260c5e675bc7ed1fcea77c7ba251bf8ab/src/Dal/Model/AbstractModel.php#L209-L218 | train |
buse974/Dal | src/Dal/Model/AbstractModel.php | AbstractModel.requireModel | public function requireModel($model, &$data, $prefix = null)
{
$class = null;
$name = (null !== $prefix) ? $prefix : substr($model, strlen(explode('_', $model)[0]) + 7);
foreach ($this->array_prefix as $k => $ap) {
if (strrpos($ap, $name) === (strlen($ap) - strlen($name)... | php | public function requireModel($model, &$data, $prefix = null)
{
$class = null;
$name = (null !== $prefix) ? $prefix : substr($model, strlen(explode('_', $model)[0]) + 7);
foreach ($this->array_prefix as $k => $ap) {
if (strrpos($ap, $name) === (strlen($ap) - strlen($name)... | [
"public",
"function",
"requireModel",
"(",
"$",
"model",
",",
"&",
"$",
"data",
",",
"$",
"prefix",
"=",
"null",
")",
"{",
"$",
"class",
"=",
"null",
";",
"$",
"name",
"=",
"(",
"null",
"!==",
"$",
"prefix",
")",
"?",
"$",
"prefix",
":",
"substr"... | return Model if needed.
@param string $model
@param array $data
@param string $prefix
@return AbstractModel|null | [
"return",
"Model",
"if",
"needed",
"."
] | faeac9e260c5e675bc7ed1fcea77c7ba251bf8ab | https://github.com/buse974/Dal/blob/faeac9e260c5e675bc7ed1fcea77c7ba251bf8ab/src/Dal/Model/AbstractModel.php#L270-L291 | train |
phpcq/autoload-validation | src/AutoloadValidator/Psr0Validator.php | Psr0Validator.checkPearOrNoMatch | private function checkPearOrNoMatch($classNameSpace, $prefixLength, $prefix)
{
// No NS, separator in class namespace.
if (!$classNameSpace) {
return false;
}
if (substr($classNameSpace, 0, $prefixLength) === $prefix) {
return false;
}
return... | php | private function checkPearOrNoMatch($classNameSpace, $prefixLength, $prefix)
{
// No NS, separator in class namespace.
if (!$classNameSpace) {
return false;
}
if (substr($classNameSpace, 0, $prefixLength) === $prefix) {
return false;
}
return... | [
"private",
"function",
"checkPearOrNoMatch",
"(",
"$",
"classNameSpace",
",",
"$",
"prefixLength",
",",
"$",
"prefix",
")",
"{",
"// No NS, separator in class namespace.",
"if",
"(",
"!",
"$",
"classNameSpace",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
... | Check if the class is PEAR style or does not match at all.
Return true if there is some problem, false otherwise.
@param string $classNameSpace The namespace of the class.
@param string $prefixLength The length of the namespace that must match.
@param string $prefix The required namespace prefix.
@return... | [
"Check",
"if",
"the",
"class",
"is",
"PEAR",
"style",
"or",
"does",
"not",
"match",
"at",
"all",
"."
] | c24d331f16034c2096ce0e55492993befbaa687a | https://github.com/phpcq/autoload-validation/blob/c24d331f16034c2096ce0e55492993befbaa687a/src/AutoloadValidator/Psr0Validator.php#L195-L207 | train |
AndyDune/Pipeline | src/Pipeline.php | Pipeline.pipe | public function pipe($pipe, $methodName = '', ...$params): self
{
if ($pipe instanceof Closure) {
$this->pipes[] = $pipe;
return $this;
}
$pipe = [
$pipe,
$methodName,
$params,
false
];
$this->pipes[] = ... | php | public function pipe($pipe, $methodName = '', ...$params): self
{
if ($pipe instanceof Closure) {
$this->pipes[] = $pipe;
return $this;
}
$pipe = [
$pipe,
$methodName,
$params,
false
];
$this->pipes[] = ... | [
"public",
"function",
"pipe",
"(",
"$",
"pipe",
",",
"$",
"methodName",
"=",
"''",
",",
"...",
"$",
"params",
")",
":",
"self",
"{",
"if",
"(",
"$",
"pipe",
"instanceof",
"Closure",
")",
"{",
"$",
"this",
"->",
"pipes",
"[",
"]",
"=",
"$",
"pipe"... | Add stage for workflow.
@param $pipe class name or service name for stage.
@param string $methodName method name for this object
@param string $params additional params
@return $this | [
"Add",
"stage",
"for",
"workflow",
"."
] | 66bcc8ba7a0d74fecdf2f993995c1140c29fd91f | https://github.com/AndyDune/Pipeline/blob/66bcc8ba7a0d74fecdf2f993995c1140c29fd91f/src/Pipeline.php#L137-L152 | train |
AndyDune/Pipeline | src/Pipeline.php | Pipeline.pipeForContainer | public function pipeForContainer($pipe, $methodName = '', ...$params): self
{
if ($pipe instanceof Closure) {
$this->pipes[] = $pipe;
return $this;
}
$pipe = [
$pipe,
$methodName,
$params,
true
];
$this-... | php | public function pipeForContainer($pipe, $methodName = '', ...$params): self
{
if ($pipe instanceof Closure) {
$this->pipes[] = $pipe;
return $this;
}
$pipe = [
$pipe,
$methodName,
$params,
true
];
$this-... | [
"public",
"function",
"pipeForContainer",
"(",
"$",
"pipe",
",",
"$",
"methodName",
"=",
"''",
",",
"...",
"$",
"params",
")",
":",
"self",
"{",
"if",
"(",
"$",
"pipe",
"instanceof",
"Closure",
")",
"{",
"$",
"this",
"->",
"pipes",
"[",
"]",
"=",
"... | Add stage without middleware interface.
@param $pipe description for stage
@param string $methodName
@param array ...$params
@return $this | [
"Add",
"stage",
"without",
"middleware",
"interface",
"."
] | 66bcc8ba7a0d74fecdf2f993995c1140c29fd91f | https://github.com/AndyDune/Pipeline/blob/66bcc8ba7a0d74fecdf2f993995c1140c29fd91f/src/Pipeline.php#L163-L178 | train |
AndyDune/Pipeline | src/Pipeline.php | Pipeline.execute | public function execute()
{
$pipeline = array_reduce(
array_reverse($this->pipes), $this->carry(), function ($passable) {
return $passable;
}
);
return $pipeline($this->passable);
} | php | public function execute()
{
$pipeline = array_reduce(
array_reverse($this->pipes), $this->carry(), function ($passable) {
return $passable;
}
);
return $pipeline($this->passable);
} | [
"public",
"function",
"execute",
"(",
")",
"{",
"$",
"pipeline",
"=",
"array_reduce",
"(",
"array_reverse",
"(",
"$",
"this",
"->",
"pipes",
")",
",",
"$",
"this",
"->",
"carry",
"(",
")",
",",
"function",
"(",
"$",
"passable",
")",
"{",
"return",
"$... | Run the pipeline without a final destination callback.
@return mixed | [
"Run",
"the",
"pipeline",
"without",
"a",
"final",
"destination",
"callback",
"."
] | 66bcc8ba7a0d74fecdf2f993995c1140c29fd91f | https://github.com/AndyDune/Pipeline/blob/66bcc8ba7a0d74fecdf2f993995c1140c29fd91f/src/Pipeline.php#L201-L210 | train |
armazon/armazon | src/Armazon/Mvc/Vista.php | Vista.filtrarValor | public function filtrarValor($filtro, $texto)
{
if (isset($this->filtros[$filtro])) {
$texto = $this->filtros[$filtro]($texto);
}
return $texto;
} | php | public function filtrarValor($filtro, $texto)
{
if (isset($this->filtros[$filtro])) {
$texto = $this->filtros[$filtro]($texto);
}
return $texto;
} | [
"public",
"function",
"filtrarValor",
"(",
"$",
"filtro",
",",
"$",
"texto",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"filtros",
"[",
"$",
"filtro",
"]",
")",
")",
"{",
"$",
"texto",
"=",
"$",
"this",
"->",
"filtros",
"[",
"$",
"filt... | Aplica el filtro solicitado al valor.
@param string $filtro
@param string $texto
@return string | [
"Aplica",
"el",
"filtro",
"solicitado",
"al",
"valor",
"."
] | ec76385ff80ce1659d81bc4050ef9483ab0ebe52 | https://github.com/armazon/armazon/blob/ec76385ff80ce1659d81bc4050ef9483ab0ebe52/src/Armazon/Mvc/Vista.php#L125-L132 | train |
SURFnet/yubikey-api-client | src/Crypto/Signer.php | Signer.sign | public function sign(array $data)
{
ksort($data);
$queryString = $this->buildQueryString($data);
$data['h'] = base64_encode(hash_hmac('sha1', $queryString, $this->clientSecret, true));
return $data;
} | php | public function sign(array $data)
{
ksort($data);
$queryString = $this->buildQueryString($data);
$data['h'] = base64_encode(hash_hmac('sha1', $queryString, $this->clientSecret, true));
return $data;
} | [
"public",
"function",
"sign",
"(",
"array",
"$",
"data",
")",
"{",
"ksort",
"(",
"$",
"data",
")",
";",
"$",
"queryString",
"=",
"$",
"this",
"->",
"buildQueryString",
"(",
"$",
"data",
")",
";",
"$",
"data",
"[",
"'h'",
"]",
"=",
"base64_encode",
... | Signs an array by calculating a signature and setting it on the 'h' key.
@param array $data
@return array | [
"Signs",
"an",
"array",
"by",
"calculating",
"a",
"signature",
"and",
"setting",
"it",
"on",
"the",
"h",
"key",
"."
] | bbcb6340c89c5bcecf2f9258390cb9dfe2b87358 | https://github.com/SURFnet/yubikey-api-client/blob/bbcb6340c89c5bcecf2f9258390cb9dfe2b87358/src/Crypto/Signer.php#L67-L75 | train |
SURFnet/yubikey-api-client | src/Crypto/Signer.php | Signer.verifySignature | public function verifySignature(array $data)
{
$signedData = array_intersect_key($data, array_flip(self::$validResponseParams));
ksort($signedData);
$queryString = $this->buildQueryString($signedData);
$signature = base64_encode(hash_hmac('sha1', $queryString, $this->clientSecret, t... | php | public function verifySignature(array $data)
{
$signedData = array_intersect_key($data, array_flip(self::$validResponseParams));
ksort($signedData);
$queryString = $this->buildQueryString($signedData);
$signature = base64_encode(hash_hmac('sha1', $queryString, $this->clientSecret, t... | [
"public",
"function",
"verifySignature",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"signedData",
"=",
"array_intersect_key",
"(",
"$",
"data",
",",
"array_flip",
"(",
"self",
"::",
"$",
"validResponseParams",
")",
")",
";",
"ksort",
"(",
"$",
"signedData",
... | Verifies that the signature in the 'h' key matches the expected signature.
@param array $data
@return bool | [
"Verifies",
"that",
"the",
"signature",
"in",
"the",
"h",
"key",
"matches",
"the",
"expected",
"signature",
"."
] | bbcb6340c89c5bcecf2f9258390cb9dfe2b87358 | https://github.com/SURFnet/yubikey-api-client/blob/bbcb6340c89c5bcecf2f9258390cb9dfe2b87358/src/Crypto/Signer.php#L83-L92 | train |
denostr/stopforumspam | src/Client.php | Client.request | public function request()
{
$data = $this->prepareData();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->apiHost . '/api');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
... | php | public function request()
{
$data = $this->prepareData();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->apiHost . '/api');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
... | [
"public",
"function",
"request",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"prepareData",
"(",
")",
";",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_URL",
",",
"$",
"this",
"->",
"apiHost",
"."... | Run API reauest
@return mixed
@throws \Exception | [
"Run",
"API",
"reauest"
] | afbab3bd33ea9b408ad7c3331e0dafa2f87ff3ca | https://github.com/denostr/stopforumspam/blob/afbab3bd33ea9b408ad7c3331e0dafa2f87ff3ca/src/Client.php#L147-L161 | train |
denostr/stopforumspam | src/Client.php | Client.prepareData | private function prepareData()
{
$data = [];
foreach (get_object_vars($this) as $property => $value) {
if (in_array($property, ['apiHost', 'debug'])) {
continue;
}
if ($property == 'format') {
$data[$value] = '';
} else... | php | private function prepareData()
{
$data = [];
foreach (get_object_vars($this) as $property => $value) {
if (in_array($property, ['apiHost', 'debug'])) {
continue;
}
if ($property == 'format') {
$data[$value] = '';
} else... | [
"private",
"function",
"prepareData",
"(",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"get_object_vars",
"(",
"$",
"this",
")",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"property",
",",
"... | Preparing data before request
@return string
@throws \Exception | [
"Preparing",
"data",
"before",
"request"
] | afbab3bd33ea9b408ad7c3331e0dafa2f87ff3ca | https://github.com/denostr/stopforumspam/blob/afbab3bd33ea9b408ad7c3331e0dafa2f87ff3ca/src/Client.php#L169-L201 | train |
denostr/stopforumspam | src/Client.php | Client.checkResult | private function checkResult($result)
{
if ($this->debug) {
if (in_array($this->format, [self::FORMAT_JSON, self::FORMAT_JSONP])) {
$result = json_decode($result, true);
} elseif ($this->format == self::FORMAT_SERIAL) {
$result = unserialize($result);
... | php | private function checkResult($result)
{
if ($this->debug) {
if (in_array($this->format, [self::FORMAT_JSON, self::FORMAT_JSONP])) {
$result = json_decode($result, true);
} elseif ($this->format == self::FORMAT_SERIAL) {
$result = unserialize($result);
... | [
"private",
"function",
"checkResult",
"(",
"$",
"result",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"debug",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"this",
"->",
"format",
",",
"[",
"self",
"::",
"FORMAT_JSON",
",",
"self",
"::",
"FORMAT_JSONP",
"]... | Check response data
@param $result
@throws \Exception | [
"Check",
"response",
"data"
] | afbab3bd33ea9b408ad7c3331e0dafa2f87ff3ca | https://github.com/denostr/stopforumspam/blob/afbab3bd33ea9b408ad7c3331e0dafa2f87ff3ca/src/Client.php#L209-L224 | train |
YiMAproject/yimaAdminor | src/yimaAdminor/Service/AuthServiceFactory.php | AuthServiceFactory.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
$serviceLocator = $serviceLocator->getServiceLocator();
$config = $serviceLocator->get('Config');
$config = (isset($config['yima_adminor']) && is_array($config['yima_adminor']))
? $config['yima_adminor']
... | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
$serviceLocator = $serviceLocator->getServiceLocator();
$config = $serviceLocator->get('Config');
$config = (isset($config['yima_adminor']) && is_array($config['yima_adminor']))
? $config['yima_adminor']
... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"$",
"serviceLocator",
"=",
"$",
"serviceLocator",
"->",
"getServiceLocator",
"(",
")",
";",
"$",
"config",
"=",
"$",
"serviceLocator",
"->",
"get",
"(",
"'Co... | Create the Authentication Service
@param ServiceLocatorInterface $serviceLocator
@return iAuthenticateAdapter | [
"Create",
"the",
"Authentication",
"Service"
] | 7a6c66e05aedaef8061c8998dfa44ac1ce9cc319 | https://github.com/YiMAproject/yimaAdminor/blob/7a6c66e05aedaef8061c8998dfa44ac1ce9cc319/src/yimaAdminor/Service/AuthServiceFactory.php#L18-L45 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Session.php | Radial_Core_Model_Session._extractQuoteSkuData | protected function _extractQuoteSkuData(Mage_Sales_Model_Quote $quote)
{
$skuData = [];
// use getAllVisibleItems to prevent dupes due to parent config + child used both being included
foreach ($quote->getAllVisibleItems() as $item) {
// before item's have been saved, getAllVisib... | php | protected function _extractQuoteSkuData(Mage_Sales_Model_Quote $quote)
{
$skuData = [];
// use getAllVisibleItems to prevent dupes due to parent config + child used both being included
foreach ($quote->getAllVisibleItems() as $item) {
// before item's have been saved, getAllVisib... | [
"protected",
"function",
"_extractQuoteSkuData",
"(",
"Mage_Sales_Model_Quote",
"$",
"quote",
")",
"{",
"$",
"skuData",
"=",
"[",
"]",
";",
"// use getAllVisibleItems to prevent dupes due to parent config + child used both being included",
"foreach",
"(",
"$",
"quote",
"->",
... | Get sku and qty data for a given quote
@param Mage_Sales_Model_Quote $quote Quote object to extract data from
@return array Array of 'sku' => qty | [
"Get",
"sku",
"and",
"qty",
"data",
"for",
"a",
"given",
"quote"
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Session.php#L57-L75 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Session.php | Radial_Core_Model_Session._extractAddressData | protected function _extractAddressData(Mage_Customer_Model_Address_Abstract $address)
{
return array(
'street' => $address->getStreet(),
'city' => $address->getCity(),
'region_code' => $address->getRegionCode(),
'country_id' => $address->getCountryId(),
... | php | protected function _extractAddressData(Mage_Customer_Model_Address_Abstract $address)
{
return array(
'street' => $address->getStreet(),
'city' => $address->getCity(),
'region_code' => $address->getRegionCode(),
'country_id' => $address->getCountryId(),
... | [
"protected",
"function",
"_extractAddressData",
"(",
"Mage_Customer_Model_Address_Abstract",
"$",
"address",
")",
"{",
"return",
"array",
"(",
"'street'",
"=>",
"$",
"address",
"->",
"getStreet",
"(",
")",
",",
"'city'",
"=>",
"$",
"address",
"->",
"getCity",
"(... | Extract array of address data - street, city, region code, etc. from an address object
@param Mage_Customer_Model_Address_Abstract $address Address object to pull data from
@return array Extracted data | [
"Extract",
"array",
"of",
"address",
"data",
"-",
"street",
"city",
"region",
"code",
"etc",
".",
"from",
"an",
"address",
"object"
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Session.php#L81-L90 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Session.php | Radial_Core_Model_Session._extractQuoteShippingData | protected function _extractQuoteShippingData(Mage_Sales_Model_Quote $quote)
{
$shippingData = array();
foreach ($quote->getAllShippingAddresses() as $address) {
$shippingData[] = array(
'method' => $address->getShippingMethod(),
'address' => $this->_extrac... | php | protected function _extractQuoteShippingData(Mage_Sales_Model_Quote $quote)
{
$shippingData = array();
foreach ($quote->getAllShippingAddresses() as $address) {
$shippingData[] = array(
'method' => $address->getShippingMethod(),
'address' => $this->_extrac... | [
"protected",
"function",
"_extractQuoteShippingData",
"(",
"Mage_Sales_Model_Quote",
"$",
"quote",
")",
"{",
"$",
"shippingData",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"quote",
"->",
"getAllShippingAddresses",
"(",
")",
"as",
"$",
"address",
")",
"... | Extract shipping data from a quote - the shipping method and address for each shipping address
in the quote.
@param Mage_Sales_Model_Quote $quote The quote to extract the data from
@return array Map of shipping method and address for each shipping address in the quote | [
"Extract",
"shipping",
"data",
"from",
"a",
"quote",
"-",
"the",
"shipping",
"method",
"and",
"address",
"for",
"each",
"shipping",
"address",
"in",
"the",
"quote",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Session.php#L97-L107 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Session.php | Radial_Core_Model_Session._extractQuoteBillingData | protected function _extractQuoteBillingData(Mage_Sales_Model_Quote $quote)
{
$address = $quote->getBillingAddress();
return $address ?
$this->_extractAddressData($address) :
array();
} | php | protected function _extractQuoteBillingData(Mage_Sales_Model_Quote $quote)
{
$address = $quote->getBillingAddress();
return $address ?
$this->_extractAddressData($address) :
array();
} | [
"protected",
"function",
"_extractQuoteBillingData",
"(",
"Mage_Sales_Model_Quote",
"$",
"quote",
")",
"{",
"$",
"address",
"=",
"$",
"quote",
"->",
"getBillingAddress",
"(",
")",
";",
"return",
"$",
"address",
"?",
"$",
"this",
"->",
"_extractAddressData",
"(",... | Return array of billing address data if available, otherwise, an empty array
@param Mage_Sales_Model_Quote $quote Quote object to extract data from
@return array Array of billing address data | [
"Return",
"array",
"of",
"billing",
"address",
"data",
"if",
"available",
"otherwise",
"an",
"empty",
"array"
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Session.php#L122-L128 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Session.php | Radial_Core_Model_Session._extractQuoteAmounts | protected function _extractQuoteAmounts(Mage_Sales_Model_Quote $quote)
{
return array_map(
function ($address) {
return array(
'subtotal' => round($address->getSubtotal(), 4) ?: 0.0000,
'discount' => round($address->getDiscountAmount(), 4) ... | php | protected function _extractQuoteAmounts(Mage_Sales_Model_Quote $quote)
{
return array_map(
function ($address) {
return array(
'subtotal' => round($address->getSubtotal(), 4) ?: 0.0000,
'discount' => round($address->getDiscountAmount(), 4) ... | [
"protected",
"function",
"_extractQuoteAmounts",
"(",
"Mage_Sales_Model_Quote",
"$",
"quote",
")",
"{",
"return",
"array_map",
"(",
"function",
"(",
"$",
"address",
")",
"{",
"return",
"array",
"(",
"'subtotal'",
"=>",
"round",
"(",
"$",
"address",
"->",
"getS... | Extract quote amounts from each address.
@param Mage_Sales_Model_Quote $quote
@return array | [
"Extract",
"quote",
"amounts",
"from",
"each",
"address",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Session.php#L134-L148 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Session.php | Radial_Core_Model_Session._diffQuoteData | protected function _diffQuoteData($oldQuote, $newQuote)
{
if (empty($oldQuote)) {
return $newQuote;
}
return $this->_diffBilling($oldQuote['billing'], $newQuote['billing']) +
$this->_diffCoupon($oldQuote['coupon'], $newQuote['coupon']) +
$this->_diffShippi... | php | protected function _diffQuoteData($oldQuote, $newQuote)
{
if (empty($oldQuote)) {
return $newQuote;
}
return $this->_diffBilling($oldQuote['billing'], $newQuote['billing']) +
$this->_diffCoupon($oldQuote['coupon'], $newQuote['coupon']) +
$this->_diffShippi... | [
"protected",
"function",
"_diffQuoteData",
"(",
"$",
"oldQuote",
",",
"$",
"newQuote",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"oldQuote",
")",
")",
"{",
"return",
"$",
"newQuote",
";",
"}",
"return",
"$",
"this",
"->",
"_diffBilling",
"(",
"$",
"oldQu... | Diff the new quote to the old quote. May contain keys for 'billing', 'coupon', 'shipping'
and 'skus'. For more details on the type of changes detected for each key, see the
responsible methods for diffing those sets of data.
@param array $oldQuote Array of data extracted from a quote
@param array $newQuote Array of... | [
"Diff",
"the",
"new",
"quote",
"to",
"the",
"old",
"quote",
".",
"May",
"contain",
"keys",
"for",
"billing",
"coupon",
"shipping",
"and",
"skus",
".",
"For",
"more",
"details",
"on",
"the",
"type",
"of",
"changes",
"detected",
"for",
"each",
"key",
"see"... | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Session.php#L252-L262 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Session.php | Radial_Core_Model_Session._anyItem | protected function _anyItem($items, $key)
{
foreach ($items as $item) {
if (isset($item[$key]) && $item[$key]) {
return true;
}
}
return false;
} | php | protected function _anyItem($items, $key)
{
foreach ($items as $item) {
if (isset($item[$key]) && $item[$key]) {
return true;
}
}
return false;
} | [
"protected",
"function",
"_anyItem",
"(",
"$",
"items",
",",
"$",
"key",
")",
"{",
"foreach",
"(",
"$",
"items",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"item",
"[",
"$",
"key",
"]",
")",
"&&",
"$",
"item",
"[",
"$",
"key",
... | Check the set of items to have an item with the given key set to a
truthy value.
@param array $items array of item data
@param string $key array key to check
@return bool true if any item has a truthy value at the given key | [
"Check",
"the",
"set",
"of",
"items",
"to",
"have",
"an",
"item",
"with",
"the",
"given",
"key",
"set",
"to",
"a",
"truthy",
"value",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Session.php#L270-L278 | train |
Clevis/Se34 | Se34/BrowserSession.php | BrowserSession.keepOpen | public function keepOpen()
{
$stoppedProperty = new \ReflectionProperty(get_parent_class($this), 'stopped');
$stoppedProperty->setAccessible(TRUE);
$stoppedProperty->setValue($this, TRUE);
} | php | public function keepOpen()
{
$stoppedProperty = new \ReflectionProperty(get_parent_class($this), 'stopped');
$stoppedProperty->setAccessible(TRUE);
$stoppedProperty->setValue($this, TRUE);
} | [
"public",
"function",
"keepOpen",
"(",
")",
"{",
"$",
"stoppedProperty",
"=",
"new",
"\\",
"ReflectionProperty",
"(",
"get_parent_class",
"(",
"$",
"this",
")",
",",
"'stopped'",
")",
";",
"$",
"stoppedProperty",
"->",
"setAccessible",
"(",
"TRUE",
")",
";",... | Calling this method avoids destructor to send DELETE session request.
The browser window will close either way, but after some quite long
timeout (at least with ChromeDriver). | [
"Calling",
"this",
"method",
"avoids",
"destructor",
"to",
"send",
"DELETE",
"session",
"request",
"."
] | c52d579a831ba5642dae464882da012b0409ae46 | https://github.com/Clevis/Se34/blob/c52d579a831ba5642dae464882da012b0409ae46/Se34/BrowserSession.php#L109-L114 | train |
Clevis/Se34 | Se34/BrowserSession.php | BrowserSession.getLink | public function getLink($presenterName, $parameters = array())
{
$url = new \Nette\Http\UrlScript($this->context->parameters['selenium']['baseUrl']);
$url->scriptPath = $url->path;
$appRequest = new \Nette\Application\Request($presenterName, 'GET', Utils::strToArray($parameters));
return $this->context->router... | php | public function getLink($presenterName, $parameters = array())
{
$url = new \Nette\Http\UrlScript($this->context->parameters['selenium']['baseUrl']);
$url->scriptPath = $url->path;
$appRequest = new \Nette\Application\Request($presenterName, 'GET', Utils::strToArray($parameters));
return $this->context->router... | [
"public",
"function",
"getLink",
"(",
"$",
"presenterName",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"url",
"=",
"new",
"\\",
"Nette",
"\\",
"Http",
"\\",
"UrlScript",
"(",
"$",
"this",
"->",
"context",
"->",
"parameters",
"[",
... | Creates an URL.
Parameters can be either a PHP array, or a Neon array without brackets.
Ie. Instead of `array('a' => 'b', 'c' => 'd')` you can pass `'a=b,c=d'`.
@param string $presenterName
@param array|string $parameters | [
"Creates",
"an",
"URL",
"."
] | c52d579a831ba5642dae464882da012b0409ae46 | https://github.com/Clevis/Se34/blob/c52d579a831ba5642dae464882da012b0409ae46/Se34/BrowserSession.php#L146-L152 | train |
Clevis/Se34 | Se34/BrowserSession.php | BrowserSession.getAppRequest | public function getAppRequest($url = NULL)
{
$httpRequest = new \Nette\Http\Request($this->getUrlScriptForUrl($url ? : $this->url()));
return $this->context->router->match($httpRequest);
} | php | public function getAppRequest($url = NULL)
{
$httpRequest = new \Nette\Http\Request($this->getUrlScriptForUrl($url ? : $this->url()));
return $this->context->router->match($httpRequest);
} | [
"public",
"function",
"getAppRequest",
"(",
"$",
"url",
"=",
"NULL",
")",
"{",
"$",
"httpRequest",
"=",
"new",
"\\",
"Nette",
"\\",
"Http",
"\\",
"Request",
"(",
"$",
"this",
"->",
"getUrlScriptForUrl",
"(",
"$",
"url",
"?",
":",
"$",
"this",
"->",
"... | URL back-routed into application request object.
@param string|NULL $url URL or NULL for current URL.
@return \Nette\Application\Request | [
"URL",
"back",
"-",
"routed",
"into",
"application",
"request",
"object",
"."
] | c52d579a831ba5642dae464882da012b0409ae46 | https://github.com/Clevis/Se34/blob/c52d579a831ba5642dae464882da012b0409ae46/Se34/BrowserSession.php#L160-L164 | train |
Clevis/Se34 | Se34/BrowserSession.php | BrowserSession.waitForAlert | public function waitForAlert($timeout = 60)
{
$result = FALSE;
$i = 0;
do
{
sleep(1);
try
{
$result = $this->alertText();
}
catch (\RuntimeException $e)
{
;
}
} while (++$i < $timeout && $result === FALSE);
return $result;
} | php | public function waitForAlert($timeout = 60)
{
$result = FALSE;
$i = 0;
do
{
sleep(1);
try
{
$result = $this->alertText();
}
catch (\RuntimeException $e)
{
;
}
} while (++$i < $timeout && $result === FALSE);
return $result;
} | [
"public",
"function",
"waitForAlert",
"(",
"$",
"timeout",
"=",
"60",
")",
"{",
"$",
"result",
"=",
"FALSE",
";",
"$",
"i",
"=",
"0",
";",
"do",
"{",
"sleep",
"(",
"1",
")",
";",
"try",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"alertText",
"... | Wait for javascript alert, prompt or confirm dialog.
@param int $timeout Patience in seconds.
@return string|bool Alert text, or FALSE if waiting times out. | [
"Wait",
"for",
"javascript",
"alert",
"prompt",
"or",
"confirm",
"dialog",
"."
] | c52d579a831ba5642dae464882da012b0409ae46 | https://github.com/Clevis/Se34/blob/c52d579a831ba5642dae464882da012b0409ae46/Se34/BrowserSession.php#L172-L189 | train |
Clevis/Se34 | Se34/BrowserSession.php | BrowserSession.waitForCondition | public function waitForCondition($jsCondition, $timeout = 60)
{
$i = 0;
do
{
sleep(1);
} while (
!($result = $this->execute(array('script' => 'return ' . $jsCondition, 'args' => array())))
&& $i++ < $timeout
);
return $result;
} | php | public function waitForCondition($jsCondition, $timeout = 60)
{
$i = 0;
do
{
sleep(1);
} while (
!($result = $this->execute(array('script' => 'return ' . $jsCondition, 'args' => array())))
&& $i++ < $timeout
);
return $result;
} | [
"public",
"function",
"waitForCondition",
"(",
"$",
"jsCondition",
",",
"$",
"timeout",
"=",
"60",
")",
"{",
"$",
"i",
"=",
"0",
";",
"do",
"{",
"sleep",
"(",
"1",
")",
";",
"}",
"while",
"(",
"!",
"(",
"$",
"result",
"=",
"$",
"this",
"->",
"e... | Wait for fulfilment of some javascript condition.
@param string $jsCondition Javascript code.
@param int $timeout Amount of patience in seconds.
@return bool Whether the condition was fulfilled. | [
"Wait",
"for",
"fulfilment",
"of",
"some",
"javascript",
"condition",
"."
] | c52d579a831ba5642dae464882da012b0409ae46 | https://github.com/Clevis/Se34/blob/c52d579a831ba5642dae464882da012b0409ae46/Se34/BrowserSession.php#L220-L231 | train |
Clevis/Se34 | Se34/BrowserSession.php | BrowserSession.getActiveElement | public function getActiveElement()
{
$response = $this->driver->curl('POST', $this->url->addCommand('element/active'));
return Element::fromResponseValue($response->getValue(), $this->url->descend('element'), $this->driver);
} | php | public function getActiveElement()
{
$response = $this->driver->curl('POST', $this->url->addCommand('element/active'));
return Element::fromResponseValue($response->getValue(), $this->url->descend('element'), $this->driver);
} | [
"public",
"function",
"getActiveElement",
"(",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"driver",
"->",
"curl",
"(",
"'POST'",
",",
"$",
"this",
"->",
"url",
"->",
"addCommand",
"(",
"'element/active'",
")",
")",
";",
"return",
"Element",
"::",... | Get the element on the page that currently has focus.
@return Element | [
"Get",
"the",
"element",
"on",
"the",
"page",
"that",
"currently",
"has",
"focus",
"."
] | c52d579a831ba5642dae464882da012b0409ae46 | https://github.com/Clevis/Se34/blob/c52d579a831ba5642dae464882da012b0409ae46/Se34/BrowserSession.php#L249-L253 | train |
Clevis/Se34 | Se34/BrowserSession.php | BrowserSession.element | public function element(\PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria)
{
$value = $this->postCommand('element', $criteria);
return Element::fromResponseValue($value, $this->url->descend('element'), $this->driver);
} | php | public function element(\PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria)
{
$value = $this->postCommand('element', $criteria);
return Element::fromResponseValue($value, $this->url->descend('element'), $this->driver);
} | [
"public",
"function",
"element",
"(",
"\\",
"PHPUnit_Extensions_Selenium2TestCase_ElementCriteria",
"$",
"criteria",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"postCommand",
"(",
"'element'",
",",
"$",
"criteria",
")",
";",
"return",
"Element",
"::",
"from... | Finds an element using the criteria.
Criteria are set by this WTF way:
<code>
$session->element($session->using('xpath')->value('//input[type="text"]'));
</code>
@param \PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria
@return Element | [
"Finds",
"an",
"element",
"using",
"the",
"criteria",
"."
] | c52d579a831ba5642dae464882da012b0409ae46 | https://github.com/Clevis/Se34/blob/c52d579a831ba5642dae464882da012b0409ae46/Se34/BrowserSession.php#L266-L270 | train |
Clevis/Se34 | Se34/BrowserSession.php | BrowserSession.elements | public function elements(\PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria)
{
$values = $this->postCommand('elements', $criteria);
$elements = array();
foreach ($values as $value)
{
$elements[] = Element::fromResponseValue($value, $this->url->descend('element'), $this->driver);
}
return $e... | php | public function elements(\PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria)
{
$values = $this->postCommand('elements', $criteria);
$elements = array();
foreach ($values as $value)
{
$elements[] = Element::fromResponseValue($value, $this->url->descend('element'), $this->driver);
}
return $e... | [
"public",
"function",
"elements",
"(",
"\\",
"PHPUnit_Extensions_Selenium2TestCase_ElementCriteria",
"$",
"criteria",
")",
"{",
"$",
"values",
"=",
"$",
"this",
"->",
"postCommand",
"(",
"'elements'",
",",
"$",
"criteria",
")",
";",
"$",
"elements",
"=",
"array"... | Finds elements using given criteria.
Similar to {@see BrowserSession::element()}, only this returns all matched
elements as an array. Also, this doesn't throw an exception if no
element was found.
@param \PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria
@return Element[] array of instances of Se34\Eleme... | [
"Finds",
"elements",
"using",
"given",
"criteria",
"."
] | c52d579a831ba5642dae464882da012b0409ae46 | https://github.com/Clevis/Se34/blob/c52d579a831ba5642dae464882da012b0409ae46/Se34/BrowserSession.php#L282-L291 | train |
stonedz/pff2 | src/Abs/AModule.php | AModule.getRequiredModules | public function getRequiredModules($moduleName) {
$moduleName = strtolower($moduleName);
if (isset($this->_requiredModules[$moduleName])) {
return $this->_requiredModules[$moduleName];
}
else {
return null;
}
} | php | public function getRequiredModules($moduleName) {
$moduleName = strtolower($moduleName);
if (isset($this->_requiredModules[$moduleName])) {
return $this->_requiredModules[$moduleName];
}
else {
return null;
}
} | [
"public",
"function",
"getRequiredModules",
"(",
"$",
"moduleName",
")",
"{",
"$",
"moduleName",
"=",
"strtolower",
"(",
"$",
"moduleName",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_requiredModules",
"[",
"$",
"moduleName",
"]",
")",
")",
"... | Gets a module
@param string $moduleName
@return AModule|null | [
"Gets",
"a",
"module"
] | ec3b087d4d4732816f61ac487f0cb25511e0da88 | https://github.com/stonedz/pff2/blob/ec3b087d4d4732816f61ac487f0cb25511e0da88/src/Abs/AModule.php#L122-L130 | train |
stonedz/pff2 | src/Abs/AModule.php | AModule.readConfig | public function readConfig($configFile) {
$yamlParser = new \Symfony\Component\Yaml\Parser();
$userConfPath = ROOT . DS . 'app' . DS . 'config' . DS . 'modules' . DS . $configFile;
$userCustomPath = ROOT. DS . 'app'. DS.'modules'.DS.$configFile;
$composerConfPath = ROOT . DS . 'modules... | php | public function readConfig($configFile) {
$yamlParser = new \Symfony\Component\Yaml\Parser();
$userConfPath = ROOT . DS . 'app' . DS . 'config' . DS . 'modules' . DS . $configFile;
$userCustomPath = ROOT. DS . 'app'. DS.'modules'.DS.$configFile;
$composerConfPath = ROOT . DS . 'modules... | [
"public",
"function",
"readConfig",
"(",
"$",
"configFile",
")",
"{",
"$",
"yamlParser",
"=",
"new",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Yaml",
"\\",
"Parser",
"(",
")",
";",
"$",
"userConfPath",
"=",
"ROOT",
".",
"DS",
".",
"'app'",
".",
"DS",
... | Reads the configuration file ad returns a configuration array
@param string $configFile The module filename
@throws ModuleException
@return array | [
"Reads",
"the",
"configuration",
"file",
"ad",
"returns",
"a",
"configuration",
"array"
] | ec3b087d4d4732816f61ac487f0cb25511e0da88 | https://github.com/stonedz/pff2/blob/ec3b087d4d4732816f61ac487f0cb25511e0da88/src/Abs/AModule.php#L195-L220 | train |
schpill/thin | src/Injection/Manager.php | InstanceManager.addSharedInstance | public function addSharedInstance($instance, $classOrAlias)
{
if (!is_object($instance)) {
throw new Exception('This method requires an object to be shared. Class or Alias given: ' . $classOrAlias);
}
$this->sharedInstances[$classOrAlias] = $instance;
... | php | public function addSharedInstance($instance, $classOrAlias)
{
if (!is_object($instance)) {
throw new Exception('This method requires an object to be shared. Class or Alias given: ' . $classOrAlias);
}
$this->sharedInstances[$classOrAlias] = $instance;
... | [
"public",
"function",
"addSharedInstance",
"(",
"$",
"instance",
",",
"$",
"classOrAlias",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"instance",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'This method requires an object to be shared. Class or Alias giv... | Add shared instance
@param object $instance
@param string $classOrAlias
@throws Exception | [
"Add",
"shared",
"instance"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Injection/Manager.php#L88-L95 | train |
schpill/thin | src/Injection/Manager.php | InstanceManager.getSharedInstanceWithParameters | public function getSharedInstanceWithParameters($classOrAlias, array $params, $fastHashFromHasLookup = null)
{
if ($fastHashFromHasLookup) {
return $this->sharedInstancesWithParams['hashLong'][$fastHashFromHasLookup];
}
ksort($params);
$hashKey = ... | php | public function getSharedInstanceWithParameters($classOrAlias, array $params, $fastHashFromHasLookup = null)
{
if ($fastHashFromHasLookup) {
return $this->sharedInstancesWithParams['hashLong'][$fastHashFromHasLookup];
}
ksort($params);
$hashKey = ... | [
"public",
"function",
"getSharedInstanceWithParameters",
"(",
"$",
"classOrAlias",
",",
"array",
"$",
"params",
",",
"$",
"fastHashFromHasLookup",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"fastHashFromHasLookup",
")",
"{",
"return",
"$",
"this",
"->",
"sharedInsta... | Retrieves an instance by its name and the parameters stored at its instantiation
@param string $classOrAlias
@param array $params
@param bool|null $fastHashFromHasLookup
@return object|bool false if no instance was found | [
"Retrieves",
"an",
"instance",
"by",
"its",
"name",
"and",
"the",
"parameters",
"stored",
"at",
"its",
"instantiation"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Injection/Manager.php#L150-L168 | train |
schpill/thin | src/Injection/Manager.php | InstanceManager.hasConfig | public function hasConfig($aliasOrClass)
{
$key = ($this->hasAlias($aliasOrClass)) ? 'alias:' . $this->getBaseAlias($aliasOrClass) : $aliasOrClass;
if (!isset($this->configurations[$key])) {
return false;
}
if ($this->configurations[$key] === $th... | php | public function hasConfig($aliasOrClass)
{
$key = ($this->hasAlias($aliasOrClass)) ? 'alias:' . $this->getBaseAlias($aliasOrClass) : $aliasOrClass;
if (!isset($this->configurations[$key])) {
return false;
}
if ($this->configurations[$key] === $th... | [
"public",
"function",
"hasConfig",
"(",
"$",
"aliasOrClass",
")",
"{",
"$",
"key",
"=",
"(",
"$",
"this",
"->",
"hasAlias",
"(",
"$",
"aliasOrClass",
")",
")",
"?",
"'alias:'",
".",
"$",
"this",
"->",
"getBaseAlias",
"(",
"$",
"aliasOrClass",
")",
":",... | Check for configuration
@param string $aliasOrClass
@return bool | [
"Check",
"for",
"configuration"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Injection/Manager.php#L279-L292 | train |
schpill/thin | src/Injection/Manager.php | InstanceManager.hasTypePreferences | public function hasTypePreferences($interfaceOrAbstract)
{
$key = ($this->hasAlias($interfaceOrAbstract)) ? 'alias:' . $interfaceOrAbstract : $interfaceOrAbstract;
return (isset($this->typePreferences[$key]) && $this->typePreferences[$key]);
} | php | public function hasTypePreferences($interfaceOrAbstract)
{
$key = ($this->hasAlias($interfaceOrAbstract)) ? 'alias:' . $interfaceOrAbstract : $interfaceOrAbstract;
return (isset($this->typePreferences[$key]) && $this->typePreferences[$key]);
} | [
"public",
"function",
"hasTypePreferences",
"(",
"$",
"interfaceOrAbstract",
")",
"{",
"$",
"key",
"=",
"(",
"$",
"this",
"->",
"hasAlias",
"(",
"$",
"interfaceOrAbstract",
")",
")",
"?",
"'alias:'",
".",
"$",
"interfaceOrAbstract",
":",
"$",
"interfaceOrAbstr... | Check for type preferences
@param string $interfaceOrAbstract
@return bool | [
"Check",
"for",
"type",
"preferences"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Injection/Manager.php#L397-L402 | train |
schpill/thin | src/Injection/Manager.php | InstanceManager.setTypePreference | public function setTypePreference($interfaceOrAbstract, array $preferredImplementations)
{
$key = ($this->hasAlias($interfaceOrAbstract)) ? 'alias:' . $interfaceOrAbstract : $interfaceOrAbstract;
foreach ($preferredImplementations as $preferredImplementation) {
$this->ad... | php | public function setTypePreference($interfaceOrAbstract, array $preferredImplementations)
{
$key = ($this->hasAlias($interfaceOrAbstract)) ? 'alias:' . $interfaceOrAbstract : $interfaceOrAbstract;
foreach ($preferredImplementations as $preferredImplementation) {
$this->ad... | [
"public",
"function",
"setTypePreference",
"(",
"$",
"interfaceOrAbstract",
",",
"array",
"$",
"preferredImplementations",
")",
"{",
"$",
"key",
"=",
"(",
"$",
"this",
"->",
"hasAlias",
"(",
"$",
"interfaceOrAbstract",
")",
")",
"?",
"'alias:'",
".",
"$",
"i... | Set type preference
@param string $interfaceOrAbstract
@param array $preferredImplementations
@return InstanceManager | [
"Set",
"type",
"preference"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Injection/Manager.php#L411-L420 | train |
schpill/thin | src/Injection/Manager.php | InstanceManager.getTypePreferences | public function getTypePreferences($interfaceOrAbstract)
{
$key = ($this->hasAlias($interfaceOrAbstract)) ? 'alias:' . $interfaceOrAbstract : $interfaceOrAbstract;
if (isset($this->typePreferences[$key])) {
return $this->typePreferences[$key];
}
... | php | public function getTypePreferences($interfaceOrAbstract)
{
$key = ($this->hasAlias($interfaceOrAbstract)) ? 'alias:' . $interfaceOrAbstract : $interfaceOrAbstract;
if (isset($this->typePreferences[$key])) {
return $this->typePreferences[$key];
}
... | [
"public",
"function",
"getTypePreferences",
"(",
"$",
"interfaceOrAbstract",
")",
"{",
"$",
"key",
"=",
"(",
"$",
"this",
"->",
"hasAlias",
"(",
"$",
"interfaceOrAbstract",
")",
")",
"?",
"'alias:'",
".",
"$",
"interfaceOrAbstract",
":",
"$",
"interfaceOrAbstr... | Get type preferences
@param string $interfaceOrAbstract
@return array | [
"Get",
"type",
"preferences"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Injection/Manager.php#L428-L437 | train |
schpill/thin | src/Injection/Manager.php | InstanceManager.unsetTypePreferences | public function unsetTypePreferences($interfaceOrAbstract)
{
$key = ($this->hasAlias($interfaceOrAbstract)) ? 'alias:' . $interfaceOrAbstract : $interfaceOrAbstract;
unset($this->typePreferences[$key]);
} | php | public function unsetTypePreferences($interfaceOrAbstract)
{
$key = ($this->hasAlias($interfaceOrAbstract)) ? 'alias:' . $interfaceOrAbstract : $interfaceOrAbstract;
unset($this->typePreferences[$key]);
} | [
"public",
"function",
"unsetTypePreferences",
"(",
"$",
"interfaceOrAbstract",
")",
"{",
"$",
"key",
"=",
"(",
"$",
"this",
"->",
"hasAlias",
"(",
"$",
"interfaceOrAbstract",
")",
")",
"?",
"'alias:'",
".",
"$",
"interfaceOrAbstract",
":",
"$",
"interfaceOrAbs... | Unset type preferences
@param string $interfaceOrAbstract
@return void | [
"Unset",
"type",
"preferences"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Injection/Manager.php#L445-L450 | train |
schpill/thin | src/Injection/Manager.php | InstanceManager.removeTypePreference | public function removeTypePreference($interfaceOrAbstract, $preferredType)
{
$key = ($this->hasAlias($interfaceOrAbstract)) ? 'alias:' . $interfaceOrAbstract : $interfaceOrAbstract;
if (!isset($this->typePreferences[$key]) || !Arrays::in($preferredType, $this->typePreferences[$key])) {
... | php | public function removeTypePreference($interfaceOrAbstract, $preferredType)
{
$key = ($this->hasAlias($interfaceOrAbstract)) ? 'alias:' . $interfaceOrAbstract : $interfaceOrAbstract;
if (!isset($this->typePreferences[$key]) || !Arrays::in($preferredType, $this->typePreferences[$key])) {
... | [
"public",
"function",
"removeTypePreference",
"(",
"$",
"interfaceOrAbstract",
",",
"$",
"preferredType",
")",
"{",
"$",
"key",
"=",
"(",
"$",
"this",
"->",
"hasAlias",
"(",
"$",
"interfaceOrAbstract",
")",
")",
"?",
"'alias:'",
".",
"$",
"interfaceOrAbstract"... | Removes a previously set type preference
@param string $interfaceOrAbstract
@param string $preferredType
@return bool|self | [
"Removes",
"a",
"previously",
"set",
"type",
"preference"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Injection/Manager.php#L480-L491 | train |
jasny/entity | src/EventListener/ToAssocRecursive.php | ToAssocRecursive.toAssocRecursive | protected function toAssocRecursive($input, SplObjectStorage $list): array
{
$values = is_iterable($input)
? i\iterable_to_array($input)
: object_get_properties($input, $input instanceof stdClass || $input instanceof DynamicEntity);
foreach ($values as $key => &$value) {
... | php | protected function toAssocRecursive($input, SplObjectStorage $list): array
{
$values = is_iterable($input)
? i\iterable_to_array($input)
: object_get_properties($input, $input instanceof stdClass || $input instanceof DynamicEntity);
foreach ($values as $key => &$value) {
... | [
"protected",
"function",
"toAssocRecursive",
"(",
"$",
"input",
",",
"SplObjectStorage",
"$",
"list",
")",
":",
"array",
"{",
"$",
"values",
"=",
"is_iterable",
"(",
"$",
"input",
")",
"?",
"i",
"\\",
"iterable_to_array",
"(",
"$",
"input",
")",
":",
"ob... | Recursively cast to associative arrays.
@param iterable|object $input
@param SplObjectStorage $list Entity / assoc map for entities that already have been converted
@return array | [
"Recursively",
"cast",
"to",
"associative",
"arrays",
"."
] | 5af7c94645671a3257d6565ff1891ff61fdcf69b | https://github.com/jasny/entity/blob/5af7c94645671a3257d6565ff1891ff61fdcf69b/src/EventListener/ToAssocRecursive.php#L62-L81 | train |
MovingImage24/VM6ApiClient | lib/Entity/Video.php | Video.getStills | public function getStills()
{
if (!isset($this->stills)) {
$this->stills = [
new Still($this->thumbnail_url, 'default'),
new Still($this->thumbnail_url_lq, 'lq'),
new Still($this->thumbnail_url_mq, 'mq'),
];
}
return $t... | php | public function getStills()
{
if (!isset($this->stills)) {
$this->stills = [
new Still($this->thumbnail_url, 'default'),
new Still($this->thumbnail_url_lq, 'lq'),
new Still($this->thumbnail_url_mq, 'mq'),
];
}
return $t... | [
"public",
"function",
"getStills",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"stills",
")",
")",
"{",
"$",
"this",
"->",
"stills",
"=",
"[",
"new",
"Still",
"(",
"$",
"this",
"->",
"thumbnail_url",
",",
"'default'",
")",
",",
... | Generate a list of Still entities based on
other properties that come from VM 6.
@return Still[] | [
"Generate",
"a",
"list",
"of",
"Still",
"entities",
"based",
"on",
"other",
"properties",
"that",
"come",
"from",
"VM",
"6",
"."
] | 84e6510fa0fb71cfbb42ea9f23775f681c266fac | https://github.com/MovingImage24/VM6ApiClient/blob/84e6510fa0fb71cfbb42ea9f23775f681c266fac/lib/Entity/Video.php#L267-L278 | train |
PhoxPHP/Glider | src/Connection/ConnectionManager.php | ConnectionManager.get | private function get(String $id)
{
if (!$id) {
$id = ConnectionManager::DEFAULT_CONNECTION_ID;
}
if (count($this->loadedConnections) < 1) {
return false;
}
if (isset($this->loadedConnections[$id])) {
$this->configuredConnectionId = $id;
$this->platformConnector = [$id => $this->loadedConnection... | php | private function get(String $id)
{
if (!$id) {
$id = ConnectionManager::DEFAULT_CONNECTION_ID;
}
if (count($this->loadedConnections) < 1) {
return false;
}
if (isset($this->loadedConnections[$id])) {
$this->configuredConnectionId = $id;
$this->platformConnector = [$id => $this->loadedConnection... | [
"private",
"function",
"get",
"(",
"String",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"$",
"id",
")",
"{",
"$",
"id",
"=",
"ConnectionManager",
"::",
"DEFAULT_CONNECTION_ID",
";",
"}",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"loadedConnections",
")",
... | Try to connection with this id from the loaded connections in the configuration
file.
@param $id <String>
@access private
@return <Mixed> | [
"Try",
"to",
"connection",
"with",
"this",
"id",
"from",
"the",
"loaded",
"connections",
"in",
"the",
"configuration",
"file",
"."
] | 17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042 | https://github.com/PhoxPHP/Glider/blob/17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042/src/Connection/ConnectionManager.php#L223-L239 | train |
phramework/testphase | src/Globals.php | Globals.toString | public static function toString()
{
$return = [];
foreach (static::$globals as $key => $value) {
$type = gettype($value);
if (is_callable($value)) {
$valueString = 'callable';
$type = 'callable';
} elseif (is_array($value)) {
... | php | public static function toString()
{
$return = [];
foreach (static::$globals as $key => $value) {
$type = gettype($value);
if (is_callable($value)) {
$valueString = 'callable';
$type = 'callable';
} elseif (is_array($value)) {
... | [
"public",
"static",
"function",
"toString",
"(",
")",
"{",
"$",
"return",
"=",
"[",
"]",
";",
"foreach",
"(",
"static",
"::",
"$",
"globals",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"type",
"=",
"gettype",
"(",
"$",
"value",
")",
";"... | Return keys and values of global variables as string
@return string | [
"Return",
"keys",
"and",
"values",
"of",
"global",
"variables",
"as",
"string"
] | b00107b7a37cf1a1b9b8860b3eb031aacfa2634c | https://github.com/phramework/testphase/blob/b00107b7a37cf1a1b9b8860b3eb031aacfa2634c/src/Globals.php#L245-L270 | train |
DBRisinajumi/d2company | controllers/CcucUserCompanyController.php | CcucUserCompanyController.actionEditableSaver | public function actionEditableSaver()
{
Yii::import('EditableSaver'); //or you can add import 'ext.editable.*' to config
$es = new EditableSaver('CcucUserCompany'); // classname of model to be updated
$es->update();
//verify if change statuss
if($es->attribute != 'c... | php | public function actionEditableSaver()
{
Yii::import('EditableSaver'); //or you can add import 'ext.editable.*' to config
$es = new EditableSaver('CcucUserCompany'); // classname of model to be updated
$es->update();
//verify if change statuss
if($es->attribute != 'c... | [
"public",
"function",
"actionEditableSaver",
"(",
")",
"{",
"Yii",
"::",
"import",
"(",
"'EditableSaver'",
")",
";",
"//or you can add import 'ext.editable.*' to config",
"$",
"es",
"=",
"new",
"EditableSaver",
"(",
"'CcucUserCompany'",
")",
";",
"// classname of model ... | for company ccuc on change status to USER create customer office uses
@return type | [
"for",
"company",
"ccuc",
"on",
"change",
"status",
"to",
"USER",
"create",
"customer",
"office",
"uses"
] | 20df0db96ac2c8e73471c4bab7d487b67ef4ed0a | https://github.com/DBRisinajumi/d2company/blob/20df0db96ac2c8e73471c4bab7d487b67ef4ed0a/controllers/CcucUserCompanyController.php#L129-L149 | train |
rbone/phactory | lib/Phactory/Loader.php | Loader.load | public function load($name)
{
$factoryClass = ucfirst($name) . "Phactory";
if (!class_exists($factoryClass)) {
throw new \Exception("Unknown factory '$name'");
}
return new Factory($name, new $factoryClass);
} | php | public function load($name)
{
$factoryClass = ucfirst($name) . "Phactory";
if (!class_exists($factoryClass)) {
throw new \Exception("Unknown factory '$name'");
}
return new Factory($name, new $factoryClass);
} | [
"public",
"function",
"load",
"(",
"$",
"name",
")",
"{",
"$",
"factoryClass",
"=",
"ucfirst",
"(",
"$",
"name",
")",
".",
"\"Phactory\"",
";",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"factoryClass",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
... | Loads the factory according to the object class name
@param string $name
@return \Phactory\Factory
@throws \Exception | [
"Loads",
"the",
"factory",
"according",
"to",
"the",
"object",
"class",
"name"
] | f1c474084f9b310d171f393fe196e8a2a7aae1ec | https://github.com/rbone/phactory/blob/f1c474084f9b310d171f393fe196e8a2a7aae1ec/lib/Phactory/Loader.php#L17-L26 | train |
newestindustry/ginger-rest | src/Ginger/XMLSerializer.php | XMLSerializer.generateValidXmlFromArray | public static function generateValidXmlFromArray($array, $node_block='response', $node_name='item')
{
$xml = '<?xml version="1.0" encoding="UTF-8" ?>';
$xml .= '<' . $node_block . '>';
$xml .= self::generateXmlFromArray($array, $node_name);
$xml .= '</' . $node_block . '>';
... | php | public static function generateValidXmlFromArray($array, $node_block='response', $node_name='item')
{
$xml = '<?xml version="1.0" encoding="UTF-8" ?>';
$xml .= '<' . $node_block . '>';
$xml .= self::generateXmlFromArray($array, $node_name);
$xml .= '</' . $node_block . '>';
... | [
"public",
"static",
"function",
"generateValidXmlFromArray",
"(",
"$",
"array",
",",
"$",
"node_block",
"=",
"'response'",
",",
"$",
"node_name",
"=",
"'item'",
")",
"{",
"$",
"xml",
"=",
"'<?xml version=\"1.0\" encoding=\"UTF-8\" ?>'",
";",
"$",
"xml",
".=",
"'... | Generate valid xml from array
@param array $array
@param string $node_block
@param string $node_name
@return string | [
"Generate",
"valid",
"xml",
"from",
"array"
] | 482b77dc122a60ab0bf143a3c4a1e67168985c83 | https://github.com/newestindustry/ginger-rest/blob/482b77dc122a60ab0bf143a3c4a1e67168985c83/src/Ginger/XMLSerializer.php#L38-L47 | train |
newestindustry/ginger-rest | src/Ginger/XMLSerializer.php | XMLSerializer.generateXmlFromArray | private static function generateXmlFromArray($array, $node_name)
{
$xml = '';
if (is_array($array) || is_object($array)) {
foreach ($array as $key=>$value) {
if (is_numeric($key)) {
$key = $node_name;
}
$xml .= '<' . ... | php | private static function generateXmlFromArray($array, $node_name)
{
$xml = '';
if (is_array($array) || is_object($array)) {
foreach ($array as $key=>$value) {
if (is_numeric($key)) {
$key = $node_name;
}
$xml .= '<' . ... | [
"private",
"static",
"function",
"generateXmlFromArray",
"(",
"$",
"array",
",",
"$",
"node_name",
")",
"{",
"$",
"xml",
"=",
"''",
";",
"if",
"(",
"is_array",
"(",
"$",
"array",
")",
"||",
"is_object",
"(",
"$",
"array",
")",
")",
"{",
"foreach",
"(... | Generate XML from array
@param array $array
@param string $node_name
@return string | [
"Generate",
"XML",
"from",
"array"
] | 482b77dc122a60ab0bf143a3c4a1e67168985c83 | https://github.com/newestindustry/ginger-rest/blob/482b77dc122a60ab0bf143a3c4a1e67168985c83/src/Ginger/XMLSerializer.php#L56-L73 | train |
luoxiaojun1992/lb_framework | components/Log.php | Log.addDeferLog | protected function addDeferLog($role, $level, $message, $context)
{
$this->deferLogs[] = compact('role', 'level', 'message', 'context');
$this->deferLogsCount++;
} | php | protected function addDeferLog($role, $level, $message, $context)
{
$this->deferLogs[] = compact('role', 'level', 'message', 'context');
$this->deferLogsCount++;
} | [
"protected",
"function",
"addDeferLog",
"(",
"$",
"role",
",",
"$",
"level",
",",
"$",
"message",
",",
"$",
"context",
")",
"{",
"$",
"this",
"->",
"deferLogs",
"[",
"]",
"=",
"compact",
"(",
"'role'",
",",
"'level'",
",",
"'message'",
",",
"'context'"... | Add a defer log
@param $role
@param $level
@param $message
@param $context | [
"Add",
"a",
"defer",
"log"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/Log.php#L145-L149 | train |
luoxiaojun1992/lb_framework | components/Log.php | Log.removeDeferLog | protected function removeDeferLog($k)
{
if (!isset($this->deferLogs[$k])) {
return;
}
unset($this->deferLogs[$k]);
$this->deferLogsCount--;
} | php | protected function removeDeferLog($k)
{
if (!isset($this->deferLogs[$k])) {
return;
}
unset($this->deferLogs[$k]);
$this->deferLogsCount--;
} | [
"protected",
"function",
"removeDeferLog",
"(",
"$",
"k",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"deferLogs",
"[",
"$",
"k",
"]",
")",
")",
"{",
"return",
";",
"}",
"unset",
"(",
"$",
"this",
"->",
"deferLogs",
"[",
"$",
"k",
... | Remove a defer log
@param $k | [
"Remove",
"a",
"defer",
"log"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/Log.php#L156-L164 | train |
luoxiaojun1992/lb_framework | components/Log.php | Log.flush | public function flush()
{
//todo bugfix batch record
foreach ($this->deferLogs as $k => $deferLog) {
$this->record($deferLog['message'], $deferLog['context'], $deferLog['level'], $deferLog['role']);
$this->removeDeferLog($k);
}
} | php | public function flush()
{
//todo bugfix batch record
foreach ($this->deferLogs as $k => $deferLog) {
$this->record($deferLog['message'], $deferLog['context'], $deferLog['level'], $deferLog['role']);
$this->removeDeferLog($k);
}
} | [
"public",
"function",
"flush",
"(",
")",
"{",
"//todo bugfix batch record",
"foreach",
"(",
"$",
"this",
"->",
"deferLogs",
"as",
"$",
"k",
"=>",
"$",
"deferLog",
")",
"{",
"$",
"this",
"->",
"record",
"(",
"$",
"deferLog",
"[",
"'message'",
"]",
",",
... | Flush defer logs | [
"Flush",
"defer",
"logs"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/Log.php#L169-L176 | train |
factorio-item-browser/api-client | src/Serializer/SerializerFactory.php | SerializerFactory.addCacheDirectory | protected function addCacheDirectory(ContainerInterface $container, SerializerBuilder $builder): void
{
$config = $container->get('config');
$libraryConfig = $config[ConfigKey::PROJECT][ConfigKey::API_CLIENT] ?? [];
$cacheDir = (string) ($libraryConfig[ConfigKey::CACHE_DIR] ?? '');
... | php | protected function addCacheDirectory(ContainerInterface $container, SerializerBuilder $builder): void
{
$config = $container->get('config');
$libraryConfig = $config[ConfigKey::PROJECT][ConfigKey::API_CLIENT] ?? [];
$cacheDir = (string) ($libraryConfig[ConfigKey::CACHE_DIR] ?? '');
... | [
"protected",
"function",
"addCacheDirectory",
"(",
"ContainerInterface",
"$",
"container",
",",
"SerializerBuilder",
"$",
"builder",
")",
":",
"void",
"{",
"$",
"config",
"=",
"$",
"container",
"->",
"get",
"(",
"'config'",
")",
";",
"$",
"libraryConfig",
"=",... | Adds the cache directory from the config to the builder.
@param ContainerInterface $container
@param SerializerBuilder $builder | [
"Adds",
"the",
"cache",
"directory",
"from",
"the",
"config",
"to",
"the",
"builder",
"."
] | ebda897483bd537c310a17ff868ca40c0568f728 | https://github.com/factorio-item-browser/api-client/blob/ebda897483bd537c310a17ff868ca40c0568f728/src/Serializer/SerializerFactory.php#L56-L65 | train |
valu-digital/valuso | src/ValuSo/Broker/ServiceBroker.php | ServiceBroker.setOptions | public function setOptions($options)
{
if (!is_array($options) && !$options instanceof Traversable) {
throw new \InvalidArgumentException(sprintf(
'Expected an array or Traversable; received "%s"',
(is_object($options) ? get_class($options) : gettype($options))
))... | php | public function setOptions($options)
{
if (!is_array($options) && !$options instanceof Traversable) {
throw new \InvalidArgumentException(sprintf(
'Expected an array or Traversable; received "%s"',
(is_object($options) ? get_class($options) : gettype($options))
))... | [
"public",
"function",
"setOptions",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"options",
")",
"&&",
"!",
"$",
"options",
"instanceof",
"Traversable",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"("... | Configure service broker
Use this method to configure service broker.
Currently supports only option 'loader' which
calls {@see setLoader()}.
@param array|Traversable $options
@throws \InvalidArgumentException
@return \ValuSo\Broker\ServiceBroker | [
"Configure",
"service",
"broker"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Broker/ServiceBroker.php#L96-L115 | train |
valu-digital/valuso | src/ValuSo/Broker/ServiceBroker.php | ServiceBroker.getDefaultIdentity | public function getDefaultIdentity()
{
if (!$this->defaultIdentity) {
$this->defaultIdentity = new ArrayObject(array());
if ($this->exists('Identity')) {
$responses = $this->execute(
'Identity',
'getIdentity',
array(),
... | php | public function getDefaultIdentity()
{
if (!$this->defaultIdentity) {
$this->defaultIdentity = new ArrayObject(array());
if ($this->exists('Identity')) {
$responses = $this->execute(
'Identity',
'getIdentity',
array(),
... | [
"public",
"function",
"getDefaultIdentity",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"defaultIdentity",
")",
"{",
"$",
"this",
"->",
"defaultIdentity",
"=",
"new",
"ArrayObject",
"(",
"array",
"(",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
... | Retrieve default identity
@return \ArrayAccess|null | [
"Retrieve",
"default",
"identity"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Broker/ServiceBroker.php#L141-L167 | train |
valu-digital/valuso | src/ValuSo/Broker/ServiceBroker.php | ServiceBroker.setLoader | public function setLoader(ServiceLoader $loader){
$this->loader = $loader;
$that = $this;
$this->loader->addInitializer(function ($instance) use ($that) {
// Inject broker to services
if ($instance instanceof Feature\ServiceBrokerAwareInterface) {
$instance->setServiceBroker($that);
... | php | public function setLoader(ServiceLoader $loader){
$this->loader = $loader;
$that = $this;
$this->loader->addInitializer(function ($instance) use ($that) {
// Inject broker to services
if ($instance instanceof Feature\ServiceBrokerAwareInterface) {
$instance->setServiceBroker($that);
... | [
"public",
"function",
"setLoader",
"(",
"ServiceLoader",
"$",
"loader",
")",
"{",
"$",
"this",
"->",
"loader",
"=",
"$",
"loader",
";",
"$",
"that",
"=",
"$",
"this",
";",
"$",
"this",
"->",
"loader",
"->",
"addInitializer",
"(",
"function",
"(",
"$",
... | Set service loader instance
@param ServiceLoader $loader | [
"Set",
"service",
"loader",
"instance"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Broker/ServiceBroker.php#L185-L204 | train |
valu-digital/valuso | src/ValuSo/Broker/ServiceBroker.php | ServiceBroker.service | public function service($service){
if(!$this->exists($service)){
throw new ServiceNotFoundException(sprintf('Service "%s" not found', $service));
}
return new Worker($this, $service);
} | php | public function service($service){
if(!$this->exists($service)){
throw new ServiceNotFoundException(sprintf('Service "%s" not found', $service));
}
return new Worker($this, $service);
} | [
"public",
"function",
"service",
"(",
"$",
"service",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"exists",
"(",
"$",
"service",
")",
")",
"{",
"throw",
"new",
"ServiceNotFoundException",
"(",
"sprintf",
"(",
"'Service \"%s\" not found'",
",",
"$",
"servi... | Initialize and retrieve a new service Worker
@param string $service
@throws ServiceNotFoundException
@return Worker | [
"Initialize",
"and",
"retrieve",
"a",
"new",
"service",
"Worker"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Broker/ServiceBroker.php#L257-L264 | train |
valu-digital/valuso | src/ValuSo/Broker/ServiceBroker.php | ServiceBroker.executeInContext | public function executeInContext($context, $service, $operation, $argv = array(), $callback = null)
{
$command = new Command(
$service,
$operation,
$argv,
$context);
return $this->dispatch($command, $callback);
} | php | public function executeInContext($context, $service, $operation, $argv = array(), $callback = null)
{
$command = new Command(
$service,
$operation,
$argv,
$context);
return $this->dispatch($command, $callback);
} | [
"public",
"function",
"executeInContext",
"(",
"$",
"context",
",",
"$",
"service",
",",
"$",
"operation",
",",
"$",
"argv",
"=",
"array",
"(",
")",
",",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"command",
"=",
"new",
"Command",
"(",
"$",
"servic... | Execute service operation in context
@param string $context
@param string $service
@param string $operation
@param array $argv
@param mixed $callback Valid PHP callback
@param string $context
@return ResponseCollection | [
"Execute",
"service",
"operation",
"in",
"context"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Broker/ServiceBroker.php#L290-L299 | train |
valu-digital/valuso | src/ValuSo/Broker/ServiceBroker.php | ServiceBroker.queue | public function queue(CommandInterface $command, array $options = [])
{
$queueName = null;
if (array_key_exists(self::QUEUE_OPTION_NAME, $options)) {
$queueName = $options[self::QUEUE_OPTION_NAME] ?: null;
unset($options[self::QUEUE_OPTION_NAME]);
}
$queue = $t... | php | public function queue(CommandInterface $command, array $options = [])
{
$queueName = null;
if (array_key_exists(self::QUEUE_OPTION_NAME, $options)) {
$queueName = $options[self::QUEUE_OPTION_NAME] ?: null;
unset($options[self::QUEUE_OPTION_NAME]);
}
$queue = $t... | [
"public",
"function",
"queue",
"(",
"CommandInterface",
"$",
"command",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"queueName",
"=",
"null",
";",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"QUEUE_OPTION_NAME",
",",
"$",
"options",
... | Queue execution of service operation
@param CommandInterface $command
@param array $options
@return ServiceJob | [
"Queue",
"execution",
"of",
"service",
"operation"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Broker/ServiceBroker.php#L308-L339 | train |
valu-digital/valuso | src/ValuSo/Broker/ServiceBroker.php | ServiceBroker.createEvent | protected function createEvent($name, CommandInterface $command)
{
$event = new ServiceEvent();
$event->setName($name);
$event->setCommand($command);
$event->setParams($command->getParams());
return $event;
} | php | protected function createEvent($name, CommandInterface $command)
{
$event = new ServiceEvent();
$event->setName($name);
$event->setCommand($command);
$event->setParams($command->getParams());
return $event;
} | [
"protected",
"function",
"createEvent",
"(",
"$",
"name",
",",
"CommandInterface",
"$",
"command",
")",
"{",
"$",
"event",
"=",
"new",
"ServiceEvent",
"(",
")",
";",
"$",
"event",
"->",
"setName",
"(",
"$",
"name",
")",
";",
"$",
"event",
"->",
"setCom... | Create a new service event
@param string $name
@param CommandInterface $command
@return \ValuSo\Broker\ServiceEvent | [
"Create",
"a",
"new",
"service",
"event"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Broker/ServiceBroker.php#L515-L523 | train |
worldnettps/magento2-module-subscription | Model/Status.php | Status.getCurrency | public function getCurrency()
{
$options = [ 'EUR' => __('Euro'),
'GBP' => __('Sterling'),
'USD' => __('US Dollar'),
'CAD' => __('Canadian Dollar'),
'AUD' => __('Australian Dollar'),
'DKK' => __('Danish Krone... | php | public function getCurrency()
{
$options = [ 'EUR' => __('Euro'),
'GBP' => __('Sterling'),
'USD' => __('US Dollar'),
'CAD' => __('Canadian Dollar'),
'AUD' => __('Australian Dollar'),
'DKK' => __('Danish Krone... | [
"public",
"function",
"getCurrency",
"(",
")",
"{",
"$",
"options",
"=",
"[",
"'EUR'",
"=>",
"__",
"(",
"'Euro'",
")",
",",
"'GBP'",
"=>",
"__",
"(",
"'Sterling'",
")",
",",
"'USD'",
"=>",
"__",
"(",
"'US Dollar'",
")",
",",
"'CAD'",
"=>",
"__",
"(... | Get Grid row currency labels array.
@return array | [
"Get",
"Grid",
"row",
"currency",
"labels",
"array",
"."
] | dcac6fb7f13bc9a3d47cb9ca04734fef627b0eab | https://github.com/worldnettps/magento2-module-subscription/blob/dcac6fb7f13bc9a3d47cb9ca04734fef627b0eab/Model/Status.php#L11-L23 | train |
bariew/yii2-doctest-extension | MethodParser.php | MethodParser.processComment | protected function processComment()
{
$comment=strtr(trim(preg_replace('/^\s*\**( |\t)?/m','',trim($this->getDocComment(),'/'))),"\r",'');
if(preg_match('/^\s*@\w+/m',$comment, $matches, PREG_OFFSET_CAPTURE)){
$meta=substr($comment,$matches[0][1]);
$this->processTags($meta);
... | php | protected function processComment()
{
$comment=strtr(trim(preg_replace('/^\s*\**( |\t)?/m','',trim($this->getDocComment(),'/'))),"\r",'');
if(preg_match('/^\s*@\w+/m',$comment, $matches, PREG_OFFSET_CAPTURE)){
$meta=substr($comment,$matches[0][1]);
$this->processTags($meta);
... | [
"protected",
"function",
"processComment",
"(",
")",
"{",
"$",
"comment",
"=",
"strtr",
"(",
"trim",
"(",
"preg_replace",
"(",
"'/^\\s*\\**( |\\t)?/m'",
",",
"''",
",",
"trim",
"(",
"$",
"this",
"->",
"getDocComment",
"(",
")",
",",
"'/'",
")",
")",
")",... | gets tags lines from docblock
@author Qiang Xue <qiang.xue@gmail.com> | [
"gets",
"tags",
"lines",
"from",
"docblock"
] | 526e0281f055dbd55ad5fbcb2a3104164a056e0b | https://github.com/bariew/yii2-doctest-extension/blob/526e0281f055dbd55ad5fbcb2a3104164a056e0b/MethodParser.php#L23-L30 | train |
bariew/yii2-doctest-extension | MethodParser.php | MethodParser.processTags | protected function processTags($comment)
{
$tags = preg_split('/^\s*@/m',$comment,-1,PREG_SPLIT_NO_EMPTY);
foreach($tags as $tag){
$segs = preg_split('/\s+/',trim($tag),2);
$tagName= $segs[0];
$param = isset($segs[1]) ? trim($segs[1]) : '';
$this->t... | php | protected function processTags($comment)
{
$tags = preg_split('/^\s*@/m',$comment,-1,PREG_SPLIT_NO_EMPTY);
foreach($tags as $tag){
$segs = preg_split('/\s+/',trim($tag),2);
$tagName= $segs[0];
$param = isset($segs[1]) ? trim($segs[1]) : '';
$this->t... | [
"protected",
"function",
"processTags",
"(",
"$",
"comment",
")",
"{",
"$",
"tags",
"=",
"preg_split",
"(",
"'/^\\s*@/m'",
",",
"$",
"comment",
",",
"-",
"1",
",",
"PREG_SPLIT_NO_EMPTY",
")",
";",
"foreach",
"(",
"$",
"tags",
"as",
"$",
"tag",
")",
"{"... | extracts tags array from docblock
@param string $comment docblock
@author Qiang Xue <qiang.xue@gmail.com> | [
"extracts",
"tags",
"array",
"from",
"docblock"
] | 526e0281f055dbd55ad5fbcb2a3104164a056e0b | https://github.com/bariew/yii2-doctest-extension/blob/526e0281f055dbd55ad5fbcb2a3104164a056e0b/MethodParser.php#L36-L45 | train |
gbprod/doctrine-specification | src/DoctrineSpecification/Registry.php | Registry.getFactory | public function getFactory(Specification $spec): Factory
{
if(!isset($this->factories[get_class($spec)])) {
throw new \OutOfRangeException(sprintf(
'Factory for Specification "%s" not registred',
get_class($spec)
));
}
return $this->fa... | php | public function getFactory(Specification $spec): Factory
{
if(!isset($this->factories[get_class($spec)])) {
throw new \OutOfRangeException(sprintf(
'Factory for Specification "%s" not registred',
get_class($spec)
));
}
return $this->fa... | [
"public",
"function",
"getFactory",
"(",
"Specification",
"$",
"spec",
")",
":",
"Factory",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"factories",
"[",
"get_class",
"(",
"$",
"spec",
")",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"OutOfRa... | Get registred factory for Specification
@param Specification $spec
@return Factory
@throw OutOfRangeException if Factory not found | [
"Get",
"registred",
"factory",
"for",
"Specification"
] | 348e8ec31547f4949a193d21b3a1d5cdb48b23cb | https://github.com/gbprod/doctrine-specification/blob/348e8ec31547f4949a193d21b3a1d5cdb48b23cb/src/DoctrineSpecification/Registry.php#L42-L52 | train |
carno-php/nsq | src/Chips/TMCommands.php | TMCommands.retry | public function retry(int $delayed = 0) : void
{
$this->link->req($this->id(), $delayed);
} | php | public function retry(int $delayed = 0) : void
{
$this->link->req($this->id(), $delayed);
} | [
"public",
"function",
"retry",
"(",
"int",
"$",
"delayed",
"=",
"0",
")",
":",
"void",
"{",
"$",
"this",
"->",
"link",
"->",
"req",
"(",
"$",
"this",
"->",
"id",
"(",
")",
",",
"$",
"delayed",
")",
";",
"}"
] | delayed in milliseconds
@param int $delayed | [
"delayed",
"in",
"milliseconds"
] | cc4f1278556ff530bbe2e03345bdeb54fef1275a | https://github.com/carno-php/nsq/blob/cc4f1278556ff530bbe2e03345bdeb54fef1275a/src/Chips/TMCommands.php#L41-L44 | train |
bruno-barros/w.eloquent-framework | src/weloquent/Plugins/Blade/blade.php | BladePlugin.parse | public function parse($template)
{
$viewsFromConfig = $this->app['config']->get('view.paths');
$views = array_merge((array)$viewsFromConfig, (array)$this->paths['theme']);
$cache = $this->paths['storage'] . '/views';
$blade = new BladeAdapter($views, $cache);
if (!$blade->getCompiler()->isExpired($templa... | php | public function parse($template)
{
$viewsFromConfig = $this->app['config']->get('view.paths');
$views = array_merge((array)$viewsFromConfig, (array)$this->paths['theme']);
$cache = $this->paths['storage'] . '/views';
$blade = new BladeAdapter($views, $cache);
if (!$blade->getCompiler()->isExpired($templa... | [
"public",
"function",
"parse",
"(",
"$",
"template",
")",
"{",
"$",
"viewsFromConfig",
"=",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'view.paths'",
")",
";",
"$",
"views",
"=",
"array_merge",
"(",
"(",
"array",
")",
"$",
"vi... | Handle the compilation of the templates
@param $template | [
"Handle",
"the",
"compilation",
"of",
"the",
"templates"
] | d252dcb1ba1b6b1cecf67877d7d6d3ba57ebedbd | https://github.com/bruno-barros/w.eloquent-framework/blob/d252dcb1ba1b6b1cecf67877d7d6d3ba57ebedbd/src/weloquent/Plugins/Blade/blade.php#L103-L122 | train |
Anahkiasen/php-configuration | src/TreeBuilder/ClosureNode.php | ClosureNode.validateType | protected function validateType($value)
{
if (!$value instanceof Closure && $value !== null) {
$exception = new InvalidTypeException(sprintf(
'Invalid type for path "%s". Expected closure, but got %s.',
$this->getPath(),
gettype($value)
... | php | protected function validateType($value)
{
if (!$value instanceof Closure && $value !== null) {
$exception = new InvalidTypeException(sprintf(
'Invalid type for path "%s". Expected closure, but got %s.',
$this->getPath(),
gettype($value)
... | [
"protected",
"function",
"validateType",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"value",
"instanceof",
"Closure",
"&&",
"$",
"value",
"!==",
"null",
")",
"{",
"$",
"exception",
"=",
"new",
"InvalidTypeException",
"(",
"sprintf",
"(",
"'Invalid t... | Validates the type of a Node.
@param mixed $value The value to validate
@throws InvalidTypeException when the value is invalid | [
"Validates",
"the",
"type",
"of",
"a",
"Node",
"."
] | f67f1e045f3e2e3dc8bd88c66caf960095e69d97 | https://github.com/Anahkiasen/php-configuration/blob/f67f1e045f3e2e3dc8bd88c66caf960095e69d97/src/TreeBuilder/ClosureNode.php#L27-L44 | train |
rackberg/para | src/Service/Strategy/DisplayCombinedOutputStrategy.php | DisplayCombinedOutputStrategy.addProcessInfo | private function addProcessInfo(Process $process, Project $project)
{
$this->processes[$project->getName()] = [
'process' => $process,
'project' => $project,
];
} | php | private function addProcessInfo(Process $process, Project $project)
{
$this->processes[$project->getName()] = [
'process' => $process,
'project' => $project,
];
} | [
"private",
"function",
"addProcessInfo",
"(",
"Process",
"$",
"process",
",",
"Project",
"$",
"project",
")",
"{",
"$",
"this",
"->",
"processes",
"[",
"$",
"project",
"->",
"getName",
"(",
")",
"]",
"=",
"[",
"'process'",
"=>",
"$",
"process",
",",
"'... | Adds the process and project info.
@param \Symfony\Component\Process\Process $process
@param \Para\Entity\Project $project | [
"Adds",
"the",
"process",
"and",
"project",
"info",
"."
] | e0ef1356ed2979670eb7c670d88921406cade46e | https://github.com/rackberg/para/blob/e0ef1356ed2979670eb7c670d88921406cade46e/src/Service/Strategy/DisplayCombinedOutputStrategy.php#L78-L84 | train |
rackberg/para | src/Service/Strategy/DisplayCombinedOutputStrategy.php | DisplayCombinedOutputStrategy.workaroundForSingleChar | private function workaroundForSingleChar(
string &$incrementalOutput,
Project $project
) {
// Check if there is a temporarily stored char.
if (!empty($this->tmpChar[$project->getName()]) && !empty($incrementalOutput)) {
// Add the char directly at the beginning of the cur... | php | private function workaroundForSingleChar(
string &$incrementalOutput,
Project $project
) {
// Check if there is a temporarily stored char.
if (!empty($this->tmpChar[$project->getName()]) && !empty($incrementalOutput)) {
// Add the char directly at the beginning of the cur... | [
"private",
"function",
"workaroundForSingleChar",
"(",
"string",
"&",
"$",
"incrementalOutput",
",",
"Project",
"$",
"project",
")",
"{",
"// Check if there is a temporarily stored char.",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"tmpChar",
"[",
"$",
"proj... | Workaround for single char.
Sometimes it happens that only one char has been returned by $process->getIncrementalOutput()
even if there are more chars that could also be returned.
In this case we need to create a workaround, that temporarily stores
the single char returned to output it in front of the next
incremental... | [
"Workaround",
"for",
"single",
"char",
"."
] | e0ef1356ed2979670eb7c670d88921406cade46e | https://github.com/rackberg/para/blob/e0ef1356ed2979670eb7c670d88921406cade46e/src/Service/Strategy/DisplayCombinedOutputStrategy.php#L118-L136 | train |
rackberg/para | src/Service/Strategy/DisplayCombinedOutputStrategy.php | DisplayCombinedOutputStrategy.handleProcessOutput | protected function handleProcessOutput(
array $processInfo,
BufferedOutputInterface $output,
callable $processTerminatedCallback
) {
// Get the process.
/** @var Process $process */
$process = $processInfo['process'];
// Get the project.
/** @var Proj... | php | protected function handleProcessOutput(
array $processInfo,
BufferedOutputInterface $output,
callable $processTerminatedCallback
) {
// Get the process.
/** @var Process $process */
$process = $processInfo['process'];
// Get the project.
/** @var Proj... | [
"protected",
"function",
"handleProcessOutput",
"(",
"array",
"$",
"processInfo",
",",
"BufferedOutputInterface",
"$",
"output",
",",
"callable",
"$",
"processTerminatedCallback",
")",
"{",
"// Get the process.",
"/** @var Process $process */",
"$",
"process",
"=",
"$",
... | Handles the output for a process.
@param array $processInfo The process information.
@param \Para\Service\Output\BufferedOutputInterface $output
@param callable $processTerminatedCallback | [
"Handles",
"the",
"output",
"for",
"a",
"process",
"."
] | e0ef1356ed2979670eb7c670d88921406cade46e | https://github.com/rackberg/para/blob/e0ef1356ed2979670eb7c670d88921406cade46e/src/Service/Strategy/DisplayCombinedOutputStrategy.php#L145-L239 | train |
ossbrownie/util | src/Brownie/Util/StorageList.php | StorageList.get | public function get($keyName, $defaultValue = null)
{
$this->initList();
$keyName = strtolower($keyName);
if (empty($this->list[$keyName])) {
return $defaultValue;
}
return $this->list[$keyName];
} | php | public function get($keyName, $defaultValue = null)
{
$this->initList();
$keyName = strtolower($keyName);
if (empty($this->list[$keyName])) {
return $defaultValue;
}
return $this->list[$keyName];
} | [
"public",
"function",
"get",
"(",
"$",
"keyName",
",",
"$",
"defaultValue",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"initList",
"(",
")",
";",
"$",
"keyName",
"=",
"strtolower",
"(",
"$",
"keyName",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",... | Gets value of by key name.
@param string $keyName Key name.
@param mixed $defaultValue Default value.
@return string|mixed | [
"Gets",
"value",
"of",
"by",
"key",
"name",
"."
] | d60edd989f4c1e3caad243a75020f251a4b80283 | https://github.com/ossbrownie/util/blob/d60edd989f4c1e3caad243a75020f251a4b80283/src/Brownie/Util/StorageList.php#L71-L79 | train |
kiler129/TinyWs | src/UpgradeHandler.php | UpgradeHandler.generateSwitchResponse | private function generateSwitchResponse($client, $request)
{
$acceptHeader = sha1($request->getHeader("sec-websocket-key") . self::WEBSOCKET_GUID, true);
$switchParams = array(
"Upgrade" => "websocket",
"Connection" => "Upgrade",
"Sec-WebSocket-Accept" => base64_e... | php | private function generateSwitchResponse($client, $request)
{
$acceptHeader = sha1($request->getHeader("sec-websocket-key") . self::WEBSOCKET_GUID, true);
$switchParams = array(
"Upgrade" => "websocket",
"Connection" => "Upgrade",
"Sec-WebSocket-Accept" => base64_e... | [
"private",
"function",
"generateSwitchResponse",
"(",
"$",
"client",
",",
"$",
"request",
")",
"{",
"$",
"acceptHeader",
"=",
"sha1",
"(",
"$",
"request",
"->",
"getHeader",
"(",
"\"sec-websocket-key\"",
")",
".",
"self",
"::",
"WEBSOCKET_GUID",
",",
"true",
... | Generates WebSocket upgrade response & notifies clients handler
@param HttpClient|StreamServerNodeInterface $client WebSocketClient which should be upgraded to WebSocket
protocol
@param HttpRequest $request Original HTTP upgrade handshake sent by client
@return HttpResponse | [
"Generates",
"WebSocket",
"upgrade",
"response",
"&",
"notifies",
"clients",
"handler"
] | 85f0335b87b3ec73ab47f5a5631eb86ba70b64a1 | https://github.com/kiler129/TinyWs/blob/85f0335b87b3ec73ab47f5a5631eb86ba70b64a1/src/UpgradeHandler.php#L76-L88 | train |
kiler129/TinyWs | src/UpgradeHandler.php | UpgradeHandler.verifyUpgradeRequest | private function verifyUpgradeRequest(HttpRequest $request)
{
$this->logger->debug("Attempting to switch protocols (checking preconditions per RFC)");
//That "ifology" is ugly, but I don't have better idea to perform checks
//Check request to conform with RFC 6455 [see page 16]
if ... | php | private function verifyUpgradeRequest(HttpRequest $request)
{
$this->logger->debug("Attempting to switch protocols (checking preconditions per RFC)");
//That "ifology" is ugly, but I don't have better idea to perform checks
//Check request to conform with RFC 6455 [see page 16]
if ... | [
"private",
"function",
"verifyUpgradeRequest",
"(",
"HttpRequest",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"\"Attempting to switch protocols (checking preconditions per RFC)\"",
")",
";",
"//That \"ifology\" is ugly, but I don't have better id... | Validates HTTP => WebSocket upgrade request
@param HttpRequest $request HTTP request, it's assumed upgrade request
@throws HttpException | [
"Validates",
"HTTP",
"=",
">",
"WebSocket",
"upgrade",
"request"
] | 85f0335b87b3ec73ab47f5a5631eb86ba70b64a1 | https://github.com/kiler129/TinyWs/blob/85f0335b87b3ec73ab47f5a5631eb86ba70b64a1/src/UpgradeHandler.php#L97-L134 | train |
kiler129/TinyWs | src/UpgradeHandler.php | UpgradeHandler.populatePaths | private function populatePaths($paths)
{
if (!is_array($paths)) {
$paths = array($paths);
}
foreach ($paths as $path) {
if ($path[0] !== "/" && $path[0] !== "*") {
throw new InvalidArgumentException("Invalid handler path specified");
}
... | php | private function populatePaths($paths)
{
if (!is_array($paths)) {
$paths = array($paths);
}
foreach ($paths as $path) {
if ($path[0] !== "/" && $path[0] !== "*") {
throw new InvalidArgumentException("Invalid handler path specified");
}
... | [
"private",
"function",
"populatePaths",
"(",
"$",
"paths",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"paths",
")",
")",
"{",
"$",
"paths",
"=",
"array",
"(",
"$",
"paths",
")",
";",
"}",
"foreach",
"(",
"$",
"paths",
"as",
"$",
"path",
")",... | Verifies & adds paths handled by this handler
It's private due to fact that for performance reasons CherryHttp will cache paths for each handler
@param string|string[] $paths One (or more) paths to be handled
@throws InvalidArgumentException Raised if any of paths is invalid | [
"Verifies",
"&",
"adds",
"paths",
"handled",
"by",
"this",
"handler",
"It",
"s",
"private",
"due",
"to",
"fact",
"that",
"for",
"performance",
"reasons",
"CherryHttp",
"will",
"cache",
"paths",
"for",
"each",
"handler"
] | 85f0335b87b3ec73ab47f5a5631eb86ba70b64a1 | https://github.com/kiler129/TinyWs/blob/85f0335b87b3ec73ab47f5a5631eb86ba70b64a1/src/UpgradeHandler.php#L144-L157 | train |
pmdevelopment/tool-bundle | Framework/PMKernel.php | PMKernel.getBaseTmpDir | public function getBaseTmpDir()
{
$folders = explode(DIRECTORY_SEPARATOR, $this->getRootDir());
$foldersCount = count($folders);
/**
* Base Path
*/
$projectDir = '';
if (true === isset($folders[$foldersCount - 2])) {
$projectDir = $folders[$fold... | php | public function getBaseTmpDir()
{
$folders = explode(DIRECTORY_SEPARATOR, $this->getRootDir());
$foldersCount = count($folders);
/**
* Base Path
*/
$projectDir = '';
if (true === isset($folders[$foldersCount - 2])) {
$projectDir = $folders[$fold... | [
"public",
"function",
"getBaseTmpDir",
"(",
")",
"{",
"$",
"folders",
"=",
"explode",
"(",
"DIRECTORY_SEPARATOR",
",",
"$",
"this",
"->",
"getRootDir",
"(",
")",
")",
";",
"$",
"foldersCount",
"=",
"count",
"(",
"$",
"folders",
")",
";",
"/**\n * B... | Get Base Tmp Dir
@return string | [
"Get",
"Base",
"Tmp",
"Dir"
] | 2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129 | https://github.com/pmdevelopment/tool-bundle/blob/2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129/Framework/PMKernel.php#L97-L114 | train |
valu-digital/valuso | src/ValuSo/Service/MetaService.php | MetaService.describe | public function describe($serviceId)
{
$cache = $this->getCache();
$cacheId = self::CACHE_ID_PREFIX . $serviceId;
if ($cache && ($description = $this->getCache()->getItem($cacheId))) {
return $description;
}
$loader = $this->getServiceLoader();
... | php | public function describe($serviceId)
{
$cache = $this->getCache();
$cacheId = self::CACHE_ID_PREFIX . $serviceId;
if ($cache && ($description = $this->getCache()->getItem($cacheId))) {
return $description;
}
$loader = $this->getServiceLoader();
... | [
"public",
"function",
"describe",
"(",
"$",
"serviceId",
")",
"{",
"$",
"cache",
"=",
"$",
"this",
"->",
"getCache",
"(",
")",
";",
"$",
"cacheId",
"=",
"self",
"::",
"CACHE_ID_PREFIX",
".",
"$",
"serviceId",
";",
"if",
"(",
"$",
"cache",
"&&",
"(",
... | Retrieve service description
@param string $serviceId Service ID
@ValuService\Context({"cli", "http", "http-get"}) | [
"Retrieve",
"service",
"description"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Service/MetaService.php#L52-L92 | train |
pmdevelopment/tool-bundle | Services/PdfService.php | PdfService.get | public function get($html) {
$kernel_dir = $this->kerneldir;
require __DIR__ . "/../Resources/config/dompdf.php";
$this->pdf = new DOMPDF;
foreach ($this->options as $optionKey => $optionValue) {
$this->pdf->set_option($optionKey, $optionValue);
}
$this->pdf->load_html($h... | php | public function get($html) {
$kernel_dir = $this->kerneldir;
require __DIR__ . "/../Resources/config/dompdf.php";
$this->pdf = new DOMPDF;
foreach ($this->options as $optionKey => $optionValue) {
$this->pdf->set_option($optionKey, $optionValue);
}
$this->pdf->load_html($h... | [
"public",
"function",
"get",
"(",
"$",
"html",
")",
"{",
"$",
"kernel_dir",
"=",
"$",
"this",
"->",
"kerneldir",
";",
"require",
"__DIR__",
".",
"\"/../Resources/config/dompdf.php\"",
";",
"$",
"this",
"->",
"pdf",
"=",
"new",
"DOMPDF",
";",
"foreach",
"("... | Get PDF By HTML
@param string $html
@return Response | [
"Get",
"PDF",
"By",
"HTML"
] | 2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129 | https://github.com/pmdevelopment/tool-bundle/blob/2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129/Services/PdfService.php#L55-L76 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.