id
int32 0
241k
| repo
stringlengths 6
63
| path
stringlengths 5
140
| func_name
stringlengths 3
151
| original_string
stringlengths 84
13k
| language
stringclasses 1
value | code
stringlengths 84
13k
| code_tokens
sequence | docstring
stringlengths 3
47.2k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 91
247
|
---|---|---|---|---|---|---|---|---|---|---|---|
4,500 | indigophp-archive/http-adapter | src/Client.php | Client.send | public function send(Request $request)
{
$response = $this->adapter->send($request);
return $response->getBody()->getContents();
} | php | public function send(Request $request)
{
$response = $this->adapter->send($request);
return $response->getBody()->getContents();
} | [
"public",
"function",
"send",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"adapter",
"->",
"send",
"(",
"$",
"request",
")",
";",
"return",
"$",
"response",
"->",
"getBody",
"(",
")",
"->",
"getContents",
"(",
")",
";",
"}"
] | Sends a request and returns it's body
@param Request $request
@return string | [
"Sends",
"a",
"request",
"and",
"returns",
"it",
"s",
"body"
] | 2233e8329a0704e020857228c2b538438e127475 | https://github.com/indigophp-archive/http-adapter/blob/2233e8329a0704e020857228c2b538438e127475/src/Client.php#L73-L78 |
4,501 | indigophp-archive/http-adapter | src/Client.php | Client.createRequest | public function createRequest($method, $url = null, array $options = [])
{
$protocol_version = '1.1';
$body = null;
$headers = [];
extract($options);
$request = new Message\Request;
$request->setMethod($method);
$request->setUrl($url ? (string) $this->createUrl($url) : (string) $this->baseUrl);
$request->setProtocolVersion($protocol_version);
if (isset($body)) {
$body = Stream::create($body);
$request->setBody($body);
}
foreach ($headers as $key => $value) {
$request->setHeader($key, $value);
}
return $request;
} | php | public function createRequest($method, $url = null, array $options = [])
{
$protocol_version = '1.1';
$body = null;
$headers = [];
extract($options);
$request = new Message\Request;
$request->setMethod($method);
$request->setUrl($url ? (string) $this->createUrl($url) : (string) $this->baseUrl);
$request->setProtocolVersion($protocol_version);
if (isset($body)) {
$body = Stream::create($body);
$request->setBody($body);
}
foreach ($headers as $key => $value) {
$request->setHeader($key, $value);
}
return $request;
} | [
"public",
"function",
"createRequest",
"(",
"$",
"method",
",",
"$",
"url",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"protocol_version",
"=",
"'1.1'",
";",
"$",
"body",
"=",
"null",
";",
"$",
"headers",
"=",
"[",
"]",
";",
"extract",
"(",
"$",
"options",
")",
";",
"$",
"request",
"=",
"new",
"Message",
"\\",
"Request",
";",
"$",
"request",
"->",
"setMethod",
"(",
"$",
"method",
")",
";",
"$",
"request",
"->",
"setUrl",
"(",
"$",
"url",
"?",
"(",
"string",
")",
"$",
"this",
"->",
"createUrl",
"(",
"$",
"url",
")",
":",
"(",
"string",
")",
"$",
"this",
"->",
"baseUrl",
")",
";",
"$",
"request",
"->",
"setProtocolVersion",
"(",
"$",
"protocol_version",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"body",
")",
")",
"{",
"$",
"body",
"=",
"Stream",
"::",
"create",
"(",
"$",
"body",
")",
";",
"$",
"request",
"->",
"setBody",
"(",
"$",
"body",
")",
";",
"}",
"foreach",
"(",
"$",
"headers",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"request",
"->",
"setHeader",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}",
"return",
"$",
"request",
";",
"}"
] | Creates a request
@param string $method
@param string|null $url
@param array $options
@return Request | [
"Creates",
"a",
"request"
] | 2233e8329a0704e020857228c2b538438e127475 | https://github.com/indigophp-archive/http-adapter/blob/2233e8329a0704e020857228c2b538438e127475/src/Client.php#L89-L113 |
4,502 | indigophp-archive/http-adapter | src/Client.php | Client.createUrl | protected function createUrl($url)
{
// is absolute URL?
if (strpos($url, '://')) {
return Url::createFromUrl($url);
}
// only query and path matters in relative url
$url = Url::createFromUrl($url);
$query = $this->baseUrl->getQuery();
$path = $this->baseUrl->getPath();
$query->modify($url->getQuery());
$path->append($url->getPath());
return $this->baseUrl->setQuery($query)->setPath($path);
} | php | protected function createUrl($url)
{
// is absolute URL?
if (strpos($url, '://')) {
return Url::createFromUrl($url);
}
// only query and path matters in relative url
$url = Url::createFromUrl($url);
$query = $this->baseUrl->getQuery();
$path = $this->baseUrl->getPath();
$query->modify($url->getQuery());
$path->append($url->getPath());
return $this->baseUrl->setQuery($query)->setPath($path);
} | [
"protected",
"function",
"createUrl",
"(",
"$",
"url",
")",
"{",
"// is absolute URL?",
"if",
"(",
"strpos",
"(",
"$",
"url",
",",
"'://'",
")",
")",
"{",
"return",
"Url",
"::",
"createFromUrl",
"(",
"$",
"url",
")",
";",
"}",
"// only query and path matters in relative url",
"$",
"url",
"=",
"Url",
"::",
"createFromUrl",
"(",
"$",
"url",
")",
";",
"$",
"query",
"=",
"$",
"this",
"->",
"baseUrl",
"->",
"getQuery",
"(",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"baseUrl",
"->",
"getPath",
"(",
")",
";",
"$",
"query",
"->",
"modify",
"(",
"$",
"url",
"->",
"getQuery",
"(",
")",
")",
";",
"$",
"path",
"->",
"append",
"(",
"$",
"url",
"->",
"getPath",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"baseUrl",
"->",
"setQuery",
"(",
"$",
"query",
")",
"->",
"setPath",
"(",
"$",
"path",
")",
";",
"}"
] | Creates a URL using the base URL
@param string|null|Url $url
@return Url | [
"Creates",
"a",
"URL",
"using",
"the",
"base",
"URL"
] | 2233e8329a0704e020857228c2b538438e127475 | https://github.com/indigophp-archive/http-adapter/blob/2233e8329a0704e020857228c2b538438e127475/src/Client.php#L122-L138 |
4,503 | tzlion/neodb | NeoDb.php | NeoDb.subVars | private function subVars($query, $vars = [])
{
if (!is_array($vars)) {
$vars = [$vars];
}
$queryParts = explode( "?", $query );
if ( count( $queryParts ) -1 != count ( $vars ) ) {
throw new \Exception( "Number of variables supplied does not match number of ?s in the query!" );
}
$finalQuery = $queryParts[0];
$queryPartNo = 0;
foreach ( $vars as $var ) {
$var = $this->escapifyVariable($var);
$queryPartNo++;
$finalQuery .= $var . $queryParts[$queryPartNo];
}
return $finalQuery;
} | php | private function subVars($query, $vars = [])
{
if (!is_array($vars)) {
$vars = [$vars];
}
$queryParts = explode( "?", $query );
if ( count( $queryParts ) -1 != count ( $vars ) ) {
throw new \Exception( "Number of variables supplied does not match number of ?s in the query!" );
}
$finalQuery = $queryParts[0];
$queryPartNo = 0;
foreach ( $vars as $var ) {
$var = $this->escapifyVariable($var);
$queryPartNo++;
$finalQuery .= $var . $queryParts[$queryPartNo];
}
return $finalQuery;
} | [
"private",
"function",
"subVars",
"(",
"$",
"query",
",",
"$",
"vars",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"vars",
")",
")",
"{",
"$",
"vars",
"=",
"[",
"$",
"vars",
"]",
";",
"}",
"$",
"queryParts",
"=",
"explode",
"(",
"\"?\"",
",",
"$",
"query",
")",
";",
"if",
"(",
"count",
"(",
"$",
"queryParts",
")",
"-",
"1",
"!=",
"count",
"(",
"$",
"vars",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Number of variables supplied does not match number of ?s in the query!\"",
")",
";",
"}",
"$",
"finalQuery",
"=",
"$",
"queryParts",
"[",
"0",
"]",
";",
"$",
"queryPartNo",
"=",
"0",
";",
"foreach",
"(",
"$",
"vars",
"as",
"$",
"var",
")",
"{",
"$",
"var",
"=",
"$",
"this",
"->",
"escapifyVariable",
"(",
"$",
"var",
")",
";",
"$",
"queryPartNo",
"++",
";",
"$",
"finalQuery",
".=",
"$",
"var",
".",
"$",
"queryParts",
"[",
"$",
"queryPartNo",
"]",
";",
"}",
"return",
"$",
"finalQuery",
";",
"}"
] | fakey bound parameters | [
"fakey",
"bound",
"parameters"
] | 81bd2f9885ffe447fdfdd7f3b17886932a962e21 | https://github.com/tzlion/neodb/blob/81bd2f9885ffe447fdfdd7f3b17886932a962e21/NeoDb.php#L126-L146 |
4,504 | phlexible/phlexible | src/Phlexible/Bundle/MessageBundle/Entity/Repository/FilterRepository.php | FilterRepository.findApplicableFiltersByMessage | public function findApplicableFiltersByMessage(Message $message, $handler = null)
{
if ($handler) {
$filters = $this->findByHandler($handler);
} else {
$filters = $this->findAll();
}
$applicableFilters = [];
$checker = new MessageChecker();
foreach ($filters as $filter) {
if (!$checker->checkByFilter($filter, $message)) {
continue;
}
$applicableFilters[] = $filter;
}
return $applicableFilters;
} | php | public function findApplicableFiltersByMessage(Message $message, $handler = null)
{
if ($handler) {
$filters = $this->findByHandler($handler);
} else {
$filters = $this->findAll();
}
$applicableFilters = [];
$checker = new MessageChecker();
foreach ($filters as $filter) {
if (!$checker->checkByFilter($filter, $message)) {
continue;
}
$applicableFilters[] = $filter;
}
return $applicableFilters;
} | [
"public",
"function",
"findApplicableFiltersByMessage",
"(",
"Message",
"$",
"message",
",",
"$",
"handler",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"handler",
")",
"{",
"$",
"filters",
"=",
"$",
"this",
"->",
"findByHandler",
"(",
"$",
"handler",
")",
";",
"}",
"else",
"{",
"$",
"filters",
"=",
"$",
"this",
"->",
"findAll",
"(",
")",
";",
"}",
"$",
"applicableFilters",
"=",
"[",
"]",
";",
"$",
"checker",
"=",
"new",
"MessageChecker",
"(",
")",
";",
"foreach",
"(",
"$",
"filters",
"as",
"$",
"filter",
")",
"{",
"if",
"(",
"!",
"$",
"checker",
"->",
"checkByFilter",
"(",
"$",
"filter",
",",
"$",
"message",
")",
")",
"{",
"continue",
";",
"}",
"$",
"applicableFilters",
"[",
"]",
"=",
"$",
"filter",
";",
"}",
"return",
"$",
"applicableFilters",
";",
"}"
] | Return all filters applicable for a message.
@param Message $message
@param string $handler
@return Filter[] | [
"Return",
"all",
"filters",
"applicable",
"for",
"a",
"message",
"."
] | 132f24924c9bb0dbb6c1ea84db0a463f97fa3893 | https://github.com/phlexible/phlexible/blob/132f24924c9bb0dbb6c1ea84db0a463f97fa3893/src/Phlexible/Bundle/MessageBundle/Entity/Repository/FilterRepository.php#L55-L75 |
4,505 | clusterpoint/php-client-api | internals/lib_protobuf.inc.php | ProtoBuf_Field.FromBytes | public function FromBytes($stream, $offset) // ret <= 0 - error
{
$moved = 0;
$vi = 0;
$moved += $parsed = ProtoBuf_Bytes2Varint($stream, $offset + $moved, $vi);
if ($parsed <= 0)
return $parsed;
//echo "vi $vi\n";
$this->wt = ($vi & 0x07);
$this->fn = ($vi >> 3);
//echo "field wt " . $this->wt . " fn " . $this->fn . "\n";
switch ($this->wt)
{
case ProtoBuf_Field::ProtoBuf_WireType_Varint: // TODO: in case we need this information, create get function
$this->data = 0;
$moved += $parsed = ProtoBuf_Bytes2Varint($stream, $offset + $moved, $this->data);
break;
case ProtoBuf_Field::ProtoBuf_WireType_64bit:
$this->data = substr($stream, $offset + $moved, 8);
$high4 = ProtoBuf_Bytes2Fixed(substr($this->data, 4), 4);
if ($high4 == 0)
{
$this->fixed64_is_32bit = true;
$this->data = ProtoBuf_Bytes2Fixed($this->data, 4);
}
else
{
$this->fixed64_is_32bit = false;
$this->data = ProtoBuf_Bytes2Fixed($this->data, 8);
}
$moved += 8;
break;
case ProtoBuf_Field::ProtoBuf_WireType_LengthDelimited:
$moved += $parsed = ProtoBuf_Bytes2Varint($stream, $offset + $moved, $vi);
if ($parsed <= 0)
return $parsed;
$this->data = substr($stream, $offset + $moved, $vi);
$moved += $vi;
break;
/*case ProtoBuf_Field::ProtoBuf_WireType_StartGroup: // TODO: in case we need this information, create get function
break;
case ProtoBuf_Field::ProtoBuf_WireType_EndGroup: // TODO: in case we need this information, create get function
break;*/
case ProtoBuf_Field::ProtoBuf_WireType_32bit:
$this->data = substr($stream, $offset + $moved, 4);
$this->data = ProtoBuf_Bytes2Fixed($this->data, 4);
$moved += 4;
break;
default:
die("[lib_protobuf.inc] Unrecognized protobuf wire type '" . $this->wt . "'\n");
break;
}
return $moved;
} | php | public function FromBytes($stream, $offset) // ret <= 0 - error
{
$moved = 0;
$vi = 0;
$moved += $parsed = ProtoBuf_Bytes2Varint($stream, $offset + $moved, $vi);
if ($parsed <= 0)
return $parsed;
//echo "vi $vi\n";
$this->wt = ($vi & 0x07);
$this->fn = ($vi >> 3);
//echo "field wt " . $this->wt . " fn " . $this->fn . "\n";
switch ($this->wt)
{
case ProtoBuf_Field::ProtoBuf_WireType_Varint: // TODO: in case we need this information, create get function
$this->data = 0;
$moved += $parsed = ProtoBuf_Bytes2Varint($stream, $offset + $moved, $this->data);
break;
case ProtoBuf_Field::ProtoBuf_WireType_64bit:
$this->data = substr($stream, $offset + $moved, 8);
$high4 = ProtoBuf_Bytes2Fixed(substr($this->data, 4), 4);
if ($high4 == 0)
{
$this->fixed64_is_32bit = true;
$this->data = ProtoBuf_Bytes2Fixed($this->data, 4);
}
else
{
$this->fixed64_is_32bit = false;
$this->data = ProtoBuf_Bytes2Fixed($this->data, 8);
}
$moved += 8;
break;
case ProtoBuf_Field::ProtoBuf_WireType_LengthDelimited:
$moved += $parsed = ProtoBuf_Bytes2Varint($stream, $offset + $moved, $vi);
if ($parsed <= 0)
return $parsed;
$this->data = substr($stream, $offset + $moved, $vi);
$moved += $vi;
break;
/*case ProtoBuf_Field::ProtoBuf_WireType_StartGroup: // TODO: in case we need this information, create get function
break;
case ProtoBuf_Field::ProtoBuf_WireType_EndGroup: // TODO: in case we need this information, create get function
break;*/
case ProtoBuf_Field::ProtoBuf_WireType_32bit:
$this->data = substr($stream, $offset + $moved, 4);
$this->data = ProtoBuf_Bytes2Fixed($this->data, 4);
$moved += 4;
break;
default:
die("[lib_protobuf.inc] Unrecognized protobuf wire type '" . $this->wt . "'\n");
break;
}
return $moved;
} | [
"public",
"function",
"FromBytes",
"(",
"$",
"stream",
",",
"$",
"offset",
")",
"// ret <= 0 - error",
"{",
"$",
"moved",
"=",
"0",
";",
"$",
"vi",
"=",
"0",
";",
"$",
"moved",
"+=",
"$",
"parsed",
"=",
"ProtoBuf_Bytes2Varint",
"(",
"$",
"stream",
",",
"$",
"offset",
"+",
"$",
"moved",
",",
"$",
"vi",
")",
";",
"if",
"(",
"$",
"parsed",
"<=",
"0",
")",
"return",
"$",
"parsed",
";",
"//echo \"vi $vi\\n\";",
"$",
"this",
"->",
"wt",
"=",
"(",
"$",
"vi",
"&",
"0x07",
")",
";",
"$",
"this",
"->",
"fn",
"=",
"(",
"$",
"vi",
">>",
"3",
")",
";",
"//echo \"field wt \" . $this->wt . \" fn \" . $this->fn . \"\\n\";",
"switch",
"(",
"$",
"this",
"->",
"wt",
")",
"{",
"case",
"ProtoBuf_Field",
"::",
"ProtoBuf_WireType_Varint",
":",
"// TODO: in case we need this information, create get function",
"$",
"this",
"->",
"data",
"=",
"0",
";",
"$",
"moved",
"+=",
"$",
"parsed",
"=",
"ProtoBuf_Bytes2Varint",
"(",
"$",
"stream",
",",
"$",
"offset",
"+",
"$",
"moved",
",",
"$",
"this",
"->",
"data",
")",
";",
"break",
";",
"case",
"ProtoBuf_Field",
"::",
"ProtoBuf_WireType_64bit",
":",
"$",
"this",
"->",
"data",
"=",
"substr",
"(",
"$",
"stream",
",",
"$",
"offset",
"+",
"$",
"moved",
",",
"8",
")",
";",
"$",
"high4",
"=",
"ProtoBuf_Bytes2Fixed",
"(",
"substr",
"(",
"$",
"this",
"->",
"data",
",",
"4",
")",
",",
"4",
")",
";",
"if",
"(",
"$",
"high4",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"fixed64_is_32bit",
"=",
"true",
";",
"$",
"this",
"->",
"data",
"=",
"ProtoBuf_Bytes2Fixed",
"(",
"$",
"this",
"->",
"data",
",",
"4",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"fixed64_is_32bit",
"=",
"false",
";",
"$",
"this",
"->",
"data",
"=",
"ProtoBuf_Bytes2Fixed",
"(",
"$",
"this",
"->",
"data",
",",
"8",
")",
";",
"}",
"$",
"moved",
"+=",
"8",
";",
"break",
";",
"case",
"ProtoBuf_Field",
"::",
"ProtoBuf_WireType_LengthDelimited",
":",
"$",
"moved",
"+=",
"$",
"parsed",
"=",
"ProtoBuf_Bytes2Varint",
"(",
"$",
"stream",
",",
"$",
"offset",
"+",
"$",
"moved",
",",
"$",
"vi",
")",
";",
"if",
"(",
"$",
"parsed",
"<=",
"0",
")",
"return",
"$",
"parsed",
";",
"$",
"this",
"->",
"data",
"=",
"substr",
"(",
"$",
"stream",
",",
"$",
"offset",
"+",
"$",
"moved",
",",
"$",
"vi",
")",
";",
"$",
"moved",
"+=",
"$",
"vi",
";",
"break",
";",
"/*case ProtoBuf_Field::ProtoBuf_WireType_StartGroup: // TODO: in case we need this information, create get function\n\t\t\t\tbreak;\n\t\t\tcase ProtoBuf_Field::ProtoBuf_WireType_EndGroup: // TODO: in case we need this information, create get function\n\t\t\t\tbreak;*/",
"case",
"ProtoBuf_Field",
"::",
"ProtoBuf_WireType_32bit",
":",
"$",
"this",
"->",
"data",
"=",
"substr",
"(",
"$",
"stream",
",",
"$",
"offset",
"+",
"$",
"moved",
",",
"4",
")",
";",
"$",
"this",
"->",
"data",
"=",
"ProtoBuf_Bytes2Fixed",
"(",
"$",
"this",
"->",
"data",
",",
"4",
")",
";",
"$",
"moved",
"+=",
"4",
";",
"break",
";",
"default",
":",
"die",
"(",
"\"[lib_protobuf.inc] Unrecognized protobuf wire type '\"",
".",
"$",
"this",
"->",
"wt",
".",
"\"'\\n\"",
")",
";",
"break",
";",
"}",
"return",
"$",
"moved",
";",
"}"
] | if fixed64 is in fact 32bit value, this is just to improve compatibility with 32bit php, which does not support 64 | [
"if",
"fixed64",
"is",
"in",
"fact",
"32bit",
"value",
"this",
"is",
"just",
"to",
"improve",
"compatibility",
"with",
"32bit",
"php",
"which",
"does",
"not",
"support",
"64"
] | 44c98a727271c91bb9b9a70975ec4f69d99e64e7 | https://github.com/clusterpoint/php-client-api/blob/44c98a727271c91bb9b9a70975ec4f69d99e64e7/internals/lib_protobuf.inc.php#L86-L142 |
4,506 | EmilSjunnesson/rss | src/library/SimplePie.php | SimplePie.set_feed_url | public function set_feed_url($url)
{
$this->multifeed_url = array();
if (is_array($url))
{
foreach ($url as $value)
{
$this->multifeed_url[] = $this->registry->call('Misc', 'fix_protocol', array($value, 1));
}
}
else
{
$this->feed_url = $this->registry->call('Misc', 'fix_protocol', array($url, 1));
}
} | php | public function set_feed_url($url)
{
$this->multifeed_url = array();
if (is_array($url))
{
foreach ($url as $value)
{
$this->multifeed_url[] = $this->registry->call('Misc', 'fix_protocol', array($value, 1));
}
}
else
{
$this->feed_url = $this->registry->call('Misc', 'fix_protocol', array($url, 1));
}
} | [
"public",
"function",
"set_feed_url",
"(",
"$",
"url",
")",
"{",
"$",
"this",
"->",
"multifeed_url",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"url",
")",
")",
"{",
"foreach",
"(",
"$",
"url",
"as",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"multifeed_url",
"[",
"]",
"=",
"$",
"this",
"->",
"registry",
"->",
"call",
"(",
"'Misc'",
",",
"'fix_protocol'",
",",
"array",
"(",
"$",
"value",
",",
"1",
")",
")",
";",
"}",
"}",
"else",
"{",
"$",
"this",
"->",
"feed_url",
"=",
"$",
"this",
"->",
"registry",
"->",
"call",
"(",
"'Misc'",
",",
"'fix_protocol'",
",",
"array",
"(",
"$",
"url",
",",
"1",
")",
")",
";",
"}",
"}"
] | Set the URL of the feed you want to parse
This allows you to enter the URL of the feed you want to parse, or the
website you want to try to use auto-discovery on. This takes priority
over any set raw data.
You can set multiple feeds to mash together by passing an array instead
of a string for the $url. Remember that with each additional feed comes
additional processing and resources.
@since 1.0 Preview Release
@see set_raw_data()
@param string|array $url This is the URL (or array of URLs) that you want to parse. | [
"Set",
"the",
"URL",
"of",
"the",
"feed",
"you",
"want",
"to",
"parse"
] | 51b75c010ab0acbde18559eb0f5d93fce98cc393 | https://github.com/EmilSjunnesson/rss/blob/51b75c010ab0acbde18559eb0f5d93fce98cc393/src/library/SimplePie.php#L717-L731 |
4,507 | EmilSjunnesson/rss | src/library/SimplePie.php | SimplePie.set_stupidly_fast | public function set_stupidly_fast($set = false)
{
if ($set)
{
$this->enable_order_by_date(false);
$this->remove_div(false);
$this->strip_comments(false);
$this->strip_htmltags(false);
$this->strip_attributes(false);
$this->set_image_handler(false);
}
} | php | public function set_stupidly_fast($set = false)
{
if ($set)
{
$this->enable_order_by_date(false);
$this->remove_div(false);
$this->strip_comments(false);
$this->strip_htmltags(false);
$this->strip_attributes(false);
$this->set_image_handler(false);
}
} | [
"public",
"function",
"set_stupidly_fast",
"(",
"$",
"set",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"set",
")",
"{",
"$",
"this",
"->",
"enable_order_by_date",
"(",
"false",
")",
";",
"$",
"this",
"->",
"remove_div",
"(",
"false",
")",
";",
"$",
"this",
"->",
"strip_comments",
"(",
"false",
")",
";",
"$",
"this",
"->",
"strip_htmltags",
"(",
"false",
")",
";",
"$",
"this",
"->",
"strip_attributes",
"(",
"false",
")",
";",
"$",
"this",
"->",
"set_image_handler",
"(",
"false",
")",
";",
"}",
"}"
] | Set options to make SP as fast as possible
Forgoes a substantial amount of data sanitization in favor of speed. This
turns SimplePie into a dumb parser of feeds.
@param bool $set Whether to set them or not | [
"Set",
"options",
"to",
"make",
"SP",
"as",
"fast",
"as",
"possible"
] | 51b75c010ab0acbde18559eb0f5d93fce98cc393 | https://github.com/EmilSjunnesson/rss/blob/51b75c010ab0acbde18559eb0f5d93fce98cc393/src/library/SimplePie.php#L1066-L1077 |
4,508 | mikeshiyan/lite-sql-insert | src/Iterate/Scenario/BaseInsertTrait.php | BaseInsertTrait.preRun | public function preRun(): void {
$this->insert = $this->getConnection()->insert($this->getTable(), $this->getFields());
} | php | public function preRun(): void {
$this->insert = $this->getConnection()->insert($this->getTable(), $this->getFields());
} | [
"public",
"function",
"preRun",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"insert",
"=",
"$",
"this",
"->",
"getConnection",
"(",
")",
"->",
"insert",
"(",
"$",
"this",
"->",
"getTable",
"(",
")",
",",
"$",
"this",
"->",
"getFields",
"(",
")",
")",
";",
"}"
] | Prepares a statement and initiates a transaction in the pre-run phase.
@see \Shiyan\Iterate\Scenario\ScenarioInterface::preRun() | [
"Prepares",
"a",
"statement",
"and",
"initiates",
"a",
"transaction",
"in",
"the",
"pre",
"-",
"run",
"phase",
"."
] | c0c26b7976d61ba5a95561363824c03ba31cee3b | https://github.com/mikeshiyan/lite-sql-insert/blob/c0c26b7976d61ba5a95561363824c03ba31cee3b/src/Iterate/Scenario/BaseInsertTrait.php#L127-L129 |
4,509 | praxisnetau/silverware-social | src/Buttons/EmailSharingButton.php | EmailSharingButton.getMessage | public function getMessage()
{
if ($this->EmailMessage) {
return sprintf('%s %s', rtrim($this->EmailMessage), $this->getCurrentPageLink());
}
return $this->getCurrentPageLink();
} | php | public function getMessage()
{
if ($this->EmailMessage) {
return sprintf('%s %s', rtrim($this->EmailMessage), $this->getCurrentPageLink());
}
return $this->getCurrentPageLink();
} | [
"public",
"function",
"getMessage",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"EmailMessage",
")",
"{",
"return",
"sprintf",
"(",
"'%s %s'",
",",
"rtrim",
"(",
"$",
"this",
"->",
"EmailMessage",
")",
",",
"$",
"this",
"->",
"getCurrentPageLink",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"getCurrentPageLink",
"(",
")",
";",
"}"
] | Answers the message for the email.
@return string | [
"Answers",
"the",
"message",
"for",
"the",
"email",
"."
] | 99d9092dae674ef0898bbee99386ae356cf6d3c3 | https://github.com/praxisnetau/silverware-social/blob/99d9092dae674ef0898bbee99386ae356cf6d3c3/src/Buttons/EmailSharingButton.php#L190-L197 |
4,510 | praxisnetau/silverware-social | src/Buttons/EmailSharingButton.php | EmailSharingButton.getButtonLink | public function getButtonLink()
{
return sprintf(
'mailto:?subject=%s&body=%s',
Convert::raw2mailto($this->getSubject()),
Convert::raw2mailto($this->getMessage())
);
} | php | public function getButtonLink()
{
return sprintf(
'mailto:?subject=%s&body=%s',
Convert::raw2mailto($this->getSubject()),
Convert::raw2mailto($this->getMessage())
);
} | [
"public",
"function",
"getButtonLink",
"(",
")",
"{",
"return",
"sprintf",
"(",
"'mailto:?subject=%s&body=%s'",
",",
"Convert",
"::",
"raw2mailto",
"(",
"$",
"this",
"->",
"getSubject",
"(",
")",
")",
",",
"Convert",
"::",
"raw2mailto",
"(",
"$",
"this",
"->",
"getMessage",
"(",
")",
")",
")",
";",
"}"
] | Answers the link for the sharing button.
@return string | [
"Answers",
"the",
"link",
"for",
"the",
"sharing",
"button",
"."
] | 99d9092dae674ef0898bbee99386ae356cf6d3c3 | https://github.com/praxisnetau/silverware-social/blob/99d9092dae674ef0898bbee99386ae356cf6d3c3/src/Buttons/EmailSharingButton.php#L204-L211 |
4,511 | HeroicTeam/m | Foundation/Core.php | Core.bind | public function bind($name, \Closure $callable, $singleton = false)
{
$this->_ioc[$name] = array(
'closure' => $callable,
'singleton' => (bool) $singleton,
'instance' => null
);
return $this;
} | php | public function bind($name, \Closure $callable, $singleton = false)
{
$this->_ioc[$name] = array(
'closure' => $callable,
'singleton' => (bool) $singleton,
'instance' => null
);
return $this;
} | [
"public",
"function",
"bind",
"(",
"$",
"name",
",",
"\\",
"Closure",
"$",
"callable",
",",
"$",
"singleton",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"_ioc",
"[",
"$",
"name",
"]",
"=",
"array",
"(",
"'closure'",
"=>",
"$",
"callable",
",",
"'singleton'",
"=>",
"(",
"bool",
")",
"$",
"singleton",
",",
"'instance'",
"=>",
"null",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Registers a new object container.
@param string $name
@param \Closure $callable
@param bool $singleton
@return \m\Foundation\Core | [
"Registers",
"a",
"new",
"object",
"container",
"."
] | daa6d5956ee6c989379fe5fae39feccc59cf4add | https://github.com/HeroicTeam/m/blob/daa6d5956ee6c989379fe5fae39feccc59cf4add/Foundation/Core.php#L51-L60 |
4,512 | HeroicTeam/m | Foundation/Core.php | Core.make | public function make($name, array $params = array(), $force = false)
{
if (isset($this->_ioc[$name])) {
// If a singleton instance exists, return it
if ($this->_ioc[$name]['instance'] && !$force)
return $this->_ioc[$name]['instance'];
// Include an instance of this object as the final argument
$params[] = $this;
// Call the stored container
$result = call_user_func_array($this->_ioc[$name]['closure'], $params);
// If this is supposed to be a singleton, store it
if ($this->_ioc[$name]['singleton'])
$this->_ioc[$name]['instance'] = $result;
return $result;
}
return null;
} | php | public function make($name, array $params = array(), $force = false)
{
if (isset($this->_ioc[$name])) {
// If a singleton instance exists, return it
if ($this->_ioc[$name]['instance'] && !$force)
return $this->_ioc[$name]['instance'];
// Include an instance of this object as the final argument
$params[] = $this;
// Call the stored container
$result = call_user_func_array($this->_ioc[$name]['closure'], $params);
// If this is supposed to be a singleton, store it
if ($this->_ioc[$name]['singleton'])
$this->_ioc[$name]['instance'] = $result;
return $result;
}
return null;
} | [
"public",
"function",
"make",
"(",
"$",
"name",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_ioc",
"[",
"$",
"name",
"]",
")",
")",
"{",
"// If a singleton instance exists, return it",
"if",
"(",
"$",
"this",
"->",
"_ioc",
"[",
"$",
"name",
"]",
"[",
"'instance'",
"]",
"&&",
"!",
"$",
"force",
")",
"return",
"$",
"this",
"->",
"_ioc",
"[",
"$",
"name",
"]",
"[",
"'instance'",
"]",
";",
"// Include an instance of this object as the final argument",
"$",
"params",
"[",
"]",
"=",
"$",
"this",
";",
"// Call the stored container",
"$",
"result",
"=",
"call_user_func_array",
"(",
"$",
"this",
"->",
"_ioc",
"[",
"$",
"name",
"]",
"[",
"'closure'",
"]",
",",
"$",
"params",
")",
";",
"// If this is supposed to be a singleton, store it",
"if",
"(",
"$",
"this",
"->",
"_ioc",
"[",
"$",
"name",
"]",
"[",
"'singleton'",
"]",
")",
"$",
"this",
"->",
"_ioc",
"[",
"$",
"name",
"]",
"[",
"'instance'",
"]",
"=",
"$",
"result",
";",
"return",
"$",
"result",
";",
"}",
"return",
"null",
";",
"}"
] | Resolves a set container and returns the result.
@param string $name
@param array $params
@param bool $force
@return object|null | [
"Resolves",
"a",
"set",
"container",
"and",
"returns",
"the",
"result",
"."
] | daa6d5956ee6c989379fe5fae39feccc59cf4add | https://github.com/HeroicTeam/m/blob/daa6d5956ee6c989379fe5fae39feccc59cf4add/Foundation/Core.php#L82-L104 |
4,513 | HeroicTeam/m | Foundation/Core.php | Core.on | public function on($event, $callable)
{
if (!is_callable($callable) && !$callable instanceof \Closure)
throw new \InvalidArgumentException();
if (!isset($this->_hooks[$event]))
$this->_hooks[$event] = array();
$this->_hooks[$event][] = $callable;
return $this;
} | php | public function on($event, $callable)
{
if (!is_callable($callable) && !$callable instanceof \Closure)
throw new \InvalidArgumentException();
if (!isset($this->_hooks[$event]))
$this->_hooks[$event] = array();
$this->_hooks[$event][] = $callable;
return $this;
} | [
"public",
"function",
"on",
"(",
"$",
"event",
",",
"$",
"callable",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callable",
")",
"&&",
"!",
"$",
"callable",
"instanceof",
"\\",
"Closure",
")",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_hooks",
"[",
"$",
"event",
"]",
")",
")",
"$",
"this",
"->",
"_hooks",
"[",
"$",
"event",
"]",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"_hooks",
"[",
"$",
"event",
"]",
"[",
"]",
"=",
"$",
"callable",
";",
"return",
"$",
"this",
";",
"}"
] | Binds a new callable action to a hook event.
@param string $event
@param \Closure|callable $callable
@return \m\Foundation\Core
@throws \InvalidArgumentException | [
"Binds",
"a",
"new",
"callable",
"action",
"to",
"a",
"hook",
"event",
"."
] | daa6d5956ee6c989379fe5fae39feccc59cf4add | https://github.com/HeroicTeam/m/blob/daa6d5956ee6c989379fe5fae39feccc59cf4add/Foundation/Core.php#L149-L160 |
4,514 | twister-php/twister | src/DateTime.php | DateTime.setDateTime | public function setDateTime(...$params)
{
switch (count($params))
{
case 5:
// $second is optional in setTime()
// array_push($params, 0); // I don't think we need this ... array_slice should pass 2 params to setTime()!
// fallthrough
case 6:
return parent::setDate(...array_slice($params, 0, 3))->setTime(...array_slice($params, 3, 3));
case 1:
$param = $params[0];
if (is_string($param))
{
if (preg_match('~(\d\d\d\d)-(\d\d)-(\d\d) ([012]\d):([0-5]\d):([0-5]\d)~', $param, $values) === 1) {
return parent::setDate(...array_slice($values, 1, 3))->setTime(...array_slice($values, 4, 3));
}
throw new \InvalidArgumentException("Invalid DateTime format `{$param}` passed to setDateTime(); expecting `YYYY-MM-DD HH:MM:SS`");
}
}
throw new \InvalidArgumentException('Invalid number or type of params for setDateTime(); requires one DateTime string or 6x params for year, month, day, hour, minute, second');
} | php | public function setDateTime(...$params)
{
switch (count($params))
{
case 5:
// $second is optional in setTime()
// array_push($params, 0); // I don't think we need this ... array_slice should pass 2 params to setTime()!
// fallthrough
case 6:
return parent::setDate(...array_slice($params, 0, 3))->setTime(...array_slice($params, 3, 3));
case 1:
$param = $params[0];
if (is_string($param))
{
if (preg_match('~(\d\d\d\d)-(\d\d)-(\d\d) ([012]\d):([0-5]\d):([0-5]\d)~', $param, $values) === 1) {
return parent::setDate(...array_slice($values, 1, 3))->setTime(...array_slice($values, 4, 3));
}
throw new \InvalidArgumentException("Invalid DateTime format `{$param}` passed to setDateTime(); expecting `YYYY-MM-DD HH:MM:SS`");
}
}
throw new \InvalidArgumentException('Invalid number or type of params for setDateTime(); requires one DateTime string or 6x params for year, month, day, hour, minute, second');
} | [
"public",
"function",
"setDateTime",
"(",
"...",
"$",
"params",
")",
"{",
"switch",
"(",
"count",
"(",
"$",
"params",
")",
")",
"{",
"case",
"5",
":",
"//\t$second is optional in setTime()\r",
"//\tarray_push($params, 0);\t\t//\tI don't think we need this ... array_slice should pass 2 params to setTime()!\r",
"//\tfallthrough\r",
"case",
"6",
":",
"return",
"parent",
"::",
"setDate",
"(",
"...",
"array_slice",
"(",
"$",
"params",
",",
"0",
",",
"3",
")",
")",
"->",
"setTime",
"(",
"...",
"array_slice",
"(",
"$",
"params",
",",
"3",
",",
"3",
")",
")",
";",
"case",
"1",
":",
"$",
"param",
"=",
"$",
"params",
"[",
"0",
"]",
";",
"if",
"(",
"is_string",
"(",
"$",
"param",
")",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'~(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d) ([012]\\d):([0-5]\\d):([0-5]\\d)~'",
",",
"$",
"param",
",",
"$",
"values",
")",
"===",
"1",
")",
"{",
"return",
"parent",
"::",
"setDate",
"(",
"...",
"array_slice",
"(",
"$",
"values",
",",
"1",
",",
"3",
")",
")",
"->",
"setTime",
"(",
"...",
"array_slice",
"(",
"$",
"values",
",",
"4",
",",
"3",
")",
")",
";",
"}",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Invalid DateTime format `{$param}` passed to setDateTime(); expecting `YYYY-MM-DD HH:MM:SS`\"",
")",
";",
"}",
"}",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Invalid number or type of params for setDateTime(); requires one DateTime string or 6x params for year, month, day, hour, minute, second'",
")",
";",
"}"
] | Set the date and time all together
This function also supports sending a single DateTime string in `YYYY-MM-DD HH:MM:SS` format
@param int|string $year | $datetime string
@param int $month
@param int $day
@param int $hour
@param int $minute
@param int $second = 0
@throws \InvalidArgumentException
@return static | [
"Set",
"the",
"date",
"and",
"time",
"all",
"together"
] | c06ea2650331faf11590c017c850dc5f0bbc5c13 | https://github.com/twister-php/twister/blob/c06ea2650331faf11590c017c850dc5f0bbc5c13/src/DateTime.php#L327-L348 |
4,515 | twister-php/twister | src/DateTime.php | DateTime.createInterval | public static function createInterval($interval)
{
return isset(static::$intervals[$interval])
? static::$intervals[$interval]
: static::$intervals[$interval] = $interval[0] === 'P'
? new \DateInterval($interval)
: \DateInterval::createFromDateString($interval);
} | php | public static function createInterval($interval)
{
return isset(static::$intervals[$interval])
? static::$intervals[$interval]
: static::$intervals[$interval] = $interval[0] === 'P'
? new \DateInterval($interval)
: \DateInterval::createFromDateString($interval);
} | [
"public",
"static",
"function",
"createInterval",
"(",
"$",
"interval",
")",
"{",
"return",
"isset",
"(",
"static",
"::",
"$",
"intervals",
"[",
"$",
"interval",
"]",
")",
"?",
"static",
"::",
"$",
"intervals",
"[",
"$",
"interval",
"]",
":",
"static",
"::",
"$",
"intervals",
"[",
"$",
"interval",
"]",
"=",
"$",
"interval",
"[",
"0",
"]",
"===",
"'P'",
"?",
"new",
"\\",
"DateInterval",
"(",
"$",
"interval",
")",
":",
"\\",
"DateInterval",
"::",
"createFromDateString",
"(",
"$",
"interval",
")",
";",
"}"
] | Create a DateInterval from ISO 8601 duration string OR relative parts!
This method does a small test on the $interval string for `[0] === 'P'`
@link http://php.net/manual/en/dateinterval.construct.php
@link http://php.net/manual/en/dateinterval.createfromdatestring.php
@link http://php.net/manual/en/datetime.formats.relative.php
This function had a significant 30%~50% performance increase over ->modify()
still had about 20% increase over creating new DateInterval values in a loop
@param string $interval Interval string in relative parts format or ISO 8601 duration
@return DateInterval | [
"Create",
"a",
"DateInterval",
"from",
"ISO",
"8601",
"duration",
"string",
"OR",
"relative",
"parts!"
] | c06ea2650331faf11590c017c850dc5f0bbc5c13 | https://github.com/twister-php/twister/blob/c06ea2650331faf11590c017c850dc5f0bbc5c13/src/DateTime.php#L387-L394 |
4,516 | twister-php/twister | src/DateTime.php | DateTime.createIntervalFromSpec | public static function createIntervalFromSpec($interval_spec)
{
return isset(static::$intervals[$interval_spec])
? static::$intervals[$interval_spec]
: static::$intervals[$interval_spec] = new \DateInterval($interval_spec);
} | php | public static function createIntervalFromSpec($interval_spec)
{
return isset(static::$intervals[$interval_spec])
? static::$intervals[$interval_spec]
: static::$intervals[$interval_spec] = new \DateInterval($interval_spec);
} | [
"public",
"static",
"function",
"createIntervalFromSpec",
"(",
"$",
"interval_spec",
")",
"{",
"return",
"isset",
"(",
"static",
"::",
"$",
"intervals",
"[",
"$",
"interval_spec",
"]",
")",
"?",
"static",
"::",
"$",
"intervals",
"[",
"$",
"interval_spec",
"]",
":",
"static",
"::",
"$",
"intervals",
"[",
"$",
"interval_spec",
"]",
"=",
"new",
"\\",
"DateInterval",
"(",
"$",
"interval_spec",
")",
";",
"}"
] | Create a DateInterval from ISO 8601 duration string
@link http://php.net/manual/en/dateinterval.construct.php
@return DateInterval | [
"Create",
"a",
"DateInterval",
"from",
"ISO",
"8601",
"duration",
"string"
] | c06ea2650331faf11590c017c850dc5f0bbc5c13 | https://github.com/twister-php/twister/blob/c06ea2650331faf11590c017c850dc5f0bbc5c13/src/DateTime.php#L404-L409 |
4,517 | twister-php/twister | src/DateTime.php | DateTime.createIntervalFromDateString | public static function createIntervalFromDateString($time)
{
return isset(static::$intervals[$time])
? static::$intervals[$time]
: static::$intervals[$time] = \DateInterval::createFromDateString($time);
} | php | public static function createIntervalFromDateString($time)
{
return isset(static::$intervals[$time])
? static::$intervals[$time]
: static::$intervals[$time] = \DateInterval::createFromDateString($time);
} | [
"public",
"static",
"function",
"createIntervalFromDateString",
"(",
"$",
"time",
")",
"{",
"return",
"isset",
"(",
"static",
"::",
"$",
"intervals",
"[",
"$",
"time",
"]",
")",
"?",
"static",
"::",
"$",
"intervals",
"[",
"$",
"time",
"]",
":",
"static",
"::",
"$",
"intervals",
"[",
"$",
"time",
"]",
"=",
"\\",
"DateInterval",
"::",
"createFromDateString",
"(",
"$",
"time",
")",
";",
"}"
] | Create a DateInterval from a string of relative parts
`Uses the normal date parsers and sets up a DateInterval from the relative parts of the parsed string.`
@link http://php.net/manual/en/dateinterval.createfromdatestring.php
@link http://php.net/manual/en/datetime.formats.relative.php
The difference between `DateInterval::createFromDateString` and this method,
is that this method includes an interval cache.
Every interval string created is cached, so loops are faster!
@return DateInterval | [
"Create",
"a",
"DateInterval",
"from",
"a",
"string",
"of",
"relative",
"parts"
] | c06ea2650331faf11590c017c850dc5f0bbc5c13 | https://github.com/twister-php/twister/blob/c06ea2650331faf11590c017c850dc5f0bbc5c13/src/DateTime.php#L426-L431 |
4,518 | twister-php/twister | src/DateTime.php | DateTime.create | public static function create(...$params)
{
switch (count($params))
{
case 1: // '2017-01-01'
case 2: // '2017-01-01', $tz
case 3: // $year, $month, $day
case 4: // $year, $month, $day, $tz
case 5: // $year, $month, $day, $hour, $minute // not useful
case 6: // $year, $month, $day, $hour, $minute, $second
case 7: // $year, $month, $day, $hour, $minute, $second, $timezone
}
return new static(new \DateTime($time, $timezone === null ? self::$utc : (is_string($timezone) ? new \DateTimeZone($timezone) : $timezone)));
} | php | public static function create(...$params)
{
switch (count($params))
{
case 1: // '2017-01-01'
case 2: // '2017-01-01', $tz
case 3: // $year, $month, $day
case 4: // $year, $month, $day, $tz
case 5: // $year, $month, $day, $hour, $minute // not useful
case 6: // $year, $month, $day, $hour, $minute, $second
case 7: // $year, $month, $day, $hour, $minute, $second, $timezone
}
return new static(new \DateTime($time, $timezone === null ? self::$utc : (is_string($timezone) ? new \DateTimeZone($timezone) : $timezone)));
} | [
"public",
"static",
"function",
"create",
"(",
"...",
"$",
"params",
")",
"{",
"switch",
"(",
"count",
"(",
"$",
"params",
")",
")",
"{",
"case",
"1",
":",
"//\t'2017-01-01'\r",
"case",
"2",
":",
"//\t'2017-01-01', $tz\r",
"case",
"3",
":",
"//\t$year, $month, $day\r",
"case",
"4",
":",
"//\t$year, $month, $day, $tz\r",
"case",
"5",
":",
"//\t$year, $month, $day, $hour, $minute\t\t\t\t\t\t\t// not useful\r",
"case",
"6",
":",
"//\t$year, $month, $day, $hour, $minute, $second\r",
"case",
"7",
":",
"//\t$year, $month, $day, $hour, $minute, $second, $timezone\r",
"}",
"return",
"new",
"static",
"(",
"new",
"\\",
"DateTime",
"(",
"$",
"time",
",",
"$",
"timezone",
"===",
"null",
"?",
"self",
"::",
"$",
"utc",
":",
"(",
"is_string",
"(",
"$",
"timezone",
")",
"?",
"new",
"\\",
"DateTimeZone",
"(",
"$",
"timezone",
")",
":",
"$",
"timezone",
")",
")",
")",
";",
"}"
] | Create a new Twister\DateTime instance from a specific date and time.
If any of $year, $month or $day are set to null their now() values will be used.
If $hour is null it will be set to its now() value and the default
values for $minute and $second will be their now() values.
If $hour is not null then the default values for $minute and $second will be 0.
@link http://php.net/manual/en/datetime.construct.php
@param int|null $year
@param int|null $month
@param int|null $day
@param int|null $hour
@param int|null $minute
@param int|null $second
@param \DateTimeZone|string|null $tz
@return static | [
"Create",
"a",
"new",
"Twister",
"\\",
"DateTime",
"instance",
"from",
"a",
"specific",
"date",
"and",
"time",
"."
] | c06ea2650331faf11590c017c850dc5f0bbc5c13 | https://github.com/twister-php/twister/blob/c06ea2650331faf11590c017c850dc5f0bbc5c13/src/DateTime.php#L576-L590 |
4,519 | twister-php/twister | src/DateTime.php | DateTime.__parse | public static function __parse($date, &$result = null) // WARNING I don't think I need this ...
{
$result = date_parse($date);
if ($result['warning_count'] === 0 && $result['error_count'] === 0) // halt, I think there is a faster way to build the DateTime ... just parse it here, check for errors ... then just build it ....
{
$year = $result['year'];
$month = $result['month'];
$day = $result['day'];
$hour = $result['hour'];
$minute = $result['minute'];
$second = $result['second'];
$fraction = $result['fraction'];
$format = null;
$value = null;
if (is_numeric($year) && is_numeric($month) && is_numeric($day))
{
$value = str_pad($year, 4, '0', STR_PAD_LEFT) . str_pad($month, 3, '-0', STR_PAD_LEFT) . str_pad($day, 3, '-0', STR_PAD_LEFT);
$format = 'Y-m-d';
}
if (is_numeric($hour) && is_numeric($minute) && is_numeric($second))
{
$value .= str_pad($hour, 2, '0', STR_PAD_LEFT) . str_pad($minute, 3, ':0', STR_PAD_LEFT) . str_pad($second, 3, ':0', STR_PAD_LEFT);
$format .= 'H:i:s';
}
$is_localtime = $result['is_localtime'];
if ($is_localtime)
{
}
}
return null;
} | php | public static function __parse($date, &$result = null) // WARNING I don't think I need this ...
{
$result = date_parse($date);
if ($result['warning_count'] === 0 && $result['error_count'] === 0) // halt, I think there is a faster way to build the DateTime ... just parse it here, check for errors ... then just build it ....
{
$year = $result['year'];
$month = $result['month'];
$day = $result['day'];
$hour = $result['hour'];
$minute = $result['minute'];
$second = $result['second'];
$fraction = $result['fraction'];
$format = null;
$value = null;
if (is_numeric($year) && is_numeric($month) && is_numeric($day))
{
$value = str_pad($year, 4, '0', STR_PAD_LEFT) . str_pad($month, 3, '-0', STR_PAD_LEFT) . str_pad($day, 3, '-0', STR_PAD_LEFT);
$format = 'Y-m-d';
}
if (is_numeric($hour) && is_numeric($minute) && is_numeric($second))
{
$value .= str_pad($hour, 2, '0', STR_PAD_LEFT) . str_pad($minute, 3, ':0', STR_PAD_LEFT) . str_pad($second, 3, ':0', STR_PAD_LEFT);
$format .= 'H:i:s';
}
$is_localtime = $result['is_localtime'];
if ($is_localtime)
{
}
}
return null;
} | [
"public",
"static",
"function",
"__parse",
"(",
"$",
"date",
",",
"&",
"$",
"result",
"=",
"null",
")",
"//\tWARNING I don't think I need this ...\r",
"{",
"$",
"result",
"=",
"date_parse",
"(",
"$",
"date",
")",
";",
"if",
"(",
"$",
"result",
"[",
"'warning_count'",
"]",
"===",
"0",
"&&",
"$",
"result",
"[",
"'error_count'",
"]",
"===",
"0",
")",
"//\thalt, I think there is a faster way to build the DateTime ... just parse it here, check for errors ... then just build it ....\r",
"{",
"$",
"year",
"=",
"$",
"result",
"[",
"'year'",
"]",
";",
"$",
"month",
"=",
"$",
"result",
"[",
"'month'",
"]",
";",
"$",
"day",
"=",
"$",
"result",
"[",
"'day'",
"]",
";",
"$",
"hour",
"=",
"$",
"result",
"[",
"'hour'",
"]",
";",
"$",
"minute",
"=",
"$",
"result",
"[",
"'minute'",
"]",
";",
"$",
"second",
"=",
"$",
"result",
"[",
"'second'",
"]",
";",
"$",
"fraction",
"=",
"$",
"result",
"[",
"'fraction'",
"]",
";",
"$",
"format",
"=",
"null",
";",
"$",
"value",
"=",
"null",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"year",
")",
"&&",
"is_numeric",
"(",
"$",
"month",
")",
"&&",
"is_numeric",
"(",
"$",
"day",
")",
")",
"{",
"$",
"value",
"=",
"str_pad",
"(",
"$",
"year",
",",
"4",
",",
"'0'",
",",
"STR_PAD_LEFT",
")",
".",
"str_pad",
"(",
"$",
"month",
",",
"3",
",",
"'-0'",
",",
"STR_PAD_LEFT",
")",
".",
"str_pad",
"(",
"$",
"day",
",",
"3",
",",
"'-0'",
",",
"STR_PAD_LEFT",
")",
";",
"$",
"format",
"=",
"'Y-m-d'",
";",
"}",
"if",
"(",
"is_numeric",
"(",
"$",
"hour",
")",
"&&",
"is_numeric",
"(",
"$",
"minute",
")",
"&&",
"is_numeric",
"(",
"$",
"second",
")",
")",
"{",
"$",
"value",
".=",
"str_pad",
"(",
"$",
"hour",
",",
"2",
",",
"'0'",
",",
"STR_PAD_LEFT",
")",
".",
"str_pad",
"(",
"$",
"minute",
",",
"3",
",",
"':0'",
",",
"STR_PAD_LEFT",
")",
".",
"str_pad",
"(",
"$",
"second",
",",
"3",
",",
"':0'",
",",
"STR_PAD_LEFT",
")",
";",
"$",
"format",
".=",
"'H:i:s'",
";",
"}",
"$",
"is_localtime",
"=",
"$",
"result",
"[",
"'is_localtime'",
"]",
";",
"if",
"(",
"$",
"is_localtime",
")",
"{",
"}",
"}",
"return",
"null",
";",
"}"
] | Wrapper around date_parse
@link http://php.net/manual/en/function.date-parse.php
@param mixed $str Value to modify, after being cast to string
@param string $encoding The character encoding
@throws \InvalidArgumentException if an array or object without a
__toString method is passed as the first argument
@return static|null | [
"Wrapper",
"around",
"date_parse"
] | c06ea2650331faf11590c017c850dc5f0bbc5c13 | https://github.com/twister-php/twister/blob/c06ea2650331faf11590c017c850dc5f0bbc5c13/src/DateTime.php#L607-L645 |
4,520 | twister-php/twister | src/DateTime.php | DateTime.md5 | public function md5($format = null, $raw_output = false)
{
return hash('md5', parent::format($format === null ? static::$format : $format), $raw_output);
} | php | public function md5($format = null, $raw_output = false)
{
return hash('md5', parent::format($format === null ? static::$format : $format), $raw_output);
} | [
"public",
"function",
"md5",
"(",
"$",
"format",
"=",
"null",
",",
"$",
"raw_output",
"=",
"false",
")",
"{",
"return",
"hash",
"(",
"'md5'",
",",
"parent",
"::",
"format",
"(",
"$",
"format",
"===",
"null",
"?",
"static",
"::",
"$",
"format",
":",
"$",
"format",
")",
",",
"$",
"raw_output",
")",
";",
"}"
] | Gets an MD5 hash code of the internal date. Return result can be raw binary or hex by default
@param bool|null $raw_output return the raw binary bytes or hex values of the md5 hash
@return string | [
"Gets",
"an",
"MD5",
"hash",
"code",
"of",
"the",
"internal",
"date",
".",
"Return",
"result",
"can",
"be",
"raw",
"binary",
"or",
"hex",
"by",
"default"
] | c06ea2650331faf11590c017c850dc5f0bbc5c13 | https://github.com/twister-php/twister/blob/c06ea2650331faf11590c017c850dc5f0bbc5c13/src/DateTime.php#L948-L951 |
4,521 | twister-php/twister | src/DateTime.php | DateTime.sha256 | public function sha256($format = null, $raw_output = false)
{
return hash('sha256', parent::format($format === null ? static::$format : $format), $raw_output);
} | php | public function sha256($format = null, $raw_output = false)
{
return hash('sha256', parent::format($format === null ? static::$format : $format), $raw_output);
} | [
"public",
"function",
"sha256",
"(",
"$",
"format",
"=",
"null",
",",
"$",
"raw_output",
"=",
"false",
")",
"{",
"return",
"hash",
"(",
"'sha256'",
",",
"parent",
"::",
"format",
"(",
"$",
"format",
"===",
"null",
"?",
"static",
"::",
"$",
"format",
":",
"$",
"format",
")",
",",
"$",
"raw_output",
")",
";",
"}"
] | Gets a SHA-256 hash code of the internal string. Return result can be raw binary or hex by default
@param bool|null $raw_output return the raw binary bytes or hex values of the SHA-256 hash
@return string | [
"Gets",
"a",
"SHA",
"-",
"256",
"hash",
"code",
"of",
"the",
"internal",
"string",
".",
"Return",
"result",
"can",
"be",
"raw",
"binary",
"or",
"hex",
"by",
"default"
] | c06ea2650331faf11590c017c850dc5f0bbc5c13 | https://github.com/twister-php/twister/blob/c06ea2650331faf11590c017c850dc5f0bbc5c13/src/DateTime.php#L1127-L1130 |
4,522 | twister-php/twister | src/DateTime.php | DateTime.sha384 | public function sha384($format = null, $raw_output = false)
{
return hash('sha384', parent::format($format === null ? static::$format : $format), $raw_output);
} | php | public function sha384($format = null, $raw_output = false)
{
return hash('sha384', parent::format($format === null ? static::$format : $format), $raw_output);
} | [
"public",
"function",
"sha384",
"(",
"$",
"format",
"=",
"null",
",",
"$",
"raw_output",
"=",
"false",
")",
"{",
"return",
"hash",
"(",
"'sha384'",
",",
"parent",
"::",
"format",
"(",
"$",
"format",
"===",
"null",
"?",
"static",
"::",
"$",
"format",
":",
"$",
"format",
")",
",",
"$",
"raw_output",
")",
";",
"}"
] | Gets a SHA-384 hash code of the internal string. Return result can be raw binary or hex by default
@param bool|null $raw_output return the raw binary bytes or hex values of the SHA-384 hash
@return string | [
"Gets",
"a",
"SHA",
"-",
"384",
"hash",
"code",
"of",
"the",
"internal",
"string",
".",
"Return",
"result",
"can",
"be",
"raw",
"binary",
"or",
"hex",
"by",
"default"
] | c06ea2650331faf11590c017c850dc5f0bbc5c13 | https://github.com/twister-php/twister/blob/c06ea2650331faf11590c017c850dc5f0bbc5c13/src/DateTime.php#L1138-L1141 |
4,523 | twister-php/twister | src/DateTime.php | DateTime.sha512 | public function sha512($format = null, $raw_output = false)
{
return hash('sha512', parent::format($format === null ? static::$format : $format), $raw_output);
} | php | public function sha512($format = null, $raw_output = false)
{
return hash('sha512', parent::format($format === null ? static::$format : $format), $raw_output);
} | [
"public",
"function",
"sha512",
"(",
"$",
"format",
"=",
"null",
",",
"$",
"raw_output",
"=",
"false",
")",
"{",
"return",
"hash",
"(",
"'sha512'",
",",
"parent",
"::",
"format",
"(",
"$",
"format",
"===",
"null",
"?",
"static",
"::",
"$",
"format",
":",
"$",
"format",
")",
",",
"$",
"raw_output",
")",
";",
"}"
] | Gets a SHA-512 hash code of the internal string. Return result can be raw binary or hex by default
@param bool|null $raw_output return the raw binary bytes or hex values of the SHA-512 hash
@return string | [
"Gets",
"a",
"SHA",
"-",
"512",
"hash",
"code",
"of",
"the",
"internal",
"string",
".",
"Return",
"result",
"can",
"be",
"raw",
"binary",
"or",
"hex",
"by",
"default"
] | c06ea2650331faf11590c017c850dc5f0bbc5c13 | https://github.com/twister-php/twister/blob/c06ea2650331faf11590c017c850dc5f0bbc5c13/src/DateTime.php#L1149-L1152 |
4,524 | arnold-almeida/UIKit | src/Almeida/UIKit/Collections/Actions/AbstractActions.php | AbstractActions.map | public static function map($actions=array(), $options=array())
{
if (empty($actions)) {
return null;
}
$out = array();
$count = 0;
$len = count($actions);
foreach ($actions as $label => $mixed) {
$count++;
$action = new Item($label, $mixed);
if ($count == 1) {
$action->isFirst = true;
}
if ($count == $len) {
$action->isLast = true;
}
$out[] = $action;
}
return $out;
} | php | public static function map($actions=array(), $options=array())
{
if (empty($actions)) {
return null;
}
$out = array();
$count = 0;
$len = count($actions);
foreach ($actions as $label => $mixed) {
$count++;
$action = new Item($label, $mixed);
if ($count == 1) {
$action->isFirst = true;
}
if ($count == $len) {
$action->isLast = true;
}
$out[] = $action;
}
return $out;
} | [
"public",
"static",
"function",
"map",
"(",
"$",
"actions",
"=",
"array",
"(",
")",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"actions",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"out",
"=",
"array",
"(",
")",
";",
"$",
"count",
"=",
"0",
";",
"$",
"len",
"=",
"count",
"(",
"$",
"actions",
")",
";",
"foreach",
"(",
"$",
"actions",
"as",
"$",
"label",
"=>",
"$",
"mixed",
")",
"{",
"$",
"count",
"++",
";",
"$",
"action",
"=",
"new",
"Item",
"(",
"$",
"label",
",",
"$",
"mixed",
")",
";",
"if",
"(",
"$",
"count",
"==",
"1",
")",
"{",
"$",
"action",
"->",
"isFirst",
"=",
"true",
";",
"}",
"if",
"(",
"$",
"count",
"==",
"$",
"len",
")",
"{",
"$",
"action",
"->",
"isLast",
"=",
"true",
";",
"}",
"$",
"out",
"[",
"]",
"=",
"$",
"action",
";",
"}",
"return",
"$",
"out",
";",
"}"
] | Get actions mapped
Preserve structure
@param array $actions [description]
@param array $options [description]
@return [type] [description] | [
"Get",
"actions",
"mapped",
"Preserve",
"structure"
] | cc52f46df011ec2f3676245c90c376da20c40e41 | https://github.com/arnold-almeida/UIKit/blob/cc52f46df011ec2f3676245c90c376da20c40e41/src/Almeida/UIKit/Collections/Actions/AbstractActions.php#L71-L100 |
4,525 | orbt/ResourceMirror | ResourceMirror.php | ResourceMirror.getReplicator | public function getReplicator()
{
if (!isset($this->replicator)) {
$this->replicator = $this->createReplicator();
}
return $this->replicator;
} | php | public function getReplicator()
{
if (!isset($this->replicator)) {
$this->replicator = $this->createReplicator();
}
return $this->replicator;
} | [
"public",
"function",
"getReplicator",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"replicator",
")",
")",
"{",
"$",
"this",
"->",
"replicator",
"=",
"$",
"this",
"->",
"createReplicator",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"replicator",
";",
"}"
] | Returns the replicator used.
@return Resource\Replicator | [
"Returns",
"the",
"replicator",
"used",
"."
] | 562a847c6b4a1879adec2b61cdcf8ed359a05443 | https://github.com/orbt/ResourceMirror/blob/562a847c6b4a1879adec2b61cdcf8ed359a05443/ResourceMirror.php#L99-L105 |
4,526 | orbt/ResourceMirror | ResourceMirror.php | ResourceMirror.materializeCollection | public function materializeCollection($collection)
{
$materializedCollection = new Collection();
foreach ($collection as $resource) {
$materializedCollection->add($this->materialize($resource));
}
return $materializedCollection;
} | php | public function materializeCollection($collection)
{
$materializedCollection = new Collection();
foreach ($collection as $resource) {
$materializedCollection->add($this->materialize($resource));
}
return $materializedCollection;
} | [
"public",
"function",
"materializeCollection",
"(",
"$",
"collection",
")",
"{",
"$",
"materializedCollection",
"=",
"new",
"Collection",
"(",
")",
";",
"foreach",
"(",
"$",
"collection",
"as",
"$",
"resource",
")",
"{",
"$",
"materializedCollection",
"->",
"add",
"(",
"$",
"this",
"->",
"materialize",
"(",
"$",
"resource",
")",
")",
";",
"}",
"return",
"$",
"materializedCollection",
";",
"}"
] | Materializes a collection of resources.
@param Collection $collection
Resource collection to materialize.
@return Collection
A collection of materialized resources. | [
"Materializes",
"a",
"collection",
"of",
"resources",
"."
] | 562a847c6b4a1879adec2b61cdcf8ed359a05443 | https://github.com/orbt/ResourceMirror/blob/562a847c6b4a1879adec2b61cdcf8ed359a05443/ResourceMirror.php#L123-L130 |
4,527 | orbt/ResourceMirror | ResourceMirror.php | ResourceMirror.materialize | public function materialize($resource, $overwrite = false)
{
if ($resource instanceof MaterializedResource) {
return $resource;
}
if ($overwrite || !$this->exists($resource)) {
try {
$this->getReplicator()->replicate($resource);
}
catch (ReplicatorException $e) {
throw new MaterializeException(sprintf('Cannot materialize resource: %s', $e->getMessage()), 0, $e);
}
$materialized = true;
}
$materializedResource = new MaterializedResource($resource, $this->getDirectory());
if (!empty($materialized)) {
$this->dispatcher->dispatch(ResourceEvents::MATERIALIZE, new ResourceMaterializeEvent($materializedResource));
}
return $materializedResource;
} | php | public function materialize($resource, $overwrite = false)
{
if ($resource instanceof MaterializedResource) {
return $resource;
}
if ($overwrite || !$this->exists($resource)) {
try {
$this->getReplicator()->replicate($resource);
}
catch (ReplicatorException $e) {
throw new MaterializeException(sprintf('Cannot materialize resource: %s', $e->getMessage()), 0, $e);
}
$materialized = true;
}
$materializedResource = new MaterializedResource($resource, $this->getDirectory());
if (!empty($materialized)) {
$this->dispatcher->dispatch(ResourceEvents::MATERIALIZE, new ResourceMaterializeEvent($materializedResource));
}
return $materializedResource;
} | [
"public",
"function",
"materialize",
"(",
"$",
"resource",
",",
"$",
"overwrite",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"resource",
"instanceof",
"MaterializedResource",
")",
"{",
"return",
"$",
"resource",
";",
"}",
"if",
"(",
"$",
"overwrite",
"||",
"!",
"$",
"this",
"->",
"exists",
"(",
"$",
"resource",
")",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"getReplicator",
"(",
")",
"->",
"replicate",
"(",
"$",
"resource",
")",
";",
"}",
"catch",
"(",
"ReplicatorException",
"$",
"e",
")",
"{",
"throw",
"new",
"MaterializeException",
"(",
"sprintf",
"(",
"'Cannot materialize resource: %s'",
",",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
",",
"0",
",",
"$",
"e",
")",
";",
"}",
"$",
"materialized",
"=",
"true",
";",
"}",
"$",
"materializedResource",
"=",
"new",
"MaterializedResource",
"(",
"$",
"resource",
",",
"$",
"this",
"->",
"getDirectory",
"(",
")",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"materialized",
")",
")",
"{",
"$",
"this",
"->",
"dispatcher",
"->",
"dispatch",
"(",
"ResourceEvents",
"::",
"MATERIALIZE",
",",
"new",
"ResourceMaterializeEvent",
"(",
"$",
"materializedResource",
")",
")",
";",
"}",
"return",
"$",
"materializedResource",
";",
"}"
] | Materializes a resource.
@param Resource\Resource $resource
Resource to materialize.
@param bool $overwrite
Whether to overwrite a resource if it already exists.
@return Resource\MaterializedResource
Materialized resource container, or the given resource if already materialized.
@throws MaterializeException
If the resource cannot be materialized. | [
"Materializes",
"a",
"resource",
"."
] | 562a847c6b4a1879adec2b61cdcf8ed359a05443 | https://github.com/orbt/ResourceMirror/blob/562a847c6b4a1879adec2b61cdcf8ed359a05443/ResourceMirror.php#L145-L167 |
4,528 | orbt/ResourceMirror | ResourceMirror.php | ResourceMirror.store | public function store($resource)
{
if (!$resource instanceof LocalResource) {
throw new \InvalidArgumentException('Resource is not local.');
}
$file = $this->directory.'/'.$resource->getPath();
@mkdir(dirname($file), 0777, true);
file_put_contents($file, $resource->getContent());
return new MaterializedResource($resource, $this->directory);
} | php | public function store($resource)
{
if (!$resource instanceof LocalResource) {
throw new \InvalidArgumentException('Resource is not local.');
}
$file = $this->directory.'/'.$resource->getPath();
@mkdir(dirname($file), 0777, true);
file_put_contents($file, $resource->getContent());
return new MaterializedResource($resource, $this->directory);
} | [
"public",
"function",
"store",
"(",
"$",
"resource",
")",
"{",
"if",
"(",
"!",
"$",
"resource",
"instanceof",
"LocalResource",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Resource is not local.'",
")",
";",
"}",
"$",
"file",
"=",
"$",
"this",
"->",
"directory",
".",
"'/'",
".",
"$",
"resource",
"->",
"getPath",
"(",
")",
";",
"@",
"mkdir",
"(",
"dirname",
"(",
"$",
"file",
")",
",",
"0777",
",",
"true",
")",
";",
"file_put_contents",
"(",
"$",
"file",
",",
"$",
"resource",
"->",
"getContent",
"(",
")",
")",
";",
"return",
"new",
"MaterializedResource",
"(",
"$",
"resource",
",",
"$",
"this",
"->",
"directory",
")",
";",
"}"
] | Stores a local resource. Existing files are overwritten.
@param LocalResource $resource
@return MaterializedResource
@throws \InvalidArgumentException
If given resource is not local. | [
"Stores",
"a",
"local",
"resource",
".",
"Existing",
"files",
"are",
"overwritten",
"."
] | 562a847c6b4a1879adec2b61cdcf8ed359a05443 | https://github.com/orbt/ResourceMirror/blob/562a847c6b4a1879adec2b61cdcf8ed359a05443/ResourceMirror.php#L178-L188 |
4,529 | skeeks-cms/cms-rp-view-widget | src/RpViewWidget.php | RpViewWidget.getCallableData | public function getCallableData()
{
$result = parent::getCallableData();
$data = $this->model->toArray();
$data['class'] = $this->model->className();
$result['object'] = $data;
return $result;
} | php | public function getCallableData()
{
$result = parent::getCallableData();
$data = $this->model->toArray();
$data['class'] = $this->model->className();
$result['object'] = $data;
return $result;
} | [
"public",
"function",
"getCallableData",
"(",
")",
"{",
"$",
"result",
"=",
"parent",
"::",
"getCallableData",
"(",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"model",
"->",
"toArray",
"(",
")",
";",
"$",
"data",
"[",
"'class'",
"]",
"=",
"$",
"this",
"->",
"model",
"->",
"className",
"(",
")",
";",
"$",
"result",
"[",
"'object'",
"]",
"=",
"$",
"data",
";",
"return",
"$",
"result",
";",
"}"
] | Admin edit widget data
@return array | [
"Admin",
"edit",
"widget",
"data"
] | 463bae22f677f69753d3d742876388bcff2e85ad | https://github.com/skeeks-cms/cms-rp-view-widget/blob/463bae22f677f69753d3d742876388bcff2e85ad/src/RpViewWidget.php#L113-L121 |
4,530 | skeeks-cms/cms-rp-view-widget | src/RpViewWidget.php | RpViewWidget.getRpAttributes | public function getRpAttributes()
{
$result = [];
$rpm = $this->model->relatedPropertiesModel;
if ($attributes = $this->visibleRpAttributes)
{
foreach ($attributes as $attribute)
{
if (!$this->visible_only_has_values)
{
$result[] = $attribute;
continue;
}
$value = $rpm->getSmartAttribute($attribute);
if ($value)
{
$result[$attribute] = $value;
continue;
}
}
}
return $result;
} | php | public function getRpAttributes()
{
$result = [];
$rpm = $this->model->relatedPropertiesModel;
if ($attributes = $this->visibleRpAttributes)
{
foreach ($attributes as $attribute)
{
if (!$this->visible_only_has_values)
{
$result[] = $attribute;
continue;
}
$value = $rpm->getSmartAttribute($attribute);
if ($value)
{
$result[$attribute] = $value;
continue;
}
}
}
return $result;
} | [
"public",
"function",
"getRpAttributes",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"rpm",
"=",
"$",
"this",
"->",
"model",
"->",
"relatedPropertiesModel",
";",
"if",
"(",
"$",
"attributes",
"=",
"$",
"this",
"->",
"visibleRpAttributes",
")",
"{",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"attribute",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible_only_has_values",
")",
"{",
"$",
"result",
"[",
"]",
"=",
"$",
"attribute",
";",
"continue",
";",
"}",
"$",
"value",
"=",
"$",
"rpm",
"->",
"getSmartAttribute",
"(",
"$",
"attribute",
")",
";",
"if",
"(",
"$",
"value",
")",
"{",
"$",
"result",
"[",
"$",
"attribute",
"]",
"=",
"$",
"value",
";",
"continue",
";",
"}",
"}",
"}",
"return",
"$",
"result",
";",
"}"
] | Smart visible code => value
@return array | [
"Smart",
"visible",
"code",
"=",
">",
"value"
] | 463bae22f677f69753d3d742876388bcff2e85ad | https://github.com/skeeks-cms/cms-rp-view-widget/blob/463bae22f677f69753d3d742876388bcff2e85ad/src/RpViewWidget.php#L171-L196 |
4,531 | skeeks-cms/cms-rp-view-widget | src/RpViewWidget.php | RpViewWidget.getVisibleRpAttributes | public function getVisibleRpAttributes()
{
if ($this->visible_properties)
{
return (array) $this->visible_properties;
} else
{
$this->model->relatedPropertiesModel->initAllProperties();
$attributes = $this->model->relatedPropertiesModel->toArray();
if ($attributes)
{
return array_keys($attributes);
} else
{
return [];
}
}
} | php | public function getVisibleRpAttributes()
{
if ($this->visible_properties)
{
return (array) $this->visible_properties;
} else
{
$this->model->relatedPropertiesModel->initAllProperties();
$attributes = $this->model->relatedPropertiesModel->toArray();
if ($attributes)
{
return array_keys($attributes);
} else
{
return [];
}
}
} | [
"public",
"function",
"getVisibleRpAttributes",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"visible_properties",
")",
"{",
"return",
"(",
"array",
")",
"$",
"this",
"->",
"visible_properties",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"model",
"->",
"relatedPropertiesModel",
"->",
"initAllProperties",
"(",
")",
";",
"$",
"attributes",
"=",
"$",
"this",
"->",
"model",
"->",
"relatedPropertiesModel",
"->",
"toArray",
"(",
")",
";",
"if",
"(",
"$",
"attributes",
")",
"{",
"return",
"array_keys",
"(",
"$",
"attributes",
")",
";",
"}",
"else",
"{",
"return",
"[",
"]",
";",
"}",
"}",
"}"
] | Only visible codes
@return array | [
"Only",
"visible",
"codes"
] | 463bae22f677f69753d3d742876388bcff2e85ad | https://github.com/skeeks-cms/cms-rp-view-widget/blob/463bae22f677f69753d3d742876388bcff2e85ad/src/RpViewWidget.php#L203-L220 |
4,532 | digipolisgent/openbib-id-api | src/Value/UserActivities/LoanCollection.php | LoanCollection.fromXml | public static function fromXml(\DOMNodeList $xml)
{
$items = array();
foreach ($xml as $xmlTag) {
$items[] = Loan::fromXml($xmlTag);
}
return new static($items);
} | php | public static function fromXml(\DOMNodeList $xml)
{
$items = array();
foreach ($xml as $xmlTag) {
$items[] = Loan::fromXml($xmlTag);
}
return new static($items);
} | [
"public",
"static",
"function",
"fromXml",
"(",
"\\",
"DOMNodeList",
"$",
"xml",
")",
"{",
"$",
"items",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"xml",
"as",
"$",
"xmlTag",
")",
"{",
"$",
"items",
"[",
"]",
"=",
"Loan",
"::",
"fromXml",
"(",
"$",
"xmlTag",
")",
";",
"}",
"return",
"new",
"static",
"(",
"$",
"items",
")",
";",
"}"
] | Builds a LoanCollection object from XML.
@param \DOMNodeList $xml
The list of xml tags representing the loans.
@return LoanCollection
A LoanCollection object. | [
"Builds",
"a",
"LoanCollection",
"object",
"from",
"XML",
"."
] | 79f58dec53a91f44333d10fa4ef79f85f31fc2de | https://github.com/digipolisgent/openbib-id-api/blob/79f58dec53a91f44333d10fa4ef79f85f31fc2de/src/Value/UserActivities/LoanCollection.php#L18-L25 |
4,533 | xloit/xloit-std | src/StringUtils.php | StringUtils.title | public static function title($value, $encoding = null)
{
$options = [];
$encoding = $encoding ?: static::$encoding;
if ($encoding) {
$options['encoding'] = $encoding;
}
return StaticFilter::execute(
static::camelCaseToUnderscore($value), Filter\UpperCaseWords::class, $options
);
} | php | public static function title($value, $encoding = null)
{
$options = [];
$encoding = $encoding ?: static::$encoding;
if ($encoding) {
$options['encoding'] = $encoding;
}
return StaticFilter::execute(
static::camelCaseToUnderscore($value), Filter\UpperCaseWords::class, $options
);
} | [
"public",
"static",
"function",
"title",
"(",
"$",
"value",
",",
"$",
"encoding",
"=",
"null",
")",
"{",
"$",
"options",
"=",
"[",
"]",
";",
"$",
"encoding",
"=",
"$",
"encoding",
"?",
":",
"static",
"::",
"$",
"encoding",
";",
"if",
"(",
"$",
"encoding",
")",
"{",
"$",
"options",
"[",
"'encoding'",
"]",
"=",
"$",
"encoding",
";",
"}",
"return",
"StaticFilter",
"::",
"execute",
"(",
"static",
"::",
"camelCaseToUnderscore",
"(",
"$",
"value",
")",
",",
"Filter",
"\\",
"UpperCaseWords",
"::",
"class",
",",
"$",
"options",
")",
";",
"}"
] | Convert the given string to title case.
@param string $value
@param string $encoding
@return string
@throws \Zend\Filter\Exception\ExceptionInterface | [
"Convert",
"the",
"given",
"string",
"to",
"title",
"case",
"."
] | 917ca269198975527caf50c2c976755ec426431e | https://github.com/xloit/xloit-std/blob/917ca269198975527caf50c2c976755ec426431e/src/StringUtils.php#L104-L116 |
4,534 | xloit/xloit-std | src/StringUtils.php | StringUtils.slug | public static function slug($string, $separator = '-', array $options = [])
{
if (!static::$slugify instanceof Slugify) {
static::$slugify = Slugify::create($options);
}
return mb_strtolower(static::$slugify->slugify($string, $separator));
} | php | public static function slug($string, $separator = '-', array $options = [])
{
if (!static::$slugify instanceof Slugify) {
static::$slugify = Slugify::create($options);
}
return mb_strtolower(static::$slugify->slugify($string, $separator));
} | [
"public",
"static",
"function",
"slug",
"(",
"$",
"string",
",",
"$",
"separator",
"=",
"'-'",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"$",
"slugify",
"instanceof",
"Slugify",
")",
"{",
"static",
"::",
"$",
"slugify",
"=",
"Slugify",
"::",
"create",
"(",
"$",
"options",
")",
";",
"}",
"return",
"mb_strtolower",
"(",
"static",
"::",
"$",
"slugify",
"->",
"slugify",
"(",
"$",
"string",
",",
"$",
"separator",
")",
")",
";",
"}"
] | Creates url friendly string.
@param string $string The input string.
@param string $separator The separator string.
@param array $options
@return string | [
"Creates",
"url",
"friendly",
"string",
"."
] | 917ca269198975527caf50c2c976755ec426431e | https://github.com/xloit/xloit-std/blob/917ca269198975527caf50c2c976755ec426431e/src/StringUtils.php#L127-L134 |
4,535 | xloit/xloit-std | src/StringUtils.php | StringUtils.alternator | public static function alternator(array $strings)
{
return function() use ($strings) {
static $i = 0;
$index = $i++ % count($strings);
return $strings[$index];
};
} | php | public static function alternator(array $strings)
{
return function() use ($strings) {
static $i = 0;
$index = $i++ % count($strings);
return $strings[$index];
};
} | [
"public",
"static",
"function",
"alternator",
"(",
"array",
"$",
"strings",
")",
"{",
"return",
"function",
"(",
")",
"use",
"(",
"$",
"strings",
")",
"{",
"static",
"$",
"i",
"=",
"0",
";",
"$",
"index",
"=",
"$",
"i",
"++",
"%",
"count",
"(",
"$",
"strings",
")",
";",
"return",
"$",
"strings",
"[",
"$",
"index",
"]",
";",
"}",
";",
"}"
] | Returns a closure that will alternate between the defined strings.
@param array $strings Array of strings to alternate between.
@return Closure | [
"Returns",
"a",
"closure",
"that",
"will",
"alternate",
"between",
"the",
"defined",
"strings",
"."
] | 917ca269198975527caf50c2c976755ec426431e | https://github.com/xloit/xloit-std/blob/917ca269198975527caf50c2c976755ec426431e/src/StringUtils.php#L221-L229 |
4,536 | xloit/xloit-std | src/StringUtils.php | StringUtils.getRandomBytes | public static function getRandomBytes($byteLength)
{
$results = null;
if (function_exists('openssl_random_pseudo_bytes')) {
/** @noinspection CryptographicallySecureRandomnessInspection */
$results = openssl_random_pseudo_bytes($byteLength);
} elseif (is_readable('/dev/urandom')) {
$fileHandler = fopen('/dev/urandom', 'rb');
if ($fileHandler !== false) {
$results = fread($fileHandler, $byteLength);
fclose($fileHandler);
}
} elseif (function_exists('mcrypt_create_iv')
&& version_compare(PHP_VERSION, '5.3.0', '>=')
) {
/** @noinspection CryptographicallySecureRandomnessInspection */
/** @noinspection PhpDeprecationInspection */
$results = mcrypt_create_iv($byteLength, MCRYPT_DEV_RANDOM);
} elseif (function_exists('random_bytes')) {
$results = random_bytes($byteLength);
} elseif (class_exists('COM')) {
/** @noinspection BadExceptionsProcessingInspection */
try {
/** @noinspection PhpUndefinedClassInspection */
/** @noinspection SpellCheckingInspection */
$capiUtil = new \COM('CAPICOM.Utilities.1');
/** @noinspection PhpUndefinedMethodInspection */
/** @noinspection SpellCheckingInspection */
$results = $capiUtil->GetRandom($byteLength, 0);
} catch (\Exception $ex) {
} // Fail silently
}
/** @noinspection IsEmptyFunctionUsageInspection */
if (empty($results)) {
throw new Exception\RuntimeException(
'Unable to find a secure method for generating random bytes.'
);
}
return $results;
} | php | public static function getRandomBytes($byteLength)
{
$results = null;
if (function_exists('openssl_random_pseudo_bytes')) {
/** @noinspection CryptographicallySecureRandomnessInspection */
$results = openssl_random_pseudo_bytes($byteLength);
} elseif (is_readable('/dev/urandom')) {
$fileHandler = fopen('/dev/urandom', 'rb');
if ($fileHandler !== false) {
$results = fread($fileHandler, $byteLength);
fclose($fileHandler);
}
} elseif (function_exists('mcrypt_create_iv')
&& version_compare(PHP_VERSION, '5.3.0', '>=')
) {
/** @noinspection CryptographicallySecureRandomnessInspection */
/** @noinspection PhpDeprecationInspection */
$results = mcrypt_create_iv($byteLength, MCRYPT_DEV_RANDOM);
} elseif (function_exists('random_bytes')) {
$results = random_bytes($byteLength);
} elseif (class_exists('COM')) {
/** @noinspection BadExceptionsProcessingInspection */
try {
/** @noinspection PhpUndefinedClassInspection */
/** @noinspection SpellCheckingInspection */
$capiUtil = new \COM('CAPICOM.Utilities.1');
/** @noinspection PhpUndefinedMethodInspection */
/** @noinspection SpellCheckingInspection */
$results = $capiUtil->GetRandom($byteLength, 0);
} catch (\Exception $ex) {
} // Fail silently
}
/** @noinspection IsEmptyFunctionUsageInspection */
if (empty($results)) {
throw new Exception\RuntimeException(
'Unable to find a secure method for generating random bytes.'
);
}
return $results;
} | [
"public",
"static",
"function",
"getRandomBytes",
"(",
"$",
"byteLength",
")",
"{",
"$",
"results",
"=",
"null",
";",
"if",
"(",
"function_exists",
"(",
"'openssl_random_pseudo_bytes'",
")",
")",
"{",
"/** @noinspection CryptographicallySecureRandomnessInspection */",
"$",
"results",
"=",
"openssl_random_pseudo_bytes",
"(",
"$",
"byteLength",
")",
";",
"}",
"elseif",
"(",
"is_readable",
"(",
"'/dev/urandom'",
")",
")",
"{",
"$",
"fileHandler",
"=",
"fopen",
"(",
"'/dev/urandom'",
",",
"'rb'",
")",
";",
"if",
"(",
"$",
"fileHandler",
"!==",
"false",
")",
"{",
"$",
"results",
"=",
"fread",
"(",
"$",
"fileHandler",
",",
"$",
"byteLength",
")",
";",
"fclose",
"(",
"$",
"fileHandler",
")",
";",
"}",
"}",
"elseif",
"(",
"function_exists",
"(",
"'mcrypt_create_iv'",
")",
"&&",
"version_compare",
"(",
"PHP_VERSION",
",",
"'5.3.0'",
",",
"'>='",
")",
")",
"{",
"/** @noinspection CryptographicallySecureRandomnessInspection */",
"/** @noinspection PhpDeprecationInspection */",
"$",
"results",
"=",
"mcrypt_create_iv",
"(",
"$",
"byteLength",
",",
"MCRYPT_DEV_RANDOM",
")",
";",
"}",
"elseif",
"(",
"function_exists",
"(",
"'random_bytes'",
")",
")",
"{",
"$",
"results",
"=",
"random_bytes",
"(",
"$",
"byteLength",
")",
";",
"}",
"elseif",
"(",
"class_exists",
"(",
"'COM'",
")",
")",
"{",
"/** @noinspection BadExceptionsProcessingInspection */",
"try",
"{",
"/** @noinspection PhpUndefinedClassInspection */",
"/** @noinspection SpellCheckingInspection */",
"$",
"capiUtil",
"=",
"new",
"\\",
"COM",
"(",
"'CAPICOM.Utilities.1'",
")",
";",
"/** @noinspection PhpUndefinedMethodInspection */",
"/** @noinspection SpellCheckingInspection */",
"$",
"results",
"=",
"$",
"capiUtil",
"->",
"GetRandom",
"(",
"$",
"byteLength",
",",
"0",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"ex",
")",
"{",
"}",
"// Fail silently",
"}",
"/** @noinspection IsEmptyFunctionUsageInspection */",
"if",
"(",
"empty",
"(",
"$",
"results",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"RuntimeException",
"(",
"'Unable to find a secure method for generating random bytes.'",
")",
";",
"}",
"return",
"$",
"results",
";",
"}"
] | Returns X random raw binary bytes.
@param int $byteLength
@return string
@throws \Xloit\Std\Exception\RuntimeException | [
"Returns",
"X",
"random",
"raw",
"binary",
"bytes",
"."
] | 917ca269198975527caf50c2c976755ec426431e | https://github.com/xloit/xloit-std/blob/917ca269198975527caf50c2c976755ec426431e/src/StringUtils.php#L500-L544 |
4,537 | unyx/utils | platform/Php.php | Php.hasFlag | public static function hasFlag(string $flag) : bool
{
// Standardize the flag name - remove starting hyphens.
$flag = ltrim($flag, '-');
// Return the check right away if it's already cached.
if (isset(static::$flags[$flag])) {
return static::$flags[$flag];
}
// Grab the output of phpinfo(). If INFO_ALL is already available, we will just parse it instead of
// fetching INFO_GENERAL specifically for our case. Then we are simply going to check if the --string
// appears in the info.
$result = strpos(static::$info[INFO_ALL] ?? static::getInfo(INFO_GENERAL), '--'.$flag);
// Cache the result and return it.
return static::$flags[$flag] = false !== $result;
} | php | public static function hasFlag(string $flag) : bool
{
// Standardize the flag name - remove starting hyphens.
$flag = ltrim($flag, '-');
// Return the check right away if it's already cached.
if (isset(static::$flags[$flag])) {
return static::$flags[$flag];
}
// Grab the output of phpinfo(). If INFO_ALL is already available, we will just parse it instead of
// fetching INFO_GENERAL specifically for our case. Then we are simply going to check if the --string
// appears in the info.
$result = strpos(static::$info[INFO_ALL] ?? static::getInfo(INFO_GENERAL), '--'.$flag);
// Cache the result and return it.
return static::$flags[$flag] = false !== $result;
} | [
"public",
"static",
"function",
"hasFlag",
"(",
"string",
"$",
"flag",
")",
":",
"bool",
"{",
"// Standardize the flag name - remove starting hyphens.",
"$",
"flag",
"=",
"ltrim",
"(",
"$",
"flag",
",",
"'-'",
")",
";",
"// Return the check right away if it's already cached.",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"flags",
"[",
"$",
"flag",
"]",
")",
")",
"{",
"return",
"static",
"::",
"$",
"flags",
"[",
"$",
"flag",
"]",
";",
"}",
"// Grab the output of phpinfo(). If INFO_ALL is already available, we will just parse it instead of",
"// fetching INFO_GENERAL specifically for our case. Then we are simply going to check if the --string",
"// appears in the info.",
"$",
"result",
"=",
"strpos",
"(",
"static",
"::",
"$",
"info",
"[",
"INFO_ALL",
"]",
"??",
"static",
"::",
"getInfo",
"(",
"INFO_GENERAL",
")",
",",
"'--'",
".",
"$",
"flag",
")",
";",
"// Cache the result and return it.",
"return",
"static",
"::",
"$",
"flags",
"[",
"$",
"flag",
"]",
"=",
"false",
"!==",
"$",
"result",
";",
"}"
] | Checks whether PHP has been compiled with the given flag.
@param string $flag The name of the flag to check. The two initial hyphens can be omitted.
@return bool True when PHP has been compiled with the given flag, false otherwise. | [
"Checks",
"whether",
"PHP",
"has",
"been",
"compiled",
"with",
"the",
"given",
"flag",
"."
] | 503a3dd46fd2216024ab771b6e830be16d36b358 | https://github.com/unyx/utils/blob/503a3dd46fd2216024ab771b6e830be16d36b358/platform/Php.php#L42-L59 |
4,538 | eosnewmedia/external-layout | src/Finisher/WorkingTagFinisher.php | WorkingTagFinisher.finish | public function finish(string $document, LayoutInterface $layout): string
{
return str_replace(
[
'<' . ManipulatorInterface::WORKING_TAG . '>',
'</' . ManipulatorInterface::WORKING_TAG . '>'
],
'',
$document
);
} | php | public function finish(string $document, LayoutInterface $layout): string
{
return str_replace(
[
'<' . ManipulatorInterface::WORKING_TAG . '>',
'</' . ManipulatorInterface::WORKING_TAG . '>'
],
'',
$document
);
} | [
"public",
"function",
"finish",
"(",
"string",
"$",
"document",
",",
"LayoutInterface",
"$",
"layout",
")",
":",
"string",
"{",
"return",
"str_replace",
"(",
"[",
"'<'",
".",
"ManipulatorInterface",
"::",
"WORKING_TAG",
".",
"'>'",
",",
"'</'",
".",
"ManipulatorInterface",
"::",
"WORKING_TAG",
".",
"'>'",
"]",
",",
"''",
",",
"$",
"document",
")",
";",
"}"
] | Finish the plain text layout document
@param string $document
@param LayoutInterface $layout
@return string | [
"Finish",
"the",
"plain",
"text",
"layout",
"document"
] | 1c7771127ea24f3b7f33026c7d7dc6d8537c61cd | https://github.com/eosnewmedia/external-layout/blob/1c7771127ea24f3b7f33026c7d7dc6d8537c61cd/src/Finisher/WorkingTagFinisher.php#L21-L31 |
4,539 | antwebes/ChateaClientLib | src/Ant/ChateaClient/Service/Client/ChateaGratisAppClient.php | ChateaGratisAppClient.factory | public static function factory($config = array()){
// Provide a hash of default client configuration options
$default = array(
'Accept'=>'application/json',
'environment'=>'prod',
'service-description-name' => Client::NAME_SERVICE_API,
'store' => new FileStore(),
'ssl'=>false
);
$required = array(
'base_url',
'client_id',
'secret',
);
// Merge in default settings and validate the config
$config = Collection::fromConfig($config, $default, $required);
if($config['environment'] == 'dev' && $config['ssl'] == false ){
$config['ssl.certificate_authority'] = 'system';
$config['curl.options'] = array(CURLOPT_SSL_VERIFYHOST=>false,CURLOPT_SSL_VERIFYPEER=>false);
}
// Create a new ChateaGratis client
$client = new self($config->get('base_url'),$config);
$client->authenticateAsGuest = isset($config['as_guest']) ? $config['as_guest'] : false;
$client->chateaOAuth2Client = $config->get('OAuth2Client');
$client->store = $config->get('store');
$client->addSubscriber(new AcceptHeaderPluging($config->toArray()));
return $client;
} | php | public static function factory($config = array()){
// Provide a hash of default client configuration options
$default = array(
'Accept'=>'application/json',
'environment'=>'prod',
'service-description-name' => Client::NAME_SERVICE_API,
'store' => new FileStore(),
'ssl'=>false
);
$required = array(
'base_url',
'client_id',
'secret',
);
// Merge in default settings and validate the config
$config = Collection::fromConfig($config, $default, $required);
if($config['environment'] == 'dev' && $config['ssl'] == false ){
$config['ssl.certificate_authority'] = 'system';
$config['curl.options'] = array(CURLOPT_SSL_VERIFYHOST=>false,CURLOPT_SSL_VERIFYPEER=>false);
}
// Create a new ChateaGratis client
$client = new self($config->get('base_url'),$config);
$client->authenticateAsGuest = isset($config['as_guest']) ? $config['as_guest'] : false;
$client->chateaOAuth2Client = $config->get('OAuth2Client');
$client->store = $config->get('store');
$client->addSubscriber(new AcceptHeaderPluging($config->toArray()));
return $client;
} | [
"public",
"static",
"function",
"factory",
"(",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"// Provide a hash of default client configuration options",
"$",
"default",
"=",
"array",
"(",
"'Accept'",
"=>",
"'application/json'",
",",
"'environment'",
"=>",
"'prod'",
",",
"'service-description-name'",
"=>",
"Client",
"::",
"NAME_SERVICE_API",
",",
"'store'",
"=>",
"new",
"FileStore",
"(",
")",
",",
"'ssl'",
"=>",
"false",
")",
";",
"$",
"required",
"=",
"array",
"(",
"'base_url'",
",",
"'client_id'",
",",
"'secret'",
",",
")",
";",
"// Merge in default settings and validate the config",
"$",
"config",
"=",
"Collection",
"::",
"fromConfig",
"(",
"$",
"config",
",",
"$",
"default",
",",
"$",
"required",
")",
";",
"if",
"(",
"$",
"config",
"[",
"'environment'",
"]",
"==",
"'dev'",
"&&",
"$",
"config",
"[",
"'ssl'",
"]",
"==",
"false",
")",
"{",
"$",
"config",
"[",
"'ssl.certificate_authority'",
"]",
"=",
"'system'",
";",
"$",
"config",
"[",
"'curl.options'",
"]",
"=",
"array",
"(",
"CURLOPT_SSL_VERIFYHOST",
"=>",
"false",
",",
"CURLOPT_SSL_VERIFYPEER",
"=>",
"false",
")",
";",
"}",
"// Create a new ChateaGratis client",
"$",
"client",
"=",
"new",
"self",
"(",
"$",
"config",
"->",
"get",
"(",
"'base_url'",
")",
",",
"$",
"config",
")",
";",
"$",
"client",
"->",
"authenticateAsGuest",
"=",
"isset",
"(",
"$",
"config",
"[",
"'as_guest'",
"]",
")",
"?",
"$",
"config",
"[",
"'as_guest'",
"]",
":",
"false",
";",
"$",
"client",
"->",
"chateaOAuth2Client",
"=",
"$",
"config",
"->",
"get",
"(",
"'OAuth2Client'",
")",
";",
"$",
"client",
"->",
"store",
"=",
"$",
"config",
"->",
"get",
"(",
"'store'",
")",
";",
"$",
"client",
"->",
"addSubscriber",
"(",
"new",
"AcceptHeaderPluging",
"(",
"$",
"config",
"->",
"toArray",
"(",
")",
")",
")",
";",
"return",
"$",
"client",
";",
"}"
] | Build new class ChateaOAuth2Client, this provides commands to run at ApiChateaServer
This client can get self credentials, and save in store. This version do not encrypted credentials.
@param array $config Associative array can configure the client. The parameters are:
client_id The public key of client. This parameter is required
secret The private key of client. This parameter is required
base_url The server endpoind url. This parameter is optional
Accept The accept header, default value is json. This parameter is optional
environment Set mode production [prod] or developing [dev] default value is prod. This parameter is optional
scheme Set server schema communication [http|https] for default https. This parameter is optional
subdomain Set server subdomain if this exist. For default is api. This parameter is optional
store Set where save server credentials
@return ChateaGratisAppClient|\Guzzle\Service\Client | [
"Build",
"new",
"class",
"ChateaOAuth2Client",
"this",
"provides",
"commands",
"to",
"run",
"at",
"ApiChateaServer",
"This",
"client",
"can",
"get",
"self",
"credentials",
"and",
"save",
"in",
"store",
".",
"This",
"version",
"do",
"not",
"encrypted",
"credentials",
"."
] | b08b207886f4a9f79a0719e8c7b20e79a1b1732d | https://github.com/antwebes/ChateaClientLib/blob/b08b207886f4a9f79a0719e8c7b20e79a1b1732d/src/Ant/ChateaClient/Service/Client/ChateaGratisAppClient.php#L69-L101 |
4,540 | antwebes/ChateaClientLib | src/Ant/ChateaClient/Service/Client/ChateaGratisAppClient.php | ChateaGratisAppClient.prepareAccessToken | private function prepareAccessToken()
{
// if not exits data in the store
if(!$this->store->getPersistentData('token_expires_at')){
return $this->getAccessTokenWithClientCredentials();
// if access token expires.
}else if($this->store->getPersistentData('token_expires_at') < time()){
try{
return $this->getAccessTokenWithRefreshToken();
}catch(AuthenticationException $e){
return $this->getAccessTokenWithClientCredentials();
}
}else{
return $this->store->getPersistentData('access_token');
}
} | php | private function prepareAccessToken()
{
// if not exits data in the store
if(!$this->store->getPersistentData('token_expires_at')){
return $this->getAccessTokenWithClientCredentials();
// if access token expires.
}else if($this->store->getPersistentData('token_expires_at') < time()){
try{
return $this->getAccessTokenWithRefreshToken();
}catch(AuthenticationException $e){
return $this->getAccessTokenWithClientCredentials();
}
}else{
return $this->store->getPersistentData('access_token');
}
} | [
"private",
"function",
"prepareAccessToken",
"(",
")",
"{",
"// if not exits data in the store",
"if",
"(",
"!",
"$",
"this",
"->",
"store",
"->",
"getPersistentData",
"(",
"'token_expires_at'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getAccessTokenWithClientCredentials",
"(",
")",
";",
"// if access token expires.",
"}",
"else",
"if",
"(",
"$",
"this",
"->",
"store",
"->",
"getPersistentData",
"(",
"'token_expires_at'",
")",
"<",
"time",
"(",
")",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"getAccessTokenWithRefreshToken",
"(",
")",
";",
"}",
"catch",
"(",
"AuthenticationException",
"$",
"e",
")",
"{",
"return",
"$",
"this",
"->",
"getAccessTokenWithClientCredentials",
"(",
")",
";",
"}",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"store",
"->",
"getPersistentData",
"(",
"'access_token'",
")",
";",
"}",
"}"
] | This retrieve the access token in store or in server
@return string the access token | [
"This",
"retrieve",
"the",
"access",
"token",
"in",
"store",
"or",
"in",
"server"
] | b08b207886f4a9f79a0719e8c7b20e79a1b1732d | https://github.com/antwebes/ChateaClientLib/blob/b08b207886f4a9f79a0719e8c7b20e79a1b1732d/src/Ant/ChateaClient/Service/Client/ChateaGratisAppClient.php#L134-L149 |
4,541 | finwo/php-datafile | src/DataFile.php | DataFile.init | public static function init()
{
// Initialize format drivers
foreach (glob(implode(DIRECTORY_SEPARATOR, array(__DIR__,'Format','*.php'))) as $filename) {
$filename = explode(DIRECTORY_SEPARATOR, $filename);
$filename = explode('.',array_pop($filename));
array_pop($filename);
$filename = implode('.', $filename);
if($filename == 'FormatInterface') continue;
$className = explode("\\",__CLASS__);
array_pop($className);
array_push($className, 'Format');
array_push($className, $filename);
$className = implode('\\', $className);
self::registerFormat($className);
}
// Initialize storage drivers
foreach (glob(implode(DIRECTORY_SEPARATOR, array(__DIR__,'Storage','*.php'))) as $filename) {
$filename = explode(DIRECTORY_SEPARATOR, $filename);
$filename = explode('.',array_pop($filename));
array_pop($filename);
$filename = implode('.', $filename);
if($filename == 'StorageInterface') continue;
$className = explode("\\",__CLASS__);
array_pop($className);
array_push($className, 'Storage');
array_push($className, $filename);
$className = implode('\\', $className);
self::registerStorage($className);
}
} | php | public static function init()
{
// Initialize format drivers
foreach (glob(implode(DIRECTORY_SEPARATOR, array(__DIR__,'Format','*.php'))) as $filename) {
$filename = explode(DIRECTORY_SEPARATOR, $filename);
$filename = explode('.',array_pop($filename));
array_pop($filename);
$filename = implode('.', $filename);
if($filename == 'FormatInterface') continue;
$className = explode("\\",__CLASS__);
array_pop($className);
array_push($className, 'Format');
array_push($className, $filename);
$className = implode('\\', $className);
self::registerFormat($className);
}
// Initialize storage drivers
foreach (glob(implode(DIRECTORY_SEPARATOR, array(__DIR__,'Storage','*.php'))) as $filename) {
$filename = explode(DIRECTORY_SEPARATOR, $filename);
$filename = explode('.',array_pop($filename));
array_pop($filename);
$filename = implode('.', $filename);
if($filename == 'StorageInterface') continue;
$className = explode("\\",__CLASS__);
array_pop($className);
array_push($className, 'Storage');
array_push($className, $filename);
$className = implode('\\', $className);
self::registerStorage($className);
}
} | [
"public",
"static",
"function",
"init",
"(",
")",
"{",
"// Initialize format drivers",
"foreach",
"(",
"glob",
"(",
"implode",
"(",
"DIRECTORY_SEPARATOR",
",",
"array",
"(",
"__DIR__",
",",
"'Format'",
",",
"'*.php'",
")",
")",
")",
"as",
"$",
"filename",
")",
"{",
"$",
"filename",
"=",
"explode",
"(",
"DIRECTORY_SEPARATOR",
",",
"$",
"filename",
")",
";",
"$",
"filename",
"=",
"explode",
"(",
"'.'",
",",
"array_pop",
"(",
"$",
"filename",
")",
")",
";",
"array_pop",
"(",
"$",
"filename",
")",
";",
"$",
"filename",
"=",
"implode",
"(",
"'.'",
",",
"$",
"filename",
")",
";",
"if",
"(",
"$",
"filename",
"==",
"'FormatInterface'",
")",
"continue",
";",
"$",
"className",
"=",
"explode",
"(",
"\"\\\\\"",
",",
"__CLASS__",
")",
";",
"array_pop",
"(",
"$",
"className",
")",
";",
"array_push",
"(",
"$",
"className",
",",
"'Format'",
")",
";",
"array_push",
"(",
"$",
"className",
",",
"$",
"filename",
")",
";",
"$",
"className",
"=",
"implode",
"(",
"'\\\\'",
",",
"$",
"className",
")",
";",
"self",
"::",
"registerFormat",
"(",
"$",
"className",
")",
";",
"}",
"// Initialize storage drivers",
"foreach",
"(",
"glob",
"(",
"implode",
"(",
"DIRECTORY_SEPARATOR",
",",
"array",
"(",
"__DIR__",
",",
"'Storage'",
",",
"'*.php'",
")",
")",
")",
"as",
"$",
"filename",
")",
"{",
"$",
"filename",
"=",
"explode",
"(",
"DIRECTORY_SEPARATOR",
",",
"$",
"filename",
")",
";",
"$",
"filename",
"=",
"explode",
"(",
"'.'",
",",
"array_pop",
"(",
"$",
"filename",
")",
")",
";",
"array_pop",
"(",
"$",
"filename",
")",
";",
"$",
"filename",
"=",
"implode",
"(",
"'.'",
",",
"$",
"filename",
")",
";",
"if",
"(",
"$",
"filename",
"==",
"'StorageInterface'",
")",
"continue",
";",
"$",
"className",
"=",
"explode",
"(",
"\"\\\\\"",
",",
"__CLASS__",
")",
";",
"array_pop",
"(",
"$",
"className",
")",
";",
"array_push",
"(",
"$",
"className",
",",
"'Storage'",
")",
";",
"array_push",
"(",
"$",
"className",
",",
"$",
"filename",
")",
";",
"$",
"className",
"=",
"implode",
"(",
"'\\\\'",
",",
"$",
"className",
")",
";",
"self",
"::",
"registerStorage",
"(",
"$",
"className",
")",
";",
"}",
"}"
] | Initialize all direct-access variables
This gets called as soon as this file is loaded | [
"Initialize",
"all",
"direct",
"-",
"access",
"variables",
"This",
"gets",
"called",
"as",
"soon",
"as",
"this",
"file",
"is",
"loaded"
] | 8333d1cc79cb5f40b0c382b33fe7dd27c68a9520 | https://github.com/finwo/php-datafile/blob/8333d1cc79cb5f40b0c382b33fe7dd27c68a9520/src/DataFile.php#L82-L122 |
4,542 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/form/instance.php | Form_Instance.set_attribute | public function set_attribute($key, $value)
{
$attributes = $this->get_config('form_attributes', array());
$attributes[$key] = $value;
$this->set_config('form_attributes', $attributes);
return $this;
} | php | public function set_attribute($key, $value)
{
$attributes = $this->get_config('form_attributes', array());
$attributes[$key] = $value;
$this->set_config('form_attributes', $attributes);
return $this;
} | [
"public",
"function",
"set_attribute",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"get_config",
"(",
"'form_attributes'",
",",
"array",
"(",
")",
")",
";",
"$",
"attributes",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"$",
"this",
"->",
"set_config",
"(",
"'form_attributes'",
",",
"$",
"attributes",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set form attribute
@param string
@param mixed | [
"Set",
"form",
"attribute"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/form/instance.php#L66-L73 |
4,543 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/form/instance.php | Form_Instance.get_attribute | public function get_attribute($key, $default = null)
{
$attributes = $this->get_config('form_attributes', array());
return array_key_exists($key, $attributes) ? $attributes[$key] : $default;
} | php | public function get_attribute($key, $default = null)
{
$attributes = $this->get_config('form_attributes', array());
return array_key_exists($key, $attributes) ? $attributes[$key] : $default;
} | [
"public",
"function",
"get_attribute",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"get_config",
"(",
"'form_attributes'",
",",
"array",
"(",
")",
")",
";",
"return",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"attributes",
")",
"?",
"$",
"attributes",
"[",
"$",
"key",
"]",
":",
"$",
"default",
";",
"}"
] | Get form attribute
@param string
@param mixed | [
"Get",
"form",
"attribute"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/form/instance.php#L81-L86 |
4,544 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/form/instance.php | Form_Instance.open | public function open($attributes = array(), array $hidden = array())
{
$attributes = ! is_array($attributes) ? array('action' => $attributes) : $attributes;
// If there is still no action set, Form-post
if( ! array_key_exists('action', $attributes) or empty($attributes['action']))
{
$attributes['action'] = \Uri::main();
}
// If not a full URL, create one
elseif ( ! strpos($attributes['action'], '://'))
{
$attributes['action'] = \Uri::create($attributes['action']);
}
if (empty($attributes['accept-charset']))
{
$attributes['accept-charset'] = strtolower(\Fuel::$encoding);
}
// If method is empty, use POST
! empty($attributes['method']) || $attributes['method'] = $this->get_config('form_method', 'post');
$form = '<form';
foreach ($attributes as $prop => $value)
{
$form .= ' '.$prop.'="'.$value.'"';
}
$form .= '>';
// Add hidden fields when given
foreach ($hidden as $field => $value)
{
$form .= PHP_EOL.$this->hidden($field, $value);
}
return $form;
} | php | public function open($attributes = array(), array $hidden = array())
{
$attributes = ! is_array($attributes) ? array('action' => $attributes) : $attributes;
// If there is still no action set, Form-post
if( ! array_key_exists('action', $attributes) or empty($attributes['action']))
{
$attributes['action'] = \Uri::main();
}
// If not a full URL, create one
elseif ( ! strpos($attributes['action'], '://'))
{
$attributes['action'] = \Uri::create($attributes['action']);
}
if (empty($attributes['accept-charset']))
{
$attributes['accept-charset'] = strtolower(\Fuel::$encoding);
}
// If method is empty, use POST
! empty($attributes['method']) || $attributes['method'] = $this->get_config('form_method', 'post');
$form = '<form';
foreach ($attributes as $prop => $value)
{
$form .= ' '.$prop.'="'.$value.'"';
}
$form .= '>';
// Add hidden fields when given
foreach ($hidden as $field => $value)
{
$form .= PHP_EOL.$this->hidden($field, $value);
}
return $form;
} | [
"public",
"function",
"open",
"(",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"array",
"$",
"hidden",
"=",
"array",
"(",
")",
")",
"{",
"$",
"attributes",
"=",
"!",
"is_array",
"(",
"$",
"attributes",
")",
"?",
"array",
"(",
"'action'",
"=>",
"$",
"attributes",
")",
":",
"$",
"attributes",
";",
"// If there is still no action set, Form-post",
"if",
"(",
"!",
"array_key_exists",
"(",
"'action'",
",",
"$",
"attributes",
")",
"or",
"empty",
"(",
"$",
"attributes",
"[",
"'action'",
"]",
")",
")",
"{",
"$",
"attributes",
"[",
"'action'",
"]",
"=",
"\\",
"Uri",
"::",
"main",
"(",
")",
";",
"}",
"// If not a full URL, create one",
"elseif",
"(",
"!",
"strpos",
"(",
"$",
"attributes",
"[",
"'action'",
"]",
",",
"'://'",
")",
")",
"{",
"$",
"attributes",
"[",
"'action'",
"]",
"=",
"\\",
"Uri",
"::",
"create",
"(",
"$",
"attributes",
"[",
"'action'",
"]",
")",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"attributes",
"[",
"'accept-charset'",
"]",
")",
")",
"{",
"$",
"attributes",
"[",
"'accept-charset'",
"]",
"=",
"strtolower",
"(",
"\\",
"Fuel",
"::",
"$",
"encoding",
")",
";",
"}",
"// If method is empty, use POST",
"!",
"empty",
"(",
"$",
"attributes",
"[",
"'method'",
"]",
")",
"||",
"$",
"attributes",
"[",
"'method'",
"]",
"=",
"$",
"this",
"->",
"get_config",
"(",
"'form_method'",
",",
"'post'",
")",
";",
"$",
"form",
"=",
"'<form'",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"prop",
"=>",
"$",
"value",
")",
"{",
"$",
"form",
".=",
"' '",
".",
"$",
"prop",
".",
"'=\"'",
".",
"$",
"value",
".",
"'\"'",
";",
"}",
"$",
"form",
".=",
"'>'",
";",
"// Add hidden fields when given",
"foreach",
"(",
"$",
"hidden",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"$",
"form",
".=",
"PHP_EOL",
".",
"$",
"this",
"->",
"hidden",
"(",
"$",
"field",
",",
"$",
"value",
")",
";",
"}",
"return",
"$",
"form",
";",
"}"
] | Create a form open tag
@param string|array action string or array with more tag attribute settings
@return string | [
"Create",
"a",
"form",
"open",
"tag"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/form/instance.php#L104-L142 |
4,545 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/form/instance.php | Form_Instance.fieldset_open | public function fieldset_open($attributes = array(), $legend = null)
{
$fieldset_open = '<fieldset ' . array_to_attr($attributes) . ' >';
! is_null($legend) and $attributes['legend'] = $legend;
if ( ! empty($attributes['legend']))
{
$fieldset_open.= "\n<legend>".$attributes['legend']."</legend>";
}
return $fieldset_open;
} | php | public function fieldset_open($attributes = array(), $legend = null)
{
$fieldset_open = '<fieldset ' . array_to_attr($attributes) . ' >';
! is_null($legend) and $attributes['legend'] = $legend;
if ( ! empty($attributes['legend']))
{
$fieldset_open.= "\n<legend>".$attributes['legend']."</legend>";
}
return $fieldset_open;
} | [
"public",
"function",
"fieldset_open",
"(",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"legend",
"=",
"null",
")",
"{",
"$",
"fieldset_open",
"=",
"'<fieldset '",
".",
"array_to_attr",
"(",
"$",
"attributes",
")",
".",
"' >'",
";",
"!",
"is_null",
"(",
"$",
"legend",
")",
"and",
"$",
"attributes",
"[",
"'legend'",
"]",
"=",
"$",
"legend",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"attributes",
"[",
"'legend'",
"]",
")",
")",
"{",
"$",
"fieldset_open",
".=",
"\"\\n<legend>\"",
".",
"$",
"attributes",
"[",
"'legend'",
"]",
".",
"\"</legend>\"",
";",
"}",
"return",
"$",
"fieldset_open",
";",
"}"
] | Create a fieldset open tag
@param array array with tag attribute settings
@param string string for the fieldset legend
@return string | [
"Create",
"a",
"fieldset",
"open",
"tag"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/form/instance.php#L161-L172 |
4,546 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/form/instance.php | Form_Instance.file | public function file($field, array $attributes = array())
{
if (is_array($field))
{
$attributes = $field;
}
else
{
$attributes['name'] = (string) $field;
}
$attributes['type'] = 'file';
return $this->input($attributes);
} | php | public function file($field, array $attributes = array())
{
if (is_array($field))
{
$attributes = $field;
}
else
{
$attributes['name'] = (string) $field;
}
$attributes['type'] = 'file';
return $this->input($attributes);
} | [
"public",
"function",
"file",
"(",
"$",
"field",
",",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"field",
")",
")",
"{",
"$",
"attributes",
"=",
"$",
"field",
";",
"}",
"else",
"{",
"$",
"attributes",
"[",
"'name'",
"]",
"=",
"(",
"string",
")",
"$",
"field",
";",
"}",
"$",
"attributes",
"[",
"'type'",
"]",
"=",
"'file'",
";",
"return",
"$",
"this",
"->",
"input",
"(",
"$",
"attributes",
")",
";",
"}"
] | Create a file upload input field
@param string|array either fieldname or full attributes array (when array other params are ignored)
@param array
@return string | [
"Create",
"a",
"file",
"upload",
"input",
"field"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/form/instance.php#L374-L387 |
4,547 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/form/instance.php | Form_Instance.reset | public function reset($field = 'reset', $value = 'Reset', array $attributes = array())
{
if (is_array($field))
{
$attributes = $field;
}
else
{
$attributes['name'] = (string) $field;
$attributes['value'] = (string) $value;
}
$attributes['type'] = 'reset';
return $this->input($attributes);
} | php | public function reset($field = 'reset', $value = 'Reset', array $attributes = array())
{
if (is_array($field))
{
$attributes = $field;
}
else
{
$attributes['name'] = (string) $field;
$attributes['value'] = (string) $value;
}
$attributes['type'] = 'reset';
return $this->input($attributes);
} | [
"public",
"function",
"reset",
"(",
"$",
"field",
"=",
"'reset'",
",",
"$",
"value",
"=",
"'Reset'",
",",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"field",
")",
")",
"{",
"$",
"attributes",
"=",
"$",
"field",
";",
"}",
"else",
"{",
"$",
"attributes",
"[",
"'name'",
"]",
"=",
"(",
"string",
")",
"$",
"field",
";",
"$",
"attributes",
"[",
"'value'",
"]",
"=",
"(",
"string",
")",
"$",
"value",
";",
"}",
"$",
"attributes",
"[",
"'type'",
"]",
"=",
"'reset'",
";",
"return",
"$",
"this",
"->",
"input",
"(",
"$",
"attributes",
")",
";",
"}"
] | Create a reset button
@param string|array either fieldname or full attributes array (when array other params are ignored)
@param string
@param array
@return string | [
"Create",
"a",
"reset",
"button"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/form/instance.php#L421-L435 |
4,548 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/form/instance.php | Form_Instance.submit | public function submit($field = 'submit', $value = 'Submit', array $attributes = array())
{
if (is_array($field))
{
$attributes = $field;
}
else
{
$attributes['name'] = (string) $field;
$attributes['value'] = (string) $value;
}
$attributes['type'] = 'submit';
return $this->input($attributes);
} | php | public function submit($field = 'submit', $value = 'Submit', array $attributes = array())
{
if (is_array($field))
{
$attributes = $field;
}
else
{
$attributes['name'] = (string) $field;
$attributes['value'] = (string) $value;
}
$attributes['type'] = 'submit';
return $this->input($attributes);
} | [
"public",
"function",
"submit",
"(",
"$",
"field",
"=",
"'submit'",
",",
"$",
"value",
"=",
"'Submit'",
",",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"field",
")",
")",
"{",
"$",
"attributes",
"=",
"$",
"field",
";",
"}",
"else",
"{",
"$",
"attributes",
"[",
"'name'",
"]",
"=",
"(",
"string",
")",
"$",
"field",
";",
"$",
"attributes",
"[",
"'value'",
"]",
"=",
"(",
"string",
")",
"$",
"value",
";",
"}",
"$",
"attributes",
"[",
"'type'",
"]",
"=",
"'submit'",
";",
"return",
"$",
"this",
"->",
"input",
"(",
"$",
"attributes",
")",
";",
"}"
] | Create a submit button
@param string|array either fieldname or full attributes array (when array other params are ignored)
@param string
@param array
@return string | [
"Create",
"a",
"submit",
"button"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/form/instance.php#L445-L459 |
4,549 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/form/instance.php | Form_Instance.build_field | public function build_field($field)
{
! $field instanceof Fieldset_Field && $field = $this->field($field);
return $field->build();
} | php | public function build_field($field)
{
! $field instanceof Fieldset_Field && $field = $this->field($field);
return $field->build();
} | [
"public",
"function",
"build_field",
"(",
"$",
"field",
")",
"{",
"!",
"$",
"field",
"instanceof",
"Fieldset_Field",
"&&",
"$",
"field",
"=",
"$",
"this",
"->",
"field",
"(",
"$",
"field",
")",
";",
"return",
"$",
"field",
"->",
"build",
"(",
")",
";",
"}"
] | Build & template individual field
@param string|Fieldset_Field field instance or name of a field in this form's fieldset
@return string
@depricated until v1.2 | [
"Build",
"&",
"template",
"individual",
"field"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/form/instance.php#L667-L672 |
4,550 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/form/instance.php | Form_Instance.add_csrf | public function add_csrf()
{
$this->add(\Config::get('security.csrf_token_key', 'fuel_csrf_token'), 'CSRF Token')
->set_type('hidden')
->set_value(\Security::fetch_token())
->add_rule(array('Security', 'check_token'));
return $this;
} | php | public function add_csrf()
{
$this->add(\Config::get('security.csrf_token_key', 'fuel_csrf_token'), 'CSRF Token')
->set_type('hidden')
->set_value(\Security::fetch_token())
->add_rule(array('Security', 'check_token'));
return $this;
} | [
"public",
"function",
"add_csrf",
"(",
")",
"{",
"$",
"this",
"->",
"add",
"(",
"\\",
"Config",
"::",
"get",
"(",
"'security.csrf_token_key'",
",",
"'fuel_csrf_token'",
")",
",",
"'CSRF Token'",
")",
"->",
"set_type",
"(",
"'hidden'",
")",
"->",
"set_value",
"(",
"\\",
"Security",
"::",
"fetch_token",
"(",
")",
")",
"->",
"add_rule",
"(",
"array",
"(",
"'Security'",
",",
"'check_token'",
")",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Add a CSRF token and a validation rule to check it | [
"Add",
"a",
"CSRF",
"token",
"and",
"a",
"validation",
"rule",
"to",
"check",
"it"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/form/instance.php#L677-L685 |
4,551 | open-orchestra/open-orchestra-media-admin-bundle | MediaAdminBundle/DependencyInjection/OpenOrchestraMediaAdminExtension.php | OpenOrchestraMediaAdminExtension.setFilesParameters | protected function setFilesParameters(ContainerBuilder $container, array $config, YamlFileLoader $loader)
{
$container->setParameter(
'open_orchestra_media_admin.files.thumbnail_format',
$config['thumbnail']
);
$container->setParameter(
'open_orchestra_media_admin.files.alternatives.default.thumbnail',
$config['files']['alternatives']['default']['thumbnail']
);
$container->setParameter(
'open_orchestra_media_admin.files.alternatives.audio.thumbnail',
$config['files']['alternatives']['audio']['thumbnail']
);
if (count($config['files']['alternatives']['image']['formats']) > 0) {
$container->setParameter(
'open_orchestra_media_admin.files.alternatives.image.formats',
$config['files']['alternatives']['image']['formats']
);
} else {
$loader->load('alternatives_formats.yml');
}
} | php | protected function setFilesParameters(ContainerBuilder $container, array $config, YamlFileLoader $loader)
{
$container->setParameter(
'open_orchestra_media_admin.files.thumbnail_format',
$config['thumbnail']
);
$container->setParameter(
'open_orchestra_media_admin.files.alternatives.default.thumbnail',
$config['files']['alternatives']['default']['thumbnail']
);
$container->setParameter(
'open_orchestra_media_admin.files.alternatives.audio.thumbnail',
$config['files']['alternatives']['audio']['thumbnail']
);
if (count($config['files']['alternatives']['image']['formats']) > 0) {
$container->setParameter(
'open_orchestra_media_admin.files.alternatives.image.formats',
$config['files']['alternatives']['image']['formats']
);
} else {
$loader->load('alternatives_formats.yml');
}
} | [
"protected",
"function",
"setFilesParameters",
"(",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"config",
",",
"YamlFileLoader",
"$",
"loader",
")",
"{",
"$",
"container",
"->",
"setParameter",
"(",
"'open_orchestra_media_admin.files.thumbnail_format'",
",",
"$",
"config",
"[",
"'thumbnail'",
"]",
")",
";",
"$",
"container",
"->",
"setParameter",
"(",
"'open_orchestra_media_admin.files.alternatives.default.thumbnail'",
",",
"$",
"config",
"[",
"'files'",
"]",
"[",
"'alternatives'",
"]",
"[",
"'default'",
"]",
"[",
"'thumbnail'",
"]",
")",
";",
"$",
"container",
"->",
"setParameter",
"(",
"'open_orchestra_media_admin.files.alternatives.audio.thumbnail'",
",",
"$",
"config",
"[",
"'files'",
"]",
"[",
"'alternatives'",
"]",
"[",
"'audio'",
"]",
"[",
"'thumbnail'",
"]",
")",
";",
"if",
"(",
"count",
"(",
"$",
"config",
"[",
"'files'",
"]",
"[",
"'alternatives'",
"]",
"[",
"'image'",
"]",
"[",
"'formats'",
"]",
")",
">",
"0",
")",
"{",
"$",
"container",
"->",
"setParameter",
"(",
"'open_orchestra_media_admin.files.alternatives.image.formats'",
",",
"$",
"config",
"[",
"'files'",
"]",
"[",
"'alternatives'",
"]",
"[",
"'image'",
"]",
"[",
"'formats'",
"]",
")",
";",
"}",
"else",
"{",
"$",
"loader",
"->",
"load",
"(",
"'alternatives_formats.yml'",
")",
";",
"}",
"}"
] | Add the files generation parameters to the container
Takes the Open Orchestra alternatives image formats or the application one instead if defined
@param ContainerBuilder $container
@param array $config
@param YamlFileLoader $loader | [
"Add",
"the",
"files",
"generation",
"parameters",
"to",
"the",
"container",
"Takes",
"the",
"Open",
"Orchestra",
"alternatives",
"image",
"formats",
"or",
"the",
"application",
"one",
"instead",
"if",
"defined"
] | 743fa00a6491b84d67221e215a806d8b210bf773 | https://github.com/open-orchestra/open-orchestra-media-admin-bundle/blob/743fa00a6491b84d67221e215a806d8b210bf773/MediaAdminBundle/DependencyInjection/OpenOrchestraMediaAdminExtension.php#L166-L191 |
4,552 | iRAP-software/package-core-libs | src/MysqliLib.php | MysqliLib.escapeValues | public static function escapeValues(array $data, \mysqli $mysqli)
{
foreach($data as $index => $value)
{
if ($value !== null)
{
$data[$index] = mysqli_escape_string($mysqli, $value);
}
}
return $data;
} | php | public static function escapeValues(array $data, \mysqli $mysqli)
{
foreach($data as $index => $value)
{
if ($value !== null)
{
$data[$index] = mysqli_escape_string($mysqli, $value);
}
}
return $data;
} | [
"public",
"static",
"function",
"escapeValues",
"(",
"array",
"$",
"data",
",",
"\\",
"mysqli",
"$",
"mysqli",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"index",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"!==",
"null",
")",
"{",
"$",
"data",
"[",
"$",
"index",
"]",
"=",
"mysqli_escape_string",
"(",
"$",
"mysqli",
",",
"$",
"value",
")",
";",
"}",
"}",
"return",
"$",
"data",
";",
"}"
] | Escape an array of data for the database.
@param array $data - the data to be escaped, either as list or name/value pairs
@param \mysqli $mysqli - the mysqli connection we are going to use for escaping.
@return array - the escaped input array. | [
"Escape",
"an",
"array",
"of",
"data",
"for",
"the",
"database",
"."
] | 244871d2fbc2f3fac26ff4b98715224953d9befb | https://github.com/iRAP-software/package-core-libs/blob/244871d2fbc2f3fac26ff4b98715224953d9befb/src/MysqliLib.php#L98-L109 |
4,553 | iRAP-software/package-core-libs | src/MysqliLib.php | MysqliLib.generateBatchReplaceQuery | public static function generateBatchReplaceQuery(array $rows, $tableName, \mysqli $mysqli)
{
$query = "REPLACE " . self::generateBatchQueryCore($rows, $tableName, $mysqli);
return $query;
} | php | public static function generateBatchReplaceQuery(array $rows, $tableName, \mysqli $mysqli)
{
$query = "REPLACE " . self::generateBatchQueryCore($rows, $tableName, $mysqli);
return $query;
} | [
"public",
"static",
"function",
"generateBatchReplaceQuery",
"(",
"array",
"$",
"rows",
",",
"$",
"tableName",
",",
"\\",
"mysqli",
"$",
"mysqli",
")",
"{",
"$",
"query",
"=",
"\"REPLACE \"",
".",
"self",
"::",
"generateBatchQueryCore",
"(",
"$",
"rows",
",",
"$",
"tableName",
",",
"$",
"mysqli",
")",
";",
"return",
"$",
"query",
";",
"}"
] | Generates a single REPLACE query that can replace any number of rows. Replacements will
perform an insert except if a row with the same primary key or unique index already exists,
in which case an UPDATE will take place.
@param array $rows - the data we wish to insert/replace into the database.
@param string tableName - the name of the table being manipulated.
@param \mysqli $mysqli - the database connection that would be used for the query.
@return string - the generated query. | [
"Generates",
"a",
"single",
"REPLACE",
"query",
"that",
"can",
"replace",
"any",
"number",
"of",
"rows",
".",
"Replacements",
"will",
"perform",
"an",
"insert",
"except",
"if",
"a",
"row",
"with",
"the",
"same",
"primary",
"key",
"or",
"unique",
"index",
"already",
"exists",
"in",
"which",
"case",
"an",
"UPDATE",
"will",
"take",
"place",
"."
] | 244871d2fbc2f3fac26ff4b98715224953d9befb | https://github.com/iRAP-software/package-core-libs/blob/244871d2fbc2f3fac26ff4b98715224953d9befb/src/MysqliLib.php#L121-L125 |
4,554 | iRAP-software/package-core-libs | src/MysqliLib.php | MysqliLib.generateBatchInsertQuery | public static function generateBatchInsertQuery(array $rows, $tableName, \mysqli $mysqli)
{
$query = "INSERT " . self::generateBatchQueryCore($rows, $tableName, $mysqli);
return $query;
} | php | public static function generateBatchInsertQuery(array $rows, $tableName, \mysqli $mysqli)
{
$query = "INSERT " . self::generateBatchQueryCore($rows, $tableName, $mysqli);
return $query;
} | [
"public",
"static",
"function",
"generateBatchInsertQuery",
"(",
"array",
"$",
"rows",
",",
"$",
"tableName",
",",
"\\",
"mysqli",
"$",
"mysqli",
")",
"{",
"$",
"query",
"=",
"\"INSERT \"",
".",
"self",
"::",
"generateBatchQueryCore",
"(",
"$",
"rows",
",",
"$",
"tableName",
",",
"$",
"mysqli",
")",
";",
"return",
"$",
"query",
";",
"}"
] | Generates a single INSERT query that for any number of rows. This is one of the most
efficient ways to insert a lot of data.
@param array $rows - the data we wish to insert/replace into the database.
@param string tableName - the name of the table being manipulated.
@param \mysqli $mysqli - the database connection that would be used for the query.
@return string - the generated query. | [
"Generates",
"a",
"single",
"INSERT",
"query",
"that",
"for",
"any",
"number",
"of",
"rows",
".",
"This",
"is",
"one",
"of",
"the",
"most",
"efficient",
"ways",
"to",
"insert",
"a",
"lot",
"of",
"data",
"."
] | 244871d2fbc2f3fac26ff4b98715224953d9befb | https://github.com/iRAP-software/package-core-libs/blob/244871d2fbc2f3fac26ff4b98715224953d9befb/src/MysqliLib.php#L136-L140 |
4,555 | iRAP-software/package-core-libs | src/MysqliLib.php | MysqliLib.generateBatchQueryCore | private static function generateBatchQueryCore(array $rows, $tableName, \mysqli $mysqli)
{
$firstRow = true;
$dataStringRows = array(); # will hold an array list of strings like "('x', 'y', 'z')"
if (count($rows) == 0)
{
throw new \Exception("Cannot create batch query with no data.");
}
foreach ($rows as $row)
{
if ($firstRow)
{
$columns = array_keys($row);
sort($columns);
$firstRow = false;
}
ksort($row);
$escapedRow = self::escapeValues($row, $mysqli);
$quotedValues = array();
# Need just the values, but order is very important.
foreach ($escapedRow as $columnName => $value)
{
if ($value !== null)
{
$quotedValues[] = "'" . $value . "'";
}
else
{
$quotedValues[] = 'NULL';
}
}
$dataStringRows[] = "(" . implode(",", $quotedValues) . ")";
}
$columns = ArrayLib::wrapElements($columns, '`');
$query = "INTO `" . $tableName . "` (" . implode(',', $columns) . ") " .
"VALUES " . implode(",", $dataStringRows);
return $query;
} | php | private static function generateBatchQueryCore(array $rows, $tableName, \mysqli $mysqli)
{
$firstRow = true;
$dataStringRows = array(); # will hold an array list of strings like "('x', 'y', 'z')"
if (count($rows) == 0)
{
throw new \Exception("Cannot create batch query with no data.");
}
foreach ($rows as $row)
{
if ($firstRow)
{
$columns = array_keys($row);
sort($columns);
$firstRow = false;
}
ksort($row);
$escapedRow = self::escapeValues($row, $mysqli);
$quotedValues = array();
# Need just the values, but order is very important.
foreach ($escapedRow as $columnName => $value)
{
if ($value !== null)
{
$quotedValues[] = "'" . $value . "'";
}
else
{
$quotedValues[] = 'NULL';
}
}
$dataStringRows[] = "(" . implode(",", $quotedValues) . ")";
}
$columns = ArrayLib::wrapElements($columns, '`');
$query = "INTO `" . $tableName . "` (" . implode(',', $columns) . ") " .
"VALUES " . implode(",", $dataStringRows);
return $query;
} | [
"private",
"static",
"function",
"generateBatchQueryCore",
"(",
"array",
"$",
"rows",
",",
"$",
"tableName",
",",
"\\",
"mysqli",
"$",
"mysqli",
")",
"{",
"$",
"firstRow",
"=",
"true",
";",
"$",
"dataStringRows",
"=",
"array",
"(",
")",
";",
"# will hold an array list of strings like \"('x', 'y', 'z')\"",
"if",
"(",
"count",
"(",
"$",
"rows",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Cannot create batch query with no data.\"",
")",
";",
"}",
"foreach",
"(",
"$",
"rows",
"as",
"$",
"row",
")",
"{",
"if",
"(",
"$",
"firstRow",
")",
"{",
"$",
"columns",
"=",
"array_keys",
"(",
"$",
"row",
")",
";",
"sort",
"(",
"$",
"columns",
")",
";",
"$",
"firstRow",
"=",
"false",
";",
"}",
"ksort",
"(",
"$",
"row",
")",
";",
"$",
"escapedRow",
"=",
"self",
"::",
"escapeValues",
"(",
"$",
"row",
",",
"$",
"mysqli",
")",
";",
"$",
"quotedValues",
"=",
"array",
"(",
")",
";",
"# Need just the values, but order is very important.",
"foreach",
"(",
"$",
"escapedRow",
"as",
"$",
"columnName",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"!==",
"null",
")",
"{",
"$",
"quotedValues",
"[",
"]",
"=",
"\"'\"",
".",
"$",
"value",
".",
"\"'\"",
";",
"}",
"else",
"{",
"$",
"quotedValues",
"[",
"]",
"=",
"'NULL'",
";",
"}",
"}",
"$",
"dataStringRows",
"[",
"]",
"=",
"\"(\"",
".",
"implode",
"(",
"\",\"",
",",
"$",
"quotedValues",
")",
".",
"\")\"",
";",
"}",
"$",
"columns",
"=",
"ArrayLib",
"::",
"wrapElements",
"(",
"$",
"columns",
",",
"'`'",
")",
";",
"$",
"query",
"=",
"\"INTO `\"",
".",
"$",
"tableName",
".",
"\"` (\"",
".",
"implode",
"(",
"','",
",",
"$",
"columns",
")",
".",
"\") \"",
".",
"\"VALUES \"",
".",
"implode",
"(",
"\",\"",
",",
"$",
"dataStringRows",
")",
";",
"return",
"$",
"query",
";",
"}"
] | Helper function to generateBatchReplaceQuery and generateBatchInsertQuery which are 99%
exactly the same except for the word REPLACE or INSERT.
@param array $rows - the data we wish to insert/replace into the database.
@param string tableName - the name of the table being manipulated.
@param \mysqli $mysqli - the database connection that would be used for the query.
@return string - the generated query.
@throws \Exception - if there is no data in the rows table and thus no query to generate. | [
"Helper",
"function",
"to",
"generateBatchReplaceQuery",
"and",
"generateBatchInsertQuery",
"which",
"are",
"99%",
"exactly",
"the",
"same",
"except",
"for",
"the",
"word",
"REPLACE",
"or",
"INSERT",
"."
] | 244871d2fbc2f3fac26ff4b98715224953d9befb | https://github.com/iRAP-software/package-core-libs/blob/244871d2fbc2f3fac26ff4b98715224953d9befb/src/MysqliLib.php#L152-L196 |
4,556 | iRAP-software/package-core-libs | src/MysqliLib.php | MysqliLib.convertResultToArrayList | public static function convertResultToArrayList(\mysqli_result $result)
{
$list = array();
while (($row = $result->fetch_assoc()) != null)
{
$list[] = $row;
}
return $list;
} | php | public static function convertResultToArrayList(\mysqli_result $result)
{
$list = array();
while (($row = $result->fetch_assoc()) != null)
{
$list[] = $row;
}
return $list;
} | [
"public",
"static",
"function",
"convertResultToArrayList",
"(",
"\\",
"mysqli_result",
"$",
"result",
")",
"{",
"$",
"list",
"=",
"array",
"(",
")",
";",
"while",
"(",
"(",
"$",
"row",
"=",
"$",
"result",
"->",
"fetch_assoc",
"(",
")",
")",
"!=",
"null",
")",
"{",
"$",
"list",
"[",
"]",
"=",
"$",
"row",
";",
"}",
"return",
"$",
"list",
";",
"}"
] | Convert a mysqli_result object into a list of rows. This is not memory efficient
but can save the developer from writing a loop.
@param mysqli_result $result
@return array | [
"Convert",
"a",
"mysqli_result",
"object",
"into",
"a",
"list",
"of",
"rows",
".",
"This",
"is",
"not",
"memory",
"efficient",
"but",
"can",
"save",
"the",
"developer",
"from",
"writing",
"a",
"loop",
"."
] | 244871d2fbc2f3fac26ff4b98715224953d9befb | https://github.com/iRAP-software/package-core-libs/blob/244871d2fbc2f3fac26ff4b98715224953d9befb/src/MysqliLib.php#L205-L215 |
4,557 | iRAP-software/package-core-libs | src/MysqliLib.php | MysqliLib.getTableColumnNames | public static function getTableColumnNames(\mysqli $mysqliConn, string $tableName) : array
{
$sql = "SHOW COLUMNS FROM `{$tableName}`";
$result = $mysqliConn->query($sql);
$columns = array();
while (($row = $result->fetch_array()) != null)
{
$columns[] = $row[0];
}
return $columns;
} | php | public static function getTableColumnNames(\mysqli $mysqliConn, string $tableName) : array
{
$sql = "SHOW COLUMNS FROM `{$tableName}`";
$result = $mysqliConn->query($sql);
$columns = array();
while (($row = $result->fetch_array()) != null)
{
$columns[] = $row[0];
}
return $columns;
} | [
"public",
"static",
"function",
"getTableColumnNames",
"(",
"\\",
"mysqli",
"$",
"mysqliConn",
",",
"string",
"$",
"tableName",
")",
":",
"array",
"{",
"$",
"sql",
"=",
"\"SHOW COLUMNS FROM `{$tableName}`\"",
";",
"$",
"result",
"=",
"$",
"mysqliConn",
"->",
"query",
"(",
"$",
"sql",
")",
";",
"$",
"columns",
"=",
"array",
"(",
")",
";",
"while",
"(",
"(",
"$",
"row",
"=",
"$",
"result",
"->",
"fetch_array",
"(",
")",
")",
"!=",
"null",
")",
"{",
"$",
"columns",
"[",
"]",
"=",
"$",
"row",
"[",
"0",
"]",
";",
"}",
"return",
"$",
"columns",
";",
"}"
] | Fetches the names of the columns for a particular table.
@return array - the collection of column names | [
"Fetches",
"the",
"names",
"of",
"the",
"columns",
"for",
"a",
"particular",
"table",
"."
] | 244871d2fbc2f3fac26ff4b98715224953d9befb | https://github.com/iRAP-software/package-core-libs/blob/244871d2fbc2f3fac26ff4b98715224953d9befb/src/MysqliLib.php#L318-L331 |
4,558 | iRAP-software/package-core-libs | src/MysqliLib.php | MysqliLib.getTableHash | public static function getTableHash(
\mysqli $mysqliConn,
string $tableName,
array $columns = array()
) : string
{
$tableHash = "";
if (count($columns) == 0)
{
$columns = MysqliLib::getTableColumnNames($mysqliConn, $tableName);
sort($columns);
}
$wrappedColumnList = array();
# Using coalesce to prevent null values causing sync issues as raised in the
# NullColumnTest test. E.g. [2, null, null] and [null, 2, null] would be considered equal
# otherwise.
foreach ($columns as $column)
{
$wrappedColumnList[] = "COALESCE(`" . $column . "`, 'NULL')";
}
# This fixes an issue with using group_concat on extremely large tables (num rows)
# and allows for tables with up to 576,460,752,303,423,000 rows
# (18,446,744,073,709,547,520 / 33)
$mysqliConn->query("SET group_concat_max_len = 18446744073709547520");
$primaryKeyArray = MysqliLib::fetchPrimaryKey($mysqliConn, $tableName);
$primaryKeyString = MysqliLib::convertPrimaryKeyArrayToString($primaryKeyArray);
$orderByString = $primaryKeyString;
$query =
"SELECT MD5(GROUP_CONCAT(MD5(CONCAT_WS('#'," . implode(',', $wrappedColumnList) . ")))) " .
"AS `hash` " .
"FROM `{$tableName}` ORDER BY {$orderByString}";
/* @var $result mysqli_result */
$result = $mysqliConn->query($query);
if ($result !== FALSE)
{
$row = $result->fetch_assoc();
if ($row['hash'] === NULL)
{
// table has no data
$tablehash = "";
}
else
{
$tableHash = $row['hash'];
}
}
else
{
throw new \Exception("Failed to fetch table hash");
}
return $tableHash;
} | php | public static function getTableHash(
\mysqli $mysqliConn,
string $tableName,
array $columns = array()
) : string
{
$tableHash = "";
if (count($columns) == 0)
{
$columns = MysqliLib::getTableColumnNames($mysqliConn, $tableName);
sort($columns);
}
$wrappedColumnList = array();
# Using coalesce to prevent null values causing sync issues as raised in the
# NullColumnTest test. E.g. [2, null, null] and [null, 2, null] would be considered equal
# otherwise.
foreach ($columns as $column)
{
$wrappedColumnList[] = "COALESCE(`" . $column . "`, 'NULL')";
}
# This fixes an issue with using group_concat on extremely large tables (num rows)
# and allows for tables with up to 576,460,752,303,423,000 rows
# (18,446,744,073,709,547,520 / 33)
$mysqliConn->query("SET group_concat_max_len = 18446744073709547520");
$primaryKeyArray = MysqliLib::fetchPrimaryKey($mysqliConn, $tableName);
$primaryKeyString = MysqliLib::convertPrimaryKeyArrayToString($primaryKeyArray);
$orderByString = $primaryKeyString;
$query =
"SELECT MD5(GROUP_CONCAT(MD5(CONCAT_WS('#'," . implode(',', $wrappedColumnList) . ")))) " .
"AS `hash` " .
"FROM `{$tableName}` ORDER BY {$orderByString}";
/* @var $result mysqli_result */
$result = $mysqliConn->query($query);
if ($result !== FALSE)
{
$row = $result->fetch_assoc();
if ($row['hash'] === NULL)
{
// table has no data
$tablehash = "";
}
else
{
$tableHash = $row['hash'];
}
}
else
{
throw new \Exception("Failed to fetch table hash");
}
return $tableHash;
} | [
"public",
"static",
"function",
"getTableHash",
"(",
"\\",
"mysqli",
"$",
"mysqliConn",
",",
"string",
"$",
"tableName",
",",
"array",
"$",
"columns",
"=",
"array",
"(",
")",
")",
":",
"string",
"{",
"$",
"tableHash",
"=",
"\"\"",
";",
"if",
"(",
"count",
"(",
"$",
"columns",
")",
"==",
"0",
")",
"{",
"$",
"columns",
"=",
"MysqliLib",
"::",
"getTableColumnNames",
"(",
"$",
"mysqliConn",
",",
"$",
"tableName",
")",
";",
"sort",
"(",
"$",
"columns",
")",
";",
"}",
"$",
"wrappedColumnList",
"=",
"array",
"(",
")",
";",
"# Using coalesce to prevent null values causing sync issues as raised in the",
"# NullColumnTest test. E.g. [2, null, null] and [null, 2, null] would be considered equal",
"# otherwise.",
"foreach",
"(",
"$",
"columns",
"as",
"$",
"column",
")",
"{",
"$",
"wrappedColumnList",
"[",
"]",
"=",
"\"COALESCE(`\"",
".",
"$",
"column",
".",
"\"`, 'NULL')\"",
";",
"}",
"# This fixes an issue with using group_concat on extremely large tables (num rows)",
"# and allows for tables with up to 576,460,752,303,423,000 rows ",
"# (18,446,744,073,709,547,520 / 33)",
"$",
"mysqliConn",
"->",
"query",
"(",
"\"SET group_concat_max_len = 18446744073709547520\"",
")",
";",
"$",
"primaryKeyArray",
"=",
"MysqliLib",
"::",
"fetchPrimaryKey",
"(",
"$",
"mysqliConn",
",",
"$",
"tableName",
")",
";",
"$",
"primaryKeyString",
"=",
"MysqliLib",
"::",
"convertPrimaryKeyArrayToString",
"(",
"$",
"primaryKeyArray",
")",
";",
"$",
"orderByString",
"=",
"$",
"primaryKeyString",
";",
"$",
"query",
"=",
"\"SELECT MD5(GROUP_CONCAT(MD5(CONCAT_WS('#',\"",
".",
"implode",
"(",
"','",
",",
"$",
"wrappedColumnList",
")",
".",
"\")))) \"",
".",
"\"AS `hash` \"",
".",
"\"FROM `{$tableName}` ORDER BY {$orderByString}\"",
";",
"/* @var $result mysqli_result */",
"$",
"result",
"=",
"$",
"mysqliConn",
"->",
"query",
"(",
"$",
"query",
")",
";",
"if",
"(",
"$",
"result",
"!==",
"FALSE",
")",
"{",
"$",
"row",
"=",
"$",
"result",
"->",
"fetch_assoc",
"(",
")",
";",
"if",
"(",
"$",
"row",
"[",
"'hash'",
"]",
"===",
"NULL",
")",
"{",
"// table has no data",
"$",
"tablehash",
"=",
"\"\"",
";",
"}",
"else",
"{",
"$",
"tableHash",
"=",
"$",
"row",
"[",
"'hash'",
"]",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Failed to fetch table hash\"",
")",
";",
"}",
"return",
"$",
"tableHash",
";",
"}"
] | Generates a hash for the entire table so we can quickly compare tables to see if they are
the same. The hash will be an empty string if the table has no data.
@param \iRAP\CoreLibs\mysqli $mysqliConn
@param string $tableName - the name of the table to fetch a hash for.
@param array $columns - optionally specify the columns of the table to hash. If not provided,
then we will get the column names, sort alphabetically, and return
the hash of that.
WARNING - order matters as it will change the hash and we do not
perform any sorting by index etc.
@return string - the md5 of the table data.
@throws Exception | [
"Generates",
"a",
"hash",
"for",
"the",
"entire",
"table",
"so",
"we",
"can",
"quickly",
"compare",
"tables",
"to",
"see",
"if",
"they",
"are",
"the",
"same",
".",
"The",
"hash",
"will",
"be",
"an",
"empty",
"string",
"if",
"the",
"table",
"has",
"no",
"data",
"."
] | 244871d2fbc2f3fac26ff4b98715224953d9befb | https://github.com/iRAP-software/package-core-libs/blob/244871d2fbc2f3fac26ff4b98715224953d9befb/src/MysqliLib.php#L347-L408 |
4,559 | iRAP-software/package-core-libs | src/MysqliLib.php | MysqliLib.fetchPrimaryKey | public static function fetchPrimaryKey(\mysqli $mysqliConn, string $tableName) : array
{
$primaryKeyArray = array();
$query = "show index FROM `" . $tableName . "`";
/*@var $result mysqli_result */
$result = $mysqliConn->query($query);
if ($result === FALSE)
{
throw new \Exception("Failed to fetch primary key", 500);
}
while (($row = $result->fetch_assoc()) != null)
{
if ($row["Key_name"] === "PRIMARY")
{
$primaryKeyArray[] = $row["Column_name"];
}
}
if (count($primaryKeyArray) == 0)
{
throw new \Exception($tableName . " does not have a primary key.");
}
return $primaryKeyArray;
} | php | public static function fetchPrimaryKey(\mysqli $mysqliConn, string $tableName) : array
{
$primaryKeyArray = array();
$query = "show index FROM `" . $tableName . "`";
/*@var $result mysqli_result */
$result = $mysqliConn->query($query);
if ($result === FALSE)
{
throw new \Exception("Failed to fetch primary key", 500);
}
while (($row = $result->fetch_assoc()) != null)
{
if ($row["Key_name"] === "PRIMARY")
{
$primaryKeyArray[] = $row["Column_name"];
}
}
if (count($primaryKeyArray) == 0)
{
throw new \Exception($tableName . " does not have a primary key.");
}
return $primaryKeyArray;
} | [
"public",
"static",
"function",
"fetchPrimaryKey",
"(",
"\\",
"mysqli",
"$",
"mysqliConn",
",",
"string",
"$",
"tableName",
")",
":",
"array",
"{",
"$",
"primaryKeyArray",
"=",
"array",
"(",
")",
";",
"$",
"query",
"=",
"\"show index FROM `\"",
".",
"$",
"tableName",
".",
"\"`\"",
";",
"/*@var $result mysqli_result */",
"$",
"result",
"=",
"$",
"mysqliConn",
"->",
"query",
"(",
"$",
"query",
")",
";",
"if",
"(",
"$",
"result",
"===",
"FALSE",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Failed to fetch primary key\"",
",",
"500",
")",
";",
"}",
"while",
"(",
"(",
"$",
"row",
"=",
"$",
"result",
"->",
"fetch_assoc",
"(",
")",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"$",
"row",
"[",
"\"Key_name\"",
"]",
"===",
"\"PRIMARY\"",
")",
"{",
"$",
"primaryKeyArray",
"[",
"]",
"=",
"$",
"row",
"[",
"\"Column_name\"",
"]",
";",
"}",
"}",
"if",
"(",
"count",
"(",
"$",
"primaryKeyArray",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"$",
"tableName",
".",
"\" does not have a primary key.\"",
")",
";",
"}",
"return",
"$",
"primaryKeyArray",
";",
"}"
] | Dynamically discovers the primary key for this table and sets this objects member variable
accordingly. This returns an array
@param \mysqli $mysqliConn - the mysqli connection to get primary key through.
@param string $tableName - the name of the table to fetch the primary key for.
@return array - the column names that act as the primary key because it could be
a combined key.
@throws Exception | [
"Dynamically",
"discovers",
"the",
"primary",
"key",
"for",
"this",
"table",
"and",
"sets",
"this",
"objects",
"member",
"variable",
"accordingly",
".",
"This",
"returns",
"an",
"array"
] | 244871d2fbc2f3fac26ff4b98715224953d9befb | https://github.com/iRAP-software/package-core-libs/blob/244871d2fbc2f3fac26ff4b98715224953d9befb/src/MysqliLib.php#L434-L461 |
4,560 | tomvlk/sweet-orm | src/SweetORM/ConnectionManager.php | ConnectionManager.createConnection | private static function createConnection()
{
// Validate if configuration has enough details.
$driver = Configuration::get('database_driver');
// Make DSN and options
$dsn = "";
$options = Configuration::get('database-options');
$options = !is_array($options) ? array() : $options;
$user = null;
$password = null;
if ($driver === 'pdo_sqlite') {
// We will ignore this for now, as it's not tested with SQLite yet!
// @codeCoverageIgnoreStart
$path = Configuration::get('database_path');
if (! $path || ! file_exists($path)) {
throw new \Exception("SQLite Database File doesn't exists or not configured! '".$path."'");
}
$dsn = "sqlite:" . $path;
// @codeCoverageIgnoreEnd
}else if ($driver === 'pdo_mysql') {
$host = Configuration::get('database_host');
$database = Configuration::get('database_db');
$user = Configuration::get('database_user');
$password = Configuration::get('database_password');
$port = Configuration::get('database_port');
$port = !is_int($port) ? 3306 : $port;
$encoding = Configuration::get('database_encoding');
$encoding = $encoding == null ? 'utf8' : $encoding;
if (is_null($host) || is_null($database) || is_null($user) || is_null($password)) {
throw new \Exception("Please configure the ORM first. We can't get a connection now!");
}
$dsn = "mysql:host=" . $host . ";port=" . $port . ";dbname=" . $database . ";charset=" . $encoding;
}else{
throw new \Exception("Please configure the ORM first. We can't get a connection now! No driver given!");
}
// Make connection
self::$connection = new \PDO($dsn, $user, $password, $options);
} | php | private static function createConnection()
{
// Validate if configuration has enough details.
$driver = Configuration::get('database_driver');
// Make DSN and options
$dsn = "";
$options = Configuration::get('database-options');
$options = !is_array($options) ? array() : $options;
$user = null;
$password = null;
if ($driver === 'pdo_sqlite') {
// We will ignore this for now, as it's not tested with SQLite yet!
// @codeCoverageIgnoreStart
$path = Configuration::get('database_path');
if (! $path || ! file_exists($path)) {
throw new \Exception("SQLite Database File doesn't exists or not configured! '".$path."'");
}
$dsn = "sqlite:" . $path;
// @codeCoverageIgnoreEnd
}else if ($driver === 'pdo_mysql') {
$host = Configuration::get('database_host');
$database = Configuration::get('database_db');
$user = Configuration::get('database_user');
$password = Configuration::get('database_password');
$port = Configuration::get('database_port');
$port = !is_int($port) ? 3306 : $port;
$encoding = Configuration::get('database_encoding');
$encoding = $encoding == null ? 'utf8' : $encoding;
if (is_null($host) || is_null($database) || is_null($user) || is_null($password)) {
throw new \Exception("Please configure the ORM first. We can't get a connection now!");
}
$dsn = "mysql:host=" . $host . ";port=" . $port . ";dbname=" . $database . ";charset=" . $encoding;
}else{
throw new \Exception("Please configure the ORM first. We can't get a connection now! No driver given!");
}
// Make connection
self::$connection = new \PDO($dsn, $user, $password, $options);
} | [
"private",
"static",
"function",
"createConnection",
"(",
")",
"{",
"// Validate if configuration has enough details.",
"$",
"driver",
"=",
"Configuration",
"::",
"get",
"(",
"'database_driver'",
")",
";",
"// Make DSN and options",
"$",
"dsn",
"=",
"\"\"",
";",
"$",
"options",
"=",
"Configuration",
"::",
"get",
"(",
"'database-options'",
")",
";",
"$",
"options",
"=",
"!",
"is_array",
"(",
"$",
"options",
")",
"?",
"array",
"(",
")",
":",
"$",
"options",
";",
"$",
"user",
"=",
"null",
";",
"$",
"password",
"=",
"null",
";",
"if",
"(",
"$",
"driver",
"===",
"'pdo_sqlite'",
")",
"{",
"// We will ignore this for now, as it's not tested with SQLite yet!",
"// @codeCoverageIgnoreStart",
"$",
"path",
"=",
"Configuration",
"::",
"get",
"(",
"'database_path'",
")",
";",
"if",
"(",
"!",
"$",
"path",
"||",
"!",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"SQLite Database File doesn't exists or not configured! '\"",
".",
"$",
"path",
".",
"\"'\"",
")",
";",
"}",
"$",
"dsn",
"=",
"\"sqlite:\"",
".",
"$",
"path",
";",
"// @codeCoverageIgnoreEnd",
"}",
"else",
"if",
"(",
"$",
"driver",
"===",
"'pdo_mysql'",
")",
"{",
"$",
"host",
"=",
"Configuration",
"::",
"get",
"(",
"'database_host'",
")",
";",
"$",
"database",
"=",
"Configuration",
"::",
"get",
"(",
"'database_db'",
")",
";",
"$",
"user",
"=",
"Configuration",
"::",
"get",
"(",
"'database_user'",
")",
";",
"$",
"password",
"=",
"Configuration",
"::",
"get",
"(",
"'database_password'",
")",
";",
"$",
"port",
"=",
"Configuration",
"::",
"get",
"(",
"'database_port'",
")",
";",
"$",
"port",
"=",
"!",
"is_int",
"(",
"$",
"port",
")",
"?",
"3306",
":",
"$",
"port",
";",
"$",
"encoding",
"=",
"Configuration",
"::",
"get",
"(",
"'database_encoding'",
")",
";",
"$",
"encoding",
"=",
"$",
"encoding",
"==",
"null",
"?",
"'utf8'",
":",
"$",
"encoding",
";",
"if",
"(",
"is_null",
"(",
"$",
"host",
")",
"||",
"is_null",
"(",
"$",
"database",
")",
"||",
"is_null",
"(",
"$",
"user",
")",
"||",
"is_null",
"(",
"$",
"password",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Please configure the ORM first. We can't get a connection now!\"",
")",
";",
"}",
"$",
"dsn",
"=",
"\"mysql:host=\"",
".",
"$",
"host",
".",
"\";port=\"",
".",
"$",
"port",
".",
"\";dbname=\"",
".",
"$",
"database",
".",
"\";charset=\"",
".",
"$",
"encoding",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Please configure the ORM first. We can't get a connection now! No driver given!\"",
")",
";",
"}",
"// Make connection",
"self",
"::",
"$",
"connection",
"=",
"new",
"\\",
"PDO",
"(",
"$",
"dsn",
",",
"$",
"user",
",",
"$",
"password",
",",
"$",
"options",
")",
";",
"}"
] | Create PDO connection with current Configuration
@throws \Exception | [
"Create",
"PDO",
"connection",
"with",
"current",
"Configuration"
] | bca014a9f83be34c87b14d6c8a36156e24577374 | https://github.com/tomvlk/sweet-orm/blob/bca014a9f83be34c87b14d6c8a36156e24577374/src/SweetORM/ConnectionManager.php#L67-L114 |
4,561 | cityware/city-wmi | src/Processors/Processors.php | Processors.get | public function get()
{
$processors = [];
$result = $this->connection->newQuery()->from(Classes::WIN32_PROCESSOR)->get();
foreach($result as $processor) {
$processors[] = new Processor($processor);
}
return $processors;
} | php | public function get()
{
$processors = [];
$result = $this->connection->newQuery()->from(Classes::WIN32_PROCESSOR)->get();
foreach($result as $processor) {
$processors[] = new Processor($processor);
}
return $processors;
} | [
"public",
"function",
"get",
"(",
")",
"{",
"$",
"processors",
"=",
"[",
"]",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"connection",
"->",
"newQuery",
"(",
")",
"->",
"from",
"(",
"Classes",
"::",
"WIN32_PROCESSOR",
")",
"->",
"get",
"(",
")",
";",
"foreach",
"(",
"$",
"result",
"as",
"$",
"processor",
")",
"{",
"$",
"processors",
"[",
"]",
"=",
"new",
"Processor",
"(",
"$",
"processor",
")",
";",
"}",
"return",
"$",
"processors",
";",
"}"
] | Returns all processors on the computer.
@return array | [
"Returns",
"all",
"processors",
"on",
"the",
"computer",
"."
] | c7296e6855b6719f537ff5c2dc19d521ce1415d8 | https://github.com/cityware/city-wmi/blob/c7296e6855b6719f537ff5c2dc19d521ce1415d8/src/Processors/Processors.php#L15-L26 |
4,562 | Silvestra/Silvestra | src/Silvestra/Component/Admin/Menu/Event/AdminMenuEvent.php | AdminMenuEvent.getItems | public function getItems()
{
uasort(
$this->items,
function (AdminMenuItem $first, AdminMenuItem $second) {
if ($first->getPriority() <= $second->getPriority()) {
return 1;
}
return -1;
}
);
return $this->items;
} | php | public function getItems()
{
uasort(
$this->items,
function (AdminMenuItem $first, AdminMenuItem $second) {
if ($first->getPriority() <= $second->getPriority()) {
return 1;
}
return -1;
}
);
return $this->items;
} | [
"public",
"function",
"getItems",
"(",
")",
"{",
"uasort",
"(",
"$",
"this",
"->",
"items",
",",
"function",
"(",
"AdminMenuItem",
"$",
"first",
",",
"AdminMenuItem",
"$",
"second",
")",
"{",
"if",
"(",
"$",
"first",
"->",
"getPriority",
"(",
")",
"<=",
"$",
"second",
"->",
"getPriority",
"(",
")",
")",
"{",
"return",
"1",
";",
"}",
"return",
"-",
"1",
";",
"}",
")",
";",
"return",
"$",
"this",
"->",
"items",
";",
"}"
] | Get admin menu items.
@return array|AdminMenuItem[] | [
"Get",
"admin",
"menu",
"items",
"."
] | b7367601b01495ae3c492b42042f804dee13ab06 | https://github.com/Silvestra/Silvestra/blob/b7367601b01495ae3c492b42042f804dee13ab06/src/Silvestra/Component/Admin/Menu/Event/AdminMenuEvent.php#L42-L56 |
4,563 | mizzencms/core | src/Navigation/Navigation.php | Navigation.setMenuAttributes | public function setMenuAttributes($type, ItemInterface $menu)
{
if (isset($this->getBag()->get('config')->nav->attributes->{$type})) {
$attributes = (array) $this->getBag()
->get('config')
->nav
->attributes
->{$type}
;
switch ($type) {
case 'root': // set attribs on top ul
$menu->setChildrenAttributes($attributes);
break;
case 'parent': // set attribs on sub uls
$menu->setChildrenAttributes($attributes);
break;
case 'child': // set attribs on li
$menu->setAttributes($attributes);
break;
case 'link': // set attribs on a tags
$menu->setLinkAttributes($attributes);
break;
case 'label': // set attribs on span tags
$menu->setLabelAttributes($attributes);
break;
default:
break;
}
}
} | php | public function setMenuAttributes($type, ItemInterface $menu)
{
if (isset($this->getBag()->get('config')->nav->attributes->{$type})) {
$attributes = (array) $this->getBag()
->get('config')
->nav
->attributes
->{$type}
;
switch ($type) {
case 'root': // set attribs on top ul
$menu->setChildrenAttributes($attributes);
break;
case 'parent': // set attribs on sub uls
$menu->setChildrenAttributes($attributes);
break;
case 'child': // set attribs on li
$menu->setAttributes($attributes);
break;
case 'link': // set attribs on a tags
$menu->setLinkAttributes($attributes);
break;
case 'label': // set attribs on span tags
$menu->setLabelAttributes($attributes);
break;
default:
break;
}
}
} | [
"public",
"function",
"setMenuAttributes",
"(",
"$",
"type",
",",
"ItemInterface",
"$",
"menu",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"getBag",
"(",
")",
"->",
"get",
"(",
"'config'",
")",
"->",
"nav",
"->",
"attributes",
"->",
"{",
"$",
"type",
"}",
")",
")",
"{",
"$",
"attributes",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"getBag",
"(",
")",
"->",
"get",
"(",
"'config'",
")",
"->",
"nav",
"->",
"attributes",
"->",
"{",
"$",
"type",
"}",
";",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"'root'",
":",
"// set attribs on top ul",
"$",
"menu",
"->",
"setChildrenAttributes",
"(",
"$",
"attributes",
")",
";",
"break",
";",
"case",
"'parent'",
":",
"// set attribs on sub uls",
"$",
"menu",
"->",
"setChildrenAttributes",
"(",
"$",
"attributes",
")",
";",
"break",
";",
"case",
"'child'",
":",
"// set attribs on li",
"$",
"menu",
"->",
"setAttributes",
"(",
"$",
"attributes",
")",
";",
"break",
";",
"case",
"'link'",
":",
"// set attribs on a tags",
"$",
"menu",
"->",
"setLinkAttributes",
"(",
"$",
"attributes",
")",
";",
"break",
";",
"case",
"'label'",
":",
"// set attribs on span tags",
"$",
"menu",
"->",
"setLabelAttributes",
"(",
"$",
"attributes",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"}",
"}"
] | Responsible for adding attributes to menu item groups
@param string $type see switch for details
@param ItemInterface $menu | [
"Responsible",
"for",
"adding",
"attributes",
"to",
"menu",
"item",
"groups"
] | d4efb4d1af7f3948fa7bee43d54298c6164ac5bb | https://github.com/mizzencms/core/blob/d4efb4d1af7f3948fa7bee43d54298c6164ac5bb/src/Navigation/Navigation.php#L124-L153 |
4,564 | mtoolkit/mtoolkit-core | src/MFileInfo.php | MFileInfo.exists | public function exists(): bool
{
if ($this->caching == false) {
return file_exists($this->getAbsoluteFilePath());
}
if ($this->exists == null) {
$this->exists = file_exists($this->getAbsoluteFilePath());
}
return $this->exists;
} | php | public function exists(): bool
{
if ($this->caching == false) {
return file_exists($this->getAbsoluteFilePath());
}
if ($this->exists == null) {
$this->exists = file_exists($this->getAbsoluteFilePath());
}
return $this->exists;
} | [
"public",
"function",
"exists",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"caching",
"==",
"false",
")",
"{",
"return",
"file_exists",
"(",
"$",
"this",
"->",
"getAbsoluteFilePath",
"(",
")",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"exists",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"exists",
"=",
"file_exists",
"(",
"$",
"this",
"->",
"getAbsoluteFilePath",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"exists",
";",
"}"
] | Returns true if the file exists; otherwise returns false.
@return boolean | [
"Returns",
"true",
"if",
"the",
"file",
"exists",
";",
"otherwise",
"returns",
"false",
"."
] | 66c53273288a8652ff38240e063bdcffdf7c30aa | https://github.com/mtoolkit/mtoolkit-core/blob/66c53273288a8652ff38240e063bdcffdf7c30aa/src/MFileInfo.php#L218-L229 |
4,565 | mtoolkit/mtoolkit-core | src/MFileInfo.php | MFileInfo.getGroup | public function getGroup(): string
{
if ($this->caching == false) {
$groupId = $this->getGroupId();
if ($groupId == -2) {
return "";
}
$group = posix_getgrgid($groupId);
return $group["name"];
}
if ($this->group == null) {
$groupId = $this->getOwnerId();
if ($groupId == -2) {
$this->group = "";
}
$group = posix_getpwuid($groupId);
$this->group = $group["name"];
}
return $this->group;
} | php | public function getGroup(): string
{
if ($this->caching == false) {
$groupId = $this->getGroupId();
if ($groupId == -2) {
return "";
}
$group = posix_getgrgid($groupId);
return $group["name"];
}
if ($this->group == null) {
$groupId = $this->getOwnerId();
if ($groupId == -2) {
$this->group = "";
}
$group = posix_getpwuid($groupId);
$this->group = $group["name"];
}
return $this->group;
} | [
"public",
"function",
"getGroup",
"(",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"caching",
"==",
"false",
")",
"{",
"$",
"groupId",
"=",
"$",
"this",
"->",
"getGroupId",
"(",
")",
";",
"if",
"(",
"$",
"groupId",
"==",
"-",
"2",
")",
"{",
"return",
"\"\"",
";",
"}",
"$",
"group",
"=",
"posix_getgrgid",
"(",
"$",
"groupId",
")",
";",
"return",
"$",
"group",
"[",
"\"name\"",
"]",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"group",
"==",
"null",
")",
"{",
"$",
"groupId",
"=",
"$",
"this",
"->",
"getOwnerId",
"(",
")",
";",
"if",
"(",
"$",
"groupId",
"==",
"-",
"2",
")",
"{",
"$",
"this",
"->",
"group",
"=",
"\"\"",
";",
"}",
"$",
"group",
"=",
"posix_getpwuid",
"(",
"$",
"groupId",
")",
";",
"$",
"this",
"->",
"group",
"=",
"$",
"group",
"[",
"\"name\"",
"]",
";",
"}",
"return",
"$",
"this",
"->",
"group",
";",
"}"
] | Returns the group of the file. On Windows, on systems where files do not
have groups, or if an error occurs, an empty string is returned.
@return string | [
"Returns",
"the",
"group",
"of",
"the",
"file",
".",
"On",
"Windows",
"on",
"systems",
"where",
"files",
"do",
"not",
"have",
"groups",
"or",
"if",
"an",
"error",
"occurs",
"an",
"empty",
"string",
"is",
"returned",
"."
] | 66c53273288a8652ff38240e063bdcffdf7c30aa | https://github.com/mtoolkit/mtoolkit-core/blob/66c53273288a8652ff38240e063bdcffdf7c30aa/src/MFileInfo.php#L257-L284 |
4,566 | mtoolkit/mtoolkit-core | src/MFileInfo.php | MFileInfo.isDir | public function isDir(): bool
{
if ($this->caching == false) {
return is_dir($this->getAbsoluteFilePath());
}
if ($this->isDir == null) {
$this->isDir = is_dir($this->getAbsoluteFilePath());
}
return $this->isDir;
} | php | public function isDir(): bool
{
if ($this->caching == false) {
return is_dir($this->getAbsoluteFilePath());
}
if ($this->isDir == null) {
$this->isDir = is_dir($this->getAbsoluteFilePath());
}
return $this->isDir;
} | [
"public",
"function",
"isDir",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"caching",
"==",
"false",
")",
"{",
"return",
"is_dir",
"(",
"$",
"this",
"->",
"getAbsoluteFilePath",
"(",
")",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isDir",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"isDir",
"=",
"is_dir",
"(",
"$",
"this",
"->",
"getAbsoluteFilePath",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"isDir",
";",
"}"
] | Returns true if this object points to a directory or to a symbolic link
to a directory; otherwise returns false.
@return boolean | [
"Returns",
"true",
"if",
"this",
"object",
"points",
"to",
"a",
"directory",
"or",
"to",
"a",
"symbolic",
"link",
"to",
"a",
"directory",
";",
"otherwise",
"returns",
"false",
"."
] | 66c53273288a8652ff38240e063bdcffdf7c30aa | https://github.com/mtoolkit/mtoolkit-core/blob/66c53273288a8652ff38240e063bdcffdf7c30aa/src/MFileInfo.php#L336-L347 |
4,567 | mtoolkit/mtoolkit-core | src/MFileInfo.php | MFileInfo.isFile | public function isFile(): bool
{
if ($this->caching == false) {
return is_file($this->getAbsoluteFilePath());
}
if ($this->isFile == null) {
$this->isFile = is_file($this->getAbsoluteFilePath());
}
return $this->isFile;
} | php | public function isFile(): bool
{
if ($this->caching == false) {
return is_file($this->getAbsoluteFilePath());
}
if ($this->isFile == null) {
$this->isFile = is_file($this->getAbsoluteFilePath());
}
return $this->isFile;
} | [
"public",
"function",
"isFile",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"caching",
"==",
"false",
")",
"{",
"return",
"is_file",
"(",
"$",
"this",
"->",
"getAbsoluteFilePath",
"(",
")",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isFile",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"isFile",
"=",
"is_file",
"(",
"$",
"this",
"->",
"getAbsoluteFilePath",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"isFile",
";",
"}"
] | Returns true if this object points to a file or to a symbolic link to a
file. Returns false if the object points to something which isn't a file,
such as a directory.
@return boolean | [
"Returns",
"true",
"if",
"this",
"object",
"points",
"to",
"a",
"file",
"or",
"to",
"a",
"symbolic",
"link",
"to",
"a",
"file",
".",
"Returns",
"false",
"if",
"the",
"object",
"points",
"to",
"something",
"which",
"isn",
"t",
"a",
"file",
"such",
"as",
"a",
"directory",
"."
] | 66c53273288a8652ff38240e063bdcffdf7c30aa | https://github.com/mtoolkit/mtoolkit-core/blob/66c53273288a8652ff38240e063bdcffdf7c30aa/src/MFileInfo.php#L369-L380 |
4,568 | mtoolkit/mtoolkit-core | src/MFileInfo.php | MFileInfo.isReadable | public function isReadable(): bool
{
if ($this->caching == false) {
return is_readable($this->getAbsoluteFilePath());
}
if ($this->isReadable == null) {
$this->isReadable = is_readable($this->getAbsoluteFilePath());
}
return $this->isReadable;
} | php | public function isReadable(): bool
{
if ($this->caching == false) {
return is_readable($this->getAbsoluteFilePath());
}
if ($this->isReadable == null) {
$this->isReadable = is_readable($this->getAbsoluteFilePath());
}
return $this->isReadable;
} | [
"public",
"function",
"isReadable",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"caching",
"==",
"false",
")",
"{",
"return",
"is_readable",
"(",
"$",
"this",
"->",
"getAbsoluteFilePath",
"(",
")",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isReadable",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"isReadable",
"=",
"is_readable",
"(",
"$",
"this",
"->",
"getAbsoluteFilePath",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"isReadable",
";",
"}"
] | Returns true if the user can read the file; otherwise returns false.
@return boolean | [
"Returns",
"true",
"if",
"the",
"user",
"can",
"read",
"the",
"file",
";",
"otherwise",
"returns",
"false",
"."
] | 66c53273288a8652ff38240e063bdcffdf7c30aa | https://github.com/mtoolkit/mtoolkit-core/blob/66c53273288a8652ff38240e063bdcffdf7c30aa/src/MFileInfo.php#L390-L401 |
4,569 | mtoolkit/mtoolkit-core | src/MFileInfo.php | MFileInfo.isWritable | public function isWritable(): bool
{
if ($this->caching == false) {
return is_writable($this->getAbsoluteFilePath());
}
if ($this->isWritable == null) {
$this->isWritable = is_writable($this->getAbsoluteFilePath());
}
return $this->isWritable;
} | php | public function isWritable(): bool
{
if ($this->caching == false) {
return is_writable($this->getAbsoluteFilePath());
}
if ($this->isWritable == null) {
$this->isWritable = is_writable($this->getAbsoluteFilePath());
}
return $this->isWritable;
} | [
"public",
"function",
"isWritable",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"caching",
"==",
"false",
")",
"{",
"return",
"is_writable",
"(",
"$",
"this",
"->",
"getAbsoluteFilePath",
"(",
")",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isWritable",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"isWritable",
"=",
"is_writable",
"(",
"$",
"this",
"->",
"getAbsoluteFilePath",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"isWritable",
";",
"}"
] | Returns true if the user can write to the file; otherwise returns false.
@return boolean | [
"Returns",
"true",
"if",
"the",
"user",
"can",
"write",
"to",
"the",
"file",
";",
"otherwise",
"returns",
"false",
"."
] | 66c53273288a8652ff38240e063bdcffdf7c30aa | https://github.com/mtoolkit/mtoolkit-core/blob/66c53273288a8652ff38240e063bdcffdf7c30aa/src/MFileInfo.php#L454-L465 |
4,570 | mtoolkit/mtoolkit-core | src/MFileInfo.php | MFileInfo.getLastModified | public function getLastModified(): \DateTime
{
if ($this->caching == false) {
return \DateTime::createFromFormat("F d Y H:i:s.", date("F d Y H:i:s.", filemtime($this->getAbsoluteFilePath())));
}
if ($this->lastModified == null) {
$this->lastModified = \DateTime::createFromFormat("F d Y H:i:s.", date("F d Y H:i:s.", filemtime($this->getAbsoluteFilePath())));
}
return $this->lastModified;
} | php | public function getLastModified(): \DateTime
{
if ($this->caching == false) {
return \DateTime::createFromFormat("F d Y H:i:s.", date("F d Y H:i:s.", filemtime($this->getAbsoluteFilePath())));
}
if ($this->lastModified == null) {
$this->lastModified = \DateTime::createFromFormat("F d Y H:i:s.", date("F d Y H:i:s.", filemtime($this->getAbsoluteFilePath())));
}
return $this->lastModified;
} | [
"public",
"function",
"getLastModified",
"(",
")",
":",
"\\",
"DateTime",
"{",
"if",
"(",
"$",
"this",
"->",
"caching",
"==",
"false",
")",
"{",
"return",
"\\",
"DateTime",
"::",
"createFromFormat",
"(",
"\"F d Y H:i:s.\"",
",",
"date",
"(",
"\"F d Y H:i:s.\"",
",",
"filemtime",
"(",
"$",
"this",
"->",
"getAbsoluteFilePath",
"(",
")",
")",
")",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"lastModified",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"lastModified",
"=",
"\\",
"DateTime",
"::",
"createFromFormat",
"(",
"\"F d Y H:i:s.\"",
",",
"date",
"(",
"\"F d Y H:i:s.\"",
",",
"filemtime",
"(",
"$",
"this",
"->",
"getAbsoluteFilePath",
"(",
")",
")",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"lastModified",
";",
"}"
] | Returns the date and time when the file was last modified.
@return \DateTime | [
"Returns",
"the",
"date",
"and",
"time",
"when",
"the",
"file",
"was",
"last",
"modified",
"."
] | 66c53273288a8652ff38240e063bdcffdf7c30aa | https://github.com/mtoolkit/mtoolkit-core/blob/66c53273288a8652ff38240e063bdcffdf7c30aa/src/MFileInfo.php#L472-L483 |
4,571 | mtoolkit/mtoolkit-core | src/MFileInfo.php | MFileInfo.getOwner | public function getOwner(): string
{
if ($this->caching == false) {
$ownerId = $this->getOwnerId();
if ($ownerId == -2) {
return "";
}
$owner = posix_getpwuid($ownerId);
return $owner["name"];
}
if ($this->owner == null) {
$ownerId = $this->getOwnerId();
if ($ownerId == -2) {
$this->owner = "";
}
$owner = posix_getpwuid($ownerId);
$this->owner = $owner["name"];
}
return $this->owner;
} | php | public function getOwner(): string
{
if ($this->caching == false) {
$ownerId = $this->getOwnerId();
if ($ownerId == -2) {
return "";
}
$owner = posix_getpwuid($ownerId);
return $owner["name"];
}
if ($this->owner == null) {
$ownerId = $this->getOwnerId();
if ($ownerId == -2) {
$this->owner = "";
}
$owner = posix_getpwuid($ownerId);
$this->owner = $owner["name"];
}
return $this->owner;
} | [
"public",
"function",
"getOwner",
"(",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"caching",
"==",
"false",
")",
"{",
"$",
"ownerId",
"=",
"$",
"this",
"->",
"getOwnerId",
"(",
")",
";",
"if",
"(",
"$",
"ownerId",
"==",
"-",
"2",
")",
"{",
"return",
"\"\"",
";",
"}",
"$",
"owner",
"=",
"posix_getpwuid",
"(",
"$",
"ownerId",
")",
";",
"return",
"$",
"owner",
"[",
"\"name\"",
"]",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"owner",
"==",
"null",
")",
"{",
"$",
"ownerId",
"=",
"$",
"this",
"->",
"getOwnerId",
"(",
")",
";",
"if",
"(",
"$",
"ownerId",
"==",
"-",
"2",
")",
"{",
"$",
"this",
"->",
"owner",
"=",
"\"\"",
";",
"}",
"$",
"owner",
"=",
"posix_getpwuid",
"(",
"$",
"ownerId",
")",
";",
"$",
"this",
"->",
"owner",
"=",
"$",
"owner",
"[",
"\"name\"",
"]",
";",
"}",
"return",
"$",
"this",
"->",
"owner",
";",
"}"
] | Returns the owner of the file. On systems where files do not have
owners, or if an error occurs, an empty string is returned.
@return string | [
"Returns",
"the",
"owner",
"of",
"the",
"file",
".",
"On",
"systems",
"where",
"files",
"do",
"not",
"have",
"owners",
"or",
"if",
"an",
"error",
"occurs",
"an",
"empty",
"string",
"is",
"returned",
"."
] | 66c53273288a8652ff38240e063bdcffdf7c30aa | https://github.com/mtoolkit/mtoolkit-core/blob/66c53273288a8652ff38240e063bdcffdf7c30aa/src/MFileInfo.php#L525-L552 |
4,572 | mtoolkit/mtoolkit-core | src/MFileInfo.php | MFileInfo.refresh | public function refresh(): void
{
$this->size = null;
$this->lastModified = null;
$this->isReadable = null;
$this->isWritable = null;
$this->exists = null;
$this->created = null;
$this->isSymLink = null;
$this->isDir = null;
$this->isFile = null;
$this->isExecutable = null;
$this->ownerId = null;
$this->owner = null;
$this->group = null;
$this->groupId = null;
$this->lastRead = null;
} | php | public function refresh(): void
{
$this->size = null;
$this->lastModified = null;
$this->isReadable = null;
$this->isWritable = null;
$this->exists = null;
$this->created = null;
$this->isSymLink = null;
$this->isDir = null;
$this->isFile = null;
$this->isExecutable = null;
$this->ownerId = null;
$this->owner = null;
$this->group = null;
$this->groupId = null;
$this->lastRead = null;
} | [
"public",
"function",
"refresh",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"size",
"=",
"null",
";",
"$",
"this",
"->",
"lastModified",
"=",
"null",
";",
"$",
"this",
"->",
"isReadable",
"=",
"null",
";",
"$",
"this",
"->",
"isWritable",
"=",
"null",
";",
"$",
"this",
"->",
"exists",
"=",
"null",
";",
"$",
"this",
"->",
"created",
"=",
"null",
";",
"$",
"this",
"->",
"isSymLink",
"=",
"null",
";",
"$",
"this",
"->",
"isDir",
"=",
"null",
";",
"$",
"this",
"->",
"isFile",
"=",
"null",
";",
"$",
"this",
"->",
"isExecutable",
"=",
"null",
";",
"$",
"this",
"->",
"ownerId",
"=",
"null",
";",
"$",
"this",
"->",
"owner",
"=",
"null",
";",
"$",
"this",
"->",
"group",
"=",
"null",
";",
"$",
"this",
"->",
"groupId",
"=",
"null",
";",
"$",
"this",
"->",
"lastRead",
"=",
"null",
";",
"}"
] | Refreshes the information about the file, i.e. reads in information from
the file system the next time a cached property is fetched. | [
"Refreshes",
"the",
"information",
"about",
"the",
"file",
"i",
".",
"e",
".",
"reads",
"in",
"information",
"from",
"the",
"file",
"system",
"the",
"next",
"time",
"a",
"cached",
"property",
"is",
"fetched",
"."
] | 66c53273288a8652ff38240e063bdcffdf7c30aa | https://github.com/mtoolkit/mtoolkit-core/blob/66c53273288a8652ff38240e063bdcffdf7c30aa/src/MFileInfo.php#L723-L740 |
4,573 | mtoolkit/mtoolkit-core | src/MFileInfo.php | MFileInfo.getSize | public function getSize(): int
{
if ($this->caching == false) {
return filesize($this->getAbsoluteFilePath());
}
if ($this->size == null) {
$this->size = filesize($this->getAbsoluteFilePath());
}
return $this->size;
} | php | public function getSize(): int
{
if ($this->caching == false) {
return filesize($this->getAbsoluteFilePath());
}
if ($this->size == null) {
$this->size = filesize($this->getAbsoluteFilePath());
}
return $this->size;
} | [
"public",
"function",
"getSize",
"(",
")",
":",
"int",
"{",
"if",
"(",
"$",
"this",
"->",
"caching",
"==",
"false",
")",
"{",
"return",
"filesize",
"(",
"$",
"this",
"->",
"getAbsoluteFilePath",
"(",
")",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"size",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"size",
"=",
"filesize",
"(",
"$",
"this",
"->",
"getAbsoluteFilePath",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"size",
";",
"}"
] | Returns the file size in bytes. If the file does not exist or cannot be
fetched, 0 is returned.
@return int | [
"Returns",
"the",
"file",
"size",
"in",
"bytes",
".",
"If",
"the",
"file",
"does",
"not",
"exist",
"or",
"cannot",
"be",
"fetched",
"0",
"is",
"returned",
"."
] | 66c53273288a8652ff38240e063bdcffdf7c30aa | https://github.com/mtoolkit/mtoolkit-core/blob/66c53273288a8652ff38240e063bdcffdf7c30aa/src/MFileInfo.php#L748-L759 |
4,574 | silverstripe-modular-project/silverstripe-placeable | code/extensions/LeftAndMainPlaceable.php | LeftAndMainPlaceable.augmentNewSiteTreeItem | public function augmentNewSiteTreeItem(&$item)
{
if (isset($_POST['PageTypeFake'])) {
$item->PageTypeFake = $_POST['PageTypeFake'];
}
if (isset($_POST['PageTypeID'])) {
$item->PageTypeID = $_POST['PageTypeID'];
}
} | php | public function augmentNewSiteTreeItem(&$item)
{
if (isset($_POST['PageTypeFake'])) {
$item->PageTypeFake = $_POST['PageTypeFake'];
}
if (isset($_POST['PageTypeID'])) {
$item->PageTypeID = $_POST['PageTypeID'];
}
} | [
"public",
"function",
"augmentNewSiteTreeItem",
"(",
"&",
"$",
"item",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_POST",
"[",
"'PageTypeFake'",
"]",
")",
")",
"{",
"$",
"item",
"->",
"PageTypeFake",
"=",
"$",
"_POST",
"[",
"'PageTypeFake'",
"]",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"_POST",
"[",
"'PageTypeID'",
"]",
")",
")",
"{",
"$",
"item",
"->",
"PageTypeID",
"=",
"$",
"_POST",
"[",
"'PageTypeID'",
"]",
";",
"}",
"}"
] | Assigns new placeable pages to a page type | [
"Assigns",
"new",
"placeable",
"pages",
"to",
"a",
"page",
"type"
] | 8ac5891493e5af2efaab7afa93ef2d1c1bea946f | https://github.com/silverstripe-modular-project/silverstripe-placeable/blob/8ac5891493e5af2efaab7afa93ef2d1c1bea946f/code/extensions/LeftAndMainPlaceable.php#L20-L28 |
4,575 | ricardoh/wurfl-php-api | WURFL/Handlers/Utils.php | WURFL_Handlers_Utils.firstSpace | public static function firstSpace($string) {
$firstSpace = strpos($string, " ");
return ($firstSpace === false)? strlen($string) : $firstSpace;
} | php | public static function firstSpace($string) {
$firstSpace = strpos($string, " ");
return ($firstSpace === false)? strlen($string) : $firstSpace;
} | [
"public",
"static",
"function",
"firstSpace",
"(",
"$",
"string",
")",
"{",
"$",
"firstSpace",
"=",
"strpos",
"(",
"$",
"string",
",",
"\" \"",
")",
";",
"return",
"(",
"$",
"firstSpace",
"===",
"false",
")",
"?",
"strlen",
"(",
"$",
"string",
")",
":",
"$",
"firstSpace",
";",
"}"
] | First occurance of a space character
@param string $string Haystack
@return int Char index | [
"First",
"occurance",
"of",
"a",
"space",
"character"
] | 1aa6c8af5b4c34ce3b37407c5eeb6fb41e5f3546 | https://github.com/ricardoh/wurfl-php-api/blob/1aa6c8af5b4c34ce3b37407c5eeb6fb41e5f3546/WURFL/Handlers/Utils.php#L464-L467 |
4,576 | cityware/city-utility | src/ThreshoudCpuCalculation.php | ThreshoudCpuCalculation.calculate | public static function calculate($numSlots = 1, $numCores = 1, $ht = 'N') {
$totalCpu = ($ht == 'S') ? (($numSlots * $numCores) * 2) : ($numSlots * $numCores);
$aReturn = Array();
$aReturn['warning'] = Array();
$aReturn['critical'] = Array();
$aReturn['warning']['load1min'] = round(($totalCpu * 0.7), 2);
$aReturn['warning']['load5min'] = round(($totalCpu * 0.65), 2);
$aReturn['warning']['load15min'] = round(($totalCpu * 0.6), 2);
$aReturn['critical']['load1min'] = round(($totalCpu * 1.0), 2);
$aReturn['critical']['load5min'] = round(($totalCpu * 0.9), 2);
$aReturn['critical']['load15min'] = round(($totalCpu * 0.8), 2);
return $aReturn;
} | php | public static function calculate($numSlots = 1, $numCores = 1, $ht = 'N') {
$totalCpu = ($ht == 'S') ? (($numSlots * $numCores) * 2) : ($numSlots * $numCores);
$aReturn = Array();
$aReturn['warning'] = Array();
$aReturn['critical'] = Array();
$aReturn['warning']['load1min'] = round(($totalCpu * 0.7), 2);
$aReturn['warning']['load5min'] = round(($totalCpu * 0.65), 2);
$aReturn['warning']['load15min'] = round(($totalCpu * 0.6), 2);
$aReturn['critical']['load1min'] = round(($totalCpu * 1.0), 2);
$aReturn['critical']['load5min'] = round(($totalCpu * 0.9), 2);
$aReturn['critical']['load15min'] = round(($totalCpu * 0.8), 2);
return $aReturn;
} | [
"public",
"static",
"function",
"calculate",
"(",
"$",
"numSlots",
"=",
"1",
",",
"$",
"numCores",
"=",
"1",
",",
"$",
"ht",
"=",
"'N'",
")",
"{",
"$",
"totalCpu",
"=",
"(",
"$",
"ht",
"==",
"'S'",
")",
"?",
"(",
"(",
"$",
"numSlots",
"*",
"$",
"numCores",
")",
"*",
"2",
")",
":",
"(",
"$",
"numSlots",
"*",
"$",
"numCores",
")",
";",
"$",
"aReturn",
"=",
"Array",
"(",
")",
";",
"$",
"aReturn",
"[",
"'warning'",
"]",
"=",
"Array",
"(",
")",
";",
"$",
"aReturn",
"[",
"'critical'",
"]",
"=",
"Array",
"(",
")",
";",
"$",
"aReturn",
"[",
"'warning'",
"]",
"[",
"'load1min'",
"]",
"=",
"round",
"(",
"(",
"$",
"totalCpu",
"*",
"0.7",
")",
",",
"2",
")",
";",
"$",
"aReturn",
"[",
"'warning'",
"]",
"[",
"'load5min'",
"]",
"=",
"round",
"(",
"(",
"$",
"totalCpu",
"*",
"0.65",
")",
",",
"2",
")",
";",
"$",
"aReturn",
"[",
"'warning'",
"]",
"[",
"'load15min'",
"]",
"=",
"round",
"(",
"(",
"$",
"totalCpu",
"*",
"0.6",
")",
",",
"2",
")",
";",
"$",
"aReturn",
"[",
"'critical'",
"]",
"[",
"'load1min'",
"]",
"=",
"round",
"(",
"(",
"$",
"totalCpu",
"*",
"1.0",
")",
",",
"2",
")",
";",
"$",
"aReturn",
"[",
"'critical'",
"]",
"[",
"'load5min'",
"]",
"=",
"round",
"(",
"(",
"$",
"totalCpu",
"*",
"0.9",
")",
",",
"2",
")",
";",
"$",
"aReturn",
"[",
"'critical'",
"]",
"[",
"'load15min'",
"]",
"=",
"round",
"(",
"(",
"$",
"totalCpu",
"*",
"0.8",
")",
",",
"2",
")",
";",
"return",
"$",
"aReturn",
";",
"}"
] | Return calculation Threshoud alert CPU
@param integer $numSlots
@param integer $numCores
@param string $ht
@return array | [
"Return",
"calculation",
"Threshoud",
"alert",
"CPU"
] | fadd33233cdaf743d87c3c30e341f2b96e96e476 | https://github.com/cityware/city-utility/blob/fadd33233cdaf743d87c3c30e341f2b96e96e476/src/ThreshoudCpuCalculation.php#L25-L41 |
4,577 | xinc-develop/xinc-core | src/Build/Build.php | Build.getLastBuild | public function getLastBuild()
{
if ($this->lastBuild == null) {
$build = new self($this->getEngine(), $this->getProject());
return $build;
}
return $this->lastBuild;
} | php | public function getLastBuild()
{
if ($this->lastBuild == null) {
$build = new self($this->getEngine(), $this->getProject());
return $build;
}
return $this->lastBuild;
} | [
"public",
"function",
"getLastBuild",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"lastBuild",
"==",
"null",
")",
"{",
"$",
"build",
"=",
"new",
"self",
"(",
"$",
"this",
"->",
"getEngine",
"(",
")",
",",
"$",
"this",
"->",
"getProject",
"(",
")",
")",
";",
"return",
"$",
"build",
";",
"}",
"return",
"$",
"this",
"->",
"lastBuild",
";",
"}"
] | Returns the last build.
@return BuildInterface | [
"Returns",
"the",
"last",
"build",
"."
] | 4bb69a6afe19e1186950a3122cbfe0989823e0d6 | https://github.com/xinc-develop/xinc-core/blob/4bb69a6afe19e1186950a3122cbfe0989823e0d6/src/Build/Build.php#L177-L186 |
4,578 | xinc-develop/xinc-core | src/Build/Build.php | Build.serialize | public function serialize()
{
Xinc_Logger::getInstance()->flush();
$this->setLastBuild();
if (!in_array($this->getStatus(), array(self::PASSED, self::FAILED, self::STOPPED))) {
throw new Xinc_Build_Exception_NotRun();
} elseif ($this->getBuildTime() == null) {
throw new Xinc_Build_Exception_Serialization($this->getProject(),
$this->getBuildTime());
}
$statusDir = Xinc::getInstance()->getStatusDir();
$buildHistoryFile = $statusDir.DIRECTORY_SEPARATOR
.$this->getProject()->getName().'.history';
$subDirectory = self::generateStatusSubDir($this->getProject()->getName(), $this->getBuildTime());
$fileName = $statusDir.DIRECTORY_SEPARATOR
.$subDirectory
.DIRECTORY_SEPARATOR.'build.ser';
$logfileName = $statusDir.DIRECTORY_SEPARATOR
.$subDirectory
.DIRECTORY_SEPARATOR.'buildlog.xml';
$lastBuildFileName = $statusDir.DIRECTORY_SEPARATOR.$this->getProject()->getName()
.DIRECTORY_SEPARATOR.'build.ser';
$lastLogFileName = $statusDir.DIRECTORY_SEPARATOR.$this->getProject()->getName()
.DIRECTORY_SEPARATOR.'buildlog.xml';
if (!file_exists(dirname($fileName))) {
mkdir(dirname($fileName), 0755, true);
}
$contents = serialize($this);
$written = file_put_contents($lastBuildFileName, $contents);
if ($written == strlen($contents)) {
$res = copy($lastBuildFileName, $fileName);
if (!$res) {
throw new Xinc_Build_Exception_Serialization($this->getProject(),
$this->getBuildTime());
} else {
if (file_exists($lastLogFileName)) {
copy($lastLogFileName, $logfileName);
unlink($lastLogFileName);
}
Xinc_Build_History::addBuild($this, $fileName);
}
return true;
} else {
throw new Xinc_Build_Exception_Serialization($this->getProject(),
$this->getBuildTime());
}
} | php | public function serialize()
{
Xinc_Logger::getInstance()->flush();
$this->setLastBuild();
if (!in_array($this->getStatus(), array(self::PASSED, self::FAILED, self::STOPPED))) {
throw new Xinc_Build_Exception_NotRun();
} elseif ($this->getBuildTime() == null) {
throw new Xinc_Build_Exception_Serialization($this->getProject(),
$this->getBuildTime());
}
$statusDir = Xinc::getInstance()->getStatusDir();
$buildHistoryFile = $statusDir.DIRECTORY_SEPARATOR
.$this->getProject()->getName().'.history';
$subDirectory = self::generateStatusSubDir($this->getProject()->getName(), $this->getBuildTime());
$fileName = $statusDir.DIRECTORY_SEPARATOR
.$subDirectory
.DIRECTORY_SEPARATOR.'build.ser';
$logfileName = $statusDir.DIRECTORY_SEPARATOR
.$subDirectory
.DIRECTORY_SEPARATOR.'buildlog.xml';
$lastBuildFileName = $statusDir.DIRECTORY_SEPARATOR.$this->getProject()->getName()
.DIRECTORY_SEPARATOR.'build.ser';
$lastLogFileName = $statusDir.DIRECTORY_SEPARATOR.$this->getProject()->getName()
.DIRECTORY_SEPARATOR.'buildlog.xml';
if (!file_exists(dirname($fileName))) {
mkdir(dirname($fileName), 0755, true);
}
$contents = serialize($this);
$written = file_put_contents($lastBuildFileName, $contents);
if ($written == strlen($contents)) {
$res = copy($lastBuildFileName, $fileName);
if (!$res) {
throw new Xinc_Build_Exception_Serialization($this->getProject(),
$this->getBuildTime());
} else {
if (file_exists($lastLogFileName)) {
copy($lastLogFileName, $logfileName);
unlink($lastLogFileName);
}
Xinc_Build_History::addBuild($this, $fileName);
}
return true;
} else {
throw new Xinc_Build_Exception_Serialization($this->getProject(),
$this->getBuildTime());
}
} | [
"public",
"function",
"serialize",
"(",
")",
"{",
"Xinc_Logger",
"::",
"getInstance",
"(",
")",
"->",
"flush",
"(",
")",
";",
"$",
"this",
"->",
"setLastBuild",
"(",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"this",
"->",
"getStatus",
"(",
")",
",",
"array",
"(",
"self",
"::",
"PASSED",
",",
"self",
"::",
"FAILED",
",",
"self",
"::",
"STOPPED",
")",
")",
")",
"{",
"throw",
"new",
"Xinc_Build_Exception_NotRun",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"getBuildTime",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"Xinc_Build_Exception_Serialization",
"(",
"$",
"this",
"->",
"getProject",
"(",
")",
",",
"$",
"this",
"->",
"getBuildTime",
"(",
")",
")",
";",
"}",
"$",
"statusDir",
"=",
"Xinc",
"::",
"getInstance",
"(",
")",
"->",
"getStatusDir",
"(",
")",
";",
"$",
"buildHistoryFile",
"=",
"$",
"statusDir",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"this",
"->",
"getProject",
"(",
")",
"->",
"getName",
"(",
")",
".",
"'.history'",
";",
"$",
"subDirectory",
"=",
"self",
"::",
"generateStatusSubDir",
"(",
"$",
"this",
"->",
"getProject",
"(",
")",
"->",
"getName",
"(",
")",
",",
"$",
"this",
"->",
"getBuildTime",
"(",
")",
")",
";",
"$",
"fileName",
"=",
"$",
"statusDir",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"subDirectory",
".",
"DIRECTORY_SEPARATOR",
".",
"'build.ser'",
";",
"$",
"logfileName",
"=",
"$",
"statusDir",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"subDirectory",
".",
"DIRECTORY_SEPARATOR",
".",
"'buildlog.xml'",
";",
"$",
"lastBuildFileName",
"=",
"$",
"statusDir",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"this",
"->",
"getProject",
"(",
")",
"->",
"getName",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"'build.ser'",
";",
"$",
"lastLogFileName",
"=",
"$",
"statusDir",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"this",
"->",
"getProject",
"(",
")",
"->",
"getName",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"'buildlog.xml'",
";",
"if",
"(",
"!",
"file_exists",
"(",
"dirname",
"(",
"$",
"fileName",
")",
")",
")",
"{",
"mkdir",
"(",
"dirname",
"(",
"$",
"fileName",
")",
",",
"0755",
",",
"true",
")",
";",
"}",
"$",
"contents",
"=",
"serialize",
"(",
"$",
"this",
")",
";",
"$",
"written",
"=",
"file_put_contents",
"(",
"$",
"lastBuildFileName",
",",
"$",
"contents",
")",
";",
"if",
"(",
"$",
"written",
"==",
"strlen",
"(",
"$",
"contents",
")",
")",
"{",
"$",
"res",
"=",
"copy",
"(",
"$",
"lastBuildFileName",
",",
"$",
"fileName",
")",
";",
"if",
"(",
"!",
"$",
"res",
")",
"{",
"throw",
"new",
"Xinc_Build_Exception_Serialization",
"(",
"$",
"this",
"->",
"getProject",
"(",
")",
",",
"$",
"this",
"->",
"getBuildTime",
"(",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"lastLogFileName",
")",
")",
"{",
"copy",
"(",
"$",
"lastLogFileName",
",",
"$",
"logfileName",
")",
";",
"unlink",
"(",
"$",
"lastLogFileName",
")",
";",
"}",
"Xinc_Build_History",
"::",
"addBuild",
"(",
"$",
"this",
",",
"$",
"fileName",
")",
";",
"}",
"return",
"true",
";",
"}",
"else",
"{",
"throw",
"new",
"Xinc_Build_Exception_Serialization",
"(",
"$",
"this",
"->",
"getProject",
"(",
")",
",",
"$",
"this",
"->",
"getBuildTime",
"(",
")",
")",
";",
"}",
"}"
] | stores the build information.
@throws Xinc_Build_Exception_NotRun
@throws Xinc_Build_Exception_Serialization
@throws Xinc_Build_History_Exception_Storage
@return bool | [
"stores",
"the",
"build",
"information",
"."
] | 4bb69a6afe19e1186950a3122cbfe0989823e0d6 | https://github.com/xinc-develop/xinc-core/blob/4bb69a6afe19e1186950a3122cbfe0989823e0d6/src/Build/Build.php#L287-L339 |
4,579 | xinc-develop/xinc-core | src/Build/Build.php | Build.unserialize | public static function unserialize(Project $project, $buildTimestamp = null, $statusDir = null)
{
if ($statusDir == null) {
$statusDir = Xinc::getInstance()->getStatusDir();
}
if ($buildTimestamp == null) {
//$fileName = $statusDir . DIRECTORY_SEPARATOR . $project->getName()
// . DIRECTORY_SEPARATOR . 'build.ser';
$fileName = Xinc_Build_History::getLastBuildFile($project);
} else {
//$subDirectory = self::generateStatusSubDir($project->getName(), $buildTimestamp);
// throws Xinc_Build_Exception_NotFound
$fileName = Xinc_Build_History::getBuildFile($project, $buildTimestamp);
}
//Xinc_Build_Repository::getBuild($project, $buildTimestamp);
if (!file_exists($fileName)) {
throw new Xinc_Build_Exception_NotFound($project,
$buildTimestamp);
} else {
$serializedString = file_get_contents($fileName);
$unserialized = @unserialize($serializedString);
if (!$unserialized instanceof Xinc_Build) {
throw new Xinc_Build_Exception_Unserialization($project,
$buildTimestamp);
} else {
/*
* compatibility with old Xinc_Build w/o statistics object
*/
if ($unserialized->getStatistics() === null) {
$unserialized->_statistics = new Xinc_Build_Statistics();
}
if ($unserialized->getConfigDirective('timezone.reporting') == true) {
$unserialized->setConfigDirective('timezone', null);
}
if (!isset($unserialized->_internalProperties)) {
if (method_exists($unserialized, 'init')) {
$unserialized->init();
}
}
return $unserialized;
}
}
} | php | public static function unserialize(Project $project, $buildTimestamp = null, $statusDir = null)
{
if ($statusDir == null) {
$statusDir = Xinc::getInstance()->getStatusDir();
}
if ($buildTimestamp == null) {
//$fileName = $statusDir . DIRECTORY_SEPARATOR . $project->getName()
// . DIRECTORY_SEPARATOR . 'build.ser';
$fileName = Xinc_Build_History::getLastBuildFile($project);
} else {
//$subDirectory = self::generateStatusSubDir($project->getName(), $buildTimestamp);
// throws Xinc_Build_Exception_NotFound
$fileName = Xinc_Build_History::getBuildFile($project, $buildTimestamp);
}
//Xinc_Build_Repository::getBuild($project, $buildTimestamp);
if (!file_exists($fileName)) {
throw new Xinc_Build_Exception_NotFound($project,
$buildTimestamp);
} else {
$serializedString = file_get_contents($fileName);
$unserialized = @unserialize($serializedString);
if (!$unserialized instanceof Xinc_Build) {
throw new Xinc_Build_Exception_Unserialization($project,
$buildTimestamp);
} else {
/*
* compatibility with old Xinc_Build w/o statistics object
*/
if ($unserialized->getStatistics() === null) {
$unserialized->_statistics = new Xinc_Build_Statistics();
}
if ($unserialized->getConfigDirective('timezone.reporting') == true) {
$unserialized->setConfigDirective('timezone', null);
}
if (!isset($unserialized->_internalProperties)) {
if (method_exists($unserialized, 'init')) {
$unserialized->init();
}
}
return $unserialized;
}
}
} | [
"public",
"static",
"function",
"unserialize",
"(",
"Project",
"$",
"project",
",",
"$",
"buildTimestamp",
"=",
"null",
",",
"$",
"statusDir",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"statusDir",
"==",
"null",
")",
"{",
"$",
"statusDir",
"=",
"Xinc",
"::",
"getInstance",
"(",
")",
"->",
"getStatusDir",
"(",
")",
";",
"}",
"if",
"(",
"$",
"buildTimestamp",
"==",
"null",
")",
"{",
"//$fileName = $statusDir . DIRECTORY_SEPARATOR . $project->getName()",
"// . DIRECTORY_SEPARATOR . 'build.ser';",
"$",
"fileName",
"=",
"Xinc_Build_History",
"::",
"getLastBuildFile",
"(",
"$",
"project",
")",
";",
"}",
"else",
"{",
"//$subDirectory = self::generateStatusSubDir($project->getName(), $buildTimestamp);",
"// throws Xinc_Build_Exception_NotFound",
"$",
"fileName",
"=",
"Xinc_Build_History",
"::",
"getBuildFile",
"(",
"$",
"project",
",",
"$",
"buildTimestamp",
")",
";",
"}",
"//Xinc_Build_Repository::getBuild($project, $buildTimestamp);",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"fileName",
")",
")",
"{",
"throw",
"new",
"Xinc_Build_Exception_NotFound",
"(",
"$",
"project",
",",
"$",
"buildTimestamp",
")",
";",
"}",
"else",
"{",
"$",
"serializedString",
"=",
"file_get_contents",
"(",
"$",
"fileName",
")",
";",
"$",
"unserialized",
"=",
"@",
"unserialize",
"(",
"$",
"serializedString",
")",
";",
"if",
"(",
"!",
"$",
"unserialized",
"instanceof",
"Xinc_Build",
")",
"{",
"throw",
"new",
"Xinc_Build_Exception_Unserialization",
"(",
"$",
"project",
",",
"$",
"buildTimestamp",
")",
";",
"}",
"else",
"{",
"/*\n * compatibility with old Xinc_Build w/o statistics object\n */",
"if",
"(",
"$",
"unserialized",
"->",
"getStatistics",
"(",
")",
"===",
"null",
")",
"{",
"$",
"unserialized",
"->",
"_statistics",
"=",
"new",
"Xinc_Build_Statistics",
"(",
")",
";",
"}",
"if",
"(",
"$",
"unserialized",
"->",
"getConfigDirective",
"(",
"'timezone.reporting'",
")",
"==",
"true",
")",
"{",
"$",
"unserialized",
"->",
"setConfigDirective",
"(",
"'timezone'",
",",
"null",
")",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"unserialized",
"->",
"_internalProperties",
")",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"unserialized",
",",
"'init'",
")",
")",
"{",
"$",
"unserialized",
"->",
"init",
"(",
")",
";",
"}",
"}",
"return",
"$",
"unserialized",
";",
"}",
"}",
"}"
] | Unserialize a build by its project and buildtimestamp.
@param Xincproject $project
@param int $buildTimestamp
@return Xinc_Build
@throws Xinc_Build_Exception_Unserialization
@throws Xinc_Build_Exception_NotFound | [
"Unserialize",
"a",
"build",
"by",
"its",
"project",
"and",
"buildtimestamp",
"."
] | 4bb69a6afe19e1186950a3122cbfe0989823e0d6 | https://github.com/xinc-develop/xinc-core/blob/4bb69a6afe19e1186950a3122cbfe0989823e0d6/src/Build/Build.php#L352-L398 |
4,580 | xinc-develop/xinc-core | src/Build/Build.php | Build.setNumber | public function setNumber($no)
{
$this->info('Setting Buildnumber to:'.$no);
$this->setProperty('build.number', $no);
$this->no = $no;
} | php | public function setNumber($no)
{
$this->info('Setting Buildnumber to:'.$no);
$this->setProperty('build.number', $no);
$this->no = $no;
} | [
"public",
"function",
"setNumber",
"(",
"$",
"no",
")",
"{",
"$",
"this",
"->",
"info",
"(",
"'Setting Buildnumber to:'",
".",
"$",
"no",
")",
";",
"$",
"this",
"->",
"setProperty",
"(",
"'build.number'",
",",
"$",
"no",
")",
";",
"$",
"this",
"->",
"no",
"=",
"$",
"no",
";",
"}"
] | Sets the sequence number for this build.
@param int $no | [
"Sets",
"the",
"sequence",
"number",
"for",
"this",
"build",
"."
] | 4bb69a6afe19e1186950a3122cbfe0989823e0d6 | https://github.com/xinc-develop/xinc-core/blob/4bb69a6afe19e1186950a3122cbfe0989823e0d6/src/Build/Build.php#L444-L449 |
4,581 | xinc-develop/xinc-core | src/Build/Build.php | Build.process | public function process($slot)
{
$tasks = $this->getTasksForSlot($slot);
while ($tasks->valid()) {
$task = $tasks->current();
$this->log->info('Processing task: '.$task->getName());
try {
$task->process($this);
} catch (Exception $e) {
var_dump($e);
}
/*
* The Post-Process continues on failure
if ($slot != Slot::POST_PROCESS) {
if ($this->getStatus() != BuildInterface::PASSED) {
$tasks->rewind();
break;
}
}
*/
$tasks->next();
}
$tasks->rewind();
} | php | public function process($slot)
{
$tasks = $this->getTasksForSlot($slot);
while ($tasks->valid()) {
$task = $tasks->current();
$this->log->info('Processing task: '.$task->getName());
try {
$task->process($this);
} catch (Exception $e) {
var_dump($e);
}
/*
* The Post-Process continues on failure
if ($slot != Slot::POST_PROCESS) {
if ($this->getStatus() != BuildInterface::PASSED) {
$tasks->rewind();
break;
}
}
*/
$tasks->next();
}
$tasks->rewind();
} | [
"public",
"function",
"process",
"(",
"$",
"slot",
")",
"{",
"$",
"tasks",
"=",
"$",
"this",
"->",
"getTasksForSlot",
"(",
"$",
"slot",
")",
";",
"while",
"(",
"$",
"tasks",
"->",
"valid",
"(",
")",
")",
"{",
"$",
"task",
"=",
"$",
"tasks",
"->",
"current",
"(",
")",
";",
"$",
"this",
"->",
"log",
"->",
"info",
"(",
"'Processing task: '",
".",
"$",
"task",
"->",
"getName",
"(",
")",
")",
";",
"try",
"{",
"$",
"task",
"->",
"process",
"(",
"$",
"this",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"var_dump",
"(",
"$",
"e",
")",
";",
"}",
"/*\n * The Post-Process continues on failure\n\n if ($slot != Slot::POST_PROCESS) {\n if ($this->getStatus() != BuildInterface::PASSED) {\n $tasks->rewind();\n break;\n }\n }\n */",
"$",
"tasks",
"->",
"next",
"(",
")",
";",
"}",
"$",
"tasks",
"->",
"rewind",
"(",
")",
";",
"}"
] | processes the tasks that are registered for the slot.
@todo exception handling & maybe move to engine
@param mixed $slot | [
"processes",
"the",
"tasks",
"that",
"are",
"registered",
"for",
"the",
"slot",
"."
] | 4bb69a6afe19e1186950a3122cbfe0989823e0d6 | https://github.com/xinc-develop/xinc-core/blob/4bb69a6afe19e1186950a3122cbfe0989823e0d6/src/Build/Build.php#L513-L538 |
4,582 | samurai-fw/samurai | src/Samurai/Component/Response/HttpResponse.php | HttpResponse.getStatusMessage | public function getStatusMessage($status = null)
{
if (! $status) $status = $this->getStatus();
if (! $status || ! isset($this->status_messages[$status])) throw new \LogicException("No such status. -> {$status}");
return $this->status_messages[$status];
} | php | public function getStatusMessage($status = null)
{
if (! $status) $status = $this->getStatus();
if (! $status || ! isset($this->status_messages[$status])) throw new \LogicException("No such status. -> {$status}");
return $this->status_messages[$status];
} | [
"public",
"function",
"getStatusMessage",
"(",
"$",
"status",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"status",
")",
"$",
"status",
"=",
"$",
"this",
"->",
"getStatus",
"(",
")",
";",
"if",
"(",
"!",
"$",
"status",
"||",
"!",
"isset",
"(",
"$",
"this",
"->",
"status_messages",
"[",
"$",
"status",
"]",
")",
")",
"throw",
"new",
"\\",
"LogicException",
"(",
"\"No such status. -> {$status}\"",
")",
";",
"return",
"$",
"this",
"->",
"status_messages",
"[",
"$",
"status",
"]",
";",
"}"
] | get status message.
@param int|null $status
@return string | [
"get",
"status",
"message",
"."
] | 7ca3847b13f86e2847a17ab5e8e4e20893021d5a | https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Samurai/Component/Response/HttpResponse.php#L165-L172 |
4,583 | samurai-fw/samurai | src/Samurai/Component/Response/HttpResponse.php | HttpResponse.sendStatus | private function sendStatus()
{
if (headers_sent()) return;
if (isset($this->status_messages[$this->status])) {
header(sprintf('HTTP/%s %d %s', $this->request->getHttpVersion(), $this->status, $this->status_messages[$this->status]));
} else {
header('Status: ' . $this->status);
}
} | php | private function sendStatus()
{
if (headers_sent()) return;
if (isset($this->status_messages[$this->status])) {
header(sprintf('HTTP/%s %d %s', $this->request->getHttpVersion(), $this->status, $this->status_messages[$this->status]));
} else {
header('Status: ' . $this->status);
}
} | [
"private",
"function",
"sendStatus",
"(",
")",
"{",
"if",
"(",
"headers_sent",
"(",
")",
")",
"return",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"status_messages",
"[",
"$",
"this",
"->",
"status",
"]",
")",
")",
"{",
"header",
"(",
"sprintf",
"(",
"'HTTP/%s %d %s'",
",",
"$",
"this",
"->",
"request",
"->",
"getHttpVersion",
"(",
")",
",",
"$",
"this",
"->",
"status",
",",
"$",
"this",
"->",
"status_messages",
"[",
"$",
"this",
"->",
"status",
"]",
")",
")",
";",
"}",
"else",
"{",
"header",
"(",
"'Status: '",
".",
"$",
"this",
"->",
"status",
")",
";",
"}",
"}"
] | send status code.
@access private | [
"send",
"status",
"code",
"."
] | 7ca3847b13f86e2847a17ab5e8e4e20893021d5a | https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Samurai/Component/Response/HttpResponse.php#L252-L261 |
4,584 | samurai-fw/samurai | src/Samurai/Component/Response/HttpResponse.php | HttpResponse.sendHeaders | private function sendHeaders()
{
foreach ($this->body->getHeaders() as $key => $value) {
$key = join('-', array_map('ucfirst', explode('-', $key)));
header(sprintf('%s: %s', $key, $value));
}
} | php | private function sendHeaders()
{
foreach ($this->body->getHeaders() as $key => $value) {
$key = join('-', array_map('ucfirst', explode('-', $key)));
header(sprintf('%s: %s', $key, $value));
}
} | [
"private",
"function",
"sendHeaders",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"body",
"->",
"getHeaders",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"key",
"=",
"join",
"(",
"'-'",
",",
"array_map",
"(",
"'ucfirst'",
",",
"explode",
"(",
"'-'",
",",
"$",
"key",
")",
")",
")",
";",
"header",
"(",
"sprintf",
"(",
"'%s: %s'",
",",
"$",
"key",
",",
"$",
"value",
")",
")",
";",
"}",
"}"
] | send headers.
@access private | [
"send",
"headers",
"."
] | 7ca3847b13f86e2847a17ab5e8e4e20893021d5a | https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Samurai/Component/Response/HttpResponse.php#L269-L275 |
4,585 | mikeshiyan/lite-sql-insert | src/Iterate/Scenario/InsertNamedMatchTrait.php | InsertNamedMatchTrait.getFields | protected function getFields(): array {
if (!$this->fields) {
// Search the pattern for named subpatterns and get their names.
// @link https://stackoverflow.com/a/47753964/3260408
preg_match_all("~(?<!\\\\)(?:\\\\{2})*\(\?(?|P?<([_A-Za-z]\w{0,31})>|'([_A-Za-z]\w{0,31})')~", $this->getPattern(), $matches);
$this->fields = $matches[1];
if (!$this->fields) {
throw new \RuntimeException('Pattern must contain named subpatterns.');
}
if (count(array_unique($this->fields)) != count($this->fields)) {
throw new \RuntimeException('Subpattern names must be unique.');
}
}
return $this->fields;
} | php | protected function getFields(): array {
if (!$this->fields) {
// Search the pattern for named subpatterns and get their names.
// @link https://stackoverflow.com/a/47753964/3260408
preg_match_all("~(?<!\\\\)(?:\\\\{2})*\(\?(?|P?<([_A-Za-z]\w{0,31})>|'([_A-Za-z]\w{0,31})')~", $this->getPattern(), $matches);
$this->fields = $matches[1];
if (!$this->fields) {
throw new \RuntimeException('Pattern must contain named subpatterns.');
}
if (count(array_unique($this->fields)) != count($this->fields)) {
throw new \RuntimeException('Subpattern names must be unique.');
}
}
return $this->fields;
} | [
"protected",
"function",
"getFields",
"(",
")",
":",
"array",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"fields",
")",
"{",
"// Search the pattern for named subpatterns and get their names.",
"// @link https://stackoverflow.com/a/47753964/3260408",
"preg_match_all",
"(",
"\"~(?<!\\\\\\\\)(?:\\\\\\\\{2})*\\(\\?(?|P?<([_A-Za-z]\\w{0,31})>|'([_A-Za-z]\\w{0,31})')~\"",
",",
"$",
"this",
"->",
"getPattern",
"(",
")",
",",
"$",
"matches",
")",
";",
"$",
"this",
"->",
"fields",
"=",
"$",
"matches",
"[",
"1",
"]",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"fields",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Pattern must contain named subpatterns.'",
")",
";",
"}",
"if",
"(",
"count",
"(",
"array_unique",
"(",
"$",
"this",
"->",
"fields",
")",
")",
"!=",
"count",
"(",
"$",
"this",
"->",
"fields",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Subpattern names must be unique.'",
")",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"fields",
";",
"}"
] | Gets names of fields to insert into.
If not overridden, this method gets and returns the names of subpatterns.
@return string[]
Field names.
@throws \RuntimeException
If there are no named subpatterns in the pattern or they are not unique. | [
"Gets",
"names",
"of",
"fields",
"to",
"insert",
"into",
"."
] | c0c26b7976d61ba5a95561363824c03ba31cee3b | https://github.com/mikeshiyan/lite-sql-insert/blob/c0c26b7976d61ba5a95561363824c03ba31cee3b/src/Iterate/Scenario/InsertNamedMatchTrait.php#L37-L53 |
4,586 | harmony-project/modular-routing | source/Metadata/Loader/YamlFileLoader.php | YamlFileLoader.validate | protected function validate($config, $name, $path)
{
if (!is_array($config)) {
throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path));
}
if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) {
throw new \InvalidArgumentException(sprintf(
'The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".',
$path, $name, implode('", "', $extraKeys), implode('", "', self::$availableKeys)
));
}
// check here if the combination of config options is invalid
} | php | protected function validate($config, $name, $path)
{
if (!is_array($config)) {
throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path));
}
if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) {
throw new \InvalidArgumentException(sprintf(
'The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".',
$path, $name, implode('", "', $extraKeys), implode('", "', self::$availableKeys)
));
}
// check here if the combination of config options is invalid
} | [
"protected",
"function",
"validate",
"(",
"$",
"config",
",",
"$",
"name",
",",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"config",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'The definition of \"%s\" in \"%s\" must be a YAML array.'",
",",
"$",
"name",
",",
"$",
"path",
")",
")",
";",
"}",
"if",
"(",
"$",
"extraKeys",
"=",
"array_diff",
"(",
"array_keys",
"(",
"$",
"config",
")",
",",
"self",
"::",
"$",
"availableKeys",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'The routing file \"%s\" contains unsupported keys for \"%s\": \"%s\". Expected one of: \"%s\".'",
",",
"$",
"path",
",",
"$",
"name",
",",
"implode",
"(",
"'\", \"'",
",",
"$",
"extraKeys",
")",
",",
"implode",
"(",
"'\", \"'",
",",
"self",
"::",
"$",
"availableKeys",
")",
")",
")",
";",
"}",
"// check here if the combination of config options is invalid",
"}"
] | Validates the metadata configuration.
@param array $config A resource config
@param string $name The config key
@param string $path The loaded file path
@throws \InvalidArgumentException If one of the provided config keys is not supported,
something is missing or the combination is invalid. | [
"Validates",
"the",
"metadata",
"configuration",
"."
] | 399bb427678ddc17c67295c738b96faea485e2d8 | https://github.com/harmony-project/modular-routing/blob/399bb427678ddc17c67295c738b96faea485e2d8/source/Metadata/Loader/YamlFileLoader.php#L152-L165 |
4,587 | intothesource/laravel-entrance | src/Http/Controllers/EntranceController.php | EntranceController.doLogin | public function doLogin(Request $request)
{
$userdata = array(
'email' => $request->email,
'password' => $request->password
);
if(\Auth::attempt($userdata, true, true))
{
if(config('entrance.activated')) {
if(\Auth::user()->status != 1) {
// Logging the user out
\Auth::logout();
$request->session()->flash('message', 'Dit account is staat niet op active');
return redirect()->route('login.index');
}
}
$request->session()->flash('message', 'Ingelogd');
return redirect()->intended();
}
else
{
$request->session()->flash('message', 'E-mail of wachtwoord onjuist!');
return redirect()->route('login.index')->withInput();
}
} | php | public function doLogin(Request $request)
{
$userdata = array(
'email' => $request->email,
'password' => $request->password
);
if(\Auth::attempt($userdata, true, true))
{
if(config('entrance.activated')) {
if(\Auth::user()->status != 1) {
// Logging the user out
\Auth::logout();
$request->session()->flash('message', 'Dit account is staat niet op active');
return redirect()->route('login.index');
}
}
$request->session()->flash('message', 'Ingelogd');
return redirect()->intended();
}
else
{
$request->session()->flash('message', 'E-mail of wachtwoord onjuist!');
return redirect()->route('login.index')->withInput();
}
} | [
"public",
"function",
"doLogin",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"userdata",
"=",
"array",
"(",
"'email'",
"=>",
"$",
"request",
"->",
"email",
",",
"'password'",
"=>",
"$",
"request",
"->",
"password",
")",
";",
"if",
"(",
"\\",
"Auth",
"::",
"attempt",
"(",
"$",
"userdata",
",",
"true",
",",
"true",
")",
")",
"{",
"if",
"(",
"config",
"(",
"'entrance.activated'",
")",
")",
"{",
"if",
"(",
"\\",
"Auth",
"::",
"user",
"(",
")",
"->",
"status",
"!=",
"1",
")",
"{",
"// Logging the user out",
"\\",
"Auth",
"::",
"logout",
"(",
")",
";",
"$",
"request",
"->",
"session",
"(",
")",
"->",
"flash",
"(",
"'message'",
",",
"'Dit account is staat niet op active'",
")",
";",
"return",
"redirect",
"(",
")",
"->",
"route",
"(",
"'login.index'",
")",
";",
"}",
"}",
"$",
"request",
"->",
"session",
"(",
")",
"->",
"flash",
"(",
"'message'",
",",
"'Ingelogd'",
")",
";",
"return",
"redirect",
"(",
")",
"->",
"intended",
"(",
")",
";",
"}",
"else",
"{",
"$",
"request",
"->",
"session",
"(",
")",
"->",
"flash",
"(",
"'message'",
",",
"'E-mail of wachtwoord onjuist!'",
")",
";",
"return",
"redirect",
"(",
")",
"->",
"route",
"(",
"'login.index'",
")",
"->",
"withInput",
"(",
")",
";",
"}",
"}"
] | Logs user in after checking inserted data.
@param Request $request
@return void
@author David Bikanov | [
"Logs",
"user",
"in",
"after",
"checking",
"inserted",
"data",
"."
] | 06abacfd7fa06bb44aaa7196faafd7b243d185b0 | https://github.com/intothesource/laravel-entrance/blob/06abacfd7fa06bb44aaa7196faafd7b243d185b0/src/Http/Controllers/EntranceController.php#L27-L53 |
4,588 | intothesource/laravel-entrance | src/Http/Controllers/EntranceController.php | EntranceController.doLogout | public function doLogout(Request $request)
{
\Auth::logout();
$request->session()->flash('message', 'Succesvol uitgelogd');
return redirect()->route('login.index');
} | php | public function doLogout(Request $request)
{
\Auth::logout();
$request->session()->flash('message', 'Succesvol uitgelogd');
return redirect()->route('login.index');
} | [
"public",
"function",
"doLogout",
"(",
"Request",
"$",
"request",
")",
"{",
"\\",
"Auth",
"::",
"logout",
"(",
")",
";",
"$",
"request",
"->",
"session",
"(",
")",
"->",
"flash",
"(",
"'message'",
",",
"'Succesvol uitgelogd'",
")",
";",
"return",
"redirect",
"(",
")",
"->",
"route",
"(",
"'login.index'",
")",
";",
"}"
] | Logs user out.
@return void
@author David Bikanov | [
"Logs",
"user",
"out",
"."
] | 06abacfd7fa06bb44aaa7196faafd7b243d185b0 | https://github.com/intothesource/laravel-entrance/blob/06abacfd7fa06bb44aaa7196faafd7b243d185b0/src/Http/Controllers/EntranceController.php#L60-L65 |
4,589 | intothesource/laravel-entrance | src/Http/Controllers/EntranceController.php | EntranceController.sendReset | public function sendReset(Request $request)
{
$user = User::where('email', '=', $request->email)->first();
if($user !== null)
{
$existingReset = Password_reset::where('email', $request->email)->first();
if($existingReset !== null)
{
$existingReset->created_at = Carbon::now()->toDateTimeString();
$existingReset->save();
\Mail::send(config('entrance.mail.password_reset'), ['reset' => $existingReset->token], function ($m) use ($user) {
$m->to($user->email, $user->name)->subject('Your Password Reset!');
});
$request->session()->flash('message', 'Er is een e-mail met een link verzonden.');
return redirect()->route('reset.password');
}
else
{
$passwordReset = new Password_reset();
$passwordReset->email = $request->email;
$passwordReset->token = $request->_token;
$passwordReset->created_at = Carbon::now()->toDateTimeString();
$passwordReset->save();
\Mail::send(config('entrance.mail.password_reset'), ['reset' => $request->_token], function ($m) use ($user) {
$m->to($user->email, $user->name)->subject('Your Password Reset!');
});
$request->session()->flash('message', 'Er is een e-mail met een link verzonden.');
return redirect()->route('reset.password');
}
}
else
{
$request->session()->flash('message', 'Er bestaat geen gebruiker met het ingevoerde e-mail adres.');
return redirect()->route('reset.password');
}
} | php | public function sendReset(Request $request)
{
$user = User::where('email', '=', $request->email)->first();
if($user !== null)
{
$existingReset = Password_reset::where('email', $request->email)->first();
if($existingReset !== null)
{
$existingReset->created_at = Carbon::now()->toDateTimeString();
$existingReset->save();
\Mail::send(config('entrance.mail.password_reset'), ['reset' => $existingReset->token], function ($m) use ($user) {
$m->to($user->email, $user->name)->subject('Your Password Reset!');
});
$request->session()->flash('message', 'Er is een e-mail met een link verzonden.');
return redirect()->route('reset.password');
}
else
{
$passwordReset = new Password_reset();
$passwordReset->email = $request->email;
$passwordReset->token = $request->_token;
$passwordReset->created_at = Carbon::now()->toDateTimeString();
$passwordReset->save();
\Mail::send(config('entrance.mail.password_reset'), ['reset' => $request->_token], function ($m) use ($user) {
$m->to($user->email, $user->name)->subject('Your Password Reset!');
});
$request->session()->flash('message', 'Er is een e-mail met een link verzonden.');
return redirect()->route('reset.password');
}
}
else
{
$request->session()->flash('message', 'Er bestaat geen gebruiker met het ingevoerde e-mail adres.');
return redirect()->route('reset.password');
}
} | [
"public",
"function",
"sendReset",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"user",
"=",
"User",
"::",
"where",
"(",
"'email'",
",",
"'='",
",",
"$",
"request",
"->",
"email",
")",
"->",
"first",
"(",
")",
";",
"if",
"(",
"$",
"user",
"!==",
"null",
")",
"{",
"$",
"existingReset",
"=",
"Password_reset",
"::",
"where",
"(",
"'email'",
",",
"$",
"request",
"->",
"email",
")",
"->",
"first",
"(",
")",
";",
"if",
"(",
"$",
"existingReset",
"!==",
"null",
")",
"{",
"$",
"existingReset",
"->",
"created_at",
"=",
"Carbon",
"::",
"now",
"(",
")",
"->",
"toDateTimeString",
"(",
")",
";",
"$",
"existingReset",
"->",
"save",
"(",
")",
";",
"\\",
"Mail",
"::",
"send",
"(",
"config",
"(",
"'entrance.mail.password_reset'",
")",
",",
"[",
"'reset'",
"=>",
"$",
"existingReset",
"->",
"token",
"]",
",",
"function",
"(",
"$",
"m",
")",
"use",
"(",
"$",
"user",
")",
"{",
"$",
"m",
"->",
"to",
"(",
"$",
"user",
"->",
"email",
",",
"$",
"user",
"->",
"name",
")",
"->",
"subject",
"(",
"'Your Password Reset!'",
")",
";",
"}",
")",
";",
"$",
"request",
"->",
"session",
"(",
")",
"->",
"flash",
"(",
"'message'",
",",
"'Er is een e-mail met een link verzonden.'",
")",
";",
"return",
"redirect",
"(",
")",
"->",
"route",
"(",
"'reset.password'",
")",
";",
"}",
"else",
"{",
"$",
"passwordReset",
"=",
"new",
"Password_reset",
"(",
")",
";",
"$",
"passwordReset",
"->",
"email",
"=",
"$",
"request",
"->",
"email",
";",
"$",
"passwordReset",
"->",
"token",
"=",
"$",
"request",
"->",
"_token",
";",
"$",
"passwordReset",
"->",
"created_at",
"=",
"Carbon",
"::",
"now",
"(",
")",
"->",
"toDateTimeString",
"(",
")",
";",
"$",
"passwordReset",
"->",
"save",
"(",
")",
";",
"\\",
"Mail",
"::",
"send",
"(",
"config",
"(",
"'entrance.mail.password_reset'",
")",
",",
"[",
"'reset'",
"=>",
"$",
"request",
"->",
"_token",
"]",
",",
"function",
"(",
"$",
"m",
")",
"use",
"(",
"$",
"user",
")",
"{",
"$",
"m",
"->",
"to",
"(",
"$",
"user",
"->",
"email",
",",
"$",
"user",
"->",
"name",
")",
"->",
"subject",
"(",
"'Your Password Reset!'",
")",
";",
"}",
")",
";",
"$",
"request",
"->",
"session",
"(",
")",
"->",
"flash",
"(",
"'message'",
",",
"'Er is een e-mail met een link verzonden.'",
")",
";",
"return",
"redirect",
"(",
")",
"->",
"route",
"(",
"'reset.password'",
")",
";",
"}",
"}",
"else",
"{",
"$",
"request",
"->",
"session",
"(",
")",
"->",
"flash",
"(",
"'message'",
",",
"'Er bestaat geen gebruiker met het ingevoerde e-mail adres.'",
")",
";",
"return",
"redirect",
"(",
")",
"->",
"route",
"(",
"'reset.password'",
")",
";",
"}",
"}"
] | Sends a password reset e-mail to the user.
@param Request $request
@return void
@author David Bikanov | [
"Sends",
"a",
"password",
"reset",
"e",
"-",
"mail",
"to",
"the",
"user",
"."
] | 06abacfd7fa06bb44aaa7196faafd7b243d185b0 | https://github.com/intothesource/laravel-entrance/blob/06abacfd7fa06bb44aaa7196faafd7b243d185b0/src/Http/Controllers/EntranceController.php#L73-L115 |
4,590 | intothesource/laravel-entrance | src/Http/Controllers/EntranceController.php | EntranceController.doReset | public function doReset(Request $request)
{
$existingReset = Password_reset::where('email', $request->email)
->where('token', $request->token)
->first();
if ($existingReset !== null)
{
if ($request->password === $request->input('repeat-password'))
{
$user = User::where('email',$request->email)->first();
$user->password = bcrypt($request->password);
$user->save();
$existingReset->delete();
return redirect()->route('success');
}
else
{
$request->session()->flash('message', 'De ingevoerde wachtwoorden komen niet overeen.');
return back()->withInput();
}
}
else
{
$request->session()->flash('message', 'Het ingevoerde e-mail adres is onjuist.');
return back()->withInput($request->except('email'));
}
} | php | public function doReset(Request $request)
{
$existingReset = Password_reset::where('email', $request->email)
->where('token', $request->token)
->first();
if ($existingReset !== null)
{
if ($request->password === $request->input('repeat-password'))
{
$user = User::where('email',$request->email)->first();
$user->password = bcrypt($request->password);
$user->save();
$existingReset->delete();
return redirect()->route('success');
}
else
{
$request->session()->flash('message', 'De ingevoerde wachtwoorden komen niet overeen.');
return back()->withInput();
}
}
else
{
$request->session()->flash('message', 'Het ingevoerde e-mail adres is onjuist.');
return back()->withInput($request->except('email'));
}
} | [
"public",
"function",
"doReset",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"existingReset",
"=",
"Password_reset",
"::",
"where",
"(",
"'email'",
",",
"$",
"request",
"->",
"email",
")",
"->",
"where",
"(",
"'token'",
",",
"$",
"request",
"->",
"token",
")",
"->",
"first",
"(",
")",
";",
"if",
"(",
"$",
"existingReset",
"!==",
"null",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"password",
"===",
"$",
"request",
"->",
"input",
"(",
"'repeat-password'",
")",
")",
"{",
"$",
"user",
"=",
"User",
"::",
"where",
"(",
"'email'",
",",
"$",
"request",
"->",
"email",
")",
"->",
"first",
"(",
")",
";",
"$",
"user",
"->",
"password",
"=",
"bcrypt",
"(",
"$",
"request",
"->",
"password",
")",
";",
"$",
"user",
"->",
"save",
"(",
")",
";",
"$",
"existingReset",
"->",
"delete",
"(",
")",
";",
"return",
"redirect",
"(",
")",
"->",
"route",
"(",
"'success'",
")",
";",
"}",
"else",
"{",
"$",
"request",
"->",
"session",
"(",
")",
"->",
"flash",
"(",
"'message'",
",",
"'De ingevoerde wachtwoorden komen niet overeen.'",
")",
";",
"return",
"back",
"(",
")",
"->",
"withInput",
"(",
")",
";",
"}",
"}",
"else",
"{",
"$",
"request",
"->",
"session",
"(",
")",
"->",
"flash",
"(",
"'message'",
",",
"'Het ingevoerde e-mail adres is onjuist.'",
")",
";",
"return",
"back",
"(",
")",
"->",
"withInput",
"(",
"$",
"request",
"->",
"except",
"(",
"'email'",
")",
")",
";",
"}",
"}"
] | Resets the users password.
@param Request $request
@return void
@author David Bikanov | [
"Resets",
"the",
"users",
"password",
"."
] | 06abacfd7fa06bb44aaa7196faafd7b243d185b0 | https://github.com/intothesource/laravel-entrance/blob/06abacfd7fa06bb44aaa7196faafd7b243d185b0/src/Http/Controllers/EntranceController.php#L123-L152 |
4,591 | intothesource/laravel-entrance | src/Http/Controllers/EntranceController.php | EntranceController.doRegister | public function doRegister(RegisterRequest $request)
{
// Encrypt the password
$request['password'] = bcrypt($request->password);
$userModel = config('entrance.classes.user_model');
$user = $userModel::create($request->all());
if(config('intothesource')) {
$roleModel = config('intothesource.usermanager.default_role_model');
$role = $roleModel::where('name', config('intothesource.usermanager.default_role'))->firstOrFail()->id;
$user->roles()->attach([$role]);
}
$request->session()->flash('message', 'Succesvol geregistreerd');
return Redirect()->route('register');
} | php | public function doRegister(RegisterRequest $request)
{
// Encrypt the password
$request['password'] = bcrypt($request->password);
$userModel = config('entrance.classes.user_model');
$user = $userModel::create($request->all());
if(config('intothesource')) {
$roleModel = config('intothesource.usermanager.default_role_model');
$role = $roleModel::where('name', config('intothesource.usermanager.default_role'))->firstOrFail()->id;
$user->roles()->attach([$role]);
}
$request->session()->flash('message', 'Succesvol geregistreerd');
return Redirect()->route('register');
} | [
"public",
"function",
"doRegister",
"(",
"RegisterRequest",
"$",
"request",
")",
"{",
"// Encrypt the password",
"$",
"request",
"[",
"'password'",
"]",
"=",
"bcrypt",
"(",
"$",
"request",
"->",
"password",
")",
";",
"$",
"userModel",
"=",
"config",
"(",
"'entrance.classes.user_model'",
")",
";",
"$",
"user",
"=",
"$",
"userModel",
"::",
"create",
"(",
"$",
"request",
"->",
"all",
"(",
")",
")",
";",
"if",
"(",
"config",
"(",
"'intothesource'",
")",
")",
"{",
"$",
"roleModel",
"=",
"config",
"(",
"'intothesource.usermanager.default_role_model'",
")",
";",
"$",
"role",
"=",
"$",
"roleModel",
"::",
"where",
"(",
"'name'",
",",
"config",
"(",
"'intothesource.usermanager.default_role'",
")",
")",
"->",
"firstOrFail",
"(",
")",
"->",
"id",
";",
"$",
"user",
"->",
"roles",
"(",
")",
"->",
"attach",
"(",
"[",
"$",
"role",
"]",
")",
";",
"}",
"$",
"request",
"->",
"session",
"(",
")",
"->",
"flash",
"(",
"'message'",
",",
"'Succesvol geregistreerd'",
")",
";",
"return",
"Redirect",
"(",
")",
"->",
"route",
"(",
"'register'",
")",
";",
"}"
] | Register the given input
@param RegisterRequest $request
@return redirect | [
"Register",
"the",
"given",
"input"
] | 06abacfd7fa06bb44aaa7196faafd7b243d185b0 | https://github.com/intothesource/laravel-entrance/blob/06abacfd7fa06bb44aaa7196faafd7b243d185b0/src/Http/Controllers/EntranceController.php#L160-L176 |
4,592 | calgamo/bench | src/Reporter/AbstractBenchmarkReporter.php | AbstractBenchmarkReporter.aggregate | protected function aggregate() : array
{
$ret = [];
if ($this->flags & Benchmark::BENCHMARK_TIME === Benchmark::BENCHMARK_TIME){
$ret['time'] = TimeBenchmark::score($this->h_time);
}
if ($this->flags & Benchmark::BENCHMARK_MEMORY === Benchmark::BENCHMARK_MEMORY){
$ret['memory'] = MemoryBenchmark::score($this->h_memory);
}
return $ret;
} | php | protected function aggregate() : array
{
$ret = [];
if ($this->flags & Benchmark::BENCHMARK_TIME === Benchmark::BENCHMARK_TIME){
$ret['time'] = TimeBenchmark::score($this->h_time);
}
if ($this->flags & Benchmark::BENCHMARK_MEMORY === Benchmark::BENCHMARK_MEMORY){
$ret['memory'] = MemoryBenchmark::score($this->h_memory);
}
return $ret;
} | [
"protected",
"function",
"aggregate",
"(",
")",
":",
"array",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"flags",
"&",
"Benchmark",
"::",
"BENCHMARK_TIME",
"===",
"Benchmark",
"::",
"BENCHMARK_TIME",
")",
"{",
"$",
"ret",
"[",
"'time'",
"]",
"=",
"TimeBenchmark",
"::",
"score",
"(",
"$",
"this",
"->",
"h_time",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"flags",
"&",
"Benchmark",
"::",
"BENCHMARK_MEMORY",
"===",
"Benchmark",
"::",
"BENCHMARK_MEMORY",
")",
"{",
"$",
"ret",
"[",
"'memory'",
"]",
"=",
"MemoryBenchmark",
"::",
"score",
"(",
"$",
"this",
"->",
"h_memory",
")",
";",
"}",
"return",
"$",
"ret",
";",
"}"
] | Aggregate benchmark result
@return array | [
"Aggregate",
"benchmark",
"result"
] | bf51f711a13604782c1922555e2c883417e78d71 | https://github.com/calgamo/bench/blob/bf51f711a13604782c1922555e2c883417e78d71/src/Reporter/AbstractBenchmarkReporter.php#L59-L70 |
4,593 | setrun/setrun-component-sys | src/entities/Language.php | Language.edit | public function edit($name, $slug, $locale, $alias, $icon): void
{
$this->name = $name;
$this->slug = $slug;
$this->locale = $locale;
$this->alias = $alias;
$this->icon = $icon;
$this->updated_by = Yii::$app->user->identity->id;
} | php | public function edit($name, $slug, $locale, $alias, $icon): void
{
$this->name = $name;
$this->slug = $slug;
$this->locale = $locale;
$this->alias = $alias;
$this->icon = $icon;
$this->updated_by = Yii::$app->user->identity->id;
} | [
"public",
"function",
"edit",
"(",
"$",
"name",
",",
"$",
"slug",
",",
"$",
"locale",
",",
"$",
"alias",
",",
"$",
"icon",
")",
":",
"void",
"{",
"$",
"this",
"->",
"name",
"=",
"$",
"name",
";",
"$",
"this",
"->",
"slug",
"=",
"$",
"slug",
";",
"$",
"this",
"->",
"locale",
"=",
"$",
"locale",
";",
"$",
"this",
"->",
"alias",
"=",
"$",
"alias",
";",
"$",
"this",
"->",
"icon",
"=",
"$",
"icon",
";",
"$",
"this",
"->",
"updated_by",
"=",
"Yii",
"::",
"$",
"app",
"->",
"user",
"->",
"identity",
"->",
"id",
";",
"}"
] | Edit a language.
@param string $name
@param string $slug
@param string $locale
@param string $alias
@param string $icon
@return void | [
"Edit",
"a",
"language",
"."
] | ad9a6442a2921e0f061ed4e455b050c56029d565 | https://github.com/setrun/setrun-component-sys/blob/ad9a6442a2921e0f061ed4e455b050c56029d565/src/entities/Language.php#L75-L83 |
4,594 | j3j5/twitterapio | src/TwitterIterator.php | TwitterIterator.checkRateLimits | public function checkRateLimits(array $response, array $original_arguments)
{
// Check for rate limits
if (is_array($response) && isset($response['errors'], $response['tts'])) {
if ($this->sleep_on_rate_limit) {
if ($response['tts'] == 0) {
$this->api->debug('An error occured: ' . print_r($response['errors'], true));
$this->max_id = $this->since_id = 0;
return [];
} else {
$this->api->debug("Sleeping for {$response['tts']}s. ...");
sleep($response['tts'] + 1);
// Retry
return $this->api->get($this->endpoint, $original_arguments);
}
} else {
$this->max_id = $this->since_id = 0;
return [];
}
}
return $response;
} | php | public function checkRateLimits(array $response, array $original_arguments)
{
// Check for rate limits
if (is_array($response) && isset($response['errors'], $response['tts'])) {
if ($this->sleep_on_rate_limit) {
if ($response['tts'] == 0) {
$this->api->debug('An error occured: ' . print_r($response['errors'], true));
$this->max_id = $this->since_id = 0;
return [];
} else {
$this->api->debug("Sleeping for {$response['tts']}s. ...");
sleep($response['tts'] + 1);
// Retry
return $this->api->get($this->endpoint, $original_arguments);
}
} else {
$this->max_id = $this->since_id = 0;
return [];
}
}
return $response;
} | [
"public",
"function",
"checkRateLimits",
"(",
"array",
"$",
"response",
",",
"array",
"$",
"original_arguments",
")",
"{",
"// Check for rate limits",
"if",
"(",
"is_array",
"(",
"$",
"response",
")",
"&&",
"isset",
"(",
"$",
"response",
"[",
"'errors'",
"]",
",",
"$",
"response",
"[",
"'tts'",
"]",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"sleep_on_rate_limit",
")",
"{",
"if",
"(",
"$",
"response",
"[",
"'tts'",
"]",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"api",
"->",
"debug",
"(",
"'An error occured: '",
".",
"print_r",
"(",
"$",
"response",
"[",
"'errors'",
"]",
",",
"true",
")",
")",
";",
"$",
"this",
"->",
"max_id",
"=",
"$",
"this",
"->",
"since_id",
"=",
"0",
";",
"return",
"[",
"]",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"api",
"->",
"debug",
"(",
"\"Sleeping for {$response['tts']}s. ...\"",
")",
";",
"sleep",
"(",
"$",
"response",
"[",
"'tts'",
"]",
"+",
"1",
")",
";",
"// Retry",
"return",
"$",
"this",
"->",
"api",
"->",
"get",
"(",
"$",
"this",
"->",
"endpoint",
",",
"$",
"original_arguments",
")",
";",
"}",
"}",
"else",
"{",
"$",
"this",
"->",
"max_id",
"=",
"$",
"this",
"->",
"since_id",
"=",
"0",
";",
"return",
"[",
"]",
";",
"}",
"}",
"return",
"$",
"response",
";",
"}"
] | Check whether the response from Twitter's API is rate limiting the calls or not.
@param array $response Twitter's respose
@ | [
"Check",
"whether",
"the",
"response",
"from",
"Twitter",
"s",
"API",
"is",
"rate",
"limiting",
"the",
"calls",
"or",
"not",
"."
] | 67c3b12da7628ed679cee0060c9ab13412d9112c | https://github.com/j3j5/twitterapio/blob/67c3b12da7628ed679cee0060c9ab13412d9112c/src/TwitterIterator.php#L51-L72 |
4,595 | rezzza/jobflow | src/Rezzza/Jobflow/ResolvedJob.php | ResolvedJob.getInitOptionsResolver | public function getInitOptionsResolver()
{
if (null === $this->initOptionsResolver) {
if (null !== $this->parent) {
$this->initOptionsResolver = clone $this->parent->getInitOptionsResolver();
} else {
$this->initOptionsResolver = new OptionsResolver();
}
$this->innerType->setInitOptions($this->initOptionsResolver);
foreach ($this->typeExtensions as $extension) {
$extension->setInitOptions($this->initOptionsResolver);
}
}
return $this->initOptionsResolver;
} | php | public function getInitOptionsResolver()
{
if (null === $this->initOptionsResolver) {
if (null !== $this->parent) {
$this->initOptionsResolver = clone $this->parent->getInitOptionsResolver();
} else {
$this->initOptionsResolver = new OptionsResolver();
}
$this->innerType->setInitOptions($this->initOptionsResolver);
foreach ($this->typeExtensions as $extension) {
$extension->setInitOptions($this->initOptionsResolver);
}
}
return $this->initOptionsResolver;
} | [
"public",
"function",
"getInitOptionsResolver",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"initOptionsResolver",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"parent",
")",
"{",
"$",
"this",
"->",
"initOptionsResolver",
"=",
"clone",
"$",
"this",
"->",
"parent",
"->",
"getInitOptionsResolver",
"(",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"initOptionsResolver",
"=",
"new",
"OptionsResolver",
"(",
")",
";",
"}",
"$",
"this",
"->",
"innerType",
"->",
"setInitOptions",
"(",
"$",
"this",
"->",
"initOptionsResolver",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"typeExtensions",
"as",
"$",
"extension",
")",
"{",
"$",
"extension",
"->",
"setInitOptions",
"(",
"$",
"this",
"->",
"initOptionsResolver",
")",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"initOptionsResolver",
";",
"}"
] | Init options with innerType requirements
@return OptionsResolver | [
"Init",
"options",
"with",
"innerType",
"requirements"
] | 80ded8ac6ed6a2f4500b8f86e2958701ec84fd65 | https://github.com/rezzza/jobflow/blob/80ded8ac6ed6a2f4500b8f86e2958701ec84fd65/src/Rezzza/Jobflow/ResolvedJob.php#L97-L114 |
4,596 | rezzza/jobflow | src/Rezzza/Jobflow/ResolvedJob.php | ResolvedJob.getExecOptionsResolver | public function getExecOptionsResolver()
{
if (null === $this->execOptionsResolver) {
if (null !== $this->parent) {
$this->execOptionsResolver = clone $this->parent->getExecOptionsResolver();
} else {
$this->execOptionsResolver = new OptionsResolver();
}
$this->innerType->setExecOptions($this->execOptionsResolver);
foreach ($this->typeExtensions as $extension) {
$extension->setExecOptions($this->execOptionsResolver);
}
}
return $this->execOptionsResolver;
} | php | public function getExecOptionsResolver()
{
if (null === $this->execOptionsResolver) {
if (null !== $this->parent) {
$this->execOptionsResolver = clone $this->parent->getExecOptionsResolver();
} else {
$this->execOptionsResolver = new OptionsResolver();
}
$this->innerType->setExecOptions($this->execOptionsResolver);
foreach ($this->typeExtensions as $extension) {
$extension->setExecOptions($this->execOptionsResolver);
}
}
return $this->execOptionsResolver;
} | [
"public",
"function",
"getExecOptionsResolver",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"execOptionsResolver",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"parent",
")",
"{",
"$",
"this",
"->",
"execOptionsResolver",
"=",
"clone",
"$",
"this",
"->",
"parent",
"->",
"getExecOptionsResolver",
"(",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"execOptionsResolver",
"=",
"new",
"OptionsResolver",
"(",
")",
";",
"}",
"$",
"this",
"->",
"innerType",
"->",
"setExecOptions",
"(",
"$",
"this",
"->",
"execOptionsResolver",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"typeExtensions",
"as",
"$",
"extension",
")",
"{",
"$",
"extension",
"->",
"setExecOptions",
"(",
"$",
"this",
"->",
"execOptionsResolver",
")",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"execOptionsResolver",
";",
"}"
] | Exec options with innerType requirements
@return OptionsResolver | [
"Exec",
"options",
"with",
"innerType",
"requirements"
] | 80ded8ac6ed6a2f4500b8f86e2958701ec84fd65 | https://github.com/rezzza/jobflow/blob/80ded8ac6ed6a2f4500b8f86e2958701ec84fd65/src/Rezzza/Jobflow/ResolvedJob.php#L121-L138 |
4,597 | rezzza/jobflow | src/Rezzza/Jobflow/ResolvedJob.php | ResolvedJob.newBuilder | protected function newBuilder($name, JobFactory $factory, array $initOptions, array $execOptions)
{
return new JobBuilder($name, $factory, new EventDispatcher(), $initOptions, $execOptions);
} | php | protected function newBuilder($name, JobFactory $factory, array $initOptions, array $execOptions)
{
return new JobBuilder($name, $factory, new EventDispatcher(), $initOptions, $execOptions);
} | [
"protected",
"function",
"newBuilder",
"(",
"$",
"name",
",",
"JobFactory",
"$",
"factory",
",",
"array",
"$",
"initOptions",
",",
"array",
"$",
"execOptions",
")",
"{",
"return",
"new",
"JobBuilder",
"(",
"$",
"name",
",",
"$",
"factory",
",",
"new",
"EventDispatcher",
"(",
")",
",",
"$",
"initOptions",
",",
"$",
"execOptions",
")",
";",
"}"
] | Create new JobBuilder for the innerType
@param string $name
@param JobFactory $factory
@return JobBuilder | [
"Create",
"new",
"JobBuilder",
"for",
"the",
"innerType"
] | 80ded8ac6ed6a2f4500b8f86e2958701ec84fd65 | https://github.com/rezzza/jobflow/blob/80ded8ac6ed6a2f4500b8f86e2958701ec84fd65/src/Rezzza/Jobflow/ResolvedJob.php#L148-L151 |
4,598 | marcqualie/mongominify | src/MongoMinify/Db.php | Db.createCollection | public function createCollection($name, $capped = false, $size = 0, $max = 0)
{
$this->native->createCollection($name, $capped, $size, $max);
return $this->selectCollection($name);
} | php | public function createCollection($name, $capped = false, $size = 0, $max = 0)
{
$this->native->createCollection($name, $capped, $size, $max);
return $this->selectCollection($name);
} | [
"public",
"function",
"createCollection",
"(",
"$",
"name",
",",
"$",
"capped",
"=",
"false",
",",
"$",
"size",
"=",
"0",
",",
"$",
"max",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"native",
"->",
"createCollection",
"(",
"$",
"name",
",",
"$",
"capped",
",",
"$",
"size",
",",
"$",
"max",
")",
";",
"return",
"$",
"this",
"->",
"selectCollection",
"(",
"$",
"name",
")",
";",
"}"
] | Create a new Collection | [
"Create",
"a",
"new",
"Collection"
] | 63240a91431e09279009235596bfc7f67636b269 | https://github.com/marcqualie/mongominify/blob/63240a91431e09279009235596bfc7f67636b269/src/MongoMinify/Db.php#L53-L58 |
4,599 | easy-system/es-http | src/Uploading/AbstractUploadStrategy.php | AbstractUploadStrategy.decideOnFailure | protected function decideOnFailure($error)
{
if (! isset($this->errors[$error])) {
throw new UnexpectedValueException(sprintf(
'Unexpected error "%s" received. All error must be specified '
. 'in errors array of this instance.',
$error
));
}
$this->state = static::STATE_FAILURE | static::STATE_BREAK;
$this->operationError = $error;
$this->operationErrorDescription = $this->errors[$error];
} | php | protected function decideOnFailure($error)
{
if (! isset($this->errors[$error])) {
throw new UnexpectedValueException(sprintf(
'Unexpected error "%s" received. All error must be specified '
. 'in errors array of this instance.',
$error
));
}
$this->state = static::STATE_FAILURE | static::STATE_BREAK;
$this->operationError = $error;
$this->operationErrorDescription = $this->errors[$error];
} | [
"protected",
"function",
"decideOnFailure",
"(",
"$",
"error",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"errors",
"[",
"$",
"error",
"]",
")",
")",
"{",
"throw",
"new",
"UnexpectedValueException",
"(",
"sprintf",
"(",
"'Unexpected error \"%s\" received. All error must be specified '",
".",
"'in errors array of this instance.'",
",",
"$",
"error",
")",
")",
";",
"}",
"$",
"this",
"->",
"state",
"=",
"static",
"::",
"STATE_FAILURE",
"|",
"static",
"::",
"STATE_BREAK",
";",
"$",
"this",
"->",
"operationError",
"=",
"$",
"error",
";",
"$",
"this",
"->",
"operationErrorDescription",
"=",
"$",
"this",
"->",
"errors",
"[",
"$",
"error",
"]",
";",
"}"
] | Decides on failure.
@param string $error The error
@throws \UnexpectedValueException If the received error is not specified
in $this->errors | [
"Decides",
"on",
"failure",
"."
] | dd5852e94901e147a7546a8715133408ece767a1 | https://github.com/easy-system/es-http/blob/dd5852e94901e147a7546a8715133408ece767a1/src/Uploading/AbstractUploadStrategy.php#L130-L143 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.