repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Wedeto/Util | src/Cache/Item.php | Item.unserialize | public function unserialize($data)
{
$data = unserialize($data);
$this->key = $data['key'];
$this->value = $data['value'];
$this->expires = $data['expires'];
$this->hit = $data['hit'];
} | php | public function unserialize($data)
{
$data = unserialize($data);
$this->key = $data['key'];
$this->value = $data['value'];
$this->expires = $data['expires'];
$this->hit = $data['hit'];
} | [
"public",
"function",
"unserialize",
"(",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"unserialize",
"(",
"$",
"data",
")",
";",
"$",
"this",
"->",
"key",
"=",
"$",
"data",
"[",
"'key'",
"]",
";",
"$",
"this",
"->",
"value",
"=",
"$",
"data",
"[",
... | Unserialize the item. Required for storing in the containing cache
@param string $data The data to unserialize | [
"Unserialize",
"the",
"item",
".",
"Required",
"for",
"storing",
"in",
"the",
"containing",
"cache"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/Cache/Item.php#L204-L211 | train |
ekyna/Table | Extension/Core/Source/ArrayAdapter.php | ArrayAdapter.buildSortClosure | public function buildSortClosure($propertyPath, $direction)
{
$value = function ($data) use ($propertyPath) {
return $this->propertyAccessor->getValue($data, $propertyPath);
};
if ($direction === Util\ColumnSort::ASC) {
return function ($rowA, $rowB) use ($value) {
... | php | public function buildSortClosure($propertyPath, $direction)
{
$value = function ($data) use ($propertyPath) {
return $this->propertyAccessor->getValue($data, $propertyPath);
};
if ($direction === Util\ColumnSort::ASC) {
return function ($rowA, $rowB) use ($value) {
... | [
"public",
"function",
"buildSortClosure",
"(",
"$",
"propertyPath",
",",
"$",
"direction",
")",
"{",
"$",
"value",
"=",
"function",
"(",
"$",
"data",
")",
"use",
"(",
"$",
"propertyPath",
")",
"{",
"return",
"$",
"this",
"->",
"propertyAccessor",
"->",
"... | Builds the sort closure.
@param string $propertyPath
@param string $direction
@return \Closure | [
"Builds",
"the",
"sort",
"closure",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Extension/Core/Source/ArrayAdapter.php#L161-L192 | train |
ekyna/Table | Extension/Core/Source/ArrayAdapter.php | ArrayAdapter.applyClosures | private function applyClosures($data)
{
if (!empty($this->filterClosures)) {
$data = array_filter($data, function ($datum) {
foreach ($this->filterClosures as $closure) {
if (!$closure($datum)) {
return false;
}
... | php | private function applyClosures($data)
{
if (!empty($this->filterClosures)) {
$data = array_filter($data, function ($datum) {
foreach ($this->filterClosures as $closure) {
if (!$closure($datum)) {
return false;
}
... | [
"private",
"function",
"applyClosures",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"filterClosures",
")",
")",
"{",
"$",
"data",
"=",
"array_filter",
"(",
"$",
"data",
",",
"function",
"(",
"$",
"datum",
")",
"{",
... | Applies the filters and sort closures.
@param array $data
@return array | [
"Applies",
"the",
"filters",
"and",
"sort",
"closures",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Extension/Core/Source/ArrayAdapter.php#L280-L311 | train |
rednose-public/RednoseComboHandlerBundle | Controller/MinifyController.php | MinifyController.rewriteUris | public static function rewriteUris($css, $options = array())
{
// Prepend the base URL and symlink schema so the proper root path gets prepended.
$symlinks = array();
if (is_link($_SERVER['DOCUMENT_ROOT'])) {
$symlinks = array(
'/'.$options['baseUrl'] => readlink... | php | public static function rewriteUris($css, $options = array())
{
// Prepend the base URL and symlink schema so the proper root path gets prepended.
$symlinks = array();
if (is_link($_SERVER['DOCUMENT_ROOT'])) {
$symlinks = array(
'/'.$options['baseUrl'] => readlink... | [
"public",
"static",
"function",
"rewriteUris",
"(",
"$",
"css",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"// Prepend the base URL and symlink schema so the proper root path gets prepended.",
"$",
"symlinks",
"=",
"array",
"(",
")",
";",
"if",
"(",
"i... | Rewrite CSS URIs.
@param string $css
@param array $options
@return string | [
"Rewrite",
"CSS",
"URIs",
"."
] | 44b55dbd6653cebcf280822156cff8b850bdae00 | https://github.com/rednose-public/RednoseComboHandlerBundle/blob/44b55dbd6653cebcf280822156cff8b850bdae00/Controller/MinifyController.php#L76-L88 | train |
rednose-public/RednoseComboHandlerBundle | Controller/MinifyController.php | MinifyController.getBaseUrl | protected function getBaseUrl()
{
$baseUrl = $this->container->get('router')->getContext()->getBaseUrl();
if ($baseUrl === '/') {
return '';
}
return rtrim(str_replace('app_dev.php', '', $this->container->get('router')->getContext()->getBaseUrl()), '/').'/';
} | php | protected function getBaseUrl()
{
$baseUrl = $this->container->get('router')->getContext()->getBaseUrl();
if ($baseUrl === '/') {
return '';
}
return rtrim(str_replace('app_dev.php', '', $this->container->get('router')->getContext()->getBaseUrl()), '/').'/';
} | [
"protected",
"function",
"getBaseUrl",
"(",
")",
"{",
"$",
"baseUrl",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'router'",
")",
"->",
"getContext",
"(",
")",
"->",
"getBaseUrl",
"(",
")",
";",
"if",
"(",
"$",
"baseUrl",
"===",
"'/'",
")... | Returns the normalized base URL.
@return string | [
"Returns",
"the",
"normalized",
"base",
"URL",
"."
] | 44b55dbd6653cebcf280822156cff8b850bdae00 | https://github.com/rednose-public/RednoseComboHandlerBundle/blob/44b55dbd6653cebcf280822156cff8b850bdae00/Controller/MinifyController.php#L133-L142 | train |
polusphp/polus-middleware | src/UserAgent.php | UserAgent.determineClientUserAgent | protected function determineClientUserAgent($request)
{
$userAgent = null;
$serverParams = $request->getServerParams();
$userAgent = $serverParams['HTTP_USER_AGENT'];
$checkProxyHeaders = $this->checkProxyHeaders;
if ($checkProxyHeaders && !empty($this->trustedProxies)) {
... | php | protected function determineClientUserAgent($request)
{
$userAgent = null;
$serverParams = $request->getServerParams();
$userAgent = $serverParams['HTTP_USER_AGENT'];
$checkProxyHeaders = $this->checkProxyHeaders;
if ($checkProxyHeaders && !empty($this->trustedProxies)) {
... | [
"protected",
"function",
"determineClientUserAgent",
"(",
"$",
"request",
")",
"{",
"$",
"userAgent",
"=",
"null",
";",
"$",
"serverParams",
"=",
"$",
"request",
"->",
"getServerParams",
"(",
")",
";",
"$",
"userAgent",
"=",
"$",
"serverParams",
"[",
"'HTTP_... | Find out the client's UserAgent from the headers available to us
@param ServerRequestInterface $request PSR-7 Request
@return string | [
"Find",
"out",
"the",
"client",
"s",
"UserAgent",
"from",
"the",
"headers",
"available",
"to",
"us"
] | c265c51fbdf6b2c5ed85686415b47a1fbf720c57 | https://github.com/polusphp/polus-middleware/blob/c265c51fbdf6b2c5ed85686415b47a1fbf720c57/src/UserAgent.php#L85-L107 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Event/ErrorEvent.php | ErrorEvent.intercept | public function intercept(ResponseInterface $response)
{
$this->stopPropagation();
$this->getTransaction()->setResponse($response);
$this->exception->setThrowImmediately(false);
RequestEvents::emitComplete($this->getTransaction());
} | php | public function intercept(ResponseInterface $response)
{
$this->stopPropagation();
$this->getTransaction()->setResponse($response);
$this->exception->setThrowImmediately(false);
RequestEvents::emitComplete($this->getTransaction());
} | [
"public",
"function",
"intercept",
"(",
"ResponseInterface",
"$",
"response",
")",
"{",
"$",
"this",
"->",
"stopPropagation",
"(",
")",
";",
"$",
"this",
"->",
"getTransaction",
"(",
")",
"->",
"setResponse",
"(",
"$",
"response",
")",
";",
"$",
"this",
... | Intercept the exception and inject a response
@param ResponseInterface $response Response to set | [
"Intercept",
"the",
"exception",
"and",
"inject",
"a",
"response"
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Event/ErrorEvent.php#L39-L45 | train |
ARCANESOFT/SEO | src/Http/Requests/Admin/Footers/FooterFormRequest.php | FooterFormRequest.getPageRule | protected function getPageRule()
{
$existsRule = Rule::exists($this->getTablePrefix().'pages', 'id')->using(function ($query) {
if ($this->has('locale'))
$query->where('locale', $this->get('locale', config('app.locale')));
});
return ['required', 'integer', $exis... | php | protected function getPageRule()
{
$existsRule = Rule::exists($this->getTablePrefix().'pages', 'id')->using(function ($query) {
if ($this->has('locale'))
$query->where('locale', $this->get('locale', config('app.locale')));
});
return ['required', 'integer', $exis... | [
"protected",
"function",
"getPageRule",
"(",
")",
"{",
"$",
"existsRule",
"=",
"Rule",
"::",
"exists",
"(",
"$",
"this",
"->",
"getTablePrefix",
"(",
")",
".",
"'pages'",
",",
"'id'",
")",
"->",
"using",
"(",
"function",
"(",
"$",
"query",
")",
"{",
... | Get the page validation rule.
@return array | [
"Get",
"the",
"page",
"validation",
"rule",
"."
] | ce6d6135d55e8b2fd43cf7923839b4791b7c7ad2 | https://github.com/ARCANESOFT/SEO/blob/ce6d6135d55e8b2fd43cf7923839b4791b7c7ad2/src/Http/Requests/Admin/Footers/FooterFormRequest.php#L39-L47 | train |
helsingborg-stad/better-post-UI | source/php/Components/InternalLinks.php | InternalLinks.updateLinkInfo | public function updateLinkInfo($results, $query)
{
$results = array_map(function ($result) {
// Get post type
$post_type = get_post_type($result['ID']);
$obj = get_post_type_object($post_type);
// Add post type to result info
$result['info'] = '<st... | php | public function updateLinkInfo($results, $query)
{
$results = array_map(function ($result) {
// Get post type
$post_type = get_post_type($result['ID']);
$obj = get_post_type_object($post_type);
// Add post type to result info
$result['info'] = '<st... | [
"public",
"function",
"updateLinkInfo",
"(",
"$",
"results",
",",
"$",
"query",
")",
"{",
"$",
"results",
"=",
"array_map",
"(",
"function",
"(",
"$",
"result",
")",
"{",
"// Get post type",
"$",
"post_type",
"=",
"get_post_type",
"(",
"$",
"result",
"[",
... | Get the post type and its parents
@param array $results An associative array of query results
@param array $query An array of WP_Query arguments
@return array | [
"Get",
"the",
"post",
"type",
"and",
"its",
"parents"
] | 0454e8d6f42787244d02f0e976825ed8dca579f0 | https://github.com/helsingborg-stad/better-post-UI/blob/0454e8d6f42787244d02f0e976825ed8dca579f0/source/php/Components/InternalLinks.php#L34-L59 | train |
helsingborg-stad/better-post-UI | source/php/Components/InternalLinks.php | InternalLinks.limitLinkSearch | public function limitLinkSearch($search, $wp_query)
{
global $wpdb;
if (empty($search)) {
return $search;
}
$query_vars = $wp_query->query_vars;
$search = '';
$and = '';
foreach((array)$query_vars['search_terms'] as $term) {
$search ... | php | public function limitLinkSearch($search, $wp_query)
{
global $wpdb;
if (empty($search)) {
return $search;
}
$query_vars = $wp_query->query_vars;
$search = '';
$and = '';
foreach((array)$query_vars['search_terms'] as $term) {
$search ... | [
"public",
"function",
"limitLinkSearch",
"(",
"$",
"search",
",",
"$",
"wp_query",
")",
"{",
"global",
"$",
"wpdb",
";",
"if",
"(",
"empty",
"(",
"$",
"search",
")",
")",
"{",
"return",
"$",
"search",
";",
"}",
"$",
"query_vars",
"=",
"$",
"wp_query"... | Limits internal link search to "post title" field
@param string $search Search SQL for WHERE clause
@param obj $wp_query The current WP_Query object
@return string Modified search string | [
"Limits",
"internal",
"link",
"search",
"to",
"post",
"title",
"field"
] | 0454e8d6f42787244d02f0e976825ed8dca579f0 | https://github.com/helsingborg-stad/better-post-UI/blob/0454e8d6f42787244d02f0e976825ed8dca579f0/source/php/Components/InternalLinks.php#L67-L87 | train |
Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Model/TranslatableTrait.php | TranslatableTrait.getTranslation | protected function getTranslation(array $translationData, $default = '')
{
// undefined locale
if (empty($translationData)) {
return $default;
}
// current locale matched
if ($this->locale && isset($translationData[$this->locale])) {
return $translati... | php | protected function getTranslation(array $translationData, $default = '')
{
// undefined locale
if (empty($translationData)) {
return $default;
}
// current locale matched
if ($this->locale && isset($translationData[$this->locale])) {
return $translati... | [
"protected",
"function",
"getTranslation",
"(",
"array",
"$",
"translationData",
",",
"$",
"default",
"=",
"''",
")",
"{",
"// undefined locale",
"if",
"(",
"empty",
"(",
"$",
"translationData",
")",
")",
"{",
"return",
"$",
"default",
";",
"}",
"// current ... | return translation matching current locale from given translation data
@param array $translationData
@param string $default
@return string | [
"return",
"translation",
"matching",
"current",
"locale",
"from",
"given",
"translation",
"data"
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Model/TranslatableTrait.php#L48-L65 | train |
NukaCode/html | src/NukaCode/Html/BBCode.php | BBCode.parse | public function parse($data)
{
$this->table();
$this->images();
$this->text();
$this->html();
// Replace everything that has been found
foreach ($this->matches as $key => $val) {
$data = preg_replace_callback($key, $val, $data);
}
// Repl... | php | public function parse($data)
{
$this->table();
$this->images();
$this->text();
$this->html();
// Replace everything that has been found
foreach ($this->matches as $key => $val) {
$data = preg_replace_callback($key, $val, $data);
}
// Repl... | [
"public",
"function",
"parse",
"(",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"table",
"(",
")",
";",
"$",
"this",
"->",
"images",
"(",
")",
";",
"$",
"this",
"->",
"text",
"(",
")",
";",
"$",
"this",
"->",
"html",
"(",
")",
";",
"// Replace ev... | Parse a text and replace the BBCodes
@access public
@param string $data
@return string | [
"Parse",
"a",
"text",
"and",
"replace",
"the",
"BBCodes"
] | 7288161fb6711b1f9889e31bacb32d0d14b46e85 | https://github.com/NukaCode/html/blob/7288161fb6711b1f9889e31bacb32d0d14b46e85/src/NukaCode/Html/BBCode.php#L31-L48 | train |
aegis-security/JSON | src/Encoder.php | Encoder._encodeConstants | private static function _encodeConstants(\ReflectionClass $cls)
{
$result = "constants : {";
$constants = $cls->getConstants();
$tmpArray = array();
if (!empty($constants)) {
foreach ($constants as $key => $value) {
$tmpArray[] = "$key: " . self::encod... | php | private static function _encodeConstants(\ReflectionClass $cls)
{
$result = "constants : {";
$constants = $cls->getConstants();
$tmpArray = array();
if (!empty($constants)) {
foreach ($constants as $key => $value) {
$tmpArray[] = "$key: " . self::encod... | [
"private",
"static",
"function",
"_encodeConstants",
"(",
"\\",
"ReflectionClass",
"$",
"cls",
")",
"{",
"$",
"result",
"=",
"\"constants : {\"",
";",
"$",
"constants",
"=",
"$",
"cls",
"->",
"getConstants",
"(",
")",
";",
"$",
"tmpArray",
"=",
"array",
"(... | Encode the constants associated with the \ReflectionClass
parameter. The encoding format is based on the class2 format
@param \ReflectionClass $cls
@return string Encoded constant block in class2 format | [
"Encode",
"the",
"constants",
"associated",
"with",
"the",
"\\",
"ReflectionClass",
"parameter",
".",
"The",
"encoding",
"format",
"is",
"based",
"on",
"the",
"class2",
"format"
] | 7bc8e442e9e570ecbc480053d9aaa42a52910fbc | https://github.com/aegis-security/JSON/blob/7bc8e442e9e570ecbc480053d9aaa42a52910fbc/src/Encoder.php#L262-L277 | train |
rollerworks-graveyard/metadata | src/NullClassMetadata.php | NullClassMetadata.merge | public function merge(ClassMetadata $object)
{
$createdAt = $this->createdAt;
if (($otherCreatedAt = $object->getCreatedAt()) > $createdAt) {
$createdAt = $otherCreatedAt;
}
return new self($this->className, $createdAt);
} | php | public function merge(ClassMetadata $object)
{
$createdAt = $this->createdAt;
if (($otherCreatedAt = $object->getCreatedAt()) > $createdAt) {
$createdAt = $otherCreatedAt;
}
return new self($this->className, $createdAt);
} | [
"public",
"function",
"merge",
"(",
"ClassMetadata",
"$",
"object",
")",
"{",
"$",
"createdAt",
"=",
"$",
"this",
"->",
"createdAt",
";",
"if",
"(",
"(",
"$",
"otherCreatedAt",
"=",
"$",
"object",
"->",
"getCreatedAt",
"(",
")",
")",
">",
"$",
"created... | Returns a new NullClassMetadata with the highest createdAt.
No actual merging is performed as NullClassMetadata can't hold
any data and it's not possible to determine which ClassMetadata
implementation must be used.
Only the createdAt of the object is used if it's higher then
the current createdAt value.
@param Clas... | [
"Returns",
"a",
"new",
"NullClassMetadata",
"with",
"the",
"highest",
"createdAt",
"."
] | 5b07f564aad87709ca0d0b3e140e4dc4edf9d375 | https://github.com/rollerworks-graveyard/metadata/blob/5b07f564aad87709ca0d0b3e140e4dc4edf9d375/src/NullClassMetadata.php#L131-L140 | train |
ezra-obiwale/dSCore | src/Stdlib/Email.php | Email.addAttachment | public function addAttachment($filePath) {
if (!$file = fopen($filePath, 'r')) {
throw new Exception('Cannot open file "' . $filePath . '"');
}
$this->attachments[$filePath] = chunk_split(base64_encode(fread($file, filesize($filePath))));
return $this;
} | php | public function addAttachment($filePath) {
if (!$file = fopen($filePath, 'r')) {
throw new Exception('Cannot open file "' . $filePath . '"');
}
$this->attachments[$filePath] = chunk_split(base64_encode(fread($file, filesize($filePath))));
return $this;
} | [
"public",
"function",
"addAttachment",
"(",
"$",
"filePath",
")",
"{",
"if",
"(",
"!",
"$",
"file",
"=",
"fopen",
"(",
"$",
"filePath",
",",
"'r'",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Cannot open file \"'",
".",
"$",
"filePath",
".",
"'\... | Attach a file to the email
@param string $filePath Path to the file
@return \Email
@throws Exception | [
"Attach",
"a",
"file",
"to",
"the",
"email"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Email.php#L46-L53 | train |
ezra-obiwale/dSCore | src/Stdlib/Email.php | Email.setHTML | public function setHTML($content, array $options = array()) {
$this->html = $content;
$this->htmlCharset = (isset($options['charset'])) ? $options['charset'] : 'utf-8';
if (@$options['autoSetText']) {
$this->setText(strip_tags($this->html), $this->htmlCharset);
}
retu... | php | public function setHTML($content, array $options = array()) {
$this->html = $content;
$this->htmlCharset = (isset($options['charset'])) ? $options['charset'] : 'utf-8';
if (@$options['autoSetText']) {
$this->setText(strip_tags($this->html), $this->htmlCharset);
}
retu... | [
"public",
"function",
"setHTML",
"(",
"$",
"content",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"html",
"=",
"$",
"content",
";",
"$",
"this",
"->",
"htmlCharset",
"=",
"(",
"isset",
"(",
"$",
"options",
"["... | Set html content
@param string $content
@param array $options Keys may include [(string) charset [= "utf-8"], (boolean) autoSetText]
@return \Email | [
"Set",
"html",
"content"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Email.php#L74-L81 | train |
ezra-obiwale/dSCore | src/Stdlib/Email.php | Email.setText | public function setText($content, $charset = 'utf-8') {
$this->text = $content;
$this->textCharset = $charset;
return $this;
} | php | public function setText($content, $charset = 'utf-8') {
$this->text = $content;
$this->textCharset = $charset;
return $this;
} | [
"public",
"function",
"setText",
"(",
"$",
"content",
",",
"$",
"charset",
"=",
"'utf-8'",
")",
"{",
"$",
"this",
"->",
"text",
"=",
"$",
"content",
";",
"$",
"this",
"->",
"textCharset",
"=",
"$",
"charset",
";",
"return",
"$",
"this",
";",
"}"
] | Set text content
@param string $content
@return \Email | [
"Set",
"text",
"content"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Email.php#L88-L92 | train |
ezra-obiwale/dSCore | src/Stdlib/Email.php | Email.addBcc | public function addBcc($bcc) {
$this->bcc = (!empty($this->bcc)) ? $this->bcc . ',' . $bcc : $bcc;
return $this;
} | php | public function addBcc($bcc) {
$this->bcc = (!empty($this->bcc)) ? $this->bcc . ',' . $bcc : $bcc;
return $this;
} | [
"public",
"function",
"addBcc",
"(",
"$",
"bcc",
")",
"{",
"$",
"this",
"->",
"bcc",
"=",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"bcc",
")",
")",
"?",
"$",
"this",
"->",
"bcc",
".",
"','",
".",
"$",
"bcc",
":",
"$",
"bcc",
";",
"return",
... | Adds a best carbon copy
@param string $bcc Email address to send to
@return \Email | [
"Adds",
"a",
"best",
"carbon",
"copy"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Email.php#L200-L203 | train |
wearenolte/wp-acf | src/Acf.php | Acf.get_post_field | public static function get_post_field( $post_id = 0, $include_wp_fields = true, $field = '' ) {
if ( $include_wp_fields && ! $field ) {
$wp_fields = [
'post_id' => $post_id,
'permalink' => get_permalink( $post_id ),
'title' => get_the_title( $post_id ),
'content' => apply_filters( 'the_content', ge... | php | public static function get_post_field( $post_id = 0, $include_wp_fields = true, $field = '' ) {
if ( $include_wp_fields && ! $field ) {
$wp_fields = [
'post_id' => $post_id,
'permalink' => get_permalink( $post_id ),
'title' => get_the_title( $post_id ),
'content' => apply_filters( 'the_content', ge... | [
"public",
"static",
"function",
"get_post_field",
"(",
"$",
"post_id",
"=",
"0",
",",
"$",
"include_wp_fields",
"=",
"true",
",",
"$",
"field",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"include_wp_fields",
"&&",
"!",
"$",
"field",
")",
"{",
"$",
"wp_fields... | Get the field value for a post.
@param int $post_id The target post's id. Or leave blank for he current post if in the loop.
@param bool $include_wp_fields Whether or not to include the default WP fields.
@param string $field The ACF field id or name. Return all fields if blank.
@return array | [
"Get",
"the",
"field",
"value",
"for",
"a",
"post",
"."
] | 2f5093438d637fa0eca42ad6d10f6b433ec078b2 | https://github.com/wearenolte/wp-acf/blob/2f5093438d637fa0eca42ad6d10f6b433ec078b2/src/Acf.php#L26-L37 | train |
wearenolte/wp-acf | src/Acf.php | Acf.get_taxonomy_field | public static function get_taxonomy_field( $taxonomy_term, $field = '' ) {
if ( is_a( $taxonomy_term, 'WP_Term' ) ) {
return self::get_field( $taxonomy_term, $field );
} elseif ( is_array( $taxonomy_term ) && count( $taxonomy_term ) >= 2 ) {
return self::get_field( "{$taxonomy_term[0]}_{$taxonomy_term[1]}", $... | php | public static function get_taxonomy_field( $taxonomy_term, $field = '' ) {
if ( is_a( $taxonomy_term, 'WP_Term' ) ) {
return self::get_field( $taxonomy_term, $field );
} elseif ( is_array( $taxonomy_term ) && count( $taxonomy_term ) >= 2 ) {
return self::get_field( "{$taxonomy_term[0]}_{$taxonomy_term[1]}", $... | [
"public",
"static",
"function",
"get_taxonomy_field",
"(",
"$",
"taxonomy_term",
",",
"$",
"field",
"=",
"''",
")",
"{",
"if",
"(",
"is_a",
"(",
"$",
"taxonomy_term",
",",
"'WP_Term'",
")",
")",
"{",
"return",
"self",
"::",
"get_field",
"(",
"$",
"taxono... | Get the fields for a taxonomy term.
@param array|\WP_Term $taxonomy_term The target term's [taxonomy, $term_id] or term object.
@param string $field The ACF field id or name. Return all fields if blank.
@return mixed
@throws \Exception | [
"Get",
"the",
"fields",
"for",
"a",
"taxonomy",
"term",
"."
] | 2f5093438d637fa0eca42ad6d10f6b433ec078b2 | https://github.com/wearenolte/wp-acf/blob/2f5093438d637fa0eca42ad6d10f6b433ec078b2/src/Acf.php#L69-L76 | train |
wearenolte/wp-acf | src/Acf.php | Acf.get_field | private static function get_field( $target_id = 0, $field = '' ) {
if ( self::is_active() ) {
if ( $field ) {
return self::get_single_field( $target_id, $field );
} else {
return self::get_all_fields( $target_id );
}
}
return $field ? null : [];
} | php | private static function get_field( $target_id = 0, $field = '' ) {
if ( self::is_active() ) {
if ( $field ) {
return self::get_single_field( $target_id, $field );
} else {
return self::get_all_fields( $target_id );
}
}
return $field ? null : [];
} | [
"private",
"static",
"function",
"get_field",
"(",
"$",
"target_id",
"=",
"0",
",",
"$",
"field",
"=",
"''",
")",
"{",
"if",
"(",
"self",
"::",
"is_active",
"(",
")",
")",
"{",
"if",
"(",
"$",
"field",
")",
"{",
"return",
"self",
"::",
"get_single_... | Get all field values.
@param int $target_id The target object's id.
@param string $field The ACF field id or name. Return all fields if blank.
@return array | [
"Get",
"all",
"field",
"values",
"."
] | 2f5093438d637fa0eca42ad6d10f6b433ec078b2 | https://github.com/wearenolte/wp-acf/blob/2f5093438d637fa0eca42ad6d10f6b433ec078b2/src/Acf.php#L117-L126 | train |
wearenolte/wp-acf | src/Acf.php | Acf.get_all_fields | private static function get_all_fields( $target_id = 0 ) {
$data = [];
$field_objs = get_field_objects( $target_id );
if ( $field_objs ) {
foreach ( $field_objs as $field_name => $field_obj ) {
$value = self::get_single_field( $target_id, $field_obj );
$group_slug = self::get_group_slug( $field_obj[... | php | private static function get_all_fields( $target_id = 0 ) {
$data = [];
$field_objs = get_field_objects( $target_id );
if ( $field_objs ) {
foreach ( $field_objs as $field_name => $field_obj ) {
$value = self::get_single_field( $target_id, $field_obj );
$group_slug = self::get_group_slug( $field_obj[... | [
"private",
"static",
"function",
"get_all_fields",
"(",
"$",
"target_id",
"=",
"0",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"field_objs",
"=",
"get_field_objects",
"(",
"$",
"target_id",
")",
";",
"if",
"(",
"$",
"field_objs",
")",
"{",
"foreac... | Get all the fields for the target object.
@param int $target_id The id of the target object.
@return array | [
"Get",
"all",
"the",
"fields",
"for",
"the",
"target",
"object",
"."
] | 2f5093438d637fa0eca42ad6d10f6b433ec078b2 | https://github.com/wearenolte/wp-acf/blob/2f5093438d637fa0eca42ad6d10f6b433ec078b2/src/Acf.php#L134-L154 | train |
wearenolte/wp-acf | src/Acf.php | Acf.get_single_field | private static function get_single_field( $target_id = 0, $field = '' ) {
$field_obj = is_array( $field ) ? $field : get_field_object( $field, $target_id );
$field_key = isset( $field_obj['key'] ) ? $field_obj['key'] : '';
$filter_name = Filter::create_name( Filter::DEFAULT_TRANSFORMS, $field_key );
$apply_d... | php | private static function get_single_field( $target_id = 0, $field = '' ) {
$field_obj = is_array( $field ) ? $field : get_field_object( $field, $target_id );
$field_key = isset( $field_obj['key'] ) ? $field_obj['key'] : '';
$filter_name = Filter::create_name( Filter::DEFAULT_TRANSFORMS, $field_key );
$apply_d... | [
"private",
"static",
"function",
"get_single_field",
"(",
"$",
"target_id",
"=",
"0",
",",
"$",
"field",
"=",
"''",
")",
"{",
"$",
"field_obj",
"=",
"is_array",
"(",
"$",
"field",
")",
"?",
"$",
"field",
":",
"get_field_object",
"(",
"$",
"field",
",",... | Gat a single field value for a target object.
@param int $target_id The id of the target object.
@param string $field The field id or name.
@return mixed | [
"Gat",
"a",
"single",
"field",
"value",
"for",
"a",
"target",
"object",
"."
] | 2f5093438d637fa0eca42ad6d10f6b433ec078b2 | https://github.com/wearenolte/wp-acf/blob/2f5093438d637fa0eca42ad6d10f6b433ec078b2/src/Acf.php#L163-L175 | train |
wearenolte/wp-acf | src/Acf.php | Acf.get_group_slug | private static function get_group_slug( $group_id ) {
global $acf_local;
if ( isset( $acf_local->groups[ $group_id ] ) ) {
// First try the local groups (added by PHP).
$title = $acf_local->groups[ $group_id ]['title'];
} else {
$title = '';
if ( is_numeric( $group_id ) ) {
$args = [
'post_... | php | private static function get_group_slug( $group_id ) {
global $acf_local;
if ( isset( $acf_local->groups[ $group_id ] ) ) {
// First try the local groups (added by PHP).
$title = $acf_local->groups[ $group_id ]['title'];
} else {
$title = '';
if ( is_numeric( $group_id ) ) {
$args = [
'post_... | [
"private",
"static",
"function",
"get_group_slug",
"(",
"$",
"group_id",
")",
"{",
"global",
"$",
"acf_local",
";",
"if",
"(",
"isset",
"(",
"$",
"acf_local",
"->",
"groups",
"[",
"$",
"group_id",
"]",
")",
")",
"{",
"// First try the local groups (added by PH... | Get an ACF group slug
@param $group_id
@return string|bool | [
"Get",
"an",
"ACF",
"group",
"slug"
] | 2f5093438d637fa0eca42ad6d10f6b433ec078b2 | https://github.com/wearenolte/wp-acf/blob/2f5093438d637fa0eca42ad6d10f6b433ec078b2/src/Acf.php#L211-L250 | train |
Vectrex/vxPHP | src/Form/FormElement/FileInputElement.php | FileInputElement.getValue | public function getValue()
{
$file = $this->getFile();
if($file instanceof UploadedFile) {
return $file->getOriginalName();
}
if(is_array($file) && $file[0] instanceof UploadedFile) {
return $file[0]->getOriginalName();
}
return null;
} | php | public function getValue()
{
$file = $this->getFile();
if($file instanceof UploadedFile) {
return $file->getOriginalName();
}
if(is_array($file) && $file[0] instanceof UploadedFile) {
return $file[0]->getOriginalName();
}
return null;
} | [
"public",
"function",
"getValue",
"(",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"getFile",
"(",
")",
";",
"if",
"(",
"$",
"file",
"instanceof",
"UploadedFile",
")",
"{",
"return",
"$",
"file",
"->",
"getOriginalName",
"(",
")",
";",
"}",
"if",
... | get original name of an uploaded file associated with this element
if attribute multiple is set the name of the first file is returned
@return string | [
"get",
"original",
"name",
"of",
"an",
"uploaded",
"file",
"associated",
"with",
"this",
"element",
"if",
"attribute",
"multiple",
"is",
"set",
"the",
"name",
"of",
"the",
"first",
"file",
"is",
"returned"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/FormElement/FileInputElement.php#L44-L57 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/NonceFilterer.php | NonceFilterer.nonce | protected function nonce()
{
$action = ($this->getParameter('action') == null) ?
$this->RequestContext->getControls()->getControl('action')
: $this->getParameter('action');
return $this->Nonces->create($action);
} | php | protected function nonce()
{
$action = ($this->getParameter('action') == null) ?
$this->RequestContext->getControls()->getControl('action')
: $this->getParameter('action');
return $this->Nonces->create($action);
} | [
"protected",
"function",
"nonce",
"(",
")",
"{",
"$",
"action",
"=",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'action'",
")",
"==",
"null",
")",
"?",
"$",
"this",
"->",
"RequestContext",
"->",
"getControls",
"(",
")",
"->",
"getControl",
"(",
"'ac... | Creates a nonce for the current or specified action
Expected Param:
action string (optional) The action that the nonce will be valid for.
If not specified, the current action will be used
@return string | [
"Creates",
"a",
"nonce",
"for",
"the",
"current",
"or",
"specified",
"action"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/NonceFilterer.php#L50-L57 | train |
flipbox/spark | src/services/traits/ElementByString.php | ElementByString.findCacheByString | public function findCacheByString(string $string, int $siteId = null)
{
// Check if already in cache
if ($this->isCachedByString($string, $siteId)) {
return $this->cacheByString[$siteId][$string];
}
return null;
} | php | public function findCacheByString(string $string, int $siteId = null)
{
// Check if already in cache
if ($this->isCachedByString($string, $siteId)) {
return $this->cacheByString[$siteId][$string];
}
return null;
} | [
"public",
"function",
"findCacheByString",
"(",
"string",
"$",
"string",
",",
"int",
"$",
"siteId",
"=",
"null",
")",
"{",
"// Check if already in cache",
"if",
"(",
"$",
"this",
"->",
"isCachedByString",
"(",
"$",
"string",
",",
"$",
"siteId",
")",
")",
"... | Find an existing cache by Handle
@param string $string
@param int|null $siteId
@return BaseElement|ElementInterface|null | [
"Find",
"an",
"existing",
"cache",
"by",
"Handle"
] | 9d75fd3d95744b9c9187921c4f3b9eea42c035d4 | https://github.com/flipbox/spark/blob/9d75fd3d95744b9c9187921c4f3b9eea42c035d4/src/services/traits/ElementByString.php#L125-L134 | train |
flipbox/spark | src/services/traits/ElementByString.php | ElementByString.isCachedByString | protected function isCachedByString($string, int $siteId = null)
{
// Resolve siteId
$siteId = SiteHelper::resolveSiteId($siteId);
if (!isset($this->cacheByString[$siteId])) {
$this->cacheByString[$siteId] = [];
}
return array_key_exists($string, $this->cacheBy... | php | protected function isCachedByString($string, int $siteId = null)
{
// Resolve siteId
$siteId = SiteHelper::resolveSiteId($siteId);
if (!isset($this->cacheByString[$siteId])) {
$this->cacheByString[$siteId] = [];
}
return array_key_exists($string, $this->cacheBy... | [
"protected",
"function",
"isCachedByString",
"(",
"$",
"string",
",",
"int",
"$",
"siteId",
"=",
"null",
")",
"{",
"// Resolve siteId",
"$",
"siteId",
"=",
"SiteHelper",
"::",
"resolveSiteId",
"(",
"$",
"siteId",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"... | Identify whether in cached by string
@param $string
@param int|null $siteId
@return bool | [
"Identify",
"whether",
"in",
"cached",
"by",
"string"
] | 9d75fd3d95744b9c9187921c4f3b9eea42c035d4 | https://github.com/flipbox/spark/blob/9d75fd3d95744b9c9187921c4f3b9eea42c035d4/src/services/traits/ElementByString.php#L143-L154 | train |
maddoger/yii2-datetime-behavior | DateTimeAttribute.php | DateTimeAttribute.parseDateValue | protected static function parseDateValue($value, $format, $timeZone)
{
$date = DateTime::createFromFormat($format, $value, new DateTimeZone($timeZone));
$errors = DateTime::getLastErrors();
if ($date === false || $errors['error_count'] || $errors['warning_count']) {
return false;... | php | protected static function parseDateValue($value, $format, $timeZone)
{
$date = DateTime::createFromFormat($format, $value, new DateTimeZone($timeZone));
$errors = DateTime::getLastErrors();
if ($date === false || $errors['error_count'] || $errors['warning_count']) {
return false;... | [
"protected",
"static",
"function",
"parseDateValue",
"(",
"$",
"value",
",",
"$",
"format",
",",
"$",
"timeZone",
")",
"{",
"$",
"date",
"=",
"DateTime",
"::",
"createFromFormat",
"(",
"$",
"format",
",",
"$",
"value",
",",
"new",
"DateTimeZone",
"(",
"$... | Parses date string into DateTime object
@param string $value string representing date
@param string $format string representing date
@param string $timeZone string representing date
@return boolean|DateTime DateTime object or false on failure | [
"Parses",
"date",
"string",
"into",
"DateTime",
"object"
] | 3fd04ab1b2c3b10e620ae4c7971e3d9ef8084db3 | https://github.com/maddoger/yii2-datetime-behavior/blob/3fd04ab1b2c3b10e620ae4c7971e3d9ef8084db3/DateTimeAttribute.php#L145-L158 | train |
Eden-PHP/Registry | src/Index.php | Index.remove | public function remove()
{
$args = func_get_args();
if (count($args) == 0) {
return $this;
}
$last = array_pop($args);
$pointer = &$this->data;
foreach ($args as $i => $step) {
if (!isset($pointer[$step])
... | php | public function remove()
{
$args = func_get_args();
if (count($args) == 0) {
return $this;
}
$last = array_pop($args);
$pointer = &$this->data;
foreach ($args as $i => $step) {
if (!isset($pointer[$step])
... | [
"public",
"function",
"remove",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"args",
")",
"==",
"0",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"last",
"=",
"array_pop",
"(",
"$",
"args",
"... | Removes a key and everything associated with it
@return Eden\Registry\Index | [
"Removes",
"a",
"key",
"and",
"everything",
"associated",
"with",
"it"
] | 4ec72e314a65372fdf30b6dff772db6ff21dd11a | https://github.com/Eden-PHP/Registry/blob/4ec72e314a65372fdf30b6dff772db6ff21dd11a/src/Index.php#L158-L182 | train |
zodream/database | src/Model/Model.php | Model.findOrDefault | public static function findOrDefault($param, array $attributes) {
$model = self::findOrNew($param);
if ($model->isNewRecord) {
$model->set($attributes);
}
return $model;
} | php | public static function findOrDefault($param, array $attributes) {
$model = self::findOrNew($param);
if ($model->isNewRecord) {
$model->set($attributes);
}
return $model;
} | [
"public",
"static",
"function",
"findOrDefault",
"(",
"$",
"param",
",",
"array",
"$",
"attributes",
")",
"{",
"$",
"model",
"=",
"self",
"::",
"findOrNew",
"(",
"$",
"param",
")",
";",
"if",
"(",
"$",
"model",
"->",
"isNewRecord",
")",
"{",
"$",
"mo... | Set not found default data
@param $param
@param array $attributes
@return bool|Model
@throws \Exception | [
"Set",
"not",
"found",
"default",
"data"
] | 03712219c057799d07350a3a2650c55bcc92c28e | https://github.com/zodream/database/blob/03712219c057799d07350a3a2650c55bcc92c28e/src/Model/Model.php#L195-L201 | train |
zodream/database | src/Model/Model.php | Model.findWithReplace | public static function findWithReplace($param, array $attributes) {
$model = self::findOrNew($param);
$model->set($attributes);
return $model;
} | php | public static function findWithReplace($param, array $attributes) {
$model = self::findOrNew($param);
$model->set($attributes);
return $model;
} | [
"public",
"static",
"function",
"findWithReplace",
"(",
"$",
"param",
",",
"array",
"$",
"attributes",
")",
"{",
"$",
"model",
"=",
"self",
"::",
"findOrNew",
"(",
"$",
"param",
")",
";",
"$",
"model",
"->",
"set",
"(",
"$",
"attributes",
")",
";",
"... | Set new attr
@param $param
@param array $attributes
@return bool|Model
@throws \Exception | [
"Set",
"new",
"attr"
] | 03712219c057799d07350a3a2650c55bcc92c28e | https://github.com/zodream/database/blob/03712219c057799d07350a3a2650c55bcc92c28e/src/Model/Model.php#L210-L214 | train |
stubbles/stubbles-peer | src/main/php/Stream.php | Stream.setTimeout | public function setTimeout(int $seconds, int $microseconds = 0): self
{
$this->timeout = (float) ($seconds . '.' . $microseconds);
stream_set_timeout($this->resource, $seconds, $microseconds);
return $this;
} | php | public function setTimeout(int $seconds, int $microseconds = 0): self
{
$this->timeout = (float) ($seconds . '.' . $microseconds);
stream_set_timeout($this->resource, $seconds, $microseconds);
return $this;
} | [
"public",
"function",
"setTimeout",
"(",
"int",
"$",
"seconds",
",",
"int",
"$",
"microseconds",
"=",
"0",
")",
":",
"self",
"{",
"$",
"this",
"->",
"timeout",
"=",
"(",
"float",
")",
"(",
"$",
"seconds",
".",
"'.'",
".",
"$",
"microseconds",
")",
... | set timeout for connections
@param int $seconds timeout for connection in seconds
@param int $microseconds optional timeout for connection in microseconds
@return $this | [
"set",
"timeout",
"for",
"connections"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/Stream.php#L96-L101 | train |
stubbles/stubbles-peer | src/main/php/Stream.php | Stream.read | public function read(int $length = null): string
{
// can not call fgets with null when not specified
$data = null === $length ? fgets($this->resource) : fgets($this->resource, $length);
if (false === $data) {
// fgets() returns false on eof while feof() returned false before
... | php | public function read(int $length = null): string
{
// can not call fgets with null when not specified
$data = null === $length ? fgets($this->resource) : fgets($this->resource, $length);
if (false === $data) {
// fgets() returns false on eof while feof() returned false before
... | [
"public",
"function",
"read",
"(",
"int",
"$",
"length",
"=",
"null",
")",
":",
"string",
"{",
"// can not call fgets with null when not specified",
"$",
"data",
"=",
"null",
"===",
"$",
"length",
"?",
"fgets",
"(",
"$",
"this",
"->",
"resource",
")",
":",
... | read from socket
@param int $length optional length of data to read
@return string data read from socket
@throws \stubbles\peer\ConnectionFailure
@throws \stubbles\peer\Timeout | [
"read",
"from",
"socket"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/Stream.php#L121-L145 | train |
stubbles/stubbles-peer | src/main/php/Stream.php | Stream.readBinary | public function readBinary(int $length = 1024): string
{
$data = fread($this->resource, $length);
if (false === $data) {
if (stream_get_meta_data($this->resource)['timed_out']) {
throw new Timeout(
'Reading of ' . $length . ' bytes failed: timeout ... | php | public function readBinary(int $length = 1024): string
{
$data = fread($this->resource, $length);
if (false === $data) {
if (stream_get_meta_data($this->resource)['timed_out']) {
throw new Timeout(
'Reading of ' . $length . ' bytes failed: timeout ... | [
"public",
"function",
"readBinary",
"(",
"int",
"$",
"length",
"=",
"1024",
")",
":",
"string",
"{",
"$",
"data",
"=",
"fread",
"(",
"$",
"this",
"->",
"resource",
",",
"$",
"length",
")",
";",
"if",
"(",
"false",
"===",
"$",
"data",
")",
"{",
"i... | read binary data from socket
@param int $length length of data to read
@return string data read from socket
@throws \stubbles\peer\ConnectionFailure
@throws \stubbles\peer\Timeout | [
"read",
"binary",
"data",
"from",
"socket"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/Stream.php#L165-L182 | train |
stubbles/stubbles-peer | src/main/php/Stream.php | Stream.write | public function write(string $data): int
{
$length = fputs($this->resource, $data, strlen($data));
if (false === $length) {
if (stream_get_meta_data($this->resource)['timed_out']) {
throw new Timeout(
'Writing of ' . strlen($data) . ' bytes failed:... | php | public function write(string $data): int
{
$length = fputs($this->resource, $data, strlen($data));
if (false === $length) {
if (stream_get_meta_data($this->resource)['timed_out']) {
throw new Timeout(
'Writing of ' . strlen($data) . ' bytes failed:... | [
"public",
"function",
"write",
"(",
"string",
"$",
"data",
")",
":",
"int",
"{",
"$",
"length",
"=",
"fputs",
"(",
"$",
"this",
"->",
"resource",
",",
"$",
"data",
",",
"strlen",
"(",
"$",
"data",
")",
")",
";",
"if",
"(",
"false",
"===",
"$",
... | write data to socket
@param string $data data to write
@return int amount of bytes written to socket
@throws \stubbles\peer\ConnectionFailure
@throws \stubbles\peer\Timeout | [
"write",
"data",
"to",
"socket"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/Stream.php#L192-L209 | train |
sil-project/VarietyBundle | src/Controller/VarietyCRUDController.php | VarietyCRUDController.strainAction | public function strainAction()
{
$id = $this->getRequest()->get($this->admin->getIdParameter());
$object = $this->admin->getObject($id);
$strain = clone $object;
$strain->setIsStrain(true);
$strain->setParent($object);
$fieldSets = ['Professional', 'Amateur', 'Produ... | php | public function strainAction()
{
$id = $this->getRequest()->get($this->admin->getIdParameter());
$object = $this->admin->getObject($id);
$strain = clone $object;
$strain->setIsStrain(true);
$strain->setParent($object);
$fieldSets = ['Professional', 'Amateur', 'Produ... | [
"public",
"function",
"strainAction",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"get",
"(",
"$",
"this",
"->",
"admin",
"->",
"getIdParameter",
"(",
")",
")",
";",
"$",
"object",
"=",
"$",
"this",
"->",
"admin"... | Creates a strain from a variety and passes it to create action.
@return Response | [
"Creates",
"a",
"strain",
"from",
"a",
"variety",
"and",
"passes",
"it",
"to",
"create",
"action",
"."
] | e9508ce13a4bb277d10bdcd925fdb84bc01f453f | https://github.com/sil-project/VarietyBundle/blob/e9508ce13a4bb277d10bdcd925fdb84bc01f453f/src/Controller/VarietyCRUDController.php#L52-L82 | train |
sil-project/VarietyBundle | src/Controller/VarietyCRUDController.php | VarietyCRUDController.getFilterWidgetAction | public function getFilterWidgetAction(Request $request)
{
$translator = $this->get('translator');
$fieldSet = $request->get('fieldset');
$field = $request->get('field');
$config = $this->admin->getConfigurationPool()->getContainer()->getParameter('librinfo_varieties');
$fiel... | php | public function getFilterWidgetAction(Request $request)
{
$translator = $this->get('translator');
$fieldSet = $request->get('fieldset');
$field = $request->get('field');
$config = $this->admin->getConfigurationPool()->getContainer()->getParameter('librinfo_varieties');
$fiel... | [
"public",
"function",
"getFilterWidgetAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"translator",
"=",
"$",
"this",
"->",
"get",
"(",
"'translator'",
")",
";",
"$",
"fieldSet",
"=",
"$",
"request",
"->",
"get",
"(",
"'fieldset'",
")",
";",
"$",... | Get field widget for filter form.
@param string $fieldName the name of the field to get the form widget for
@return JsonResponse | [
"Get",
"field",
"widget",
"for",
"filter",
"form",
"."
] | e9508ce13a4bb277d10bdcd925fdb84bc01f453f | https://github.com/sil-project/VarietyBundle/blob/e9508ce13a4bb277d10bdcd925fdb84bc01f453f/src/Controller/VarietyCRUDController.php#L91-L155 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/errors/ErrorHandler.php | ErrorHandler.handleErrors | public function handleErrors($severity, $message, $filepath, $line)
{
if (error_reporting() == 0 || $severity == E_STRICT)
return;
if (false !== strpos($filepath, '/')) {
$x = explode('/', $filepath);
$filepath = $x[count($x)-3].'/'.$x[count($x)-2].'/'.end($x);
... | php | public function handleErrors($severity, $message, $filepath, $line)
{
if (error_reporting() == 0 || $severity == E_STRICT)
return;
if (false !== strpos($filepath, '/')) {
$x = explode('/', $filepath);
$filepath = $x[count($x)-3].'/'.$x[count($x)-2].'/'.end($x);
... | [
"public",
"function",
"handleErrors",
"(",
"$",
"severity",
",",
"$",
"message",
",",
"$",
"filepath",
",",
"$",
"line",
")",
"{",
"if",
"(",
"error_reporting",
"(",
")",
"==",
"0",
"||",
"$",
"severity",
"==",
"E_STRICT",
")",
"return",
";",
"if",
"... | Defines the error handler that will be used when this class is created.
Using error_log, this function will record the error.
@param string $severity The severity of the error
@param string $message The error message
@param string $filepath The file where the error was encountered
@param string $line The line nu... | [
"Defines",
"the",
"error",
"handler",
"that",
"will",
"be",
"used",
"when",
"this",
"class",
"is",
"created",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/errors/ErrorHandler.php#L140-L179 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/errors/ErrorHandler.php | ErrorHandler.handleExceptions | public function handleExceptions($exception)
{
$this->displayError($exception);
$this->sendErrorNotification($exception);
if(isset($this->ApplicationContext) && ($this->ApplicationContext->isOneOffRedeploy() || $this->redeployOnError))
$this->ApplicationContext->clearContextFile... | php | public function handleExceptions($exception)
{
$this->displayError($exception);
$this->sendErrorNotification($exception);
if(isset($this->ApplicationContext) && ($this->ApplicationContext->isOneOffRedeploy() || $this->redeployOnError))
$this->ApplicationContext->clearContextFile... | [
"public",
"function",
"handleExceptions",
"(",
"$",
"exception",
")",
"{",
"$",
"this",
"->",
"displayError",
"(",
"$",
"exception",
")",
";",
"$",
"this",
"->",
"sendErrorNotification",
"(",
"$",
"exception",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"thi... | Defines the exception handler to use.
@param Exception $exception The exception to handle
@return void | [
"Defines",
"the",
"exception",
"handler",
"to",
"use",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/errors/ErrorHandler.php#L234-L241 | train |
translationexchange/tml-php-clientsdk | library/Tr8n/Utils/BrowserUtils.php | BrowserUtils.matchLanguage | public static function matchLanguage($a, $b) {
$a = explode('-', $a);
$b = explode('-', $b);
for ($i=0, $n=min(count($a), count($b)); $i<$n; $i++) {
if ($a[$i] !== $b[$i]) break;
}
return $i === 0 ? 0 : (float) $i / count($a);
} | php | public static function matchLanguage($a, $b) {
$a = explode('-', $a);
$b = explode('-', $b);
for ($i=0, $n=min(count($a), count($b)); $i<$n; $i++) {
if ($a[$i] !== $b[$i]) break;
}
return $i === 0 ? 0 : (float) $i / count($a);
} | [
"public",
"static",
"function",
"matchLanguage",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"$",
"a",
"=",
"explode",
"(",
"'-'",
",",
"$",
"a",
")",
";",
"$",
"b",
"=",
"explode",
"(",
"'-'",
",",
"$",
"b",
")",
";",
"for",
"(",
"$",
"i",
"="... | compare two language tags and distinguish the degree of matching | [
"compare",
"two",
"language",
"tags",
"and",
"distinguish",
"the",
"degree",
"of",
"matching"
] | fe51473824e62cfd883c6aa0c6a3783a16ce8425 | https://github.com/translationexchange/tml-php-clientsdk/blob/fe51473824e62cfd883c6aa0c6a3783a16ce8425/library/Tr8n/Utils/BrowserUtils.php#L69-L76 | train |
Beotie/Beotie-PSR7-stream | src/Stream/Factory/FileInfoStreamFactory.php | FileInfoStreamFactory.paramHasContent | protected function paramHasContent(array $params, string $method = 'getStream') : bool
{
if (!array_key_exists(self::ARRAY_KEY, $params)) {
throw new \RuntimeException(
sprintf(
'The "%s::%s" expect a file array key to build an instance of FileInfoStreamAdapte... | php | protected function paramHasContent(array $params, string $method = 'getStream') : bool
{
if (!array_key_exists(self::ARRAY_KEY, $params)) {
throw new \RuntimeException(
sprintf(
'The "%s::%s" expect a file array key to build an instance of FileInfoStreamAdapte... | [
"protected",
"function",
"paramHasContent",
"(",
"array",
"$",
"params",
",",
"string",
"$",
"method",
"=",
"'getStream'",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"self",
"::",
"ARRAY_KEY",
",",
"$",
"params",
")",
")",
"{",
"thro... | Param has content
This method aim to validate the existance of a 'inner_content' key into the parameters array.
@param array $params The original method parameters validated by the function
@param string $method The original method name. This parameter is used to build the exception message
@throws \RuntimeExceptio... | [
"Param",
"has",
"content"
] | 8f4f4bfb8252e392fc17eed2a2b0682c4e9d08ca | https://github.com/Beotie/Beotie-PSR7-stream/blob/8f4f4bfb8252e392fc17eed2a2b0682c4e9d08ca/src/Stream/Factory/FileInfoStreamFactory.php#L92-L105 | train |
Beotie/Beotie-PSR7-stream | src/Stream/Factory/FileInfoStreamFactory.php | FileInfoStreamFactory.contentIsFileInfo | protected function contentIsFileInfo($file, string $method = 'getStream') : bool
{
if (! $file instanceof \SplFileInfo) {
$message = 'The "%s::%s" expect the file array key to be an instance of "%s". "%s" given';
$givenType = (is_object($file) ? get_class($file) : gettype($file));
... | php | protected function contentIsFileInfo($file, string $method = 'getStream') : bool
{
if (! $file instanceof \SplFileInfo) {
$message = 'The "%s::%s" expect the file array key to be an instance of "%s". "%s" given';
$givenType = (is_object($file) ? get_class($file) : gettype($file));
... | [
"protected",
"function",
"contentIsFileInfo",
"(",
"$",
"file",
",",
"string",
"$",
"method",
"=",
"'getStream'",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"file",
"instanceof",
"\\",
"SplFileInfo",
")",
"{",
"$",
"message",
"=",
"'The \"%s::%s\" expect th... | Content is FileInfo
This method validate the instance of the given content parameter. This type is expected to be SplFileInfo.
@param mixed $file The file which the method aim to validate the type
@param string $method The original method name. This parameter is used to define the exception message
@throws \Runti... | [
"Content",
"is",
"FileInfo"
] | 8f4f4bfb8252e392fc17eed2a2b0682c4e9d08ca | https://github.com/Beotie/Beotie-PSR7-stream/blob/8f4f4bfb8252e392fc17eed2a2b0682c4e9d08ca/src/Stream/Factory/FileInfoStreamFactory.php#L118-L128 | train |
itcreator/custom-cmf | Module/Data/src/Cmf/Data/Filter/StripTags.php | StripTags._filterTag | protected function _filterTag($tag)
{
// Parse the tag into:
// 1. a starting delimiter (mandatory)
// 2. a tag name (if available)
// 3. a string of attributes (if available)
// 4. an ending delimiter (if available)
$isMatch = preg_match('~(</?)(\w*)((/(?!>)|[^/>])*)... | php | protected function _filterTag($tag)
{
// Parse the tag into:
// 1. a starting delimiter (mandatory)
// 2. a tag name (if available)
// 3. a string of attributes (if available)
// 4. an ending delimiter (if available)
$isMatch = preg_match('~(</?)(\w*)((/(?!>)|[^/>])*)... | [
"protected",
"function",
"_filterTag",
"(",
"$",
"tag",
")",
"{",
"// Parse the tag into:",
"// 1. a starting delimiter (mandatory)",
"// 2. a tag name (if available)",
"// 3. a string of attributes (if available)",
"// 4. an ending delimiter (if available)",
"$",
"isMatch",
"=",
"pr... | Filters a single tag against the current option settings
@param string $tag
@return string | [
"Filters",
"a",
"single",
"tag",
"against",
"the",
"current",
"option",
"settings"
] | 42fc0535dfa0f641856f06673f6ab596b2020c40 | https://github.com/itcreator/custom-cmf/blob/42fc0535dfa0f641856f06673f6ab596b2020c40/Module/Data/src/Cmf/Data/Filter/StripTags.php#L237-L295 | train |
phpguard/listen | src/PhpGuard/Listen/Adapter/BasicAdapter.php | BasicAdapter.initialize | public function initialize(Listener $listener)
{
$this->listener = $listener;
$this->topDirs = array_merge($this->topDirs,$listener->getPaths());
$this->tracker->initialize($listener);
} | php | public function initialize(Listener $listener)
{
$this->listener = $listener;
$this->topDirs = array_merge($this->topDirs,$listener->getPaths());
$this->tracker->initialize($listener);
} | [
"public",
"function",
"initialize",
"(",
"Listener",
"$",
"listener",
")",
"{",
"$",
"this",
"->",
"listener",
"=",
"$",
"listener",
";",
"$",
"this",
"->",
"topDirs",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"topDirs",
",",
"$",
"listener",
"->",
"... | Initialize a listener
@param Listener $listener
@return void | [
"Initialize",
"a",
"listener"
] | cd0cda150858d6d85deb025a72996873d2af3532 | https://github.com/phpguard/listen/blob/cd0cda150858d6d85deb025a72996873d2af3532/src/PhpGuard/Listen/Adapter/BasicAdapter.php#L46-L51 | train |
phpguard/listen | src/PhpGuard/Listen/Adapter/BasicAdapter.php | BasicAdapter.doCleanup | private function doCleanup($unchecked)
{
$tracker = $this->tracker;
/* @var \PhpGuard\Listen\Resource\TrackedObject $tracked */
foreach($unchecked as $id=>$tracked){
$origin = $tracked->getResource();
if(!$origin->isExists()){
$tracker->addChangeSet($t... | php | private function doCleanup($unchecked)
{
$tracker = $this->tracker;
/* @var \PhpGuard\Listen\Resource\TrackedObject $tracked */
foreach($unchecked as $id=>$tracked){
$origin = $tracked->getResource();
if(!$origin->isExists()){
$tracker->addChangeSet($t... | [
"private",
"function",
"doCleanup",
"(",
"$",
"unchecked",
")",
"{",
"$",
"tracker",
"=",
"$",
"this",
"->",
"tracker",
";",
"/* @var \\PhpGuard\\Listen\\Resource\\TrackedObject $tracked */",
"foreach",
"(",
"$",
"unchecked",
"as",
"$",
"id",
"=>",
"$",
"tracked",... | Track any undetected changes
such as recursive directory delete | [
"Track",
"any",
"undetected",
"changes",
"such",
"as",
"recursive",
"directory",
"delete"
] | cd0cda150858d6d85deb025a72996873d2af3532 | https://github.com/phpguard/listen/blob/cd0cda150858d6d85deb025a72996873d2af3532/src/PhpGuard/Listen/Adapter/BasicAdapter.php#L89-L101 | train |
shgysk8zer0/core_api | traits/http_auth.php | HTTP_Auth.authenticateBasic | final public function authenticateBasic($realm = null)
{
if (! (
array_key_exists('PHP_AUTH_USER', $_SERVER)
and array_key_exists('PHP_AUTH_PW', $_SERVER))
and ! empty($_SERVER['PHP_AUTH_USER'])
and ! empty($_SERER['PHP_AUTH_PW'])
) {
$this->HTTPAuthenticate('Basic', array('realm' => $realm));
re... | php | final public function authenticateBasic($realm = null)
{
if (! (
array_key_exists('PHP_AUTH_USER', $_SERVER)
and array_key_exists('PHP_AUTH_PW', $_SERVER))
and ! empty($_SERVER['PHP_AUTH_USER'])
and ! empty($_SERER['PHP_AUTH_PW'])
) {
$this->HTTPAuthenticate('Basic', array('realm' => $realm));
re... | [
"final",
"public",
"function",
"authenticateBasic",
"(",
"$",
"realm",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"array_key_exists",
"(",
"'PHP_AUTH_USER'",
",",
"$",
"_SERVER",
")",
"and",
"array_key_exists",
"(",
"'PHP_AUTH_PW'",
",",
"$",
"_SERVER",
")"... | Checks for credentials in HTTP headers for "Basic" authentication
@param string $realm
@return bool | [
"Checks",
"for",
"credentials",
"in",
"HTTP",
"headers",
"for",
"Basic",
"authentication"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/http_auth.php#L48-L63 | train |
ThomasSquall/PHPMagicAnnotations | src/Reflection/ReflectionBase.php | ReflectionBase.hasAnnotation | public function hasAnnotation($name)
{
$result = false;
if (!string_ends_with($name, 'Annotation')) $name .= 'Annotation';
foreach ($this->annotations as $annotation)
{
$class = get_class($annotation);
if (string_starts_with($class, "\\") && !string_starts_... | php | public function hasAnnotation($name)
{
$result = false;
if (!string_ends_with($name, 'Annotation')) $name .= 'Annotation';
foreach ($this->annotations as $annotation)
{
$class = get_class($annotation);
if (string_starts_with($class, "\\") && !string_starts_... | [
"public",
"function",
"hasAnnotation",
"(",
"$",
"name",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"!",
"string_ends_with",
"(",
"$",
"name",
",",
"'Annotation'",
")",
")",
"$",
"name",
".=",
"'Annotation'",
";",
"foreach",
"(",
"$",
"this... | Tells if the reflection object has the given annotation or not.
@param string $name
@return bool | [
"Tells",
"if",
"the",
"reflection",
"object",
"has",
"the",
"given",
"annotation",
"or",
"not",
"."
] | 3a733fa6e1ca9ebdfdfb7250f67e7aceb6a4c001 | https://github.com/ThomasSquall/PHPMagicAnnotations/blob/3a733fa6e1ca9ebdfdfb7250f67e7aceb6a4c001/src/Reflection/ReflectionBase.php#L20-L43 | train |
ThomasSquall/PHPMagicAnnotations | src/Reflection/ReflectionBase.php | ReflectionBase.getAnnotation | public function getAnnotation($name)
{
$result = null;
if ($this->hasAnnotationAndReturn($name))
{
if (!string_ends_with($name, 'Annotation')) $name .= 'Annotation';
$result = isset($this->annotations[$name]) ? $this->annotations[$name] : null;
if ($res... | php | public function getAnnotation($name)
{
$result = null;
if ($this->hasAnnotationAndReturn($name))
{
if (!string_ends_with($name, 'Annotation')) $name .= 'Annotation';
$result = isset($this->annotations[$name]) ? $this->annotations[$name] : null;
if ($res... | [
"public",
"function",
"getAnnotation",
"(",
"$",
"name",
")",
"{",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"hasAnnotationAndReturn",
"(",
"$",
"name",
")",
")",
"{",
"if",
"(",
"!",
"string_ends_with",
"(",
"$",
"name",
",",
"'... | Returns the requested annotation.
@param string $name
@return Annotation|null | [
"Returns",
"the",
"requested",
"annotation",
"."
] | 3a733fa6e1ca9ebdfdfb7250f67e7aceb6a4c001 | https://github.com/ThomasSquall/PHPMagicAnnotations/blob/3a733fa6e1ca9ebdfdfb7250f67e7aceb6a4c001/src/Reflection/ReflectionBase.php#L76-L100 | train |
native5/native5-sdk-client-php | src/Native5/Sessions/WebSessionManager.php | WebSessionManager.isActiveSession | public function isActiveSession()
{
// Check if session timeout is defined in application settings
$sessionConfig = $GLOBALS['app']->getConfiguration()->getRawConfiguration('session');
if (!empty($sessionConfig) && isset($sessionConfig['timeout']) && !empty($sessionConfig['timeout'])) {
... | php | public function isActiveSession()
{
// Check if session timeout is defined in application settings
$sessionConfig = $GLOBALS['app']->getConfiguration()->getRawConfiguration('session');
if (!empty($sessionConfig) && isset($sessionConfig['timeout']) && !empty($sessionConfig['timeout'])) {
... | [
"public",
"function",
"isActiveSession",
"(",
")",
"{",
"// Check if session timeout is defined in application settings",
"$",
"sessionConfig",
"=",
"$",
"GLOBALS",
"[",
"'app'",
"]",
"->",
"getConfiguration",
"(",
")",
"->",
"getRawConfiguration",
"(",
"'session'",
")"... | Checks if session is currently active.
@access public
@return boolean | [
"Checks",
"if",
"session",
"is",
"currently",
"active",
"."
] | e1f598cf27654d81bb5facace1990b737242a2f9 | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Sessions/WebSessionManager.php#L175-L193 | train |
native5/native5-sdk-client-php | src/Native5/Sessions/WebSessionManager.php | WebSessionManager.resetActiveSession | public static function resetActiveSession()
{
// Strip '.'
$appContext = rtrim($GLOBALS['app']->getConfiguration()->getApplicationContext(), '.');
if (empty($appContext)) {
$appContext = "/";
} else {
$appContext = "/".$appContext."/";
}
$cate... | php | public static function resetActiveSession()
{
// Strip '.'
$appContext = rtrim($GLOBALS['app']->getConfiguration()->getApplicationContext(), '.');
if (empty($appContext)) {
$appContext = "/";
} else {
$appContext = "/".$appContext."/";
}
$cate... | [
"public",
"static",
"function",
"resetActiveSession",
"(",
")",
"{",
"// Strip '.'",
"$",
"appContext",
"=",
"rtrim",
"(",
"$",
"GLOBALS",
"[",
"'app'",
"]",
"->",
"getConfiguration",
"(",
")",
"->",
"getApplicationContext",
"(",
")",
",",
"'.'",
")",
";",
... | Resets currently active session.
@access public
@return void | [
"Resets",
"currently",
"active",
"session",
"."
] | e1f598cf27654d81bb5facace1990b737242a2f9 | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Sessions/WebSessionManager.php#L202-L225 | train |
MindyPHP/QueryBuilder | Database/Pgsql/Adapter.php | Adapter.sqlCheckIntegrity | public function sqlCheckIntegrity($check = true, $schema = '', $table = '')
{
if (empty($schema) && empty($table)) {
return 'SET CONSTRAINTS ALL '.($check ? 'IMMEDIATE' : 'DEFERRED');
}
return sprintf(
'ALTER TABLE %s.%s %s TRIGGER ALL',
$this->ge... | php | public function sqlCheckIntegrity($check = true, $schema = '', $table = '')
{
if (empty($schema) && empty($table)) {
return 'SET CONSTRAINTS ALL '.($check ? 'IMMEDIATE' : 'DEFERRED');
}
return sprintf(
'ALTER TABLE %s.%s %s TRIGGER ALL',
$this->ge... | [
"public",
"function",
"sqlCheckIntegrity",
"(",
"$",
"check",
"=",
"true",
",",
"$",
"schema",
"=",
"''",
",",
"$",
"table",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"schema",
")",
"&&",
"empty",
"(",
"$",
"table",
")",
")",
"{",
"retur... | Builds a SQL statement for enabling or disabling integrity check.
@param bool $check whether to turn on or off the integrity check
@param string $schema the schema of the tables
@param string $table the table name
@return string the SQL statement for checking integrity | [
"Builds",
"a",
"SQL",
"statement",
"for",
"enabling",
"or",
"disabling",
"integrity",
"check",
"."
] | fc486454786f3d38887dd7246802ea11e2954e54 | https://github.com/MindyPHP/QueryBuilder/blob/fc486454786f3d38887dd7246802ea11e2954e54/Database/Pgsql/Adapter.php#L28-L40 | train |
linpax/microphp-framework | src/web/Identity.php | Identity.addCookie | public function addCookie(
$name,
$value,
$expire = 0,
$path = '/',
$domain = '',
$secure = false,
$httpOnly = true
) {
return (new CookieInjector)->build()->set($name, $value, $expire, $path, $domain, $secure, $httpOnly);
} | php | public function addCookie(
$name,
$value,
$expire = 0,
$path = '/',
$domain = '',
$secure = false,
$httpOnly = true
) {
return (new CookieInjector)->build()->set($name, $value, $expire, $path, $domain, $secure, $httpOnly);
} | [
"public",
"function",
"addCookie",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"expire",
"=",
"0",
",",
"$",
"path",
"=",
"'/'",
",",
"$",
"domain",
"=",
"''",
",",
"$",
"secure",
"=",
"false",
",",
"$",
"httpOnly",
"=",
"true",
")",
"{",
"r... | Add data into cookie
@access public
@param string $name cookie name
@param mixed $value data value
@param int $expire life time
@param string $path path access cookie
@param string $domain domain access cookie
@param bool $secure use SSL?
@param bool $httpOnly disable on JS?
@return mixed
@throws Exception | [
"Add",
"data",
"into",
"cookie"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/web/Identity.php#L89-L99 | train |
pryley/castor-framework | src/Forms/Fields/Base.php | Base.generateDescription | public function generateDescription( $paragraph = true )
{
if( !isset( $this->args['desc'] ) || !$this->args['desc'] )return;
$tag = ( !!$paragraph || $paragraph == 'p' ) ? 'p' : 'span';
return sprintf( '<%1$s class="description">%2$s</%1$s>', $tag, $this->args['desc'] );
} | php | public function generateDescription( $paragraph = true )
{
if( !isset( $this->args['desc'] ) || !$this->args['desc'] )return;
$tag = ( !!$paragraph || $paragraph == 'p' ) ? 'p' : 'span';
return sprintf( '<%1$s class="description">%2$s</%1$s>', $tag, $this->args['desc'] );
} | [
"public",
"function",
"generateDescription",
"(",
"$",
"paragraph",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"args",
"[",
"'desc'",
"]",
")",
"||",
"!",
"$",
"this",
"->",
"args",
"[",
"'desc'",
"]",
")",
"return",
";... | Generate the field description
@param bool $paragraph
@return null|string | [
"Generate",
"the",
"field",
"description"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Fields/Base.php#L72-L79 | train |
pryley/castor-framework | src/Forms/Fields/Base.php | Base.implodeOptions | protected function implodeOptions( $method = 'select_option', $default = null )
{
$this->args['default'] ?: $this->args['default'] = $default;
$method = $this->camelCase( $method );
$method = method_exists( $this, $method )
? $method
: 'selectOption';
$i = 0;
if( $method === 'singleInput' ) {
i... | php | protected function implodeOptions( $method = 'select_option', $default = null )
{
$this->args['default'] ?: $this->args['default'] = $default;
$method = $this->camelCase( $method );
$method = method_exists( $this, $method )
? $method
: 'selectOption';
$i = 0;
if( $method === 'singleInput' ) {
i... | [
"protected",
"function",
"implodeOptions",
"(",
"$",
"method",
"=",
"'select_option'",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"args",
"[",
"'default'",
"]",
"?",
":",
"$",
"this",
"->",
"args",
"[",
"'default'",
"]",
"=",
"$",
... | Implode multi-field items
@return null|string | [
"Implode",
"multi",
"-",
"field",
"items"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Fields/Base.php#L133-L161 | train |
pryley/castor-framework | src/Forms/Fields/Base.php | Base.normalize | protected function normalize( array $defaults = [], $implode = false )
{
$args = $this->mergeAttributesWith( $defaults );
$normalize = new Normalizer;
return ( $this->element && method_exists( $normalize, $this->element ))
? $normalize->{$this->element}( $args, $implode )
: ( !!$implode ? '' : [] );
} | php | protected function normalize( array $defaults = [], $implode = false )
{
$args = $this->mergeAttributesWith( $defaults );
$normalize = new Normalizer;
return ( $this->element && method_exists( $normalize, $this->element ))
? $normalize->{$this->element}( $args, $implode )
: ( !!$implode ? '' : [] );
} | [
"protected",
"function",
"normalize",
"(",
"array",
"$",
"defaults",
"=",
"[",
"]",
",",
"$",
"implode",
"=",
"false",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"mergeAttributesWith",
"(",
"$",
"defaults",
")",
";",
"$",
"normalize",
"=",
"new",
... | Normalize attributes for this specific field type
@param bool|string $implode
@return array|string | [
"Normalize",
"attributes",
"for",
"this",
"specific",
"field",
"type"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Fields/Base.php#L170-L179 | train |
pryley/castor-framework | src/Forms/Fields/Base.php | Base.multiInput | protected function multiInput( $optionKey, $number, $type = 'radio' )
{
$args = $this->multiInputArgs( $type, $optionKey, $number );
if( !$args )return;
$attributes = '';
foreach( $args['attributes'] as $key => $val ) {
$attributes .= sprintf( '%s="%s" ', $key, $val );
}
return sprintf( '<li><label ... | php | protected function multiInput( $optionKey, $number, $type = 'radio' )
{
$args = $this->multiInputArgs( $type, $optionKey, $number );
if( !$args )return;
$attributes = '';
foreach( $args['attributes'] as $key => $val ) {
$attributes .= sprintf( '%s="%s" ', $key, $val );
}
return sprintf( '<li><label ... | [
"protected",
"function",
"multiInput",
"(",
"$",
"optionKey",
",",
"$",
"number",
",",
"$",
"type",
"=",
"'radio'",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"multiInputArgs",
"(",
"$",
"type",
",",
"$",
"optionKey",
",",
"$",
"number",
")",
";"... | Generate checkboxes and radios
@param string $optionKey
@param string $number
@param string $type
@return null|string | [
"Generate",
"checkboxes",
"and",
"radios"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Fields/Base.php#L209-L227 | train |
pryley/castor-framework | src/Forms/Fields/Base.php | Base.selectOption | protected function selectOption( $optionKey )
{
return sprintf( '<option value="%s"%s>%s</option>',
$optionKey,
selected( $this->args['value'], $optionKey, false ),
$this->args['options'][ $optionKey ]
);
} | php | protected function selectOption( $optionKey )
{
return sprintf( '<option value="%s"%s>%s</option>',
$optionKey,
selected( $this->args['value'], $optionKey, false ),
$this->args['options'][ $optionKey ]
);
} | [
"protected",
"function",
"selectOption",
"(",
"$",
"optionKey",
")",
"{",
"return",
"sprintf",
"(",
"'<option value=\"%s\"%s>%s</option>'",
",",
"$",
"optionKey",
",",
"selected",
"(",
"$",
"this",
"->",
"args",
"[",
"'value'",
"]",
",",
"$",
"optionKey",
",",... | Generate select options
@param string $optionKey
@return string | [
"Generate",
"select",
"options"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Fields/Base.php#L312-L319 | train |
pryley/castor-framework | src/Forms/Fields/Base.php | Base.singleInput | protected function singleInput( $type = 'checkbox' )
{
$optionKey = key( $this->args['options'] );
$args = $this->multiInputArgs( $type, $optionKey, 1 );
if( !$args )return;
$atts = $this->normalize();
$atts = wp_parse_args( $args['attributes'], $atts );
$attributes = '';
foreach( $atts as $key => $... | php | protected function singleInput( $type = 'checkbox' )
{
$optionKey = key( $this->args['options'] );
$args = $this->multiInputArgs( $type, $optionKey, 1 );
if( !$args )return;
$atts = $this->normalize();
$atts = wp_parse_args( $args['attributes'], $atts );
$attributes = '';
foreach( $atts as $key => $... | [
"protected",
"function",
"singleInput",
"(",
"$",
"type",
"=",
"'checkbox'",
")",
"{",
"$",
"optionKey",
"=",
"key",
"(",
"$",
"this",
"->",
"args",
"[",
"'options'",
"]",
")",
";",
"$",
"args",
"=",
"$",
"this",
"->",
"multiInputArgs",
"(",
"$",
"ty... | Generate a single checkbox
@param string $type
@return null|string | [
"Generate",
"a",
"single",
"checkbox"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Fields/Base.php#L328-L351 | train |
erenmustafaozdal/laravel-modules-base | src/Controllers/DataTableTrait.php | DataTableTrait.setColumns | public function setColumns(array $columns)
{
// add columns
foreach($columns['add'] as $key => $value) {
$this->dataTables->addColumn($key, $value);
}
// edit columns
foreach($columns['edit'] as $key => $value) {
$this->dataTables->editColumn($key, $v... | php | public function setColumns(array $columns)
{
// add columns
foreach($columns['add'] as $key => $value) {
$this->dataTables->addColumn($key, $value);
}
// edit columns
foreach($columns['edit'] as $key => $value) {
$this->dataTables->editColumn($key, $v... | [
"public",
"function",
"setColumns",
"(",
"array",
"$",
"columns",
")",
"{",
"// add columns",
"foreach",
"(",
"$",
"columns",
"[",
"'add'",
"]",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"dataTables",
"->",
"addColumn",
"(",
"$... | set data table columns
@param array $columns [array('add' => ..., 'edit' => ...,'remove' => ...)]
@return void | [
"set",
"data",
"table",
"columns"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/DataTableTrait.php#L56-L72 | train |
erenmustafaozdal/laravel-modules-base | src/Controllers/DataTableTrait.php | DataTableTrait.getDefaultUrls | private function getDefaultUrls($model)
{
$slug = getModelSlug($model);
return [
'details' => lmbRoute("api.{$slug}.detail", ['id' => $model->id]),
'fast_edit' => lmbRoute("api.{$slug}.fastEdit", ['id' => $model->id]),
'edit' => lmbRoute("api.{$slug}.update... | php | private function getDefaultUrls($model)
{
$slug = getModelSlug($model);
return [
'details' => lmbRoute("api.{$slug}.detail", ['id' => $model->id]),
'fast_edit' => lmbRoute("api.{$slug}.fastEdit", ['id' => $model->id]),
'edit' => lmbRoute("api.{$slug}.update... | [
"private",
"function",
"getDefaultUrls",
"(",
"$",
"model",
")",
"{",
"$",
"slug",
"=",
"getModelSlug",
"(",
"$",
"model",
")",
";",
"return",
"[",
"'details'",
"=>",
"lmbRoute",
"(",
"\"api.{$slug}.detail\"",
",",
"[",
"'id'",
"=>",
"$",
"model",
"->",
... | get default urls for Datatables
@param \Illuminate\Database\Eloquent\Model $model
@return array | [
"get",
"default",
"urls",
"for",
"Datatables"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/DataTableTrait.php#L99-L109 | train |
Eden-PHP/Block | Component/Pagination.php | Pagination.setShow | public function setShow($show)
{
Argument::i()->test(1, 'int');
if($show < 1) {
$show = 1;
}
$this->show = $show;
return $this;
} | php | public function setShow($show)
{
Argument::i()->test(1, 'int');
if($show < 1) {
$show = 1;
}
$this->show = $show;
return $this;
} | [
"public",
"function",
"setShow",
"(",
"$",
"show",
")",
"{",
"Argument",
"::",
"i",
"(",
")",
"->",
"test",
"(",
"1",
",",
"'int'",
")",
";",
"if",
"(",
"$",
"show",
"<",
"1",
")",
"{",
"$",
"show",
"=",
"1",
";",
"}",
"$",
"this",
"->",
"s... | Sets pages to show left and right of the current page
@param int
@return Eden\Block\Component\Pagination | [
"Sets",
"pages",
"to",
"show",
"left",
"and",
"right",
"of",
"the",
"current",
"page"
] | 681b9f01dd118612d0fced84d2f702167b52109b | https://github.com/Eden-PHP/Block/blob/681b9f01dd118612d0fced84d2f702167b52109b/Component/Pagination.php#L146-L156 | train |
Wedeto/DB | src/Query/ConstantArray.php | ConstantArray.toSQL | public function toSQL(Parameters $params, bool $inner_clause)
{
if ($key = $this->getKey())
{
try
{
$params->get($key);
}
catch (\OutOfRangeException $e)
{
// Not a valid key, replace
$key = n... | php | public function toSQL(Parameters $params, bool $inner_clause)
{
if ($key = $this->getKey())
{
try
{
$params->get($key);
}
catch (\OutOfRangeException $e)
{
// Not a valid key, replace
$key = n... | [
"public",
"function",
"toSQL",
"(",
"Parameters",
"$",
"params",
",",
"bool",
"$",
"inner_clause",
")",
"{",
"if",
"(",
"$",
"key",
"=",
"$",
"this",
"->",
"getKey",
"(",
")",
")",
"{",
"try",
"{",
"$",
"params",
"->",
"get",
"(",
"$",
"key",
")"... | Write a constant array clause as SQL query syntax
@param Parameters $params The query parameters: tables and placeholder values
@return string The generated SQL | [
"Write",
"a",
"constant",
"array",
"clause",
"as",
"SQL",
"query",
"syntax"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/ConstantArray.php#L63-L84 | train |
sndsgd/form | src/form/field/FieldAbstract.php | FieldAbstract.getName | public function getName(array $keys = [], string $delimiter = "."): string
{
if (empty($keys)) {
return $this->name;
}
$keys[] = $this->name;
return implode($delimiter, $keys);
} | php | public function getName(array $keys = [], string $delimiter = "."): string
{
if (empty($keys)) {
return $this->name;
}
$keys[] = $this->name;
return implode($delimiter, $keys);
} | [
"public",
"function",
"getName",
"(",
"array",
"$",
"keys",
"=",
"[",
"]",
",",
"string",
"$",
"delimiter",
"=",
"\".\"",
")",
":",
"string",
"{",
"if",
"(",
"empty",
"(",
"$",
"keys",
")",
")",
"{",
"return",
"$",
"this",
"->",
"name",
";",
"}",... | Get the name of the field
@param array<string> $keys The nested names of parents
@param string $delimiter A string to use when joining the name
@return string | [
"Get",
"the",
"name",
"of",
"the",
"field"
] | 56b5b9572a8942aea34c97c7c838b871e198e34f | https://github.com/sndsgd/form/blob/56b5b9572a8942aea34c97c7c838b871e198e34f/src/form/field/FieldAbstract.php#L67-L75 | train |
sndsgd/form | src/form/field/FieldAbstract.php | FieldAbstract.getNestedName | public function getNestedName(
string $delimiter = ".",
string $name = ""
): string
{
$keys = array_filter([$this->name, $name], "strlen");
$parent = $this;
while ($parent = $parent->getParent()) {
$name = $parent->getName();
if ($name) {
... | php | public function getNestedName(
string $delimiter = ".",
string $name = ""
): string
{
$keys = array_filter([$this->name, $name], "strlen");
$parent = $this;
while ($parent = $parent->getParent()) {
$name = $parent->getName();
if ($name) {
... | [
"public",
"function",
"getNestedName",
"(",
"string",
"$",
"delimiter",
"=",
"\".\"",
",",
"string",
"$",
"name",
"=",
"\"\"",
")",
":",
"string",
"{",
"$",
"keys",
"=",
"array_filter",
"(",
"[",
"$",
"this",
"->",
"name",
",",
"$",
"name",
"]",
",",... | Get a field's nested name
@param string $delimiter
@param string $name A name to append to the result
@return string | [
"Get",
"a",
"field",
"s",
"nested",
"name"
] | 56b5b9572a8942aea34c97c7c838b871e198e34f | https://github.com/sndsgd/form/blob/56b5b9572a8942aea34c97c7c838b871e198e34f/src/form/field/FieldAbstract.php#L84-L98 | train |
sokil/NotificationBundle | src/TransportProvider.php | TransportProvider.getTransport | public function getTransport($transportName)
{
if (empty($this->transport[$transportName])) {
throw new InvalidArgumentException(sprintf('Transport %s not found', $transportName));
}
return $this->transport[$transportName];
} | php | public function getTransport($transportName)
{
if (empty($this->transport[$transportName])) {
throw new InvalidArgumentException(sprintf('Transport %s not found', $transportName));
}
return $this->transport[$transportName];
} | [
"public",
"function",
"getTransport",
"(",
"$",
"transportName",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"transport",
"[",
"$",
"transportName",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Transport %s... | Get transport by name
@param $transportName
@return TransportInterface
@throws InvalidArgumentException | [
"Get",
"transport",
"by",
"name"
] | bf8d793b6b5a13827b2db4f0b3c588cf6a03c66b | https://github.com/sokil/NotificationBundle/blob/bf8d793b6b5a13827b2db4f0b3c588cf6a03c66b/src/TransportProvider.php#L35-L42 | train |
tonis-io-legacy/tonis | src/Router/RouteMap.php | RouteMap.add | public function add($path, $handler)
{
$route = new Route($path, $handler);
$this->routes[] = $route;
$this->nameCache = [];
$this->routeParser = new RouteParser;
return $route;
} | php | public function add($path, $handler)
{
$route = new Route($path, $handler);
$this->routes[] = $route;
$this->nameCache = [];
$this->routeParser = new RouteParser;
return $route;
} | [
"public",
"function",
"add",
"(",
"$",
"path",
",",
"$",
"handler",
")",
"{",
"$",
"route",
"=",
"new",
"Route",
"(",
"$",
"path",
",",
"$",
"handler",
")",
";",
"$",
"this",
"->",
"routes",
"[",
"]",
"=",
"$",
"route",
";",
"$",
"this",
"->",
... | Adds a route to the map and resets the name cache.
@param string $path
@param callable $handler
@return Route | [
"Adds",
"a",
"route",
"to",
"the",
"map",
"and",
"resets",
"the",
"name",
"cache",
"."
] | 8371a277a94232433d882aaf37a85cd469daf501 | https://github.com/tonis-io-legacy/tonis/blob/8371a277a94232433d882aaf37a85cd469daf501/src/Router/RouteMap.php#L25-L33 | train |
tonis-io-legacy/tonis | src/Router/RouteMap.php | RouteMap.buildNameCache | private function buildNameCache()
{
if (!empty($this->nameCache)) {
return;
}
foreach ($this as $route) {
if (!$route->name()) {
continue;
}
$this->nameCache[$route->name()] = $route;
}
} | php | private function buildNameCache()
{
if (!empty($this->nameCache)) {
return;
}
foreach ($this as $route) {
if (!$route->name()) {
continue;
}
$this->nameCache[$route->name()] = $route;
}
} | [
"private",
"function",
"buildNameCache",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"nameCache",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"this",
"as",
"$",
"route",
")",
"{",
"if",
"(",
"!",
"$",
"route",
"->"... | Iterates through routes and builds a name cache. | [
"Iterates",
"through",
"routes",
"and",
"builds",
"a",
"name",
"cache",
"."
] | 8371a277a94232433d882aaf37a85cd469daf501 | https://github.com/tonis-io-legacy/tonis/blob/8371a277a94232433d882aaf37a85cd469daf501/src/Router/RouteMap.php#L110-L121 | train |
PenoaksDev/Milky-Framework | src/Milky/Http/JsonResponse.php | JsonResponse.setJsonOptions | public function setJsonOptions($options)
{
$this->encodingOptions = (int) $options;
return $this->setData($this->getData());
} | php | public function setJsonOptions($options)
{
$this->encodingOptions = (int) $options;
return $this->setData($this->getData());
} | [
"public",
"function",
"setJsonOptions",
"(",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"encodingOptions",
"=",
"(",
"int",
")",
"$",
"options",
";",
"return",
"$",
"this",
"->",
"setData",
"(",
"$",
"this",
"->",
"getData",
"(",
")",
")",
";",
"}"... | Set the JSON encoding options.
@param int $options
@return mixed | [
"Set",
"the",
"JSON",
"encoding",
"options",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Http/JsonResponse.php#L86-L91 | train |
RhubarbPHP/Scaffold.BackgroundTasks | src/Task.php | Task.initiate | public static function initiate($settings)
{
// Create an entry in our database.
$taskStatus = new BackgroundTaskStatus();
$taskStatus->TaskClass = get_called_class();
$taskStatus->TaskSettings = $settings;
$taskStatus->save();
$task = new static();
$additio... | php | public static function initiate($settings)
{
// Create an entry in our database.
$taskStatus = new BackgroundTaskStatus();
$taskStatus->TaskClass = get_called_class();
$taskStatus->TaskSettings = $settings;
$taskStatus->save();
$task = new static();
$additio... | [
"public",
"static",
"function",
"initiate",
"(",
"$",
"settings",
")",
"{",
"// Create an entry in our database.",
"$",
"taskStatus",
"=",
"new",
"BackgroundTaskStatus",
"(",
")",
";",
"$",
"taskStatus",
"->",
"TaskClass",
"=",
"get_called_class",
"(",
")",
";",
... | Initiates execution of the background task.
@param array $settings Settings which will be passed to the execute method of the BackgroundTask (must be JSON serialisable)
@return BackgroundTaskStatus The status object for this task. | [
"Initiates",
"execution",
"of",
"the",
"background",
"task",
"."
] | 92a5feab27599288e8bf39deb522588115838904 | https://github.com/RhubarbPHP/Scaffold.BackgroundTasks/blob/92a5feab27599288e8bf39deb522588115838904/src/Task.php#L71-L107 | train |
heiglandreas/OrgHeiglFileFinder | src/ClassMapList.php | ClassMapList.add | public function add(\SplFileInfo $file)
{
$content = new \Org_Heigl\FileFinder\Service\Tokenlist(file_get_contents($file->getPathname()));
$classname = $content->getClassName();
if (! $classname) {
return;
}
$class = $content->getNamespace();
$class[] = $... | php | public function add(\SplFileInfo $file)
{
$content = new \Org_Heigl\FileFinder\Service\Tokenlist(file_get_contents($file->getPathname()));
$classname = $content->getClassName();
if (! $classname) {
return;
}
$class = $content->getNamespace();
$class[] = $... | [
"public",
"function",
"add",
"(",
"\\",
"SplFileInfo",
"$",
"file",
")",
"{",
"$",
"content",
"=",
"new",
"\\",
"Org_Heigl",
"\\",
"FileFinder",
"\\",
"Service",
"\\",
"Tokenlist",
"(",
"file_get_contents",
"(",
"$",
"file",
"->",
"getPathname",
"(",
")",
... | Add an SPL-File-Info to the filelist
@param \SplFileInfo $file
@return void | [
"Add",
"an",
"SPL",
"-",
"File",
"-",
"Info",
"to",
"the",
"filelist"
] | 189d15b95bec7dc186ef73681463c104831234d8 | https://github.com/heiglandreas/OrgHeiglFileFinder/blob/189d15b95bec7dc186ef73681463c104831234d8/src/ClassMapList.php#L48-L62 | train |
ComPHPPuebla/restful-extensions | src/ComPHPPuebla/Slim/Middleware/CheckOptionsMiddleware.php | CheckOptionsMiddleware.call | public function call()
{
$params = $this->app->router()->getCurrentRoute()->getParams();
$options = $this->model->getOptionsList();
if (isset($params['id'])) {
$options = $this->model->getOptions();
}
if (in_array($this->app->request()->getMethod(), $options)) {... | php | public function call()
{
$params = $this->app->router()->getCurrentRoute()->getParams();
$options = $this->model->getOptionsList();
if (isset($params['id'])) {
$options = $this->model->getOptions();
}
if (in_array($this->app->request()->getMethod(), $options)) {... | [
"public",
"function",
"call",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"app",
"->",
"router",
"(",
")",
"->",
"getCurrentRoute",
"(",
")",
"->",
"getParams",
"(",
")",
";",
"$",
"options",
"=",
"$",
"this",
"->",
"model",
"->",
"getOpt... | Check if the current HTTP method is allowed for the resource being accesed
@see \Slim\Middleware::call() | [
"Check",
"if",
"the",
"current",
"HTTP",
"method",
"is",
"allowed",
"for",
"the",
"resource",
"being",
"accesed"
] | 3dc5e554d7ebe1305eed4cd4ec71a6944316199c | https://github.com/ComPHPPuebla/restful-extensions/blob/3dc5e554d7ebe1305eed4cd4ec71a6944316199c/src/ComPHPPuebla/Slim/Middleware/CheckOptionsMiddleware.php#L27-L43 | train |
Nicklas766/Comment | src/Comment/Modules/ActiveRecordModelExtender.php | ActiveRecordModelExtender.getMD | public function getMD($content)
{
$funcArr = ["yamlfrontmatter", "shortcode", "markdown", "titlefromheader"];
$textFilter = new textFilter();
return $textFilter->parse($content, $funcArr)->text;
} | php | public function getMD($content)
{
$funcArr = ["yamlfrontmatter", "shortcode", "markdown", "titlefromheader"];
$textFilter = new textFilter();
return $textFilter->parse($content, $funcArr)->text;
} | [
"public",
"function",
"getMD",
"(",
"$",
"content",
")",
"{",
"$",
"funcArr",
"=",
"[",
"\"yamlfrontmatter\"",
",",
"\"shortcode\"",
",",
"\"markdown\"",
",",
"\"titlefromheader\"",
"]",
";",
"$",
"textFilter",
"=",
"new",
"textFilter",
"(",
")",
";",
"retur... | Return markdown based on string
@param string $content unparsed markdown
@return string as parsed markdown | [
"Return",
"markdown",
"based",
"on",
"string"
] | 1483eaf1ebb120b8bd6c2a1552c084b3a288ff25 | https://github.com/Nicklas766/Comment/blob/1483eaf1ebb120b8bd6c2a1552c084b3a288ff25/src/Comment/Modules/ActiveRecordModelExtender.php#L42-L47 | train |
the-eater/odango.php | src/NyaaCollector.php | NyaaCollector.getFeed | protected function getFeed($query, $options)
{
$options = array_merge(['query' => $query], $options);
$nyaa = $this->getNyaa();
$feed = $nyaa->getFeed($options);
$matcher = $this->getMatcher();
return array_filter($feed, function ($item) use ($matcher, $query) {
$title = $item->getMe... | php | protected function getFeed($query, $options)
{
$options = array_merge(['query' => $query], $options);
$nyaa = $this->getNyaa();
$feed = $nyaa->getFeed($options);
$matcher = $this->getMatcher();
return array_filter($feed, function ($item) use ($matcher, $query) {
$title = $item->getMe... | [
"protected",
"function",
"getFeed",
"(",
"$",
"query",
",",
"$",
"options",
")",
"{",
"$",
"options",
"=",
"array_merge",
"(",
"[",
"'query'",
"=>",
"$",
"query",
"]",
",",
"$",
"options",
")",
";",
"$",
"nyaa",
"=",
"$",
"this",
"->",
"getNyaa",
"... | Gets the torrent feed for given query and options
@param string $query Query to search for in the nyaa feed
@param array $options Options for the nyaa feed
@return NyaaTorrent[] | [
"Gets",
"the",
"torrent",
"feed",
"for",
"given",
"query",
"and",
"options"
] | 6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f | https://github.com/the-eater/odango.php/blob/6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f/src/NyaaCollector.php#L63-L75 | train |
the-eater/odango.php | src/NyaaCollector.php | NyaaCollector.filterDuplicates | public function filterDuplicates($torrents)
{
$arr = [];
foreach ($torrents as $torrent) {
$arr[$torrent->getTorrentId()] = $torrent;
}
return array_values($arr);
} | php | public function filterDuplicates($torrents)
{
$arr = [];
foreach ($torrents as $torrent) {
$arr[$torrent->getTorrentId()] = $torrent;
}
return array_values($arr);
} | [
"public",
"function",
"filterDuplicates",
"(",
"$",
"torrents",
")",
"{",
"$",
"arr",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"torrents",
"as",
"$",
"torrent",
")",
"{",
"$",
"arr",
"[",
"$",
"torrent",
"->",
"getTorrentId",
"(",
")",
"]",
"=",
"$... | Return list with unique torrents from given array
@param NyaaTorrent[] The list to filter duplicates out
@param NyaaTorrent[] | [
"Return",
"list",
"with",
"unique",
"torrents",
"from",
"given",
"array"
] | 6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f | https://github.com/the-eater/odango.php/blob/6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f/src/NyaaCollector.php#L83-L92 | train |
the-eater/odango.php | src/NyaaCollector.php | NyaaCollector.mapByHash | public function mapByHash($feed)
{
$torrents = [];
foreach ($feed as $torrent) {
$hash = $torrent->getSeriesHash();
if(!isset($torrents[$hash])) {
$torrents[$hash] = new NyaaSet($hash);
}
$torrents[$hash]->add($torrent);
}
return $torrents;
} | php | public function mapByHash($feed)
{
$torrents = [];
foreach ($feed as $torrent) {
$hash = $torrent->getSeriesHash();
if(!isset($torrents[$hash])) {
$torrents[$hash] = new NyaaSet($hash);
}
$torrents[$hash]->add($torrent);
}
return $torrents;
} | [
"public",
"function",
"mapByHash",
"(",
"$",
"feed",
")",
"{",
"$",
"torrents",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"feed",
"as",
"$",
"torrent",
")",
"{",
"$",
"hash",
"=",
"$",
"torrent",
"->",
"getSeriesHash",
"(",
")",
";",
"if",
"(",
"!... | Maps the torrents by series hash and collects them in a NyaaSet
@param NyaaTorrent[] list of torrents to be mapped
@param NyaaSet[] | [
"Maps",
"the",
"torrents",
"by",
"series",
"hash",
"and",
"collects",
"them",
"in",
"a",
"NyaaSet"
] | 6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f | https://github.com/the-eater/odango.php/blob/6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f/src/NyaaCollector.php#L100-L115 | train |
the-eater/odango.php | src/NyaaCollector.php | NyaaCollector.collectForUser | public function collectForUser($query, $users, $options = [])
{
$bigFeed = [];
foreach ($users as $userId) {
$userOptions = array_merge($options, ['user' => $userId]);
$userFeed = $this->getFeed($query, $userOptions);
$bigFeed = array_merge($bigFeed, $userFeed);
}
$bigFeed = $this-... | php | public function collectForUser($query, $users, $options = [])
{
$bigFeed = [];
foreach ($users as $userId) {
$userOptions = array_merge($options, ['user' => $userId]);
$userFeed = $this->getFeed($query, $userOptions);
$bigFeed = array_merge($bigFeed, $userFeed);
}
$bigFeed = $this-... | [
"public",
"function",
"collectForUser",
"(",
"$",
"query",
",",
"$",
"users",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"bigFeed",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"users",
"as",
"$",
"userId",
")",
"{",
"$",
"userOptions",
"=",
... | Searches for torrents per user
@param string $query The query to search for
@param int[] $users The users to search in
@param array $options extra options for the nyaa feed
@return NyaaSet[] | [
"Searches",
"for",
"torrents",
"per",
"user"
] | 6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f | https://github.com/the-eater/odango.php/blob/6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f/src/NyaaCollector.php#L125-L138 | train |
the-eater/odango.php | src/NyaaCollector.php | NyaaCollector.collectRecursive | public function collectRecursive($query, $options = [])
{
$feed = $this->getFeed($query, $options);
$userIds = [];
foreach ($feed as $torrent) {
if (!isset($userIds[$torrent->getSeriesHash()])) {
$userIds[$torrent->getSeriesHash()] = $torrent->getUserId();
}
}
$userIds = arr... | php | public function collectRecursive($query, $options = [])
{
$feed = $this->getFeed($query, $options);
$userIds = [];
foreach ($feed as $torrent) {
if (!isset($userIds[$torrent->getSeriesHash()])) {
$userIds[$torrent->getSeriesHash()] = $torrent->getUserId();
}
}
$userIds = arr... | [
"public",
"function",
"collectRecursive",
"(",
"$",
"query",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"feed",
"=",
"$",
"this",
"->",
"getFeed",
"(",
"$",
"query",
",",
"$",
"options",
")",
";",
"$",
"userIds",
"=",
"[",
"]",
";",
"fore... | Searches for torrent and searches for each found torrent in their user for more torrents, to create complete sets
@param string $query The query to search for
@param array $options Extra options for the nyaa feed
@return NyaaSet[] | [
"Searches",
"for",
"torrent",
"and",
"searches",
"for",
"each",
"found",
"torrent",
"in",
"their",
"user",
"for",
"more",
"torrents",
"to",
"create",
"complete",
"sets"
] | 6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f | https://github.com/the-eater/odango.php/blob/6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f/src/NyaaCollector.php#L147-L162 | train |
the-eater/odango.php | src/NyaaCollector.php | NyaaCollector.collect | public function collect($query, $options = [])
{
if (!$this->getNyaa()->canProvideAllData()) {
return $this->collectRecursive($query, $options);
}
return $this->collectSingleFeed($query, $options);
} | php | public function collect($query, $options = [])
{
if (!$this->getNyaa()->canProvideAllData()) {
return $this->collectRecursive($query, $options);
}
return $this->collectSingleFeed($query, $options);
} | [
"public",
"function",
"collect",
"(",
"$",
"query",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getNyaa",
"(",
")",
"->",
"canProvideAllData",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"collectRecursive",
... | Searches for torrents by query and returns sets created from it
Collects recursively if backend doesn't provide all data
@param string $query The query to search for
@param array $options Extra options for the nyaa feed | [
"Searches",
"for",
"torrents",
"by",
"query",
"and",
"returns",
"sets",
"created",
"from",
"it",
"Collects",
"recursively",
"if",
"backend",
"doesn",
"t",
"provide",
"all",
"data"
] | 6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f | https://github.com/the-eater/odango.php/blob/6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f/src/NyaaCollector.php#L171-L179 | train |
the-eater/odango.php | src/NyaaCollector.php | NyaaCollector.collectSingleFeed | public function collectSingleFeed($query, $options = [])
{
$feed = $this->getFeed($query, $options);
return $this->mapByHash($feed);
} | php | public function collectSingleFeed($query, $options = [])
{
$feed = $this->getFeed($query, $options);
return $this->mapByHash($feed);
} | [
"public",
"function",
"collectSingleFeed",
"(",
"$",
"query",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"feed",
"=",
"$",
"this",
"->",
"getFeed",
"(",
"$",
"query",
",",
"$",
"options",
")",
";",
"return",
"$",
"this",
"->",
"mapByHash",
... | Searches for torrents by query and returns sets created from it, only fetches one feed.
@param string $query
@param array $options | [
"Searches",
"for",
"torrents",
"by",
"query",
"and",
"returns",
"sets",
"created",
"from",
"it",
"only",
"fetches",
"one",
"feed",
"."
] | 6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f | https://github.com/the-eater/odango.php/blob/6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f/src/NyaaCollector.php#L187-L192 | train |
praxigento/mobi_mod_downline | Block/Customer/Account/Reflink.php | Reflink.getDwnlCustomer | private function getDwnlCustomer()
{
if (is_null($this->cacheDwnlCust)) {
$custId = $this->session->getCustomerId();
$this->cacheDwnlCust = $this->daoDwnlCust->getById($custId);
}
return $this->cacheDwnlCust;
} | php | private function getDwnlCustomer()
{
if (is_null($this->cacheDwnlCust)) {
$custId = $this->session->getCustomerId();
$this->cacheDwnlCust = $this->daoDwnlCust->getById($custId);
}
return $this->cacheDwnlCust;
} | [
"private",
"function",
"getDwnlCustomer",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"cacheDwnlCust",
")",
")",
"{",
"$",
"custId",
"=",
"$",
"this",
"->",
"session",
"->",
"getCustomerId",
"(",
")",
";",
"$",
"this",
"->",
"cacheDwnl... | Cached data for current downline customer.
@return \Praxigento\Downline\Repo\Data\Customer | [
"Cached",
"data",
"for",
"current",
"downline",
"customer",
"."
] | 0f3c276dfff1aa029f9fd205ccfc56f207a2e75b | https://github.com/praxigento/mobi_mod_downline/blob/0f3c276dfff1aa029f9fd205ccfc56f207a2e75b/Block/Customer/Account/Reflink.php#L44-L51 | train |
LIN3S/CMSKernel | src/LIN3S/CMSKernel/Infrastructure/Lin3sAdminBundle/Twig/TwigActionTranslationFilter.php | TwigActionTranslationFilter.actionTranslation | public function actionTranslation($options)
{
if (!is_array($options)) {
return $this->translator->trans($options, [], 'CmsKernelAdminBridge');
}
$resultOptions = [];
foreach ($options as $optionKey => $option) {
$option = null === json_decode($option, true) ... | php | public function actionTranslation($options)
{
if (!is_array($options)) {
return $this->translator->trans($options, [], 'CmsKernelAdminBridge');
}
$resultOptions = [];
foreach ($options as $optionKey => $option) {
$option = null === json_decode($option, true) ... | [
"public",
"function",
"actionTranslation",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"options",
")",
")",
"{",
"return",
"$",
"this",
"->",
"translator",
"->",
"trans",
"(",
"$",
"options",
",",
"[",
"]",
",",
"'CmsKernelAdmi... | Callback of action translation Twig filter that returns resultant array.
@param string $options The action options
@return array|string | [
"Callback",
"of",
"action",
"translation",
"Twig",
"filter",
"that",
"returns",
"resultant",
"array",
"."
] | 71b5fc1930cd60d6eac1a9816df34af4654f9a7e | https://github.com/LIN3S/CMSKernel/blob/71b5fc1930cd60d6eac1a9816df34af4654f9a7e/src/LIN3S/CMSKernel/Infrastructure/Lin3sAdminBundle/Twig/TwigActionTranslationFilter.php#L57-L89 | train |
K-Phoen/rulerz-bridge | Form/SpecificationToBooleanTransformer.php | SpecificationToBooleanTransformer.reverseTransform | public function reverseTransform($boolean)
{
if (!$boolean) {
return null;
}
$rClass = new \ReflectionClass($this->specificationClass);
if ($rClass->getConstructor() && $rClass->getConstructor()->getNumberOfParameters() > 0) {
return $rClass->newInstanceArgs... | php | public function reverseTransform($boolean)
{
if (!$boolean) {
return null;
}
$rClass = new \ReflectionClass($this->specificationClass);
if ($rClass->getConstructor() && $rClass->getConstructor()->getNumberOfParameters() > 0) {
return $rClass->newInstanceArgs... | [
"public",
"function",
"reverseTransform",
"(",
"$",
"boolean",
")",
"{",
"if",
"(",
"!",
"$",
"boolean",
")",
"{",
"return",
"null",
";",
"}",
"$",
"rClass",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
"->",
"specificationClass",
")",
";",
"... | Transforms a value into a specification.
@param bool $boolean
@return \RulerZ\Spec\Specification|null | [
"Transforms",
"a",
"value",
"into",
"a",
"specification",
"."
] | fdad5856b669d59b5e4bda47c4e927a0485bf7a0 | https://github.com/K-Phoen/rulerz-bridge/blob/fdad5856b669d59b5e4bda47c4e927a0485bf7a0/Form/SpecificationToBooleanTransformer.php#L48-L61 | train |
schpill/thin | src/Request.php | Request.detectEnv | public static function detectEnv(array $environments, $uri)
{
foreach ($environments as $environment => $patterns) {
// Essentially we just want to loop through each environment pattern
// and determine if the current URI matches the pattern and if so
... | php | public static function detectEnv(array $environments, $uri)
{
foreach ($environments as $environment => $patterns) {
// Essentially we just want to loop through each environment pattern
// and determine if the current URI matches the pattern and if so
... | [
"public",
"static",
"function",
"detectEnv",
"(",
"array",
"$",
"environments",
",",
"$",
"uri",
")",
"{",
"foreach",
"(",
"$",
"environments",
"as",
"$",
"environment",
"=>",
"$",
"patterns",
")",
"{",
"// Essentially we just want to loop through each environment p... | Detect the current environment from an environment configuration.
@param array $environments
@param string $uri
@return string|null | [
"Detect",
"the",
"current",
"environment",
"from",
"an",
"environment",
"configuration",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Request.php#L231-L243 | train |
atelierspierrot/patterns | src/Patterns/Commons/Registry.php | Registry.setEntry | public function setEntry($var = null, $val = null, $section = false)
{
if (!empty($var)) {
if ($section) {
if (!isset($this->registry[$section])) {
$this->registry[$section] = array();
}
$this->registry[$section][$var] = $val;
... | php | public function setEntry($var = null, $val = null, $section = false)
{
if (!empty($var)) {
if ($section) {
if (!isset($this->registry[$section])) {
$this->registry[$section] = array();
}
$this->registry[$section][$var] = $val;
... | [
"public",
"function",
"setEntry",
"(",
"$",
"var",
"=",
"null",
",",
"$",
"val",
"=",
"null",
",",
"$",
"section",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"var",
")",
")",
"{",
"if",
"(",
"$",
"section",
")",
"{",
"if",
"("... | Set an entry in the instance registry
@param null|string $var The variable name to set
@param null|mixed $val The variable value to set
@param false|string $section A section name in the registry (default is FALSE)
@return self | [
"Set",
"an",
"entry",
"in",
"the",
"instance",
"registry"
] | b7a8313e98bbfb6525e1672d0a726a1ead6f156e | https://github.com/atelierspierrot/patterns/blob/b7a8313e98bbfb6525e1672d0a726a1ead6f156e/src/Patterns/Commons/Registry.php#L102-L115 | train |
atelierspierrot/patterns | src/Patterns/Commons/Registry.php | Registry.getEntry | public function getEntry($var = null, $section = false, $default = null)
{
if (!empty($var)) {
if (!empty($section) && isset($this->registry[$section]) && isset($this->registry[$section][$var])) {
return $this->registry[$section][$var];
} elseif (isset($this->registry... | php | public function getEntry($var = null, $section = false, $default = null)
{
if (!empty($var)) {
if (!empty($section) && isset($this->registry[$section]) && isset($this->registry[$section][$var])) {
return $this->registry[$section][$var];
} elseif (isset($this->registry... | [
"public",
"function",
"getEntry",
"(",
"$",
"var",
"=",
"null",
",",
"$",
"section",
"=",
"false",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"var",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"section"... | Get an entry from the instance registry
@param string $var The variable name to get
@param string $section A section name in the registry (default is FALSE)
@param mixed $default The default value to return if it is not in registry (default is NULL)
@return mixed The value found or $default | [
"Get",
"an",
"entry",
"from",
"the",
"instance",
"registry"
] | b7a8313e98bbfb6525e1672d0a726a1ead6f156e | https://github.com/atelierspierrot/patterns/blob/b7a8313e98bbfb6525e1672d0a726a1ead6f156e/src/Patterns/Commons/Registry.php#L143-L153 | train |
atelierspierrot/patterns | src/Patterns/Commons/Registry.php | Registry.isEntry | public function isEntry($var = null, $section = false)
{
return (
!empty($var) and (
(!empty($section) && isset($this->registry[$section]) && isset($this->registry[$section][$var])) or
isset($this->registry[$var])
)
);
} | php | public function isEntry($var = null, $section = false)
{
return (
!empty($var) and (
(!empty($section) && isset($this->registry[$section]) && isset($this->registry[$section][$var])) or
isset($this->registry[$var])
)
);
} | [
"public",
"function",
"isEntry",
"(",
"$",
"var",
"=",
"null",
",",
"$",
"section",
"=",
"false",
")",
"{",
"return",
"(",
"!",
"empty",
"(",
"$",
"var",
")",
"and",
"(",
"(",
"!",
"empty",
"(",
"$",
"section",
")",
"&&",
"isset",
"(",
"$",
"th... | Check if an entry exists in registry
@param string $var The variable name to check
@param string $section A section name in the registry (default is FALSE)
@return bool | [
"Check",
"if",
"an",
"entry",
"exists",
"in",
"registry"
] | b7a8313e98bbfb6525e1672d0a726a1ead6f156e | https://github.com/atelierspierrot/patterns/blob/b7a8313e98bbfb6525e1672d0a726a1ead6f156e/src/Patterns/Commons/Registry.php#L162-L170 | train |
atelierspierrot/patterns | src/Patterns/Commons/Registry.php | Registry.getKey | public function getKey($val = null, $var = null, $section = false)
{
if (!empty($val)) {
if (!empty($var)) {
foreach ($this->registry as $_sct=>$_data) {
if ($ok=array_search($val, $_data) && $ok==$var) {
return $_sct;
... | php | public function getKey($val = null, $var = null, $section = false)
{
if (!empty($val)) {
if (!empty($var)) {
foreach ($this->registry as $_sct=>$_data) {
if ($ok=array_search($val, $_data) && $ok==$var) {
return $_sct;
... | [
"public",
"function",
"getKey",
"(",
"$",
"val",
"=",
"null",
",",
"$",
"var",
"=",
"null",
",",
"$",
"section",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"val",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"var",
")",
... | Search a key in registry
@param mixed $val The variable value to find
@param string $var The variable name to search in (in case of array)
@param string $section A section name in the registry (default is FALSE)
@return string|null The key found in the registry | [
"Search",
"a",
"key",
"in",
"registry"
] | b7a8313e98bbfb6525e1672d0a726a1ead6f156e | https://github.com/atelierspierrot/patterns/blob/b7a8313e98bbfb6525e1672d0a726a1ead6f156e/src/Patterns/Commons/Registry.php#L180-L195 | train |
atelierspierrot/patterns | src/Patterns/Commons/Registry.php | Registry.dumpStack | public function dumpStack($index = null, $default = null)
{
if (array_key_exists($index, $this->registry_stacks)) {
return $this->registry_stacks[$index];
}
return $default;
} | php | public function dumpStack($index = null, $default = null)
{
if (array_key_exists($index, $this->registry_stacks)) {
return $this->registry_stacks[$index];
}
return $default;
} | [
"public",
"function",
"dumpStack",
"(",
"$",
"index",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"index",
",",
"$",
"this",
"->",
"registry_stacks",
")",
")",
"{",
"return",
"$",
"this",
"->",
"r... | Get a full stack from registry stacks
@param string $index The stack index
@param mixed $default The default value to return if it is not in registry (default is NULL)
@return mixed The requested stack entry if so | [
"Get",
"a",
"full",
"stack",
"from",
"registry",
"stacks"
] | b7a8313e98bbfb6525e1672d0a726a1ead6f156e | https://github.com/atelierspierrot/patterns/blob/b7a8313e98bbfb6525e1672d0a726a1ead6f156e/src/Patterns/Commons/Registry.php#L208-L214 | train |
atelierspierrot/patterns | src/Patterns/Commons/Registry.php | Registry.saveStack | public function saveStack($index = null, $and_clean = false)
{
$this->registry_stacks[$index] = $this->registry;
if ($and_clean===true) {
$this->registry=array();
}
return $this;
} | php | public function saveStack($index = null, $and_clean = false)
{
$this->registry_stacks[$index] = $this->registry;
if ($and_clean===true) {
$this->registry=array();
}
return $this;
} | [
"public",
"function",
"saveStack",
"(",
"$",
"index",
"=",
"null",
",",
"$",
"and_clean",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"registry_stacks",
"[",
"$",
"index",
"]",
"=",
"$",
"this",
"->",
"registry",
";",
"if",
"(",
"$",
"and_clean",
"===... | Save a stack of entries in registry
@param string $index The stack index
@param bool $and_clean Clean the actual registry after recorded the stack (default is FALSE)
@return self | [
"Save",
"a",
"stack",
"of",
"entries",
"in",
"registry"
] | b7a8313e98bbfb6525e1672d0a726a1ead6f156e | https://github.com/atelierspierrot/patterns/blob/b7a8313e98bbfb6525e1672d0a726a1ead6f156e/src/Patterns/Commons/Registry.php#L223-L230 | train |
atelierspierrot/patterns | src/Patterns/Commons/Registry.php | Registry.getStackEntry | public function getStackEntry($var = null, $section = false, $stack = null, $default = null)
{
if (!empty($var)) {
if (!empty($stack) && $this->isStack($stack)) {
$tmp_stack = $this->registry;
$this->loadStack($stack);
$val = $this->getEntry($var, ... | php | public function getStackEntry($var = null, $section = false, $stack = null, $default = null)
{
if (!empty($var)) {
if (!empty($stack) && $this->isStack($stack)) {
$tmp_stack = $this->registry;
$this->loadStack($stack);
$val = $this->getEntry($var, ... | [
"public",
"function",
"getStackEntry",
"(",
"$",
"var",
"=",
"null",
",",
"$",
"section",
"=",
"false",
",",
"$",
"stack",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"var",
")",
")",
"{",
"if",
"... | Get a stack entry of the registry stacks
@param string $var The variable name to search
@param string $section A section name in the registry (default is FALSE)
@param string $stack The stack name to search in
@param mixed $default The default value to return if it is not in registry (de... | [
"Get",
"a",
"stack",
"entry",
"of",
"the",
"registry",
"stacks"
] | b7a8313e98bbfb6525e1672d0a726a1ead6f156e | https://github.com/atelierspierrot/patterns/blob/b7a8313e98bbfb6525e1672d0a726a1ead6f156e/src/Patterns/Commons/Registry.php#L264-L276 | train |
atelierspierrot/patterns | src/Patterns/Commons/Registry.php | Registry.getStackKey | public function getStackKey($val = null, $section = false, $stack = null, $default = null)
{
if (!empty($val)) {
if (!empty($stack) && $this->isStack($stack)) {
$tmp_stack = $this->registry;
$this->loadStack($stack);
$var = $this->getKey($val, $sec... | php | public function getStackKey($val = null, $section = false, $stack = null, $default = null)
{
if (!empty($val)) {
if (!empty($stack) && $this->isStack($stack)) {
$tmp_stack = $this->registry;
$this->loadStack($stack);
$var = $this->getKey($val, $sec... | [
"public",
"function",
"getStackKey",
"(",
"$",
"val",
"=",
"null",
",",
"$",
"section",
"=",
"false",
",",
"$",
"stack",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"val",
")",
")",
"{",
"if",
"("... | Get the key of a stack entry of the registry stacks
@param string $val The variable value to search
@param string $section A section name in the registry (default is FALSE)
@param string $stack The stack name to search in
@param mixed $default The default value to return if it is not in ... | [
"Get",
"the",
"key",
"of",
"a",
"stack",
"entry",
"of",
"the",
"registry",
"stacks"
] | b7a8313e98bbfb6525e1672d0a726a1ead6f156e | https://github.com/atelierspierrot/patterns/blob/b7a8313e98bbfb6525e1672d0a726a1ead6f156e/src/Patterns/Commons/Registry.php#L287-L299 | train |
ben-gibson/foursquare-venue-client | src/Factory/Tip/TipFactory.php | TipFactory.create | public function create(Description $description)
{
return new Tip(
new Identifier($description->getMandatoryProperty('id')),
$description->getMandatoryProperty('text'),
$description->getMandatoryProperty('type'),
$description->getMandatoryProperty('agreeCount'... | php | public function create(Description $description)
{
return new Tip(
new Identifier($description->getMandatoryProperty('id')),
$description->getMandatoryProperty('text'),
$description->getMandatoryProperty('type'),
$description->getMandatoryProperty('agreeCount'... | [
"public",
"function",
"create",
"(",
"Description",
"$",
"description",
")",
"{",
"return",
"new",
"Tip",
"(",
"new",
"Identifier",
"(",
"$",
"description",
"->",
"getMandatoryProperty",
"(",
"'id'",
")",
")",
",",
"$",
"description",
"->",
"getMandatoryProper... | Create a tip from a description.
@param Description $description The tip description.
@return Tip | [
"Create",
"a",
"tip",
"from",
"a",
"description",
"."
] | ce5e7c308f87d5ccc28ab8d27a9cb51bd106d969 | https://github.com/ben-gibson/foursquare-venue-client/blob/ce5e7c308f87d5ccc28ab8d27a9cb51bd106d969/src/Factory/Tip/TipFactory.php#L21-L30 | train |
PHPColibri/framework | Util/File.php | File.getMimeType | public static function getMimeType($filePath)
{
$fInfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($fInfo, $filePath);
finfo_close($fInfo);
return $mime;
} | php | public static function getMimeType($filePath)
{
$fInfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($fInfo, $filePath);
finfo_close($fInfo);
return $mime;
} | [
"public",
"static",
"function",
"getMimeType",
"(",
"$",
"filePath",
")",
"{",
"$",
"fInfo",
"=",
"finfo_open",
"(",
"FILEINFO_MIME_TYPE",
")",
";",
"$",
"mime",
"=",
"finfo_file",
"(",
"$",
"fInfo",
",",
"$",
"filePath",
")",
";",
"finfo_close",
"(",
"$... | Get mime-type og the file.
@param string $filePath
@throws \Exception
@return string string with mime-type like 'image/jpeg' & etc | [
"Get",
"mime",
"-",
"type",
"og",
"the",
"file",
"."
] | 7e5b77141da5e5e7c63afc83592671321ac52f36 | https://github.com/PHPColibri/framework/blob/7e5b77141da5e5e7c63afc83592671321ac52f36/Util/File.php#L18-L25 | train |
atelierspierrot/patterns | src/Patterns/Abstracts/AbstractSingleton.php | AbstractSingleton.createInstance | private static function createInstance($classname, array $arguments = array())
{
$reflection_obj = new ReflectionClass($classname);
if ($reflection_obj->getMethod('__construct')->isPublic()) {
self::$_instances[ $classname ] = call_user_func_array(array($reflection_obj, 'newInstance'), $... | php | private static function createInstance($classname, array $arguments = array())
{
$reflection_obj = new ReflectionClass($classname);
if ($reflection_obj->getMethod('__construct')->isPublic()) {
self::$_instances[ $classname ] = call_user_func_array(array($reflection_obj, 'newInstance'), $... | [
"private",
"static",
"function",
"createInstance",
"(",
"$",
"classname",
",",
"array",
"$",
"arguments",
"=",
"array",
"(",
")",
")",
"{",
"$",
"reflection_obj",
"=",
"new",
"ReflectionClass",
"(",
"$",
"classname",
")",
";",
"if",
"(",
"$",
"reflection_o... | Real object instances creation
@param string $classname The classname to create object from
@param array $arguments The arguments to pass to the `__construct` or `init` method
@return void | [
"Real",
"object",
"instances",
"creation"
] | b7a8313e98bbfb6525e1672d0a726a1ead6f156e | https://github.com/atelierspierrot/patterns/blob/b7a8313e98bbfb6525e1672d0a726a1ead6f156e/src/Patterns/Abstracts/AbstractSingleton.php#L124-L144 | train |
harp-orm/harp | src/Rel/AbstractRel.php | AbstractRel.linkModels | public function linkModels(Models $models, Models $foreign, Closure $yield)
{
foreach ($models as $model) {
$linked = [];
foreach ($foreign as $foreignModel) {
if ($this->areLinked($model, $foreignModel)) {
$linked []= $foreignModel;
... | php | public function linkModels(Models $models, Models $foreign, Closure $yield)
{
foreach ($models as $model) {
$linked = [];
foreach ($foreign as $foreignModel) {
if ($this->areLinked($model, $foreignModel)) {
$linked []= $foreignModel;
... | [
"public",
"function",
"linkModels",
"(",
"Models",
"$",
"models",
",",
"Models",
"$",
"foreign",
",",
"Closure",
"$",
"yield",
")",
"{",
"foreach",
"(",
"$",
"models",
"as",
"$",
"model",
")",
"{",
"$",
"linked",
"=",
"[",
"]",
";",
"foreach",
"(",
... | Iterate models and foreign models one by one and and assign links based on the areLinked method
Yeild the resulted links one by one for further processing.
@param Models $models
@param Models $foreign
@param Closure $yield call for each link | [
"Iterate",
"models",
"and",
"foreign",
"models",
"one",
"by",
"one",
"and",
"and",
"assign",
"links",
"based",
"on",
"the",
"areLinked",
"method",
"Yeild",
"the",
"resulted",
"links",
"one",
"by",
"one",
"for",
"further",
"processing",
"."
] | e0751696521164c86ccd0a76d708df490efd8306 | https://github.com/harp-orm/harp/blob/e0751696521164c86ccd0a76d708df490efd8306/src/Rel/AbstractRel.php#L165-L181 | train |
praxisnetau/silverware-navigation | src/Model/LinkHolder.php | LinkHolder.getEnabledLinks | public function getEnabledLinks()
{
switch ($this->LinkMode) {
case self::MODE_PAGES:
$links = ArrayList::create();
foreach ($this->LinkedPages() as $page) {
$link = $page->toLink();
... | php | public function getEnabledLinks()
{
switch ($this->LinkMode) {
case self::MODE_PAGES:
$links = ArrayList::create();
foreach ($this->LinkedPages() as $page) {
$link = $page->toLink();
... | [
"public",
"function",
"getEnabledLinks",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"LinkMode",
")",
"{",
"case",
"self",
"::",
"MODE_PAGES",
":",
"$",
"links",
"=",
"ArrayList",
"::",
"create",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
... | Answers a list of the enabled links within the receiver.
@return ArrayList | [
"Answers",
"a",
"list",
"of",
"the",
"enabled",
"links",
"within",
"the",
"receiver",
"."
] | 04e6f3003c2871348d5bba7869d4fc273641627e | https://github.com/praxisnetau/silverware-navigation/blob/04e6f3003c2871348d5bba7869d4fc273641627e/src/Model/LinkHolder.php#L316-L341 | train |
atelierspierrot/templatengine | src/TemplateEngine/TemplateObject/CssFile.php | CssFile.addIfExists | public function addIfExists($file_path, $media = 'screen', $condition = null)
{
$_fp = $this->__template->findAsset($file_path);
if ($_fp || \AssetsManager\Loader::isUrl($file_path)) {
return $this->add($file_path, $media, $condition);
}
return $this;
} | php | public function addIfExists($file_path, $media = 'screen', $condition = null)
{
$_fp = $this->__template->findAsset($file_path);
if ($_fp || \AssetsManager\Loader::isUrl($file_path)) {
return $this->add($file_path, $media, $condition);
}
return $this;
} | [
"public",
"function",
"addIfExists",
"(",
"$",
"file_path",
",",
"$",
"media",
"=",
"'screen'",
",",
"$",
"condition",
"=",
"null",
")",
"{",
"$",
"_fp",
"=",
"$",
"this",
"->",
"__template",
"->",
"findAsset",
"(",
"$",
"file_path",
")",
";",
"if",
... | Add a CSS file in CSS stack if it exists
@param string $file_path The new CSS path
@param string $media The media type for the CSS file (default is "screen")
@param string|null $condition Define a condition (for IE) for this stylesheet
@return self | [
"Add",
"a",
"CSS",
"file",
"in",
"CSS",
"stack",
"if",
"it",
"exists"
] | de01b117f882670bed7b322e2d3b8b30fa9ae45f | https://github.com/atelierspierrot/templatengine/blob/de01b117f882670bed7b322e2d3b8b30fa9ae45f/src/TemplateEngine/TemplateObject/CssFile.php#L70-L77 | train |
atelierspierrot/templatengine | src/TemplateEngine/TemplateObject/CssFile.php | CssFile.add | public function add($file_path, $media = 'screen', $condition = null)
{
$_fp = $this->__template->findAsset($file_path);
if ($_fp || \AssetsManager\Loader::isUrl($file_path)) {
$this->registry->addEntry(array(
'file'=>$_fp, 'media'=>$media, 'condition'=>$condition
... | php | public function add($file_path, $media = 'screen', $condition = null)
{
$_fp = $this->__template->findAsset($file_path);
if ($_fp || \AssetsManager\Loader::isUrl($file_path)) {
$this->registry->addEntry(array(
'file'=>$_fp, 'media'=>$media, 'condition'=>$condition
... | [
"public",
"function",
"add",
"(",
"$",
"file_path",
",",
"$",
"media",
"=",
"'screen'",
",",
"$",
"condition",
"=",
"null",
")",
"{",
"$",
"_fp",
"=",
"$",
"this",
"->",
"__template",
"->",
"findAsset",
"(",
"$",
"file_path",
")",
";",
"if",
"(",
"... | Add a CSS file in CSS stack
@param string $file_path The new CSS path
@param string $media The media type for the CSS file (default is "screen")
@param string|null $condition Define a condition (for IE) for this stylesheet
@return self
@throws \InvalidArgumentException if the path doesn't exist | [
"Add",
"a",
"CSS",
"file",
"in",
"CSS",
"stack"
] | de01b117f882670bed7b322e2d3b8b30fa9ae45f | https://github.com/atelierspierrot/templatengine/blob/de01b117f882670bed7b322e2d3b8b30fa9ae45f/src/TemplateEngine/TemplateObject/CssFile.php#L88-L101 | train |
atelierspierrot/templatengine | src/TemplateEngine/TemplateObject/CssFile.php | CssFile.set | public function set(array $files)
{
if (!empty($files)) {
foreach ($files as $_file) {
if (is_array($_file) && isset($_file['file'])) {
$this->add(
$_file['file'],
isset($_file['media']) ? $_file['media'] : '',
... | php | public function set(array $files)
{
if (!empty($files)) {
foreach ($files as $_file) {
if (is_array($_file) && isset($_file['file'])) {
$this->add(
$_file['file'],
isset($_file['media']) ? $_file['media'] : '',
... | [
"public",
"function",
"set",
"(",
"array",
"$",
"files",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"files",
")",
")",
"{",
"foreach",
"(",
"$",
"files",
"as",
"$",
"_file",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"_file",
")",
"&&",
"isse... | Set a full CSS stack
@param array $files An array of CSS files paths
@return self
@see self::add() | [
"Set",
"a",
"full",
"CSS",
"stack"
] | de01b117f882670bed7b322e2d3b8b30fa9ae45f | https://github.com/atelierspierrot/templatengine/blob/de01b117f882670bed7b322e2d3b8b30fa9ae45f/src/TemplateEngine/TemplateObject/CssFile.php#L110-L126 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.