repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MessageContext.php | MessageContext.assertMultipleSuccessMessage | public function assertMultipleSuccessMessage(TableNode $messages)
{
$this->assertValidMessageTable($messages, 'success messages');
foreach ($messages->getHash() as $key => $value) {
$value = array_change_key_case($value);
$message = trim($value['success messages']);
... | php | public function assertMultipleSuccessMessage(TableNode $messages)
{
$this->assertValidMessageTable($messages, 'success messages');
foreach ($messages->getHash() as $key => $value) {
$value = array_change_key_case($value);
$message = trim($value['success messages']);
... | [
"public",
"function",
"assertMultipleSuccessMessage",
"(",
"TableNode",
"$",
"messages",
")",
"{",
"$",
"this",
"->",
"assertValidMessageTable",
"(",
"$",
"messages",
",",
"'success messages'",
")",
";",
"foreach",
"(",
"$",
"messages",
"->",
"getHash",
"(",
")"... | Checks if the current page contains the given set of success messages
@param array $message
An array of texts to be checked. The first row should consist of the
string "Success messages".
@Then I should see the following success messages: | [
"Checks",
"if",
"the",
"current",
"page",
"contains",
"the",
"given",
"set",
"of",
"success",
"messages"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MessageContext.php#L123-L131 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MessageContext.php | MessageContext.assertNotMultipleSuccessMessage | public function assertNotMultipleSuccessMessage(TableNode $messages)
{
$this->assertValidMessageTable($messages, 'success messages');
foreach ($messages->getHash() as $key => $value) {
$value = array_change_key_case($value);
$message = trim($value['success messages']);
... | php | public function assertNotMultipleSuccessMessage(TableNode $messages)
{
$this->assertValidMessageTable($messages, 'success messages');
foreach ($messages->getHash() as $key => $value) {
$value = array_change_key_case($value);
$message = trim($value['success messages']);
... | [
"public",
"function",
"assertNotMultipleSuccessMessage",
"(",
"TableNode",
"$",
"messages",
")",
"{",
"$",
"this",
"->",
"assertValidMessageTable",
"(",
"$",
"messages",
",",
"'success messages'",
")",
";",
"foreach",
"(",
"$",
"messages",
"->",
"getHash",
"(",
... | Checks if the current page does not contain the given set of success messages
@param array $message
An array of texts to be checked. The first row should consist of the
string "Success messages".
@Then I should not see the following success messages: | [
"Checks",
"if",
"the",
"current",
"page",
"does",
"not",
"contain",
"the",
"given",
"set",
"of",
"success",
"messages"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MessageContext.php#L159-L167 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MessageContext.php | MessageContext.assertMultipleWarningMessage | public function assertMultipleWarningMessage(TableNode $messages)
{
$this->assertValidMessageTable($messages, 'warning messages');
foreach ($messages->getHash() as $key => $value) {
$value = array_change_key_case($value);
$message = trim($value['warning messages']);
... | php | public function assertMultipleWarningMessage(TableNode $messages)
{
$this->assertValidMessageTable($messages, 'warning messages');
foreach ($messages->getHash() as $key => $value) {
$value = array_change_key_case($value);
$message = trim($value['warning messages']);
... | [
"public",
"function",
"assertMultipleWarningMessage",
"(",
"TableNode",
"$",
"messages",
")",
"{",
"$",
"this",
"->",
"assertValidMessageTable",
"(",
"$",
"messages",
",",
"'warning messages'",
")",
";",
"foreach",
"(",
"$",
"messages",
"->",
"getHash",
"(",
")"... | Checks if the current page contains the given set of warning messages
@param array $message
An array of texts to be checked. The first row should consist of the
string "Warning messages".
@Then I should see the following warning messages: | [
"Checks",
"if",
"the",
"current",
"page",
"contains",
"the",
"given",
"set",
"of",
"warning",
"messages"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MessageContext.php#L196-L204 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MessageContext.php | MessageContext.assertNotMultipleWarningMessage | public function assertNotMultipleWarningMessage(TableNode $messages)
{
$this->assertValidMessageTable($messages, 'warning messages');
foreach ($messages->getHash() as $key => $value) {
$value = array_change_key_case($value);
$message = trim($value['warning messages']);
... | php | public function assertNotMultipleWarningMessage(TableNode $messages)
{
$this->assertValidMessageTable($messages, 'warning messages');
foreach ($messages->getHash() as $key => $value) {
$value = array_change_key_case($value);
$message = trim($value['warning messages']);
... | [
"public",
"function",
"assertNotMultipleWarningMessage",
"(",
"TableNode",
"$",
"messages",
")",
"{",
"$",
"this",
"->",
"assertValidMessageTable",
"(",
"$",
"messages",
",",
"'warning messages'",
")",
";",
"foreach",
"(",
"$",
"messages",
"->",
"getHash",
"(",
... | Checks if the current page does not contain the given set of warning messages
@param array $message
An array of texts to be checked. The first row should consist of the
string "Warning messages".
@Then I should not see the following warning messages: | [
"Checks",
"if",
"the",
"current",
"page",
"does",
"not",
"contain",
"the",
"given",
"set",
"of",
"warning",
"messages"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MessageContext.php#L232-L240 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MessageContext.php | MessageContext.assertValidMessageTable | protected function assertValidMessageTable(TableNode $messages, $expected_header)
{
// Check that the table only contains a single column.
$header_row = $messages->getRow(0);
$column_count = count($header_row);
if ($column_count != 1) {
throw new \RuntimeException("The l... | php | protected function assertValidMessageTable(TableNode $messages, $expected_header)
{
// Check that the table only contains a single column.
$header_row = $messages->getRow(0);
$column_count = count($header_row);
if ($column_count != 1) {
throw new \RuntimeException("The l... | [
"protected",
"function",
"assertValidMessageTable",
"(",
"TableNode",
"$",
"messages",
",",
"$",
"expected_header",
")",
"{",
"// Check that the table only contains a single column.",
"$",
"header_row",
"=",
"$",
"messages",
"->",
"getRow",
"(",
"0",
")",
";",
"$",
... | Checks whether the given list of messages is valid.
This checks whether the list has only one column and has the correct
header.
@param \Behat\Gherkin\Node\TableNode $messages
The list of messages.
@param string $expected_header
The header that should be present in the list. | [
"Checks",
"whether",
"the",
"given",
"list",
"of",
"messages",
"is",
"valid",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MessageContext.php#L288-L304 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MessageContext.php | MessageContext.assert | private function assert($message, $selectorId, $exceptionMsgNone, $exceptionMsgMissing)
{
$selector = $this->getDrupalSelector($selectorId);
$selectorObjects = $this->getSession()->getPage()->findAll("css", $selector);
if (empty($selectorObjects)) {
throw new ExpectationException... | php | private function assert($message, $selectorId, $exceptionMsgNone, $exceptionMsgMissing)
{
$selector = $this->getDrupalSelector($selectorId);
$selectorObjects = $this->getSession()->getPage()->findAll("css", $selector);
if (empty($selectorObjects)) {
throw new ExpectationException... | [
"private",
"function",
"assert",
"(",
"$",
"message",
",",
"$",
"selectorId",
",",
"$",
"exceptionMsgNone",
",",
"$",
"exceptionMsgMissing",
")",
"{",
"$",
"selector",
"=",
"$",
"this",
"->",
"getDrupalSelector",
"(",
"$",
"selectorId",
")",
";",
"$",
"sel... | Internal callback to check for a specific message in a given context.
@param $message
string The message to be checked
@param $selectorId
string CSS selector name
@param $exceptionMsgNone
string The message being thrown when no message is contained, string
should contain one '%s' as a placeholder for the current URL
@... | [
"Internal",
"callback",
"to",
"check",
"for",
"a",
"specific",
"message",
"in",
"a",
"given",
"context",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MessageContext.php#L323-L336 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MessageContext.php | MessageContext.assertNot | private function assertNot($message, $selectorId, $exceptionMsg)
{
$selector = $this->getDrupalSelector($selectorId);
$selectorObjects = $this->getSession()->getPage()->findAll("css", $selector);
if (!empty($selectorObjects)) {
foreach ($selectorObjects as $selectorObject) {
... | php | private function assertNot($message, $selectorId, $exceptionMsg)
{
$selector = $this->getDrupalSelector($selectorId);
$selectorObjects = $this->getSession()->getPage()->findAll("css", $selector);
if (!empty($selectorObjects)) {
foreach ($selectorObjects as $selectorObject) {
... | [
"private",
"function",
"assertNot",
"(",
"$",
"message",
",",
"$",
"selectorId",
",",
"$",
"exceptionMsg",
")",
"{",
"$",
"selector",
"=",
"$",
"this",
"->",
"getDrupalSelector",
"(",
"$",
"selectorId",
")",
";",
"$",
"selectorObjects",
"=",
"$",
"this",
... | Internal callback to check if the current page does not contain the given message
@param $message
string The message to be checked
@param $selectorId
string CSS selector name
@param $exceptionMsg
string The message being thrown when the message is contained, string
should contain two '%s' as placeholders for the curre... | [
"Internal",
"callback",
"to",
"check",
"if",
"the",
"current",
"page",
"does",
"not",
"contain",
"the",
"given",
"message"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MessageContext.php#L352-L363 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/BatchContext.php | BatchContext.thereIsAnItemInTheSystemQueue | public function thereIsAnItemInTheSystemQueue(TableNode $table)
{
// Gather the data.
$fields = $table->getRowsHash();
// Default data field separately since this is longish.
if (empty($fields['data'])) {
$fields['data'] = json_encode([]);
}
// @see Syst... | php | public function thereIsAnItemInTheSystemQueue(TableNode $table)
{
// Gather the data.
$fields = $table->getRowsHash();
// Default data field separately since this is longish.
if (empty($fields['data'])) {
$fields['data'] = json_encode([]);
}
// @see Syst... | [
"public",
"function",
"thereIsAnItemInTheSystemQueue",
"(",
"TableNode",
"$",
"table",
")",
"{",
"// Gather the data.",
"$",
"fields",
"=",
"$",
"table",
"->",
"getRowsHash",
"(",
")",
";",
"// Default data field separately since this is longish.",
"if",
"(",
"empty",
... | Creates a queue item. Defaults inputs if none are available.
Expects the `data` to be a json encoded string.
@Given there is an item in the system queue: | [
"Creates",
"a",
"queue",
"item",
".",
"Defaults",
"inputs",
"if",
"none",
"are",
"available",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/BatchContext.php#L33-L54 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MarkupContext.php | MarkupContext.assertRegionButton | public function assertRegionButton($button, $region)
{
$regionObj = $this->getRegion($region);
$buttonObj = $regionObj->findButton($button);
if (empty($buttonObj)) {
throw new \Exception(sprintf("The button '%s' was not found in the region '%s' on the page %s", $button, $region,... | php | public function assertRegionButton($button, $region)
{
$regionObj = $this->getRegion($region);
$buttonObj = $regionObj->findButton($button);
if (empty($buttonObj)) {
throw new \Exception(sprintf("The button '%s' was not found in the region '%s' on the page %s", $button, $region,... | [
"public",
"function",
"assertRegionButton",
"(",
"$",
"button",
",",
"$",
"region",
")",
"{",
"$",
"regionObj",
"=",
"$",
"this",
"->",
"getRegion",
"(",
"$",
"region",
")",
";",
"$",
"buttonObj",
"=",
"$",
"regionObj",
"->",
"findButton",
"(",
"$",
"b... | Checks if a button with id|name|title|alt|value exists in a region
@Then I should see the button :button in the :region( region)
@Then I should see the :button button in the :region( region)
@param $button
string The id|name|title|alt|value of the button
@param $region
string The region in which the button should be ... | [
"Checks",
"if",
"a",
"button",
"with",
"id|name|title|alt|value",
"exists",
"in",
"a",
"region"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MarkupContext.php#L51-L59 |
ircmaxell/php-cfg | lib/PHPCfg/Parser.php | Parser.parseExprList | protected function parseExprList(array $expr, $readWrite = self::MODE_NONE): array
{
$vars = array_map([$this, 'parseExprNode'], $expr);
if ($readWrite === self::MODE_READ) {
$vars = array_map([$this, 'readVariable'], $vars);
} elseif ($readWrite === self::MODE_WRITE) {
... | php | protected function parseExprList(array $expr, $readWrite = self::MODE_NONE): array
{
$vars = array_map([$this, 'parseExprNode'], $expr);
if ($readWrite === self::MODE_READ) {
$vars = array_map([$this, 'readVariable'], $vars);
} elseif ($readWrite === self::MODE_WRITE) {
... | [
"protected",
"function",
"parseExprList",
"(",
"array",
"$",
"expr",
",",
"$",
"readWrite",
"=",
"self",
"::",
"MODE_NONE",
")",
":",
"array",
"{",
"$",
"vars",
"=",
"array_map",
"(",
"[",
"$",
"this",
",",
"'parseExprNode'",
"]",
",",
"$",
"expr",
")"... | @param Node[] $expr
@param int $readWrite
@return Operand[] | [
"@param",
"Node",
"[]",
"$expr",
"@param",
"int",
"$readWrite"
] | train | https://github.com/ircmaxell/php-cfg/blob/2e8ac7373dce7067691e098950f0a9faf1037d0b/lib/PHPCfg/Parser.php#L700-L710 |
soberwp/models | dist/symfony/yaml/Parser.php | Parser.parse | public function parse($value, $flags = 0)
{
if (\is_bool($flags)) {
@trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED);
if ($... | php | public function parse($value, $flags = 0)
{
if (\is_bool($flags)) {
@trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED);
if ($... | [
"public",
"function",
"parse",
"(",
"$",
"value",
",",
"$",
"flags",
"=",
"0",
")",
"{",
"if",
"(",
"\\",
"is_bool",
"(",
"$",
"flags",
")",
")",
"{",
"@",
"trigger_error",
"(",
"'Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 ... | Parses a YAML string to a PHP value.
@param string $value A YAML string
@param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior
@return mixed A PHP value
@throws ParseException If the YAML is not valid | [
"Parses",
"a",
"YAML",
"string",
"to",
"a",
"PHP",
"value",
"."
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/dist/symfony/yaml/Parser.php#L93-L161 |
soberwp/models | dist/symfony/yaml/Parser.php | Parser.parseValue | private function parseValue($value, $flags, $context)
{
if (0 === strpos($value, '*')) {
if (false !== $pos = strpos($value, '#')) {
$value = substr($value, 1, $pos - 2);
} else {
$value = substr($value, 1);
}
if (!array_key_ex... | php | private function parseValue($value, $flags, $context)
{
if (0 === strpos($value, '*')) {
if (false !== $pos = strpos($value, '#')) {
$value = substr($value, 1, $pos - 2);
} else {
$value = substr($value, 1);
}
if (!array_key_ex... | [
"private",
"function",
"parseValue",
"(",
"$",
"value",
",",
"$",
"flags",
",",
"$",
"context",
")",
"{",
"if",
"(",
"0",
"===",
"strpos",
"(",
"$",
"value",
",",
"'*'",
")",
")",
"{",
"if",
"(",
"false",
"!==",
"$",
"pos",
"=",
"strpos",
"(",
... | Parses a YAML value.
@param string $value A YAML value
@param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior
@param string $context The parser context (either sequence or mapping)
@return mixed A PHP value
@throws ParseException When reference does not exist | [
"Parses",
"a",
"YAML",
"value",
"."
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/dist/symfony/yaml/Parser.php#L682-L770 |
soberwp/models | dist/symfony/yaml/Parser.php | Parser.parseBlockScalar | private function parseBlockScalar($style, $chomping = '', $indentation = 0)
{
$notEOF = $this->moveToNextLine();
if (!$notEOF) {
return '';
}
$isCurrentLineBlank = $this->isCurrentLineBlank();
$blockLines = array();
// leading blank lines are consumed be... | php | private function parseBlockScalar($style, $chomping = '', $indentation = 0)
{
$notEOF = $this->moveToNextLine();
if (!$notEOF) {
return '';
}
$isCurrentLineBlank = $this->isCurrentLineBlank();
$blockLines = array();
// leading blank lines are consumed be... | [
"private",
"function",
"parseBlockScalar",
"(",
"$",
"style",
",",
"$",
"chomping",
"=",
"''",
",",
"$",
"indentation",
"=",
"0",
")",
"{",
"$",
"notEOF",
"=",
"$",
"this",
"->",
"moveToNextLine",
"(",
")",
";",
"if",
"(",
"!",
"$",
"notEOF",
")",
... | Parses a block scalar.
@param string $style The style indicator that was used to begin this block scalar (| or >)
@param string $chomping The chomping indicator that was used to begin this block scalar (+ or -)
@param int $indentation The indentation indicator that was used to begin this block scalar
@ret... | [
"Parses",
"a",
"block",
"scalar",
"."
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/dist/symfony/yaml/Parser.php#L781-L881 |
soberwp/models | dist/symfony/yaml/Parser.php | Parser.isNextLineUnIndentedCollection | private function isNextLineUnIndentedCollection()
{
$currentIndentation = $this->getCurrentLineIndentation();
$movements = 0;
do {
$EOF = !$this->moveToNextLine();
if (!$EOF) {
++$movements;
}
} while (!$EOF && ($this->isCurrentLi... | php | private function isNextLineUnIndentedCollection()
{
$currentIndentation = $this->getCurrentLineIndentation();
$movements = 0;
do {
$EOF = !$this->moveToNextLine();
if (!$EOF) {
++$movements;
}
} while (!$EOF && ($this->isCurrentLi... | [
"private",
"function",
"isNextLineUnIndentedCollection",
"(",
")",
"{",
"$",
"currentIndentation",
"=",
"$",
"this",
"->",
"getCurrentLineIndentation",
"(",
")",
";",
"$",
"movements",
"=",
"0",
";",
"do",
"{",
"$",
"EOF",
"=",
"!",
"$",
"this",
"->",
"mov... | Returns true if the next line starts unindented collection.
@return bool Returns true if the next line starts unindented collection, false otherwise | [
"Returns",
"true",
"if",
"the",
"next",
"line",
"starts",
"unindented",
"collection",
"."
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/dist/symfony/yaml/Parser.php#L995-L1019 |
soberwp/models | dist/symfony/yaml/Parser.php | Parser.preg_match | public static function preg_match($pattern, $subject, &$matches = null, $flags = 0, $offset = 0)
{
if (false === $ret = preg_match($pattern, $subject, $matches, $flags, $offset)) {
switch (preg_last_error()) {
case PREG_INTERNAL_ERROR:
$error = 'Internal PCRE ... | php | public static function preg_match($pattern, $subject, &$matches = null, $flags = 0, $offset = 0)
{
if (false === $ret = preg_match($pattern, $subject, $matches, $flags, $offset)) {
switch (preg_last_error()) {
case PREG_INTERNAL_ERROR:
$error = 'Internal PCRE ... | [
"public",
"static",
"function",
"preg_match",
"(",
"$",
"pattern",
",",
"$",
"subject",
",",
"&",
"$",
"matches",
"=",
"null",
",",
"$",
"flags",
"=",
"0",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"ret",
"=",
"preg_... | A local wrapper for `preg_match` which will throw a ParseException if there
is an internal error in the PCRE engine.
This avoids us needing to check for "false" every time PCRE is used
in the YAML engine
@throws ParseException on a PCRE internal error
@see preg_last_error()
@internal | [
"A",
"local",
"wrapper",
"for",
"preg_match",
"which",
"will",
"throw",
"a",
"ParseException",
"if",
"there",
"is",
"an",
"internal",
"error",
"in",
"the",
"PCRE",
"engine",
"."
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/dist/symfony/yaml/Parser.php#L1044-L1071 |
soberwp/models | dist/hassankhan/config/src/FileParser/Php.php | Php.parse | public function parse($path)
{
// Require the file, if it throws an exception, rethrow it
try {
$temp = require $path;
} catch (Exception $exception) {
throw new ParseException(
array(
'message' => 'PHP file threw an exception',
... | php | public function parse($path)
{
// Require the file, if it throws an exception, rethrow it
try {
$temp = require $path;
} catch (Exception $exception) {
throw new ParseException(
array(
'message' => 'PHP file threw an exception',
... | [
"public",
"function",
"parse",
"(",
"$",
"path",
")",
"{",
"// Require the file, if it throws an exception, rethrow it",
"try",
"{",
"$",
"temp",
"=",
"require",
"$",
"path",
";",
"}",
"catch",
"(",
"Exception",
"$",
"exception",
")",
"{",
"throw",
"new",
"Par... | {@inheritDoc}
Loads a PHP file and gets its' contents as an array
@throws ParseException If the PHP file throws an exception
@throws UnsupportedFormatException If the PHP file does not return an array | [
"{",
"@inheritDoc",
"}",
"Loads",
"a",
"PHP",
"file",
"and",
"gets",
"its",
"contents",
"as",
"an",
"array"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/dist/hassankhan/config/src/FileParser/Php.php#L27-L52 |
soberwp/models | src/Model.php | Model.setConfig | protected function setConfig()
{
if ($this->data['config']) {
$this->config = array_replace($this->config, $this->data['config']);
}
} | php | protected function setConfig()
{
if ($this->data['config']) {
$this->config = array_replace($this->config, $this->data['config']);
}
} | [
"protected",
"function",
"setConfig",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"data",
"[",
"'config'",
"]",
")",
"{",
"$",
"this",
"->",
"config",
"=",
"array_replace",
"(",
"$",
"this",
"->",
"config",
",",
"$",
"this",
"->",
"data",
"[",
"'c... | Set config
Merge and/or replace defaults with user config | [
"Set",
"config"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/src/Model.php#L57-L62 |
soberwp/models | src/Model.php | Model.setNameLabels | protected function setNameLabels()
{
$this->one = ($this->data['labels.has_one'] ? $this->data['labels.has_one'] : ucfirst($this->name));
$this->many = ($this->data['labels.has_many'] ? $this->data['labels.has_many'] : ucfirst($this->name . 's'));
$this->i18n = ($this->data['labels.text_doma... | php | protected function setNameLabels()
{
$this->one = ($this->data['labels.has_one'] ? $this->data['labels.has_one'] : ucfirst($this->name));
$this->many = ($this->data['labels.has_many'] ? $this->data['labels.has_many'] : ucfirst($this->name . 's'));
$this->i18n = ($this->data['labels.text_doma... | [
"protected",
"function",
"setNameLabels",
"(",
")",
"{",
"$",
"this",
"->",
"one",
"=",
"(",
"$",
"this",
"->",
"data",
"[",
"'labels.has_one'",
"]",
"?",
"$",
"this",
"->",
"data",
"[",
"'labels.has_one'",
"]",
":",
"ucfirst",
"(",
"$",
"this",
"->",
... | Set required labels
Based on name, or keys labels.has-one and labels.has-many | [
"Set",
"required",
"labels"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/src/Model.php#L69-L74 |
soberwp/models | src/Model.php | Model.setLabels | protected function setLabels()
{
if ($this->data['labels.overrides']) {
$this->labels = array_replace($this->labels, $this->data['labels.overrides']);
}
} | php | protected function setLabels()
{
if ($this->data['labels.overrides']) {
$this->labels = array_replace($this->labels, $this->data['labels.overrides']);
}
} | [
"protected",
"function",
"setLabels",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"data",
"[",
"'labels.overrides'",
"]",
")",
"{",
"$",
"this",
"->",
"labels",
"=",
"array_replace",
"(",
"$",
"this",
"->",
"labels",
",",
"$",
"this",
"->",
"data",
... | Set label overrides
If key labels.overrides exists, add to or replace label defaults | [
"Set",
"label",
"overrides"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/src/Model.php#L81-L86 |
soberwp/models | src/Model/Taxonomy.php | Taxonomy.setDefaultConfig | protected function setDefaultConfig()
{
if ($this->data['config']) {
$this->config = $this->data['config'];
}
if (in_array($this->data['type'], ['cat', 'category'])) {
$this->config = ['hierarchical' => true];
}
if ($this->data['links']) {
... | php | protected function setDefaultConfig()
{
if ($this->data['config']) {
$this->config = $this->data['config'];
}
if (in_array($this->data['type'], ['cat', 'category'])) {
$this->config = ['hierarchical' => true];
}
if ($this->data['links']) {
... | [
"protected",
"function",
"setDefaultConfig",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"data",
"[",
"'config'",
"]",
")",
"{",
"$",
"this",
"->",
"config",
"=",
"$",
"this",
"->",
"data",
"[",
"'config'",
"]",
";",
"}",
"if",
"(",
"in_array",
"(... | Set config defaults
Make public and change menu position
@return $this | [
"Set",
"config",
"defaults"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/src/Model/Taxonomy.php#L31-L44 |
soberwp/models | src/Model/Taxonomy.php | Taxonomy.merge | protected function merge()
{
$this->args = [
'labels' => $this->labels
];
$this->args = array_merge($this->args, $this->config);
} | php | protected function merge()
{
$this->args = [
'labels' => $this->labels
];
$this->args = array_merge($this->args, $this->config);
} | [
"protected",
"function",
"merge",
"(",
")",
"{",
"$",
"this",
"->",
"args",
"=",
"[",
"'labels'",
"=>",
"$",
"this",
"->",
"labels",
"]",
";",
"$",
"this",
"->",
"args",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"args",
",",
"$",
"this",
"->",
... | Merge
Args to be passed to WP register_taxonomy()
@return $this | [
"Merge"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/src/Model/Taxonomy.php#L85-L91 |
soberwp/models | src/Model/Taxonomy.php | Taxonomy.register | protected function register()
{
if (function_exists('register_extended_taxonomy')) {
register_extended_taxonomy($this->name, $this->links, $this->args);
} else {
register_taxonomy($this->name, $this->links, $this->args);
}
} | php | protected function register()
{
if (function_exists('register_extended_taxonomy')) {
register_extended_taxonomy($this->name, $this->links, $this->args);
} else {
register_taxonomy($this->name, $this->links, $this->args);
}
} | [
"protected",
"function",
"register",
"(",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'register_extended_taxonomy'",
")",
")",
"{",
"register_extended_taxonomy",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"this",
"->",
"links",
",",
"$",
"this",
"->",
"args... | Register Taxonomy
Uses extended-cpts if available.
@see https://github.com/johnbillion/extended-cpts
@return void | [
"Register",
"Taxonomy"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/src/Model/Taxonomy.php#L101-L108 |
soberwp/models | dist/symfony/yaml/Inline.php | Inline.parse | public static function parse($value, $flags = 0, $references = array())
{
if (\is_bool($flags)) {
@trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_D... | php | public static function parse($value, $flags = 0, $references = array())
{
if (\is_bool($flags)) {
@trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_D... | [
"public",
"static",
"function",
"parse",
"(",
"$",
"value",
",",
"$",
"flags",
"=",
"0",
",",
"$",
"references",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"\\",
"is_bool",
"(",
"$",
"flags",
")",
")",
"{",
"@",
"trigger_error",
"(",
"'Passing a ... | Converts a YAML string to a PHP value.
@param string $value A YAML string
@param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior
@param array $references Mapping of variable names to values
@return mixed A PHP value
@throws ParseException | [
"Converts",
"a",
"YAML",
"string",
"to",
"a",
"PHP",
"value",
"."
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/dist/symfony/yaml/Inline.php#L66-L142 |
soberwp/models | dist/symfony/yaml/Inline.php | Inline.parseSequence | private static function parseSequence($sequence, $flags, &$i = 0, $references = array())
{
$output = array();
$len = \strlen($sequence);
++$i;
// [foo, bar, ...]
while ($i < $len) {
if (']' === $sequence[$i]) {
return $output;
}
... | php | private static function parseSequence($sequence, $flags, &$i = 0, $references = array())
{
$output = array();
$len = \strlen($sequence);
++$i;
// [foo, bar, ...]
while ($i < $len) {
if (']' === $sequence[$i]) {
return $output;
}
... | [
"private",
"static",
"function",
"parseSequence",
"(",
"$",
"sequence",
",",
"$",
"flags",
",",
"&",
"$",
"i",
"=",
"0",
",",
"$",
"references",
"=",
"array",
"(",
")",
")",
"{",
"$",
"output",
"=",
"array",
"(",
")",
";",
"$",
"len",
"=",
"\\",
... | Parses a YAML sequence.
@param string $sequence
@param int $flags
@param int &$i
@param array $references
@return array
@throws ParseException When malformed inline YAML string is parsed | [
"Parses",
"a",
"YAML",
"sequence",
"."
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/dist/symfony/yaml/Inline.php#L410-L465 |
soberwp/models | dist/hassankhan/config/src/Config.php | Config.getParser | private function getParser($extension)
{
foreach ($this->supportedFileParsers as $fileParser) {
if (in_array($extension, $fileParser::getSupportedExtensions($extension))) {
return new $fileParser();
}
}
// If none exist, then throw an exception
... | php | private function getParser($extension)
{
foreach ($this->supportedFileParsers as $fileParser) {
if (in_array($extension, $fileParser::getSupportedExtensions($extension))) {
return new $fileParser();
}
}
// If none exist, then throw an exception
... | [
"private",
"function",
"getParser",
"(",
"$",
"extension",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"supportedFileParsers",
"as",
"$",
"fileParser",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"extension",
",",
"$",
"fileParser",
"::",
"getSupportedExtens... | Gets a parser for a given file extension
@param string $extension
@return Noodlehaus\FileParser\FileParserInterface
@throws UnsupportedFormatException If `$path` is an unsupported file format | [
"Gets",
"a",
"parser",
"for",
"a",
"given",
"file",
"extension"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/dist/hassankhan/config/src/Config.php#L84-L95 |
soberwp/models | dist/hassankhan/config/src/Config.php | Config.getPathFromArray | private function getPathFromArray($path)
{
$paths = array();
foreach ($path as $unverifiedPath) {
try {
// Check if `$unverifiedPath` is optional
// If it exists, then it's added to the list
// If it doesn't, it throws an exception which w... | php | private function getPathFromArray($path)
{
$paths = array();
foreach ($path as $unverifiedPath) {
try {
// Check if `$unverifiedPath` is optional
// If it exists, then it's added to the list
// If it doesn't, it throws an exception which w... | [
"private",
"function",
"getPathFromArray",
"(",
"$",
"path",
")",
"{",
"$",
"paths",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"path",
"as",
"$",
"unverifiedPath",
")",
"{",
"try",
"{",
"// Check if `$unverifiedPath` is optional",
"// If it exists, then ... | Gets an array of paths
@param array $path
@return array
@throws FileNotFoundException If a file is not found at `$path` | [
"Gets",
"an",
"array",
"of",
"paths"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/dist/hassankhan/config/src/Config.php#L106-L133 |
soberwp/models | dist/hassankhan/config/src/Config.php | Config.getValidPath | private function getValidPath($path)
{
// If `$path` is array
if (is_array($path)) {
return $this->getPathFromArray($path);
}
// If `$path` is a directory
if (is_dir($path)) {
$paths = glob($path . '/*.*');
if (empty($paths)) {
... | php | private function getValidPath($path)
{
// If `$path` is array
if (is_array($path)) {
return $this->getPathFromArray($path);
}
// If `$path` is a directory
if (is_dir($path)) {
$paths = glob($path . '/*.*');
if (empty($paths)) {
... | [
"private",
"function",
"getValidPath",
"(",
"$",
"path",
")",
"{",
"// If `$path` is array",
"if",
"(",
"is_array",
"(",
"$",
"path",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getPathFromArray",
"(",
"$",
"path",
")",
";",
"}",
"// If `$path` is a directo... | Checks `$path` to see if it is either an array, a directory, or a file
@param string|array $path
@return array
@throws EmptyDirectoryException If `$path` is an empty directory
@throws FileNotFoundException If a file is not found at `$path` | [
"Checks",
"$path",
"to",
"see",
"if",
"it",
"is",
"either",
"an",
"array",
"a",
"directory",
"or",
"a",
"file"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/dist/hassankhan/config/src/Config.php#L146-L167 |
soberwp/models | src/Loader.php | Loader.getPath | protected function getPath()
{
$default = (file_exists(dirname(get_template_directory()) . '/app') ?
dirname(get_template_directory()) . '/app/models' :
get_stylesheet_directory() . '/models');
$this->path = (has_filter('sober/models/path') ?
... | php | protected function getPath()
{
$default = (file_exists(dirname(get_template_directory()) . '/app') ?
dirname(get_template_directory()) . '/app/models' :
get_stylesheet_directory() . '/models');
$this->path = (has_filter('sober/models/path') ?
... | [
"protected",
"function",
"getPath",
"(",
")",
"{",
"$",
"default",
"=",
"(",
"file_exists",
"(",
"dirname",
"(",
"get_template_directory",
"(",
")",
")",
".",
"'/app'",
")",
"?",
"dirname",
"(",
"get_template_directory",
"(",
")",
")",
".",
"'/app/models'",
... | Get custom path | [
"Get",
"custom",
"path"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/src/Loader.php#L25-L34 |
soberwp/models | src/Loader.php | Loader.load | protected function load()
{
if (file_exists($this->path)) {
$path = new \RecursiveDirectoryIterator($this->path);
foreach (new \RecursiveIteratorIterator($path) as $filename => $file) {
if (in_array(pathinfo($file, PATHINFO_EXTENSION), ['json', 'php', 'yml', 'yaml']))... | php | protected function load()
{
if (file_exists($this->path)) {
$path = new \RecursiveDirectoryIterator($this->path);
foreach (new \RecursiveIteratorIterator($path) as $filename => $file) {
if (in_array(pathinfo($file, PATHINFO_EXTENSION), ['json', 'php', 'yml', 'yaml']))... | [
"protected",
"function",
"load",
"(",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
"path",
")",
")",
"{",
"$",
"path",
"=",
"new",
"\\",
"RecursiveDirectoryIterator",
"(",
"$",
"this",
"->",
"path",
")",
";",
"foreach",
"(",
"new",
"\\... | Load | [
"Load"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/src/Loader.php#L39-L50 |
soberwp/models | src/Loader.php | Loader.route | protected function route($config)
{
if (in_array($config['type'], ['post-type', 'cpt', 'posttype', 'post_type'])) {
(new PostType($config))->run();
}
if (in_array($config['type'], ['taxonomy', 'tax', 'category', 'cat', 'tag'])) {
(new Taxonomy($config))->run();
... | php | protected function route($config)
{
if (in_array($config['type'], ['post-type', 'cpt', 'posttype', 'post_type'])) {
(new PostType($config))->run();
}
if (in_array($config['type'], ['taxonomy', 'tax', 'category', 'cat', 'tag'])) {
(new Taxonomy($config))->run();
... | [
"protected",
"function",
"route",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"config",
"[",
"'type'",
"]",
",",
"[",
"'post-type'",
",",
"'cpt'",
",",
"'posttype'",
",",
"'post_type'",
"]",
")",
")",
"{",
"(",
"new",
"PostType",
"... | Route to class | [
"Route",
"to",
"class"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/src/Loader.php#L73-L81 |
soberwp/models | dist/hassankhan/config/src/FileParser/Yaml.php | Yaml.parse | public function parse($path)
{
try {
$data = YamlParser::parse(file_get_contents($path), YamlParser::PARSE_CONSTANT);
} catch (Exception $exception) {
throw new ParseException(
array(
'message' => 'Error parsing YAML file',
... | php | public function parse($path)
{
try {
$data = YamlParser::parse(file_get_contents($path), YamlParser::PARSE_CONSTANT);
} catch (Exception $exception) {
throw new ParseException(
array(
'message' => 'Error parsing YAML file',
... | [
"public",
"function",
"parse",
"(",
"$",
"path",
")",
"{",
"try",
"{",
"$",
"data",
"=",
"YamlParser",
"::",
"parse",
"(",
"file_get_contents",
"(",
"$",
"path",
")",
",",
"YamlParser",
"::",
"PARSE_CONSTANT",
")",
";",
"}",
"catch",
"(",
"Exception",
... | {@inheritDoc}
Loads a YAML/YML file as an array
@throws ParseException If If there is an error parsing the YAML file | [
"{",
"@inheritDoc",
"}",
"Loads",
"a",
"YAML",
"/",
"YML",
"file",
"as",
"an",
"array"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/dist/hassankhan/config/src/FileParser/Yaml.php#L26-L40 |
soberwp/models | dist/hassankhan/config/src/FileParser/Ini.php | Ini.parse | public function parse($path)
{
$data = @parse_ini_file($path, true);
if (!$data) {
$error = error_get_last();
// parse_ini_file() may return NULL but set no error if the file contains no parsable data
if (!is_array($error)) {
$error["message"] = ... | php | public function parse($path)
{
$data = @parse_ini_file($path, true);
if (!$data) {
$error = error_get_last();
// parse_ini_file() may return NULL but set no error if the file contains no parsable data
if (!is_array($error)) {
$error["message"] = ... | [
"public",
"function",
"parse",
"(",
"$",
"path",
")",
"{",
"$",
"data",
"=",
"@",
"parse_ini_file",
"(",
"$",
"path",
",",
"true",
")",
";",
"if",
"(",
"!",
"$",
"data",
")",
"{",
"$",
"error",
"=",
"error_get_last",
"(",
")",
";",
"// parse_ini_fi... | {@inheritDoc}
Parses an INI file as an array
@throws ParseException If there is an error parsing the INI file | [
"{",
"@inheritDoc",
"}",
"Parses",
"an",
"INI",
"file",
"as",
"an",
"array"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/dist/hassankhan/config/src/FileParser/Ini.php#L26-L48 |
soberwp/models | dist/hassankhan/config/src/FileParser/Ini.php | Ini.expandDottedKey | protected function expandDottedKey($data)
{
foreach ($data as $key => $value) {
if (($found = strpos($key, '.')) !== false) {
$newKey = substr($key, 0, $found);
$remainder = substr($key, $found + 1);
$expandedValue = $this->expandDottedKey(array($... | php | protected function expandDottedKey($data)
{
foreach ($data as $key => $value) {
if (($found = strpos($key, '.')) !== false) {
$newKey = substr($key, 0, $found);
$remainder = substr($key, $found + 1);
$expandedValue = $this->expandDottedKey(array($... | [
"protected",
"function",
"expandDottedKey",
"(",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"(",
"$",
"found",
"=",
"strpos",
"(",
"$",
"key",
",",
"'.'",
")",
")",
"!==",
"false... | Expand array with dotted keys to multidimensional array
@param array $data
@return array | [
"Expand",
"array",
"with",
"dotted",
"keys",
"to",
"multidimensional",
"array"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/dist/hassankhan/config/src/FileParser/Ini.php#L57-L74 |
soberwp/models | dist/hassankhan/config/src/FileParser/Xml.php | Xml.parse | public function parse($path)
{
libxml_use_internal_errors(true);
$data = simplexml_load_file($path, null, LIBXML_NOERROR);
if ($data === false) {
$errors = libxml_get_errors();
$latestError = array_pop($errors);
$error = array(
... | php | public function parse($path)
{
libxml_use_internal_errors(true);
$data = simplexml_load_file($path, null, LIBXML_NOERROR);
if ($data === false) {
$errors = libxml_get_errors();
$latestError = array_pop($errors);
$error = array(
... | [
"public",
"function",
"parse",
"(",
"$",
"path",
")",
"{",
"libxml_use_internal_errors",
"(",
"true",
")",
";",
"$",
"data",
"=",
"simplexml_load_file",
"(",
"$",
"path",
",",
"null",
",",
"LIBXML_NOERROR",
")",
";",
"if",
"(",
"$",
"data",
"===",
"false... | {@inheritDoc}
Parses an XML file as an array
@throws ParseException If there is an error parsing the XML file | [
"{",
"@inheritDoc",
"}",
"Parses",
"an",
"XML",
"file",
"as",
"an",
"array"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/dist/hassankhan/config/src/FileParser/Xml.php#L24-L46 |
soberwp/models | dist/symfony/yaml/Unescaper.php | Unescaper.unescapeDoubleQuotedString | public function unescapeDoubleQuotedString($value)
{
$callback = function ($match) {
return $this->unescapeCharacter($match[0]);
};
// evaluate the string
return preg_replace_callback('/'.self::REGEX_ESCAPED_CHARACTER.'/u', $callback, $value);
} | php | public function unescapeDoubleQuotedString($value)
{
$callback = function ($match) {
return $this->unescapeCharacter($match[0]);
};
// evaluate the string
return preg_replace_callback('/'.self::REGEX_ESCAPED_CHARACTER.'/u', $callback, $value);
} | [
"public",
"function",
"unescapeDoubleQuotedString",
"(",
"$",
"value",
")",
"{",
"$",
"callback",
"=",
"function",
"(",
"$",
"match",
")",
"{",
"return",
"$",
"this",
"->",
"unescapeCharacter",
"(",
"$",
"match",
"[",
"0",
"]",
")",
";",
"}",
";",
"// ... | Unescapes a double quoted string.
@param string $value A double quoted string
@return string The unescaped string | [
"Unescapes",
"a",
"double",
"quoted",
"string",
"."
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/dist/symfony/yaml/Unescaper.php#L50-L58 |
soberwp/models | src/Model/PostType.php | PostType.setDefaultLabels | protected function setDefaultLabels()
{
$this->labels = [
'name' => _x($this->many, 'Post type general name', $this->i18n),
'singular_name' => _x($this->one, 'Post type singular name', $this->i18n),
'menu_name' => _x($this->many, 'Admi... | php | protected function setDefaultLabels()
{
$this->labels = [
'name' => _x($this->many, 'Post type general name', $this->i18n),
'singular_name' => _x($this->one, 'Post type singular name', $this->i18n),
'menu_name' => _x($this->many, 'Admi... | [
"protected",
"function",
"setDefaultLabels",
"(",
")",
"{",
"$",
"this",
"->",
"labels",
"=",
"[",
"'name'",
"=>",
"_x",
"(",
"$",
"this",
"->",
"many",
",",
"'Post type general name'",
",",
"$",
"this",
"->",
"i18n",
")",
",",
"'singular_name'",
"=>",
"... | Set default labels
Create an labels array and implement default singular and plural labels
@return $this | [
"Set",
"default",
"labels"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/src/Model/PostType.php#L48-L75 |
soberwp/models | src/Model/PostType.php | PostType.register | protected function register()
{
if (function_exists('register_extended_post_type')) {
register_extended_post_type($this->name, $this->args);
} else {
register_post_type($this->name, $this->args);
}
} | php | protected function register()
{
if (function_exists('register_extended_post_type')) {
register_extended_post_type($this->name, $this->args);
} else {
register_post_type($this->name, $this->args);
}
} | [
"protected",
"function",
"register",
"(",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'register_extended_post_type'",
")",
")",
"{",
"register_extended_post_type",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"this",
"->",
"args",
")",
";",
"}",
"else",
"{",
... | Register Post Type
Uses extended-cpts if available.
@see https://github.com/johnbillion/extended-cpts
@return void | [
"Register",
"Post",
"Type"
] | train | https://github.com/soberwp/models/blob/d0e052c8281910f6081596b33789fc31a9ed1e68/src/Model/PostType.php#L100-L107 |
browscap/browscap-php | src/Parser/Helper/GetData.php | GetData.getSettings | public function getSettings(string $pattern, array $settings = []) : array
{
// The pattern has been pre-quoted on generation to speed up the pattern search,
// but for this check we need the unquoted version
$unquotedPattern = $this->quoter->pregUnQuote($pattern);
// Try to get set... | php | public function getSettings(string $pattern, array $settings = []) : array
{
// The pattern has been pre-quoted on generation to speed up the pattern search,
// but for this check we need the unquoted version
$unquotedPattern = $this->quoter->pregUnQuote($pattern);
// Try to get set... | [
"public",
"function",
"getSettings",
"(",
"string",
"$",
"pattern",
",",
"array",
"$",
"settings",
"=",
"[",
"]",
")",
":",
"array",
"{",
"// The pattern has been pre-quoted on generation to speed up the pattern search,",
"// but for this check we need the unquoted version",
... | Gets the settings for a given pattern (method calls itself to
get the data from the parent patterns)
@param string $pattern
@param array $settings
@throws \UnexpectedValueException
@return array | [
"Gets",
"the",
"settings",
"for",
"a",
"given",
"pattern",
"(",
"method",
"calls",
"itself",
"to",
"get",
"the",
"data",
"from",
"the",
"parent",
"patterns",
")"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Parser/Helper/GetData.php#L63-L104 |
browscap/browscap-php | src/Parser/Helper/GetData.php | GetData.getIniPart | private function getIniPart(string $pattern) : array
{
$pattern = strtolower($pattern);
$patternhash = Pattern::getHashForParts($pattern);
$subkey = SubKey::getIniPartCacheSubKey($patternhash);
try {
if (! $this->cache->hasItem('browscap.iniparts.' . $subkey, true)) {
... | php | private function getIniPart(string $pattern) : array
{
$pattern = strtolower($pattern);
$patternhash = Pattern::getHashForParts($pattern);
$subkey = SubKey::getIniPartCacheSubKey($patternhash);
try {
if (! $this->cache->hasItem('browscap.iniparts.' . $subkey, true)) {
... | [
"private",
"function",
"getIniPart",
"(",
"string",
"$",
"pattern",
")",
":",
"array",
"{",
"$",
"pattern",
"=",
"strtolower",
"(",
"$",
"pattern",
")",
";",
"$",
"patternhash",
"=",
"Pattern",
"::",
"getHashForParts",
"(",
"$",
"pattern",
")",
";",
"$",... | Gets the relevant part (array of settings) of the ini file for a given pattern.
@param string $pattern
@return array | [
"Gets",
"the",
"relevant",
"part",
"(",
"array",
"of",
"settings",
")",
"of",
"the",
"ini",
"file",
"for",
"a",
"given",
"pattern",
"."
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Parser/Helper/GetData.php#L113-L180 |
browscap/browscap-php | src/Formatter/PhpGetBrowser.php | PhpGetBrowser.setData | public function setData(array $settings) : void
{
foreach ($settings as $key => $value) {
$this->data[strtolower($key)] = $value;
}
} | php | public function setData(array $settings) : void
{
foreach ($settings as $key => $value) {
$this->data[strtolower($key)] = $value;
}
} | [
"public",
"function",
"setData",
"(",
"array",
"$",
"settings",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"settings",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"strtolower",
"(",
"$",
"key",
")",
"]",
"=",
... | Sets the data (done by the parser)
@param array $settings | [
"Sets",
"the",
"data",
"(",
"done",
"by",
"the",
"parser",
")"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Formatter/PhpGetBrowser.php#L81-L86 |
browscap/browscap-php | src/Formatter/PhpGetBrowser.php | PhpGetBrowser.getData | public function getData() : \stdClass
{
$output = new \stdClass();
$propertyNames = array_keys($this->defaultProperties);
foreach ($propertyNames as $property) {
$key = strtolower($property);
if (array_key_exists($key, $this->data)) {
$output->{$key}... | php | public function getData() : \stdClass
{
$output = new \stdClass();
$propertyNames = array_keys($this->defaultProperties);
foreach ($propertyNames as $property) {
$key = strtolower($property);
if (array_key_exists($key, $this->data)) {
$output->{$key}... | [
"public",
"function",
"getData",
"(",
")",
":",
"\\",
"stdClass",
"{",
"$",
"output",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"propertyNames",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"defaultProperties",
")",
";",
"foreach",
"(",
"$",
"pro... | Gets the data (in the preferred format)
@return \stdClass | [
"Gets",
"the",
"data",
"(",
"in",
"the",
"preferred",
"format",
")"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Formatter/PhpGetBrowser.php#L93-L115 |
browscap/browscap-php | src/Helper/Support.php | Support.getUserAgent | public function getUserAgent() : string
{
$userAgent = '';
foreach ($this->userAgentHeaders as $header) {
if (array_key_exists($header, $this->source)
&& $this->source[$header]
) {
$userAgent = $this->cleanParam($this->source[$header]);
... | php | public function getUserAgent() : string
{
$userAgent = '';
foreach ($this->userAgentHeaders as $header) {
if (array_key_exists($header, $this->source)
&& $this->source[$header]
) {
$userAgent = $this->cleanParam($this->source[$header]);
... | [
"public",
"function",
"getUserAgent",
"(",
")",
":",
"string",
"{",
"$",
"userAgent",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"userAgentHeaders",
"as",
"$",
"header",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"header",
",",
"$",
"th... | detect the useragent
@return string | [
"detect",
"the",
"useragent"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Helper/Support.php#L48-L63 |
browscap/browscap-php | src/Cache/BrowscapCache.php | BrowscapCache.getVersion | public function getVersion() : ?int
{
if (null === $this->version) {
$success = null;
try {
$version = $this->getItem('browscap.version', false, $success);
} catch (InvalidArgumentException $e) {
$this->logger->error(new \InvalidArgumentEx... | php | public function getVersion() : ?int
{
if (null === $this->version) {
$success = null;
try {
$version = $this->getItem('browscap.version', false, $success);
} catch (InvalidArgumentException $e) {
$this->logger->error(new \InvalidArgumentEx... | [
"public",
"function",
"getVersion",
"(",
")",
":",
"?",
"int",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"version",
")",
"{",
"$",
"success",
"=",
"null",
";",
"try",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"getItem",
"(",
"'browscap.v... | Gets the version of the Browscap data
@return int | [
"Gets",
"the",
"version",
"of",
"the",
"Browscap",
"data"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Cache/BrowscapCache.php#L66-L84 |
browscap/browscap-php | src/Cache/BrowscapCache.php | BrowscapCache.getReleaseDate | public function getReleaseDate() : ?string
{
if (null === $this->releaseDate) {
$success = null;
try {
$releaseDate = $this->getItem('browscap.releaseDate', false, $success);
} catch (InvalidArgumentException $e) {
$this->logger->error(new... | php | public function getReleaseDate() : ?string
{
if (null === $this->releaseDate) {
$success = null;
try {
$releaseDate = $this->getItem('browscap.releaseDate', false, $success);
} catch (InvalidArgumentException $e) {
$this->logger->error(new... | [
"public",
"function",
"getReleaseDate",
"(",
")",
":",
"?",
"string",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"releaseDate",
")",
"{",
"$",
"success",
"=",
"null",
";",
"try",
"{",
"$",
"releaseDate",
"=",
"$",
"this",
"->",
"getItem",
"(",... | Gets the release date of the Browscap data
@return string|null | [
"Gets",
"the",
"release",
"date",
"of",
"the",
"Browscap",
"data"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Cache/BrowscapCache.php#L91-L109 |
browscap/browscap-php | src/Cache/BrowscapCache.php | BrowscapCache.getType | public function getType() : ?string
{
if (null === $this->type) {
$success = null;
try {
$type = $this->getItem('browscap.type', false, $success);
} catch (InvalidArgumentException $e) {
$this->logger->error(new \InvalidArgumentException('... | php | public function getType() : ?string
{
if (null === $this->type) {
$success = null;
try {
$type = $this->getItem('browscap.type', false, $success);
} catch (InvalidArgumentException $e) {
$this->logger->error(new \InvalidArgumentException('... | [
"public",
"function",
"getType",
"(",
")",
":",
"?",
"string",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"type",
")",
"{",
"$",
"success",
"=",
"null",
";",
"try",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"getItem",
"(",
"'browscap.type'",... | Gets the type of the Browscap data | [
"Gets",
"the",
"type",
"of",
"the",
"Browscap",
"data"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Cache/BrowscapCache.php#L114-L132 |
browscap/browscap-php | src/Cache/BrowscapCache.php | BrowscapCache.getItem | public function getItem(string $cacheId, bool $withVersion = true, ?bool &$success = null)
{
if ($withVersion) {
$cacheId .= '.' . $this->getVersion();
}
if (! $this->cache->has($cacheId)) {
$success = false;
return null;
}
$data = $this... | php | public function getItem(string $cacheId, bool $withVersion = true, ?bool &$success = null)
{
if ($withVersion) {
$cacheId .= '.' . $this->getVersion();
}
if (! $this->cache->has($cacheId)) {
$success = false;
return null;
}
$data = $this... | [
"public",
"function",
"getItem",
"(",
"string",
"$",
"cacheId",
",",
"bool",
"$",
"withVersion",
"=",
"true",
",",
"?",
"bool",
"&",
"$",
"success",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"withVersion",
")",
"{",
"$",
"cacheId",
".=",
"'.'",
".",
"... | Get an item.
@param string $cacheId
@param bool $withVersion
@param bool $success
@throws \Psr\SimpleCache\InvalidArgumentException
@return mixed Data on success, null on failure | [
"Get",
"an",
"item",
"."
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Cache/BrowscapCache.php#L145-L168 |
browscap/browscap-php | src/Cache/BrowscapCache.php | BrowscapCache.setItem | public function setItem(string $cacheId, $content, bool $withVersion = true) : bool
{
// Get the whole PHP code
$data = [
'content' => serialize($content),
];
if ($withVersion) {
$cacheId .= '.' . $this->getVersion();
}
// Save and return
... | php | public function setItem(string $cacheId, $content, bool $withVersion = true) : bool
{
// Get the whole PHP code
$data = [
'content' => serialize($content),
];
if ($withVersion) {
$cacheId .= '.' . $this->getVersion();
}
// Save and return
... | [
"public",
"function",
"setItem",
"(",
"string",
"$",
"cacheId",
",",
"$",
"content",
",",
"bool",
"$",
"withVersion",
"=",
"true",
")",
":",
"bool",
"{",
"// Get the whole PHP code",
"$",
"data",
"=",
"[",
"'content'",
"=>",
"serialize",
"(",
"$",
"content... | save the content into an php file
@param string $cacheId The cache id
@param mixed $content The content to store
@param bool $withVersion
@throws \Psr\SimpleCache\InvalidArgumentException
@return bool whether the file was correctly written to the disk | [
"save",
"the",
"content",
"into",
"an",
"php",
"file"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Cache/BrowscapCache.php#L181-L194 |
browscap/browscap-php | src/Cache/BrowscapCache.php | BrowscapCache.hasItem | public function hasItem(string $cacheId, bool $withVersion = true) : bool
{
if ($withVersion) {
$cacheId .= '.' . $this->getVersion();
}
return $this->cache->has($cacheId);
} | php | public function hasItem(string $cacheId, bool $withVersion = true) : bool
{
if ($withVersion) {
$cacheId .= '.' . $this->getVersion();
}
return $this->cache->has($cacheId);
} | [
"public",
"function",
"hasItem",
"(",
"string",
"$",
"cacheId",
",",
"bool",
"$",
"withVersion",
"=",
"true",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"withVersion",
")",
"{",
"$",
"cacheId",
".=",
"'.'",
".",
"$",
"this",
"->",
"getVersion",
"(",
")",... | Test if an item exists.
@param string $cacheId
@param bool $withVersion
@throws \Psr\SimpleCache\InvalidArgumentException
@return bool | [
"Test",
"if",
"an",
"item",
"exists",
"."
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Cache/BrowscapCache.php#L206-L213 |
browscap/browscap-php | src/Cache/BrowscapCache.php | BrowscapCache.removeItem | public function removeItem(string $cacheId, bool $withVersion = true) : bool
{
if ($withVersion) {
$cacheId .= '.' . $this->getVersion();
}
return $this->cache->delete($cacheId);
} | php | public function removeItem(string $cacheId, bool $withVersion = true) : bool
{
if ($withVersion) {
$cacheId .= '.' . $this->getVersion();
}
return $this->cache->delete($cacheId);
} | [
"public",
"function",
"removeItem",
"(",
"string",
"$",
"cacheId",
",",
"bool",
"$",
"withVersion",
"=",
"true",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"withVersion",
")",
"{",
"$",
"cacheId",
".=",
"'.'",
".",
"$",
"this",
"->",
"getVersion",
"(",
"... | Remove an item.
@param string $cacheId
@param bool $withVersion
@throws \Psr\SimpleCache\InvalidArgumentException
@return bool | [
"Remove",
"an",
"item",
"."
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Cache/BrowscapCache.php#L225-L232 |
browscap/browscap-php | src/Parser/Helper/SubKey.php | SubKey.getAllPatternCacheSubkeys | public static function getAllPatternCacheSubkeys() : array
{
$subkeys = [];
$chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
foreach ($chars as $charOne) {
foreach ($chars as $charTwo) {
$subkeys[$charOne . $charTwo] = ''... | php | public static function getAllPatternCacheSubkeys() : array
{
$subkeys = [];
$chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
foreach ($chars as $charOne) {
foreach ($chars as $charTwo) {
$subkeys[$charOne . $charTwo] = ''... | [
"public",
"static",
"function",
"getAllPatternCacheSubkeys",
"(",
")",
":",
"array",
"{",
"$",
"subkeys",
"=",
"[",
"]",
";",
"$",
"chars",
"=",
"[",
"'0'",
",",
"'1'",
",",
"'2'",
",",
"'3'",
",",
"'4'",
",",
"'5'",
",",
"'6'",
",",
"'7'",
",",
... | Gets all subkeys for the pattern cache files
@return string[] | [
"Gets",
"all",
"subkeys",
"for",
"the",
"pattern",
"cache",
"files"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Parser/Helper/SubKey.php#L32-L44 |
browscap/browscap-php | src/Parser/Helper/SubKey.php | SubKey.getAllIniPartCacheSubKeys | public static function getAllIniPartCacheSubKeys() : array
{
$subKeys = [];
$chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
foreach ($chars as $charOne) {
foreach ($chars as $charTwo) {
foreach ($chars as $charThree) {
... | php | public static function getAllIniPartCacheSubKeys() : array
{
$subKeys = [];
$chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
foreach ($chars as $charOne) {
foreach ($chars as $charTwo) {
foreach ($chars as $charThree) {
... | [
"public",
"static",
"function",
"getAllIniPartCacheSubKeys",
"(",
")",
":",
"array",
"{",
"$",
"subKeys",
"=",
"[",
"]",
";",
"$",
"chars",
"=",
"[",
"'0'",
",",
"'1'",
",",
"'2'",
",",
"'3'",
",",
"'4'",
",",
"'5'",
",",
"'6'",
",",
"'7'",
",",
... | Gets all sub keys for the inipart cache files
@return string[] | [
"Gets",
"all",
"sub",
"keys",
"for",
"the",
"inipart",
"cache",
"files"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Parser/Helper/SubKey.php#L63-L77 |
browscap/browscap-php | src/Command/ParserCommand.php | ParserCommand.execute | protected function execute(InputInterface $input, OutputInterface $output) : int
{
$logger = LoggerHelper::createDefaultLogger($output);
/** @var string $cacheOption */
$cacheOption = $input->getOption('cache');
$fileCache = new FilesystemCache($cacheOption);
$cache = new Si... | php | protected function execute(InputInterface $input, OutputInterface $output) : int
{
$logger = LoggerHelper::createDefaultLogger($output);
/** @var string $cacheOption */
$cacheOption = $input->getOption('cache');
$fileCache = new FilesystemCache($cacheOption);
$cache = new Si... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
":",
"int",
"{",
"$",
"logger",
"=",
"LoggerHelper",
"::",
"createDefaultLogger",
"(",
"$",
"output",
")",
";",
"/** @var string $cacheOption */",
... | @param \Symfony\Component\Console\Input\InputInterface $input
@param \Symfony\Component\Console\Output\OutputInterface $output
@return int | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Console",
"\\",
"Input",
"\\",
"InputInterface",
"$input",
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Console",
"\\",
"Output",
"\\",
"OutputInterface",
"$output"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Command/ParserCommand.php#L61-L92 |
browscap/browscap-php | src/Parser/Helper/Pattern.php | Pattern.getHashForPattern | public static function getHashForPattern(string $pattern, bool $variants = false) : array
{
$regex = '/^([^\.\*\?\s\r\n\\\\]+).*$/';
$pattern = substr($pattern, 0, 32);
$matches = [];
if (! preg_match($regex, $pattern, $matches)) {
return [md5('')];
}
if... | php | public static function getHashForPattern(string $pattern, bool $variants = false) : array
{
$regex = '/^([^\.\*\?\s\r\n\\\\]+).*$/';
$pattern = substr($pattern, 0, 32);
$matches = [];
if (! preg_match($regex, $pattern, $matches)) {
return [md5('')];
}
if... | [
"public",
"static",
"function",
"getHashForPattern",
"(",
"string",
"$",
"pattern",
",",
"bool",
"$",
"variants",
"=",
"false",
")",
":",
"array",
"{",
"$",
"regex",
"=",
"'/^([^\\.\\*\\?\\s\\r\\n\\\\\\\\]+).*$/'",
";",
"$",
"pattern",
"=",
"substr",
"(",
"$",... | Gets a hash or an array of hashes from the first characters of a pattern/user agent, that can
be used for a fast comparison, by comparing only the hashes, without having to match the
complete pattern against the user agent.
With the variants options, all variants from the maximum number of pattern characters to one
ch... | [
"Gets",
"a",
"hash",
"or",
"an",
"array",
"of",
"hashes",
"from",
"the",
"first",
"characters",
"of",
"a",
"pattern",
"/",
"user",
"agent",
"that",
"can",
"be",
"used",
"for",
"a",
"fast",
"comparison",
"by",
"comparing",
"only",
"the",
"hashes",
"withou... | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Parser/Helper/Pattern.php#L39-L71 |
browscap/browscap-php | src/Data/PropertyHolder.php | PropertyHolder.checkValueInArray | public function checkValueInArray(string $property, string $value) : string
{
switch ($property) {
case 'Browser_Type':
$allowedValues = [
'Useragent Anonymizer' => 1,
'Browser' => 1,
'Offline Browser' => 1,
... | php | public function checkValueInArray(string $property, string $value) : string
{
switch ($property) {
case 'Browser_Type':
$allowedValues = [
'Useragent Anonymizer' => 1,
'Browser' => 1,
'Offline Browser' => 1,
... | [
"public",
"function",
"checkValueInArray",
"(",
"string",
"$",
"property",
",",
"string",
"$",
"value",
")",
":",
"string",
"{",
"switch",
"(",
"$",
"property",
")",
"{",
"case",
"'Browser_Type'",
":",
"$",
"allowedValues",
"=",
"[",
"'Useragent Anonymizer'",
... | @param string $property
@param string $value
@throws \InvalidArgumentException
@return string | [
"@param",
"string",
"$property",
"@param",
"string",
"$value"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Data/PropertyHolder.php#L130-L204 |
browscap/browscap-php | src/Helper/LoggerHelper.php | LoggerHelper.createDefaultLogger | public static function createDefaultLogger(OutputInterface $output) : LoggerInterface
{
$logger = new Logger('browscap');
$consoleLogger = new ConsoleLogger($output);
$psrHandler = new PsrHandler($consoleLogger);
$logger->pushHandler($psrHandler);
/** @var callable $memoryP... | php | public static function createDefaultLogger(OutputInterface $output) : LoggerInterface
{
$logger = new Logger('browscap');
$consoleLogger = new ConsoleLogger($output);
$psrHandler = new PsrHandler($consoleLogger);
$logger->pushHandler($psrHandler);
/** @var callable $memoryP... | [
"public",
"static",
"function",
"createDefaultLogger",
"(",
"OutputInterface",
"$",
"output",
")",
":",
"LoggerInterface",
"{",
"$",
"logger",
"=",
"new",
"Logger",
"(",
"'browscap'",
")",
";",
"$",
"consoleLogger",
"=",
"new",
"ConsoleLogger",
"(",
"$",
"outp... | creates a \Monolog\Logger instance
@param \Symfony\Component\Console\Output\OutputInterface $output
@return LoggerInterface | [
"creates",
"a",
"\\",
"Monolog",
"\\",
"Logger",
"instance"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Helper/LoggerHelper.php#L31-L50 |
browscap/browscap-php | src/Helper/Filesystem.php | Filesystem.dumpFile | public function dumpFile($filename, $content, ?int $mode = 0666) : void
{
$dir = dirname($filename);
if (! is_dir($dir)) {
$this->mkdir($dir);
} elseif (! is_writable($dir)) {
throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $di... | php | public function dumpFile($filename, $content, ?int $mode = 0666) : void
{
$dir = dirname($filename);
if (! is_dir($dir)) {
$this->mkdir($dir);
} elseif (! is_writable($dir)) {
throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $di... | [
"public",
"function",
"dumpFile",
"(",
"$",
"filename",
",",
"$",
"content",
",",
"?",
"int",
"$",
"mode",
"=",
"0666",
")",
":",
"void",
"{",
"$",
"dir",
"=",
"dirname",
"(",
"$",
"filename",
")",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"dir",
... | Atomically dumps content into a file.
@param string $filename The file to be written to.
@param string $content The data to write into the file.
@param int|null $mode The file mode (octal). If null, file permissions are not modified
Deprecated since version 2.3.12, to be removed in 3.0.
@throws I... | [
"Atomically",
"dumps",
"content",
"into",
"a",
"file",
"."
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Helper/Filesystem.php#L24-L52 |
browscap/browscap-php | src/BrowscapUpdater.php | BrowscapUpdater.convertFile | public function convertFile(string $iniFile) : void
{
if (empty($iniFile)) {
throw new FileNameMissingException('the file name can not be empty');
}
if (! is_readable($iniFile)) {
throw new FileNotFoundException('it was not possible to read the local file ' . $iniFil... | php | public function convertFile(string $iniFile) : void
{
if (empty($iniFile)) {
throw new FileNameMissingException('the file name can not be empty');
}
if (! is_readable($iniFile)) {
throw new FileNotFoundException('it was not possible to read the local file ' . $iniFil... | [
"public",
"function",
"convertFile",
"(",
"string",
"$",
"iniFile",
")",
":",
"void",
"{",
"if",
"(",
"empty",
"(",
"$",
"iniFile",
")",
")",
"{",
"throw",
"new",
"FileNameMissingException",
"(",
"'the file name can not be empty'",
")",
";",
"}",
"if",
"(",
... | reads and parses an ini file and writes the results into the cache
@param string $iniFile
@throws \BrowscapPHP\Exception\FileNameMissingException
@throws \BrowscapPHP\Exception\FileNotFoundException
@throws \BrowscapPHP\Exception\ErrorReadingFileException | [
"reads",
"and",
"parses",
"an",
"ini",
"file",
"and",
"writes",
"the",
"results",
"into",
"the",
"cache"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/BrowscapUpdater.php#L90-L107 |
browscap/browscap-php | src/BrowscapUpdater.php | BrowscapUpdater.convertString | public function convertString(string $iniString) : void
{
try {
$cachedVersion = $this->cache->getItem('browscap.version', false, $success);
} catch (InvalidArgumentException $e) {
$this->logger->error(new \InvalidArgumentException('an error occured while reading the data ver... | php | public function convertString(string $iniString) : void
{
try {
$cachedVersion = $this->cache->getItem('browscap.version', false, $success);
} catch (InvalidArgumentException $e) {
$this->logger->error(new \InvalidArgumentException('an error occured while reading the data ver... | [
"public",
"function",
"convertString",
"(",
"string",
"$",
"iniString",
")",
":",
"void",
"{",
"try",
"{",
"$",
"cachedVersion",
"=",
"$",
"this",
"->",
"cache",
"->",
"getItem",
"(",
"'browscap.version'",
",",
"false",
",",
"$",
"success",
")",
";",
"}"... | reads and parses an ini string and writes the results into the cache
@param string $iniString | [
"reads",
"and",
"parses",
"an",
"ini",
"string",
"and",
"writes",
"the",
"results",
"into",
"the",
"cache"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/BrowscapUpdater.php#L114-L127 |
browscap/browscap-php | src/BrowscapUpdater.php | BrowscapUpdater.fetch | public function fetch(string $file, string $remoteFile = IniLoaderInterface::PHP_INI) : void
{
try {
$cachedVersion = $this->checkUpdate();
} catch (NoNewVersionException $e) {
return;
} catch (NoCachedVersionException $e) {
$cachedVersion = 0;
}
... | php | public function fetch(string $file, string $remoteFile = IniLoaderInterface::PHP_INI) : void
{
try {
$cachedVersion = $this->checkUpdate();
} catch (NoNewVersionException $e) {
return;
} catch (NoCachedVersionException $e) {
$cachedVersion = 0;
}
... | [
"public",
"function",
"fetch",
"(",
"string",
"$",
"file",
",",
"string",
"$",
"remoteFile",
"=",
"IniLoaderInterface",
"::",
"PHP_INI",
")",
":",
"void",
"{",
"try",
"{",
"$",
"cachedVersion",
"=",
"$",
"this",
"->",
"checkUpdate",
"(",
")",
";",
"}",
... | fetches a remote file and stores it into a local folder
@param string $file The name of the file where to store the remote content
@param string $remoteFile The code for the remote file to load
@throws \BrowscapPHP\Exception\FetcherException
@throws \BrowscapPHP\Helper\Exception
@throws \BrowscapPHP\Exception\ErrorCa... | [
"fetches",
"a",
"remote",
"file",
"and",
"stores",
"it",
"into",
"a",
"local",
"folder"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/BrowscapUpdater.php#L139-L206 |
browscap/browscap-php | src/BrowscapUpdater.php | BrowscapUpdater.update | public function update(string $remoteFile = IniLoaderInterface::PHP_INI) : void
{
$this->logger->debug('started fetching remote file');
try {
$cachedVersion = $this->checkUpdate();
} catch (NoNewVersionException $e) {
return;
} catch (NoCachedVersionException... | php | public function update(string $remoteFile = IniLoaderInterface::PHP_INI) : void
{
$this->logger->debug('started fetching remote file');
try {
$cachedVersion = $this->checkUpdate();
} catch (NoNewVersionException $e) {
return;
} catch (NoCachedVersionException... | [
"public",
"function",
"update",
"(",
"string",
"$",
"remoteFile",
"=",
"IniLoaderInterface",
"::",
"PHP_INI",
")",
":",
"void",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"'started fetching remote file'",
")",
";",
"try",
"{",
"$",
"cachedVersion",
... | fetches a remote file, parses it and writes the result into the cache
if the local stored information are in the same version as the remote data no actions are
taken
@param string $remoteFile The code for the remote file to load
@throws \BrowscapPHP\Exception\FetcherException
@throws \BrowscapPHP\Helper\Exception
@th... | [
"fetches",
"a",
"remote",
"file",
"parses",
"it",
"and",
"writes",
"the",
"result",
"into",
"the",
"cache",
"if",
"the",
"local",
"stored",
"information",
"are",
"in",
"the",
"same",
"version",
"as",
"the",
"remote",
"data",
"no",
"actions",
"are",
"taken"... | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/BrowscapUpdater.php#L219-L279 |
browscap/browscap-php | src/BrowscapUpdater.php | BrowscapUpdater.checkUpdate | public function checkUpdate() : ?int
{
$success = null;
try {
$cachedVersion = $this->cache->getItem('browscap.version', false, $success);
} catch (InvalidArgumentException $e) {
throw new ErrorCachedVersionException('an error occured while reading the data version f... | php | public function checkUpdate() : ?int
{
$success = null;
try {
$cachedVersion = $this->cache->getItem('browscap.version', false, $success);
} catch (InvalidArgumentException $e) {
throw new ErrorCachedVersionException('an error occured while reading the data version f... | [
"public",
"function",
"checkUpdate",
"(",
")",
":",
"?",
"int",
"{",
"$",
"success",
"=",
"null",
";",
"try",
"{",
"$",
"cachedVersion",
"=",
"$",
"this",
"->",
"cache",
"->",
"getItem",
"(",
"'browscap.version'",
",",
"false",
",",
"$",
"success",
")"... | checks if an update on a remote location for the local file or the cache
@throws \BrowscapPHP\Exception\FetcherException
@throws \BrowscapPHP\Exception\NoCachedVersionException
@throws \BrowscapPHP\Exception\ErrorCachedVersionException
@throws \BrowscapPHP\Exception\NoNewVersionException
@return int|null The actual c... | [
"checks",
"if",
"an",
"update",
"on",
"a",
"remote",
"location",
"for",
"the",
"local",
"file",
"or",
"the",
"cache"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/BrowscapUpdater.php#L291-L362 |
browscap/browscap-php | src/BrowscapUpdater.php | BrowscapUpdater.storeContent | private function storeContent(ConverterInterface $converter, string $content, ?int $cachedVersion) : void
{
$iniString = $this->sanitizeContent($content);
$iniVersion = $converter->getIniVersion($iniString);
if (! $cachedVersion || $iniVersion > $cachedVersion) {
$converter->sto... | php | private function storeContent(ConverterInterface $converter, string $content, ?int $cachedVersion) : void
{
$iniString = $this->sanitizeContent($content);
$iniVersion = $converter->getIniVersion($iniString);
if (! $cachedVersion || $iniVersion > $cachedVersion) {
$converter->sto... | [
"private",
"function",
"storeContent",
"(",
"ConverterInterface",
"$",
"converter",
",",
"string",
"$",
"content",
",",
"?",
"int",
"$",
"cachedVersion",
")",
":",
"void",
"{",
"$",
"iniString",
"=",
"$",
"this",
"->",
"sanitizeContent",
"(",
"$",
"content",... | reads and parses an ini string and writes the results into the cache
@param \BrowscapPHP\Helper\ConverterInterface $converter
@param string $content
@param int|null $cachedVersion | [
"reads",
"and",
"parses",
"an",
"ini",
"string",
"and",
"writes",
"the",
"results",
"into",
"the",
"cache"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/BrowscapUpdater.php#L380-L389 |
browscap/browscap-php | src/Command/FetchCommand.php | FetchCommand.execute | protected function execute(InputInterface $input, OutputInterface $output) : int
{
$logger = LoggerHelper::createDefaultLogger($output);
/** @var string $cacheOption */
$cacheOption = $input->getOption('cache');
$fileCache = new FilesystemCache($cacheOption);
$cache = new Si... | php | protected function execute(InputInterface $input, OutputInterface $output) : int
{
$logger = LoggerHelper::createDefaultLogger($output);
/** @var string $cacheOption */
$cacheOption = $input->getOption('cache');
$fileCache = new FilesystemCache($cacheOption);
$cache = new Si... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
":",
"int",
"{",
"$",
"logger",
"=",
"LoggerHelper",
"::",
"createDefaultLogger",
"(",
"$",
"output",
")",
";",
"/** @var string $cacheOption */",
... | @param \Symfony\Component\Console\Input\InputInterface $input
@param \Symfony\Component\Console\Output\OutputInterface $output
@return int | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Console",
"\\",
"Input",
"\\",
"InputInterface",
"$input",
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Console",
"\\",
"Output",
"\\",
"OutputInterface",
"$output"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Command/FetchCommand.php#L77-L120 |
browscap/browscap-php | src/Parser/Helper/GetPattern.php | GetPattern.getPatterns | public function getPatterns(string $userAgent) : \Generator
{
$starts = Pattern::getHashForPattern($userAgent, true);
$length = strlen($userAgent);
// add special key to fall back to the default browser
$starts[] = str_repeat('z', 32);
// get patterns, first for the given b... | php | public function getPatterns(string $userAgent) : \Generator
{
$starts = Pattern::getHashForPattern($userAgent, true);
$length = strlen($userAgent);
// add special key to fall back to the default browser
$starts[] = str_repeat('z', 32);
// get patterns, first for the given b... | [
"public",
"function",
"getPatterns",
"(",
"string",
"$",
"userAgent",
")",
":",
"\\",
"Generator",
"{",
"$",
"starts",
"=",
"Pattern",
"::",
"getHashForPattern",
"(",
"$",
"userAgent",
",",
"true",
")",
";",
"$",
"length",
"=",
"strlen",
"(",
"$",
"userA... | Gets some possible patterns that have to be matched against the user agent. With the given
user agent string, we can optimize the search for potential patterns:
- We check the first characters of the user agent (or better: a hash, generated from it)
- We compare the length of the pattern with the length of the user age... | [
"Gets",
"some",
"possible",
"patterns",
"that",
"have",
"to",
"be",
"matched",
"against",
"the",
"user",
"agent",
".",
"With",
"the",
"given",
"user",
"agent",
"string",
"we",
"can",
"optimize",
"the",
"search",
"for",
"potential",
"patterns",
":",
"-",
"W... | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Parser/Helper/GetPattern.php#L52-L117 |
browscap/browscap-php | src/Command/ConvertCommand.php | ConvertCommand.execute | protected function execute(InputInterface $input, OutputInterface $output) : int
{
$logger = LoggerHelper::createDefaultLogger($output);
/** @var string $cacheOption */
$cacheOption = $input->getOption('cache');
$fileCache = new FilesystemCache($cacheOption);
$cache = new Si... | php | protected function execute(InputInterface $input, OutputInterface $output) : int
{
$logger = LoggerHelper::createDefaultLogger($output);
/** @var string $cacheOption */
$cacheOption = $input->getOption('cache');
$fileCache = new FilesystemCache($cacheOption);
$cache = new Si... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
":",
"int",
"{",
"$",
"logger",
"=",
"LoggerHelper",
"::",
"createDefaultLogger",
"(",
"$",
"output",
")",
";",
"/** @var string $cacheOption */",
... | @param \Symfony\Component\Console\Input\InputInterface $input
@param \Symfony\Component\Console\Output\OutputInterface $output
@return int | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Console",
"\\",
"Input",
"\\",
"InputInterface",
"$input",
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Console",
"\\",
"Output",
"\\",
"OutputInterface",
"$output"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Command/ConvertCommand.php#L66-L108 |
browscap/browscap-php | src/IniParser/IniParser.php | IniParser.createIniParts | public function createIniParts(string $content) : \Generator
{
// get all patterns from the ini file in the correct order,
// so that we can calculate with index number of the resulting array,
// which part to use when the ini file is splitted into its sections.
preg_match_all('/(?<=... | php | public function createIniParts(string $content) : \Generator
{
// get all patterns from the ini file in the correct order,
// so that we can calculate with index number of the resulting array,
// which part to use when the ini file is splitted into its sections.
preg_match_all('/(?<=... | [
"public",
"function",
"createIniParts",
"(",
"string",
"$",
"content",
")",
":",
"\\",
"Generator",
"{",
"// get all patterns from the ini file in the correct order,",
"// so that we can calculate with index number of the resulting array,",
"// which part to use when the ini file is spli... | Creates new ini part cache files
@param string $content
@throws \OutOfRangeException
@throws \UnexpectedValueException
@return \Generator | [
"Creates",
"new",
"ini",
"part",
"cache",
"files"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/IniParser/IniParser.php#L38-L109 |
browscap/browscap-php | src/IniParser/IniParser.php | IniParser.createPatterns | public function createPatterns($content) : \Generator
{
// get all relevant patterns from the INI file
// - containing "*" or "?"
// - not containing "*" or "?", but not having a comment
preg_match_all(
'/(?<=\[)(?:[^\r\n]*[?*][^\r\n]*)(?=\])|(?<=\[)(?:[^\r\n*?]+)(?=\])(?... | php | public function createPatterns($content) : \Generator
{
// get all relevant patterns from the INI file
// - containing "*" or "?"
// - not containing "*" or "?", but not having a comment
preg_match_all(
'/(?<=\[)(?:[^\r\n]*[?*][^\r\n]*)(?=\])|(?<=\[)(?:[^\r\n*?]+)(?=\])(?... | [
"public",
"function",
"createPatterns",
"(",
"$",
"content",
")",
":",
"\\",
"Generator",
"{",
"// get all relevant patterns from the INI file",
"// - containing \"*\" or \"?\"",
"// - not containing \"*\" or \"?\", but not having a comment",
"preg_match_all",
"(",
"'/(?<=\\[)(?:[^\\... | Creates new pattern cache files
@param string $content
@return \Generator | [
"Creates",
"new",
"pattern",
"cache",
"files"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/IniParser/IniParser.php#L118-L238 |
browscap/browscap-php | src/IniParser/IniParser.php | IniParser.compareBcStrings | private function compareBcStrings(string $a, string $b) : int
{
$a_len = strlen($a);
$b_len = strlen($b);
if ($a_len > $b_len) {
return -1;
}
if ($a_len < $b_len) {
return 1;
}
$a_len = strlen(str_replace(['*', '?'], '', $a));
... | php | private function compareBcStrings(string $a, string $b) : int
{
$a_len = strlen($a);
$b_len = strlen($b);
if ($a_len > $b_len) {
return -1;
}
if ($a_len < $b_len) {
return 1;
}
$a_len = strlen(str_replace(['*', '?'], '', $a));
... | [
"private",
"function",
"compareBcStrings",
"(",
"string",
"$",
"a",
",",
"string",
"$",
"b",
")",
":",
"int",
"{",
"$",
"a_len",
"=",
"strlen",
"(",
"$",
"a",
")",
";",
"$",
"b_len",
"=",
"strlen",
"(",
"$",
"b",
")",
";",
"if",
"(",
"$",
"a_le... | @param string $a
@param string $b
@return int | [
"@param",
"string",
"$a",
"@param",
"string",
"$b"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/IniParser/IniParser.php#L246-L271 |
browscap/browscap-php | src/Command/CheckUpdateCommand.php | CheckUpdateCommand.execute | protected function execute(InputInterface $input, OutputInterface $output) : int
{
$logger = LoggerHelper::createDefaultLogger($output);
/** @var string $cacheOption */
$cacheOption = $input->getOption('cache');
$fileCache = new FilesystemCache($cacheOption);
$cache = new Si... | php | protected function execute(InputInterface $input, OutputInterface $output) : int
{
$logger = LoggerHelper::createDefaultLogger($output);
/** @var string $cacheOption */
$cacheOption = $input->getOption('cache');
$fileCache = new FilesystemCache($cacheOption);
$cache = new Si... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
":",
"int",
"{",
"$",
"logger",
"=",
"LoggerHelper",
"::",
"createDefaultLogger",
"(",
"$",
"output",
")",
";",
"/** @var string $cacheOption */",
... | @param \Symfony\Component\Console\Input\InputInterface $input
@param \Symfony\Component\Console\Output\OutputInterface $output
@return int | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Console",
"\\",
"Input",
"\\",
"InputInterface",
"$input",
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Console",
"\\",
"Output",
"\\",
"OutputInterface",
"$output"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Command/CheckUpdateCommand.php#L57-L96 |
browscap/browscap-php | src/Helper/IniLoader.php | IniLoader.setRemoteFilename | public function setRemoteFilename(string $name) : void
{
if (empty($name)) {
throw new Exception(
'the filename can not be empty',
Exception::INI_FILE_MISSING
);
}
$this->remoteFilename = $name;
} | php | public function setRemoteFilename(string $name) : void
{
if (empty($name)) {
throw new Exception(
'the filename can not be empty',
Exception::INI_FILE_MISSING
);
}
$this->remoteFilename = $name;
} | [
"public",
"function",
"setRemoteFilename",
"(",
"string",
"$",
"name",
")",
":",
"void",
"{",
"if",
"(",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'the filename can not be empty'",
",",
"Exception",
"::",
"INI_FILE_MISSING",
... | sets the name of the local ini file
@param string $name the file name
@throws \BrowscapPHP\Helper\Exception | [
"sets",
"the",
"name",
"of",
"the",
"local",
"ini",
"file"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Helper/IniLoader.php#L42-L52 |
browscap/browscap-php | src/Formatter/LegacyFormatter.php | LegacyFormatter.getData | public function getData() : \stdClass
{
$output = new \stdClass();
foreach ($this->data as $key => $property) {
if ($this->options['lowercase']) {
$key = strtolower($key);
}
$output->{$key} = $property;
}
return $output;
} | php | public function getData() : \stdClass
{
$output = new \stdClass();
foreach ($this->data as $key => $property) {
if ($this->options['lowercase']) {
$key = strtolower($key);
}
$output->{$key} = $property;
}
return $output;
} | [
"public",
"function",
"getData",
"(",
")",
":",
"\\",
"stdClass",
"{",
"$",
"output",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"key",
"=>",
"$",
"property",
")",
"{",
"if",
"(",
"$",
"this... | Gets the data (in the preferred format)
@return \stdClass | [
"Gets",
"the",
"data",
"(",
"in",
"the",
"preferred",
"format",
")"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Formatter/LegacyFormatter.php#L59-L72 |
browscap/browscap-php | src/Exception/FetcherException.php | FetcherException.httpError | public static function httpError(string $resource, string $error) : self
{
return new self(
sprintf('Could not fetch HTTP resource "%s": %s', $resource, $error)
);
} | php | public static function httpError(string $resource, string $error) : self
{
return new self(
sprintf('Could not fetch HTTP resource "%s": %s', $resource, $error)
);
} | [
"public",
"static",
"function",
"httpError",
"(",
"string",
"$",
"resource",
",",
"string",
"$",
"error",
")",
":",
"self",
"{",
"return",
"new",
"self",
"(",
"sprintf",
"(",
"'Could not fetch HTTP resource \"%s\": %s'",
",",
"$",
"resource",
",",
"$",
"error"... | @param string $resource
@param string $error
@return FetcherException | [
"@param",
"string",
"$resource",
"@param",
"string",
"$error"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Exception/FetcherException.php#L17-L22 |
browscap/browscap-php | src/Parser/Ini.php | Ini.getBrowser | public function getBrowser(string $userAgent) : ?FormatterInterface
{
$userAgent = strtolower($userAgent);
$formatter = null;
foreach ($this->patternHelper->getPatterns($userAgent) as $patterns) {
$patternToMatch = '/^(?:' . str_replace("\t", ')|(?:', $patterns) . ')$/i';
... | php | public function getBrowser(string $userAgent) : ?FormatterInterface
{
$userAgent = strtolower($userAgent);
$formatter = null;
foreach ($this->patternHelper->getPatterns($userAgent) as $patterns) {
$patternToMatch = '/^(?:' . str_replace("\t", ')|(?:', $patterns) . ')$/i';
... | [
"public",
"function",
"getBrowser",
"(",
"string",
"$",
"userAgent",
")",
":",
"?",
"FormatterInterface",
"{",
"$",
"userAgent",
"=",
"strtolower",
"(",
"$",
"userAgent",
")",
";",
"$",
"formatter",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"p... | Gets the browser data formatr for the given user agent
(or null if no data avaailble, no even the default browser)
@param string $userAgent
@throws \UnexpectedValueException
@return FormatterInterface|null | [
"Gets",
"the",
"browser",
"data",
"formatr",
"for",
"the",
"given",
"user",
"agent",
"(",
"or",
"null",
"if",
"no",
"data",
"avaailble",
"no",
"even",
"the",
"default",
"browser",
")"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Parser/Ini.php#L59-L107 |
browscap/browscap-php | src/Browscap.php | Browscap.getParser | public function getParser() : ParserInterface
{
if (null === $this->parser) {
$patternHelper = new Parser\Helper\GetPattern($this->cache, $this->logger);
$dataHelper = new Parser\Helper\GetData($this->cache, $this->logger, new Quoter());
$this->parser = new Parser\Ini($p... | php | public function getParser() : ParserInterface
{
if (null === $this->parser) {
$patternHelper = new Parser\Helper\GetPattern($this->cache, $this->logger);
$dataHelper = new Parser\Helper\GetData($this->cache, $this->logger, new Quoter());
$this->parser = new Parser\Ini($p... | [
"public",
"function",
"getParser",
"(",
")",
":",
"ParserInterface",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"parser",
")",
"{",
"$",
"patternHelper",
"=",
"new",
"Parser",
"\\",
"Helper",
"\\",
"GetPattern",
"(",
"$",
"this",
"->",
"cache",
... | returns an instance of the used parser class
@return \BrowscapPHP\Parser\ParserInterface | [
"returns",
"an",
"instance",
"of",
"the",
"used",
"parser",
"class"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Browscap.php#L82-L92 |
browscap/browscap-php | src/Browscap.php | Browscap.getBrowser | public function getBrowser(string $userAgent = null) : \stdClass
{
if (null === $this->cache->getVersion()) {
// there is no active/warm cache available
throw new Exception('there is no active cache available, please use the BrowscapUpdater and run the update command');
}
... | php | public function getBrowser(string $userAgent = null) : \stdClass
{
if (null === $this->cache->getVersion()) {
// there is no active/warm cache available
throw new Exception('there is no active cache available, please use the BrowscapUpdater and run the update command');
}
... | [
"public",
"function",
"getBrowser",
"(",
"string",
"$",
"userAgent",
"=",
"null",
")",
":",
"\\",
"stdClass",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"cache",
"->",
"getVersion",
"(",
")",
")",
"{",
"// there is no active/warm cache available",
"th... | parses the given user agent to get the information about the browser
if no user agent is given, it uses {@see \BrowscapPHP\Helper\Support} to get it
@param string $userAgent the user agent string
@throws \BrowscapPHP\Exception
@return \stdClass the object containing the browsers details. | [
"parses",
"the",
"given",
"user",
"agent",
"to",
"get",
"the",
"information",
"about",
"the",
"browser"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Browscap.php#L105-L133 |
browscap/browscap-php | src/Helper/Quoter.php | Quoter.pregQuote | public function pregQuote(string $user_agent, string $delimiter = '/') : string
{
$pattern = preg_quote($user_agent, $delimiter);
// the \\x replacement is a fix for "Der gro\xdfe BilderSauger 2.00u" user agent match
return str_replace(['\*', '\?', '\\x'], ['.*', '.', '\\\\x'], $pattern);
... | php | public function pregQuote(string $user_agent, string $delimiter = '/') : string
{
$pattern = preg_quote($user_agent, $delimiter);
// the \\x replacement is a fix for "Der gro\xdfe BilderSauger 2.00u" user agent match
return str_replace(['\*', '\?', '\\x'], ['.*', '.', '\\\\x'], $pattern);
... | [
"public",
"function",
"pregQuote",
"(",
"string",
"$",
"user_agent",
",",
"string",
"$",
"delimiter",
"=",
"'/'",
")",
":",
"string",
"{",
"$",
"pattern",
"=",
"preg_quote",
"(",
"$",
"user_agent",
",",
"$",
"delimiter",
")",
";",
"// the \\\\x replacement i... | Converts browscap match patterns into preg match patterns.
@param string $user_agent
@param string $delimiter
@return string | [
"Converts",
"browscap",
"match",
"patterns",
"into",
"preg",
"match",
"patterns",
"."
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Helper/Quoter.php#L19-L25 |
browscap/browscap-php | src/Helper/Quoter.php | Quoter.pregUnQuote | public function pregUnQuote(string $pattern) : string
{
// Fast check, because most parent pattern like 'DefaultProperties' don't need a replacement
if (!preg_match('/[^a-z\s]/i', $pattern)) {
return $pattern;
}
$origPattern = $pattern;
// Undo the \\x replaceme... | php | public function pregUnQuote(string $pattern) : string
{
// Fast check, because most parent pattern like 'DefaultProperties' don't need a replacement
if (!preg_match('/[^a-z\s]/i', $pattern)) {
return $pattern;
}
$origPattern = $pattern;
// Undo the \\x replaceme... | [
"public",
"function",
"pregUnQuote",
"(",
"string",
"$",
"pattern",
")",
":",
"string",
"{",
"// Fast check, because most parent pattern like 'DefaultProperties' don't need a replacement",
"if",
"(",
"!",
"preg_match",
"(",
"'/[^a-z\\s]/i'",
",",
"$",
"pattern",
")",
")",... | Reverts the quoting of a pattern.
@param string $pattern
@throws \UnexpectedValueException
@return string | [
"Reverts",
"the",
"quoting",
"of",
"a",
"pattern",
"."
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Helper/Quoter.php#L36-L73 |
browscap/browscap-php | src/Data/PropertyFormatter.php | PropertyFormatter.formatPropertyValue | public function formatPropertyValue($value, string $property)
{
switch ($this->propertyHolder->getPropertyType($property)) {
case PropertyHolder::TYPE_BOOLEAN:
if (true === $value || 'true' === $value || '1' === $value) {
return true;
}
... | php | public function formatPropertyValue($value, string $property)
{
switch ($this->propertyHolder->getPropertyType($property)) {
case PropertyHolder::TYPE_BOOLEAN:
if (true === $value || 'true' === $value || '1' === $value) {
return true;
}
... | [
"public",
"function",
"formatPropertyValue",
"(",
"$",
"value",
",",
"string",
"$",
"property",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"propertyHolder",
"->",
"getPropertyType",
"(",
"$",
"property",
")",
")",
"{",
"case",
"PropertyHolder",
"::",
"TYPE_... | formats the name of a property
@param bool|string $value
@param string $property
@return bool|string | [
"formats",
"the",
"name",
"of",
"a",
"property"
] | train | https://github.com/browscap/browscap-php/blob/b6ca3db5df6015ecae8cdd3a488cd53ab1a31e49/src/Data/PropertyFormatter.php#L31-L53 |
artkonekt/appshell | src/Console/Commands/SuperCommand.php | SuperCommand.askEmail | protected function askEmail()
{
$email = $this->ask('E-mail');
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$this->error("'$email' is not an email address.");
exit(2);
} elseif (UserProxy::where('email', $email)->first()) {
$this->error("User '$email... | php | protected function askEmail()
{
$email = $this->ask('E-mail');
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$this->error("'$email' is not an email address.");
exit(2);
} elseif (UserProxy::where('email', $email)->first()) {
$this->error("User '$email... | [
"protected",
"function",
"askEmail",
"(",
")",
"{",
"$",
"email",
"=",
"$",
"this",
"->",
"ask",
"(",
"'E-mail'",
")",
";",
"if",
"(",
"!",
"filter_var",
"(",
"$",
"email",
",",
"FILTER_VALIDATE_EMAIL",
")",
")",
"{",
"$",
"this",
"->",
"error",
"(",... | Asks for and validates E-mail address
@return string | [
"Asks",
"for",
"and",
"validates",
"E",
"-",
"mail",
"address"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Console/Commands/SuperCommand.php#L58-L71 |
artkonekt/appshell | src/Console/Commands/SuperCommand.php | SuperCommand.fetchRole | protected function fetchRole($roleName)
{
$role = RoleProxy::where('name', $roleName)->first();
if (! $role) {
if (! $this->confirm("Role '$roleName' doesn't exists. Create it?")) {
$this->warn('Nothing has been done.');
exit(1);
}
... | php | protected function fetchRole($roleName)
{
$role = RoleProxy::where('name', $roleName)->first();
if (! $role) {
if (! $this->confirm("Role '$roleName' doesn't exists. Create it?")) {
$this->warn('Nothing has been done.');
exit(1);
}
... | [
"protected",
"function",
"fetchRole",
"(",
"$",
"roleName",
")",
"{",
"$",
"role",
"=",
"RoleProxy",
"::",
"where",
"(",
"'name'",
",",
"$",
"roleName",
")",
"->",
"first",
"(",
")",
";",
"if",
"(",
"!",
"$",
"role",
")",
"{",
"if",
"(",
"!",
"$"... | @param $roleName
@return Role | [
"@param",
"$roleName"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Console/Commands/SuperCommand.php#L78-L92 |
artkonekt/appshell | src/Console/Commands/SuperCommand.php | SuperCommand.createRole | protected function createRole($name)
{
$role = RoleProxy::create(['name' => $name])->fresh();
$role->givePermissionTo(ResourcePermissions::allPermissionsFor('user'));
$role->givePermissionTo(ResourcePermissions::allPermissionsFor('role'));
return $role;
} | php | protected function createRole($name)
{
$role = RoleProxy::create(['name' => $name])->fresh();
$role->givePermissionTo(ResourcePermissions::allPermissionsFor('user'));
$role->givePermissionTo(ResourcePermissions::allPermissionsFor('role'));
return $role;
} | [
"protected",
"function",
"createRole",
"(",
"$",
"name",
")",
"{",
"$",
"role",
"=",
"RoleProxy",
"::",
"create",
"(",
"[",
"'name'",
"=>",
"$",
"name",
"]",
")",
"->",
"fresh",
"(",
")",
";",
"$",
"role",
"->",
"givePermissionTo",
"(",
"ResourcePermis... | @param $name
@return Role | [
"@param",
"$name"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Console/Commands/SuperCommand.php#L99-L107 |
artkonekt/appshell | src/Icons/EnumIconMapper.php | EnumIconMapper.registerEnumIcons | public function registerEnumIcons($enumClass, array $icons)
{
$this->map = array_merge($this->map, [shorten($enumClass) => $icons]);
} | php | public function registerEnumIcons($enumClass, array $icons)
{
$this->map = array_merge($this->map, [shorten($enumClass) => $icons]);
} | [
"public",
"function",
"registerEnumIcons",
"(",
"$",
"enumClass",
",",
"array",
"$",
"icons",
")",
"{",
"$",
"this",
"->",
"map",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"map",
",",
"[",
"shorten",
"(",
"$",
"enumClass",
")",
"=>",
"$",
"icons",
... | Register icon mapping for a specific enum class
@param string $enumClass
@param array $icons | [
"Register",
"icon",
"mapping",
"for",
"a",
"specific",
"enum",
"class"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Icons/EnumIconMapper.php#L27-L30 |
artkonekt/appshell | src/Icons/EnumIconMapper.php | EnumIconMapper.icon | public function icon(Enum $enum)
{
return array_get(
$this->map,
sprintf('%s.%s', shorten(get_class($enum)), $enum->value()),
config('konekt.app_shell.icon.default', 'default')
);
} | php | public function icon(Enum $enum)
{
return array_get(
$this->map,
sprintf('%s.%s', shorten(get_class($enum)), $enum->value()),
config('konekt.app_shell.icon.default', 'default')
);
} | [
"public",
"function",
"icon",
"(",
"Enum",
"$",
"enum",
")",
"{",
"return",
"array_get",
"(",
"$",
"this",
"->",
"map",
",",
"sprintf",
"(",
"'%s.%s'",
",",
"shorten",
"(",
"get_class",
"(",
"$",
"enum",
")",
")",
",",
"$",
"enum",
"->",
"value",
"... | Returns the icon for the given enum instance
@param Enum $enum
@return mixed | [
"Returns",
"the",
"icon",
"for",
"the",
"given",
"enum",
"instance"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Icons/EnumIconMapper.php#L39-L46 |
artkonekt/appshell | src/Http/Controllers/AppShellViewAware.php | AppShellViewAware.appShellView | protected function appShellView($view = null, $data = [], $mergeData = [])
{
if (null === $this->viewNS) {
$this->viewNS = config('konekt.app_shell.views.namespace');
}
if (!str_contains($view, '::')) {
$view = sprintf('%s::%s', $this->viewNS, $view);
} elsei... | php | protected function appShellView($view = null, $data = [], $mergeData = [])
{
if (null === $this->viewNS) {
$this->viewNS = config('konekt.app_shell.views.namespace');
}
if (!str_contains($view, '::')) {
$view = sprintf('%s::%s', $this->viewNS, $view);
} elsei... | [
"protected",
"function",
"appShellView",
"(",
"$",
"view",
"=",
"null",
",",
"$",
"data",
"=",
"[",
"]",
",",
"$",
"mergeData",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"viewNS",
")",
"{",
"$",
"this",
"->",
"viewNS",... | A tiny wrapper for view() method that handles cases when the
'appshell::' view namespace gets customized, or the cases
when no namespace gets specified by adding a namespace
@param string $view
@param array $data
@param array $mergeData
@return \Illuminate\View\View|\Illuminate\Contracts\View\Factory | [
"A",
"tiny",
"wrapper",
"for",
"view",
"()",
"method",
"that",
"handles",
"cases",
"when",
"the",
"appshell",
"::",
"view",
"namespace",
"gets",
"customized",
"or",
"the",
"cases",
"when",
"no",
"namespace",
"gets",
"specified",
"by",
"adding",
"a",
"namespa... | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Http/Controllers/AppShellViewAware.php#L30-L43 |
artkonekt/appshell | src/Providers/ModuleServiceProvider.php | ModuleServiceProvider.registerThirdPartyProviders | protected function registerThirdPartyProviders()
{
if (
'testing' == $this->app->environment()
||
version_compare(Application::VERSION, '5.5.0', '<')
) {
$this->registerMenuComponent();
$this->registerFormComponent();
$this->reg... | php | protected function registerThirdPartyProviders()
{
if (
'testing' == $this->app->environment()
||
version_compare(Application::VERSION, '5.5.0', '<')
) {
$this->registerMenuComponent();
$this->registerFormComponent();
$this->reg... | [
"protected",
"function",
"registerThirdPartyProviders",
"(",
")",
"{",
"if",
"(",
"'testing'",
"==",
"$",
"this",
"->",
"app",
"->",
"environment",
"(",
")",
"||",
"version_compare",
"(",
"Application",
"::",
"VERSION",
",",
"'5.5.0'",
",",
"'<'",
")",
")",
... | Registers 3rd party providers, AppShell is built on top of
They are:
- Konekt Menu,
- Laravel Collective Forms
- Laracasts Flash
- DaveJamesMiller Breadcrumbs | [
"Registers",
"3rd",
"party",
"providers",
"AppShell",
"is",
"built",
"on",
"top",
"of"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Providers/ModuleServiceProvider.php#L128-L143 |
artkonekt/appshell | src/Providers/ModuleServiceProvider.php | ModuleServiceProvider.initializeMenus | protected function initializeMenus()
{
foreach ($this->config('menu') as $name => $config) {
Menu::create($name, $config);
}
// Add default menu items to sidebar
if ($appshellMenu = Menu::get('appshell')) {
// CRM Group
$crm = $appshellMenu->addIt... | php | protected function initializeMenus()
{
foreach ($this->config('menu') as $name => $config) {
Menu::create($name, $config);
}
// Add default menu items to sidebar
if ($appshellMenu = Menu::get('appshell')) {
// CRM Group
$crm = $appshellMenu->addIt... | [
"protected",
"function",
"initializeMenus",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"config",
"(",
"'menu'",
")",
"as",
"$",
"name",
"=>",
"$",
"config",
")",
"{",
"Menu",
"::",
"create",
"(",
"$",
"name",
",",
"$",
"config",
")",
";",
"}... | Initializes menus set in the configuration | [
"Initializes",
"menus",
"set",
"in",
"the",
"configuration"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Providers/ModuleServiceProvider.php#L161-L193 |
artkonekt/appshell | src/Providers/ModuleServiceProvider.php | ModuleServiceProvider.registerFormComponent | private function registerFormComponent()
{
$this->app->register(\Collective\Html\HtmlServiceProvider::class);
$this->concord->registerAlias('Form', \Collective\Html\FormFacade::class);
$this->concord->registerAlias('Html', \Collective\Html\HtmlFacade::class);
} | php | private function registerFormComponent()
{
$this->app->register(\Collective\Html\HtmlServiceProvider::class);
$this->concord->registerAlias('Form', \Collective\Html\FormFacade::class);
$this->concord->registerAlias('Html', \Collective\Html\HtmlFacade::class);
} | [
"private",
"function",
"registerFormComponent",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"register",
"(",
"\\",
"Collective",
"\\",
"Html",
"\\",
"HtmlServiceProvider",
"::",
"class",
")",
";",
"$",
"this",
"->",
"concord",
"->",
"registerAlias",
"(",
... | Register Laravel Collective Form Component | [
"Register",
"Laravel",
"Collective",
"Form",
"Component"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Providers/ModuleServiceProvider.php#L212-L217 |
artkonekt/appshell | src/Providers/ModuleServiceProvider.php | ModuleServiceProvider.registerMenuComponent | private function registerMenuComponent()
{
$this->app->register(\Konekt\Menu\MenuServiceProvider::class);
$this->concord->registerAlias('Menu', \Konekt\Menu\Facades\Menu::class);
} | php | private function registerMenuComponent()
{
$this->app->register(\Konekt\Menu\MenuServiceProvider::class);
$this->concord->registerAlias('Menu', \Konekt\Menu\Facades\Menu::class);
} | [
"private",
"function",
"registerMenuComponent",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"register",
"(",
"\\",
"Konekt",
"\\",
"Menu",
"\\",
"MenuServiceProvider",
"::",
"class",
")",
";",
"$",
"this",
"->",
"concord",
"->",
"registerAlias",
"(",
"'... | Registers Konekt Menu Component | [
"Registers",
"Konekt",
"Menu",
"Component"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Providers/ModuleServiceProvider.php#L222-L226 |
artkonekt/appshell | src/Providers/ModuleServiceProvider.php | ModuleServiceProvider.registerBreadcrumbsComponent | private function registerBreadcrumbsComponent()
{
// Register The Breadcrumbs Component
if (class_exists('\\DaveJamesMiller\\Breadcrumbs\\ServiceProvider')) { // Breadcrumbs v3.x - Laravel 5.4
$this->app->register(\DaveJamesMiller\Breadcrumbs\ServiceProvider::class);
$this->c... | php | private function registerBreadcrumbsComponent()
{
// Register The Breadcrumbs Component
if (class_exists('\\DaveJamesMiller\\Breadcrumbs\\ServiceProvider')) { // Breadcrumbs v3.x - Laravel 5.4
$this->app->register(\DaveJamesMiller\Breadcrumbs\ServiceProvider::class);
$this->c... | [
"private",
"function",
"registerBreadcrumbsComponent",
"(",
")",
"{",
"// Register The Breadcrumbs Component",
"if",
"(",
"class_exists",
"(",
"'\\\\DaveJamesMiller\\\\Breadcrumbs\\\\ServiceProvider'",
")",
")",
"{",
"// Breadcrumbs v3.x - Laravel 5.4",
"$",
"this",
"->",
"app"... | Register the breadcrumbs component, also merge the config from within the box config | [
"Register",
"the",
"breadcrumbs",
"component",
"also",
"merge",
"the",
"config",
"from",
"within",
"the",
"box",
"config"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Providers/ModuleServiceProvider.php#L239-L249 |
artkonekt/appshell | src/Http/Middleware/AclMiddleware.php | AclMiddleware.handle | public function handle($request, Closure $next, $permission = null)
{
$permission = $permission ?: $this->getNecessaryPermission($request->route()->getAction());
if (false !== $permission) {
if (! $request->user()->can($permission)) {
abort(403);
}
}
... | php | public function handle($request, Closure $next, $permission = null)
{
$permission = $permission ?: $this->getNecessaryPermission($request->route()->getAction());
if (false !== $permission) {
if (! $request->user()->can($permission)) {
abort(403);
}
}
... | [
"public",
"function",
"handle",
"(",
"$",
"request",
",",
"Closure",
"$",
"next",
",",
"$",
"permission",
"=",
"null",
")",
"{",
"$",
"permission",
"=",
"$",
"permission",
"?",
":",
"$",
"this",
"->",
"getNecessaryPermission",
"(",
"$",
"request",
"->",
... | Handle an incoming request.
@param \Illuminate\Http\Request $request
@param \Closure $next
@param null $permission
@return mixed | [
"Handle",
"an",
"incoming",
"request",
"."
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Http/Middleware/AclMiddleware.php#L20-L31 |
artkonekt/appshell | src/Http/Middleware/AclMiddleware.php | AclMiddleware.getNecessaryPermission | protected function getNecessaryPermission($action)
{
$parsed = $this->parseAction($action);
return ResourcePermissions::permissionFor($parsed['resource'], $parsed['action']);
} | php | protected function getNecessaryPermission($action)
{
$parsed = $this->parseAction($action);
return ResourcePermissions::permissionFor($parsed['resource'], $parsed['action']);
} | [
"protected",
"function",
"getNecessaryPermission",
"(",
"$",
"action",
")",
"{",
"$",
"parsed",
"=",
"$",
"this",
"->",
"parseAction",
"(",
"$",
"action",
")",
";",
"return",
"ResourcePermissions",
"::",
"permissionFor",
"(",
"$",
"parsed",
"[",
"'resource'",
... | Returns permission name like 'edit users', 'list users' etc based on resource and action
@param $action
@return bool|string Returns the permission name or false if no matching action was found | [
"Returns",
"permission",
"name",
"like",
"edit",
"users",
"list",
"users",
"etc",
"based",
"on",
"resource",
"and",
"action"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Http/Middleware/AclMiddleware.php#L40-L45 |
artkonekt/appshell | src/Http/Middleware/AclMiddleware.php | AclMiddleware.parseAction | protected function parseAction($action)
{
// Remove namespace
$parts = explode('\\', $action['uses']);
$ctrlAndAction = end($parts);
// Split controller and action
$parts = explode('@', $ctrlAndAction);
$controller = $parts[0];
$action = end(... | php | protected function parseAction($action)
{
// Remove namespace
$parts = explode('\\', $action['uses']);
$ctrlAndAction = end($parts);
// Split controller and action
$parts = explode('@', $ctrlAndAction);
$controller = $parts[0];
$action = end(... | [
"protected",
"function",
"parseAction",
"(",
"$",
"action",
")",
"{",
"// Remove namespace",
"$",
"parts",
"=",
"explode",
"(",
"'\\\\'",
",",
"$",
"action",
"[",
"'uses'",
"]",
")",
";",
"$",
"ctrlAndAction",
"=",
"end",
"(",
"$",
"parts",
")",
";",
"... | @param array $action
@return array | [
"@param",
"array",
"$action"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Http/Middleware/AclMiddleware.php#L52-L68 |
artkonekt/appshell | src/Listeners/UpdateUserLoginData.php | UpdateUserLoginData.handle | public function handle(Login $event)
{
if (config('konekt.app_shell.disable.login_counter')) {
return;
}
$event->user->last_login_at = Carbon::now();
$event->user->login_count += 1;
$event->user->save();
} | php | public function handle(Login $event)
{
if (config('konekt.app_shell.disable.login_counter')) {
return;
}
$event->user->last_login_at = Carbon::now();
$event->user->login_count += 1;
$event->user->save();
} | [
"public",
"function",
"handle",
"(",
"Login",
"$",
"event",
")",
"{",
"if",
"(",
"config",
"(",
"'konekt.app_shell.disable.login_counter'",
")",
")",
"{",
"return",
";",
"}",
"$",
"event",
"->",
"user",
"->",
"last_login_at",
"=",
"Carbon",
"::",
"now",
"(... | Updates user's login data
@param Login $event | [
"Updates",
"user",
"s",
"login",
"data"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Listeners/UpdateUserLoginData.php#L24-L33 |
artkonekt/appshell | src/Http/Controllers/UserController.php | UserController.store | public function store(CreateUser $request)
{
$request->merge(['password' => bcrypt($request->get('password'))]);
try {
$user = UserProxy::create($request->except('roles'));
$user->syncRoles($request->roles());
flash()->success(__('User has been created'));
... | php | public function store(CreateUser $request)
{
$request->merge(['password' => bcrypt($request->get('password'))]);
try {
$user = UserProxy::create($request->except('roles'));
$user->syncRoles($request->roles());
flash()->success(__('User has been created'));
... | [
"public",
"function",
"store",
"(",
"CreateUser",
"$",
"request",
")",
"{",
"$",
"request",
"->",
"merge",
"(",
"[",
"'password'",
"=>",
"bcrypt",
"(",
"$",
"request",
"->",
"get",
"(",
"'password'",
")",
")",
"]",
")",
";",
"try",
"{",
"$",
"user",
... | @param CreateUser $request
@return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector | [
"@param",
"CreateUser",
"$request"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Http/Controllers/UserController.php#L53-L69 |
artkonekt/appshell | src/Http/Controllers/UserController.php | UserController.edit | public function edit(User $user)
{
return $this->appShellView('user.edit', [
'user' => $user,
'types' => UserTypeProxy::choices(),
'roles' => RoleProxy::all()
]);
} | php | public function edit(User $user)
{
return $this->appShellView('user.edit', [
'user' => $user,
'types' => UserTypeProxy::choices(),
'roles' => RoleProxy::all()
]);
} | [
"public",
"function",
"edit",
"(",
"User",
"$",
"user",
")",
"{",
"return",
"$",
"this",
"->",
"appShellView",
"(",
"'user.edit'",
",",
"[",
"'user'",
"=>",
"$",
"user",
",",
"'types'",
"=>",
"UserTypeProxy",
"::",
"choices",
"(",
")",
",",
"'roles'",
... | @param User $user
@return \Illuminate\Contracts\View\Factory|\Illuminate\View\View | [
"@param",
"User",
"$user"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Http/Controllers/UserController.php#L88-L95 |
artkonekt/appshell | src/Http/Controllers/UserController.php | UserController.update | public function update(User $user, UpdateUser $request)
{
$data = $request->except(['password', 'roles']);
if ($request->wantsPasswordChange()) {
$data['password'] = bcrypt($request->getNewPassword());
}
try {
$user->update($data);
$user->syncRole... | php | public function update(User $user, UpdateUser $request)
{
$data = $request->except(['password', 'roles']);
if ($request->wantsPasswordChange()) {
$data['password'] = bcrypt($request->getNewPassword());
}
try {
$user->update($data);
$user->syncRole... | [
"public",
"function",
"update",
"(",
"User",
"$",
"user",
",",
"UpdateUser",
"$",
"request",
")",
"{",
"$",
"data",
"=",
"$",
"request",
"->",
"except",
"(",
"[",
"'password'",
",",
"'roles'",
"]",
")",
";",
"if",
"(",
"$",
"request",
"->",
"wantsPas... | @param User $user
@param UpdateUser $request
@return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector | [
"@param",
"User",
"$user",
"@param",
"UpdateUser",
"$request"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Http/Controllers/UserController.php#L103-L127 |
artkonekt/appshell | src/Http/Controllers/UserController.php | UserController.destroy | public function destroy(User $user)
{
if ($user->id == Auth::user()->id) {
flash()->error(__("You can't delete your self. What's wrong dude? Do you want to talk about it?"));
return redirect()->back();
}
try {
$user->delete();
flash()->info(... | php | public function destroy(User $user)
{
if ($user->id == Auth::user()->id) {
flash()->error(__("You can't delete your self. What's wrong dude? Do you want to talk about it?"));
return redirect()->back();
}
try {
$user->delete();
flash()->info(... | [
"public",
"function",
"destroy",
"(",
"User",
"$",
"user",
")",
"{",
"if",
"(",
"$",
"user",
"->",
"id",
"==",
"Auth",
"::",
"user",
"(",
")",
"->",
"id",
")",
"{",
"flash",
"(",
")",
"->",
"error",
"(",
"__",
"(",
"\"You can't delete your self. What... | Delete a user
@param User $user
@return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector | [
"Delete",
"a",
"user"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Http/Controllers/UserController.php#L136-L153 |
artkonekt/appshell | src/resources/database/migrations/2017_06_12_073443_create_appshell_permissions.php | CreateAppshellPermissions.up | public function up()
{
$adminRole = RoleProxy::create(['name' => 'admin']);
$adminRole->givePermissionTo(
ResourcePermissions::createPermissionsForResource($this->resources)
);
$admins = UserProxy::where(['type' => UserType::ADMIN])->get();
$admins->each->assign... | php | public function up()
{
$adminRole = RoleProxy::create(['name' => 'admin']);
$adminRole->givePermissionTo(
ResourcePermissions::createPermissionsForResource($this->resources)
);
$admins = UserProxy::where(['type' => UserType::ADMIN])->get();
$admins->each->assign... | [
"public",
"function",
"up",
"(",
")",
"{",
"$",
"adminRole",
"=",
"RoleProxy",
"::",
"create",
"(",
"[",
"'name'",
"=>",
"'admin'",
"]",
")",
";",
"$",
"adminRole",
"->",
"givePermissionTo",
"(",
"ResourcePermissions",
"::",
"createPermissionsForResource",
"("... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/resources/database/migrations/2017_06_12_073443_create_appshell_permissions.php#L18-L28 |
artkonekt/appshell | src/resources/database/migrations/2017_06_12_073443_create_appshell_permissions.php | CreateAppshellPermissions.down | public function down()
{
$adminRole = RoleProxy::where(['name' => 'admin'])->first();
if ($adminRole) {
$admins = UserProxy::where(['type' => UserType::ADMIN])->get();
$admins->each->removeRole($adminRole);
}
ResourcePermissions::deletePermissionsForResource... | php | public function down()
{
$adminRole = RoleProxy::where(['name' => 'admin'])->first();
if ($adminRole) {
$admins = UserProxy::where(['type' => UserType::ADMIN])->get();
$admins->each->removeRole($adminRole);
}
ResourcePermissions::deletePermissionsForResource... | [
"public",
"function",
"down",
"(",
")",
"{",
"$",
"adminRole",
"=",
"RoleProxy",
"::",
"where",
"(",
"[",
"'name'",
"=>",
"'admin'",
"]",
")",
"->",
"first",
"(",
")",
";",
"if",
"(",
"$",
"adminRole",
")",
"{",
"$",
"admins",
"=",
"UserProxy",
"::... | Reverse the migrations.
@return void | [
"Reverse",
"the",
"migrations",
"."
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/resources/database/migrations/2017_06_12_073443_create_appshell_permissions.php#L35-L47 |
artkonekt/appshell | src/Breadcrumbs/HasBreadcrumbs.php | HasBreadcrumbs.loadBreadcrumbs | public function loadBreadcrumbs()
{
if (!$this->config('breadcrumbs')) {
return false;
}
$file = sprintf('%s/%s/%s',
$this->basePath,
$this->convention->routesFolder(),
'breadcrumbs.php'
);
if (file_exists($file)) {
... | php | public function loadBreadcrumbs()
{
if (!$this->config('breadcrumbs')) {
return false;
}
$file = sprintf('%s/%s/%s',
$this->basePath,
$this->convention->routesFolder(),
'breadcrumbs.php'
);
if (file_exists($file)) {
... | [
"public",
"function",
"loadBreadcrumbs",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"config",
"(",
"'breadcrumbs'",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"file",
"=",
"sprintf",
"(",
"'%s/%s/%s'",
",",
"$",
"this",
"->",
"basePath",
... | Loads definitions from breadcrumbs file in case it's enabled in the config
@return bool | [
"Loads",
"definitions",
"from",
"breadcrumbs",
"file",
"in",
"case",
"it",
"s",
"enabled",
"in",
"the",
"config"
] | train | https://github.com/artkonekt/appshell/blob/2ec5d9b36cf65eec619d7daa37ab66d0fd4d9d3b/src/Breadcrumbs/HasBreadcrumbs.php#L21-L36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.