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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
romm/configuration_object | Classes/Service/Items/Parents/ParentsTrait.php | ParentsTrait.getFirstParent | public function getFirstParent($parentClassName)
{
$foundParent = null;
$this->alongParents(function ($parent) use ($parentClassName, &$foundParent) {
if ($parent instanceof $parentClassName) {
$foundParent = $parent;
return false;
}
... | php | public function getFirstParent($parentClassName)
{
$foundParent = null;
$this->alongParents(function ($parent) use ($parentClassName, &$foundParent) {
if ($parent instanceof $parentClassName) {
$foundParent = $parent;
return false;
}
... | [
"public",
"function",
"getFirstParent",
"(",
"$",
"parentClassName",
")",
"{",
"$",
"foundParent",
"=",
"null",
";",
"$",
"this",
"->",
"alongParents",
"(",
"function",
"(",
"$",
"parent",
")",
"use",
"(",
"$",
"parentClassName",
",",
"&",
"$",
"foundParen... | Returns the first found instance of the desired parent.
An exception is thrown if the parent is not found. It is advised to use
the function `hasParent()` before using this function.
@param string $parentClassName Name of the parent class.
@return object
@throws EntryNotFoundException | [
"Returns",
"the",
"first",
"found",
"instance",
"of",
"the",
"desired",
"parent",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Service/Items/Parents/ParentsTrait.php#L178-L200 | train |
zewadesign/framework | Zewa/View.php | View.setView | public function setView($viewName)
{
$view = $this->pathToView . DIRECTORY_SEPARATOR . strtolower($viewName) . '.php';
if (!file_exists($view)) {
throw new Exception\LookupException('View: "' . $view . '" could not be found.');
}
$this->viewQueue[$viewName] = $view;
... | php | public function setView($viewName)
{
$view = $this->pathToView . DIRECTORY_SEPARATOR . strtolower($viewName) . '.php';
if (!file_exists($view)) {
throw new Exception\LookupException('View: "' . $view . '" could not be found.');
}
$this->viewQueue[$viewName] = $view;
... | [
"public",
"function",
"setView",
"(",
"$",
"viewName",
")",
"{",
"$",
"view",
"=",
"$",
"this",
"->",
"pathToView",
".",
"DIRECTORY_SEPARATOR",
".",
"strtolower",
"(",
"$",
"viewName",
")",
".",
"'.php'",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"... | formats and prepares view for inclusion
@param $viewName
@return string
@throws Exception\LookupException | [
"formats",
"and",
"prepares",
"view",
"for",
"inclusion"
] | be74e41c674ac2c2ef924752ed310cfbaafe33b8 | https://github.com/zewadesign/framework/blob/be74e41c674ac2c2ef924752ed310cfbaafe33b8/Zewa/View.php#L125-L134 | train |
zewadesign/framework | Zewa/View.php | View.fetchCSS | public function fetchCSS()
{
$string = "";
if (empty($this->queuedCSS)) {
return $string;
}
foreach ($this->queuedCSS as $sheet) {
$string .= '<link rel="stylesheet" href="' . $sheet .'">' . "\r\n";
}
return $string;
} | php | public function fetchCSS()
{
$string = "";
if (empty($this->queuedCSS)) {
return $string;
}
foreach ($this->queuedCSS as $sheet) {
$string .= '<link rel="stylesheet" href="' . $sheet .'">' . "\r\n";
}
return $string;
} | [
"public",
"function",
"fetchCSS",
"(",
")",
"{",
"$",
"string",
"=",
"\"\"",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"queuedCSS",
")",
")",
"{",
"return",
"$",
"string",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"queuedCSS",
"as",
"$",
... | Helper method for grabbing aggregated css files
@access protected
@return string css includes | [
"Helper",
"method",
"for",
"grabbing",
"aggregated",
"css",
"files"
] | be74e41c674ac2c2ef924752ed310cfbaafe33b8 | https://github.com/zewadesign/framework/blob/be74e41c674ac2c2ef924752ed310cfbaafe33b8/Zewa/View.php#L249-L262 | train |
zewadesign/framework | Zewa/View.php | View.fetchJS | public function fetchJS()
{
$string = "<script>baseURL = '" . $this->router->baseURL() . "/'</script>\r\n";
if (empty($this->queuedJS)) {
return $string;
}
foreach ($this->queuedJS as $script) {
$string .= '<script src="' . $script . '"></script>' . "\r\n";
... | php | public function fetchJS()
{
$string = "<script>baseURL = '" . $this->router->baseURL() . "/'</script>\r\n";
if (empty($this->queuedJS)) {
return $string;
}
foreach ($this->queuedJS as $script) {
$string .= '<script src="' . $script . '"></script>' . "\r\n";
... | [
"public",
"function",
"fetchJS",
"(",
")",
"{",
"$",
"string",
"=",
"\"<script>baseURL = '\"",
".",
"$",
"this",
"->",
"router",
"->",
"baseURL",
"(",
")",
".",
"\"/'</script>\\r\\n\"",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"queuedJS",
")",
")... | Helper method for grabbing aggregated JS files
@access protected
@return string JS includes | [
"Helper",
"method",
"for",
"grabbing",
"aggregated",
"JS",
"files"
] | be74e41c674ac2c2ef924752ed310cfbaafe33b8 | https://github.com/zewadesign/framework/blob/be74e41c674ac2c2ef924752ed310cfbaafe33b8/Zewa/View.php#L270-L283 | train |
phpguard/listen | src/PhpGuard/Listen/Resource/FileResource.php | FileResource.isExists | public function isExists()
{
clearstatcache(true,(string)$this->resource);
return is_file((string)$this->resource);
} | php | public function isExists()
{
clearstatcache(true,(string)$this->resource);
return is_file((string)$this->resource);
} | [
"public",
"function",
"isExists",
"(",
")",
"{",
"clearstatcache",
"(",
"true",
",",
"(",
"string",
")",
"$",
"this",
"->",
"resource",
")",
";",
"return",
"is_file",
"(",
"(",
"string",
")",
"$",
"this",
"->",
"resource",
")",
";",
"}"
] | Returns true if the resource exists in the filesystem.
@return Boolean | [
"Returns",
"true",
"if",
"the",
"resource",
"exists",
"in",
"the",
"filesystem",
"."
] | cd0cda150858d6d85deb025a72996873d2af3532 | https://github.com/phpguard/listen/blob/cd0cda150858d6d85deb025a72996873d2af3532/src/PhpGuard/Listen/Resource/FileResource.php#L52-L56 | train |
Mandarin-Medien/MMCmfContentBundle | Controller/ContentNodeController.php | ContentNodeController.saveAction | public function saveAction(Request $request)
{
$json_nodes = $request->get('nodes');
if ($json_nodes) {
$this->em = $this->getDoctrine()->getManager();
foreach ($json_nodes as $id => $obj) {
$contentNode = $this->em->find(ContentNode::class, $id);
... | php | public function saveAction(Request $request)
{
$json_nodes = $request->get('nodes');
if ($json_nodes) {
$this->em = $this->getDoctrine()->getManager();
foreach ($json_nodes as $id => $obj) {
$contentNode = $this->em->find(ContentNode::class, $id);
... | [
"public",
"function",
"saveAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"json_nodes",
"=",
"$",
"request",
"->",
"get",
"(",
"'nodes'",
")",
";",
"if",
"(",
"$",
"json_nodes",
")",
"{",
"$",
"this",
"->",
"em",
"=",
"$",
"this",
"->",
"g... | AJAX save endpoint, not related to the CRUD
@param Request $request
@return JsonResponse | [
"AJAX",
"save",
"endpoint",
"not",
"related",
"to",
"the",
"CRUD"
] | 503ab31cef3ce068f767de5b72f833526355b726 | https://github.com/Mandarin-Medien/MMCmfContentBundle/blob/503ab31cef3ce068f767de5b72f833526355b726/Controller/ContentNodeController.php#L35-L96 | train |
Mandarin-Medien/MMCmfContentBundle | Controller/ContentNodeController.php | ContentNodeController.simpleUpdateAction | public function simpleUpdateAction(Request $request, ContentNode $contentNode)
{
return $this->updateAction($request, $contentNode, true);
} | php | public function simpleUpdateAction(Request $request, ContentNode $contentNode)
{
return $this->updateAction($request, $contentNode, true);
} | [
"public",
"function",
"simpleUpdateAction",
"(",
"Request",
"$",
"request",
",",
"ContentNode",
"$",
"contentNode",
")",
"{",
"return",
"$",
"this",
"->",
"updateAction",
"(",
"$",
"request",
",",
"$",
"contentNode",
",",
"true",
")",
";",
"}"
] | validates the simple ContentNode Form
@param Request $request
@param ContentNode $contentNode
@return JsonResponse | [
"validates",
"the",
"simple",
"ContentNode",
"Form"
] | 503ab31cef3ce068f767de5b72f833526355b726 | https://github.com/Mandarin-Medien/MMCmfContentBundle/blob/503ab31cef3ce068f767de5b72f833526355b726/Controller/ContentNodeController.php#L191-L194 | train |
Mandarin-Medien/MMCmfContentBundle | Controller/ContentNodeController.php | ContentNodeController.updateAction | public function updateAction(Request $request, ContentNode $contentNode, $isSimpleForm = false)
{
$em = $this->getDoctrine()->getManager();
$repository = $this->getDoctrine()->getRepository('MMCmfNodeBundle:Node');
$rootNode = null;
if ((int)$request->get('root_node')) {
... | php | public function updateAction(Request $request, ContentNode $contentNode, $isSimpleForm = false)
{
$em = $this->getDoctrine()->getManager();
$repository = $this->getDoctrine()->getRepository('MMCmfNodeBundle:Node');
$rootNode = null;
if ((int)$request->get('root_node')) {
... | [
"public",
"function",
"updateAction",
"(",
"Request",
"$",
"request",
",",
"ContentNode",
"$",
"contentNode",
",",
"$",
"isSimpleForm",
"=",
"false",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",... | validates the general ContentNode Form
@param Request $request
@param ContentNode $contentNode
@param bool $isSimpleForm
@return JsonResponse | [
"validates",
"the",
"general",
"ContentNode",
"Form"
] | 503ab31cef3ce068f767de5b72f833526355b726 | https://github.com/Mandarin-Medien/MMCmfContentBundle/blob/503ab31cef3ce068f767de5b72f833526355b726/Controller/ContentNodeController.php#L362-L398 | train |
Mandarin-Medien/MMCmfContentBundle | Controller/ContentNodeController.php | ContentNodeController.createSimpleEditForm | public function createSimpleEditForm(ContentNode $contentNode, Node $rootNode = null)
{
$contentNodeClassName = get_class($contentNode);
$contentNodeParser = $this->get('mm_cmf_content.content_parser');
$simpleFormData = $contentNodeParser->getSimpleForm($contentNodeClassName);
//s... | php | public function createSimpleEditForm(ContentNode $contentNode, Node $rootNode = null)
{
$contentNodeClassName = get_class($contentNode);
$contentNodeParser = $this->get('mm_cmf_content.content_parser');
$simpleFormData = $contentNodeParser->getSimpleForm($contentNodeClassName);
//s... | [
"public",
"function",
"createSimpleEditForm",
"(",
"ContentNode",
"$",
"contentNode",
",",
"Node",
"$",
"rootNode",
"=",
"null",
")",
"{",
"$",
"contentNodeClassName",
"=",
"get_class",
"(",
"$",
"contentNode",
")",
";",
"$",
"contentNodeParser",
"=",
"$",
"th... | Returns the configured Simple Form for Frontend Editing purpose
@param ContentNode $contentNode
@param Node|null $rootNode
@return \Symfony\Component\Form\Form | [
"Returns",
"the",
"configured",
"Simple",
"Form",
"for",
"Frontend",
"Editing",
"purpose"
] | 503ab31cef3ce068f767de5b72f833526355b726 | https://github.com/Mandarin-Medien/MMCmfContentBundle/blob/503ab31cef3ce068f767de5b72f833526355b726/Controller/ContentNodeController.php#L407-L439 | train |
LpFactory/NestedSetRoutingBundle | Factory/PageRouteFactory.php | PageRouteFactory.createFromId | public function createFromId(AbstractPageRouteConfiguration $routeConfiguration, $pageId)
{
$page = $this->repository->find($pageId);
return $this->create($routeConfiguration, $page);
} | php | public function createFromId(AbstractPageRouteConfiguration $routeConfiguration, $pageId)
{
$page = $this->repository->find($pageId);
return $this->create($routeConfiguration, $page);
} | [
"public",
"function",
"createFromId",
"(",
"AbstractPageRouteConfiguration",
"$",
"routeConfiguration",
",",
"$",
"pageId",
")",
"{",
"$",
"page",
"=",
"$",
"this",
"->",
"repository",
"->",
"find",
"(",
"$",
"pageId",
")",
";",
"return",
"$",
"this",
"->",
... | Create a new route instance from a page id
@param AbstractPageRouteConfiguration $routeConfiguration
@param int $pageId
@return \Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\Route | [
"Create",
"a",
"new",
"route",
"instance",
"from",
"a",
"page",
"id"
] | dc07227a6764e657b7b321827a18127ec18ba214 | https://github.com/LpFactory/NestedSetRoutingBundle/blob/dc07227a6764e657b7b321827a18127ec18ba214/Factory/PageRouteFactory.php#L80-L85 | train |
LpFactory/NestedSetRoutingBundle | Factory/PageRouteFactory.php | PageRouteFactory.buildUrlFromPath | protected function buildUrlFromPath(array $path)
{
// Remove root level (homepage)
array_shift($path);
// Homepage
if (count($path) === 0 && $this->treeStrategy->isHomeTreeRoot()) {
return '/';
}
// Build uri from tree path
return array_reduce($p... | php | protected function buildUrlFromPath(array $path)
{
// Remove root level (homepage)
array_shift($path);
// Homepage
if (count($path) === 0 && $this->treeStrategy->isHomeTreeRoot()) {
return '/';
}
// Build uri from tree path
return array_reduce($p... | [
"protected",
"function",
"buildUrlFromPath",
"(",
"array",
"$",
"path",
")",
"{",
"// Remove root level (homepage)",
"array_shift",
"(",
"$",
"path",
")",
";",
"// Homepage",
"if",
"(",
"count",
"(",
"$",
"path",
")",
"===",
"0",
"&&",
"$",
"this",
"->",
"... | Build an url from a path
@param array $path
@return string | [
"Build",
"an",
"url",
"from",
"a",
"path"
] | dc07227a6764e657b7b321827a18127ec18ba214 | https://github.com/LpFactory/NestedSetRoutingBundle/blob/dc07227a6764e657b7b321827a18127ec18ba214/Factory/PageRouteFactory.php#L94-L109 | train |
intrip/laravel-library | src/Jacopo/Library/Form/FormModel.php | FormModel.process | public function process(array $input)
{
if($this->v->validate($input))
{
Event::fire("form.processing", array($input));
return $this->callRepository($input);
}
else
{
$this->errors = $this->v->getErrors();
throw new ValidationEx... | php | public function process(array $input)
{
if($this->v->validate($input))
{
Event::fire("form.processing", array($input));
return $this->callRepository($input);
}
else
{
$this->errors = $this->v->getErrors();
throw new ValidationEx... | [
"public",
"function",
"process",
"(",
"array",
"$",
"input",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"v",
"->",
"validate",
"(",
"$",
"input",
")",
")",
"{",
"Event",
"::",
"fire",
"(",
"\"form.processing\"",
",",
"array",
"(",
"$",
"input",
")",
"... | Process the input and calls the repository
@param array $input
@throws \Jacopo\Library\Exceptions\JacopoExceptionsInterface | [
"Process",
"the",
"input",
"and",
"calls",
"the",
"repository"
] | 9ea7d5cd9d84c70893238af6300b24c7dd4b8ca3 | https://github.com/intrip/laravel-library/blob/9ea7d5cd9d84c70893238af6300b24c7dd4b8ca3/src/Jacopo/Library/Form/FormModel.php#L51-L63 | train |
intrip/laravel-library | src/Jacopo/Library/Form/FormModel.php | FormModel.isUpdate | protected function isUpdate($input)
{
return (isset($input[$this->id_field_name]) && ! empty($input[$this->id_field_name]) );
} | php | protected function isUpdate($input)
{
return (isset($input[$this->id_field_name]) && ! empty($input[$this->id_field_name]) );
} | [
"protected",
"function",
"isUpdate",
"(",
"$",
"input",
")",
"{",
"return",
"(",
"isset",
"(",
"$",
"input",
"[",
"$",
"this",
"->",
"id_field_name",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"input",
"[",
"$",
"this",
"->",
"id_field_name",
"]",
")",
... | Check if the operation is update or create
@param $input
@return booelan $update update=true create=false | [
"Check",
"if",
"the",
"operation",
"is",
"update",
"or",
"create"
] | 9ea7d5cd9d84c70893238af6300b24c7dd4b8ca3 | https://github.com/intrip/laravel-library/blob/9ea7d5cd9d84c70893238af6300b24c7dd4b8ca3/src/Jacopo/Library/Form/FormModel.php#L110-L113 | train |
intrip/laravel-library | src/Jacopo/Library/Form/FormModel.php | FormModel.delete | public function delete(array $input)
{
if(isset($input[$this->id_field_name]) && ! empty($input[$this->id_field_name]))
{
try
{
$this->r->delete($input[$this->id_field_name]);
}
catch(ModelNotFoundException $e)
{
... | php | public function delete(array $input)
{
if(isset($input[$this->id_field_name]) && ! empty($input[$this->id_field_name]))
{
try
{
$this->r->delete($input[$this->id_field_name]);
}
catch(ModelNotFoundException $e)
{
... | [
"public",
"function",
"delete",
"(",
"array",
"$",
"input",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"input",
"[",
"$",
"this",
"->",
"id_field_name",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"input",
"[",
"$",
"this",
"->",
"id_field_name",
"]",
")"... | Run delete on the repository
@param $input
@throws \Jacopo\Library\Exceptions\NotFoundException
@todo test with exceptions | [
"Run",
"delete",
"on",
"the",
"repository"
] | 9ea7d5cd9d84c70893238af6300b24c7dd4b8ca3 | https://github.com/intrip/laravel-library/blob/9ea7d5cd9d84c70893238af6300b24c7dd4b8ca3/src/Jacopo/Library/Form/FormModel.php#L121-L145 | train |
bseddon/XPath20 | AST/ForNode.php | ForNode.getQNVarName | public function getQNVarName()
{
return \lyquidity\xml\qname( $this->_varName->ToString(), $this->getContext()->NamespaceManager->getNamespaces(), true );
} | php | public function getQNVarName()
{
return \lyquidity\xml\qname( $this->_varName->ToString(), $this->getContext()->NamespaceManager->getNamespaces(), true );
} | [
"public",
"function",
"getQNVarName",
"(",
")",
"{",
"return",
"\\",
"lyquidity",
"\\",
"xml",
"\\",
"qname",
"(",
"$",
"this",
"->",
"_varName",
"->",
"ToString",
"(",
")",
",",
"$",
"this",
"->",
"getContext",
"(",
")",
"->",
"NamespaceManager",
"->",
... | Get the VarName as a QName | [
"Get",
"the",
"VarName",
"as",
"a",
"QName"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/AST/ForNode.php#L89-L92 | train |
Vectrex/vxPHP | src/Http/JsonResponse.php | JsonResponse.setCallback | public function setCallback($callback = NULL) {
if (NULL !== $callback) {
// taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/
$pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u';
foreach (explode('.', $callback) as $part) {
if (!preg_match($pattern... | php | public function setCallback($callback = NULL) {
if (NULL !== $callback) {
// taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/
$pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u';
foreach (explode('.', $callback) as $part) {
if (!preg_match($pattern... | [
"public",
"function",
"setCallback",
"(",
"$",
"callback",
"=",
"NULL",
")",
"{",
"if",
"(",
"NULL",
"!==",
"$",
"callback",
")",
"{",
"// taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/",
"$",
"pattern",
"=",
"'/^[$_\\p{L}][$_\\p{L}\\p{Mn}\\p{... | set the JSONP callback
pass NULL for not using a callback
@param string|null $callback
@return JsonResponse
@throws \InvalidArgumentException when callback name is not valid | [
"set",
"the",
"JSONP",
"callback",
"pass",
"NULL",
"for",
"not",
"using",
"a",
"callback"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/JsonResponse.php#L72-L90 | train |
Vectrex/vxPHP | src/Http/JsonResponse.php | JsonResponse.setEncodingOptions | public function setEncodingOptions($encodingOptions) {
$this->encodingOptions = (int) $encodingOptions;
return $this->setPayload(json_decode($this->data));
} | php | public function setEncodingOptions($encodingOptions) {
$this->encodingOptions = (int) $encodingOptions;
return $this->setPayload(json_decode($this->data));
} | [
"public",
"function",
"setEncodingOptions",
"(",
"$",
"encodingOptions",
")",
"{",
"$",
"this",
"->",
"encodingOptions",
"=",
"(",
"int",
")",
"$",
"encodingOptions",
";",
"return",
"$",
"this",
"->",
"setPayload",
"(",
"json_decode",
"(",
"$",
"this",
"->",... | set options used while encoding data to JSON
re-encodes payload with new encoding setting
@param int $encodingOptions
@return JsonResponse
@throws \Exception | [
"set",
"options",
"used",
"while",
"encoding",
"data",
"to",
"JSON",
"re",
"-",
"encodes",
"payload",
"with",
"new",
"encoding",
"setting"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/JsonResponse.php#L144-L150 | train |
Vectrex/vxPHP | src/Http/JsonResponse.php | JsonResponse.update | protected function update() {
if(!is_null($this->callback)) {
// Not using application/javascript for compatibility reasons with older browsers.
$this->headers->set('Content-Type', 'text/javascript');
return $this->setContent(sprintf('/**/%s(%s);', $this->callback, $this->data));
}
// se... | php | protected function update() {
if(!is_null($this->callback)) {
// Not using application/javascript for compatibility reasons with older browsers.
$this->headers->set('Content-Type', 'text/javascript');
return $this->setContent(sprintf('/**/%s(%s);', $this->callback, $this->data));
}
// se... | [
"protected",
"function",
"update",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"callback",
")",
")",
"{",
"// Not using application/javascript for compatibility reasons with older browsers.",
"$",
"this",
"->",
"headers",
"->",
"set",
"(",
"'... | update content and headers according to the JSON data and a set callback
@return JsonResponse | [
"update",
"content",
"and",
"headers",
"according",
"to",
"the",
"JSON",
"data",
"and",
"a",
"set",
"callback"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/JsonResponse.php#L157-L177 | train |
anime-db/catalog-bundle | src/Plugin/Fill/Refiller/Chain.php | Chain.getPluginsThatCanFillItem | public function getPluginsThatCanFillItem(Item $item, $field)
{
$plugins = [];
/* @var $plugin Refiller */
foreach ($this->plugins as $plugin) {
if ($plugin->isCanRefill($item, $field) || $plugin->isCanSearch($item, $field)) {
$plugins[] = $plugin;
}
... | php | public function getPluginsThatCanFillItem(Item $item, $field)
{
$plugins = [];
/* @var $plugin Refiller */
foreach ($this->plugins as $plugin) {
if ($plugin->isCanRefill($item, $field) || $plugin->isCanSearch($item, $field)) {
$plugins[] = $plugin;
}
... | [
"public",
"function",
"getPluginsThatCanFillItem",
"(",
"Item",
"$",
"item",
",",
"$",
"field",
")",
"{",
"$",
"plugins",
"=",
"[",
"]",
";",
"/* @var $plugin Refiller */",
"foreach",
"(",
"$",
"this",
"->",
"plugins",
"as",
"$",
"plugin",
")",
"{",
"if",
... | Get list of plugins that can fill item.
@param Item $item
@param string $field
@return RefillerInterface[] | [
"Get",
"list",
"of",
"plugins",
"that",
"can",
"fill",
"item",
"."
] | 631b6f92a654e91bee84f46218c52cf42bdb8606 | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Plugin/Fill/Refiller/Chain.php#L30-L41 | train |
iron-bound-designs/IronBound-WPEvents | src/EventDispatcher.php | EventDispatcher.add_listener | public function add_listener( $event_name, $listener, $priority = self::PRIORITY, $accepted_args = self::ACCEPTED ) {
if ( ! is_callable( $listener, true ) ) {
throw new InvalidListenerException( '$listener must be callable.' );
}
if ( ! is_int( $priority ) ) {
throw new \InvalidArgumentException( '$prior... | php | public function add_listener( $event_name, $listener, $priority = self::PRIORITY, $accepted_args = self::ACCEPTED ) {
if ( ! is_callable( $listener, true ) ) {
throw new InvalidListenerException( '$listener must be callable.' );
}
if ( ! is_int( $priority ) ) {
throw new \InvalidArgumentException( '$prior... | [
"public",
"function",
"add_listener",
"(",
"$",
"event_name",
",",
"$",
"listener",
",",
"$",
"priority",
"=",
"self",
"::",
"PRIORITY",
",",
"$",
"accepted_args",
"=",
"self",
"::",
"ACCEPTED",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"listene... | Add an event listener that listens for a given event.
@since 1.0
@param string $event_name The fully-qualified event name to listen for.
@param callable $listener Listener to be called whenever the event occurs.
@param int $priority The priority of the listener. Lower priority listeners are called... | [
"Add",
"an",
"event",
"listener",
"that",
"listens",
"for",
"a",
"given",
"event",
"."
] | b5bdb570f5377c1a311e572547a8c29d507facf9 | https://github.com/iron-bound-designs/IronBound-WPEvents/blob/b5bdb570f5377c1a311e572547a8c29d507facf9/src/EventDispatcher.php#L119-L136 | train |
iron-bound-designs/IronBound-WPEvents | src/EventDispatcher.php | EventDispatcher.remove_listener | public function remove_listener( $event_name, $listener, $priority = self::PRIORITY ) {
if ( ! is_callable( $listener, true ) ) {
throw new InvalidListenerException( '$listener must be callable.' );
}
if ( ! is_int( $priority ) ) {
throw new \InvalidArgumentException( '$priority must be an int.' );
}
... | php | public function remove_listener( $event_name, $listener, $priority = self::PRIORITY ) {
if ( ! is_callable( $listener, true ) ) {
throw new InvalidListenerException( '$listener must be callable.' );
}
if ( ! is_int( $priority ) ) {
throw new \InvalidArgumentException( '$priority must be an int.' );
}
... | [
"public",
"function",
"remove_listener",
"(",
"$",
"event_name",
",",
"$",
"listener",
",",
"$",
"priority",
"=",
"self",
"::",
"PRIORITY",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"listener",
",",
"true",
")",
")",
"{",
"throw",
"new",
"Inva... | Remove an event listener for a given event.
@since 1.0
@param string $event_name The fully-qualified event name to remove a listener from.
@param callable $listener The listener to be removed.
@param int $priority The priority of the listener.
@return self | [
"Remove",
"an",
"event",
"listener",
"for",
"a",
"given",
"event",
"."
] | b5bdb570f5377c1a311e572547a8c29d507facf9 | https://github.com/iron-bound-designs/IronBound-WPEvents/blob/b5bdb570f5377c1a311e572547a8c29d507facf9/src/EventDispatcher.php#L149-L162 | train |
iron-bound-designs/IronBound-WPEvents | src/EventDispatcher.php | EventDispatcher.add_subscriber | public function add_subscriber( EventSubscriber $subscriber ) {
foreach ( $subscriber->get_subscribed_events() as $event => $params ) {
if ( is_string( $params ) ) {
$this->add_listener( $event, array( $subscriber, $params ) );
} elseif ( is_array( $params ) && isset( $params[0] ) ) {
$method ... | php | public function add_subscriber( EventSubscriber $subscriber ) {
foreach ( $subscriber->get_subscribed_events() as $event => $params ) {
if ( is_string( $params ) ) {
$this->add_listener( $event, array( $subscriber, $params ) );
} elseif ( is_array( $params ) && isset( $params[0] ) ) {
$method ... | [
"public",
"function",
"add_subscriber",
"(",
"EventSubscriber",
"$",
"subscriber",
")",
"{",
"foreach",
"(",
"$",
"subscriber",
"->",
"get_subscribed_events",
"(",
")",
"as",
"$",
"event",
"=>",
"$",
"params",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"p... | Add an event subscriber.
This iterates over all of the subscribers events, and adds them as listeners.
@since 1.0
@param EventSubscriber $subscriber
@return self | [
"Add",
"an",
"event",
"subscriber",
"."
] | b5bdb570f5377c1a311e572547a8c29d507facf9 | https://github.com/iron-bound-designs/IronBound-WPEvents/blob/b5bdb570f5377c1a311e572547a8c29d507facf9/src/EventDispatcher.php#L175-L194 | train |
iron-bound-designs/IronBound-WPEvents | src/EventDispatcher.php | EventDispatcher.remove_subscriber | public function remove_subscriber( EventSubscriber $subscriber ) {
foreach ( $subscriber->get_subscribed_events() as $event => $params ) {
if ( is_string( $params ) ) {
$this->add_listener( $event, $params );
} elseif ( is_array( $params ) && isset( $params[0] ) ) {
$method = $params[0];
$prior... | php | public function remove_subscriber( EventSubscriber $subscriber ) {
foreach ( $subscriber->get_subscribed_events() as $event => $params ) {
if ( is_string( $params ) ) {
$this->add_listener( $event, $params );
} elseif ( is_array( $params ) && isset( $params[0] ) ) {
$method = $params[0];
$prior... | [
"public",
"function",
"remove_subscriber",
"(",
"EventSubscriber",
"$",
"subscriber",
")",
"{",
"foreach",
"(",
"$",
"subscriber",
"->",
"get_subscribed_events",
"(",
")",
"as",
"$",
"event",
"=>",
"$",
"params",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
... | Remove an event subscriber.
This iterates over all of the subscribers events, and removes them as listeners.
@since 1.0
@param EventSubscriber $subscriber
@return self | [
"Remove",
"an",
"event",
"subscriber",
"."
] | b5bdb570f5377c1a311e572547a8c29d507facf9 | https://github.com/iron-bound-designs/IronBound-WPEvents/blob/b5bdb570f5377c1a311e572547a8c29d507facf9/src/EventDispatcher.php#L207-L225 | train |
iron-bound-designs/IronBound-WPEvents | src/EventDispatcher.php | EventDispatcher.get_listener_priority | public function get_listener_priority( $event_name, $listener ) {
if ( ! is_callable( $listener, true ) ) {
throw new InvalidListenerException( '$listener must be callable.' );
}
$priority = has_filter( $event_name, $listener );
if ( false === $priority ) {
return null;
}
return $priority;
} | php | public function get_listener_priority( $event_name, $listener ) {
if ( ! is_callable( $listener, true ) ) {
throw new InvalidListenerException( '$listener must be callable.' );
}
$priority = has_filter( $event_name, $listener );
if ( false === $priority ) {
return null;
}
return $priority;
} | [
"public",
"function",
"get_listener_priority",
"(",
"$",
"event_name",
",",
"$",
"listener",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"listener",
",",
"true",
")",
")",
"{",
"throw",
"new",
"InvalidListenerException",
"(",
"'$listener must be callable.... | Get the listener priority for a given event.
Lower priority listeners are evaluated earlier.
@since 1.0
@param string $event_name The fully-qualified event name.
@param callable $listener The listener to check against.
@return int|null | [
"Get",
"the",
"listener",
"priority",
"for",
"a",
"given",
"event",
"."
] | b5bdb570f5377c1a311e572547a8c29d507facf9 | https://github.com/iron-bound-designs/IronBound-WPEvents/blob/b5bdb570f5377c1a311e572547a8c29d507facf9/src/EventDispatcher.php#L252-L265 | train |
zewadesign/framework | Zewa/Config.php | Config.loadConfigFile | protected function loadConfigFile(string $key)
{
$key = strtolower($key);
$filename = $this->path . DIRECTORY_SEPARATOR . ucfirst($key) . Config::CONFIG_FILE_EXTENSION;
if (file_exists($filename)) {
$this->configuration[$key] = require $filename;
return;
}
... | php | protected function loadConfigFile(string $key)
{
$key = strtolower($key);
$filename = $this->path . DIRECTORY_SEPARATOR . ucfirst($key) . Config::CONFIG_FILE_EXTENSION;
if (file_exists($filename)) {
$this->configuration[$key] = require $filename;
return;
}
... | [
"protected",
"function",
"loadConfigFile",
"(",
"string",
"$",
"key",
")",
"{",
"$",
"key",
"=",
"strtolower",
"(",
"$",
"key",
")",
";",
"$",
"filename",
"=",
"$",
"this",
"->",
"path",
".",
"DIRECTORY_SEPARATOR",
".",
"ucfirst",
"(",
"$",
"key",
")",... | Loads a configuration file in to memory
@param $key
@throws ConfigException when file is missing | [
"Loads",
"a",
"configuration",
"file",
"in",
"to",
"memory"
] | be74e41c674ac2c2ef924752ed310cfbaafe33b8 | https://github.com/zewadesign/framework/blob/be74e41c674ac2c2ef924752ed310cfbaafe33b8/Zewa/Config.php#L57-L68 | train |
zewadesign/framework | Zewa/Config.php | Config.get | public function get(string $key)
{
$key = strtolower($key);
if (empty($this->configuration[$key])) {
$this->loadConfigFile($key);
}
return $this->configuration[$key];
} | php | public function get(string $key)
{
$key = strtolower($key);
if (empty($this->configuration[$key])) {
$this->loadConfigFile($key);
}
return $this->configuration[$key];
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"key",
")",
"{",
"$",
"key",
"=",
"strtolower",
"(",
"$",
"key",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"configuration",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"this",
"->",
"lo... | Get Configuration Item
@param $key
@return \stdClass
@throws ConfigException when config file not found | [
"Get",
"Configuration",
"Item"
] | be74e41c674ac2c2ef924752ed310cfbaafe33b8 | https://github.com/zewadesign/framework/blob/be74e41c674ac2c2ef924752ed310cfbaafe33b8/Zewa/Config.php#L78-L87 | train |
Appsco/appsco-php-client | src/Appsco/Dashboard/ApiBundle/Client/AppscoClient.php | AppscoClient.addDashboardIcon | public function addDashboardIcon($dashboardRoleId, $appTemplateId)
{
$url = sprintf('%s://%s%s/api/v1/dashboard/%s/application', $this->scheme, $this->domain, $this->sufix, $dashboardRoleId);
if ($this->logger) {
$this->logger->info('Appsco.AppscoClient.addDashboardIcon', array(
... | php | public function addDashboardIcon($dashboardRoleId, $appTemplateId)
{
$url = sprintf('%s://%s%s/api/v1/dashboard/%s/application', $this->scheme, $this->domain, $this->sufix, $dashboardRoleId);
if ($this->logger) {
$this->logger->info('Appsco.AppscoClient.addDashboardIcon', array(
... | [
"public",
"function",
"addDashboardIcon",
"(",
"$",
"dashboardRoleId",
",",
"$",
"appTemplateId",
")",
"{",
"$",
"url",
"=",
"sprintf",
"(",
"'%s://%s%s/api/v1/dashboard/%s/application'",
",",
"$",
"this",
"->",
"scheme",
",",
"$",
"this",
"->",
"domain",
",",
... | Creates a dashboard icon
@param int $dashboardRoleId
@param int $appTemplateId | [
"Creates",
"a",
"dashboard",
"icon"
] | 1109a639c529488be41aee98165c286b3ca3d550 | https://github.com/Appsco/appsco-php-client/blob/1109a639c529488be41aee98165c286b3ca3d550/src/Appsco/Dashboard/ApiBundle/Client/AppscoClient.php#L330-L357 | train |
Tom-Millard/php-class-gen | src/Config.php | Config.evaluateArgs | public function evaluateArgs(array $args) : void
{
array_shift($args);
if (count($args) < 2) {
$this->out->red("Not enough arguments: expects 2, got ".(count($args) - 1).".");
return;
}
$this->setName($args[0]);
$this->setLocation($args[1]);
... | php | public function evaluateArgs(array $args) : void
{
array_shift($args);
if (count($args) < 2) {
$this->out->red("Not enough arguments: expects 2, got ".(count($args) - 1).".");
return;
}
$this->setName($args[0]);
$this->setLocation($args[1]);
... | [
"public",
"function",
"evaluateArgs",
"(",
"array",
"$",
"args",
")",
":",
"void",
"{",
"array_shift",
"(",
"$",
"args",
")",
";",
"if",
"(",
"count",
"(",
"$",
"args",
")",
"<",
"2",
")",
"{",
"$",
"this",
"->",
"out",
"->",
"red",
"(",
"\"Not e... | Take in an array of args and evalutate them
@param array $args
@return void | [
"Take",
"in",
"an",
"array",
"of",
"args",
"and",
"evalutate",
"them"
] | a4c06620589a63a98b3b64c9f64b9a85d754810e | https://github.com/Tom-Millard/php-class-gen/blob/a4c06620589a63a98b3b64c9f64b9a85d754810e/src/Config.php#L34-L50 | train |
Tom-Millard/php-class-gen | src/Config.php | Config.additionalArgs | public function additionalArgs(array $args) : void
{
foreach ($args as $a) {
//match --extends
if (substr($a, 0, strlen("--extends=")) == "--extends=") {
$this->extends = explode("=", $a);
$this->extends = $this->extends[1];
continue;
... | php | public function additionalArgs(array $args) : void
{
foreach ($args as $a) {
//match --extends
if (substr($a, 0, strlen("--extends=")) == "--extends=") {
$this->extends = explode("=", $a);
$this->extends = $this->extends[1];
continue;
... | [
"public",
"function",
"additionalArgs",
"(",
"array",
"$",
"args",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"args",
"as",
"$",
"a",
")",
"{",
"//match --extends",
"if",
"(",
"substr",
"(",
"$",
"a",
",",
"0",
",",
"strlen",
"(",
"\"--extends=\"",
... | Evaluate optional additional args
@param array $args
@return void | [
"Evaluate",
"optional",
"additional",
"args"
] | a4c06620589a63a98b3b64c9f64b9a85d754810e | https://github.com/Tom-Millard/php-class-gen/blob/a4c06620589a63a98b3b64c9f64b9a85d754810e/src/Config.php#L58-L78 | train |
kaiohken1982/NeobazaarDocumentModule | src/Document/Model/Classified/AbstractModel.php | AbstractModel.getStateFormatted | protected function getStateFormatted(Document $document)
{
switch($document->getState()) {
case Document::DOCUMENT_STATE_ACTIVE:
$this->stateClass = 'success';
return 'Attivo';
break;
case Document::DOCUMENT_STATE_DEACTIVE:
$this->stateClass = 'warning';
return 'Disattivo';
break;
c... | php | protected function getStateFormatted(Document $document)
{
switch($document->getState()) {
case Document::DOCUMENT_STATE_ACTIVE:
$this->stateClass = 'success';
return 'Attivo';
break;
case Document::DOCUMENT_STATE_DEACTIVE:
$this->stateClass = 'warning';
return 'Disattivo';
break;
c... | [
"protected",
"function",
"getStateFormatted",
"(",
"Document",
"$",
"document",
")",
"{",
"switch",
"(",
"$",
"document",
"->",
"getState",
"(",
")",
")",
"{",
"case",
"Document",
"::",
"DOCUMENT_STATE_ACTIVE",
":",
"$",
"this",
"->",
"stateClass",
"=",
"'su... | This will fill the stateClass as well
@param Document $document
@return string | [
"This",
"will",
"fill",
"the",
"stateClass",
"as",
"well"
] | edb0223878fe02e791d2a0266c5a7c0f2029e3fe | https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Model/Classified/AbstractModel.php#L81-L100 | train |
kaiohken1982/NeobazaarDocumentModule | src/Document/Model/Classified/AbstractModel.php | AbstractModel.getIsExpired | protected function getIsExpired(Document $document)
{
$date = null === $document->getDateEdit() ? $document->getDateInsert() : $document->getDateEdit();
$now = new \Datetime("now");
$interval = $date->diff($now);
if ($interval->y > 0) {
return true;
}
return $interval->m >= 6;
} | php | protected function getIsExpired(Document $document)
{
$date = null === $document->getDateEdit() ? $document->getDateInsert() : $document->getDateEdit();
$now = new \Datetime("now");
$interval = $date->diff($now);
if ($interval->y > 0) {
return true;
}
return $interval->m >= 6;
} | [
"protected",
"function",
"getIsExpired",
"(",
"Document",
"$",
"document",
")",
"{",
"$",
"date",
"=",
"null",
"===",
"$",
"document",
"->",
"getDateEdit",
"(",
")",
"?",
"$",
"document",
"->",
"getDateInsert",
"(",
")",
":",
"$",
"document",
"->",
"getD... | If the classified is >= 6 months old is expired
@param Document $document
@return boolean | [
"If",
"the",
"classified",
"is",
">",
"=",
"6",
"months",
"old",
"is",
"expired"
] | edb0223878fe02e791d2a0266c5a7c0f2029e3fe | https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Model/Classified/AbstractModel.php#L108-L119 | train |
kaiohken1982/NeobazaarDocumentModule | src/Document/Model/Classified/AbstractModel.php | AbstractModel.getUserHashId | protected function getUserHashId(Document $document, $sm)
{
$user = $document->getUser();
$main = $sm->get('neobazaar.service.main');
$userRepository = $main->getUserEntityRepository();
//$this->userIdNoHash = $user->getUserId(); // we do not want to give this info
return $userRepository->getEncryptedId(... | php | protected function getUserHashId(Document $document, $sm)
{
$user = $document->getUser();
$main = $sm->get('neobazaar.service.main');
$userRepository = $main->getUserEntityRepository();
//$this->userIdNoHash = $user->getUserId(); // we do not want to give this info
return $userRepository->getEncryptedId(... | [
"protected",
"function",
"getUserHashId",
"(",
"Document",
"$",
"document",
",",
"$",
"sm",
")",
"{",
"$",
"user",
"=",
"$",
"document",
"->",
"getUser",
"(",
")",
";",
"$",
"main",
"=",
"$",
"sm",
"->",
"get",
"(",
"'neobazaar.service.main'",
")",
";"... | Return the user hash id for the classified.
It's an sha1 hash. Also fill userIdNoHash
@param Document $document
@return string | [
"Return",
"the",
"user",
"hash",
"id",
"for",
"the",
"classified",
".",
"It",
"s",
"an",
"sha1",
"hash",
".",
"Also",
"fill",
"userIdNoHash"
] | edb0223878fe02e791d2a0266c5a7c0f2029e3fe | https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Model/Classified/AbstractModel.php#L152-L160 | train |
kaiohken1982/NeobazaarDocumentModule | src/Document/Model/Classified/AbstractModel.php | AbstractModel.getEditAddress | protected function getEditAddress(Document $document)
{
$key = null === $this->hashId ?
$this->getHashId($document) : $this->hashId;
return '/edit-classified/' . $key . '.html';
} | php | protected function getEditAddress(Document $document)
{
$key = null === $this->hashId ?
$this->getHashId($document) : $this->hashId;
return '/edit-classified/' . $key . '.html';
} | [
"protected",
"function",
"getEditAddress",
"(",
"Document",
"$",
"document",
")",
"{",
"$",
"key",
"=",
"null",
"===",
"$",
"this",
"->",
"hashId",
"?",
"$",
"this",
"->",
"getHashId",
"(",
"$",
"document",
")",
":",
"$",
"this",
"->",
"hashId",
";",
... | Get the address to be called to edit classified
@param Document $document
@return string | [
"Get",
"the",
"address",
"to",
"be",
"called",
"to",
"edit",
"classified"
] | edb0223878fe02e791d2a0266c5a7c0f2029e3fe | https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Model/Classified/AbstractModel.php#L168-L174 | train |
kaiohken1982/NeobazaarDocumentModule | src/Document/Model/Classified/AbstractModel.php | AbstractModel.getHashId | protected function getHashId(Document $document, $sm)
{
$main = $sm->get('neobazaar.service.main');
$documentRepository = $main->getDocumentEntityRepository();
return $documentRepository->getEncryptedId($document->getDocumentId());
} | php | protected function getHashId(Document $document, $sm)
{
$main = $sm->get('neobazaar.service.main');
$documentRepository = $main->getDocumentEntityRepository();
return $documentRepository->getEncryptedId($document->getDocumentId());
} | [
"protected",
"function",
"getHashId",
"(",
"Document",
"$",
"document",
",",
"$",
"sm",
")",
"{",
"$",
"main",
"=",
"$",
"sm",
"->",
"get",
"(",
"'neobazaar.service.main'",
")",
";",
"$",
"documentRepository",
"=",
"$",
"main",
"->",
"getDocumentEntityReposi... | Return the classified hash id.
It's an sha1 hash
@param Document $document
@return string | [
"Return",
"the",
"classified",
"hash",
"id",
".",
"It",
"s",
"an",
"sha1",
"hash"
] | edb0223878fe02e791d2a0266c5a7c0f2029e3fe | https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Model/Classified/AbstractModel.php#L204-L209 | train |
kaiohken1982/NeobazaarDocumentModule | src/Document/Model/Classified/AbstractModel.php | AbstractModel.getAddress | protected function getAddress(Document $document, $sm)
{
$firstCategory = null === $this->category ?
$this->getCategory($document) : $this->category;
$key = null === $this->hashId ?
$this->getHashId($document, $sm) : $this->hashId;
$slug = null === $this->slug ?
$this->getSlug($document) : $th... | php | protected function getAddress(Document $document, $sm)
{
$firstCategory = null === $this->category ?
$this->getCategory($document) : $this->category;
$key = null === $this->hashId ?
$this->getHashId($document, $sm) : $this->hashId;
$slug = null === $this->slug ?
$this->getSlug($document) : $th... | [
"protected",
"function",
"getAddress",
"(",
"Document",
"$",
"document",
",",
"$",
"sm",
")",
"{",
"$",
"firstCategory",
"=",
"null",
"===",
"$",
"this",
"->",
"category",
"?",
"$",
"this",
"->",
"getCategory",
"(",
"$",
"document",
")",
":",
"$",
"thi... | Get the classified full adress
@param Document $document
@return string | [
"Get",
"the",
"classified",
"full",
"adress"
] | edb0223878fe02e791d2a0266c5a7c0f2029e3fe | https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Model/Classified/AbstractModel.php#L217-L234 | train |
kaiohken1982/NeobazaarDocumentModule | src/Document/Model/Classified/AbstractModel.php | AbstractModel.getCategory | protected function getCategory(Document $document)
{
$obj = new CategoriesToRender();
$categories = $obj($document, true, true);
$firstCategory = reset($categories);
return $firstCategory;
} | php | protected function getCategory(Document $document)
{
$obj = new CategoriesToRender();
$categories = $obj($document, true, true);
$firstCategory = reset($categories);
return $firstCategory;
} | [
"protected",
"function",
"getCategory",
"(",
"Document",
"$",
"document",
")",
"{",
"$",
"obj",
"=",
"new",
"CategoriesToRender",
"(",
")",
";",
"$",
"categories",
"=",
"$",
"obj",
"(",
"$",
"document",
",",
"true",
",",
"true",
")",
";",
"$",
"firstCa... | The first category as slug
@param Document $document
@return mixed | [
"The",
"first",
"category",
"as",
"slug"
] | edb0223878fe02e791d2a0266c5a7c0f2029e3fe | https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Model/Classified/AbstractModel.php#L254-L261 | train |
kaiohken1982/NeobazaarDocumentModule | src/Document/Model/Classified/AbstractModel.php | AbstractModel.getLocation | protected function getLocation(Document $document, $sm)
{
$main = $sm->get('neobazaar.service.main');
$location = $document->getGeoname();
if(null !== $location) {
if('ADM3' == $location->getFeatureCode()) {
$location = $main->getGeonamesEntityRepository()->getParent($location);
}
}
return null... | php | protected function getLocation(Document $document, $sm)
{
$main = $sm->get('neobazaar.service.main');
$location = $document->getGeoname();
if(null !== $location) {
if('ADM3' == $location->getFeatureCode()) {
$location = $main->getGeonamesEntityRepository()->getParent($location);
}
}
return null... | [
"protected",
"function",
"getLocation",
"(",
"Document",
"$",
"document",
",",
"$",
"sm",
")",
"{",
"$",
"main",
"=",
"$",
"sm",
"->",
"get",
"(",
"'neobazaar.service.main'",
")",
";",
"$",
"location",
"=",
"$",
"document",
"->",
"getGeoname",
"(",
")",
... | Get the classified location.
To make the ADM2 select populated it will use the parent
entity if the location is an ADM3
@param Document $document
@return string | [
"Get",
"the",
"classified",
"location",
".",
"To",
"make",
"the",
"ADM2",
"select",
"populated",
"it",
"will",
"use",
"the",
"parent",
"entity",
"if",
"the",
"location",
"is",
"an",
"ADM3"
] | edb0223878fe02e791d2a0266c5a7c0f2029e3fe | https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Model/Classified/AbstractModel.php#L271-L282 | train |
kaiohken1982/NeobazaarDocumentModule | src/Document/Model/Classified/AbstractModel.php | AbstractModel.getPurpose | protected function getPurpose(Document $document)
{
$value = '';
foreach($document->getMetadata() as $meta) {
if('finalita' == $meta->getKey()) {
$value = $meta->getValue();
break;
}
}
return $value;
} | php | protected function getPurpose(Document $document)
{
$value = '';
foreach($document->getMetadata() as $meta) {
if('finalita' == $meta->getKey()) {
$value = $meta->getValue();
break;
}
}
return $value;
} | [
"protected",
"function",
"getPurpose",
"(",
"Document",
"$",
"document",
")",
"{",
"$",
"value",
"=",
"''",
";",
"foreach",
"(",
"$",
"document",
"->",
"getMetadata",
"(",
")",
"as",
"$",
"meta",
")",
"{",
"if",
"(",
"'finalita'",
"==",
"$",
"meta",
... | Get the classified purpose
@param Document $document
@return string | [
"Get",
"the",
"classified",
"purpose"
] | edb0223878fe02e791d2a0266c5a7c0f2029e3fe | https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Model/Classified/AbstractModel.php#L303-L314 | train |
kaiohken1982/NeobazaarDocumentModule | src/Document/Model/Classified/AbstractModel.php | AbstractModel.getHideMobile | protected function getHideMobile(Document $document)
{
foreach($document->getMetadata() as $meta) {
if('hidemobile' == $meta->getKey()) {
$v = $meta->getValue();
return $v;
break;
}
}
return false;
} | php | protected function getHideMobile(Document $document)
{
foreach($document->getMetadata() as $meta) {
if('hidemobile' == $meta->getKey()) {
$v = $meta->getValue();
return $v;
break;
}
}
return false;
} | [
"protected",
"function",
"getHideMobile",
"(",
"Document",
"$",
"document",
")",
"{",
"foreach",
"(",
"$",
"document",
"->",
"getMetadata",
"(",
")",
"as",
"$",
"meta",
")",
"{",
"if",
"(",
"'hidemobile'",
"==",
"$",
"meta",
"->",
"getKey",
"(",
")",
"... | Get the classified hidemobile meta value
@param Document $document
@return string | [
"Get",
"the",
"classified",
"hidemobile",
"meta",
"value"
] | edb0223878fe02e791d2a0266c5a7c0f2029e3fe | https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Model/Classified/AbstractModel.php#L341-L352 | train |
ezra-obiwale/dSCore | src/Stdlib/Object.php | Object.add | public function add(array $data, $preserveArray = false, $preserveKeyOnly = null) {
foreach ($data as $key => $value) {
if (is_array($value) && (!$preserveArray || ($preserveArray && $preserveKeyOnly && $key !== $preserveKeyOnly))) {
$this->$key = (array_key_exists(0, $value)) ? $val... | php | public function add(array $data, $preserveArray = false, $preserveKeyOnly = null) {
foreach ($data as $key => $value) {
if (is_array($value) && (!$preserveArray || ($preserveArray && $preserveKeyOnly && $key !== $preserveKeyOnly))) {
$this->$key = (array_key_exists(0, $value)) ? $val... | [
"public",
"function",
"add",
"(",
"array",
"$",
"data",
",",
"$",
"preserveArray",
"=",
"false",
",",
"$",
"preserveKeyOnly",
"=",
"null",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
... | Adds data to the object
@param array $data
@param boolean $preserveArray Indicates whether to preserve array or turn them objects too
@return Object
@throws \Exception | [
"Adds",
"data",
"to",
"the",
"object"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Object.php#L25-L41 | train |
ezra-obiwale/dSCore | src/Stdlib/Object.php | Object.toArray | public function toArray($recursive = false) {
$return = get_object_vars($this);
if ($recursive) {
foreach ($return as $ppt => &$val) {
if ($ppt === 'integerkeys')
continue;
if (is_object($val) && method_exists($val, 'toArray')) {
... | php | public function toArray($recursive = false) {
$return = get_object_vars($this);
if ($recursive) {
foreach ($return as $ppt => &$val) {
if ($ppt === 'integerkeys')
continue;
if (is_object($val) && method_exists($val, 'toArray')) {
... | [
"public",
"function",
"toArray",
"(",
"$",
"recursive",
"=",
"false",
")",
"{",
"$",
"return",
"=",
"get_object_vars",
"(",
"$",
"this",
")",
";",
"if",
"(",
"$",
"recursive",
")",
"{",
"foreach",
"(",
"$",
"return",
"as",
"$",
"ppt",
"=>",
"&",
"$... | Returns array of properties
@param $recursive
@return array | [
"Returns",
"array",
"of",
"properties"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Object.php#L71-L84 | train |
drdplusinfo/drdplus-races | DrdPlus/Races/Race.php | Race.getBodyWeight | public function getBodyWeight(GenderCode $genderCode, Tables $tables): int
{
$weightInKg = $this->getWeightInKg($genderCode, $tables);
return (new Weight($weightInKg, Weight::KG, $tables->getWeightTable()))->getBonus()->getValue();
} | php | public function getBodyWeight(GenderCode $genderCode, Tables $tables): int
{
$weightInKg = $this->getWeightInKg($genderCode, $tables);
return (new Weight($weightInKg, Weight::KG, $tables->getWeightTable()))->getBonus()->getValue();
} | [
"public",
"function",
"getBodyWeight",
"(",
"GenderCode",
"$",
"genderCode",
",",
"Tables",
"$",
"tables",
")",
":",
"int",
"{",
"$",
"weightInKg",
"=",
"$",
"this",
"->",
"getWeightInKg",
"(",
"$",
"genderCode",
",",
"$",
"tables",
")",
";",
"return",
"... | Bonus of body weight
@param GenderCode $genderCode
@param Tables $tables
@return int | [
"Bonus",
"of",
"body",
"weight"
] | a7189555ff5235e690c5fe01afc85aec0015b21a | https://github.com/drdplusinfo/drdplus-races/blob/a7189555ff5235e690c5fe01afc85aec0015b21a/DrdPlus/Races/Race.php#L144-L149 | train |
stevenliebregt/crispysystem | src/Routing/Route.php | Route.any | public static function any(string $path, $handler) : array
{
return [
static::get($path, $handler),
static::post($path, $handler),
static::put($path, $handler),
static::patch($path, $handler),
static::delete($path, $handler),
];
} | php | public static function any(string $path, $handler) : array
{
return [
static::get($path, $handler),
static::post($path, $handler),
static::put($path, $handler),
static::patch($path, $handler),
static::delete($path, $handler),
];
} | [
"public",
"static",
"function",
"any",
"(",
"string",
"$",
"path",
",",
"$",
"handler",
")",
":",
"array",
"{",
"return",
"[",
"static",
"::",
"get",
"(",
"$",
"path",
",",
"$",
"handler",
")",
",",
"static",
"::",
"post",
"(",
"$",
"path",
",",
... | Add a route that matches any HTTP verb
@param string $path
@param $handler
@return array
@since 1.4.0 | [
"Add",
"a",
"route",
"that",
"matches",
"any",
"HTTP",
"verb"
] | 06547dae100dae1023a93ec903f2d2abacce9aec | https://github.com/stevenliebregt/crispysystem/blob/06547dae100dae1023a93ec903f2d2abacce9aec/src/Routing/Route.php#L144-L153 | train |
stevenliebregt/crispysystem | src/Routing/Route.php | Route.match | public static function match(array $verbs, string $path, $handler) : array
{
$routes = [];
foreach ($verbs as $verb) {
switch (strtolower($verb)) {
case 'get':
$routes[] = static::get($path, $handler);
break;
case '... | php | public static function match(array $verbs, string $path, $handler) : array
{
$routes = [];
foreach ($verbs as $verb) {
switch (strtolower($verb)) {
case 'get':
$routes[] = static::get($path, $handler);
break;
case '... | [
"public",
"static",
"function",
"match",
"(",
"array",
"$",
"verbs",
",",
"string",
"$",
"path",
",",
"$",
"handler",
")",
":",
"array",
"{",
"$",
"routes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"verbs",
"as",
"$",
"verb",
")",
"{",
"switch",
... | Add a route that matches the given HTTP verbs
@param array $verbs
@param string $path
@param $handler
@return array
@since 1.4.0 | [
"Add",
"a",
"route",
"that",
"matches",
"the",
"given",
"HTTP",
"verbs"
] | 06547dae100dae1023a93ec903f2d2abacce9aec | https://github.com/stevenliebregt/crispysystem/blob/06547dae100dae1023a93ec903f2d2abacce9aec/src/Routing/Route.php#L163-L188 | train |
stevenliebregt/crispysystem | src/Routing/Route.php | Route.add | protected static function add(string $verb, string $path, $handler) : Route
{
/** @var Router $router */
$router = static::getRouterInstance();
$route = new static($router, $verb, $path, $handler);
Router::addRoute($verb, $route);
return $route;
} | php | protected static function add(string $verb, string $path, $handler) : Route
{
/** @var Router $router */
$router = static::getRouterInstance();
$route = new static($router, $verb, $path, $handler);
Router::addRoute($verb, $route);
return $route;
} | [
"protected",
"static",
"function",
"add",
"(",
"string",
"$",
"verb",
",",
"string",
"$",
"path",
",",
"$",
"handler",
")",
":",
"Route",
"{",
"/** @var Router $router */",
"$",
"router",
"=",
"static",
"::",
"getRouterInstance",
"(",
")",
";",
"$",
"route... | Creates a new route
@param string $verb
@param string $path
@param $handler
@return Route
@since 1.0.0 | [
"Creates",
"a",
"new",
"route"
] | 06547dae100dae1023a93ec903f2d2abacce9aec | https://github.com/stevenliebregt/crispysystem/blob/06547dae100dae1023a93ec903f2d2abacce9aec/src/Routing/Route.php#L198-L208 | train |
stevenliebregt/crispysystem | src/Routing/Route.php | Route.createRegex | public function createRegex()
{
$parts = explode('/', ltrim($this->path, '/'));
$regex = '/^'; // Matches the start of the string
foreach ($parts as $part) {
$regex .= '\/'; // Matches starting slash
// Handle non-variable parts
if (stripos($part, '{') ===... | php | public function createRegex()
{
$parts = explode('/', ltrim($this->path, '/'));
$regex = '/^'; // Matches the start of the string
foreach ($parts as $part) {
$regex .= '\/'; // Matches starting slash
// Handle non-variable parts
if (stripos($part, '{') ===... | [
"public",
"function",
"createRegex",
"(",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'/'",
",",
"ltrim",
"(",
"$",
"this",
"->",
"path",
",",
"'/'",
")",
")",
";",
"$",
"regex",
"=",
"'/^'",
";",
"// Matches the start of the string",
"foreach",
"(",
... | Creates a regular expression to match the route
@since 1.0.0 | [
"Creates",
"a",
"regular",
"expression",
"to",
"match",
"the",
"route"
] | 06547dae100dae1023a93ec903f2d2abacce9aec | https://github.com/stevenliebregt/crispysystem/blob/06547dae100dae1023a93ec903f2d2abacce9aec/src/Routing/Route.php#L280-L306 | train |
phpffcms/ffcms-core | src/Network/Request/MultiLanguageFeatures.php | MultiLanguageFeatures.runMultiLanguage | private function runMultiLanguage(): void
{
// check if multi-language is enabled
if (!App::$Properties->get('multiLanguage')) {
$this->language = App::$Properties->get('singleLanguage');
return;
}
// check if domain-lang binding is enabled
if (Any::i... | php | private function runMultiLanguage(): void
{
// check if multi-language is enabled
if (!App::$Properties->get('multiLanguage')) {
$this->language = App::$Properties->get('singleLanguage');
return;
}
// check if domain-lang binding is enabled
if (Any::i... | [
"private",
"function",
"runMultiLanguage",
"(",
")",
":",
"void",
"{",
"// check if multi-language is enabled",
"if",
"(",
"!",
"App",
"::",
"$",
"Properties",
"->",
"get",
"(",
"'multiLanguage'",
")",
")",
"{",
"$",
"this",
"->",
"language",
"=",
"App",
"::... | Build multi language pathway binding.
@return void | [
"Build",
"multi",
"language",
"pathway",
"binding",
"."
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Network/Request/MultiLanguageFeatures.php#L27-L62 | train |
phpffcms/ffcms-core | src/Network/Request/MultiLanguageFeatures.php | MultiLanguageFeatures.setLanguageFromBrowser | private function setLanguageFromBrowser(): void
{
$userLang = App::$Properties->get('singleLanguage');
$browserAccept = $this->getLanguages();
if (Any::isArray($browserAccept) && count($browserAccept) > 0) {
foreach ($browserAccept as $bLang) {
if (Arr::in($bLang,... | php | private function setLanguageFromBrowser(): void
{
$userLang = App::$Properties->get('singleLanguage');
$browserAccept = $this->getLanguages();
if (Any::isArray($browserAccept) && count($browserAccept) > 0) {
foreach ($browserAccept as $bLang) {
if (Arr::in($bLang,... | [
"private",
"function",
"setLanguageFromBrowser",
"(",
")",
":",
"void",
"{",
"$",
"userLang",
"=",
"App",
"::",
"$",
"Properties",
"->",
"get",
"(",
"'singleLanguage'",
")",
";",
"$",
"browserAccept",
"=",
"$",
"this",
"->",
"getLanguages",
"(",
")",
";",
... | Set language from browser headers
@return void | [
"Set",
"language",
"from",
"browser",
"headers"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Network/Request/MultiLanguageFeatures.php#L68-L92 | train |
praxigento/mobi_mod_downline | Service/Snap/Calc/A/ComposeUpdates.php | ComposeUpdates.composeSnapItem | private function composeSnapItem($customerId, $parentId, $dsChanged, $snap)
{
$result = new ESnap();
$result->setCustomerRef($customerId);
$result->setParentRef($parentId);
$result->setDate($dsChanged);
if ($customerId == $parentId) {
/* this is root node customer... | php | private function composeSnapItem($customerId, $parentId, $dsChanged, $snap)
{
$result = new ESnap();
$result->setCustomerRef($customerId);
$result->setParentRef($parentId);
$result->setDate($dsChanged);
if ($customerId == $parentId) {
/* this is root node customer... | [
"private",
"function",
"composeSnapItem",
"(",
"$",
"customerId",
",",
"$",
"parentId",
",",
"$",
"dsChanged",
",",
"$",
"snap",
")",
"{",
"$",
"result",
"=",
"new",
"ESnap",
"(",
")",
";",
"$",
"result",
"->",
"setCustomerRef",
"(",
"$",
"customerId",
... | Compose snapshot item.
@param int $customerId
@param int $parentId
@param string $dsChanged
@param ESnap[] $snap
@return ESnap | [
"Compose",
"snapshot",
"item",
"."
] | 0f3c276dfff1aa029f9fd205ccfc56f207a2e75b | https://github.com/praxigento/mobi_mod_downline/blob/0f3c276dfff1aa029f9fd205ccfc56f207a2e75b/Service/Snap/Calc/A/ComposeUpdates.php#L139-L162 | train |
ColonelBlimp/NsanjaConfig | src/Nsanja/Platform/Config/ConfigurationAbstract.php | ConfigurationAbstract.getArrayValue | final protected function getArrayValue(string $key): array
{
$value = $this->getConfigValue($key);
if (!$value || !\is_array($value)) {
return [];
}
return $value;
} | php | final protected function getArrayValue(string $key): array
{
$value = $this->getConfigValue($key);
if (!$value || !\is_array($value)) {
return [];
}
return $value;
} | [
"final",
"protected",
"function",
"getArrayValue",
"(",
"string",
"$",
"key",
")",
":",
"array",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"$",
"key",
")",
";",
"if",
"(",
"!",
"$",
"value",
"||",
"!",
"\\",
"is_array",
"(",
... | Returns an array value.
@param string $key
@return array | [
"Returns",
"an",
"array",
"value",
"."
] | d23609c6cd00f7c524f122b16c532681b8c489be | https://github.com/ColonelBlimp/NsanjaConfig/blob/d23609c6cd00f7c524f122b16c532681b8c489be/src/Nsanja/Platform/Config/ConfigurationAbstract.php#L105-L113 | train |
ColonelBlimp/NsanjaConfig | src/Nsanja/Platform/Config/ConfigurationAbstract.php | ConfigurationAbstract.getStringValue | final protected function getStringValue(string $key, string $default = ''): string
{
$value = $this->getConfigValue($key);
if (!$value) {
return $default;
}
return strval($value);
} | php | final protected function getStringValue(string $key, string $default = ''): string
{
$value = $this->getConfigValue($key);
if (!$value) {
return $default;
}
return strval($value);
} | [
"final",
"protected",
"function",
"getStringValue",
"(",
"string",
"$",
"key",
",",
"string",
"$",
"default",
"=",
"''",
")",
":",
"string",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"$",
"key",
")",
";",
"if",
"(",
"!",
"$",
... | Retrieves a string configuration parameter.
@param string $key The for the value.
@param string $default The default value if not found (empty string)
@return string The value. | [
"Retrieves",
"a",
"string",
"configuration",
"parameter",
"."
] | d23609c6cd00f7c524f122b16c532681b8c489be | https://github.com/ColonelBlimp/NsanjaConfig/blob/d23609c6cd00f7c524f122b16c532681b8c489be/src/Nsanja/Platform/Config/ConfigurationAbstract.php#L137-L145 | train |
ColonelBlimp/NsanjaConfig | src/Nsanja/Platform/Config/ConfigurationAbstract.php | ConfigurationAbstract.getBooleanValue | final protected function getBooleanValue(string $key, bool $default = false): bool
{
$value = $this->getConfigValue($key);
if (!$value) {
return $default;
}
return \boolval($value);
} | php | final protected function getBooleanValue(string $key, bool $default = false): bool
{
$value = $this->getConfigValue($key);
if (!$value) {
return $default;
}
return \boolval($value);
} | [
"final",
"protected",
"function",
"getBooleanValue",
"(",
"string",
"$",
"key",
",",
"bool",
"$",
"default",
"=",
"false",
")",
":",
"bool",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getConfigValue",
"(",
"$",
"key",
")",
";",
"if",
"(",
"!",
"$",
... | Retrieves a boolean configuration parameter.
@param string $key The key for the value.
@param bool $default The default value if not found (false)
@return bool The value | [
"Retrieves",
"a",
"boolean",
"configuration",
"parameter",
"."
] | d23609c6cd00f7c524f122b16c532681b8c489be | https://github.com/ColonelBlimp/NsanjaConfig/blob/d23609c6cd00f7c524f122b16c532681b8c489be/src/Nsanja/Platform/Config/ConfigurationAbstract.php#L153-L161 | train |
ColonelBlimp/NsanjaConfig | src/Nsanja/Platform/Config/ConfigurationAbstract.php | ConfigurationAbstract.isBaseConfigPropertiesSet | private function isBaseConfigPropertiesSet(): bool
{
return isset(
$this->config[ConfigurationInterface::KEY_APP_ROOT],
$this->config[ConfigurationInterface::KEY_CONFIG_ROOT],
$this->config[ConfigurationInterface::KEY_CACHE_ROOT],
$this->config[ConfigurationIn... | php | private function isBaseConfigPropertiesSet(): bool
{
return isset(
$this->config[ConfigurationInterface::KEY_APP_ROOT],
$this->config[ConfigurationInterface::KEY_CONFIG_ROOT],
$this->config[ConfigurationInterface::KEY_CACHE_ROOT],
$this->config[ConfigurationIn... | [
"private",
"function",
"isBaseConfigPropertiesSet",
"(",
")",
":",
"bool",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"config",
"[",
"ConfigurationInterface",
"::",
"KEY_APP_ROOT",
"]",
",",
"$",
"this",
"->",
"config",
"[",
"ConfigurationInterface",
"::",
... | Checks that all the mandatory properties are set.
@return bool Return <code>true</code> if all the properties are set, otherwise <code>false</code>. | [
"Checks",
"that",
"all",
"the",
"mandatory",
"properties",
"are",
"set",
"."
] | d23609c6cd00f7c524f122b16c532681b8c489be | https://github.com/ColonelBlimp/NsanjaConfig/blob/d23609c6cd00f7c524f122b16c532681b8c489be/src/Nsanja/Platform/Config/ConfigurationAbstract.php#L167-L176 | train |
inc2734/wp-page-speed-optimization | src/App/Controller/Menu.php | Menu._pre_wp_nav_menu | public function _pre_wp_nav_menu( $output, $args ) {
if ( is_customize_preview() ) {
return $output;
}
// For the nav menu widget.
if ( ! $args->theme_location ) {
return $output;
}
if ( ! $this->_is_caching_nav_menus() ) {
return $output;
}
if ( ! $this->_is_caching_nav_menu( $args->theme_l... | php | public function _pre_wp_nav_menu( $output, $args ) {
if ( is_customize_preview() ) {
return $output;
}
// For the nav menu widget.
if ( ! $args->theme_location ) {
return $output;
}
if ( ! $this->_is_caching_nav_menus() ) {
return $output;
}
if ( ! $this->_is_caching_nav_menu( $args->theme_l... | [
"public",
"function",
"_pre_wp_nav_menu",
"(",
"$",
"output",
",",
"$",
"args",
")",
"{",
"if",
"(",
"is_customize_preview",
"(",
")",
")",
"{",
"return",
"$",
"output",
";",
"}",
"// For the nav menu widget.",
"if",
"(",
"!",
"$",
"args",
"->",
"theme_loc... | Output nav menu
@param string $output HTML
@param array $args
@return string | [
"Output",
"nav",
"menu"
] | 219963582b592eef4bde6cdd4ed1cf0dc71a6114 | https://github.com/inc2734/wp-page-speed-optimization/blob/219963582b592eef4bde6cdd4ed1cf0dc71a6114/src/App/Controller/Menu.php#L95-L119 | train |
inc2734/wp-page-speed-optimization | src/App/Controller/Menu.php | Menu._remove_current_classes | public function _remove_current_classes( $items, $args ) {
if ( is_customize_preview() ) {
return $items;
}
if ( ! static::_is_caching_nav_menus() ) {
return $items;
}
if ( ! $this->_is_caching_nav_menu( $args->theme_location ) ) {
return $items;
}
foreach ( $items as $items_index => $item ) {... | php | public function _remove_current_classes( $items, $args ) {
if ( is_customize_preview() ) {
return $items;
}
if ( ! static::_is_caching_nav_menus() ) {
return $items;
}
if ( ! $this->_is_caching_nav_menu( $args->theme_location ) ) {
return $items;
}
foreach ( $items as $items_index => $item ) {... | [
"public",
"function",
"_remove_current_classes",
"(",
"$",
"items",
",",
"$",
"args",
")",
"{",
"if",
"(",
"is_customize_preview",
"(",
")",
")",
"{",
"return",
"$",
"items",
";",
"}",
"if",
"(",
"!",
"static",
"::",
"_is_caching_nav_menus",
"(",
")",
")... | Remove current classes
@param string $items The menu items, sorted by each menu item's menu order.
@param stdClass $args An object containing wp_nav_menu() arguments.
@return string | [
"Remove",
"current",
"classes"
] | 219963582b592eef4bde6cdd4ed1cf0dc71a6114 | https://github.com/inc2734/wp-page-speed-optimization/blob/219963582b592eef4bde6cdd4ed1cf0dc71a6114/src/App/Controller/Menu.php#L128-L150 | train |
Vectrex/vxPHP | src/Debug/Debug.php | Debug.enable | public static function enable($reportingLevel = NULL, $displayErrors = NULL) {
if (!static::$enabled) {
static::$enabled = true;
error_reporting(E_ALL);
ErrorHandler::register($reportingLevel, $displayErrors);
if (PHP_SAPI !== 'cli') {
ExceptionHandler::register($reportingLevel, $displayErrors);... | php | public static function enable($reportingLevel = NULL, $displayErrors = NULL) {
if (!static::$enabled) {
static::$enabled = true;
error_reporting(E_ALL);
ErrorHandler::register($reportingLevel, $displayErrors);
if (PHP_SAPI !== 'cli') {
ExceptionHandler::register($reportingLevel, $displayErrors);... | [
"public",
"static",
"function",
"enable",
"(",
"$",
"reportingLevel",
"=",
"NULL",
",",
"$",
"displayErrors",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"$",
"enabled",
")",
"{",
"static",
"::",
"$",
"enabled",
"=",
"true",
";",
"error_repo... | activate custom debugging
registers error handler and exception handler
@param integer $reportingLevel
@param boolean $displayErrors | [
"activate",
"custom",
"debugging",
"registers",
"error",
"handler",
"and",
"exception",
"handler"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Debug/Debug.php#L30-L47 | train |
miknatr/grace-dbal | lib/Grace/SQLBuilder/WhereBuilderAbstract.php | WhereBuilderAbstract.sql | public function sql($sql, array $values = array())
{
$this->whereSqlConditions[] = $sql;
$this->arguments = array_merge($this->arguments, $values);
return $this;
} | php | public function sql($sql, array $values = array())
{
$this->whereSqlConditions[] = $sql;
$this->arguments = array_merge($this->arguments, $values);
return $this;
} | [
"public",
"function",
"sql",
"(",
"$",
"sql",
",",
"array",
"$",
"values",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"whereSqlConditions",
"[",
"]",
"=",
"$",
"sql",
";",
"$",
"this",
"->",
"arguments",
"=",
"array_merge",
"(",
"$",
"thi... | Adds sql statement into where statement
@param $sql
@param array $values
@return $this | [
"Adds",
"sql",
"statement",
"into",
"where",
"statement"
] | b05e03040568631dc6c77477c0eaed6e60db4ba2 | https://github.com/miknatr/grace-dbal/blob/b05e03040568631dc6c77477c0eaed6e60db4ba2/lib/Grace/SQLBuilder/WhereBuilderAbstract.php#L27-L32 | train |
miknatr/grace-dbal | lib/Grace/SQLBuilder/WhereBuilderAbstract.php | WhereBuilderAbstract.like | public function like($field, $value)
{
$operator = ' ' . $this->executable->provideSqlDialect()->likeOperator() . ' ';
return $this->setTwoArgsOperator($field, $value, $operator);
} | php | public function like($field, $value)
{
$operator = ' ' . $this->executable->provideSqlDialect()->likeOperator() . ' ';
return $this->setTwoArgsOperator($field, $value, $operator);
} | [
"public",
"function",
"like",
"(",
"$",
"field",
",",
"$",
"value",
")",
"{",
"$",
"operator",
"=",
"' '",
".",
"$",
"this",
"->",
"executable",
"->",
"provideSqlDialect",
"(",
")",
"->",
"likeOperator",
"(",
")",
".",
"' '",
";",
"return",
"$",
"thi... | Adds LIKE statement into where statement
@param $field
@param $value
@return $this | [
"Adds",
"LIKE",
"statement",
"into",
"where",
"statement"
] | b05e03040568631dc6c77477c0eaed6e60db4ba2 | https://github.com/miknatr/grace-dbal/blob/b05e03040568631dc6c77477c0eaed6e60db4ba2/lib/Grace/SQLBuilder/WhereBuilderAbstract.php#L168-L172 | train |
agentmedia/phine-builtin | src/BuiltIn/Modules/Backend/RegisterSimpleForm.php | RegisterSimpleForm.SaveElement | protected function SaveElement()
{
$this->register->SetConfirmUrl($this->selectorConfirm->Save($this->register->GetConfirmUrl()));
$this->register->SetNextUrl($this->selectorNext->Save($this->register->GetNextUrl()));
$this->register->SetMailFrom($this->Value('MailFrom'));
$this->reg... | php | protected function SaveElement()
{
$this->register->SetConfirmUrl($this->selectorConfirm->Save($this->register->GetConfirmUrl()));
$this->register->SetNextUrl($this->selectorNext->Save($this->register->GetNextUrl()));
$this->register->SetMailFrom($this->Value('MailFrom'));
$this->reg... | [
"protected",
"function",
"SaveElement",
"(",
")",
"{",
"$",
"this",
"->",
"register",
"->",
"SetConfirmUrl",
"(",
"$",
"this",
"->",
"selectorConfirm",
"->",
"Save",
"(",
"$",
"this",
"->",
"register",
"->",
"GetConfirmUrl",
"(",
")",
")",
")",
";",
"$",... | Saves the simple register element
@return ContentRegisterSimple | [
"Saves",
"the",
"simple",
"register",
"element"
] | 4dd05bc406a71e997bd4eaa16b12e23dbe62a456 | https://github.com/agentmedia/phine-builtin/blob/4dd05bc406a71e997bd4eaa16b12e23dbe62a456/src/BuiltIn/Modules/Backend/RegisterSimpleForm.php#L160-L170 | train |
translationexchange/tml-php-clientsdk | library/Tr8n/Utils/HtmlTranslator.php | HtmlTranslator.prepareHtml | function prepareHtml() {
// remove all tabs and new lines - as they mean nothing in HTML
$this->html = trim(preg_replace('/\t\n/', '', $this->html));
// normalize multiple spaces to one space
$this->html = preg_replace('/\s+/', ' ', $this->html);
// replace special characters l... | php | function prepareHtml() {
// remove all tabs and new lines - as they mean nothing in HTML
$this->html = trim(preg_replace('/\t\n/', '', $this->html));
// normalize multiple spaces to one space
$this->html = preg_replace('/\s+/', ' ', $this->html);
// replace special characters l... | [
"function",
"prepareHtml",
"(",
")",
"{",
"// remove all tabs and new lines - as they mean nothing in HTML",
"$",
"this",
"->",
"html",
"=",
"trim",
"(",
"preg_replace",
"(",
"'/\\t\\n/'",
",",
"''",
",",
"$",
"this",
"->",
"html",
")",
")",
";",
"// normalize mul... | Prepares HTML for processing | [
"Prepares",
"HTML",
"for",
"processing"
] | fe51473824e62cfd883c6aa0c6a3783a16ce8425 | https://github.com/translationexchange/tml-php-clientsdk/blob/fe51473824e62cfd883c6aa0c6a3783a16ce8425/library/Tr8n/Utils/HtmlTranslator.php#L94-L109 | train |
translationexchange/tml-php-clientsdk | library/Tr8n/Utils/HtmlTranslator.php | HtmlTranslator.parseDocument | function parseDocument() {
$this->prepareHtml();
$current = libxml_use_internal_errors(true);
$disableEntities = libxml_disable_entity_loader(true);
$charset = 'UTF-8';
$this->doc = new \DOMDocument('1.0', $charset);
$this->doc->strictErrorChecking = false;
@$t... | php | function parseDocument() {
$this->prepareHtml();
$current = libxml_use_internal_errors(true);
$disableEntities = libxml_disable_entity_loader(true);
$charset = 'UTF-8';
$this->doc = new \DOMDocument('1.0', $charset);
$this->doc->strictErrorChecking = false;
@$t... | [
"function",
"parseDocument",
"(",
")",
"{",
"$",
"this",
"->",
"prepareHtml",
"(",
")",
";",
"$",
"current",
"=",
"libxml_use_internal_errors",
"(",
"true",
")",
";",
"$",
"disableEntities",
"=",
"libxml_disable_entity_loader",
"(",
"true",
")",
";",
"$",
"c... | Parses the HTML document | [
"Parses",
"the",
"HTML",
"document"
] | fe51473824e62cfd883c6aa0c6a3783a16ce8425 | https://github.com/translationexchange/tml-php-clientsdk/blob/fe51473824e62cfd883c6aa0c6a3783a16ce8425/library/Tr8n/Utils/HtmlTranslator.php#L114-L128 | train |
translationexchange/tml-php-clientsdk | library/Tr8n/Utils/HtmlTranslator.php | HtmlTranslator.generateTmlTags | private function generateTmlTags($node) {
$buffer = "";
foreach($node->childNodes as $child) {
if ($child->nodeType == 3) { // text node
$buffer = $buffer . $child->wholeText;
} else {
$buffer = $buffer . $this->generateTmlTags($... | php | private function generateTmlTags($node) {
$buffer = "";
foreach($node->childNodes as $child) {
if ($child->nodeType == 3) { // text node
$buffer = $buffer . $child->wholeText;
} else {
$buffer = $buffer . $this->generateTmlTags($... | [
"private",
"function",
"generateTmlTags",
"(",
"$",
"node",
")",
"{",
"$",
"buffer",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"node",
"->",
"childNodes",
"as",
"$",
"child",
")",
"{",
"if",
"(",
"$",
"child",
"->",
"nodeType",
"==",
"3",
")",
"{",
"/... | TML nodes can be nested - but they CANNOT contain non-inline nodes
@param $node
@return string | [
"TML",
"nodes",
"can",
"be",
"nested",
"-",
"but",
"they",
"CANNOT",
"contain",
"non",
"-",
"inline",
"nodes"
] | fe51473824e62cfd883c6aa0c6a3783a16ce8425 | https://github.com/translationexchange/tml-php-clientsdk/blob/fe51473824e62cfd883c6aa0c6a3783a16ce8425/library/Tr8n/Utils/HtmlTranslator.php#L218-L241 | train |
translationexchange/tml-php-clientsdk | library/Tr8n/Utils/HtmlTranslator.php | HtmlTranslator.resetContext | private function resetContext() {
$this->debug_tokens = $this->tokens;
$this->tokens = array_merge(array(), $this->context);
} | php | private function resetContext() {
$this->debug_tokens = $this->tokens;
$this->tokens = array_merge(array(), $this->context);
} | [
"private",
"function",
"resetContext",
"(",
")",
"{",
"$",
"this",
"->",
"debug_tokens",
"=",
"$",
"this",
"->",
"tokens",
";",
"$",
"this",
"->",
"tokens",
"=",
"array_merge",
"(",
"array",
"(",
")",
",",
"$",
"this",
"->",
"context",
")",
";",
"}"
... | Resets context of the current translation | [
"Resets",
"context",
"of",
"the",
"current",
"translation"
] | fe51473824e62cfd883c6aa0c6a3783a16ce8425 | https://github.com/translationexchange/tml-php-clientsdk/blob/fe51473824e62cfd883c6aa0c6a3783a16ce8425/library/Tr8n/Utils/HtmlTranslator.php#L275-L278 | train |
irfantoor/engine | src/Http/Cookie.php | Cookie.send | function send()
{
if (!headers_sent()) {
extract($this->toArray());
setcookie($name, $value, $expires, $path, $domain, $secure, $httponly);
}
} | php | function send()
{
if (!headers_sent()) {
extract($this->toArray());
setcookie($name, $value, $expires, $path, $domain, $secure, $httponly);
}
} | [
"function",
"send",
"(",
")",
"{",
"if",
"(",
"!",
"headers_sent",
"(",
")",
")",
"{",
"extract",
"(",
"$",
"this",
"->",
"toArray",
"(",
")",
")",
";",
"setcookie",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"expires",
",",
"$",
"path",
",... | Sets the cookie to be sent by the headers | [
"Sets",
"the",
"cookie",
"to",
"be",
"sent",
"by",
"the",
"headers"
] | 4d2d221add749f75100d0b4ffe1488cdbf7af5d3 | https://github.com/irfantoor/engine/blob/4d2d221add749f75100d0b4ffe1488cdbf7af5d3/src/Http/Cookie.php#L80-L86 | train |
romm/configuration_object | Classes/Service/Items/MixedTypes/MixedTypesResolver.php | MixedTypesResolver.addError | public function addError(Error $error)
{
$this->result->addError($error);
$this->setObjectType(self::OBJECT_TYPE_NONE);
} | php | public function addError(Error $error)
{
$this->result->addError($error);
$this->setObjectType(self::OBJECT_TYPE_NONE);
} | [
"public",
"function",
"addError",
"(",
"Error",
"$",
"error",
")",
"{",
"$",
"this",
"->",
"result",
"->",
"addError",
"(",
"$",
"error",
")",
";",
"$",
"this",
"->",
"setObjectType",
"(",
"self",
"::",
"OBJECT_TYPE_NONE",
")",
";",
"}"
] | Adds an error to the processor, which may then be merged with the errors
of the property being currently mapped.
It will also set the object type to `null`, because if there is an error,
the property can probably not being converted correctly.
@param Error $error | [
"Adds",
"an",
"error",
"to",
"the",
"processor",
"which",
"may",
"then",
"be",
"merged",
"with",
"the",
"errors",
"of",
"the",
"property",
"being",
"currently",
"mapped",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Service/Items/MixedTypes/MixedTypesResolver.php#L67-L71 | train |
modulusphp/http | Session.php | Session.key | public static function key($key, $value = null)
{
if ($value == null) return $_SESSION[$key];
$_SESSION[$key] = $value;
} | php | public static function key($key, $value = null)
{
if ($value == null) return $_SESSION[$key];
$_SESSION[$key] = $value;
} | [
"public",
"static",
"function",
"key",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"value",
"==",
"null",
")",
"return",
"$",
"_SESSION",
"[",
"$",
"key",
"]",
";",
"$",
"_SESSION",
"[",
"$",
"key",
"]",
"=",
"$",... | Set or get session key
@param mixed $key
@param mixed $value
@return void | [
"Set",
"or",
"get",
"session",
"key"
] | fc5c0f2b582a04de1685578d3fb790686a0a240c | https://github.com/modulusphp/http/blob/fc5c0f2b582a04de1685578d3fb790686a0a240c/Session.php#L42-L47 | train |
modulusphp/http | Session.php | Session.flash | public static function flash(string $key, $value = null)
{
/**
* Check if session already has variables.
*
* If variables have already been set, merge the new
* variables with the old ones.
*/
return $_SESSION['application']['with'] = array_merge(
... | php | public static function flash(string $key, $value = null)
{
/**
* Check if session already has variables.
*
* If variables have already been set, merge the new
* variables with the old ones.
*/
return $_SESSION['application']['with'] = array_merge(
... | [
"public",
"static",
"function",
"flash",
"(",
"string",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"/**\n * Check if session already has variables.\n *\n * If variables have already been set, merge the new\n * variables with the old ones.\n */",
"return... | Create a flash message
@param string $key
@param mixed $value
@return | [
"Create",
"a",
"flash",
"message"
] | fc5c0f2b582a04de1685578d3fb790686a0a240c | https://github.com/modulusphp/http/blob/fc5c0f2b582a04de1685578d3fb790686a0a240c/Session.php#L56-L68 | train |
libreworks/caridea-validate | src/Registry.php | Registry.register | public function register(array $definitions): self
{
foreach ($definitions as $name => $callback) {
if (!is_callable($callback)) {
throw new \InvalidArgumentException('Values passed to register must be callable');
}
$this->definitions[$name] = $callback;
... | php | public function register(array $definitions): self
{
foreach ($definitions as $name => $callback) {
if (!is_callable($callback)) {
throw new \InvalidArgumentException('Values passed to register must be callable');
}
$this->definitions[$name] = $callback;
... | [
"public",
"function",
"register",
"(",
"array",
"$",
"definitions",
")",
":",
"self",
"{",
"foreach",
"(",
"$",
"definitions",
"as",
"$",
"name",
"=>",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"th... | Registers rule definitions.
```php
$registry = new \Caridea\Validate\Registry();
$registry->register([
'adult' => ['My\Validate\AgeRule', 'adult'],
'credit_card' => function(){return new CreditCardRule();},
'something' => 'my_function_that_can_be_called'
]);
```
@param array<string,callable> $definitions Associative ... | [
"Registers",
"rule",
"definitions",
"."
] | 625835694d34591bfb1e3b2ce60c2cc28a28d006 | https://github.com/libreworks/caridea-validate/blob/625835694d34591bfb1e3b2ce60c2cc28a28d006/src/Registry.php#L96-L105 | train |
libreworks/caridea-validate | src/Registry.php | Registry.alias | public function alias(string $name, $rules, ?string $error = null): self
{
$this->definitions[$name] = function () use ($rules, $error) {
return $this->parser->parse($rules)->setError($error);
};
return $this;
} | php | public function alias(string $name, $rules, ?string $error = null): self
{
$this->definitions[$name] = function () use ($rules, $error) {
return $this->parser->parse($rules)->setError($error);
};
return $this;
} | [
"public",
"function",
"alias",
"(",
"string",
"$",
"name",
",",
"$",
"rules",
",",
"?",
"string",
"$",
"error",
"=",
"null",
")",
":",
"self",
"{",
"$",
"this",
"->",
"definitions",
"[",
"$",
"name",
"]",
"=",
"function",
"(",
")",
"use",
"(",
"$... | Registers an alias for a ruleset.
@param string $name The name of the alias
@param object|array $rules The ruleset to alias
@param string|null $error A custom error code to return, or `null` to use normal codes
@return $this provides a fluent interface | [
"Registers",
"an",
"alias",
"for",
"a",
"ruleset",
"."
] | 625835694d34591bfb1e3b2ce60c2cc28a28d006 | https://github.com/libreworks/caridea-validate/blob/625835694d34591bfb1e3b2ce60c2cc28a28d006/src/Registry.php#L115-L121 | train |
libreworks/caridea-validate | src/Registry.php | Registry.aliasDefinition | public function aliasDefinition($definition): self
{
if (is_object($definition)) {
$definition = (array) $definition;
}
if (!is_array($definition)) {
throw new \InvalidArgumentException("Invalid alias definition: must be an object or an associative array");
}
... | php | public function aliasDefinition($definition): self
{
if (is_object($definition)) {
$definition = (array) $definition;
}
if (!is_array($definition)) {
throw new \InvalidArgumentException("Invalid alias definition: must be an object or an associative array");
}
... | [
"public",
"function",
"aliasDefinition",
"(",
"$",
"definition",
")",
":",
"self",
"{",
"if",
"(",
"is_object",
"(",
"$",
"definition",
")",
")",
"{",
"$",
"definition",
"=",
"(",
"array",
")",
"$",
"definition",
";",
"}",
"if",
"(",
"!",
"is_array",
... | Registers an alias for a ruleset, using a LIVR-compliant definition.
```javascript
// alias.json
{
"name": "valid_address",
"rules": { "nested_object": {
"country": "required",
"city": "required",
"zip": "positive_integer"
}},
error: "WRONG_ADDRESS"
}
```
```php
$registry->aliasDefinition(json_decode(file_get_contents... | [
"Registers",
"an",
"alias",
"for",
"a",
"ruleset",
"using",
"a",
"LIVR",
"-",
"compliant",
"definition",
"."
] | 625835694d34591bfb1e3b2ce60c2cc28a28d006 | https://github.com/libreworks/caridea-validate/blob/625835694d34591bfb1e3b2ce60c2cc28a28d006/src/Registry.php#L146-L158 | train |
libreworks/caridea-validate | src/Registry.php | Registry.factory | public function factory(string $name, $arg = null): Rule
{
if (!array_key_exists($name, $this->definitions)) {
throw new \InvalidArgumentException("No rule registered with name: $name");
}
$vrule = is_array($arg) ?
call_user_func_array($this->definitions[$name], $arg)... | php | public function factory(string $name, $arg = null): Rule
{
if (!array_key_exists($name, $this->definitions)) {
throw new \InvalidArgumentException("No rule registered with name: $name");
}
$vrule = is_array($arg) ?
call_user_func_array($this->definitions[$name], $arg)... | [
"public",
"function",
"factory",
"(",
"string",
"$",
"name",
",",
"$",
"arg",
"=",
"null",
")",
":",
"Rule",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"definitions",
")",
")",
"{",
"throw",
"new",
"\\",
"Inv... | Constructs a validation rule.
@param string $name A string name
@param mixed $arg Optional constructor argument, or an array of arguments
@return \Caridea\Validate\Rule The instantiated rule
@throws \InvalidArgumentException if the rule name is not registered
@throws \UnexpectedValueException if the factory returns a ... | [
"Constructs",
"a",
"validation",
"rule",
"."
] | 625835694d34591bfb1e3b2ce60c2cc28a28d006 | https://github.com/libreworks/caridea-validate/blob/625835694d34591bfb1e3b2ce60c2cc28a28d006/src/Registry.php#L169-L181 | train |
WellCommerce/DistributionBundle | Composer/HerokuEnvironment.php | HerokuEnvironment.populateEnvironment | public static function populateEnvironment(Event $event)
{
$url = getenv('CLEARDB_DATABASE_URL');
if ($url) {
$url = parse_url($url);
putenv("SYMFONY_DATABASE_HOST={$url['host']}");
putenv("SYMFONY_DATABASE_USER={$url['user']}");
putenv("SYMFONY_DATAB... | php | public static function populateEnvironment(Event $event)
{
$url = getenv('CLEARDB_DATABASE_URL');
if ($url) {
$url = parse_url($url);
putenv("SYMFONY_DATABASE_HOST={$url['host']}");
putenv("SYMFONY_DATABASE_USER={$url['user']}");
putenv("SYMFONY_DATAB... | [
"public",
"static",
"function",
"populateEnvironment",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"url",
"=",
"getenv",
"(",
"'CLEARDB_DATABASE_URL'",
")",
";",
"if",
"(",
"$",
"url",
")",
"{",
"$",
"url",
"=",
"parse_url",
"(",
"$",
"url",
")",
";",
... | Populate Heroku environment
@param Event $event Event | [
"Populate",
"Heroku",
"environment"
] | 82b1b4c2c5a59536aaae22506b23ccd5d141cbb0 | https://github.com/WellCommerce/DistributionBundle/blob/82b1b4c2c5a59536aaae22506b23ccd5d141cbb0/Composer/HerokuEnvironment.php#L29-L47 | train |
praxigento/mobi_mod_downline | Helper/Registry.php | Registry.putQuoteId | public function putQuoteId($data)
{
if ($this->registry->registry(self::QUOTE_ID)) {
$this->registry->unregister(self::QUOTE_ID);
}
$this->registry->register(self::QUOTE_ID, $data);
} | php | public function putQuoteId($data)
{
if ($this->registry->registry(self::QUOTE_ID)) {
$this->registry->unregister(self::QUOTE_ID);
}
$this->registry->register(self::QUOTE_ID, $data);
} | [
"public",
"function",
"putQuoteId",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"registry",
"->",
"registry",
"(",
"self",
"::",
"QUOTE_ID",
")",
")",
"{",
"$",
"this",
"->",
"registry",
"->",
"unregister",
"(",
"self",
"::",
"QUOTE_ID",
... | Quote ID for newly created orders.
@param int $data | [
"Quote",
"ID",
"for",
"newly",
"created",
"orders",
"."
] | 0f3c276dfff1aa029f9fd205ccfc56f207a2e75b | https://github.com/praxigento/mobi_mod_downline/blob/0f3c276dfff1aa029f9fd205ccfc56f207a2e75b/Helper/Registry.php#L62-L68 | train |
fxpio/fxp-default-value-bundle | DependencyInjection/Compiler/DefaultValuePass.php | DefaultValuePass.findTags | protected function findTags(ContainerBuilder $container, $tagName, $argumentPosition, $ext = false): void
{
$services = [];
foreach ($container->findTaggedServiceIds($tagName) as $serviceId => $tag) {
$class = isset($tag[0]['class'])
? $this->getRealClassName($container,... | php | protected function findTags(ContainerBuilder $container, $tagName, $argumentPosition, $ext = false): void
{
$services = [];
foreach ($container->findTaggedServiceIds($tagName) as $serviceId => $tag) {
$class = isset($tag[0]['class'])
? $this->getRealClassName($container,... | [
"protected",
"function",
"findTags",
"(",
"ContainerBuilder",
"$",
"container",
",",
"$",
"tagName",
",",
"$",
"argumentPosition",
",",
"$",
"ext",
"=",
"false",
")",
":",
"void",
"{",
"$",
"services",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"container"... | Find service tags.
@param ContainerBuilder $container
@param string $tagName
@param int $argumentPosition
@param bool $ext
@throws InvalidConfigurationException | [
"Find",
"service",
"tags",
"."
] | f2610281aa59b3d841931dc952af79664a6fc063 | https://github.com/fxpio/fxp-default-value-bundle/blob/f2610281aa59b3d841931dc952af79664a6fc063/DependencyInjection/Compiler/DefaultValuePass.php#L59-L79 | train |
fxpio/fxp-default-value-bundle | DependencyInjection/Compiler/DefaultValuePass.php | DefaultValuePass.getRealClassName | protected function getRealClassName(ContainerBuilder $container, $classname)
{
return 0 === strpos($classname, '%') ? $container->getParameter(trim($classname, '%')) : $classname;
} | php | protected function getRealClassName(ContainerBuilder $container, $classname)
{
return 0 === strpos($classname, '%') ? $container->getParameter(trim($classname, '%')) : $classname;
} | [
"protected",
"function",
"getRealClassName",
"(",
"ContainerBuilder",
"$",
"container",
",",
"$",
"classname",
")",
"{",
"return",
"0",
"===",
"strpos",
"(",
"$",
"classname",
",",
"'%'",
")",
"?",
"$",
"container",
"->",
"getParameter",
"(",
"trim",
"(",
... | Get the real class name.
@param ContainerBuilder $container The container
@param string $classname The class name or the parameter name of classname
@return string | [
"Get",
"the",
"real",
"class",
"name",
"."
] | f2610281aa59b3d841931dc952af79664a6fc063 | https://github.com/fxpio/fxp-default-value-bundle/blob/f2610281aa59b3d841931dc952af79664a6fc063/DependencyInjection/Compiler/DefaultValuePass.php#L89-L92 | train |
fxpio/fxp-default-value-bundle | DependencyInjection/Compiler/DefaultValuePass.php | DefaultValuePass.getClassName | protected function getClassName(ContainerBuilder $container, $serviceId, $tagName)
{
$type = $container->getDefinition($serviceId);
$interfaces = class_implements($type->getClass());
if (\in_array(ObjectTypeExtensionInterface::class, $interfaces, true)) {
throw new InvalidConfig... | php | protected function getClassName(ContainerBuilder $container, $serviceId, $tagName)
{
$type = $container->getDefinition($serviceId);
$interfaces = class_implements($type->getClass());
if (\in_array(ObjectTypeExtensionInterface::class, $interfaces, true)) {
throw new InvalidConfig... | [
"protected",
"function",
"getClassName",
"(",
"ContainerBuilder",
"$",
"container",
",",
"$",
"serviceId",
",",
"$",
"tagName",
")",
"{",
"$",
"type",
"=",
"$",
"container",
"->",
"getDefinition",
"(",
"$",
"serviceId",
")",
";",
"$",
"interfaces",
"=",
"c... | Get the class name of default value type.
@param ContainerBuilder $container The container service
@param string $serviceId The service id of default value type
@param string $tagName The tag name
@throws InvalidConfigurationException When the service is not an instance of Fxp\Component\DefaultV... | [
"Get",
"the",
"class",
"name",
"of",
"default",
"value",
"type",
"."
] | f2610281aa59b3d841931dc952af79664a6fc063 | https://github.com/fxpio/fxp-default-value-bundle/blob/f2610281aa59b3d841931dc952af79664a6fc063/DependencyInjection/Compiler/DefaultValuePass.php#L105-L118 | train |
fxpio/fxp-default-value-bundle | DependencyInjection/Compiler/DefaultValuePass.php | DefaultValuePass.buildInstanceType | protected function buildInstanceType(Definition $type, $serviceId, $tagName)
{
$parents = class_parents($type->getClass());
$args = $type->getArguments();
$ref = new \ReflectionClass($type);
if (\in_array(AbstractSimpleType::class, $parents, true)
&& (0 === \count($a... | php | protected function buildInstanceType(Definition $type, $serviceId, $tagName)
{
$parents = class_parents($type->getClass());
$args = $type->getArguments();
$ref = new \ReflectionClass($type);
if (\in_array(AbstractSimpleType::class, $parents, true)
&& (0 === \count($a... | [
"protected",
"function",
"buildInstanceType",
"(",
"Definition",
"$",
"type",
",",
"$",
"serviceId",
",",
"$",
"tagName",
")",
"{",
"$",
"parents",
"=",
"class_parents",
"(",
"$",
"type",
"->",
"getClass",
"(",
")",
")",
";",
"$",
"args",
"=",
"$",
"ty... | Build the simple default type instance.
@param Definition $type The definition of default value type
@param string $serviceId The service id of default value type
@param string $tagName The tag name
@return ObjectTypeInterface | [
"Build",
"the",
"simple",
"default",
"type",
"instance",
"."
] | f2610281aa59b3d841931dc952af79664a6fc063 | https://github.com/fxpio/fxp-default-value-bundle/blob/f2610281aa59b3d841931dc952af79664a6fc063/DependencyInjection/Compiler/DefaultValuePass.php#L129-L141 | train |
fxpio/fxp-default-value-bundle | DependencyInjection/Compiler/DefaultValuePass.php | DefaultValuePass.findResolveTarget | private function findResolveTarget(ContainerBuilder $container, $class)
{
$resolveTargets = $this->getResolveTargets($container);
if (isset($resolveTargets[$class])) {
$class = $resolveTargets[$class];
}
return $class;
} | php | private function findResolveTarget(ContainerBuilder $container, $class)
{
$resolveTargets = $this->getResolveTargets($container);
if (isset($resolveTargets[$class])) {
$class = $resolveTargets[$class];
}
return $class;
} | [
"private",
"function",
"findResolveTarget",
"(",
"ContainerBuilder",
"$",
"container",
",",
"$",
"class",
")",
"{",
"$",
"resolveTargets",
"=",
"$",
"this",
"->",
"getResolveTargets",
"(",
"$",
"container",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"resolveTar... | Find the resolve target of class.
@param ContainerBuilder $container The container
@param string $class The class name
@return string | [
"Find",
"the",
"resolve",
"target",
"of",
"class",
"."
] | f2610281aa59b3d841931dc952af79664a6fc063 | https://github.com/fxpio/fxp-default-value-bundle/blob/f2610281aa59b3d841931dc952af79664a6fc063/DependencyInjection/Compiler/DefaultValuePass.php#L151-L160 | train |
fxpio/fxp-default-value-bundle | DependencyInjection/Compiler/DefaultValuePass.php | DefaultValuePass.replaceResolveTargetClass | private function replaceResolveTargetClass(ContainerBuilder $container, $tagName, $serviceId, $class): void
{
$def = $container->getDefinition($serviceId);
$this->replaceClassInArguments($container, $def, $class);
$this->replaceClassInTags($def, $tagName, $class);
} | php | private function replaceResolveTargetClass(ContainerBuilder $container, $tagName, $serviceId, $class): void
{
$def = $container->getDefinition($serviceId);
$this->replaceClassInArguments($container, $def, $class);
$this->replaceClassInTags($def, $tagName, $class);
} | [
"private",
"function",
"replaceResolveTargetClass",
"(",
"ContainerBuilder",
"$",
"container",
",",
"$",
"tagName",
",",
"$",
"serviceId",
",",
"$",
"class",
")",
":",
"void",
"{",
"$",
"def",
"=",
"$",
"container",
"->",
"getDefinition",
"(",
"$",
"serviceI... | Replace the resolve target class.
@param ContainerBuilder $container The container service
@param string $tagName The tag name
@param string $serviceId The service id of default value type
@param string $class The class name | [
"Replace",
"the",
"resolve",
"target",
"class",
"."
] | f2610281aa59b3d841931dc952af79664a6fc063 | https://github.com/fxpio/fxp-default-value-bundle/blob/f2610281aa59b3d841931dc952af79664a6fc063/DependencyInjection/Compiler/DefaultValuePass.php#L196-L202 | train |
WellCommerce/LocaleBundle | Command/DeleteLocaleCommand.php | DeleteLocaleCommand.deleteLocaleData | protected function deleteLocaleData($localeCode, OutputInterface $output)
{
$entityManager = $this->getDoctrineHelper()->getEntityManager();
$metadata = $this->getDoctrineHelper()->getAllMetadata();
$locale = $this->getLocaleRepository()->findOneBy(['code' => $localeCode]);
... | php | protected function deleteLocaleData($localeCode, OutputInterface $output)
{
$entityManager = $this->getDoctrineHelper()->getEntityManager();
$metadata = $this->getDoctrineHelper()->getAllMetadata();
$locale = $this->getLocaleRepository()->findOneBy(['code' => $localeCode]);
... | [
"protected",
"function",
"deleteLocaleData",
"(",
"$",
"localeCode",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"entityManager",
"=",
"$",
"this",
"->",
"getDoctrineHelper",
"(",
")",
"->",
"getEntityManager",
"(",
")",
";",
"$",
"metadata",
"=",
... | Deletes the locale
@param $localeCode
@param OutputInterface $output | [
"Deletes",
"the",
"locale"
] | da61e059b789ccc748fd3cb0e881780fe6e6d3c6 | https://github.com/WellCommerce/LocaleBundle/blob/da61e059b789ccc748fd3cb0e881780fe6e6d3c6/Command/DeleteLocaleCommand.php#L74-L91 | train |
sil-project/SeedBatchBundle | src/Entity/SeedBatch.php | SeedBatch.setSeedFarm | public function setSeedFarm(\Librinfo\SeedBatchBundle\Entity\SeedFarm $seedFarm = null)
{
$this->seedFarm = $seedFarm;
return $this;
} | php | public function setSeedFarm(\Librinfo\SeedBatchBundle\Entity\SeedFarm $seedFarm = null)
{
$this->seedFarm = $seedFarm;
return $this;
} | [
"public",
"function",
"setSeedFarm",
"(",
"\\",
"Librinfo",
"\\",
"SeedBatchBundle",
"\\",
"Entity",
"\\",
"SeedFarm",
"$",
"seedFarm",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"seedFarm",
"=",
"$",
"seedFarm",
";",
"return",
"$",
"this",
";",
"}"
] | Set seedFarm.
@param \Librinfo\SeedBatchBundle\Entity\SeedFarm $seedFarm
@return SeedBatch | [
"Set",
"seedFarm",
"."
] | a2640b5359fe31d3bdb9c9fa2f72141ac841729c | https://github.com/sil-project/SeedBatchBundle/blob/a2640b5359fe31d3bdb9c9fa2f72141ac841729c/src/Entity/SeedBatch.php#L306-L311 | train |
bit55/midcore | src/Middleware/ErrorHandler.php | ErrorHandler.createErrorHandler | private function createErrorHandler()
{
/**
* @param int $errno
* @param string $errstr
* @param string $errfile
* @param int $errline
* @return void
* @throws \ErrorException if error is not within the error_reporting mask.
*/
return fu... | php | private function createErrorHandler()
{
/**
* @param int $errno
* @param string $errstr
* @param string $errfile
* @param int $errline
* @return void
* @throws \ErrorException if error is not within the error_reporting mask.
*/
return fu... | [
"private",
"function",
"createErrorHandler",
"(",
")",
"{",
"/**\n * @param int $errno\n * @param string $errstr\n * @param string $errfile\n * @param int $errline\n * @return void\n * @throws \\ErrorException if error is not within the error_reporting mas... | Creates and returns a callable error handler that raises exceptions.
Only raises exceptions for errors that are within the error_reporting mask.
@return callable | [
"Creates",
"and",
"returns",
"a",
"callable",
"error",
"handler",
"that",
"raises",
"exceptions",
"."
] | 53f96a82e709918b4691372f0554a6e6f6ba2ae3 | https://github.com/bit55/midcore/blob/53f96a82e709918b4691372f0554a6e6f6ba2ae3/src/Middleware/ErrorHandler.php#L47-L65 | train |
BenGorUser/DoctrineORMBridge | src/BenGorUser/DoctrineORMBridge/Infrastructure/Persistence/EntityManagerFactory.php | EntityManagerFactory.build | public function build($aConnection, array $mappingsPaths = [], $isDevMode = true)
{
if (empty($mappingsPaths)) {
$mappingsPaths = [__DIR__ . '/Mapping'];
}
Type::addType('user_id', UserIdType::class);
Type::addType('user_roles', UserRolesType::class);
return Ent... | php | public function build($aConnection, array $mappingsPaths = [], $isDevMode = true)
{
if (empty($mappingsPaths)) {
$mappingsPaths = [__DIR__ . '/Mapping'];
}
Type::addType('user_id', UserIdType::class);
Type::addType('user_roles', UserRolesType::class);
return Ent... | [
"public",
"function",
"build",
"(",
"$",
"aConnection",
",",
"array",
"$",
"mappingsPaths",
"=",
"[",
"]",
",",
"$",
"isDevMode",
"=",
"true",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"mappingsPaths",
")",
")",
"{",
"$",
"mappingsPaths",
"=",
"[",
"__... | Creates an entity manager instance enabling mappings and custom types.
@param mixed $aConnection Connection parameters as db driver
@param array $mappingsPaths The mapping files diretory paths
@param bool $isDevMode Enables the dev mode, by default is enabled
@return EntityManager | [
"Creates",
"an",
"entity",
"manager",
"instance",
"enabling",
"mappings",
"and",
"custom",
"types",
"."
] | 0ad9799a0d7f3502f5b86292d426d83d9c245c86 | https://github.com/BenGorUser/DoctrineORMBridge/blob/0ad9799a0d7f3502f5b86292d426d83d9c245c86/src/BenGorUser/DoctrineORMBridge/Infrastructure/Persistence/EntityManagerFactory.php#L37-L50 | train |
elifesciences/bus-sdk-php | src/Queue/CachedTransformer.php | CachedTransformer.get | public function get(string $type, string $id)
{
if ($this->shouldCacheEntity($type, $id)) {
$key = $this->getKey($type, $id);
$this->logger->debug('Fetching from cache', [
'type' => $type,
'id' => $id,
'key' => $key,
]);
... | php | public function get(string $type, string $id)
{
if ($this->shouldCacheEntity($type, $id)) {
$key = $this->getKey($type, $id);
$this->logger->debug('Fetching from cache', [
'type' => $type,
'id' => $id,
'key' => $key,
]);
... | [
"public",
"function",
"get",
"(",
"string",
"$",
"type",
",",
"string",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"shouldCacheEntity",
"(",
"$",
"type",
",",
"$",
"id",
")",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getKey",
"(",
... | Get single entity.
This method will return an API SDK item when given an ID and Type.
If the item should be cached ($this->shouldCache) then we check to
see if the item is in the cache.
- If the item IS in the cache we return it, never hitting the ApiSDK.
- If the item IS NOT in the cache but it CAN be cached we requ... | [
"Get",
"single",
"entity",
"."
] | 3af0739fac110e79ea7f21aadf8d17b891f3b918 | https://github.com/elifesciences/bus-sdk-php/blob/3af0739fac110e79ea7f21aadf8d17b891f3b918/src/Queue/CachedTransformer.php#L60-L75 | train |
elifesciences/bus-sdk-php | src/Queue/CachedTransformer.php | CachedTransformer.getFreshDataWithCache | private function getFreshDataWithCache(QueueItem $item)
{
$sdk = $this->getSdk($item);
$entity = $sdk->get($item->getId())->wait(true);
if (false === $this->shouldCacheEntity($item->getType(), $item->getId())) {
return $entity;
}
if ($entity) {
$this->... | php | private function getFreshDataWithCache(QueueItem $item)
{
$sdk = $this->getSdk($item);
$entity = $sdk->get($item->getId())->wait(true);
if (false === $this->shouldCacheEntity($item->getType(), $item->getId())) {
return $entity;
}
if ($entity) {
$this->... | [
"private",
"function",
"getFreshDataWithCache",
"(",
"QueueItem",
"$",
"item",
")",
"{",
"$",
"sdk",
"=",
"$",
"this",
"->",
"getSdk",
"(",
"$",
"item",
")",
";",
"$",
"entity",
"=",
"$",
"sdk",
"->",
"get",
"(",
"$",
"item",
"->",
"getId",
"(",
")... | Get fresh data with cache.
This method call guarantees a fresh copy of them entity in ApiSDK represented
by the QueueItem. If the item should be cached, it will be cached at this point.
@return mixed | [
"Get",
"fresh",
"data",
"with",
"cache",
"."
] | 3af0739fac110e79ea7f21aadf8d17b891f3b918 | https://github.com/elifesciences/bus-sdk-php/blob/3af0739fac110e79ea7f21aadf8d17b891f3b918/src/Queue/CachedTransformer.php#L85-L110 | train |
johnkrovitch/Sam | Task/TaskRunner.php | TaskRunner.run | public function run(Task $task)
{
// get configured filters for this task
$filters = $task
->getConfiguration()
->getParameter('filters');
// get sources files
$sources = $this->fetchSources($task);
$destinations = $this->fetchDestinations($task);
... | php | public function run(Task $task)
{
// get configured filters for this task
$filters = $task
->getConfiguration()
->getParameter('filters');
// get sources files
$sources = $this->fetchSources($task);
$destinations = $this->fetchDestinations($task);
... | [
"public",
"function",
"run",
"(",
"Task",
"$",
"task",
")",
"{",
"// get configured filters for this task",
"$",
"filters",
"=",
"$",
"task",
"->",
"getConfiguration",
"(",
")",
"->",
"getParameter",
"(",
"'filters'",
")",
";",
"// get sources files",
"$",
"sour... | Run a task, load its sources before and call the clean method on the filter.
@param Task $task
@throws Exception | [
"Run",
"a",
"task",
"load",
"its",
"sources",
"before",
"and",
"call",
"the",
"clean",
"method",
"on",
"the",
"filter",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Task/TaskRunner.php#L47-L84 | train |
johnkrovitch/Sam | Task/TaskRunner.php | TaskRunner.getFilter | protected function getFilter($name)
{
// filters must exists in configured filters
if (!array_key_exists($name, $this->filters)) {
throw new Exception('Invalid filter '.$name.'. Check your mapping configuration');
}
return $this->filters[$name];
} | php | protected function getFilter($name)
{
// filters must exists in configured filters
if (!array_key_exists($name, $this->filters)) {
throw new Exception('Invalid filter '.$name.'. Check your mapping configuration');
}
return $this->filters[$name];
} | [
"protected",
"function",
"getFilter",
"(",
"$",
"name",
")",
"{",
"// filters must exists in configured filters",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"filters",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Invali... | Return a filter by its name. Throw an exception if it is not exists.
@param string $name
@return FilterInterface
@throws Exception | [
"Return",
"a",
"filter",
"by",
"its",
"name",
".",
"Throw",
"an",
"exception",
"if",
"it",
"is",
"not",
"exists",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Task/TaskRunner.php#L93-L101 | train |
johnkrovitch/Sam | Task/TaskRunner.php | TaskRunner.fetchSources | protected function fetchSources(Task $task)
{
$sources = [];
foreach ($task->getSources() as $source) {
// locate new resource and merge them to the existing sources
$sources = array_merge($sources, $this->locator->locate($source));
}
return $sources;
} | php | protected function fetchSources(Task $task)
{
$sources = [];
foreach ($task->getSources() as $source) {
// locate new resource and merge them to the existing sources
$sources = array_merge($sources, $this->locator->locate($source));
}
return $sources;
} | [
"protected",
"function",
"fetchSources",
"(",
"Task",
"$",
"task",
")",
"{",
"$",
"sources",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"task",
"->",
"getSources",
"(",
")",
"as",
"$",
"source",
")",
"{",
"// locate new resource and merge them to the existing so... | Fetch the source files from the task and return and array of SplInfo.
@param Task $task
@return array | [
"Fetch",
"the",
"source",
"files",
"from",
"the",
"task",
"and",
"return",
"and",
"array",
"of",
"SplInfo",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Task/TaskRunner.php#L109-L119 | train |
johnkrovitch/Sam | Task/TaskRunner.php | TaskRunner.fetchDestinations | protected function fetchDestinations(Task $task)
{
$sources = [];
foreach ($task->getDestinations() as $source) {
// locate new resource and merge them to the existing sources
$sources[] = new SplFileInfo($source);
}
return $sources;
} | php | protected function fetchDestinations(Task $task)
{
$sources = [];
foreach ($task->getDestinations() as $source) {
// locate new resource and merge them to the existing sources
$sources[] = new SplFileInfo($source);
}
return $sources;
} | [
"protected",
"function",
"fetchDestinations",
"(",
"Task",
"$",
"task",
")",
"{",
"$",
"sources",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"task",
"->",
"getDestinations",
"(",
")",
"as",
"$",
"source",
")",
"{",
"// locate new resource and merge them to the e... | Fetch the destination files from the task and return and array of SplInfo.
@param Task $task
@return SplFileInfo[] | [
"Fetch",
"the",
"destination",
"files",
"from",
"the",
"task",
"and",
"return",
"and",
"array",
"of",
"SplInfo",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Task/TaskRunner.php#L127-L137 | train |
johnkrovitch/Sam | Task/TaskRunner.php | TaskRunner.filterSources | protected function filterSources(array $sources, FilterInterface $filter)
{
$filteredSources = [];
// if the filter supports no extension, there is an error
if (!is_array($filter->getSupportedExtensions()) || !count($filter->getSupportedExtensions())) {
throw new Exception('No s... | php | protected function filterSources(array $sources, FilterInterface $filter)
{
$filteredSources = [];
// if the filter supports no extension, there is an error
if (!is_array($filter->getSupportedExtensions()) || !count($filter->getSupportedExtensions())) {
throw new Exception('No s... | [
"protected",
"function",
"filterSources",
"(",
"array",
"$",
"sources",
",",
"FilterInterface",
"$",
"filter",
")",
"{",
"$",
"filteredSources",
"=",
"[",
"]",
";",
"// if the filter supports no extension, there is an error",
"if",
"(",
"!",
"is_array",
"(",
"$",
... | Filter only the sources supported by the current filter.
@param SplFileInfo[] $sources
@param FilterInterface $filter
@return array
@throws Exception | [
"Filter",
"only",
"the",
"sources",
"supported",
"by",
"the",
"current",
"filter",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Task/TaskRunner.php#L147-L169 | train |
johnkrovitch/Sam | Task/TaskRunner.php | TaskRunner.updateSources | protected function updateSources(array $originalSources, array $filteredSources, array $updatedSources)
{
$sources = [];
$filteredPath = [];
foreach ($filteredSources as $filteredSource) {
$filteredPath[] = $filteredSource->getPath();
}
// keep only the not filte... | php | protected function updateSources(array $originalSources, array $filteredSources, array $updatedSources)
{
$sources = [];
$filteredPath = [];
foreach ($filteredSources as $filteredSource) {
$filteredPath[] = $filteredSource->getPath();
}
// keep only the not filte... | [
"protected",
"function",
"updateSources",
"(",
"array",
"$",
"originalSources",
",",
"array",
"$",
"filteredSources",
",",
"array",
"$",
"updatedSources",
")",
"{",
"$",
"sources",
"=",
"[",
"]",
";",
"$",
"filteredPath",
"=",
"[",
"]",
";",
"foreach",
"("... | Remove the filtered files from the sources, and merge with the new ones.
@param SplFileInfo[] $originalSources
@param SplFileInfo[] $filteredSources
@param SplFileInfo[] $updatedSources
@return SplFileInfo[]
@throws Exception | [
"Remove",
"the",
"filtered",
"files",
"from",
"the",
"sources",
"and",
"merge",
"with",
"the",
"new",
"ones",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Task/TaskRunner.php#L180-L208 | train |
lasallecms/lasallecms-l5-helpers-pkg | src/Images/ImagesHelper.php | ImagesHelper.urlOfImage | public function urlOfImage($filename, $width=300, $height=300)
{
$url = Config::get('app.url');
$url .= '/';
$url .= Config::get('lasallecmsfrontend.images_folder_resized');
$url .= '/';
$url .= $this->parseFilenameIntoResizedFilename($filename, $width, $height);
re... | php | public function urlOfImage($filename, $width=300, $height=300)
{
$url = Config::get('app.url');
$url .= '/';
$url .= Config::get('lasallecmsfrontend.images_folder_resized');
$url .= '/';
$url .= $this->parseFilenameIntoResizedFilename($filename, $width, $height);
re... | [
"public",
"function",
"urlOfImage",
"(",
"$",
"filename",
",",
"$",
"width",
"=",
"300",
",",
"$",
"height",
"=",
"300",
")",
"{",
"$",
"url",
"=",
"Config",
"::",
"get",
"(",
"'app.url'",
")",
";",
"$",
"url",
".=",
"'/'",
";",
"$",
"url",
".=",... | Put together the URL of the image.
Need this for the social media tags for image.
@param string $filename The uploaded image's filename
@parem int $width Width of the resized image
@param int $height Height of the resized image
@return string | [
"Put",
"together",
"the",
"URL",
"of",
"the",
"image",
"."
] | 733967ce3fd81a1efba5265e11663c324ff983c4 | https://github.com/lasallecms/lasallecms-l5-helpers-pkg/blob/733967ce3fd81a1efba5265e11663c324ff983c4/src/Images/ImagesHelper.php#L102-L111 | train |
lasallecms/lasallecms-l5-helpers-pkg | src/Images/ImagesHelper.php | ImagesHelper.parseFilenameIntoResizedFilename | public function parseFilenameIntoResizedFilename($filename, $width=300, $height=300)
{
$fileNameWithNoExtension = $this->filenameWithNoExtension($filename);
$fileNameExtension = $this->filenameWithExtensionOnly($filename);
$parsedFilename = "";
$parsedFilename .= $fileNameWit... | php | public function parseFilenameIntoResizedFilename($filename, $width=300, $height=300)
{
$fileNameWithNoExtension = $this->filenameWithNoExtension($filename);
$fileNameExtension = $this->filenameWithExtensionOnly($filename);
$parsedFilename = "";
$parsedFilename .= $fileNameWit... | [
"public",
"function",
"parseFilenameIntoResizedFilename",
"(",
"$",
"filename",
",",
"$",
"width",
"=",
"300",
",",
"$",
"height",
"=",
"300",
")",
"{",
"$",
"fileNameWithNoExtension",
"=",
"$",
"this",
"->",
"filenameWithNoExtension",
"(",
"$",
"filename",
")... | Take an image's filename, and return the name of the resized file.
For use within the "single post" blade file.
Does *NOT* create the resized image file.
@param string $filename The uploaded image's filename
@parem int $width Width of the resized image
@param int $he... | [
"Take",
"an",
"image",
"s",
"filename",
"and",
"return",
"the",
"name",
"of",
"the",
"resized",
"file",
"."
] | 733967ce3fd81a1efba5265e11663c324ff983c4 | https://github.com/lasallecms/lasallecms-l5-helpers-pkg/blob/733967ce3fd81a1efba5265e11663c324ff983c4/src/Images/ImagesHelper.php#L126-L141 | train |
lasallecms/lasallecms-l5-helpers-pkg | src/Images/ImagesHelper.php | ImagesHelper.categoryImageResizedFilename | public function categoryImageResizedFilename($categoryFeaturedImage)
{
// grab the image sizes to create from the config
$imageSizes = Config::get('lasallecmsfrontend.category_featured_image_size');
// filename
$fileNameWithNoExtension = $this->filenameWithNoExtension($categoryFeatu... | php | public function categoryImageResizedFilename($categoryFeaturedImage)
{
// grab the image sizes to create from the config
$imageSizes = Config::get('lasallecmsfrontend.category_featured_image_size');
// filename
$fileNameWithNoExtension = $this->filenameWithNoExtension($categoryFeatu... | [
"public",
"function",
"categoryImageResizedFilename",
"(",
"$",
"categoryFeaturedImage",
")",
"{",
"// grab the image sizes to create from the config",
"$",
"imageSizes",
"=",
"Config",
"::",
"get",
"(",
"'lasallecmsfrontend.category_featured_image_size'",
")",
";",
"// filenam... | What is the name of the resized category featured image that the view will use?
Does not actually resize the image!
ASSUMES THAT THERE IS JUST ONE RESIZED CATEGORY IMAGE
@param string $categoryFeaturedImage The category's featured image (that is in the categories table)
@return string | [
"What",
"is",
"the",
"name",
"of",
"the",
"resized",
"category",
"featured",
"image",
"that",
"the",
"view",
"will",
"use?"
] | 733967ce3fd81a1efba5265e11663c324ff983c4 | https://github.com/lasallecms/lasallecms-l5-helpers-pkg/blob/733967ce3fd81a1efba5265e11663c324ff983c4/src/Images/ImagesHelper.php#L192-L206 | train |
lasallecms/lasallecms-l5-helpers-pkg | src/Images/ImagesHelper.php | ImagesHelper.createCategoryResizedImageFiles | public function createCategoryResizedImageFiles($filename)
{
// Use the default or a specified category featured image
$filename = $this->categoryImageDefaultOrSpecified($filename);
// grab the image sizes to create from the config
$imageSizes = Config::get('lasallecmsfrontend.categ... | php | public function createCategoryResizedImageFiles($filename)
{
// Use the default or a specified category featured image
$filename = $this->categoryImageDefaultOrSpecified($filename);
// grab the image sizes to create from the config
$imageSizes = Config::get('lasallecmsfrontend.categ... | [
"public",
"function",
"createCategoryResizedImageFiles",
"(",
"$",
"filename",
")",
"{",
"// Use the default or a specified category featured image",
"$",
"filename",
"=",
"$",
"this",
"->",
"categoryImageDefaultOrSpecified",
"(",
"$",
"filename",
")",
";",
"// grab the ima... | Create resized image files for the category featured image
@param string $filename Category's UN-resized image's filename
@return void | [
"Create",
"resized",
"image",
"files",
"for",
"the",
"category",
"featured",
"image"
] | 733967ce3fd81a1efba5265e11663c324ff983c4 | https://github.com/lasallecms/lasallecms-l5-helpers-pkg/blob/733967ce3fd81a1efba5265e11663c324ff983c4/src/Images/ImagesHelper.php#L216-L233 | train |
lasallecms/lasallecms-l5-helpers-pkg | src/Images/ImagesHelper.php | ImagesHelper.tagImageResizedFilename | public function tagImageResizedFilename($defaultTagImage)
{
// grab the image sizes to create from the config
$imageSizes = Config::get('lasallecmsfrontend.default_tag_image_image_size');
// filename
$fileNameWithNoExtension = $this->filenameWithNoExtension($defaultTagImage);
... | php | public function tagImageResizedFilename($defaultTagImage)
{
// grab the image sizes to create from the config
$imageSizes = Config::get('lasallecmsfrontend.default_tag_image_image_size');
// filename
$fileNameWithNoExtension = $this->filenameWithNoExtension($defaultTagImage);
... | [
"public",
"function",
"tagImageResizedFilename",
"(",
"$",
"defaultTagImage",
")",
"{",
"// grab the image sizes to create from the config",
"$",
"imageSizes",
"=",
"Config",
"::",
"get",
"(",
"'lasallecmsfrontend.default_tag_image_image_size'",
")",
";",
"// filename",
"$",
... | What is the name of the resized tag default image that the view will use?
Does not actually resize the image!
@param string $defaultTagImage The defaul_tag_image config setting
@return string | [
"What",
"is",
"the",
"name",
"of",
"the",
"resized",
"tag",
"default",
"image",
"that",
"the",
"view",
"will",
"use?"
] | 733967ce3fd81a1efba5265e11663c324ff983c4 | https://github.com/lasallecms/lasallecms-l5-helpers-pkg/blob/733967ce3fd81a1efba5265e11663c324ff983c4/src/Images/ImagesHelper.php#L250-L264 | train |
lasallecms/lasallecms-l5-helpers-pkg | src/Images/ImagesHelper.php | ImagesHelper.tagResizedImageFiles | public function tagResizedImageFiles($defaultTagImage)
{
// grab the image sizes to create from the config
$imageSizes = Config::get('lasallecmsfrontend.default_tag_image_image_size');
// iterate through the sizes to create new image files for each size
foreach ($imageSizes as $widt... | php | public function tagResizedImageFiles($defaultTagImage)
{
// grab the image sizes to create from the config
$imageSizes = Config::get('lasallecmsfrontend.default_tag_image_image_size');
// iterate through the sizes to create new image files for each size
foreach ($imageSizes as $widt... | [
"public",
"function",
"tagResizedImageFiles",
"(",
"$",
"defaultTagImage",
")",
"{",
"// grab the image sizes to create from the config",
"$",
"imageSizes",
"=",
"Config",
"::",
"get",
"(",
"'lasallecmsfrontend.default_tag_image_image_size'",
")",
";",
"// iterate through the s... | Create resized image files for the tag default image
@param string $defaultTagImage The defaul_tag_image config setting
@return void | [
"Create",
"resized",
"image",
"files",
"for",
"the",
"tag",
"default",
"image"
] | 733967ce3fd81a1efba5265e11663c324ff983c4 | https://github.com/lasallecms/lasallecms-l5-helpers-pkg/blob/733967ce3fd81a1efba5265e11663c324ff983c4/src/Images/ImagesHelper.php#L274-L288 | train |
lasallecms/lasallecms-l5-helpers-pkg | src/Images/ImagesHelper.php | ImagesHelper.resize | public function resize($filename, $width, $height)
{
// open an image file
$img = Image::make($this->pathOfImagesUploadFolder() .'/'. $filename);
// resize image
// http://image.intervention.io/api/resize
// closure prevents possible upsizing
$img->resize($width, $he... | php | public function resize($filename, $width, $height)
{
// open an image file
$img = Image::make($this->pathOfImagesUploadFolder() .'/'. $filename);
// resize image
// http://image.intervention.io/api/resize
// closure prevents possible upsizing
$img->resize($width, $he... | [
"public",
"function",
"resize",
"(",
"$",
"filename",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"// open an image file",
"$",
"img",
"=",
"Image",
"::",
"make",
"(",
"$",
"this",
"->",
"pathOfImagesUploadFolder",
"(",
")",
".",
"'/'",
".",
"$",
... | Resize the image using the terrific Intervention package
@param string $filename Image filename
@param int $width Resized width
@param int $height Resized height
@return void | [
"Resize",
"the",
"image",
"using",
"the",
"terrific",
"Intervention",
"package"
] | 733967ce3fd81a1efba5265e11663c324ff983c4 | https://github.com/lasallecms/lasallecms-l5-helpers-pkg/blob/733967ce3fd81a1efba5265e11663c324ff983c4/src/Images/ImagesHelper.php#L304-L318 | train |
lasallecms/lasallecms-l5-helpers-pkg | src/Images/ImagesHelper.php | ImagesHelper.pathFilenameOfResizedImage | public function pathFilenameOfResizedImage($filename, $width, $height)
{
$path = $this->pathOfImagesResizedFolder();
$filenameWithNoExtension = $this->filenameWithNoExtension($filename);
$filenameWithExtensionOnly = $this->filenameWithExtensionOnly($filename);
... | php | public function pathFilenameOfResizedImage($filename, $width, $height)
{
$path = $this->pathOfImagesResizedFolder();
$filenameWithNoExtension = $this->filenameWithNoExtension($filename);
$filenameWithExtensionOnly = $this->filenameWithExtensionOnly($filename);
... | [
"public",
"function",
"pathFilenameOfResizedImage",
"(",
"$",
"filename",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"pathOfImagesResizedFolder",
"(",
")",
";",
"$",
"filenameWithNoExtension",
"=",
"$",
"this",
"->"... | Put together the path + name of the resized imaged.
@param string $filename Image filename
@param int $width Resized width
@param int $height Resized height
@return string | [
"Put",
"together",
"the",
"path",
"+",
"name",
"of",
"the",
"resized",
"imaged",
"."
] | 733967ce3fd81a1efba5265e11663c324ff983c4 | https://github.com/lasallecms/lasallecms-l5-helpers-pkg/blob/733967ce3fd81a1efba5265e11663c324ff983c4/src/Images/ImagesHelper.php#L357-L374 | train |
wobblecode/WobbleCodeUserBundle | Document/Contact.php | Contact.getServiceProfile | public function getServiceProfile($service)
{
if (isset($this->serviceProfiles[$service])) {
return $this->serviceProfiles[$service];
}
return null;
} | php | public function getServiceProfile($service)
{
if (isset($this->serviceProfiles[$service])) {
return $this->serviceProfiles[$service];
}
return null;
} | [
"public",
"function",
"getServiceProfile",
"(",
"$",
"service",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"serviceProfiles",
"[",
"$",
"service",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"serviceProfiles",
"[",
"$",
"service",
"]",
... | Get service profile data
@param string $service
@return array|null | [
"Get",
"service",
"profile",
"data"
] | 7b8206f8b4a50fbc61f7bfe4f83eb466cad96440 | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Contact.php#L775-L782 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.