id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
230,300 | deanblackborough/zf3-view-helpers | src/Bootstrap4Card.php | Bootstrap4Card.addCustomBodyClass | public function addCustomBodyClass(string $class, string $element, bool $first = false) : Bootstrap4Card
{
if (in_array($element, $this->body_elements) === true) {
$this->body_classes[$element][] = $class;
if ($first === true) {
$this->body_classes_first[$element][$c... | php | public function addCustomBodyClass(string $class, string $element, bool $first = false) : Bootstrap4Card
{
if (in_array($element, $this->body_elements) === true) {
$this->body_classes[$element][] = $class;
if ($first === true) {
$this->body_classes_first[$element][$c... | [
"public",
"function",
"addCustomBodyClass",
"(",
"string",
"$",
"class",
",",
"string",
"$",
"element",
",",
"bool",
"$",
"first",
"=",
"false",
")",
":",
"Bootstrap4Card",
"{",
"if",
"(",
"in_array",
"(",
"$",
"element",
",",
"$",
"this",
"->",
"body_el... | Add a custom class to a card body element, if there are multiple body elements of
the same type the class will be added to all of them.
Silently errors, if the element is invalid the attribute is not assigned to the body classes array
@param string $class Class to assign to element
@param string $element Body element... | [
"Add",
"a",
"custom",
"class",
"to",
"a",
"card",
"body",
"element",
"if",
"there",
"are",
"multiple",
"body",
"elements",
"of",
"the",
"same",
"type",
"the",
"class",
"will",
"be",
"added",
"to",
"all",
"of",
"them",
"."
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4Card.php#L390-L401 |
230,301 | deanblackborough/zf3-view-helpers | src/Bootstrap4Card.php | Bootstrap4Card.addCustomAttr | public function addCustomAttr(string $attr, string $element) : Bootstrap4Card
{
if (in_array($element, $this->elements) === true) {
$this->attr[$element][] = $attr;
}
return $this;
} | php | public function addCustomAttr(string $attr, string $element) : Bootstrap4Card
{
if (in_array($element, $this->elements) === true) {
$this->attr[$element][] = $attr;
}
return $this;
} | [
"public",
"function",
"addCustomAttr",
"(",
"string",
"$",
"attr",
",",
"string",
"$",
"element",
")",
":",
"Bootstrap4Card",
"{",
"if",
"(",
"in_array",
"(",
"$",
"element",
",",
"$",
"this",
"->",
"elements",
")",
"===",
"true",
")",
"{",
"$",
"this"... | Add a custom attribute to a card element
Silently errors, if the element is invalid the attribute is not assigned to the attributes array
@param string $attr Attribute to assign to element
@param string $element Element to attach the attribute to [card|body|header|footer]
@return Bootstrap4Card | [
"Add",
"a",
"custom",
"attribute",
"to",
"a",
"card",
"element"
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4Card.php#L413-L420 |
230,302 | deanblackborough/zf3-view-helpers | src/Bootstrap4Card.php | Bootstrap4Card.addCustomBodyAttr | public function addCustomBodyAttr(string $attr, string $element, bool $first = false) : Bootstrap4Card
{
if (in_array($element, $this->body_elements) === true) {
$this->body_attr[$element][] = $attr;
if ($first === true) {
$this->body_attr_first[$element][$attr] = tr... | php | public function addCustomBodyAttr(string $attr, string $element, bool $first = false) : Bootstrap4Card
{
if (in_array($element, $this->body_elements) === true) {
$this->body_attr[$element][] = $attr;
if ($first === true) {
$this->body_attr_first[$element][$attr] = tr... | [
"public",
"function",
"addCustomBodyAttr",
"(",
"string",
"$",
"attr",
",",
"string",
"$",
"element",
",",
"bool",
"$",
"first",
"=",
"false",
")",
":",
"Bootstrap4Card",
"{",
"if",
"(",
"in_array",
"(",
"$",
"element",
",",
"$",
"this",
"->",
"body_elem... | Add a custom attribute to a card body element, if there are multiple body elements of
the same type the attribute will be added to all of them.
Silently errors, if the element is invalid the attribute is not assigned to the body attributes array
@param string $attr Attribute to assign to element
@param string $elemen... | [
"Add",
"a",
"custom",
"attribute",
"to",
"a",
"card",
"body",
"element",
"if",
"there",
"are",
"multiple",
"body",
"elements",
"of",
"the",
"same",
"type",
"the",
"attribute",
"will",
"be",
"added",
"to",
"all",
"of",
"them",
"."
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4Card.php#L434-L445 |
230,303 | deanblackborough/zf3-view-helpers | src/Bootstrap4Card.php | Bootstrap4Card.addTitleToBody | public function addTitleToBody(string $content, string $tag = 'h4') : Bootstrap4Card
{
$this->body_sections[] = [
'type' => 'title',
'tag' => $tag,
'content' => $content
];
return $this;
} | php | public function addTitleToBody(string $content, string $tag = 'h4') : Bootstrap4Card
{
$this->body_sections[] = [
'type' => 'title',
'tag' => $tag,
'content' => $content
];
return $this;
} | [
"public",
"function",
"addTitleToBody",
"(",
"string",
"$",
"content",
",",
"string",
"$",
"tag",
"=",
"'h4'",
")",
":",
"Bootstrap4Card",
"{",
"$",
"this",
"->",
"body_sections",
"[",
"]",
"=",
"[",
"'type'",
"=>",
"'title'",
",",
"'tag'",
"=>",
"$",
... | Add a title section to the body
@param string $content
@param string $tag title tag, defaults to h4
@return Bootstrap4Card | [
"Add",
"a",
"title",
"section",
"to",
"the",
"body"
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4Card.php#L487-L496 |
230,304 | deanblackborough/zf3-view-helpers | src/Bootstrap4Card.php | Bootstrap4Card.addSubtitleToBody | public function addSubtitleToBody(string $content, string $tag = 'h6') : Bootstrap4Card
{
$this->body_sections[] = [
'type' => 'subtitle',
'tag' => $tag,
'content' => $content
];
return $this;
} | php | public function addSubtitleToBody(string $content, string $tag = 'h6') : Bootstrap4Card
{
$this->body_sections[] = [
'type' => 'subtitle',
'tag' => $tag,
'content' => $content
];
return $this;
} | [
"public",
"function",
"addSubtitleToBody",
"(",
"string",
"$",
"content",
",",
"string",
"$",
"tag",
"=",
"'h6'",
")",
":",
"Bootstrap4Card",
"{",
"$",
"this",
"->",
"body_sections",
"[",
"]",
"=",
"[",
"'type'",
"=>",
"'subtitle'",
",",
"'tag'",
"=>",
"... | Add a subtitle section to the body
@param string $content
@param string $tag title tag, defaults to h6
@return Bootstrap4Card | [
"Add",
"a",
"subtitle",
"section",
"to",
"the",
"body"
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4Card.php#L506-L515 |
230,305 | deanblackborough/zf3-view-helpers | src/Bootstrap4Card.php | Bootstrap4Card.addLinkToBody | public function addLinkToBody(string $content, string $uri) : Bootstrap4Card
{
$this->body_sections[] = [
'type' => 'link',
'uri' => $uri,
'content' => $content
];
return $this;
} | php | public function addLinkToBody(string $content, string $uri) : Bootstrap4Card
{
$this->body_sections[] = [
'type' => 'link',
'uri' => $uri,
'content' => $content
];
return $this;
} | [
"public",
"function",
"addLinkToBody",
"(",
"string",
"$",
"content",
",",
"string",
"$",
"uri",
")",
":",
"Bootstrap4Card",
"{",
"$",
"this",
"->",
"body_sections",
"[",
"]",
"=",
"[",
"'type'",
"=>",
"'link'",
",",
"'uri'",
"=>",
"$",
"uri",
",",
"'c... | Add a link section to the body
@param string $content
@param string $uri URI
@return Bootstrap4Card | [
"Add",
"a",
"link",
"section",
"to",
"the",
"body"
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4Card.php#L525-L534 |
230,306 | deanblackborough/zf3-view-helpers | src/Bootstrap4Card.php | Bootstrap4Card.assignBgStyle | protected function assignBgStyle(string $color)
{
if (in_array($color, $this->supported_bg_styles) === true) {
$this->classes['card'][] = 'bg-' . $color;
}
} | php | protected function assignBgStyle(string $color)
{
if (in_array($color, $this->supported_bg_styles) === true) {
$this->classes['card'][] = 'bg-' . $color;
}
} | [
"protected",
"function",
"assignBgStyle",
"(",
"string",
"$",
"color",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"color",
",",
"$",
"this",
"->",
"supported_bg_styles",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"classes",
"[",
"'card'",
"]",
"[... | Validate and assign the background colour, overrides the method in Bootstrap4Helper
@param string $color | [
"Validate",
"and",
"assign",
"the",
"background",
"colour",
"overrides",
"the",
"method",
"in",
"Bootstrap4Helper"
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4Card.php#L570-L575 |
230,307 | Webiny/Framework | src/Webiny/Component/Http/Response.php | Response.setStatusCode | public function setStatusCode($statusCode, $message = '')
{
if (empty($message)) {
if (!isset(self::$httpStatuses[$statusCode])) {
throw new ResponseException('Invalid status code provided: "' . $statusCode . '".');
} else {
$this->statusMessage = self... | php | public function setStatusCode($statusCode, $message = '')
{
if (empty($message)) {
if (!isset(self::$httpStatuses[$statusCode])) {
throw new ResponseException('Invalid status code provided: "' . $statusCode . '".');
} else {
$this->statusMessage = self... | [
"public",
"function",
"setStatusCode",
"(",
"$",
"statusCode",
",",
"$",
"message",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"message",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"httpStatuses",
"[",
"$",
"statusCode",
... | Set HTTP response status code. The status code must be a valid HTTP status code, or an exception will be thrown.
@param int $statusCode Http status code.
@param string $message Http status message. If not set we will use the default message by RFC2616.
@return $this
@throws Response\ResponseException | [
"Set",
"HTTP",
"response",
"status",
"code",
".",
"The",
"status",
"code",
"must",
"be",
"a",
"valid",
"HTTP",
"status",
"code",
"or",
"an",
"exception",
"will",
"be",
"thrown",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Http/Response.php#L214-L229 |
230,308 | Webiny/Framework | src/Webiny/Component/Http/Response.php | Response.setContentType | public function setContentType($contentType)
{
$this->contentType = $contentType;
$this->setHeader('Content-Type', $contentType . '; charset=' . $this->getCharset());
return $this;
} | php | public function setContentType($contentType)
{
$this->contentType = $contentType;
$this->setHeader('Content-Type', $contentType . '; charset=' . $this->getCharset());
return $this;
} | [
"public",
"function",
"setContentType",
"(",
"$",
"contentType",
")",
"{",
"$",
"this",
"->",
"contentType",
"=",
"$",
"contentType",
";",
"$",
"this",
"->",
"setHeader",
"(",
"'Content-Type'",
",",
"$",
"contentType",
".",
"'; charset='",
".",
"$",
"this",
... | Sets the Content-Type header value.
@param string $contentType
@return $this | [
"Sets",
"the",
"Content",
"-",
"Type",
"header",
"value",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Http/Response.php#L248-L255 |
230,309 | Webiny/Framework | src/Webiny/Component/Http/Response.php | Response.setCharset | public function setCharset($charset)
{
$this->charset = $charset;
$this->setContentType($this->getContentType()); // update charset which is set on content-type
return $this;
} | php | public function setCharset($charset)
{
$this->charset = $charset;
$this->setContentType($this->getContentType()); // update charset which is set on content-type
return $this;
} | [
"public",
"function",
"setCharset",
"(",
"$",
"charset",
")",
"{",
"$",
"this",
"->",
"charset",
"=",
"$",
"charset",
";",
"$",
"this",
"->",
"setContentType",
"(",
"$",
"this",
"->",
"getContentType",
"(",
")",
")",
";",
"// update charset which is set on c... | Set the response charset.
@param string $charset Charset name.
@return $this | [
"Set",
"the",
"response",
"charset",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Http/Response.php#L274-L280 |
230,310 | Webiny/Framework | src/Webiny/Component/Http/Response.php | Response.setAsNotModified | public function setAsNotModified()
{
$this->setStatusCode(304);
$this->setContent('');
// remove headers that MUST NOT be included with 304 Not Modified responses
$headersToRemove = [
'Allow',
'Content-Encoding',
'Content-Language',
'C... | php | public function setAsNotModified()
{
$this->setStatusCode(304);
$this->setContent('');
// remove headers that MUST NOT be included with 304 Not Modified responses
$headersToRemove = [
'Allow',
'Content-Encoding',
'Content-Language',
'C... | [
"public",
"function",
"setAsNotModified",
"(",
")",
"{",
"$",
"this",
"->",
"setStatusCode",
"(",
"304",
")",
";",
"$",
"this",
"->",
"setContent",
"(",
"''",
")",
";",
"// remove headers that MUST NOT be included with 304 Not Modified responses",
"$",
"headersToRemov... | Sets the response as not modified.
@return $this | [
"Sets",
"the",
"response",
"as",
"not",
"modified",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Http/Response.php#L322-L342 |
230,311 | Webiny/Framework | src/Webiny/Component/Http/Response.php | Response.sendHeaders | public function sendHeaders()
{
// first build headers -> only if they haven't already been sent
if (!headers_sent()) {
// status code header
header(self::PROTOCOL . ' ' . $this->getStatusCode() . ' ' . $this->statusMessage
);
// other headers
... | php | public function sendHeaders()
{
// first build headers -> only if they haven't already been sent
if (!headers_sent()) {
// status code header
header(self::PROTOCOL . ' ' . $this->getStatusCode() . ' ' . $this->statusMessage
);
// other headers
... | [
"public",
"function",
"sendHeaders",
"(",
")",
"{",
"// first build headers -> only if they haven't already been sent",
"if",
"(",
"!",
"headers_sent",
"(",
")",
")",
"{",
"// status code header",
"header",
"(",
"self",
"::",
"PROTOCOL",
".",
"' '",
".",
"$",
"this"... | Send the currently defined headers.
This also sends the cache control headers.
@return $this | [
"Send",
"the",
"currently",
"defined",
"headers",
".",
"This",
"also",
"sends",
"the",
"cache",
"control",
"headers",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Http/Response.php#L360-L381 |
230,312 | letyii/yii2-rbac-cached | RbacCached.php | RbacCached.setCache | protected function setCache($key, $value) {
$this->cachedData = $this->resolveCacheComponent()->get($this->cacheKeyName);
if (empty($this->cachedData))
$this->cachedData = [];
$this->cachedData[$key] = $value;
return $this->resolveCacheComponent()->set($this->cacheKeyName, $t... | php | protected function setCache($key, $value) {
$this->cachedData = $this->resolveCacheComponent()->get($this->cacheKeyName);
if (empty($this->cachedData))
$this->cachedData = [];
$this->cachedData[$key] = $value;
return $this->resolveCacheComponent()->set($this->cacheKeyName, $t... | [
"protected",
"function",
"setCache",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"cachedData",
"=",
"$",
"this",
"->",
"resolveCacheComponent",
"(",
")",
"->",
"get",
"(",
"$",
"this",
"->",
"cacheKeyName",
")",
";",
"if",
"(",
"... | Set a value in cache
@param $key
@param $value
@return mixed | [
"Set",
"a",
"value",
"in",
"cache"
] | 0e9ace4c6464a8a352e4af3cba0cf3333eaf06c3 | https://github.com/letyii/yii2-rbac-cached/blob/0e9ace4c6464a8a352e4af3cba0cf3333eaf06c3/RbacCached.php#L106-L112 |
230,313 | Webiny/Framework | src/Webiny/Component/Amazon/S3.php | S3.putObject | public function putObject($bucket, $key, $content, array $params = [])
{
return $this->instance->putObject($bucket, $key, $content, $params);
} | php | public function putObject($bucket, $key, $content, array $params = [])
{
return $this->instance->putObject($bucket, $key, $content, $params);
} | [
"public",
"function",
"putObject",
"(",
"$",
"bucket",
",",
"$",
"key",
",",
"$",
"content",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"instance",
"->",
"putObject",
"(",
"$",
"bucket",
",",
"$",
"key",
",",... | Adds an object to a bucket.
@param string $bucket
@param string $key
@param string $content
@param array $params
@return mixed | [
"Adds",
"an",
"object",
"to",
"a",
"bucket",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Amazon/S3.php#L255-L258 |
230,314 | Webiny/Framework | src/Webiny/Component/Cache/Storage/Redis.php | Redis.getInstance | public static function getInstance($host = 'localhost', $port = 6379)
{
return \Webiny\Component\Cache\Bridge\Redis::getInstance($host, $port);
} | php | public static function getInstance($host = 'localhost', $port = 6379)
{
return \Webiny\Component\Cache\Bridge\Redis::getInstance($host, $port);
} | [
"public",
"static",
"function",
"getInstance",
"(",
"$",
"host",
"=",
"'localhost'",
",",
"$",
"port",
"=",
"6379",
")",
"{",
"return",
"\\",
"Webiny",
"\\",
"Component",
"\\",
"Cache",
"\\",
"Bridge",
"\\",
"Redis",
"::",
"getInstance",
"(",
"$",
"host"... | Get an instance of Redis cache storage.
@param string $host Host on which Redis server is running.
@param int $port Port on which Redis server is running.
@return CacheStorageInterface | [
"Get",
"an",
"instance",
"of",
"Redis",
"cache",
"storage",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Cache/Storage/Redis.php#L28-L31 |
230,315 | hypeJunction/hypeLists | classes/hypeJunction/Lists/EntityList.php | EntityList.getItems | public function getItems($batch = false) {
$entities = new ElggBatch($this->getter, $this->getOptions());
if ($batch) {
return $entities;
}
$items = [];
foreach ($entities as $entity) {
$items[] = $entity;
}
return $items;
} | php | public function getItems($batch = false) {
$entities = new ElggBatch($this->getter, $this->getOptions());
if ($batch) {
return $entities;
}
$items = [];
foreach ($entities as $entity) {
$items[] = $entity;
}
return $items;
} | [
"public",
"function",
"getItems",
"(",
"$",
"batch",
"=",
"false",
")",
"{",
"$",
"entities",
"=",
"new",
"ElggBatch",
"(",
"$",
"this",
"->",
"getter",
",",
"$",
"this",
"->",
"getOptions",
"(",
")",
")",
";",
"if",
"(",
"$",
"batch",
")",
"{",
... | Returns items of the list as an array or batch
@param bool $batch Return ElggBatch
@return mixed | [
"Returns",
"items",
"of",
"the",
"list",
"as",
"an",
"array",
"or",
"batch"
] | 6d93d609972d9e4c7aa7b99ba12bddcf5466444a | https://github.com/hypeJunction/hypeLists/blob/6d93d609972d9e4c7aa7b99ba12bddcf5466444a/classes/hypeJunction/Lists/EntityList.php#L131-L141 |
230,316 | hypeJunction/hypeLists | classes/hypeJunction/Lists/EntityList.php | EntityList.getGUIDs | public function getGUIDs() {
$options = $this->getOptions();
$options['callback'] = false;
$rows = new ElggBatch($this->getter, $options);
$guids = [];
foreach ($rows as $row) {
$guids[] = $row->guid;
}
return $guids;
} | php | public function getGUIDs() {
$options = $this->getOptions();
$options['callback'] = false;
$rows = new ElggBatch($this->getter, $options);
$guids = [];
foreach ($rows as $row) {
$guids[] = $row->guid;
}
return $guids;
} | [
"public",
"function",
"getGUIDs",
"(",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getOptions",
"(",
")",
";",
"$",
"options",
"[",
"'callback'",
"]",
"=",
"false",
";",
"$",
"rows",
"=",
"new",
"ElggBatch",
"(",
"$",
"this",
"->",
"getter",
... | Returns an array of GUIDs of items in the batch
@return int[] | [
"Returns",
"an",
"array",
"of",
"GUIDs",
"of",
"items",
"in",
"the",
"batch"
] | 6d93d609972d9e4c7aa7b99ba12bddcf5466444a | https://github.com/hypeJunction/hypeLists/blob/6d93d609972d9e4c7aa7b99ba12bddcf5466444a/classes/hypeJunction/Lists/EntityList.php#L147-L158 |
230,317 | hypeJunction/hypeLists | classes/hypeJunction/Lists/EntityList.php | EntityList.toObject | public function toObject() {
$options = $this->getOptions();
$result = (object) [
'type' => 'list',
'count' => $this->getCount(),
'limit' => elgg_extract('limit', $options, elgg_get_config('default_limit')),
'offset' => elgg_extract('offset', $options, 0),
'sorts' => $this->sorts,
'filters' => ar... | php | public function toObject() {
$options = $this->getOptions();
$result = (object) [
'type' => 'list',
'count' => $this->getCount(),
'limit' => elgg_extract('limit', $options, elgg_get_config('default_limit')),
'offset' => elgg_extract('offset', $options, 0),
'sorts' => $this->sorts,
'filters' => ar... | [
"public",
"function",
"toObject",
"(",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getOptions",
"(",
")",
";",
"$",
"result",
"=",
"(",
"object",
")",
"[",
"'type'",
"=>",
"'list'",
",",
"'count'",
"=>",
"$",
"this",
"->",
"getCount",
"(",
"... | Exports a list into a serializable object
@return stdClass | [
"Exports",
"a",
"list",
"into",
"a",
"serializable",
"object"
] | 6d93d609972d9e4c7aa7b99ba12bddcf5466444a | https://github.com/hypeJunction/hypeLists/blob/6d93d609972d9e4c7aa7b99ba12bddcf5466444a/classes/hypeJunction/Lists/EntityList.php#L164-L192 |
230,318 | hypeJunction/hypeLists | classes/hypeJunction/Lists/EntityList.php | EntityList.addSort | public function addSort($field = 'time_created', $direction = 'DESC', $priority = 500) {
if (!$field || !$direction) {
return $this;
}
while (isset($this->sorts[$priority])) {
$priority++;
}
$field = sanitize_string($field);
$direction = strtoupper(sanitize_string($direction));
if (!in_array($di... | php | public function addSort($field = 'time_created', $direction = 'DESC', $priority = 500) {
if (!$field || !$direction) {
return $this;
}
while (isset($this->sorts[$priority])) {
$priority++;
}
$field = sanitize_string($field);
$direction = strtoupper(sanitize_string($direction));
if (!in_array($di... | [
"public",
"function",
"addSort",
"(",
"$",
"field",
"=",
"'time_created'",
",",
"$",
"direction",
"=",
"'DESC'",
",",
"$",
"priority",
"=",
"500",
")",
"{",
"if",
"(",
"!",
"$",
"field",
"||",
"!",
"$",
"direction",
")",
"{",
"return",
"$",
"this",
... | Set sort field and direction
@param string $field Field name
@param string $direction Sort direction
@param int $priority Priority
@return self | [
"Set",
"sort",
"field",
"and",
"direction"
] | 6d93d609972d9e4c7aa7b99ba12bddcf5466444a | https://github.com/hypeJunction/hypeLists/blob/6d93d609972d9e4c7aa7b99ba12bddcf5466444a/classes/hypeJunction/Lists/EntityList.php#L202-L229 |
230,319 | hypeJunction/hypeLists | classes/hypeJunction/Lists/EntityList.php | EntityList.removeSort | public function removeSort($field) {
foreach ($this->sorts as $key => $value) {
if ($value['field'] == $field) {
unset($this->sorts[$key]);
}
}
return $this;
} | php | public function removeSort($field) {
foreach ($this->sorts as $key => $value) {
if ($value['field'] == $field) {
unset($this->sorts[$key]);
}
}
return $this;
} | [
"public",
"function",
"removeSort",
"(",
"$",
"field",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"sorts",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"[",
"'field'",
"]",
"==",
"$",
"field",
")",
"{",
"unset",
"(",... | Remove sort field
@param string $field Field name
@return self | [
"Remove",
"sort",
"field"
] | 6d93d609972d9e4c7aa7b99ba12bddcf5466444a | https://github.com/hypeJunction/hypeLists/blob/6d93d609972d9e4c7aa7b99ba12bddcf5466444a/classes/hypeJunction/Lists/EntityList.php#L237-L245 |
230,320 | hypeJunction/hypeLists | classes/hypeJunction/Lists/EntityList.php | EntityList.getSortOptions | public function getSortOptions(array $params = []) {
$options = $this->getOptions();
$plugin = elgg_get_plugin_from_id('hypeLists');
$settings = $plugin->getAllSettings();
foreach ($settings as $k => $val) {
if (!$val) {
continue;
}
list(, $entity_type, $field, $direction) = explode('::', $k);
... | php | public function getSortOptions(array $params = []) {
$options = $this->getOptions();
$plugin = elgg_get_plugin_from_id('hypeLists');
$settings = $plugin->getAllSettings();
foreach ($settings as $k => $val) {
if (!$val) {
continue;
}
list(, $entity_type, $field, $direction) = explode('::', $k);
... | [
"public",
"function",
"getSortOptions",
"(",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getOptions",
"(",
")",
";",
"$",
"plugin",
"=",
"elgg_get_plugin_from_id",
"(",
"'hypeLists'",
")",
";",
"$",
"settings... | Returns a list of sort options
@return array $params Params to pass to the hook
@return array | [
"Returns",
"a",
"list",
"of",
"sort",
"options"
] | 6d93d609972d9e4c7aa7b99ba12bddcf5466444a | https://github.com/hypeJunction/hypeLists/blob/6d93d609972d9e4c7aa7b99ba12bddcf5466444a/classes/hypeJunction/Lists/EntityList.php#L253-L288 |
230,321 | hypeJunction/hypeLists | classes/hypeJunction/Lists/EntityList.php | EntityList.getSubtypeOptions | public function getSubtypeOptions() {
$types = get_registered_entity_types();
$types = elgg_trigger_plugin_hook('search_types', 'get_queries', [], $types);
return elgg_extract($this->getEntityType(), $types);
} | php | public function getSubtypeOptions() {
$types = get_registered_entity_types();
$types = elgg_trigger_plugin_hook('search_types', 'get_queries', [], $types);
return elgg_extract($this->getEntityType(), $types);
} | [
"public",
"function",
"getSubtypeOptions",
"(",
")",
"{",
"$",
"types",
"=",
"get_registered_entity_types",
"(",
")",
";",
"$",
"types",
"=",
"elgg_trigger_plugin_hook",
"(",
"'search_types'",
",",
"'get_queries'",
",",
"[",
"]",
",",
"$",
"types",
")",
";",
... | Returns a list of subtype options
@return array | [
"Returns",
"a",
"list",
"of",
"subtype",
"options"
] | 6d93d609972d9e4c7aa7b99ba12bddcf5466444a | https://github.com/hypeJunction/hypeLists/blob/6d93d609972d9e4c7aa7b99ba12bddcf5466444a/classes/hypeJunction/Lists/EntityList.php#L302-L307 |
230,322 | hypeJunction/hypeLists | classes/hypeJunction/Lists/EntityList.php | EntityList.setQuery | public function setQuery($search_query = '', array $search_options = []) {
$this->search_query = sanitize_string(stripslashes($search_query));
$this->search_options = $search_options;
return $this;
} | php | public function setQuery($search_query = '', array $search_options = []) {
$this->search_query = sanitize_string(stripslashes($search_query));
$this->search_options = $search_options;
return $this;
} | [
"public",
"function",
"setQuery",
"(",
"$",
"search_query",
"=",
"''",
",",
"array",
"$",
"search_options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"search_query",
"=",
"sanitize_string",
"(",
"stripslashes",
"(",
"$",
"search_query",
")",
")",
";",
... | Set a search query
@param string $search_query Search query
@param array $search_options Search options
- 'fields' - optional array of attribute and metadata names to search in
- 'advanced' - extend search to tags/profile fields
@return self | [
"Set",
"a",
"search",
"query"
] | 6d93d609972d9e4c7aa7b99ba12bddcf5466444a | https://github.com/hypeJunction/hypeLists/blob/6d93d609972d9e4c7aa7b99ba12bddcf5466444a/classes/hypeJunction/Lists/EntityList.php#L318-L322 |
230,323 | hypeJunction/hypeLists | classes/hypeJunction/Lists/EntityList.php | EntityList.addFilter | public function addFilter($filter, ElggEntity $target = null, $priority = 500) {
if (!$filter) {
return $this;
}
while (isset($this->filters[$priority])) {
$priority++;
}
$this->removeFilter($filter);
if (!isset($target)) {
$target = elgg_get_logged_in_user_entity();
}
$this->filters[$prior... | php | public function addFilter($filter, ElggEntity $target = null, $priority = 500) {
if (!$filter) {
return $this;
}
while (isset($this->filters[$priority])) {
$priority++;
}
$this->removeFilter($filter);
if (!isset($target)) {
$target = elgg_get_logged_in_user_entity();
}
$this->filters[$prior... | [
"public",
"function",
"addFilter",
"(",
"$",
"filter",
",",
"ElggEntity",
"$",
"target",
"=",
"null",
",",
"$",
"priority",
"=",
"500",
")",
"{",
"if",
"(",
"!",
"$",
"filter",
")",
"{",
"return",
"$",
"this",
";",
"}",
"while",
"(",
"isset",
"(",
... | Add relationship filter
@param string $filter Filter name
@param ElggEntity $target Target entity
@param int $priority Priority
@return self | [
"Add",
"relationship",
"filter"
] | 6d93d609972d9e4c7aa7b99ba12bddcf5466444a | https://github.com/hypeJunction/hypeLists/blob/6d93d609972d9e4c7aa7b99ba12bddcf5466444a/classes/hypeJunction/Lists/EntityList.php#L342-L365 |
230,324 | hypeJunction/hypeLists | classes/hypeJunction/Lists/EntityList.php | EntityList.getFieldSearchWhereClause | public static function getFieldSearchWhereClause($table, $fields, $params, $use_fulltext = TRUE) {
if (is_callable('search_get_where_sql')) {
return search_get_where_sql($table, $fields, $params, $use_fulltext);
}
$query = $params['query'];
// add the table prefix to the fields
foreach ($fields as $i => ... | php | public static function getFieldSearchWhereClause($table, $fields, $params, $use_fulltext = TRUE) {
if (is_callable('search_get_where_sql')) {
return search_get_where_sql($table, $fields, $params, $use_fulltext);
}
$query = $params['query'];
// add the table prefix to the fields
foreach ($fields as $i => ... | [
"public",
"static",
"function",
"getFieldSearchWhereClause",
"(",
"$",
"table",
",",
"$",
"fields",
",",
"$",
"params",
",",
"$",
"use_fulltext",
"=",
"TRUE",
")",
"{",
"if",
"(",
"is_callable",
"(",
"'search_get_where_sql'",
")",
")",
"{",
"return",
"search... | Returns a where clause for a search query.
@see search_get_where_sql
@param str $table Prefix for table to search on
@param array $fields Fields to match against
@param array $params Original search params
@param bool $use_fulltext Use fulltext search
@return str | [
"Returns",
"a",
"where",
"clause",
"for",
"a",
"search",
"query",
"."
] | 6d93d609972d9e4c7aa7b99ba12bddcf5466444a | https://github.com/hypeJunction/hypeLists/blob/6d93d609972d9e4c7aa7b99ba12bddcf5466444a/classes/hypeJunction/Lists/EntityList.php#L394-L447 |
230,325 | hypeJunction/hypeLists | classes/hypeJunction/Lists/EntityList.php | EntityList.getBaseURL | public function getBaseURL() {
$options = $this->getOptions();
$base_url = elgg_extract('base_url', $options);
$offset_key = elgg_extract('offset_key', $options, 'offset');
if (!$base_url) {
$base_url = current_page_url();
}
$base_url = elgg_http_remove_url_query_element($base_url, 'query');
$base_ur... | php | public function getBaseURL() {
$options = $this->getOptions();
$base_url = elgg_extract('base_url', $options);
$offset_key = elgg_extract('offset_key', $options, 'offset');
if (!$base_url) {
$base_url = current_page_url();
}
$base_url = elgg_http_remove_url_query_element($base_url, 'query');
$base_ur... | [
"public",
"function",
"getBaseURL",
"(",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getOptions",
"(",
")",
";",
"$",
"base_url",
"=",
"elgg_extract",
"(",
"'base_url'",
",",
"$",
"options",
")",
";",
"$",
"offset_key",
"=",
"elgg_extract",
"(",
... | Returns base URL of the list
@return string | [
"Returns",
"base",
"URL",
"of",
"the",
"list"
] | 6d93d609972d9e4c7aa7b99ba12bddcf5466444a | https://github.com/hypeJunction/hypeLists/blob/6d93d609972d9e4c7aa7b99ba12bddcf5466444a/classes/hypeJunction/Lists/EntityList.php#L453-L468 |
230,326 | hypeJunction/hypeLists | classes/hypeJunction/Lists/EntityList.php | EntityList.getId | public function getId() {
$options = $this->getOptions();
$id = elgg_extract('list_id', $options);
if (!$id) {
$id = md5($this->getBaseURL());
}
return $id;
} | php | public function getId() {
$options = $this->getOptions();
$id = elgg_extract('list_id', $options);
if (!$id) {
$id = md5($this->getBaseURL());
}
return $id;
} | [
"public",
"function",
"getId",
"(",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getOptions",
"(",
")",
";",
"$",
"id",
"=",
"elgg_extract",
"(",
"'list_id'",
",",
"$",
"options",
")",
";",
"if",
"(",
"!",
"$",
"id",
")",
"{",
"$",
"id",
... | Returns list id
@return string | [
"Returns",
"list",
"id"
] | 6d93d609972d9e4c7aa7b99ba12bddcf5466444a | https://github.com/hypeJunction/hypeLists/blob/6d93d609972d9e4c7aa7b99ba12bddcf5466444a/classes/hypeJunction/Lists/EntityList.php#L474-L481 |
230,327 | hypeJunction/hypeLists | classes/hypeJunction/Lists/EntityList.php | EntityList.render | public function render() {
$type = $this->getEntityType();
$options = $this->getOptions();
$options['base_url'] = $this->getBaseURL();
$options['list_id'] = $this->getId();
$list = elgg_list_entities($options, $this->getter);
$list = elgg_format_element('div', [
'class' => 'elgg-sortable-list-view',
... | php | public function render() {
$type = $this->getEntityType();
$options = $this->getOptions();
$options['base_url'] = $this->getBaseURL();
$options['list_id'] = $this->getId();
$list = elgg_list_entities($options, $this->getter);
$list = elgg_format_element('div', [
'class' => 'elgg-sortable-list-view',
... | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"getEntityType",
"(",
")",
";",
"$",
"options",
"=",
"$",
"this",
"->",
"getOptions",
"(",
")",
";",
"$",
"options",
"[",
"'base_url'",
"]",
"=",
"$",
"this",
"->",... | Render a list of items
@return string | [
"Render",
"a",
"list",
"of",
"items"
] | 6d93d609972d9e4c7aa7b99ba12bddcf5466444a | https://github.com/hypeJunction/hypeLists/blob/6d93d609972d9e4c7aa7b99ba12bddcf5466444a/classes/hypeJunction/Lists/EntityList.php#L487-L553 |
230,328 | wikimedia/mediawiki-extensions-Auth_remoteuser | src/UserNameSessionProvider.php | UserNameSessionProvider.mergeMetadata | public function mergeMetadata( array $savedMetadata, array $providedMetadata ) {
$keys = [
'userId',
'remoteUserName',
'filteredUserName',
'canonicalUserName',
'canonicalUserNameUsed'
];
foreach ( $keys as $key ) {
$savedMetadata[ $key ] = $providedMetadata[ $key ];
}
return parent::mergeMet... | php | public function mergeMetadata( array $savedMetadata, array $providedMetadata ) {
$keys = [
'userId',
'remoteUserName',
'filteredUserName',
'canonicalUserName',
'canonicalUserNameUsed'
];
foreach ( $keys as $key ) {
$savedMetadata[ $key ] = $providedMetadata[ $key ];
}
return parent::mergeMet... | [
"public",
"function",
"mergeMetadata",
"(",
"array",
"$",
"savedMetadata",
",",
"array",
"$",
"providedMetadata",
")",
"{",
"$",
"keys",
"=",
"[",
"'userId'",
",",
"'remoteUserName'",
",",
"'filteredUserName'",
",",
"'canonicalUserName'",
",",
"'canonicalUserNameUse... | Never use the stored metadata and return the provided one in any case.
But let our parents implementation of this method decide on his own for the
other members.
@since 2.0.0 | [
"Never",
"use",
"the",
"stored",
"metadata",
"and",
"return",
"the",
"provided",
"one",
"in",
"any",
"case",
"."
] | 1436b981d6ff721cb7e0072cf32779d56ce03f45 | https://github.com/wikimedia/mediawiki-extensions-Auth_remoteuser/blob/1436b981d6ff721cb7e0072cf32779d56ce03f45/src/UserNameSessionProvider.php#L446-L458 |
230,329 | wikimedia/mediawiki-extensions-Auth_remoteuser | src/UserNameSessionProvider.php | UserNameSessionProvider.persistSession | public function persistSession( SessionBackend $session, WebRequest $request ) {
$metadata = $session->getProviderMetadata();
$this->remoteToken = $metadata[ 'filteredUserName' ];
return parent::persistSession( $session, $request );
} | php | public function persistSession( SessionBackend $session, WebRequest $request ) {
$metadata = $session->getProviderMetadata();
$this->remoteToken = $metadata[ 'filteredUserName' ];
return parent::persistSession( $session, $request );
} | [
"public",
"function",
"persistSession",
"(",
"SessionBackend",
"$",
"session",
",",
"WebRequest",
"$",
"request",
")",
"{",
"$",
"metadata",
"=",
"$",
"session",
"->",
"getProviderMetadata",
"(",
")",
";",
"$",
"this",
"->",
"remoteToken",
"=",
"$",
"metadat... | Specify remote token.
@since 2.0.0 | [
"Specify",
"remote",
"token",
"."
] | 1436b981d6ff721cb7e0072cf32779d56ce03f45 | https://github.com/wikimedia/mediawiki-extensions-Auth_remoteuser/blob/1436b981d6ff721cb7e0072cf32779d56ce03f45/src/UserNameSessionProvider.php#L755-L759 |
230,330 | naneau/semver | src/Naneau/SemVer/Sort.php | Sort.sort | public static function sort()
{
$arguments = func_get_args();
if (count($arguments) === 0) {
return array();
}
// Versions array
$versions = array();
// If the first argument is an array, use that
if (is_array($arguments[0])) {
$vers... | php | public static function sort()
{
$arguments = func_get_args();
if (count($arguments) === 0) {
return array();
}
// Versions array
$versions = array();
// If the first argument is an array, use that
if (is_array($arguments[0])) {
$vers... | [
"public",
"static",
"function",
"sort",
"(",
")",
"{",
"$",
"arguments",
"=",
"func_get_args",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"arguments",
")",
"===",
"0",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"// Versions array",
"$",
"vers... | Sort a set of SemVer versions
This method is a catch-all and accepts:
- A single array of strings or Versions
- A variable number of strings and Versions
Strings will be parsed into Version instances
The result will be a sorted array of Versions, in ascending order
@param array|string|Version $v1
@param string|V... | [
"Sort",
"a",
"set",
"of",
"SemVer",
"versions"
] | c771ad1e6c89064c0a4fa714979639dc3649d6c8 | https://github.com/naneau/semver/blob/c771ad1e6c89064c0a4fa714979639dc3649d6c8/src/Naneau/SemVer/Sort.php#L44-L77 |
230,331 | naneau/semver | src/Naneau/SemVer/Sort.php | Sort.sortArray | public static function sortArray(array $versions)
{
// Empty array does not needs sorting
if (count($versions) === 0) {
return array();
}
// Array of one item (pivot) from the middle
$pivotArray = array_splice(
$versions,
(int) floor((coun... | php | public static function sortArray(array $versions)
{
// Empty array does not needs sorting
if (count($versions) === 0) {
return array();
}
// Array of one item (pivot) from the middle
$pivotArray = array_splice(
$versions,
(int) floor((coun... | [
"public",
"static",
"function",
"sortArray",
"(",
"array",
"$",
"versions",
")",
"{",
"// Empty array does not needs sorting",
"if",
"(",
"count",
"(",
"$",
"versions",
")",
"===",
"0",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"// Array of one item (pi... | Sort an array of Versions
unlike sort() this method accepts only an array of Version instances
This method uses QuickSort for the actual sorting
@param array[int]Version
@return array[int]Version | [
"Sort",
"an",
"array",
"of",
"Versions"
] | c771ad1e6c89064c0a4fa714979639dc3649d6c8 | https://github.com/naneau/semver/blob/c771ad1e6c89064c0a4fa714979639dc3649d6c8/src/Naneau/SemVer/Sort.php#L89-L122 |
230,332 | addiks/phpsql | src/Addiks/PHPSQL/Index/BTreeNodePage.php | BTreeNodePage.getLastReference | public function getLastReference()
{
return substr($this->data, $this->forkRate * $this->keyLength*3, $this->keyLength);
} | php | public function getLastReference()
{
return substr($this->data, $this->forkRate * $this->keyLength*3, $this->keyLength);
} | [
"public",
"function",
"getLastReference",
"(",
")",
"{",
"return",
"substr",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"this",
"->",
"forkRate",
"*",
"$",
"this",
"->",
"keyLength",
"*",
"3",
",",
"$",
"this",
"->",
"keyLength",
")",
";",
"}"
] | When not in 'leaf-mode', all references get used when search-value
is lower then corresponding reference-value.
This leaves the case open that the search-value is bigger then all reference-values.
In that case, this extra reference is used. | [
"When",
"not",
"in",
"leaf",
"-",
"mode",
"all",
"references",
"get",
"used",
"when",
"search",
"-",
"value",
"is",
"lower",
"then",
"corresponding",
"reference",
"-",
"value",
".",
"This",
"leaves",
"the",
"case",
"open",
"that",
"the",
"search",
"-",
"... | 28dae64ffc2123f39f801a50ab53bfe29890cbd9 | https://github.com/addiks/phpsql/blob/28dae64ffc2123f39f801a50ab53bfe29890cbd9/src/Addiks/PHPSQL/Index/BTreeNodePage.php#L183-L186 |
230,333 | naneau/semver | src/Naneau/SemVer/Parser/Versionable.php | Versionable.parse | public static function parse($string, $className)
{
// Sanity check
if (substr_count($string, '.') !== 2) {
throw new InvalidArgumentException(
'part "' . $string . '" can not be parsed into a SemVer'
. ' major.minor.patch version'
);
}... | php | public static function parse($string, $className)
{
// Sanity check
if (substr_count($string, '.') !== 2) {
throw new InvalidArgumentException(
'part "' . $string . '" can not be parsed into a SemVer'
. ' major.minor.patch version'
);
}... | [
"public",
"static",
"function",
"parse",
"(",
"$",
"string",
",",
"$",
"className",
")",
"{",
"// Sanity check",
"if",
"(",
"substr_count",
"(",
"$",
"string",
",",
"'.'",
")",
"!==",
"2",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'part \... | Parse a string into Versionable properties
@throws InvalidArgumentException
@param string $string
@param string $className
@return VersionableVersion | [
"Parse",
"a",
"string",
"into",
"Versionable",
"properties"
] | c771ad1e6c89064c0a4fa714979639dc3649d6c8 | https://github.com/naneau/semver/blob/c771ad1e6c89064c0a4fa714979639dc3649d6c8/src/Naneau/SemVer/Parser/Versionable.php#L36-L66 |
230,334 | Webiny/Framework | src/Webiny/Component/Config/Bridge/Yaml/SymfonyYaml/SymfonyYaml.php | SymfonyYaml.parseResource | private function parseResource()
{
if ($this->isArray($this->resource)) {
return StdObjectWrapper::toArray($this->resource);
} elseif ($this->isString($this->resource)) {
return Yaml::parse($this->resource);
} elseif ($this->isInstanceOf($this->resource, ConfigObject:... | php | private function parseResource()
{
if ($this->isArray($this->resource)) {
return StdObjectWrapper::toArray($this->resource);
} elseif ($this->isString($this->resource)) {
return Yaml::parse($this->resource);
} elseif ($this->isInstanceOf($this->resource, ConfigObject:... | [
"private",
"function",
"parseResource",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isArray",
"(",
"$",
"this",
"->",
"resource",
")",
")",
"{",
"return",
"StdObjectWrapper",
"::",
"toArray",
"(",
"$",
"this",
"->",
"resource",
")",
";",
"}",
"elseif... | Parse given Yaml resource and build array
@throws SymfonyYamlException
@return array | [
"Parse",
"given",
"Yaml",
"resource",
"and",
"build",
"array"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Config/Bridge/Yaml/SymfonyYaml/SymfonyYaml.php#L73-L84 |
230,335 | Webiny/Framework | src/Webiny/Component/Security/User/AbstractUser.php | AbstractUser.populate | public function populate($username, $password, array $roles, $isAuthenticated = false)
{
// store general data
$this->username = $username;
$this->password = $password;
$this->isAuthenticated = $isAuthenticated;
$this->roles = $this->arr([]);
foreach ($roles as $r) {... | php | public function populate($username, $password, array $roles, $isAuthenticated = false)
{
// store general data
$this->username = $username;
$this->password = $password;
$this->isAuthenticated = $isAuthenticated;
$this->roles = $this->arr([]);
foreach ($roles as $r) {... | [
"public",
"function",
"populate",
"(",
"$",
"username",
",",
"$",
"password",
",",
"array",
"$",
"roles",
",",
"$",
"isAuthenticated",
"=",
"false",
")",
"{",
"// store general data",
"$",
"this",
"->",
"username",
"=",
"$",
"username",
";",
"$",
"this",
... | Populate the user object.
@param string $username Username.
@param string $password Hashed password.
@param array $roles Array of the assigned roles.
@param bool $isAuthenticated Boolean flag that tells us if user is already authenticated or not. | [
"Populate",
"the",
"user",
"object",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Security/User/AbstractUser.php#L76-L94 |
230,336 | Webiny/Framework | src/Webiny/Component/Security/User/AbstractUser.php | AbstractUser.hasRole | public function hasRole($role)
{
foreach ($this->roles as $roleObj) {
if($role == $roleObj->getRole()){
return true;
}
}
return false;
} | php | public function hasRole($role)
{
foreach ($this->roles as $roleObj) {
if($role == $roleObj->getRole()){
return true;
}
}
return false;
} | [
"public",
"function",
"hasRole",
"(",
"$",
"role",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"roles",
"as",
"$",
"roleObj",
")",
"{",
"if",
"(",
"$",
"role",
"==",
"$",
"roleObj",
"->",
"getRole",
"(",
")",
")",
"{",
"return",
"true",
";",
"}"... | Check if current user has the defined role.
@param string $role Role name
@return bool True if user has the role, otherwise false. | [
"Check",
"if",
"current",
"user",
"has",
"the",
"defined",
"role",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Security/User/AbstractUser.php#L128-L136 |
230,337 | Webiny/Framework | src/Webiny/Component/Http/Request/Files/File.php | File.store | public function store($folder, $filename = null)
{
// check for errors
if ($this->getError() == UPLOAD_ERR_OK) {
throw new FilesException('Unable to move the file because an upload error occurred.');
}
// validate filename
$filename = isset($filename) ? $filename... | php | public function store($folder, $filename = null)
{
// check for errors
if ($this->getError() == UPLOAD_ERR_OK) {
throw new FilesException('Unable to move the file because an upload error occurred.');
}
// validate filename
$filename = isset($filename) ? $filename... | [
"public",
"function",
"store",
"(",
"$",
"folder",
",",
"$",
"filename",
"=",
"null",
")",
"{",
"// check for errors",
"if",
"(",
"$",
"this",
"->",
"getError",
"(",
")",
"==",
"UPLOAD_ERR_OK",
")",
"{",
"throw",
"new",
"FilesException",
"(",
"'Unable to m... | Store the uploaded file to a designated destination.
@param string $folder Folder under which the file will be saved.
@param null|string $filename If you wish to store the file under a different name, other than the original uploaded name.
@return bool True if file was successfully saved in the designated dest... | [
"Store",
"the",
"uploaded",
"file",
"to",
"a",
"designated",
"destination",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Http/Request/Files/File.php#L107-L144 |
230,338 | alexandresalome/php-webdriver | src/WebDriver/Browser.php | Browser.execute | public function execute($javascript, array $args = array())
{
$response = $this->request('POST', 'execute', json_encode(array(
'script' => $javascript,
'args' => $args
)));
$data = json_decode($response->getContent(), true);
return $data['value'];
} | php | public function execute($javascript, array $args = array())
{
$response = $this->request('POST', 'execute', json_encode(array(
'script' => $javascript,
'args' => $args
)));
$data = json_decode($response->getContent(), true);
return $data['value'];
} | [
"public",
"function",
"execute",
"(",
"$",
"javascript",
",",
"array",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"request",
"(",
"'POST'",
",",
"'execute'",
",",
"json_encode",
"(",
"array",
"(",
"'script'"... | Run a Javascript snippet on browser.
@param string $javascript The javascript snippet to execute
@param array $args Arguments to pass to snippet (accessible by arguments[0], ...)
@return mixed Result of javascript execution | [
"Run",
"a",
"Javascript",
"snippet",
"on",
"browser",
"."
] | ba187e7b13979e1db5001b7bfbe82d07c8e2e39d | https://github.com/alexandresalome/php-webdriver/blob/ba187e7b13979e1db5001b7bfbe82d07c8e2e39d/src/WebDriver/Browser.php#L176-L186 |
230,339 | alexandresalome/php-webdriver | src/WebDriver/Browser.php | Browser.moveTo | public function moveTo($x, $y, Element $element = null)
{
$this->request('POST', 'moveto', json_encode(array(
'element' => $element ? $element->getId() : null,
'xoffset' => $x,
'yoffset' => $y
)));
return $this;
} | php | public function moveTo($x, $y, Element $element = null)
{
$this->request('POST', 'moveto', json_encode(array(
'element' => $element ? $element->getId() : null,
'xoffset' => $x,
'yoffset' => $y
)));
return $this;
} | [
"public",
"function",
"moveTo",
"(",
"$",
"x",
",",
"$",
"y",
",",
"Element",
"$",
"element",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"request",
"(",
"'POST'",
",",
"'moveto'",
",",
"json_encode",
"(",
"array",
"(",
"'element'",
"=>",
"$",
"element... | Moves the mouse to a given position.
@param int $x X offset
@param int $y Y offset
@param Element $element Relative to an element
@return Browser | [
"Moves",
"the",
"mouse",
"to",
"a",
"given",
"position",
"."
] | ba187e7b13979e1db5001b7bfbe82d07c8e2e39d | https://github.com/alexandresalome/php-webdriver/blob/ba187e7b13979e1db5001b7bfbe82d07c8e2e39d/src/WebDriver/Browser.php#L226-L235 |
230,340 | alexandresalome/php-webdriver | src/WebDriver/Browser.php | Browser.close | public function close()
{
if (null === $this->sessionId) {
return;
}
$this->client->closeBrowser($this->getSessionId());
$this->sessionId = null;
return $this;
} | php | public function close()
{
if (null === $this->sessionId) {
return;
}
$this->client->closeBrowser($this->getSessionId());
$this->sessionId = null;
return $this;
} | [
"public",
"function",
"close",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"sessionId",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"client",
"->",
"closeBrowser",
"(",
"$",
"this",
"->",
"getSessionId",
"(",
")",
")",
";",
"$"... | Closes the session and disable this session.
@return Browser fluid interface | [
"Closes",
"the",
"session",
"and",
"disable",
"this",
"session",
"."
] | ba187e7b13979e1db5001b7bfbe82d07c8e2e39d | https://github.com/alexandresalome/php-webdriver/blob/ba187e7b13979e1db5001b7bfbe82d07c8e2e39d/src/WebDriver/Browser.php#L288-L298 |
230,341 | alexandresalome/php-webdriver | src/WebDriver/Browser.php | Browser.request | public function request($verb, $path, $content = null, array $headers = array())
{
return $this->client->request($verb, sprintf('/session/%s/%s', $this->sessionId, $path), $content, $headers);
} | php | public function request($verb, $path, $content = null, array $headers = array())
{
return $this->client->request($verb, sprintf('/session/%s/%s', $this->sessionId, $path), $content, $headers);
} | [
"public",
"function",
"request",
"(",
"$",
"verb",
",",
"$",
"path",
",",
"$",
"content",
"=",
"null",
",",
"array",
"$",
"headers",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"client",
"->",
"request",
"(",
"$",
"verb",
",",
... | Ease requesting in session directory.
@return Response | [
"Ease",
"requesting",
"in",
"session",
"directory",
"."
] | ba187e7b13979e1db5001b7bfbe82d07c8e2e39d | https://github.com/alexandresalome/php-webdriver/blob/ba187e7b13979e1db5001b7bfbe82d07c8e2e39d/src/WebDriver/Browser.php#L475-L478 |
230,342 | alexandresalome/php-webdriver | src/WebDriver/Browser.php | Browser.requestValue | public function requestValue($name)
{
$response = $this->client->request('GET', sprintf('/session/%s/%s', $this->sessionId, $name));
$content = json_decode($response->getContent(), true);
if (!isset($content['value'])) {
throw new LibraryException('Malformed response: expected a... | php | public function requestValue($name)
{
$response = $this->client->request('GET', sprintf('/session/%s/%s', $this->sessionId, $name));
$content = json_decode($response->getContent(), true);
if (!isset($content['value'])) {
throw new LibraryException('Malformed response: expected a... | [
"public",
"function",
"requestValue",
"(",
"$",
"name",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"request",
"(",
"'GET'",
",",
"sprintf",
"(",
"'/session/%s/%s'",
",",
"$",
"this",
"->",
"sessionId",
",",
"$",
"name",
")",
")"... | Internal method to get a scalar value from server.
@return mixed | [
"Internal",
"method",
"to",
"get",
"a",
"scalar",
"value",
"from",
"server",
"."
] | ba187e7b13979e1db5001b7bfbe82d07c8e2e39d | https://github.com/alexandresalome/php-webdriver/blob/ba187e7b13979e1db5001b7bfbe82d07c8e2e39d/src/WebDriver/Browser.php#L485-L495 |
230,343 | Webiny/Framework | src/Webiny/Component/Rest/Parser/Parser.php | Parser.parseApi | public function parseApi($class, $normalize)
{
$versions = $this->getVersions($class);
$parsedApi = new ParsedApi($class);
foreach ($versions['versions'] as $v => $versionClass) {
$classParser = new ClassParser($versionClass, $normalize);
$parsedApi->addVersion($clas... | php | public function parseApi($class, $normalize)
{
$versions = $this->getVersions($class);
$parsedApi = new ParsedApi($class);
foreach ($versions['versions'] as $v => $versionClass) {
$classParser = new ClassParser($versionClass, $normalize);
$parsedApi->addVersion($clas... | [
"public",
"function",
"parseApi",
"(",
"$",
"class",
",",
"$",
"normalize",
")",
"{",
"$",
"versions",
"=",
"$",
"this",
"->",
"getVersions",
"(",
"$",
"class",
")",
";",
"$",
"parsedApi",
"=",
"new",
"ParsedApi",
"(",
"$",
"class",
")",
";",
"foreac... | Parses the api class and all its versions.
@param string $class Fully qualified name of the api class.
@param bool $normalize Should the class name and the method name be normalized.
@return ParsedApi | [
"Parses",
"the",
"api",
"class",
"and",
"all",
"its",
"versions",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Parser/Parser.php#L27-L41 |
230,344 | Webiny/Framework | src/Webiny/Component/Entity/Attribute/Many2OneAttribute.php | Many2OneAttribute.getDbValue | public function getDbValue()
{
$value = $this->getValue();
if (is_null($value)) {
// Process default value
$value = $this->getDefaultValue();
if ($this->isInstanceOf($value, AbstractEntity::class)) {
if (!$value->exists()) {
$va... | php | public function getDbValue()
{
$value = $this->getValue();
if (is_null($value)) {
// Process default value
$value = $this->getDefaultValue();
if ($this->isInstanceOf($value, AbstractEntity::class)) {
if (!$value->exists()) {
$va... | [
"public",
"function",
"getDbValue",
"(",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getValue",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"// Process default value",
"$",
"value",
"=",
"$",
"this",
"->",
"getDefaultVal... | Get value that will be stored to database
@return string | [
"Get",
"value",
"that",
"will",
"be",
"stored",
"to",
"database"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Entity/Attribute/Many2OneAttribute.php#L109-L132 |
230,345 | alexandresalome/php-webdriver | src/WebDriver/WindowList.php | WindowList.setSize | public function setSize($width, $height, $name = null)
{
if (null === $name) {
$name = 'current';
}
$this->browser->request('POST', 'window/'.urlencode($name).'/size', json_encode(array('width' => $width, 'height' => $height)));
return $this;
} | php | public function setSize($width, $height, $name = null)
{
if (null === $name) {
$name = 'current';
}
$this->browser->request('POST', 'window/'.urlencode($name).'/size', json_encode(array('width' => $width, 'height' => $height)));
return $this;
} | [
"public",
"function",
"setSize",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"'current'",
";",
"}",
"$",
"this",
"->",
"browser",
"->",
"reques... | Changes a window size.
@return WindowList | [
"Changes",
"a",
"window",
"size",
"."
] | ba187e7b13979e1db5001b7bfbe82d07c8e2e39d | https://github.com/alexandresalome/php-webdriver/blob/ba187e7b13979e1db5001b7bfbe82d07c8e2e39d/src/WebDriver/WindowList.php#L92-L101 |
230,346 | alexandresalome/php-webdriver | src/WebDriver/WindowList.php | WindowList.setPosition | public function setPosition($x, $y, $name = 'current')
{
if (null === $name) {
$name = 'current';
}
$this->browser->request('POST', 'window/'.urlencode($name).'/position', json_encode(array('x' => $x, 'y' => $y)));
return $this;
} | php | public function setPosition($x, $y, $name = 'current')
{
if (null === $name) {
$name = 'current';
}
$this->browser->request('POST', 'window/'.urlencode($name).'/position', json_encode(array('x' => $x, 'y' => $y)));
return $this;
} | [
"public",
"function",
"setPosition",
"(",
"$",
"x",
",",
"$",
"y",
",",
"$",
"name",
"=",
"'current'",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"'current'",
";",
"}",
"$",
"this",
"->",
"browser",
"->",
"reques... | Changes a window position.
@return WindowList | [
"Changes",
"a",
"window",
"position",
"."
] | ba187e7b13979e1db5001b7bfbe82d07c8e2e39d | https://github.com/alexandresalome/php-webdriver/blob/ba187e7b13979e1db5001b7bfbe82d07c8e2e39d/src/WebDriver/WindowList.php#L121-L130 |
230,347 | alexandresalome/php-webdriver | src/WebDriver/WindowList.php | WindowList.maximize | public function maximize($name = 'current')
{
if (null === $name) {
$name = 'current';
}
$this->browser->request('POST', 'window/'.urlencode($name).'/maximize');
return $this;
} | php | public function maximize($name = 'current')
{
if (null === $name) {
$name = 'current';
}
$this->browser->request('POST', 'window/'.urlencode($name).'/maximize');
return $this;
} | [
"public",
"function",
"maximize",
"(",
"$",
"name",
"=",
"'current'",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"'current'",
";",
"}",
"$",
"this",
"->",
"browser",
"->",
"request",
"(",
"'POST'",
",",
"'window/'",
... | Maximizes a window.
@return WindowList | [
"Maximizes",
"a",
"window",
"."
] | ba187e7b13979e1db5001b7bfbe82d07c8e2e39d | https://github.com/alexandresalome/php-webdriver/blob/ba187e7b13979e1db5001b7bfbe82d07c8e2e39d/src/WebDriver/WindowList.php#L137-L146 |
230,348 | addiks/phpsql | src/Addiks/PHPSQL/Value/Database/Dsn/MySQLDsn.php | MySQLDsn.getAsAssociative | protected function getAsAssociative()
{
$value = $this->getValue();
$value = explode(":", $value);
$value = $value[1];
$value = explode(";", $value);
$values = array();
foreach ($value as $value) {
$value = explode("=", $value);
... | php | protected function getAsAssociative()
{
$value = $this->getValue();
$value = explode(":", $value);
$value = $value[1];
$value = explode(";", $value);
$values = array();
foreach ($value as $value) {
$value = explode("=", $value);
... | [
"protected",
"function",
"getAsAssociative",
"(",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getValue",
"(",
")",
";",
"$",
"value",
"=",
"explode",
"(",
"\":\"",
",",
"$",
"value",
")",
";",
"$",
"value",
"=",
"$",
"value",
"[",
"1",
"]",
... | Gets the parts of the DSN as an associative array.
@see Value::getValue()
@return array | [
"Gets",
"the",
"parts",
"of",
"the",
"DSN",
"as",
"an",
"associative",
"array",
"."
] | 28dae64ffc2123f39f801a50ab53bfe29890cbd9 | https://github.com/addiks/phpsql/blob/28dae64ffc2123f39f801a50ab53bfe29890cbd9/src/Addiks/PHPSQL/Value/Database/Dsn/MySQLDsn.php#L40-L60 |
230,349 | Webiny/Framework | src/Webiny/Component/Security/User/Providers/Memory/Memory.php | Memory.addUsers | private function addUsers($users)
{
if (!is_array($users)) {
return false;
}
foreach ($users as $username => $data) {
if ($username == '' || !$this->isString($username)) {
throw new MemoryException('Cannot store a user that doesn\'t have a username.')... | php | private function addUsers($users)
{
if (!is_array($users)) {
return false;
}
foreach ($users as $username => $data) {
if ($username == '' || !$this->isString($username)) {
throw new MemoryException('Cannot store a user that doesn\'t have a username.')... | [
"private",
"function",
"addUsers",
"(",
"$",
"users",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"users",
")",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"users",
"as",
"$",
"username",
"=>",
"$",
"data",
")",
"{",
"if",
"("... | Check user data and, if valid, store them.
@param array $users List of user accounts.
@return bool
@throws MemoryException | [
"Check",
"user",
"data",
"and",
"if",
"valid",
"store",
"them",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Security/User/Providers/Memory/Memory.php#L48-L73 |
230,350 | EdgedesignCZ/ares | Decorator/ProxyCurlDecorator.php | ProxyCurlDecorator.decorate | public function decorate($resource)
{
curl_setopt($resource, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt(
$resource,
CURLOPT_PROXY,
sprintf(
'%s:%s',
$this->proxyHost,
$this->proxyPort
)
);
i... | php | public function decorate($resource)
{
curl_setopt($resource, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt(
$resource,
CURLOPT_PROXY,
sprintf(
'%s:%s',
$this->proxyHost,
$this->proxyPort
)
);
i... | [
"public",
"function",
"decorate",
"(",
"$",
"resource",
")",
"{",
"curl_setopt",
"(",
"$",
"resource",
",",
"CURLOPT_FOLLOWLOCATION",
",",
"1",
")",
";",
"curl_setopt",
"(",
"$",
"resource",
",",
"CURLOPT_PROXY",
",",
"sprintf",
"(",
"'%s:%s'",
",",
"$",
"... | Sets up given cURL resource with desired parameters.
@param resource $resource | [
"Sets",
"up",
"given",
"cURL",
"resource",
"with",
"desired",
"parameters",
"."
] | ae0f50155571875d09ba969e7b062854c823b57d | https://github.com/EdgedesignCZ/ares/blob/ae0f50155571875d09ba969e7b062854c823b57d/Decorator/ProxyCurlDecorator.php#L41-L65 |
230,351 | Webiny/Framework | src/Webiny/Component/OAuth2/OAuth2User.php | OAuth2User.setGender | public function setGender($gender)
{
$gender = strtolower($gender);
if ($gender != '' && $gender != 'male' && $gender != 'female') {
throw new OAuth2Exception('Gender can be either "male" or "female", you tried to set it to "' . $gender . '".');
}
$this->gender = $gende... | php | public function setGender($gender)
{
$gender = strtolower($gender);
if ($gender != '' && $gender != 'male' && $gender != 'female') {
throw new OAuth2Exception('Gender can be either "male" or "female", you tried to set it to "' . $gender . '".');
}
$this->gender = $gende... | [
"public",
"function",
"setGender",
"(",
"$",
"gender",
")",
"{",
"$",
"gender",
"=",
"strtolower",
"(",
"$",
"gender",
")",
";",
"if",
"(",
"$",
"gender",
"!=",
"''",
"&&",
"$",
"gender",
"!=",
"'male'",
"&&",
"$",
"gender",
"!=",
"'female'",
")",
... | Set the gender of the user, can be 'male' or 'female'.
@param $gender
@throws OAuth2Exception | [
"Set",
"the",
"gender",
"of",
"the",
"user",
"can",
"be",
"male",
"or",
"female",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/OAuth2/OAuth2User.php#L220-L229 |
230,352 | Webiny/Framework | src/Webiny/Component/Router/Matcher/UrlMatcher.php | UrlMatcher.extractParameters | private function extractParameters($matches, CompiledRoute $compiledRoute)
{
$params = [];
foreach ($compiledRoute->getVariables() as $index => $var) {
$params[$var['name']] = $matches[($index + 1)][0];
}
return $params;
} | php | private function extractParameters($matches, CompiledRoute $compiledRoute)
{
$params = [];
foreach ($compiledRoute->getVariables() as $index => $var) {
$params[$var['name']] = $matches[($index + 1)][0];
}
return $params;
} | [
"private",
"function",
"extractParameters",
"(",
"$",
"matches",
",",
"CompiledRoute",
"$",
"compiledRoute",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"compiledRoute",
"->",
"getVariables",
"(",
")",
"as",
"$",
"index",
"=>",
"$",
... | Extracts and matches the parameters with their defined names.
@param $matches
@param CompiledRoute $compiledRoute
@return array | [
"Extracts",
"and",
"matches",
"the",
"parameters",
"with",
"their",
"defined",
"names",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Router/Matcher/UrlMatcher.php#L133-L141 |
230,353 | clue/php-socket-react | src/Stream/Factory.php | Factory.createClient | public function createClient($address)
{
$that = $this;
$factory = $this->rawFactory;
return $this->resolve($address)->then(function ($address) use ($factory, $that){
$deferred = new Deferred();
$socket = $factory->createFromString($address, $scheme);
if... | php | public function createClient($address)
{
$that = $this;
$factory = $this->rawFactory;
return $this->resolve($address)->then(function ($address) use ($factory, $that){
$deferred = new Deferred();
$socket = $factory->createFromString($address, $scheme);
if... | [
"public",
"function",
"createClient",
"(",
"$",
"address",
")",
"{",
"$",
"that",
"=",
"$",
"this",
";",
"$",
"factory",
"=",
"$",
"this",
"->",
"rawFactory",
";",
"return",
"$",
"this",
"->",
"resolve",
"(",
"$",
"address",
")",
"->",
"then",
"(",
... | create stream client socket connected to given address
@param string $address
@return PromiseInterface to return a \Sockets\Stream
@uses RawFactory::createFromString()
@uses RawSocket::setBlocking() to turn on non-blocking mode
@uses RawSocket::connect() to initiate async connection
@uses LoopInterface::addWriteStream... | [
"create",
"stream",
"client",
"socket",
"connected",
"to",
"given",
"address"
] | 420dcbc20e8b007a7df2a12373af94b0b70ec15e | https://github.com/clue/php-socket-react/blob/420dcbc20e8b007a7df2a12373af94b0b70ec15e/src/Stream/Factory.php#L36-L90 |
230,354 | clue/php-socket-react | src/Stream/Factory.php | Factory.createServer | public function createServer($address)
{
return $this->resolve($address)->then(function ($address) {
$server = new Server($this->getSocketLoop(), $this->rawFactory);
$server->listenAddress($address);
return $server;
});
} | php | public function createServer($address)
{
return $this->resolve($address)->then(function ($address) {
$server = new Server($this->getSocketLoop(), $this->rawFactory);
$server->listenAddress($address);
return $server;
});
} | [
"public",
"function",
"createServer",
"(",
"$",
"address",
")",
"{",
"return",
"$",
"this",
"->",
"resolve",
"(",
"$",
"address",
")",
"->",
"then",
"(",
"function",
"(",
"$",
"address",
")",
"{",
"$",
"server",
"=",
"new",
"Server",
"(",
"$",
"this"... | create stream server socket bound to and listening on the given address for incomming stream client connections
@param string $address
@return PromiseInterface to return a \Sockets\Server
@throws Exception on error
@uses Server::listenAddress() | [
"create",
"stream",
"server",
"socket",
"bound",
"to",
"and",
"listening",
"on",
"the",
"given",
"address",
"for",
"incomming",
"stream",
"client",
"connections"
] | 420dcbc20e8b007a7df2a12373af94b0b70ec15e | https://github.com/clue/php-socket-react/blob/420dcbc20e8b007a7df2a12373af94b0b70ec15e/src/Stream/Factory.php#L100-L108 |
230,355 | clue/php-socket-react | src/Stream/Factory.php | Factory.getSocketLoop | public function getSocketLoop()
{
if ($this->socketLoop === null) {
if ($this->loop instanceof StreamSelectLoop) {
$this->socketLoop = new SelectPoller($this->loop);
} else {
$this->socketLoop = $this->loop;
}
}
return $this... | php | public function getSocketLoop()
{
if ($this->socketLoop === null) {
if ($this->loop instanceof StreamSelectLoop) {
$this->socketLoop = new SelectPoller($this->loop);
} else {
$this->socketLoop = $this->loop;
}
}
return $this... | [
"public",
"function",
"getSocketLoop",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"socketLoop",
"===",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"loop",
"instanceof",
"StreamSelectLoop",
")",
"{",
"$",
"this",
"->",
"socketLoop",
"=",
"new",
"S... | return a loop interface that supports adding socket resources
@return LoopInterface | [
"return",
"a",
"loop",
"interface",
"that",
"supports",
"adding",
"socket",
"resources"
] | 420dcbc20e8b007a7df2a12373af94b0b70ec15e | https://github.com/clue/php-socket-react/blob/420dcbc20e8b007a7df2a12373af94b0b70ec15e/src/Stream/Factory.php#L115-L125 |
230,356 | deanblackborough/zf3-view-helpers | src/Bootstrap4Alert.php | Bootstrap4Alert.setHeading | public function setHeading(string $heading, int $heading_level = 4) : Bootstrap4Alert
{
$this->heading = $heading;
$this->heading_level = $heading_level;
return $this;
} | php | public function setHeading(string $heading, int $heading_level = 4) : Bootstrap4Alert
{
$this->heading = $heading;
$this->heading_level = $heading_level;
return $this;
} | [
"public",
"function",
"setHeading",
"(",
"string",
"$",
"heading",
",",
"int",
"$",
"heading_level",
"=",
"4",
")",
":",
"Bootstrap4Alert",
"{",
"$",
"this",
"->",
"heading",
"=",
"$",
"heading",
";",
"$",
"this",
"->",
"heading_level",
"=",
"$",
"headin... | Set an optional heading for the alert
@param string $heading
@param integer $heading_level Optional heading level, 1-7 defaults to 4
@return Bootstrap4Alert | [
"Set",
"an",
"optional",
"heading",
"for",
"the",
"alert"
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4Alert.php#L70-L76 |
230,357 | deanblackborough/zf3-view-helpers | src/Bootstrap4Alert.php | Bootstrap4Alert.classes | private function classes(): string
{
$classes = 'alert';
if ($this->bg_color !== null) {
$classes .= ' alert-' . $this->bg_color;
}
if ($this->text_color !== null) {
$classes .= ' text-' . $this->text_color;
}
return $classes;
} | php | private function classes(): string
{
$classes = 'alert';
if ($this->bg_color !== null) {
$classes .= ' alert-' . $this->bg_color;
}
if ($this->text_color !== null) {
$classes .= ' text-' . $this->text_color;
}
return $classes;
} | [
"private",
"function",
"classes",
"(",
")",
":",
"string",
"{",
"$",
"classes",
"=",
"'alert'",
";",
"if",
"(",
"$",
"this",
"->",
"bg_color",
"!==",
"null",
")",
"{",
"$",
"classes",
".=",
"' alert-'",
".",
"$",
"this",
"->",
"bg_color",
";",
"}",
... | Generate the classes for the alert component based on the set options
@return string | [
"Generate",
"the",
"classes",
"for",
"the",
"alert",
"component",
"based",
"on",
"the",
"set",
"options"
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4Alert.php#L116-L129 |
230,358 | Webiny/Framework | src/Webiny/Component/TwitterOAuth/Bridge/League/TwitterOAuth.php | TwitterOAuth.getUserDetails | public function getUserDetails()
{
$accessToken = $this->getAccessToken();
$tc = new TokenCredentials();
$tc->setIdentifier($accessToken['oauth_token']);
$tc->setSecret($accessToken['oauth_token_secret']);
$user = $this->instance->getUserDetails($tc);
$twUserObj = n... | php | public function getUserDetails()
{
$accessToken = $this->getAccessToken();
$tc = new TokenCredentials();
$tc->setIdentifier($accessToken['oauth_token']);
$tc->setSecret($accessToken['oauth_token_secret']);
$user = $this->instance->getUserDetails($tc);
$twUserObj = n... | [
"public",
"function",
"getUserDetails",
"(",
")",
"{",
"$",
"accessToken",
"=",
"$",
"this",
"->",
"getAccessToken",
"(",
")",
";",
"$",
"tc",
"=",
"new",
"TokenCredentials",
"(",
")",
";",
"$",
"tc",
"->",
"setIdentifier",
"(",
"$",
"accessToken",
"[",
... | Returns an instance of TwitterOAuthUser.
@return TwitterOAuthUser | [
"Returns",
"an",
"instance",
"of",
"TwitterOAuthUser",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/TwitterOAuth/Bridge/League/TwitterOAuth.php#L183-L202 |
230,359 | Webiny/Framework | src/Webiny/Component/TwitterOAuth/Bridge/League/TwitterOAuth.php | TwitterOAuth.get | public function get($url, array $headers = [], array $params = [])
{
return $this->instance->createHttpClient()->get($url, $headers, $params);
} | php | public function get($url, array $headers = [], array $params = [])
{
return $this->instance->createHttpClient()->get($url, $headers, $params);
} | [
"public",
"function",
"get",
"(",
"$",
"url",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"instance",
"->",
"createHttpClient",
"(",
")",
"->",
"get",
"(",
"$",
"... | Make a GET request to Twitter API.
@param string $url Api url.
@param array $headers Request headers.
@param array $params Additional parameters.
@return string|array Api response (if json) it will be returned as array. | [
"Make",
"a",
"GET",
"request",
"to",
"Twitter",
"API",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/TwitterOAuth/Bridge/League/TwitterOAuth.php#L213-L216 |
230,360 | Webiny/Framework | src/Webiny/Component/TwitterOAuth/Bridge/League/TwitterOAuth.php | TwitterOAuth.post | public function post($url, array $postBody, array $headers = [], array $params = [])
{
return $this->instance->createHttpClient()->post($url, $headers, $postBody, $params);
} | php | public function post($url, array $postBody, array $headers = [], array $params = [])
{
return $this->instance->createHttpClient()->post($url, $headers, $postBody, $params);
} | [
"public",
"function",
"post",
"(",
"$",
"url",
",",
"array",
"$",
"postBody",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"instance",
"->",
"createHttpClient",
"(",
... | Make a POST request to Twitter API.
@param string $url Api url.
@param array $postBody Post body.
@param array $headers Request headers.
@param array $params Additional parameters.
@return string|array Api response (if json) it will be returned as array. | [
"Make",
"a",
"POST",
"request",
"to",
"Twitter",
"API",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/TwitterOAuth/Bridge/League/TwitterOAuth.php#L228-L231 |
230,361 | Webiny/Framework | src/Webiny/Component/TwitterOAuth/Bridge/League/TwitterOAuth.php | TwitterOAuth.delete | public function delete($url, array $headers = [], array $params = [])
{
return $this->instance->createHttpClient()->delete($url, $headers, $params);
} | php | public function delete($url, array $headers = [], array $params = [])
{
return $this->instance->createHttpClient()->delete($url, $headers, $params);
} | [
"public",
"function",
"delete",
"(",
"$",
"url",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"instance",
"->",
"createHttpClient",
"(",
")",
"->",
"delete",
"(",
"$... | Make a DELETE request to Twitter API.
@param string $url Api url.
@param array $headers Request headers.
@param array $params Additional parameters.
@return string|array Api response (if json) it will be returned as array. | [
"Make",
"a",
"DELETE",
"request",
"to",
"Twitter",
"API",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/TwitterOAuth/Bridge/League/TwitterOAuth.php#L242-L245 |
230,362 | Webiny/Framework | src/Webiny/Component/Cache/Storage/SessionArray.php | SessionArray.save | public function save($key, $value, $ttl = 600, $tags = null)
{
$this->cache[md5($key)] = $value;
if (is_array($tags)) {
foreach ($tags as $t) {
$this->tags[$t][] = $key;
}
}
return true;
} | php | public function save($key, $value, $ttl = 600, $tags = null)
{
$this->cache[md5($key)] = $value;
if (is_array($tags)) {
foreach ($tags as $t) {
$this->tags[$t][] = $key;
}
}
return true;
} | [
"public",
"function",
"save",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"ttl",
"=",
"600",
",",
"$",
"tags",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"cache",
"[",
"md5",
"(",
"$",
"key",
")",
"]",
"=",
"$",
"value",
";",
"if",
"(",
"i... | Save a value into memory.
@param string $key Name of the key.
@param mixed $value Value you wish to save.
@param int $ttl For how long to store value. (in seconds)
@param array|string $tags Tags you wish to assign to this cache entry.
@return bool True if value was stored successfully, othe... | [
"Save",
"a",
"value",
"into",
"memory",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Cache/Storage/SessionArray.php#L62-L73 |
230,363 | Webiny/Framework | src/Webiny/Component/Cache/Storage/SessionArray.php | SessionArray.deleteByTags | public function deleteByTags($tag)
{
if (!isset($this->tags[$tag])) {
return false;
}
foreach ($this->tags[$tag] as $key) {
$this->delete($key);
}
return true;
} | php | public function deleteByTags($tag)
{
if (!isset($this->tags[$tag])) {
return false;
}
foreach ($this->tags[$tag] as $key) {
$this->delete($key);
}
return true;
} | [
"public",
"function",
"deleteByTags",
"(",
"$",
"tag",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"tags",
"[",
"$",
"tag",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"tags",
"[",
"$",
"ta... | Delete keys by tags.
@param array|string $tag Tag, or an array of tags, for which you wish to delete the cache.
@return boolean | [
"Delete",
"keys",
"by",
"tags",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Cache/Storage/SessionArray.php#L131-L142 |
230,364 | Webiny/Framework | src/Webiny/Component/TwitterOAuth/Bridge/TwitterOAuth.php | TwitterOAuth.getInstance | public static function getInstance($clientId, $clientSecret, $redirectUri)
{
$driver = static::getLibrary();
try {
$instance = new $driver($clientId, $clientSecret, $redirectUri);
} catch (\Exception $e) {
throw new TwitterOAuthException('Unable to create an instance... | php | public static function getInstance($clientId, $clientSecret, $redirectUri)
{
$driver = static::getLibrary();
try {
$instance = new $driver($clientId, $clientSecret, $redirectUri);
} catch (\Exception $e) {
throw new TwitterOAuthException('Unable to create an instance... | [
"public",
"static",
"function",
"getInstance",
"(",
"$",
"clientId",
",",
"$",
"clientSecret",
",",
"$",
"redirectUri",
")",
"{",
"$",
"driver",
"=",
"static",
"::",
"getLibrary",
"(",
")",
";",
"try",
"{",
"$",
"instance",
"=",
"new",
"$",
"driver",
"... | Create an instance of an TwitterOAuth driver.
@param string $clientId Client id.
@param string $clientSecret Client secret.
@param string $redirectUri Target url where to redirect after authentication.
@throws TwitterOAuthException
@return TwitterOAuthInterface | [
"Create",
"an",
"instance",
"of",
"an",
"TwitterOAuth",
"driver",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/TwitterOAuth/Bridge/TwitterOAuth.php#L59-L74 |
230,365 | takatost/wechat_open_platform | src/Server/Server.php | Server.serve | public function serve()
{
Log::debug('Request received:', [
'Method' => $this->request->getMethod(),
'URI' => $this->request->getRequestUri(),
'Query' => $this->request->getQueryString(),
'Protocal' => $this->request->server->get('SERVER_PROTOCOL'),
... | php | public function serve()
{
Log::debug('Request received:', [
'Method' => $this->request->getMethod(),
'URI' => $this->request->getRequestUri(),
'Query' => $this->request->getQueryString(),
'Protocal' => $this->request->server->get('SERVER_PROTOCOL'),
... | [
"public",
"function",
"serve",
"(",
")",
"{",
"Log",
"::",
"debug",
"(",
"'Request received:'",
",",
"[",
"'Method'",
"=>",
"$",
"this",
"->",
"request",
"->",
"getMethod",
"(",
")",
",",
"'URI'",
"=>",
"$",
"this",
"->",
"request",
"->",
"getRequestUri"... | Handle and return response.
@return Response
@throws BadRequestException | [
"Handle",
"and",
"return",
"response",
"."
] | e3173f529236f6203a0d8f85ee20f4486183a85e | https://github.com/takatost/wechat_open_platform/blob/e3173f529236f6203a0d8f85ee20f4486183a85e/src/Server/Server.php#L93-L110 |
230,366 | takatost/wechat_open_platform | src/Server/Server.php | Server.handleMessage | protected function handleMessage($message)
{
$handler = $this->messageHandler;
if (!is_callable($handler)) {
Log::debug('No handler enabled.');
return null;
}
Log::debug('Message detail:', $message->all());
$type = $this->messageTypeMapping[ $messa... | php | protected function handleMessage($message)
{
$handler = $this->messageHandler;
if (!is_callable($handler)) {
Log::debug('No handler enabled.');
return null;
}
Log::debug('Message detail:', $message->all());
$type = $this->messageTypeMapping[ $messa... | [
"protected",
"function",
"handleMessage",
"(",
"$",
"message",
")",
"{",
"$",
"handler",
"=",
"$",
"this",
"->",
"messageHandler",
";",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"handler",
")",
")",
"{",
"Log",
"::",
"debug",
"(",
"'No handler enabled.'",
... | Handle message.
@param Collection $message
@return mixed | [
"Handle",
"message",
"."
] | e3173f529236f6203a0d8f85ee20f4486183a85e | https://github.com/takatost/wechat_open_platform/blob/e3173f529236f6203a0d8f85ee20f4486183a85e/src/Server/Server.php#L154-L175 |
230,367 | themsaid/katana-core | src/Markdown.php | Markdown.parseWithYAML | public static function parseWithYAML($text)
{
$parser = new Parser();
$parsed = $parser->parse($text);
return [$parsed->getContent(), $parsed->getYAML()];
} | php | public static function parseWithYAML($text)
{
$parser = new Parser();
$parsed = $parser->parse($text);
return [$parsed->getContent(), $parsed->getYAML()];
} | [
"public",
"static",
"function",
"parseWithYAML",
"(",
"$",
"text",
")",
"{",
"$",
"parser",
"=",
"new",
"Parser",
"(",
")",
";",
"$",
"parsed",
"=",
"$",
"parser",
"->",
"parse",
"(",
"$",
"text",
")",
";",
"return",
"[",
"$",
"parsed",
"->",
"getC... | Parse markdown with YAML headers
This method returns an array of: content as the first member and
YAML values as the second member.
@param string $text
@return array | [
"Parse",
"markdown",
"with",
"YAML",
"headers"
] | 897c1adb6863d5145f1f104cbc8c9200cd98c3fb | https://github.com/themsaid/katana-core/blob/897c1adb6863d5145f1f104cbc8c9200cd98c3fb/src/Markdown.php#L35-L42 |
230,368 | themsaid/katana-core | src/Markdown.php | Markdown.cleanLeadingSpace | protected static function cleanLeadingSpace($text)
{
$i = 0;
while (! $firstLine = explode("\n", $text)[$i]) {
$i ++;
}
preg_match('/^( *)/', $firstLine, $matches);
return preg_replace('/^[ ]{'.strlen($matches[1]).'}/m', '', $text);
} | php | protected static function cleanLeadingSpace($text)
{
$i = 0;
while (! $firstLine = explode("\n", $text)[$i]) {
$i ++;
}
preg_match('/^( *)/', $firstLine, $matches);
return preg_replace('/^[ ]{'.strlen($matches[1]).'}/m', '', $text);
} | [
"protected",
"static",
"function",
"cleanLeadingSpace",
"(",
"$",
"text",
")",
"{",
"$",
"i",
"=",
"0",
";",
"while",
"(",
"!",
"$",
"firstLine",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"text",
")",
"[",
"$",
"i",
"]",
")",
"{",
"$",
"i",
"++",... | Remove initial leading space from each line
Since @markdown can be placed inside any HTML element, there might
be leading space due to code editor indentation, here we trim it
to avoid compiling the whole markdown block as a code block.
@param $text
@return string | [
"Remove",
"initial",
"leading",
"space",
"from",
"each",
"line"
] | 897c1adb6863d5145f1f104cbc8c9200cd98c3fb | https://github.com/themsaid/katana-core/blob/897c1adb6863d5145f1f104cbc8c9200cd98c3fb/src/Markdown.php#L55-L66 |
230,369 | alexandresalome/php-webdriver | src/WebDriver/Cookie.php | Cookie.fromArray | static public function fromArray(array $array)
{
$name = $array['name'];
$value = $array['value'];
$path = isset($array['path']) ? $array['path'] : null;
$domain = isset($array['domain']) ? $array['domain'] : null;
$isSecure = isset($array['secure']) ? $arra... | php | static public function fromArray(array $array)
{
$name = $array['name'];
$value = $array['value'];
$path = isset($array['path']) ? $array['path'] : null;
$domain = isset($array['domain']) ? $array['domain'] : null;
$isSecure = isset($array['secure']) ? $arra... | [
"static",
"public",
"function",
"fromArray",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"name",
"=",
"$",
"array",
"[",
"'name'",
"]",
";",
"$",
"value",
"=",
"$",
"array",
"[",
"'value'",
"]",
";",
"$",
"path",
"=",
"isset",
"(",
"$",
"array",
"... | Creates a Cookie from an array.
@param array $array the array to load from
@return Cookie a cookie object | [
"Creates",
"a",
"Cookie",
"from",
"an",
"array",
"."
] | ba187e7b13979e1db5001b7bfbe82d07c8e2e39d | https://github.com/alexandresalome/php-webdriver/blob/ba187e7b13979e1db5001b7bfbe82d07c8e2e39d/src/WebDriver/Cookie.php#L75-L89 |
230,370 | alexandresalome/php-webdriver | src/WebDriver/Cookie.php | Cookie.toArray | public function toArray()
{
return array(
'name' => $this->name,
'value' => $this->value,
'path' => $this->path,
'domain' => $this->domain,
'secure' => $this->isSecure,
'expiry' => null === $this->expiry ? null : $this->expiry->get... | php | public function toArray()
{
return array(
'name' => $this->name,
'value' => $this->value,
'path' => $this->path,
'domain' => $this->domain,
'secure' => $this->isSecure,
'expiry' => null === $this->expiry ? null : $this->expiry->get... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"return",
"array",
"(",
"'name'",
"=>",
"$",
"this",
"->",
"name",
",",
"'value'",
"=>",
"$",
"this",
"->",
"value",
",",
"'path'",
"=>",
"$",
"this",
"->",
"path",
",",
"'domain'",
"=>",
"$",
"this",
... | Converts the cookie to an array.
@return array | [
"Converts",
"the",
"cookie",
"to",
"an",
"array",
"."
] | ba187e7b13979e1db5001b7bfbe82d07c8e2e39d | https://github.com/alexandresalome/php-webdriver/blob/ba187e7b13979e1db5001b7bfbe82d07c8e2e39d/src/WebDriver/Cookie.php#L96-L106 |
230,371 | Webiny/Framework | src/Webiny/Component/Rest/Parser/ClassParser.php | ClassParser.parseClass | private function parseClass()
{
// check which interfaces are implemented
$interfaces = [];
foreach ($this->parentClasses as $pc) {
$interfaces = array_merge($interfaces,
$pc->getInterfaceNames()); // returns only the interfaces that the current class implements
... | php | private function parseClass()
{
// check which interfaces are implemented
$interfaces = [];
foreach ($this->parentClasses as $pc) {
$interfaces = array_merge($interfaces,
$pc->getInterfaceNames()); // returns only the interfaces that the current class implements
... | [
"private",
"function",
"parseClass",
"(",
")",
"{",
"// check which interfaces are implemented",
"$",
"interfaces",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"parentClasses",
"as",
"$",
"pc",
")",
"{",
"$",
"interfaces",
"=",
"array_merge",
"(",
... | Internal method that does the actual parsing of class properties. | [
"Internal",
"method",
"that",
"does",
"the",
"actual",
"parsing",
"of",
"class",
"properties",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Parser/ClassParser.php#L96-L115 |
230,372 | Webiny/Framework | src/Webiny/Component/Rest/Parser/ClassParser.php | ClassParser.parseMethods | private function parseMethods()
{
$methods = $this->reflectionClass->getMethods(); // this still returns the methods for all parent classes
if (!is_array($methods) || count($methods) < 1) {
throw new RestException('Parser: The class "' . $this->class . '" doesn\'t have any methods define... | php | private function parseMethods()
{
$methods = $this->reflectionClass->getMethods(); // this still returns the methods for all parent classes
if (!is_array($methods) || count($methods) < 1) {
throw new RestException('Parser: The class "' . $this->class . '" doesn\'t have any methods define... | [
"private",
"function",
"parseMethods",
"(",
")",
"{",
"$",
"methods",
"=",
"$",
"this",
"->",
"reflectionClass",
"->",
"getMethods",
"(",
")",
";",
"// this still returns the methods for all parent classes",
"if",
"(",
"!",
"is_array",
"(",
"$",
"methods",
")",
... | Parsed the class methods and assigns them to the ParsedClass instance.
@throws RestException | [
"Parsed",
"the",
"class",
"methods",
"and",
"assigns",
"them",
"to",
"the",
"ParsedClass",
"instance",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Parser/ClassParser.php#L122-L138 |
230,373 | Webiny/Framework | src/Webiny/Component/Logger/LoggerTrait.php | LoggerTrait.logger | public static function logger($name = 'Webiny')
{
try {
return ServiceManager::getInstance()->getService('Logger.' . $name);
} catch (ServiceManagerException $e) {
if ($e->getCode() == ServiceManagerException::SERVICE_DEFINITION_NOT_FOUND) {
return new Logger(... | php | public static function logger($name = 'Webiny')
{
try {
return ServiceManager::getInstance()->getService('Logger.' . $name);
} catch (ServiceManagerException $e) {
if ($e->getCode() == ServiceManagerException::SERVICE_DEFINITION_NOT_FOUND) {
return new Logger(... | [
"public",
"static",
"function",
"logger",
"(",
"$",
"name",
"=",
"'Webiny'",
")",
"{",
"try",
"{",
"return",
"ServiceManager",
"::",
"getInstance",
"(",
")",
"->",
"getService",
"(",
"'Logger.'",
".",
"$",
"name",
")",
";",
"}",
"catch",
"(",
"ServiceMan... | Get logger.
Just provide the logger name without the 'logger.' prefix.
The name must match the name of your service.
@param string $name Logger service name.
@return LoggerDriverInterface
@throws ServiceManagerException | [
"Get",
"logger",
".",
"Just",
"provide",
"the",
"logger",
"name",
"without",
"the",
"logger",
".",
"prefix",
".",
"The",
"name",
"must",
"match",
"the",
"name",
"of",
"your",
"service",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Logger/LoggerTrait.php#L33-L45 |
230,374 | Webiny/Framework | src/Webiny/Component/Bootstrap/Dispatcher.php | Dispatcher.mvcDispatcher | public static function mvcDispatcher($module, $controller, $action, $params)
{
$dispatcher = new self;
$dispatcher->setModule($module);
$dispatcher->setController($controller);
$dispatcher->setAction($action);
$dispatcher->setParams($params);
// get current applicati... | php | public static function mvcDispatcher($module, $controller, $action, $params)
{
$dispatcher = new self;
$dispatcher->setModule($module);
$dispatcher->setController($controller);
$dispatcher->setAction($action);
$dispatcher->setParams($params);
// get current applicati... | [
"public",
"static",
"function",
"mvcDispatcher",
"(",
"$",
"module",
",",
"$",
"controller",
",",
"$",
"action",
",",
"$",
"params",
")",
"{",
"$",
"dispatcher",
"=",
"new",
"self",
";",
"$",
"dispatcher",
"->",
"setModule",
"(",
"$",
"module",
")",
";... | Creates a Dispatcher instance from MVC parameters.
@param string $module Module name.
@param string $controller Controller name.
@param string $action Action name.
@param array $params Parameters.
@return Dispatcher | [
"Creates",
"a",
"Dispatcher",
"instance",
"from",
"MVC",
"parameters",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Bootstrap/Dispatcher.php#L62-L78 |
230,375 | Webiny/Framework | src/Webiny/Component/Bootstrap/Dispatcher.php | Dispatcher.customDispatcher | public static function customDispatcher($className, $action, $params)
{
$dispatcher = new self;
$dispatcher->setClassName($className);
$dispatcher->setAction($action);
$dispatcher->setParams($params);
return $dispatcher;
} | php | public static function customDispatcher($className, $action, $params)
{
$dispatcher = new self;
$dispatcher->setClassName($className);
$dispatcher->setAction($action);
$dispatcher->setParams($params);
return $dispatcher;
} | [
"public",
"static",
"function",
"customDispatcher",
"(",
"$",
"className",
",",
"$",
"action",
",",
"$",
"params",
")",
"{",
"$",
"dispatcher",
"=",
"new",
"self",
";",
"$",
"dispatcher",
"->",
"setClassName",
"(",
"$",
"className",
")",
";",
"$",
"dispa... | Creates a Dispatcher instance from a class name.
@param string $className Fully qualified class name.
@param string $action Action name.
@param array $params Parameters.
@return Dispatcher | [
"Creates",
"a",
"Dispatcher",
"instance",
"from",
"a",
"class",
"name",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Bootstrap/Dispatcher.php#L89-L97 |
230,376 | Webiny/Framework | src/Webiny/Component/Bootstrap/Dispatcher.php | Dispatcher.setClassName | public function setClassName($className)
{
try {
$classFilename = ClassLoader::getInstance()->findClass($className);
if (!file_exists($classFilename)) {
throw new BootstrapException('The provided callback class "' . $className . '" does not exist.');
} els... | php | public function setClassName($className)
{
try {
$classFilename = ClassLoader::getInstance()->findClass($className);
if (!file_exists($classFilename)) {
throw new BootstrapException('The provided callback class "' . $className . '" does not exist.');
} els... | [
"public",
"function",
"setClassName",
"(",
"$",
"className",
")",
"{",
"try",
"{",
"$",
"classFilename",
"=",
"ClassLoader",
"::",
"getInstance",
"(",
")",
"->",
"findClass",
"(",
"$",
"className",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"clas... | Sets the class name. Note, this will overwrite the current class name, also valid in case of MVC callback.
@param string $className Fully qualified class name.
@throws \Exception | BootstrapException | [
"Sets",
"the",
"class",
"name",
".",
"Note",
"this",
"will",
"overwrite",
"the",
"current",
"class",
"name",
"also",
"valid",
"in",
"case",
"of",
"MVC",
"callback",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Bootstrap/Dispatcher.php#L188-L200 |
230,377 | Webiny/Framework | src/Webiny/Component/Bootstrap/Dispatcher.php | Dispatcher.issueCallback | public function issueCallback()
{
$instance = $this->getCallbackClassInstance();
// call the controller
call_user_func_array([
$instance,
$this->getAction() . 'Action'
], $this->getParams());
$response = $instance->app()->httpResponse();
if (... | php | public function issueCallback()
{
$instance = $this->getCallbackClassInstance();
// call the controller
call_user_func_array([
$instance,
$this->getAction() . 'Action'
], $this->getParams());
$response = $instance->app()->httpResponse();
if (... | [
"public",
"function",
"issueCallback",
"(",
")",
"{",
"$",
"instance",
"=",
"$",
"this",
"->",
"getCallbackClassInstance",
"(",
")",
";",
"// call the controller",
"call_user_func_array",
"(",
"[",
"$",
"instance",
",",
"$",
"this",
"->",
"getAction",
"(",
")"... | Calls the defined action on the current class name, passing along the parameters.
@throws BootstrapException | [
"Calls",
"the",
"defined",
"action",
"on",
"the",
"current",
"class",
"name",
"passing",
"along",
"the",
"parameters",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Bootstrap/Dispatcher.php#L217-L231 |
230,378 | Webiny/Framework | src/Webiny/Component/Bootstrap/Dispatcher.php | Dispatcher.getCallbackClassInstance | private function getCallbackClassInstance()
{
// create and validate the instance
$className = $this->getClassName();
$instance = new $className();
// check that the app implements the trait
// is we use the class_traits method, we only get the traits of the current level, w... | php | private function getCallbackClassInstance()
{
// create and validate the instance
$className = $this->getClassName();
$instance = new $className();
// check that the app implements the trait
// is we use the class_traits method, we only get the traits of the current level, w... | [
"private",
"function",
"getCallbackClassInstance",
"(",
")",
"{",
"// create and validate the instance",
"$",
"className",
"=",
"$",
"this",
"->",
"getClassName",
"(",
")",
";",
"$",
"instance",
"=",
"new",
"$",
"className",
"(",
")",
";",
"// check that the app i... | Creates class instance from the defined class name.
Method automatically also tries to set the view template - only in case of an MVC callback.
In all cases the callback class must implement the AppTrait, because the method also calls the setUp method on
the class instance.
@return mixed
@throws BootstrapException | [
"Creates",
"class",
"instance",
"from",
"the",
"defined",
"class",
"name",
".",
"Method",
"automatically",
"also",
"tries",
"to",
"set",
"the",
"view",
"template",
"-",
"only",
"in",
"case",
"of",
"an",
"MVC",
"callback",
".",
"In",
"all",
"cases",
"the",
... | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Bootstrap/Dispatcher.php#L242-L269 |
230,379 | Webiny/Framework | src/Webiny/Component/Rest/Response/CallbackResult.php | CallbackResult.setHeaderResponse | public function setHeaderResponse($statusCode, $message = '')
{
$this->statusCode = $statusCode;
$this->message = $message;
if ($message == '') {
$this->message = self::$defaultMessages[$statusCode];
}
if (empty($this->message)) {
throw new RestExcept... | php | public function setHeaderResponse($statusCode, $message = '')
{
$this->statusCode = $statusCode;
$this->message = $message;
if ($message == '') {
$this->message = self::$defaultMessages[$statusCode];
}
if (empty($this->message)) {
throw new RestExcept... | [
"public",
"function",
"setHeaderResponse",
"(",
"$",
"statusCode",
",",
"$",
"message",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"statusCode",
"=",
"$",
"statusCode",
";",
"$",
"this",
"->",
"message",
"=",
"$",
"message",
";",
"if",
"(",
"$",
"message"... | Set response header status code and message.
@param int $statusCode Response status code.
@param string $message Response message.
@return $this
@throws \Webiny\Component\Rest\RestException | [
"Set",
"response",
"header",
"status",
"code",
"and",
"message",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Response/CallbackResult.php#L109-L122 |
230,380 | Webiny/Framework | src/Webiny/Component/Rest/Response/CallbackResult.php | CallbackResult.setErrorResponse | public function setErrorResponse($message, $description = '', $code = '')
{
$this->outputArray['errorReport']['message'] = $message;
if (!empty($description)) {
$this->outputArray['errorReport']['description'] = $description;
}
if (!empty($code)) {
$this->ou... | php | public function setErrorResponse($message, $description = '', $code = '')
{
$this->outputArray['errorReport']['message'] = $message;
if (!empty($description)) {
$this->outputArray['errorReport']['description'] = $description;
}
if (!empty($code)) {
$this->ou... | [
"public",
"function",
"setErrorResponse",
"(",
"$",
"message",
",",
"$",
"description",
"=",
"''",
",",
"$",
"code",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"outputArray",
"[",
"'errorReport'",
"]",
"[",
"'message'",
"]",
"=",
"$",
"message",
";",
"if"... | Adds a general error to the response.
@param string $message Error message.
@param string $description Error description.
@param string $code Error code.
@return $this | [
"Adds",
"a",
"general",
"error",
"to",
"the",
"response",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Response/CallbackResult.php#L133-L146 |
230,381 | Webiny/Framework | src/Webiny/Component/Rest/Response/CallbackResult.php | CallbackResult.attachDebugHeader | public function attachDebugHeader($name, $value, $ignoreEnv = false)
{
if ($this->env != 'development' && !$ignoreEnv) {
return $this;
}
if (strpos($name, 'X-Webiny-Rest') === false) {
$name = 'X-Webiny-Rest-' . $name;
}
$this->debugHeaders[$name] =... | php | public function attachDebugHeader($name, $value, $ignoreEnv = false)
{
if ($this->env != 'development' && !$ignoreEnv) {
return $this;
}
if (strpos($name, 'X-Webiny-Rest') === false) {
$name = 'X-Webiny-Rest-' . $name;
}
$this->debugHeaders[$name] =... | [
"public",
"function",
"attachDebugHeader",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"ignoreEnv",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"env",
"!=",
"'development'",
"&&",
"!",
"$",
"ignoreEnv",
")",
"{",
"return",
"$",
"this",
"... | Adds a debug header information.
@param string $name Header name.
@param string $value Header value.
@param bool $ignoreEnv Headers will be added only if we are in development mode, unless you set this to true.
@return $this | [
"Adds",
"a",
"debug",
"header",
"information",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Response/CallbackResult.php#L219-L233 |
230,382 | Webiny/Framework | src/Webiny/Component/Rest/Response/CallbackResult.php | CallbackResult.sendOutput | public function sendOutput()
{
// check environment to see what and how to do the output
$prettyPrint = false;
if ($this->env == 'development') {
$prettyPrint = true;
unset($this->outputArray['debug']);
}
// if there is an error, we always dump the co... | php | public function sendOutput()
{
// check environment to see what and how to do the output
$prettyPrint = false;
if ($this->env == 'development') {
$prettyPrint = true;
unset($this->outputArray['debug']);
}
// if there is an error, we always dump the co... | [
"public",
"function",
"sendOutput",
"(",
")",
"{",
"// check environment to see what and how to do the output",
"$",
"prettyPrint",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"env",
"==",
"'development'",
")",
"{",
"$",
"prettyPrint",
"=",
"true",
";",
"un... | Sends the output to browser. | [
"Sends",
"the",
"output",
"to",
"browser",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Response/CallbackResult.php#L274-L306 |
230,383 | Webiny/Framework | src/Webiny/Component/Storage/Storage.php | Storage.setContents | public function setContents($key, $contents, $append = false)
{
return $this->driver->setContents($key, $contents, $append);
} | php | public function setContents($key, $contents, $append = false)
{
return $this->driver->setContents($key, $contents, $append);
} | [
"public",
"function",
"setContents",
"(",
"$",
"key",
",",
"$",
"contents",
",",
"$",
"append",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"driver",
"->",
"setContents",
"(",
"$",
"key",
",",
"$",
"contents",
",",
"$",
"append",
")",
";",
... | Writes the given contents into the file
@param string $key
@param string $contents
@param bool $append
@return bool|int The number of bytes that were written into the file | [
"Writes",
"the",
"given",
"contents",
"into",
"the",
"file"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Storage/Storage.php#L76-L79 |
230,384 | Webiny/Framework | src/Webiny/Component/Storage/Storage.php | Storage.getTimeModified | public function getTimeModified($key, $asDateTimeObject = false)
{
$time = $this->driver->getTimeModified($key);
if ($asDateTimeObject) {
$datetime = new DateTimeObject();
return $datetime->setTimestamp($time);
}
return $time;
} | php | public function getTimeModified($key, $asDateTimeObject = false)
{
$time = $this->driver->getTimeModified($key);
if ($asDateTimeObject) {
$datetime = new DateTimeObject();
return $datetime->setTimestamp($time);
}
return $time;
} | [
"public",
"function",
"getTimeModified",
"(",
"$",
"key",
",",
"$",
"asDateTimeObject",
"=",
"false",
")",
"{",
"$",
"time",
"=",
"$",
"this",
"->",
"driver",
"->",
"getTimeModified",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"asDateTimeObject",
")",
... | Returns the last modified time
@param string $key
@param bool $asDateTimeObject (Optional) Return as DateTimeObject if true
@return UNIX Timestamp or DateTimeObject | [
"Returns",
"the",
"last",
"modified",
"time"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Storage/Storage.php#L116-L126 |
230,385 | Webiny/Framework | src/Webiny/Component/Image/Bridge/Imagine/Image.php | Image.getBinary | public function getBinary($options = [])
{
$options['quality'] = isset($options['quality']) ? $options['quality'] : self::QUALITY;
return $this->image->get($this->getFormat(), $options);
} | php | public function getBinary($options = [])
{
$options['quality'] = isset($options['quality']) ? $options['quality'] : self::QUALITY;
return $this->image->get($this->getFormat(), $options);
} | [
"public",
"function",
"getBinary",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"[",
"'quality'",
"]",
"=",
"isset",
"(",
"$",
"options",
"[",
"'quality'",
"]",
")",
"?",
"$",
"options",
"[",
"'quality'",
"]",
":",
"self",
"::",
"Q... | Get image as a binary string.
@param array $options An array of options. Possible keys are [quality, filters].
@return string | [
"Get",
"image",
"as",
"a",
"binary",
"string",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Image/Bridge/Imagine/Image.php#L54-L59 |
230,386 | Webiny/Framework | src/Webiny/Component/Image/Bridge/Imagine/Image.php | Image.getSize | public function getSize()
{
$size = $this->image->getSize();
return $this->arr([
'width' => $size->getWidth(),
'height' => $size->getHeight()
]
);
} | php | public function getSize()
{
$size = $this->image->getSize();
return $this->arr([
'width' => $size->getWidth(),
'height' => $size->getHeight()
]
);
} | [
"public",
"function",
"getSize",
"(",
")",
"{",
"$",
"size",
"=",
"$",
"this",
"->",
"image",
"->",
"getSize",
"(",
")",
";",
"return",
"$",
"this",
"->",
"arr",
"(",
"[",
"'width'",
"=>",
"$",
"size",
"->",
"getWidth",
"(",
")",
",",
"'height'",
... | Returns the width and height of the image in pixels.
@return ArrayObject | [
"Returns",
"the",
"width",
"and",
"height",
"of",
"the",
"image",
"in",
"pixels",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Image/Bridge/Imagine/Image.php#L66-L75 |
230,387 | Webiny/Framework | src/Webiny/Component/Image/Bridge/Imagine/Image.php | Image.crop | public function crop($width, $height, $offestX = 0, $offestY = 0)
{
$pointer = new Point($offestX, $offestY);
$size = new Box($width, $height);
$this->image->crop($pointer, $size);
return $this;
} | php | public function crop($width, $height, $offestX = 0, $offestY = 0)
{
$pointer = new Point($offestX, $offestY);
$size = new Box($width, $height);
$this->image->crop($pointer, $size);
return $this;
} | [
"public",
"function",
"crop",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"offestX",
"=",
"0",
",",
"$",
"offestY",
"=",
"0",
")",
"{",
"$",
"pointer",
"=",
"new",
"Point",
"(",
"$",
"offestX",
",",
"$",
"offestY",
")",
";",
"$",
"size",
"... | Crop the image to the given dimensions.
@param int $width Width on the new image.
@param int $height Height of the new image.
@param int $offestX Crop start position on X axis.
@param int $offestY Crop start position on Y axis.
@return $this | [
"Crop",
"the",
"image",
"to",
"the",
"given",
"dimensions",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Image/Bridge/Imagine/Image.php#L87-L95 |
230,388 | Webiny/Framework | src/Webiny/Component/Image/Bridge/Imagine/Image.php | Image.resize | public function resize($width, $height, $preserveAspectRatio = true)
{
if ($preserveAspectRatio) {
$currentSize = $this->getSize();
$currentAspectRatio = round($currentSize->width / $currentSize->height, 3);
$aspectRatio = round($width / $height, 3);
if ($cu... | php | public function resize($width, $height, $preserveAspectRatio = true)
{
if ($preserveAspectRatio) {
$currentSize = $this->getSize();
$currentAspectRatio = round($currentSize->width / $currentSize->height, 3);
$aspectRatio = round($width / $height, 3);
if ($cu... | [
"public",
"function",
"resize",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"preserveAspectRatio",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"preserveAspectRatio",
")",
"{",
"$",
"currentSize",
"=",
"$",
"this",
"->",
"getSize",
"(",
")",
";",
"$",
... | Resize the image to given dimensions.
@param int $width Width of the new image.
@param int $height Height of the new image.
@param bool $preserveAspectRatio Do you wish to preserve the aspect ration while resizing. Default is true.
NOTE: If you preserve the as... | [
"Resize",
"the",
"image",
"to",
"given",
"dimensions",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Image/Bridge/Imagine/Image.php#L108-L130 |
230,389 | Webiny/Framework | src/Webiny/Component/Image/Bridge/Imagine/Image.php | Image.thumbnail | public function thumbnail($width, $height, $cropOrPad = false, $padColor = null)
{
// get the aspect ratio
$currentSize = $this->getSize();
$ar = round($currentSize['width'] / $currentSize['height'], 3);
$nar = round($width / $height, 3);
$newWidth = $width;
$newHeig... | php | public function thumbnail($width, $height, $cropOrPad = false, $padColor = null)
{
// get the aspect ratio
$currentSize = $this->getSize();
$ar = round($currentSize['width'] / $currentSize['height'], 3);
$nar = round($width / $height, 3);
$newWidth = $width;
$newHeig... | [
"public",
"function",
"thumbnail",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"cropOrPad",
"=",
"false",
",",
"$",
"padColor",
"=",
"null",
")",
"{",
"// get the aspect ratio",
"$",
"currentSize",
"=",
"$",
"this",
"->",
"getSize",
"(",
")",
";",
... | This is a method that combines resize, crop and paste methods in order to generate a thumbnail from the given image.
The benefit of using this function is that the function can automatically combine crop and resize methods together
with the pad feature in order to generate the thumb.
@param int $width Thum... | [
"This",
"is",
"a",
"method",
"that",
"combines",
"resize",
"crop",
"and",
"paste",
"methods",
"in",
"order",
"to",
"generate",
"a",
"thumbnail",
"from",
"the",
"given",
"image",
".",
"The",
"benefit",
"of",
"using",
"this",
"function",
"is",
"that",
"the",... | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Image/Bridge/Imagine/Image.php#L183-L239 |
230,390 | Webiny/Framework | src/Webiny/Component/Image/Bridge/Imagine/Image.php | Image.paste | public function paste(ImageInterface $image, $offsetX = 0, $offsetY = 0)
{
$point = new Point($offsetX, $offsetY);
$this->image->paste($image->getInstance(), $point);
return $this;
} | php | public function paste(ImageInterface $image, $offsetX = 0, $offsetY = 0)
{
$point = new Point($offsetX, $offsetY);
$this->image->paste($image->getInstance(), $point);
return $this;
} | [
"public",
"function",
"paste",
"(",
"ImageInterface",
"$",
"image",
",",
"$",
"offsetX",
"=",
"0",
",",
"$",
"offsetY",
"=",
"0",
")",
"{",
"$",
"point",
"=",
"new",
"Point",
"(",
"$",
"offsetX",
",",
"$",
"offsetY",
")",
";",
"$",
"this",
"->",
... | Paste another image into this one a the specified dimension.
@param ImageInterface $image Image to paste.
@param int $offsetX Offset on x axis.
@param int $offsetY Offset on y axis
@return $this | [
"Paste",
"another",
"image",
"into",
"this",
"one",
"a",
"the",
"specified",
"dimension",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Image/Bridge/Imagine/Image.php#L250-L257 |
230,391 | Webiny/Framework | src/Webiny/Component/Config/Bridge/Yaml/Yaml.php | Yaml.setDriver | public static function setDriver($driver)
{
if (!self::isInstanceOf($driver, YamlInterface::class)) {
if (self::isString($driver) || self::isStringObject($driver)) {
$driver = StdObjectWrapper::toString($driver);
$driver = new $driver;
if (self::i... | php | public static function setDriver($driver)
{
if (!self::isInstanceOf($driver, YamlInterface::class)) {
if (self::isString($driver) || self::isStringObject($driver)) {
$driver = StdObjectWrapper::toString($driver);
$driver = new $driver;
if (self::i... | [
"public",
"static",
"function",
"setDriver",
"(",
"$",
"driver",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isInstanceOf",
"(",
"$",
"driver",
",",
"YamlInterface",
"::",
"class",
")",
")",
"{",
"if",
"(",
"self",
"::",
"isString",
"(",
"$",
"driver",
... | Set Yaml driver to use by Yaml bridge
@param $driver string|YamlInterface
@throws YamlException | [
"Set",
"Yaml",
"driver",
"to",
"use",
"by",
"Yaml",
"bridge"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Config/Bridge/Yaml/Yaml.php#L48-L66 |
230,392 | Webiny/Framework | src/Webiny/Component/Config/Bridge/Yaml/Yaml.php | Yaml.getString | public function getString($indent = 2, $wordWrap = false)
{
$res = $this->driverInstance->getString($indent, $wordWrap);
if (!$this->isString($res) && !$this->isStringObject($res)) {
throw new YamlException('YamlInterface method _getString() must return a string or StringObject.');
... | php | public function getString($indent = 2, $wordWrap = false)
{
$res = $this->driverInstance->getString($indent, $wordWrap);
if (!$this->isString($res) && !$this->isStringObject($res)) {
throw new YamlException('YamlInterface method _getString() must return a string or StringObject.');
... | [
"public",
"function",
"getString",
"(",
"$",
"indent",
"=",
"2",
",",
"$",
"wordWrap",
"=",
"false",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"driverInstance",
"->",
"getString",
"(",
"$",
"indent",
",",
"$",
"wordWrap",
")",
";",
"if",
"(",
"... | Get current Yaml value as string
@param int $indent
@param bool $wordWrap
@throws YamlException
@return string | [
"Get",
"current",
"Yaml",
"value",
"as",
"string"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Config/Bridge/Yaml/Yaml.php#L89-L97 |
230,393 | Webiny/Framework | src/Webiny/Component/Config/Bridge/Yaml/Yaml.php | Yaml.getArray | public function getArray()
{
$res = $this->driverInstance->getArray();
if (!$this->isArray($res) && !$this->isArrayObject($res)) {
throw new YamlException('YamlInterface method getArray() must return an array or ArrayObject.');
}
return StdObjectWrapper::toArray($res);
... | php | public function getArray()
{
$res = $this->driverInstance->getArray();
if (!$this->isArray($res) && !$this->isArrayObject($res)) {
throw new YamlException('YamlInterface method getArray() must return an array or ArrayObject.');
}
return StdObjectWrapper::toArray($res);
... | [
"public",
"function",
"getArray",
"(",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"driverInstance",
"->",
"getArray",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isArray",
"(",
"$",
"res",
")",
"&&",
"!",
"$",
"this",
"->",
"isArrayObject... | Get Yaml value as array
@throws YamlException
@return array | [
"Get",
"Yaml",
"value",
"as",
"array"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Config/Bridge/Yaml/Yaml.php#L105-L113 |
230,394 | Webiny/Framework | src/Webiny/Component/Config/Bridge/Yaml/Yaml.php | Yaml.setResource | public function setResource($resource)
{
$res = $this->driverInstance->setResource($resource);
if (!$this->isInstanceOf($res, YamlInterface::class)) {
throw new YamlException('YamlInterface method setSource() must return YamlInterface object.');
}
return $this;
} | php | public function setResource($resource)
{
$res = $this->driverInstance->setResource($resource);
if (!$this->isInstanceOf($res, YamlInterface::class)) {
throw new YamlException('YamlInterface method setSource() must return YamlInterface object.');
}
return $this;
} | [
"public",
"function",
"setResource",
"(",
"$",
"resource",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"driverInstance",
"->",
"setResource",
"(",
"$",
"resource",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isInstanceOf",
"(",
"$",
"res",
",",
"... | Set driver resource to work on
@param mixed $resource
@throws YamlException
@return $this | [
"Set",
"driver",
"resource",
"to",
"work",
"on"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Config/Bridge/Yaml/Yaml.php#L123-L131 |
230,395 | Webiny/Framework | src/Webiny/Component/Rest/Compiler/CacheDrivers/FilesystemDriver.php | FilesystemDriver.getCacheFilename | private function getCacheFilename($api, $class, $version)
{
if (!is_numeric(substr($version, 0, 1))) {
$versionFile = $version . '.php';
} else {
$versionFile = 'v' . $version . '.php';
}
// combine the paths and look for the cache file
$cacheFile = $... | php | private function getCacheFilename($api, $class, $version)
{
if (!is_numeric(substr($version, 0, 1))) {
$versionFile = $version . '.php';
} else {
$versionFile = 'v' . $version . '.php';
}
// combine the paths and look for the cache file
$cacheFile = $... | [
"private",
"function",
"getCacheFilename",
"(",
"$",
"api",
",",
"$",
"class",
",",
"$",
"version",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"substr",
"(",
"$",
"version",
",",
"0",
",",
"1",
")",
")",
")",
"{",
"$",
"versionFile",
"=",
"$",
... | Returns the name of the cached class file.
@param string $api Name of the api configuration.
@param string $class Class name.
@param string $version Version of the api class.
@return string Full path to the cache filename.
@throws \Webiny\Component\Rest\RestException | [
"Returns",
"the",
"name",
"of",
"the",
"cached",
"class",
"file",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Compiler/CacheDrivers/FilesystemDriver.php#L126-L138 |
230,396 | Webiny/Framework | src/Webiny/Component/Rest/Compiler/CacheDrivers/FilesystemDriver.php | FilesystemDriver.getCacheFolder | private function getCacheFolder($api, $class)
{
// get the api compile folder
$compilePath = Rest::getConfig()->get($api)->CompilePath;
if (empty($compilePath)) {
throw new RestException('You must set CompilePath for "' . $api . '" api.');
}
$apiFolder = $this->st... | php | private function getCacheFolder($api, $class)
{
// get the api compile folder
$compilePath = Rest::getConfig()->get($api)->CompilePath;
if (empty($compilePath)) {
throw new RestException('You must set CompilePath for "' . $api . '" api.');
}
$apiFolder = $this->st... | [
"private",
"function",
"getCacheFolder",
"(",
"$",
"api",
",",
"$",
"class",
")",
"{",
"// get the api compile folder",
"$",
"compilePath",
"=",
"Rest",
"::",
"getConfig",
"(",
")",
"->",
"get",
"(",
"$",
"api",
")",
"->",
"CompilePath",
";",
"if",
"(",
... | Returns the folder where the cache files should be stored.
@param string $api Name of the api configuration.
@param string $class Class name.
@return string
@throws RestException
@throws \Webiny\Component\Rest\RestException | [
"Returns",
"the",
"folder",
"where",
"the",
"cache",
"files",
"should",
"be",
"stored",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Compiler/CacheDrivers/FilesystemDriver.php#L150-L170 |
230,397 | ZenMagick/ZenCart | includes/modules/payment/linkpoint_api.php | linkpoint_api._sendRequest | function _sendRequest($myorder) {
$myorder["host"] = "secure.linkpt.net";
if (MODULE_PAYMENT_LINKPOINT_API_TRANSACTION_MODE == 'DevelopersTest') {
$myorder["host"] = "staging.linkpt.net";
}
$myorder["port"] = "1129";
$myorder["keyfile"] =(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment... | php | function _sendRequest($myorder) {
$myorder["host"] = "secure.linkpt.net";
if (MODULE_PAYMENT_LINKPOINT_API_TRANSACTION_MODE == 'DevelopersTest') {
$myorder["host"] = "staging.linkpt.net";
}
$myorder["port"] = "1129";
$myorder["keyfile"] =(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment... | [
"function",
"_sendRequest",
"(",
"$",
"myorder",
")",
"{",
"$",
"myorder",
"[",
"\"host\"",
"]",
"=",
"\"secure.linkpt.net\"",
";",
"if",
"(",
"MODULE_PAYMENT_LINKPOINT_API_TRANSACTION_MODE",
"==",
"'DevelopersTest'",
")",
"{",
"$",
"myorder",
"[",
"\"host\"",
"]"... | Send transaction to gateway | [
"Send",
"transaction",
"to",
"gateway"
] | 00438ebc0faee786489aab4a6d70fc0d0c1461c7 | https://github.com/ZenMagick/ZenCart/blob/00438ebc0faee786489aab4a6d70fc0d0c1461c7/includes/modules/payment/linkpoint_api.php#L789-L832 |
230,398 | ZenMagick/ZenCart | includes/modules/payment/linkpoint_api.php | linkpoint_api._updateOrderStatus | function _updateOrderStatus($oID, $new_order_status, $comments) {
global $db;
$sql_data_array= array(array('fieldName'=>'orders_id', 'value' => $oID, 'type'=>'integer'),
array('fieldName'=>'orders_status_id', 'value' => $new_order_status, 'type'=>'integer'),
... | php | function _updateOrderStatus($oID, $new_order_status, $comments) {
global $db;
$sql_data_array= array(array('fieldName'=>'orders_id', 'value' => $oID, 'type'=>'integer'),
array('fieldName'=>'orders_status_id', 'value' => $new_order_status, 'type'=>'integer'),
... | [
"function",
"_updateOrderStatus",
"(",
"$",
"oID",
",",
"$",
"new_order_status",
",",
"$",
"comments",
")",
"{",
"global",
"$",
"db",
";",
"$",
"sql_data_array",
"=",
"array",
"(",
"array",
"(",
"'fieldName'",
"=>",
"'orders_id'",
",",
"'value'",
"=>",
"$"... | Update order status and order status history based on admin changes sent to gateway | [
"Update",
"order",
"status",
"and",
"order",
"status",
"history",
"based",
"on",
"admin",
"changes",
"sent",
"to",
"gateway"
] | 00438ebc0faee786489aab4a6d70fc0d0c1461c7 | https://github.com/ZenMagick/ZenCart/blob/00438ebc0faee786489aab4a6d70fc0d0c1461c7/includes/modules/payment/linkpoint_api.php#L837-L848 |
230,399 | Webiny/Framework | src/Webiny/Component/ServiceManager/ServiceManager.php | ServiceManager.getService | public function getService($serviceName)
{
$serviceName = ltrim($serviceName, '@');
if (!isset($this->registeredServices[$serviceName])) {
throw new ServiceManagerException(ServiceManagerException::SERVICE_DEFINITION_NOT_FOUND, [$serviceName]);
}
// Instantiate new servi... | php | public function getService($serviceName)
{
$serviceName = ltrim($serviceName, '@');
if (!isset($this->registeredServices[$serviceName])) {
throw new ServiceManagerException(ServiceManagerException::SERVICE_DEFINITION_NOT_FOUND, [$serviceName]);
}
// Instantiate new servi... | [
"public",
"function",
"getService",
"(",
"$",
"serviceName",
")",
"{",
"$",
"serviceName",
"=",
"ltrim",
"(",
"$",
"serviceName",
",",
"'@'",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"registeredServices",
"[",
"$",
"serviceName",
"]",
... | Get service instance by given name nad optional arguments
@param string $serviceName Requested service name
@throws ServiceManagerException
@return object | [
"Get",
"service",
"instance",
"by",
"given",
"name",
"nad",
"optional",
"arguments"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/ServiceManager/ServiceManager.php#L46-L61 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.