id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
198,900 | danielgp/common-lib | source/MySQLiByDanielGPtypes.php | MySQLiByDanielGPtypes.getMySQLqueryType | protected function getMySQLqueryType($sQuery)
{
$queryPieces = explode(' ', $sQuery);
$statementTypes = $this->listOfMySQLqueryStatementType($queryPieces[0]);
if (in_array($queryPieces[0], $statementTypes['keys'])) {
$type = $statementTypes['value']['Type'];
$ar... | php | protected function getMySQLqueryType($sQuery)
{
$queryPieces = explode(' ', $sQuery);
$statementTypes = $this->listOfMySQLqueryStatementType($queryPieces[0]);
if (in_array($queryPieces[0], $statementTypes['keys'])) {
$type = $statementTypes['value']['Type'];
$ar... | [
"protected",
"function",
"getMySQLqueryType",
"(",
"$",
"sQuery",
")",
"{",
"$",
"queryPieces",
"=",
"explode",
"(",
"' '",
",",
"$",
"sQuery",
")",
";",
"$",
"statementTypes",
"=",
"$",
"this",
"->",
"listOfMySQLqueryStatementType",
"(",
"$",
"queryPieces",
... | Returns the Query language type by scanning the 1st keyword from a given query
@param string $sQuery | [
"Returns",
"the",
"Query",
"language",
"type",
"by",
"scanning",
"the",
"1st",
"keyword",
"from",
"a",
"given",
"query"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGPtypes.php#L44-L62 |
198,901 | danielgp/common-lib | source/MySQLiByDanielGPtypes.php | MySQLiByDanielGPtypes.listOfMySQLqueryLanguageType | private function listOfMySQLqueryLanguageType($qType)
{
$keyForReturn = 'Type ' . $qType . ' stands for';
$vMap = ['DCL', 'DDL', 'DML', 'DQL', 'DTL'];
if (in_array($qType, $vMap)) {
$valForReturn = $this->readTypeFromJsonFile('MySQLiLanguageTypes')[$qType];
re... | php | private function listOfMySQLqueryLanguageType($qType)
{
$keyForReturn = 'Type ' . $qType . ' stands for';
$vMap = ['DCL', 'DDL', 'DML', 'DQL', 'DTL'];
if (in_array($qType, $vMap)) {
$valForReturn = $this->readTypeFromJsonFile('MySQLiLanguageTypes')[$qType];
re... | [
"private",
"function",
"listOfMySQLqueryLanguageType",
"(",
"$",
"qType",
")",
"{",
"$",
"keyForReturn",
"=",
"'Type '",
".",
"$",
"qType",
".",
"' stands for'",
";",
"$",
"vMap",
"=",
"[",
"'DCL'",
",",
"'DDL'",
",",
"'DML'",
",",
"'DQL'",
",",
"'DTL'",
... | Just to keep a list of type of language as array
@return array | [
"Just",
"to",
"keep",
"a",
"list",
"of",
"type",
"of",
"language",
"as",
"array"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGPtypes.php#L69-L78 |
198,902 | danielgp/common-lib | source/MySQLiByDanielGPtypes.php | MySQLiByDanielGPtypes.listOfMySQLqueryStatementType | private function listOfMySQLqueryStatementType($firstKwordWQuery)
{
$statmentsArray = $this->readTypeFromJsonFile('MySQLiStatementTypes');
return [
'keys' => array_keys($statmentsArray),
'value' => [
'Description' => $statmentsArray[$firstKwordWQuery][1],
... | php | private function listOfMySQLqueryStatementType($firstKwordWQuery)
{
$statmentsArray = $this->readTypeFromJsonFile('MySQLiStatementTypes');
return [
'keys' => array_keys($statmentsArray),
'value' => [
'Description' => $statmentsArray[$firstKwordWQuery][1],
... | [
"private",
"function",
"listOfMySQLqueryStatementType",
"(",
"$",
"firstKwordWQuery",
")",
"{",
"$",
"statmentsArray",
"=",
"$",
"this",
"->",
"readTypeFromJsonFile",
"(",
"'MySQLiStatementTypes'",
")",
";",
"return",
"[",
"'keys'",
"=>",
"array_keys",
"(",
"$",
"... | Just to keep a list of statement types as array
@param string $firstKwordWQuery
@return array | [
"Just",
"to",
"keep",
"a",
"list",
"of",
"statement",
"types",
"as",
"array"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGPtypes.php#L86-L96 |
198,903 | buflix/SimpleCollection | src/SimpleCollection/Entity/EntityAssocCollection.php | EntityAssocCollection.add | public function add($oEntity)
{
$this->checkClass($oEntity);
$this->values[$oEntity->getCollectionIndex()] = $oEntity;
return $this;
} | php | public function add($oEntity)
{
$this->checkClass($oEntity);
$this->values[$oEntity->getCollectionIndex()] = $oEntity;
return $this;
} | [
"public",
"function",
"add",
"(",
"$",
"oEntity",
")",
"{",
"$",
"this",
"->",
"checkClass",
"(",
"$",
"oEntity",
")",
";",
"$",
"this",
"->",
"values",
"[",
"$",
"oEntity",
"->",
"getCollectionIndex",
"(",
")",
"]",
"=",
"$",
"oEntity",
";",
"return... | Add Entity to collection
@param AssocEntityInterface $oEntity
@return $this | [
"Add",
"Entity",
"to",
"collection"
] | 405504d8be6415a872a5a49ce8223c22a932831a | https://github.com/buflix/SimpleCollection/blob/405504d8be6415a872a5a49ce8223c22a932831a/src/SimpleCollection/Entity/EntityAssocCollection.php#L56-L62 |
198,904 | buflix/SimpleCollection | src/SimpleCollection/Entity/EntityAssocCollection.php | EntityAssocCollection.indexEntities | protected function indexEntities(array $aEntities)
{
$aIndexEntities = array();
foreach ($aEntities as $oEntity) {
$aIndexEntities[$oEntity->getCollectionIndex()] = $oEntity;
}
return $aIndexEntities;
} | php | protected function indexEntities(array $aEntities)
{
$aIndexEntities = array();
foreach ($aEntities as $oEntity) {
$aIndexEntities[$oEntity->getCollectionIndex()] = $oEntity;
}
return $aIndexEntities;
} | [
"protected",
"function",
"indexEntities",
"(",
"array",
"$",
"aEntities",
")",
"{",
"$",
"aIndexEntities",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"aEntities",
"as",
"$",
"oEntity",
")",
"{",
"$",
"aIndexEntities",
"[",
"$",
"oEntity",
"->",
"g... | Create index array
@param AssocEntityInterface[] $aEntities
@return array | [
"Create",
"index",
"array"
] | 405504d8be6415a872a5a49ce8223c22a932831a | https://github.com/buflix/SimpleCollection/blob/405504d8be6415a872a5a49ce8223c22a932831a/src/SimpleCollection/Entity/EntityAssocCollection.php#L71-L79 |
198,905 | SlabPHP/controllers | src/Feed.php | Feed.determineFeedType | protected function determineFeedType()
{
$feedType = strtolower($this->getRoutedParameter('feedType', static::TYPE_JSON));
if ($feedType == static::TYPE_JSON) {
$this->displayResolver = static::RESOLVER_JSON;
if (empty($this->callback))
{
$this->c... | php | protected function determineFeedType()
{
$feedType = strtolower($this->getRoutedParameter('feedType', static::TYPE_JSON));
if ($feedType == static::TYPE_JSON) {
$this->displayResolver = static::RESOLVER_JSON;
if (empty($this->callback))
{
$this->c... | [
"protected",
"function",
"determineFeedType",
"(",
")",
"{",
"$",
"feedType",
"=",
"strtolower",
"(",
"$",
"this",
"->",
"getRoutedParameter",
"(",
"'feedType'",
",",
"static",
"::",
"TYPE_JSON",
")",
")",
";",
"if",
"(",
"$",
"feedType",
"==",
"static",
"... | Determine feed type | [
"Determine",
"feed",
"type"
] | a1c4fded0265100a85904dd664b972a7f8687652 | https://github.com/SlabPHP/controllers/blob/a1c4fded0265100a85904dd664b972a7f8687652/src/Feed.php#L59-L84 |
198,906 | covex-nn/JooS | src/JooS/Log/Log.php | Log.getWriters | public static function getWriters()
{
if (is_null(self::$_writers)) {
$writers = Config::getInstance("JooS_Log")->writers;
/* @var $writers JooS_Config */
if (!is_null($writers)) {
foreach ($writers->valueOf() as $name) {
$name = ucfirst(strtolower($name));
$className... | php | public static function getWriters()
{
if (is_null(self::$_writers)) {
$writers = Config::getInstance("JooS_Log")->writers;
/* @var $writers JooS_Config */
if (!is_null($writers)) {
foreach ($writers->valueOf() as $name) {
$name = ucfirst(strtolower($name));
$className... | [
"public",
"static",
"function",
"getWriters",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"self",
"::",
"$",
"_writers",
")",
")",
"{",
"$",
"writers",
"=",
"Config",
"::",
"getInstance",
"(",
"\"JooS_Log\"",
")",
"->",
"writers",
";",
"/* @var $writers JooS... | Return log writers
@return array | [
"Return",
"log",
"writers"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Log/Log.php#L45-L66 |
198,907 | covex-nn/JooS | src/JooS/Log/Log.php | Log.addWriter | public static function addWriter(Log_Interface $writer)
{
if (is_null(self::$_writers)) {
self::$_writers = array();
}
$key = get_class($writer);
if (!isset(self::$_writers[$key])) {
self::$_writers[$key] = $writer;
$result = true;
} else {
$result = false;
}
... | php | public static function addWriter(Log_Interface $writer)
{
if (is_null(self::$_writers)) {
self::$_writers = array();
}
$key = get_class($writer);
if (!isset(self::$_writers[$key])) {
self::$_writers[$key] = $writer;
$result = true;
} else {
$result = false;
}
... | [
"public",
"static",
"function",
"addWriter",
"(",
"Log_Interface",
"$",
"writer",
")",
"{",
"if",
"(",
"is_null",
"(",
"self",
"::",
"$",
"_writers",
")",
")",
"{",
"self",
"::",
"$",
"_writers",
"=",
"array",
"(",
")",
";",
"}",
"$",
"key",
"=",
"... | Add new writer
@param Log_Interface $writer Log writer
@return boolean | [
"Add",
"new",
"writer"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Log/Log.php#L75-L90 |
198,908 | linpax/microphp-framework | src/cli/Console.php | Console.action | public function action($name)
{
$command = '\\App\\Consoles\\'.ucfirst($name).'ConsoleCommand';
$command = class_exists($command) ? $command : '\\Micro\\Cli\\Consoles\\'.ucfirst($name).'ConsoleCommand';
if (!class_exists($command)) {
throw new Exception('Command `'.$name.'` not ... | php | public function action($name)
{
$command = '\\App\\Consoles\\'.ucfirst($name).'ConsoleCommand';
$command = class_exists($command) ? $command : '\\Micro\\Cli\\Consoles\\'.ucfirst($name).'ConsoleCommand';
if (!class_exists($command)) {
throw new Exception('Command `'.$name.'` not ... | [
"public",
"function",
"action",
"(",
"$",
"name",
")",
"{",
"$",
"command",
"=",
"'\\\\App\\\\Consoles\\\\'",
".",
"ucfirst",
"(",
"$",
"name",
")",
".",
"'ConsoleCommand'",
";",
"$",
"command",
"=",
"class_exists",
"(",
"$",
"command",
")",
"?",
"$",
"c... | Run action of console command by name
@access public
@param string $name Command name
@return ResponseInterface
@throws \RuntimeException|\InvalidArgumentException|Exception | [
"Run",
"action",
"of",
"console",
"command",
"by",
"name"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/cli/Console.php#L48-L68 |
198,909 | damianociarla/DCSSecurityCoreBundle | src/Event/AuthenticatedTokenEvent.php | AuthenticatedTokenEvent.regenerateUsernamePasswordTokenWithRoles | public function regenerateUsernamePasswordTokenWithRoles(array $roles, $mergeWithExistingRoles = true)
{
$user = $this->token->getUser();
$credentials = $this->token->getCredentials();
$providerKey = $this->token->getProviderKey();
if ($mergeWithExistingRoles) {
$roles =... | php | public function regenerateUsernamePasswordTokenWithRoles(array $roles, $mergeWithExistingRoles = true)
{
$user = $this->token->getUser();
$credentials = $this->token->getCredentials();
$providerKey = $this->token->getProviderKey();
if ($mergeWithExistingRoles) {
$roles =... | [
"public",
"function",
"regenerateUsernamePasswordTokenWithRoles",
"(",
"array",
"$",
"roles",
",",
"$",
"mergeWithExistingRoles",
"=",
"true",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"token",
"->",
"getUser",
"(",
")",
";",
"$",
"credentials",
"=",
"$... | Regenerate same instance of this token with another roles
@param array $roles
@param bool $mergeWithExistingRoles | [
"Regenerate",
"same",
"instance",
"of",
"this",
"token",
"with",
"another",
"roles"
] | cf061017674e6add1cb5b79389be6018f8722733 | https://github.com/damianociarla/DCSSecurityCoreBundle/blob/cf061017674e6add1cb5b79389be6018f8722733/src/Event/AuthenticatedTokenEvent.php#L47-L58 |
198,910 | praxigento/mobi_mod_pv | Helper/Customer.php | Customer.canSeePv | public function canSeePv($gid = null)
{
$result = false;
if (is_null($gid)) {
$gid = $this->session->getCustomerGroupId();
}
if (!isset($this->cacheCanSeeByGid[$gid])) {
$item = $this->daoPvCustGroup->getById($gid);
if ($item) $result = (bool)$item... | php | public function canSeePv($gid = null)
{
$result = false;
if (is_null($gid)) {
$gid = $this->session->getCustomerGroupId();
}
if (!isset($this->cacheCanSeeByGid[$gid])) {
$item = $this->daoPvCustGroup->getById($gid);
if ($item) $result = (bool)$item... | [
"public",
"function",
"canSeePv",
"(",
"$",
"gid",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"is_null",
"(",
"$",
"gid",
")",
")",
"{",
"$",
"gid",
"=",
"$",
"this",
"->",
"session",
"->",
"getCustomerGroupId",
"(",
")",
... | Cached accessor for 'Can See PV' flag.
@param int|null $gid customer group ID, if 'null' - group for current customer is used.
@return bool | [
"Cached",
"accessor",
"for",
"Can",
"See",
"PV",
"flag",
"."
] | d1540b7e94264527006e8b9fa68904a72a63928e | https://github.com/praxigento/mobi_mod_pv/blob/d1540b7e94264527006e8b9fa68904a72a63928e/Helper/Customer.php#L34-L48 |
198,911 | taylornetwork/make-html | src/HTMLGenerator.php | HTMLGenerator.makeLinks | public function makeLinks($text)
{
$pattern = '~(?xi)
(?:
((ht|f)tps?://) # scheme://
| # or
www\d{0,3}\. # "www.", "www1.", "www2." ... "www999."
| ... | php | public function makeLinks($text)
{
$pattern = '~(?xi)
(?:
((ht|f)tps?://) # scheme://
| # or
www\d{0,3}\. # "www.", "www1.", "www2." ... "www999."
| ... | [
"public",
"function",
"makeLinks",
"(",
"$",
"text",
")",
"{",
"$",
"pattern",
"=",
"'~(?xi)\n (?:\n ((ht|f)tps?://) # scheme://\n | # or\n www\\d{0,3}\\. # \"w... | Make the links clickable.
@param $text
@return string | [
"Make",
"the",
"links",
"clickable",
"."
] | 216308d5ba8c9d2412dc787fb6db1a837c20b820 | https://github.com/taylornetwork/make-html/blob/216308d5ba8c9d2412dc787fb6db1a837c20b820/src/HTMLGenerator.php#L80-L135 |
198,912 | taylornetwork/make-html | src/HTMLGenerator.php | HTMLGenerator.makeHTML | public function makeHTML($text)
{
$html = $text;
if ($this->defaultActions['makeLinks']) {
$html = $this->makeLinks($html);
}
if ($this->defaultActions['convertLineEndings']) {
$html = $this->convertLineEndings($html);
}
return $html;
} | php | public function makeHTML($text)
{
$html = $text;
if ($this->defaultActions['makeLinks']) {
$html = $this->makeLinks($html);
}
if ($this->defaultActions['convertLineEndings']) {
$html = $this->convertLineEndings($html);
}
return $html;
} | [
"public",
"function",
"makeHTML",
"(",
"$",
"text",
")",
"{",
"$",
"html",
"=",
"$",
"text",
";",
"if",
"(",
"$",
"this",
"->",
"defaultActions",
"[",
"'makeLinks'",
"]",
")",
"{",
"$",
"html",
"=",
"$",
"this",
"->",
"makeLinks",
"(",
"$",
"html",... | The main function to use instead of calling everything individually.
@param $text
@return string | [
"The",
"main",
"function",
"to",
"use",
"instead",
"of",
"calling",
"everything",
"individually",
"."
] | 216308d5ba8c9d2412dc787fb6db1a837c20b820 | https://github.com/taylornetwork/make-html/blob/216308d5ba8c9d2412dc787fb6db1a837c20b820/src/HTMLGenerator.php#L156-L169 |
198,913 | taylornetwork/make-html | src/HTMLGenerator.php | HTMLGenerator.generateTag | public function generateTag($tag, $attributes, $closeTag = true)
{
$openPattern = replace_variables($this->openTagPattern, compact('tag'));
$external = '';
if (in_array($tag, $this->voidTags) && !empty($this->voidTagPattern) && $this->voidTagPattern != $this->openTagPattern) {
$... | php | public function generateTag($tag, $attributes, $closeTag = true)
{
$openPattern = replace_variables($this->openTagPattern, compact('tag'));
$external = '';
if (in_array($tag, $this->voidTags) && !empty($this->voidTagPattern) && $this->voidTagPattern != $this->openTagPattern) {
$... | [
"public",
"function",
"generateTag",
"(",
"$",
"tag",
",",
"$",
"attributes",
",",
"$",
"closeTag",
"=",
"true",
")",
"{",
"$",
"openPattern",
"=",
"replace_variables",
"(",
"$",
"this",
"->",
"openTagPattern",
",",
"compact",
"(",
"'tag'",
")",
")",
";"... | Generate an HTML tag.
@param $tag
@param $attributes
@param $closeTag
@return string | [
"Generate",
"an",
"HTML",
"tag",
"."
] | 216308d5ba8c9d2412dc787fb6db1a837c20b820 | https://github.com/taylornetwork/make-html/blob/216308d5ba8c9d2412dc787fb6db1a837c20b820/src/HTMLGenerator.php#L180-L205 |
198,914 | taylornetwork/make-html | src/HTMLGenerator.php | HTMLGenerator.closeTag | public function closeTag($tag)
{
if (!in_array($tag, $this->voidTags)) {
return replace_variables($this->closeTagPattern, compact('tag'));
}
return '';
} | php | public function closeTag($tag)
{
if (!in_array($tag, $this->voidTags)) {
return replace_variables($this->closeTagPattern, compact('tag'));
}
return '';
} | [
"public",
"function",
"closeTag",
"(",
"$",
"tag",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"tag",
",",
"$",
"this",
"->",
"voidTags",
")",
")",
"{",
"return",
"replace_variables",
"(",
"$",
"this",
"->",
"closeTagPattern",
",",
"compact",
"(",
... | Close an HTML tag.
@param $tag
@return string | [
"Close",
"an",
"HTML",
"tag",
"."
] | 216308d5ba8c9d2412dc787fb6db1a837c20b820 | https://github.com/taylornetwork/make-html/blob/216308d5ba8c9d2412dc787fb6db1a837c20b820/src/HTMLGenerator.php#L214-L221 |
198,915 | jenskooij/cloudcontrol | src/cc/application/ApplicationRenderer.php | ApplicationRenderer.setCachingHeaders | public function setCachingHeaders($intervalString = CachableBaseComponent::DEFAULT_MAXAGE)
{
$expires = new \DateTime();
$interval = new \DateInterval($intervalString);
$maxAge = date_create('@0')->add($interval)->getTimestamp();
$expires = $expires->add($interval);
ResponseH... | php | public function setCachingHeaders($intervalString = CachableBaseComponent::DEFAULT_MAXAGE)
{
$expires = new \DateTime();
$interval = new \DateInterval($intervalString);
$maxAge = date_create('@0')->add($interval)->getTimestamp();
$expires = $expires->add($interval);
ResponseH... | [
"public",
"function",
"setCachingHeaders",
"(",
"$",
"intervalString",
"=",
"CachableBaseComponent",
"::",
"DEFAULT_MAXAGE",
")",
"{",
"$",
"expires",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"$",
"interval",
"=",
"new",
"\\",
"DateInterval",
"(",
"$",
"... | Set the default caching of pages
@param string $intervalString
@throws \Exception | [
"Set",
"the",
"default",
"caching",
"of",
"pages"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/cc/application/ApplicationRenderer.php#L67-L76 |
198,916 | jenskooij/cloudcontrol | src/cc/application/ApplicationRenderer.php | ApplicationRenderer.setNotCachingHeaders | public function setNotCachingHeaders()
{
ResponseHeaders::add(ResponseHeaders::HEADER_CACHE_CONTROL, ResponseHeaders::HEADER_CACHE_CONTROL_CONTENT_NO_STORE_NO_CACHE_MUST_REVALIDATE_MAX_AGE_0);
ResponseHeaders::add(ResponseHeaders::HEADER_PRAGMA, ResponseHeaders::HEADER_PRAGMA_CONTENT_NO_CACHE);
... | php | public function setNotCachingHeaders()
{
ResponseHeaders::add(ResponseHeaders::HEADER_CACHE_CONTROL, ResponseHeaders::HEADER_CACHE_CONTROL_CONTENT_NO_STORE_NO_CACHE_MUST_REVALIDATE_MAX_AGE_0);
ResponseHeaders::add(ResponseHeaders::HEADER_PRAGMA, ResponseHeaders::HEADER_PRAGMA_CONTENT_NO_CACHE);
... | [
"public",
"function",
"setNotCachingHeaders",
"(",
")",
"{",
"ResponseHeaders",
"::",
"add",
"(",
"ResponseHeaders",
"::",
"HEADER_CACHE_CONTROL",
",",
"ResponseHeaders",
"::",
"HEADER_CACHE_CONTROL_CONTENT_NO_STORE_NO_CACHE_MUST_REVALIDATE_MAX_AGE_0",
")",
";",
"ResponseHeader... | Set non caching
@throws \Exception | [
"Set",
"non",
"caching"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/cc/application/ApplicationRenderer.php#L82-L86 |
198,917 | koolkode/meta | src/Annotation/AnnotationLexer.php | AnnotationLexer.tokenize | public function tokenize($input)
{
$tokens = [];
$exp = ltrim($input);
for($length = strlen($exp), $i = 0; $i < $length; $i++)
{
if(trim($exp[$i]) == '')
{
continue;
}
if(NULL !== ($token = $this->getTerminalToken($exp, $i)))
{
$tokens[] = $token;
continue;
}
if... | php | public function tokenize($input)
{
$tokens = [];
$exp = ltrim($input);
for($length = strlen($exp), $i = 0; $i < $length; $i++)
{
if(trim($exp[$i]) == '')
{
continue;
}
if(NULL !== ($token = $this->getTerminalToken($exp, $i)))
{
$tokens[] = $token;
continue;
}
if... | [
"public",
"function",
"tokenize",
"(",
"$",
"input",
")",
"{",
"$",
"tokens",
"=",
"[",
"]",
";",
"$",
"exp",
"=",
"ltrim",
"(",
"$",
"input",
")",
";",
"for",
"(",
"$",
"length",
"=",
"strlen",
"(",
"$",
"exp",
")",
",",
"$",
"i",
"=",
"0",
... | Tokenize the given source string into annotation tokens and returns
the created token sequence.
@param string $input
@return AnnotationTokenSequence | [
"Tokenize",
"the",
"given",
"source",
"string",
"into",
"annotation",
"tokens",
"and",
"returns",
"the",
"created",
"token",
"sequence",
"."
] | 339db24d3ce461190f552c96e243bca21010f360 | https://github.com/koolkode/meta/blob/339db24d3ce461190f552c96e243bca21010f360/src/Annotation/AnnotationLexer.php#L61-L116 |
198,918 | koolkode/meta | src/Annotation/AnnotationLexer.php | AnnotationLexer.getStringToken | protected function getStringToken($exp, $length, & $i)
{
if($exp[$i] == '"' || $exp[$i] == "'")
{
$delim = $exp[$i++];
$buffer = '';
$terminated = false;
$escaped = false;
for(; $i < $length; $i++)
{
if($exp[$i] == '\\')
{
$escaped = !$escaped;
}
elseif($exp[$i] == $d... | php | protected function getStringToken($exp, $length, & $i)
{
if($exp[$i] == '"' || $exp[$i] == "'")
{
$delim = $exp[$i++];
$buffer = '';
$terminated = false;
$escaped = false;
for(; $i < $length; $i++)
{
if($exp[$i] == '\\')
{
$escaped = !$escaped;
}
elseif($exp[$i] == $d... | [
"protected",
"function",
"getStringToken",
"(",
"$",
"exp",
",",
"$",
"length",
",",
"&",
"$",
"i",
")",
"{",
"if",
"(",
"$",
"exp",
"[",
"$",
"i",
"]",
"==",
"'\"'",
"||",
"$",
"exp",
"[",
"$",
"i",
"]",
"==",
"\"'\"",
")",
"{",
"$",
"delim"... | Reads a string token from the source expression.
@param string $exp
@param integer $length
@param integer $i
@return AnnotationToken <code>NULL</code> if no string token was found. | [
"Reads",
"a",
"string",
"token",
"from",
"the",
"source",
"expression",
"."
] | 339db24d3ce461190f552c96e243bca21010f360 | https://github.com/koolkode/meta/blob/339db24d3ce461190f552c96e243bca21010f360/src/Annotation/AnnotationLexer.php#L164-L199 |
198,919 | koolkode/meta | src/Annotation/AnnotationLexer.php | AnnotationLexer.getIntegerToken | protected function getIntegerToken(array $m)
{
$sign = (isset($m['sign']) && $m['sign'] == '-') ? -1 : 1;
if(isset($m['oct']) && $m['oct'] != '')
{
return new AnnotationToken(AnnotationToken::T_INTEGER, $sign * intval($m['oct'], 8));
}
if(isset($m['bin']) && $m['bin'] != '')
{
return new Annota... | php | protected function getIntegerToken(array $m)
{
$sign = (isset($m['sign']) && $m['sign'] == '-') ? -1 : 1;
if(isset($m['oct']) && $m['oct'] != '')
{
return new AnnotationToken(AnnotationToken::T_INTEGER, $sign * intval($m['oct'], 8));
}
if(isset($m['bin']) && $m['bin'] != '')
{
return new Annota... | [
"protected",
"function",
"getIntegerToken",
"(",
"array",
"$",
"m",
")",
"{",
"$",
"sign",
"=",
"(",
"isset",
"(",
"$",
"m",
"[",
"'sign'",
"]",
")",
"&&",
"$",
"m",
"[",
"'sign'",
"]",
"==",
"'-'",
")",
"?",
"-",
"1",
":",
"1",
";",
"if",
"(... | Builds an integer token from the given match of PATTERN_INTEGER.
@param array<string> $m
@return AnnotationToken | [
"Builds",
"an",
"integer",
"token",
"from",
"the",
"given",
"match",
"of",
"PATTERN_INTEGER",
"."
] | 339db24d3ce461190f552c96e243bca21010f360 | https://github.com/koolkode/meta/blob/339db24d3ce461190f552c96e243bca21010f360/src/Annotation/AnnotationLexer.php#L218-L238 |
198,920 | Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Log/LoggableTrait.php | LoggableTrait.registerLogger | public function registerLogger(LoggerInterface $logger = null, $debug = false)
{
$this->logger = $logger ?: new NullLogger();
$this->debug = $debug;
return $this;
} | php | public function registerLogger(LoggerInterface $logger = null, $debug = false)
{
$this->logger = $logger ?: new NullLogger();
$this->debug = $debug;
return $this;
} | [
"public",
"function",
"registerLogger",
"(",
"LoggerInterface",
"$",
"logger",
"=",
"null",
",",
"$",
"debug",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"logger",
"=",
"$",
"logger",
"?",
":",
"new",
"NullLogger",
"(",
")",
";",
"$",
"this",
"->",
"... | register a logger and eventually debug mode into Loggable class
@param LoggerInterface $logger
@param boolean $debug
@return self | [
"register",
"a",
"logger",
"and",
"eventually",
"debug",
"mode",
"into",
"Loggable",
"class"
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Log/LoggableTrait.php#L31-L37 |
198,921 | jabernardo/lollipop-php | Library/SQL/BuilderTrait.php | BuilderTrait.insert | public function insert($fields) {
// Create temporary variables for
// tokenized parameter
$_tmp_fields = [];
$_tmp_values = [];
if (is_array($fields)) {
foreach ($fields as $key => $value) {
array_push($_tmp_fields, $key);
... | php | public function insert($fields) {
// Create temporary variables for
// tokenized parameter
$_tmp_fields = [];
$_tmp_values = [];
if (is_array($fields)) {
foreach ($fields as $key => $value) {
array_push($_tmp_fields, $key);
... | [
"public",
"function",
"insert",
"(",
"$",
"fields",
")",
"{",
"// Create temporary variables for \r",
"// tokenized parameter\r",
"$",
"_tmp_fields",
"=",
"[",
"]",
";",
"$",
"_tmp_values",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"fields",
")",
... | Insert data to table
@param array $fields Fields to put in data
@return mixed Returns $this when insert succeed and false on failure | [
"Insert",
"data",
"to",
"table"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/SQL/BuilderTrait.php#L333-L365 |
198,922 | jabernardo/lollipop-php | Library/SQL/BuilderTrait.php | BuilderTrait.update | public function update($fields) {
if (is_array($fields)) {
foreach ($fields as $key => $value) {
if (is_string($value)) {
array_push($this->_updates, $key . ' = \'' . addslashes($value) . '\'');
} else {
array_push($this->... | php | public function update($fields) {
if (is_array($fields)) {
foreach ($fields as $key => $value) {
if (is_string($value)) {
array_push($this->_updates, $key . ' = \'' . addslashes($value) . '\'');
} else {
array_push($this->... | [
"public",
"function",
"update",
"(",
"$",
"fields",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"fields",
")",
")",
"{",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",... | Update data from table
@param array $fields Fields to put in data
@return mixed Returns $this when insert succeed and false on failure | [
"Update",
"data",
"from",
"table"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/SQL/BuilderTrait.php#L407-L439 |
198,923 | jabernardo/lollipop-php | Library/SQL/BuilderTrait.php | BuilderTrait.asc | public function asc($fields) {
if (is_array($fields)) {
$this->_order = ' ORDER BY ' . implode($fields, ', ') . ' ASC';
} else {
$this->_order = ' ORDER BY ' . $fields . ' ASC';
}
return $this;
} | php | public function asc($fields) {
if (is_array($fields)) {
$this->_order = ' ORDER BY ' . implode($fields, ', ') . ' ASC';
} else {
$this->_order = ' ORDER BY ' . $fields . ' ASC';
}
return $this;
} | [
"public",
"function",
"asc",
"(",
"$",
"fields",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"fields",
")",
")",
"{",
"$",
"this",
"->",
"_order",
"=",
"' ORDER BY '",
".",
"implode",
"(",
"$",
"fields",
",",
"', '",
")",
".",
"' ASC'",
";",
"}",
... | Order by ascending
@param string/array $fields | [
"Order",
"by",
"ascending"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/SQL/BuilderTrait.php#L752-L760 |
198,924 | jabernardo/lollipop-php | Library/SQL/BuilderTrait.php | BuilderTrait.desc | public function desc($fields) {
if (is_array($fields)) {
$this->_order = ' ORDER BY ' . implode($fields, ', ') . ' DESC';
} else {
$this->_order = ' ORDER BY ' . $fields . ' DESC';
}
return $this;
} | php | public function desc($fields) {
if (is_array($fields)) {
$this->_order = ' ORDER BY ' . implode($fields, ', ') . ' DESC';
} else {
$this->_order = ' ORDER BY ' . $fields . ' DESC';
}
return $this;
} | [
"public",
"function",
"desc",
"(",
"$",
"fields",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"fields",
")",
")",
"{",
"$",
"this",
"->",
"_order",
"=",
"' ORDER BY '",
".",
"implode",
"(",
"$",
"fields",
",",
"', '",
")",
".",
"' DESC'",
";",
"}",
... | Order by descending
@param string/array $fields | [
"Order",
"by",
"descending"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/SQL/BuilderTrait.php#L768-L776 |
198,925 | jabernardo/lollipop-php | Library/SQL/BuilderTrait.php | BuilderTrait.leftJoin | public function leftJoin($table, $field1, $operator, $field2) {
array_push($this->_joins, ' LEFT JOIN ' . $table . ' ON ' . $field1 . ' ' . $operator . ' ' . $field2 . ' ');
return $this;
} | php | public function leftJoin($table, $field1, $operator, $field2) {
array_push($this->_joins, ' LEFT JOIN ' . $table . ' ON ' . $field1 . ' ' . $operator . ' ' . $field2 . ' ');
return $this;
} | [
"public",
"function",
"leftJoin",
"(",
"$",
"table",
",",
"$",
"field1",
",",
"$",
"operator",
",",
"$",
"field2",
")",
"{",
"array_push",
"(",
"$",
"this",
"->",
"_joins",
",",
"' LEFT JOIN '",
".",
"$",
"table",
".",
"' ON '",
".",
"$",
"field1",
"... | Left Join Tables
@param string $table Table name
@param string $field1 Table.Fieldname
@param string $operator Operator
@param string $field2 Table.Fieldname
@example leftJoin('users', 'users.id', '=', 'login.id') | [
"Left",
"Join",
"Tables"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/SQL/BuilderTrait.php#L822-L826 |
198,926 | jabernardo/lollipop-php | Library/SQL/BuilderTrait.php | BuilderTrait.rightJoin | public function rightJoin($table, $field1, $operator, $field2) {
array_push($this->_joins, ' RIGHT JOIN ' . $table . ' ON ' . $field1 . ' ' . $operator . ' ' . $field2 . ' ');
return $this;
} | php | public function rightJoin($table, $field1, $operator, $field2) {
array_push($this->_joins, ' RIGHT JOIN ' . $table . ' ON ' . $field1 . ' ' . $operator . ' ' . $field2 . ' ');
return $this;
} | [
"public",
"function",
"rightJoin",
"(",
"$",
"table",
",",
"$",
"field1",
",",
"$",
"operator",
",",
"$",
"field2",
")",
"{",
"array_push",
"(",
"$",
"this",
"->",
"_joins",
",",
"' RIGHT JOIN '",
".",
"$",
"table",
".",
"' ON '",
".",
"$",
"field1",
... | Right Join Tables
@param string $table Table name
@param string $field1 Table.Fieldname
@param string $operator Operator
@param string $field2 Table.Fieldname
@example rightJoin('users', 'users.id', '=', 'login.id') | [
"Right",
"Join",
"Tables"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/SQL/BuilderTrait.php#L839-L843 |
198,927 | agentmedia/phine-core | src/Core/Modules/Backend/SiteForm.php | SiteForm.AddSitemapActiveField | private function AddSitemapActiveField()
{
$name = 'SitemapActive';
$field = new Checkbox($name);
if (!$this->site->Exists() || $this->site->GetSitemapActive())
{
$field->SetChecked();
}
$this->AddField($field);
} | php | private function AddSitemapActiveField()
{
$name = 'SitemapActive';
$field = new Checkbox($name);
if (!$this->site->Exists() || $this->site->GetSitemapActive())
{
$field->SetChecked();
}
$this->AddField($field);
} | [
"private",
"function",
"AddSitemapActiveField",
"(",
")",
"{",
"$",
"name",
"=",
"'SitemapActive'",
";",
"$",
"field",
"=",
"new",
"Checkbox",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"site",
"->",
"Exists",
"(",
")",
"||",
"$",... | Adds the sitemap active checkbox | [
"Adds",
"the",
"sitemap",
"active",
"checkbox"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/SiteForm.php#L92-L101 |
198,928 | agentmedia/phine-core | src/Core/Modules/Backend/SiteForm.php | SiteForm.OnSuccess | protected function OnSuccess()
{
$action = Action::Update();
if (!$this->site->Exists())
{
$action = Action::Create();
$this->site->SetUser(self::Guard()->GetUser());
}
$this->site->SetName($this->Value('Name'));
$this->site->SetUrl($this->Valu... | php | protected function OnSuccess()
{
$action = Action::Update();
if (!$this->site->Exists())
{
$action = Action::Create();
$this->site->SetUser(self::Guard()->GetUser());
}
$this->site->SetName($this->Value('Name'));
$this->site->SetUrl($this->Valu... | [
"protected",
"function",
"OnSuccess",
"(",
")",
"{",
"$",
"action",
"=",
"Action",
"::",
"Update",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"site",
"->",
"Exists",
"(",
")",
")",
"{",
"$",
"action",
"=",
"Action",
"::",
"Create",
"(",
")... | Saves the site | [
"Saves",
"the",
"site"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/SiteForm.php#L115-L137 |
198,929 | phpffcms/ffcms-core | src/I18n/Translate.php | Translate.get | public function get(?string $index, string $text, ?array $params = null)
{
if (App::$Request->getLanguage() !== App::$Properties->get('baseLanguage')) {
if ($index && !Arr::in($index, $this->indexes)) {
$this->cached = Arr::merge($this->cached, $this->load($index));
... | php | public function get(?string $index, string $text, ?array $params = null)
{
if (App::$Request->getLanguage() !== App::$Properties->get('baseLanguage')) {
if ($index && !Arr::in($index, $this->indexes)) {
$this->cached = Arr::merge($this->cached, $this->load($index));
... | [
"public",
"function",
"get",
"(",
"?",
"string",
"$",
"index",
",",
"string",
"$",
"text",
",",
"?",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"if",
"(",
"App",
"::",
"$",
"Request",
"->",
"getLanguage",
"(",
")",
"!==",
"App",
"::",
"$",
"P... | Get internalization of current text from i18n
@param string $index
@param string $text
@param array|null $params
@return string | [
"Get",
"internalization",
"of",
"current",
"text",
"from",
"i18n"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/I18n/Translate.php#L43-L62 |
198,930 | phpffcms/ffcms-core | src/I18n/Translate.php | Translate.translate | public function translate(string $text, array $params = null)
{
$index = null;
$namespace = 'Apps\Controller\\' . env_name . '\\';
foreach (@debug_backtrace() as $caller) {
if (isset($caller['class']) && Str::startsWith($namespace, $caller['class'])) {
$index = St... | php | public function translate(string $text, array $params = null)
{
$index = null;
$namespace = 'Apps\Controller\\' . env_name . '\\';
foreach (@debug_backtrace() as $caller) {
if (isset($caller['class']) && Str::startsWith($namespace, $caller['class'])) {
$index = St... | [
"public",
"function",
"translate",
"(",
"string",
"$",
"text",
",",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"index",
"=",
"null",
";",
"$",
"namespace",
"=",
"'Apps\\Controller\\\\'",
".",
"env_name",
".",
"'\\\\'",
";",
"foreach",
"(",
"@",
... | Get internalization based on called controller
@param string $text
@param array $params
@return string | [
"Get",
"internalization",
"based",
"on",
"called",
"controller"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/I18n/Translate.php#L70-L80 |
198,931 | phpffcms/ffcms-core | src/I18n/Translate.php | Translate.load | protected function load(string $index): ?array
{
$file = root . '/I18n/' . env_name . '/' . App::$Request->getLanguage() . '/' . $index . '.php';
if (!File::exist($file)) {
return [];
}
return require($file);
} | php | protected function load(string $index): ?array
{
$file = root . '/I18n/' . env_name . '/' . App::$Request->getLanguage() . '/' . $index . '.php';
if (!File::exist($file)) {
return [];
}
return require($file);
} | [
"protected",
"function",
"load",
"(",
"string",
"$",
"index",
")",
":",
"?",
"array",
"{",
"$",
"file",
"=",
"root",
".",
"'/I18n/'",
".",
"env_name",
".",
"'/'",
".",
"App",
"::",
"$",
"Request",
"->",
"getLanguage",
"(",
")",
".",
"'/'",
".",
"$"... | Load locale file from local storage
@param string $index
@return array|null | [
"Load",
"locale",
"file",
"from",
"local",
"storage"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/I18n/Translate.php#L87-L95 |
198,932 | phpffcms/ffcms-core | src/I18n/Translate.php | Translate.append | public function append($path): bool
{
$path = Normalize::diskFullPath($path);
// check if file exist
if (!File::exist($path)) {
return false;
}
// load file translations
$addTranslation = require($path);
if (!Any::isArray($addTranslation)) {
... | php | public function append($path): bool
{
$path = Normalize::diskFullPath($path);
// check if file exist
if (!File::exist($path)) {
return false;
}
// load file translations
$addTranslation = require($path);
if (!Any::isArray($addTranslation)) {
... | [
"public",
"function",
"append",
"(",
"$",
"path",
")",
":",
"bool",
"{",
"$",
"path",
"=",
"Normalize",
"::",
"diskFullPath",
"(",
"$",
"path",
")",
";",
"// check if file exist",
"if",
"(",
"!",
"File",
"::",
"exist",
"(",
"$",
"path",
")",
")",
"{"... | Append translation data from exist full path
@param string $path
@return bool | [
"Append",
"translation",
"data",
"from",
"exist",
"full",
"path"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/I18n/Translate.php#L102-L119 |
198,933 | phpffcms/ffcms-core | src/I18n/Translate.php | Translate.getAvailableLangs | public function getAvailableLangs(): array
{
$langs = ['en'];
$scan = Directory::scan(root . '/I18n/' . env_name . '/', GLOB_ONLYDIR, true);
foreach ($scan as $row) {
$langs[] = trim($row, '/');
}
return $langs;
} | php | public function getAvailableLangs(): array
{
$langs = ['en'];
$scan = Directory::scan(root . '/I18n/' . env_name . '/', GLOB_ONLYDIR, true);
foreach ($scan as $row) {
$langs[] = trim($row, '/');
}
return $langs;
} | [
"public",
"function",
"getAvailableLangs",
"(",
")",
":",
"array",
"{",
"$",
"langs",
"=",
"[",
"'en'",
"]",
";",
"$",
"scan",
"=",
"Directory",
"::",
"scan",
"(",
"root",
".",
"'/I18n/'",
".",
"env_name",
".",
"'/'",
",",
"GLOB_ONLYDIR",
",",
"true",
... | Get available languages in the filesystem
@return array | [
"Get",
"available",
"languages",
"in",
"the",
"filesystem"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/I18n/Translate.php#L125-L133 |
198,934 | phpffcms/ffcms-core | src/I18n/Translate.php | Translate.getLocaleText | public function getLocaleText($input, ?string $lang = null, ?string $default = null): ?string
{
// define language if empty
if ($lang === null) {
$lang = App::$Request->getLanguage();
}
// unserialize from string to array
if (Any::isStr($input)) {
$inp... | php | public function getLocaleText($input, ?string $lang = null, ?string $default = null): ?string
{
// define language if empty
if ($lang === null) {
$lang = App::$Request->getLanguage();
}
// unserialize from string to array
if (Any::isStr($input)) {
$inp... | [
"public",
"function",
"getLocaleText",
"(",
"$",
"input",
",",
"?",
"string",
"$",
"lang",
"=",
"null",
",",
"?",
"string",
"$",
"default",
"=",
"null",
")",
":",
"?",
"string",
"{",
"// define language if empty",
"if",
"(",
"$",
"lang",
"===",
"null",
... | Get locale data from input array or serialized string
@param array|string $input
@param string|null $lang
@param string|null $default
@return string|null | [
"Get",
"locale",
"data",
"from",
"input",
"array",
"or",
"serialized",
"string"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/I18n/Translate.php#L142-L158 |
198,935 | RockPhp/Datet | src/Rock/Datet/DateObj.php | Rock_Datet_DateObj.getDate | public function getDate($format = null)
{
$format = empty($format) ? $this->format : $format;
return strftime($format, $this->ts);
} | php | public function getDate($format = null)
{
$format = empty($format) ? $this->format : $format;
return strftime($format, $this->ts);
} | [
"public",
"function",
"getDate",
"(",
"$",
"format",
"=",
"null",
")",
"{",
"$",
"format",
"=",
"empty",
"(",
"$",
"format",
")",
"?",
"$",
"this",
"->",
"format",
":",
"$",
"format",
";",
"return",
"strftime",
"(",
"$",
"format",
",",
"$",
"this",... | Retorna data no formato especificado
@param string $format
não obrigatório. Formato padrão da função strftime() http://php.net/strftime
@return string | [
"Retorna",
"data",
"no",
"formato",
"especificado"
] | 10eb9320efbe0a5c5acb2ffb262b514a36476bf0 | https://github.com/RockPhp/Datet/blob/10eb9320efbe0a5c5acb2ffb262b514a36476bf0/src/Rock/Datet/DateObj.php#L86-L91 |
198,936 | SCLInternet/SclZfGenericMapper | src/SclZfGenericMapper/Doctrine/FlushLock.php | FlushLock.unlock | public function unlock()
{
$this->count--;
if ($this->count < 0) {
$this->count = 0;
return false;
}
if (0 === $this->count) {
$this->entityManager->flush();
return true;
}
return false;
} | php | public function unlock()
{
$this->count--;
if ($this->count < 0) {
$this->count = 0;
return false;
}
if (0 === $this->count) {
$this->entityManager->flush();
return true;
}
return false;
} | [
"public",
"function",
"unlock",
"(",
")",
"{",
"$",
"this",
"->",
"count",
"--",
";",
"if",
"(",
"$",
"this",
"->",
"count",
"<",
"0",
")",
"{",
"$",
"this",
"->",
"count",
"=",
"0",
";",
"return",
"false",
";",
"}",
"if",
"(",
"0",
"===",
"$... | Call this at the end of a persistence function.
@return boolean True if flush was called. | [
"Call",
"this",
"at",
"the",
"end",
"of",
"a",
"persistence",
"function",
"."
] | c61c61546bfbc07e9c9a4b425e8e02fd7182d80b | https://github.com/SCLInternet/SclZfGenericMapper/blob/c61c61546bfbc07e9c9a4b425e8e02fd7182d80b/src/SclZfGenericMapper/Doctrine/FlushLock.php#L60-L76 |
198,937 | AdamB7586/menu-builder | src/Helpers/Levels.php | Levels.getCurrent | public static function getCurrent($navigation, $current) {
self::iterateItems($navigation);
foreach(self::$navItem as $item) {
if($item === $current) {
self::getCurrentItem(intval(floor(self::$navItem->getDepth() / 2)));
}
}
ksort(self::$currentIte... | php | public static function getCurrent($navigation, $current) {
self::iterateItems($navigation);
foreach(self::$navItem as $item) {
if($item === $current) {
self::getCurrentItem(intval(floor(self::$navItem->getDepth() / 2)));
}
}
ksort(self::$currentIte... | [
"public",
"static",
"function",
"getCurrent",
"(",
"$",
"navigation",
",",
"$",
"current",
")",
"{",
"self",
"::",
"iterateItems",
"(",
"$",
"navigation",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"navItem",
"as",
"$",
"item",
")",
"{",
"if",
"(",
... | Creates the current menu items which are selected from the navigation item hierarchy | [
"Creates",
"the",
"current",
"menu",
"items",
"which",
"are",
"selected",
"from",
"the",
"navigation",
"item",
"hierarchy"
] | dbc192bca7d59475068c19d1a07a039e5f997ee4 | https://github.com/AdamB7586/menu-builder/blob/dbc192bca7d59475068c19d1a07a039e5f997ee4/src/Helpers/Levels.php#L15-L24 |
198,938 | AdamB7586/menu-builder | src/Helpers/Levels.php | Levels.getCurrentItem | protected static function getCurrentItem($depth){
self::$currentItems[$depth] = iterator_to_array(self::$navItem->getSubIterator((($depth * 2) + 1)));
unset(self::$currentItems[$depth]['children']);
if($depth >= 1){
self::getCurrentItem(($depth - 1));
}
} | php | protected static function getCurrentItem($depth){
self::$currentItems[$depth] = iterator_to_array(self::$navItem->getSubIterator((($depth * 2) + 1)));
unset(self::$currentItems[$depth]['children']);
if($depth >= 1){
self::getCurrentItem(($depth - 1));
}
} | [
"protected",
"static",
"function",
"getCurrentItem",
"(",
"$",
"depth",
")",
"{",
"self",
"::",
"$",
"currentItems",
"[",
"$",
"depth",
"]",
"=",
"iterator_to_array",
"(",
"self",
"::",
"$",
"navItem",
"->",
"getSubIterator",
"(",
"(",
"(",
"$",
"depth",
... | Gets the current level items from the menu array
@param int $depth This should be the depth of the menu item you are setting | [
"Gets",
"the",
"current",
"level",
"items",
"from",
"the",
"menu",
"array"
] | dbc192bca7d59475068c19d1a07a039e5f997ee4 | https://github.com/AdamB7586/menu-builder/blob/dbc192bca7d59475068c19d1a07a039e5f997ee4/src/Helpers/Levels.php#L30-L36 |
198,939 | juliangut/mapping | src/Driver/Traits/XmlMappingTrait.php | XmlMappingTrait.parseSimpleXML | final protected function parseSimpleXML(\SimpleXMLElement $element)
{
$elements = [];
foreach ($element->attributes() as $attribute => $value) {
$elements[$attribute] = $value instanceof \SimpleXMLElement ? $this->parseSimpleXML($value) : $value;
}
foreach ($element->ch... | php | final protected function parseSimpleXML(\SimpleXMLElement $element)
{
$elements = [];
foreach ($element->attributes() as $attribute => $value) {
$elements[$attribute] = $value instanceof \SimpleXMLElement ? $this->parseSimpleXML($value) : $value;
}
foreach ($element->ch... | [
"final",
"protected",
"function",
"parseSimpleXML",
"(",
"\\",
"SimpleXMLElement",
"$",
"element",
")",
"{",
"$",
"elements",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"element",
"->",
"attributes",
"(",
")",
"as",
"$",
"attribute",
"=>",
"$",
"value",
")... | Parse xml to array.
@param \SimpleXMLElement $element
@return string|float|int|bool|array | [
"Parse",
"xml",
"to",
"array",
"."
] | 1830ff84c054d8e3759df170a5664a97f7070be9 | https://github.com/juliangut/mapping/blob/1830ff84c054d8e3759df170a5664a97f7070be9/src/Driver/Traits/XmlMappingTrait.php#L112-L135 |
198,940 | juliangut/mapping | src/Driver/Traits/XmlMappingTrait.php | XmlMappingTrait.getTypedValue | private function getTypedValue(string $value)
{
if (\in_array($value, self::$boolValues, true)) {
return \in_array($value, self::$truthlyValues, true);
}
if (\is_numeric($value)) {
return $this->getNumericValue($value);
}
return $value;
} | php | private function getTypedValue(string $value)
{
if (\in_array($value, self::$boolValues, true)) {
return \in_array($value, self::$truthlyValues, true);
}
if (\is_numeric($value)) {
return $this->getNumericValue($value);
}
return $value;
} | [
"private",
"function",
"getTypedValue",
"(",
"string",
"$",
"value",
")",
"{",
"if",
"(",
"\\",
"in_array",
"(",
"$",
"value",
",",
"self",
"::",
"$",
"boolValues",
",",
"true",
")",
")",
"{",
"return",
"\\",
"in_array",
"(",
"$",
"value",
",",
"self... | Transforms string to type.
@param string $value
@return bool|float|int|string | [
"Transforms",
"string",
"to",
"type",
"."
] | 1830ff84c054d8e3759df170a5664a97f7070be9 | https://github.com/juliangut/mapping/blob/1830ff84c054d8e3759df170a5664a97f7070be9/src/Driver/Traits/XmlMappingTrait.php#L144-L155 |
198,941 | juliangut/mapping | src/Driver/Traits/XmlMappingTrait.php | XmlMappingTrait.getNumericValue | private function getNumericValue(string $value)
{
if (\strpos($value, '.') !== false) {
return (float) $value;
}
return (int) $value;
} | php | private function getNumericValue(string $value)
{
if (\strpos($value, '.') !== false) {
return (float) $value;
}
return (int) $value;
} | [
"private",
"function",
"getNumericValue",
"(",
"string",
"$",
"value",
")",
"{",
"if",
"(",
"\\",
"strpos",
"(",
"$",
"value",
",",
"'.'",
")",
"!==",
"false",
")",
"{",
"return",
"(",
"float",
")",
"$",
"value",
";",
"}",
"return",
"(",
"int",
")"... | Get numeric value from string.
@param string $value
@return float|int | [
"Get",
"numeric",
"value",
"from",
"string",
"."
] | 1830ff84c054d8e3759df170a5664a97f7070be9 | https://github.com/juliangut/mapping/blob/1830ff84c054d8e3759df170a5664a97f7070be9/src/Driver/Traits/XmlMappingTrait.php#L164-L171 |
198,942 | QoboLtd/qobo-robo-cakephp | src/Command/Cakephp/Plugins.php | Plugins.cakephpPlugins | public function cakephpPlugins($opts = ['format' => 'table', 'fields' => ''])
{
$result = $this->taskCakephpPlugins()
->run();
if (!$result->wasSuccessful()) {
$this->exitError("Failed to run the command");
}
return new PropertyList($result->getData()['data']... | php | public function cakephpPlugins($opts = ['format' => 'table', 'fields' => ''])
{
$result = $this->taskCakephpPlugins()
->run();
if (!$result->wasSuccessful()) {
$this->exitError("Failed to run the command");
}
return new PropertyList($result->getData()['data']... | [
"public",
"function",
"cakephpPlugins",
"(",
"$",
"opts",
"=",
"[",
"'format'",
"=>",
"'table'",
",",
"'fields'",
"=>",
"''",
"]",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"taskCakephpPlugins",
"(",
")",
"->",
"run",
"(",
")",
";",
"if",
"(",... | List CakePHP loaded plugins
@option string $format Output format (table, list, csv, json, xml)
@option string $fields Limit output to given fields, comma-separated
@return PropertyList result | [
"List",
"CakePHP",
"loaded",
"plugins"
] | 942d1839ad55a26e4aba893bd5bed35ec6edca94 | https://github.com/QoboLtd/qobo-robo-cakephp/blob/942d1839ad55a26e4aba893bd5bed35ec6edca94/src/Command/Cakephp/Plugins.php#L27-L36 |
198,943 | ezra-obiwale/dSCore | src/Core/AUser.php | AUser.check | final public function check(array $options) {
foreach ($options as $property => $value) {
if ((is_array($value) && !in_array($this->$property, $value)) ||
(!is_array($value) && $this->$property !== $value))
return false;
}
return true;
} | php | final public function check(array $options) {
foreach ($options as $property => $value) {
if ((is_array($value) && !in_array($this->$property, $value)) ||
(!is_array($value) && $this->$property !== $value))
return false;
}
return true;
} | [
"final",
"public",
"function",
"check",
"(",
"array",
"$",
"options",
")",
"{",
"foreach",
"(",
"$",
"options",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"(",
"is_array",
"(",
"$",
"value",
")",
"&&",
"!",
"in_array",
"(",
"$"... | Checks if properties exist and their values are as required
@param array $options
@return boolean | [
"Checks",
"if",
"properties",
"exist",
"and",
"their",
"values",
"are",
"as",
"required"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/AUser.php#L45-L53 |
198,944 | ARCANESOFT/Blog | src/Seeds/PermissionsTableSeeder.php | PermissionsTableSeeder.getPostsPermissions | private function getPostsPermissions()
{
return [
[
'name' => 'Posts - List all posts',
'description' => 'Allow to list all posts.',
'slug' => PostsPolicy::PERMISSION_LIST,
],
[
'name' =>... | php | private function getPostsPermissions()
{
return [
[
'name' => 'Posts - List all posts',
'description' => 'Allow to list all posts.',
'slug' => PostsPolicy::PERMISSION_LIST,
],
[
'name' =>... | [
"private",
"function",
"getPostsPermissions",
"(",
")",
"{",
"return",
"[",
"[",
"'name'",
"=>",
"'Posts - List all posts'",
",",
"'description'",
"=>",
"'Allow to list all posts.'",
",",
"'slug'",
"=>",
"PostsPolicy",
"::",
"PERMISSION_LIST",
",",
"]",
",",
"[",
... | Get the Posts permissions.
@return array | [
"Get",
"the",
"Posts",
"permissions",
"."
] | 2078fdfdcbccda161c02899b9e1f344f011b2859 | https://github.com/ARCANESOFT/Blog/blob/2078fdfdcbccda161c02899b9e1f344f011b2859/src/Seeds/PermissionsTableSeeder.php#L70-L99 |
198,945 | ARCANESOFT/Blog | src/Seeds/PermissionsTableSeeder.php | PermissionsTableSeeder.getCategoriesPermissions | private function getCategoriesPermissions()
{
return [
[
'name' => 'Categories - List all categories',
'description' => 'Allow to list all categories.',
'slug' => CategoriesPolicy::PERMISSION_LIST,
],
[
... | php | private function getCategoriesPermissions()
{
return [
[
'name' => 'Categories - List all categories',
'description' => 'Allow to list all categories.',
'slug' => CategoriesPolicy::PERMISSION_LIST,
],
[
... | [
"private",
"function",
"getCategoriesPermissions",
"(",
")",
"{",
"return",
"[",
"[",
"'name'",
"=>",
"'Categories - List all categories'",
",",
"'description'",
"=>",
"'Allow to list all categories.'",
",",
"'slug'",
"=>",
"CategoriesPolicy",
"::",
"PERMISSION_LIST",
","... | Get the Categories permissions.
@return array | [
"Get",
"the",
"Categories",
"permissions",
"."
] | 2078fdfdcbccda161c02899b9e1f344f011b2859 | https://github.com/ARCANESOFT/Blog/blob/2078fdfdcbccda161c02899b9e1f344f011b2859/src/Seeds/PermissionsTableSeeder.php#L106-L135 |
198,946 | ARCANESOFT/Blog | src/Seeds/PermissionsTableSeeder.php | PermissionsTableSeeder.getTagsPermissions | private function getTagsPermissions()
{
return [
[
'name' => 'Tags - List all tags',
'description' => 'Allow to list all tags.',
'slug' => TagsPolicy::PERMISSION_LIST,
],
[
'name' => 'Tag... | php | private function getTagsPermissions()
{
return [
[
'name' => 'Tags - List all tags',
'description' => 'Allow to list all tags.',
'slug' => TagsPolicy::PERMISSION_LIST,
],
[
'name' => 'Tag... | [
"private",
"function",
"getTagsPermissions",
"(",
")",
"{",
"return",
"[",
"[",
"'name'",
"=>",
"'Tags - List all tags'",
",",
"'description'",
"=>",
"'Allow to list all tags.'",
",",
"'slug'",
"=>",
"TagsPolicy",
"::",
"PERMISSION_LIST",
",",
"]",
",",
"[",
"'nam... | Get the Tags permissions.
@return array | [
"Get",
"the",
"Tags",
"permissions",
"."
] | 2078fdfdcbccda161c02899b9e1f344f011b2859 | https://github.com/ARCANESOFT/Blog/blob/2078fdfdcbccda161c02899b9e1f344f011b2859/src/Seeds/PermissionsTableSeeder.php#L142-L171 |
198,947 | ARCANESOFT/Auth | src/ViewComposers/PermissionGroupsFilterComposer.php | PermissionGroupsFilterComposer.getFilters | private function getFilters()
{
$filters = new Collection;
foreach ($this->getCachedPermissionGroups() as $group) {
/** @var \Arcanesoft\Auth\Models\PermissionsGroup $group */
$filters->push([
'name' => $group->name,
'params' => [$group->h... | php | private function getFilters()
{
$filters = new Collection;
foreach ($this->getCachedPermissionGroups() as $group) {
/** @var \Arcanesoft\Auth\Models\PermissionsGroup $group */
$filters->push([
'name' => $group->name,
'params' => [$group->h... | [
"private",
"function",
"getFilters",
"(",
")",
"{",
"$",
"filters",
"=",
"new",
"Collection",
";",
"foreach",
"(",
"$",
"this",
"->",
"getCachedPermissionGroups",
"(",
")",
"as",
"$",
"group",
")",
"{",
"/** @var \\Arcanesoft\\Auth\\Models\\PermissionsGroup $group... | Get the groups filters data.
@return \Illuminate\Support\Collection | [
"Get",
"the",
"groups",
"filters",
"data",
"."
] | b33ca82597a76b1e395071f71ae3e51f1ec67e62 | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/ViewComposers/PermissionGroupsFilterComposer.php#L45-L67 |
198,948 | Aerendir/PHPTextMatrix | src/PHPTextMatrix.php | PHPTextMatrix.render | public function render(array $options = []): string
{
// Set the options to use
$this->resolveOptions($options);
if (false === $this->validate()) {
return false;
}
// Splits the content of the cells to fit into the defined line length
$this->splitCellsCo... | php | public function render(array $options = []): string
{
// Set the options to use
$this->resolveOptions($options);
if (false === $this->validate()) {
return false;
}
// Splits the content of the cells to fit into the defined line length
$this->splitCellsCo... | [
"public",
"function",
"render",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
":",
"string",
"{",
"// Set the options to use",
"$",
"this",
"->",
"resolveOptions",
"(",
"$",
"options",
")",
";",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"validate... | Renders the table as plain text.
@param array $options
@return string | [
"Renders",
"the",
"table",
"as",
"plain",
"text",
"."
] | d8b3ce58b7174c6ddd9959e33427aa61862302d6 | https://github.com/Aerendir/PHPTextMatrix/blob/d8b3ce58b7174c6ddd9959e33427aa61862302d6/src/PHPTextMatrix.php#L73-L113 |
198,949 | Aerendir/PHPTextMatrix | src/PHPTextMatrix.php | PHPTextMatrix.validate | public function validate(): bool
{
// The number of columns
$numberOfColumns = null;
// Reset the errors
$this->errors = [];
// Check that there are rows in the data
if (0 >= count($this->data)) {
$message = 'There are no rows in the table';
... | php | public function validate(): bool
{
// The number of columns
$numberOfColumns = null;
// Reset the errors
$this->errors = [];
// Check that there are rows in the data
if (0 >= count($this->data)) {
$message = 'There are no rows in the table';
... | [
"public",
"function",
"validate",
"(",
")",
":",
"bool",
"{",
"// The number of columns",
"$",
"numberOfColumns",
"=",
"null",
";",
"// Reset the errors",
"$",
"this",
"->",
"errors",
"=",
"[",
"]",
";",
"// Check that there are rows in the data",
"if",
"(",
"0",
... | Validates the given array to check all the rows have the same number of columns.
Returns false if the validation fails and calling the getErrors() method it is possible to know
which are these errors.
@return bool False if the validation fails, true if all succeeds | [
"Validates",
"the",
"given",
"array",
"to",
"check",
"all",
"the",
"rows",
"have",
"the",
"same",
"number",
"of",
"columns",
"."
] | d8b3ce58b7174c6ddd9959e33427aa61862302d6 | https://github.com/Aerendir/PHPTextMatrix/blob/d8b3ce58b7174c6ddd9959e33427aa61862302d6/src/PHPTextMatrix.php#L123-L159 |
198,950 | Aerendir/PHPTextMatrix | src/PHPTextMatrix.php | PHPTextMatrix.splitCellsContent | private function splitCellsContent()
{
// For each row...
foreach ($this->data as $rowPosition => $rowContent) {
// ... cycle each column to get its content
foreach ($rowContent as $columnName => $cellContent) {
// Remove extra spaces from the string
... | php | private function splitCellsContent()
{
// For each row...
foreach ($this->data as $rowPosition => $rowContent) {
// ... cycle each column to get its content
foreach ($rowContent as $columnName => $cellContent) {
// Remove extra spaces from the string
... | [
"private",
"function",
"splitCellsContent",
"(",
")",
"{",
"// For each row...",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"rowPosition",
"=>",
"$",
"rowContent",
")",
"{",
"// ... cycle each column to get its content",
"foreach",
"(",
"$",
"rowContent",... | Splits the content of each cell into multiple lines according to the set max column width. | [
"Splits",
"the",
"content",
"of",
"each",
"cell",
"into",
"multiple",
"lines",
"according",
"to",
"the",
"set",
"max",
"column",
"width",
"."
] | d8b3ce58b7174c6ddd9959e33427aa61862302d6 | https://github.com/Aerendir/PHPTextMatrix/blob/d8b3ce58b7174c6ddd9959e33427aa61862302d6/src/PHPTextMatrix.php#L184-L225 |
198,951 | Aerendir/PHPTextMatrix | src/PHPTextMatrix.php | PHPTextMatrix.calculateSizes | private function calculateSizes()
{
// For each row...
foreach ($this->data as $rowPosition => $rowContent) {
// ... cycle each column to get its content ...
foreach ($rowContent as $columnName => $cellContent) {
// If we don't already know the height of this ... | php | private function calculateSizes()
{
// For each row...
foreach ($this->data as $rowPosition => $rowContent) {
// ... cycle each column to get its content ...
foreach ($rowContent as $columnName => $cellContent) {
// If we don't already know the height of this ... | [
"private",
"function",
"calculateSizes",
"(",
")",
"{",
"// For each row...",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"rowPosition",
"=>",
"$",
"rowContent",
")",
"{",
"// ... cycle each column to get its content ...",
"foreach",
"(",
"$",
"rowContent"... | Calculates the width of each column of the table. | [
"Calculates",
"the",
"width",
"of",
"each",
"column",
"of",
"the",
"table",
"."
] | d8b3ce58b7174c6ddd9959e33427aa61862302d6 | https://github.com/Aerendir/PHPTextMatrix/blob/d8b3ce58b7174c6ddd9959e33427aa61862302d6/src/PHPTextMatrix.php#L242-L289 |
198,952 | Aerendir/PHPTextMatrix | src/PHPTextMatrix.php | PHPTextMatrix.calculateTableWidth | private function calculateTableWidth(): int
{
// Now calculate the total width of the table
$tableWidth = 0;
// Add the width of the columns
foreach ($this->columnsWidths as $width) {
$tableWidth += $width;
}
// Add 1 for the first separator
$tab... | php | private function calculateTableWidth(): int
{
// Now calculate the total width of the table
$tableWidth = 0;
// Add the width of the columns
foreach ($this->columnsWidths as $width) {
$tableWidth += $width;
}
// Add 1 for the first separator
$tab... | [
"private",
"function",
"calculateTableWidth",
"(",
")",
":",
"int",
"{",
"// Now calculate the total width of the table",
"$",
"tableWidth",
"=",
"0",
";",
"// Add the width of the columns",
"foreach",
"(",
"$",
"this",
"->",
"columnsWidths",
"as",
"$",
"width",
")",
... | Calculates the total width of the table.
@return int | [
"Calculates",
"the",
"total",
"width",
"of",
"the",
"table",
"."
] | d8b3ce58b7174c6ddd9959e33427aa61862302d6 | https://github.com/Aerendir/PHPTextMatrix/blob/d8b3ce58b7174c6ddd9959e33427aa61862302d6/src/PHPTextMatrix.php#L296-L316 |
198,953 | Aerendir/PHPTextMatrix | src/PHPTextMatrix.php | PHPTextMatrix.drawDivider | private function drawDivider(string $prefix = 'sep_'): string
{
$divider = '';
foreach ($this->columnsWidths as $width) {
// Column width position for the xSep + left and rigth padding
$times = $width + $this->options['cells_padding'][1] + $this->options['cells_padding'][3];
... | php | private function drawDivider(string $prefix = 'sep_'): string
{
$divider = '';
foreach ($this->columnsWidths as $width) {
// Column width position for the xSep + left and rigth padding
$times = $width + $this->options['cells_padding'][1] + $this->options['cells_padding'][3];
... | [
"private",
"function",
"drawDivider",
"(",
"string",
"$",
"prefix",
"=",
"'sep_'",
")",
":",
"string",
"{",
"$",
"divider",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"columnsWidths",
"as",
"$",
"width",
")",
"{",
"// Column width position for the xS... | Draws the horizontal divider.
@param string $prefix
@return string | [
"Draws",
"the",
"horizontal",
"divider",
"."
] | d8b3ce58b7174c6ddd9959e33427aa61862302d6 | https://github.com/Aerendir/PHPTextMatrix/blob/d8b3ce58b7174c6ddd9959e33427aa61862302d6/src/PHPTextMatrix.php#L333-L343 |
198,954 | Aerendir/PHPTextMatrix | src/PHPTextMatrix.php | PHPTextMatrix.resolveCellsPaddings | private function resolveCellsPaddings(): array
{
$return = [0, 0, 0, 0];
// If padding is not set, return default values
if (false === isset($this->options['cells_padding'])) {
return $return;
}
// Create a resolver to validate passed values
$resolver = ... | php | private function resolveCellsPaddings(): array
{
$return = [0, 0, 0, 0];
// If padding is not set, return default values
if (false === isset($this->options['cells_padding'])) {
return $return;
}
// Create a resolver to validate passed values
$resolver = ... | [
"private",
"function",
"resolveCellsPaddings",
"(",
")",
":",
"array",
"{",
"$",
"return",
"=",
"[",
"0",
",",
"0",
",",
"0",
",",
"0",
"]",
";",
"// If padding is not set, return default values",
"if",
"(",
"false",
"===",
"isset",
"(",
"$",
"this",
"->",... | Set the padding of the cells.
This is the number of spaces to put on the left and on the right and on top and bottom of the content in each cell.
This method follows the rules of the padding CSS rule.
@see http://www.w3schools.com/css/css_padding.asp
@throws \InvalidArgumentException If the value is not an integer
... | [
"Set",
"the",
"padding",
"of",
"the",
"cells",
"."
] | d8b3ce58b7174c6ddd9959e33427aa61862302d6 | https://github.com/Aerendir/PHPTextMatrix/blob/d8b3ce58b7174c6ddd9959e33427aa61862302d6/src/PHPTextMatrix.php#L521-L574 |
198,955 | linpax/microphp-framework | src/logger/drivers/DbDriver.php | DbDriver.sendMessage | public function sendMessage($level, $message)
{
$this->db->insert($this->tableName, [
'level' => $level,
'message' => $message,
'date_create' => $_SERVER['REQUEST_TIME']
]);
} | php | public function sendMessage($level, $message)
{
$this->db->insert($this->tableName, [
'level' => $level,
'message' => $message,
'date_create' => $_SERVER['REQUEST_TIME']
]);
} | [
"public",
"function",
"sendMessage",
"(",
"$",
"level",
",",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"db",
"->",
"insert",
"(",
"$",
"this",
"->",
"tableName",
",",
"[",
"'level'",
"=>",
"$",
"level",
",",
"'message'",
"=>",
"$",
"message",
",",... | Send log message into DB
@access public
@param integer $level level number
@param string $message message to write
@return void | [
"Send",
"log",
"message",
"into",
"DB"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/logger/drivers/DbDriver.php#L73-L80 |
198,956 | JochLAin/symfony-database | src/ORM/Repository.php | Repository.count | public function count(array $constraints = [], QueryBuilder $qb = null)
{
$qb = !is_null($qb) ? $qb : $this->createQueryBuilder('e');
if (count($constraints)) $qb = $this->_by($qb, $constraints);
return $this->arrange($this->_count($qb), Repository::RESULT_SHAPE_SCALAR);
} | php | public function count(array $constraints = [], QueryBuilder $qb = null)
{
$qb = !is_null($qb) ? $qb : $this->createQueryBuilder('e');
if (count($constraints)) $qb = $this->_by($qb, $constraints);
return $this->arrange($this->_count($qb), Repository::RESULT_SHAPE_SCALAR);
} | [
"public",
"function",
"count",
"(",
"array",
"$",
"constraints",
"=",
"[",
"]",
",",
"QueryBuilder",
"$",
"qb",
"=",
"null",
")",
"{",
"$",
"qb",
"=",
"!",
"is_null",
"(",
"$",
"qb",
")",
"?",
"$",
"qb",
":",
"$",
"this",
"->",
"createQueryBuilder"... | Return number of entities
@param Doctrine\ORM\QueryBuilder = null
@return integer | [
"Return",
"number",
"of",
"entities"
] | a0fae6e057e142190ef68d0a37898d5f1b16cba9 | https://github.com/JochLAin/symfony-database/blob/a0fae6e057e142190ef68d0a37898d5f1b16cba9/src/ORM/Repository.php#L40-L45 |
198,957 | JochLAin/symfony-database | src/ORM/Repository.php | Repository._paginate | protected function _paginate(QueryBuilder $qb, int $offset, int $limit)
{
return $qb
->setFirstResult($offset)
->setMaxResults($limit);
} | php | protected function _paginate(QueryBuilder $qb, int $offset, int $limit)
{
return $qb
->setFirstResult($offset)
->setMaxResults($limit);
} | [
"protected",
"function",
"_paginate",
"(",
"QueryBuilder",
"$",
"qb",
",",
"int",
"$",
"offset",
",",
"int",
"$",
"limit",
")",
"{",
"return",
"$",
"qb",
"->",
"setFirstResult",
"(",
"$",
"offset",
")",
"->",
"setMaxResults",
"(",
"$",
"limit",
")",
";... | Improve QueryBuilder with basic paginate request
@param Doctrine\ORM\QueryBuilder
@param integer $offset
@param integer $limit
@return Doctrine\ORM\QueryBuilder | [
"Improve",
"QueryBuilder",
"with",
"basic",
"paginate",
"request"
] | a0fae6e057e142190ef68d0a37898d5f1b16cba9 | https://github.com/JochLAin/symfony-database/blob/a0fae6e057e142190ef68d0a37898d5f1b16cba9/src/ORM/Repository.php#L103-L108 |
198,958 | mylxsw/FocusPHP | src/Server.php | Server.init | public static function init(Container $container = null)
{
if (empty(self::$_instance)) {
// 环境检测
if (version_compare(PHP_VERSION, '5.6.0', '<')) {
throw new \ErrorException('NONSUPPORT_PHP_VERSION');
}
if (is_null($container)) {
... | php | public static function init(Container $container = null)
{
if (empty(self::$_instance)) {
// 环境检测
if (version_compare(PHP_VERSION, '5.6.0', '<')) {
throw new \ErrorException('NONSUPPORT_PHP_VERSION');
}
if (is_null($container)) {
... | [
"public",
"static",
"function",
"init",
"(",
"Container",
"$",
"container",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"self",
"::",
"$",
"_instance",
")",
")",
"{",
"// 环境检测",
"if",
"(",
"version_compare",
"(",
"PHP_VERSION",
",",
"'5.6.0'",
",",
... | Initialize the server object.
@param Container $container
@throws \ErrorException
@return Server | [
"Initialize",
"the",
"server",
"object",
"."
] | 33922bacbea66f11f874d991d7308a36cdf5831a | https://github.com/mylxsw/FocusPHP/blob/33922bacbea66f11f874d991d7308a36cdf5831a/src/Server.php#L58-L74 |
198,959 | mylxsw/FocusPHP | src/Server.php | Server.registerRouter | public function registerRouter($router, ...$params)
{
$this->_router->add($router, ...$params);
if (defined('FOCUS_DEBUG') && FOCUS_DEBUG) {
$this->getLogger()->debug('add new router: '
.(is_string($router) ? $router : get_class($router)));
}
... | php | public function registerRouter($router, ...$params)
{
$this->_router->add($router, ...$params);
if (defined('FOCUS_DEBUG') && FOCUS_DEBUG) {
$this->getLogger()->debug('add new router: '
.(is_string($router) ? $router : get_class($router)));
}
... | [
"public",
"function",
"registerRouter",
"(",
"$",
"router",
",",
"...",
"$",
"params",
")",
"{",
"$",
"this",
"->",
"_router",
"->",
"add",
"(",
"$",
"router",
",",
"...",
"$",
"params",
")",
";",
"if",
"(",
"defined",
"(",
"'FOCUS_DEBUG'",
")",
"&&"... | register router.
@param $router
@param $params | [
"register",
"router",
"."
] | 33922bacbea66f11f874d991d7308a36cdf5831a | https://github.com/mylxsw/FocusPHP/blob/33922bacbea66f11f874d991d7308a36cdf5831a/src/Server.php#L104-L111 |
198,960 | mylxsw/FocusPHP | src/Server.php | Server.registerAutoloader | public function registerAutoloader($baseDir, $baseNs)
{
$baseNs = $baseNs[strlen($baseNs) - 1] == '\\' ? $baseNs : "{$baseNs}\\";
$baseDir = rtrim($baseDir, '/');
spl_autoload_register(
function ($class) use ($baseDir, $baseNs) {
if (strncmp($baseNs, $class, strl... | php | public function registerAutoloader($baseDir, $baseNs)
{
$baseNs = $baseNs[strlen($baseNs) - 1] == '\\' ? $baseNs : "{$baseNs}\\";
$baseDir = rtrim($baseDir, '/');
spl_autoload_register(
function ($class) use ($baseDir, $baseNs) {
if (strncmp($baseNs, $class, strl... | [
"public",
"function",
"registerAutoloader",
"(",
"$",
"baseDir",
",",
"$",
"baseNs",
")",
"{",
"$",
"baseNs",
"=",
"$",
"baseNs",
"[",
"strlen",
"(",
"$",
"baseNs",
")",
"-",
"1",
"]",
"==",
"'\\\\'",
"?",
"$",
"baseNs",
":",
"\"{$baseNs}\\\\\"",
";",
... | register class autoloader.
@param string $baseDir Root directory of the project
@param string $baseNs Basic namespace | [
"register",
"class",
"autoloader",
"."
] | 33922bacbea66f11f874d991d7308a36cdf5831a | https://github.com/mylxsw/FocusPHP/blob/33922bacbea66f11f874d991d7308a36cdf5831a/src/Server.php#L146-L175 |
198,961 | e-commit/EcommitUtilBundle | Cache/Cache.php | Cache.load | public function load($key)
{
$data = $this->adapter->getItem($key, $success);
if ($success && $this->automaticSerialization) {
$data = unserialize($data);
if ($data === false) {
$this->remove($key);
}
}
return $data;
... | php | public function load($key)
{
$data = $this->adapter->getItem($key, $success);
if ($success && $this->automaticSerialization) {
$data = unserialize($data);
if ($data === false) {
$this->remove($key);
}
}
return $data;
... | [
"public",
"function",
"load",
"(",
"$",
"key",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"adapter",
"->",
"getItem",
"(",
"$",
"key",
",",
"$",
"success",
")",
";",
"if",
"(",
"$",
"success",
"&&",
"$",
"this",
"->",
"automaticSerialization",
... | Get an item
@param string $key
@return mixed Data on success and false on failure
@throws \Zend\Cache\Exception | [
"Get",
"an",
"item"
] | 2ee5ddae7709e8ad4412739cbecda28e0590da8b | https://github.com/e-commit/EcommitUtilBundle/blob/2ee5ddae7709e8ad4412739cbecda28e0590da8b/Cache/Cache.php#L67-L80 |
198,962 | jabernardo/lollipop-php | Library/Security/CsrfToken.php | CsrfToken.isValid | public static function isValid($token) {
// Get configuration
$expiration = Config::get('security.anti_csrf.expiration', 18000);
// Compute for token availablity
$computed = microtime(true) - (double)Text::unlock($token, self::getKey());
return $computed <= $expiration;
... | php | public static function isValid($token) {
// Get configuration
$expiration = Config::get('security.anti_csrf.expiration', 18000);
// Compute for token availablity
$computed = microtime(true) - (double)Text::unlock($token, self::getKey());
return $computed <= $expiration;
... | [
"public",
"static",
"function",
"isValid",
"(",
"$",
"token",
")",
"{",
"// Get configuration",
"$",
"expiration",
"=",
"Config",
"::",
"get",
"(",
"'security.anti_csrf.expiration'",
",",
"18000",
")",
";",
"// Compute for token availablity",
"$",
"computed",
"=",
... | Check Validity of Token
@access public
@return bool | [
"Check",
"Validity",
"of",
"Token"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/Security/CsrfToken.php#L75-L82 |
198,963 | WellCommerce/LayoutBundle | Configurator/LayoutBoxConfiguratorCollection.php | LayoutBoxConfiguratorCollection.add | public function add(LayoutBoxConfiguratorInterface $configurator)
{
$type = $configurator->getType();
if ($this->has($type)) {
throw new \InvalidArgumentException(sprintf('Layout box configurator "%s" already exists.', $type));
}
$this->items[$configurator->getType()] = $... | php | public function add(LayoutBoxConfiguratorInterface $configurator)
{
$type = $configurator->getType();
if ($this->has($type)) {
throw new \InvalidArgumentException(sprintf('Layout box configurator "%s" already exists.', $type));
}
$this->items[$configurator->getType()] = $... | [
"public",
"function",
"add",
"(",
"LayoutBoxConfiguratorInterface",
"$",
"configurator",
")",
"{",
"$",
"type",
"=",
"$",
"configurator",
"->",
"getType",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"type",
")",
")",
"{",
"throw",
"ne... | Adds new configurator to collection
@param LayoutBoxConfiguratorInterface $configurator
@throws \InvalidArgumentException If such configurator already exists in collection | [
"Adds",
"new",
"configurator",
"to",
"collection"
] | 470efd187d19827058f88317221cb875b4c9ced3 | https://github.com/WellCommerce/LayoutBundle/blob/470efd187d19827058f88317221cb875b4c9ced3/Configurator/LayoutBoxConfiguratorCollection.php#L31-L38 |
198,964 | geoffroy-aubry/Helpers | src/GAubry/Helpers/Helpers.php | Helpers.isAssociativeArray | public static function isAssociativeArray (array $aArray)
{
foreach (array_keys($aArray) as $key) {
if (! is_int($key)) {
return true;
}
}
return false;
} | php | public static function isAssociativeArray (array $aArray)
{
foreach (array_keys($aArray) as $key) {
if (! is_int($key)) {
return true;
}
}
return false;
} | [
"public",
"static",
"function",
"isAssociativeArray",
"(",
"array",
"$",
"aArray",
")",
"{",
"foreach",
"(",
"array_keys",
"(",
"$",
"aArray",
")",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"key",
")",
")",
"{",
"return",
"true"... | Returns TRUE iff the specified array is associative.
If the specified array is empty, then return FALSE.
http://stackoverflow.com/questions/173400/php-arrays-a-good-way-to-check-if-an-array-is-associative-or-sequential
@param array $aArray
@return bool true ssi iff the specified array is associative | [
"Returns",
"TRUE",
"iff",
"the",
"specified",
"array",
"is",
"associative",
".",
"If",
"the",
"specified",
"array",
"is",
"empty",
"then",
"return",
"FALSE",
"."
] | 09e787e554158d7c2233a27107d2949824cd5602 | https://github.com/geoffroy-aubry/Helpers/blob/09e787e554158d7c2233a27107d2949824cd5602/src/GAubry/Helpers/Helpers.php#L291-L299 |
198,965 | geoffroy-aubry/Helpers | src/GAubry/Helpers/Helpers.php | Helpers.getCurrentTimeWithCS | public static function getCurrentTimeWithCS ($sFormat)
{
$aMicrotime = explode(' ', microtime());
$sFilledFormat = sprintf($sFormat, $aMicrotime[0]*1000000);
$sDate = date($sFilledFormat, $aMicrotime[1]);
return $sDate;
} | php | public static function getCurrentTimeWithCS ($sFormat)
{
$aMicrotime = explode(' ', microtime());
$sFilledFormat = sprintf($sFormat, $aMicrotime[0]*1000000);
$sDate = date($sFilledFormat, $aMicrotime[1]);
return $sDate;
} | [
"public",
"static",
"function",
"getCurrentTimeWithCS",
"(",
"$",
"sFormat",
")",
"{",
"$",
"aMicrotime",
"=",
"explode",
"(",
"' '",
",",
"microtime",
"(",
")",
")",
";",
"$",
"sFilledFormat",
"=",
"sprintf",
"(",
"$",
"sFormat",
",",
"$",
"aMicrotime",
... | Returns current time with hundredths of a second.
@param string $sFormat including %s for cs, eg: 'Y-m-d H:i:s.%s'
@return string current time with hundredths of a second. | [
"Returns",
"current",
"time",
"with",
"hundredths",
"of",
"a",
"second",
"."
] | 09e787e554158d7c2233a27107d2949824cd5602 | https://github.com/geoffroy-aubry/Helpers/blob/09e787e554158d7c2233a27107d2949824cd5602/src/GAubry/Helpers/Helpers.php#L307-L313 |
198,966 | geoffroy-aubry/Helpers | src/GAubry/Helpers/Helpers.php | Helpers.generateMongoId | public static function generateMongoId ($iTimestamp = 0, $bBase32 = true)
{
static $inc = 0;
if ($inc === 0) {
// set with microseconds:
$inc = (int)substr(microtime(), 2, 6);
}
$bin = sprintf(
'%s%s%s%s',
pack('N', $iTimestamp ?: time... | php | public static function generateMongoId ($iTimestamp = 0, $bBase32 = true)
{
static $inc = 0;
if ($inc === 0) {
// set with microseconds:
$inc = (int)substr(microtime(), 2, 6);
}
$bin = sprintf(
'%s%s%s%s',
pack('N', $iTimestamp ?: time... | [
"public",
"static",
"function",
"generateMongoId",
"(",
"$",
"iTimestamp",
"=",
"0",
",",
"$",
"bBase32",
"=",
"true",
")",
"{",
"static",
"$",
"inc",
"=",
"0",
";",
"if",
"(",
"$",
"inc",
"===",
"0",
")",
"{",
"// set with microseconds:",
"$",
"inc",
... | Generates a globally unique id generator using Mongo Object ID algorithm.
The 12-byte ObjectId value consists of:
- a 4-byte value representing the seconds since the Unix epoch,
- a 3-byte machine identifier,
- a 2-byte process id, and
- a 3-byte counter, starting with a random value.
@see https://docs.mongodb.org/man... | [
"Generates",
"a",
"globally",
"unique",
"id",
"generator",
"using",
"Mongo",
"Object",
"ID",
"algorithm",
"."
] | 09e787e554158d7c2233a27107d2949824cd5602 | https://github.com/geoffroy-aubry/Helpers/blob/09e787e554158d7c2233a27107d2949824cd5602/src/GAubry/Helpers/Helpers.php#L355-L372 |
198,967 | yasheena/yii2-view | YFormatter.php | YFormatter.asNtext1line | public function asNtext1line($value, $maxlen = null)
{
if ($value === null) {
return $this->nullDisplay;
}
$suffix = '';
if ((false !== ($n = strpos($value, "\n"))) || (false !== ($n = strpos($value, "\r")))) {
if (($n > 0) && (substr($value, $n - 1, 1) ==... | php | public function asNtext1line($value, $maxlen = null)
{
if ($value === null) {
return $this->nullDisplay;
}
$suffix = '';
if ((false !== ($n = strpos($value, "\n"))) || (false !== ($n = strpos($value, "\r")))) {
if (($n > 0) && (substr($value, $n - 1, 1) ==... | [
"public",
"function",
"asNtext1line",
"(",
"$",
"value",
",",
"$",
"maxlen",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"nullDisplay",
";",
"}",
"$",
"suffix",
"=",
"''",
";",
"if",
"(",
... | Formats the value as an HTML-encoded plain text. If the value contains \n or \r
the first line will be returned only.
@param string $value the value to be formatted.
@return string the formatted result. | [
"Formats",
"the",
"value",
"as",
"an",
"HTML",
"-",
"encoded",
"plain",
"text",
".",
"If",
"the",
"value",
"contains",
"\\",
"n",
"or",
"\\",
"r",
"the",
"first",
"line",
"will",
"be",
"returned",
"only",
"."
] | b75a24efc9bbf463c0fce8e2e4477ff3ae169559 | https://github.com/yasheena/yii2-view/blob/b75a24efc9bbf463c0fce8e2e4477ff3ae169559/YFormatter.php#L30-L50 |
198,968 | dms-org/common.structure | src/DateTime/TimezonedDateTimeRange.php | TimezonedDateTimeRange.overlaps | public function overlaps(TimezonedDateTimeRange $otherRange) : bool
{
return $this->contains($otherRange->start) || $this->contains($otherRange->end)
|| $this->encompasses($otherRange)
|| $otherRange->encompasses($this);
} | php | public function overlaps(TimezonedDateTimeRange $otherRange) : bool
{
return $this->contains($otherRange->start) || $this->contains($otherRange->end)
|| $this->encompasses($otherRange)
|| $otherRange->encompasses($this);
} | [
"public",
"function",
"overlaps",
"(",
"TimezonedDateTimeRange",
"$",
"otherRange",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"contains",
"(",
"$",
"otherRange",
"->",
"start",
")",
"||",
"$",
"this",
"->",
"contains",
"(",
"$",
"otherRange",
"->... | Returns whether the supplied timezoned date time range overlaps this date time range.
@param TimezonedDateTimeRange $otherRange
@return bool | [
"Returns",
"whether",
"the",
"supplied",
"timezoned",
"date",
"time",
"range",
"overlaps",
"this",
"date",
"time",
"range",
"."
] | 23f122182f60df5ec847047a81a39c8aab019ff1 | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/DateTime/TimezonedDateTimeRange.php#L105-L110 |
198,969 | Raphhh/puppy-static-route | src/StaticModule.php | StaticModule.init | public function init(Application $application)
{
$application->addService('staticController', new StaticControllerService());
$application->any(':all', $application->getService('staticController'));
} | php | public function init(Application $application)
{
$application->addService('staticController', new StaticControllerService());
$application->any(':all', $application->getService('staticController'));
} | [
"public",
"function",
"init",
"(",
"Application",
"$",
"application",
")",
"{",
"$",
"application",
"->",
"addService",
"(",
"'staticController'",
",",
"new",
"StaticControllerService",
"(",
")",
")",
";",
"$",
"application",
"->",
"any",
"(",
"':all'",
",",
... | init the module.
@param Application $application | [
"init",
"the",
"module",
"."
] | 08d94ffdd9cc58fff1b0cae6982cc51b6e4ece5a | https://github.com/Raphhh/puppy-static-route/blob/08d94ffdd9cc58fff1b0cae6982cc51b6e4ece5a/src/StaticModule.php#L20-L24 |
198,970 | inc2734/wp-page-speed-optimization | src/App/Controller/Assets.php | Assets._builded | public function _builded( $tag, $handle, $src ) {
$handles = apply_filters( 'inc2734_wp_page_speed_optimization_builded_scripts', [] );
if ( ! in_array( $handle, $handles ) ) {
return $tag;
}
return sprintf(
'<script>
document.addEventListener("DOMContentLoaded", function(event) {
var s=document.... | php | public function _builded( $tag, $handle, $src ) {
$handles = apply_filters( 'inc2734_wp_page_speed_optimization_builded_scripts', [] );
if ( ! in_array( $handle, $handles ) ) {
return $tag;
}
return sprintf(
'<script>
document.addEventListener("DOMContentLoaded", function(event) {
var s=document.... | [
"public",
"function",
"_builded",
"(",
"$",
"tag",
",",
"$",
"handle",
",",
"$",
"src",
")",
"{",
"$",
"handles",
"=",
"apply_filters",
"(",
"'inc2734_wp_page_speed_optimization_builded_scripts'",
",",
"[",
"]",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"... | Re-build script tag
only in_footer param is true
@param string $tag
@param string handle
@param string src
@return string | [
"Re",
"-",
"build",
"script",
"tag",
"only",
"in_footer",
"param",
"is",
"true"
] | 219963582b592eef4bde6cdd4ed1cf0dc71a6114 | https://github.com/inc2734/wp-page-speed-optimization/blob/219963582b592eef4bde6cdd4ed1cf0dc71a6114/src/App/Controller/Assets.php#L69-L86 |
198,971 | inc2734/wp-page-speed-optimization | src/App/Controller/Assets.php | Assets._set_preload_stylesheet | public function _set_preload_stylesheet( $tag, $handle, $src ) {
$handles = apply_filters( 'inc2734_wp_page_speed_optimization_output_head_styles', [] );
if ( in_array( $handle, $handles ) && 0 === strpos( $src, site_url() ) ) {
$sitepath = site_url( '', 'relative' );
$abspath = untrailingslashit( ABSPATH );... | php | public function _set_preload_stylesheet( $tag, $handle, $src ) {
$handles = apply_filters( 'inc2734_wp_page_speed_optimization_output_head_styles', [] );
if ( in_array( $handle, $handles ) && 0 === strpos( $src, site_url() ) ) {
$sitepath = site_url( '', 'relative' );
$abspath = untrailingslashit( ABSPATH );... | [
"public",
"function",
"_set_preload_stylesheet",
"(",
"$",
"tag",
",",
"$",
"handle",
",",
"$",
"src",
")",
"{",
"$",
"handles",
"=",
"apply_filters",
"(",
"'inc2734_wp_page_speed_optimization_output_head_styles'",
",",
"[",
"]",
")",
";",
"if",
"(",
"in_array",... | Set rel="preload" for stylesheet
@param string $tag
@param string handle
@param string src
@return string | [
"Set",
"rel",
"=",
"preload",
"for",
"stylesheet"
] | 219963582b592eef4bde6cdd4ed1cf0dc71a6114 | https://github.com/inc2734/wp-page-speed-optimization/blob/219963582b592eef4bde6cdd4ed1cf0dc71a6114/src/App/Controller/Assets.php#L96-L124 |
198,972 | inc2734/wp-page-speed-optimization | src/App/Controller/Assets.php | Assets._optimize_jquery_loading | public function _optimize_jquery_loading() {
$optimize_loading = apply_filters( 'inc2734_wp_page_speed_optimization_optimize_jquery_loading', false );
if ( ! $optimize_loading ) {
return;
}
if ( is_admin() || in_array( $GLOBALS['pagenow'], [ 'wp-login.php', 'wp-register.php' ] ) ) {
return;
}
global... | php | public function _optimize_jquery_loading() {
$optimize_loading = apply_filters( 'inc2734_wp_page_speed_optimization_optimize_jquery_loading', false );
if ( ! $optimize_loading ) {
return;
}
if ( is_admin() || in_array( $GLOBALS['pagenow'], [ 'wp-login.php', 'wp-register.php' ] ) ) {
return;
}
global... | [
"public",
"function",
"_optimize_jquery_loading",
"(",
")",
"{",
"$",
"optimize_loading",
"=",
"apply_filters",
"(",
"'inc2734_wp_page_speed_optimization_optimize_jquery_loading'",
",",
"false",
")",
";",
"if",
"(",
"!",
"$",
"optimize_loading",
")",
"{",
"return",
";... | Optimize jQuery loading
jQuery loads in footer and Invalidate jquery-migrate
@return void | [
"Optimize",
"jQuery",
"loading"
] | 219963582b592eef4bde6cdd4ed1cf0dc71a6114 | https://github.com/inc2734/wp-page-speed-optimization/blob/219963582b592eef4bde6cdd4ed1cf0dc71a6114/src/App/Controller/Assets.php#L161-L182 |
198,973 | geega/php-simple-orm | src/Model.php | Model.find | static public function find($id)
{
$model = new static;
$result = $model->execute('SELECT * FROM '.$model->table.' WHERE '.$model->key.' = ?', [$id]);
if (is_array($result)) {
$result = current($result);
}
return $result;
} | php | static public function find($id)
{
$model = new static;
$result = $model->execute('SELECT * FROM '.$model->table.' WHERE '.$model->key.' = ?', [$id]);
if (is_array($result)) {
$result = current($result);
}
return $result;
} | [
"static",
"public",
"function",
"find",
"(",
"$",
"id",
")",
"{",
"$",
"model",
"=",
"new",
"static",
";",
"$",
"result",
"=",
"$",
"model",
"->",
"execute",
"(",
"'SELECT * FROM '",
".",
"$",
"model",
"->",
"table",
".",
"' WHERE '",
".",
"$",
"mode... | Find record by pk
@param $id
@return array|mixed | [
"Find",
"record",
"by",
"pk"
] | 8ef636fd181c16ee3936d630d99e232c53883447 | https://github.com/geega/php-simple-orm/blob/8ef636fd181c16ee3936d630d99e232c53883447/src/Model.php#L60-L68 |
198,974 | geega/php-simple-orm | src/Model.php | Model.findByQuery | static public function findByQuery($sqlQuery, array $params, $fetchMode = \PDO::FETCH_OBJ)
{
$model = new static;
if($model->table) {
$sqlQuery = str_replace(':table', $model->table, $sqlQuery);
}
$result = $model->execute($sqlQuery);
return $result;
} | php | static public function findByQuery($sqlQuery, array $params, $fetchMode = \PDO::FETCH_OBJ)
{
$model = new static;
if($model->table) {
$sqlQuery = str_replace(':table', $model->table, $sqlQuery);
}
$result = $model->execute($sqlQuery);
return $result;
} | [
"static",
"public",
"function",
"findByQuery",
"(",
"$",
"sqlQuery",
",",
"array",
"$",
"params",
",",
"$",
"fetchMode",
"=",
"\\",
"PDO",
"::",
"FETCH_OBJ",
")",
"{",
"$",
"model",
"=",
"new",
"static",
";",
"if",
"(",
"$",
"model",
"->",
"table",
"... | Find by query
@param $sqlQuery
@param array $params
@param int $fetchMode
@return mixed | [
"Find",
"by",
"query"
] | 8ef636fd181c16ee3936d630d99e232c53883447 | https://github.com/geega/php-simple-orm/blob/8ef636fd181c16ee3936d630d99e232c53883447/src/Model.php#L96-L105 |
198,975 | erenmustafaozdal/laravel-modules-base | src/Controllers/OperationNodeTrait.php | OperationNodeTrait.getNodes | protected function getNodes($class, $id)
{
$records = [];
$records['nodes'] = [];
$models = $this->getNodeModels($class, $id);
foreach ($models as $model) {
$records['nodes'][] = $this->getNodeValues($model);
}
return $records;
} | php | protected function getNodes($class, $id)
{
$records = [];
$records['nodes'] = [];
$models = $this->getNodeModels($class, $id);
foreach ($models as $model) {
$records['nodes'][] = $this->getNodeValues($model);
}
return $records;
} | [
"protected",
"function",
"getNodes",
"(",
"$",
"class",
",",
"$",
"id",
")",
"{",
"$",
"records",
"=",
"[",
"]",
";",
"$",
"records",
"[",
"'nodes'",
"]",
"=",
"[",
"]",
";",
"$",
"models",
"=",
"$",
"this",
"->",
"getNodeModels",
"(",
"$",
"clas... | get nestable nodes
@param $class
@param integer|null $id
@return array | [
"get",
"nestable",
"nodes"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/OperationNodeTrait.php#L38-L47 |
198,976 | erenmustafaozdal/laravel-modules-base | src/Controllers/OperationNodeTrait.php | OperationNodeTrait.storeNode | protected function storeNode($class, $path = null, $id = null)
{
DB::beginTransaction();
try {
$datas = $this->request->parent != 0 || $this->request->related != 0 ? $this->getDefineDatas($class) : $this->request->all();
$this->model = $class::create($datas);
$thi... | php | protected function storeNode($class, $path = null, $id = null)
{
DB::beginTransaction();
try {
$datas = $this->request->parent != 0 || $this->request->related != 0 ? $this->getDefineDatas($class) : $this->request->all();
$this->model = $class::create($datas);
$thi... | [
"protected",
"function",
"storeNode",
"(",
"$",
"class",
",",
"$",
"path",
"=",
"null",
",",
"$",
"id",
"=",
"null",
")",
"{",
"DB",
"::",
"beginTransaction",
"(",
")",
";",
"try",
"{",
"$",
"datas",
"=",
"$",
"this",
"->",
"request",
"->",
"parent... | store nestable node
@param $class
@param string|null $path
@param integer|null $id
@throws StoreException
@return array | [
"store",
"nestable",
"node"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/OperationNodeTrait.php#L58-L94 |
198,977 | erenmustafaozdal/laravel-modules-base | src/Controllers/OperationNodeTrait.php | OperationNodeTrait.moveModel | protected function moveModel($model)
{
$this->model = $model;
DB::beginTransaction();
try {
if ($this->request->position === 'firstChild' || $this->request->position === 'lastChild') {
$this->model->fill($this->getDefineDatas($this->model))->save();
}
... | php | protected function moveModel($model)
{
$this->model = $model;
DB::beginTransaction();
try {
if ($this->request->position === 'firstChild' || $this->request->position === 'lastChild') {
$this->model->fill($this->getDefineDatas($this->model))->save();
}
... | [
"protected",
"function",
"moveModel",
"(",
"$",
"model",
")",
"{",
"$",
"this",
"->",
"model",
"=",
"$",
"model",
";",
"DB",
"::",
"beginTransaction",
"(",
")",
";",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"request",
"->",
"position",
"===",
"'firs... | move nestable node
@param $model
@throws StoreException
@return array | [
"move",
"nestable",
"node"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/OperationNodeTrait.php#L103-L130 |
198,978 | erenmustafaozdal/laravel-modules-base | src/Controllers/OperationNodeTrait.php | OperationNodeTrait.getNodeModels | private function getNodeModels($class, $relation_id)
{
if ($this->request->id === '0') {
return is_null($relation_id)
? $class::all()->toHierarchy()
: $class::where('parent_id',$relation_id)->get()->toHierarchy();
}
return $class::findOrFail($this... | php | private function getNodeModels($class, $relation_id)
{
if ($this->request->id === '0') {
return is_null($relation_id)
? $class::all()->toHierarchy()
: $class::where('parent_id',$relation_id)->get()->toHierarchy();
}
return $class::findOrFail($this... | [
"private",
"function",
"getNodeModels",
"(",
"$",
"class",
",",
"$",
"relation_id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"request",
"->",
"id",
"===",
"'0'",
")",
"{",
"return",
"is_null",
"(",
"$",
"relation_id",
")",
"?",
"$",
"class",
"::",
"al... | get node models
@param $class
@param integer $relation_id
@return \Illuminate\Database\Eloquent\Collection | [
"get",
"node",
"models"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/OperationNodeTrait.php#L139-L148 |
198,979 | erenmustafaozdal/laravel-modules-base | src/Controllers/OperationNodeTrait.php | OperationNodeTrait.getNodeValues | private function getNodeValues($model)
{
$attribute = "{$this->name}_uc_first";
return [
'id' => $model->id,
'parent' => $model->parent_id,
'name' => $model->$attribute,
'level' => $model->depth,
'type' => $model->is... | php | private function getNodeValues($model)
{
$attribute = "{$this->name}_uc_first";
return [
'id' => $model->id,
'parent' => $model->parent_id,
'name' => $model->$attribute,
'level' => $model->depth,
'type' => $model->is... | [
"private",
"function",
"getNodeValues",
"(",
"$",
"model",
")",
"{",
"$",
"attribute",
"=",
"\"{$this->name}_uc_first\"",
";",
"return",
"[",
"'id'",
"=>",
"$",
"model",
"->",
"id",
",",
"'parent'",
"=>",
"$",
"model",
"->",
"parent_id",
",",
"'name'",
"=>... | get node values for return data
@param \Illuminate\Database\Eloquent\Model $model
@return array | [
"get",
"node",
"values",
"for",
"return",
"data"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/OperationNodeTrait.php#L156-L166 |
198,980 | erenmustafaozdal/laravel-modules-base | src/Controllers/OperationNodeTrait.php | OperationNodeTrait.getDefineDatas | protected function getDefineDatas($class)
{
$class = is_string($class) ? $class : get_class($class);
$id = $this->request->has('parent') && $this->request->parent != 0 ? $this->request->parent : $this->request->related;
$parent = $class::findOrFail($id);
$datas = $this->request->all(... | php | protected function getDefineDatas($class)
{
$class = is_string($class) ? $class : get_class($class);
$id = $this->request->has('parent') && $this->request->parent != 0 ? $this->request->parent : $this->request->related;
$parent = $class::findOrFail($id);
$datas = $this->request->all(... | [
"protected",
"function",
"getDefineDatas",
"(",
"$",
"class",
")",
"{",
"$",
"class",
"=",
"is_string",
"(",
"$",
"class",
")",
"?",
"$",
"class",
":",
"get_class",
"(",
"$",
"class",
")",
";",
"$",
"id",
"=",
"$",
"this",
"->",
"request",
"->",
"h... | get the define datas
@param $class
@return array | [
"get",
"the",
"define",
"datas"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/OperationNodeTrait.php#L185-L195 |
198,981 | ContaoBlackForest/contao-doctrine-orm-timestampable | src/Timestampable/Bridge.php | Bridge.duplicateEntity | public static function duplicateEntity(DuplicateEntity $event)
{
if ($event->getWithoutKeys()) {
$entity = $event->getEntity();
if (isset($GLOBALS['TL_DCA'][$entity->entityTableName()]['fields'])) {
/** @var EntityAccessor $entityAccessor */
$entityAc... | php | public static function duplicateEntity(DuplicateEntity $event)
{
if ($event->getWithoutKeys()) {
$entity = $event->getEntity();
if (isset($GLOBALS['TL_DCA'][$entity->entityTableName()]['fields'])) {
/** @var EntityAccessor $entityAccessor */
$entityAc... | [
"public",
"static",
"function",
"duplicateEntity",
"(",
"DuplicateEntity",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"event",
"->",
"getWithoutKeys",
"(",
")",
")",
"{",
"$",
"entity",
"=",
"$",
"event",
"->",
"getEntity",
"(",
")",
";",
"if",
"(",
"isse... | Clean timestamp able entries from duplicated entities.
@param DuplicateEntity $event The event.
@return void
@SuppressWarnings(PHPMD.Superglobals) | [
"Clean",
"timestamp",
"able",
"entries",
"from",
"duplicated",
"entities",
"."
] | 5322a2a4325dfbc4091c9a8ead010f882da13007 | https://github.com/ContaoBlackForest/contao-doctrine-orm-timestampable/blob/5322a2a4325dfbc4091c9a8ead010f882da13007/src/Timestampable/Bridge.php#L56-L73 |
198,982 | itkg/core | src/Itkg/Core/EntityAbstract.php | EntityAbstract.setDataForSubEntitiy | private function setDataForSubEntitiy($propertyKey, $value)
{
$subKey = strtolower(strstr($propertyKey, '_', true));
$getterMethodName = 'get' . ucfirst($subKey);
if (!empty($subKey) && method_exists($this, $getterMethodName)) {
$subObject = $this->$getterMethodName();
... | php | private function setDataForSubEntitiy($propertyKey, $value)
{
$subKey = strtolower(strstr($propertyKey, '_', true));
$getterMethodName = 'get' . ucfirst($subKey);
if (!empty($subKey) && method_exists($this, $getterMethodName)) {
$subObject = $this->$getterMethodName();
... | [
"private",
"function",
"setDataForSubEntitiy",
"(",
"$",
"propertyKey",
",",
"$",
"value",
")",
"{",
"$",
"subKey",
"=",
"strtolower",
"(",
"strstr",
"(",
"$",
"propertyKey",
",",
"'_'",
",",
"true",
")",
")",
";",
"$",
"getterMethodName",
"=",
"'get'",
... | Process sub entity to set data recursively
@param string $propertyKey
@param mixed $value
@return void | [
"Process",
"sub",
"entity",
"to",
"set",
"data",
"recursively"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/EntityAbstract.php#L129-L144 |
198,983 | itkg/core | src/Itkg/Core/EntityAbstract.php | EntityAbstract.getPropertyValue | protected function getPropertyValue($propertyName)
{
$desiredKey = $this->trimPrefixKey($propertyName);
$getter = 'get' . ucfirst($this->getPropertyName($desiredKey));
if (method_exists($this, $getter)) {
return $this->$getter();
}
// Otherwise, try to get sub o... | php | protected function getPropertyValue($propertyName)
{
$desiredKey = $this->trimPrefixKey($propertyName);
$getter = 'get' . ucfirst($this->getPropertyName($desiredKey));
if (method_exists($this, $getter)) {
return $this->$getter();
}
// Otherwise, try to get sub o... | [
"protected",
"function",
"getPropertyValue",
"(",
"$",
"propertyName",
")",
"{",
"$",
"desiredKey",
"=",
"$",
"this",
"->",
"trimPrefixKey",
"(",
"$",
"propertyName",
")",
";",
"$",
"getter",
"=",
"'get'",
".",
"ucfirst",
"(",
"$",
"this",
"->",
"getProper... | Get method name for getter
@param string $propertyName
@throws \InvalidArgumentException
@return string | [
"Get",
"method",
"name",
"for",
"getter"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/EntityAbstract.php#L216-L242 |
198,984 | itkg/core | src/Itkg/Core/EntityAbstract.php | EntityAbstract.getDataForCache | public function getDataForCache()
{
$reflectionClass = new \ReflectionObject($this);
$array = array();
$excludes = array_flip($this->excludedPropertiesForCache);
$excludes['excludedPropertiesForCache'] = true;
foreach ($reflectionClass->getProperties() as $property) {
... | php | public function getDataForCache()
{
$reflectionClass = new \ReflectionObject($this);
$array = array();
$excludes = array_flip($this->excludedPropertiesForCache);
$excludes['excludedPropertiesForCache'] = true;
foreach ($reflectionClass->getProperties() as $property) {
... | [
"public",
"function",
"getDataForCache",
"(",
")",
"{",
"$",
"reflectionClass",
"=",
"new",
"\\",
"ReflectionObject",
"(",
"$",
"this",
")",
";",
"$",
"array",
"=",
"array",
"(",
")",
";",
"$",
"excludes",
"=",
"array_flip",
"(",
"$",
"this",
"->",
"ex... | Get data from entity for cache set
@return mixed | [
"Get",
"data",
"from",
"entity",
"for",
"cache",
"set"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/EntityAbstract.php#L270-L285 |
198,985 | itkg/core | src/Itkg/Core/EntityAbstract.php | EntityAbstract.processPropertyForCache | protected function processPropertyForCache($propertyName)
{
$value = $this->$propertyName;
if ($value instanceof CacheableInterface) {
$value = $value->getDataForCache();
} elseif (is_object($value)) {
$value = null;
}
return $value;
} | php | protected function processPropertyForCache($propertyName)
{
$value = $this->$propertyName;
if ($value instanceof CacheableInterface) {
$value = $value->getDataForCache();
} elseif (is_object($value)) {
$value = null;
}
return $value;
} | [
"protected",
"function",
"processPropertyForCache",
"(",
"$",
"propertyName",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"$",
"propertyName",
";",
"if",
"(",
"$",
"value",
"instanceof",
"CacheableInterface",
")",
"{",
"$",
"value",
"=",
"$",
"value",
... | Process a property to get data for caching flow
@param string $propertyName
@return mixed|null | [
"Process",
"a",
"property",
"to",
"get",
"data",
"for",
"caching",
"flow"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/EntityAbstract.php#L316-L327 |
198,986 | wb-crowdfusion/crowdfusion | system/core/classes/mvc/controllers/NodeCliController.php | NodeCliController.deleteAll | protected function deleteAll()
{
$elements = $this->Request->getRequiredParameter('elements');
$interval = 1000;
$elementSlugs = StringUtils::smartExplode($elements);
$elements = array();
foreach($elementSlugs as $eSlug)
$elements[] = $this->ElementService->getB... | php | protected function deleteAll()
{
$elements = $this->Request->getRequiredParameter('elements');
$interval = 1000;
$elementSlugs = StringUtils::smartExplode($elements);
$elements = array();
foreach($elementSlugs as $eSlug)
$elements[] = $this->ElementService->getB... | [
"protected",
"function",
"deleteAll",
"(",
")",
"{",
"$",
"elements",
"=",
"$",
"this",
"->",
"Request",
"->",
"getRequiredParameter",
"(",
"'elements'",
")",
";",
"$",
"interval",
"=",
"1000",
";",
"$",
"elementSlugs",
"=",
"StringUtils",
"::",
"smartExplod... | Deletes all nodes for specified elements.
@param elements A comma delimited list of the elements to delete nodes in
@param offset An integer value for the offset to begin deleting nodes from
@return void | [
"Deletes",
"all",
"nodes",
"for",
"specified",
"elements",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/controllers/NodeCliController.php#L404-L467 |
198,987 | fridge-project/dbal | src/Fridge/DBAL/Schema/Sequence.php | Sequence.setInitialValue | public function setInitialValue($initialValue)
{
if (!is_int($initialValue) || ($initialValue <= 0)) {
throw SchemaException::invalidSequenceInitialValue($this->getName());
}
$this->initialValue = $initialValue;
} | php | public function setInitialValue($initialValue)
{
if (!is_int($initialValue) || ($initialValue <= 0)) {
throw SchemaException::invalidSequenceInitialValue($this->getName());
}
$this->initialValue = $initialValue;
} | [
"public",
"function",
"setInitialValue",
"(",
"$",
"initialValue",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"initialValue",
")",
"||",
"(",
"$",
"initialValue",
"<=",
"0",
")",
")",
"{",
"throw",
"SchemaException",
"::",
"invalidSequenceInitialValue",
"... | Sets the initial value.
@param integer $initialValue The initial value.
@throws \Fridge\DBAL\Exception\SchemaException If the initial value is not a positive integer. | [
"Sets",
"the",
"initial",
"value",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/Sequence.php#L61-L68 |
198,988 | fridge-project/dbal | src/Fridge/DBAL/Schema/Sequence.php | Sequence.setIncrementSize | public function setIncrementSize($incrementSize)
{
if (!is_int($incrementSize) || ($incrementSize <= 0)) {
throw SchemaException::invalidSequenceIncrementSize($this->getName());
}
$this->incrementSize = $incrementSize;
} | php | public function setIncrementSize($incrementSize)
{
if (!is_int($incrementSize) || ($incrementSize <= 0)) {
throw SchemaException::invalidSequenceIncrementSize($this->getName());
}
$this->incrementSize = $incrementSize;
} | [
"public",
"function",
"setIncrementSize",
"(",
"$",
"incrementSize",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"incrementSize",
")",
"||",
"(",
"$",
"incrementSize",
"<=",
"0",
")",
")",
"{",
"throw",
"SchemaException",
"::",
"invalidSequenceIncrementSize"... | Sets the increment size.
@param integer $incrementSize The increment size.
@throws \Fridge\DBAL\Exception\SchemaException If the increment size is not a positive integer. | [
"Sets",
"the",
"increment",
"size",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/Sequence.php#L87-L94 |
198,989 | CalderaWP/caldera-interop | src/Traits/CollectsModels.php | CollectsModels.addItem | public function addItem(Model $item) : Collection
{
call_user_func([$this,$this->setterName()], $item);
return $this;
} | php | public function addItem(Model $item) : Collection
{
call_user_func([$this,$this->setterName()], $item);
return $this;
} | [
"public",
"function",
"addItem",
"(",
"Model",
"$",
"item",
")",
":",
"Collection",
"{",
"call_user_func",
"(",
"[",
"$",
"this",
",",
"$",
"this",
"->",
"setterName",
"(",
")",
"]",
",",
"$",
"item",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Add item to collection
@param Model $item
@return Collection | [
"Add",
"item",
"to",
"collection"
] | d25c4bc930200b314fbd42d084080b5d85261c94 | https://github.com/CalderaWP/caldera-interop/blob/d25c4bc930200b314fbd42d084080b5d85261c94/src/Traits/CollectsModels.php#L27-L31 |
198,990 | CalderaWP/caldera-interop | src/Traits/CollectsModels.php | CollectsModels.removeItem | public function removeItem(Model $item) : Collection
{
if ($this->has($item->getId())) {
unset($this->items[$item->getId()]);
}
return $this;
} | php | public function removeItem(Model $item) : Collection
{
if ($this->has($item->getId())) {
unset($this->items[$item->getId()]);
}
return $this;
} | [
"public",
"function",
"removeItem",
"(",
"Model",
"$",
"item",
")",
":",
"Collection",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"item",
"->",
"getId",
"(",
")",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"items",
"[",
"$",
"item",... | Remove an item from collection
@param Model $item
@return Collection | [
"Remove",
"an",
"item",
"from",
"collection"
] | d25c4bc930200b314fbd42d084080b5d85261c94 | https://github.com/CalderaWP/caldera-interop/blob/d25c4bc930200b314fbd42d084080b5d85261c94/src/Traits/CollectsModels.php#L56-L63 |
198,991 | CalderaWP/caldera-interop | src/Traits/CollectsModels.php | CollectsModels.toArray | public function toArray() : array
{
$items= is_array($this->items)? $this->items : [];
foreach ($items as $itemIndex => $item) {
if (is_object($item)&& is_callable([$item,'toArray'])) {
try {
$items[ $itemIndex ] = $item->toArray();
} catch (\Exception $e) {
throw $e;
}
}
}
return $... | php | public function toArray() : array
{
$items= is_array($this->items)? $this->items : [];
foreach ($items as $itemIndex => $item) {
if (is_object($item)&& is_callable([$item,'toArray'])) {
try {
$items[ $itemIndex ] = $item->toArray();
} catch (\Exception $e) {
throw $e;
}
}
}
return $... | [
"public",
"function",
"toArray",
"(",
")",
":",
"array",
"{",
"$",
"items",
"=",
"is_array",
"(",
"$",
"this",
"->",
"items",
")",
"?",
"$",
"this",
"->",
"items",
":",
"[",
"]",
";",
"foreach",
"(",
"$",
"items",
"as",
"$",
"itemIndex",
"=>",
"$... | Get items in collection
@return array | [
"Get",
"items",
"in",
"collection"
] | d25c4bc930200b314fbd42d084080b5d85261c94 | https://github.com/CalderaWP/caldera-interop/blob/d25c4bc930200b314fbd42d084080b5d85261c94/src/Traits/CollectsModels.php#L70-L83 |
198,992 | JamesMcAvoy/PsrRouter | src/Route.php | Route.call | public function call(Request $request, Response $response) : Response {
return call_user_func($this->callable, $request, $response, $this->slugs);
} | php | public function call(Request $request, Response $response) : Response {
return call_user_func($this->callable, $request, $response, $this->slugs);
} | [
"public",
"function",
"call",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
":",
"Response",
"{",
"return",
"call_user_func",
"(",
"$",
"this",
"->",
"callable",
",",
"$",
"request",
",",
"$",
"response",
",",
"$",
"this",
"->",
... | Call the callback function of the route
@param RequestInterface
@param ResponseInterface
@return mixed | [
"Call",
"the",
"callback",
"function",
"of",
"the",
"route"
] | 00a3e15f8d1f87aef0eadde1074bea2179cd53fe | https://github.com/JamesMcAvoy/PsrRouter/blob/00a3e15f8d1f87aef0eadde1074bea2179cd53fe/src/Route.php#L95-L99 |
198,993 | kambalabs/KmbPuppetDb | src/KmbPuppetDb/Request.php | Request.getFullUri | public function getFullUri()
{
$queryString = '';
$params = array();
if ($this->hasQuery()) {
$params[] = $this->getQueryParam();
}
if ($this->hasOrderBy()) {
$params[] = $this->getOrderByParam();
}
if ($this->hasSummarizeBy()) {
... | php | public function getFullUri()
{
$queryString = '';
$params = array();
if ($this->hasQuery()) {
$params[] = $this->getQueryParam();
}
if ($this->hasOrderBy()) {
$params[] = $this->getOrderByParam();
}
if ($this->hasSummarizeBy()) {
... | [
"public",
"function",
"getFullUri",
"(",
")",
"{",
"$",
"queryString",
"=",
"''",
";",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"hasQuery",
"(",
")",
")",
"{",
"$",
"params",
"[",
"]",
"=",
"$",
"this",
"->",
"g... | Get full constructed URI.
@return string | [
"Get",
"full",
"constructed",
"URI",
"."
] | df56a275cf00f4402cf121a2e99149168f1f8b2d | https://github.com/kambalabs/KmbPuppetDb/blob/df56a275cf00f4402cf121a2e99149168f1f8b2d/src/KmbPuppetDb/Request.php#L70-L104 |
198,994 | Wedeto/Util | src/DI/Injector.php | Injector.getInstance | public function getInstance(string $class, string $selector = Injector::DEFAULT_SELECTOR)
{
if (array_search($class, $this->instance_stack, true))
throw new DIException("Cyclic dependencies in creating $class: " . WF::str($this->instance_stack));
array_push($this->instance_stack, $class... | php | public function getInstance(string $class, string $selector = Injector::DEFAULT_SELECTOR)
{
if (array_search($class, $this->instance_stack, true))
throw new DIException("Cyclic dependencies in creating $class: " . WF::str($this->instance_stack));
array_push($this->instance_stack, $class... | [
"public",
"function",
"getInstance",
"(",
"string",
"$",
"class",
",",
"string",
"$",
"selector",
"=",
"Injector",
"::",
"DEFAULT_SELECTOR",
")",
"{",
"if",
"(",
"array_search",
"(",
"$",
"class",
",",
"$",
"this",
"->",
"instance_stack",
",",
"true",
")",... | Get an instance of the object
@param string $class The class to get an instance of
@param string $selector Where multiple instances may exist, they can be categorized by a selector
@return Object an instance of the class | [
"Get",
"an",
"instance",
"of",
"the",
"object"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DI/Injector.php#L77-L120 |
198,995 | Wedeto/Util | src/DI/Injector.php | Injector.hasInstance | public function hasInstance(string $class, string $selector = Injector::DEFAULT_SELECTOR)
{
return isset($this->objects[$class][$selector]);
} | php | public function hasInstance(string $class, string $selector = Injector::DEFAULT_SELECTOR)
{
return isset($this->objects[$class][$selector]);
} | [
"public",
"function",
"hasInstance",
"(",
"string",
"$",
"class",
",",
"string",
"$",
"selector",
"=",
"Injector",
"::",
"DEFAULT_SELECTOR",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"class",
"]",
"[",
"$",
"selector",
"]"... | Check if an instance for the class is available.
@param string $class The class to check for an instance
@param string $selector The selector to use to find an instance. Defaults to DEFAULT_SELECTOR
@return bool True if an instance is available, false if not | [
"Check",
"if",
"an",
"instance",
"for",
"the",
"class",
"is",
"available",
"."
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DI/Injector.php#L129-L132 |
198,996 | Wedeto/Util | src/DI/Injector.php | Injector.registerFactory | public function registerFactory(string $produced_class, Factory $factory)
{
$this->factories[$produced_class] = $factory;
return $this;
} | php | public function registerFactory(string $produced_class, Factory $factory)
{
$this->factories[$produced_class] = $factory;
return $this;
} | [
"public",
"function",
"registerFactory",
"(",
"string",
"$",
"produced_class",
",",
"Factory",
"$",
"factory",
")",
"{",
"$",
"this",
"->",
"factories",
"[",
"$",
"produced_class",
"]",
"=",
"$",
"factory",
";",
"return",
"$",
"this",
";",
"}"
] | Register a factory for a class name
@param string $produced_class The class produced by the factory
@param Wedeto\Util\DI\Factory $factory The factory to register
@return $this Provides fluent interface | [
"Register",
"a",
"factory",
"for",
"a",
"class",
"name"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DI/Injector.php#L161-L165 |
198,997 | Wedeto/Util | src/DI/Injector.php | Injector.setInstance | public function setInstance(string $class, $instance, string $selector = Injector::DEFAULT_SELECTOR)
{
if (!is_a($instance, $class))
throw new DIException("Instance should be a subclass of $class");
if (!isset($this->objects[$class]))
$this->objects[$class] = [];
$t... | php | public function setInstance(string $class, $instance, string $selector = Injector::DEFAULT_SELECTOR)
{
if (!is_a($instance, $class))
throw new DIException("Instance should be a subclass of $class");
if (!isset($this->objects[$class]))
$this->objects[$class] = [];
$t... | [
"public",
"function",
"setInstance",
"(",
"string",
"$",
"class",
",",
"$",
"instance",
",",
"string",
"$",
"selector",
"=",
"Injector",
"::",
"DEFAULT_SELECTOR",
")",
"{",
"if",
"(",
"!",
"is_a",
"(",
"$",
"instance",
",",
"$",
"class",
")",
")",
"thr... | Set a specific instance of class
@param string $class The name of the class
@param string $selector Where multiple instances may exist, they can be caterogized by a selector
@param object $instance The instance to set for this class | [
"Set",
"a",
"specific",
"instance",
"of",
"class"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DI/Injector.php#L174-L183 |
198,998 | Wedeto/Util | src/DI/Injector.php | Injector.clearInstance | public function clearInstance(string $class, string $selector = Injector::DEFAULT_SELECTOR)
{
if (!isset($this->objects[$class]))
return;
unset($this->objects[$class][$selector]);
} | php | public function clearInstance(string $class, string $selector = Injector::DEFAULT_SELECTOR)
{
if (!isset($this->objects[$class]))
return;
unset($this->objects[$class][$selector]);
} | [
"public",
"function",
"clearInstance",
"(",
"string",
"$",
"class",
",",
"string",
"$",
"selector",
"=",
"Injector",
"::",
"DEFAULT_SELECTOR",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"class",
"]",
")",
")",
"retu... | Remove an instance from the repository
@param string $class The name of the class
@param string $selector The selector to clear | [
"Remove",
"an",
"instance",
"from",
"the",
"repository"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DI/Injector.php#L190-L196 |
198,999 | shrink0r/php-schema | src/Property/BoolProperty.php | BoolProperty.validate | public function validate($value)
{
return is_bool($value) ? Ok::unit() : Error::unit([ Error::NON_BOOL ]);
} | php | public function validate($value)
{
return is_bool($value) ? Ok::unit() : Error::unit([ Error::NON_BOOL ]);
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"return",
"is_bool",
"(",
"$",
"value",
")",
"?",
"Ok",
"::",
"unit",
"(",
")",
":",
"Error",
"::",
"unit",
"(",
"[",
"Error",
"::",
"NON_BOOL",
"]",
")",
";",
"}"
] | Tells if a given value is a valid bool.
@param mixed $value
@return ResultInterface Returns Ok if the value is valid, otherwise an Error is returned. | [
"Tells",
"if",
"a",
"given",
"value",
"is",
"a",
"valid",
"bool",
"."
] | 94293fe897af376dd9d05962e2c516079409dd29 | https://github.com/shrink0r/php-schema/blob/94293fe897af376dd9d05962e2c516079409dd29/src/Property/BoolProperty.php#L18-L21 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.