repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
LapaLabs/YoutubeHelper | Resource/YoutubeResource.php | YoutubeResource.buildEmbedHtml | public function buildEmbedHtml(array $attributes = [], array $parameters = [])
{
// <iframe width="560" height="315" src="https://www.youtube.com/embed/5qanlirrRWs" frameborder="0" allowfullscreen></iframe>
$attributes = array_merge($this->attributes, $attributes, [
'src' => $this->build... | php | public function buildEmbedHtml(array $attributes = [], array $parameters = [])
{
// <iframe width="560" height="315" src="https://www.youtube.com/embed/5qanlirrRWs" frameborder="0" allowfullscreen></iframe>
$attributes = array_merge($this->attributes, $attributes, [
'src' => $this->build... | [
"public",
"function",
"buildEmbedHtml",
"(",
"array",
"$",
"attributes",
"=",
"[",
"]",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"// <iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/5qanlirrRWs\" frameborder=\"0\" allowfullscreen></ifram... | Build the valid HTML code to embed this resource
@param array $attributes
@param array $parameters
@return string | [
"Build",
"the",
"valid",
"HTML",
"code",
"to",
"embed",
"this",
"resource"
] | b94fd4700881494d24f14fb39ed8093215d0b25b | https://github.com/LapaLabs/YoutubeHelper/blob/b94fd4700881494d24f14fb39ed8093215d0b25b/Resource/YoutubeResource.php#L230-L247 | train |
cityware/city-format | src/Text.php | Text.slugify | public static function slugify($title, $length = 200) {
$title = strip_tags($title);
// Preserve escaped octets.
$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
// Remove percent signs that are not part of an octet.
$title = str_replace('%', '', $title);... | php | public static function slugify($title, $length = 200) {
$title = strip_tags($title);
// Preserve escaped octets.
$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
// Remove percent signs that are not part of an octet.
$title = str_replace('%', '', $title);... | [
"public",
"static",
"function",
"slugify",
"(",
"$",
"title",
",",
"$",
"length",
"=",
"200",
")",
"{",
"$",
"title",
"=",
"strip_tags",
"(",
"$",
"title",
")",
";",
"// Preserve escaped octets.",
"$",
"title",
"=",
"preg_replace",
"(",
"'|%([a-fA-F0-9][a-fA... | Sanitizes title, replacing whitespace with dashes.
Limits the output to alphanumeric characters, underscore (_) and dash (-).
Whitespace becomes a dash.
@param string $title The title to be sanitized.
@return string The sanitized title. | [
"Sanitizes",
"title",
"replacing",
"whitespace",
"with",
"dashes",
"."
] | 1e292670639a950ecf561b545462427512950c74 | https://github.com/cityware/city-format/blob/1e292670639a950ecf561b545462427512950c74/src/Text.php#L234-L257 | train |
headzoo/web-tools | src/Headzoo/Web/Tools/WebServer.php | WebServer.sendResponseHeadersToClient | protected function sendResponseHeadersToClient(WebRequest $request, $code, $message)
{
$headers = [
"Date" => gmdate("D, d M Y H:i:s T"),
"Connection" => "close"
];
$bytes = $this->sendToClient($request->getVersion() . " {$code} {$message}\r\n");
... | php | protected function sendResponseHeadersToClient(WebRequest $request, $code, $message)
{
$headers = [
"Date" => gmdate("D, d M Y H:i:s T"),
"Connection" => "close"
];
$bytes = $this->sendToClient($request->getVersion() . " {$code} {$message}\r\n");
... | [
"protected",
"function",
"sendResponseHeadersToClient",
"(",
"WebRequest",
"$",
"request",
",",
"$",
"code",
",",
"$",
"message",
")",
"{",
"$",
"headers",
"=",
"[",
"\"Date\"",
"=>",
"gmdate",
"(",
"\"D, d M Y H:i:s T\"",
")",
",",
"\"Connection\"",
"=>",
"\"... | Sends the response headers through the client socket
Returns the number of bytes sent.
@param WebRequest $request The http request
@param int $code The http status code to sent
@param string $message The http status message to send
@return int | [
"Sends",
"the",
"response",
"headers",
"through",
"the",
"client",
"socket"
] | 305ce78029b86fa1fadaf8341d8fc737c84eab87 | https://github.com/headzoo/web-tools/blob/305ce78029b86fa1fadaf8341d8fc737c84eab87/src/Headzoo/Web/Tools/WebServer.php#L231-L245 | train |
headzoo/web-tools | src/Headzoo/Web/Tools/WebServer.php | WebServer.sendToClient | protected function sendToClient($line)
{
$bytes = 0;
$len = strlen($line);
if ($len) {
while(true) {
$sent = socket_write($this->client, $line, $len);
if (false === $sent) {
throw new Exceptions\HttpStatusError(
... | php | protected function sendToClient($line)
{
$bytes = 0;
$len = strlen($line);
if ($len) {
while(true) {
$sent = socket_write($this->client, $line, $len);
if (false === $sent) {
throw new Exceptions\HttpStatusError(
... | [
"protected",
"function",
"sendToClient",
"(",
"$",
"line",
")",
"{",
"$",
"bytes",
"=",
"0",
";",
"$",
"len",
"=",
"strlen",
"(",
"$",
"line",
")",
";",
"if",
"(",
"$",
"len",
")",
"{",
"while",
"(",
"true",
")",
"{",
"$",
"sent",
"=",
"socket_... | Sends a string through the client socket
Returns the number of bytes sent.
@param string $line The string to send
@return int
@throws Exceptions\HttpStatusError | [
"Sends",
"a",
"string",
"through",
"the",
"client",
"socket"
] | 305ce78029b86fa1fadaf8341d8fc737c84eab87 | https://github.com/headzoo/web-tools/blob/305ce78029b86fa1fadaf8341d8fc737c84eab87/src/Headzoo/Web/Tools/WebServer.php#L256-L281 | train |
headzoo/web-tools | src/Headzoo/Web/Tools/WebServer.php | WebServer.getFile | protected function getFile(WebRequest $request)
{
$path = realpath($this->dirRoot . DIRECTORY_SEPARATOR . $request->getPath());
if (false === $path) {
throw new Exceptions\HttpStatusError(
"File not found.",
404
);
}
if (is_dir(... | php | protected function getFile(WebRequest $request)
{
$path = realpath($this->dirRoot . DIRECTORY_SEPARATOR . $request->getPath());
if (false === $path) {
throw new Exceptions\HttpStatusError(
"File not found.",
404
);
}
if (is_dir(... | [
"protected",
"function",
"getFile",
"(",
"WebRequest",
"$",
"request",
")",
"{",
"$",
"path",
"=",
"realpath",
"(",
"$",
"this",
"->",
"dirRoot",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"request",
"->",
"getPath",
"(",
")",
")",
";",
"if",
"(",
"false",
... | Returns the data for the requested file
@param WebRequest $request The http request
@return string
@throws Exceptions\HttpStatusError | [
"Returns",
"the",
"data",
"for",
"the",
"requested",
"file"
] | 305ce78029b86fa1fadaf8341d8fc737c84eab87 | https://github.com/headzoo/web-tools/blob/305ce78029b86fa1fadaf8341d8fc737c84eab87/src/Headzoo/Web/Tools/WebServer.php#L290-L316 | train |
timostamm/url-builder | src/UrlPath.php | UrlPath.parseComponent | public function parseComponent($str)
{
if (! is_string($str)) {
throw new InvalidUrlException('Unexpected type.');
}
if (strpos($str, ' ') !== false) {
throw new InvalidUrlException('Path contains whitespace.');
}
$p = explode('/', $str);
foreach ($p as $i => $v) {
$p[$i] = rawurldecode($v);
}
... | php | public function parseComponent($str)
{
if (! is_string($str)) {
throw new InvalidUrlException('Unexpected type.');
}
if (strpos($str, ' ') !== false) {
throw new InvalidUrlException('Path contains whitespace.');
}
$p = explode('/', $str);
foreach ($p as $i => $v) {
$p[$i] = rawurldecode($v);
}
... | [
"public",
"function",
"parseComponent",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"str",
")",
")",
"{",
"throw",
"new",
"InvalidUrlException",
"(",
"'Unexpected type.'",
")",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"str",
",",
... | Parses a path component as it appears in a URL.
@param string $str
@throws \InvalidArgumentException | [
"Parses",
"a",
"path",
"component",
"as",
"it",
"appears",
"in",
"a",
"URL",
"."
] | 9dec80635017415d83b7e6ef155e9324f4b27a00 | https://github.com/timostamm/url-builder/blob/9dec80635017415d83b7e6ef155e9324f4b27a00/src/UrlPath.php#L41-L55 | train |
timostamm/url-builder | src/UrlPath.php | UrlPath.get | public function get()
{
if (is_null($this->url)) {
return $this->path->get();
}
if (! $this->url->host->isEmpty()) {
return Path::info('/')->resolve($this->path)->get();
}
return $this->path->get();
} | php | public function get()
{
if (is_null($this->url)) {
return $this->path->get();
}
if (! $this->url->host->isEmpty()) {
return Path::info('/')->resolve($this->path)->get();
}
return $this->path->get();
} | [
"public",
"function",
"get",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"url",
")",
")",
"{",
"return",
"$",
"this",
"->",
"path",
"->",
"get",
"(",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"url",
"->",
"host",
"->"... | Returns the decoded path.
The path will start with a slash if the host is set, regardless whether
the slash was present in the parsed URL and regardless whether you
included the slash when setting the path via set().
Please not that __toString() does not prepend the slash.
@return string | [
"Returns",
"the",
"decoded",
"path",
"."
] | 9dec80635017415d83b7e6ef155e9324f4b27a00 | https://github.com/timostamm/url-builder/blob/9dec80635017415d83b7e6ef155e9324f4b27a00/src/UrlPath.php#L68-L77 | train |
timostamm/url-builder | src/UrlPath.php | UrlPath.set | public function set($str)
{
if ($str instanceof Path) {
$this->path->set($str->get());
} else if ($str instanceof UrlPath) {
$this->path->set($str->get());
} else if (is_string($str)) {
$this->path->set($str);
} else {
throw new \InvalidArgumentException('Unexpected type.');
}
} | php | public function set($str)
{
if ($str instanceof Path) {
$this->path->set($str->get());
} else if ($str instanceof UrlPath) {
$this->path->set($str->get());
} else if (is_string($str)) {
$this->path->set($str);
} else {
throw new \InvalidArgumentException('Unexpected type.');
}
} | [
"public",
"function",
"set",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"$",
"str",
"instanceof",
"Path",
")",
"{",
"$",
"this",
"->",
"path",
"->",
"set",
"(",
"$",
"str",
"->",
"get",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"$",
"str",
"inst... | Sets the decoded path.
@param string|UrlPath|Path $str
@throws \InvalidArgumentException | [
"Sets",
"the",
"decoded",
"path",
"."
] | 9dec80635017415d83b7e6ef155e9324f4b27a00 | https://github.com/timostamm/url-builder/blob/9dec80635017415d83b7e6ef155e9324f4b27a00/src/UrlPath.php#L85-L96 | train |
timostamm/url-builder | src/UrlPath.php | UrlPath.isAbsolute | public function isAbsolute()
{
if (! is_null($this->url) && $this->path->isEmpty()) {
return ! $this->url->host->isEmpty();
}
return $this->path->isAbsolute();
} | php | public function isAbsolute()
{
if (! is_null($this->url) && $this->path->isEmpty()) {
return ! $this->url->host->isEmpty();
}
return $this->path->isAbsolute();
} | [
"public",
"function",
"isAbsolute",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"url",
")",
"&&",
"$",
"this",
"->",
"path",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
"!",
"$",
"this",
"->",
"url",
"->",
"host",
"->",
... | URLs can be relative if scheme and host are omitted.
Examples for relative URLs are:
- ../foo.html
- foo.html
However, they can have an absolute path at the same time:
- /index.html
You can use this method to determine whether the path is absolute or not.
@return boolean | [
"URLs",
"can",
"be",
"relative",
"if",
"scheme",
"and",
"host",
"are",
"omitted",
"."
] | 9dec80635017415d83b7e6ef155e9324f4b27a00 | https://github.com/timostamm/url-builder/blob/9dec80635017415d83b7e6ef155e9324f4b27a00/src/UrlPath.php#L135-L141 | train |
timostamm/url-builder | src/UrlPath.php | UrlPath.dirname | public function dirname()
{
if (! is_null($this->url) && $this->path->isEmpty() && ! $this->url->host->isEmpty()) {
return '/';
}
return $this->path->dirname();
} | php | public function dirname()
{
if (! is_null($this->url) && $this->path->isEmpty() && ! $this->url->host->isEmpty()) {
return '/';
}
return $this->path->dirname();
} | [
"public",
"function",
"dirname",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"url",
")",
"&&",
"$",
"this",
"->",
"path",
"->",
"isEmpty",
"(",
")",
"&&",
"!",
"$",
"this",
"->",
"url",
"->",
"host",
"->",
"isEmpty",
"(",
... | Return the path excluding the filename.
If the URL has a host but no path, we still return '/'.
@return string | [
"Return",
"the",
"path",
"excluding",
"the",
"filename",
"."
] | 9dec80635017415d83b7e6ef155e9324f4b27a00 | https://github.com/timostamm/url-builder/blob/9dec80635017415d83b7e6ef155e9324f4b27a00/src/UrlPath.php#L160-L166 | train |
3ev/wordpress-core | src/Tev/Field/Model/ImageField.php | ImageField.sizeUrl | public function sizeUrl($size)
{
if (($this->base['return_format'] === 'array') && isset($this->base['value']['sizes'][$size])) {
return $this->base['value']['sizes'][$size];
} elseif ($this->base['return_format'] === 'id') {
if ($src = wp_get_attachment_image_src($this->id()... | php | public function sizeUrl($size)
{
if (($this->base['return_format'] === 'array') && isset($this->base['value']['sizes'][$size])) {
return $this->base['value']['sizes'][$size];
} elseif ($this->base['return_format'] === 'id') {
if ($src = wp_get_attachment_image_src($this->id()... | [
"public",
"function",
"sizeUrl",
"(",
"$",
"size",
")",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"base",
"[",
"'return_format'",
"]",
"===",
"'array'",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"base",
"[",
"'value'",
"]",
"[",
"'sizes'",
"]",
"["... | Get an image URL of a specic size.
@param string $size Image size (e.g thumbnail, large or custom size)
@return string Image URL | [
"Get",
"an",
"image",
"URL",
"of",
"a",
"specic",
"size",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Field/Model/ImageField.php#L86-L97 | train |
SpoonX/SxBootstrap | src/SxBootstrap/View/Helper/Bootstrap/Tooltip.php | Tooltip.setOption | public function setOption($key, $value)
{
if (!in_array($key, $this->availableOptions)) {
throw new Exception\InvalidArgumentException('Invalid option for Tooltip');
}
if (is_bool($value)) {
$value = $value ? 'true' : 'false';
}
if (!is_string($value... | php | public function setOption($key, $value)
{
if (!in_array($key, $this->availableOptions)) {
throw new Exception\InvalidArgumentException('Invalid option for Tooltip');
}
if (is_bool($value)) {
$value = $value ? 'true' : 'false';
}
if (!is_string($value... | [
"public",
"function",
"setOption",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"availableOptions",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"InvalidArgumentException",
"(",
... | Set a single option to the Tooltip
@param string $key
@param string $value
@return \SxBootstrap\View\Helper\Bootstrap\Label
@throws Exception\InvalidArgumentException | [
"Set",
"a",
"single",
"option",
"to",
"the",
"Tooltip"
] | 768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6 | https://github.com/SpoonX/SxBootstrap/blob/768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6/src/SxBootstrap/View/Helper/Bootstrap/Tooltip.php#L145-L165 | train |
zara-4/php-sdk | Zara4/API/Communication/Util.php | Util.currentIpAddress | public static function currentIpAddress() {
//
// Just get the headers if we can or else use the SERVER global
//
if (function_exists('apache_request_headers')) {
$headers = apache_request_headers();
} else {
$headers = $_SERVER;
}
//
// Get the forwarded IP if it exists
... | php | public static function currentIpAddress() {
//
// Just get the headers if we can or else use the SERVER global
//
if (function_exists('apache_request_headers')) {
$headers = apache_request_headers();
} else {
$headers = $_SERVER;
}
//
// Get the forwarded IP if it exists
... | [
"public",
"static",
"function",
"currentIpAddress",
"(",
")",
"{",
"//",
"// Just get the headers if we can or else use the SERVER global",
"//",
"if",
"(",
"function_exists",
"(",
"'apache_request_headers'",
")",
")",
"{",
"$",
"headers",
"=",
"apache_request_headers",
"... | Get the ip address from the current request.
@return String | [
"Get",
"the",
"ip",
"address",
"from",
"the",
"current",
"request",
"."
] | 33a1bc9676d9d870a0e274ca44068b207e5dae78 | https://github.com/zara-4/php-sdk/blob/33a1bc9676d9d870a0e274ca44068b207e5dae78/Zara4/API/Communication/Util.php#L266-L299 | train |
schpill/thin | src/Navigation/Page.php | Page.setLabel | public function setLabel($label)
{
if (null !== $label && !is_string($label)) {
throw new Exception(
'Invalid argument: $label must be a string or null');
}
$this->_label = $label;
return $this;
} | php | public function setLabel($label)
{
if (null !== $label && !is_string($label)) {
throw new Exception(
'Invalid argument: $label must be a string or null');
}
$this->_label = $label;
return $this;
} | [
"public",
"function",
"setLabel",
"(",
"$",
"label",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"label",
"&&",
"!",
"is_string",
"(",
"$",
"label",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Invalid argument: $label must be a string or null'",
")",
";"... | Sets page label
@param string $label new page label
@return Page fluent interface, returns self
@throws Exception if empty/no string is given | [
"Sets",
"page",
"label"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L262-L271 | train |
schpill/thin | src/Navigation/Page.php | Page.setFragment | public function setFragment($fragment)
{
if (null !== $fragment && !is_string($fragment)) {
throw new Exception(
'Invalid argument: $fragment must be a string or null');
}
$this->_fragment = $fragment;
return $this;
... | php | public function setFragment($fragment)
{
if (null !== $fragment && !is_string($fragment)) {
throw new Exception(
'Invalid argument: $fragment must be a string or null');
}
$this->_fragment = $fragment;
return $this;
... | [
"public",
"function",
"setFragment",
"(",
"$",
"fragment",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"fragment",
"&&",
"!",
"is_string",
"(",
"$",
"fragment",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Invalid argument: $fragment must be a string or null'... | Sets a fragment identifier
@param string $fragment new fragment identifier
@return Page fluent interface, returns self
@throws Exception if empty/no string is given | [
"Sets",
"a",
"fragment",
"identifier"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L290-L299 | train |
schpill/thin | src/Navigation/Page.php | Page.setId | public function setId($id = null)
{
if (null !== $id && !is_string($id) && !is_numeric($id)) {
throw new Exception(
'Invalid argument: $id must be a string, number or null');
}
$this->_id = null === $id ? $id : (string) $id;
... | php | public function setId($id = null)
{
if (null !== $id && !is_string($id) && !is_numeric($id)) {
throw new Exception(
'Invalid argument: $id must be a string, number or null');
}
$this->_id = null === $id ? $id : (string) $id;
... | [
"public",
"function",
"setId",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"id",
"&&",
"!",
"is_string",
"(",
"$",
"id",
")",
"&&",
"!",
"is_numeric",
"(",
"$",
"id",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'... | Sets page id
@param string|null $id [optional] id to set. Default is null,
which sets no id.
@return Page fluent interface, returns self
@throws Exception if not given string or null | [
"Sets",
"page",
"id"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L319-L329 | train |
schpill/thin | src/Navigation/Page.php | Page.setTitle | public function setTitle($title = null)
{
if (null !== $title && !is_string($title)) {
throw new Exception(
'Invalid argument: $title must be a non-empty string');
}
$this->_title = $title;
return $this;
} | php | public function setTitle($title = null)
{
if (null !== $title && !is_string($title)) {
throw new Exception(
'Invalid argument: $title must be a non-empty string');
}
$this->_title = $title;
return $this;
} | [
"public",
"function",
"setTitle",
"(",
"$",
"title",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"title",
"&&",
"!",
"is_string",
"(",
"$",
"title",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Invalid argument: $title must be a non-empty str... | Sets page title
@param string $title [optional] page title. Default is
null, which sets no title.
@return Page fluent interface, returns self
@throws Exception if not given string or null | [
"Sets",
"page",
"title"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L379-L389 | train |
schpill/thin | src/Navigation/Page.php | Page.setTarget | public function setTarget($target = null)
{
if (null !== $target && !is_string($target)) {
throw new Exception(
'Invalid argument: $target must be a string or null');
}
$this->_target = $target;
return $this;
} | php | public function setTarget($target = null)
{
if (null !== $target && !is_string($target)) {
throw new Exception(
'Invalid argument: $target must be a string or null');
}
$this->_target = $target;
return $this;
} | [
"public",
"function",
"setTarget",
"(",
"$",
"target",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"target",
"&&",
"!",
"is_string",
"(",
"$",
"target",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Invalid argument: $target must be a string o... | Sets page target
@param string|null $target [optional] target to set. Default is
null, which sets no target.
@return Page fluent interface, returns self
@throws Exception if target is not string or null | [
"Sets",
"page",
"target"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L409-L419 | train |
schpill/thin | src/Navigation/Page.php | Page.setAccesskey | public function setAccesskey($character = null)
{
if (null !== $character
&& (!is_string($character) || 1 != strlen($character)))
{
throw new Exception(
'Invalid argument: $character must be a single character or null'
)... | php | public function setAccesskey($character = null)
{
if (null !== $character
&& (!is_string($character) || 1 != strlen($character)))
{
throw new Exception(
'Invalid argument: $character must be a single character or null'
)... | [
"public",
"function",
"setAccesskey",
"(",
"$",
"character",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"character",
"&&",
"(",
"!",
"is_string",
"(",
"$",
"character",
")",
"||",
"1",
"!=",
"strlen",
"(",
"$",
"character",
")",
")",
")",
... | Sets access key for this page
@param string|null $character [optional] access key to set. Default
is null, which sets no access key.
@return Page fluent interface, returns self
@throws Exception if access key is not string or null or
if the string length not equal to one | [
"Sets",
"access",
"key",
"for",
"this",
"page"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L440-L453 | train |
schpill/thin | src/Navigation/Page.php | Page.setRel | public function setRel($relations = null)
{
$this->_rel = array();
if (null !== $relations) {
if (!is_array($relations)) {
throw new Exception(
'Invalid argument: $relations must be an array');
}
... | php | public function setRel($relations = null)
{
$this->_rel = array();
if (null !== $relations) {
if (!is_array($relations)) {
throw new Exception(
'Invalid argument: $relations must be an array');
}
... | [
"public",
"function",
"setRel",
"(",
"$",
"relations",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_rel",
"=",
"array",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"relations",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"relations",
")",
")... | Sets the page's forward links to other pages
This method expects an associative array of forward links to other pages,
where each element's key is the name of the relation (e.g. alternate,
prev, next, help, etc), and the value is a mixed value that could somehow
be considered a page.
@param array $relations [option... | [
"Sets",
"the",
"page",
"s",
"forward",
"links",
"to",
"other",
"pages"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L477-L496 | train |
schpill/thin | src/Navigation/Page.php | Page.getRel | public function getRel($relation = null)
{
if (null !== $relation) {
return isset($this->_rel[$relation]) ?
$this->_rel[$relation] :
null;
}
return $this->_rel;
} | php | public function getRel($relation = null)
{
if (null !== $relation) {
return isset($this->_rel[$relation]) ?
$this->_rel[$relation] :
null;
}
return $this->_rel;
} | [
"public",
"function",
"getRel",
"(",
"$",
"relation",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"relation",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_rel",
"[",
"$",
"relation",
"]",
")",
"?",
"$",
"this",
"->",
"_rel",
"... | Returns the page's forward links to other pages
This method returns an associative array of forward links to other pages,
where each element's key is the name of the relation (e.g. alternate,
prev, next, help, etc), and the value is a mixed value that could somehow
be considered a page.
@param string $relation [opt... | [
"Returns",
"the",
"page",
"s",
"forward",
"links",
"to",
"other",
"pages"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L512-L521 | train |
schpill/thin | src/Navigation/Page.php | Page.setRev | public function setRev($relations = null)
{
$this->_rev = array();
if (null !== $relations) {
if (!is_array($relations)) {
throw new Exception(
'Invalid argument: $relations must be an array');
}
... | php | public function setRev($relations = null)
{
$this->_rev = array();
if (null !== $relations) {
if (!is_array($relations)) {
throw new Exception(
'Invalid argument: $relations must be an array');
}
... | [
"public",
"function",
"setRev",
"(",
"$",
"relations",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_rev",
"=",
"array",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"relations",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"relations",
")",
")... | Sets the page's reverse links to other pages
This method expects an associative array of reverse links to other pages,
where each element's key is the name of the relation (e.g. alternate,
prev, next, help, etc), and the value is a mixed value that could somehow
be considered a page.
@param array $relations [option... | [
"Sets",
"the",
"page",
"s",
"reverse",
"links",
"to",
"other",
"pages"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L535-L553 | train |
schpill/thin | src/Navigation/Page.php | Page.getRev | public function getRev($relation = null)
{
if (null !== $relation) {
return isset($this->_rev[$relation]) ?
$this->_rev[$relation] :
null;
}
return $this->_rev;
} | php | public function getRev($relation = null)
{
if (null !== $relation) {
return isset($this->_rev[$relation]) ?
$this->_rev[$relation] :
null;
}
return $this->_rev;
} | [
"public",
"function",
"getRev",
"(",
"$",
"relation",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"relation",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_rev",
"[",
"$",
"relation",
"]",
")",
"?",
"$",
"this",
"->",
"_rev",
"... | Returns the page's reverse links to other pages
This method returns an associative array of forward links to other pages,
where each element's key is the name of the relation (e.g. alternate,
prev, next, help, etc), and the value is a mixed value that could somehow
be considered a page.
@param string $relation [opt... | [
"Returns",
"the",
"page",
"s",
"reverse",
"links",
"to",
"other",
"pages"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L569-L578 | train |
schpill/thin | src/Navigation/Page.php | Page.setCustomHtmlAttrib | public function setCustomHtmlAttrib($name, $value)
{
if (!is_string($name)) {
throw new Exception(
'Invalid argument: $name must be a string'
);
}
if (null !== $value && !is_string($value)) {
throw new Excep... | php | public function setCustomHtmlAttrib($name, $value)
{
if (!is_string($name)) {
throw new Exception(
'Invalid argument: $name must be a string'
);
}
if (null !== $value && !is_string($value)) {
throw new Excep... | [
"public",
"function",
"setCustomHtmlAttrib",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Invalid argument: $name must be a string'",
")",
";",
"}",
"if",
"... | Sets a single custom HTML attribute
@param string $name name of the HTML attribute
@param string|null $value value for the HTML attribute
@return Page fluent interface, returns self
@throws Exception if name is not string or value is
not null or a string | [
"Sets",
"a",
"single",
"custom",
"HTML",
"attribute"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L589-L610 | train |
schpill/thin | src/Navigation/Page.php | Page.getCustomHtmlAttrib | public function getCustomHtmlAttrib($name)
{
if (!is_string($name)) {
throw new Exception(
'Invalid argument: $name must be a string'
);
}
if (isset($this->_customHtmlAttribs[$name])) {
return $this->_custom... | php | public function getCustomHtmlAttrib($name)
{
if (!is_string($name)) {
throw new Exception(
'Invalid argument: $name must be a string'
);
}
if (isset($this->_customHtmlAttribs[$name])) {
return $this->_custom... | [
"public",
"function",
"getCustomHtmlAttrib",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Invalid argument: $name must be a string'",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"... | Returns a single custom HTML attributes by name
@param string $name name of the HTML attribute
@return string|null value for the HTML attribute or null
@throws Exception if name is not string | [
"Returns",
"a",
"single",
"custom",
"HTML",
"attributes",
"by",
"name"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L619-L632 | train |
schpill/thin | src/Navigation/Page.php | Page.setCustomHtmlAttribs | public function setCustomHtmlAttribs(array $attribs)
{
foreach ($attribs as $key => $value) {
$this->setCustomHtmlAttrib($key, $value);
}
return $this;
} | php | public function setCustomHtmlAttribs(array $attribs)
{
foreach ($attribs as $key => $value) {
$this->setCustomHtmlAttrib($key, $value);
}
return $this;
} | [
"public",
"function",
"setCustomHtmlAttribs",
"(",
"array",
"$",
"attribs",
")",
"{",
"foreach",
"(",
"$",
"attribs",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"setCustomHtmlAttrib",
"(",
"$",
"key",
",",
"$",
"value",
")",
";"... | Sets multiple custom HTML attributes at once
@param array $attribs an associative array of html attributes
@return Page fluent interface, returns self | [
"Sets",
"multiple",
"custom",
"HTML",
"attributes",
"at",
"once"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L640-L646 | train |
schpill/thin | src/Navigation/Page.php | Page.removeCustomHtmlAttrib | public function removeCustomHtmlAttrib($name)
{
if (!is_string($name)) {
throw new Exception(
'Invalid argument: $name must be a string'
);
}
if (isset($this->_customHtmlAttribs[$name])) {
unset($this->_cust... | php | public function removeCustomHtmlAttrib($name)
{
if (!is_string($name)) {
throw new Exception(
'Invalid argument: $name must be a string'
);
}
if (isset($this->_customHtmlAttribs[$name])) {
unset($this->_cust... | [
"public",
"function",
"removeCustomHtmlAttrib",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Invalid argument: $name must be a string'",
")",
";",
"}",
"if",
"(",
"isset",
"(",
... | Removes a custom HTML attribute from the page
@param string $name name of the custom HTML attribute
@return Page fluent interface, returns self | [
"Removes",
"a",
"custom",
"HTML",
"attribute",
"from",
"the",
"page"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L664-L675 | train |
schpill/thin | src/Navigation/Page.php | Page.setOrder | public function setOrder($order = null)
{
if (is_string($order)) {
$temp = (int) $order;
if ($temp < 0 || $temp > 0 || $order == '0') {
$order = $temp;
}
}
if (null !== $order && !is_int($order)) {
... | php | public function setOrder($order = null)
{
if (is_string($order)) {
$temp = (int) $order;
if ($temp < 0 || $temp > 0 || $order == '0') {
$order = $temp;
}
}
if (null !== $order && !is_int($order)) {
... | [
"public",
"function",
"setOrder",
"(",
"$",
"order",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"order",
")",
")",
"{",
"$",
"temp",
"=",
"(",
"int",
")",
"$",
"order",
";",
"if",
"(",
"$",
"temp",
"<",
"0",
"||",
"$",
"temp",
"... | Sets page order to use in parent container
@param int $order [optional] page order in container.
Default is null, which sets no
specific order.
@return Page fluent interface, returns self
@throws Exception if order is not integer or null | [
"Sets",
"page",
"order",
"to",
"use",
"in",
"parent",
"container"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L698-L721 | train |
schpill/thin | src/Navigation/Page.php | Page.setResource | public function setResource($resource = null)
{
if (null === $resource || is_string($resource) ||
$resource instanceof Acl) {
$this->_resource = $resource;
} else {
require_once 'Zend/Navigation/Exception.php';
throw new Exc... | php | public function setResource($resource = null)
{
if (null === $resource || is_string($resource) ||
$resource instanceof Acl) {
$this->_resource = $resource;
} else {
require_once 'Zend/Navigation/Exception.php';
throw new Exc... | [
"public",
"function",
"setResource",
"(",
"$",
"resource",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"resource",
"||",
"is_string",
"(",
"$",
"resource",
")",
"||",
"$",
"resource",
"instanceof",
"Acl",
")",
"{",
"$",
"this",
"->",
"_resour... | Sets ACL resource assoicated with this page
@param string|Acl $resource [optional] resource
to associate with
page. Default is
null, which sets no
resource.
@throws Exception if $resource if
invalid
@return Page fluent interface,
returns self | [
"Sets",
"ACL",
"resource",
"assoicated",
"with",
"this",
"page"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L746-L759 | train |
schpill/thin | src/Navigation/Page.php | Page.setPrivilege | public function setPrivilege($privilege = null)
{
$this->_privilege = is_string($privilege) ? $privilege : null;
return $this;
} | php | public function setPrivilege($privilege = null)
{
$this->_privilege = is_string($privilege) ? $privilege : null;
return $this;
} | [
"public",
"function",
"setPrivilege",
"(",
"$",
"privilege",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_privilege",
"=",
"is_string",
"(",
"$",
"privilege",
")",
"?",
"$",
"privilege",
":",
"null",
";",
"return",
"$",
"this",
";",
"}"
] | Sets ACL privilege associated with this page
@param string|null $privilege [optional] ACL privilege to associate
with this page. Default is null, which
sets no privilege.
@return Page fluent interface, returns self | [
"Sets",
"ACL",
"privilege",
"associated",
"with",
"this",
"page"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L779-L783 | train |
schpill/thin | src/Navigation/Page.php | Page.setVisible | public function setVisible($visible = true)
{
if (is_string($visible) && 'false' == strtolower($visible)) {
$visible = false;
}
$this->_visible = (bool) $visible;
return $this;
} | php | public function setVisible($visible = true)
{
if (is_string($visible) && 'false' == strtolower($visible)) {
$visible = false;
}
$this->_visible = (bool) $visible;
return $this;
} | [
"public",
"function",
"setVisible",
"(",
"$",
"visible",
"=",
"true",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"visible",
")",
"&&",
"'false'",
"==",
"strtolower",
"(",
"$",
"visible",
")",
")",
"{",
"$",
"visible",
"=",
"false",
";",
"}",
"$",
... | Sets whether the page should be visible or not
@param bool $visible [optional] whether page should be
considered visible or not. Default is true.
@return Page fluent interface, returns self | [
"Sets",
"whether",
"the",
"page",
"should",
"be",
"visible",
"or",
"not"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L851-L858 | train |
schpill/thin | src/Navigation/Page.php | Page.isVisible | public function isVisible($recursive = false)
{
if ($recursive && isset($this->_parent) &&
$this->_parent instanceof Page) {
if (!$this->_parent->isVisible(true)) {
return false;
}
}
return $this->_visible;
... | php | public function isVisible($recursive = false)
{
if ($recursive && isset($this->_parent) &&
$this->_parent instanceof Page) {
if (!$this->_parent->isVisible(true)) {
return false;
}
}
return $this->_visible;
... | [
"public",
"function",
"isVisible",
"(",
"$",
"recursive",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"recursive",
"&&",
"isset",
"(",
"$",
"this",
"->",
"_parent",
")",
"&&",
"$",
"this",
"->",
"_parent",
"instanceof",
"Page",
")",
"{",
"if",
"(",
"!",
... | Returns a boolean value indicating whether the page is visible
@param bool $recursive [optional] whether page should be considered
invisible if parent is invisible. Default is
false.
@return bool whether page should be considered visible | [
"Returns",
"a",
"boolean",
"value",
"indicating",
"whether",
"the",
"page",
"is",
"visible"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L868-L878 | train |
schpill/thin | src/Navigation/Page.php | Page.setParent | public function setParent(Container $parent = null)
{
if ($parent === $this) {
throw new Exception(
'A page cannot have itself as a parent');
}
// return if the given parent already is parent
if ($parent === $this->_parent) {
... | php | public function setParent(Container $parent = null)
{
if ($parent === $this) {
throw new Exception(
'A page cannot have itself as a parent');
}
// return if the given parent already is parent
if ($parent === $this->_parent) {
... | [
"public",
"function",
"setParent",
"(",
"Container",
"$",
"parent",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"parent",
"===",
"$",
"this",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'A page cannot have itself as a parent'",
")",
";",
"}",
"// return if the giv... | Sets parent container
@param Container $parent [optional] new parent to set.
Default is null which will set
no parent.
@return Page fluent interface, returns self | [
"Sets",
"parent",
"container"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L903-L929 | train |
schpill/thin | src/Navigation/Page.php | Page.set | public function set($property, $value)
{
if (!is_string($property) || empty($property)) {
throw new Exception(
'Invalid argument: $property must be a non-empty string');
}
$method = 'set' . self::_normalizePropertyName($property);
... | php | public function set($property, $value)
{
if (!is_string($property) || empty($property)) {
throw new Exception(
'Invalid argument: $property must be a non-empty string');
}
$method = 'set' . self::_normalizePropertyName($property);
... | [
"public",
"function",
"set",
"(",
"$",
"property",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"property",
")",
"||",
"empty",
"(",
"$",
"property",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Invalid argument: $property mu... | Sets the given property
If the given property is native (id, class, title, etc), the matching
set method will be used. Otherwise, it will be set as a custom property.
@param string $property property name
@param mixed $value value to set
@return Page fluent interface, returns self
@thr... | [
"Sets",
"the",
"given",
"property"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L952-L969 | train |
schpill/thin | src/Navigation/Page.php | Page.get | public function get($property)
{
if (!is_string($property) || empty($property)) {
throw new Exception(
'Invalid argument: $property must be a non-empty string');
}
$method = 'get' . self::_normalizePropertyName($property);
... | php | public function get($property)
{
if (!is_string($property) || empty($property)) {
throw new Exception(
'Invalid argument: $property must be a non-empty string');
}
$method = 'get' . self::_normalizePropertyName($property);
... | [
"public",
"function",
"get",
"(",
"$",
"property",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"property",
")",
"||",
"empty",
"(",
"$",
"property",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Invalid argument: $property must be a non-empty string'... | Returns the value of the given property
If the given property is native (id, class, title, etc), the matching
get method will be used. Otherwise, it will return the matching custom
property, or null if not found.
@param string $property property name
@return mixed the property's value ... | [
"Returns",
"the",
"value",
"of",
"the",
"given",
"property"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L982-L998 | train |
schpill/thin | src/Navigation/Page.php | Page.__isset | public function __isset($name)
{
$method = 'get' . self::_normalizePropertyName($name);
if (method_exists($this, $method)) {
return true;
}
return isset($this->_properties[$name]);
} | php | public function __isset($name)
{
$method = 'get' . self::_normalizePropertyName($name);
if (method_exists($this, $method)) {
return true;
}
return isset($this->_properties[$name]);
} | [
"public",
"function",
"__isset",
"(",
"$",
"name",
")",
"{",
"$",
"method",
"=",
"'get'",
".",
"self",
"::",
"_normalizePropertyName",
"(",
"$",
"name",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"$",
"method",
")",
")",
"{",
"retur... | Checks if a property is set
Magic overload for enabling <code>isset($page->propname)</code>.
Returns true if the property is native (id, class, title, etc), and
true or false if it's a custom property (depending on whether the
property actually is set).
@param string $name property name
@return bool wheth... | [
"Checks",
"if",
"a",
"property",
"is",
"set"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L1043-L1051 | train |
schpill/thin | src/Navigation/Page.php | Page.addRel | public function addRel($relation, $value)
{
if (is_string($relation)) {
$this->_rel[$relation] = $value;
}
return $this;
} | php | public function addRel($relation, $value)
{
if (is_string($relation)) {
$this->_rel[$relation] = $value;
}
return $this;
} | [
"public",
"function",
"addRel",
"(",
"$",
"relation",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"relation",
")",
")",
"{",
"$",
"this",
"->",
"_rel",
"[",
"$",
"relation",
"]",
"=",
"$",
"value",
";",
"}",
"return",
"$",
"thi... | Adds a forward relation to the page
@param string $relation relation name (e.g. alternate, glossary,
canonical, etc)
@param mixed $value value to set for relation
@return Page fluent interface, returns self | [
"Adds",
"a",
"forward",
"relation",
"to",
"the",
"page"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L1098-L1105 | train |
schpill/thin | src/Navigation/Page.php | Page.addRev | public function addRev($relation, $value)
{
if (is_string($relation)) {
$this->_rev[$relation] = $value;
}
return $this;
} | php | public function addRev($relation, $value)
{
if (is_string($relation)) {
$this->_rev[$relation] = $value;
}
return $this;
} | [
"public",
"function",
"addRev",
"(",
"$",
"relation",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"relation",
")",
")",
"{",
"$",
"this",
"->",
"_rev",
"[",
"$",
"relation",
"]",
"=",
"$",
"value",
";",
"}",
"return",
"$",
"thi... | Adds a reverse relation to the page
@param string $relation relation name (e.g. alternate, glossary,
canonical, etc)
@param mixed $value value to set for relation
@return Page fluent interface, returns self | [
"Adds",
"a",
"reverse",
"relation",
"to",
"the",
"page"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L1115-L1122 | train |
schpill/thin | src/Navigation/Page.php | Page.removeRel | public function removeRel($relation)
{
if (isset($this->_rel[$relation])) {
unset($this->_rel[$relation]);
}
return $this;
} | php | public function removeRel($relation)
{
if (isset($this->_rel[$relation])) {
unset($this->_rel[$relation]);
}
return $this;
} | [
"public",
"function",
"removeRel",
"(",
"$",
"relation",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_rel",
"[",
"$",
"relation",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"_rel",
"[",
"$",
"relation",
"]",
")",
";",
"}",
... | Removes a forward relation from the page
@param string $relation name of relation to remove
@return Page fluent interface, returns self | [
"Removes",
"a",
"forward",
"relation",
"from",
"the",
"page"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L1130-L1137 | train |
schpill/thin | src/Navigation/Page.php | Page.removeRev | public function removeRev($relation)
{
if (isset($this->_rev[$relation])) {
unset($this->_rev[$relation]);
}
return $this;
} | php | public function removeRev($relation)
{
if (isset($this->_rev[$relation])) {
unset($this->_rev[$relation]);
}
return $this;
} | [
"public",
"function",
"removeRev",
"(",
"$",
"relation",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_rev",
"[",
"$",
"relation",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"_rev",
"[",
"$",
"relation",
"]",
")",
";",
"}",
... | Removes a reverse relation from the page
@param string $relation name of relation to remove
@return Page fluent interface, returns self | [
"Removes",
"a",
"reverse",
"relation",
"from",
"the",
"page"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page.php#L1145-L1152 | train |
SpoonX/SxBootstrap | src/SxBootstrap/View/Helper/Bootstrap/AbstractElementHelper.php | AbstractElementHelper.addAttribute | public function addAttribute($key, $value = null)
{
$this->element->addAttribute($key, $value);
return $this;
} | php | public function addAttribute($key, $value = null)
{
$this->element->addAttribute($key, $value);
return $this;
} | [
"public",
"function",
"addAttribute",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"element",
"->",
"addAttribute",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Add attribute on element
@param string $key
@param string $value
@return $this | [
"Add",
"attribute",
"on",
"element"
] | 768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6 | https://github.com/SpoonX/SxBootstrap/blob/768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6/src/SxBootstrap/View/Helper/Bootstrap/AbstractElementHelper.php#L59-L64 | train |
inhere/php-library-plus | libs/Task/Worker/Manager.php | Manager.showHelp | protected function showHelp($msg = '', $code = 0)
{
$usage = Cli::color('USAGE:', 'brown');
$commands = Cli::color('COMMANDS:', 'brown');
$sOptions = Cli::color('SPECIAL OPTIONS:', 'brown');
$pOptions = Cli::color('PUBLIC OPTIONS:', 'brown');
$version = Cli::color(self::VERSI... | php | protected function showHelp($msg = '', $code = 0)
{
$usage = Cli::color('USAGE:', 'brown');
$commands = Cli::color('COMMANDS:', 'brown');
$sOptions = Cli::color('SPECIAL OPTIONS:', 'brown');
$pOptions = Cli::color('PUBLIC OPTIONS:', 'brown');
$version = Cli::color(self::VERSI... | [
"protected",
"function",
"showHelp",
"(",
"$",
"msg",
"=",
"''",
",",
"$",
"code",
"=",
"0",
")",
"{",
"$",
"usage",
"=",
"Cli",
"::",
"color",
"(",
"'USAGE:'",
",",
"'brown'",
")",
";",
"$",
"commands",
"=",
"Cli",
"::",
"color",
"(",
"'COMMANDS:'... | Shows the scripts help info with optional error message
@param string $msg
@param int $code The exit code | [
"Shows",
"the",
"scripts",
"help",
"info",
"with",
"optional",
"error",
"message"
] | 8604e037937d31fa2338d79aaf9d0910cb48f559 | https://github.com/inhere/php-library-plus/blob/8604e037937d31fa2338d79aaf9d0910cb48f559/libs/Task/Worker/Manager.php#L249-L308 | train |
groundctrl/discourse-sso-php | src/QueryString.php | QueryString.isValid | public function isValid($key)
{
if (! isset ($this['sso'], $this['sig'])) {
return false;
}
return $this['sig'] === Secret::create($key)->sign($this['sso']);
} | php | public function isValid($key)
{
if (! isset ($this['sso'], $this['sig'])) {
return false;
}
return $this['sig'] === Secret::create($key)->sign($this['sso']);
} | [
"public",
"function",
"isValid",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"[",
"'sso'",
"]",
",",
"$",
"this",
"[",
"'sig'",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"[",
"'sig'",
"]",... | Checks the validity of this QueryString's against a secret key.
@param string|Secret $key
@return bool | [
"Checks",
"the",
"validity",
"of",
"this",
"QueryString",
"s",
"against",
"a",
"secret",
"key",
"."
] | 8ef1d0ced2e0502b673b25c46aab09cce2efc765 | https://github.com/groundctrl/discourse-sso-php/blob/8ef1d0ced2e0502b673b25c46aab09cce2efc765/src/QueryString.php#L11-L18 | train |
groundctrl/discourse-sso-php | src/QueryString.php | QueryString.fromString | public static function fromString($query, array $data = [])
{
$url = parse_url($query);
$query = isset($url['query']) ? $url['query'] : $url['path'];
parse_str($query, $data);
return new QueryString($data);
} | php | public static function fromString($query, array $data = [])
{
$url = parse_url($query);
$query = isset($url['query']) ? $url['query'] : $url['path'];
parse_str($query, $data);
return new QueryString($data);
} | [
"public",
"static",
"function",
"fromString",
"(",
"$",
"query",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"url",
"=",
"parse_url",
"(",
"$",
"query",
")",
";",
"$",
"query",
"=",
"isset",
"(",
"$",
"url",
"[",
"'query'",
"]",
")",... | Creates a QueryString from a string.
@param string $query A url or query string part.
@param array $data An optional data array.
@return QueryString | [
"Creates",
"a",
"QueryString",
"from",
"a",
"string",
"."
] | 8ef1d0ced2e0502b673b25c46aab09cce2efc765 | https://github.com/groundctrl/discourse-sso-php/blob/8ef1d0ced2e0502b673b25c46aab09cce2efc765/src/QueryString.php#L38-L45 | train |
groundctrl/discourse-sso-php | src/QueryString.php | QueryString.normalize | static public function normalize(array $params)
{
$qs = http_build_query($params, null, '&');
if ('' == $qs) {
return '';
}
$parts = array();
$order = array();
foreach (explode('&', $qs) as $param) {
if ('' === $param || '=' === $param[0]) {... | php | static public function normalize(array $params)
{
$qs = http_build_query($params, null, '&');
if ('' == $qs) {
return '';
}
$parts = array();
$order = array();
foreach (explode('&', $qs) as $param) {
if ('' === $param || '=' === $param[0]) {... | [
"static",
"public",
"function",
"normalize",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"qs",
"=",
"http_build_query",
"(",
"$",
"params",
",",
"null",
",",
"'&'",
")",
";",
"if",
"(",
"''",
"==",
"$",
"qs",
")",
"{",
"return",
"''",
";",
"}",
"... | Builds a normalized query string from the given parameters.
This normalization logic comes direct from Symfony's HttpFoundation Component.
Since this is the extent of the dependency, let's opt for a bit of code duplication instead.
@param array $params
@return string | [
"Builds",
"a",
"normalized",
"query",
"string",
"from",
"the",
"given",
"parameters",
"."
] | 8ef1d0ced2e0502b673b25c46aab09cce2efc765 | https://github.com/groundctrl/discourse-sso-php/blob/8ef1d0ced2e0502b673b25c46aab09cce2efc765/src/QueryString.php#L56-L89 | train |
phOnion/framework | src/Dependency/CacheAwareContainer.php | CacheAwareContainer.resolveContainer | private function resolveContainer(): ContainerInterface
{
if ($this->container === null) {
$container = $this->containerFactory->build($this);
if (!$container instanceof ContainerInterface) {
throw new \RuntimeException(
"Invalid factory result, e... | php | private function resolveContainer(): ContainerInterface
{
if ($this->container === null) {
$container = $this->containerFactory->build($this);
if (!$container instanceof ContainerInterface) {
throw new \RuntimeException(
"Invalid factory result, e... | [
"private",
"function",
"resolveContainer",
"(",
")",
":",
"ContainerInterface",
"{",
"if",
"(",
"$",
"this",
"->",
"container",
"===",
"null",
")",
"{",
"$",
"container",
"=",
"$",
"this",
"->",
"containerFactory",
"->",
"build",
"(",
"$",
"this",
")",
"... | Instantiate the container if not and return it
@return ContainerInterface | [
"Instantiate",
"the",
"container",
"if",
"not",
"and",
"return",
"it"
] | eb2d99cc65d3b39faecbfd49b602fb2c62349d05 | https://github.com/phOnion/framework/blob/eb2d99cc65d3b39faecbfd49b602fb2c62349d05/src/Dependency/CacheAwareContainer.php#L76-L91 | train |
Synapse-Cmf/synapse-cmf | src/Synapse/Admin/Bundle/Controller/TemplateAdminController.php | TemplateAdminController.listAction | public function listAction(Request $request)
{
$theme = $request->attributes->get(
'synapse_theme',
$this->container->get('synapse')
->enableDefaultTheme()
->getCurrentTheme()
);
$templateCollection = $this->container->get('synapse.tem... | php | public function listAction(Request $request)
{
$theme = $request->attributes->get(
'synapse_theme',
$this->container->get('synapse')
->enableDefaultTheme()
->getCurrentTheme()
);
$templateCollection = $this->container->get('synapse.tem... | [
"public",
"function",
"listAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"theme",
"=",
"$",
"request",
"->",
"attributes",
"->",
"get",
"(",
"'synapse_theme'",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'synapse'",
")",
"->",
"enab... | Templates listing action.
@param Request $request
@return Response | [
"Templates",
"listing",
"action",
"."
] | d8122a4150a83d5607289724425cf35c56a5e880 | https://github.com/Synapse-Cmf/synapse-cmf/blob/d8122a4150a83d5607289724425cf35c56a5e880/src/Synapse/Admin/Bundle/Controller/TemplateAdminController.php#L25-L51 | train |
Synapse-Cmf/synapse-cmf | src/Synapse/Admin/Bundle/Controller/TemplateAdminController.php | TemplateAdminController.initAction | public function initAction(Request $request, $templateType, $contentType, $contentId = null)
{
$templateDomain = $this->container->get('synapse.template.domain');
$template = empty($contentId)
? $templateDomain->createGlobal(
$contentType,
$templateType
... | php | public function initAction(Request $request, $templateType, $contentType, $contentId = null)
{
$templateDomain = $this->container->get('synapse.template.domain');
$template = empty($contentId)
? $templateDomain->createGlobal(
$contentType,
$templateType
... | [
"public",
"function",
"initAction",
"(",
"Request",
"$",
"request",
",",
"$",
"templateType",
",",
"$",
"contentType",
",",
"$",
"contentId",
"=",
"null",
")",
"{",
"$",
"templateDomain",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'synapse.tem... | Template init action.
@param Request $request
@param string $templateType
@param string $contentType
@param int $contentId
@return Response | [
"Template",
"init",
"action",
"."
] | d8122a4150a83d5607289724425cf35c56a5e880 | https://github.com/Synapse-Cmf/synapse-cmf/blob/d8122a4150a83d5607289724425cf35c56a5e880/src/Synapse/Admin/Bundle/Controller/TemplateAdminController.php#L63-L84 | train |
Synapse-Cmf/synapse-cmf | src/Synapse/Admin/Bundle/Controller/TemplateAdminController.php | TemplateAdminController.editAction | public function editAction($id, Request $request)
{
$template = $this->container->get('synapse.template.orm_loader')
->retrieveOne(array(
'id' => $id,
'scope' => TemplateInterface::GLOBAL_SCOPE
))
;
if (!$template) {
throw n... | php | public function editAction($id, Request $request)
{
$template = $this->container->get('synapse.template.orm_loader')
->retrieveOne(array(
'id' => $id,
'scope' => TemplateInterface::GLOBAL_SCOPE
))
;
if (!$template) {
throw n... | [
"public",
"function",
"editAction",
"(",
"$",
"id",
",",
"Request",
"$",
"request",
")",
"{",
"$",
"template",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'synapse.template.orm_loader'",
")",
"->",
"retrieveOne",
"(",
"array",
"(",
"'id'",
"=>"... | Global template edition action.
Requires an activated or activable theme.
@param Request $request
@return Response | [
"Global",
"template",
"edition",
"action",
".",
"Requires",
"an",
"activated",
"or",
"activable",
"theme",
"."
] | d8122a4150a83d5607289724425cf35c56a5e880 | https://github.com/Synapse-Cmf/synapse-cmf/blob/d8122a4150a83d5607289724425cf35c56a5e880/src/Synapse/Admin/Bundle/Controller/TemplateAdminController.php#L94-L143 | train |
Synapse-Cmf/synapse-cmf | src/Synapse/Admin/Bundle/Controller/TemplateAdminController.php | TemplateAdminController.addComponentAction | public function addComponentAction($id, $zoneTypeId, $componentTypeId, Request $request)
{
if (!$template = $this->container->get('synapse.template.loader')->retrieve($id)) {
throw new NotFoundHttpException(sprintf('No template found under id "%s"', $id));
}
if (!$zoneType = $tem... | php | public function addComponentAction($id, $zoneTypeId, $componentTypeId, Request $request)
{
if (!$template = $this->container->get('synapse.template.loader')->retrieve($id)) {
throw new NotFoundHttpException(sprintf('No template found under id "%s"', $id));
}
if (!$zoneType = $tem... | [
"public",
"function",
"addComponentAction",
"(",
"$",
"id",
",",
"$",
"zoneTypeId",
",",
"$",
"componentTypeId",
",",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"template",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'synapse.t... | Adds a component of given type id into given template id and zone type id.
@param int $id
@param string $zoneTypeId
@param string $componentTypeId
@param Request $request
@return Response | [
"Adds",
"a",
"component",
"of",
"given",
"type",
"id",
"into",
"given",
"template",
"id",
"and",
"zone",
"type",
"id",
"."
] | d8122a4150a83d5607289724425cf35c56a5e880 | https://github.com/Synapse-Cmf/synapse-cmf/blob/d8122a4150a83d5607289724425cf35c56a5e880/src/Synapse/Admin/Bundle/Controller/TemplateAdminController.php#L155-L186 | train |
hal-platform/hal-core | src/Repository/EnvironmentRepository.php | EnvironmentRepository.getBuildableEnvironmentsByApplication | public function getBuildableEnvironmentsByApplication(Application $application)
{
$region = sprintf(self::ENV_QUERY_REGION, $application->id());
$dql = sprintf(self::DQL_BY_APPLICATION, Target::class, Environment::class);
$query = $this->getEntityManager()
->createQuery($dql)
... | php | public function getBuildableEnvironmentsByApplication(Application $application)
{
$region = sprintf(self::ENV_QUERY_REGION, $application->id());
$dql = sprintf(self::DQL_BY_APPLICATION, Target::class, Environment::class);
$query = $this->getEntityManager()
->createQuery($dql)
... | [
"public",
"function",
"getBuildableEnvironmentsByApplication",
"(",
"Application",
"$",
"application",
")",
"{",
"$",
"region",
"=",
"sprintf",
"(",
"self",
"::",
"ENV_QUERY_REGION",
",",
"$",
"application",
"->",
"id",
"(",
")",
")",
";",
"$",
"dql",
"=",
"... | Get all buildable environments for an application.
@param Application $application
@return Environment[] | [
"Get",
"all",
"buildable",
"environments",
"for",
"an",
"application",
"."
] | 30d456f8392fc873301ad4217d2ae90436c67090 | https://github.com/hal-platform/hal-core/blob/30d456f8392fc873301ad4217d2ae90436c67090/src/Repository/EnvironmentRepository.php#L38-L55 | train |
hal-platform/hal-core | src/Repository/EnvironmentRepository.php | EnvironmentRepository.clearBuildableEnvironmentsByApplication | public function clearBuildableEnvironmentsByApplication(Application $application)
{
$region = sprintf(self::ENV_QUERY_REGION, $application->id());
$cache = $this
->getEntityManager()
->getCache();
$cache
->getQueryCache($region)
->clear();
... | php | public function clearBuildableEnvironmentsByApplication(Application $application)
{
$region = sprintf(self::ENV_QUERY_REGION, $application->id());
$cache = $this
->getEntityManager()
->getCache();
$cache
->getQueryCache($region)
->clear();
... | [
"public",
"function",
"clearBuildableEnvironmentsByApplication",
"(",
"Application",
"$",
"application",
")",
"{",
"$",
"region",
"=",
"sprintf",
"(",
"self",
"::",
"ENV_QUERY_REGION",
",",
"$",
"application",
"->",
"id",
"(",
")",
")",
";",
"$",
"cache",
"=",... | Clear cache for buildable environments for an application.
@param Application $application
@return void | [
"Clear",
"cache",
"for",
"buildable",
"environments",
"for",
"an",
"application",
"."
] | 30d456f8392fc873301ad4217d2ae90436c67090 | https://github.com/hal-platform/hal-core/blob/30d456f8392fc873301ad4217d2ae90436c67090/src/Repository/EnvironmentRepository.php#L64-L75 | train |
CodeCollab/Http | src/Response/Response.php | Response.addCookie | public function addCookie(string $key, $value, \DateTimeInterface $expire)
{
$this->cookies[$key] = $this->cookieFactory->build($key, $value, $expire);
} | php | public function addCookie(string $key, $value, \DateTimeInterface $expire)
{
$this->cookies[$key] = $this->cookieFactory->build($key, $value, $expire);
} | [
"public",
"function",
"addCookie",
"(",
"string",
"$",
"key",
",",
"$",
"value",
",",
"\\",
"DateTimeInterface",
"$",
"expire",
")",
"{",
"$",
"this",
"->",
"cookies",
"[",
"$",
"key",
"]",
"=",
"$",
"this",
"->",
"cookieFactory",
"->",
"build",
"(",
... | Adds a cookie
@param string $key The name of the cookie
@param mixed $value The value pf the cookie
@param \DateTimeInterface $expire The expiration date | [
"Adds",
"a",
"cookie"
] | b1f8306b20daebcf26ed4b13c032c5bc008a0861 | https://github.com/CodeCollab/Http/blob/b1f8306b20daebcf26ed4b13c032c5bc008a0861/src/Response/Response.php#L127-L130 | train |
CodeCollab/Http | src/Response/Response.php | Response.send | public function send()
{
$this->sendCookies();
$this->sendHeaders();
if ($this->request->server('REQUEST_METHOD') === 'HEAD') {
return '';
}
echo $this->body;
} | php | public function send()
{
$this->sendCookies();
$this->sendHeaders();
if ($this->request->server('REQUEST_METHOD') === 'HEAD') {
return '';
}
echo $this->body;
} | [
"public",
"function",
"send",
"(",
")",
"{",
"$",
"this",
"->",
"sendCookies",
"(",
")",
";",
"$",
"this",
"->",
"sendHeaders",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"request",
"->",
"server",
"(",
"'REQUEST_METHOD'",
")",
"===",
"'HEAD'",
")"... | Sends the response to the client | [
"Sends",
"the",
"response",
"to",
"the",
"client"
] | b1f8306b20daebcf26ed4b13c032c5bc008a0861 | https://github.com/CodeCollab/Http/blob/b1f8306b20daebcf26ed4b13c032c5bc008a0861/src/Response/Response.php#L135-L146 | train |
CodeCollab/Http | src/Response/Response.php | Response.sendHeaders | private function sendHeaders()
{
if (!array_key_exists('Content-Type', $this->headers)) {
$this->headers['Content-Type'] = 'text/html; charset=UTF-8';
}
$this->headers['Content-Length'] = strlen($this->body);
header(
sprintf(
'HTTP/%s %s %s',... | php | private function sendHeaders()
{
if (!array_key_exists('Content-Type', $this->headers)) {
$this->headers['Content-Type'] = 'text/html; charset=UTF-8';
}
$this->headers['Content-Length'] = strlen($this->body);
header(
sprintf(
'HTTP/%s %s %s',... | [
"private",
"function",
"sendHeaders",
"(",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'Content-Type'",
",",
"$",
"this",
"->",
"headers",
")",
")",
"{",
"$",
"this",
"->",
"headers",
"[",
"'Content-Type'",
"]",
"=",
"'text/html; charset=UTF-8'",
";"... | Sends the headers to the client | [
"Sends",
"the",
"headers",
"to",
"the",
"client"
] | b1f8306b20daebcf26ed4b13c032c5bc008a0861 | https://github.com/CodeCollab/Http/blob/b1f8306b20daebcf26ed4b13c032c5bc008a0861/src/Response/Response.php#L161-L183 | train |
3ev/wordpress-core | src/Tev/Post/Model/Attachment.php | Attachment.getImageUrl | public function getImageUrl($size = 'thumbnail')
{
$res = wp_get_attachment_image_src($this->getId(), $size);
return $res && isset($res[0]) ? $res[0] : null;
} | php | public function getImageUrl($size = 'thumbnail')
{
$res = wp_get_attachment_image_src($this->getId(), $size);
return $res && isset($res[0]) ? $res[0] : null;
} | [
"public",
"function",
"getImageUrl",
"(",
"$",
"size",
"=",
"'thumbnail'",
")",
"{",
"$",
"res",
"=",
"wp_get_attachment_image_src",
"(",
"$",
"this",
"->",
"getId",
"(",
")",
",",
"$",
"size",
")",
";",
"return",
"$",
"res",
"&&",
"isset",
"(",
"$",
... | Get attachment image URL.
@param mixed $size Arguments accepted by second param of wp_get_attachment_image_src()
@return string|null Image URL or null if not found | [
"Get",
"attachment",
"image",
"URL",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Post/Model/Attachment.php#L36-L40 | train |
chilimatic/chilimatic-framework | lib/handler/memory/shmop/Entry.php | Entry.save | public function save()
{
if ($this->id) {
$this->id = shmop_open($this->key, $this->mode, $this->permission, $this->size);
}
@shmop_write($this->id, serialize($this->data), $this->offset);
return true;
} | php | public function save()
{
if ($this->id) {
$this->id = shmop_open($this->key, $this->mode, $this->permission, $this->size);
}
@shmop_write($this->id, serialize($this->data), $this->offset);
return true;
} | [
"public",
"function",
"save",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"id",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"shmop_open",
"(",
"$",
"this",
"->",
"key",
",",
"$",
"this",
"->",
"mode",
",",
"$",
"this",
"->",
"permission",
",",
"$"... | saves the data of an entry
@return boolean | [
"saves",
"the",
"data",
"of",
"an",
"entry"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/handler/memory/shmop/Entry.php#L160-L170 | train |
chilimatic/chilimatic-framework | lib/handler/memory/shmop/Entry.php | Entry.delete | public function delete()
{
if (empty($this->id)) {
$this->id = shmop_open($this->key, $this->mode, $this->permission, $this->size);
}
@shmop_delete($this->id);
@shmop_close($this->id);
return true;
} | php | public function delete()
{
if (empty($this->id)) {
$this->id = shmop_open($this->key, $this->mode, $this->permission, $this->size);
}
@shmop_delete($this->id);
@shmop_close($this->id);
return true;
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"id",
")",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"shmop_open",
"(",
"$",
"this",
"->",
"key",
",",
"$",
"this",
"->",
"mode",
",",
"$",
"this",
"->",
... | deletes the entry
@return boolean | [
"deletes",
"the",
"entry"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/handler/memory/shmop/Entry.php#L209-L219 | train |
awurth/SlimValidationREST | Validator.php | Validator.validate | public function validate(Request $request, array $rules, array $messages = [])
{
foreach ($rules as $param => $options) {
$value = $request->getParam($param);
$this->data[$param] = $value;
$isRule = $options instanceof V;
try {
if ($isRule) {
... | php | public function validate(Request $request, array $rules, array $messages = [])
{
foreach ($rules as $param => $options) {
$value = $request->getParam($param);
$this->data[$param] = $value;
$isRule = $options instanceof V;
try {
if ($isRule) {
... | [
"public",
"function",
"validate",
"(",
"Request",
"$",
"request",
",",
"array",
"$",
"rules",
",",
"array",
"$",
"messages",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"rules",
"as",
"$",
"param",
"=>",
"$",
"options",
")",
"{",
"$",
"value",
"=... | Validate request params with the given rules
@param Request $request
@param array $rules
@param array $messages
@return $this | [
"Validate",
"request",
"params",
"with",
"the",
"given",
"rules"
] | e1e715b880acc43b963d2bad660a00f68499dfea | https://github.com/awurth/SlimValidationREST/blob/e1e715b880acc43b963d2bad660a00f68499dfea/Validator.php#L56-L112 | train |
awurth/SlimValidationREST | Validator.php | Validator.addErrors | public function addErrors($param, array $messages)
{
foreach ($messages as $message) {
$this->errors[$param][] = $message;
}
return $this;
} | php | public function addErrors($param, array $messages)
{
foreach ($messages as $message) {
$this->errors[$param][] = $message;
}
return $this;
} | [
"public",
"function",
"addErrors",
"(",
"$",
"param",
",",
"array",
"$",
"messages",
")",
"{",
"foreach",
"(",
"$",
"messages",
"as",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"errors",
"[",
"$",
"param",
"]",
"[",
"]",
"=",
"$",
"message",
";",... | Add errors for param
@param string $param
@param array $messages
@return $this | [
"Add",
"errors",
"for",
"param"
] | e1e715b880acc43b963d2bad660a00f68499dfea | https://github.com/awurth/SlimValidationREST/blob/e1e715b880acc43b963d2bad660a00f68499dfea/Validator.php#L134-L141 | train |
alphacomm/alpharpc | src/AlphaRPC/Client/Client.php | Client.setDelay | public function setDelay($delay)
{
if (is_string($delay) && ctype_digit($delay)) {
$delay = (int) $delay;
} elseif (!is_int($delay)) {
throw new \RuntimeException('Delay should be an integer in MS.');
}
$this->delay = $delay;
return $this;
} | php | public function setDelay($delay)
{
if (is_string($delay) && ctype_digit($delay)) {
$delay = (int) $delay;
} elseif (!is_int($delay)) {
throw new \RuntimeException('Delay should be an integer in MS.');
}
$this->delay = $delay;
return $this;
} | [
"public",
"function",
"setDelay",
"(",
"$",
"delay",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"delay",
")",
"&&",
"ctype_digit",
"(",
"$",
"delay",
")",
")",
"{",
"$",
"delay",
"=",
"(",
"int",
")",
"$",
"delay",
";",
"}",
"elseif",
"(",
"!",
... | Defines how long the client should wait for the AlphaRPC instances
to respond. If the time is reached the next AlphaRPC instance will be
asked to execute the request.
@param integer $delay
@return Client
@throws \RuntimeException | [
"Defines",
"how",
"long",
"the",
"client",
"should",
"wait",
"for",
"the",
"AlphaRPC",
"instances",
"to",
"respond",
".",
"If",
"the",
"time",
"is",
"reached",
"the",
"next",
"AlphaRPC",
"instance",
"will",
"be",
"asked",
"to",
"execute",
"the",
"request",
... | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/Client.php#L132-L143 | train |
alphacomm/alpharpc | src/AlphaRPC/Client/Client.php | Client.setTimeout | public function setTimeout($timeout)
{
if (is_string($timeout) && ctype_digit($timeout)) {
$timeout = (int) $timeout;
} elseif (!is_int($timeout)) {
throw new \RuntimeException('Unable to set timeout.');
}
$this->timeout = $timeout;
return $this;
... | php | public function setTimeout($timeout)
{
if (is_string($timeout) && ctype_digit($timeout)) {
$timeout = (int) $timeout;
} elseif (!is_int($timeout)) {
throw new \RuntimeException('Unable to set timeout.');
}
$this->timeout = $timeout;
return $this;
... | [
"public",
"function",
"setTimeout",
"(",
"$",
"timeout",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"timeout",
")",
"&&",
"ctype_digit",
"(",
"$",
"timeout",
")",
")",
"{",
"$",
"timeout",
"=",
"(",
"int",
")",
"$",
"timeout",
";",
"}",
"elseif",
... | Sets the timeout in MS.
@param int $timeout
@return Client
@throws \RuntimeException | [
"Sets",
"the",
"timeout",
"in",
"MS",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/Client.php#L197-L207 | train |
alphacomm/alpharpc | src/AlphaRPC/Client/Client.php | Client.addManager | public function addManager($manager)
{
if (is_array($manager)) {
foreach ($manager as $item) {
$this->managerList->add($item);
}
return $this;
}
$this->managerList->add($manager);
return $this;
} | php | public function addManager($manager)
{
if (is_array($manager)) {
foreach ($manager as $item) {
$this->managerList->add($item);
}
return $this;
}
$this->managerList->add($manager);
return $this;
} | [
"public",
"function",
"addManager",
"(",
"$",
"manager",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"manager",
")",
")",
"{",
"foreach",
"(",
"$",
"manager",
"as",
"$",
"item",
")",
"{",
"$",
"this",
"->",
"managerList",
"->",
"add",
"(",
"$",
"ite... | Adds an address to a AlphaRPC daemon.
@param string|array $manager
@return Client
@throws \InvalidArgumentException | [
"Adds",
"an",
"address",
"to",
"a",
"AlphaRPC",
"daemon",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/Client.php#L217-L230 | train |
alphacomm/alpharpc | src/AlphaRPC/Client/Client.php | Client.startRequest | public function startRequest($function, array $params = array(), $cache = null)
{
if ($cache !== null && !is_string($cache)) {
throw new \RuntimeException('$cache is an id for the request and should be a string or null.');
}
$request = new Request($function, $params);
$p... | php | public function startRequest($function, array $params = array(), $cache = null)
{
if ($cache !== null && !is_string($cache)) {
throw new \RuntimeException('$cache is an id for the request and should be a string or null.');
}
$request = new Request($function, $params);
$p... | [
"public",
"function",
"startRequest",
"(",
"$",
"function",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"cache",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"cache",
"!==",
"null",
"&&",
"!",
"is_string",
"(",
"$",
"cache",
")",
")",
... | Starts a request.
@param string $function
@param array $params
@param string $cache
@return Request
@throws \RuntimeException | [
"Starts",
"a",
"request",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/Client.php#L242-L270 | train |
alphacomm/alpharpc | src/AlphaRPC/Client/Client.php | Client.request | public function request($function, array $params = array(), $cache = null)
{
$request = $this->startRequest($function, $params, $cache);
return $this->fetchResponse($request);
} | php | public function request($function, array $params = array(), $cache = null)
{
$request = $this->startRequest($function, $params, $cache);
return $this->fetchResponse($request);
} | [
"public",
"function",
"request",
"(",
"$",
"function",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"cache",
"=",
"null",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"startRequest",
"(",
"$",
"function",
",",
"$",
"params",
... | Does a full request and returns the result.
@param string $function
@param array $params
@param string $cache
@return mixed | [
"Does",
"a",
"full",
"request",
"and",
"returns",
"the",
"result",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/Client.php#L281-L286 | train |
alphacomm/alpharpc | src/AlphaRPC/Client/Client.php | Client.getSocket | protected function getSocket($server)
{
if (isset($this->socket[$server])) {
return $this->socket[$server];
}
$context = new ZMQContext();
$socket = Socket::create($context, ZMQ::SOCKET_REQ, $this->logger);
$socket->connect($server);
$this->socket[$serve... | php | protected function getSocket($server)
{
if (isset($this->socket[$server])) {
return $this->socket[$server];
}
$context = new ZMQContext();
$socket = Socket::create($context, ZMQ::SOCKET_REQ, $this->logger);
$socket->connect($server);
$this->socket[$serve... | [
"protected",
"function",
"getSocket",
"(",
"$",
"server",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"socket",
"[",
"$",
"server",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"socket",
"[",
"$",
"server",
"]",
";",
"}",
"$",
"cont... | Returns a socket for the given server.
If the socket does not yet exist, it is created.
@param string $server
@return Socket | [
"Returns",
"a",
"socket",
"for",
"the",
"given",
"server",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/Client.php#L297-L310 | train |
alphacomm/alpharpc | src/AlphaRPC/Client/Client.php | Client.serializeParams | protected function serializeParams(array $params)
{
$serialized = array();
foreach ($params as $param) {
$serialized[] = $this->serializer->serialize($param);
}
return $serialized;
} | php | protected function serializeParams(array $params)
{
$serialized = array();
foreach ($params as $param) {
$serialized[] = $this->serializer->serialize($param);
}
return $serialized;
} | [
"protected",
"function",
"serializeParams",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"serialized",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"param",
")",
"{",
"$",
"serialized",
"[",
"]",
"=",
"$",
"this",
"->",
"seri... | Serializes parameters.
@param array $params
@return array | [
"Serializes",
"parameters",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/Client.php#L333-L341 | train |
alphacomm/alpharpc | src/AlphaRPC/Client/Client.php | Client.sendExecuteRequest | protected function sendExecuteRequest($manager, Request $request, $cache = null)
{
$serialized = $this->serializeParams($request->getParams());
$msg = new ExecuteRequest($cache, $request->getFunction(), $serialized);
$socket = $this->getSocket($manager);
$stream = $socket->getStream... | php | protected function sendExecuteRequest($manager, Request $request, $cache = null)
{
$serialized = $this->serializeParams($request->getParams());
$msg = new ExecuteRequest($cache, $request->getFunction(), $serialized);
$socket = $this->getSocket($manager);
$stream = $socket->getStream... | [
"protected",
"function",
"sendExecuteRequest",
"(",
"$",
"manager",
",",
"Request",
"$",
"request",
",",
"$",
"cache",
"=",
"null",
")",
"{",
"$",
"serialized",
"=",
"$",
"this",
"->",
"serializeParams",
"(",
"$",
"request",
"->",
"getParams",
"(",
")",
... | Send a request to the ClientHandler.
@param string $manager
@param Request $request
@param string $cache
@return ExecuteResponse
@throws TimeoutException
@throws InvalidResponseException | [
"Send",
"a",
"request",
"to",
"the",
"ClientHandler",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/Client.php#L354-L382 | train |
alphacomm/alpharpc | src/AlphaRPC/Client/Client.php | Client.fetchResponse | public function fetchResponse(Request $request, $waitForResult = true)
{
if ($request->hasResponse()) {
return $request->getResponse();
}
$timer = $this->getFetchTimer($waitForResult);
$req = new FetchRequest($request->getRequestId(), $waitForResult);
do {
... | php | public function fetchResponse(Request $request, $waitForResult = true)
{
if ($request->hasResponse()) {
return $request->getResponse();
}
$timer = $this->getFetchTimer($waitForResult);
$req = new FetchRequest($request->getRequestId(), $waitForResult);
do {
... | [
"public",
"function",
"fetchResponse",
"(",
"Request",
"$",
"request",
",",
"$",
"waitForResult",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"hasResponse",
"(",
")",
")",
"{",
"return",
"$",
"request",
"->",
"getResponse",
"(",
")",
";",
"... | Fetches the response for a request.
Throws a RuntimeException if there is no response (yet) and the timeout
is reached.
@param \AlphaRPC\Client\Request $request
@param boolean $waitForResult
@return mixed
@throws \RuntimeException | [
"Fetches",
"the",
"response",
"for",
"a",
"request",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/Client.php#L396-L417 | train |
alphacomm/alpharpc | src/AlphaRPC/Client/Client.php | Client.getManagerForRequest | private function getManagerForRequest(Request $request)
{
if (!$request->getManager()) {
$request->setManager($this->managerList->get());
}
return $request->getManager();
} | php | private function getManagerForRequest(Request $request)
{
if (!$request->getManager()) {
$request->setManager($this->managerList->get());
}
return $request->getManager();
} | [
"private",
"function",
"getManagerForRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"->",
"getManager",
"(",
")",
")",
"{",
"$",
"request",
"->",
"setManager",
"(",
"$",
"this",
"->",
"managerList",
"->",
"get",
"(",
... | Returns a manager for the Request.
It prefers the manager that is already set, but if it is
not, then it adds a random manager from the manager list.
@param Request $request
@return string | [
"Returns",
"a",
"manager",
"for",
"the",
"Request",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/Client.php#L534-L541 | train |
rackberg/para | src/Plugin/PluginManager.php | PluginManager.decodeLockFile | private function decodeLockFile(): array
{
$data = [];
$encoder = $this->jsonEncoderFactory->getEncoder();
if (file_exists($this->rootDirectory . 'composer.lock')) {
$data = $encoder->decode(
file_get_contents($this->rootDirectory.'composer.lock'),
... | php | private function decodeLockFile(): array
{
$data = [];
$encoder = $this->jsonEncoderFactory->getEncoder();
if (file_exists($this->rootDirectory . 'composer.lock')) {
$data = $encoder->decode(
file_get_contents($this->rootDirectory.'composer.lock'),
... | [
"private",
"function",
"decodeLockFile",
"(",
")",
":",
"array",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"encoder",
"=",
"$",
"this",
"->",
"jsonEncoderFactory",
"->",
"getEncoder",
"(",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
... | Returns the decoded lock file data.
@return array | [
"Returns",
"the",
"decoded",
"lock",
"file",
"data",
"."
] | e0ef1356ed2979670eb7c670d88921406cade46e | https://github.com/rackberg/para/blob/e0ef1356ed2979670eb7c670d88921406cade46e/src/Plugin/PluginManager.php#L206-L219 | train |
yii2lab/yii2-rbac | src/domain/services/RuleService.php | RuleService.executeRule | public function executeRule($user, $item, $params)
{
if ($item->ruleName === null) {
return true;
}
$rule = $this->domain->rule->getRule($item->ruleName);
if ($rule instanceof Rule) {
return $rule->execute($user, $item, $params);
}
throw new InvalidConfigException("Rule not found: {$item->ruleName... | php | public function executeRule($user, $item, $params)
{
if ($item->ruleName === null) {
return true;
}
$rule = $this->domain->rule->getRule($item->ruleName);
if ($rule instanceof Rule) {
return $rule->execute($user, $item, $params);
}
throw new InvalidConfigException("Rule not found: {$item->ruleName... | [
"public",
"function",
"executeRule",
"(",
"$",
"user",
",",
"$",
"item",
",",
"$",
"params",
")",
"{",
"if",
"(",
"$",
"item",
"->",
"ruleName",
"===",
"null",
")",
"{",
"return",
"true",
";",
"}",
"$",
"rule",
"=",
"$",
"this",
"->",
"domain",
"... | Executes the rule associated with the specified auth item.
If the item does not specify a rule, this method will return true. Otherwise, it will
return the value of [[Rule::execute()]].
@param string|int $user the user ID. This should be either an integer or a string representing
the unique identifier of a user. See ... | [
"Executes",
"the",
"rule",
"associated",
"with",
"the",
"specified",
"auth",
"item",
"."
] | e72ac0359af660690c161451f864208b2d20919d | https://github.com/yii2lab/yii2-rbac/blob/e72ac0359af660690c161451f864208b2d20919d/src/domain/services/RuleService.php#L84-L95 | train |
gplcart/base | handlers/Install.php | Install.install | public function install(array $data, $db)
{
$this->db = $db;
$this->data = $data;
$this->data['step'] = 0;
if (GC_CLI) {
$this->installCli();
return array();
}
return $this->installHttp();
} | php | public function install(array $data, $db)
{
$this->db = $db;
$this->data = $data;
$this->data['step'] = 0;
if (GC_CLI) {
$this->installCli();
return array();
}
return $this->installHttp();
} | [
"public",
"function",
"install",
"(",
"array",
"$",
"data",
",",
"$",
"db",
")",
"{",
"$",
"this",
"->",
"db",
"=",
"$",
"db",
";",
"$",
"this",
"->",
"data",
"=",
"$",
"data",
";",
"$",
"this",
"->",
"data",
"[",
"'step'",
"]",
"=",
"0",
";"... | Performs initial system installation. Step 0
@param array $data
@param \gplcart\core\Database $db
@return array | [
"Performs",
"initial",
"system",
"installation",
".",
"Step",
"0"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L54-L66 | train |
gplcart/base | handlers/Install.php | Install.installHttp | protected function installHttp()
{
$result = array(
'message' => '',
'severity' => 'success',
'redirect' => 'install/' . ($this->data['step'] + 1)
);
try {
$this->start();
$this->process();
} catch (Exception $ex) {
... | php | protected function installHttp()
{
$result = array(
'message' => '',
'severity' => 'success',
'redirect' => 'install/' . ($this->data['step'] + 1)
);
try {
$this->start();
$this->process();
} catch (Exception $ex) {
... | [
"protected",
"function",
"installHttp",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
"'message'",
"=>",
"''",
",",
"'severity'",
"=>",
"'success'",
",",
"'redirect'",
"=>",
"'install/'",
".",
"(",
"$",
"this",
"->",
"data",
"[",
"'step'",
"]",
"+",
... | Performs installation via classic web UI
@return array | [
"Performs",
"installation",
"via",
"classic",
"web",
"UI"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L72-L94 | train |
gplcart/base | handlers/Install.php | Install.installCli | protected function installCli()
{
try {
$this->process();
$this->installCliStep1();
$this->installCliStep2();
$this->installCliStep3();
$this->cli->line($this->getSuccessMessage());
} catch (Exception $ex) {
$this->cli->error($e... | php | protected function installCli()
{
try {
$this->process();
$this->installCliStep1();
$this->installCliStep2();
$this->installCliStep3();
$this->cli->line($this->getSuccessMessage());
} catch (Exception $ex) {
$this->cli->error($e... | [
"protected",
"function",
"installCli",
"(",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"process",
"(",
")",
";",
"$",
"this",
"->",
"installCliStep1",
"(",
")",
";",
"$",
"this",
"->",
"installCliStep2",
"(",
")",
";",
"$",
"this",
"->",
"installCliStep3... | Install in CLI mode | [
"Install",
"in",
"CLI",
"mode"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L99-L110 | train |
gplcart/base | handlers/Install.php | Install.installCliStep1 | protected function installCliStep1()
{
$this->data['step'] = 1;
$this->setCliMessage('Configuring modules...');
$result = $this->installModules($this->data, $this->db);
if ($result['severity'] !== 'success') {
throw new UnexpectedValueException($result['message']);
... | php | protected function installCliStep1()
{
$this->data['step'] = 1;
$this->setCliMessage('Configuring modules...');
$result = $this->installModules($this->data, $this->db);
if ($result['severity'] !== 'success') {
throw new UnexpectedValueException($result['message']);
... | [
"protected",
"function",
"installCliStep1",
"(",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'step'",
"]",
"=",
"1",
";",
"$",
"this",
"->",
"setCliMessage",
"(",
"'Configuring modules...'",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"installModules",... | Process step 1 in CLI mode
@throws UnexpectedValueException | [
"Process",
"step",
"1",
"in",
"CLI",
"mode"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L116-L125 | train |
gplcart/base | handlers/Install.php | Install.installCliStep2 | protected function installCliStep2()
{
$title = $this->translation->text('Please select a demo content package (enter a number)');
$this->data['demo_handler_id'] = $this->cli->menu($this->getDemoOptions(), '', $title);
if (!empty($this->data['demo_handler_id'])) {
$this->data['... | php | protected function installCliStep2()
{
$title = $this->translation->text('Please select a demo content package (enter a number)');
$this->data['demo_handler_id'] = $this->cli->menu($this->getDemoOptions(), '', $title);
if (!empty($this->data['demo_handler_id'])) {
$this->data['... | [
"protected",
"function",
"installCliStep2",
"(",
")",
"{",
"$",
"title",
"=",
"$",
"this",
"->",
"translation",
"->",
"text",
"(",
"'Please select a demo content package (enter a number)'",
")",
";",
"$",
"this",
"->",
"data",
"[",
"'demo_handler_id'",
"]",
"=",
... | Process step 2 in CLI mode
@throws UnexpectedValueException | [
"Process",
"step",
"2",
"in",
"CLI",
"mode"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L131-L148 | train |
gplcart/base | handlers/Install.php | Install.installCliStep3 | protected function installCliStep3()
{
$this->data['step'] = 3;
$result = $this->installFinish($this->data, $this->db);
if ($result['severity'] !== 'success') {
throw new UnexpectedValueException($result['message']);
}
} | php | protected function installCliStep3()
{
$this->data['step'] = 3;
$result = $this->installFinish($this->data, $this->db);
if ($result['severity'] !== 'success') {
throw new UnexpectedValueException($result['message']);
}
} | [
"protected",
"function",
"installCliStep3",
"(",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'step'",
"]",
"=",
"3",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"installFinish",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"this",
"->",
"db",
")",
";",... | Precess step 3 in CLI mode
@throws UnexpectedValueException | [
"Precess",
"step",
"3",
"in",
"CLI",
"mode"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L154-L162 | train |
gplcart/base | handlers/Install.php | Install.installModules | public function installModules(array $data, $db)
{
$this->db = $db;
$this->data = $data;
try {
$this->install_model->installModules();
$this->configureModules();
return array(
'message' => '',
'severity' => 'success',
... | php | public function installModules(array $data, $db)
{
$this->db = $db;
$this->data = $data;
try {
$this->install_model->installModules();
$this->configureModules();
return array(
'message' => '',
'severity' => 'success',
... | [
"public",
"function",
"installModules",
"(",
"array",
"$",
"data",
",",
"$",
"db",
")",
"{",
"$",
"this",
"->",
"db",
"=",
"$",
"db",
";",
"$",
"this",
"->",
"data",
"=",
"$",
"data",
";",
"try",
"{",
"$",
"this",
"->",
"install_model",
"->",
"in... | Installs required modules. Step 1
@param array $data
@param \gplcart\core\Database $db
@return array | [
"Installs",
"required",
"modules",
".",
"Step",
"1"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L170-L196 | train |
gplcart/base | handlers/Install.php | Install.installDemo | public function installDemo(array $data, $db)
{
set_time_limit(0);
$this->db = $db;
$this->data = $data;
$success_result = array(
'message' => '',
'severity' => 'success',
'redirect' => 'install/' . ($this->data['step'] + 1)
);
i... | php | public function installDemo(array $data, $db)
{
set_time_limit(0);
$this->db = $db;
$this->data = $data;
$success_result = array(
'message' => '',
'severity' => 'success',
'redirect' => 'install/' . ($this->data['step'] + 1)
);
i... | [
"public",
"function",
"installDemo",
"(",
"array",
"$",
"data",
",",
"$",
"db",
")",
"{",
"set_time_limit",
"(",
"0",
")",
";",
"$",
"this",
"->",
"db",
"=",
"$",
"db",
";",
"$",
"this",
"->",
"data",
"=",
"$",
"data",
";",
"$",
"success_result",
... | Install a demo-content. Step 2
@param array $data
@param \gplcart\core\Database $db
@return array | [
"Install",
"a",
"demo",
"-",
"content",
".",
"Step",
"2"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L204-L228 | train |
gplcart/base | handlers/Install.php | Install.installFinish | public function installFinish(array $data, $db)
{
$this->db = $db;
$this->data = $data;
$result = $this->finish();
$errors = $this->getContextErrors();
if (empty($errors)) {
if ($this->getContext('demo_handler_id')) {
$store_id = $this->getContex... | php | public function installFinish(array $data, $db)
{
$this->db = $db;
$this->data = $data;
$result = $this->finish();
$errors = $this->getContextErrors();
if (empty($errors)) {
if ($this->getContext('demo_handler_id')) {
$store_id = $this->getContex... | [
"public",
"function",
"installFinish",
"(",
"array",
"$",
"data",
",",
"$",
"db",
")",
"{",
"$",
"this",
"->",
"db",
"=",
"$",
"db",
";",
"$",
"this",
"->",
"data",
"=",
"$",
"data",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"finish",
"(",
")... | Performs final tasks. Step 3
@param array $data
@param \gplcart\core\Database $db
@return array | [
"Performs",
"final",
"tasks",
".",
"Step",
"3"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L236-L255 | train |
gplcart/base | handlers/Install.php | Install.getDemoOptions | protected function getDemoOptions()
{
$options = array('' => $this->translation->text('No demo'));
foreach ($this->install_model->getDemoHandlers() as $id => $handler) {
$options[$id] = $handler['title'];
}
return $options;
} | php | protected function getDemoOptions()
{
$options = array('' => $this->translation->text('No demo'));
foreach ($this->install_model->getDemoHandlers() as $id => $handler) {
$options[$id] = $handler['title'];
}
return $options;
} | [
"protected",
"function",
"getDemoOptions",
"(",
")",
"{",
"$",
"options",
"=",
"array",
"(",
"''",
"=>",
"$",
"this",
"->",
"translation",
"->",
"text",
"(",
"'No demo'",
")",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"install_model",
"->",
"getDemoHa... | Returns an array of demo content options
@return array | [
"Returns",
"an",
"array",
"of",
"demo",
"content",
"options"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L261-L270 | train |
gplcart/base | handlers/Install.php | Install.configureModuleDevice | protected function configureModuleDevice()
{
$store_id = $this->getContext('store_id');
$settings = array();
$settings['theme'][$store_id]['mobile'] = 'mobile';
$settings['theme'][$store_id]['tablet'] = 'mobile';
$this->module->setSettings('device', $settings);
} | php | protected function configureModuleDevice()
{
$store_id = $this->getContext('store_id');
$settings = array();
$settings['theme'][$store_id]['mobile'] = 'mobile';
$settings['theme'][$store_id]['tablet'] = 'mobile';
$this->module->setSettings('device', $settings);
} | [
"protected",
"function",
"configureModuleDevice",
"(",
")",
"{",
"$",
"store_id",
"=",
"$",
"this",
"->",
"getContext",
"(",
"'store_id'",
")",
";",
"$",
"settings",
"=",
"array",
"(",
")",
";",
"$",
"settings",
"[",
"'theme'",
"]",
"[",
"$",
"store_id",... | Configure Device module settings | [
"Configure",
"Device",
"module",
"settings"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L284-L293 | train |
gplcart/base | handlers/Install.php | Install.configureModuleGaReport | protected function configureModuleGaReport()
{
$info = $this->module->getInfo('ga_report');
$info['settings']['dashboard'] = array(
'visit_date',
'pageview_date',
'content_statistic',
'top_pages',
'source',
'keyword',
... | php | protected function configureModuleGaReport()
{
$info = $this->module->getInfo('ga_report');
$info['settings']['dashboard'] = array(
'visit_date',
'pageview_date',
'content_statistic',
'top_pages',
'source',
'keyword',
... | [
"protected",
"function",
"configureModuleGaReport",
"(",
")",
"{",
"$",
"info",
"=",
"$",
"this",
"->",
"module",
"->",
"getInfo",
"(",
"'ga_report'",
")",
";",
"$",
"info",
"[",
"'settings'",
"]",
"[",
"'dashboard'",
"]",
"=",
"array",
"(",
"'visit_date'"... | Configure Google Analytics Report module settings | [
"Configure",
"Google",
"Analytics",
"Report",
"module",
"settings"
] | bbcd87604d25333a0a1b84d79299fa06ec5dd39e | https://github.com/gplcart/base/blob/bbcd87604d25333a0a1b84d79299fa06ec5dd39e/handlers/Install.php#L298-L313 | train |
dcarbone/curl-plus | src/CurlPlusClient.php | CurlPlusClient.initialize | public function initialize($url, $reset = true)
{
if ((bool)$reset)
$this->reset();
$this->currentRequestUrl = $url;
$this->state = self::STATE_INITIALIZED;
return $this;
} | php | public function initialize($url, $reset = true)
{
if ((bool)$reset)
$this->reset();
$this->currentRequestUrl = $url;
$this->state = self::STATE_INITIALIZED;
return $this;
} | [
"public",
"function",
"initialize",
"(",
"$",
"url",
",",
"$",
"reset",
"=",
"true",
")",
"{",
"if",
"(",
"(",
"bool",
")",
"$",
"reset",
")",
"$",
"this",
"->",
"reset",
"(",
")",
";",
"$",
"this",
"->",
"currentRequestUrl",
"=",
"$",
"url",
";"... | Create a new CURL resource
@param string $url
@param bool $reset
@return $this | [
"Create",
"a",
"new",
"CURL",
"resource"
] | 7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52 | https://github.com/dcarbone/curl-plus/blob/7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52/src/CurlPlusClient.php#L82-L92 | train |
dcarbone/curl-plus | src/CurlPlusClient.php | CurlPlusClient.setRequestHeader | public function setRequestHeader($name, $value)
{
if (!is_string($name))
throw new \InvalidArgumentException('Argument 1 expected to be string, '.gettype($name).' seen.');
if (!is_string($value))
throw new \InvalidArgumentException('Argument 2 expected to be string, '.gettyp... | php | public function setRequestHeader($name, $value)
{
if (!is_string($name))
throw new \InvalidArgumentException('Argument 1 expected to be string, '.gettype($name).' seen.');
if (!is_string($value))
throw new \InvalidArgumentException('Argument 2 expected to be string, '.gettyp... | [
"public",
"function",
"setRequestHeader",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Argument 1 expected to be string, '",
".",
"gettype",
"("... | Add a header string to the request
@param string $name
@param string $value
@throws \RuntimeException
@throws \InvalidArgumentException
@return $this | [
"Add",
"a",
"header",
"string",
"to",
"the",
"request"
] | 7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52 | https://github.com/dcarbone/curl-plus/blob/7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52/src/CurlPlusClient.php#L111-L125 | train |
dcarbone/curl-plus | src/CurlPlusClient.php | CurlPlusClient.setCurlOpt | public function setCurlOpt($opt, $val)
{
if (!is_int($opt))
{
throw new \InvalidArgumentException(sprintf(
'%s::setCurlOpt - Argument 1 expected to be integer, %s seen.',
get_class($this),
gettype($opt)
));
}
$t... | php | public function setCurlOpt($opt, $val)
{
if (!is_int($opt))
{
throw new \InvalidArgumentException(sprintf(
'%s::setCurlOpt - Argument 1 expected to be integer, %s seen.',
get_class($this),
gettype($opt)
));
}
$t... | [
"public",
"function",
"setCurlOpt",
"(",
"$",
"opt",
",",
"$",
"val",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"opt",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'%s::setCurlOpt - Argument 1 expected to be intege... | Set CURL option
@link http://www.php.net/manual/en/function.curl-setopt.php
@param int $opt curl option
@param mixed $val curl option value
@throws \InvalidArgumentException
@return $this | [
"Set",
"CURL",
"option"
] | 7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52 | https://github.com/dcarbone/curl-plus/blob/7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52/src/CurlPlusClient.php#L189-L202 | train |
dcarbone/curl-plus | src/CurlPlusClient.php | CurlPlusClient.close | public function close()
{
if ('resource' === gettype($this->ch))
curl_close($this->ch);
$this->state = self::STATE_CLOSED;
return $this;
} | php | public function close()
{
if ('resource' === gettype($this->ch))
curl_close($this->ch);
$this->state = self::STATE_CLOSED;
return $this;
} | [
"public",
"function",
"close",
"(",
")",
"{",
"if",
"(",
"'resource'",
"===",
"gettype",
"(",
"$",
"this",
"->",
"ch",
")",
")",
"curl_close",
"(",
"$",
"this",
"->",
"ch",
")",
";",
"$",
"this",
"->",
"state",
"=",
"self",
"::",
"STATE_CLOSED",
";... | Close the curl resource, if exists | [
"Close",
"the",
"curl",
"resource",
"if",
"exists"
] | 7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52 | https://github.com/dcarbone/curl-plus/blob/7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52/src/CurlPlusClient.php#L249-L257 | train |
dcarbone/curl-plus | src/CurlPlusClient.php | CurlPlusClient.reset | public function reset()
{
$this->close();
$this->curlOpts = array();
$this->requestHeaders = array();
$this->currentRequestUrl = null;
$this->state = self::STATE_NEW;
return $this;
} | php | public function reset()
{
$this->close();
$this->curlOpts = array();
$this->requestHeaders = array();
$this->currentRequestUrl = null;
$this->state = self::STATE_NEW;
return $this;
} | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"close",
"(",
")",
";",
"$",
"this",
"->",
"curlOpts",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"requestHeaders",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"currentReques... | Reset to new state
@return $this | [
"Reset",
"to",
"new",
"state"
] | 7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52 | https://github.com/dcarbone/curl-plus/blob/7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52/src/CurlPlusClient.php#L264-L274 | train |
dcarbone/curl-plus | src/CurlPlusClient.php | CurlPlusClient.curlOptSet | public function curlOptSet($opt)
{
return isset($this->curlOpts[$opt]) || array_key_exists($opt, $this->curlOpts);
} | php | public function curlOptSet($opt)
{
return isset($this->curlOpts[$opt]) || array_key_exists($opt, $this->curlOpts);
} | [
"public",
"function",
"curlOptSet",
"(",
"$",
"opt",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"curlOpts",
"[",
"$",
"opt",
"]",
")",
"||",
"array_key_exists",
"(",
"$",
"opt",
",",
"$",
"this",
"->",
"curlOpts",
")",
";",
"}"
] | Returns true if passed in curl option has a value
@param int $opt
@return bool | [
"Returns",
"true",
"if",
"passed",
"in",
"curl",
"option",
"has",
"a",
"value"
] | 7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52 | https://github.com/dcarbone/curl-plus/blob/7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52/src/CurlPlusClient.php#L282-L285 | train |
dcarbone/curl-plus | src/CurlPlusClient.php | CurlPlusClient.execute | public function execute($resetAfterExecution = false)
{
$this->buildRequest();
$response = new CurlPlusResponse(
curl_exec($this->ch),
curl_getinfo($this->ch),
curl_error($this->ch),
$this->getCurlOpts()
);
if ($resetAfterExecution)
... | php | public function execute($resetAfterExecution = false)
{
$this->buildRequest();
$response = new CurlPlusResponse(
curl_exec($this->ch),
curl_getinfo($this->ch),
curl_error($this->ch),
$this->getCurlOpts()
);
if ($resetAfterExecution)
... | [
"public",
"function",
"execute",
"(",
"$",
"resetAfterExecution",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"buildRequest",
"(",
")",
";",
"$",
"response",
"=",
"new",
"CurlPlusResponse",
"(",
"curl_exec",
"(",
"$",
"this",
"->",
"ch",
")",
",",
"curl_g... | Execute CURL command
@param bool $resetAfterExecution
@throws \RuntimeException
@return \DCarbone\CurlPlus\CurlPlusResponse | [
"Execute",
"CURL",
"command"
] | 7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52 | https://github.com/dcarbone/curl-plus/blob/7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52/src/CurlPlusClient.php#L308-L323 | train |
dcarbone/curl-plus | src/CurlPlusClient.php | CurlPlusClient.buildRequest | protected function buildRequest()
{
if (self::STATE_NEW === $this->state)
{
throw new \RuntimeException(sprintf(
'%s::execute - Could not execute request, curl has not been initialized.',
get_class($this)
));
}
if (self::STATE_... | php | protected function buildRequest()
{
if (self::STATE_NEW === $this->state)
{
throw new \RuntimeException(sprintf(
'%s::execute - Could not execute request, curl has not been initialized.',
get_class($this)
));
}
if (self::STATE_... | [
"protected",
"function",
"buildRequest",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"STATE_NEW",
"===",
"$",
"this",
"->",
"state",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"sprintf",
"(",
"'%s::execute - Could not execute request, curl has not been ini... | Attempts to set up the client for a request, throws an exception if it cannot | [
"Attempts",
"to",
"set",
"up",
"the",
"client",
"for",
"a",
"request",
"throws",
"an",
"exception",
"if",
"it",
"cannot"
] | 7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52 | https://github.com/dcarbone/curl-plus/blob/7f6b8269c3045eee6e5ade0bff2ca91cb4f58d52/src/CurlPlusClient.php#L328-L383 | train |
crisu83/yii-consoletools | helpers/ConfigHelper.php | ConfigHelper.merge | public static function merge(array $array)
{
$result = array();
foreach ($array as $config) {
if (is_string($config)) {
if (!file_exists($config)) {
continue;
}
$config = require($config);
}
if (!... | php | public static function merge(array $array)
{
$result = array();
foreach ($array as $config) {
if (is_string($config)) {
if (!file_exists($config)) {
continue;
}
$config = require($config);
}
if (!... | [
"public",
"static",
"function",
"merge",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"config",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"config",
")",
")",
"{",
"if... | Merges the given configurations into a single configuration array.
@param array $array the configurations to merge.
@return array the merged configuration. | [
"Merges",
"the",
"given",
"configurations",
"into",
"a",
"single",
"configuration",
"array",
"."
] | 53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc | https://github.com/crisu83/yii-consoletools/blob/53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc/helpers/ConfigHelper.php#L20-L36 | train |
znframework/package-helpers | Debugger.php | Debugger.parent | public function parent(Int $index = 1) : stdClass
{
return $this->_layer($this->debug, $index, $index + 1);
} | php | public function parent(Int $index = 1) : stdClass
{
return $this->_layer($this->debug, $index, $index + 1);
} | [
"public",
"function",
"parent",
"(",
"Int",
"$",
"index",
"=",
"1",
")",
":",
"stdClass",
"{",
"return",
"$",
"this",
"->",
"_layer",
"(",
"$",
"this",
"->",
"debug",
",",
"$",
"index",
",",
"$",
"index",
"+",
"1",
")",
";",
"}"
] | Parent Debug Data
@param int $index = 1
@return object | [
"Parent",
"Debug",
"Data"
] | c78502263cdda5c14626a1abf7fc7e02dd2bd57d | https://github.com/znframework/package-helpers/blob/c78502263cdda5c14626a1abf7fc7e02dd2bd57d/Debugger.php#L52-L55 | train |
crisu83/yii-consoletools | commands/MysqldumpCommand.php | MysqldumpCommand.resolveDumpPath | protected function resolveDumpPath()
{
$path = $this->basePath . '/' . $this->dumpPath;
$this->ensureDirectory($path);
return realpath($path) . '/' . $this->dumpFile;
} | php | protected function resolveDumpPath()
{
$path = $this->basePath . '/' . $this->dumpPath;
$this->ensureDirectory($path);
return realpath($path) . '/' . $this->dumpFile;
} | [
"protected",
"function",
"resolveDumpPath",
"(",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"basePath",
".",
"'/'",
".",
"$",
"this",
"->",
"dumpPath",
";",
"$",
"this",
"->",
"ensureDirectory",
"(",
"$",
"path",
")",
";",
"return",
"realpath",
"("... | Returns the path to the dump-file.
@return string the path. | [
"Returns",
"the",
"path",
"to",
"the",
"dump",
"-",
"file",
"."
] | 53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc | https://github.com/crisu83/yii-consoletools/blob/53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc/commands/MysqldumpCommand.php#L135-L140 | train |
crisu83/yii-consoletools | commands/MysqldumpCommand.php | MysqldumpCommand.normalizeOptions | protected function normalizeOptions($options)
{
$result = array();
foreach ($options as $name => $value) {
$result[] = "--$name=\"$value\"";
}
return implode(' ', $result);
} | php | protected function normalizeOptions($options)
{
$result = array();
foreach ($options as $name => $value) {
$result[] = "--$name=\"$value\"";
}
return implode(' ', $result);
} | [
"protected",
"function",
"normalizeOptions",
"(",
"$",
"options",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"options",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"result",
"[",
"]",
"=",
"\"--$name=\\\"$value... | Normalizes the given options to a string
@param array $options the options.
@return string the options. | [
"Normalizes",
"the",
"given",
"options",
"to",
"a",
"string"
] | 53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc | https://github.com/crisu83/yii-consoletools/blob/53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc/commands/MysqldumpCommand.php#L147-L154 | train |
crisu83/yii-consoletools | commands/MysqldumpCommand.php | MysqldumpCommand.getDb | protected function getDb()
{
if (isset($this->_db)) {
return $this->_db;
} else {
if (($db = Yii::app()->getComponent($this->connectionID)) === null) {
throw new CException(sprintf(
'Failed to get database connection. Component %s not found... | php | protected function getDb()
{
if (isset($this->_db)) {
return $this->_db;
} else {
if (($db = Yii::app()->getComponent($this->connectionID)) === null) {
throw new CException(sprintf(
'Failed to get database connection. Component %s not found... | [
"protected",
"function",
"getDb",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_db",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_db",
";",
"}",
"else",
"{",
"if",
"(",
"(",
"$",
"db",
"=",
"Yii",
"::",
"app",
"(",
")",
"->",
... | Returns the database connection component.
@return CDbConnection the component.
@throws CException if the component is not found. | [
"Returns",
"the",
"database",
"connection",
"component",
"."
] | 53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc | https://github.com/crisu83/yii-consoletools/blob/53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc/commands/MysqldumpCommand.php#L161-L174 | train |
andyburton/Sonic-Framework | src/Model.php | Model.get | public function get ($name)
{
// If the attribute doesn't exists
if (!$this->attributeExists ($name))
{
throw new Exception (get_called_class () . '->' . $name . ' attribute does not exist!');
}
// If attribute getter isn't set or is disabled
if (!$this->attributeGet ($name))
{
throw ne... | php | public function get ($name)
{
// If the attribute doesn't exists
if (!$this->attributeExists ($name))
{
throw new Exception (get_called_class () . '->' . $name . ' attribute does not exist!');
}
// If attribute getter isn't set or is disabled
if (!$this->attributeGet ($name))
{
throw ne... | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"// If the attribute doesn't exists",
"if",
"(",
"!",
"$",
"this",
"->",
"attributeExists",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"get_called_class",
"(",
")",
".",
"'->'... | Return an attribute value if allowed by attribute getter
@param string $name Attribute name
@throws Exception
@return mixed | [
"Return",
"an",
"attribute",
"value",
"if",
"allowed",
"by",
"attribute",
"getter"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L328-L370 | train |
andyburton/Sonic-Framework | src/Model.php | Model.set | public function set ($name, $val, $validate = TRUE)
{
// If the attribute doesn't exists
if (!$this->attributeExists ($name))
{
throw new Exception (get_called_class () . '->' . $name . ' attribute does not exist!');
}
// If attribute setter isn't set or is disabled
if (!$this->attributeSet ... | php | public function set ($name, $val, $validate = TRUE)
{
// If the attribute doesn't exists
if (!$this->attributeExists ($name))
{
throw new Exception (get_called_class () . '->' . $name . ' attribute does not exist!');
}
// If attribute setter isn't set or is disabled
if (!$this->attributeSet ... | [
"public",
"function",
"set",
"(",
"$",
"name",
",",
"$",
"val",
",",
"$",
"validate",
"=",
"TRUE",
")",
"{",
"// If the attribute doesn't exists",
"if",
"(",
"!",
"$",
"this",
"->",
"attributeExists",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"E... | Set an attribute value if allowed by attribute setter
@param string $name Attribute name
@param mixed $val Attribute value
@param boolean $validate Whether to validate the value
@throws Exception|Parser\Exception
@return void | [
"Set",
"an",
"attribute",
"value",
"if",
"allowed",
"by",
"attribute",
"setter"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L382-L418 | train |
andyburton/Sonic-Framework | src/Model.php | Model.reset | public function reset ($name)
{
// If the attribute doesn't exists
if (!$this->attributeExists ($name))
{
throw new Exception (get_called_class () . '->' . $name . ' attribute does not exist!');
}
// If attribute reset is disabled
if (!$this->attributeReset ($name))
{
throw new Exceptio... | php | public function reset ($name)
{
// If the attribute doesn't exists
if (!$this->attributeExists ($name))
{
throw new Exception (get_called_class () . '->' . $name . ' attribute does not exist!');
}
// If attribute reset is disabled
if (!$this->attributeReset ($name))
{
throw new Exceptio... | [
"public",
"function",
"reset",
"(",
"$",
"name",
")",
"{",
"// If the attribute doesn't exists",
"if",
"(",
"!",
"$",
"this",
"->",
"attributeExists",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"get_called_class",
"(",
")",
".",
"'-... | Reset an attribute value to its default
@param string $name Attribute name
@throws Exception
@return void | [
"Reset",
"an",
"attribute",
"value",
"to",
"its",
"default"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model.php#L522-L553 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.