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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6,400 | SpartzInc/text-formatter | src/TextFormatter.php | TextFormatter.convertTitle | public function convertTitle()
{
if ($this->title === null) {
return '';
}
foreach ($this->splitWords() as $index => $word) {
if ($this->wordShouldBeUppercase($index, $word)) {
$this->rebuildTitle($index, $this->uppercaseWord($word));
}
... | php | public function convertTitle()
{
if ($this->title === null) {
return '';
}
foreach ($this->splitWords() as $index => $word) {
if ($this->wordShouldBeUppercase($index, $word)) {
$this->rebuildTitle($index, $this->uppercaseWord($word));
}
... | [
"public",
"function",
"convertTitle",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"title",
"===",
"null",
")",
"{",
"return",
"''",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"splitWords",
"(",
")",
"as",
"$",
"index",
"=>",
"$",
"word",
")",
... | Converts the initial title to a correctly formatted one
@return string | [
"Converts",
"the",
"initial",
"title",
"to",
"a",
"correctly",
"formatted",
"one"
] | 979a1646ab55188b3dfea1df0a8c8568e5905745 | https://github.com/SpartzInc/text-formatter/blob/979a1646ab55188b3dfea1df0a8c8568e5905745/src/TextFormatter.php#L81-L94 |
6,401 | SpartzInc/text-formatter | src/TextFormatter.php | TextFormatter.setTitle | protected function setTitle($title)
{
$title = trim(preg_replace('/\s\s+/', ' ', str_replace("\n", " ", $title)));
if ($title != '') {
$this->title = $title;
}
} | php | protected function setTitle($title)
{
$title = trim(preg_replace('/\s\s+/', ' ', str_replace("\n", " ", $title)));
if ($title != '') {
$this->title = $title;
}
} | [
"protected",
"function",
"setTitle",
"(",
"$",
"title",
")",
"{",
"$",
"title",
"=",
"trim",
"(",
"preg_replace",
"(",
"'/\\s\\s+/'",
",",
"' '",
",",
"str_replace",
"(",
"\"\\n\"",
",",
"\" \"",
",",
"$",
"title",
")",
")",
")",
";",
"if",
"(",
"$",... | Sets the title after cleaning up extra spaces
@param string $title | [
"Sets",
"the",
"title",
"after",
"cleaning",
"up",
"extra",
"spaces"
] | 979a1646ab55188b3dfea1df0a8c8568e5905745 | https://github.com/SpartzInc/text-formatter/blob/979a1646ab55188b3dfea1df0a8c8568e5905745/src/TextFormatter.php#L115-L122 |
6,402 | SpartzInc/text-formatter | src/TextFormatter.php | TextFormatter.splitWords | protected function splitWords()
{
$indexedWords = [];
$offset = 0;
$words = explode($this->separator, $this->title);
foreach ($words as $word) {
if (mb_strlen($word, $this->encoding) == 0) {
continue;
}
$wordIndex = $this->getWord... | php | protected function splitWords()
{
$indexedWords = [];
$offset = 0;
$words = explode($this->separator, $this->title);
foreach ($words as $word) {
if (mb_strlen($word, $this->encoding) == 0) {
continue;
}
$wordIndex = $this->getWord... | [
"protected",
"function",
"splitWords",
"(",
")",
"{",
"$",
"indexedWords",
"=",
"[",
"]",
";",
"$",
"offset",
"=",
"0",
";",
"$",
"words",
"=",
"explode",
"(",
"$",
"this",
"->",
"separator",
",",
"$",
"this",
"->",
"title",
")",
";",
"foreach",
"(... | Creates an array of words from the title to be formatted | [
"Creates",
"an",
"array",
"of",
"words",
"from",
"the",
"title",
"to",
"be",
"formatted"
] | 979a1646ab55188b3dfea1df0a8c8568e5905745 | https://github.com/SpartzInc/text-formatter/blob/979a1646ab55188b3dfea1df0a8c8568e5905745/src/TextFormatter.php#L127-L150 |
6,403 | SpartzInc/text-formatter | src/TextFormatter.php | TextFormatter.getWordIndex | protected function getWordIndex($word, $offset)
{
$index = mb_strpos($this->title, $word, $offset, $this->encoding);
return $this->correctIndexOffset($index);
} | php | protected function getWordIndex($word, $offset)
{
$index = mb_strpos($this->title, $word, $offset, $this->encoding);
return $this->correctIndexOffset($index);
} | [
"protected",
"function",
"getWordIndex",
"(",
"$",
"word",
",",
"$",
"offset",
")",
"{",
"$",
"index",
"=",
"mb_strpos",
"(",
"$",
"this",
"->",
"title",
",",
"$",
"word",
",",
"$",
"offset",
",",
"$",
"this",
"->",
"encoding",
")",
";",
"return",
... | Finds the correct index of the word within the title
@param $word
@param $offset
@return int | [
"Finds",
"the",
"correct",
"index",
"of",
"the",
"word",
"within",
"the",
"title"
] | 979a1646ab55188b3dfea1df0a8c8568e5905745 | https://github.com/SpartzInc/text-formatter/blob/979a1646ab55188b3dfea1df0a8c8568e5905745/src/TextFormatter.php#L159-L163 |
6,404 | SpartzInc/text-formatter | src/TextFormatter.php | TextFormatter.correctIndexOffset | protected function correctIndexOffset($index)
{
return mb_strlen(mb_substr($this->title, 0, $index, $this->encoding), $this->encoding);
} | php | protected function correctIndexOffset($index)
{
return mb_strlen(mb_substr($this->title, 0, $index, $this->encoding), $this->encoding);
} | [
"protected",
"function",
"correctIndexOffset",
"(",
"$",
"index",
")",
"{",
"return",
"mb_strlen",
"(",
"mb_substr",
"(",
"$",
"this",
"->",
"title",
",",
"0",
",",
"$",
"index",
",",
"$",
"this",
"->",
"encoding",
")",
",",
"$",
"this",
"->",
"encodin... | Corrects the potential offset issue with some UTF-8 characters
@param $index
@return int | [
"Corrects",
"the",
"potential",
"offset",
"issue",
"with",
"some",
"UTF",
"-",
"8",
"characters"
] | 979a1646ab55188b3dfea1df0a8c8568e5905745 | https://github.com/SpartzInc/text-formatter/blob/979a1646ab55188b3dfea1df0a8c8568e5905745/src/TextFormatter.php#L171-L174 |
6,405 | SpartzInc/text-formatter | src/TextFormatter.php | TextFormatter.rebuildTitle | protected function rebuildTitle($index, $word)
{
$this->title =
mb_substr($this->title, 0, $index, $this->encoding) .
$word .
mb_substr(
$this->title,
$index + mb_strlen($word, $this->encoding),
mb_strlen($this->title, $this... | php | protected function rebuildTitle($index, $word)
{
$this->title =
mb_substr($this->title, 0, $index, $this->encoding) .
$word .
mb_substr(
$this->title,
$index + mb_strlen($word, $this->encoding),
mb_strlen($this->title, $this... | [
"protected",
"function",
"rebuildTitle",
"(",
"$",
"index",
",",
"$",
"word",
")",
"{",
"$",
"this",
"->",
"title",
"=",
"mb_substr",
"(",
"$",
"this",
"->",
"title",
",",
"0",
",",
"$",
"index",
",",
"$",
"this",
"->",
"encoding",
")",
".",
"$",
... | Replaces a formatted word within the current title
@param int $index
@param string $word | [
"Replaces",
"a",
"formatted",
"word",
"within",
"the",
"current",
"title"
] | 979a1646ab55188b3dfea1df0a8c8568e5905745 | https://github.com/SpartzInc/text-formatter/blob/979a1646ab55188b3dfea1df0a8c8568e5905745/src/TextFormatter.php#L182-L193 |
6,406 | SpartzInc/text-formatter | src/TextFormatter.php | TextFormatter.uppercaseWord | protected function uppercaseWord($word)
{
// see if first characters are special
$prefix = '';
$hasPunctuation = true;
do {
$first = mb_substr($word, 0, 1, $this->encoding);
if ($this->isPunctuation($first)) {
$prefix .= $first;
... | php | protected function uppercaseWord($word)
{
// see if first characters are special
$prefix = '';
$hasPunctuation = true;
do {
$first = mb_substr($word, 0, 1, $this->encoding);
if ($this->isPunctuation($first)) {
$prefix .= $first;
... | [
"protected",
"function",
"uppercaseWord",
"(",
"$",
"word",
")",
"{",
"// see if first characters are special",
"$",
"prefix",
"=",
"''",
";",
"$",
"hasPunctuation",
"=",
"true",
";",
"do",
"{",
"$",
"first",
"=",
"mb_substr",
"(",
"$",
"word",
",",
"0",
"... | Performs the uppercase action on the given word
@param $word
@return string | [
"Performs",
"the",
"uppercase",
"action",
"on",
"the",
"given",
"word"
] | 979a1646ab55188b3dfea1df0a8c8568e5905745 | https://github.com/SpartzInc/text-formatter/blob/979a1646ab55188b3dfea1df0a8c8568e5905745/src/TextFormatter.php#L201-L217 |
6,407 | SpartzInc/text-formatter | src/TextFormatter.php | TextFormatter.wordShouldBeUppercase | protected function wordShouldBeUppercase($index, $word)
{
return
(
$this->isFirstWordOfSentence($index) ||
$this->isLastWord($word) ||
!$this->isIgnoredWord($word)
) &&
(
!$this->hasUppercaseLetter($word)
... | php | protected function wordShouldBeUppercase($index, $word)
{
return
(
$this->isFirstWordOfSentence($index) ||
$this->isLastWord($word) ||
!$this->isIgnoredWord($word)
) &&
(
!$this->hasUppercaseLetter($word)
... | [
"protected",
"function",
"wordShouldBeUppercase",
"(",
"$",
"index",
",",
"$",
"word",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"isFirstWordOfSentence",
"(",
"$",
"index",
")",
"||",
"$",
"this",
"->",
"isLastWord",
"(",
"$",
"word",
")",
"||",
"!",
... | Condition to see if the given word should be uppercase
@param $index
@param $word
@return bool | [
"Condition",
"to",
"see",
"if",
"the",
"given",
"word",
"should",
"be",
"uppercase"
] | 979a1646ab55188b3dfea1df0a8c8568e5905745 | https://github.com/SpartzInc/text-formatter/blob/979a1646ab55188b3dfea1df0a8c8568e5905745/src/TextFormatter.php#L226-L237 |
6,408 | SpartzInc/text-formatter | src/TextFormatter.php | TextFormatter.isFirstWordOfSentence | protected function isFirstWordOfSentence($index)
{
if ($index == 0) {
return true;
}
$twoCharactersBack = mb_substr($this->title, $index - 2, 1, $this->encoding);
if ($this->isPunctuation($twoCharactersBack)) {
return true;
}
return false;
... | php | protected function isFirstWordOfSentence($index)
{
if ($index == 0) {
return true;
}
$twoCharactersBack = mb_substr($this->title, $index - 2, 1, $this->encoding);
if ($this->isPunctuation($twoCharactersBack)) {
return true;
}
return false;
... | [
"protected",
"function",
"isFirstWordOfSentence",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"$",
"index",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}",
"$",
"twoCharactersBack",
"=",
"mb_substr",
"(",
"$",
"this",
"->",
"title",
",",
"$",
"index",
"-"... | Checks to see if the word the start of a new sentence
@param $index
@return bool | [
"Checks",
"to",
"see",
"if",
"the",
"word",
"the",
"start",
"of",
"a",
"new",
"sentence"
] | 979a1646ab55188b3dfea1df0a8c8568e5905745 | https://github.com/SpartzInc/text-formatter/blob/979a1646ab55188b3dfea1df0a8c8568e5905745/src/TextFormatter.php#L260-L273 |
6,409 | SpartzInc/text-formatter | src/TextFormatter.php | TextFormatter.hasDash | protected function hasDash($word)
{
$wordWithoutDashes = str_replace('-', '', $word);
return preg_match("/\-/", $word) && mb_strlen($wordWithoutDashes, $this->encoding) > 1;
} | php | protected function hasDash($word)
{
$wordWithoutDashes = str_replace('-', '', $word);
return preg_match("/\-/", $word) && mb_strlen($wordWithoutDashes, $this->encoding) > 1;
} | [
"protected",
"function",
"hasDash",
"(",
"$",
"word",
")",
"{",
"$",
"wordWithoutDashes",
"=",
"str_replace",
"(",
"'-'",
",",
"''",
",",
"$",
"word",
")",
";",
"return",
"preg_match",
"(",
"\"/\\-/\"",
",",
"$",
"word",
")",
"&&",
"mb_strlen",
"(",
"$... | Checks to see if the word has a dash
@param $word
@return int | [
"Checks",
"to",
"see",
"if",
"the",
"word",
"has",
"a",
"dash"
] | 979a1646ab55188b3dfea1df0a8c8568e5905745 | https://github.com/SpartzInc/text-formatter/blob/979a1646ab55188b3dfea1df0a8c8568e5905745/src/TextFormatter.php#L314-L319 |
6,410 | znframework/package-services | CDNAbstract.php | CDNAbstract.getLinks | public function getLinks() : Array
{
if( ! $this->isJsonCheck() || $this->refresh === true )
{
$result = $this->getApiResult();
if( ! is_object($result) )
{
throw new Exception\BadRequestURLException($this->address);
}
$th... | php | public function getLinks() : Array
{
if( ! $this->isJsonCheck() || $this->refresh === true )
{
$result = $this->getApiResult();
if( ! is_object($result) )
{
throw new Exception\BadRequestURLException($this->address);
}
$th... | [
"public",
"function",
"getLinks",
"(",
")",
":",
"Array",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isJsonCheck",
"(",
")",
"||",
"$",
"this",
"->",
"refresh",
"===",
"true",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getApiResult",
"(",
")",... | Gets links.
@return array | [
"Gets",
"links",
"."
] | d603667191e2e386cbc2119836c5bed9e3ade141 | https://github.com/znframework/package-services/blob/d603667191e2e386cbc2119836c5bed9e3ade141/CDNAbstract.php#L54-L71 |
6,411 | yujin1st/yii2-user | Module.php | Module.getUserMenu | public function getUserMenu() {
$event = new BuildUserMenuEvent();
$this->trigger(self::EVENT_BUILD_USER_MENU, $event);
$menu = [];
foreach ($event->items as $block => $items) {
foreach ($items as $item) {
$menu[] = $item;
}
}
return $menu;
} | php | public function getUserMenu() {
$event = new BuildUserMenuEvent();
$this->trigger(self::EVENT_BUILD_USER_MENU, $event);
$menu = [];
foreach ($event->items as $block => $items) {
foreach ($items as $item) {
$menu[] = $item;
}
}
return $menu;
} | [
"public",
"function",
"getUserMenu",
"(",
")",
"{",
"$",
"event",
"=",
"new",
"BuildUserMenuEvent",
"(",
")",
";",
"$",
"this",
"->",
"trigger",
"(",
"self",
"::",
"EVENT_BUILD_USER_MENU",
",",
"$",
"event",
")",
";",
"$",
"menu",
"=",
"[",
"]",
";",
... | Collecting side menu over modules | [
"Collecting",
"side",
"menu",
"over",
"modules"
] | b404c77acf4a96f0cdf9bb0af5c8d62bcae3946f | https://github.com/yujin1st/yii2-user/blob/b404c77acf4a96f0cdf9bb0af5c8d62bcae3946f/Module.php#L207-L217 |
6,412 | Vibius/Container | src/Container.php | Container.open | public static function open($key, $private = false, $secure = false){
if( !isset(self::$privates[$key]) && ($private === true) ){
self::$privates[$key] = new Container;
self::$privates[$key]->name = $key;
self::$privates[$key]->secure = false;
if($secure){
... | php | public static function open($key, $private = false, $secure = false){
if( !isset(self::$privates[$key]) && ($private === true) ){
self::$privates[$key] = new Container;
self::$privates[$key]->name = $key;
self::$privates[$key]->secure = false;
if($secure){
... | [
"public",
"static",
"function",
"open",
"(",
"$",
"key",
",",
"$",
"private",
"=",
"false",
",",
"$",
"secure",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"privates",
"[",
"$",
"key",
"]",
")",
"&&",
"(",
"$",
"pri... | Method is used to open specific instance of container.
@param string $key Identifier for inner storage to find the proper instance to open or create.
@return object Instance of Container class picked by $key. | [
"Method",
"is",
"used",
"to",
"open",
"specific",
"instance",
"of",
"container",
"."
] | 98691c1bc4317d36e4c950ccd47e424ea86dc39c | https://github.com/Vibius/Container/blob/98691c1bc4317d36e4c950ccd47e424ea86dc39c/src/Container.php#L35-L61 |
6,413 | xinc-develop/xinc-core | src/Build/Labeler/DefaultLabeler.php | DefaultLabeler.getLabel | public function getLabel(BuildInterface $build)
{
$buildNo = $build->getNumber();
if ($buildNo == null) {
$buildNo = $this->_firstBuild;
}
$buildLabel = $this->_prefix.$buildNo;
$build->setProperty('build.label', $buildLabel);
return $buildLabel;
} | php | public function getLabel(BuildInterface $build)
{
$buildNo = $build->getNumber();
if ($buildNo == null) {
$buildNo = $this->_firstBuild;
}
$buildLabel = $this->_prefix.$buildNo;
$build->setProperty('build.label', $buildLabel);
return $buildLabel;
} | [
"public",
"function",
"getLabel",
"(",
"BuildInterface",
"$",
"build",
")",
"{",
"$",
"buildNo",
"=",
"$",
"build",
"->",
"getNumber",
"(",
")",
";",
"if",
"(",
"$",
"buildNo",
"==",
"null",
")",
"{",
"$",
"buildNo",
"=",
"$",
"this",
"->",
"_firstBu... | Return the label for this build.
@param Xinc_Build_Interface $build
@return string | [
"Return",
"the",
"label",
"for",
"this",
"build",
"."
] | 4bb69a6afe19e1186950a3122cbfe0989823e0d6 | https://github.com/xinc-develop/xinc-core/blob/4bb69a6afe19e1186950a3122cbfe0989823e0d6/src/Build/Labeler/DefaultLabeler.php#L54-L66 |
6,414 | yusukezzz/consolet | src/Consolet/Application.php | Application.prepareContainer | public static function prepareContainer(Container $container)
{
if ( ! isset($container['config'])) {
$container['config'] = [];
}
if ( ! isset($container['files'])) {
$container['files'] = new Filesystem();
}
if ( ! isset($container['providers'])) {
... | php | public static function prepareContainer(Container $container)
{
if ( ! isset($container['config'])) {
$container['config'] = [];
}
if ( ! isset($container['files'])) {
$container['files'] = new Filesystem();
}
if ( ! isset($container['providers'])) {
... | [
"public",
"static",
"function",
"prepareContainer",
"(",
"Container",
"$",
"container",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"container",
"[",
"'config'",
"]",
")",
")",
"{",
"$",
"container",
"[",
"'config'",
"]",
"=",
"[",
"]",
";",
"}",
"i... | prepare default dependencies
@param Container $container
@return Container | [
"prepare",
"default",
"dependencies"
] | eceddd0ace37f14c1cf12d793eef265c530924e1 | https://github.com/yusukezzz/consolet/blob/eceddd0ace37f14c1cf12d793eef265c530924e1/src/Consolet/Application.php#L65-L80 |
6,415 | oschildt/SmartFactory | src/SmartFactory/ErrorHandler.php | ErrorHandler.init | public function init($parameters)
{
if (!empty($parameters["app_root"])) {
$this->app_root = $parameters["app_root"];
}
if (empty($parameters["log_path"])) {
throw new \Exception("Log path is not specified!");
}
$this->log_path = $par... | php | public function init($parameters)
{
if (!empty($parameters["app_root"])) {
$this->app_root = $parameters["app_root"];
}
if (empty($parameters["log_path"])) {
throw new \Exception("Log path is not specified!");
}
$this->log_path = $par... | [
"public",
"function",
"init",
"(",
"$",
"parameters",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"parameters",
"[",
"\"app_root\"",
"]",
")",
")",
"{",
"$",
"this",
"->",
"app_root",
"=",
"$",
"parameters",
"[",
"\"app_root\"",
"]",
";",
"}",
"if",... | Initializes the error handler with parameters.
@param array $parameters
Settings for logging as an associative array in the form key => value:
- $parameters["app_root"] - the root directory of the application.
- $parameters["log_path"] - the target file path where the logs should be stored.
@return boolean
Returns ... | [
"Initializes",
"the",
"error",
"handler",
"with",
"parameters",
"."
] | efd289961a720d5f3103a3c696e2beee16e9644d | https://github.com/oschildt/SmartFactory/blob/efd289961a720d5f3103a3c696e2beee16e9644d/src/SmartFactory/ErrorHandler.php#L86-L105 |
6,416 | oschildt/SmartFactory | src/SmartFactory/ErrorHandler.php | ErrorHandler.handleError | public function handleError($errno, $errstr, $errfile, $errline)
{
$this->setLastError($errstr);
$errortype = [
E_ERROR => "Error",
E_WARNING => "Warning",
E_PARSE => "Parsing Error",
E_NOTICE => "Notice",
E_CORE_ERROR => "Core Err... | php | public function handleError($errno, $errstr, $errfile, $errline)
{
$this->setLastError($errstr);
$errortype = [
E_ERROR => "Error",
E_WARNING => "Warning",
E_PARSE => "Parsing Error",
E_NOTICE => "Notice",
E_CORE_ERROR => "Core Err... | [
"public",
"function",
"handleError",
"(",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
",",
"$",
"errline",
")",
"{",
"$",
"this",
"->",
"setLastError",
"(",
"$",
"errstr",
")",
";",
"$",
"errortype",
"=",
"[",
"E_ERROR",
"=>",
"\"Error\"",
... | This is the function for handling of the PHP errors. It is set a the
error handler.
@param int $errno
Error code.
@param string $errstr
Error text.
@param string $errfile
Source file where the error occured.
@param int $errline
Line number where the error occured.
@return void
@author Oleg Schildt | [
"This",
"is",
"the",
"function",
"for",
"handling",
"of",
"the",
"PHP",
"errors",
".",
"It",
"is",
"set",
"a",
"the",
"error",
"handler",
"."
] | efd289961a720d5f3103a3c696e2beee16e9644d | https://github.com/oschildt/SmartFactory/blob/efd289961a720d5f3103a3c696e2beee16e9644d/src/SmartFactory/ErrorHandler.php#L321-L350 |
6,417 | aurorahttp/http-handler | src/ReplaceableTrait.php | ReplaceableTrait.replace | public function replace($handler, $bindTo = true)
{
if ($bindTo && $handler instanceof Closure) {
$handler = $handler->bindTo($this, $this);
}
$this->handler = $handler;
} | php | public function replace($handler, $bindTo = true)
{
if ($bindTo && $handler instanceof Closure) {
$handler = $handler->bindTo($this, $this);
}
$this->handler = $handler;
} | [
"public",
"function",
"replace",
"(",
"$",
"handler",
",",
"$",
"bindTo",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"bindTo",
"&&",
"$",
"handler",
"instanceof",
"Closure",
")",
"{",
"$",
"handler",
"=",
"$",
"handler",
"->",
"bindTo",
"(",
"$",
"this",... | Replace class handle method.
@param callable $handler
@param bool $bindTo | [
"Replace",
"class",
"handle",
"method",
"."
] | 2dc12a964b15b497f5a81b2b2ab389fe95bcd460 | https://github.com/aurorahttp/http-handler/blob/2dc12a964b15b497f5a81b2b2ab389fe95bcd460/src/ReplaceableTrait.php#L20-L26 |
6,418 | flowcode/AmulenPageBundle | src/Flowcode/PageBundle/Services/MenuService.php | MenuService.reorder | public function reorder(Menu $menu, $field = 'position')
{
$roots = $this->menuItemRepository->getRootNodes();
$rootItem = null;
foreach ($roots as $root) {
if ($root->getMenu() == $menu) {
$rootItem = $root;
}
}
if ($rootItem) {
... | php | public function reorder(Menu $menu, $field = 'position')
{
$roots = $this->menuItemRepository->getRootNodes();
$rootItem = null;
foreach ($roots as $root) {
if ($root->getMenu() == $menu) {
$rootItem = $root;
}
}
if ($rootItem) {
... | [
"public",
"function",
"reorder",
"(",
"Menu",
"$",
"menu",
",",
"$",
"field",
"=",
"'position'",
")",
"{",
"$",
"roots",
"=",
"$",
"this",
"->",
"menuItemRepository",
"->",
"getRootNodes",
"(",
")",
";",
"$",
"rootItem",
"=",
"null",
";",
"foreach",
"(... | Reorder Menu tree.
@param Menu $menu
@param string $field
@return bool | [
"Reorder",
"Menu",
"tree",
"."
] | 41c90e1860d5f51aeda13cb42993b17cf14cf89f | https://github.com/flowcode/AmulenPageBundle/blob/41c90e1860d5f51aeda13cb42993b17cf14cf89f/src/Flowcode/PageBundle/Services/MenuService.php#L31-L48 |
6,419 | marando/phpSOFA | src/Marando/IAU/iauAb.php | iauAb.Ab | public static function Ab(array $pnat, array $v, $s, $bm1, array &$ppr) {
$i;
$pdv;
$w1;
$w2;
$r2;
$w;
$p = [];
$r;
$pdv = static::Pdp($pnat, $v);
$w1 = 1.0 + $pdv / (1.0 + $bm1);
$w2 = SRS / $s;
$r2 = 0.0;
for ($i = 0; $i < 3; $i++) {
$w = $pnat[$i] * $... | php | public static function Ab(array $pnat, array $v, $s, $bm1, array &$ppr) {
$i;
$pdv;
$w1;
$w2;
$r2;
$w;
$p = [];
$r;
$pdv = static::Pdp($pnat, $v);
$w1 = 1.0 + $pdv / (1.0 + $bm1);
$w2 = SRS / $s;
$r2 = 0.0;
for ($i = 0; $i < 3; $i++) {
$w = $pnat[$i] * $... | [
"public",
"static",
"function",
"Ab",
"(",
"array",
"$",
"pnat",
",",
"array",
"$",
"v",
",",
"$",
"s",
",",
"$",
"bm1",
",",
"array",
"&",
"$",
"ppr",
")",
"{",
"$",
"i",
";",
"$",
"pdv",
";",
"$",
"w1",
";",
"$",
"w2",
";",
"$",
"r2",
"... | - - - - - -
i a u A b
- - - - - -
Apply aberration to transform natural direction into proper
direction.
This function is part of the International Astronomical Union's
SOFA (Standards of Fundamental Astronomy) software collection.
Status: support function.
Given:
pnat double[3] natural direction to the sourc... | [
"-",
"-",
"-",
"-",
"-",
"-",
"i",
"a",
"u",
"A",
"b",
"-",
"-",
"-",
"-",
"-",
"-"
] | 757fa49fe335ae1210eaa7735473fd4388b13f07 | https://github.com/marando/phpSOFA/blob/757fa49fe335ae1210eaa7735473fd4388b13f07/src/Marando/IAU/iauAb.php#L64-L88 |
6,420 | AnonymPHP/Anonym-Library | src/Anonym/Providers/SecurityProvider.php | SecurityProvider.registerFirewallSecurity | private function registerFirewallSecurity(array $firewall = [])
{
if (true === $firewall['status']) {
if (isset($firewall['ip_firewall'])) {
$this->registerIpFirewall($firewall['ip_firewall']);
}
if (isset($firewall['full_firewall'])) {
$... | php | private function registerFirewallSecurity(array $firewall = [])
{
if (true === $firewall['status']) {
if (isset($firewall['ip_firewall'])) {
$this->registerIpFirewall($firewall['ip_firewall']);
}
if (isset($firewall['full_firewall'])) {
$... | [
"private",
"function",
"registerFirewallSecurity",
"(",
"array",
"$",
"firewall",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"true",
"===",
"$",
"firewall",
"[",
"'status'",
"]",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"firewall",
"[",
"'ip_firewall'",
"]",
"... | register the firewall
@param array $firewall | [
"register",
"the",
"firewall"
] | c967ad804f84e8fb204593a0959cda2fed5ae075 | https://github.com/AnonymPHP/Anonym-Library/blob/c967ad804f84e8fb204593a0959cda2fed5ae075/src/Anonym/Providers/SecurityProvider.php#L84-L97 |
6,421 | AnonymPHP/Anonym-Library | src/Anonym/Providers/SecurityProvider.php | SecurityProvider.prepareCsrfInstance | private function prepareCsrfInstance(array $configs = [])
{
$configs = Config::get('security.csrf');
$field = $configs['field_name'];
$this->singleton(
'security.csrf',
function () use ($field) {
return (new CsrfToken())->setFormFieldName($field);
... | php | private function prepareCsrfInstance(array $configs = [])
{
$configs = Config::get('security.csrf');
$field = $configs['field_name'];
$this->singleton(
'security.csrf',
function () use ($field) {
return (new CsrfToken())->setFormFieldName($field);
... | [
"private",
"function",
"prepareCsrfInstance",
"(",
"array",
"$",
"configs",
"=",
"[",
"]",
")",
"{",
"$",
"configs",
"=",
"Config",
"::",
"get",
"(",
"'security.csrf'",
")",
";",
"$",
"field",
"=",
"$",
"configs",
"[",
"'field_name'",
"]",
";",
"$",
"t... | register the csrf token
@param array $configs | [
"register",
"the",
"csrf",
"token"
] | c967ad804f84e8fb204593a0959cda2fed5ae075 | https://github.com/AnonymPHP/Anonym-Library/blob/c967ad804f84e8fb204593a0959cda2fed5ae075/src/Anonym/Providers/SecurityProvider.php#L126-L138 |
6,422 | CatLabInteractive/Neuron | src/Neuron/Mappers/CachedMapper.php | CachedMapper.getModel | protected function getModel ($id) {
return isset ($this->models[$id]) ? $this->models[$id] : null;
} | php | protected function getModel ($id) {
return isset ($this->models[$id]) ? $this->models[$id] : null;
} | [
"protected",
"function",
"getModel",
"(",
"$",
"id",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"models",
"[",
"$",
"id",
"]",
")",
"?",
"$",
"this",
"->",
"models",
"[",
"$",
"id",
"]",
":",
"null",
";",
"}"
] | Return model.
@param $id
@return Model|null | [
"Return",
"model",
"."
] | 67dca5349891e23b31a96dcdead893b9491a1b8b | https://github.com/CatLabInteractive/Neuron/blob/67dca5349891e23b31a96dcdead893b9491a1b8b/src/Neuron/Mappers/CachedMapper.php#L36-L38 |
6,423 | gintonicweb/menus | src/View/Helper/MenuHelper.php | MenuHelper.create | public function create(array $config = [], array $data = [])
{
$here = $this->_View->request->here();
$menu = new MenuGroup($config, $here);
return $menu->render($data);
} | php | public function create(array $config = [], array $data = [])
{
$here = $this->_View->request->here();
$menu = new MenuGroup($config, $here);
return $menu->render($data);
} | [
"public",
"function",
"create",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"here",
"=",
"$",
"this",
"->",
"_View",
"->",
"request",
"->",
"here",
"(",
")",
";",
"$",
"menu",
"=",
"new",... | Creates the menu
The menu config defines the templates to be used. Each item of the array
represents a level of nesting. The config is inherited by default, and
each subsequent level can override the previous configuration
```
$config = [
[
'templates' => [
'group' => '<ul class="sidebar-menu">{{group}}</ul>',
'wrapp... | [
"Creates",
"the",
"menu"
] | 79ccbef8a014339a7bed9c1886d1837a5ef084b8 | https://github.com/gintonicweb/menus/blob/79ccbef8a014339a7bed9c1886d1837a5ef084b8/src/View/Helper/MenuHelper.php#L77-L82 |
6,424 | joegreen88/zf1-component-http | src/Zend/Http/CookieJar.php | Zend_Http_CookieJar.getMatchingCookies | public function getMatchingCookies($uri, $matchSessionCookies = true,
$ret_as = self::COOKIE_OBJECT, $now = null)
{
if (is_string($uri)) $uri = Zend_Uri::factory($uri);
if (! $uri instanceof Zend_Uri_Http) {
throw new Zend_Http_Exception("Invalid URI string or object passed");
... | php | public function getMatchingCookies($uri, $matchSessionCookies = true,
$ret_as = self::COOKIE_OBJECT, $now = null)
{
if (is_string($uri)) $uri = Zend_Uri::factory($uri);
if (! $uri instanceof Zend_Uri_Http) {
throw new Zend_Http_Exception("Invalid URI string or object passed");
... | [
"public",
"function",
"getMatchingCookies",
"(",
"$",
"uri",
",",
"$",
"matchSessionCookies",
"=",
"true",
",",
"$",
"ret_as",
"=",
"self",
"::",
"COOKIE_OBJECT",
",",
"$",
"now",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"uri",
")",
")"... | Return an array of all cookies matching a specific request according to the request URI,
whether session cookies should be sent or not, and the time to consider as "now" when
checking cookie expiry time.
@param string|Zend_Uri_Http $uri URI to check against (secure, domain, path)
@param boolean $matchSessionCookies Wh... | [
"Return",
"an",
"array",
"of",
"all",
"cookies",
"matching",
"a",
"specific",
"request",
"according",
"to",
"the",
"request",
"URI",
"whether",
"session",
"cookies",
"should",
"be",
"sent",
"or",
"not",
"and",
"the",
"time",
"to",
"consider",
"as",
"now",
... | 39e834e8f0393cf4223d099a0acaab5fa05e9ad4 | https://github.com/joegreen88/zf1-component-http/blob/39e834e8f0393cf4223d099a0acaab5fa05e9ad4/src/Zend/Http/CookieJar.php#L199-L226 |
6,425 | joegreen88/zf1-component-http | src/Zend/Http/CookieJar.php | Zend_Http_CookieJar.getCookie | public function getCookie($uri, $cookie_name, $ret_as = self::COOKIE_OBJECT)
{
if (is_string($uri)) {
$uri = Zend_Uri::factory($uri);
}
if (! $uri instanceof Zend_Uri_Http) {
throw new Zend_Http_Exception('Invalid URI specified');
}
// Get correct c... | php | public function getCookie($uri, $cookie_name, $ret_as = self::COOKIE_OBJECT)
{
if (is_string($uri)) {
$uri = Zend_Uri::factory($uri);
}
if (! $uri instanceof Zend_Uri_Http) {
throw new Zend_Http_Exception('Invalid URI specified');
}
// Get correct c... | [
"public",
"function",
"getCookie",
"(",
"$",
"uri",
",",
"$",
"cookie_name",
",",
"$",
"ret_as",
"=",
"self",
"::",
"COOKIE_OBJECT",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"uri",
")",
")",
"{",
"$",
"uri",
"=",
"Zend_Uri",
"::",
"factory",
"(",
... | Get a specific cookie according to a URI and name
@param Zend_Uri_Http|string $uri The uri (domain and path) to match
@param string $cookie_name The cookie's name
@param int $ret_as Whether to return cookies as objects of Zend_Http_Cookie or as strings
@return Zend_Http_Cookie|string | [
"Get",
"a",
"specific",
"cookie",
"according",
"to",
"a",
"URI",
"and",
"name"
] | 39e834e8f0393cf4223d099a0acaab5fa05e9ad4 | https://github.com/joegreen88/zf1-component-http/blob/39e834e8f0393cf4223d099a0acaab5fa05e9ad4/src/Zend/Http/CookieJar.php#L236-L277 |
6,426 | LasseHaslev/image-handler | src/Modifiers/ImageModifier.php | ImageModifier.createImageObject | protected function createImageObject()
{
// Check if the file is a valid file
if ( ! is_file( $this->originalImagePath ) ) {
throw new Exception( sprintf( '%s: No image found.', $this->originalImagePath ) );
}
// Get the mimetype
$this->imageType = exif_imagetyp... | php | protected function createImageObject()
{
// Check if the file is a valid file
if ( ! is_file( $this->originalImagePath ) ) {
throw new Exception( sprintf( '%s: No image found.', $this->originalImagePath ) );
}
// Get the mimetype
$this->imageType = exif_imagetyp... | [
"protected",
"function",
"createImageObject",
"(",
")",
"{",
"// Check if the file is a valid file",
"if",
"(",
"!",
"is_file",
"(",
"$",
"this",
"->",
"originalImagePath",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"sprintf",
"(",
"'%s: No image found.'",
"... | Create GD Image object based on the mime_type
@return GD object resource | [
"Create",
"GD",
"Image",
"object",
"based",
"on",
"the",
"mime_type"
] | dfc4fc7417617169d2483d62e5d27d3dd6a12235 | https://github.com/LasseHaslev/image-handler/blob/dfc4fc7417617169d2483d62e5d27d3dd6a12235/src/Modifiers/ImageModifier.php#L73-L118 |
6,427 | LasseHaslev/image-handler | src/Modifiers/ImageModifier.php | ImageModifier.save | public function save($path)
{
switch ( $this->imageType ) {
case IMAGETYPE_GIF:
$returnData = imagegif( $this->image, $path );
break;
case IMAGETYPE_PNG:
$returnData = imagepng( $this->image, $path );
break;
... | php | public function save($path)
{
switch ( $this->imageType ) {
case IMAGETYPE_GIF:
$returnData = imagegif( $this->image, $path );
break;
case IMAGETYPE_PNG:
$returnData = imagepng( $this->image, $path );
break;
... | [
"public",
"function",
"save",
"(",
"$",
"path",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"imageType",
")",
"{",
"case",
"IMAGETYPE_GIF",
":",
"$",
"returnData",
"=",
"imagegif",
"(",
"$",
"this",
"->",
"image",
",",
"$",
"path",
")",
";",
"break",... | Save the working image to the new path
@return $this | [
"Save",
"the",
"working",
"image",
"to",
"the",
"new",
"path"
] | dfc4fc7417617169d2483d62e5d27d3dd6a12235 | https://github.com/LasseHaslev/image-handler/blob/dfc4fc7417617169d2483d62e5d27d3dd6a12235/src/Modifiers/ImageModifier.php#L125-L154 |
6,428 | LasseHaslev/image-handler | src/Modifiers/ImageModifier.php | ImageModifier.cropToFit | public function cropToFit($width, $height, $focusPointX = 0, $focusPointY = 0)
{
$debug = $width == 100 && $height == 100;
// Check if the image is a valid resource
if (!is_resource($this->image)) {
throw new RuntimeException('No image set');
}
// Get the width... | php | public function cropToFit($width, $height, $focusPointX = 0, $focusPointY = 0)
{
$debug = $width == 100 && $height == 100;
// Check if the image is a valid resource
if (!is_resource($this->image)) {
throw new RuntimeException('No image set');
}
// Get the width... | [
"public",
"function",
"cropToFit",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"focusPointX",
"=",
"0",
",",
"$",
"focusPointY",
"=",
"0",
")",
"{",
"$",
"debug",
"=",
"$",
"width",
"==",
"100",
"&&",
"$",
"height",
"==",
"100",
";",
"// Check... | Crop image To the width and height of the image
@return $this | [
"Crop",
"image",
"To",
"the",
"width",
"and",
"height",
"of",
"the",
"image"
] | dfc4fc7417617169d2483d62e5d27d3dd6a12235 | https://github.com/LasseHaslev/image-handler/blob/dfc4fc7417617169d2483d62e5d27d3dd6a12235/src/Modifiers/ImageModifier.php#L161-L219 |
6,429 | LasseHaslev/image-handler | src/Modifiers/ImageModifier.php | ImageModifier.resize | public function resize( $width = null, $height = null )
{
// Get the source width and height
$sourceWidth = imagesx( $this->image );
$sourceHeight = imagesy( $this->image );
// Check if any of the width and height is null, and set it to the $source size
// $width = $width ?:... | php | public function resize( $width = null, $height = null )
{
// Get the source width and height
$sourceWidth = imagesx( $this->image );
$sourceHeight = imagesy( $this->image );
// Check if any of the width and height is null, and set it to the $source size
// $width = $width ?:... | [
"public",
"function",
"resize",
"(",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
")",
"{",
"// Get the source width and height",
"$",
"sourceWidth",
"=",
"imagesx",
"(",
"$",
"this",
"->",
"image",
")",
";",
"$",
"sourceHeight",
"=",
"image... | Resize the GD Image
@return $this | [
"Resize",
"the",
"GD",
"Image"
] | dfc4fc7417617169d2483d62e5d27d3dd6a12235 | https://github.com/LasseHaslev/image-handler/blob/dfc4fc7417617169d2483d62e5d27d3dd6a12235/src/Modifiers/ImageModifier.php#L264-L302 |
6,430 | LasseHaslev/image-handler | src/Modifiers/ImageModifier.php | ImageModifier.createCanvas | protected function createCanvas($width, $height)
{
// Create the canvas element
$canvas = imagecreatetruecolor( $width, $height );
// Check if we should preserve the transparency
if ( $this->imageType == IMAGETYPE_GIF || $this->imageType == IMAGETYPE_PNG ) {
imagealphabl... | php | protected function createCanvas($width, $height)
{
// Create the canvas element
$canvas = imagecreatetruecolor( $width, $height );
// Check if we should preserve the transparency
if ( $this->imageType == IMAGETYPE_GIF || $this->imageType == IMAGETYPE_PNG ) {
imagealphabl... | [
"protected",
"function",
"createCanvas",
"(",
"$",
"width",
",",
"$",
"height",
")",
"{",
"// Create the canvas element",
"$",
"canvas",
"=",
"imagecreatetruecolor",
"(",
"$",
"width",
",",
"$",
"height",
")",
";",
"// Check if we should preserve the transparency",
... | Create a new canvas element
@return Resource | [
"Create",
"a",
"new",
"canvas",
"element"
] | dfc4fc7417617169d2483d62e5d27d3dd6a12235 | https://github.com/LasseHaslev/image-handler/blob/dfc4fc7417617169d2483d62e5d27d3dd6a12235/src/Modifiers/ImageModifier.php#L309-L322 |
6,431 | LasseHaslev/image-handler | src/Modifiers/ImageModifier.php | ImageModifier.replace | public function replace($res)
{
// Check if the image we should replace with is resource
if (!is_resource($res)) {
throw new UnexpectedValueException('Invalid resource');
}
// Check if we can destroy the image
if (is_resource($this->image)) {
imagede... | php | public function replace($res)
{
// Check if the image we should replace with is resource
if (!is_resource($res)) {
throw new UnexpectedValueException('Invalid resource');
}
// Check if we can destroy the image
if (is_resource($this->image)) {
imagede... | [
"public",
"function",
"replace",
"(",
"$",
"res",
")",
"{",
"// Check if the image we should replace with is resource",
"if",
"(",
"!",
"is_resource",
"(",
"$",
"res",
")",
")",
"{",
"throw",
"new",
"UnexpectedValueException",
"(",
"'Invalid resource'",
")",
";",
... | Replaces the image with the new image
@return $this | [
"Replaces",
"the",
"image",
"with",
"the",
"new",
"image"
] | dfc4fc7417617169d2483d62e5d27d3dd6a12235 | https://github.com/LasseHaslev/image-handler/blob/dfc4fc7417617169d2483d62e5d27d3dd6a12235/src/Modifiers/ImageModifier.php#L330-L348 |
6,432 | laraviet/l5scaffold | src/stubs/Libs/ValueHelper.php | ValueHelper.getOldInput | public static function getOldInput($model, $property)
{
if (\Session::getOldInput($property) !== null) {
return \Session::getOldInput($property);
}
return $model->$property;
} | php | public static function getOldInput($model, $property)
{
if (\Session::getOldInput($property) !== null) {
return \Session::getOldInput($property);
}
return $model->$property;
} | [
"public",
"static",
"function",
"getOldInput",
"(",
"$",
"model",
",",
"$",
"property",
")",
"{",
"if",
"(",
"\\",
"Session",
"::",
"getOldInput",
"(",
"$",
"property",
")",
"!==",
"null",
")",
"{",
"return",
"\\",
"Session",
"::",
"getOldInput",
"(",
... | Get old input when validate has errors
@param Model instance $model
@param string $property | [
"Get",
"old",
"input",
"when",
"validate",
"has",
"errors"
] | 765188e47fc1fb38d599342ac71a24e53f4dcac9 | https://github.com/laraviet/l5scaffold/blob/765188e47fc1fb38d599342ac71a24e53f4dcac9/src/stubs/Libs/ValueHelper.php#L14-L20 |
6,433 | ProgMiner/image-constructor | lib/Utility.php | Utility.transparentImage | public static function transparentImage(int $width, int $height): Image {
$image = imagecreatetruecolor(max($width, 1), max($height, 1));
$transparent = imagecolorallocatealpha($image, 0, 0, 0, 127);
imagefill($image, 0, 0, $transparent);
imagesavealpha($image, true);
return new... | php | public static function transparentImage(int $width, int $height): Image {
$image = imagecreatetruecolor(max($width, 1), max($height, 1));
$transparent = imagecolorallocatealpha($image, 0, 0, 0, 127);
imagefill($image, 0, 0, $transparent);
imagesavealpha($image, true);
return new... | [
"public",
"static",
"function",
"transparentImage",
"(",
"int",
"$",
"width",
",",
"int",
"$",
"height",
")",
":",
"Image",
"{",
"$",
"image",
"=",
"imagecreatetruecolor",
"(",
"max",
"(",
"$",
"width",
",",
"1",
")",
",",
"max",
"(",
"$",
"height",
... | Creates empty transparent GD image
@link http://php.net/manual/function.imagefill.php#110186
@param int $width
@param int $height
@return Image | [
"Creates",
"empty",
"transparent",
"GD",
"image"
] | a8d323f7c5f7d9ba131d6e0b4b52155c98dd240c | https://github.com/ProgMiner/image-constructor/blob/a8d323f7c5f7d9ba131d6e0b4b52155c98dd240c/lib/Utility.php#L46-L53 |
6,434 | rodchyn/elephant-lang | lib/ParserGenerator/PHP/ParserGenerator/Symbol.php | PHP_ParserGenerator_Symbol.sortSymbols | public static function sortSymbols($a, $b)
{
$i1 = $a->index + 10000000*(ord($a->name[0]) > ord('Z'));
$i2 = $b->index + 10000000*(ord($b->name[0]) > ord('Z'));
return $i1 - $i2;
} | php | public static function sortSymbols($a, $b)
{
$i1 = $a->index + 10000000*(ord($a->name[0]) > ord('Z'));
$i2 = $b->index + 10000000*(ord($b->name[0]) > ord('Z'));
return $i1 - $i2;
} | [
"public",
"static",
"function",
"sortSymbols",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"$",
"i1",
"=",
"$",
"a",
"->",
"index",
"+",
"10000000",
"*",
"(",
"ord",
"(",
"$",
"a",
"->",
"name",
"[",
"0",
"]",
")",
">",
"ord",
"(",
"'Z'",
")",
... | Sort function helper for symbols
Symbols that begin with upper case letters (terminals or tokens)
must sort before symbols that begin with lower case letters
(non-terminals). Other than that, the order does not matter.
We find experimentally that leaving the symbols in their original
order (the order they appeared i... | [
"Sort",
"function",
"helper",
"for",
"symbols"
] | e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf | https://github.com/rodchyn/elephant-lang/blob/e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf/lib/ParserGenerator/PHP/ParserGenerator/Symbol.php#L267-L272 |
6,435 | rodchyn/elephant-lang | lib/ParserGenerator/PHP/ParserGenerator/Symbol.php | PHP_ParserGenerator_Symbol.same_symbol | public static function same_symbol(PHP_ParserGenerator_Symbol $a, PHP_ParserGenerator_Symbol $b)
{
if ($a === $b) return 1;
if ($a->type != self::MULTITERMINAL) return 0;
if ($b->type != self::MULTITERMINAL) return 0;
if ($a->nsubsym != $b->nsubsym) return 0;
for ($i = 0; $i ... | php | public static function same_symbol(PHP_ParserGenerator_Symbol $a, PHP_ParserGenerator_Symbol $b)
{
if ($a === $b) return 1;
if ($a->type != self::MULTITERMINAL) return 0;
if ($b->type != self::MULTITERMINAL) return 0;
if ($a->nsubsym != $b->nsubsym) return 0;
for ($i = 0; $i ... | [
"public",
"static",
"function",
"same_symbol",
"(",
"PHP_ParserGenerator_Symbol",
"$",
"a",
",",
"PHP_ParserGenerator_Symbol",
"$",
"b",
")",
"{",
"if",
"(",
"$",
"a",
"===",
"$",
"b",
")",
"return",
"1",
";",
"if",
"(",
"$",
"a",
"->",
"type",
"!=",
"... | Return true if two symbols are the same. | [
"Return",
"true",
"if",
"two",
"symbols",
"are",
"the",
"same",
"."
] | e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf | https://github.com/rodchyn/elephant-lang/blob/e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf/lib/ParserGenerator/PHP/ParserGenerator/Symbol.php#L277-L287 |
6,436 | webbuilders-group/silverstripe-kapost-bridge | code/control/KapostAdmin.php | KapostAdmin.getEditForm | public function getEditForm($id=null, $fields=null) {
$form=parent::getEditForm($id, $fields);
Requirements::css(KAPOST_DIR.'/css/KapostAdmin.css');
Requirements::javascript(KAPOST_DIR.'/javascript/KapostAdmin.js');
if($this->modelClass=='KapostObject' && $grid... | php | public function getEditForm($id=null, $fields=null) {
$form=parent::getEditForm($id, $fields);
Requirements::css(KAPOST_DIR.'/css/KapostAdmin.css');
Requirements::javascript(KAPOST_DIR.'/javascript/KapostAdmin.js');
if($this->modelClass=='KapostObject' && $grid... | [
"public",
"function",
"getEditForm",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"fields",
"=",
"null",
")",
"{",
"$",
"form",
"=",
"parent",
"::",
"getEditForm",
"(",
"$",
"id",
",",
"$",
"fields",
")",
";",
"Requirements",
"::",
"css",
"(",
"KAPOST_DIR"... | Form used for displaying the gridfield in the model admin
@param string $id ID of the form
@param FieldList $fields Fields to use in the form
@return Form Form to be used in the model admin interface | [
"Form",
"used",
"for",
"displaying",
"the",
"gridfield",
"in",
"the",
"model",
"admin"
] | 718f498cad0eec764d19c9081404b2a0c8f44d71 | https://github.com/webbuilders-group/silverstripe-kapost-bridge/blob/718f498cad0eec764d19c9081404b2a0c8f44d71/code/control/KapostAdmin.php#L34-L82 |
6,437 | webbuilders-group/silverstripe-kapost-bridge | code/control/KapostAdmin.php | KapostAdmin.getList | public function getList() {
$context=$this->getSearchContext();
$params=$this->getRequest()->requestVar('q');
if(is_array($params)) {
if(array_key_exists('Created', $params) && is_array($params['Created'])) {
$params['Created']=implode(' ', $params['Created']... | php | public function getList() {
$context=$this->getSearchContext();
$params=$this->getRequest()->requestVar('q');
if(is_array($params)) {
if(array_key_exists('Created', $params) && is_array($params['Created'])) {
$params['Created']=implode(' ', $params['Created']... | [
"public",
"function",
"getList",
"(",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getSearchContext",
"(",
")",
";",
"$",
"params",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"requestVar",
"(",
"'q'",
")",
";",
"if",
"(",
"is_array",... | Gets the list used in the ModelAdmin
@return SS_List | [
"Gets",
"the",
"list",
"used",
"in",
"the",
"ModelAdmin"
] | 718f498cad0eec764d19c9081404b2a0c8f44d71 | https://github.com/webbuilders-group/silverstripe-kapost-bridge/blob/718f498cad0eec764d19c9081404b2a0c8f44d71/code/control/KapostAdmin.php#L113-L130 |
6,438 | factorio-item-browser/api-database | src/Filter/DataFilter.php | DataFilter.filter | public function filter(array $data): array
{
/* @var array|DataInterface[] $result */
$result = [];
foreach ($data as $item) {
$key = implode('|', $item->getKeys());
if (!isset($result[$key]) || $result[$key]->getOrder() < $item->getOrder()) {
$result[... | php | public function filter(array $data): array
{
/* @var array|DataInterface[] $result */
$result = [];
foreach ($data as $item) {
$key = implode('|', $item->getKeys());
if (!isset($result[$key]) || $result[$key]->getOrder() < $item->getOrder()) {
$result[... | [
"public",
"function",
"filter",
"(",
"array",
"$",
"data",
")",
":",
"array",
"{",
"/* @var array|DataInterface[] $result */",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"item",
")",
"{",
"$",
"key",
"=",
"implode",
"(",
... | Filters the data to only contain the items with the highest order.
@param array|DataInterface[] $data
@return array|DataInterface[] | [
"Filters",
"the",
"data",
"to",
"only",
"contain",
"the",
"items",
"with",
"the",
"highest",
"order",
"."
] | c3a27e5673462a58b5afafc0ea0e0002f6db9803 | https://github.com/factorio-item-browser/api-database/blob/c3a27e5673462a58b5afafc0ea0e0002f6db9803/src/Filter/DataFilter.php#L22-L33 |
6,439 | mizmoz/container | src/InjectContainer.php | InjectContainer.classUses | public static function classUses($class, string $find): bool
{
$uses = class_uses($class);
if (in_array($find, $uses)) {
// found the item
return true;
}
// add any parent classes to the search
$uses = array_merge($uses, class_parents($class));
... | php | public static function classUses($class, string $find): bool
{
$uses = class_uses($class);
if (in_array($find, $uses)) {
// found the item
return true;
}
// add any parent classes to the search
$uses = array_merge($uses, class_parents($class));
... | [
"public",
"static",
"function",
"classUses",
"(",
"$",
"class",
",",
"string",
"$",
"find",
")",
":",
"bool",
"{",
"$",
"uses",
"=",
"class_uses",
"(",
"$",
"class",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"find",
",",
"$",
"uses",
")",
")",
"... | Check to see if the class uses the provided item
@param $class
@param string $find
@return bool | [
"Check",
"to",
"see",
"if",
"the",
"class",
"uses",
"the",
"provided",
"item"
] | 7ae194189595fbcd392445bb41ac8ddb118b5b7c | https://github.com/mizmoz/container/blob/7ae194189595fbcd392445bb41ac8ddb118b5b7c/src/InjectContainer.php#L39-L58 |
6,440 | tarsana/filesystem | src/Filesystem.php | Filesystem.whatIs | public function whatIs($pattern)
{
if (! $this->adapter->isAbsolute($pattern)) {
$pattern = $this->rootPath . $pattern;
}
$paths = $this->adapter->glob($pattern);
if (count($paths) == 0)
return 'nothing';
if (count($paths) == 1)
return ($... | php | public function whatIs($pattern)
{
if (! $this->adapter->isAbsolute($pattern)) {
$pattern = $this->rootPath . $pattern;
}
$paths = $this->adapter->glob($pattern);
if (count($paths) == 0)
return 'nothing';
if (count($paths) == 1)
return ($... | [
"public",
"function",
"whatIs",
"(",
"$",
"pattern",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"adapter",
"->",
"isAbsolute",
"(",
"$",
"pattern",
")",
")",
"{",
"$",
"pattern",
"=",
"$",
"this",
"->",
"rootPath",
".",
"$",
"pattern",
";",
"}",
... | Tells what is the given pattern matching, returns 'file' or 'dir' if a
single file or directory matches the pattern. Returns 'collection'
if there are multiple matches and 'nothing' if no match found.
@param string $pattern
@return string | [
"Tells",
"what",
"is",
"the",
"given",
"pattern",
"matching",
"returns",
"file",
"or",
"dir",
"if",
"a",
"single",
"file",
"or",
"directory",
"matches",
"the",
"pattern",
".",
"Returns",
"collection",
"if",
"there",
"are",
"multiple",
"matches",
"and",
"noth... | db6c8f040af38dfb01066e382645aff6c72530fa | https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Filesystem.php#L78-L91 |
6,441 | tarsana/filesystem | src/Filesystem.php | Filesystem.is | protected function is($path, $type)
{
if (! $this->adapter->isAbsolute($path)) {
$path = $this->rootPath . $path;
}
switch ($type) {
case 'readable':
return $this->adapter->isReadable($path);
case 'writable':
return $this->a... | php | protected function is($path, $type)
{
if (! $this->adapter->isAbsolute($path)) {
$path = $this->rootPath . $path;
}
switch ($type) {
case 'readable':
return $this->adapter->isReadable($path);
case 'writable':
return $this->a... | [
"protected",
"function",
"is",
"(",
"$",
"path",
",",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"adapter",
"->",
"isAbsolute",
"(",
"$",
"path",
")",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"rootPath",
".",
"$",
"path",
"... | Checks if the given path is of the given type.
@param string $path
@param string $type
@return boolean | [
"Checks",
"if",
"the",
"given",
"path",
"is",
"of",
"the",
"given",
"type",
"."
] | db6c8f040af38dfb01066e382645aff6c72530fa | https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Filesystem.php#L100-L121 |
6,442 | tarsana/filesystem | src/Filesystem.php | Filesystem.are | protected function are($paths, $type)
{
foreach ($paths as $path) {
if (! $this->is($path, $type)) {
return false;
}
}
return (count($paths) == 0) ? false : true;
} | php | protected function are($paths, $type)
{
foreach ($paths as $path) {
if (! $this->is($path, $type)) {
return false;
}
}
return (count($paths) == 0) ? false : true;
} | [
"protected",
"function",
"are",
"(",
"$",
"paths",
",",
"$",
"type",
")",
"{",
"foreach",
"(",
"$",
"paths",
"as",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is",
"(",
"$",
"path",
",",
"$",
"type",
")",
")",
"{",
"return",
"f... | Checks if the given paths are all of the given type.
@param array $paths
@param string $type
@return boolean | [
"Checks",
"if",
"the",
"given",
"paths",
"are",
"all",
"of",
"the",
"given",
"type",
"."
] | db6c8f040af38dfb01066e382645aff6c72530fa | https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Filesystem.php#L130-L138 |
6,443 | tarsana/filesystem | src/Filesystem.php | Filesystem.file | public function file($path, $createMissing = false)
{
if (! $this->adapter->isAbsolute($path)) {
$path = $this->rootPath . $path;
}
if (! $createMissing && ! $this->isFile($path, true)) {
throw new FilesystemException("Cannot find the file '{$path}'");
}
... | php | public function file($path, $createMissing = false)
{
if (! $this->adapter->isAbsolute($path)) {
$path = $this->rootPath . $path;
}
if (! $createMissing && ! $this->isFile($path, true)) {
throw new FilesystemException("Cannot find the file '{$path}'");
}
... | [
"public",
"function",
"file",
"(",
"$",
"path",
",",
"$",
"createMissing",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"adapter",
"->",
"isAbsolute",
"(",
"$",
"path",
")",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"rootPath",
... | Gets a file by relative or absolute path,
optionally creates the file if missing.
@param string $path
@param boolean $createMissing
@return Tarsana\Filesystem\File
@throws Tarsana\Filesystem\Exceptions\FilesystemException | [
"Gets",
"a",
"file",
"by",
"relative",
"or",
"absolute",
"path",
"optionally",
"creates",
"the",
"file",
"if",
"missing",
"."
] | db6c8f040af38dfb01066e382645aff6c72530fa | https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Filesystem.php#L283-L293 |
6,444 | tarsana/filesystem | src/Filesystem.php | Filesystem.files | public function files($paths = false, $createMissing = false)
{
if ($paths === false) {
return $this->find('*')->files();
}
$list = new Collection;
foreach ($paths as $path) {
$list->add($this->file($path, $createMissing));
}
return $list;
... | php | public function files($paths = false, $createMissing = false)
{
if ($paths === false) {
return $this->find('*')->files();
}
$list = new Collection;
foreach ($paths as $path) {
$list->add($this->file($path, $createMissing));
}
return $list;
... | [
"public",
"function",
"files",
"(",
"$",
"paths",
"=",
"false",
",",
"$",
"createMissing",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"paths",
"===",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"find",
"(",
"'*'",
")",
"->",
"files",
"(",
")",
"... | Gets files by relative or absolute path,
optionally creates missing files.
@param array $paths
@param boolean $createMissing
@return Tarsana\Filesystem\Collection
@throws Tarsana\Filesystem\Exceptions\FilesystemException | [
"Gets",
"files",
"by",
"relative",
"or",
"absolute",
"path",
"optionally",
"creates",
"missing",
"files",
"."
] | db6c8f040af38dfb01066e382645aff6c72530fa | https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Filesystem.php#L305-L316 |
6,445 | tarsana/filesystem | src/Filesystem.php | Filesystem.dir | public function dir($path, $createMissing = false)
{
if (! $this->adapter->isAbsolute($path)) {
$path = $this->rootPath . $path;
}
if (! $createMissing && ! $this->isDir($path, true)) {
throw new FilesystemException("Cannot find the directory '{$path}'");
}
... | php | public function dir($path, $createMissing = false)
{
if (! $this->adapter->isAbsolute($path)) {
$path = $this->rootPath . $path;
}
if (! $createMissing && ! $this->isDir($path, true)) {
throw new FilesystemException("Cannot find the directory '{$path}'");
}
... | [
"public",
"function",
"dir",
"(",
"$",
"path",
",",
"$",
"createMissing",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"adapter",
"->",
"isAbsolute",
"(",
"$",
"path",
")",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"rootPath",
... | Gets a directory by relative or absolute path,
optionally creates the directory if missing.
@param string $path
@param boolean $createMissing
@return Tarsana\Filesystem\Directory
@throws Tarsana\Filesystem\Exceptions\FilesystemException | [
"Gets",
"a",
"directory",
"by",
"relative",
"or",
"absolute",
"path",
"optionally",
"creates",
"the",
"directory",
"if",
"missing",
"."
] | db6c8f040af38dfb01066e382645aff6c72530fa | https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Filesystem.php#L328-L337 |
6,446 | tarsana/filesystem | src/Filesystem.php | Filesystem.dirs | public function dirs($paths = false, $createMissing = false)
{
if ($paths === false) {
return $this->find('*')->dirs();
}
$list = new Collection;
foreach ($paths as $path) {
$list->add($this->dir($path, $createMissing));
}
return $list;
} | php | public function dirs($paths = false, $createMissing = false)
{
if ($paths === false) {
return $this->find('*')->dirs();
}
$list = new Collection;
foreach ($paths as $path) {
$list->add($this->dir($path, $createMissing));
}
return $list;
} | [
"public",
"function",
"dirs",
"(",
"$",
"paths",
"=",
"false",
",",
"$",
"createMissing",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"paths",
"===",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"find",
"(",
"'*'",
")",
"->",
"dirs",
"(",
")",
";"... | Gets directories by relative or absolute path,
optionally creates missing directories.
@param array $paths
@param boolean $createMissing
@return Tarsana\Filesystem\Collection
@throws Tarsana\Filesystem\Exceptions\FilesystemException | [
"Gets",
"directories",
"by",
"relative",
"or",
"absolute",
"path",
"optionally",
"creates",
"missing",
"directories",
"."
] | db6c8f040af38dfb01066e382645aff6c72530fa | https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Filesystem.php#L349-L360 |
6,447 | tarsana/filesystem | src/Filesystem.php | Filesystem.find | public function find($pattern)
{
if (! $this->adapter->isAbsolute($pattern)) {
$pattern = $this->rootPath . $pattern;
}
$list = new Collection;
foreach ($this->adapter->glob($pattern) as $path) {
if ($this->isFile($path, true)) {
$list->add(new... | php | public function find($pattern)
{
if (! $this->adapter->isAbsolute($pattern)) {
$pattern = $this->rootPath . $pattern;
}
$list = new Collection;
foreach ($this->adapter->glob($pattern) as $path) {
if ($this->isFile($path, true)) {
$list->add(new... | [
"public",
"function",
"find",
"(",
"$",
"pattern",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"adapter",
"->",
"isAbsolute",
"(",
"$",
"pattern",
")",
")",
"{",
"$",
"pattern",
"=",
"$",
"this",
"->",
"rootPath",
".",
"$",
"pattern",
";",
"}",
... | Finds files and directories matching the given pattern
and returns a collection containing them.
@param string $pattern
@return Tarsana\Filesystem\Collection | [
"Finds",
"files",
"and",
"directories",
"matching",
"the",
"given",
"pattern",
"and",
"returns",
"a",
"collection",
"containing",
"them",
"."
] | db6c8f040af38dfb01066e382645aff6c72530fa | https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Filesystem.php#L369-L383 |
6,448 | tarsana/filesystem | src/Filesystem.php | Filesystem.remove | public function remove($path)
{
if (! $this->adapter->isAbsolute($path)) {
$path = $this->rootPath . $path;
}
if ($this->isFile($path, true)) {
$this->adapter->unlink($path);
} else {
// clean the directory
$path = rtrim($path, '/') . '... | php | public function remove($path)
{
if (! $this->adapter->isAbsolute($path)) {
$path = $this->rootPath . $path;
}
if ($this->isFile($path, true)) {
$this->adapter->unlink($path);
} else {
// clean the directory
$path = rtrim($path, '/') . '... | [
"public",
"function",
"remove",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"adapter",
"->",
"isAbsolute",
"(",
"$",
"path",
")",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"rootPath",
".",
"$",
"path",
";",
"}",
"if",
"(... | Removes a file or directory recursively.
@param string $path
@return Tarsana\Filesystem | [
"Removes",
"a",
"file",
"or",
"directory",
"recursively",
"."
] | db6c8f040af38dfb01066e382645aff6c72530fa | https://github.com/tarsana/filesystem/blob/db6c8f040af38dfb01066e382645aff6c72530fa/src/Filesystem.php#L391-L408 |
6,449 | cerad/di | Container.php | Container.set | public function set($id,$item,$tagArg = null)
{
if (!is_callable($item)) $this->instances[$id] = $item;
else
{
$this->callables[$id] = $item;
unset($this->instances[$id]);
}
if (!$tagArg) return $this;
$tag = is_array($tagArg) ? $tagArg : ['name' => $tagArg];
$tag['se... | php | public function set($id,$item,$tagArg = null)
{
if (!is_callable($item)) $this->instances[$id] = $item;
else
{
$this->callables[$id] = $item;
unset($this->instances[$id]);
}
if (!$tagArg) return $this;
$tag = is_array($tagArg) ? $tagArg : ['name' => $tagArg];
$tag['se... | [
"public",
"function",
"set",
"(",
"$",
"id",
",",
"$",
"item",
",",
"$",
"tagArg",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"item",
")",
")",
"$",
"this",
"->",
"instances",
"[",
"$",
"id",
"]",
"=",
"$",
"item",
";",
"... | Add a service with optional tagging | [
"Add",
"a",
"service",
"with",
"optional",
"tagging"
] | a70c3a562422867a681e37030c4821facdf8fd90 | https://github.com/cerad/di/blob/a70c3a562422867a681e37030c4821facdf8fd90/Container.php#L17-L36 |
6,450 | cerad/di | Container.php | Container.getTags | public function getTags($name = null)
{
if (!$name) return $this->tags;
return isset($this->tags[$name]) ? $this->tags[$name] : [];
} | php | public function getTags($name = null)
{
if (!$name) return $this->tags;
return isset($this->tags[$name]) ? $this->tags[$name] : [];
} | [
"public",
"function",
"getTags",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"name",
")",
"return",
"$",
"this",
"->",
"tags",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"tags",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this... | List of services for a given tag | [
"List",
"of",
"services",
"for",
"a",
"given",
"tag"
] | a70c3a562422867a681e37030c4821facdf8fd90 | https://github.com/cerad/di/blob/a70c3a562422867a681e37030c4821facdf8fd90/Container.php#L69-L74 |
6,451 | niconoe-/asserts | src/Asserts/Categories/AssertFileTrait.php | AssertFileTrait.assertIsDir | public static function assertIsDir(string $path, Throwable $exception): string
{
static::makeAssertion(\is_dir($path), $exception);
return $path;
} | php | public static function assertIsDir(string $path, Throwable $exception): string
{
static::makeAssertion(\is_dir($path), $exception);
return $path;
} | [
"public",
"static",
"function",
"assertIsDir",
"(",
"string",
"$",
"path",
",",
"Throwable",
"$",
"exception",
")",
":",
"string",
"{",
"static",
"::",
"makeAssertion",
"(",
"\\",
"is_dir",
"(",
"$",
"path",
")",
",",
"$",
"exception",
")",
";",
"return"... | Asserts that the given path is a directory path.
@param string $path The path to check that must be a directory.
@param Throwable $exception The exception to throw if the assertion fails.
@return string The directory path if the assertion does not fail. | [
"Asserts",
"that",
"the",
"given",
"path",
"is",
"a",
"directory",
"path",
"."
] | a33dd3fb8983ae6965533c8ff4ff8380367b561d | https://github.com/niconoe-/asserts/blob/a33dd3fb8983ae6965533c8ff4ff8380367b561d/src/Asserts/Categories/AssertFileTrait.php#L26-L30 |
6,452 | niconoe-/asserts | src/Asserts/Categories/AssertFileTrait.php | AssertFileTrait.assertIsFile | public static function assertIsFile(string $path, Throwable $exception): string
{
static::makeAssertion(\is_file($path), $exception);
return $path;
} | php | public static function assertIsFile(string $path, Throwable $exception): string
{
static::makeAssertion(\is_file($path), $exception);
return $path;
} | [
"public",
"static",
"function",
"assertIsFile",
"(",
"string",
"$",
"path",
",",
"Throwable",
"$",
"exception",
")",
":",
"string",
"{",
"static",
"::",
"makeAssertion",
"(",
"\\",
"is_file",
"(",
"$",
"path",
")",
",",
"$",
"exception",
")",
";",
"retur... | Asserts that the given path is a file path.
@param string $path The path to check that must be a file.
@param Throwable $exception The exception to throw if the assertion fails.
@return string The file path if the assertion does not fail. | [
"Asserts",
"that",
"the",
"given",
"path",
"is",
"a",
"file",
"path",
"."
] | a33dd3fb8983ae6965533c8ff4ff8380367b561d | https://github.com/niconoe-/asserts/blob/a33dd3fb8983ae6965533c8ff4ff8380367b561d/src/Asserts/Categories/AssertFileTrait.php#L39-L43 |
6,453 | niconoe-/asserts | src/Asserts/Categories/AssertFileTrait.php | AssertFileTrait.assertIsLink | public static function assertIsLink(string $path, Throwable $exception): string
{
static::makeAssertion(\is_link($path), $exception);
return $path;
} | php | public static function assertIsLink(string $path, Throwable $exception): string
{
static::makeAssertion(\is_link($path), $exception);
return $path;
} | [
"public",
"static",
"function",
"assertIsLink",
"(",
"string",
"$",
"path",
",",
"Throwable",
"$",
"exception",
")",
":",
"string",
"{",
"static",
"::",
"makeAssertion",
"(",
"\\",
"is_link",
"(",
"$",
"path",
")",
",",
"$",
"exception",
")",
";",
"retur... | Asserts that the given path is a link path.
@param string $path The path to check that must be a link.
@param Throwable $exception The exception to throw if the assertion fails.
@return string The link path if the assertion does not fail. | [
"Asserts",
"that",
"the",
"given",
"path",
"is",
"a",
"link",
"path",
"."
] | a33dd3fb8983ae6965533c8ff4ff8380367b561d | https://github.com/niconoe-/asserts/blob/a33dd3fb8983ae6965533c8ff4ff8380367b561d/src/Asserts/Categories/AssertFileTrait.php#L52-L56 |
6,454 | niconoe-/asserts | src/Asserts/Categories/AssertFileTrait.php | AssertFileTrait.assertIsReadable | public static function assertIsReadable(string $path, Throwable $exception): string
{
static::makeAssertion(\is_readable($path), $exception);
return $path;
} | php | public static function assertIsReadable(string $path, Throwable $exception): string
{
static::makeAssertion(\is_readable($path), $exception);
return $path;
} | [
"public",
"static",
"function",
"assertIsReadable",
"(",
"string",
"$",
"path",
",",
"Throwable",
"$",
"exception",
")",
":",
"string",
"{",
"static",
"::",
"makeAssertion",
"(",
"\\",
"is_readable",
"(",
"$",
"path",
")",
",",
"$",
"exception",
")",
";",
... | Asserts that the given path is readable.
@param string $path The path to check that must be readable.
@param Throwable $exception The exception to throw if the assertion fails.
@return string The path if the assertion does not fail. | [
"Asserts",
"that",
"the",
"given",
"path",
"is",
"readable",
"."
] | a33dd3fb8983ae6965533c8ff4ff8380367b561d | https://github.com/niconoe-/asserts/blob/a33dd3fb8983ae6965533c8ff4ff8380367b561d/src/Asserts/Categories/AssertFileTrait.php#L65-L69 |
6,455 | niconoe-/asserts | src/Asserts/Categories/AssertFileTrait.php | AssertFileTrait.assertIsWritable | public static function assertIsWritable(string $path, Throwable $exception): string
{
static::makeAssertion(\is_writable($path), $exception);
return $path;
} | php | public static function assertIsWritable(string $path, Throwable $exception): string
{
static::makeAssertion(\is_writable($path), $exception);
return $path;
} | [
"public",
"static",
"function",
"assertIsWritable",
"(",
"string",
"$",
"path",
",",
"Throwable",
"$",
"exception",
")",
":",
"string",
"{",
"static",
"::",
"makeAssertion",
"(",
"\\",
"is_writable",
"(",
"$",
"path",
")",
",",
"$",
"exception",
")",
";",
... | Asserts that the given path is writable.
@param string $path The path to check that must be writable.
@param Throwable $exception The exception to throw if the assertion fails.
@return string The path if the assertion does not fail. | [
"Asserts",
"that",
"the",
"given",
"path",
"is",
"writable",
"."
] | a33dd3fb8983ae6965533c8ff4ff8380367b561d | https://github.com/niconoe-/asserts/blob/a33dd3fb8983ae6965533c8ff4ff8380367b561d/src/Asserts/Categories/AssertFileTrait.php#L78-L82 |
6,456 | niconoe-/asserts | src/Asserts/Categories/AssertFileTrait.php | AssertFileTrait.assertIsExecutable | public static function assertIsExecutable(string $path, Throwable $exception): string
{
static::makeAssertion(\is_executable($path), $exception);
return $path;
} | php | public static function assertIsExecutable(string $path, Throwable $exception): string
{
static::makeAssertion(\is_executable($path), $exception);
return $path;
} | [
"public",
"static",
"function",
"assertIsExecutable",
"(",
"string",
"$",
"path",
",",
"Throwable",
"$",
"exception",
")",
":",
"string",
"{",
"static",
"::",
"makeAssertion",
"(",
"\\",
"is_executable",
"(",
"$",
"path",
")",
",",
"$",
"exception",
")",
"... | Asserts that the given path is executable.
@param string $path The path to check that must be executable.
@param Throwable $exception The exception to throw if the assertion fails.
@return string The path if the assertion does not fail. | [
"Asserts",
"that",
"the",
"given",
"path",
"is",
"executable",
"."
] | a33dd3fb8983ae6965533c8ff4ff8380367b561d | https://github.com/niconoe-/asserts/blob/a33dd3fb8983ae6965533c8ff4ff8380367b561d/src/Asserts/Categories/AssertFileTrait.php#L91-L95 |
6,457 | chriscollins/general-utils | lib/ChrisCollins/GeneralUtils/Curl/CurlHandle.php | CurlHandle.execute | public function execute()
{
$this->initialiseHandle();
$this->applyOptionsToHandle();
$content = curl_exec($this->handle);
$this->info = $this->getInfoFromHandle();
$this->errorCode = $this->getErrorCodeFromHandle();
$this->errorMessage = $this->getErrorMessageFrom... | php | public function execute()
{
$this->initialiseHandle();
$this->applyOptionsToHandle();
$content = curl_exec($this->handle);
$this->info = $this->getInfoFromHandle();
$this->errorCode = $this->getErrorCodeFromHandle();
$this->errorMessage = $this->getErrorMessageFrom... | [
"public",
"function",
"execute",
"(",
")",
"{",
"$",
"this",
"->",
"initialiseHandle",
"(",
")",
";",
"$",
"this",
"->",
"applyOptionsToHandle",
"(",
")",
";",
"$",
"content",
"=",
"curl_exec",
"(",
"$",
"this",
"->",
"handle",
")",
";",
"$",
"this",
... | Execute the request and return the content.
@return string The content at the URL. | [
"Execute",
"the",
"request",
"and",
"return",
"the",
"content",
"."
] | 3fef519f3dd97bf15aa16ff528152ae663e027ac | https://github.com/chriscollins/general-utils/blob/3fef519f3dd97bf15aa16ff528152ae663e027ac/lib/ChrisCollins/GeneralUtils/Curl/CurlHandle.php#L69-L84 |
6,458 | chriscollins/general-utils | lib/ChrisCollins/GeneralUtils/Curl/CurlHandle.php | CurlHandle.getErrorCodeFromHandle | public function getErrorCodeFromHandle()
{
$errorNumber = null;
if ($this->handle !== null) {
$errorNumber = curl_errno($this->handle);
}
return $errorNumber === 0 ? null : $errorNumber;
} | php | public function getErrorCodeFromHandle()
{
$errorNumber = null;
if ($this->handle !== null) {
$errorNumber = curl_errno($this->handle);
}
return $errorNumber === 0 ? null : $errorNumber;
} | [
"public",
"function",
"getErrorCodeFromHandle",
"(",
")",
"{",
"$",
"errorNumber",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"handle",
"!==",
"null",
")",
"{",
"$",
"errorNumber",
"=",
"curl_errno",
"(",
"$",
"this",
"->",
"handle",
")",
";",
"}"... | Get the last error code that occurred, or null if there were no problems.
@return int|null An integer representing the last error that occurred, or null if there were no problems. | [
"Get",
"the",
"last",
"error",
"code",
"that",
"occurred",
"or",
"null",
"if",
"there",
"were",
"no",
"problems",
"."
] | 3fef519f3dd97bf15aa16ff528152ae663e027ac | https://github.com/chriscollins/general-utils/blob/3fef519f3dd97bf15aa16ff528152ae663e027ac/lib/ChrisCollins/GeneralUtils/Curl/CurlHandle.php#L236-L245 |
6,459 | chriscollins/general-utils | lib/ChrisCollins/GeneralUtils/Curl/CurlHandle.php | CurlHandle.getErrorMessageFromHandle | public function getErrorMessageFromHandle()
{
$errorMessage = null;
if ($this->handle !== null) {
$errorMessage = curl_errno($this->handle);
}
return $errorMessage === '' ? null : $errorMessage;
} | php | public function getErrorMessageFromHandle()
{
$errorMessage = null;
if ($this->handle !== null) {
$errorMessage = curl_errno($this->handle);
}
return $errorMessage === '' ? null : $errorMessage;
} | [
"public",
"function",
"getErrorMessageFromHandle",
"(",
")",
"{",
"$",
"errorMessage",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"handle",
"!==",
"null",
")",
"{",
"$",
"errorMessage",
"=",
"curl_errno",
"(",
"$",
"this",
"->",
"handle",
")",
";",
... | Get the message for the last error that occurred, or null if there were no problems.
@return string|null An error message, or null if there was no error. | [
"Get",
"the",
"message",
"for",
"the",
"last",
"error",
"that",
"occurred",
"or",
"null",
"if",
"there",
"were",
"no",
"problems",
"."
] | 3fef519f3dd97bf15aa16ff528152ae663e027ac | https://github.com/chriscollins/general-utils/blob/3fef519f3dd97bf15aa16ff528152ae663e027ac/lib/ChrisCollins/GeneralUtils/Curl/CurlHandle.php#L262-L271 |
6,460 | academic/VipaImportBundle | Importer/PKP/IssueFileImporter.php | IssueFileImporter.importIssueFiles | public function importIssueFiles($issue, $oldId, $slug)
{
$issueFilesSql = "SELECT * FROM issue_files WHERE issue_id = :id";
$issueFilesStatement = $this->dbalConnection->prepare($issueFilesSql);
$issueFilesStatement->bindValue('id', $oldId);
$issueFilesStatement->execute();
... | php | public function importIssueFiles($issue, $oldId, $slug)
{
$issueFilesSql = "SELECT * FROM issue_files WHERE issue_id = :id";
$issueFilesStatement = $this->dbalConnection->prepare($issueFilesSql);
$issueFilesStatement->bindValue('id', $oldId);
$issueFilesStatement->execute();
... | [
"public",
"function",
"importIssueFiles",
"(",
"$",
"issue",
",",
"$",
"oldId",
",",
"$",
"slug",
")",
"{",
"$",
"issueFilesSql",
"=",
"\"SELECT * FROM issue_files WHERE issue_id = :id\"",
";",
"$",
"issueFilesStatement",
"=",
"$",
"this",
"->",
"dbalConnection",
... | Imports files of given issue
@param Issue $issue The issue whose files are going to be imported
@param int $oldId Old ID of the issue
@param String $slug Journal's slug
@throws \Doctrine\DBAL\DBALException | [
"Imports",
"files",
"of",
"given",
"issue"
] | cee7d9e51613706a4fd6e2eade44041ce1af9ad3 | https://github.com/academic/VipaImportBundle/blob/cee7d9e51613706a4fd6e2eade44041ce1af9ad3/Importer/PKP/IssueFileImporter.php#L21-L32 |
6,461 | cmdweb/kernel | Kernel/Controller.php | Controller.Model | public function Model()
{
$file = $this->getAddressModel();
if(file_exists($file)) {
$model = $this->getClassModel();
$this->model = new $model();
}
} | php | public function Model()
{
$file = $this->getAddressModel();
if(file_exists($file)) {
$model = $this->getClassModel();
$this->model = new $model();
}
} | [
"public",
"function",
"Model",
"(",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"getAddressModel",
"(",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"file",
")",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"getClassModel",
"(",
")",
";",
... | Carrega a model | [
"Carrega",
"a",
"model"
] | 01dfc802c582adac1a739bcb34e4c31d86cde268 | https://github.com/cmdweb/kernel/blob/01dfc802c582adac1a739bcb34e4c31d86cde268/Kernel/Controller.php#L42-L49 |
6,462 | cmdweb/kernel | Kernel/Controller.php | Controller.generateModel | private function generateModel($model){
if(is_object($model))
Session::set(md5(Request::getArea().Request::getController().Request::getAction()), base64_encode(get_class($model)));
} | php | private function generateModel($model){
if(is_object($model))
Session::set(md5(Request::getArea().Request::getController().Request::getAction()), base64_encode(get_class($model)));
} | [
"private",
"function",
"generateModel",
"(",
"$",
"model",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"model",
")",
")",
"Session",
"::",
"set",
"(",
"md5",
"(",
"Request",
"::",
"getArea",
"(",
")",
".",
"Request",
"::",
"getController",
"(",
")",
... | Gera um gid para gravar a tipagem da model por action | [
"Gera",
"um",
"gid",
"para",
"gravar",
"a",
"tipagem",
"da",
"model",
"por",
"action"
] | 01dfc802c582adac1a739bcb34e4c31d86cde268 | https://github.com/cmdweb/kernel/blob/01dfc802c582adac1a739bcb34e4c31d86cde268/Kernel/Controller.php#L54-L57 |
6,463 | cmdweb/kernel | Kernel/Controller.php | Controller.getTypeModel | public static function getTypeModel(){
$type = base64_decode(Session::get(md5(Request::getArea().Request::getController().Request::getAction())));
if($type == null)
return 'stdClass';
return $type;
} | php | public static function getTypeModel(){
$type = base64_decode(Session::get(md5(Request::getArea().Request::getController().Request::getAction())));
if($type == null)
return 'stdClass';
return $type;
} | [
"public",
"static",
"function",
"getTypeModel",
"(",
")",
"{",
"$",
"type",
"=",
"base64_decode",
"(",
"Session",
"::",
"get",
"(",
"md5",
"(",
"Request",
"::",
"getArea",
"(",
")",
".",
"Request",
"::",
"getController",
"(",
")",
".",
"Request",
"::",
... | Resgata o tipo da model | [
"Resgata",
"o",
"tipo",
"da",
"model"
] | 01dfc802c582adac1a739bcb34e4c31d86cde268 | https://github.com/cmdweb/kernel/blob/01dfc802c582adac1a739bcb34e4c31d86cde268/Kernel/Controller.php#L62-L68 |
6,464 | andreas-weber/php-config | src/Core/Config.php | Config.convert | private function convert(array $config)
{
foreach ($config as $index => $data) {
if (is_array($data)) {
$config[$index] = new Config($data);
}
}
return $config;
} | php | private function convert(array $config)
{
foreach ($config as $index => $data) {
if (is_array($data)) {
$config[$index] = new Config($data);
}
}
return $config;
} | [
"private",
"function",
"convert",
"(",
"array",
"$",
"config",
")",
"{",
"foreach",
"(",
"$",
"config",
"as",
"$",
"index",
"=>",
"$",
"data",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"$",
"config",
"[",
"$",
"index",
"]"... | Convert each sub array in an own config instance.
@param array $config
@return array | [
"Convert",
"each",
"sub",
"array",
"in",
"an",
"own",
"config",
"instance",
"."
] | f7433a6fcfbd0d788b017540d394de70f4bed320 | https://github.com/andreas-weber/php-config/blob/f7433a6fcfbd0d788b017540d394de70f4bed320/src/Core/Config.php#L47-L56 |
6,465 | andreas-weber/php-config | src/Core/Config.php | Config.merge | public function merge(Config $config)
{
$this->data = array_replace_recursive(
$this->data,
$config->toArray()
);
return $this;
} | php | public function merge(Config $config)
{
$this->data = array_replace_recursive(
$this->data,
$config->toArray()
);
return $this;
} | [
"public",
"function",
"merge",
"(",
"Config",
"$",
"config",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"array_replace_recursive",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"config",
"->",
"toArray",
"(",
")",
")",
";",
"return",
"$",
"this",
";",
"}"... | Merge another config instance in this config instance.
@param Config $config
@return $this | [
"Merge",
"another",
"config",
"instance",
"in",
"this",
"config",
"instance",
"."
] | f7433a6fcfbd0d788b017540d394de70f4bed320 | https://github.com/andreas-weber/php-config/blob/f7433a6fcfbd0d788b017540d394de70f4bed320/src/Core/Config.php#L65-L73 |
6,466 | webtoucher/yii2-migrate | components/Migration.php | Migration.addCommentOnTable | public function addCommentOnTable($table, $comment)
{
$table = $this->db->quoteTableName($table);
$comment = $this->db->quoteValue($comment);
$this->execute("COMMENT ON TABLE $table IS $comment;");
} | php | public function addCommentOnTable($table, $comment)
{
$table = $this->db->quoteTableName($table);
$comment = $this->db->quoteValue($comment);
$this->execute("COMMENT ON TABLE $table IS $comment;");
} | [
"public",
"function",
"addCommentOnTable",
"(",
"$",
"table",
",",
"$",
"comment",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"db",
"->",
"quoteTableName",
"(",
"$",
"table",
")",
";",
"$",
"comment",
"=",
"$",
"this",
"->",
"db",
"->",
"quoteVa... | Adds comment for a table.
@param string $table
@param string $comment
@return void | [
"Adds",
"comment",
"for",
"a",
"table",
"."
] | bfd8323811d72f68eac64d0405d0f3c40e485c58 | https://github.com/webtoucher/yii2-migrate/blob/bfd8323811d72f68eac64d0405d0f3c40e485c58/components/Migration.php#L55-L61 |
6,467 | webtoucher/yii2-migrate | components/Migration.php | Migration.addCommentOnColumn | public function addCommentOnColumn($table, $column, $comment)
{
$table = $this->db->quoteTableName($table);
$column = $this->db->quoteColumnName($column);
$comment = $this->db->quoteValue($comment);
$this->execute("COMMENT ON COLUMN $table.$column IS $comment;");
} | php | public function addCommentOnColumn($table, $column, $comment)
{
$table = $this->db->quoteTableName($table);
$column = $this->db->quoteColumnName($column);
$comment = $this->db->quoteValue($comment);
$this->execute("COMMENT ON COLUMN $table.$column IS $comment;");
} | [
"public",
"function",
"addCommentOnColumn",
"(",
"$",
"table",
",",
"$",
"column",
",",
"$",
"comment",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"db",
"->",
"quoteTableName",
"(",
"$",
"table",
")",
";",
"$",
"column",
"=",
"$",
"this",
"->",
... | Adds comment for a table's column.
@param string $table
@param string $column
@param string $comment
@return void | [
"Adds",
"comment",
"for",
"a",
"table",
"s",
"column",
"."
] | bfd8323811d72f68eac64d0405d0f3c40e485c58 | https://github.com/webtoucher/yii2-migrate/blob/bfd8323811d72f68eac64d0405d0f3c40e485c58/components/Migration.php#L71-L78 |
6,468 | asbsoft/yii2module-news_1b_160430 | controllers/MainController.php | MainController.actionView | public function actionView($id, $renderPartial = false)
{
$modelNews = $this->module->model('News');
$model = $modelNews::findOne($id);
$modelI18n = false;
if (!empty($model)) {
$modelsI18n = $modelNews::prepareI18nModels($model);
$modelI18n = $modelsI18n[$th... | php | public function actionView($id, $renderPartial = false)
{
$modelNews = $this->module->model('News');
$model = $modelNews::findOne($id);
$modelI18n = false;
if (!empty($model)) {
$modelsI18n = $modelNews::prepareI18nModels($model);
$modelI18n = $modelsI18n[$th... | [
"public",
"function",
"actionView",
"(",
"$",
"id",
",",
"$",
"renderPartial",
"=",
"false",
")",
"{",
"$",
"modelNews",
"=",
"$",
"this",
"->",
"module",
"->",
"model",
"(",
"'News'",
")",
";",
"$",
"model",
"=",
"$",
"modelNews",
"::",
"findOne",
"... | Render article's body.
@param integer $id
@param boolean $renderPartial if true ignore visibility and show without layout by call renderPartial() | [
"Render",
"article",
"s",
"body",
"."
] | ce64b1e70c5a57b572921945cc51384087905461 | https://github.com/asbsoft/yii2module-news_1b_160430/blob/ce64b1e70c5a57b572921945cc51384087905461/controllers/MainController.php#L83-L109 |
6,469 | leonardodarosa23/rose-core | core/Exception/ExceptionHandler.php | ExceptionHandler.logObject | private static function logObject( $obj )
{
$path = config('system.errors.save_dir');
if ($path != null) {
if (!is_dir($path)) {
@mkdir($path, 0755);
}
$name = strftime(config('system.errors.file_name'));
if($name != '' && @touch($path.DIRECTORY_SEPARATOR.$name)){
@error_log(PHP_EOL . $obj . PH... | php | private static function logObject( $obj )
{
$path = config('system.errors.save_dir');
if ($path != null) {
if (!is_dir($path)) {
@mkdir($path, 0755);
}
$name = strftime(config('system.errors.file_name'));
if($name != '' && @touch($path.DIRECTORY_SEPARATOR.$name)){
@error_log(PHP_EOL . $obj . PH... | [
"private",
"static",
"function",
"logObject",
"(",
"$",
"obj",
")",
"{",
"$",
"path",
"=",
"config",
"(",
"'system.errors.save_dir'",
")",
";",
"if",
"(",
"$",
"path",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"path",
")",
")",
"{... | Efetua o log do erro nos registros
@param \Exception $obj | [
"Efetua",
"o",
"log",
"do",
"erro",
"nos",
"registros"
] | 998f483ca02347b84940aa4039870b83be5fc360 | https://github.com/leonardodarosa23/rose-core/blob/998f483ca02347b84940aa4039870b83be5fc360/core/Exception/ExceptionHandler.php#L101-L115 |
6,470 | calin-marian/google-supported-languages | src/LanguageFactory.php | LanguageFactory.create | public function create($languageCode) {
$mappings = $this->getMappings();
if (!isset($mappings[$languageCode])) {
throw new \InvalidArgumentException('The language code is not part of the supported list. Please see GoogleSupportedLanguages\LanguageFactory::getMappings() for reference.');
}
retur... | php | public function create($languageCode) {
$mappings = $this->getMappings();
if (!isset($mappings[$languageCode])) {
throw new \InvalidArgumentException('The language code is not part of the supported list. Please see GoogleSupportedLanguages\LanguageFactory::getMappings() for reference.');
}
retur... | [
"public",
"function",
"create",
"(",
"$",
"languageCode",
")",
"{",
"$",
"mappings",
"=",
"$",
"this",
"->",
"getMappings",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"mappings",
"[",
"$",
"languageCode",
"]",
")",
")",
"{",
"throw",
"new",
... | Create a language object from the language code.
@param string $languageCode
@return LanguageInterface | [
"Create",
"a",
"language",
"object",
"from",
"the",
"language",
"code",
"."
] | d9460f8e741df52ab842d32e9b94651ad3cd6785 | https://github.com/calin-marian/google-supported-languages/blob/d9460f8e741df52ab842d32e9b94651ad3cd6785/src/LanguageFactory.php#L19-L27 |
6,471 | osflab/view | AbstractHelper.php | AbstractHelper.init | public function init(): void
{
if ($this->initialized) {
return;
}
if (!$this->view) {
$containerGetter = 'get' . ucfirst($this->viewName);
$this->setView(Container::$containerGetter());
}
if (method_exists($this, 'getAvailableHelpers')) {
... | php | public function init(): void
{
if ($this->initialized) {
return;
}
if (!$this->view) {
$containerGetter = 'get' . ucfirst($this->viewName);
$this->setView(Container::$containerGetter());
}
if (method_exists($this, 'getAvailableHelpers')) {
... | [
"public",
"function",
"init",
"(",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"initialized",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"view",
")",
"{",
"$",
"containerGetter",
"=",
"'get'",
".",
"ucfirst",
"(",
"... | Lazy loading process
@return void | [
"Lazy",
"loading",
"process"
] | e06601013e8ec86dc2055e000e58dffd963c78e2 | https://github.com/osflab/view/blob/e06601013e8ec86dc2055e000e58dffd963c78e2/AbstractHelper.php#L183-L197 |
6,472 | osflab/view | AbstractHelper.php | AbstractHelper.get | public function get($key, $alternateContent = '')
{
$this->init();
return isset($this->view->getValues()[$key]) ? $this->view->getValues()[$key] : $alternateContent;
} | php | public function get($key, $alternateContent = '')
{
$this->init();
return isset($this->view->getValues()[$key]) ? $this->view->getValues()[$key] : $alternateContent;
} | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"alternateContent",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"init",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"view",
"->",
"getValues",
"(",
")",
"[",
"$",
"key",
"]",
")",
... | Get a value from action controller
@param string $key
@param string $alternateContent displayd if $key not found
@return multitype: | [
"Get",
"a",
"value",
"from",
"action",
"controller"
] | e06601013e8ec86dc2055e000e58dffd963c78e2 | https://github.com/osflab/view/blob/e06601013e8ec86dc2055e000e58dffd963c78e2/AbstractHelper.php#L225-L229 |
6,473 | simple-php-mvc/installer-module | src/InstallerModule/Command/AssetsInstallCommand.php | AssetsInstallCommand.recursiveRemoveDir | function recursiveRemoveDir($dir)
{
if (is_link($dir)) {
@unlink($dir);
} else if (is_dir($dir)) {
$files = array_diff(@scandir($dir), array('.', '..'));
foreach ($files as $file) {
(is_dir("$dir/$file")) ? $this->recursiveRemoveDir("$dir/$file") :... | php | function recursiveRemoveDir($dir)
{
if (is_link($dir)) {
@unlink($dir);
} else if (is_dir($dir)) {
$files = array_diff(@scandir($dir), array('.', '..'));
foreach ($files as $file) {
(is_dir("$dir/$file")) ? $this->recursiveRemoveDir("$dir/$file") :... | [
"function",
"recursiveRemoveDir",
"(",
"$",
"dir",
")",
"{",
"if",
"(",
"is_link",
"(",
"$",
"dir",
")",
")",
"{",
"@",
"unlink",
"(",
"$",
"dir",
")",
";",
"}",
"else",
"if",
"(",
"is_dir",
"(",
"$",
"dir",
")",
")",
"{",
"$",
"files",
"=",
... | Recursive Remove Dir
@param string $dir
@return boolean | [
"Recursive",
"Remove",
"Dir"
] | 62bd5bac05418b5f712dfcead1edc75ef14d60e3 | https://github.com/simple-php-mvc/installer-module/blob/62bd5bac05418b5f712dfcead1edc75ef14d60e3/src/InstallerModule/Command/AssetsInstallCommand.php#L103-L114 |
6,474 | bestit/commercetools-async-pool | src/Pool.php | Pool.addPromise | public function addPromise(
ClientRequestInterface $request,
callable $startingSuccessCallback = null,
callable $startingFailCallback = null
): ApiResponseInterface {
$return = $this->promises[$request->getIdentifier()] = $this->createStartingPromise(
$request,
... | php | public function addPromise(
ClientRequestInterface $request,
callable $startingSuccessCallback = null,
callable $startingFailCallback = null
): ApiResponseInterface {
$return = $this->promises[$request->getIdentifier()] = $this->createStartingPromise(
$request,
... | [
"public",
"function",
"addPromise",
"(",
"ClientRequestInterface",
"$",
"request",
",",
"callable",
"$",
"startingSuccessCallback",
"=",
"null",
",",
"callable",
"$",
"startingFailCallback",
"=",
"null",
")",
":",
"ApiResponseInterface",
"{",
"$",
"return",
"=",
"... | Adds a promise to this pool.
@param ClientRequestInterface $request
@param callable $startingSuccessCallback Overwrite the starting success callback.
@param callable $startingFailCallback Overwrite the failing success callback.
@return ApiResponseInterface | [
"Adds",
"a",
"promise",
"to",
"this",
"pool",
"."
] | 3b011cceb474c287351e4aa0893ab8ecddd1af21 | https://github.com/bestit/commercetools-async-pool/blob/3b011cceb474c287351e4aa0893ab8ecddd1af21/src/Pool.php#L59-L71 |
6,475 | bestit/commercetools-async-pool | src/Pool.php | Pool.createStartingPromise | private function createStartingPromise(
ClientRequestInterface $request,
callable $startingSuccessCallback = null,
callable $startingFailCallback = null
): ApiResponseInterface {
if (!$startingSuccessCallback) {
$startingSuccessCallback = function (ResponseInterface $resp... | php | private function createStartingPromise(
ClientRequestInterface $request,
callable $startingSuccessCallback = null,
callable $startingFailCallback = null
): ApiResponseInterface {
if (!$startingSuccessCallback) {
$startingSuccessCallback = function (ResponseInterface $resp... | [
"private",
"function",
"createStartingPromise",
"(",
"ClientRequestInterface",
"$",
"request",
",",
"callable",
"$",
"startingSuccessCallback",
"=",
"null",
",",
"callable",
"$",
"startingFailCallback",
"=",
"null",
")",
":",
"ApiResponseInterface",
"{",
"if",
"(",
... | Makes a ctp response out of the default async response and returns the promise for the next chaining level.
@param ClientRequestInterface $request
@param callable $startingSuccessCallback Overwrite the starting success callback.
@param callable $startingFailCallback Overwrite the failing success callback.
@return ApiRe... | [
"Makes",
"a",
"ctp",
"response",
"out",
"of",
"the",
"default",
"async",
"response",
"and",
"returns",
"the",
"promise",
"for",
"the",
"next",
"chaining",
"level",
"."
] | 3b011cceb474c287351e4aa0893ab8ecddd1af21 | https://github.com/bestit/commercetools-async-pool/blob/3b011cceb474c287351e4aa0893ab8ecddd1af21/src/Pool.php#L80-L98 |
6,476 | bestit/commercetools-async-pool | src/Pool.php | Pool.flush | public function flush()
{
// Prevent an endless loop and work on a batch copy.
$promises = $this->getPromises();
$this->setPromises([]);
Promise\settle($promises)->wait();
} | php | public function flush()
{
// Prevent an endless loop and work on a batch copy.
$promises = $this->getPromises();
$this->setPromises([]);
Promise\settle($promises)->wait();
} | [
"public",
"function",
"flush",
"(",
")",
"{",
"// Prevent an endless loop and work on a batch copy.",
"$",
"promises",
"=",
"$",
"this",
"->",
"getPromises",
"(",
")",
";",
"$",
"this",
"->",
"setPromises",
"(",
"[",
"]",
")",
";",
"Promise",
"\\",
"settle",
... | Flushes the collected pull of promises.
@return void | [
"Flushes",
"the",
"collected",
"pull",
"of",
"promises",
"."
] | 3b011cceb474c287351e4aa0893ab8ecddd1af21 | https://github.com/bestit/commercetools-async-pool/blob/3b011cceb474c287351e4aa0893ab8ecddd1af21/src/Pool.php#L113-L119 |
6,477 | squire-assistant/dependency-injection | Dumper/GraphvizDumper.php | GraphvizDumper.findNodes | private function findNodes()
{
$nodes = array();
$container = $this->cloneContainer();
foreach ($container->getDefinitions() as $id => $definition) {
$class = $definition->getClass();
if ('\\' === substr($class, 0, 1)) {
$class = substr($class, 1);
... | php | private function findNodes()
{
$nodes = array();
$container = $this->cloneContainer();
foreach ($container->getDefinitions() as $id => $definition) {
$class = $definition->getClass();
if ('\\' === substr($class, 0, 1)) {
$class = substr($class, 1);
... | [
"private",
"function",
"findNodes",
"(",
")",
"{",
"$",
"nodes",
"=",
"array",
"(",
")",
";",
"$",
"container",
"=",
"$",
"this",
"->",
"cloneContainer",
"(",
")",
";",
"foreach",
"(",
"$",
"container",
"->",
"getDefinitions",
"(",
")",
"as",
"$",
"i... | Finds all nodes.
@return array An array of all nodes | [
"Finds",
"all",
"nodes",
"."
] | c61d77bf8814369344fd71b015d7238322126041 | https://github.com/squire-assistant/dependency-injection/blob/c61d77bf8814369344fd71b015d7238322126041/Dumper/GraphvizDumper.php#L160-L194 |
6,478 | AnonymPHP/Anonym-Library | src/Anonym/Http/Redirect.php | Redirect.to | public function to($url = '', $time = 0, array $headers = [])
{
$this->redirector->setTarget($url)->setTime($time)->setHeaders($headers);
return $this;
} | php | public function to($url = '', $time = 0, array $headers = [])
{
$this->redirector->setTarget($url)->setTime($time)->setHeaders($headers);
return $this;
} | [
"public",
"function",
"to",
"(",
"$",
"url",
"=",
"''",
",",
"$",
"time",
"=",
"0",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"redirector",
"->",
"setTarget",
"(",
"$",
"url",
")",
"->",
"setTime",
"(",
"$",
"tim... | redirect user to somewhere else
@param string $url
@param int $time
@param array $headers
@return $this | [
"redirect",
"user",
"to",
"somewhere",
"else"
] | c967ad804f84e8fb204593a0959cda2fed5ae075 | https://github.com/AnonymPHP/Anonym-Library/blob/c967ad804f84e8fb204593a0959cda2fed5ae075/src/Anonym/Http/Redirect.php#L76-L81 |
6,479 | AnonymPHP/Anonym-Library | src/Anonym/Http/Redirect.php | Redirect.withError | public function withError($message)
{
if (is_array($message)) {
$this->errorBag->setErrors($message);
} else {
$this->errorBag->add($message);
}
return $this;
} | php | public function withError($message)
{
if (is_array($message)) {
$this->errorBag->setErrors($message);
} else {
$this->errorBag->add($message);
}
return $this;
} | [
"public",
"function",
"withError",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"message",
")",
")",
"{",
"$",
"this",
"->",
"errorBag",
"->",
"setErrors",
"(",
"$",
"message",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"erro... | add or set error messages
@param array|string $message
@return $this | [
"add",
"or",
"set",
"error",
"messages"
] | c967ad804f84e8fb204593a0959cda2fed5ae075 | https://github.com/AnonymPHP/Anonym-Library/blob/c967ad804f84e8fb204593a0959cda2fed5ae075/src/Anonym/Http/Redirect.php#L89-L98 |
6,480 | AnonymPHP/Anonym-Library | src/Anonym/Http/Redirect.php | Redirect.withInput | public function withInput($name, $message = null)
{
if (!is_array($name)) {
$name = [$name, $message];
}
foreach ($name as $key => $message) {
Session::set($key, $message);
}
return $this;
} | php | public function withInput($name, $message = null)
{
if (!is_array($name)) {
$name = [$name, $message];
}
foreach ($name as $key => $message) {
Session::set($key, $message);
}
return $this;
} | [
"public",
"function",
"withInput",
"(",
"$",
"name",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"$",
"name",
"=",
"[",
"$",
"name",
",",
"$",
"message",
"]",
";",
"}",
"foreach",
"("... | redirect with input
@param array|string $name
@param mixed $message
@return $this | [
"redirect",
"with",
"input"
] | c967ad804f84e8fb204593a0959cda2fed5ae075 | https://github.com/AnonymPHP/Anonym-Library/blob/c967ad804f84e8fb204593a0959cda2fed5ae075/src/Anonym/Http/Redirect.php#L108-L119 |
6,481 | AnonymPHP/Anonym-Library | src/Anonym/Http/Redirect.php | Redirect.withCookie | public function withCookie($name, $message = null, $time = 3600)
{
if (!is_array($name)) {
$name = [$name, $message];
}
foreach ($name as $key => $message) {
$this->redirector->getCookieBase()->set($key, $message, $time);
}
return $this;
} | php | public function withCookie($name, $message = null, $time = 3600)
{
if (!is_array($name)) {
$name = [$name, $message];
}
foreach ($name as $key => $message) {
$this->redirector->getCookieBase()->set($key, $message, $time);
}
return $this;
} | [
"public",
"function",
"withCookie",
"(",
"$",
"name",
",",
"$",
"message",
"=",
"null",
",",
"$",
"time",
"=",
"3600",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"$",
"name",
"=",
"[",
"$",
"name",
",",
"$",
"message... | redirect with single or multipile cookies
@param array|string $name
@param mixed $message
@param int $time
@return $this | [
"redirect",
"with",
"single",
"or",
"multipile",
"cookies"
] | c967ad804f84e8fb204593a0959cda2fed5ae075 | https://github.com/AnonymPHP/Anonym-Library/blob/c967ad804f84e8fb204593a0959cda2fed5ae075/src/Anonym/Http/Redirect.php#L139-L150 |
6,482 | AnonymPHP/Anonym-Library | src/Anonym/Http/Redirect.php | Redirect.back | public function back($time = 0)
{
$this->redirector->setTarget(Request::back());
$this->redirector->setTime($time);
return $this;
} | php | public function back($time = 0)
{
$this->redirector->setTarget(Request::back());
$this->redirector->setTime($time);
return $this;
} | [
"public",
"function",
"back",
"(",
"$",
"time",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"redirector",
"->",
"setTarget",
"(",
"Request",
"::",
"back",
"(",
")",
")",
";",
"$",
"this",
"->",
"redirector",
"->",
"setTime",
"(",
"$",
"time",
")",
";",
... | redirect user to it referer url
@param int $time
@return $this | [
"redirect",
"user",
"to",
"it",
"referer",
"url"
] | c967ad804f84e8fb204593a0959cda2fed5ae075 | https://github.com/AnonymPHP/Anonym-Library/blob/c967ad804f84e8fb204593a0959cda2fed5ae075/src/Anonym/Http/Redirect.php#L158-L164 |
6,483 | infusephp/rest-api | src/ModelController.php | ModelController.getCreateRoute | protected function getCreateRoute(Request $req, Response $res)
{
$route = new CreateModelRoute($req, $res);
$route->setApp($this->app)
->setSerializer($this->getSerializer($req));
return $route;
} | php | protected function getCreateRoute(Request $req, Response $res)
{
$route = new CreateModelRoute($req, $res);
$route->setApp($this->app)
->setSerializer($this->getSerializer($req));
return $route;
} | [
"protected",
"function",
"getCreateRoute",
"(",
"Request",
"$",
"req",
",",
"Response",
"$",
"res",
")",
"{",
"$",
"route",
"=",
"new",
"CreateModelRoute",
"(",
"$",
"req",
",",
"$",
"res",
")",
";",
"$",
"route",
"->",
"setApp",
"(",
"$",
"this",
"-... | Builds a create route object.
@param Request $req
@param Response $res
@return CreateModelRoute | [
"Builds",
"a",
"create",
"route",
"object",
"."
] | 3a02152048ea38ec5f0adaed3f10a17730086ec7 | https://github.com/infusephp/rest-api/blob/3a02152048ea38ec5f0adaed3f10a17730086ec7/src/ModelController.php#L54-L61 |
6,484 | infusephp/rest-api | src/ModelController.php | ModelController.getListRoute | protected function getListRoute(Request $req, Response $res)
{
$route = new ListModelsRoute($req, $res);
$route->setApp($this->app)
->setSerializer($this->getSerializer($req));
return $route;
} | php | protected function getListRoute(Request $req, Response $res)
{
$route = new ListModelsRoute($req, $res);
$route->setApp($this->app)
->setSerializer($this->getSerializer($req));
return $route;
} | [
"protected",
"function",
"getListRoute",
"(",
"Request",
"$",
"req",
",",
"Response",
"$",
"res",
")",
"{",
"$",
"route",
"=",
"new",
"ListModelsRoute",
"(",
"$",
"req",
",",
"$",
"res",
")",
";",
"$",
"route",
"->",
"setApp",
"(",
"$",
"this",
"->",... | Builds a list route object.
@param Request $req
@param Response $res
@return ListModelsRoute | [
"Builds",
"a",
"list",
"route",
"object",
"."
] | 3a02152048ea38ec5f0adaed3f10a17730086ec7 | https://github.com/infusephp/rest-api/blob/3a02152048ea38ec5f0adaed3f10a17730086ec7/src/ModelController.php#L71-L78 |
6,485 | infusephp/rest-api | src/ModelController.php | ModelController.getRetrieveRoute | protected function getRetrieveRoute(Request $req, Response $res)
{
$route = new RetrieveModelRoute($req, $res);
$route->setApp($this->app)
->setSerializer($this->getSerializer($req));
return $route;
} | php | protected function getRetrieveRoute(Request $req, Response $res)
{
$route = new RetrieveModelRoute($req, $res);
$route->setApp($this->app)
->setSerializer($this->getSerializer($req));
return $route;
} | [
"protected",
"function",
"getRetrieveRoute",
"(",
"Request",
"$",
"req",
",",
"Response",
"$",
"res",
")",
"{",
"$",
"route",
"=",
"new",
"RetrieveModelRoute",
"(",
"$",
"req",
",",
"$",
"res",
")",
";",
"$",
"route",
"->",
"setApp",
"(",
"$",
"this",
... | Builds a retrieve route object.
@param Request $req
@param Response $res
@return RetrieveModelRoute | [
"Builds",
"a",
"retrieve",
"route",
"object",
"."
] | 3a02152048ea38ec5f0adaed3f10a17730086ec7 | https://github.com/infusephp/rest-api/blob/3a02152048ea38ec5f0adaed3f10a17730086ec7/src/ModelController.php#L88-L95 |
6,486 | infusephp/rest-api | src/ModelController.php | ModelController.getEditRoute | protected function getEditRoute(Request $req, Response $res)
{
$route = new EditModelRoute($req, $res);
$route->setApp($this->app)
->setSerializer($this->getSerializer($req));
return $route;
} | php | protected function getEditRoute(Request $req, Response $res)
{
$route = new EditModelRoute($req, $res);
$route->setApp($this->app)
->setSerializer($this->getSerializer($req));
return $route;
} | [
"protected",
"function",
"getEditRoute",
"(",
"Request",
"$",
"req",
",",
"Response",
"$",
"res",
")",
"{",
"$",
"route",
"=",
"new",
"EditModelRoute",
"(",
"$",
"req",
",",
"$",
"res",
")",
";",
"$",
"route",
"->",
"setApp",
"(",
"$",
"this",
"->",
... | Builds an edit route object.
@param Request $req
@param Response $res
@return EditModelRoute | [
"Builds",
"an",
"edit",
"route",
"object",
"."
] | 3a02152048ea38ec5f0adaed3f10a17730086ec7 | https://github.com/infusephp/rest-api/blob/3a02152048ea38ec5f0adaed3f10a17730086ec7/src/ModelController.php#L105-L112 |
6,487 | infusephp/rest-api | src/ModelController.php | ModelController.getDeleteRoute | protected function getDeleteRoute(Request $req, Response $res)
{
$route = new DeleteModelRoute($req, $res);
$route->setApp($this->app)
->setSerializer($this->getSerializer($req));
return $route;
} | php | protected function getDeleteRoute(Request $req, Response $res)
{
$route = new DeleteModelRoute($req, $res);
$route->setApp($this->app)
->setSerializer($this->getSerializer($req));
return $route;
} | [
"protected",
"function",
"getDeleteRoute",
"(",
"Request",
"$",
"req",
",",
"Response",
"$",
"res",
")",
"{",
"$",
"route",
"=",
"new",
"DeleteModelRoute",
"(",
"$",
"req",
",",
"$",
"res",
")",
";",
"$",
"route",
"->",
"setApp",
"(",
"$",
"this",
"-... | Builds a delete route object.
@param Request $req
@param Response $res
@return DeleteModelRoute | [
"Builds",
"a",
"delete",
"route",
"object",
"."
] | 3a02152048ea38ec5f0adaed3f10a17730086ec7 | https://github.com/infusephp/rest-api/blob/3a02152048ea38ec5f0adaed3f10a17730086ec7/src/ModelController.php#L122-L129 |
6,488 | infusephp/rest-api | src/ModelController.php | ModelController.getSerializer | public function getSerializer(Request $req)
{
$modelSerializer = new ModelSerializer($req);
$jsonSerializer = new JsonSerializer($req);
$serializer = new ChainedSerializer();
$serializer->add($modelSerializer)
->add($jsonSerializer);
return $serializer;
... | php | public function getSerializer(Request $req)
{
$modelSerializer = new ModelSerializer($req);
$jsonSerializer = new JsonSerializer($req);
$serializer = new ChainedSerializer();
$serializer->add($modelSerializer)
->add($jsonSerializer);
return $serializer;
... | [
"public",
"function",
"getSerializer",
"(",
"Request",
"$",
"req",
")",
"{",
"$",
"modelSerializer",
"=",
"new",
"ModelSerializer",
"(",
"$",
"req",
")",
";",
"$",
"jsonSerializer",
"=",
"new",
"JsonSerializer",
"(",
"$",
"req",
")",
";",
"$",
"serializer"... | Builds a serializer object.
@param Request $req
@return ChainedSerializer | [
"Builds",
"a",
"serializer",
"object",
"."
] | 3a02152048ea38ec5f0adaed3f10a17730086ec7 | https://github.com/infusephp/rest-api/blob/3a02152048ea38ec5f0adaed3f10a17730086ec7/src/ModelController.php#L138-L148 |
6,489 | ndj888/com_jjcbs_tool | src/com_jjcbs/fun/AnnotationFun.php | AnnotationFun.createClosure | public static function createClosure(string $methodStr , string $methodName , string $data = '') : string {
if ( empty($data)){
// no function body
return '$fun = ' . preg_replace('/public|static|protected|private|public static|protected static|private static/'
, '' ,... | php | public static function createClosure(string $methodStr , string $methodName , string $data = '') : string {
if ( empty($data)){
// no function body
return '$fun = ' . preg_replace('/public|static|protected|private|public static|protected static|private static/'
, '' ,... | [
"public",
"static",
"function",
"createClosure",
"(",
"string",
"$",
"methodStr",
",",
"string",
"$",
"methodName",
",",
"string",
"$",
"data",
"=",
"''",
")",
":",
"string",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"// no function body"... | create a closure by old method str
@param string $methodStr
@param string $methodName
@param string $data
@return string | [
"create",
"a",
"closure",
"by",
"old",
"method",
"str"
] | 6c86980182d93ce66df45768fa7864b5df32e63d | https://github.com/ndj888/com_jjcbs_tool/blob/6c86980182d93ce66df45768fa7864b5df32e63d/src/com_jjcbs/fun/AnnotationFun.php#L26-L39 |
6,490 | ndj888/com_jjcbs_tool | src/com_jjcbs/fun/AnnotationFun.php | AnnotationFun.replaceClassInfoStr | public static function replaceClassInfoStr(string $className , string $data , string $input){
return preg_replace(sprintf('/class\s*%s/' , $className) , $data , $input);
} | php | public static function replaceClassInfoStr(string $className , string $data , string $input){
return preg_replace(sprintf('/class\s*%s/' , $className) , $data , $input);
} | [
"public",
"static",
"function",
"replaceClassInfoStr",
"(",
"string",
"$",
"className",
",",
"string",
"$",
"data",
",",
"string",
"$",
"input",
")",
"{",
"return",
"preg_replace",
"(",
"sprintf",
"(",
"'/class\\s*%s/'",
",",
"$",
"className",
")",
",",
"$",... | replace class info
@param string $className
@param string $data
@param string $input
@return mixed | [
"replace",
"class",
"info"
] | 6c86980182d93ce66df45768fa7864b5df32e63d | https://github.com/ndj888/com_jjcbs_tool/blob/6c86980182d93ce66df45768fa7864b5df32e63d/src/com_jjcbs/fun/AnnotationFun.php#L61-L63 |
6,491 | railsphp/framework | src/Rails/ActiveRecord/Associations/CollectionProxy.php | CollectionProxy.add | public function add($records/*...$records*/)
{
if (!$this->owner->isPersisted()) {
throw new Exception\RuntimeException(
# TODO: terminar mensaje:
# ...adding children to its $type association
"Owner record must be persisted before adding children"... | php | public function add($records/*...$records*/)
{
if (!$this->owner->isPersisted()) {
throw new Exception\RuntimeException(
# TODO: terminar mensaje:
# ...adding children to its $type association
"Owner record must be persisted before adding children"... | [
"public",
"function",
"add",
"(",
"$",
"records",
"/*...$records*/",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"owner",
"->",
"isPersisted",
"(",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"RuntimeException",
"(",
"# TODO: terminar mensaje:",
"# ..... | Add records to the association. The owner record must be
persisted before adding records.
Pass an array or records or many records. | [
"Add",
"records",
"to",
"the",
"association",
".",
"The",
"owner",
"record",
"must",
"be",
"persisted",
"before",
"adding",
"records",
".",
"Pass",
"an",
"array",
"or",
"records",
"or",
"many",
"records",
"."
] | 2ac9d3e493035dcc68f3c3812423327127327cd5 | https://github.com/railsphp/framework/blob/2ac9d3e493035dcc68f3c3812423327127327cd5/src/Rails/ActiveRecord/Associations/CollectionProxy.php#L27-L73 |
6,492 | nano7/Database | src/Deploys/Deployer.php | Deployer.run | public function run($paths = [], array $options = [])
{
$this->notes = [];
$files = $this->getDeployFiles($paths);
$this->requireFiles($files);
$this->runDeployies($files, $options);
$this->runClearDatabaseCollections();
return $files;
} | php | public function run($paths = [], array $options = [])
{
$this->notes = [];
$files = $this->getDeployFiles($paths);
$this->requireFiles($files);
$this->runDeployies($files, $options);
$this->runClearDatabaseCollections();
return $files;
} | [
"public",
"function",
"run",
"(",
"$",
"paths",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"notes",
"=",
"[",
"]",
";",
"$",
"files",
"=",
"$",
"this",
"->",
"getDeployFiles",
"(",
"$",
"paths",
")"... | Run the pending deployies at a given path.
@param array|string $paths
@param array $options
@return array | [
"Run",
"the",
"pending",
"deployies",
"at",
"a",
"given",
"path",
"."
] | 7d8c10af415c469a317f40471f657104e4d5b52a | https://github.com/nano7/Database/blob/7d8c10af415c469a317f40471f657104e4d5b52a/src/Deploys/Deployer.php#L54-L67 |
6,493 | nano7/Database | src/Deploys/Deployer.php | Deployer.runDeployies | protected function runDeployies(array $deployies, array $options = [])
{
if (count($deployies) == 0) {
$this->note('<info>Nothing to deploy.</info>');
return;
}
foreach ($deployies as $file) {
$this->runDeploy($file);
}
} | php | protected function runDeployies(array $deployies, array $options = [])
{
if (count($deployies) == 0) {
$this->note('<info>Nothing to deploy.</info>');
return;
}
foreach ($deployies as $file) {
$this->runDeploy($file);
}
} | [
"protected",
"function",
"runDeployies",
"(",
"array",
"$",
"deployies",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"deployies",
")",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"note",
"(",
"'<info>Nothing to depl... | Run an array of deployies.
@param array $deployies
@param array $options
@return void | [
"Run",
"an",
"array",
"of",
"deployies",
"."
] | 7d8c10af415c469a317f40471f657104e4d5b52a | https://github.com/nano7/Database/blob/7d8c10af415c469a317f40471f657104e4d5b52a/src/Deploys/Deployer.php#L76-L87 |
6,494 | nano7/Database | src/Deploys/Deployer.php | Deployer.runDeploy | protected function runDeploy($file)
{
$deploy = $this->resolve($name = $this->getDeployName($file));
$this->note("<comment>Deploying:</comment> {$name}");
// Run deploy
$deploy->run();
$this->note("<info>Deployed:</info> {$name}");
} | php | protected function runDeploy($file)
{
$deploy = $this->resolve($name = $this->getDeployName($file));
$this->note("<comment>Deploying:</comment> {$name}");
// Run deploy
$deploy->run();
$this->note("<info>Deployed:</info> {$name}");
} | [
"protected",
"function",
"runDeploy",
"(",
"$",
"file",
")",
"{",
"$",
"deploy",
"=",
"$",
"this",
"->",
"resolve",
"(",
"$",
"name",
"=",
"$",
"this",
"->",
"getDeployName",
"(",
"$",
"file",
")",
")",
";",
"$",
"this",
"->",
"note",
"(",
"\"<comm... | Run "run" a deploy instance.
@param string $file
@return void | [
"Run",
"run",
"a",
"deploy",
"instance",
"."
] | 7d8c10af415c469a317f40471f657104e4d5b52a | https://github.com/nano7/Database/blob/7d8c10af415c469a317f40471f657104e4d5b52a/src/Deploys/Deployer.php#L95-L105 |
6,495 | nano7/Database | src/Deploys/Deployer.php | Deployer.runClearDatabaseCollections | protected function runClearDatabaseCollections()
{
$collections = db()->getCollections();
$activated = array_keys($this->collections);
// Carregar lista de colecoes que sobraram no banco
$diff = Arr::where($collections, function($item) use ($activated) {
return ! in_arra... | php | protected function runClearDatabaseCollections()
{
$collections = db()->getCollections();
$activated = array_keys($this->collections);
// Carregar lista de colecoes que sobraram no banco
$diff = Arr::where($collections, function($item) use ($activated) {
return ! in_arra... | [
"protected",
"function",
"runClearDatabaseCollections",
"(",
")",
"{",
"$",
"collections",
"=",
"db",
"(",
")",
"->",
"getCollections",
"(",
")",
";",
"$",
"activated",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"collections",
")",
";",
"// Carregar lista de c... | Run clear database collections. | [
"Run",
"clear",
"database",
"collections",
"."
] | 7d8c10af415c469a317f40471f657104e4d5b52a | https://github.com/nano7/Database/blob/7d8c10af415c469a317f40471f657104e4d5b52a/src/Deploys/Deployer.php#L110-L129 |
6,496 | nano7/Database | src/Deploys/Deployer.php | Deployer.runClearDatabaseIndexs | protected function runClearDatabaseIndexs()
{
foreach ($this->collections as $coll => $activated) {
$indexs = db()->getIndexs($coll);
// Carregar lista de colecoes que sobraram no banco
$diff = Arr::where($indexs, function($item) use ($activated) {
return... | php | protected function runClearDatabaseIndexs()
{
foreach ($this->collections as $coll => $activated) {
$indexs = db()->getIndexs($coll);
// Carregar lista de colecoes que sobraram no banco
$diff = Arr::where($indexs, function($item) use ($activated) {
return... | [
"protected",
"function",
"runClearDatabaseIndexs",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"collections",
"as",
"$",
"coll",
"=>",
"$",
"activated",
")",
"{",
"$",
"indexs",
"=",
"db",
"(",
")",
"->",
"getIndexs",
"(",
"$",
"coll",
")",
";",
... | Run clear database indexs. | [
"Run",
"clear",
"database",
"indexs",
"."
] | 7d8c10af415c469a317f40471f657104e4d5b52a | https://github.com/nano7/Database/blob/7d8c10af415c469a317f40471f657104e4d5b52a/src/Deploys/Deployer.php#L134-L151 |
6,497 | nano7/Database | src/Deploys/Deployer.php | Deployer.getDeployFiles | public function getDeployFiles($paths)
{
return Collection::make($paths)->flatMap(function ($path) {
return $this->files->glob($path.'/*.php');
})->filter()->sortBy(function ($file) {
return $this->getDeployName($file);
})->values()->keyBy(function ($file) {
... | php | public function getDeployFiles($paths)
{
return Collection::make($paths)->flatMap(function ($path) {
return $this->files->glob($path.'/*.php');
})->filter()->sortBy(function ($file) {
return $this->getDeployName($file);
})->values()->keyBy(function ($file) {
... | [
"public",
"function",
"getDeployFiles",
"(",
"$",
"paths",
")",
"{",
"return",
"Collection",
"::",
"make",
"(",
"$",
"paths",
")",
"->",
"flatMap",
"(",
"function",
"(",
"$",
"path",
")",
"{",
"return",
"$",
"this",
"->",
"files",
"->",
"glob",
"(",
... | Get all of the deploy files in a given path.
@param string|array $paths
@return array | [
"Get",
"all",
"of",
"the",
"deploy",
"files",
"in",
"a",
"given",
"path",
"."
] | 7d8c10af415c469a317f40471f657104e4d5b52a | https://github.com/nano7/Database/blob/7d8c10af415c469a317f40471f657104e4d5b52a/src/Deploys/Deployer.php#L172-L181 |
6,498 | nano7/Database | src/Deploys/Deployer.php | Deployer.collection | public function collection($name)
{
// Verificar se deve adicionar a colecao na lista
if (! array_key_exists($name, $this->collections)) {
$this->collections[$name] = [];
}
// Verificar se jah foi criado
if (db()->hasCollection($name)) {
return true;
... | php | public function collection($name)
{
// Verificar se deve adicionar a colecao na lista
if (! array_key_exists($name, $this->collections)) {
$this->collections[$name] = [];
}
// Verificar se jah foi criado
if (db()->hasCollection($name)) {
return true;
... | [
"public",
"function",
"collection",
"(",
"$",
"name",
")",
"{",
"// Verificar se deve adicionar a colecao na lista",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"collections",
")",
")",
"{",
"$",
"this",
"->",
"collections",
"... | Create collection.
@param $name
@return bool | [
"Create",
"collection",
"."
] | 7d8c10af415c469a317f40471f657104e4d5b52a | https://github.com/nano7/Database/blob/7d8c10af415c469a317f40471f657104e4d5b52a/src/Deploys/Deployer.php#L264-L280 |
6,499 | nano7/Database | src/Deploys/Deployer.php | Deployer.index | public function index($collection, $columns, $unique)
{
// Montar nome do index
$name = strtolower(sprintf('ax_%s_%s', implode('_', array_keys($columns)), $unique ? 'unique' : "normal"));
// Verificar se deve adicionar a colecao na lista
if (! array_key_exists($collection, $this->co... | php | public function index($collection, $columns, $unique)
{
// Montar nome do index
$name = strtolower(sprintf('ax_%s_%s', implode('_', array_keys($columns)), $unique ? 'unique' : "normal"));
// Verificar se deve adicionar a colecao na lista
if (! array_key_exists($collection, $this->co... | [
"public",
"function",
"index",
"(",
"$",
"collection",
",",
"$",
"columns",
",",
"$",
"unique",
")",
"{",
"// Montar nome do index",
"$",
"name",
"=",
"strtolower",
"(",
"sprintf",
"(",
"'ax_%s_%s'",
",",
"implode",
"(",
"'_'",
",",
"array_keys",
"(",
"$",... | Create index.
@param $name
@return bool | [
"Create",
"index",
"."
] | 7d8c10af415c469a317f40471f657104e4d5b52a | https://github.com/nano7/Database/blob/7d8c10af415c469a317f40471f657104e4d5b52a/src/Deploys/Deployer.php#L287-L311 |
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.