id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
33,600 | silverorange/swat | Swat/SwatTableViewOrderableColumn.php | SwatTableViewOrderableColumn.initFromGetVariables | private function initFromGetVariables()
{
$key_orderby = $this->getLinkPrefix() . 'orderby';
$key_orderbydir = $this->getLinkPrefix() . 'orderbydir';
if (isset($_GET[$key_orderby]) && $_GET[$key_orderby] == $this->id) {
$this->view->orderby_column = $this;
if (isset($_GET[$key_orderbydir])) {
$this->setDirectionByString($_GET[$key_orderbydir]);
}
}
} | php | private function initFromGetVariables()
{
$key_orderby = $this->getLinkPrefix() . 'orderby';
$key_orderbydir = $this->getLinkPrefix() . 'orderbydir';
if (isset($_GET[$key_orderby]) && $_GET[$key_orderby] == $this->id) {
$this->view->orderby_column = $this;
if (isset($_GET[$key_orderbydir])) {
$this->setDirectionByString($_GET[$key_orderbydir]);
}
}
} | [
"private",
"function",
"initFromGetVariables",
"(",
")",
"{",
"$",
"key_orderby",
"=",
"$",
"this",
"->",
"getLinkPrefix",
"(",
")",
".",
"'orderby'",
";",
"$",
"key_orderbydir",
"=",
"$",
"this",
"->",
"getLinkPrefix",
"(",
")",
".",
"'orderbydir'",
";",
"if",
"(",
"isset",
"(",
"$",
"_GET",
"[",
"$",
"key_orderby",
"]",
")",
"&&",
"$",
"_GET",
"[",
"$",
"key_orderby",
"]",
"==",
"$",
"this",
"->",
"id",
")",
"{",
"$",
"this",
"->",
"view",
"->",
"orderby_column",
"=",
"$",
"this",
";",
"if",
"(",
"isset",
"(",
"$",
"_GET",
"[",
"$",
"key_orderbydir",
"]",
")",
")",
"{",
"$",
"this",
"->",
"setDirectionByString",
"(",
"$",
"_GET",
"[",
"$",
"key_orderbydir",
"]",
")",
";",
"}",
"}",
"}"
] | Process GET variables and set class variables | [
"Process",
"GET",
"variables",
"and",
"set",
"class",
"variables"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewOrderableColumn.php#L475-L487 |
33,601 | zeroem/ZeroemCurlBundle | Curl/MultiManager.php | MultiManager.addRequest | public function addRequest(Request $request) {
$oid = spl_object_hash($request);
if(!isset($this->requests[$oid])) {
$this->requests[$oid] = $request;
curl_multi_add_handle($this->handle, $request->getHandle());
}
return $this;
} | php | public function addRequest(Request $request) {
$oid = spl_object_hash($request);
if(!isset($this->requests[$oid])) {
$this->requests[$oid] = $request;
curl_multi_add_handle($this->handle, $request->getHandle());
}
return $this;
} | [
"public",
"function",
"addRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"oid",
"=",
"spl_object_hash",
"(",
"$",
"request",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"requests",
"[",
"$",
"oid",
"]",
")",
")",
"{",
"$",
"this",
"->",
"requests",
"[",
"$",
"oid",
"]",
"=",
"$",
"request",
";",
"curl_multi_add_handle",
"(",
"$",
"this",
"->",
"handle",
",",
"$",
"request",
"->",
"getHandle",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Add a cURL request to be processed in parallel
Alias of the curl_multi_add_handle function
@param Request $request A Request object to be executed
@return MultiManager $this | [
"Add",
"a",
"cURL",
"request",
"to",
"be",
"processed",
"in",
"parallel"
] | 1045e2093bec5a013ff9458828721e581725f1a0 | https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/MultiManager.php#L86-L95 |
33,602 | zeroem/ZeroemCurlBundle | Curl/MultiManager.php | MultiManager.removeRequest | public function removeRequest(Request $request) {
$oid = spl_object_hash($request);
$result = false;
if(isset($this->requests[$oid])) {
unset($this->requests[$oid]);
$result = $request;
curl_multi_remove_handle($this->handle, $request->getHandle());
}
return $result;
} | php | public function removeRequest(Request $request) {
$oid = spl_object_hash($request);
$result = false;
if(isset($this->requests[$oid])) {
unset($this->requests[$oid]);
$result = $request;
curl_multi_remove_handle($this->handle, $request->getHandle());
}
return $result;
} | [
"public",
"function",
"removeRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"oid",
"=",
"spl_object_hash",
"(",
"$",
"request",
")",
";",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"requests",
"[",
"$",
"oid",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"requests",
"[",
"$",
"oid",
"]",
")",
";",
"$",
"result",
"=",
"$",
"request",
";",
"curl_multi_remove_handle",
"(",
"$",
"this",
"->",
"handle",
",",
"$",
"request",
"->",
"getHandle",
"(",
")",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
] | Remove a request from the execution stack
Analogous to the curl_multi_remove_handle function
@param Request $request The Request to be removed
@return Request|boolean the request that was removed or false if the request isn't managed by this object | [
"Remove",
"a",
"request",
"from",
"the",
"execution",
"stack"
] | 1045e2093bec5a013ff9458828721e581725f1a0 | https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/MultiManager.php#L105-L116 |
33,603 | zeroem/ZeroemCurlBundle | Curl/MultiManager.php | MultiManager.execute | public function execute() {
if($this->blocking) {
return $this->executeBlocking();
} else {
return $this->errorCheck(
curl_multi_exec($this->handle,$active)
);
}
} | php | public function execute() {
if($this->blocking) {
return $this->executeBlocking();
} else {
return $this->errorCheck(
curl_multi_exec($this->handle,$active)
);
}
} | [
"public",
"function",
"execute",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"blocking",
")",
"{",
"return",
"$",
"this",
"->",
"executeBlocking",
"(",
")",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"errorCheck",
"(",
"curl_multi_exec",
"(",
"$",
"this",
"->",
"handle",
",",
"$",
"active",
")",
")",
";",
"}",
"}"
] | Execute the registered Request objects in parallel
Analogous to curl_multi_exec
@return int the result of curl_multi_exec
@throws CurlErrorException | [
"Execute",
"the",
"registered",
"Request",
"objects",
"in",
"parallel"
] | 1045e2093bec5a013ff9458828721e581725f1a0 | https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/MultiManager.php#L138-L146 |
33,604 | zeroem/ZeroemCurlBundle | Curl/MultiManager.php | MultiManager.processInfo | private function processInfo(array $info) {
$request = $this->findRequest($info["handle"]);
if(isset($this->dispatcher) && false !== $request) {
$this->dispatcher->dispatch(
CurlEvents::MULTI_INFO,
new MultiInfoEvent(
$this,
$request,
new MultiInfo($info)
)
);
}
} | php | private function processInfo(array $info) {
$request = $this->findRequest($info["handle"]);
if(isset($this->dispatcher) && false !== $request) {
$this->dispatcher->dispatch(
CurlEvents::MULTI_INFO,
new MultiInfoEvent(
$this,
$request,
new MultiInfo($info)
)
);
}
} | [
"private",
"function",
"processInfo",
"(",
"array",
"$",
"info",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"findRequest",
"(",
"$",
"info",
"[",
"\"handle\"",
"]",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"dispatcher",
")",
"&&",
"false",
"!==",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"dispatcher",
"->",
"dispatch",
"(",
"CurlEvents",
"::",
"MULTI_INFO",
",",
"new",
"MultiInfoEvent",
"(",
"$",
"this",
",",
"$",
"request",
",",
"new",
"MultiInfo",
"(",
"$",
"info",
")",
")",
")",
";",
"}",
"}"
] | Process and callbacks associated with the handle returned by
curl_multi_info_read
@param array $info data array from curl_multi_info_read | [
"Process",
"and",
"callbacks",
"associated",
"with",
"the",
"handle",
"returned",
"by",
"curl_multi_info_read"
] | 1045e2093bec5a013ff9458828721e581725f1a0 | https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/MultiManager.php#L192-L205 |
33,605 | zeroem/ZeroemCurlBundle | Curl/MultiManager.php | MultiManager.findRequest | public function findRequest($handle) {
foreach($this->requests as $request) {
if($handle === $request->getHandle()) {
return $request;
}
}
return false;
} | php | public function findRequest($handle) {
foreach($this->requests as $request) {
if($handle === $request->getHandle()) {
return $request;
}
}
return false;
} | [
"public",
"function",
"findRequest",
"(",
"$",
"handle",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"requests",
"as",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"handle",
"===",
"$",
"request",
"->",
"getHandle",
"(",
")",
")",
"{",
"return",
"$",
"request",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Given a cURL handle, locate the request object associated with it
@param resource $handle a cURL handle
@return Request|boolean the associated Request object or false if it is not found | [
"Given",
"a",
"cURL",
"handle",
"locate",
"the",
"request",
"object",
"associated",
"with",
"it"
] | 1045e2093bec5a013ff9458828721e581725f1a0 | https://github.com/zeroem/ZeroemCurlBundle/blob/1045e2093bec5a013ff9458828721e581725f1a0/Curl/MultiManager.php#L213-L221 |
33,606 | brainworxx/kreXX | src/Service/Factory/Event.php | Event.dispatch | public function dispatch($name, AbstractCallback $callback, Model $model = null)
{
if (isset($this->register[$name]) === false) {
// No registered handler. Early return.
return '';
}
$output = '';
// Got to handel them all.
foreach ($this->register[$name] as $classname) {
$output .= $this->pool->createClass($classname)->handle($callback, $model);
}
return $output;
} | php | public function dispatch($name, AbstractCallback $callback, Model $model = null)
{
if (isset($this->register[$name]) === false) {
// No registered handler. Early return.
return '';
}
$output = '';
// Got to handel them all.
foreach ($this->register[$name] as $classname) {
$output .= $this->pool->createClass($classname)->handle($callback, $model);
}
return $output;
} | [
"public",
"function",
"dispatch",
"(",
"$",
"name",
",",
"AbstractCallback",
"$",
"callback",
",",
"Model",
"$",
"model",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"register",
"[",
"$",
"name",
"]",
")",
"===",
"false",
")",
"{",
"// No registered handler. Early return.",
"return",
"''",
";",
"}",
"$",
"output",
"=",
"''",
";",
"// Got to handel them all.",
"foreach",
"(",
"$",
"this",
"->",
"register",
"[",
"$",
"name",
"]",
"as",
"$",
"classname",
")",
"{",
"$",
"output",
".=",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"$",
"classname",
")",
"->",
"handle",
"(",
"$",
"callback",
",",
"$",
"model",
")",
";",
"}",
"return",
"$",
"output",
";",
"}"
] | Dispatches an event.
@param string $name
The name of the event.
@param AbstractCallback $callback
The parameters for the callback.
@param \Brainworxx\Krexx\Analyse\Model|null $model
The model so far, if available.
@return string
The generated markup from the event handlers
This will only get dispatched, if you use the start event. | [
"Dispatches",
"an",
"event",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Factory/Event.php#L90-L105 |
33,607 | TypiCMS/Menus | src/Repositories/EloquentMenu.php | EloquentMenu.prepare | public function prepare($items = null)
{
$items->each(function ($item) {
$item->items = collect();
if ($item->has_categories) {
$item->items = $this->prepare(ProjectCategories::allForMenu($item->page->uri()));
}
$item->href = $this->setHref($item);
$item->class = $this->setClass($item);
});
return $items;
} | php | public function prepare($items = null)
{
$items->each(function ($item) {
$item->items = collect();
if ($item->has_categories) {
$item->items = $this->prepare(ProjectCategories::allForMenu($item->page->uri()));
}
$item->href = $this->setHref($item);
$item->class = $this->setClass($item);
});
return $items;
} | [
"public",
"function",
"prepare",
"(",
"$",
"items",
"=",
"null",
")",
"{",
"$",
"items",
"->",
"each",
"(",
"function",
"(",
"$",
"item",
")",
"{",
"$",
"item",
"->",
"items",
"=",
"collect",
"(",
")",
";",
"if",
"(",
"$",
"item",
"->",
"has_categories",
")",
"{",
"$",
"item",
"->",
"items",
"=",
"$",
"this",
"->",
"prepare",
"(",
"ProjectCategories",
"::",
"allForMenu",
"(",
"$",
"item",
"->",
"page",
"->",
"uri",
"(",
")",
")",
")",
";",
"}",
"$",
"item",
"->",
"href",
"=",
"$",
"this",
"->",
"setHref",
"(",
"$",
"item",
")",
";",
"$",
"item",
"->",
"class",
"=",
"$",
"this",
"->",
"setClass",
"(",
"$",
"item",
")",
";",
"}",
")",
";",
"return",
"$",
"items",
";",
"}"
] | Set href and classes for each items in collection.
@param $items
@return \TypiCMS\NestableCollection | [
"Set",
"href",
"and",
"classes",
"for",
"each",
"items",
"in",
"collection",
"."
] | 628211bf23dfd035c85140e5a6ad28882bed50cb | https://github.com/TypiCMS/Menus/blob/628211bf23dfd035c85140e5a6ad28882bed50cb/src/Repositories/EloquentMenu.php#L82-L94 |
33,608 | TypiCMS/Menus | src/Repositories/EloquentMenu.php | EloquentMenu.setHref | public function setHref($menulink)
{
if ($menulink->url) {
return $menulink->url;
}
if ($menulink->page) {
return $menulink->page->uri();
}
return '/';
} | php | public function setHref($menulink)
{
if ($menulink->url) {
return $menulink->url;
}
if ($menulink->page) {
return $menulink->page->uri();
}
return '/';
} | [
"public",
"function",
"setHref",
"(",
"$",
"menulink",
")",
"{",
"if",
"(",
"$",
"menulink",
"->",
"url",
")",
"{",
"return",
"$",
"menulink",
"->",
"url",
";",
"}",
"if",
"(",
"$",
"menulink",
"->",
"page",
")",
"{",
"return",
"$",
"menulink",
"->",
"page",
"->",
"uri",
"(",
")",
";",
"}",
"return",
"'/'",
";",
"}"
] | 1. If menulink has url field, take it.
2. If menulink has a page, take the uri of the page in the current locale.
@param $menulink
@return string uri | [
"1",
".",
"If",
"menulink",
"has",
"url",
"field",
"take",
"it",
".",
"2",
".",
"If",
"menulink",
"has",
"a",
"page",
"take",
"the",
"uri",
"of",
"the",
"page",
"in",
"the",
"current",
"locale",
"."
] | 628211bf23dfd035c85140e5a6ad28882bed50cb | https://github.com/TypiCMS/Menus/blob/628211bf23dfd035c85140e5a6ad28882bed50cb/src/Repositories/EloquentMenu.php#L104-L114 |
33,609 | TypiCMS/Menus | src/Repositories/EloquentMenu.php | EloquentMenu.setClass | public function setClass($menulink)
{
$classArray = preg_split('/ /', $menulink->class, null, PREG_SPLIT_NO_EMPTY);
// add active class if current uri is equal to item uri or contains
// item uri and is bigger than 3 to avoid homepage link always active ('/', '/lg')
$pattern = $menulink->href;
if (strlen($menulink->href) > 3) {
$pattern .= '*';
}
if (request()->is($pattern)) {
$classArray[] = 'active';
}
return implode(' ', $classArray);
} | php | public function setClass($menulink)
{
$classArray = preg_split('/ /', $menulink->class, null, PREG_SPLIT_NO_EMPTY);
// add active class if current uri is equal to item uri or contains
// item uri and is bigger than 3 to avoid homepage link always active ('/', '/lg')
$pattern = $menulink->href;
if (strlen($menulink->href) > 3) {
$pattern .= '*';
}
if (request()->is($pattern)) {
$classArray[] = 'active';
}
return implode(' ', $classArray);
} | [
"public",
"function",
"setClass",
"(",
"$",
"menulink",
")",
"{",
"$",
"classArray",
"=",
"preg_split",
"(",
"'/ /'",
",",
"$",
"menulink",
"->",
"class",
",",
"null",
",",
"PREG_SPLIT_NO_EMPTY",
")",
";",
"// add active class if current uri is equal to item uri or contains",
"// item uri and is bigger than 3 to avoid homepage link always active ('/', '/lg')",
"$",
"pattern",
"=",
"$",
"menulink",
"->",
"href",
";",
"if",
"(",
"strlen",
"(",
"$",
"menulink",
"->",
"href",
")",
">",
"3",
")",
"{",
"$",
"pattern",
".=",
"'*'",
";",
"}",
"if",
"(",
"request",
"(",
")",
"->",
"is",
"(",
"$",
"pattern",
")",
")",
"{",
"$",
"classArray",
"[",
"]",
"=",
"'active'",
";",
"}",
"return",
"implode",
"(",
"' '",
",",
"$",
"classArray",
")",
";",
"}"
] | Take the classes from field and add active if needed.
@param $menulink
@return string classes | [
"Take",
"the",
"classes",
"from",
"field",
"and",
"add",
"active",
"if",
"needed",
"."
] | 628211bf23dfd035c85140e5a6ad28882bed50cb | https://github.com/TypiCMS/Menus/blob/628211bf23dfd035c85140e5a6ad28882bed50cb/src/Repositories/EloquentMenu.php#L123-L137 |
33,610 | FreeDSx/Socket | src/FreeDSx/Socket/Socket.php | Socket.create | public static function create(string $host, array $options = []) : Socket
{
return (new self(null, $options))->connect($host);
} | php | public static function create(string $host, array $options = []) : Socket
{
return (new self(null, $options))->connect($host);
} | [
"public",
"static",
"function",
"create",
"(",
"string",
"$",
"host",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
":",
"Socket",
"{",
"return",
"(",
"new",
"self",
"(",
"null",
",",
"$",
"options",
")",
")",
"->",
"connect",
"(",
"$",
"host",
")",
";",
"}"
] | Create a socket by connecting to a specific host.
@param string $host
@param array $options
@return Socket
@throws ConnectionException | [
"Create",
"a",
"socket",
"by",
"connecting",
"to",
"a",
"specific",
"host",
"."
] | d74683bf8b827e91a8ca051805c55dacaf64f93d | https://github.com/FreeDSx/Socket/blob/d74683bf8b827e91a8ca051805c55dacaf64f93d/src/FreeDSx/Socket/Socket.php#L264-L267 |
33,611 | FreeDSx/Socket | src/FreeDSx/Socket/Socket.php | Socket.tcp | public static function tcp(string $host, array $options = []) : Socket
{
return self::create($host, \array_merge($options, ['transport' => 'tcp']));
} | php | public static function tcp(string $host, array $options = []) : Socket
{
return self::create($host, \array_merge($options, ['transport' => 'tcp']));
} | [
"public",
"static",
"function",
"tcp",
"(",
"string",
"$",
"host",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
":",
"Socket",
"{",
"return",
"self",
"::",
"create",
"(",
"$",
"host",
",",
"\\",
"array_merge",
"(",
"$",
"options",
",",
"[",
"'transport'",
"=>",
"'tcp'",
"]",
")",
")",
";",
"}"
] | Create a TCP based socket.
@param string $host
@param array $options
@return Socket
@throws ConnectionException | [
"Create",
"a",
"TCP",
"based",
"socket",
"."
] | d74683bf8b827e91a8ca051805c55dacaf64f93d | https://github.com/FreeDSx/Socket/blob/d74683bf8b827e91a8ca051805c55dacaf64f93d/src/FreeDSx/Socket/Socket.php#L277-L280 |
33,612 | FreeDSx/Socket | src/FreeDSx/Socket/Socket.php | Socket.udp | public static function udp(string $host, array $options = []) : Socket
{
return self::create($host, \array_merge($options, [
'transport' => 'udp',
'buffer_size' => 65507,
]));
} | php | public static function udp(string $host, array $options = []) : Socket
{
return self::create($host, \array_merge($options, [
'transport' => 'udp',
'buffer_size' => 65507,
]));
} | [
"public",
"static",
"function",
"udp",
"(",
"string",
"$",
"host",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
":",
"Socket",
"{",
"return",
"self",
"::",
"create",
"(",
"$",
"host",
",",
"\\",
"array_merge",
"(",
"$",
"options",
",",
"[",
"'transport'",
"=>",
"'udp'",
",",
"'buffer_size'",
"=>",
"65507",
",",
"]",
")",
")",
";",
"}"
] | Create a UDP based socket.
@param string $host
@param array $options
@return Socket
@throws ConnectionException | [
"Create",
"a",
"UDP",
"based",
"socket",
"."
] | d74683bf8b827e91a8ca051805c55dacaf64f93d | https://github.com/FreeDSx/Socket/blob/d74683bf8b827e91a8ca051805c55dacaf64f93d/src/FreeDSx/Socket/Socket.php#L290-L296 |
33,613 | silverorange/swat | Swat/SwatListEntry.php | SwatListEntry.display | public function display()
{
if (!$this->visible) {
return;
}
// Do not have a maxlength on the XHTML input tag. This relies on
// internal knowledge of the parent::display() method.
$old_maxlength = $this->maxlength;
$this->maxlength = null;
parent::display();
$this->maxlength = $old_maxlength;
} | php | public function display()
{
if (!$this->visible) {
return;
}
// Do not have a maxlength on the XHTML input tag. This relies on
// internal knowledge of the parent::display() method.
$old_maxlength = $this->maxlength;
$this->maxlength = null;
parent::display();
$this->maxlength = $old_maxlength;
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"// Do not have a maxlength on the XHTML input tag. This relies on",
"// internal knowledge of the parent::display() method.",
"$",
"old_maxlength",
"=",
"$",
"this",
"->",
"maxlength",
";",
"$",
"this",
"->",
"maxlength",
"=",
"null",
";",
"parent",
"::",
"display",
"(",
")",
";",
"$",
"this",
"->",
"maxlength",
"=",
"$",
"old_maxlength",
";",
"}"
] | Displays this list entry | [
"Displays",
"this",
"list",
"entry"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatListEntry.php#L98-L112 |
33,614 | silverorange/swat | Swat/SwatListEntry.php | SwatListEntry.setState | public function setState($values)
{
if (is_array($values)) {
$this->values = $values;
} else {
$this->values = $this->splitValues($values);
}
} | php | public function setState($values)
{
if (is_array($values)) {
$this->values = $values;
} else {
$this->values = $this->splitValues($values);
}
} | [
"public",
"function",
"setState",
"(",
"$",
"values",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"values",
")",
")",
"{",
"$",
"this",
"->",
"values",
"=",
"$",
"values",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"values",
"=",
"$",
"this",
"->",
"splitValues",
"(",
"$",
"values",
")",
";",
"}",
"}"
] | Sets the current state of this list entry widget
@param string $state the new state of this list entry widget.
@see SwatState::setState() | [
"Sets",
"the",
"current",
"state",
"of",
"this",
"list",
"entry",
"widget"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatListEntry.php#L260-L267 |
33,615 | silverorange/swat | Swat/SwatListEntry.php | SwatListEntry.getDisplayValue | protected function getDisplayValue($value)
{
if ($this->trim_whitespace && $this->delimiter != ' ') {
return implode($this->delimiter . ' ', $this->values);
} else {
return implode($this->delimiter, $this->values);
}
} | php | protected function getDisplayValue($value)
{
if ($this->trim_whitespace && $this->delimiter != ' ') {
return implode($this->delimiter . ' ', $this->values);
} else {
return implode($this->delimiter, $this->values);
}
} | [
"protected",
"function",
"getDisplayValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"trim_whitespace",
"&&",
"$",
"this",
"->",
"delimiter",
"!=",
"' '",
")",
"{",
"return",
"implode",
"(",
"$",
"this",
"->",
"delimiter",
".",
"' '",
",",
"$",
"this",
"->",
"values",
")",
";",
"}",
"else",
"{",
"return",
"implode",
"(",
"$",
"this",
"->",
"delimiter",
",",
"$",
"this",
"->",
"values",
")",
";",
"}",
"}"
] | Gets the value displayed in the XHTML input
For list entry, this is a delimiter separated string containing the
elements of {@link SwatListEntry::$values}.
@param array $value the value to format for display.
@return string the values displayed in the XHTML input. | [
"Gets",
"the",
"value",
"displayed",
"in",
"the",
"XHTML",
"input"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatListEntry.php#L282-L289 |
33,616 | silverorange/swat | Swat/SwatListEntry.php | SwatListEntry.getNote | public function getNote()
{
$message = null;
$locale = SwatI18NLocale::get();
if (
$this->max_entries !== null &&
$this->max_entries > 0 &&
$this->min_entries === null
) {
$message = new SwatMessage(
sprintf(
Swat::ngettext(
'List can contain at most %s entry',
'List can contain at most %s entries',
$this->max_entries
),
$locale->formatNumber($this->max_entries)
)
);
} elseif (
($this->max_entries === null || $this->max_entries === 0) &&
$this->min_entries > 1 &&
$this->required == true
) {
$message = new SwatMessage(
sprintf(
Swat::ngettext(
'List must contain at least %s entry',
'List must contain at least %s entries',
$this->min_entries
),
$locale->formatNumber($this->min_entries)
)
);
} elseif (
$this->max_entries !== null &&
$this->max_entries > 0 &&
$this->min_entries !== null &&
$this->required == true
) {
$message = new SwatMessage(
sprintf(
'List must contain between %s and %s entries.',
$locale->formatNumber($this->min_entries),
$locale->formatNumber($this->max_entries)
)
);
}
return $message;
} | php | public function getNote()
{
$message = null;
$locale = SwatI18NLocale::get();
if (
$this->max_entries !== null &&
$this->max_entries > 0 &&
$this->min_entries === null
) {
$message = new SwatMessage(
sprintf(
Swat::ngettext(
'List can contain at most %s entry',
'List can contain at most %s entries',
$this->max_entries
),
$locale->formatNumber($this->max_entries)
)
);
} elseif (
($this->max_entries === null || $this->max_entries === 0) &&
$this->min_entries > 1 &&
$this->required == true
) {
$message = new SwatMessage(
sprintf(
Swat::ngettext(
'List must contain at least %s entry',
'List must contain at least %s entries',
$this->min_entries
),
$locale->formatNumber($this->min_entries)
)
);
} elseif (
$this->max_entries !== null &&
$this->max_entries > 0 &&
$this->min_entries !== null &&
$this->required == true
) {
$message = new SwatMessage(
sprintf(
'List must contain between %s and %s entries.',
$locale->formatNumber($this->min_entries),
$locale->formatNumber($this->max_entries)
)
);
}
return $message;
} | [
"public",
"function",
"getNote",
"(",
")",
"{",
"$",
"message",
"=",
"null",
";",
"$",
"locale",
"=",
"SwatI18NLocale",
"::",
"get",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"max_entries",
"!==",
"null",
"&&",
"$",
"this",
"->",
"max_entries",
">",
"0",
"&&",
"$",
"this",
"->",
"min_entries",
"===",
"null",
")",
"{",
"$",
"message",
"=",
"new",
"SwatMessage",
"(",
"sprintf",
"(",
"Swat",
"::",
"ngettext",
"(",
"'List can contain at most %s entry'",
",",
"'List can contain at most %s entries'",
",",
"$",
"this",
"->",
"max_entries",
")",
",",
"$",
"locale",
"->",
"formatNumber",
"(",
"$",
"this",
"->",
"max_entries",
")",
")",
")",
";",
"}",
"elseif",
"(",
"(",
"$",
"this",
"->",
"max_entries",
"===",
"null",
"||",
"$",
"this",
"->",
"max_entries",
"===",
"0",
")",
"&&",
"$",
"this",
"->",
"min_entries",
">",
"1",
"&&",
"$",
"this",
"->",
"required",
"==",
"true",
")",
"{",
"$",
"message",
"=",
"new",
"SwatMessage",
"(",
"sprintf",
"(",
"Swat",
"::",
"ngettext",
"(",
"'List must contain at least %s entry'",
",",
"'List must contain at least %s entries'",
",",
"$",
"this",
"->",
"min_entries",
")",
",",
"$",
"locale",
"->",
"formatNumber",
"(",
"$",
"this",
"->",
"min_entries",
")",
")",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"max_entries",
"!==",
"null",
"&&",
"$",
"this",
"->",
"max_entries",
">",
"0",
"&&",
"$",
"this",
"->",
"min_entries",
"!==",
"null",
"&&",
"$",
"this",
"->",
"required",
"==",
"true",
")",
"{",
"$",
"message",
"=",
"new",
"SwatMessage",
"(",
"sprintf",
"(",
"'List must contain between %s and %s entries.'",
",",
"$",
"locale",
"->",
"formatNumber",
"(",
"$",
"this",
"->",
"min_entries",
")",
",",
"$",
"locale",
"->",
"formatNumber",
"(",
"$",
"this",
"->",
"max_entries",
")",
")",
")",
";",
"}",
"return",
"$",
"message",
";",
"}"
] | Gets a note describing the rules on this list entry
This note informs the user what numbers of entries are valid for this
list entry. This note does not mention anything about what type of
delimiter is used. Developers are responsible for ensuring that users
are notified what type of delimiters are used.
@return SwatMessage an informative note of how to use this list entry.
@see SwatControl::getNote() | [
"Gets",
"a",
"note",
"describing",
"the",
"rules",
"on",
"this",
"list",
"entry"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatListEntry.php#L306-L357 |
33,617 | silverorange/swat | Swat/SwatListEntry.php | SwatListEntry.splitValues | protected function splitValues($value)
{
$delimiter = preg_quote($this->delimiter, '/');
if ($this->trim_whitespace) {
$expression = '/\s*' . $delimiter . '\s*/u';
} else {
$expression = '/' . $delimiter . '/u';
}
return preg_split($expression, $value, -1, PREG_SPLIT_NO_EMPTY);
} | php | protected function splitValues($value)
{
$delimiter = preg_quote($this->delimiter, '/');
if ($this->trim_whitespace) {
$expression = '/\s*' . $delimiter . '\s*/u';
} else {
$expression = '/' . $delimiter . '/u';
}
return preg_split($expression, $value, -1, PREG_SPLIT_NO_EMPTY);
} | [
"protected",
"function",
"splitValues",
"(",
"$",
"value",
")",
"{",
"$",
"delimiter",
"=",
"preg_quote",
"(",
"$",
"this",
"->",
"delimiter",
",",
"'/'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"trim_whitespace",
")",
"{",
"$",
"expression",
"=",
"'/\\s*'",
".",
"$",
"delimiter",
".",
"'\\s*/u'",
";",
"}",
"else",
"{",
"$",
"expression",
"=",
"'/'",
".",
"$",
"delimiter",
".",
"'/u'",
";",
"}",
"return",
"preg_split",
"(",
"$",
"expression",
",",
"$",
"value",
",",
"-",
"1",
",",
"PREG_SPLIT_NO_EMPTY",
")",
";",
"}"
] | Splits a value string with entries separated by delimiters into
an array
If {@link SwatListEntry::$trim_whitespace} is set to true, whitespace
is not included in the split values.
@param string $value the string to split.
@return array the string of delimiter separated values split into an
array of values. | [
"Splits",
"a",
"value",
"string",
"with",
"entries",
"separated",
"by",
"delimiters",
"into",
"an",
"array"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatListEntry.php#L374-L385 |
33,618 | silverorange/swat | Swat/SwatHtmlTag.php | SwatHtmlTag.addAttributes | public function addAttributes($attributes)
{
if (is_array($attributes)) {
$this->attributes = array_merge($this->attributes, $attributes);
}
} | php | public function addAttributes($attributes)
{
if (is_array($attributes)) {
$this->attributes = array_merge($this->attributes, $attributes);
}
} | [
"public",
"function",
"addAttributes",
"(",
"$",
"attributes",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"attributes",
")",
")",
"{",
"$",
"this",
"->",
"attributes",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"attributes",
",",
"$",
"attributes",
")",
";",
"}",
"}"
] | Adds an array of attributes to this XHTML tag
If entries in the attributes array coincide with existing attributes of
this XHTML tag, the attributes in the array overwrite the existing
attributes.
@param array an array of attribute-value pairs of the form
'attribute' => 'value'. | [
"Adds",
"an",
"array",
"of",
"attributes",
"to",
"this",
"XHTML",
"tag"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatHtmlTag.php#L103-L108 |
33,619 | silverorange/swat | Swat/SwatHtmlTag.php | SwatHtmlTag.display | public function display()
{
if ($this->content === null) {
$this->openInternal(true);
} else {
$this->openInternal(false);
$this->displayContent();
$this->close();
}
} | php | public function display()
{
if ($this->content === null) {
$this->openInternal(true);
} else {
$this->openInternal(false);
$this->displayContent();
$this->close();
}
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"content",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"openInternal",
"(",
"true",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"openInternal",
"(",
"false",
")",
";",
"$",
"this",
"->",
"displayContent",
"(",
")",
";",
"$",
"this",
"->",
"close",
"(",
")",
";",
"}",
"}"
] | Displays this tag
Output the opening tag including all its attributes and implicitly
close the tag. If explicit closing is desired, use
{@link SwatHtmlTag::open()} and {@link SwatHtmlTag::close()} instead.
If {@link SwatHtmlTag::content} is set then the content is displayed
between an opening and closing tag, otherwise a self-closing tag is
displayed.
@see SwatHtmlTag::open() | [
"Displays",
"this",
"tag"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatHtmlTag.php#L141-L150 |
33,620 | silverorange/swat | Swat/SwatHtmlTag.php | SwatHtmlTag.displayContent | public function displayContent()
{
if ($this->content !== null) {
if ($this->content_type === 'text/plain') {
echo SwatString::minimizeEntities($this->content);
} else {
echo $this->content;
}
}
} | php | public function displayContent()
{
if ($this->content !== null) {
if ($this->content_type === 'text/plain') {
echo SwatString::minimizeEntities($this->content);
} else {
echo $this->content;
}
}
} | [
"public",
"function",
"displayContent",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"content",
"!==",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"content_type",
"===",
"'text/plain'",
")",
"{",
"echo",
"SwatString",
"::",
"minimizeEntities",
"(",
"$",
"this",
"->",
"content",
")",
";",
"}",
"else",
"{",
"echo",
"$",
"this",
"->",
"content",
";",
"}",
"}",
"}"
] | Displays the content of this tag
If {@link SwatHtmlTag::content} is set then the content is displayed.
@see SwatHtmlTag::display() | [
"Displays",
"the",
"content",
"of",
"this",
"tag"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatHtmlTag.php#L162-L171 |
33,621 | silverorange/swat | Swat/SwatHtmlTag.php | SwatHtmlTag.openInternal | private function openInternal($self_closing = false)
{
echo '<', $this->tag_name;
foreach ($this->attributes as $attribute => $value) {
if ($value !== null) {
echo ' ',
$attribute,
'="',
SwatString::minimizeEntities($value),
'"';
}
}
if ($self_closing) {
echo ' />';
} else {
echo '>';
}
} | php | private function openInternal($self_closing = false)
{
echo '<', $this->tag_name;
foreach ($this->attributes as $attribute => $value) {
if ($value !== null) {
echo ' ',
$attribute,
'="',
SwatString::minimizeEntities($value),
'"';
}
}
if ($self_closing) {
echo ' />';
} else {
echo '>';
}
} | [
"private",
"function",
"openInternal",
"(",
"$",
"self_closing",
"=",
"false",
")",
"{",
"echo",
"'<'",
",",
"$",
"this",
"->",
"tag_name",
";",
"foreach",
"(",
"$",
"this",
"->",
"attributes",
"as",
"$",
"attribute",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"!==",
"null",
")",
"{",
"echo",
"' '",
",",
"$",
"attribute",
",",
"'=\"'",
",",
"SwatString",
"::",
"minimizeEntities",
"(",
"$",
"value",
")",
",",
"'\"'",
";",
"}",
"}",
"if",
"(",
"$",
"self_closing",
")",
"{",
"echo",
"' />'",
";",
"}",
"else",
"{",
"echo",
"'>'",
";",
"}",
"}"
] | Outputs opening tag and all attributes
This is a helper method that does the attribute displaying when opening
this tag. This method can also display self-closing XHTML tags.
@param boolean $self_closing whether this tag should be displayed as a
self-closing tag. | [
"Outputs",
"opening",
"tag",
"and",
"all",
"attributes"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatHtmlTag.php#L309-L328 |
33,622 | rollun-com/rollun-datastore | src/DataStore/src/DataStore/DataStoreAbstract.php | DataStoreAbstract.getKeys | protected function getKeys()
{
$identifier = $this->getIdentifier();
$query = new Query();
$selectNode = new Node\SelectNode([$identifier]);
$query->setSelect($selectNode);
$queryResult = $this->query($query);
$keysArray = [];
foreach ($queryResult as $row) {
$keysArray[] = $row[$identifier];
}
return $keysArray;
} | php | protected function getKeys()
{
$identifier = $this->getIdentifier();
$query = new Query();
$selectNode = new Node\SelectNode([$identifier]);
$query->setSelect($selectNode);
$queryResult = $this->query($query);
$keysArray = [];
foreach ($queryResult as $row) {
$keysArray[] = $row[$identifier];
}
return $keysArray;
} | [
"protected",
"function",
"getKeys",
"(",
")",
"{",
"$",
"identifier",
"=",
"$",
"this",
"->",
"getIdentifier",
"(",
")",
";",
"$",
"query",
"=",
"new",
"Query",
"(",
")",
";",
"$",
"selectNode",
"=",
"new",
"Node",
"\\",
"SelectNode",
"(",
"[",
"$",
"identifier",
"]",
")",
";",
"$",
"query",
"->",
"setSelect",
"(",
"$",
"selectNode",
")",
";",
"$",
"queryResult",
"=",
"$",
"this",
"->",
"query",
"(",
"$",
"query",
")",
";",
"$",
"keysArray",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"queryResult",
"as",
"$",
"row",
")",
"{",
"$",
"keysArray",
"[",
"]",
"=",
"$",
"row",
"[",
"$",
"identifier",
"]",
";",
"}",
"return",
"$",
"keysArray",
";",
"}"
] | Return array of keys or empty array
@return array | [
"Return",
"array",
"of",
"keys",
"or",
"empty",
"array"
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/DataStoreAbstract.php#L494-L509 |
33,623 | silverorange/swat | Swat/SwatHtmlHeadEntrySet.php | SwatHtmlHeadEntrySet.addEntry | public function addEntry($entry)
{
if (is_string($entry)) {
$class = $this->getClassFromType($entry);
if ($class === null) {
throw new SwatClassNotFoundException(
'SwatHtmlHeadEntry class not found for entry string of "' .
$entry .
'".'
);
}
$entry = new $class($entry);
}
if (!($entry instanceof SwatHtmlHeadEntry)) {
throw new SwatInvalidTypeException(
'Added entry must be either a string or an instance of a' .
'SwatHtmlHeadEntry.',
0,
$entry
);
}
$uri = $entry->getUri();
if (!array_key_exists($uri, $this->entries)) {
$this->entries[$uri] = $entry;
}
} | php | public function addEntry($entry)
{
if (is_string($entry)) {
$class = $this->getClassFromType($entry);
if ($class === null) {
throw new SwatClassNotFoundException(
'SwatHtmlHeadEntry class not found for entry string of "' .
$entry .
'".'
);
}
$entry = new $class($entry);
}
if (!($entry instanceof SwatHtmlHeadEntry)) {
throw new SwatInvalidTypeException(
'Added entry must be either a string or an instance of a' .
'SwatHtmlHeadEntry.',
0,
$entry
);
}
$uri = $entry->getUri();
if (!array_key_exists($uri, $this->entries)) {
$this->entries[$uri] = $entry;
}
} | [
"public",
"function",
"addEntry",
"(",
"$",
"entry",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"entry",
")",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"getClassFromType",
"(",
"$",
"entry",
")",
";",
"if",
"(",
"$",
"class",
"===",
"null",
")",
"{",
"throw",
"new",
"SwatClassNotFoundException",
"(",
"'SwatHtmlHeadEntry class not found for entry string of \"'",
".",
"$",
"entry",
".",
"'\".'",
")",
";",
"}",
"$",
"entry",
"=",
"new",
"$",
"class",
"(",
"$",
"entry",
")",
";",
"}",
"if",
"(",
"!",
"(",
"$",
"entry",
"instanceof",
"SwatHtmlHeadEntry",
")",
")",
"{",
"throw",
"new",
"SwatInvalidTypeException",
"(",
"'Added entry must be either a string or an instance of a'",
".",
"'SwatHtmlHeadEntry.'",
",",
"0",
",",
"$",
"entry",
")",
";",
"}",
"$",
"uri",
"=",
"$",
"entry",
"->",
"getUri",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"uri",
",",
"$",
"this",
"->",
"entries",
")",
")",
"{",
"$",
"this",
"->",
"entries",
"[",
"$",
"uri",
"]",
"=",
"$",
"entry",
";",
"}",
"}"
] | Adds a HTML head entry to this set
@param SwatHtmlHeadEntry|string $entry the entry to add. | [
"Adds",
"a",
"HTML",
"head",
"entry",
"to",
"this",
"set"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatHtmlHeadEntrySet.php#L62-L91 |
33,624 | silverorange/swat | Swat/SwatHtmlHeadEntrySet.php | SwatHtmlHeadEntrySet.addEntrySet | public function addEntrySet(SwatHtmlHeadEntrySet $set)
{
$this->entries = array_merge($this->entries, $set->entries);
} | php | public function addEntrySet(SwatHtmlHeadEntrySet $set)
{
$this->entries = array_merge($this->entries, $set->entries);
} | [
"public",
"function",
"addEntrySet",
"(",
"SwatHtmlHeadEntrySet",
"$",
"set",
")",
"{",
"$",
"this",
"->",
"entries",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"entries",
",",
"$",
"set",
"->",
"entries",
")",
";",
"}"
] | Adds a set of HTML head entries to this set
@param SwatHtmlHeadEntrySet $set the set to add. | [
"Adds",
"a",
"set",
"of",
"HTML",
"head",
"entries",
"to",
"this",
"set"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatHtmlHeadEntrySet.php#L101-L104 |
33,625 | silverorange/swat | Swat/SwatHtmlHeadEntrySet.php | SwatHtmlHeadEntrySet.getByType | public function getByType($type)
{
$class = __CLASS__;
$set = new $class();
foreach ($this->entries as $entry) {
if ($entry->getType() === $type) {
$set->addEntry($entry);
}
}
return $set;
} | php | public function getByType($type)
{
$class = __CLASS__;
$set = new $class();
foreach ($this->entries as $entry) {
if ($entry->getType() === $type) {
$set->addEntry($entry);
}
}
return $set;
} | [
"public",
"function",
"getByType",
"(",
"$",
"type",
")",
"{",
"$",
"class",
"=",
"__CLASS__",
";",
"$",
"set",
"=",
"new",
"$",
"class",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"entries",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"$",
"entry",
"->",
"getType",
"(",
")",
"===",
"$",
"type",
")",
"{",
"$",
"set",
"->",
"addEntry",
"(",
"$",
"entry",
")",
";",
"}",
"}",
"return",
"$",
"set",
";",
"}"
] | Gets a subset of this set by the entry type
@param string $type the type of HTML head entry to get. For example,
'SwatJavaScriptHtmlHeadEntry'.
@return SwatHtmlHeadEntrySet a subset of this set containing only
entries of the specified type. If no such
entries exist, an empty set is returned. | [
"Gets",
"a",
"subset",
"of",
"this",
"set",
"by",
"the",
"entry",
"type"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatHtmlHeadEntrySet.php#L189-L199 |
33,626 | brainworxx/kreXX | src/Analyse/Callback/Iterate/ThroughMethodAnalysis.php | ThroughMethodAnalysis.callMe | public function callMe()
{
$output = $this->dispatchStartEvent();
foreach ($this->parameters[static::PARAM_DATA] as $key => $string) {
/** @var Model $model */
$model = $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($string)
->setName($key)
->setType(static::TYPE_REFLECTION);
if ($key === static::META_COMMENT || $key === static::META_DECLARED_IN || $key === static::META_SOURCE) {
$model->setNormal(static::UNKNOWN_VALUE);
$model->setHasExtra(true);
} else {
$model->setNormal($string);
}
$output .= $this->pool->render->renderSingleChild(
$this->dispatchEventWithModel(
__FUNCTION__ . static::EVENT_MARKER_END,
$model
)
);
}
return $output;
} | php | public function callMe()
{
$output = $this->dispatchStartEvent();
foreach ($this->parameters[static::PARAM_DATA] as $key => $string) {
/** @var Model $model */
$model = $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($string)
->setName($key)
->setType(static::TYPE_REFLECTION);
if ($key === static::META_COMMENT || $key === static::META_DECLARED_IN || $key === static::META_SOURCE) {
$model->setNormal(static::UNKNOWN_VALUE);
$model->setHasExtra(true);
} else {
$model->setNormal($string);
}
$output .= $this->pool->render->renderSingleChild(
$this->dispatchEventWithModel(
__FUNCTION__ . static::EVENT_MARKER_END,
$model
)
);
}
return $output;
} | [
"public",
"function",
"callMe",
"(",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"dispatchStartEvent",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"parameters",
"[",
"static",
"::",
"PARAM_DATA",
"]",
"as",
"$",
"key",
"=>",
"$",
"string",
")",
"{",
"/** @var Model $model */",
"$",
"model",
"=",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'",
")",
"->",
"setData",
"(",
"$",
"string",
")",
"->",
"setName",
"(",
"$",
"key",
")",
"->",
"setType",
"(",
"static",
"::",
"TYPE_REFLECTION",
")",
";",
"if",
"(",
"$",
"key",
"===",
"static",
"::",
"META_COMMENT",
"||",
"$",
"key",
"===",
"static",
"::",
"META_DECLARED_IN",
"||",
"$",
"key",
"===",
"static",
"::",
"META_SOURCE",
")",
"{",
"$",
"model",
"->",
"setNormal",
"(",
"static",
"::",
"UNKNOWN_VALUE",
")",
";",
"$",
"model",
"->",
"setHasExtra",
"(",
"true",
")",
";",
"}",
"else",
"{",
"$",
"model",
"->",
"setNormal",
"(",
"$",
"string",
")",
";",
"}",
"$",
"output",
".=",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderSingleChild",
"(",
"$",
"this",
"->",
"dispatchEventWithModel",
"(",
"__FUNCTION__",
".",
"static",
"::",
"EVENT_MARKER_END",
",",
"$",
"model",
")",
")",
";",
"}",
"return",
"$",
"output",
";",
"}"
] | Renders the info of a single method.
@return string
The generated markup. | [
"Renders",
"the",
"info",
"of",
"a",
"single",
"method",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Iterate/ThroughMethodAnalysis.php#L61-L88 |
33,627 | brainworxx/kreXX | src/Service/Config/From/Ini.php | Ini.loadIniFile | public function loadIniFile($path)
{
$this->iniSettings = (array)parse_ini_string(
$this->pool->fileService->getFileContents($path, false),
true
);
return $this;
} | php | public function loadIniFile($path)
{
$this->iniSettings = (array)parse_ini_string(
$this->pool->fileService->getFileContents($path, false),
true
);
return $this;
} | [
"public",
"function",
"loadIniFile",
"(",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"iniSettings",
"=",
"(",
"array",
")",
"parse_ini_string",
"(",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"getFileContents",
"(",
"$",
"path",
",",
"false",
")",
",",
"true",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Setter for the ini path.
@param string $path
The path to the ini file.
@return $this
Return $this, for chaining. | [
"Setter",
"for",
"the",
"ini",
"path",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/From/Ini.php#L82-L91 |
33,628 | brainworxx/kreXX | src/Service/Config/From/Ini.php | Ini.getFeConfig | public function getFeConfig($name)
{
// Load it from the file.
$filevalue = $this->getFeConfigFromFile($name);
// Do we have a value?
if (empty($filevalue) === true) {
// Fallback to factory settings.
if (isset($this->feConfigFallback[$name]) === true) {
return array(
($this->feConfigFallback[$name][static::RENDER][static::RENDER_EDITABLE] === static::VALUE_TRUE),
$this->feConfigFallback[$name][static::RENDER][static::RENDER_TYPE]
);
}
// Unknown parameter and nothing in the fallback!
// This should never happen, btw.
return array(false, static::RENDER_TYPE_NONE);
}
return array(
($filevalue[static::RENDER_EDITABLE] === static::VALUE_TRUE),
$filevalue[static::RENDER_TYPE]
);
} | php | public function getFeConfig($name)
{
// Load it from the file.
$filevalue = $this->getFeConfigFromFile($name);
// Do we have a value?
if (empty($filevalue) === true) {
// Fallback to factory settings.
if (isset($this->feConfigFallback[$name]) === true) {
return array(
($this->feConfigFallback[$name][static::RENDER][static::RENDER_EDITABLE] === static::VALUE_TRUE),
$this->feConfigFallback[$name][static::RENDER][static::RENDER_TYPE]
);
}
// Unknown parameter and nothing in the fallback!
// This should never happen, btw.
return array(false, static::RENDER_TYPE_NONE);
}
return array(
($filevalue[static::RENDER_EDITABLE] === static::VALUE_TRUE),
$filevalue[static::RENDER_TYPE]
);
} | [
"public",
"function",
"getFeConfig",
"(",
"$",
"name",
")",
"{",
"// Load it from the file.",
"$",
"filevalue",
"=",
"$",
"this",
"->",
"getFeConfigFromFile",
"(",
"$",
"name",
")",
";",
"// Do we have a value?",
"if",
"(",
"empty",
"(",
"$",
"filevalue",
")",
"===",
"true",
")",
"{",
"// Fallback to factory settings.",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"feConfigFallback",
"[",
"$",
"name",
"]",
")",
"===",
"true",
")",
"{",
"return",
"array",
"(",
"(",
"$",
"this",
"->",
"feConfigFallback",
"[",
"$",
"name",
"]",
"[",
"static",
"::",
"RENDER",
"]",
"[",
"static",
"::",
"RENDER_EDITABLE",
"]",
"===",
"static",
"::",
"VALUE_TRUE",
")",
",",
"$",
"this",
"->",
"feConfigFallback",
"[",
"$",
"name",
"]",
"[",
"static",
"::",
"RENDER",
"]",
"[",
"static",
"::",
"RENDER_TYPE",
"]",
")",
";",
"}",
"// Unknown parameter and nothing in the fallback!",
"// This should never happen, btw.",
"return",
"array",
"(",
"false",
",",
"static",
"::",
"RENDER_TYPE_NONE",
")",
";",
"}",
"return",
"array",
"(",
"(",
"$",
"filevalue",
"[",
"static",
"::",
"RENDER_EDITABLE",
"]",
"===",
"static",
"::",
"VALUE_TRUE",
")",
",",
"$",
"filevalue",
"[",
"static",
"::",
"RENDER_TYPE",
"]",
")",
";",
"}"
] | Get the configuration of the frontend config form.
@param string $name
The parameter name you want to render.
@return array
The configuration (is it editable, a dropdown, a textfield, ...) | [
"Get",
"the",
"configuration",
"of",
"the",
"frontend",
"config",
"form",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/From/Ini.php#L102-L125 |
33,629 | brainworxx/kreXX | src/Service/Config/From/Ini.php | Ini.getFeConfigFromFile | public function getFeConfigFromFile($parameterName)
{
// Get the human readable stuff from the ini file.
$value = $this->getConfigFromFile('feEditing', $parameterName);
if (empty($value) === true) {
// Sorry, no value stored.
return null;
}
// Get the rendering type.
$type = $this->feConfigFallback[$parameterName][static::RENDER][static::RENDER_TYPE];
// Stitch together the setting.
switch ($value) {
case static::RENDER_TYPE_NONE:
$type = static::RENDER_TYPE_NONE;
$editable = static::VALUE_FALSE;
break;
case static::RENDER_TYPE_INI_DISPLAY:
$editable = static::VALUE_FALSE;
break;
case static::RENDER_TYPE_INI_FULL:
$editable = static::VALUE_TRUE;
break;
default:
// Unknown setting.
// Fallback to no display, just in case.
$type = static::RENDER_TYPE_NONE;
$editable = static::VALUE_FALSE;
break;
}
return array(
static::RENDER_TYPE => $type,
static::RENDER_EDITABLE => $editable,
);
} | php | public function getFeConfigFromFile($parameterName)
{
// Get the human readable stuff from the ini file.
$value = $this->getConfigFromFile('feEditing', $parameterName);
if (empty($value) === true) {
// Sorry, no value stored.
return null;
}
// Get the rendering type.
$type = $this->feConfigFallback[$parameterName][static::RENDER][static::RENDER_TYPE];
// Stitch together the setting.
switch ($value) {
case static::RENDER_TYPE_NONE:
$type = static::RENDER_TYPE_NONE;
$editable = static::VALUE_FALSE;
break;
case static::RENDER_TYPE_INI_DISPLAY:
$editable = static::VALUE_FALSE;
break;
case static::RENDER_TYPE_INI_FULL:
$editable = static::VALUE_TRUE;
break;
default:
// Unknown setting.
// Fallback to no display, just in case.
$type = static::RENDER_TYPE_NONE;
$editable = static::VALUE_FALSE;
break;
}
return array(
static::RENDER_TYPE => $type,
static::RENDER_EDITABLE => $editable,
);
} | [
"public",
"function",
"getFeConfigFromFile",
"(",
"$",
"parameterName",
")",
"{",
"// Get the human readable stuff from the ini file.",
"$",
"value",
"=",
"$",
"this",
"->",
"getConfigFromFile",
"(",
"'feEditing'",
",",
"$",
"parameterName",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"value",
")",
"===",
"true",
")",
"{",
"// Sorry, no value stored.",
"return",
"null",
";",
"}",
"// Get the rendering type.",
"$",
"type",
"=",
"$",
"this",
"->",
"feConfigFallback",
"[",
"$",
"parameterName",
"]",
"[",
"static",
"::",
"RENDER",
"]",
"[",
"static",
"::",
"RENDER_TYPE",
"]",
";",
"// Stitch together the setting.",
"switch",
"(",
"$",
"value",
")",
"{",
"case",
"static",
"::",
"RENDER_TYPE_NONE",
":",
"$",
"type",
"=",
"static",
"::",
"RENDER_TYPE_NONE",
";",
"$",
"editable",
"=",
"static",
"::",
"VALUE_FALSE",
";",
"break",
";",
"case",
"static",
"::",
"RENDER_TYPE_INI_DISPLAY",
":",
"$",
"editable",
"=",
"static",
"::",
"VALUE_FALSE",
";",
"break",
";",
"case",
"static",
"::",
"RENDER_TYPE_INI_FULL",
":",
"$",
"editable",
"=",
"static",
"::",
"VALUE_TRUE",
";",
"break",
";",
"default",
":",
"// Unknown setting.",
"// Fallback to no display, just in case.",
"$",
"type",
"=",
"static",
"::",
"RENDER_TYPE_NONE",
";",
"$",
"editable",
"=",
"static",
"::",
"VALUE_FALSE",
";",
"break",
";",
"}",
"return",
"array",
"(",
"static",
"::",
"RENDER_TYPE",
"=>",
"$",
"type",
",",
"static",
"::",
"RENDER_EDITABLE",
"=>",
"$",
"editable",
",",
")",
";",
"}"
] | Get the config of the frontend config form from the file.
@param string $parameterName
The parameter you want to render.
@return array|null
The configuration (is it editable, a dropdown, a textfield, ...) | [
"Get",
"the",
"config",
"of",
"the",
"frontend",
"config",
"form",
"from",
"the",
"file",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/From/Ini.php#L136-L176 |
33,630 | brainworxx/kreXX | src/Service/Config/From/Ini.php | Ini.getConfigFromFile | public function getConfigFromFile($group, $name)
{
// Do we have a value in the ini?
// Does it validate?
if (isset($this->iniSettings[$group][$name]) === true &&
$this->security->evaluateSetting($group, $name, $this->iniSettings[$group][$name]) === true
) {
return $this->iniSettings[$group][$name];
}
return null;
} | php | public function getConfigFromFile($group, $name)
{
// Do we have a value in the ini?
// Does it validate?
if (isset($this->iniSettings[$group][$name]) === true &&
$this->security->evaluateSetting($group, $name, $this->iniSettings[$group][$name]) === true
) {
return $this->iniSettings[$group][$name];
}
return null;
} | [
"public",
"function",
"getConfigFromFile",
"(",
"$",
"group",
",",
"$",
"name",
")",
"{",
"// Do we have a value in the ini?",
"// Does it validate?",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"iniSettings",
"[",
"$",
"group",
"]",
"[",
"$",
"name",
"]",
")",
"===",
"true",
"&&",
"$",
"this",
"->",
"security",
"->",
"evaluateSetting",
"(",
"$",
"group",
",",
"$",
"name",
",",
"$",
"this",
"->",
"iniSettings",
"[",
"$",
"group",
"]",
"[",
"$",
"name",
"]",
")",
"===",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"iniSettings",
"[",
"$",
"group",
"]",
"[",
"$",
"name",
"]",
";",
"}",
"return",
"null",
";",
"}"
] | Returns settings from the ini file.
@param string $group
The group name inside of the ini.
@param string $name
The name of the setting.
@return string
The value from the file. | [
"Returns",
"settings",
"from",
"the",
"ini",
"file",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/From/Ini.php#L189-L200 |
33,631 | rollun-com/rollun-datastore | src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php | ConditionBuilderAbstract.makeAbstractQueryOperator | public function makeAbstractQueryOperator(AbstractQueryNode $queryNode)
{
switch (true) {
case ($queryNode instanceof AbstractScalarOperatorNode):
return $this->makeScalarOperator($queryNode);
case ($queryNode instanceof AbstractLogicOperatorNode):
return $this->makeLogicOperator($queryNode);
case ($queryNode instanceof AbstractArrayOperatorNode):
return $this->makeArrayOperator($queryNode);
case ($queryNode instanceof BinaryOperatorNodeAbstract):
return $this->makeBinaryOperator($queryNode);
default:
throw new DataStoreException('The Node type not supported: ' . $queryNode->getNodeName());
}
} | php | public function makeAbstractQueryOperator(AbstractQueryNode $queryNode)
{
switch (true) {
case ($queryNode instanceof AbstractScalarOperatorNode):
return $this->makeScalarOperator($queryNode);
case ($queryNode instanceof AbstractLogicOperatorNode):
return $this->makeLogicOperator($queryNode);
case ($queryNode instanceof AbstractArrayOperatorNode):
return $this->makeArrayOperator($queryNode);
case ($queryNode instanceof BinaryOperatorNodeAbstract):
return $this->makeBinaryOperator($queryNode);
default:
throw new DataStoreException('The Node type not supported: ' . $queryNode->getNodeName());
}
} | [
"public",
"function",
"makeAbstractQueryOperator",
"(",
"AbstractQueryNode",
"$",
"queryNode",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"(",
"$",
"queryNode",
"instanceof",
"AbstractScalarOperatorNode",
")",
":",
"return",
"$",
"this",
"->",
"makeScalarOperator",
"(",
"$",
"queryNode",
")",
";",
"case",
"(",
"$",
"queryNode",
"instanceof",
"AbstractLogicOperatorNode",
")",
":",
"return",
"$",
"this",
"->",
"makeLogicOperator",
"(",
"$",
"queryNode",
")",
";",
"case",
"(",
"$",
"queryNode",
"instanceof",
"AbstractArrayOperatorNode",
")",
":",
"return",
"$",
"this",
"->",
"makeArrayOperator",
"(",
"$",
"queryNode",
")",
";",
"case",
"(",
"$",
"queryNode",
"instanceof",
"BinaryOperatorNodeAbstract",
")",
":",
"return",
"$",
"this",
"->",
"makeBinaryOperator",
"(",
"$",
"queryNode",
")",
";",
"default",
":",
"throw",
"new",
"DataStoreException",
"(",
"'The Node type not supported: '",
".",
"$",
"queryNode",
"->",
"getNodeName",
"(",
")",
")",
";",
"}",
"}"
] | Make string with conditions for not null Query
@param AbstractQueryNode $queryNode
@return string
@throws DataStoreException | [
"Make",
"string",
"with",
"conditions",
"for",
"not",
"null",
"Query"
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php#L65-L79 |
33,632 | rollun-com/rollun-datastore | src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php | ConditionBuilderAbstract.makeBinaryOperator | public function makeBinaryOperator(BinaryOperatorNodeAbstract $node)
{
$nodeName = $node->getNodeName();
if (!isset($this->literals['BinaryOperator'][$nodeName])) {
throw new DataStoreException(
'The Binary Operator not supported: ' . $nodeName
);
}
$strQuery = $this->literals['BinaryOperator'][$nodeName]['before']
. $this->prepareFieldName($node->getField())
. $this->literals['BinaryOperator'][$nodeName]['after'];
return $strQuery;
} | php | public function makeBinaryOperator(BinaryOperatorNodeAbstract $node)
{
$nodeName = $node->getNodeName();
if (!isset($this->literals['BinaryOperator'][$nodeName])) {
throw new DataStoreException(
'The Binary Operator not supported: ' . $nodeName
);
}
$strQuery = $this->literals['BinaryOperator'][$nodeName]['before']
. $this->prepareFieldName($node->getField())
. $this->literals['BinaryOperator'][$nodeName]['after'];
return $strQuery;
} | [
"public",
"function",
"makeBinaryOperator",
"(",
"BinaryOperatorNodeAbstract",
"$",
"node",
")",
"{",
"$",
"nodeName",
"=",
"$",
"node",
"->",
"getNodeName",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"literals",
"[",
"'BinaryOperator'",
"]",
"[",
"$",
"nodeName",
"]",
")",
")",
"{",
"throw",
"new",
"DataStoreException",
"(",
"'The Binary Operator not supported: '",
".",
"$",
"nodeName",
")",
";",
"}",
"$",
"strQuery",
"=",
"$",
"this",
"->",
"literals",
"[",
"'BinaryOperator'",
"]",
"[",
"$",
"nodeName",
"]",
"[",
"'before'",
"]",
".",
"$",
"this",
"->",
"prepareFieldName",
"(",
"$",
"node",
"->",
"getField",
"(",
")",
")",
".",
"$",
"this",
"->",
"literals",
"[",
"'BinaryOperator'",
"]",
"[",
"$",
"nodeName",
"]",
"[",
"'after'",
"]",
";",
"return",
"$",
"strQuery",
";",
"}"
] | Make string with conditions for binary operators
@param BinaryOperatorNodeAbstract $node
@return string | [
"Make",
"string",
"with",
"conditions",
"for",
"binary",
"operators"
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php#L87-L102 |
33,633 | rollun-com/rollun-datastore | src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php | ConditionBuilderAbstract.getValueFromGlob | public function getValueFromGlob(Glob $globNode)
{
$reflection = new \ReflectionClass($globNode);
$globProperty = $reflection->getProperty('glob');
$globProperty->setAccessible(true);
$glob = $globProperty->getValue($globNode);
$globProperty->setAccessible(false);
return $glob;
} | php | public function getValueFromGlob(Glob $globNode)
{
$reflection = new \ReflectionClass($globNode);
$globProperty = $reflection->getProperty('glob');
$globProperty->setAccessible(true);
$glob = $globProperty->getValue($globNode);
$globProperty->setAccessible(false);
return $glob;
} | [
"public",
"function",
"getValueFromGlob",
"(",
"Glob",
"$",
"globNode",
")",
"{",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"globNode",
")",
";",
"$",
"globProperty",
"=",
"$",
"reflection",
"->",
"getProperty",
"(",
"'glob'",
")",
";",
"$",
"globProperty",
"->",
"setAccessible",
"(",
"true",
")",
";",
"$",
"glob",
"=",
"$",
"globProperty",
"->",
"getValue",
"(",
"$",
"globNode",
")",
";",
"$",
"globProperty",
"->",
"setAccessible",
"(",
"false",
")",
";",
"return",
"$",
"glob",
";",
"}"
] | Return value from Glob
I have no idea why, but Xiag\Rql\Parser\DataType\Glob
have not method getValue(). We fix it/
@see Glob
@param Glob $globNode
@return string | [
"Return",
"value",
"from",
"Glob"
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php#L173-L182 |
33,634 | rollun-com/rollun-datastore | src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php | ConditionBuilderAbstract.makeLogicOperator | public function makeLogicOperator(AbstractLogicOperatorNode $node)
{
$nodeName = $node->getNodeName();
if (!isset($this->literals['LogicOperator'][$nodeName])) {
throw new DataStoreException(
'The Logic Operator not supported: ' . $nodeName
);
}
$arrayQueries = $node->getQueries();
$strQuery = $this->literals['LogicOperator'][$nodeName]['before'];
foreach ($arrayQueries as $queryNode) {
/* @var $queryNode AbstractQueryNode */
$strQuery = $strQuery . $this->makeAbstractQueryOperator($queryNode)
. $this->literals['LogicOperator'][$nodeName]['between'];
}
$strQuery = rtrim($strQuery, $this->literals['LogicOperator'][$nodeName]['between']);
$strQuery = $strQuery . $this->literals['LogicOperator'][$nodeName]['after'];
return $strQuery;
} | php | public function makeLogicOperator(AbstractLogicOperatorNode $node)
{
$nodeName = $node->getNodeName();
if (!isset($this->literals['LogicOperator'][$nodeName])) {
throw new DataStoreException(
'The Logic Operator not supported: ' . $nodeName
);
}
$arrayQueries = $node->getQueries();
$strQuery = $this->literals['LogicOperator'][$nodeName]['before'];
foreach ($arrayQueries as $queryNode) {
/* @var $queryNode AbstractQueryNode */
$strQuery = $strQuery . $this->makeAbstractQueryOperator($queryNode)
. $this->literals['LogicOperator'][$nodeName]['between'];
}
$strQuery = rtrim($strQuery, $this->literals['LogicOperator'][$nodeName]['between']);
$strQuery = $strQuery . $this->literals['LogicOperator'][$nodeName]['after'];
return $strQuery;
} | [
"public",
"function",
"makeLogicOperator",
"(",
"AbstractLogicOperatorNode",
"$",
"node",
")",
"{",
"$",
"nodeName",
"=",
"$",
"node",
"->",
"getNodeName",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"literals",
"[",
"'LogicOperator'",
"]",
"[",
"$",
"nodeName",
"]",
")",
")",
"{",
"throw",
"new",
"DataStoreException",
"(",
"'The Logic Operator not supported: '",
".",
"$",
"nodeName",
")",
";",
"}",
"$",
"arrayQueries",
"=",
"$",
"node",
"->",
"getQueries",
"(",
")",
";",
"$",
"strQuery",
"=",
"$",
"this",
"->",
"literals",
"[",
"'LogicOperator'",
"]",
"[",
"$",
"nodeName",
"]",
"[",
"'before'",
"]",
";",
"foreach",
"(",
"$",
"arrayQueries",
"as",
"$",
"queryNode",
")",
"{",
"/* @var $queryNode AbstractQueryNode */",
"$",
"strQuery",
"=",
"$",
"strQuery",
".",
"$",
"this",
"->",
"makeAbstractQueryOperator",
"(",
"$",
"queryNode",
")",
".",
"$",
"this",
"->",
"literals",
"[",
"'LogicOperator'",
"]",
"[",
"$",
"nodeName",
"]",
"[",
"'between'",
"]",
";",
"}",
"$",
"strQuery",
"=",
"rtrim",
"(",
"$",
"strQuery",
",",
"$",
"this",
"->",
"literals",
"[",
"'LogicOperator'",
"]",
"[",
"$",
"nodeName",
"]",
"[",
"'between'",
"]",
")",
";",
"$",
"strQuery",
"=",
"$",
"strQuery",
".",
"$",
"this",
"->",
"literals",
"[",
"'LogicOperator'",
"]",
"[",
"$",
"nodeName",
"]",
"[",
"'after'",
"]",
";",
"return",
"$",
"strQuery",
";",
"}"
] | Make string with conditions for LogicOperatorNode
@param AbstractLogicOperatorNode $node
@return string
@throws DataStoreException | [
"Make",
"string",
"with",
"conditions",
"for",
"LogicOperatorNode"
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php#L191-L214 |
33,635 | rollun-com/rollun-datastore | src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php | ConditionBuilderAbstract.makeArrayOperator | public function makeArrayOperator(AbstractArrayOperatorNode $node)
{
$nodeName = $node->getNodeName();
if (!isset($this->literals['ArrayOperator'][$nodeName])) {
throw new DataStoreException(
'The Array Operator not supported: ' . $nodeName
);
}
$arrayValues = $node->getValues();
$strQuery = $this->literals['ArrayOperator'][$nodeName]['before']
. $this->prepareFieldName($node->getField())
. $this->literals['ArrayOperator'][$nodeName]['between'];
foreach ($arrayValues as $value) {
$strQuery = $strQuery
. $this->prepareFieldValue($value)
. $this->literals['ArrayOperator'][$nodeName]['delimiter'];
}
$strQuery = rtrim($strQuery, $this->literals['ArrayOperator'][$nodeName]['delimiter']);
$strQuery = $strQuery . $this->literals['ArrayOperator'][$nodeName]['after'];
return $strQuery;
} | php | public function makeArrayOperator(AbstractArrayOperatorNode $node)
{
$nodeName = $node->getNodeName();
if (!isset($this->literals['ArrayOperator'][$nodeName])) {
throw new DataStoreException(
'The Array Operator not supported: ' . $nodeName
);
}
$arrayValues = $node->getValues();
$strQuery = $this->literals['ArrayOperator'][$nodeName]['before']
. $this->prepareFieldName($node->getField())
. $this->literals['ArrayOperator'][$nodeName]['between'];
foreach ($arrayValues as $value) {
$strQuery = $strQuery
. $this->prepareFieldValue($value)
. $this->literals['ArrayOperator'][$nodeName]['delimiter'];
}
$strQuery = rtrim($strQuery, $this->literals['ArrayOperator'][$nodeName]['delimiter']);
$strQuery = $strQuery . $this->literals['ArrayOperator'][$nodeName]['after'];
return $strQuery;
} | [
"public",
"function",
"makeArrayOperator",
"(",
"AbstractArrayOperatorNode",
"$",
"node",
")",
"{",
"$",
"nodeName",
"=",
"$",
"node",
"->",
"getNodeName",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"literals",
"[",
"'ArrayOperator'",
"]",
"[",
"$",
"nodeName",
"]",
")",
")",
"{",
"throw",
"new",
"DataStoreException",
"(",
"'The Array Operator not supported: '",
".",
"$",
"nodeName",
")",
";",
"}",
"$",
"arrayValues",
"=",
"$",
"node",
"->",
"getValues",
"(",
")",
";",
"$",
"strQuery",
"=",
"$",
"this",
"->",
"literals",
"[",
"'ArrayOperator'",
"]",
"[",
"$",
"nodeName",
"]",
"[",
"'before'",
"]",
".",
"$",
"this",
"->",
"prepareFieldName",
"(",
"$",
"node",
"->",
"getField",
"(",
")",
")",
".",
"$",
"this",
"->",
"literals",
"[",
"'ArrayOperator'",
"]",
"[",
"$",
"nodeName",
"]",
"[",
"'between'",
"]",
";",
"foreach",
"(",
"$",
"arrayValues",
"as",
"$",
"value",
")",
"{",
"$",
"strQuery",
"=",
"$",
"strQuery",
".",
"$",
"this",
"->",
"prepareFieldValue",
"(",
"$",
"value",
")",
".",
"$",
"this",
"->",
"literals",
"[",
"'ArrayOperator'",
"]",
"[",
"$",
"nodeName",
"]",
"[",
"'delimiter'",
"]",
";",
"}",
"$",
"strQuery",
"=",
"rtrim",
"(",
"$",
"strQuery",
",",
"$",
"this",
"->",
"literals",
"[",
"'ArrayOperator'",
"]",
"[",
"$",
"nodeName",
"]",
"[",
"'delimiter'",
"]",
")",
";",
"$",
"strQuery",
"=",
"$",
"strQuery",
".",
"$",
"this",
"->",
"literals",
"[",
"'ArrayOperator'",
"]",
"[",
"$",
"nodeName",
"]",
"[",
"'after'",
"]",
";",
"return",
"$",
"strQuery",
";",
"}"
] | Make string with conditions for ArrayOperatorNode
@param AbstractArrayOperatorNode $node
@return string
@throws DataStoreException | [
"Make",
"string",
"with",
"conditions",
"for",
"ArrayOperatorNode"
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/ConditionBuilder/ConditionBuilderAbstract.php#L223-L248 |
33,636 | silverorange/swat | Swat/SwatToolLink.php | SwatToolLink.display | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$tag = $this->isSensitive()
? $this->getSensitiveTag()
: $this->getInsensitiveTag();
$tag->open();
$icon_span = new SwatHtmlTag('span');
if ($this->isSensitive()) {
$icon_span->class = 'swat-tool-link-icon';
} else {
$icon_span->class =
'swat-tool-link-icon swat-tool-link-icon-insensitive';
}
$icon_span->setContent('');
$icon_span->display();
$title_span = new SwatHtmlTag('span');
$title_span->class = 'swat-tool-link-title';
$title_span->setContent($this->title, $this->content_type);
$title_span->display();
$tag->close();
} | php | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$tag = $this->isSensitive()
? $this->getSensitiveTag()
: $this->getInsensitiveTag();
$tag->open();
$icon_span = new SwatHtmlTag('span');
if ($this->isSensitive()) {
$icon_span->class = 'swat-tool-link-icon';
} else {
$icon_span->class =
'swat-tool-link-icon swat-tool-link-icon-insensitive';
}
$icon_span->setContent('');
$icon_span->display();
$title_span = new SwatHtmlTag('span');
$title_span->class = 'swat-tool-link-title';
$title_span->setContent($this->title, $this->content_type);
$title_span->display();
$tag->close();
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"display",
"(",
")",
";",
"$",
"tag",
"=",
"$",
"this",
"->",
"isSensitive",
"(",
")",
"?",
"$",
"this",
"->",
"getSensitiveTag",
"(",
")",
":",
"$",
"this",
"->",
"getInsensitiveTag",
"(",
")",
";",
"$",
"tag",
"->",
"open",
"(",
")",
";",
"$",
"icon_span",
"=",
"new",
"SwatHtmlTag",
"(",
"'span'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isSensitive",
"(",
")",
")",
"{",
"$",
"icon_span",
"->",
"class",
"=",
"'swat-tool-link-icon'",
";",
"}",
"else",
"{",
"$",
"icon_span",
"->",
"class",
"=",
"'swat-tool-link-icon swat-tool-link-icon-insensitive'",
";",
"}",
"$",
"icon_span",
"->",
"setContent",
"(",
"''",
")",
";",
"$",
"icon_span",
"->",
"display",
"(",
")",
";",
"$",
"title_span",
"=",
"new",
"SwatHtmlTag",
"(",
"'span'",
")",
";",
"$",
"title_span",
"->",
"class",
"=",
"'swat-tool-link-title'",
";",
"$",
"title_span",
"->",
"setContent",
"(",
"$",
"this",
"->",
"title",
",",
"$",
"this",
"->",
"content_type",
")",
";",
"$",
"title_span",
"->",
"display",
"(",
")",
";",
"$",
"tag",
"->",
"close",
"(",
")",
";",
"}"
] | Displays this tool link | [
"Displays",
"this",
"tool",
"link"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatToolLink.php#L148-L181 |
33,637 | silverorange/swat | Swat/SwatToolLink.php | SwatToolLink.setFromStock | public function setFromStock($stock_id, $overwrite_properties = true)
{
switch ($stock_id) {
case 'create':
$title = Swat::_('Create');
$class = 'swat-tool-link-create';
break;
case 'add':
$title = Swat::_('Add');
$class = 'swat-tool-link-add';
break;
case 'edit':
$title = Swat::_('Edit');
$class = 'swat-tool-link-edit';
break;
case 'download':
$title = Swat::_('Download');
$class = 'swat-tool-link-download';
break;
case 'delete':
$title = Swat::_('Delete');
$class = 'swat-tool-link-delete';
break;
case 'cancel':
$title = Swat::_('Cancel');
$class = 'swat-tool-link-cancel';
break;
case 'preview':
$title = Swat::_('Preview');
$class = 'swat-tool-link-preview';
break;
case 'change-order':
$title = Swat::_('Change Order');
$class = 'swat-tool-link-change-order';
break;
case 'help':
$title = Swat::_('Help');
$class = 'swat-tool-link-help';
break;
case 'print':
$title = Swat::_('Print');
$class = 'swat-tool-link-print';
break;
case 'email':
$title = Swat::_('Email');
$class = 'swat-tool-link-email';
break;
default:
throw new SwatUndefinedStockTypeException(
"Stock type with id of '{$stock_id}' not found.",
0,
$stock_id
);
}
if ($overwrite_properties || $this->title === null) {
$this->title = $title;
}
$this->stock_class = $class;
} | php | public function setFromStock($stock_id, $overwrite_properties = true)
{
switch ($stock_id) {
case 'create':
$title = Swat::_('Create');
$class = 'swat-tool-link-create';
break;
case 'add':
$title = Swat::_('Add');
$class = 'swat-tool-link-add';
break;
case 'edit':
$title = Swat::_('Edit');
$class = 'swat-tool-link-edit';
break;
case 'download':
$title = Swat::_('Download');
$class = 'swat-tool-link-download';
break;
case 'delete':
$title = Swat::_('Delete');
$class = 'swat-tool-link-delete';
break;
case 'cancel':
$title = Swat::_('Cancel');
$class = 'swat-tool-link-cancel';
break;
case 'preview':
$title = Swat::_('Preview');
$class = 'swat-tool-link-preview';
break;
case 'change-order':
$title = Swat::_('Change Order');
$class = 'swat-tool-link-change-order';
break;
case 'help':
$title = Swat::_('Help');
$class = 'swat-tool-link-help';
break;
case 'print':
$title = Swat::_('Print');
$class = 'swat-tool-link-print';
break;
case 'email':
$title = Swat::_('Email');
$class = 'swat-tool-link-email';
break;
default:
throw new SwatUndefinedStockTypeException(
"Stock type with id of '{$stock_id}' not found.",
0,
$stock_id
);
}
if ($overwrite_properties || $this->title === null) {
$this->title = $title;
}
$this->stock_class = $class;
} | [
"public",
"function",
"setFromStock",
"(",
"$",
"stock_id",
",",
"$",
"overwrite_properties",
"=",
"true",
")",
"{",
"switch",
"(",
"$",
"stock_id",
")",
"{",
"case",
"'create'",
":",
"$",
"title",
"=",
"Swat",
"::",
"_",
"(",
"'Create'",
")",
";",
"$",
"class",
"=",
"'swat-tool-link-create'",
";",
"break",
";",
"case",
"'add'",
":",
"$",
"title",
"=",
"Swat",
"::",
"_",
"(",
"'Add'",
")",
";",
"$",
"class",
"=",
"'swat-tool-link-add'",
";",
"break",
";",
"case",
"'edit'",
":",
"$",
"title",
"=",
"Swat",
"::",
"_",
"(",
"'Edit'",
")",
";",
"$",
"class",
"=",
"'swat-tool-link-edit'",
";",
"break",
";",
"case",
"'download'",
":",
"$",
"title",
"=",
"Swat",
"::",
"_",
"(",
"'Download'",
")",
";",
"$",
"class",
"=",
"'swat-tool-link-download'",
";",
"break",
";",
"case",
"'delete'",
":",
"$",
"title",
"=",
"Swat",
"::",
"_",
"(",
"'Delete'",
")",
";",
"$",
"class",
"=",
"'swat-tool-link-delete'",
";",
"break",
";",
"case",
"'cancel'",
":",
"$",
"title",
"=",
"Swat",
"::",
"_",
"(",
"'Cancel'",
")",
";",
"$",
"class",
"=",
"'swat-tool-link-cancel'",
";",
"break",
";",
"case",
"'preview'",
":",
"$",
"title",
"=",
"Swat",
"::",
"_",
"(",
"'Preview'",
")",
";",
"$",
"class",
"=",
"'swat-tool-link-preview'",
";",
"break",
";",
"case",
"'change-order'",
":",
"$",
"title",
"=",
"Swat",
"::",
"_",
"(",
"'Change Order'",
")",
";",
"$",
"class",
"=",
"'swat-tool-link-change-order'",
";",
"break",
";",
"case",
"'help'",
":",
"$",
"title",
"=",
"Swat",
"::",
"_",
"(",
"'Help'",
")",
";",
"$",
"class",
"=",
"'swat-tool-link-help'",
";",
"break",
";",
"case",
"'print'",
":",
"$",
"title",
"=",
"Swat",
"::",
"_",
"(",
"'Print'",
")",
";",
"$",
"class",
"=",
"'swat-tool-link-print'",
";",
"break",
";",
"case",
"'email'",
":",
"$",
"title",
"=",
"Swat",
"::",
"_",
"(",
"'Email'",
")",
";",
"$",
"class",
"=",
"'swat-tool-link-email'",
";",
"break",
";",
"default",
":",
"throw",
"new",
"SwatUndefinedStockTypeException",
"(",
"\"Stock type with id of '{$stock_id}' not found.\"",
",",
"0",
",",
"$",
"stock_id",
")",
";",
"}",
"if",
"(",
"$",
"overwrite_properties",
"||",
"$",
"this",
"->",
"title",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"title",
"=",
"$",
"title",
";",
"}",
"$",
"this",
"->",
"stock_class",
"=",
"$",
"class",
";",
"}"
] | Sets the values of this tool link to a stock type
Valid stock type ids are:
- create
- add
- edit
- delete
- cancel
- preview
- change-order
- help
- print
- email
@param string $stock_id the identifier of the stock type to use.
@param boolean $overwrite_properties whether to overwrite properties if
they are already set.
@throws SwatUndefinedStockTypeException | [
"Sets",
"the",
"values",
"of",
"this",
"tool",
"link",
"to",
"a",
"stock",
"type"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatToolLink.php#L208-L279 |
33,638 | silverorange/swat | Swat/SwatToolLink.php | SwatToolLink.getCSSClassNames | protected function getCSSClassNames()
{
$classes = array('swat-tool-link');
if (!$this->isSensitive()) {
$classes[] = 'swat-tool-link-insensitive';
}
if ($this->stock_class !== null) {
$classes[] = $this->stock_class;
}
$classes = array_merge($classes, $this->classes);
return $classes;
} | php | protected function getCSSClassNames()
{
$classes = array('swat-tool-link');
if (!$this->isSensitive()) {
$classes[] = 'swat-tool-link-insensitive';
}
if ($this->stock_class !== null) {
$classes[] = $this->stock_class;
}
$classes = array_merge($classes, $this->classes);
return $classes;
} | [
"protected",
"function",
"getCSSClassNames",
"(",
")",
"{",
"$",
"classes",
"=",
"array",
"(",
"'swat-tool-link'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isSensitive",
"(",
")",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"'swat-tool-link-insensitive'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"stock_class",
"!==",
"null",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"$",
"this",
"->",
"stock_class",
";",
"}",
"$",
"classes",
"=",
"array_merge",
"(",
"$",
"classes",
",",
"$",
"this",
"->",
"classes",
")",
";",
"return",
"$",
"classes",
";",
"}"
] | Gets the array of CSS classes that are applied to this tool link
@return array the array of CSS classes that are applied to this tool
link. | [
"Gets",
"the",
"array",
"of",
"CSS",
"classes",
"that",
"are",
"applied",
"to",
"this",
"tool",
"link"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatToolLink.php#L290-L305 |
33,639 | silverorange/swat | Swat/SwatToolLink.php | SwatToolLink.getSensitiveTag | protected function getSensitiveTag()
{
$tag = new SwatHtmlTag('a');
$tag->id = $this->id;
$tag->class = $this->getCSSClassString();
if ($this->target !== null) {
$tag->target = $this->target;
}
if ($this->value === null) {
$tag->href = $this->link;
} elseif (is_array($this->value)) {
$tag->href = vsprintf($this->link, $this->value);
} else {
$tag->href = sprintf($this->link, $this->value);
}
if ($this->tooltip !== null) {
$tag->title = $this->tooltip;
}
$tag->accesskey = $this->access_key;
return $tag;
} | php | protected function getSensitiveTag()
{
$tag = new SwatHtmlTag('a');
$tag->id = $this->id;
$tag->class = $this->getCSSClassString();
if ($this->target !== null) {
$tag->target = $this->target;
}
if ($this->value === null) {
$tag->href = $this->link;
} elseif (is_array($this->value)) {
$tag->href = vsprintf($this->link, $this->value);
} else {
$tag->href = sprintf($this->link, $this->value);
}
if ($this->tooltip !== null) {
$tag->title = $this->tooltip;
}
$tag->accesskey = $this->access_key;
return $tag;
} | [
"protected",
"function",
"getSensitiveTag",
"(",
")",
"{",
"$",
"tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'a'",
")",
";",
"$",
"tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"target",
"!==",
"null",
")",
"{",
"$",
"tag",
"->",
"target",
"=",
"$",
"this",
"->",
"target",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"value",
"===",
"null",
")",
"{",
"$",
"tag",
"->",
"href",
"=",
"$",
"this",
"->",
"link",
";",
"}",
"elseif",
"(",
"is_array",
"(",
"$",
"this",
"->",
"value",
")",
")",
"{",
"$",
"tag",
"->",
"href",
"=",
"vsprintf",
"(",
"$",
"this",
"->",
"link",
",",
"$",
"this",
"->",
"value",
")",
";",
"}",
"else",
"{",
"$",
"tag",
"->",
"href",
"=",
"sprintf",
"(",
"$",
"this",
"->",
"link",
",",
"$",
"this",
"->",
"value",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"tooltip",
"!==",
"null",
")",
"{",
"$",
"tag",
"->",
"title",
"=",
"$",
"this",
"->",
"tooltip",
";",
"}",
"$",
"tag",
"->",
"accesskey",
"=",
"$",
"this",
"->",
"access_key",
";",
"return",
"$",
"tag",
";",
"}"
] | Gets the tag used to display this tool link when it is sensitive
@return SwatHtmlTag the tag used to display this tool link when it is
sensitive. | [
"Gets",
"the",
"tag",
"used",
"to",
"display",
"this",
"tool",
"link",
"when",
"it",
"is",
"sensitive"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatToolLink.php#L316-L342 |
33,640 | silverorange/swat | Swat/SwatToolLink.php | SwatToolLink.getInsensitiveTag | protected function getInsensitiveTag()
{
$tag = new SwatHtmlTag('span');
$tag->id = $this->id;
$tag->class = $this->getCSSClassString();
if ($this->tooltip !== null) {
$tag->title = $this->tooltip;
}
return $tag;
} | php | protected function getInsensitiveTag()
{
$tag = new SwatHtmlTag('span');
$tag->id = $this->id;
$tag->class = $this->getCSSClassString();
if ($this->tooltip !== null) {
$tag->title = $this->tooltip;
}
return $tag;
} | [
"protected",
"function",
"getInsensitiveTag",
"(",
")",
"{",
"$",
"tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'span'",
")",
";",
"$",
"tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"tooltip",
"!==",
"null",
")",
"{",
"$",
"tag",
"->",
"title",
"=",
"$",
"this",
"->",
"tooltip",
";",
"}",
"return",
"$",
"tag",
";",
"}"
] | Gets the tag used to display this tool link when it is not sensitive
@return SwatHtmlTag the tag used to display this tool link when it is
not sensitive. | [
"Gets",
"the",
"tag",
"used",
"to",
"display",
"this",
"tool",
"link",
"when",
"it",
"is",
"not",
"sensitive"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatToolLink.php#L353-L365 |
33,641 | silverorange/swat | Swat/SwatNullTextCellRenderer.php | SwatNullTextCellRenderer.render | public function render()
{
if (!$this->visible) {
return;
}
$is_null = $this->strict ? $this->text === null : $this->text == null;
if ($is_null) {
$this->text = $this->null_text;
echo '<span class="swat-null-text-cell-renderer">';
parent::render();
echo '</span>';
// Reset the text so that subsequent $is_null checks pass.
$this->text = null;
} else {
parent::render();
}
} | php | public function render()
{
if (!$this->visible) {
return;
}
$is_null = $this->strict ? $this->text === null : $this->text == null;
if ($is_null) {
$this->text = $this->null_text;
echo '<span class="swat-null-text-cell-renderer">';
parent::render();
echo '</span>';
// Reset the text so that subsequent $is_null checks pass.
$this->text = null;
} else {
parent::render();
}
} | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"$",
"is_null",
"=",
"$",
"this",
"->",
"strict",
"?",
"$",
"this",
"->",
"text",
"===",
"null",
":",
"$",
"this",
"->",
"text",
"==",
"null",
";",
"if",
"(",
"$",
"is_null",
")",
"{",
"$",
"this",
"->",
"text",
"=",
"$",
"this",
"->",
"null_text",
";",
"echo",
"'<span class=\"swat-null-text-cell-renderer\">'",
";",
"parent",
"::",
"render",
"(",
")",
";",
"echo",
"'</span>'",
";",
"// Reset the text so that subsequent $is_null checks pass.",
"$",
"this",
"->",
"text",
"=",
"null",
";",
"}",
"else",
"{",
"parent",
"::",
"render",
"(",
")",
";",
"}",
"}"
] | Renders this cell renderer | [
"Renders",
"this",
"cell",
"renderer"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatNullTextCellRenderer.php#L53-L73 |
33,642 | silverorange/swat | Swat/SwatActionItem.php | SwatActionItem.setWidget | public function setWidget(SwatWidget $widget)
{
if ($this->widget !== null) {
throw new SwatException(
'SwatUI: Only one widget can be nested ' .
'within a SwatActionItem'
);
}
$this->widget = $widget;
$widget->parent = $this;
} | php | public function setWidget(SwatWidget $widget)
{
if ($this->widget !== null) {
throw new SwatException(
'SwatUI: Only one widget can be nested ' .
'within a SwatActionItem'
);
}
$this->widget = $widget;
$widget->parent = $this;
} | [
"public",
"function",
"setWidget",
"(",
"SwatWidget",
"$",
"widget",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"widget",
"!==",
"null",
")",
"{",
"throw",
"new",
"SwatException",
"(",
"'SwatUI: Only one widget can be nested '",
".",
"'within a SwatActionItem'",
")",
";",
"}",
"$",
"this",
"->",
"widget",
"=",
"$",
"widget",
";",
"$",
"widget",
"->",
"parent",
"=",
"$",
"this",
";",
"}"
] | Sets the widget to use for this item
Each SwatActionItem can have one associated SwatWidget. This method
sets the widget for this item.
@param SwatWidget $widget the widget associated with this action.
@throws SwatException | [
"Sets",
"the",
"widget",
"to",
"use",
"for",
"this",
"item"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatActionItem.php#L87-L98 |
33,643 | silverorange/swat | Swat/SwatRadioNoteBook.php | SwatRadioNoteBook.getPage | public function getPage($id)
{
$found_page = null;
foreach ($this->pages as $page) {
if ($page->id == $id) {
$found_page = $page;
break;
}
}
return $found_page;
} | php | public function getPage($id)
{
$found_page = null;
foreach ($this->pages as $page) {
if ($page->id == $id) {
$found_page = $page;
break;
}
}
return $found_page;
} | [
"public",
"function",
"getPage",
"(",
"$",
"id",
")",
"{",
"$",
"found_page",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"pages",
"as",
"$",
"page",
")",
"{",
"if",
"(",
"$",
"page",
"->",
"id",
"==",
"$",
"id",
")",
"{",
"$",
"found_page",
"=",
"$",
"page",
";",
"break",
";",
"}",
"}",
"return",
"$",
"found_page",
";",
"}"
] | Gets a page in this notebook
Retrieves a page from the list of pages in this notebook based on
the unique identifier of the page.
@param string $id the unique id of the page to look for.
@return SwatNoteBookPage the found page or null if not found. | [
"Gets",
"a",
"page",
"in",
"this",
"notebook"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRadioNoteBook.php#L132-L144 |
33,644 | silverorange/swat | Swat/SwatRadioNoteBook.php | SwatRadioNoteBook.init | public function init()
{
parent::init();
foreach ($this->children as $child) {
$child->init();
foreach ($child->getPages() as $page) {
$this->addPage($page);
}
}
foreach ($this->pages as $page) {
$page->init();
}
} | php | public function init()
{
parent::init();
foreach ($this->children as $child) {
$child->init();
foreach ($child->getPages() as $page) {
$this->addPage($page);
}
}
foreach ($this->pages as $page) {
$page->init();
}
} | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"children",
"as",
"$",
"child",
")",
"{",
"$",
"child",
"->",
"init",
"(",
")",
";",
"foreach",
"(",
"$",
"child",
"->",
"getPages",
"(",
")",
"as",
"$",
"page",
")",
"{",
"$",
"this",
"->",
"addPage",
"(",
"$",
"page",
")",
";",
"}",
"}",
"foreach",
"(",
"$",
"this",
"->",
"pages",
"as",
"$",
"page",
")",
"{",
"$",
"page",
"->",
"init",
"(",
")",
";",
"}",
"}"
] | Initializes this notebook | [
"Initializes",
"this",
"notebook"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRadioNoteBook.php#L152-L166 |
33,645 | silverorange/swat | Swat/SwatRadioNoteBook.php | SwatRadioNoteBook.process | public function process()
{
parent::process();
if (!$this->processValue()) {
return;
}
if (
$this->required &&
$this->isSensitive() &&
$this->selected_page == ''
) {
$this->addMessage($this->getValidationMessage('required'));
}
foreach ($this->pages as $page) {
if ($page->id == $this->selected_page) {
$page->process();
}
}
} | php | public function process()
{
parent::process();
if (!$this->processValue()) {
return;
}
if (
$this->required &&
$this->isSensitive() &&
$this->selected_page == ''
) {
$this->addMessage($this->getValidationMessage('required'));
}
foreach ($this->pages as $page) {
if ($page->id == $this->selected_page) {
$page->process();
}
}
} | [
"public",
"function",
"process",
"(",
")",
"{",
"parent",
"::",
"process",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"processValue",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"required",
"&&",
"$",
"this",
"->",
"isSensitive",
"(",
")",
"&&",
"$",
"this",
"->",
"selected_page",
"==",
"''",
")",
"{",
"$",
"this",
"->",
"addMessage",
"(",
"$",
"this",
"->",
"getValidationMessage",
"(",
"'required'",
")",
")",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"pages",
"as",
"$",
"page",
")",
"{",
"if",
"(",
"$",
"page",
"->",
"id",
"==",
"$",
"this",
"->",
"selected_page",
")",
"{",
"$",
"page",
"->",
"process",
"(",
")",
";",
"}",
"}",
"}"
] | Processes this notebook | [
"Processes",
"this",
"notebook"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRadioNoteBook.php#L174-L195 |
33,646 | silverorange/swat | Swat/SwatRadioNoteBook.php | SwatRadioNoteBook.getMessages | public function getMessages()
{
$messages = parent::getMessages();
foreach ($this->pages as $page) {
$messages = array_merge($messages, $page->getMessages());
}
return $messages;
} | php | public function getMessages()
{
$messages = parent::getMessages();
foreach ($this->pages as $page) {
$messages = array_merge($messages, $page->getMessages());
}
return $messages;
} | [
"public",
"function",
"getMessages",
"(",
")",
"{",
"$",
"messages",
"=",
"parent",
"::",
"getMessages",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"pages",
"as",
"$",
"page",
")",
"{",
"$",
"messages",
"=",
"array_merge",
"(",
"$",
"messages",
",",
"$",
"page",
"->",
"getMessages",
"(",
")",
")",
";",
"}",
"return",
"$",
"messages",
";",
"}"
] | Gets all messaages
Gathers all messages from pages of this notebook and from this notebook
itself.
@return array an array of {@link SwatMessage} objects.
@see SwatMessage | [
"Gets",
"all",
"messaages"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRadioNoteBook.php#L276-L285 |
33,647 | silverorange/swat | Swat/SwatRadioNoteBook.php | SwatRadioNoteBook.processValue | public function processValue()
{
$form = $this->getForm();
if ($form->getHiddenField($this->id . '_submitted') === null) {
return false;
}
$data = &$form->getFormData();
if (isset($data[$this->id])) {
// get selected page id, strip off this id prefix
$this->selected_page = mb_substr(
$data[$this->id],
mb_strlen($this->id) + 1
);
} else {
$this->selected_page = null;
}
return true;
} | php | public function processValue()
{
$form = $this->getForm();
if ($form->getHiddenField($this->id . '_submitted') === null) {
return false;
}
$data = &$form->getFormData();
if (isset($data[$this->id])) {
// get selected page id, strip off this id prefix
$this->selected_page = mb_substr(
$data[$this->id],
mb_strlen($this->id) + 1
);
} else {
$this->selected_page = null;
}
return true;
} | [
"public",
"function",
"processValue",
"(",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"getForm",
"(",
")",
";",
"if",
"(",
"$",
"form",
"->",
"getHiddenField",
"(",
"$",
"this",
"->",
"id",
".",
"'_submitted'",
")",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"$",
"data",
"=",
"&",
"$",
"form",
"->",
"getFormData",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"$",
"this",
"->",
"id",
"]",
")",
")",
"{",
"// get selected page id, strip off this id prefix",
"$",
"this",
"->",
"selected_page",
"=",
"mb_substr",
"(",
"$",
"data",
"[",
"$",
"this",
"->",
"id",
"]",
",",
"mb_strlen",
"(",
"$",
"this",
"->",
"id",
")",
"+",
"1",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"selected_page",
"=",
"null",
";",
"}",
"return",
"true",
";",
"}"
] | Processes the value of this radio list from user-submitted form data
This method can be used to process the list value without processing
the selected page widget sub-tree.
@return boolean true if the value was processed from form data | [
"Processes",
"the",
"value",
"of",
"this",
"radio",
"list",
"from",
"user",
"-",
"submitted",
"form",
"data"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRadioNoteBook.php#L524-L545 |
33,648 | silverorange/swat | Swat/SwatRadioNoteBook.php | SwatRadioNoteBook.displayPage | protected function displayPage(SwatNoteBookPage $page, $count = 0)
{
echo '<tr class="swat-radio-note-book-option-row">';
echo '<td>';
$radio = new SwatHtmlTag('input');
$radio->type = 'radio';
$radio->name = $this->id;
$radio->id = $this->id . '_' . $page->id;
$radio->value = $this->id . '_' . $page->id;
if ($page->id == $this->selected_page) {
$radio->checked = 'checked';
}
echo '<span class="swat-radio-wrapper">';
$radio->display();
echo '<span class="swat-radio-shim"></span>';
echo '</span>';
echo '</td>';
echo '<td>';
$label = new SwatHtmlTag('label');
$label->for = $this->id . '_' . $page->id;
$label->setContent($page->title, $page->title_content_type);
$label->display();
echo '</td>';
echo '</tr>';
echo '<tr class="swat-radio-note-book-page-row">';
echo '<td></td>';
$td = new SwatHtmlTag('td');
$td->class = 'swat-radio-note-book-page';
if ($page->id == $this->selected_page) {
$td->class .= ' selected';
}
$td->open();
echo '<div class="swat-radio-note-book-page-container">';
$page->display();
echo '</div>';
$td->close();
echo '</tr>';
} | php | protected function displayPage(SwatNoteBookPage $page, $count = 0)
{
echo '<tr class="swat-radio-note-book-option-row">';
echo '<td>';
$radio = new SwatHtmlTag('input');
$radio->type = 'radio';
$radio->name = $this->id;
$radio->id = $this->id . '_' . $page->id;
$radio->value = $this->id . '_' . $page->id;
if ($page->id == $this->selected_page) {
$radio->checked = 'checked';
}
echo '<span class="swat-radio-wrapper">';
$radio->display();
echo '<span class="swat-radio-shim"></span>';
echo '</span>';
echo '</td>';
echo '<td>';
$label = new SwatHtmlTag('label');
$label->for = $this->id . '_' . $page->id;
$label->setContent($page->title, $page->title_content_type);
$label->display();
echo '</td>';
echo '</tr>';
echo '<tr class="swat-radio-note-book-page-row">';
echo '<td></td>';
$td = new SwatHtmlTag('td');
$td->class = 'swat-radio-note-book-page';
if ($page->id == $this->selected_page) {
$td->class .= ' selected';
}
$td->open();
echo '<div class="swat-radio-note-book-page-container">';
$page->display();
echo '</div>';
$td->close();
echo '</tr>';
} | [
"protected",
"function",
"displayPage",
"(",
"SwatNoteBookPage",
"$",
"page",
",",
"$",
"count",
"=",
"0",
")",
"{",
"echo",
"'<tr class=\"swat-radio-note-book-option-row\">'",
";",
"echo",
"'<td>'",
";",
"$",
"radio",
"=",
"new",
"SwatHtmlTag",
"(",
"'input'",
")",
";",
"$",
"radio",
"->",
"type",
"=",
"'radio'",
";",
"$",
"radio",
"->",
"name",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"radio",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
".",
"'_'",
".",
"$",
"page",
"->",
"id",
";",
"$",
"radio",
"->",
"value",
"=",
"$",
"this",
"->",
"id",
".",
"'_'",
".",
"$",
"page",
"->",
"id",
";",
"if",
"(",
"$",
"page",
"->",
"id",
"==",
"$",
"this",
"->",
"selected_page",
")",
"{",
"$",
"radio",
"->",
"checked",
"=",
"'checked'",
";",
"}",
"echo",
"'<span class=\"swat-radio-wrapper\">'",
";",
"$",
"radio",
"->",
"display",
"(",
")",
";",
"echo",
"'<span class=\"swat-radio-shim\"></span>'",
";",
"echo",
"'</span>'",
";",
"echo",
"'</td>'",
";",
"echo",
"'<td>'",
";",
"$",
"label",
"=",
"new",
"SwatHtmlTag",
"(",
"'label'",
")",
";",
"$",
"label",
"->",
"for",
"=",
"$",
"this",
"->",
"id",
".",
"'_'",
".",
"$",
"page",
"->",
"id",
";",
"$",
"label",
"->",
"setContent",
"(",
"$",
"page",
"->",
"title",
",",
"$",
"page",
"->",
"title_content_type",
")",
";",
"$",
"label",
"->",
"display",
"(",
")",
";",
"echo",
"'</td>'",
";",
"echo",
"'</tr>'",
";",
"echo",
"'<tr class=\"swat-radio-note-book-page-row\">'",
";",
"echo",
"'<td></td>'",
";",
"$",
"td",
"=",
"new",
"SwatHtmlTag",
"(",
"'td'",
")",
";",
"$",
"td",
"->",
"class",
"=",
"'swat-radio-note-book-page'",
";",
"if",
"(",
"$",
"page",
"->",
"id",
"==",
"$",
"this",
"->",
"selected_page",
")",
"{",
"$",
"td",
"->",
"class",
".=",
"' selected'",
";",
"}",
"$",
"td",
"->",
"open",
"(",
")",
";",
"echo",
"'<div class=\"swat-radio-note-book-page-container\">'",
";",
"$",
"page",
"->",
"display",
"(",
")",
";",
"echo",
"'</div>'",
";",
"$",
"td",
"->",
"close",
"(",
")",
";",
"echo",
"'</tr>'",
";",
"}"
] | Displays an individual page in this radio notebook
@param SwatNoteBookPage $page the page to display
@param integer $count the ordinal idnex of the page being displayed
starting at 1. | [
"Displays",
"an",
"individual",
"page",
"in",
"this",
"radio",
"notebook"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRadioNoteBook.php#L557-L605 |
33,649 | silverorange/swat | Swat/SwatRadioNoteBook.php | SwatRadioNoteBook.displaySinglePage | protected function displaySinglePage(SwatNoteBookPage $page)
{
$container = new SwatHtmlTag('div');
$container->id = $this->id;
$container->class = 'swat-radio-note-book';
$container->open();
$div = new SwatHtmlTag('div');
$div->class = 'swat-radio-note-book-page';
$div->open();
$page->display();
$div->close();
$input = new SwatHtmlTag('input');
$input->type = 'hidden';
$input->name = $this->id;
$input->id = $this->id . '_' . $page->id;
$input->value = $this->id . '_' . $page->id;
$input->display();
$container->close();
} | php | protected function displaySinglePage(SwatNoteBookPage $page)
{
$container = new SwatHtmlTag('div');
$container->id = $this->id;
$container->class = 'swat-radio-note-book';
$container->open();
$div = new SwatHtmlTag('div');
$div->class = 'swat-radio-note-book-page';
$div->open();
$page->display();
$div->close();
$input = new SwatHtmlTag('input');
$input->type = 'hidden';
$input->name = $this->id;
$input->id = $this->id . '_' . $page->id;
$input->value = $this->id . '_' . $page->id;
$input->display();
$container->close();
} | [
"protected",
"function",
"displaySinglePage",
"(",
"SwatNoteBookPage",
"$",
"page",
")",
"{",
"$",
"container",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"container",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"container",
"->",
"class",
"=",
"'swat-radio-note-book'",
";",
"$",
"container",
"->",
"open",
"(",
")",
";",
"$",
"div",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"div",
"->",
"class",
"=",
"'swat-radio-note-book-page'",
";",
"$",
"div",
"->",
"open",
"(",
")",
";",
"$",
"page",
"->",
"display",
"(",
")",
";",
"$",
"div",
"->",
"close",
"(",
")",
";",
"$",
"input",
"=",
"new",
"SwatHtmlTag",
"(",
"'input'",
")",
";",
"$",
"input",
"->",
"type",
"=",
"'hidden'",
";",
"$",
"input",
"->",
"name",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"input",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
".",
"'_'",
".",
"$",
"page",
"->",
"id",
";",
"$",
"input",
"->",
"value",
"=",
"$",
"this",
"->",
"id",
".",
"'_'",
".",
"$",
"page",
"->",
"id",
";",
"$",
"input",
"->",
"display",
"(",
")",
";",
"$",
"container",
"->",
"close",
"(",
")",
";",
"}"
] | Displays the only page of this notebook if this notebook contains only
one page
@param SwatNoteBookPage $page the page to display. | [
"Displays",
"the",
"only",
"page",
"of",
"this",
"notebook",
"if",
"this",
"notebook",
"contains",
"only",
"one",
"page"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatRadioNoteBook.php#L616-L637 |
33,650 | honey-comb/core | src/Models/HCUser.php | HCUser.updateLastLogin | public function updateLastLogin(string $time = null): void
{
$this->timestamps = false;
$this->last_login = is_null($time) ? $this->freshTimestamp() : $time;
$this->save();
$this->updateLastActivity();
} | php | public function updateLastLogin(string $time = null): void
{
$this->timestamps = false;
$this->last_login = is_null($time) ? $this->freshTimestamp() : $time;
$this->save();
$this->updateLastActivity();
} | [
"public",
"function",
"updateLastLogin",
"(",
"string",
"$",
"time",
"=",
"null",
")",
":",
"void",
"{",
"$",
"this",
"->",
"timestamps",
"=",
"false",
";",
"$",
"this",
"->",
"last_login",
"=",
"is_null",
"(",
"$",
"time",
")",
"?",
"$",
"this",
"->",
"freshTimestamp",
"(",
")",
":",
"$",
"time",
";",
"$",
"this",
"->",
"save",
"(",
")",
";",
"$",
"this",
"->",
"updateLastActivity",
"(",
")",
";",
"}"
] | Update last login timestamp
@param null|string $time
@throws \Exception | [
"Update",
"last",
"login",
"timestamp"
] | 5c12aba31cae092e9681f0ae3e3664ed3fcec956 | https://github.com/honey-comb/core/blob/5c12aba31cae092e9681f0ae3e3664ed3fcec956/src/Models/HCUser.php#L154-L161 |
33,651 | honey-comb/core | src/Models/HCUser.php | HCUser.updateLastActivity | public function updateLastActivity(string $time = null): void
{
$this->timestamps = false;
$this->last_activity = is_null($time) ? $this->freshTimestamp() : $time;
$this->save();
} | php | public function updateLastActivity(string $time = null): void
{
$this->timestamps = false;
$this->last_activity = is_null($time) ? $this->freshTimestamp() : $time;
$this->save();
} | [
"public",
"function",
"updateLastActivity",
"(",
"string",
"$",
"time",
"=",
"null",
")",
":",
"void",
"{",
"$",
"this",
"->",
"timestamps",
"=",
"false",
";",
"$",
"this",
"->",
"last_activity",
"=",
"is_null",
"(",
"$",
"time",
")",
"?",
"$",
"this",
"->",
"freshTimestamp",
"(",
")",
":",
"$",
"time",
";",
"$",
"this",
"->",
"save",
"(",
")",
";",
"}"
] | Update last activity timestamp
@param null|string $time
@throws \Exception | [
"Update",
"last",
"activity",
"timestamp"
] | 5c12aba31cae092e9681f0ae3e3664ed3fcec956 | https://github.com/honey-comb/core/blob/5c12aba31cae092e9681f0ae3e3664ed3fcec956/src/Models/HCUser.php#L169-L174 |
33,652 | silverorange/swat | Swat/SwatMoneyEntry.php | SwatMoneyEntry.display | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
if ($this->display_currency) {
$locale = SwatI18NLocale::get($this->locale);
echo SwatString::minimizeEntities(
' ' . $locale->getInternationalCurrencySymbol()
);
}
} | php | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
if ($this->display_currency) {
$locale = SwatI18NLocale::get($this->locale);
echo SwatString::minimizeEntities(
' ' . $locale->getInternationalCurrencySymbol()
);
}
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"display",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"display_currency",
")",
"{",
"$",
"locale",
"=",
"SwatI18NLocale",
"::",
"get",
"(",
"$",
"this",
"->",
"locale",
")",
";",
"echo",
"SwatString",
"::",
"minimizeEntities",
"(",
"' '",
".",
"$",
"locale",
"->",
"getInternationalCurrencySymbol",
"(",
")",
")",
";",
"}",
"}"
] | Displays this money entry widget
The widget is displayed as an input box and an optional currency symbol. | [
"Displays",
"this",
"money",
"entry",
"widget"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatMoneyEntry.php#L53-L67 |
33,653 | silverorange/swat | Swat/SwatMoneyEntry.php | SwatMoneyEntry.process | public function process()
{
parent::process();
if ($this->value === null) {
return;
}
$locale = SwatI18NLocale::get($this->locale);
$format = $locale->getNationalCurrencyFormat();
$max_decimal_places =
$this->decimal_places === null
? $format->fractional_digits
: $this->decimal_places;
$value = $this->getRawValue();
// Get the number of entered fractional digits places from the raw
// value. This checks the raw value instead of the processed value
// because the processed value could have been parsed into a float by
// this point.
$decimal_position = mb_strpos(
(string) $value,
$format->decimal_separator
);
if ($decimal_position === false) {
$decimal_places = 0;
} else {
$fractional_digits = mb_substr(
rtrim((string) $value, '0'),
$decimal_position + mb_strlen($format->decimal_separator)
);
$decimal_places = preg_match_all('/[0-9]/', $fractional_digits);
}
// check if length of the given fractional part is more than the
// allowed length
if ($decimal_places > $max_decimal_places) {
// validation failed so reset value to the raw value
$this->value = $value;
if ($this->decimal_places === null) {
$message = $this->getValidationMessage(
'currency-decimal-places'
);
$max_decimal_places_formatted = str_replace(
'%',
'%%',
$locale->formatNumber($max_decimal_places)
);
// C99 specification includes spacing character, remove it
$currency_formatted = str_replace(
'%',
'%%',
$locale->getInternationalCurrencySymbol()
);
$message->primary_content = sprintf(
$message->primary_content,
$currency_formatted,
$max_decimal_places_formatted
);
} else {
if ($max_decimal_places === 0) {
$message = $this->getValidationMessage('no-decimal-places');
} else {
$max_decimal_places_formatted = str_replace(
'%',
'%%',
$locale->formatNumber($max_decimal_places)
);
// note: not using getValidationMessage() because of
// ngettext. We may want to add this ability to that method
$message = new SwatMessage(
sprintf(
Swat::ngettext(
'The %%s field has too many decimal places. There ' .
'can be at most one decimal place.',
'The %%s field has too many decimal places. There ' .
'can be at most %s decimal places.',
$max_decimal_places
),
$max_decimal_places_formatted
),
'error'
);
}
}
$this->addMessage($message);
}
} | php | public function process()
{
parent::process();
if ($this->value === null) {
return;
}
$locale = SwatI18NLocale::get($this->locale);
$format = $locale->getNationalCurrencyFormat();
$max_decimal_places =
$this->decimal_places === null
? $format->fractional_digits
: $this->decimal_places;
$value = $this->getRawValue();
// Get the number of entered fractional digits places from the raw
// value. This checks the raw value instead of the processed value
// because the processed value could have been parsed into a float by
// this point.
$decimal_position = mb_strpos(
(string) $value,
$format->decimal_separator
);
if ($decimal_position === false) {
$decimal_places = 0;
} else {
$fractional_digits = mb_substr(
rtrim((string) $value, '0'),
$decimal_position + mb_strlen($format->decimal_separator)
);
$decimal_places = preg_match_all('/[0-9]/', $fractional_digits);
}
// check if length of the given fractional part is more than the
// allowed length
if ($decimal_places > $max_decimal_places) {
// validation failed so reset value to the raw value
$this->value = $value;
if ($this->decimal_places === null) {
$message = $this->getValidationMessage(
'currency-decimal-places'
);
$max_decimal_places_formatted = str_replace(
'%',
'%%',
$locale->formatNumber($max_decimal_places)
);
// C99 specification includes spacing character, remove it
$currency_formatted = str_replace(
'%',
'%%',
$locale->getInternationalCurrencySymbol()
);
$message->primary_content = sprintf(
$message->primary_content,
$currency_formatted,
$max_decimal_places_formatted
);
} else {
if ($max_decimal_places === 0) {
$message = $this->getValidationMessage('no-decimal-places');
} else {
$max_decimal_places_formatted = str_replace(
'%',
'%%',
$locale->formatNumber($max_decimal_places)
);
// note: not using getValidationMessage() because of
// ngettext. We may want to add this ability to that method
$message = new SwatMessage(
sprintf(
Swat::ngettext(
'The %%s field has too many decimal places. There ' .
'can be at most one decimal place.',
'The %%s field has too many decimal places. There ' .
'can be at most %s decimal places.',
$max_decimal_places
),
$max_decimal_places_formatted
),
'error'
);
}
}
$this->addMessage($message);
}
} | [
"public",
"function",
"process",
"(",
")",
"{",
"parent",
"::",
"process",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"value",
"===",
"null",
")",
"{",
"return",
";",
"}",
"$",
"locale",
"=",
"SwatI18NLocale",
"::",
"get",
"(",
"$",
"this",
"->",
"locale",
")",
";",
"$",
"format",
"=",
"$",
"locale",
"->",
"getNationalCurrencyFormat",
"(",
")",
";",
"$",
"max_decimal_places",
"=",
"$",
"this",
"->",
"decimal_places",
"===",
"null",
"?",
"$",
"format",
"->",
"fractional_digits",
":",
"$",
"this",
"->",
"decimal_places",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"getRawValue",
"(",
")",
";",
"// Get the number of entered fractional digits places from the raw",
"// value. This checks the raw value instead of the processed value",
"// because the processed value could have been parsed into a float by",
"// this point.",
"$",
"decimal_position",
"=",
"mb_strpos",
"(",
"(",
"string",
")",
"$",
"value",
",",
"$",
"format",
"->",
"decimal_separator",
")",
";",
"if",
"(",
"$",
"decimal_position",
"===",
"false",
")",
"{",
"$",
"decimal_places",
"=",
"0",
";",
"}",
"else",
"{",
"$",
"fractional_digits",
"=",
"mb_substr",
"(",
"rtrim",
"(",
"(",
"string",
")",
"$",
"value",
",",
"'0'",
")",
",",
"$",
"decimal_position",
"+",
"mb_strlen",
"(",
"$",
"format",
"->",
"decimal_separator",
")",
")",
";",
"$",
"decimal_places",
"=",
"preg_match_all",
"(",
"'/[0-9]/'",
",",
"$",
"fractional_digits",
")",
";",
"}",
"// check if length of the given fractional part is more than the",
"// allowed length",
"if",
"(",
"$",
"decimal_places",
">",
"$",
"max_decimal_places",
")",
"{",
"// validation failed so reset value to the raw value",
"$",
"this",
"->",
"value",
"=",
"$",
"value",
";",
"if",
"(",
"$",
"this",
"->",
"decimal_places",
"===",
"null",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"getValidationMessage",
"(",
"'currency-decimal-places'",
")",
";",
"$",
"max_decimal_places_formatted",
"=",
"str_replace",
"(",
"'%'",
",",
"'%%'",
",",
"$",
"locale",
"->",
"formatNumber",
"(",
"$",
"max_decimal_places",
")",
")",
";",
"// C99 specification includes spacing character, remove it",
"$",
"currency_formatted",
"=",
"str_replace",
"(",
"'%'",
",",
"'%%'",
",",
"$",
"locale",
"->",
"getInternationalCurrencySymbol",
"(",
")",
")",
";",
"$",
"message",
"->",
"primary_content",
"=",
"sprintf",
"(",
"$",
"message",
"->",
"primary_content",
",",
"$",
"currency_formatted",
",",
"$",
"max_decimal_places_formatted",
")",
";",
"}",
"else",
"{",
"if",
"(",
"$",
"max_decimal_places",
"===",
"0",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"getValidationMessage",
"(",
"'no-decimal-places'",
")",
";",
"}",
"else",
"{",
"$",
"max_decimal_places_formatted",
"=",
"str_replace",
"(",
"'%'",
",",
"'%%'",
",",
"$",
"locale",
"->",
"formatNumber",
"(",
"$",
"max_decimal_places",
")",
")",
";",
"// note: not using getValidationMessage() because of",
"// ngettext. We may want to add this ability to that method",
"$",
"message",
"=",
"new",
"SwatMessage",
"(",
"sprintf",
"(",
"Swat",
"::",
"ngettext",
"(",
"'The %%s field has too many decimal places. There '",
".",
"'can be at most one decimal place.'",
",",
"'The %%s field has too many decimal places. There '",
".",
"'can be at most %s decimal places.'",
",",
"$",
"max_decimal_places",
")",
",",
"$",
"max_decimal_places_formatted",
")",
",",
"'error'",
")",
";",
"}",
"}",
"$",
"this",
"->",
"addMessage",
"(",
"$",
"message",
")",
";",
"}",
"}"
] | Processes this money entry widget
If the value of this widget is not a monetary value or the number of
fractional decimal places is not within the allowed range, an error
message is attached to this money entry widget. | [
"Processes",
"this",
"money",
"entry",
"widget"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatMoneyEntry.php#L79-L174 |
33,654 | silverorange/swat | Swat/SwatMoneyEntry.php | SwatMoneyEntry.getDisplayValue | protected function getDisplayValue($value)
{
// if the value is valid, format accordingly
if (!$this->hasMessage() && is_numeric($value)) {
$value = SwatI18NLocale::get($this->locale)->formatCurrency(
$value,
false,
array('fractional_digits' => $this->decimal_places)
);
}
return $value;
} | php | protected function getDisplayValue($value)
{
// if the value is valid, format accordingly
if (!$this->hasMessage() && is_numeric($value)) {
$value = SwatI18NLocale::get($this->locale)->formatCurrency(
$value,
false,
array('fractional_digits' => $this->decimal_places)
);
}
return $value;
} | [
"protected",
"function",
"getDisplayValue",
"(",
"$",
"value",
")",
"{",
"// if the value is valid, format accordingly",
"if",
"(",
"!",
"$",
"this",
"->",
"hasMessage",
"(",
")",
"&&",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"SwatI18NLocale",
"::",
"get",
"(",
"$",
"this",
"->",
"locale",
")",
"->",
"formatCurrency",
"(",
"$",
"value",
",",
"false",
",",
"array",
"(",
"'fractional_digits'",
"=>",
"$",
"this",
"->",
"decimal_places",
")",
")",
";",
"}",
"return",
"$",
"value",
";",
"}"
] | Formats a monetary value to display
@param string $value the value to format for display.
@return string the formatted value. | [
"Formats",
"a",
"monetary",
"value",
"to",
"display"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatMoneyEntry.php#L186-L198 |
33,655 | silverorange/swat | Swat/SwatMoneyEntry.php | SwatMoneyEntry.getValidationMessage | protected function getValidationMessage($id)
{
switch ($id) {
case 'float':
$locale = SwatI18NLocale::get($this->locale);
$currency = $locale->getInternationalCurrencySymbol();
$example = $locale->formatCurrency(1036.95, false, array(
'fractional_digits' => $this->decimal_places
));
$text = sprintf(
$this->show_field_title_in_messages
? Swat::_(
'The %%s field must be a monetary value ' .
'formatted for %s (i.e. %s).'
)
: Swat::_(
'This field must be a monetary value ' .
'formatted for %s (i.e. %s).'
),
str_replace('%', '%%', $currency),
str_replace('%', '%%', $example)
);
$message = new SwatMessage($text, 'error');
break;
case 'currency-decimal-places':
$text = $this->show_field_title_in_messages
? Swat::_(
'The %%s field has too many decimal places. The ' .
'currency %s only allows %s.'
)
: Swat::_(
'This field has too many decimal places. The ' .
'currency %s only allows %s.'
);
$message = new SwatMessage($text, 'error');
break;
case 'no-decimal-places':
$text = $this->show_field_title_in_messages
? Swat::_('The %s field must not have any decimal places.')
: Swat::_('This field must not have any decimal places.');
$message = new SwatMessage($text, 'error');
break;
default:
$message = parent::getValidationMessage($id);
break;
}
return $message;
} | php | protected function getValidationMessage($id)
{
switch ($id) {
case 'float':
$locale = SwatI18NLocale::get($this->locale);
$currency = $locale->getInternationalCurrencySymbol();
$example = $locale->formatCurrency(1036.95, false, array(
'fractional_digits' => $this->decimal_places
));
$text = sprintf(
$this->show_field_title_in_messages
? Swat::_(
'The %%s field must be a monetary value ' .
'formatted for %s (i.e. %s).'
)
: Swat::_(
'This field must be a monetary value ' .
'formatted for %s (i.e. %s).'
),
str_replace('%', '%%', $currency),
str_replace('%', '%%', $example)
);
$message = new SwatMessage($text, 'error');
break;
case 'currency-decimal-places':
$text = $this->show_field_title_in_messages
? Swat::_(
'The %%s field has too many decimal places. The ' .
'currency %s only allows %s.'
)
: Swat::_(
'This field has too many decimal places. The ' .
'currency %s only allows %s.'
);
$message = new SwatMessage($text, 'error');
break;
case 'no-decimal-places':
$text = $this->show_field_title_in_messages
? Swat::_('The %s field must not have any decimal places.')
: Swat::_('This field must not have any decimal places.');
$message = new SwatMessage($text, 'error');
break;
default:
$message = parent::getValidationMessage($id);
break;
}
return $message;
} | [
"protected",
"function",
"getValidationMessage",
"(",
"$",
"id",
")",
"{",
"switch",
"(",
"$",
"id",
")",
"{",
"case",
"'float'",
":",
"$",
"locale",
"=",
"SwatI18NLocale",
"::",
"get",
"(",
"$",
"this",
"->",
"locale",
")",
";",
"$",
"currency",
"=",
"$",
"locale",
"->",
"getInternationalCurrencySymbol",
"(",
")",
";",
"$",
"example",
"=",
"$",
"locale",
"->",
"formatCurrency",
"(",
"1036.95",
",",
"false",
",",
"array",
"(",
"'fractional_digits'",
"=>",
"$",
"this",
"->",
"decimal_places",
")",
")",
";",
"$",
"text",
"=",
"sprintf",
"(",
"$",
"this",
"->",
"show_field_title_in_messages",
"?",
"Swat",
"::",
"_",
"(",
"'The %%s field must be a monetary value '",
".",
"'formatted for %s (i.e. %s).'",
")",
":",
"Swat",
"::",
"_",
"(",
"'This field must be a monetary value '",
".",
"'formatted for %s (i.e. %s).'",
")",
",",
"str_replace",
"(",
"'%'",
",",
"'%%'",
",",
"$",
"currency",
")",
",",
"str_replace",
"(",
"'%'",
",",
"'%%'",
",",
"$",
"example",
")",
")",
";",
"$",
"message",
"=",
"new",
"SwatMessage",
"(",
"$",
"text",
",",
"'error'",
")",
";",
"break",
";",
"case",
"'currency-decimal-places'",
":",
"$",
"text",
"=",
"$",
"this",
"->",
"show_field_title_in_messages",
"?",
"Swat",
"::",
"_",
"(",
"'The %%s field has too many decimal places. The '",
".",
"'currency %s only allows %s.'",
")",
":",
"Swat",
"::",
"_",
"(",
"'This field has too many decimal places. The '",
".",
"'currency %s only allows %s.'",
")",
";",
"$",
"message",
"=",
"new",
"SwatMessage",
"(",
"$",
"text",
",",
"'error'",
")",
";",
"break",
";",
"case",
"'no-decimal-places'",
":",
"$",
"text",
"=",
"$",
"this",
"->",
"show_field_title_in_messages",
"?",
"Swat",
"::",
"_",
"(",
"'The %s field must not have any decimal places.'",
")",
":",
"Swat",
"::",
"_",
"(",
"'This field must not have any decimal places.'",
")",
";",
"$",
"message",
"=",
"new",
"SwatMessage",
"(",
"$",
"text",
",",
"'error'",
")",
";",
"break",
";",
"default",
":",
"$",
"message",
"=",
"parent",
"::",
"getValidationMessage",
"(",
"$",
"id",
")",
";",
"break",
";",
"}",
"return",
"$",
"message",
";",
"}"
] | Gets a validation message for this money entry widget
@see SwatEntry::getValidationMessage()
@param string $id the string identifier of the validation message.
@return SwatMessage the validation message. | [
"Gets",
"a",
"validation",
"message",
"for",
"this",
"money",
"entry",
"widget"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatMoneyEntry.php#L227-L279 |
33,656 | spiral/dumper | src/System.php | System.isColorsSupported | public static function isColorsSupported($stream = STDOUT): bool
{
if ('Hyper' === getenv('TERM_PROGRAM')) {
return true;
}
try {
if (\DIRECTORY_SEPARATOR === '\\') {
return (
function_exists('sapi_windows_vt100_support')
&& @sapi_windows_vt100_support($stream)
) || getenv('ANSICON') !== false
|| getenv('ConEmuANSI') == 'ON'
|| getenv('TERM') == 'xterm';
}
if (\function_exists('stream_isatty')) {
return @stream_isatty($stream);
}
if (\function_exists('posix_isatty')) {
return @posix_isatty($stream);
}
$stat = @fstat($stream);
// Check if formatted mode is S_IFCHR
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
} catch (\Throwable $e) {
return false;
}
} | php | public static function isColorsSupported($stream = STDOUT): bool
{
if ('Hyper' === getenv('TERM_PROGRAM')) {
return true;
}
try {
if (\DIRECTORY_SEPARATOR === '\\') {
return (
function_exists('sapi_windows_vt100_support')
&& @sapi_windows_vt100_support($stream)
) || getenv('ANSICON') !== false
|| getenv('ConEmuANSI') == 'ON'
|| getenv('TERM') == 'xterm';
}
if (\function_exists('stream_isatty')) {
return @stream_isatty($stream);
}
if (\function_exists('posix_isatty')) {
return @posix_isatty($stream);
}
$stat = @fstat($stream);
// Check if formatted mode is S_IFCHR
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
} catch (\Throwable $e) {
return false;
}
} | [
"public",
"static",
"function",
"isColorsSupported",
"(",
"$",
"stream",
"=",
"STDOUT",
")",
":",
"bool",
"{",
"if",
"(",
"'Hyper'",
"===",
"getenv",
"(",
"'TERM_PROGRAM'",
")",
")",
"{",
"return",
"true",
";",
"}",
"try",
"{",
"if",
"(",
"\\",
"DIRECTORY_SEPARATOR",
"===",
"'\\\\'",
")",
"{",
"return",
"(",
"function_exists",
"(",
"'sapi_windows_vt100_support'",
")",
"&&",
"@",
"sapi_windows_vt100_support",
"(",
"$",
"stream",
")",
")",
"||",
"getenv",
"(",
"'ANSICON'",
")",
"!==",
"false",
"||",
"getenv",
"(",
"'ConEmuANSI'",
")",
"==",
"'ON'",
"||",
"getenv",
"(",
"'TERM'",
")",
"==",
"'xterm'",
";",
"}",
"if",
"(",
"\\",
"function_exists",
"(",
"'stream_isatty'",
")",
")",
"{",
"return",
"@",
"stream_isatty",
"(",
"$",
"stream",
")",
";",
"}",
"if",
"(",
"\\",
"function_exists",
"(",
"'posix_isatty'",
")",
")",
"{",
"return",
"@",
"posix_isatty",
"(",
"$",
"stream",
")",
";",
"}",
"$",
"stat",
"=",
"@",
"fstat",
"(",
"$",
"stream",
")",
";",
"// Check if formatted mode is S_IFCHR",
"return",
"$",
"stat",
"?",
"0020000",
"===",
"(",
"$",
"stat",
"[",
"'mode'",
"]",
"&",
"0170000",
")",
":",
"false",
";",
"}",
"catch",
"(",
"\\",
"Throwable",
"$",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}"
] | Returns true if the STDOUT supports colorization.
@codeCoverageIgnore
@link https://github.com/symfony/Console/blob/master/Output/StreamOutput.php#L94
@param mixed $stream
@return bool | [
"Returns",
"true",
"if",
"the",
"STDOUT",
"supports",
"colorization",
"."
] | 87bc579b0ecd69754197804b1fc5e0d5b3293bd3 | https://github.com/spiral/dumper/blob/87bc579b0ecd69754197804b1fc5e0d5b3293bd3/src/System.php#L45-L76 |
33,657 | brainworxx/kreXX | src/Service/Reflection/ReflectionClass.php | ReflectionClass.retrieveValue | public function retrieveValue(\ReflectionProperty $refProperty)
{
$propName = $refProperty->getName();
if (array_key_exists("\0*\0" . $propName, $this->objectArray)) {
// Protected or a private
return $this->objectArray["\0*\0" . $propName];
}
if (array_key_exists($propName, $this->objectArray)) {
// Must be a public. Those are rare.
return $this->objectArray[$propName];
}
if ($refProperty->isStatic() === true) {
// Static values are not inside the value array.
$refProperty->setAccessible(true);
return $refProperty->getValue($this->data);
}
// If we are facing multiple declarations, the declaring class name
// is set in front of the key.
$propName = "\0" . $refProperty->getDeclaringClass()->getName() . "\0" . $propName;
if (array_key_exists($propName, $this->objectArray)) {
// Found it!
return $this->objectArray[$propName];
}
// We are still here, which means that we are not able to get the value
// out of it. The only remaining possibility is, that this value was
// unset during runtime.
$refProperty->isUnset = true;
return null;
} | php | public function retrieveValue(\ReflectionProperty $refProperty)
{
$propName = $refProperty->getName();
if (array_key_exists("\0*\0" . $propName, $this->objectArray)) {
// Protected or a private
return $this->objectArray["\0*\0" . $propName];
}
if (array_key_exists($propName, $this->objectArray)) {
// Must be a public. Those are rare.
return $this->objectArray[$propName];
}
if ($refProperty->isStatic() === true) {
// Static values are not inside the value array.
$refProperty->setAccessible(true);
return $refProperty->getValue($this->data);
}
// If we are facing multiple declarations, the declaring class name
// is set in front of the key.
$propName = "\0" . $refProperty->getDeclaringClass()->getName() . "\0" . $propName;
if (array_key_exists($propName, $this->objectArray)) {
// Found it!
return $this->objectArray[$propName];
}
// We are still here, which means that we are not able to get the value
// out of it. The only remaining possibility is, that this value was
// unset during runtime.
$refProperty->isUnset = true;
return null;
} | [
"public",
"function",
"retrieveValue",
"(",
"\\",
"ReflectionProperty",
"$",
"refProperty",
")",
"{",
"$",
"propName",
"=",
"$",
"refProperty",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"\"\\0*\\0\"",
".",
"$",
"propName",
",",
"$",
"this",
"->",
"objectArray",
")",
")",
"{",
"// Protected or a private",
"return",
"$",
"this",
"->",
"objectArray",
"[",
"\"\\0*\\0\"",
".",
"$",
"propName",
"]",
";",
"}",
"if",
"(",
"array_key_exists",
"(",
"$",
"propName",
",",
"$",
"this",
"->",
"objectArray",
")",
")",
"{",
"// Must be a public. Those are rare.",
"return",
"$",
"this",
"->",
"objectArray",
"[",
"$",
"propName",
"]",
";",
"}",
"if",
"(",
"$",
"refProperty",
"->",
"isStatic",
"(",
")",
"===",
"true",
")",
"{",
"// Static values are not inside the value array.",
"$",
"refProperty",
"->",
"setAccessible",
"(",
"true",
")",
";",
"return",
"$",
"refProperty",
"->",
"getValue",
"(",
"$",
"this",
"->",
"data",
")",
";",
"}",
"// If we are facing multiple declarations, the declaring class name",
"// is set in front of the key.",
"$",
"propName",
"=",
"\"\\0\"",
".",
"$",
"refProperty",
"->",
"getDeclaringClass",
"(",
")",
"->",
"getName",
"(",
")",
".",
"\"\\0\"",
".",
"$",
"propName",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"propName",
",",
"$",
"this",
"->",
"objectArray",
")",
")",
"{",
"// Found it!",
"return",
"$",
"this",
"->",
"objectArray",
"[",
"$",
"propName",
"]",
";",
"}",
"// We are still here, which means that we are not able to get the value",
"// out of it. The only remaining possibility is, that this value was",
"// unset during runtime.",
"$",
"refProperty",
"->",
"isUnset",
"=",
"true",
";",
"return",
"null",
";",
"}"
] | Retrieve the value from the object, if possible.
@param \ReflectionProperty $refProperty
The reflection of the property we are analysing.
@return mixed;
The retrieved value. | [
"Retrieve",
"the",
"value",
"from",
"the",
"object",
"if",
"possible",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Reflection/ReflectionClass.php#L84-L117 |
33,658 | silverorange/swat | Swat/SwatError.php | SwatError.process | public function process()
{
if (ini_get('display_errors')) {
$this->display();
}
if (ini_get('log_errors')) {
$this->log();
}
if ($this->severity & self::$fatal_severity) {
exit(1);
}
} | php | public function process()
{
if (ini_get('display_errors')) {
$this->display();
}
if (ini_get('log_errors')) {
$this->log();
}
if ($this->severity & self::$fatal_severity) {
exit(1);
}
} | [
"public",
"function",
"process",
"(",
")",
"{",
"if",
"(",
"ini_get",
"(",
"'display_errors'",
")",
")",
"{",
"$",
"this",
"->",
"display",
"(",
")",
";",
"}",
"if",
"(",
"ini_get",
"(",
"'log_errors'",
")",
")",
"{",
"$",
"this",
"->",
"log",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"severity",
"&",
"self",
"::",
"$",
"fatal_severity",
")",
"{",
"exit",
"(",
"1",
")",
";",
"}",
"}"
] | Processes this error
Processing involves displaying errors, logging errors and sending
error message emails.
If a fatal error has occured, this calls exit to ensure no further
processing is done. | [
"Processes",
"this",
"error"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatError.php#L202-L215 |
33,659 | silverorange/swat | Swat/SwatError.php | SwatError.log | public function log()
{
if (count(self::$loggers) === 0) {
error_log($this->getSummary(), 0);
} else {
foreach (self::$loggers as $logger) {
$logger->log($this);
}
}
} | php | public function log()
{
if (count(self::$loggers) === 0) {
error_log($this->getSummary(), 0);
} else {
foreach (self::$loggers as $logger) {
$logger->log($this);
}
}
} | [
"public",
"function",
"log",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"self",
"::",
"$",
"loggers",
")",
"===",
"0",
")",
"{",
"error_log",
"(",
"$",
"this",
"->",
"getSummary",
"(",
")",
",",
"0",
")",
";",
"}",
"else",
"{",
"foreach",
"(",
"self",
"::",
"$",
"loggers",
"as",
"$",
"logger",
")",
"{",
"$",
"logger",
"->",
"log",
"(",
"$",
"this",
")",
";",
"}",
"}",
"}"
] | Logs this error
The error is logged to the webserver error log. | [
"Logs",
"this",
"error"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatError.php#L277-L286 |
33,660 | silverorange/swat | Swat/SwatError.php | SwatError.getSummary | public function getSummary()
{
ob_start();
printf(
"%s error in file '%s' line %s",
$this->getSeverityString(),
$this->file,
$this->line
);
return ob_get_clean();
} | php | public function getSummary()
{
ob_start();
printf(
"%s error in file '%s' line %s",
$this->getSeverityString(),
$this->file,
$this->line
);
return ob_get_clean();
} | [
"public",
"function",
"getSummary",
"(",
")",
"{",
"ob_start",
"(",
")",
";",
"printf",
"(",
"\"%s error in file '%s' line %s\"",
",",
"$",
"this",
"->",
"getSeverityString",
"(",
")",
",",
"$",
"this",
"->",
"file",
",",
"$",
"this",
"->",
"line",
")",
";",
"return",
"ob_get_clean",
"(",
")",
";",
"}"
] | Gets a one-line short text summary of this error
This summary is useful for log entries and error email titles.
@return string a one-line summary of this error. | [
"Gets",
"a",
"one",
"-",
"line",
"short",
"text",
"summary",
"of",
"this",
"error"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatError.php#L315-L327 |
33,661 | silverorange/swat | Swat/SwatError.php | SwatError.toString | public function toString()
{
ob_start();
printf(
"%s:\n\nMessage:\n\t%s\n\n" . "In file '%s' on line %s.\n\n",
$this->getSeverityString(),
$this->message,
$this->file,
$this->line
);
echo "Stack Trace:\n";
$count = count($this->backtrace);
foreach ($this->backtrace as $entry) {
$class = array_key_exists('class', $entry) ? $entry['class'] : null;
$function = array_key_exists('function', $entry)
? $entry['function']
: null;
if (array_key_exists('args', $entry)) {
$arguments = $this->getArguments(
$entry['args'],
$function,
$class
);
} else {
$arguments = '';
}
printf(
"%s. In file '%s' on line %s.\n%sMethod: %s%s%s(%s)\n",
str_pad(--$count, 6, ' ', STR_PAD_LEFT),
array_key_exists('file', $entry) ? $entry['file'] : 'unknown',
array_key_exists('line', $entry) ? $entry['line'] : 'unknown',
str_repeat(' ', 8),
$class === null ? '' : $class,
array_key_exists('type', $entry) ? $entry['type'] : '',
$function === null ? '' : $function,
$arguments
);
}
echo "\n";
return ob_get_clean();
} | php | public function toString()
{
ob_start();
printf(
"%s:\n\nMessage:\n\t%s\n\n" . "In file '%s' on line %s.\n\n",
$this->getSeverityString(),
$this->message,
$this->file,
$this->line
);
echo "Stack Trace:\n";
$count = count($this->backtrace);
foreach ($this->backtrace as $entry) {
$class = array_key_exists('class', $entry) ? $entry['class'] : null;
$function = array_key_exists('function', $entry)
? $entry['function']
: null;
if (array_key_exists('args', $entry)) {
$arguments = $this->getArguments(
$entry['args'],
$function,
$class
);
} else {
$arguments = '';
}
printf(
"%s. In file '%s' on line %s.\n%sMethod: %s%s%s(%s)\n",
str_pad(--$count, 6, ' ', STR_PAD_LEFT),
array_key_exists('file', $entry) ? $entry['file'] : 'unknown',
array_key_exists('line', $entry) ? $entry['line'] : 'unknown',
str_repeat(' ', 8),
$class === null ? '' : $class,
array_key_exists('type', $entry) ? $entry['type'] : '',
$function === null ? '' : $function,
$arguments
);
}
echo "\n";
return ob_get_clean();
} | [
"public",
"function",
"toString",
"(",
")",
"{",
"ob_start",
"(",
")",
";",
"printf",
"(",
"\"%s:\\n\\nMessage:\\n\\t%s\\n\\n\"",
".",
"\"In file '%s' on line %s.\\n\\n\"",
",",
"$",
"this",
"->",
"getSeverityString",
"(",
")",
",",
"$",
"this",
"->",
"message",
",",
"$",
"this",
"->",
"file",
",",
"$",
"this",
"->",
"line",
")",
";",
"echo",
"\"Stack Trace:\\n\"",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"this",
"->",
"backtrace",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"backtrace",
"as",
"$",
"entry",
")",
"{",
"$",
"class",
"=",
"array_key_exists",
"(",
"'class'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'class'",
"]",
":",
"null",
";",
"$",
"function",
"=",
"array_key_exists",
"(",
"'function'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'function'",
"]",
":",
"null",
";",
"if",
"(",
"array_key_exists",
"(",
"'args'",
",",
"$",
"entry",
")",
")",
"{",
"$",
"arguments",
"=",
"$",
"this",
"->",
"getArguments",
"(",
"$",
"entry",
"[",
"'args'",
"]",
",",
"$",
"function",
",",
"$",
"class",
")",
";",
"}",
"else",
"{",
"$",
"arguments",
"=",
"''",
";",
"}",
"printf",
"(",
"\"%s. In file '%s' on line %s.\\n%sMethod: %s%s%s(%s)\\n\"",
",",
"str_pad",
"(",
"--",
"$",
"count",
",",
"6",
",",
"' '",
",",
"STR_PAD_LEFT",
")",
",",
"array_key_exists",
"(",
"'file'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'file'",
"]",
":",
"'unknown'",
",",
"array_key_exists",
"(",
"'line'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'line'",
"]",
":",
"'unknown'",
",",
"str_repeat",
"(",
"' '",
",",
"8",
")",
",",
"$",
"class",
"===",
"null",
"?",
"''",
":",
"$",
"class",
",",
"array_key_exists",
"(",
"'type'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'type'",
"]",
":",
"''",
",",
"$",
"function",
"===",
"null",
"?",
"''",
":",
"$",
"function",
",",
"$",
"arguments",
")",
";",
"}",
"echo",
"\"\\n\"",
";",
"return",
"ob_get_clean",
"(",
")",
";",
"}"
] | Gets this error as a nicely formatted text block
This is useful for text-based logs and emails.
@return string this error formatted as text. | [
"Gets",
"this",
"error",
"as",
"a",
"nicely",
"formatted",
"text",
"block"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatError.php#L339-L387 |
33,662 | silverorange/swat | Swat/SwatError.php | SwatError.toXHTML | public function toXHTML()
{
ob_start();
$this->displayStyleSheet();
echo '<div class="swat-exception">';
printf(
'<h3>%s</h3>' .
'<div class="swat-exception-body">' .
'Message:<div class="swat-exception-message">%s</div>' .
'Occurred in file <strong>%s</strong> ' .
'on line <strong>%s</strong>.<br /><br />',
$this->getSeverityString(),
nl2br(htmlspecialchars($this->message)),
$this->file,
$this->line
);
echo 'Stack Trace:<br /><dl>';
$count = count($this->backtrace);
foreach ($this->backtrace as $entry) {
$class = array_key_exists('class', $entry) ? $entry['class'] : null;
$function = array_key_exists('function', $entry)
? $entry['function']
: null;
if (array_key_exists('args', $entry)) {
$arguments = htmlspecialchars(
$this->getArguments($entry['args'], $function, $class),
null,
'UTF-8'
);
} else {
$arguments = '';
}
printf(
'<dt>%s.</dt><dd>In file <strong>%s</strong> ' .
'line <strong>%s</strong>.<br />Method: ' .
'<strong>%s%s%s(</strong>%s<strong>)</strong></dd>',
--$count,
array_key_exists('file', $entry) ? $entry['file'] : 'unknown',
array_key_exists('line', $entry) ? $entry['line'] : 'unknown',
$class === null ? '' : $class,
array_key_exists('type', $entry) ? $entry['type'] : '',
$function === null ? '' : $function,
$arguments
);
}
echo '</dl></div></div>';
return ob_get_clean();
} | php | public function toXHTML()
{
ob_start();
$this->displayStyleSheet();
echo '<div class="swat-exception">';
printf(
'<h3>%s</h3>' .
'<div class="swat-exception-body">' .
'Message:<div class="swat-exception-message">%s</div>' .
'Occurred in file <strong>%s</strong> ' .
'on line <strong>%s</strong>.<br /><br />',
$this->getSeverityString(),
nl2br(htmlspecialchars($this->message)),
$this->file,
$this->line
);
echo 'Stack Trace:<br /><dl>';
$count = count($this->backtrace);
foreach ($this->backtrace as $entry) {
$class = array_key_exists('class', $entry) ? $entry['class'] : null;
$function = array_key_exists('function', $entry)
? $entry['function']
: null;
if (array_key_exists('args', $entry)) {
$arguments = htmlspecialchars(
$this->getArguments($entry['args'], $function, $class),
null,
'UTF-8'
);
} else {
$arguments = '';
}
printf(
'<dt>%s.</dt><dd>In file <strong>%s</strong> ' .
'line <strong>%s</strong>.<br />Method: ' .
'<strong>%s%s%s(</strong>%s<strong>)</strong></dd>',
--$count,
array_key_exists('file', $entry) ? $entry['file'] : 'unknown',
array_key_exists('line', $entry) ? $entry['line'] : 'unknown',
$class === null ? '' : $class,
array_key_exists('type', $entry) ? $entry['type'] : '',
$function === null ? '' : $function,
$arguments
);
}
echo '</dl></div></div>';
return ob_get_clean();
} | [
"public",
"function",
"toXHTML",
"(",
")",
"{",
"ob_start",
"(",
")",
";",
"$",
"this",
"->",
"displayStyleSheet",
"(",
")",
";",
"echo",
"'<div class=\"swat-exception\">'",
";",
"printf",
"(",
"'<h3>%s</h3>'",
".",
"'<div class=\"swat-exception-body\">'",
".",
"'Message:<div class=\"swat-exception-message\">%s</div>'",
".",
"'Occurred in file <strong>%s</strong> '",
".",
"'on line <strong>%s</strong>.<br /><br />'",
",",
"$",
"this",
"->",
"getSeverityString",
"(",
")",
",",
"nl2br",
"(",
"htmlspecialchars",
"(",
"$",
"this",
"->",
"message",
")",
")",
",",
"$",
"this",
"->",
"file",
",",
"$",
"this",
"->",
"line",
")",
";",
"echo",
"'Stack Trace:<br /><dl>'",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"this",
"->",
"backtrace",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"backtrace",
"as",
"$",
"entry",
")",
"{",
"$",
"class",
"=",
"array_key_exists",
"(",
"'class'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'class'",
"]",
":",
"null",
";",
"$",
"function",
"=",
"array_key_exists",
"(",
"'function'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'function'",
"]",
":",
"null",
";",
"if",
"(",
"array_key_exists",
"(",
"'args'",
",",
"$",
"entry",
")",
")",
"{",
"$",
"arguments",
"=",
"htmlspecialchars",
"(",
"$",
"this",
"->",
"getArguments",
"(",
"$",
"entry",
"[",
"'args'",
"]",
",",
"$",
"function",
",",
"$",
"class",
")",
",",
"null",
",",
"'UTF-8'",
")",
";",
"}",
"else",
"{",
"$",
"arguments",
"=",
"''",
";",
"}",
"printf",
"(",
"'<dt>%s.</dt><dd>In file <strong>%s</strong> '",
".",
"'line <strong>%s</strong>.<br />Method: '",
".",
"'<strong>%s%s%s(</strong>%s<strong>)</strong></dd>'",
",",
"--",
"$",
"count",
",",
"array_key_exists",
"(",
"'file'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'file'",
"]",
":",
"'unknown'",
",",
"array_key_exists",
"(",
"'line'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'line'",
"]",
":",
"'unknown'",
",",
"$",
"class",
"===",
"null",
"?",
"''",
":",
"$",
"class",
",",
"array_key_exists",
"(",
"'type'",
",",
"$",
"entry",
")",
"?",
"$",
"entry",
"[",
"'type'",
"]",
":",
"''",
",",
"$",
"function",
"===",
"null",
"?",
"''",
":",
"$",
"function",
",",
"$",
"arguments",
")",
";",
"}",
"echo",
"'</dl></div></div>'",
";",
"return",
"ob_get_clean",
"(",
")",
";",
"}"
] | Gets this error as a nicely formatted XHTML fragment
This is nice for debugging errors on a staging server.
@return string this error formatted as XHTML. | [
"Gets",
"this",
"error",
"as",
"a",
"nicely",
"formatted",
"XHTML",
"fragment"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatError.php#L399-L456 |
33,663 | silverorange/swat | Swat/SwatError.php | SwatError.handle | public static function handle($errno, $errstr, $errfile, $errline)
{
// only handle error if error reporting is not suppressed
if (error_reporting() != 0) {
$error = new SwatError($errno, $errstr, $errfile, $errline);
$error->process();
}
} | php | public static function handle($errno, $errstr, $errfile, $errline)
{
// only handle error if error reporting is not suppressed
if (error_reporting() != 0) {
$error = new SwatError($errno, $errstr, $errfile, $errline);
$error->process();
}
} | [
"public",
"static",
"function",
"handle",
"(",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
",",
"$",
"errline",
")",
"{",
"// only handle error if error reporting is not suppressed",
"if",
"(",
"error_reporting",
"(",
")",
"!=",
"0",
")",
"{",
"$",
"error",
"=",
"new",
"SwatError",
"(",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
",",
"$",
"errline",
")",
";",
"$",
"error",
"->",
"process",
"(",
")",
";",
"}",
"}"
] | Handles an error
When an error occurs, a SwatError object is created and processed.
@param integer $errno the severity code of the handled error.
@param string $errstr the message of the handled error.
@param string $errfile the file ther handled error occurred in.
@param integer $errline the line the handled error occurred at. | [
"Handles",
"an",
"error"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatError.php#L471-L478 |
33,664 | silverorange/swat | Swat/SwatError.php | SwatError.getArguments | protected function getArguments($args, $function = null, $class = null)
{
$params = array();
$method = null;
// try to get function or method parameter list using reflection
if ($class !== null && $function !== null && class_exists($class)) {
$class_reflector = new ReflectionClass($class);
if ($class_reflector->hasMethod($function)) {
$method = $class_reflector->getMethod($function);
$params = $method->getParameters();
}
} elseif ($function !== null && function_exists($function)) {
$method = new ReflectionFunction($function);
$params = $method->getParameters();
}
// display each parameter
$formatted_values = array();
for ($i = 0; $i < count($args); $i++) {
$value = $args[$i];
if ($method !== null && array_key_exists($i, $params)) {
$name = $params[$i]->getName();
$sensitive = $this->isSensitiveParameter($method, $name);
} else {
$name = null;
$sensitive = false;
}
if ($name !== null && $sensitive) {
$formatted_values[] = $this->formatSensitiveParam(
$name,
$value
);
} else {
$formatted_values[] = $this->formatValue($value);
}
}
return implode(', ', $formatted_values);
} | php | protected function getArguments($args, $function = null, $class = null)
{
$params = array();
$method = null;
// try to get function or method parameter list using reflection
if ($class !== null && $function !== null && class_exists($class)) {
$class_reflector = new ReflectionClass($class);
if ($class_reflector->hasMethod($function)) {
$method = $class_reflector->getMethod($function);
$params = $method->getParameters();
}
} elseif ($function !== null && function_exists($function)) {
$method = new ReflectionFunction($function);
$params = $method->getParameters();
}
// display each parameter
$formatted_values = array();
for ($i = 0; $i < count($args); $i++) {
$value = $args[$i];
if ($method !== null && array_key_exists($i, $params)) {
$name = $params[$i]->getName();
$sensitive = $this->isSensitiveParameter($method, $name);
} else {
$name = null;
$sensitive = false;
}
if ($name !== null && $sensitive) {
$formatted_values[] = $this->formatSensitiveParam(
$name,
$value
);
} else {
$formatted_values[] = $this->formatValue($value);
}
}
return implode(', ', $formatted_values);
} | [
"protected",
"function",
"getArguments",
"(",
"$",
"args",
",",
"$",
"function",
"=",
"null",
",",
"$",
"class",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"method",
"=",
"null",
";",
"// try to get function or method parameter list using reflection",
"if",
"(",
"$",
"class",
"!==",
"null",
"&&",
"$",
"function",
"!==",
"null",
"&&",
"class_exists",
"(",
"$",
"class",
")",
")",
"{",
"$",
"class_reflector",
"=",
"new",
"ReflectionClass",
"(",
"$",
"class",
")",
";",
"if",
"(",
"$",
"class_reflector",
"->",
"hasMethod",
"(",
"$",
"function",
")",
")",
"{",
"$",
"method",
"=",
"$",
"class_reflector",
"->",
"getMethod",
"(",
"$",
"function",
")",
";",
"$",
"params",
"=",
"$",
"method",
"->",
"getParameters",
"(",
")",
";",
"}",
"}",
"elseif",
"(",
"$",
"function",
"!==",
"null",
"&&",
"function_exists",
"(",
"$",
"function",
")",
")",
"{",
"$",
"method",
"=",
"new",
"ReflectionFunction",
"(",
"$",
"function",
")",
";",
"$",
"params",
"=",
"$",
"method",
"->",
"getParameters",
"(",
")",
";",
"}",
"// display each parameter",
"$",
"formatted_values",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"count",
"(",
"$",
"args",
")",
";",
"$",
"i",
"++",
")",
"{",
"$",
"value",
"=",
"$",
"args",
"[",
"$",
"i",
"]",
";",
"if",
"(",
"$",
"method",
"!==",
"null",
"&&",
"array_key_exists",
"(",
"$",
"i",
",",
"$",
"params",
")",
")",
"{",
"$",
"name",
"=",
"$",
"params",
"[",
"$",
"i",
"]",
"->",
"getName",
"(",
")",
";",
"$",
"sensitive",
"=",
"$",
"this",
"->",
"isSensitiveParameter",
"(",
"$",
"method",
",",
"$",
"name",
")",
";",
"}",
"else",
"{",
"$",
"name",
"=",
"null",
";",
"$",
"sensitive",
"=",
"false",
";",
"}",
"if",
"(",
"$",
"name",
"!==",
"null",
"&&",
"$",
"sensitive",
")",
"{",
"$",
"formatted_values",
"[",
"]",
"=",
"$",
"this",
"->",
"formatSensitiveParam",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"}",
"else",
"{",
"$",
"formatted_values",
"[",
"]",
"=",
"$",
"this",
"->",
"formatValue",
"(",
"$",
"value",
")",
";",
"}",
"}",
"return",
"implode",
"(",
"', '",
",",
"$",
"formatted_values",
")",
";",
"}"
] | Formats a method call's arguments
This method is also responsible for filtering sensitive parameters
out of the final stack trace.
@param array $args an array of arguments.
@param string $method optional. The current method or function.
@param string $class optional. The current class name.
@return string the arguments formatted into a comma delimited string. | [
"Formats",
"a",
"method",
"call",
"s",
"arguments"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatError.php#L495-L536 |
33,665 | silverorange/swat | Swat/SwatError.php | SwatError.getSeverityString | protected function getSeverityString()
{
static $error_types = array(
E_WARNING => 'Warning',
E_NOTICE => 'Notice',
E_USER_ERROR => 'User Fatal Error',
E_USER_WARNING => 'User Warning',
E_USER_NOTICE => 'User Notice',
E_STRICT => 'Forward Compatibility Notice'
);
$out = null;
if (isset($error_types[$this->severity])) {
$out = $error_types[$this->severity];
}
return $out;
} | php | protected function getSeverityString()
{
static $error_types = array(
E_WARNING => 'Warning',
E_NOTICE => 'Notice',
E_USER_ERROR => 'User Fatal Error',
E_USER_WARNING => 'User Warning',
E_USER_NOTICE => 'User Notice',
E_STRICT => 'Forward Compatibility Notice'
);
$out = null;
if (isset($error_types[$this->severity])) {
$out = $error_types[$this->severity];
}
return $out;
} | [
"protected",
"function",
"getSeverityString",
"(",
")",
"{",
"static",
"$",
"error_types",
"=",
"array",
"(",
"E_WARNING",
"=>",
"'Warning'",
",",
"E_NOTICE",
"=>",
"'Notice'",
",",
"E_USER_ERROR",
"=>",
"'User Fatal Error'",
",",
"E_USER_WARNING",
"=>",
"'User Warning'",
",",
"E_USER_NOTICE",
"=>",
"'User Notice'",
",",
"E_STRICT",
"=>",
"'Forward Compatibility Notice'",
")",
";",
"$",
"out",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"error_types",
"[",
"$",
"this",
"->",
"severity",
"]",
")",
")",
"{",
"$",
"out",
"=",
"$",
"error_types",
"[",
"$",
"this",
"->",
"severity",
"]",
";",
"}",
"return",
"$",
"out",
";",
"}"
] | Gets a string representation of this error's severity
@return string a string representation of this error's severity. | [
"Gets",
"a",
"string",
"representation",
"of",
"this",
"error",
"s",
"severity"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatError.php#L663-L680 |
33,666 | silverorange/swat | Swat/SwatError.php | SwatError.isSensitiveParameter | protected function isSensitiveParameter(
ReflectionFunctionAbstract $method,
$name
) {
$sensitive = false;
$exp =
'/^.*@sensitive\s+\$([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*).*$/';
$documentation = $method->getDocComment();
$documentation = str_replace("\r", "\n", $documentation);
$documentation_exp = explode("\n", $documentation);
foreach ($documentation_exp as $documentation_line) {
$matches = array();
if (
preg_match($exp, $documentation_line, $matches) === 1 &&
$matches[1] == $name
) {
$sensitive = true;
break;
}
}
return $sensitive;
} | php | protected function isSensitiveParameter(
ReflectionFunctionAbstract $method,
$name
) {
$sensitive = false;
$exp =
'/^.*@sensitive\s+\$([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*).*$/';
$documentation = $method->getDocComment();
$documentation = str_replace("\r", "\n", $documentation);
$documentation_exp = explode("\n", $documentation);
foreach ($documentation_exp as $documentation_line) {
$matches = array();
if (
preg_match($exp, $documentation_line, $matches) === 1 &&
$matches[1] == $name
) {
$sensitive = true;
break;
}
}
return $sensitive;
} | [
"protected",
"function",
"isSensitiveParameter",
"(",
"ReflectionFunctionAbstract",
"$",
"method",
",",
"$",
"name",
")",
"{",
"$",
"sensitive",
"=",
"false",
";",
"$",
"exp",
"=",
"'/^.*@sensitive\\s+\\$([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*).*$/'",
";",
"$",
"documentation",
"=",
"$",
"method",
"->",
"getDocComment",
"(",
")",
";",
"$",
"documentation",
"=",
"str_replace",
"(",
"\"\\r\"",
",",
"\"\\n\"",
",",
"$",
"documentation",
")",
";",
"$",
"documentation_exp",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"documentation",
")",
";",
"foreach",
"(",
"$",
"documentation_exp",
"as",
"$",
"documentation_line",
")",
"{",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"if",
"(",
"preg_match",
"(",
"$",
"exp",
",",
"$",
"documentation_line",
",",
"$",
"matches",
")",
"===",
"1",
"&&",
"$",
"matches",
"[",
"1",
"]",
"==",
"$",
"name",
")",
"{",
"$",
"sensitive",
"=",
"true",
";",
"break",
";",
"}",
"}",
"return",
"$",
"sensitive",
";",
"}"
] | Detects whether or not a parameter is sensitive from the method-level
documentation of the parameter's method
Parameters with the following docblock tag are considered sensitive:
<code>
<?php
/**
* @sensitive $parameter_name
*\/
?>
</code>
@param ReflectionFunctionAbstract $method the method the parameter to
which the parameter belongs.
@param string $name the name of the parameter.
@return boolean true if the parameter is sensitive and false if the
method is not sensitive. | [
"Detects",
"whether",
"or",
"not",
"a",
"parameter",
"is",
"sensitive",
"from",
"the",
"method",
"-",
"level",
"documentation",
"of",
"the",
"parameter",
"s",
"method"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatError.php#L705-L729 |
33,667 | brainworxx/kreXX | src/Analyse/Callback/AbstractCallback.php | AbstractCallback.dispatchEventWithModel | protected function dispatchEventWithModel($name, Model $model)
{
$this->pool->eventService->dispatch(
static::$eventPrefix . '::' . $name,
$this,
$model
);
return $model;
} | php | protected function dispatchEventWithModel($name, Model $model)
{
$this->pool->eventService->dispatch(
static::$eventPrefix . '::' . $name,
$this,
$model
);
return $model;
} | [
"protected",
"function",
"dispatchEventWithModel",
"(",
"$",
"name",
",",
"Model",
"$",
"model",
")",
"{",
"$",
"this",
"->",
"pool",
"->",
"eventService",
"->",
"dispatch",
"(",
"static",
"::",
"$",
"eventPrefix",
".",
"'::'",
".",
"$",
"name",
",",
"$",
"this",
",",
"$",
"model",
")",
";",
"return",
"$",
"model",
";",
"}"
] | Dispatches an event where the modes is available.
@param string $name
The name of the event.
@param Model $model
The model so far.
@return Model
Return the model for chaining. | [
"Dispatches",
"an",
"event",
"where",
"the",
"modes",
"is",
"available",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/AbstractCallback.php#L147-L156 |
33,668 | brainworxx/kreXX | src/Analyse/Callback/AbstractCallback.php | AbstractCallback.isPropertyNameNormal | protected function isPropertyNameNormal($propName)
{
static $cache = array();
if (isset($cache[$propName])) {
return $cache[$propName];
}
// The first regex detects all allowed characters.
// For some reason, they also allow BOM characters.
return $cache[$propName] = (bool) preg_match("/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/", $propName) &&
!(bool) preg_match("/[\xEF\xBB\xBF]$/", $propName);
} | php | protected function isPropertyNameNormal($propName)
{
static $cache = array();
if (isset($cache[$propName])) {
return $cache[$propName];
}
// The first regex detects all allowed characters.
// For some reason, they also allow BOM characters.
return $cache[$propName] = (bool) preg_match("/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/", $propName) &&
!(bool) preg_match("/[\xEF\xBB\xBF]$/", $propName);
} | [
"protected",
"function",
"isPropertyNameNormal",
"(",
"$",
"propName",
")",
"{",
"static",
"$",
"cache",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"cache",
"[",
"$",
"propName",
"]",
")",
")",
"{",
"return",
"$",
"cache",
"[",
"$",
"propName",
"]",
";",
"}",
"// The first regex detects all allowed characters.",
"// For some reason, they also allow BOM characters.",
"return",
"$",
"cache",
"[",
"$",
"propName",
"]",
"=",
"(",
"bool",
")",
"preg_match",
"(",
"\"/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/\"",
",",
"$",
"propName",
")",
"&&",
"!",
"(",
"bool",
")",
"preg_match",
"(",
"\"/[\\xEF\\xBB\\xBF]$/\"",
",",
"$",
"propName",
")",
";",
"}"
] | Check for special chars in properties.
AFAIK this is only possible for dynamically declared properties
or some magical stuff from __get()
@see https://stackoverflow.com/questions/29019484/validate-a-php-variable
@author AbraCadaver
@param $propName
The property name we want to check.
@return bool
Whether we have a special char in there, or not. | [
"Check",
"for",
"special",
"chars",
"in",
"properties",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/AbstractCallback.php#L172-L184 |
33,669 | brainworxx/kreXX | src/Analyse/Comment/AbstractComment.php | AbstractComment.prettifyComment | protected function prettifyComment($comment)
{
if (empty($comment) === true) {
return '';
}
// We split our comment into single lines and remove the unwanted
// comment chars with the array_map callback.
// We skip lines with /** and */
$result = array();
foreach (array_slice(explode("\n", $comment), 1, -1) as $commentLine) {
// Remove comment-chars and trim the whitespace.
$result[] = trim($commentLine, "* \t\n\r\0\x0B");
}
// Sadly, we must not escape this here, or glue it with <br /> for a
// direct display. The thing is, we may resolve several @inheritdoc
// marks. The escaping and nlbr() will be done when everything is
// stitched together.
return implode(PHP_EOL, $result);
} | php | protected function prettifyComment($comment)
{
if (empty($comment) === true) {
return '';
}
// We split our comment into single lines and remove the unwanted
// comment chars with the array_map callback.
// We skip lines with /** and */
$result = array();
foreach (array_slice(explode("\n", $comment), 1, -1) as $commentLine) {
// Remove comment-chars and trim the whitespace.
$result[] = trim($commentLine, "* \t\n\r\0\x0B");
}
// Sadly, we must not escape this here, or glue it with <br /> for a
// direct display. The thing is, we may resolve several @inheritdoc
// marks. The escaping and nlbr() will be done when everything is
// stitched together.
return implode(PHP_EOL, $result);
} | [
"protected",
"function",
"prettifyComment",
"(",
"$",
"comment",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"comment",
")",
"===",
"true",
")",
"{",
"return",
"''",
";",
"}",
"// We split our comment into single lines and remove the unwanted",
"// comment chars with the array_map callback.",
"// We skip lines with /** and */",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"array_slice",
"(",
"explode",
"(",
"\"\\n\"",
",",
"$",
"comment",
")",
",",
"1",
",",
"-",
"1",
")",
"as",
"$",
"commentLine",
")",
"{",
"// Remove comment-chars and trim the whitespace.",
"$",
"result",
"[",
"]",
"=",
"trim",
"(",
"$",
"commentLine",
",",
"\"* \\t\\n\\r\\0\\x0B\"",
")",
";",
"}",
"// Sadly, we must not escape this here, or glue it with <br /> for a",
"// direct display. The thing is, we may resolve several @inheritdoc",
"// marks. The escaping and nlbr() will be done when everything is",
"// stitched together.",
"return",
"implode",
"(",
"PHP_EOL",
",",
"$",
"result",
")",
";",
"}"
] | Removes the comment-chars from the comment string.
@param string $comment
The original comment from code.
@return string
The better readable comment | [
"Removes",
"the",
"comment",
"-",
"chars",
"from",
"the",
"comment",
"string",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Comment/AbstractComment.php#L99-L119 |
33,670 | silverorange/swat | Swat/SwatTimeZoneEntry.php | SwatTimeZoneEntry.display | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$areas_flydown = $this->getCompositeWidget('areas_flydown');
$regions_flydown = $this->getCompositeWidget('regions_flydown');
$div_tag = new SwatHtmlTag('div');
$div_tag->id = $this->id;
$div_tag->class = $this->getCSSClassString();
$div_tag->open();
$areas_flydown->value = $this->getArea($this->value);
$areas_flydown->display();
$regions_flydown->options = $this->regions;
$regions_flydown->value = $this->getRegion($this->value);
$regions_flydown->display();
$div_tag->close();
} | php | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$areas_flydown = $this->getCompositeWidget('areas_flydown');
$regions_flydown = $this->getCompositeWidget('regions_flydown');
$div_tag = new SwatHtmlTag('div');
$div_tag->id = $this->id;
$div_tag->class = $this->getCSSClassString();
$div_tag->open();
$areas_flydown->value = $this->getArea($this->value);
$areas_flydown->display();
$regions_flydown->options = $this->regions;
$regions_flydown->value = $this->getRegion($this->value);
$regions_flydown->display();
$div_tag->close();
} | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"display",
"(",
")",
";",
"$",
"areas_flydown",
"=",
"$",
"this",
"->",
"getCompositeWidget",
"(",
"'areas_flydown'",
")",
";",
"$",
"regions_flydown",
"=",
"$",
"this",
"->",
"getCompositeWidget",
"(",
"'regions_flydown'",
")",
";",
"$",
"div_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"div_tag",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"div_tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"$",
"div_tag",
"->",
"open",
"(",
")",
";",
"$",
"areas_flydown",
"->",
"value",
"=",
"$",
"this",
"->",
"getArea",
"(",
"$",
"this",
"->",
"value",
")",
";",
"$",
"areas_flydown",
"->",
"display",
"(",
")",
";",
"$",
"regions_flydown",
"->",
"options",
"=",
"$",
"this",
"->",
"regions",
";",
"$",
"regions_flydown",
"->",
"value",
"=",
"$",
"this",
"->",
"getRegion",
"(",
"$",
"this",
"->",
"value",
")",
";",
"$",
"regions_flydown",
"->",
"display",
"(",
")",
";",
"$",
"div_tag",
"->",
"close",
"(",
")",
";",
"}"
] | Displays this time zone entry widget
Outputs a cascading list of time zones. | [
"Displays",
"this",
"time",
"zone",
"entry",
"widget"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeZoneEntry.php#L84-L108 |
33,671 | silverorange/swat | Swat/SwatTimeZoneEntry.php | SwatTimeZoneEntry.process | public function process()
{
parent::process();
$areas_flydown = $this->getCompositeWidget('areas_flydown');
$regions_flydown = $this->getCompositeWidget('regions_flydown');
if ($areas_flydown->value === 'UTC') {
$this->value = 'UTC';
} elseif (
$areas_flydown->value === null ||
$regions_flydown->value === null
) {
$this->value = null;
} else {
$this->value =
$areas_flydown->value . '/' . $regions_flydown->value;
}
if (!$this->required && $this->value === null && $this->isSensitive()) {
return;
} elseif ($this->value === null) {
$message = Swat::_('The %s field is required.');
$this->addMessage(new SwatMessage($message, 'error'));
} else {
try {
$time_zone = new DateTimeZone($this->value);
} catch (Exception $e) {
$message = Swat::_('The %s field is an invalid time zone.');
$this->addMessage(new SwatMessage($message, 'error'));
}
}
} | php | public function process()
{
parent::process();
$areas_flydown = $this->getCompositeWidget('areas_flydown');
$regions_flydown = $this->getCompositeWidget('regions_flydown');
if ($areas_flydown->value === 'UTC') {
$this->value = 'UTC';
} elseif (
$areas_flydown->value === null ||
$regions_flydown->value === null
) {
$this->value = null;
} else {
$this->value =
$areas_flydown->value . '/' . $regions_flydown->value;
}
if (!$this->required && $this->value === null && $this->isSensitive()) {
return;
} elseif ($this->value === null) {
$message = Swat::_('The %s field is required.');
$this->addMessage(new SwatMessage($message, 'error'));
} else {
try {
$time_zone = new DateTimeZone($this->value);
} catch (Exception $e) {
$message = Swat::_('The %s field is an invalid time zone.');
$this->addMessage(new SwatMessage($message, 'error'));
}
}
} | [
"public",
"function",
"process",
"(",
")",
"{",
"parent",
"::",
"process",
"(",
")",
";",
"$",
"areas_flydown",
"=",
"$",
"this",
"->",
"getCompositeWidget",
"(",
"'areas_flydown'",
")",
";",
"$",
"regions_flydown",
"=",
"$",
"this",
"->",
"getCompositeWidget",
"(",
"'regions_flydown'",
")",
";",
"if",
"(",
"$",
"areas_flydown",
"->",
"value",
"===",
"'UTC'",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"'UTC'",
";",
"}",
"elseif",
"(",
"$",
"areas_flydown",
"->",
"value",
"===",
"null",
"||",
"$",
"regions_flydown",
"->",
"value",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"null",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"value",
"=",
"$",
"areas_flydown",
"->",
"value",
".",
"'/'",
".",
"$",
"regions_flydown",
"->",
"value",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"required",
"&&",
"$",
"this",
"->",
"value",
"===",
"null",
"&&",
"$",
"this",
"->",
"isSensitive",
"(",
")",
")",
"{",
"return",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"value",
"===",
"null",
")",
"{",
"$",
"message",
"=",
"Swat",
"::",
"_",
"(",
"'The %s field is required.'",
")",
";",
"$",
"this",
"->",
"addMessage",
"(",
"new",
"SwatMessage",
"(",
"$",
"message",
",",
"'error'",
")",
")",
";",
"}",
"else",
"{",
"try",
"{",
"$",
"time_zone",
"=",
"new",
"DateTimeZone",
"(",
"$",
"this",
"->",
"value",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"message",
"=",
"Swat",
"::",
"_",
"(",
"'The %s field is an invalid time zone.'",
")",
";",
"$",
"this",
"->",
"addMessage",
"(",
"new",
"SwatMessage",
"(",
"$",
"message",
",",
"'error'",
")",
")",
";",
"}",
"}",
"}"
] | Processes this time zone entry widget
If any validation type errors occur, an error message is attached to
this entry widget. | [
"Processes",
"this",
"time",
"zone",
"entry",
"widget"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeZoneEntry.php#L119-L151 |
33,672 | silverorange/swat | Swat/SwatTimeZoneEntry.php | SwatTimeZoneEntry.parseAreaWhitelist | private function parseAreaWhitelist($area_whitelist)
{
$areas = array();
$whitelist = 0;
foreach ($area_whitelist as $area) {
$whitelist = $whitelist | $area;
}
$tz_data = DateTimeZone::listIdentifiers($whitelist);
foreach ($tz_data as $id) {
$area = $this->getArea($id);
$region = $this->getRegion($id);
if (!array_key_exists($area, $areas)) {
$areas[$area] = array();
}
$areas[$area][] = $region;
}
return $areas;
} | php | private function parseAreaWhitelist($area_whitelist)
{
$areas = array();
$whitelist = 0;
foreach ($area_whitelist as $area) {
$whitelist = $whitelist | $area;
}
$tz_data = DateTimeZone::listIdentifiers($whitelist);
foreach ($tz_data as $id) {
$area = $this->getArea($id);
$region = $this->getRegion($id);
if (!array_key_exists($area, $areas)) {
$areas[$area] = array();
}
$areas[$area][] = $region;
}
return $areas;
} | [
"private",
"function",
"parseAreaWhitelist",
"(",
"$",
"area_whitelist",
")",
"{",
"$",
"areas",
"=",
"array",
"(",
")",
";",
"$",
"whitelist",
"=",
"0",
";",
"foreach",
"(",
"$",
"area_whitelist",
"as",
"$",
"area",
")",
"{",
"$",
"whitelist",
"=",
"$",
"whitelist",
"|",
"$",
"area",
";",
"}",
"$",
"tz_data",
"=",
"DateTimeZone",
"::",
"listIdentifiers",
"(",
"$",
"whitelist",
")",
";",
"foreach",
"(",
"$",
"tz_data",
"as",
"$",
"id",
")",
"{",
"$",
"area",
"=",
"$",
"this",
"->",
"getArea",
"(",
"$",
"id",
")",
";",
"$",
"region",
"=",
"$",
"this",
"->",
"getRegion",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"area",
",",
"$",
"areas",
")",
")",
"{",
"$",
"areas",
"[",
"$",
"area",
"]",
"=",
"array",
"(",
")",
";",
"}",
"$",
"areas",
"[",
"$",
"area",
"]",
"[",
"]",
"=",
"$",
"region",
";",
"}",
"return",
"$",
"areas",
";",
"}"
] | Parses a whitelist of valid areas
Filters the full list of areas down to a select list and returns a
tree-structured array of areas, regions, and subregions.
@param array area_whitelist an array of valid area names.
@return array a tree-structured array of areas regions and subregions
inside the specified whitelist of areas. | [
"Parses",
"a",
"whitelist",
"of",
"valid",
"areas"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeZoneEntry.php#L236-L258 |
33,673 | silverorange/swat | Swat/SwatTimeZoneEntry.php | SwatTimeZoneEntry.getArea | private function getArea($time_zone)
{
$area = null;
if ($time_zone === 'UTC') {
$area = 'UTC';
} elseif ($time_zone !== null) {
$parts = explode('/', $time_zone, 2);
$area = reset($parts);
}
return $area;
} | php | private function getArea($time_zone)
{
$area = null;
if ($time_zone === 'UTC') {
$area = 'UTC';
} elseif ($time_zone !== null) {
$parts = explode('/', $time_zone, 2);
$area = reset($parts);
}
return $area;
} | [
"private",
"function",
"getArea",
"(",
"$",
"time_zone",
")",
"{",
"$",
"area",
"=",
"null",
";",
"if",
"(",
"$",
"time_zone",
"===",
"'UTC'",
")",
"{",
"$",
"area",
"=",
"'UTC'",
";",
"}",
"elseif",
"(",
"$",
"time_zone",
"!==",
"null",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'/'",
",",
"$",
"time_zone",
",",
"2",
")",
";",
"$",
"area",
"=",
"reset",
"(",
"$",
"parts",
")",
";",
"}",
"return",
"$",
"area",
";",
"}"
] | Gets an area from a time zone identifier
Returns the area part of a full time zone.
@param string $time_zone the time zone identifier to get the area from.
@return string an area name. | [
"Gets",
"an",
"area",
"from",
"a",
"time",
"zone",
"identifier"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeZoneEntry.php#L333-L345 |
33,674 | silverorange/swat | Swat/SwatTimeZoneEntry.php | SwatTimeZoneEntry.getRegion | private function getRegion($time_zone)
{
$region = null;
if ($time_zone === 'UTC') {
$region = 'Coordinated_Universal_Time'; // fake region for UTC
} elseif ($time_zone !== null) {
$parts = explode('/', $time_zone, 2);
$region = end($parts);
}
return $region;
} | php | private function getRegion($time_zone)
{
$region = null;
if ($time_zone === 'UTC') {
$region = 'Coordinated_Universal_Time'; // fake region for UTC
} elseif ($time_zone !== null) {
$parts = explode('/', $time_zone, 2);
$region = end($parts);
}
return $region;
} | [
"private",
"function",
"getRegion",
"(",
"$",
"time_zone",
")",
"{",
"$",
"region",
"=",
"null",
";",
"if",
"(",
"$",
"time_zone",
"===",
"'UTC'",
")",
"{",
"$",
"region",
"=",
"'Coordinated_Universal_Time'",
";",
"// fake region for UTC",
"}",
"elseif",
"(",
"$",
"time_zone",
"!==",
"null",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'/'",
",",
"$",
"time_zone",
",",
"2",
")",
";",
"$",
"region",
"=",
"end",
"(",
"$",
"parts",
")",
";",
"}",
"return",
"$",
"region",
";",
"}"
] | Gets a region from a time zone identifier
@param string $time_zone the time zone identifier from which to get the
region.
@return string the region part of a full time zone indentifier. | [
"Gets",
"a",
"region",
"from",
"a",
"time",
"zone",
"identifier"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeZoneEntry.php#L358-L370 |
33,675 | silverorange/swat | Swat/SwatTimeZoneEntry.php | SwatTimeZoneEntry.getRegionTitle | private function getRegionTitle($region)
{
$region = str_replace('_', ' ', $region);
$region = explode('/', $region);
$title = array_shift($region);
foreach ($region as $part) {
$title .= ' (' . $part . ')';
}
return $title;
} | php | private function getRegionTitle($region)
{
$region = str_replace('_', ' ', $region);
$region = explode('/', $region);
$title = array_shift($region);
foreach ($region as $part) {
$title .= ' (' . $part . ')';
}
return $title;
} | [
"private",
"function",
"getRegionTitle",
"(",
"$",
"region",
")",
"{",
"$",
"region",
"=",
"str_replace",
"(",
"'_'",
",",
"' '",
",",
"$",
"region",
")",
";",
"$",
"region",
"=",
"explode",
"(",
"'/'",
",",
"$",
"region",
")",
";",
"$",
"title",
"=",
"array_shift",
"(",
"$",
"region",
")",
";",
"foreach",
"(",
"$",
"region",
"as",
"$",
"part",
")",
"{",
"$",
"title",
".=",
"' ('",
".",
"$",
"part",
".",
"')'",
";",
"}",
"return",
"$",
"title",
";",
"}"
] | Gets a formatted region title from the region part of a time zone
identifier
@param string $region the region part of the time zone identifier.
@return string the formatted region title. | [
"Gets",
"a",
"formatted",
"region",
"title",
"from",
"the",
"region",
"part",
"of",
"a",
"time",
"zone",
"identifier"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTimeZoneEntry.php#L383-L394 |
33,676 | brainworxx/kreXX | src/Analyse/Callback/Iterate/ThroughProperties.php | ThroughProperties.callMe | public function callMe()
{
$output = $this->dispatchStartEvent();
// I need to preprocess them, since I do not want to render a
// reflection property.
/** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $ref */
$ref = $this->parameters[static::PARAM_REF];
foreach ($this->parameters[static::PARAM_DATA] as $refProperty) {
// Check memory and runtime.
if ($this->pool->emergencyHandler->checkEmergencyBreak() === true) {
return '';
}
// Stitch together our additional info about the data:
// public access, protected access, private access and info if it was
// inherited from somewhere.
$additional = $this->getAdditionalData($refProperty, $ref);
// Every other additional string requires a special connector,
// so we do this here.
$connectorType = Connectors::NORMAL_PROPERTY;
/** @var \ReflectionProperty $refProperty */
$propName = $refProperty->getName();
// Static properties are very special.
if ($refProperty->isStatic() === true) {
$connectorType = Connectors::STATIC_PROPERTY;
// There is always a $ in front of a static property.
$propName = '$' . $propName;
}
$value = $ref->retrieveValue($refProperty);
if (isset($refProperty->isUnset) === true) {
$additional .= 'unset ';
}
if (isset($refProperty->isUndeclared) === true) {
// The property 'isUndeclared' is not a part of the reflectionProperty.
// @see \Brainworxx\Krexx\Analyse\Callback\Analyse\Objects
$additional .= 'dynamic property ';
// Check for very special chars in there.
// AFAIK this is only possible for dynamically declared properties
// which can never be static.
if ($this->isPropertyNameNormal($propName) === false) {
$propName = $this->pool->encodingService->encodeStringForCodeGeneration($propName);
$connectorType = Connectors::SPECIAL_CHARS_PROP;
}
// There is no comment ora declaration place for a dynamic property.
$comment = '';
$declarationPlace = 'undeclared';
} else {
// Since we are dealing with a declared Property here, we can
// get the comment and the declaration place.
$comment = $this->pool
->createClass('Brainworxx\\Krexx\\Analyse\\Comment\\Properties')
->getComment($refProperty);
$declarationPlace = $this->retrieveDeclarationPlace($refProperty);
}
// Stitch together our model
$output .= $this->pool->routing->analysisHub(
$this->dispatchEventWithModel(
__FUNCTION__ . static::EVENT_MARKER_END,
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($value)
->setName($this->pool->encodingService->encodeString($propName))
->addToJson(static::META_COMMENT, $comment)
->addToJson(static::META_DECLARED_IN, $declarationPlace)
->setAdditional($additional)
->setConnectorType($connectorType)
->setIsPublic($refProperty->isPublic())
)
);
}
return $output;
} | php | public function callMe()
{
$output = $this->dispatchStartEvent();
// I need to preprocess them, since I do not want to render a
// reflection property.
/** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $ref */
$ref = $this->parameters[static::PARAM_REF];
foreach ($this->parameters[static::PARAM_DATA] as $refProperty) {
// Check memory and runtime.
if ($this->pool->emergencyHandler->checkEmergencyBreak() === true) {
return '';
}
// Stitch together our additional info about the data:
// public access, protected access, private access and info if it was
// inherited from somewhere.
$additional = $this->getAdditionalData($refProperty, $ref);
// Every other additional string requires a special connector,
// so we do this here.
$connectorType = Connectors::NORMAL_PROPERTY;
/** @var \ReflectionProperty $refProperty */
$propName = $refProperty->getName();
// Static properties are very special.
if ($refProperty->isStatic() === true) {
$connectorType = Connectors::STATIC_PROPERTY;
// There is always a $ in front of a static property.
$propName = '$' . $propName;
}
$value = $ref->retrieveValue($refProperty);
if (isset($refProperty->isUnset) === true) {
$additional .= 'unset ';
}
if (isset($refProperty->isUndeclared) === true) {
// The property 'isUndeclared' is not a part of the reflectionProperty.
// @see \Brainworxx\Krexx\Analyse\Callback\Analyse\Objects
$additional .= 'dynamic property ';
// Check for very special chars in there.
// AFAIK this is only possible for dynamically declared properties
// which can never be static.
if ($this->isPropertyNameNormal($propName) === false) {
$propName = $this->pool->encodingService->encodeStringForCodeGeneration($propName);
$connectorType = Connectors::SPECIAL_CHARS_PROP;
}
// There is no comment ora declaration place for a dynamic property.
$comment = '';
$declarationPlace = 'undeclared';
} else {
// Since we are dealing with a declared Property here, we can
// get the comment and the declaration place.
$comment = $this->pool
->createClass('Brainworxx\\Krexx\\Analyse\\Comment\\Properties')
->getComment($refProperty);
$declarationPlace = $this->retrieveDeclarationPlace($refProperty);
}
// Stitch together our model
$output .= $this->pool->routing->analysisHub(
$this->dispatchEventWithModel(
__FUNCTION__ . static::EVENT_MARKER_END,
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->setData($value)
->setName($this->pool->encodingService->encodeString($propName))
->addToJson(static::META_COMMENT, $comment)
->addToJson(static::META_DECLARED_IN, $declarationPlace)
->setAdditional($additional)
->setConnectorType($connectorType)
->setIsPublic($refProperty->isPublic())
)
);
}
return $output;
} | [
"public",
"function",
"callMe",
"(",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"dispatchStartEvent",
"(",
")",
";",
"// I need to preprocess them, since I do not want to render a",
"// reflection property.",
"/** @var \\Brainworxx\\Krexx\\Service\\Reflection\\ReflectionClass $ref */",
"$",
"ref",
"=",
"$",
"this",
"->",
"parameters",
"[",
"static",
"::",
"PARAM_REF",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"parameters",
"[",
"static",
"::",
"PARAM_DATA",
"]",
"as",
"$",
"refProperty",
")",
"{",
"// Check memory and runtime.",
"if",
"(",
"$",
"this",
"->",
"pool",
"->",
"emergencyHandler",
"->",
"checkEmergencyBreak",
"(",
")",
"===",
"true",
")",
"{",
"return",
"''",
";",
"}",
"// Stitch together our additional info about the data:",
"// public access, protected access, private access and info if it was",
"// inherited from somewhere.",
"$",
"additional",
"=",
"$",
"this",
"->",
"getAdditionalData",
"(",
"$",
"refProperty",
",",
"$",
"ref",
")",
";",
"// Every other additional string requires a special connector,",
"// so we do this here.",
"$",
"connectorType",
"=",
"Connectors",
"::",
"NORMAL_PROPERTY",
";",
"/** @var \\ReflectionProperty $refProperty */",
"$",
"propName",
"=",
"$",
"refProperty",
"->",
"getName",
"(",
")",
";",
"// Static properties are very special.",
"if",
"(",
"$",
"refProperty",
"->",
"isStatic",
"(",
")",
"===",
"true",
")",
"{",
"$",
"connectorType",
"=",
"Connectors",
"::",
"STATIC_PROPERTY",
";",
"// There is always a $ in front of a static property.",
"$",
"propName",
"=",
"'$'",
".",
"$",
"propName",
";",
"}",
"$",
"value",
"=",
"$",
"ref",
"->",
"retrieveValue",
"(",
"$",
"refProperty",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"refProperty",
"->",
"isUnset",
")",
"===",
"true",
")",
"{",
"$",
"additional",
".=",
"'unset '",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"refProperty",
"->",
"isUndeclared",
")",
"===",
"true",
")",
"{",
"// The property 'isUndeclared' is not a part of the reflectionProperty.",
"// @see \\Brainworxx\\Krexx\\Analyse\\Callback\\Analyse\\Objects",
"$",
"additional",
".=",
"'dynamic property '",
";",
"// Check for very special chars in there.",
"// AFAIK this is only possible for dynamically declared properties",
"// which can never be static.",
"if",
"(",
"$",
"this",
"->",
"isPropertyNameNormal",
"(",
"$",
"propName",
")",
"===",
"false",
")",
"{",
"$",
"propName",
"=",
"$",
"this",
"->",
"pool",
"->",
"encodingService",
"->",
"encodeStringForCodeGeneration",
"(",
"$",
"propName",
")",
";",
"$",
"connectorType",
"=",
"Connectors",
"::",
"SPECIAL_CHARS_PROP",
";",
"}",
"// There is no comment ora declaration place for a dynamic property.",
"$",
"comment",
"=",
"''",
";",
"$",
"declarationPlace",
"=",
"'undeclared'",
";",
"}",
"else",
"{",
"// Since we are dealing with a declared Property here, we can",
"// get the comment and the declaration place.",
"$",
"comment",
"=",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Comment\\\\Properties'",
")",
"->",
"getComment",
"(",
"$",
"refProperty",
")",
";",
"$",
"declarationPlace",
"=",
"$",
"this",
"->",
"retrieveDeclarationPlace",
"(",
"$",
"refProperty",
")",
";",
"}",
"// Stitch together our model",
"$",
"output",
".=",
"$",
"this",
"->",
"pool",
"->",
"routing",
"->",
"analysisHub",
"(",
"$",
"this",
"->",
"dispatchEventWithModel",
"(",
"__FUNCTION__",
".",
"static",
"::",
"EVENT_MARKER_END",
",",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'",
")",
"->",
"setData",
"(",
"$",
"value",
")",
"->",
"setName",
"(",
"$",
"this",
"->",
"pool",
"->",
"encodingService",
"->",
"encodeString",
"(",
"$",
"propName",
")",
")",
"->",
"addToJson",
"(",
"static",
"::",
"META_COMMENT",
",",
"$",
"comment",
")",
"->",
"addToJson",
"(",
"static",
"::",
"META_DECLARED_IN",
",",
"$",
"declarationPlace",
")",
"->",
"setAdditional",
"(",
"$",
"additional",
")",
"->",
"setConnectorType",
"(",
"$",
"connectorType",
")",
"->",
"setIsPublic",
"(",
"$",
"refProperty",
"->",
"isPublic",
"(",
")",
")",
")",
")",
";",
"}",
"return",
"$",
"output",
";",
"}"
] | Renders the properties of a class.
@return string
The generated markup. | [
"Renders",
"the",
"properties",
"of",
"a",
"class",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Iterate/ThroughProperties.php#L85-L166 |
33,677 | brainworxx/kreXX | src/Analyse/Callback/Iterate/ThroughProperties.php | ThroughProperties.getAdditionalData | protected function getAdditionalData(\ReflectionProperty $refProperty, \ReflectionClass $ref)
{
// Now that we have the key and the value, we can analyse it.
// Stitch together our additional info about the data:
// public access, protected access, private access, static declaration.
$additional = '';
if ($refProperty->isProtected() === true) {
$additional .= 'protected ';
} elseif ($refProperty->isPublic() === true) {
$additional .= 'public ';
} elseif ($refProperty->isPrivate() === true) {
$additional .= 'private ';
}
// Test if the property is inherited or not by testing the
// declaring class
if ($refProperty->getDeclaringClass()->getName() !== $ref->getName()) {
// This one got inherited fom a lower level.
$additional .= 'inherited ';
}
// Add the info, if this is static.
if ($refProperty->isStatic() === true) {
$additional .= 'static ';
}
return $additional;
} | php | protected function getAdditionalData(\ReflectionProperty $refProperty, \ReflectionClass $ref)
{
// Now that we have the key and the value, we can analyse it.
// Stitch together our additional info about the data:
// public access, protected access, private access, static declaration.
$additional = '';
if ($refProperty->isProtected() === true) {
$additional .= 'protected ';
} elseif ($refProperty->isPublic() === true) {
$additional .= 'public ';
} elseif ($refProperty->isPrivate() === true) {
$additional .= 'private ';
}
// Test if the property is inherited or not by testing the
// declaring class
if ($refProperty->getDeclaringClass()->getName() !== $ref->getName()) {
// This one got inherited fom a lower level.
$additional .= 'inherited ';
}
// Add the info, if this is static.
if ($refProperty->isStatic() === true) {
$additional .= 'static ';
}
return $additional;
} | [
"protected",
"function",
"getAdditionalData",
"(",
"\\",
"ReflectionProperty",
"$",
"refProperty",
",",
"\\",
"ReflectionClass",
"$",
"ref",
")",
"{",
"// Now that we have the key and the value, we can analyse it.",
"// Stitch together our additional info about the data:",
"// public access, protected access, private access, static declaration.",
"$",
"additional",
"=",
"''",
";",
"if",
"(",
"$",
"refProperty",
"->",
"isProtected",
"(",
")",
"===",
"true",
")",
"{",
"$",
"additional",
".=",
"'protected '",
";",
"}",
"elseif",
"(",
"$",
"refProperty",
"->",
"isPublic",
"(",
")",
"===",
"true",
")",
"{",
"$",
"additional",
".=",
"'public '",
";",
"}",
"elseif",
"(",
"$",
"refProperty",
"->",
"isPrivate",
"(",
")",
"===",
"true",
")",
"{",
"$",
"additional",
".=",
"'private '",
";",
"}",
"// Test if the property is inherited or not by testing the",
"// declaring class",
"if",
"(",
"$",
"refProperty",
"->",
"getDeclaringClass",
"(",
")",
"->",
"getName",
"(",
")",
"!==",
"$",
"ref",
"->",
"getName",
"(",
")",
")",
"{",
"// This one got inherited fom a lower level.",
"$",
"additional",
".=",
"'inherited '",
";",
"}",
"// Add the info, if this is static.",
"if",
"(",
"$",
"refProperty",
"->",
"isStatic",
"(",
")",
"===",
"true",
")",
"{",
"$",
"additional",
".=",
"'static '",
";",
"}",
"return",
"$",
"additional",
";",
"}"
] | Adding declaration keywords to our data in the additional field.
@param \ReflectionProperty $refProperty
A reflection of the property we ara analysing.
@param \ReflectionClass $ref
A reflection of the class we are analysing.
@return string | [
"Adding",
"declaration",
"keywords",
"to",
"our",
"data",
"in",
"the",
"additional",
"field",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Iterate/ThroughProperties.php#L178-L205 |
33,678 | brainworxx/kreXX | src/Analyse/Callback/Iterate/ThroughProperties.php | ThroughProperties.retrieveDeclarationPlace | protected function retrieveDeclarationPlace(\ReflectionProperty $refProperty)
{
static $declarationCache = array();
// Early return from the cache.
$declaringClass = $refProperty->getDeclaringClass();
$key = $refProperty->name . '::' . $declaringClass->name;
if (isset($declarationCache[$key])) {
return $declarationCache[$key];
}
// A class can not redeclare a property from a trait that it is using.
// Hence, if one of the traits has the same property that we are
// analysing, it is probably declared there.
// Traits on the other hand can redeclare their properties.
// I'm not sure how to get the actual declaration place, when dealing
// with several layers of traits. We will not parse the source code
// for an answer.
$type = '<br />in class: ';
if (method_exists($declaringClass, 'getTraits')) {
foreach ($refProperty->getDeclaringClass()->getTraits() as $trait) {
if ($trait->hasProperty($refProperty->name)) {
if (count($trait->getTraitNames()) > 0) {
// Multiple layers of traits!
return $declarationCache[$key] = '';
}
// From a trait.
$declaringClass = $trait;
$type = '<br />in trait: ';
break;
}
}
}
$filename = $declaringClass->getFileName();
if (empty($filename) === true) {
return $declarationCache[$key] = static::UNKNOWN_DECLARATION;
}
return $declarationCache[$key] = $this->pool->fileService
->filterFilePath($declaringClass->getFileName()) . $type . $declaringClass->name;
} | php | protected function retrieveDeclarationPlace(\ReflectionProperty $refProperty)
{
static $declarationCache = array();
// Early return from the cache.
$declaringClass = $refProperty->getDeclaringClass();
$key = $refProperty->name . '::' . $declaringClass->name;
if (isset($declarationCache[$key])) {
return $declarationCache[$key];
}
// A class can not redeclare a property from a trait that it is using.
// Hence, if one of the traits has the same property that we are
// analysing, it is probably declared there.
// Traits on the other hand can redeclare their properties.
// I'm not sure how to get the actual declaration place, when dealing
// with several layers of traits. We will not parse the source code
// for an answer.
$type = '<br />in class: ';
if (method_exists($declaringClass, 'getTraits')) {
foreach ($refProperty->getDeclaringClass()->getTraits() as $trait) {
if ($trait->hasProperty($refProperty->name)) {
if (count($trait->getTraitNames()) > 0) {
// Multiple layers of traits!
return $declarationCache[$key] = '';
}
// From a trait.
$declaringClass = $trait;
$type = '<br />in trait: ';
break;
}
}
}
$filename = $declaringClass->getFileName();
if (empty($filename) === true) {
return $declarationCache[$key] = static::UNKNOWN_DECLARATION;
}
return $declarationCache[$key] = $this->pool->fileService
->filterFilePath($declaringClass->getFileName()) . $type . $declaringClass->name;
} | [
"protected",
"function",
"retrieveDeclarationPlace",
"(",
"\\",
"ReflectionProperty",
"$",
"refProperty",
")",
"{",
"static",
"$",
"declarationCache",
"=",
"array",
"(",
")",
";",
"// Early return from the cache.",
"$",
"declaringClass",
"=",
"$",
"refProperty",
"->",
"getDeclaringClass",
"(",
")",
";",
"$",
"key",
"=",
"$",
"refProperty",
"->",
"name",
".",
"'::'",
".",
"$",
"declaringClass",
"->",
"name",
";",
"if",
"(",
"isset",
"(",
"$",
"declarationCache",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"$",
"declarationCache",
"[",
"$",
"key",
"]",
";",
"}",
"// A class can not redeclare a property from a trait that it is using.",
"// Hence, if one of the traits has the same property that we are",
"// analysing, it is probably declared there.",
"// Traits on the other hand can redeclare their properties.",
"// I'm not sure how to get the actual declaration place, when dealing",
"// with several layers of traits. We will not parse the source code",
"// for an answer.",
"$",
"type",
"=",
"'<br />in class: '",
";",
"if",
"(",
"method_exists",
"(",
"$",
"declaringClass",
",",
"'getTraits'",
")",
")",
"{",
"foreach",
"(",
"$",
"refProperty",
"->",
"getDeclaringClass",
"(",
")",
"->",
"getTraits",
"(",
")",
"as",
"$",
"trait",
")",
"{",
"if",
"(",
"$",
"trait",
"->",
"hasProperty",
"(",
"$",
"refProperty",
"->",
"name",
")",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"trait",
"->",
"getTraitNames",
"(",
")",
")",
">",
"0",
")",
"{",
"// Multiple layers of traits!",
"return",
"$",
"declarationCache",
"[",
"$",
"key",
"]",
"=",
"''",
";",
"}",
"// From a trait.",
"$",
"declaringClass",
"=",
"$",
"trait",
";",
"$",
"type",
"=",
"'<br />in trait: '",
";",
"break",
";",
"}",
"}",
"}",
"$",
"filename",
"=",
"$",
"declaringClass",
"->",
"getFileName",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"filename",
")",
"===",
"true",
")",
"{",
"return",
"$",
"declarationCache",
"[",
"$",
"key",
"]",
"=",
"static",
"::",
"UNKNOWN_DECLARATION",
";",
"}",
"return",
"$",
"declarationCache",
"[",
"$",
"key",
"]",
"=",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"filterFilePath",
"(",
"$",
"declaringClass",
"->",
"getFileName",
"(",
")",
")",
".",
"$",
"type",
".",
"$",
"declaringClass",
"->",
"name",
";",
"}"
] | Retrieve the declaration place of a property.
@param \ReflectionProperty $refProperty
@return string | [
"Retrieve",
"the",
"declaration",
"place",
"of",
"a",
"property",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Iterate/ThroughProperties.php#L213-L255 |
33,679 | rollun-com/rollun-datastore | src/DataStore/src/DataStore/Aspect/AspectTyped.php | AspectTyped.dtoToArray | protected function dtoToArray(BaseDto $dto)
{
$itemData = [];
foreach ($this->scheme as $fieldName => $fieldInfo) {
$getter = 'get' . ucfirst($fieldName);
if (!method_exists($dto, $getter)) {
throw new RuntimeException("Undefined method '$getter' in " . get_class($dto));
}
/** @var FormatterInterface $formatter */
$formatter = $this->formatterPluginManager->get($fieldInfo['formatter']);
$itemData[$fieldName] = $formatter->format($dto->$getter());
}
return $itemData;
} | php | protected function dtoToArray(BaseDto $dto)
{
$itemData = [];
foreach ($this->scheme as $fieldName => $fieldInfo) {
$getter = 'get' . ucfirst($fieldName);
if (!method_exists($dto, $getter)) {
throw new RuntimeException("Undefined method '$getter' in " . get_class($dto));
}
/** @var FormatterInterface $formatter */
$formatter = $this->formatterPluginManager->get($fieldInfo['formatter']);
$itemData[$fieldName] = $formatter->format($dto->$getter());
}
return $itemData;
} | [
"protected",
"function",
"dtoToArray",
"(",
"BaseDto",
"$",
"dto",
")",
"{",
"$",
"itemData",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"scheme",
"as",
"$",
"fieldName",
"=>",
"$",
"fieldInfo",
")",
"{",
"$",
"getter",
"=",
"'get'",
".",
"ucfirst",
"(",
"$",
"fieldName",
")",
";",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"dto",
",",
"$",
"getter",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Undefined method '$getter' in \"",
".",
"get_class",
"(",
"$",
"dto",
")",
")",
";",
"}",
"/** @var FormatterInterface $formatter */",
"$",
"formatter",
"=",
"$",
"this",
"->",
"formatterPluginManager",
"->",
"get",
"(",
"$",
"fieldInfo",
"[",
"'formatter'",
"]",
")",
";",
"$",
"itemData",
"[",
"$",
"fieldName",
"]",
"=",
"$",
"formatter",
"->",
"format",
"(",
"$",
"dto",
"->",
"$",
"getter",
"(",
")",
")",
";",
"}",
"return",
"$",
"itemData",
";",
"}"
] | Convert BaseDto object to array
@param BaseDto $dto
@return array | [
"Convert",
"BaseDto",
"object",
"to",
"array"
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/Aspect/AspectTyped.php#L183-L201 |
33,680 | rollun-com/rollun-datastore | src/DataStore/src/DataStore/Aspect/AspectTyped.php | AspectTyped.arrayToDto | protected function arrayToDto(array $itemData)
{
foreach ($itemData as $field => $value) {
if (!isset($this->scheme[$field])) {
throw new InvalidArgumentException("Undefined field '$field' in scheme");
}
$typeService = $this->scheme[$field]['type'];
$itemData[$field] = $this->typePluginManager->get($typeService, ['value' => $value]);
}
return new $this->dtoClassName($itemData);
} | php | protected function arrayToDto(array $itemData)
{
foreach ($itemData as $field => $value) {
if (!isset($this->scheme[$field])) {
throw new InvalidArgumentException("Undefined field '$field' in scheme");
}
$typeService = $this->scheme[$field]['type'];
$itemData[$field] = $this->typePluginManager->get($typeService, ['value' => $value]);
}
return new $this->dtoClassName($itemData);
} | [
"protected",
"function",
"arrayToDto",
"(",
"array",
"$",
"itemData",
")",
"{",
"foreach",
"(",
"$",
"itemData",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"scheme",
"[",
"$",
"field",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Undefined field '$field' in scheme\"",
")",
";",
"}",
"$",
"typeService",
"=",
"$",
"this",
"->",
"scheme",
"[",
"$",
"field",
"]",
"[",
"'type'",
"]",
";",
"$",
"itemData",
"[",
"$",
"field",
"]",
"=",
"$",
"this",
"->",
"typePluginManager",
"->",
"get",
"(",
"$",
"typeService",
",",
"[",
"'value'",
"=>",
"$",
"value",
"]",
")",
";",
"}",
"return",
"new",
"$",
"this",
"->",
"dtoClassName",
"(",
"$",
"itemData",
")",
";",
"}"
] | Convert array to BaseDto object
@param array $itemData
@return BaseDto | [
"Convert",
"array",
"to",
"BaseDto",
"object"
] | ef433b58b94e1c311123ad1b2a0360e95a636bd1 | https://github.com/rollun-com/rollun-datastore/blob/ef433b58b94e1c311123ad1b2a0360e95a636bd1/src/DataStore/src/DataStore/Aspect/AspectTyped.php#L209-L221 |
33,681 | brainworxx/kreXX | src/Analyse/Callback/Analyse/Objects/AbstractObjectAnalysis.php | AbstractObjectAnalysis.getReflectionPropertiesData | protected function getReflectionPropertiesData(array $refProps, ReflectionClass $ref, $label = null)
{
// We are dumping public properties direct into the main-level, without
// any "abstraction level", because they can be accessed directly.
/** @var Model $model */
$model = $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->addParameter(static::PARAM_DATA, $refProps)
->addParameter(static::PARAM_REF, $ref)
->injectCallback(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughProperties')
);
if (isset($label)) {
// Protected or private properties.
return $this->pool->render->renderExpandableChild(
$this->dispatchEventWithModel(
static::EVENT_MARKER_ANALYSES_END,
$model->setName($label)
->setType(static::TYPE_INTERNALS)
)
);
}
// Public properties.
// We render them directly in the object "root", so we call
// the render directly.
return $this->dispatchEventWithModel(
static::EVENT_MARKER_ANALYSES_END,
$model
)->renderMe();
} | php | protected function getReflectionPropertiesData(array $refProps, ReflectionClass $ref, $label = null)
{
// We are dumping public properties direct into the main-level, without
// any "abstraction level", because they can be accessed directly.
/** @var Model $model */
$model = $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
->addParameter(static::PARAM_DATA, $refProps)
->addParameter(static::PARAM_REF, $ref)
->injectCallback(
$this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughProperties')
);
if (isset($label)) {
// Protected or private properties.
return $this->pool->render->renderExpandableChild(
$this->dispatchEventWithModel(
static::EVENT_MARKER_ANALYSES_END,
$model->setName($label)
->setType(static::TYPE_INTERNALS)
)
);
}
// Public properties.
// We render them directly in the object "root", so we call
// the render directly.
return $this->dispatchEventWithModel(
static::EVENT_MARKER_ANALYSES_END,
$model
)->renderMe();
} | [
"protected",
"function",
"getReflectionPropertiesData",
"(",
"array",
"$",
"refProps",
",",
"ReflectionClass",
"$",
"ref",
",",
"$",
"label",
"=",
"null",
")",
"{",
"// We are dumping public properties direct into the main-level, without",
"// any \"abstraction level\", because they can be accessed directly.",
"/** @var Model $model */",
"$",
"model",
"=",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Model'",
")",
"->",
"addParameter",
"(",
"static",
"::",
"PARAM_DATA",
",",
"$",
"refProps",
")",
"->",
"addParameter",
"(",
"static",
"::",
"PARAM_REF",
",",
"$",
"ref",
")",
"->",
"injectCallback",
"(",
"$",
"this",
"->",
"pool",
"->",
"createClass",
"(",
"'Brainworxx\\\\Krexx\\\\Analyse\\\\Callback\\\\Iterate\\\\ThroughProperties'",
")",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"label",
")",
")",
"{",
"// Protected or private properties.",
"return",
"$",
"this",
"->",
"pool",
"->",
"render",
"->",
"renderExpandableChild",
"(",
"$",
"this",
"->",
"dispatchEventWithModel",
"(",
"static",
"::",
"EVENT_MARKER_ANALYSES_END",
",",
"$",
"model",
"->",
"setName",
"(",
"$",
"label",
")",
"->",
"setType",
"(",
"static",
"::",
"TYPE_INTERNALS",
")",
")",
")",
";",
"}",
"// Public properties.",
"// We render them directly in the object \"root\", so we call",
"// the render directly.",
"return",
"$",
"this",
"->",
"dispatchEventWithModel",
"(",
"static",
"::",
"EVENT_MARKER_ANALYSES_END",
",",
"$",
"model",
")",
"->",
"renderMe",
"(",
")",
";",
"}"
] | Gets the properties from a reflection property of the object.
@param array $refProps
The list of the reflection properties.
@param ReflectionClass $ref
The reflection of the object we are currently analysing.
@param string $label
The additional part of the template file. If set, we will use a wrapper
around the analysis output.
@return string
The generated markup. | [
"Gets",
"the",
"properties",
"from",
"a",
"reflection",
"property",
"of",
"the",
"object",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/AbstractObjectAnalysis.php#L83-L113 |
33,682 | brainworxx/kreXX | src/Analyse/Callback/Analyse/Objects/AbstractObjectAnalysis.php | AbstractObjectAnalysis.reflectionSorting | protected function reflectionSorting(\Reflector $reflectionA, \Reflector $reflectionB)
{
/** @var \ReflectionMethod | \ReflectionProperty $reflectionA */
/** @var \ReflectionMethod | \ReflectionProperty $reflectionB */
return strcmp($reflectionA->getName(), $reflectionB->getName());
} | php | protected function reflectionSorting(\Reflector $reflectionA, \Reflector $reflectionB)
{
/** @var \ReflectionMethod | \ReflectionProperty $reflectionA */
/** @var \ReflectionMethod | \ReflectionProperty $reflectionB */
return strcmp($reflectionA->getName(), $reflectionB->getName());
} | [
"protected",
"function",
"reflectionSorting",
"(",
"\\",
"Reflector",
"$",
"reflectionA",
",",
"\\",
"Reflector",
"$",
"reflectionB",
")",
"{",
"/** @var \\ReflectionMethod | \\ReflectionProperty $reflectionA */",
"/** @var \\ReflectionMethod | \\ReflectionProperty $reflectionB */",
"return",
"strcmp",
"(",
"$",
"reflectionA",
"->",
"getName",
"(",
")",
",",
"$",
"reflectionB",
"->",
"getName",
"(",
")",
")",
";",
"}"
] | Simple sorting callback for reflections.
@param \Reflector $reflectionA
The first reflection.
@param \Reflector $reflectionB
The second reflection.
@return int | [
"Simple",
"sorting",
"callback",
"for",
"reflections",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/AbstractObjectAnalysis.php#L124-L129 |
33,683 | brainworxx/kreXX | src/Service/Config/Security.php | Security.evaluateSetting | public function evaluateSetting($group, $name, $value)
{
if ($group === 'feEditing') {
// Logging options can never be changed in the frontend.
// The debug methods will also not be editable.
return !in_array($name, $this->feConfigNoEdit);
}
// We simply call the configured evaluation method.
$callback = $this->feConfigFallback[$name][static::EVALUATE];
return $this->$callback($value, $name, $group);
} | php | public function evaluateSetting($group, $name, $value)
{
if ($group === 'feEditing') {
// Logging options can never be changed in the frontend.
// The debug methods will also not be editable.
return !in_array($name, $this->feConfigNoEdit);
}
// We simply call the configured evaluation method.
$callback = $this->feConfigFallback[$name][static::EVALUATE];
return $this->$callback($value, $name, $group);
} | [
"public",
"function",
"evaluateSetting",
"(",
"$",
"group",
",",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"group",
"===",
"'feEditing'",
")",
"{",
"// Logging options can never be changed in the frontend.",
"// The debug methods will also not be editable.",
"return",
"!",
"in_array",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"feConfigNoEdit",
")",
";",
"}",
"// We simply call the configured evaluation method.",
"$",
"callback",
"=",
"$",
"this",
"->",
"feConfigFallback",
"[",
"$",
"name",
"]",
"[",
"static",
"::",
"EVALUATE",
"]",
";",
"return",
"$",
"this",
"->",
"$",
"callback",
"(",
"$",
"value",
",",
"$",
"name",
",",
"$",
"group",
")",
";",
"}"
] | Evaluate a single setting from the cookies or the ini file.
@param string $group
The group value in the ini.
@param string $name
The name of the setting.
@param string $value
The value to evaluate.
@return bool
If it was evaluated. | [
"Evaluate",
"a",
"single",
"setting",
"from",
"the",
"cookies",
"or",
"the",
"ini",
"file",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/Security.php#L78-L89 |
33,684 | brainworxx/kreXX | src/Service/Config/Security.php | Security.evalDevHandle | protected function evalDevHandle($value, $name)
{
$result = preg_match('/[^a-zA-Z]/', $value) === 0;
if ($result === false) {
$this->pool->messages->addMessage(static::KEY_CONFIG_ERROR . ucfirst($name));
}
return $result;
} | php | protected function evalDevHandle($value, $name)
{
$result = preg_match('/[^a-zA-Z]/', $value) === 0;
if ($result === false) {
$this->pool->messages->addMessage(static::KEY_CONFIG_ERROR . ucfirst($name));
}
return $result;
} | [
"protected",
"function",
"evalDevHandle",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"$",
"result",
"=",
"preg_match",
"(",
"'/[^a-zA-Z]/'",
",",
"$",
"value",
")",
"===",
"0",
";",
"if",
"(",
"$",
"result",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"pool",
"->",
"messages",
"->",
"addMessage",
"(",
"static",
"::",
"KEY_CONFIG_ERROR",
".",
"ucfirst",
"(",
"$",
"name",
")",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
] | We check the dev handle for a-z and A-Z.
@param string $value
The value we want to evaluate
@param string $name
The name of the value we are checking, needed for the feedback text.
@return boolean
Whether it does evaluate or not. | [
"We",
"check",
"the",
"dev",
"handle",
"for",
"a",
"-",
"z",
"and",
"A",
"-",
"Z",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/Security.php#L102-L110 |
33,685 | brainworxx/kreXX | src/Service/Config/Security.php | Security.evalSkin | protected function evalSkin($value, $name)
{
$result = isset($this->skinConfiguration[$value]) &&
class_exists($this->skinConfiguration[$value][static::SKIN_CLASS]) &&
$this->pool->fileService->fileIsReadable(
$this->skinConfiguration[$value][static::SKIN_DIRECTORY] . 'header.html'
);
if ($result === false) {
$this->pool->messages->addMessage(static::KEY_CONFIG_ERROR . ucfirst($name));
}
return $result;
} | php | protected function evalSkin($value, $name)
{
$result = isset($this->skinConfiguration[$value]) &&
class_exists($this->skinConfiguration[$value][static::SKIN_CLASS]) &&
$this->pool->fileService->fileIsReadable(
$this->skinConfiguration[$value][static::SKIN_DIRECTORY] . 'header.html'
);
if ($result === false) {
$this->pool->messages->addMessage(static::KEY_CONFIG_ERROR . ucfirst($name));
}
return $result;
} | [
"protected",
"function",
"evalSkin",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"$",
"result",
"=",
"isset",
"(",
"$",
"this",
"->",
"skinConfiguration",
"[",
"$",
"value",
"]",
")",
"&&",
"class_exists",
"(",
"$",
"this",
"->",
"skinConfiguration",
"[",
"$",
"value",
"]",
"[",
"static",
"::",
"SKIN_CLASS",
"]",
")",
"&&",
"$",
"this",
"->",
"pool",
"->",
"fileService",
"->",
"fileIsReadable",
"(",
"$",
"this",
"->",
"skinConfiguration",
"[",
"$",
"value",
"]",
"[",
"static",
"::",
"SKIN_DIRECTORY",
"]",
".",
"'header.html'",
")",
";",
"if",
"(",
"$",
"result",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"pool",
"->",
"messages",
"->",
"addMessage",
"(",
"static",
"::",
"KEY_CONFIG_ERROR",
".",
"ucfirst",
"(",
"$",
"name",
")",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
] | We check the configuration for this skin.
@param string $value
The value we want to evaluate
@param string $name
The name of the value we are checking, needed for the feedback text.
@return boolean
Whether it does evaluate or not. | [
"We",
"check",
"the",
"configuration",
"for",
"this",
"skin",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/Security.php#L123-L136 |
33,686 | brainworxx/kreXX | src/Service/Config/Security.php | Security.evalDestination | protected function evalDestination($value, $name)
{
$result = ($value === static::VALUE_BROWSER || $value === 'file');
if ($result === false) {
$this->pool->messages->addMessage(static::KEY_CONFIG_ERROR . ucfirst($name));
}
return $result;
} | php | protected function evalDestination($value, $name)
{
$result = ($value === static::VALUE_BROWSER || $value === 'file');
if ($result === false) {
$this->pool->messages->addMessage(static::KEY_CONFIG_ERROR . ucfirst($name));
}
return $result;
} | [
"protected",
"function",
"evalDestination",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"$",
"result",
"=",
"(",
"$",
"value",
"===",
"static",
"::",
"VALUE_BROWSER",
"||",
"$",
"value",
"===",
"'file'",
")",
";",
"if",
"(",
"$",
"result",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"pool",
"->",
"messages",
"->",
"addMessage",
"(",
"static",
"::",
"KEY_CONFIG_ERROR",
".",
"ucfirst",
"(",
"$",
"name",
")",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
] | We are expecting 'browser' or 'file'.
@param string $value
The value we want to evaluate
@param string $name
The name of the value we are checking, needed for the feedback text.
@return boolean
Whether it does evaluate or not. | [
"We",
"are",
"expecting",
"browser",
"or",
"file",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/Security.php#L149-L157 |
33,687 | brainworxx/kreXX | src/Service/Config/Security.php | Security.evalIpRange | protected function evalIpRange($value, $name)
{
$result = empty($value);
if ($result === true) {
$this->pool->messages->addMessage(static::KEY_CONFIG_ERROR . ucfirst($name));
}
return !$result;
} | php | protected function evalIpRange($value, $name)
{
$result = empty($value);
if ($result === true) {
$this->pool->messages->addMessage(static::KEY_CONFIG_ERROR . ucfirst($name));
}
return !$result;
} | [
"protected",
"function",
"evalIpRange",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"$",
"result",
"=",
"empty",
"(",
"$",
"value",
")",
";",
"if",
"(",
"$",
"result",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"pool",
"->",
"messages",
"->",
"addMessage",
"(",
"static",
"::",
"KEY_CONFIG_ERROR",
".",
"ucfirst",
"(",
"$",
"name",
")",
")",
";",
"}",
"return",
"!",
"$",
"result",
";",
"}"
] | Evaluating the IP range, by testing that it is not empty.
@param string $value
The value we want to evaluate
@param string $name
The name of the value we are checking, needed for the feedback text.
@return boolean
Whether it does evaluate or not. | [
"Evaluating",
"the",
"IP",
"range",
"by",
"testing",
"that",
"it",
"is",
"not",
"empty",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/Security.php#L170-L178 |
33,688 | brainworxx/kreXX | src/Service/Config/Security.php | Security.evalMaxRuntime | protected function evalMaxRuntime($value, $name, $group)
{
// Check for integer first.
if ($this->evalInt($value, $name, $group) === false) {
return false;
}
$maxTime = (int)ini_get('max_execution_time');
// We need a maximum runtime in the first place
// and then check, if we have a value smaller than it.
if ($maxTime <= 0) {
// We were unable to get the maximum runtime from the server.
// No need to check any further.
return true;
}
if ($maxTime < (int)$value) {
$this->pool->messages->addMessage(
static::KEY_CONFIG_ERROR . ucfirst($name) . 'Big',
array($maxTime)
);
return false;
}
return true;
} | php | protected function evalMaxRuntime($value, $name, $group)
{
// Check for integer first.
if ($this->evalInt($value, $name, $group) === false) {
return false;
}
$maxTime = (int)ini_get('max_execution_time');
// We need a maximum runtime in the first place
// and then check, if we have a value smaller than it.
if ($maxTime <= 0) {
// We were unable to get the maximum runtime from the server.
// No need to check any further.
return true;
}
if ($maxTime < (int)$value) {
$this->pool->messages->addMessage(
static::KEY_CONFIG_ERROR . ucfirst($name) . 'Big',
array($maxTime)
);
return false;
}
return true;
} | [
"protected",
"function",
"evalMaxRuntime",
"(",
"$",
"value",
",",
"$",
"name",
",",
"$",
"group",
")",
"{",
"// Check for integer first.",
"if",
"(",
"$",
"this",
"->",
"evalInt",
"(",
"$",
"value",
",",
"$",
"name",
",",
"$",
"group",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"$",
"maxTime",
"=",
"(",
"int",
")",
"ini_get",
"(",
"'max_execution_time'",
")",
";",
"// We need a maximum runtime in the first place",
"// and then check, if we have a value smaller than it.",
"if",
"(",
"$",
"maxTime",
"<=",
"0",
")",
"{",
"// We were unable to get the maximum runtime from the server.",
"// No need to check any further.",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"maxTime",
"<",
"(",
"int",
")",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"pool",
"->",
"messages",
"->",
"addMessage",
"(",
"static",
"::",
"KEY_CONFIG_ERROR",
".",
"ucfirst",
"(",
"$",
"name",
")",
".",
"'Big'",
",",
"array",
"(",
"$",
"maxTime",
")",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Evaluation the maximum runtime, by looking at the server settings, as
well as checking for an integer value.
@param string $value
The value we want to evaluate
@param string $name
The name of the value we are checking, needed for the feedback text.
@param string $group
The name of the group that we are evaluating, needed for the feedback
text.
@return boolean
Whether it does evaluate or not. | [
"Evaluation",
"the",
"maximum",
"runtime",
"by",
"looking",
"at",
"the",
"server",
"settings",
"as",
"well",
"as",
"checking",
"for",
"an",
"integer",
"value",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/Security.php#L195-L220 |
33,689 | brainworxx/kreXX | src/Service/Config/Security.php | Security.evalBool | protected function evalBool($value, $name, $group)
{
$result = ($value === static::VALUE_TRUE || $value === static::VALUE_FALSE);
if ($result === false) {
$this->pool->messages->addMessage(static::KEY_CONFIG_ERROR_BOOL, array($group, $name));
}
return $result;
} | php | protected function evalBool($value, $name, $group)
{
$result = ($value === static::VALUE_TRUE || $value === static::VALUE_FALSE);
if ($result === false) {
$this->pool->messages->addMessage(static::KEY_CONFIG_ERROR_BOOL, array($group, $name));
}
return $result;
} | [
"protected",
"function",
"evalBool",
"(",
"$",
"value",
",",
"$",
"name",
",",
"$",
"group",
")",
"{",
"$",
"result",
"=",
"(",
"$",
"value",
"===",
"static",
"::",
"VALUE_TRUE",
"||",
"$",
"value",
"===",
"static",
"::",
"VALUE_FALSE",
")",
";",
"if",
"(",
"$",
"result",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"pool",
"->",
"messages",
"->",
"addMessage",
"(",
"static",
"::",
"KEY_CONFIG_ERROR_BOOL",
",",
"array",
"(",
"$",
"group",
",",
"$",
"name",
")",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
] | Evaluates a string of 'true' or 'false'.
@param string $value
The string we want to evaluate.
@param string $name
The name of the value we are checking, needed for the feedback text.
@param string $group
The name of the group that we are evaluating, needed for the feedback
text.
@return bool
Whether it does evaluate or not. | [
"Evaluates",
"a",
"string",
"of",
"true",
"or",
"false",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/Security.php#L236-L244 |
33,690 | brainworxx/kreXX | src/Service/Config/Security.php | Security.evalInt | protected function evalInt($value, $name, $group)
{
$result = ((int) $value) > 0;
if ($result === false) {
$this->pool->messages->addMessage(static::KEY_CONFIG_ERROR_INT, array($group, $name));
}
return $result;
} | php | protected function evalInt($value, $name, $group)
{
$result = ((int) $value) > 0;
if ($result === false) {
$this->pool->messages->addMessage(static::KEY_CONFIG_ERROR_INT, array($group, $name));
}
return $result;
} | [
"protected",
"function",
"evalInt",
"(",
"$",
"value",
",",
"$",
"name",
",",
"$",
"group",
")",
"{",
"$",
"result",
"=",
"(",
"(",
"int",
")",
"$",
"value",
")",
">",
"0",
";",
"if",
"(",
"$",
"result",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"pool",
"->",
"messages",
"->",
"addMessage",
"(",
"static",
"::",
"KEY_CONFIG_ERROR_INT",
",",
"array",
"(",
"$",
"group",
",",
"$",
"name",
")",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
] | Evaluates a string of integer.
It must be greater than 0 and smaller than 101.
@param string $value
The string we want to evaluate.
@param string $name
The name of the value we are checking, needed for the feedback text.
@param string $group
The name of the group that we are evaluating, needed for the feedback
text.
@return bool
Whether it does evaluate or not. | [
"Evaluates",
"a",
"string",
"of",
"integer",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/Security.php#L262-L270 |
33,691 | brainworxx/kreXX | src/Service/Config/Security.php | Security.evalDebugMethods | protected function evalDebugMethods($value, $name, $group)
{
$list = explode(',', $value);
foreach ($list as $entry) {
// Test for whitespace and the blacklist.
if (in_array($entry, $this->methodBlacklist)) {
$this->pool->messages->addMessage(
static::KEY_CONFIG_ERROR_DEBUG_BLACKLIST,
array($group, $name, $entry)
);
return false;
}
if (strpos($entry, ' ') !== false) {
$this->pool->messages->addMessage(
static::KEY_CONFIG_ERROR_DEBUG_INVALID,
array($group, $name, $entry)
);
return false;
}
}
return true;
} | php | protected function evalDebugMethods($value, $name, $group)
{
$list = explode(',', $value);
foreach ($list as $entry) {
// Test for whitespace and the blacklist.
if (in_array($entry, $this->methodBlacklist)) {
$this->pool->messages->addMessage(
static::KEY_CONFIG_ERROR_DEBUG_BLACKLIST,
array($group, $name, $entry)
);
return false;
}
if (strpos($entry, ' ') !== false) {
$this->pool->messages->addMessage(
static::KEY_CONFIG_ERROR_DEBUG_INVALID,
array($group, $name, $entry)
);
return false;
}
}
return true;
} | [
"protected",
"function",
"evalDebugMethods",
"(",
"$",
"value",
",",
"$",
"name",
",",
"$",
"group",
")",
"{",
"$",
"list",
"=",
"explode",
"(",
"','",
",",
"$",
"value",
")",
";",
"foreach",
"(",
"$",
"list",
"as",
"$",
"entry",
")",
"{",
"// Test for whitespace and the blacklist.",
"if",
"(",
"in_array",
"(",
"$",
"entry",
",",
"$",
"this",
"->",
"methodBlacklist",
")",
")",
"{",
"$",
"this",
"->",
"pool",
"->",
"messages",
"->",
"addMessage",
"(",
"static",
"::",
"KEY_CONFIG_ERROR_DEBUG_BLACKLIST",
",",
"array",
"(",
"$",
"group",
",",
"$",
"name",
",",
"$",
"entry",
")",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"entry",
",",
"' '",
")",
"!==",
"false",
")",
"{",
"$",
"this",
"->",
"pool",
"->",
"messages",
"->",
"addMessage",
"(",
"static",
"::",
"KEY_CONFIG_ERROR_DEBUG_INVALID",
",",
"array",
"(",
"$",
"group",
",",
"$",
"name",
",",
"$",
"entry",
")",
")",
";",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Sanity check, if the supplied debug methods are not obviously flawed.
@param string $value
Comma separated list of debug methods.
@param string $name
The name of the value we are checking, needed for the feedback text.
@param string $group
The name of the group that we are evaluating, needed for the feedback
text.
@return bool
Whether it does evaluate or not. | [
"Sanity",
"check",
"if",
"the",
"supplied",
"debug",
"methods",
"are",
"not",
"obviously",
"flawed",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/Security.php#L297-L320 |
33,692 | silverorange/swat | Swat/SwatLinkCellRenderer.php | SwatLinkCellRenderer.renderSensitive | protected function renderSensitive()
{
$anchor_tag = new SwatHtmlTag('a');
$anchor_tag->setContent($this->getText(), $this->content_type);
$anchor_tag->href = $this->getLink();
$anchor_tag->title = $this->getTitle();
$anchor_tag->class = $this->getCSSClassString();
$anchor_tag->display();
} | php | protected function renderSensitive()
{
$anchor_tag = new SwatHtmlTag('a');
$anchor_tag->setContent($this->getText(), $this->content_type);
$anchor_tag->href = $this->getLink();
$anchor_tag->title = $this->getTitle();
$anchor_tag->class = $this->getCSSClassString();
$anchor_tag->display();
} | [
"protected",
"function",
"renderSensitive",
"(",
")",
"{",
"$",
"anchor_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'a'",
")",
";",
"$",
"anchor_tag",
"->",
"setContent",
"(",
"$",
"this",
"->",
"getText",
"(",
")",
",",
"$",
"this",
"->",
"content_type",
")",
";",
"$",
"anchor_tag",
"->",
"href",
"=",
"$",
"this",
"->",
"getLink",
"(",
")",
";",
"$",
"anchor_tag",
"->",
"title",
"=",
"$",
"this",
"->",
"getTitle",
"(",
")",
";",
"$",
"anchor_tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"$",
"anchor_tag",
"->",
"display",
"(",
")",
";",
"}"
] | Renders this link as sensitive | [
"Renders",
"this",
"link",
"as",
"sensitive"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatLinkCellRenderer.php#L122-L130 |
33,693 | silverorange/swat | Swat/SwatLinkCellRenderer.php | SwatLinkCellRenderer.renderInsensitive | protected function renderInsensitive()
{
$span_tag = new SwatHtmlTag('span');
$span_tag->setContent($this->getText(), $this->content_type);
$span_tag->title = $this->getTitle();
$span_tag->class = $this->getCSSClassString();
$span_tag->display();
} | php | protected function renderInsensitive()
{
$span_tag = new SwatHtmlTag('span');
$span_tag->setContent($this->getText(), $this->content_type);
$span_tag->title = $this->getTitle();
$span_tag->class = $this->getCSSClassString();
$span_tag->display();
} | [
"protected",
"function",
"renderInsensitive",
"(",
")",
"{",
"$",
"span_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'span'",
")",
";",
"$",
"span_tag",
"->",
"setContent",
"(",
"$",
"this",
"->",
"getText",
"(",
")",
",",
"$",
"this",
"->",
"content_type",
")",
";",
"$",
"span_tag",
"->",
"title",
"=",
"$",
"this",
"->",
"getTitle",
"(",
")",
";",
"$",
"span_tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"$",
"span_tag",
"->",
"display",
"(",
")",
";",
"}"
] | Renders this link as not sensitive | [
"Renders",
"this",
"link",
"as",
"not",
"sensitive"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatLinkCellRenderer.php#L138-L145 |
33,694 | brainworxx/kreXX | src/Analyse/AbstractModel.php | AbstractModel.addToJson | public function addToJson($key, $value)
{
// Remove leftover linebreaks.
$value = trim(preg_replace("/\r|\n/", "", $value));
if ($value === '') {
unset($this->json[$key]);
} else {
$this->json[$key] = $value;
}
return $this;
} | php | public function addToJson($key, $value)
{
// Remove leftover linebreaks.
$value = trim(preg_replace("/\r|\n/", "", $value));
if ($value === '') {
unset($this->json[$key]);
} else {
$this->json[$key] = $value;
}
return $this;
} | [
"public",
"function",
"addToJson",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"// Remove leftover linebreaks.",
"$",
"value",
"=",
"trim",
"(",
"preg_replace",
"(",
"\"/\\r|\\n/\"",
",",
"\"\"",
",",
"$",
"value",
")",
")",
";",
"if",
"(",
"$",
"value",
"===",
"''",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"json",
"[",
"$",
"key",
"]",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"json",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | We simply add more info to our info json.
Leftover linebreaks will be removed.
If the value is empty, we will remove a possible previous entry to this key.
@param string $key
The array key.
@param string $value
The value we want to set.
@return $this
$this for chaining. | [
"We",
"simply",
"add",
"more",
"info",
"to",
"our",
"info",
"json",
".",
"Leftover",
"linebreaks",
"will",
"be",
"removed",
".",
"If",
"the",
"value",
"is",
"empty",
"we",
"will",
"remove",
"a",
"possible",
"previous",
"entry",
"to",
"this",
"key",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/AbstractModel.php#L173-L184 |
33,695 | silverorange/swat | SwatDB/SwatDBRecordsetWrapper.php | SwatDBRecordsetWrapper.duplicate | public function duplicate()
{
$class = get_class($this);
$new_wrapper = new $class();
foreach ($this->getArray() as $object) {
$object->setDatabase($this->db);
$duplicate_object = $object->duplicate();
$duplicate_object->setDatabase($this->db);
$new_wrapper->add($duplicate_object);
}
$new_wrapper->setDatabase($this->db);
return $new_wrapper;
} | php | public function duplicate()
{
$class = get_class($this);
$new_wrapper = new $class();
foreach ($this->getArray() as $object) {
$object->setDatabase($this->db);
$duplicate_object = $object->duplicate();
$duplicate_object->setDatabase($this->db);
$new_wrapper->add($duplicate_object);
}
$new_wrapper->setDatabase($this->db);
return $new_wrapper;
} | [
"public",
"function",
"duplicate",
"(",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"$",
"new_wrapper",
"=",
"new",
"$",
"class",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getArray",
"(",
")",
"as",
"$",
"object",
")",
"{",
"$",
"object",
"->",
"setDatabase",
"(",
"$",
"this",
"->",
"db",
")",
";",
"$",
"duplicate_object",
"=",
"$",
"object",
"->",
"duplicate",
"(",
")",
";",
"$",
"duplicate_object",
"->",
"setDatabase",
"(",
"$",
"this",
"->",
"db",
")",
";",
"$",
"new_wrapper",
"->",
"add",
"(",
"$",
"duplicate_object",
")",
";",
"}",
"$",
"new_wrapper",
"->",
"setDatabase",
"(",
"$",
"this",
"->",
"db",
")",
";",
"return",
"$",
"new_wrapper",
";",
"}"
] | Duplicates this record set wrapper
@return SwatDBRecordsetWrapper a duplicate of this object.
@see SwatDBDataobject::duplicate() | [
"Duplicates",
"this",
"record",
"set",
"wrapper"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDBRecordsetWrapper.php#L177-L192 |
33,696 | silverorange/swat | SwatDB/SwatDBRecordsetWrapper.php | SwatDBRecordsetWrapper.setOptions | public function setOptions($options, $value = null)
{
// if options passed as string then second param is option value
if (is_string($options)) {
$options = array($options => $value);
}
if (!is_array($options)) {
throw new InvalidArgumentException(
'The $options parameter must either be an array or a string ' .
'containing the option name.'
);
}
// new options override existing options
$this->options = array_merge($options, $this->options);
return $this;
} | php | public function setOptions($options, $value = null)
{
// if options passed as string then second param is option value
if (is_string($options)) {
$options = array($options => $value);
}
if (!is_array($options)) {
throw new InvalidArgumentException(
'The $options parameter must either be an array or a string ' .
'containing the option name.'
);
}
// new options override existing options
$this->options = array_merge($options, $this->options);
return $this;
} | [
"public",
"function",
"setOptions",
"(",
"$",
"options",
",",
"$",
"value",
"=",
"null",
")",
"{",
"// if options passed as string then second param is option value",
"if",
"(",
"is_string",
"(",
"$",
"options",
")",
")",
"{",
"$",
"options",
"=",
"array",
"(",
"$",
"options",
"=>",
"$",
"value",
")",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"options",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'The $options parameter must either be an array or a string '",
".",
"'containing the option name.'",
")",
";",
"}",
"// new options override existing options",
"$",
"this",
"->",
"options",
"=",
"array_merge",
"(",
"$",
"options",
",",
"$",
"this",
"->",
"options",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Sets one or more options for this recordset wrapper
Subclasses may define additional options. The default options are:
- <kbd>boolean read_only</kbd> if true, records are initialized as
read only. Defaults to false.
@param array|string $options either an array containing key-value pairs
or a string cotnaining the option name to
set.
@param mixed $value optional. If <kbd>$options</kbd> was passed
as a string, this is the option value.
@return SwatDBRecordsetWrapper the current object for fluent interface. | [
"Sets",
"one",
"or",
"more",
"options",
"for",
"this",
"recordset",
"wrapper"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDBRecordsetWrapper.php#L213-L231 |
33,697 | silverorange/swat | SwatDB/SwatDBRecordsetWrapper.php | SwatDBRecordsetWrapper.copyEmpty | public function copyEmpty()
{
$class_name = get_class($this);
$wrapper = new $class_name();
$wrapper->row_wrapper_class = $this->row_wrapper_class;
$wrapper->index_field = $this->index_field;
$wrapper->options = $this->options;
return $wrapper;
} | php | public function copyEmpty()
{
$class_name = get_class($this);
$wrapper = new $class_name();
$wrapper->row_wrapper_class = $this->row_wrapper_class;
$wrapper->index_field = $this->index_field;
$wrapper->options = $this->options;
return $wrapper;
} | [
"public",
"function",
"copyEmpty",
"(",
")",
"{",
"$",
"class_name",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"$",
"wrapper",
"=",
"new",
"$",
"class_name",
"(",
")",
";",
"$",
"wrapper",
"->",
"row_wrapper_class",
"=",
"$",
"this",
"->",
"row_wrapper_class",
";",
"$",
"wrapper",
"->",
"index_field",
"=",
"$",
"this",
"->",
"index_field",
";",
"$",
"wrapper",
"->",
"options",
"=",
"$",
"this",
"->",
"options",
";",
"return",
"$",
"wrapper",
";",
"}"
] | Creates a new empty copy of this recordset wrapper
@return SwatDBRecordsetWrapper a new empty copy of this wrapper. | [
"Creates",
"a",
"new",
"empty",
"copy",
"of",
"this",
"recordset",
"wrapper"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDBRecordsetWrapper.php#L265-L275 |
33,698 | silverorange/swat | SwatDB/SwatDBRecordsetWrapper.php | SwatDBRecordsetWrapper.instantiateRowWrapperObject | protected function instantiateRowWrapperObject($row)
{
if ($this->row_wrapper_class === null) {
$object = $row;
} else {
$object = new $this->row_wrapper_class(
$row,
$this->getOption('read_only')
);
}
return $object;
} | php | protected function instantiateRowWrapperObject($row)
{
if ($this->row_wrapper_class === null) {
$object = $row;
} else {
$object = new $this->row_wrapper_class(
$row,
$this->getOption('read_only')
);
}
return $object;
} | [
"protected",
"function",
"instantiateRowWrapperObject",
"(",
"$",
"row",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"row_wrapper_class",
"===",
"null",
")",
"{",
"$",
"object",
"=",
"$",
"row",
";",
"}",
"else",
"{",
"$",
"object",
"=",
"new",
"$",
"this",
"->",
"row_wrapper_class",
"(",
"$",
"row",
",",
"$",
"this",
"->",
"getOption",
"(",
"'read_only'",
")",
")",
";",
"}",
"return",
"$",
"object",
";",
"}"
] | Creates a new dataobject
@param stdClass $row the data row to use.
@return mixed the instantiated data object or the original object if
no <i>$row_wrapper_class</i> is defined for this
recordset wrapper. | [
"Creates",
"a",
"new",
"dataobject"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDBRecordsetWrapper.php#L289-L301 |
33,699 | silverorange/swat | SwatDB/SwatDBRecordsetWrapper.php | SwatDBRecordsetWrapper.offsetExists | public function offsetExists($offset)
{
if ($this->index_field === null) {
return isset($this->objects[$offset]);
}
return isset($this->objects_by_index[$offset]);
} | php | public function offsetExists($offset)
{
if ($this->index_field === null) {
return isset($this->objects[$offset]);
}
return isset($this->objects_by_index[$offset]);
} | [
"public",
"function",
"offsetExists",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"index_field",
"===",
"null",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"offset",
"]",
")",
";",
"}",
"return",
"isset",
"(",
"$",
"this",
"->",
"objects_by_index",
"[",
"$",
"offset",
"]",
")",
";",
"}"
] | Gets whether or not a value exists for the given offset
@param mixed $offset the offset to check. If this recordset has a
defined index field, the offset is an index
value. Otherwise, the offset is an ordinal value.
@return boolean true if this recordset has a value for the given offset
and false if it does not. | [
"Gets",
"whether",
"or",
"not",
"a",
"value",
"exists",
"for",
"the",
"given",
"offset"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDBRecordsetWrapper.php#L355-L362 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.