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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
23,500 | heidelpay/PhpDoc | src/phpDocumentor/Translator/Translator.php | Translator.addTranslations | public function addTranslations($filename, $locale = self::DEFAULT_LOCALE, $textDomain = self::DEFAULT_DOMAIN)
{
parent::addTranslationFile(self::TRANSLATION_FILE_TYPE, $filename, $textDomain, $locale);
$this->messages = array();
return $this;
} | php | public function addTranslations($filename, $locale = self::DEFAULT_LOCALE, $textDomain = self::DEFAULT_DOMAIN)
{
parent::addTranslationFile(self::TRANSLATION_FILE_TYPE, $filename, $textDomain, $locale);
$this->messages = array();
return $this;
} | [
"public",
"function",
"addTranslations",
"(",
"$",
"filename",
",",
"$",
"locale",
"=",
"self",
"::",
"DEFAULT_LOCALE",
",",
"$",
"textDomain",
"=",
"self",
"::",
"DEFAULT_DOMAIN",
")",
"{",
"parent",
"::",
"addTranslationFile",
"(",
"self",
"::",
"TRANSLATION... | Adds a translation file for a specific locale, or the default locale when none is provided.
@param string $filename Name of the file to add.
@param string|null $locale The locale to assign to, matches
{@link http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes ISO-639-1} and defaults to en (English).
@param... | [
"Adds",
"a",
"translation",
"file",
"for",
"a",
"specific",
"locale",
"or",
"the",
"default",
"locale",
"when",
"none",
"is",
"provided",
"."
] | 5ac9e842cbd4cbb70900533b240c131f3515ee02 | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Translator/Translator.php#L103-L110 |
23,501 | heidelpay/PhpDoc | src/phpDocumentor/Translator/Translator.php | Translator.addTranslationFolder | public function addTranslationFolder($folder, array $domains = array())
{
if (empty($domains)) {
$domains = array(self::DEFAULT_DOMAIN);
}
foreach ($domains as $domain) {
$this->addTranslationsUsingPattern($folder, $domain);
}
return $this;
} | php | public function addTranslationFolder($folder, array $domains = array())
{
if (empty($domains)) {
$domains = array(self::DEFAULT_DOMAIN);
}
foreach ($domains as $domain) {
$this->addTranslationsUsingPattern($folder, $domain);
}
return $this;
} | [
"public",
"function",
"addTranslationFolder",
"(",
"$",
"folder",
",",
"array",
"$",
"domains",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"domains",
")",
")",
"{",
"$",
"domains",
"=",
"array",
"(",
"self",
"::",
"DEFAULT_DOMAIN",... | Adds a folder with files containing translation sources.
This method scans the provided folder for any file matching the following format:
`[domain].[locale].php`
If the domain matches the {@see self::DEFAULT_DOMAIN default domain} then that part is omitted and the filename
should match:
`[locale].php`
@link http:... | [
"Adds",
"a",
"folder",
"with",
"files",
"containing",
"translation",
"sources",
"."
] | 5ac9e842cbd4cbb70900533b240c131f3515ee02 | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Translator/Translator.php#L134-L145 |
23,502 | heidelpay/PhpDoc | src/phpDocumentor/Translator/Translator.php | Translator.addTranslationsUsingPattern | public function addTranslationsUsingPattern(
$baseDir,
$textDomain = self::DEFAULT_DOMAIN,
$pattern = self::DEFAULT_PATTERN
) {
if ($textDomain !== self::DEFAULT_DOMAIN && $pattern === self::DEFAULT_PATTERN) {
$pattern = $textDomain . '.' . $pattern;
}
pa... | php | public function addTranslationsUsingPattern(
$baseDir,
$textDomain = self::DEFAULT_DOMAIN,
$pattern = self::DEFAULT_PATTERN
) {
if ($textDomain !== self::DEFAULT_DOMAIN && $pattern === self::DEFAULT_PATTERN) {
$pattern = $textDomain . '.' . $pattern;
}
pa... | [
"public",
"function",
"addTranslationsUsingPattern",
"(",
"$",
"baseDir",
",",
"$",
"textDomain",
"=",
"self",
"::",
"DEFAULT_DOMAIN",
",",
"$",
"pattern",
"=",
"self",
"::",
"DEFAULT_PATTERN",
")",
"{",
"if",
"(",
"$",
"textDomain",
"!==",
"self",
"::",
"DE... | Adds a series of translation files given a pattern.
This method will search the base directory for a series of files matching the given pattern (where %s is replaces
by the two-letter locale shorthand) and adds any translations to the translation table.
@param string $baseDir Directory to search in (not-recursive)... | [
"Adds",
"a",
"series",
"of",
"translation",
"files",
"given",
"a",
"pattern",
"."
] | 5ac9e842cbd4cbb70900533b240c131f3515ee02 | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Translator/Translator.php#L166-L180 |
23,503 | heidelpay/PhpDoc | src/phpDocumentor/Translator/Translator.php | Translator.translate | public function translate($message, $textDomain = self::DEFAULT_DOMAIN, $locale = null)
{
return parent::translate($message, $textDomain, $locale);
} | php | public function translate($message, $textDomain = self::DEFAULT_DOMAIN, $locale = null)
{
return parent::translate($message, $textDomain, $locale);
} | [
"public",
"function",
"translate",
"(",
"$",
"message",
",",
"$",
"textDomain",
"=",
"self",
"::",
"DEFAULT_DOMAIN",
",",
"$",
"locale",
"=",
"null",
")",
"{",
"return",
"parent",
"::",
"translate",
"(",
"$",
"message",
",",
"$",
"textDomain",
",",
"$",
... | Attempts to translate the given message or code into the provided locale.
@param string $message The message or code to translate.
@param string $textDomain A message may be located in a domain, here you can provide in which.
@param null $locale The locale to translate to or the default if not set.
@return s... | [
"Attempts",
"to",
"translate",
"the",
"given",
"message",
"or",
"code",
"into",
"the",
"provided",
"locale",
"."
] | 5ac9e842cbd4cbb70900533b240c131f3515ee02 | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Translator/Translator.php#L191-L194 |
23,504 | oroinc/OroLayoutComponent | Extension/Theme/Visitor/ImportVisitor.php | ImportVisitor.insertUpdate | private function insertUpdate($parentUpdate, $update)
{
$el = $update instanceof ElementDependentLayoutUpdateInterface
? $update->getElement()
: 'root';
$parentUpdateIndex = array_search($parentUpdate, $this->updates[$el]);
$this->updates[$el] = array_merge(
... | php | private function insertUpdate($parentUpdate, $update)
{
$el = $update instanceof ElementDependentLayoutUpdateInterface
? $update->getElement()
: 'root';
$parentUpdateIndex = array_search($parentUpdate, $this->updates[$el]);
$this->updates[$el] = array_merge(
... | [
"private",
"function",
"insertUpdate",
"(",
"$",
"parentUpdate",
",",
"$",
"update",
")",
"{",
"$",
"el",
"=",
"$",
"update",
"instanceof",
"ElementDependentLayoutUpdateInterface",
"?",
"$",
"update",
"->",
"getElement",
"(",
")",
":",
"'root'",
";",
"$",
"p... | Insert import update right after its parent update
@param ImportsAwareLayoutUpdateInterface $parentUpdate
@param LayoutUpdateImportInterface $update | [
"Insert",
"import",
"update",
"right",
"after",
"its",
"parent",
"update"
] | 682a96672393d81c63728e47c4a4c3618c515be0 | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/Extension/Theme/Visitor/ImportVisitor.php#L122-L135 |
23,505 | luniki/trails | lib/trails.php | Trails_Dispatcher.dispatch | function dispatch($uri) {
# E_USER_ERROR|E_USER_WARNING|E_USER_NOTICE|E_RECOVERABLE_ERROR = 5888
$old_handler = set_error_handler(array($this, 'error_handler'), 5888);
ob_start();
$level = ob_get_level();
$this->map_uri_to_response($this->clean_request_uri((string) $uri))->output();
while (o... | php | function dispatch($uri) {
# E_USER_ERROR|E_USER_WARNING|E_USER_NOTICE|E_RECOVERABLE_ERROR = 5888
$old_handler = set_error_handler(array($this, 'error_handler'), 5888);
ob_start();
$level = ob_get_level();
$this->map_uri_to_response($this->clean_request_uri((string) $uri))->output();
while (o... | [
"function",
"dispatch",
"(",
"$",
"uri",
")",
"{",
"# E_USER_ERROR|E_USER_WARNING|E_USER_NOTICE|E_RECOVERABLE_ERROR = 5888",
"$",
"old_handler",
"=",
"set_error_handler",
"(",
"array",
"(",
"$",
"this",
",",
"'error_handler'",
")",
",",
"5888",
")",
";",
"ob_start",
... | Maps a string to a response which is then rendered.
@param string The requested URI.
@return void | [
"Maps",
"a",
"string",
"to",
"a",
"response",
"which",
"is",
"then",
"rendered",
"."
] | ade6e3aa6bb543fb66e3295acc74f32121085c16 | https://github.com/luniki/trails/blob/ade6e3aa6bb543fb66e3295acc74f32121085c16/lib/trails.php#L113-L130 |
23,506 | luniki/trails | lib/trails.php | Trails_Controller.perform | function perform($unconsumed) {
list($action, $args, $format) = $this->extract_action_and_args($unconsumed);
# set format
$this->format = isset($format) ? $format : 'html';
# call before filter
$before_filter_result = $this->before_filter($action, $args);
# send action to controller
# TO... | php | function perform($unconsumed) {
list($action, $args, $format) = $this->extract_action_and_args($unconsumed);
# set format
$this->format = isset($format) ? $format : 'html';
# call before filter
$before_filter_result = $this->before_filter($action, $args);
# send action to controller
# TO... | [
"function",
"perform",
"(",
"$",
"unconsumed",
")",
"{",
"list",
"(",
"$",
"action",
",",
"$",
"args",
",",
"$",
"format",
")",
"=",
"$",
"this",
"->",
"extract_action_and_args",
"(",
"$",
"unconsumed",
")",
";",
"# set format",
"$",
"this",
"->",
"for... | This method extracts an action string and further arguments from it's
parameter. The action string is mapped to a method being called afterwards
using the said arguments. That method is called and a response object is
generated, populated and sent back to the dispatcher.
@param type <description>
@return type <descri... | [
"This",
"method",
"extracts",
"an",
"action",
"string",
"and",
"further",
"arguments",
"from",
"it",
"s",
"parameter",
".",
"The",
"action",
"string",
"is",
"mapped",
"to",
"a",
"method",
"being",
"called",
"afterwards",
"using",
"the",
"said",
"arguments",
... | ade6e3aa6bb543fb66e3295acc74f32121085c16 | https://github.com/luniki/trails/blob/ade6e3aa6bb543fb66e3295acc74f32121085c16/lib/trails.php#L536-L569 |
23,507 | luniki/trails | lib/trails.php | Trails_Controller.extract_action_and_args | function extract_action_and_args($string) {
if ('' === $string) {
return array('index', array(), NULL);
}
// find optional file extension
$format = NULL;
if (preg_match('/^(.*[^\/.])\.(\w+)$/', $string, $matches)) {
list($_, $string, $format) = $matches;
}
// TODO this should ... | php | function extract_action_and_args($string) {
if ('' === $string) {
return array('index', array(), NULL);
}
// find optional file extension
$format = NULL;
if (preg_match('/^(.*[^\/.])\.(\w+)$/', $string, $matches)) {
list($_, $string, $format) = $matches;
}
// TODO this should ... | [
"function",
"extract_action_and_args",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"''",
"===",
"$",
"string",
")",
"{",
"return",
"array",
"(",
"'index'",
",",
"array",
"(",
")",
",",
"NULL",
")",
";",
"}",
"// find optional file extension",
"$",
"format",
... | Extracts action and args from a string.
@param string the processed string
@return array an array with two elements - a string containing the
action and an array of strings representing the args | [
"Extracts",
"action",
"and",
"args",
"from",
"a",
"string",
"."
] | ade6e3aa6bb543fb66e3295acc74f32121085c16 | https://github.com/luniki/trails/blob/ade6e3aa6bb543fb66e3295acc74f32121085c16/lib/trails.php#L580-L596 |
23,508 | luniki/trails | lib/trails.php | Trails_Controller.url_for | function url_for($to/*, ...*/) {
# urlencode all but the first argument
$args = func_get_args();
$args = array_map('urlencode', $args);
$args[0] = $to;
return $this->dispatcher->trails_uri . '/' . join('/', $args);
} | php | function url_for($to/*, ...*/) {
# urlencode all but the first argument
$args = func_get_args();
$args = array_map('urlencode', $args);
$args[0] = $to;
return $this->dispatcher->trails_uri . '/' . join('/', $args);
} | [
"function",
"url_for",
"(",
"$",
"to",
"/*, ...*/",
")",
"{",
"# urlencode all but the first argument",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"args",
"=",
"array_map",
"(",
"'urlencode'",
",",
"$",
"args",
")",
";",
"$",
"args",
"[",
"0",
... | Returns a URL to a specified route to your Trails application.
Example:
Your Trails application is located at 'http://example.com/dispatch.php'.
So your dispatcher's trails_uri is set to 'http://example.com/dispatch.php'
If you want the URL to your 'wiki' controller with action 'show' and
parameter 'page' you should s... | [
"Returns",
"a",
"URL",
"to",
"a",
"specified",
"route",
"to",
"your",
"Trails",
"application",
"."
] | ade6e3aa6bb543fb66e3295acc74f32121085c16 | https://github.com/luniki/trails/blob/ade6e3aa6bb543fb66e3295acc74f32121085c16/lib/trails.php#L825-L833 |
23,509 | zicht/z | src/Zicht/Tool/Container/ContainerCompiler.php | ContainerCompiler.getContainer | public function getContainer()
{
$mutex = new Mutex($this->file . '.lock', true);
$ret = $mutex->run(
function () {
if ($this->needsRecompile()) {
file_put_contents($this->file, $this->compileContainerCode());
}
return ... | php | public function getContainer()
{
$mutex = new Mutex($this->file . '.lock', true);
$ret = $mutex->run(
function () {
if ($this->needsRecompile()) {
file_put_contents($this->file, $this->compileContainerCode());
}
return ... | [
"public",
"function",
"getContainer",
"(",
")",
"{",
"$",
"mutex",
"=",
"new",
"Mutex",
"(",
"$",
"this",
"->",
"file",
".",
"'.lock'",
",",
"true",
")",
";",
"$",
"ret",
"=",
"$",
"mutex",
"->",
"run",
"(",
"function",
"(",
")",
"{",
"if",
"(",
... | Writes the code to a temporary file and returns the resulting Container object.
@return mixed
@throws \LogicException | [
"Writes",
"the",
"code",
"to",
"a",
"temporary",
"file",
"and",
"returns",
"the",
"resulting",
"Container",
"object",
"."
] | 6a1731dad20b018555a96b726a61d4bf8ec8c886 | https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Container/ContainerCompiler.php#L48-L68 |
23,510 | zicht/z | src/Zicht/Tool/Container/ContainerCompiler.php | ContainerCompiler.needsRecompile | protected function needsRecompile()
{
clearstatcache();
return !is_file($this->file) || (
(!empty($this->configTree['z']['sources'])
&& max(array_map('filemtime', $this->configTree['z']['sources'])) >= filemtime($this->file))
);
} | php | protected function needsRecompile()
{
clearstatcache();
return !is_file($this->file) || (
(!empty($this->configTree['z']['sources'])
&& max(array_map('filemtime', $this->configTree['z']['sources'])) >= filemtime($this->file))
);
} | [
"protected",
"function",
"needsRecompile",
"(",
")",
"{",
"clearstatcache",
"(",
")",
";",
"return",
"!",
"is_file",
"(",
"$",
"this",
"->",
"file",
")",
"||",
"(",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"configTree",
"[",
"'z'",
"]",
"[",
"'sour... | Crude check for whether a recompile is needed.
@return bool | [
"Crude",
"check",
"for",
"whether",
"a",
"recompile",
"is",
"needed",
"."
] | 6a1731dad20b018555a96b726a61d4bf8ec8c886 | https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Container/ContainerCompiler.php#L88-L95 |
23,511 | zicht/z | src/Zicht/Tool/Container/ContainerCompiler.php | ContainerCompiler.compileContainerCode | public function compileContainerCode()
{
$builder = new ContainerBuilder($this->configTree);
foreach ($this->plugins as $name => $plugin) {
$plugin->setContainerBuilder($builder);
}
$containerNode = $builder->build();
$buffer = new Buffer();
$buffer->write... | php | public function compileContainerCode()
{
$builder = new ContainerBuilder($this->configTree);
foreach ($this->plugins as $name => $plugin) {
$plugin->setContainerBuilder($builder);
}
$containerNode = $builder->build();
$buffer = new Buffer();
$buffer->write... | [
"public",
"function",
"compileContainerCode",
"(",
")",
"{",
"$",
"builder",
"=",
"new",
"ContainerBuilder",
"(",
"$",
"this",
"->",
"configTree",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"plugins",
"as",
"$",
"name",
"=>",
"$",
"plugin",
")",
"{",
... | Returns the code for initializing the container.
@return string | [
"Returns",
"the",
"code",
"for",
"initializing",
"the",
"container",
"."
] | 6a1731dad20b018555a96b726a61d4bf8ec8c886 | https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Container/ContainerCompiler.php#L103-L116 |
23,512 | wenbinye/PhalconX | src/Enum/Enum.php | Enum.instances | public static function instances()
{
$all = [];
foreach (static::getNames() as $name => $val) {
$all[] = new static($name, $val);
}
return $all;
} | php | public static function instances()
{
$all = [];
foreach (static::getNames() as $name => $val) {
$all[] = new static($name, $val);
}
return $all;
} | [
"public",
"static",
"function",
"instances",
"(",
")",
"{",
"$",
"all",
"=",
"[",
"]",
";",
"foreach",
"(",
"static",
"::",
"getNames",
"(",
")",
"as",
"$",
"name",
"=>",
"$",
"val",
")",
"{",
"$",
"all",
"[",
"]",
"=",
"new",
"static",
"(",
"$... | Gets all enums
@return Enum[] | [
"Gets",
"all",
"enums"
] | 0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1 | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Enum/Enum.php#L120-L127 |
23,513 | wenbinye/PhalconX | src/Enum/Enum.php | Enum.nameOf | public static function nameOf($value)
{
$values = static::getValues();
return isset($values[$value]) ? $values[$value] : null;
} | php | public static function nameOf($value)
{
$values = static::getValues();
return isset($values[$value]) ? $values[$value] : null;
} | [
"public",
"static",
"function",
"nameOf",
"(",
"$",
"value",
")",
"{",
"$",
"values",
"=",
"static",
"::",
"getValues",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"values",
"[",
"$",
"value",
"]",
")",
"?",
"$",
"values",
"[",
"$",
"value",
"]",
... | Gets the name for the enum value
@return string | [
"Gets",
"the",
"name",
"for",
"the",
"enum",
"value"
] | 0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1 | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Enum/Enum.php#L142-L146 |
23,514 | wenbinye/PhalconX | src/Enum/Enum.php | Enum.valueOf | public static function valueOf($name)
{
$names = static::getNames();
return isset($names[$name]) ? $names[$name] : null;
} | php | public static function valueOf($name)
{
$names = static::getNames();
return isset($names[$name]) ? $names[$name] : null;
} | [
"public",
"static",
"function",
"valueOf",
"(",
"$",
"name",
")",
"{",
"$",
"names",
"=",
"static",
"::",
"getNames",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"names",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"names",
"[",
"$",
"name",
"]",
":",
... | Gets the enum value for the name
@return mixed value of | [
"Gets",
"the",
"enum",
"value",
"for",
"the",
"name"
] | 0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1 | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Enum/Enum.php#L162-L166 |
23,515 | wenbinye/PhalconX | src/Enum/Enum.php | Enum.fromName | public static function fromName($name)
{
$names = static::getNames();
if (array_key_exists($name, $names)) {
return new static($name, $names[$name]);
}
throw new \InvalidArgumentException("No enum constant '$name' in class " . get_called_class());
} | php | public static function fromName($name)
{
$names = static::getNames();
if (array_key_exists($name, $names)) {
return new static($name, $names[$name]);
}
throw new \InvalidArgumentException("No enum constant '$name' in class " . get_called_class());
} | [
"public",
"static",
"function",
"fromName",
"(",
"$",
"name",
")",
"{",
"$",
"names",
"=",
"static",
"::",
"getNames",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"names",
")",
")",
"{",
"return",
"new",
"static",
"(",
... | Gets the enum instance for the name
@return Enum | [
"Gets",
"the",
"enum",
"instance",
"for",
"the",
"name"
] | 0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1 | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Enum/Enum.php#L173-L180 |
23,516 | wenbinye/PhalconX | src/Enum/Enum.php | Enum.fromValue | public static function fromValue($value)
{
$values = static::getValues();
if (array_key_exists($value, $values)) {
return new static($values[$value], $value);
}
throw new \InvalidArgumentException("No enum constant value '$value' class " . get_called_class());
} | php | public static function fromValue($value)
{
$values = static::getValues();
if (array_key_exists($value, $values)) {
return new static($values[$value], $value);
}
throw new \InvalidArgumentException("No enum constant value '$value' class " . get_called_class());
} | [
"public",
"static",
"function",
"fromValue",
"(",
"$",
"value",
")",
"{",
"$",
"values",
"=",
"static",
"::",
"getValues",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"value",
",",
"$",
"values",
")",
")",
"{",
"return",
"new",
"static",
... | Gets the enum instance for the value
@return Enum | [
"Gets",
"the",
"enum",
"instance",
"for",
"the",
"value"
] | 0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1 | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Enum/Enum.php#L187-L194 |
23,517 | surebert/surebert-framework | src/sb/PDO.php | PDO.s2o | public function s2o($sql, $params=null, $class_name='')
{
//if it has parameters then prepare the statement and execute with the parameters
//stmts that have already been prepared will reuse the prepared statement
if(is_array($params) || is_object($params)){
//convert object p... | php | public function s2o($sql, $params=null, $class_name='')
{
//if it has parameters then prepare the statement and execute with the parameters
//stmts that have already been prepared will reuse the prepared statement
if(is_array($params) || is_object($params)){
//convert object p... | [
"public",
"function",
"s2o",
"(",
"$",
"sql",
",",
"$",
"params",
"=",
"null",
",",
"$",
"class_name",
"=",
"''",
")",
"{",
"//if it has parameters then prepare the statement and execute with the parameters",
"//stmts that have already been prepared will reuse the prepared stat... | Turn a sql query into an array of objects representing each row returned
@param string $sql A sql string, can be used with :prop to create a prepared statement
@param Array params An array hash of values to match with properties inside prepared statement
@param Object params An object whose properties match with prope... | [
"Turn",
"a",
"sql",
"query",
"into",
"an",
"array",
"of",
"objects",
"representing",
"each",
"row",
"returned"
] | f2f32eb693bd39385ceb93355efb5b2a429f27ce | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/PDO.php#L74-L116 |
23,518 | surebert/surebert-framework | src/sb/PDO.php | PDO.paramify | public static function paramify($data, $omit=Array())
{
$params = Array();
if(is_object($data)){
$data = get_object_vars($data);
}
if(is_array($data)){
foreach($data as $key=>$val){
if(!in_array($key, $omit)){
$params[':'... | php | public static function paramify($data, $omit=Array())
{
$params = Array();
if(is_object($data)){
$data = get_object_vars($data);
}
if(is_array($data)){
foreach($data as $key=>$val){
if(!in_array($key, $omit)){
$params[':'... | [
"public",
"static",
"function",
"paramify",
"(",
"$",
"data",
",",
"$",
"omit",
"=",
"Array",
"(",
")",
")",
"{",
"$",
"params",
"=",
"Array",
"(",
")",
";",
"if",
"(",
"is_object",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"=",
"get_object_v... | Converts an array into a bound params hash
@param array/object $data The object/hash to convert to a bindParams compatible hash with the colon in front of each key so that it can be used as a bid param array
@param array $omit An simple array of key names to omit from the array
@return array The input data as an array... | [
"Converts",
"an",
"array",
"into",
"a",
"bound",
"params",
"hash"
] | f2f32eb693bd39385ceb93355efb5b2a429f27ce | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/PDO.php#L139-L157 |
23,519 | surebert/surebert-framework | src/sb/PDO.php | PDO.prepare | public function prepare($sql, $driver_options=array())
{
$md5 = md5($sql);
if(isset($this->prepared_sql[$md5])){
return $this->prepared_sql[$md5];
}
$stmt = parent::prepare($sql, $driver_options);
$this->prepared_sql[$md5] = $stmt;
return $stmt;
} | php | public function prepare($sql, $driver_options=array())
{
$md5 = md5($sql);
if(isset($this->prepared_sql[$md5])){
return $this->prepared_sql[$md5];
}
$stmt = parent::prepare($sql, $driver_options);
$this->prepared_sql[$md5] = $stmt;
return $stmt;
} | [
"public",
"function",
"prepare",
"(",
"$",
"sql",
",",
"$",
"driver_options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"md5",
"=",
"md5",
"(",
"$",
"sql",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"prepared_sql",
"[",
"$",
"md5",
"]",
... | Used to prepare and store sql statements for value binding
@param string $sql
@return PDOStatement A PDO_statment instance | [
"Used",
"to",
"prepare",
"and",
"store",
"sql",
"statements",
"for",
"value",
"binding"
] | f2f32eb693bd39385ceb93355efb5b2a429f27ce | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/PDO.php#L165-L177 |
23,520 | mothership-ec/composer | src/Composer/Command/ShowCommand.php | ShowCommand.printLicenses | protected function printLicenses(CompletePackageInterface $package)
{
$spdxLicense = new SpdxLicense;
$licenses = $package->getLicense();
foreach ($licenses as $licenseId) {
$license = $spdxLicense->getLicenseByIdentifier($licenseId); // keys: 0 fullname, 1 osi, 2 url
... | php | protected function printLicenses(CompletePackageInterface $package)
{
$spdxLicense = new SpdxLicense;
$licenses = $package->getLicense();
foreach ($licenses as $licenseId) {
$license = $spdxLicense->getLicenseByIdentifier($licenseId); // keys: 0 fullname, 1 osi, 2 url
... | [
"protected",
"function",
"printLicenses",
"(",
"CompletePackageInterface",
"$",
"package",
")",
"{",
"$",
"spdxLicense",
"=",
"new",
"SpdxLicense",
";",
"$",
"licenses",
"=",
"$",
"package",
"->",
"getLicense",
"(",
")",
";",
"foreach",
"(",
"$",
"licenses",
... | Prints the licenses of a package with metadata
@param CompletePackageInterface $package | [
"Prints",
"the",
"licenses",
"of",
"a",
"package",
"with",
"metadata"
] | fa6ad031a939d8d33b211e428fdbdd28cfce238c | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Command/ShowCommand.php#L391-L413 |
23,521 | WellCommerce/AppBundle | Service/Admin/Provider/AdminMenuProvider.php | AdminMenuProvider.filterElements | protected function filterElements(Collection $collection, AdminMenu $parent = null)
{
$children = $collection->filter(function (AdminMenu $menuItem) use ($parent) {
return $menuItem->getParent() === $parent;
});
return $children;
} | php | protected function filterElements(Collection $collection, AdminMenu $parent = null)
{
$children = $collection->filter(function (AdminMenu $menuItem) use ($parent) {
return $menuItem->getParent() === $parent;
});
return $children;
} | [
"protected",
"function",
"filterElements",
"(",
"Collection",
"$",
"collection",
",",
"AdminMenu",
"$",
"parent",
"=",
"null",
")",
"{",
"$",
"children",
"=",
"$",
"collection",
"->",
"filter",
"(",
"function",
"(",
"AdminMenu",
"$",
"menuItem",
")",
"use",
... | Filters the collection and returns only children elements for given parent element
@param Collection $collection
@param AdminMenu|null $parent
@return Collection | [
"Filters",
"the",
"collection",
"and",
"returns",
"only",
"children",
"elements",
"for",
"given",
"parent",
"element"
] | 2add687d1c898dd0b24afd611d896e3811a0eac3 | https://github.com/WellCommerce/AppBundle/blob/2add687d1c898dd0b24afd611d896e3811a0eac3/Service/Admin/Provider/AdminMenuProvider.php#L117-L124 |
23,522 | SporkCode/Spork | src/View/Helper/CSS/AbstractHelper.php | AbstractHelper.getCompiler | public function getCompiler()
{
if (!$this->compiler instanceof AbstractCompiler) {
if (null === $this->compiler) {
throw new \Exception('Compiler not set');
}
$compiler = $this->getView()->getHelperPluginManager()->getServiceLocator()->get($this->compiler... | php | public function getCompiler()
{
if (!$this->compiler instanceof AbstractCompiler) {
if (null === $this->compiler) {
throw new \Exception('Compiler not set');
}
$compiler = $this->getView()->getHelperPluginManager()->getServiceLocator()->get($this->compiler... | [
"public",
"function",
"getCompiler",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"compiler",
"instanceof",
"AbstractCompiler",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"compiler",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'... | Get compiler instance
@throws \Exception On compiler not set or invalid compiler type found
@return \Spork\CSS\AbstractCompiler | [
"Get",
"compiler",
"instance"
] | 7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a | https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/CSS/AbstractHelper.php#L70-L86 |
23,523 | SporkCode/Spork | src/View/Helper/CSS/AbstractHelper.php | AbstractHelper.initializeResolver | protected function initializeResolver()
{
$extensions = $this->getCompiler()->getExtensions();
$resolver = $this->resolver = new AggregateResolver();
$stack = array($this->getView()->resolver());
while ($source = array_shift($stack)) {
if ($source instanceof Aggregat... | php | protected function initializeResolver()
{
$extensions = $this->getCompiler()->getExtensions();
$resolver = $this->resolver = new AggregateResolver();
$stack = array($this->getView()->resolver());
while ($source = array_shift($stack)) {
if ($source instanceof Aggregat... | [
"protected",
"function",
"initializeResolver",
"(",
")",
"{",
"$",
"extensions",
"=",
"$",
"this",
"->",
"getCompiler",
"(",
")",
"->",
"getExtensions",
"(",
")",
";",
"$",
"resolver",
"=",
"$",
"this",
"->",
"resolver",
"=",
"new",
"AggregateResolver",
"(... | Initializes Resolver to find files by mimicking the default template
resolver and using compiler extensions. | [
"Initializes",
"Resolver",
"to",
"find",
"files",
"by",
"mimicking",
"the",
"default",
"template",
"resolver",
"and",
"using",
"compiler",
"extensions",
"."
] | 7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a | https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/CSS/AbstractHelper.php#L130-L151 |
23,524 | dotkernel/dot-rbac-guard | src/Provider/ArrayGuardsProvider.php | ArrayGuardsProvider.getGuards | public function getGuards(): array
{
if ($this->guards) {
return $this->guards;
}
if (empty($this->guardsConfig)) {
return [];
}
$this->guards = [];
foreach ($this->guardsConfig as $guardConfig) {
$this->guards[] = $this->getGuard... | php | public function getGuards(): array
{
if ($this->guards) {
return $this->guards;
}
if (empty($this->guardsConfig)) {
return [];
}
$this->guards = [];
foreach ($this->guardsConfig as $guardConfig) {
$this->guards[] = $this->getGuard... | [
"public",
"function",
"getGuards",
"(",
")",
":",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"guards",
")",
"{",
"return",
"$",
"this",
"->",
"guards",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"guardsConfig",
")",
")",
"{",
"return",
... | Gets the cached guard list or creates it from the config
@return GuardInterface[] | [
"Gets",
"the",
"cached",
"guard",
"list",
"or",
"creates",
"it",
"from",
"the",
"config"
] | 4ecaafe2bfcf1d2a66ae582d6d7af4830ec51653 | https://github.com/dotkernel/dot-rbac-guard/blob/4ecaafe2bfcf1d2a66ae582d6d7af4830ec51653/src/Provider/ArrayGuardsProvider.php#L44-L61 |
23,525 | dotkernel/dot-rbac-guard | src/Provider/ArrayGuardsProvider.php | ArrayGuardsProvider.sortGuardsByPriority | protected function sortGuardsByPriority()
{
usort($this->guards, function (GuardInterface $a, GuardInterface $b) {
return $b->getPriority() - $a->getPriority();
});
} | php | protected function sortGuardsByPriority()
{
usort($this->guards, function (GuardInterface $a, GuardInterface $b) {
return $b->getPriority() - $a->getPriority();
});
} | [
"protected",
"function",
"sortGuardsByPriority",
"(",
")",
"{",
"usort",
"(",
"$",
"this",
"->",
"guards",
",",
"function",
"(",
"GuardInterface",
"$",
"a",
",",
"GuardInterface",
"$",
"b",
")",
"{",
"return",
"$",
"b",
"->",
"getPriority",
"(",
")",
"-"... | Sort the guards list internally
@return void | [
"Sort",
"the",
"guards",
"list",
"internally"
] | 4ecaafe2bfcf1d2a66ae582d6d7af4830ec51653 | https://github.com/dotkernel/dot-rbac-guard/blob/4ecaafe2bfcf1d2a66ae582d6d7af4830ec51653/src/Provider/ArrayGuardsProvider.php#L68-L73 |
23,526 | heidelpay/PhpDoc | src/phpDocumentor/Plugin/Twig/Extension.php | Extension.getFilters | public function getFilters()
{
$parser = \Parsedown::instance();
$translator = $this->translator;
$routeRenderer = $this->routeRenderer;
return array(
'markdown' => new \Twig_SimpleFilter(
'markdown',
function ($value) use ($parser) {
... | php | public function getFilters()
{
$parser = \Parsedown::instance();
$translator = $this->translator;
$routeRenderer = $this->routeRenderer;
return array(
'markdown' => new \Twig_SimpleFilter(
'markdown',
function ($value) use ($parser) {
... | [
"public",
"function",
"getFilters",
"(",
")",
"{",
"$",
"parser",
"=",
"\\",
"Parsedown",
"::",
"instance",
"(",
")",
";",
"$",
"translator",
"=",
"$",
"this",
"->",
"translator",
";",
"$",
"routeRenderer",
"=",
"$",
"this",
"->",
"routeRenderer",
";",
... | Returns a list of all filters that are exposed by this extension.
@return \Twig_SimpleFilter[] | [
"Returns",
"a",
"list",
"of",
"all",
"filters",
"that",
"are",
"exposed",
"by",
"this",
"extension",
"."
] | 5ac9e842cbd4cbb70900533b240c131f3515ee02 | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Twig/Extension.php#L166-L222 |
23,527 | cakebake/yii2-scalable-behavior | ScalableBehavior.php | ScalableBehavior.virtualToScalable | public function virtualToScalable($event)
{
if (($this->scalableAttributeName() !== null) &&
($this->virtualAttributesNames() !== null)) {
$data = [];
foreach ($this->virtualAttributesNames() as $name) {
if (!empty($this->owner->{$name})) {
... | php | public function virtualToScalable($event)
{
if (($this->scalableAttributeName() !== null) &&
($this->virtualAttributesNames() !== null)) {
$data = [];
foreach ($this->virtualAttributesNames() as $name) {
if (!empty($this->owner->{$name})) {
... | [
"public",
"function",
"virtualToScalable",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"scalableAttributeName",
"(",
")",
"!==",
"null",
")",
"&&",
"(",
"$",
"this",
"->",
"virtualAttributesNames",
"(",
")",
"!==",
"null",
")",
")",
... | Converts configured attributes before saving them to database
@param mixed $event | [
"Converts",
"configured",
"attributes",
"before",
"saving",
"them",
"to",
"database"
] | 4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb | https://github.com/cakebake/yii2-scalable-behavior/blob/4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb/ScalableBehavior.php#L68-L82 |
23,528 | cakebake/yii2-scalable-behavior | ScalableBehavior.php | ScalableBehavior.scalableToVirtual | public function scalableToVirtual($event = null)
{
if (($this->scalableAttributeName() !== null) &&
($this->virtualAttributesNames() !== null)) {
$virtualAttributesConf = [];
foreach ($this->virtualAttributesNames() as $name) {
$virtualAttributesConf[$name] =... | php | public function scalableToVirtual($event = null)
{
if (($this->scalableAttributeName() !== null) &&
($this->virtualAttributesNames() !== null)) {
$virtualAttributesConf = [];
foreach ($this->virtualAttributesNames() as $name) {
$virtualAttributesConf[$name] =... | [
"public",
"function",
"scalableToVirtual",
"(",
"$",
"event",
"=",
"null",
")",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"scalableAttributeName",
"(",
")",
"!==",
"null",
")",
"&&",
"(",
"$",
"this",
"->",
"virtualAttributesNames",
"(",
")",
"!==",
"null"... | Checks if the defined attributes are unserializeable and unserializes their values
@param mixed $event | [
"Checks",
"if",
"the",
"defined",
"attributes",
"are",
"unserializeable",
"and",
"unserializes",
"their",
"values"
] | 4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb | https://github.com/cakebake/yii2-scalable-behavior/blob/4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb/ScalableBehavior.php#L90-L111 |
23,529 | cakebake/yii2-scalable-behavior | ScalableBehavior.php | ScalableBehavior.convert | public function convert($data)
{
if (empty($data) || ($out = @serialize($data)) === false)
return null;
return $out;
} | php | public function convert($data)
{
if (empty($data) || ($out = @serialize($data)) === false)
return null;
return $out;
} | [
"public",
"function",
"convert",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
"||",
"(",
"$",
"out",
"=",
"@",
"serialize",
"(",
"$",
"data",
")",
")",
"===",
"false",
")",
"return",
"null",
";",
"return",
"$",
"out",
... | Converts some input to a serialized string
@param mixed $data Input as an array, String, Object, and so on
@return null|string null at fault, string on success | [
"Converts",
"some",
"input",
"to",
"a",
"serialized",
"string"
] | 4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb | https://github.com/cakebake/yii2-scalable-behavior/blob/4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb/ScalableBehavior.php#L119-L125 |
23,530 | cakebake/yii2-scalable-behavior | ScalableBehavior.php | ScalableBehavior.unConvert | public function unConvert($data)
{
if (empty($data) || !is_string($data) || ($out = @unserialize($data)) === false)
return null;
if (!is_array($out) || empty($out))
return null;
return $out;
} | php | public function unConvert($data)
{
if (empty($data) || !is_string($data) || ($out = @unserialize($data)) === false)
return null;
if (!is_array($out) || empty($out))
return null;
return $out;
} | [
"public",
"function",
"unConvert",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
"||",
"!",
"is_string",
"(",
"$",
"data",
")",
"||",
"(",
"$",
"out",
"=",
"@",
"unserialize",
"(",
"$",
"data",
")",
")",
"===",
"false",
... | Unconverts a serialized string into an array
@param string $data Serialized string to convert
@return null|array null at fault, array on success | [
"Unconverts",
"a",
"serialized",
"string",
"into",
"an",
"array"
] | 4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb | https://github.com/cakebake/yii2-scalable-behavior/blob/4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb/ScalableBehavior.php#L133-L142 |
23,531 | cakebake/yii2-scalable-behavior | ScalableBehavior.php | ScalableBehavior.scalableAttributeName | public function scalableAttributeName()
{
if ($this->_scalableAttribute !== null)
return $this->_scalableAttribute;
if (in_array((string)$this->scalableAttribute, $this->objAttributesNames()))
return $this->_scalableAttribute = $this->scalableAttribute;
return null;... | php | public function scalableAttributeName()
{
if ($this->_scalableAttribute !== null)
return $this->_scalableAttribute;
if (in_array((string)$this->scalableAttribute, $this->objAttributesNames()))
return $this->_scalableAttribute = $this->scalableAttribute;
return null;... | [
"public",
"function",
"scalableAttributeName",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_scalableAttribute",
"!==",
"null",
")",
"return",
"$",
"this",
"->",
"_scalableAttribute",
";",
"if",
"(",
"in_array",
"(",
"(",
"string",
")",
"$",
"this",
"->",... | Verifies the configured scalable attribute
@return null|string | [
"Verifies",
"the",
"configured",
"scalable",
"attribute"
] | 4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb | https://github.com/cakebake/yii2-scalable-behavior/blob/4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb/ScalableBehavior.php#L153-L162 |
23,532 | cakebake/yii2-scalable-behavior | ScalableBehavior.php | ScalableBehavior.virtualAttributesNames | public function virtualAttributesNames()
{
if (!empty($this->_virtualAttributes))
return $this->_virtualAttributes;
if (!is_array($this->virtualAttributes) || empty($this->virtualAttributes))
return null;
$attributes = [];
foreach ($this->virtualAttributes a... | php | public function virtualAttributesNames()
{
if (!empty($this->_virtualAttributes))
return $this->_virtualAttributes;
if (!is_array($this->virtualAttributes) || empty($this->virtualAttributes))
return null;
$attributes = [];
foreach ($this->virtualAttributes a... | [
"public",
"function",
"virtualAttributesNames",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_virtualAttributes",
")",
")",
"return",
"$",
"this",
"->",
"_virtualAttributes",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"v... | Verifies the configured virtual attributes
@return mixed | [
"Verifies",
"the",
"configured",
"virtual",
"attributes"
] | 4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb | https://github.com/cakebake/yii2-scalable-behavior/blob/4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb/ScalableBehavior.php#L173-L189 |
23,533 | rhosocial/yii2-user | forms/LoginForm.php | LoginForm.validateId | public function validateId($attribute, $params)
{
foreach (Yii::$app->user->getLoginPriority() as $item) {
if ($item::validate($this->$attribute)) {
return;
}
}
$this->addError($attribute, Yii::t('user', 'Incorrect ID.'));
} | php | public function validateId($attribute, $params)
{
foreach (Yii::$app->user->getLoginPriority() as $item) {
if ($item::validate($this->$attribute)) {
return;
}
}
$this->addError($attribute, Yii::t('user', 'Incorrect ID.'));
} | [
"public",
"function",
"validateId",
"(",
"$",
"attribute",
",",
"$",
"params",
")",
"{",
"foreach",
"(",
"Yii",
"::",
"$",
"app",
"->",
"user",
"->",
"getLoginPriority",
"(",
")",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"item",
"::",
"validate",... | Validates the ID.
@param $attribute
@param $params | [
"Validates",
"the",
"ID",
"."
] | 96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/forms/LoginForm.php#L82-L90 |
23,534 | flextype-components/text | Text.php | Text.increment | public static function increment(string $str, int $first = 1, string $separator = '_') : string
{
preg_match('/(.+)'.$separator.'([0-9]+)$/', $str, $match);
return isset($match[2]) ? $match[1].$separator.($match[2] + 1) : $str.$separator.$first;
} | php | public static function increment(string $str, int $first = 1, string $separator = '_') : string
{
preg_match('/(.+)'.$separator.'([0-9]+)$/', $str, $match);
return isset($match[2]) ? $match[1].$separator.($match[2] + 1) : $str.$separator.$first;
} | [
"public",
"static",
"function",
"increment",
"(",
"string",
"$",
"str",
",",
"int",
"$",
"first",
"=",
"1",
",",
"string",
"$",
"separator",
"=",
"'_'",
")",
":",
"string",
"{",
"preg_match",
"(",
"'/(.+)'",
".",
"$",
"separator",
".",
"'([0-9]+)$/'",
... | Add's _1 to a string or increment the ending number to allow _2, _3, etc
$str = Text::increment($str);
@param string $str String to increment
@param int $first Start with
@param string $separator Separator
@return string | [
"Add",
"s",
"_1",
"to",
"a",
"string",
"or",
"increment",
"the",
"ending",
"number",
"to",
"allow",
"_2",
"_3",
"etc"
] | 8d707eec2dd9025cb17ae3b0c3e995e67580ece3 | https://github.com/flextype-components/text/blob/8d707eec2dd9025cb17ae3b0c3e995e67580ece3/Text.php#L239-L244 |
23,535 | flextype-components/text | Text.php | Text.safeString | public static function safeString(string $str, string $delimiter = '-', bool $lowercase = false) : string
{
// Remove tags
$str = filter_var($str, FILTER_SANITIZE_STRING);
// Decode all entities to their simpler forms
$str = html_entity_decode($str, ENT_QUOTES, 'UTF-8');
//... | php | public static function safeString(string $str, string $delimiter = '-', bool $lowercase = false) : string
{
// Remove tags
$str = filter_var($str, FILTER_SANITIZE_STRING);
// Decode all entities to their simpler forms
$str = html_entity_decode($str, ENT_QUOTES, 'UTF-8');
//... | [
"public",
"static",
"function",
"safeString",
"(",
"string",
"$",
"str",
",",
"string",
"$",
"delimiter",
"=",
"'-'",
",",
"bool",
"$",
"lowercase",
"=",
"false",
")",
":",
"string",
"{",
"// Remove tags",
"$",
"str",
"=",
"filter_var",
"(",
"$",
"str",
... | Create safe string. Use to create safe usernames or filenames.
$safe_string = Text::safeString('hello world');
@param string $str String
@param string $delimiter String delimiter
@param boolean $lowercase String Lowercase
@return string | [
"Create",
"safe",
"string",
".",
"Use",
"to",
"create",
"safe",
"usernames",
"or",
"filenames",
"."
] | 8d707eec2dd9025cb17ae3b0c3e995e67580ece3 | https://github.com/flextype-components/text/blob/8d707eec2dd9025cb17ae3b0c3e995e67580ece3/Text.php#L418-L459 |
23,536 | philiplb/Valdi | src/Valdi/Validator/Contains.php | Contains.adjustCaseInsensitive | protected function adjustCaseInsensitive(&$value, &$parameters) {
$parameterAmount = count($parameters);
if ($parameterAmount == 1 || $parameterAmount > 1 && $parameters[1]) {
$parameters[0] = strtolower($parameters[0]);
$value = strtolower($value);
}
} | php | protected function adjustCaseInsensitive(&$value, &$parameters) {
$parameterAmount = count($parameters);
if ($parameterAmount == 1 || $parameterAmount > 1 && $parameters[1]) {
$parameters[0] = strtolower($parameters[0]);
$value = strtolower($value);
}
} | [
"protected",
"function",
"adjustCaseInsensitive",
"(",
"&",
"$",
"value",
",",
"&",
"$",
"parameters",
")",
"{",
"$",
"parameterAmount",
"=",
"count",
"(",
"$",
"parameters",
")",
";",
"if",
"(",
"$",
"parameterAmount",
"==",
"1",
"||",
"$",
"parameterAmou... | Adjusts value and parameters to be case insensitive if the second
parameter says so or is not given.
@param mixed $value
the value to validate
@param array $parameters
the other parameters the validator need | [
"Adjusts",
"value",
"and",
"parameters",
"to",
"be",
"case",
"insensitive",
"if",
"the",
"second",
"parameter",
"says",
"so",
"or",
"is",
"not",
"given",
"."
] | 9927ec34a2cb00cec705e952d3c2374e2dc3c972 | https://github.com/philiplb/Valdi/blob/9927ec34a2cb00cec705e952d3c2374e2dc3c972/src/Valdi/Validator/Contains.php#L47-L53 |
23,537 | david-mk/mail-map | src/MailMap/Query.php | Query.get | public function get(ConnectionContract $connection, MailFactoryContract $factory)
{
$uids = $connection->search($this->parseSearch());
$stream = $connection->getStream();
$max = $this->limit > 0 ? $this->limit : self::$max;
$uids = array_slice($uids, 0, $max);
return array_... | php | public function get(ConnectionContract $connection, MailFactoryContract $factory)
{
$uids = $connection->search($this->parseSearch());
$stream = $connection->getStream();
$max = $this->limit > 0 ? $this->limit : self::$max;
$uids = array_slice($uids, 0, $max);
return array_... | [
"public",
"function",
"get",
"(",
"ConnectionContract",
"$",
"connection",
",",
"MailFactoryContract",
"$",
"factory",
")",
"{",
"$",
"uids",
"=",
"$",
"connection",
"->",
"search",
"(",
"$",
"this",
"->",
"parseSearch",
"(",
")",
")",
";",
"$",
"stream",
... | Execute search query on connection and put
results into Mail wrappers using factory
@param \MailMap\Contracts\Connection $connection
@param \MailMap\Contracts\MailFactory $factory
@return array List of Mail wrappers | [
"Execute",
"search",
"query",
"on",
"connection",
"and",
"put",
"results",
"into",
"Mail",
"wrappers",
"using",
"factory"
] | 4eea346ece9fa35c0d309b5a909f657ad83e1e6a | https://github.com/david-mk/mail-map/blob/4eea346ece9fa35c0d309b5a909f657ad83e1e6a/src/MailMap/Query.php#L108-L119 |
23,538 | david-mk/mail-map | src/MailMap/Query.php | Query.where | public function where($flag, $value = null)
{
if (!in_array(strtolower($flag), static::$searchCriteria)) {
throw new InvalidArgumentException("Invalid where criteria '{$flag}'");
}
$this->where[$flag] = $value;
return $this;
} | php | public function where($flag, $value = null)
{
if (!in_array(strtolower($flag), static::$searchCriteria)) {
throw new InvalidArgumentException("Invalid where criteria '{$flag}'");
}
$this->where[$flag] = $value;
return $this;
} | [
"public",
"function",
"where",
"(",
"$",
"flag",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"strtolower",
"(",
"$",
"flag",
")",
",",
"static",
"::",
"$",
"searchCriteria",
")",
")",
"{",
"throw",
"new",
"InvalidArgume... | Set where condition.
@param string $flag
@param string $value
@return $this | [
"Set",
"where",
"condition",
"."
] | 4eea346ece9fa35c0d309b5a909f657ad83e1e6a | https://github.com/david-mk/mail-map/blob/4eea346ece9fa35c0d309b5a909f657ad83e1e6a/src/MailMap/Query.php#L140-L148 |
23,539 | david-mk/mail-map | src/MailMap/Query.php | Query.order | public function order($orderFlag, $dir = 'desc')
{
if (!in_array($orderFlag, static::$orderCriteria)) {
throw new InvalidArgumentException("Invalid order criteria '{$orderFlag}'");
}
$this->order = $orderFlag;
$this->orderDir = strtolower($dir) === 'asc' ? 0 : 1;
... | php | public function order($orderFlag, $dir = 'desc')
{
if (!in_array($orderFlag, static::$orderCriteria)) {
throw new InvalidArgumentException("Invalid order criteria '{$orderFlag}'");
}
$this->order = $orderFlag;
$this->orderDir = strtolower($dir) === 'asc' ? 0 : 1;
... | [
"public",
"function",
"order",
"(",
"$",
"orderFlag",
",",
"$",
"dir",
"=",
"'desc'",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"orderFlag",
",",
"static",
"::",
"$",
"orderCriteria",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
... | Set sorting order.
imap_sort only allows one sort condition http://php.net/manual/en/function.imap-sort.php
Calling again will overwrite previous
@param int $orderFlag
@param string $dir
@return $this | [
"Set",
"sorting",
"order",
"."
] | 4eea346ece9fa35c0d309b5a909f657ad83e1e6a | https://github.com/david-mk/mail-map/blob/4eea346ece9fa35c0d309b5a909f657ad83e1e6a/src/MailMap/Query.php#L160-L170 |
23,540 | david-mk/mail-map | src/MailMap/Query.php | Query.parseSearch | protected function parseSearch()
{
return implode(' ', array_map(function ($key, $val) {
if (is_null($val)) {
return strtoupper($key);
}
return sprintf('%s %s', strtoupper($key), $val);
}, array_keys($this->where), array_values($this->where)));
... | php | protected function parseSearch()
{
return implode(' ', array_map(function ($key, $val) {
if (is_null($val)) {
return strtoupper($key);
}
return sprintf('%s %s', strtoupper($key), $val);
}, array_keys($this->where), array_values($this->where)));
... | [
"protected",
"function",
"parseSearch",
"(",
")",
"{",
"return",
"implode",
"(",
"' '",
",",
"array_map",
"(",
"function",
"(",
"$",
"key",
",",
"$",
"val",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"val",
")",
")",
"{",
"return",
"strtoupper",
"(",
... | Parse the 'where' conditions for imap_search
@return string | [
"Parse",
"the",
"where",
"conditions",
"for",
"imap_search"
] | 4eea346ece9fa35c0d309b5a909f657ad83e1e6a | https://github.com/david-mk/mail-map/blob/4eea346ece9fa35c0d309b5a909f657ad83e1e6a/src/MailMap/Query.php#L177-L185 |
23,541 | bpolaszek/simple-dbal | src/Model/Adapter/Mysqli/Statement.php | Statement.toScalar | protected function toScalar($value)
{
if (is_scalar($value)) {
return $value;
} elseif (null === $value) {
return 'NULL';
} else {
if (is_object($value)) {
if (is_callable([$value, '__toString'])) {
return (string) $valu... | php | protected function toScalar($value)
{
if (is_scalar($value)) {
return $value;
} elseif (null === $value) {
return 'NULL';
} else {
if (is_object($value)) {
if (is_callable([$value, '__toString'])) {
return (string) $valu... | [
"protected",
"function",
"toScalar",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_scalar",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"value",
";",
"}",
"elseif",
"(",
"null",
"===",
"$",
"value",
")",
"{",
"return",
"'NULL'",
";",
"}",
"else"... | Attempt to convert non-scalar values.
@param $value
@return string | [
"Attempt",
"to",
"convert",
"non",
"-",
"scalar",
"values",
"."
] | 52cb50d326ba5854191814b470f5e84950ebb6e6 | https://github.com/bpolaszek/simple-dbal/blob/52cb50d326ba5854191814b470f5e84950ebb6e6/src/Model/Adapter/Mysqli/Statement.php#L136-L155 |
23,542 | blast-project/BaseEntitiesBundle | src/EventListener/SortableListener.php | SortableListener.prePersist | public function prePersist(EventArgs $args)
{
$em = $args->getEntityManager();
$object = $args->getObject();
$class = get_class($object);
$meta = $em->getClassMetadata($class);
$reflectionClass = $meta->getReflectionClass();
if (!$reflectionClass || !$this->hasTrait... | php | public function prePersist(EventArgs $args)
{
$em = $args->getEntityManager();
$object = $args->getObject();
$class = get_class($object);
$meta = $em->getClassMetadata($class);
$reflectionClass = $meta->getReflectionClass();
if (!$reflectionClass || !$this->hasTrait... | [
"public",
"function",
"prePersist",
"(",
"EventArgs",
"$",
"args",
")",
"{",
"$",
"em",
"=",
"$",
"args",
"->",
"getEntityManager",
"(",
")",
";",
"$",
"object",
"=",
"$",
"args",
"->",
"getObject",
"(",
")",
";",
"$",
"class",
"=",
"get_class",
"(",... | Compute sortRank for entities that are created.
@param EventArgs $args | [
"Compute",
"sortRank",
"for",
"entities",
"that",
"are",
"created",
"."
] | abd06891fc38922225ab7e4fcb437a286ba2c0c4 | https://github.com/blast-project/BaseEntitiesBundle/blob/abd06891fc38922225ab7e4fcb437a286ba2c0c4/src/EventListener/SortableListener.php#L85-L107 |
23,543 | odiaseo/pagebuilder | src/PageBuilder/Model/ResourceModel.php | ResourceModel.getGenericResources | public function getGenericResources($limit = 10, $mode = AbstractQuery::HYDRATE_OBJECT)
{
$builder = $this->getEntityManager()->createQueryBuilder();
$builder->select('e')
->from($this->getEntity(), 'e')
->where('e.isGeneric = 1')
->setMaxResults($limit);
... | php | public function getGenericResources($limit = 10, $mode = AbstractQuery::HYDRATE_OBJECT)
{
$builder = $this->getEntityManager()->createQueryBuilder();
$builder->select('e')
->from($this->getEntity(), 'e')
->where('e.isGeneric = 1')
->setMaxResults($limit);
... | [
"public",
"function",
"getGenericResources",
"(",
"$",
"limit",
"=",
"10",
",",
"$",
"mode",
"=",
"AbstractQuery",
"::",
"HYDRATE_OBJECT",
")",
"{",
"$",
"builder",
"=",
"$",
"this",
"->",
"getEntityManager",
"(",
")",
"->",
"createQueryBuilder",
"(",
")",
... | List Generic Resources
@param int $limit
@param int $mode
@return mixed | [
"List",
"Generic",
"Resources"
] | 88ef7cccf305368561307efe4ca07fac8e5774f3 | https://github.com/odiaseo/pagebuilder/blob/88ef7cccf305368561307efe4ca07fac8e5774f3/src/PageBuilder/Model/ResourceModel.php#L26-L38 |
23,544 | thecodingmachine/mvc.splash-common | src/Mouf/Mvc/Splash/Routers/ExceptionRouter.php | ExceptionRouter.handleException | private function handleException(\Throwable $t, Request $request)
{
if ($this->log !== null) {
$this->log->error('Exception thrown inside a controller.', array(
'exception' => $t,
));
} else {
// If no logger is set, let's log in PHP error_log
... | php | private function handleException(\Throwable $t, Request $request)
{
if ($this->log !== null) {
$this->log->error('Exception thrown inside a controller.', array(
'exception' => $t,
));
} else {
// If no logger is set, let's log in PHP error_log
... | [
"private",
"function",
"handleException",
"(",
"\\",
"Throwable",
"$",
"t",
",",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"log",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"log",
"->",
"error",
"(",
"'Exception thrown inside a ... | Actually handle the exception.
@param \Throwable $t
@param Request $request
@return ResponseInterface | [
"Actually",
"handle",
"the",
"exception",
"."
] | eed0269ceda4d7d090a330a220490906a7aa60bd | https://github.com/thecodingmachine/mvc.splash-common/blob/eed0269ceda4d7d090a330a220490906a7aa60bd/src/Mouf/Mvc/Splash/Routers/ExceptionRouter.php#L55-L73 |
23,545 | alevilar/ristorantino-vendor | Mesa/Controller/MesasController.php | MesasController.cerrarMesa | public function cerrarMesa ( $mesa_id, $imprimir_ticket = true) {
$this->Mesa->id = $mesa_id;
if( !$this->Mesa->cerrar_mesa() ) {
if( !$this->request->is('ajax') ){
$this->setFlash('Error al cerrar la mesa', 'flash_error');
}
}
... | php | public function cerrarMesa ( $mesa_id, $imprimir_ticket = true) {
$this->Mesa->id = $mesa_id;
if( !$this->Mesa->cerrar_mesa() ) {
if( !$this->request->is('ajax') ){
$this->setFlash('Error al cerrar la mesa', 'flash_error');
}
}
... | [
"public",
"function",
"cerrarMesa",
"(",
"$",
"mesa_id",
",",
"$",
"imprimir_ticket",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"Mesa",
"->",
"id",
"=",
"$",
"mesa_id",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"Mesa",
"->",
"cerrar_mesa",
"(",
")",
... | Cierra la mesa, calculando el total y, si se lo indica,
imprime el ticket fiscal.
@param type $mesa_id
@param type $imprimir_ticket
@return type | [
"Cierra",
"la",
"mesa",
"calculando",
"el",
"total",
"y",
"si",
"se",
"lo",
"indica",
"imprime",
"el",
"ticket",
"fiscal",
"."
] | 6b91a1e20cc0ba09a1968d77e3de6512cfa2d966 | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Mesa/Controller/MesasController.php#L128-L140 |
23,546 | webandco/neos-wireframe | Classes/ViewHelpers/RenderBoxViewHelper.php | RenderBoxViewHelper.render | public function render($mode, $node) {
return ($mode > 0 || $node->hasProperty('renderBox') == false || $node->getProperty('renderBox') === null || $node->getProperty('renderBox') === true) ? true : false;
} | php | public function render($mode, $node) {
return ($mode > 0 || $node->hasProperty('renderBox') == false || $node->getProperty('renderBox') === null || $node->getProperty('renderBox') === true) ? true : false;
} | [
"public",
"function",
"render",
"(",
"$",
"mode",
",",
"$",
"node",
")",
"{",
"return",
"(",
"$",
"mode",
">",
"0",
"||",
"$",
"node",
"->",
"hasProperty",
"(",
"'renderBox'",
")",
"==",
"false",
"||",
"$",
"node",
"->",
"getProperty",
"(",
"'renderB... | Decide if box should be rendered or not based on renderMode and node properties
@param integer $mode Value to check
@param NodeInterface $node
@return boolean | [
"Decide",
"if",
"box",
"should",
"be",
"rendered",
"or",
"not",
"based",
"on",
"renderMode",
"and",
"node",
"properties"
] | b1dfd9bedee80001a9a0cf0f483d0261633d12cb | https://github.com/webandco/neos-wireframe/blob/b1dfd9bedee80001a9a0cf0f483d0261633d12cb/Classes/ViewHelpers/RenderBoxViewHelper.php#L19-L21 |
23,547 | GrupaZero/api | src/Gzero/Api/Transformer/RoleTransformer.php | RoleTransformer.transform | public function transform($role)
{
$role = $this->entityToArray(Role::class, $role);
return [
'id' => (int) $role['id'],
'name' => $role['name'],
'createdAt' => $role['created_at'],
'updatedAt' => $role['updated_at']
];
} | php | public function transform($role)
{
$role = $this->entityToArray(Role::class, $role);
return [
'id' => (int) $role['id'],
'name' => $role['name'],
'createdAt' => $role['created_at'],
'updatedAt' => $role['updated_at']
];
} | [
"public",
"function",
"transform",
"(",
"$",
"role",
")",
"{",
"$",
"role",
"=",
"$",
"this",
"->",
"entityToArray",
"(",
"Role",
"::",
"class",
",",
"$",
"role",
")",
";",
"return",
"[",
"'id'",
"=>",
"(",
"int",
")",
"$",
"role",
"[",
"'id'",
"... | Transforms role entity
@param Role|array $role Role entity
@return array | [
"Transforms",
"role",
"entity"
] | fc544bb6057274e9d5e7b617346c3f854ea5effd | https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Transformer/RoleTransformer.php#L26-L35 |
23,548 | nathan-fiscaletti/extended-arrays | src/ExtendedArrays/IndexedArray.php | IndexedArray.offsetSet | public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->_args[count($this->_args)] = $value;
} else {
if (is_int($offset)) {
$this->_args[$offset] = $value;
} else {
throw new \Exception('Cannot set offset \''.$o... | php | public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->_args[count($this->_args)] = $value;
} else {
if (is_int($offset)) {
$this->_args[$offset] = $value;
} else {
throw new \Exception('Cannot set offset \''.$o... | [
"public",
"function",
"offsetSet",
"(",
"$",
"offset",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"offset",
")",
")",
"{",
"$",
"this",
"->",
"_args",
"[",
"count",
"(",
"$",
"this",
"->",
"_args",
")",
"]",
"=",
"$",
"value",
... | Override the offsetSet function to enforce
integral keys only.
@param mixed $offset
@param mixed $value
@throws \Exception | [
"Override",
"the",
"offsetSet",
"function",
"to",
"enforce",
"integral",
"keys",
"only",
"."
] | a641856115131f76417521d3e4aa2d951158050a | https://github.com/nathan-fiscaletti/extended-arrays/blob/a641856115131f76417521d3e4aa2d951158050a/src/ExtendedArrays/IndexedArray.php#L40-L51 |
23,549 | nathan-fiscaletti/extended-arrays | src/ExtendedArrays/IndexedArray.php | IndexedArray.offsetGet | public function offsetGet($offset)
{
if (isset($this->_args[$offset])) {
if (is_array($this->_args[$offset])) {
return new AssociativeArray($this->_args[$offset]);
} else {
return $this->_args[$offset];
}
} else {
throw ... | php | public function offsetGet($offset)
{
if (isset($this->_args[$offset])) {
if (is_array($this->_args[$offset])) {
return new AssociativeArray($this->_args[$offset]);
} else {
return $this->_args[$offset];
}
} else {
throw ... | [
"public",
"function",
"offsetGet",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_args",
"[",
"$",
"offset",
"]",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"_args",
"[",
"$",
"offset",
"]",
")",
... | Override the offsetGet function to throw
an undefined offset error when a key is
not found.
@param mixed $offset
@return mixed
@throws \Exception | [
"Override",
"the",
"offsetGet",
"function",
"to",
"throw",
"an",
"undefined",
"offset",
"error",
"when",
"a",
"key",
"is",
"not",
"found",
"."
] | a641856115131f76417521d3e4aa2d951158050a | https://github.com/nathan-fiscaletti/extended-arrays/blob/a641856115131f76417521d3e4aa2d951158050a/src/ExtendedArrays/IndexedArray.php#L63-L74 |
23,550 | nathan-fiscaletti/extended-arrays | src/ExtendedArrays/IndexedArray.php | IndexedArray.isPrefixedKey | private function isPrefixedKey($key)
{
if (strlen($key) > 1) {
if (substr($key, 0, 1) == '_') {
try {
intval(substr($key, 1, strlen($key) - 1));
return true;
} catch (\Exception $e) {
return false;
... | php | private function isPrefixedKey($key)
{
if (strlen($key) > 1) {
if (substr($key, 0, 1) == '_') {
try {
intval(substr($key, 1, strlen($key) - 1));
return true;
} catch (\Exception $e) {
return false;
... | [
"private",
"function",
"isPrefixedKey",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"key",
")",
">",
"1",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"key",
",",
"0",
",",
"1",
")",
"==",
"'_'",
")",
"{",
"try",
"{",
"intval",
"(",... | Check if a string is in the proper format
to be a prefixed integral array key.
@param string $key
@return bool | [
"Check",
"if",
"a",
"string",
"is",
"in",
"the",
"proper",
"format",
"to",
"be",
"a",
"prefixed",
"integral",
"array",
"key",
"."
] | a641856115131f76417521d3e4aa2d951158050a | https://github.com/nathan-fiscaletti/extended-arrays/blob/a641856115131f76417521d3e4aa2d951158050a/src/ExtendedArrays/IndexedArray.php#L183-L196 |
23,551 | mothership-ec/composer | src/Composer/Package/Locker.php | Locker.getPlatformRequirements | public function getPlatformRequirements($withDevReqs = false)
{
$lockData = $this->getLockData();
$versionParser = new VersionParser();
$requirements = array();
if (!empty($lockData['platform'])) {
$requirements = $versionParser->parseLinks(
'__ROOT__',
... | php | public function getPlatformRequirements($withDevReqs = false)
{
$lockData = $this->getLockData();
$versionParser = new VersionParser();
$requirements = array();
if (!empty($lockData['platform'])) {
$requirements = $versionParser->parseLinks(
'__ROOT__',
... | [
"public",
"function",
"getPlatformRequirements",
"(",
"$",
"withDevReqs",
"=",
"false",
")",
"{",
"$",
"lockData",
"=",
"$",
"this",
"->",
"getLockData",
"(",
")",
";",
"$",
"versionParser",
"=",
"new",
"VersionParser",
"(",
")",
";",
"$",
"requirements",
... | Returns the platform requirements stored in the lock file
@param bool $withDevReqs if true, the platform requirements from the require-dev block are also returned
@return \Composer\Package\Link[] | [
"Returns",
"the",
"platform",
"requirements",
"stored",
"in",
"the",
"lock",
"file"
] | fa6ad031a939d8d33b211e428fdbdd28cfce238c | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Package/Locker.php#L133-L160 |
23,552 | mothership-ec/composer | src/Composer/Package/Locker.php | Locker.setLockData | public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
{
$lock = array(
'_readme' => array('This file locks the dependencies of your projec... | php | public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
{
$lock = array(
'_readme' => array('This file locks the dependencies of your projec... | [
"public",
"function",
"setLockData",
"(",
"array",
"$",
"packages",
",",
"$",
"devPackages",
",",
"array",
"$",
"platformReqs",
",",
"$",
"platformDevReqs",
",",
"array",
"$",
"aliases",
",",
"$",
"minimumStability",
",",
"array",
"$",
"stabilityFlags",
",",
... | Locks provided data into lockfile.
@param array $packages array of packages
@param mixed $devPackages array of dev packages or null if installed without --dev
@param array $platformReqs array of package name => constraint for required platform packages
@param mixed $platformDevReqs array of p... | [
"Locks",
"provided",
"data",
"into",
"lockfile",
"."
] | fa6ad031a939d8d33b211e428fdbdd28cfce238c | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Package/Locker.php#L237-L291 |
23,553 | crysalead/storage-stream | src/Stream.php | Stream._initResource | protected function _initResource($config)
{
if (!empty($config['data']) && !empty($config['filename'])) {
throw new InvalidArgumentException("The `'data'` or `'filename'` option must be defined.");
}
if ($config['filename']) {
$this->_filename = $config['filename'];
... | php | protected function _initResource($config)
{
if (!empty($config['data']) && !empty($config['filename'])) {
throw new InvalidArgumentException("The `'data'` or `'filename'` option must be defined.");
}
if ($config['filename']) {
$this->_filename = $config['filename'];
... | [
"protected",
"function",
"_initResource",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"config",
"[",
"'data'",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"config",
"[",
"'filename'",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgum... | Init the stream resource.
@param array $config The constructor configuration array. | [
"Init",
"the",
"stream",
"resource",
"."
] | 8ec613b42a2dd5d7e951a118f61d6094fe97dd9b | https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/Stream.php#L140-L161 |
23,554 | crysalead/storage-stream | src/Stream.php | Stream.length | public function length()
{
if ($this->_limit !== null) {
return $this->_limit;
}
if ($this->_length !== null) {
return $this->_length;
}
if ($this->isSeekable()) {
$old = $this->tell();
$begin = $this->rewind();
$en... | php | public function length()
{
if ($this->_limit !== null) {
return $this->_limit;
}
if ($this->_length !== null) {
return $this->_length;
}
if ($this->isSeekable()) {
$old = $this->tell();
$begin = $this->rewind();
$en... | [
"public",
"function",
"length",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_limit",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_limit",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"_length",
"!==",
"null",
")",
"{",
"return",
"$",
"thi... | Get the stream range length. | [
"Get",
"the",
"stream",
"range",
"length",
"."
] | 8ec613b42a2dd5d7e951a118f61d6094fe97dd9b | https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/Stream.php#L213-L230 |
23,555 | crysalead/storage-stream | src/Stream.php | Stream.meta | public function meta($key = null)
{
if ($this->_resource === null && $this->_filename) {
$this->_resource = fopen($this->_filename, $this->_mode);
}
if (!$this->valid()) {
throw new RuntimeException('Invalid resource.');
}
$meta = stream_get_meta_data(... | php | public function meta($key = null)
{
if ($this->_resource === null && $this->_filename) {
$this->_resource = fopen($this->_filename, $this->_mode);
}
if (!$this->valid()) {
throw new RuntimeException('Invalid resource.');
}
$meta = stream_get_meta_data(... | [
"public",
"function",
"meta",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_resource",
"===",
"null",
"&&",
"$",
"this",
"->",
"_filename",
")",
"{",
"$",
"this",
"->",
"_resource",
"=",
"fopen",
"(",
"$",
"this",
"->",
... | Get stream meta data.
@param string $key A specific meta data or `null` to get all meta data.
Possibles values are:
`'uri'` _string_ : the URI/filename associated with this stream.
`'mode'` _string_ : the type of access required for this stream.
`'wrapper_type'` _string_ : the protocol wrapper implem... | [
"Get",
"stream",
"meta",
"data",
"."
] | 8ec613b42a2dd5d7e951a118f61d6094fe97dd9b | https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/Stream.php#L309-L323 |
23,556 | crysalead/storage-stream | src/Stream.php | Stream._ensureReadable | protected function _ensureReadable($bytePerByte = true)
{
if (!$this->valid()) {
throw new RuntimeException('Cannot read from a closed stream.');
}
if (!$this->isReadable()) {
$mode = $this->meta('mode');
throw new RuntimeException("Cannot read on a non-re... | php | protected function _ensureReadable($bytePerByte = true)
{
if (!$this->valid()) {
throw new RuntimeException('Cannot read from a closed stream.');
}
if (!$this->isReadable()) {
$mode = $this->meta('mode');
throw new RuntimeException("Cannot read on a non-re... | [
"protected",
"function",
"_ensureReadable",
"(",
"$",
"bytePerByte",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"valid",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Cannot read from a closed stream.'",
")",
";",
"}",
"if",
... | Throw an exception if a stream is not readable.
@param boolean $bytePerByte Check if the stream is readable byte per byte. | [
"Throw",
"an",
"exception",
"if",
"a",
"stream",
"is",
"not",
"readable",
"."
] | 8ec613b42a2dd5d7e951a118f61d6094fe97dd9b | https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/Stream.php#L351-L360 |
23,557 | crysalead/storage-stream | src/Stream.php | Stream._ensureWritable | protected function _ensureWritable()
{
if (!$this->valid()) {
throw new RuntimeException('Cannot write on a closed stream.');
}
if (!$this->isWritable()) {
$mode = $this->meta('mode');
throw new RuntimeException("Cannot write on a non-writable stream (mode... | php | protected function _ensureWritable()
{
if (!$this->valid()) {
throw new RuntimeException('Cannot write on a closed stream.');
}
if (!$this->isWritable()) {
$mode = $this->meta('mode');
throw new RuntimeException("Cannot write on a non-writable stream (mode... | [
"protected",
"function",
"_ensureWritable",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"valid",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Cannot write on a closed stream.'",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"i... | Throw an exception if a stream is not writable. | [
"Throw",
"an",
"exception",
"if",
"a",
"stream",
"is",
"not",
"writable",
"."
] | 8ec613b42a2dd5d7e951a118f61d6094fe97dd9b | https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/Stream.php#L376-L385 |
23,558 | crysalead/storage-stream | src/Stream.php | Stream._bufferSize | protected function _bufferSize($length)
{
if ($this->_limit !== null) {
$position = $this->tell();
$max = $this->_start + $this->_limit;
$length = $max - $position;
}
if ($length === null) {
$length = $this->_bufferSize;
}
retur... | php | protected function _bufferSize($length)
{
if ($this->_limit !== null) {
$position = $this->tell();
$max = $this->_start + $this->_limit;
$length = $max - $position;
}
if ($length === null) {
$length = $this->_bufferSize;
}
retur... | [
"protected",
"function",
"_bufferSize",
"(",
"$",
"length",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_limit",
"!==",
"null",
")",
"{",
"$",
"position",
"=",
"$",
"this",
"->",
"tell",
"(",
")",
";",
"$",
"max",
"=",
"$",
"this",
"->",
"_start",
"... | Determine the buffer size to read.
@param integer $length Maximum number of bytes to read (default to buffer size).
@return integer The allowed size. | [
"Determine",
"the",
"buffer",
"size",
"to",
"read",
"."
] | 8ec613b42a2dd5d7e951a118f61d6094fe97dd9b | https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/Stream.php#L448-L459 |
23,559 | crysalead/storage-stream | src/Stream.php | Stream.pipe | public function pipe($stream)
{
$offset = $stream->tell();
$result = stream_copy_to_stream($this->resource(), $stream->resource());
if ($stream->isSeekable()) {
$stream->seek($offset);
}
return $result;
} | php | public function pipe($stream)
{
$offset = $stream->tell();
$result = stream_copy_to_stream($this->resource(), $stream->resource());
if ($stream->isSeekable()) {
$stream->seek($offset);
}
return $result;
} | [
"public",
"function",
"pipe",
"(",
"$",
"stream",
")",
"{",
"$",
"offset",
"=",
"$",
"stream",
"->",
"tell",
"(",
")",
";",
"$",
"result",
"=",
"stream_copy_to_stream",
"(",
"$",
"this",
"->",
"resource",
"(",
")",
",",
"$",
"stream",
"->",
"resource... | Read the content of this stream and write it to another stream.
@param instance $stream The destination stream to write to
@return integer The number of copied bytes | [
"Read",
"the",
"content",
"of",
"this",
"stream",
"and",
"write",
"it",
"to",
"another",
"stream",
"."
] | 8ec613b42a2dd5d7e951a118f61d6094fe97dd9b | https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/Stream.php#L539-L547 |
23,560 | crysalead/storage-stream | src/Stream.php | Stream.seek | public function seek($offset, $whence = SEEK_SET)
{
if ($this->_filename === 'php://input' && $this->eof() && !$offset && $whence === SEEK_SET) {
$this->close();
$this->_resource = fopen($this->_filename, 'r');
}
$this->_ensureSeekable();
fseek($this->_resourc... | php | public function seek($offset, $whence = SEEK_SET)
{
if ($this->_filename === 'php://input' && $this->eof() && !$offset && $whence === SEEK_SET) {
$this->close();
$this->_resource = fopen($this->_filename, 'r');
}
$this->_ensureSeekable();
fseek($this->_resourc... | [
"public",
"function",
"seek",
"(",
"$",
"offset",
",",
"$",
"whence",
"=",
"SEEK_SET",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_filename",
"===",
"'php://input'",
"&&",
"$",
"this",
"->",
"eof",
"(",
")",
"&&",
"!",
"$",
"offset",
"&&",
"$",
"when... | Seek on the stream.
@param integer $offset The offset.
@param integer $whence Accepted values are:
- SEEK_SET - Set position equal to $offset bytes.
- SEEK_CUR - Set position to current location plus $offset.
- SEEK_END - Set position to end-of-file plus $offset. | [
"Seek",
"on",
"the",
"stream",
"."
] | 8ec613b42a2dd5d7e951a118f61d6094fe97dd9b | https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/Stream.php#L598-L607 |
23,561 | crysalead/storage-stream | src/Stream.php | Stream.valid | public function valid()
{
if ($this->_resource === null && $this->_filename) {
$this->_resource = fopen($this->_filename, $this->_mode);
}
return !!$this->_resource && is_resource($this->_resource);
} | php | public function valid()
{
if ($this->_resource === null && $this->_filename) {
$this->_resource = fopen($this->_filename, $this->_mode);
}
return !!$this->_resource && is_resource($this->_resource);
} | [
"public",
"function",
"valid",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_resource",
"===",
"null",
"&&",
"$",
"this",
"->",
"_filename",
")",
"{",
"$",
"this",
"->",
"_resource",
"=",
"fopen",
"(",
"$",
"this",
"->",
"_filename",
",",
"$",
"th... | Check if the stream is valid.
@return Boolean | [
"Check",
"if",
"the",
"stream",
"is",
"valid",
"."
] | 8ec613b42a2dd5d7e951a118f61d6094fe97dd9b | https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/Stream.php#L648-L654 |
23,562 | crysalead/storage-stream | src/Stream.php | Stream.getMime | public static function getMime($stream, $mime)
{
if (is_string($mime)) {
return $mime;
}
if (!$mime || !$stream->isSeekable() || !$stream->isReadable()) {
return;
}
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$old = $stream->tell();
$stre... | php | public static function getMime($stream, $mime)
{
if (is_string($mime)) {
return $mime;
}
if (!$mime || !$stream->isSeekable() || !$stream->isReadable()) {
return;
}
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$old = $stream->tell();
$stre... | [
"public",
"static",
"function",
"getMime",
"(",
"$",
"stream",
",",
"$",
"mime",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"mime",
")",
")",
"{",
"return",
"$",
"mime",
";",
"}",
"if",
"(",
"!",
"$",
"mime",
"||",
"!",
"$",
"stream",
"->",
"i... | Mime detector.
Concat the first 1024 bytes + the last 4 bytes of readable & seekable streams
to detext the mime info.
@param string $stream The stream to extract mime value from.
@param string $mime The mime type detection. Possible values are:
-`true` : auto detect the mime.
- a string : don't detect the mime an... | [
"Mime",
"detector",
".",
"Concat",
"the",
"first",
"1024",
"bytes",
"+",
"the",
"last",
"4",
"bytes",
"of",
"readable",
"&",
"seekable",
"streams",
"to",
"detext",
"the",
"mime",
"info",
"."
] | 8ec613b42a2dd5d7e951a118f61d6094fe97dd9b | https://github.com/crysalead/storage-stream/blob/8ec613b42a2dd5d7e951a118f61d6094fe97dd9b/src/Stream.php#L750-L778 |
23,563 | silvercommerce/geozones | src/Model/Zone.php | Zone.getCountriesArray | public function getCountriesArray()
{
$return = json_decode($this->Country);
if (empty($return) && isset($this->Country)) {
$return = [$this->Country];
}
return $return;
} | php | public function getCountriesArray()
{
$return = json_decode($this->Country);
if (empty($return) && isset($this->Country)) {
$return = [$this->Country];
}
return $return;
} | [
"public",
"function",
"getCountriesArray",
"(",
")",
"{",
"$",
"return",
"=",
"json_decode",
"(",
"$",
"this",
"->",
"Country",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"return",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"Country",
")",
")",
"{",
... | Return an array of all associated countries
@return array | [
"Return",
"an",
"array",
"of",
"all",
"associated",
"countries"
] | 85af587805ae5cc6dce6a890ca04b338cf5552cb | https://github.com/silvercommerce/geozones/blob/85af587805ae5cc6dce6a890ca04b338cf5552cb/src/Model/Zone.php#L71-L80 |
23,564 | ekuiter/feature-php | FeaturePhp/Generator/ChunkGenerator.php | ChunkGenerator.getSpecification | protected function getSpecification($file, $settings, $artifact) {
return fphp\Specification\ChunkSpecification::fromArrayAndSettings($file, $settings);
} | php | protected function getSpecification($file, $settings, $artifact) {
return fphp\Specification\ChunkSpecification::fromArrayAndSettings($file, $settings);
} | [
"protected",
"function",
"getSpecification",
"(",
"$",
"file",
",",
"$",
"settings",
",",
"$",
"artifact",
")",
"{",
"return",
"fphp",
"\\",
"Specification",
"\\",
"ChunkSpecification",
"::",
"fromArrayAndSettings",
"(",
"$",
"file",
",",
"$",
"settings",
")",... | Returns a chunk specification from a plain settings array.
@param array $file a plain settings array
@param Settings $settings the generator's settings
@param \FeaturePhp\Artifact\Artifact $artifact the currently processed artifact
@return \FeaturePhp\Specification\ChunkSpecification | [
"Returns",
"a",
"chunk",
"specification",
"from",
"a",
"plain",
"settings",
"array",
"."
] | daf4a59098802fedcfd1f1a1d07847fcf2fea7bf | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Generator/ChunkGenerator.php#L33-L35 |
23,565 | zhouyl/mellivora | Mellivora/Database/Query/Grammars/MySqlGrammar.php | MySqlGrammar.compileJsonUpdateColumn | protected function compileJsonUpdateColumn($key, JsonExpression $value)
{
$path = explode('->', $key);
$field = $this->wrapValue(array_shift($path));
$accessor = '"$.' . implode('.', $path) . '"';
return "{$field} = json_set({$field}, {$accessor}, {$value->getValue()})";
} | php | protected function compileJsonUpdateColumn($key, JsonExpression $value)
{
$path = explode('->', $key);
$field = $this->wrapValue(array_shift($path));
$accessor = '"$.' . implode('.', $path) . '"';
return "{$field} = json_set({$field}, {$accessor}, {$value->getValue()})";
} | [
"protected",
"function",
"compileJsonUpdateColumn",
"(",
"$",
"key",
",",
"JsonExpression",
"$",
"value",
")",
"{",
"$",
"path",
"=",
"explode",
"(",
"'->'",
",",
"$",
"key",
")",
";",
"$",
"field",
"=",
"$",
"this",
"->",
"wrapValue",
"(",
"array_shift"... | Prepares a JSON column being updated using the JSON_SET function.
@param string $key
@param \Mellivora\Database\Query\JsonExpression $value
@return string | [
"Prepares",
"a",
"JSON",
"column",
"being",
"updated",
"using",
"the",
"JSON_SET",
"function",
"."
] | 79f844c5c9c25ffbe18d142062e9bc3df00b36a1 | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Grammars/MySqlGrammar.php#L167-L176 |
23,566 | mothership-ec/composer | src/Composer/Package/Archiver/GitExcludeFilter.php | GitExcludeFilter.parseGitAttributesLine | public function parseGitAttributesLine($line)
{
$parts = preg_split('#\s+#', $line);
if (count($parts) != 2) {
return null;
}
if ($parts[1] === 'export-ignore') {
return $this->generatePattern($parts[0]);
}
} | php | public function parseGitAttributesLine($line)
{
$parts = preg_split('#\s+#', $line);
if (count($parts) != 2) {
return null;
}
if ($parts[1] === 'export-ignore') {
return $this->generatePattern($parts[0]);
}
} | [
"public",
"function",
"parseGitAttributesLine",
"(",
"$",
"line",
")",
"{",
"$",
"parts",
"=",
"preg_split",
"(",
"'#\\s+#'",
",",
"$",
"line",
")",
";",
"if",
"(",
"count",
"(",
"$",
"parts",
")",
"!=",
"2",
")",
"{",
"return",
"null",
";",
"}",
"... | Callback parser which finds export-ignore rules in git attribute lines
@param string $line A line from .gitattributes
@return array An exclude pattern for filter() | [
"Callback",
"parser",
"which",
"finds",
"export",
"-",
"ignore",
"rules",
"in",
"git",
"attribute",
"lines"
] | fa6ad031a939d8d33b211e428fdbdd28cfce238c | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Package/Archiver/GitExcludeFilter.php#L68-L79 |
23,567 | Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/file/file_set.php | ezcMailFileSet.hasData | public function hasData()
{
if ( count( $this->files ) >= 1 )
{
if ( $this->files[0] === 'php://stdin' || filesize( $this->files[0] ) > 0 )
{
return true;
}
}
return false;
} | php | public function hasData()
{
if ( count( $this->files ) >= 1 )
{
if ( $this->files[0] === 'php://stdin' || filesize( $this->files[0] ) > 0 )
{
return true;
}
}
return false;
} | [
"public",
"function",
"hasData",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"files",
")",
">=",
"1",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"files",
"[",
"0",
"]",
"===",
"'php://stdin'",
"||",
"filesize",
"(",
"$",
"this",
"->",... | Returns whether the file set contains files
@return bool | [
"Returns",
"whether",
"the",
"file",
"set",
"contains",
"files"
] | b0afc661105f0a2f65d49abac13956cc93c5188d | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/file/file_set.php#L90-L100 |
23,568 | Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/file/file_set.php | ezcMailFileSet.openFile | private function openFile( $isFirst = false )
{
// cleanup file pointer if needed
if ( $this->fp != null )
{
fclose( $this->fp );
$this->fp = null;
}
// open the new file
$file = $isFirst ? current( $this->files ) : next( $this->files );
... | php | private function openFile( $isFirst = false )
{
// cleanup file pointer if needed
if ( $this->fp != null )
{
fclose( $this->fp );
$this->fp = null;
}
// open the new file
$file = $isFirst ? current( $this->files ) : next( $this->files );
... | [
"private",
"function",
"openFile",
"(",
"$",
"isFirst",
"=",
"false",
")",
"{",
"// cleanup file pointer if needed",
"if",
"(",
"$",
"this",
"->",
"fp",
"!=",
"null",
")",
"{",
"fclose",
"(",
"$",
"this",
"->",
"fp",
")",
";",
"$",
"this",
"->",
"fp",
... | Opens the next file in the set and returns true on success.
@param bool $isFirst
@return bool | [
"Opens",
"the",
"next",
"file",
"in",
"the",
"set",
"and",
"returns",
"true",
"on",
"success",
"."
] | b0afc661105f0a2f65d49abac13956cc93c5188d | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/file/file_set.php#L159-L186 |
23,569 | joni-jones/yii2-heroku-logger | HerokuTarget.php | HerokuTarget.export | public function export()
{
$messages = implode("\n", array_map([$this, 'formatMessage'], $this->messages))."\n";
$stdout = fopen('php://stdout', 'w');
if ($stdout === false) {
throw new InvalidConfigException('Unable to open stdout stream');
}
fwrite($stdout, $mes... | php | public function export()
{
$messages = implode("\n", array_map([$this, 'formatMessage'], $this->messages))."\n";
$stdout = fopen('php://stdout', 'w');
if ($stdout === false) {
throw new InvalidConfigException('Unable to open stdout stream');
}
fwrite($stdout, $mes... | [
"public",
"function",
"export",
"(",
")",
"{",
"$",
"messages",
"=",
"implode",
"(",
"\"\\n\"",
",",
"array_map",
"(",
"[",
"$",
"this",
",",
"'formatMessage'",
"]",
",",
"$",
"this",
"->",
"messages",
")",
")",
".",
"\"\\n\"",
";",
"$",
"stdout",
"=... | Write yii logs to stdout
@access public
@return void | [
"Write",
"yii",
"logs",
"to",
"stdout"
] | 0a648cdd52941caae49c0e54ae65b8a7fc6b2db9 | https://github.com/joni-jones/yii2-heroku-logger/blob/0a648cdd52941caae49c0e54ae65b8a7fc6b2db9/HerokuTarget.php#L15-L24 |
23,570 | zicht/z | src/Zicht/Tool/Debug.php | Debug.enterScope | public static function enterScope($scope)
{
if (!is_scalar($scope)) {
throw new \InvalidArgumentException("Only scalars allowed as scope identifiers");
}
array_push(self::$scope, $scope);
list($call) = debug_backtrace(0);
array_push(self::$scopeChange, $call);
... | php | public static function enterScope($scope)
{
if (!is_scalar($scope)) {
throw new \InvalidArgumentException("Only scalars allowed as scope identifiers");
}
array_push(self::$scope, $scope);
list($call) = debug_backtrace(0);
array_push(self::$scopeChange, $call);
... | [
"public",
"static",
"function",
"enterScope",
"(",
"$",
"scope",
")",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"scope",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Only scalars allowed as scope identifiers\"",
")",
";",
"}",
"ar... | Keeps track of scope
@param string $scope
@return void | [
"Keeps",
"track",
"of",
"scope"
] | 6a1731dad20b018555a96b726a61d4bf8ec8c886 | https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Debug.php#L31-L39 |
23,571 | fdisotto/cac-api | src/fdisotto/CACApi.php | CACApi._make_power_operation | private function _make_power_operation($sid, $action) {
$data = $this->_data;
$data['sid'] = $sid;
$data['action'] = $action;
try {
return $this->_make_request(self::POWER_OP_URL, $data, 'POST');
} catch (\Exception $e) {
throw new \Exception('Something gone wrong', 0, $e);
}
return true;
} | php | private function _make_power_operation($sid, $action) {
$data = $this->_data;
$data['sid'] = $sid;
$data['action'] = $action;
try {
return $this->_make_request(self::POWER_OP_URL, $data, 'POST');
} catch (\Exception $e) {
throw new \Exception('Something gone wrong', 0, $e);
}
return true;
} | [
"private",
"function",
"_make_power_operation",
"(",
"$",
"sid",
",",
"$",
"action",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"_data",
";",
"$",
"data",
"[",
"'sid'",
"]",
"=",
"$",
"sid",
";",
"$",
"data",
"[",
"'action'",
"]",
"=",
"$",
"... | Perform the power operation on the server
@param int $sid Server ID
@param string $action poweron, poweroff, reset request
@return bool | [
"Perform",
"the",
"power",
"operation",
"on",
"the",
"server"
] | c5c7fce1a00dd35584d5ce7e78a41d54188163cc | https://github.com/fdisotto/cac-api/blob/c5c7fce1a00dd35584d5ce7e78a41d54188163cc/src/fdisotto/CACApi.php#L304-L317 |
23,572 | mothership-ec/composer | src/Composer/Util/StreamContextFactory.php | StreamContextFactory.fixHttpHeaderField | private static function fixHttpHeaderField($header)
{
if (!is_array($header)) {
$header = explode("\r\n", $header);
}
uasort($header, function ($el) {
return preg_match('{^content-type}i', $el) ? 1 : -1;
});
return $header;
} | php | private static function fixHttpHeaderField($header)
{
if (!is_array($header)) {
$header = explode("\r\n", $header);
}
uasort($header, function ($el) {
return preg_match('{^content-type}i', $el) ? 1 : -1;
});
return $header;
} | [
"private",
"static",
"function",
"fixHttpHeaderField",
"(",
"$",
"header",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"header",
")",
")",
"{",
"$",
"header",
"=",
"explode",
"(",
"\"\\r\\n\"",
",",
"$",
"header",
")",
";",
"}",
"uasort",
"(",
"$... | A bug in PHP prevents the headers from correctly being sent when a content-type header is present and
NOT at the end of the array
This method fixes the array by moving the content-type header to the end
@link https://bugs.php.net/bug.php?id=61548
@param $header
@return array | [
"A",
"bug",
"in",
"PHP",
"prevents",
"the",
"headers",
"from",
"correctly",
"being",
"sent",
"when",
"a",
"content",
"-",
"type",
"header",
"is",
"present",
"and",
"NOT",
"at",
"the",
"end",
"of",
"the",
"array"
] | fa6ad031a939d8d33b211e428fdbdd28cfce238c | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Util/StreamContextFactory.php#L143-L153 |
23,573 | nabab/bbn | src/bbn/appui/tasks.php | tasks.stop_track | public function stop_track($id_task, $message = false, $id_user = false){
$ok = false;
$now = time();
if (
($active_track = $this->get_active_track($id_user)) &&
($active_track['id_task'] === $id_task)
){
$ok = true;
if (
!empty($message) &&
!($id_note = $this->co... | php | public function stop_track($id_task, $message = false, $id_user = false){
$ok = false;
$now = time();
if (
($active_track = $this->get_active_track($id_user)) &&
($active_track['id_task'] === $id_task)
){
$ok = true;
if (
!empty($message) &&
!($id_note = $this->co... | [
"public",
"function",
"stop_track",
"(",
"$",
"id_task",
",",
"$",
"message",
"=",
"false",
",",
"$",
"id_user",
"=",
"false",
")",
"{",
"$",
"ok",
"=",
"false",
";",
"$",
"now",
"=",
"time",
"(",
")",
";",
"if",
"(",
"(",
"$",
"active_track",
"=... | Stops a track.
@param string $id_task The task's ID
@param boolean|string $message The message to attach to track (optional)
@param boolean|string $id_user The track's user. If you give 'false', it will use the current user
@return boolean | [
"Stops",
"a",
"track",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/tasks.php#L1113-L1140 |
23,574 | oroinc/OroLayoutComponent | HierarchyCollection.php | HierarchyCollection.getRootId | public function getRootId()
{
if (empty($this->hierarchy)) {
throw new Exception\LogicException('The root item does not exist.');
}
reset($this->hierarchy);
$id = key($this->hierarchy);
return $id;
} | php | public function getRootId()
{
if (empty($this->hierarchy)) {
throw new Exception\LogicException('The root item does not exist.');
}
reset($this->hierarchy);
$id = key($this->hierarchy);
return $id;
} | [
"public",
"function",
"getRootId",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"hierarchy",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"LogicException",
"(",
"'The root item does not exist.'",
")",
";",
"}",
"reset",
"(",
"$",
"this",... | Returns the identifier of the root item
@return string
@throws Exception\LogicException if the root item does not exist | [
"Returns",
"the",
"identifier",
"of",
"the",
"root",
"item"
] | 682a96672393d81c63728e47c4a4c3618c515be0 | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/HierarchyCollection.php#L41-L51 |
23,575 | oroinc/OroLayoutComponent | HierarchyCollection.php | HierarchyCollection.get | public function get(array $path)
{
$current = &$this->hierarchy;
foreach ($path as $childId) {
if (!isset($current[$childId])) {
return [];
}
$current = &$current[$childId];
}
return $current;
} | php | public function get(array $path)
{
$current = &$this->hierarchy;
foreach ($path as $childId) {
if (!isset($current[$childId])) {
return [];
}
$current = &$current[$childId];
}
return $current;
} | [
"public",
"function",
"get",
"(",
"array",
"$",
"path",
")",
"{",
"$",
"current",
"=",
"&",
"$",
"this",
"->",
"hierarchy",
";",
"foreach",
"(",
"$",
"path",
"as",
"$",
"childId",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"current",
"[",
"$",
... | Gets hierarchy by the path
@param string[] $path
@return array | [
"Gets",
"hierarchy",
"by",
"the",
"path"
] | 682a96672393d81c63728e47c4a4c3618c515be0 | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/HierarchyCollection.php#L60-L71 |
23,576 | oroinc/OroLayoutComponent | HierarchyCollection.php | HierarchyCollection.remove | public function remove(array $path)
{
$current = &$this->hierarchy;
$pathLength = count($path);
for ($i = 0; $i < $pathLength; $i++) {
if (!isset($current[$path[$i]])) {
break;
}
if ($i === $pathLength - 1) {
unset($curre... | php | public function remove(array $path)
{
$current = &$this->hierarchy;
$pathLength = count($path);
for ($i = 0; $i < $pathLength; $i++) {
if (!isset($current[$path[$i]])) {
break;
}
if ($i === $pathLength - 1) {
unset($curre... | [
"public",
"function",
"remove",
"(",
"array",
"$",
"path",
")",
"{",
"$",
"current",
"=",
"&",
"$",
"this",
"->",
"hierarchy",
";",
"$",
"pathLength",
"=",
"count",
"(",
"$",
"path",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",... | Removes the item from the hierarchy
@param string[] $path | [
"Removes",
"the",
"item",
"from",
"the",
"hierarchy"
] | 682a96672393d81c63728e47c4a4c3618c515be0 | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/HierarchyCollection.php#L180-L194 |
23,577 | SporkCode/Spork | src/View/Helper/Dojo.php | Dojo.createService | public function createService(ServiceLocatorInterface $viewHelperManager)
{
$serviceLocator = $viewHelperManager->getServiceLocator();
$config = $serviceLocator->has('config') ? $serviceLocator->get('config') : array();
if (isset($config['dojo'])) {
$this->config($config['dojo'])... | php | public function createService(ServiceLocatorInterface $viewHelperManager)
{
$serviceLocator = $viewHelperManager->getServiceLocator();
$config = $serviceLocator->has('config') ? $serviceLocator->get('config') : array();
if (isset($config['dojo'])) {
$this->config($config['dojo'])... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"viewHelperManager",
")",
"{",
"$",
"serviceLocator",
"=",
"$",
"viewHelperManager",
"->",
"getServiceLocator",
"(",
")",
";",
"$",
"config",
"=",
"$",
"serviceLocator",
"->",
"has",
"(",
... | Create and configure service
@see \Zend\ServiceManager\FactoryInterface::createService()
@param ServiceLocatorInterface $viewHelperManager
@return \Spork\View\Helper\Dojo | [
"Create",
"and",
"configure",
"service"
] | 7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a | https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/Dojo.php#L118-L133 |
23,578 | SporkCode/Spork | src/View/Helper/Dojo.php | Dojo.setDebug | public function setDebug($flag = true)
{
$this->debug = $this->getSession()->debug = (bool) $flag;
if (true == $this->debug) {
if (isset($this->options['debugOptions'])
&& is_array($this->options['debugOptions'])) {
$this->initializeOptions($this->opti... | php | public function setDebug($flag = true)
{
$this->debug = $this->getSession()->debug = (bool) $flag;
if (true == $this->debug) {
if (isset($this->options['debugOptions'])
&& is_array($this->options['debugOptions'])) {
$this->initializeOptions($this->opti... | [
"public",
"function",
"setDebug",
"(",
"$",
"flag",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"debug",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"debug",
"=",
"(",
"bool",
")",
"$",
"flag",
";",
"if",
"(",
"true",
"==",
"$",
"this",
... | Set debug flag
@param string $flag | [
"Set",
"debug",
"flag"
] | 7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a | https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/Dojo.php#L170-L181 |
23,579 | SporkCode/Spork | src/View/Helper/Dojo.php | Dojo.initialize | public function initialize()
{
if (true == $this->initialized) {
return;
}
$this->initialized = true;
if ($this->isEnabled()) {
$headScript = $this->getView()->plugin('headScript');
$headScript->prependFile($this->src);
... | php | public function initialize()
{
if (true == $this->initialized) {
return;
}
$this->initialized = true;
if ($this->isEnabled()) {
$headScript = $this->getView()->plugin('headScript');
$headScript->prependFile($this->src);
... | [
"public",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"true",
"==",
"$",
"this",
"->",
"initialized",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"initialized",
"=",
"true",
";",
"if",
"(",
"$",
"this",
"->",
"isEnabled",
"(",
")",
")"... | Add Dojo configuration to HeadScript. Should only be called once. | [
"Add",
"Dojo",
"configuration",
"to",
"HeadScript",
".",
"Should",
"only",
"be",
"called",
"once",
"."
] | 7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a | https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/Dojo.php#L330-L360 |
23,580 | mothership-ec/composer | src/Composer/Downloader/ArchiveDownloader.php | ArchiveDownloader.getFolderContent | private function getFolderContent($dir)
{
$finder = Finder::create()
->ignoreVCS(false)
->ignoreDotFiles(false)
->depth(0)
->in($dir);
return iterator_to_array($finder);
} | php | private function getFolderContent($dir)
{
$finder = Finder::create()
->ignoreVCS(false)
->ignoreDotFiles(false)
->depth(0)
->in($dir);
return iterator_to_array($finder);
} | [
"private",
"function",
"getFolderContent",
"(",
"$",
"dir",
")",
"{",
"$",
"finder",
"=",
"Finder",
"::",
"create",
"(",
")",
"->",
"ignoreVCS",
"(",
"false",
")",
"->",
"ignoreDotFiles",
"(",
"false",
")",
"->",
"depth",
"(",
"0",
")",
"->",
"in",
"... | Returns the folder content, excluding dotfiles
@param string $dir Directory
@return \SplFileInfo[] | [
"Returns",
"the",
"folder",
"content",
"excluding",
"dotfiles"
] | fa6ad031a939d8d33b211e428fdbdd28cfce238c | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Downloader/ArchiveDownloader.php#L143-L152 |
23,581 | c5labs/block-boilerplate | controller.php | Controller.import | public function import($page, $areaHandle, SimpleXMLElement $blockNode)
{
parent::import($page, $areaHandle, $blockNode);
} | php | public function import($page, $areaHandle, SimpleXMLElement $blockNode)
{
parent::import($page, $areaHandle, $blockNode);
} | [
"public",
"function",
"import",
"(",
"$",
"page",
",",
"$",
"areaHandle",
",",
"SimpleXMLElement",
"$",
"blockNode",
")",
"{",
"parent",
"::",
"import",
"(",
"$",
"page",
",",
"$",
"areaHandle",
",",
"$",
"blockNode",
")",
";",
"}"
] | Runs when a block is being imported.
@param Page $page
@param string $areaHandle
@param SimpleXMLElement $blockNode
@return void | [
"Runs",
"when",
"a",
"block",
"is",
"being",
"imported",
"."
] | ed011364db67d8e219fdb3e18ff3d3e87027b565 | https://github.com/c5labs/block-boilerplate/blob/ed011364db67d8e219fdb3e18ff3d3e87027b565/controller.php#L371-L374 |
23,582 | phootwork/lang | src/ArrayObject.php | ArrayObject.add | public function add($element, $index = null) {
if ($index === null) {
$this->array[$this->count()] = $element;
} else {
array_splice($this->array, $index, 0, $element);
}
return $this;
} | php | public function add($element, $index = null) {
if ($index === null) {
$this->array[$this->count()] = $element;
} else {
array_splice($this->array, $index, 0, $element);
}
return $this;
} | [
"public",
"function",
"add",
"(",
"$",
"element",
",",
"$",
"index",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"index",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"array",
"[",
"$",
"this",
"->",
"count",
"(",
")",
"]",
"=",
"$",
"element",
";",
... | Adds an element to that array
@param mixed $element
@param int $index
@return $this | [
"Adds",
"an",
"element",
"to",
"that",
"array"
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/ArrayObject.php#L100-L108 |
23,583 | phootwork/lang | src/ArrayObject.php | ArrayObject.doSort | protected function doSort(&$array, $cmp, callable $usort, callable $sort) {
if (is_callable($cmp)) {
$usort($array, $cmp);
} else if ($cmp instanceof Comparator) {
$usort($array, function ($a, $b) use ($cmp) {
return $cmp->compare($a, $b);
});
} else {
$sort($array);
}
} | php | protected function doSort(&$array, $cmp, callable $usort, callable $sort) {
if (is_callable($cmp)) {
$usort($array, $cmp);
} else if ($cmp instanceof Comparator) {
$usort($array, function ($a, $b) use ($cmp) {
return $cmp->compare($a, $b);
});
} else {
$sort($array);
}
} | [
"protected",
"function",
"doSort",
"(",
"&",
"$",
"array",
",",
"$",
"cmp",
",",
"callable",
"$",
"usort",
",",
"callable",
"$",
"sort",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"cmp",
")",
")",
"{",
"$",
"usort",
"(",
"$",
"array",
",",
"$"... | Internal sort function
@param array $array the array on which is operated on
@param Comparator|callable $cmp the compare function
@param callable $usort the sort function for user passed $cmd
@param callable $sort the default sort function | [
"Internal",
"sort",
"function"
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/ArrayObject.php#L264-L274 |
23,584 | phootwork/lang | src/ArrayObject.php | ArrayObject.find | public function find() {
if (func_num_args() == 1) {
$callback = func_get_arg(0);
} else {
$query = func_get_arg(0);
$callback = func_get_arg(1);
}
foreach ($this->array as $element) {
$return = func_num_args() == 1 ? $callback($element) : $callback($element, $query);
if ($return) {
return ... | php | public function find() {
if (func_num_args() == 1) {
$callback = func_get_arg(0);
} else {
$query = func_get_arg(0);
$callback = func_get_arg(1);
}
foreach ($this->array as $element) {
$return = func_num_args() == 1 ? $callback($element) : $callback($element, $query);
if ($return) {
return ... | [
"public",
"function",
"find",
"(",
")",
"{",
"if",
"(",
"func_num_args",
"(",
")",
"==",
"1",
")",
"{",
"$",
"callback",
"=",
"func_get_arg",
"(",
"0",
")",
";",
"}",
"else",
"{",
"$",
"query",
"=",
"func_get_arg",
"(",
"0",
")",
";",
"$",
"callb... | Searches the array with a given callback and returns the first element if found.
The callback function takes one or two parameters:
function ($element [, $query]) {}
The callback must return a boolean
@param mixed $query OPTIONAL the provided query
@param callable $callback the callback function
@return mixed|null ... | [
"Searches",
"the",
"array",
"with",
"a",
"given",
"callback",
"and",
"returns",
"the",
"first",
"element",
"if",
"found",
"."
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/ArrayObject.php#L382-L399 |
23,585 | phootwork/lang | src/ArrayObject.php | ArrayObject.findLast | public function findLast() {
if (func_num_args() == 1) {
$callback = func_get_arg(0);
} else {
$query = func_get_arg(0);
$callback = func_get_arg(1);
}
$reverse = array_reverse($this->array, true);
foreach ($reverse as $element) {
$return = func_num_args() == 1 ? $callback($element) : $callback($... | php | public function findLast() {
if (func_num_args() == 1) {
$callback = func_get_arg(0);
} else {
$query = func_get_arg(0);
$callback = func_get_arg(1);
}
$reverse = array_reverse($this->array, true);
foreach ($reverse as $element) {
$return = func_num_args() == 1 ? $callback($element) : $callback($... | [
"public",
"function",
"findLast",
"(",
")",
"{",
"if",
"(",
"func_num_args",
"(",
")",
"==",
"1",
")",
"{",
"$",
"callback",
"=",
"func_get_arg",
"(",
"0",
")",
";",
"}",
"else",
"{",
"$",
"query",
"=",
"func_get_arg",
"(",
"0",
")",
";",
"$",
"c... | Searches the array with a given callback and returns the last element if found.
The callback function takes one or two parameters:
function ($element [, $query]) {}
The callback must return a boolean
@param mixed $query OPTIONAL the provided query
@param callable $callback the callback function
@return mixed|null t... | [
"Searches",
"the",
"array",
"with",
"a",
"given",
"callback",
"and",
"returns",
"the",
"last",
"element",
"if",
"found",
"."
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/ArrayObject.php#L414-L432 |
23,586 | phootwork/lang | src/ArrayObject.php | ArrayObject.findAll | public function findAll() {
if (func_num_args() == 1) {
$callback = func_get_arg(0);
} else {
$query = func_get_arg(0);
$callback = func_get_arg(1);
}
$array = [];
foreach ($this->array as $k => $element) {
$return = func_num_args() == 1 ? $callback($element) : $callback($element, $query);
if... | php | public function findAll() {
if (func_num_args() == 1) {
$callback = func_get_arg(0);
} else {
$query = func_get_arg(0);
$callback = func_get_arg(1);
}
$array = [];
foreach ($this->array as $k => $element) {
$return = func_num_args() == 1 ? $callback($element) : $callback($element, $query);
if... | [
"public",
"function",
"findAll",
"(",
")",
"{",
"if",
"(",
"func_num_args",
"(",
")",
"==",
"1",
")",
"{",
"$",
"callback",
"=",
"func_get_arg",
"(",
"0",
")",
";",
"}",
"else",
"{",
"$",
"query",
"=",
"func_get_arg",
"(",
"0",
")",
";",
"$",
"ca... | Searches the array with a given callback and returns all matching elements.
The callback function takes one or two parameters:
function ($element [, $query]) {}
The callback must return a boolean
@param mixed $query OPTIONAL the provided query
@param callable $callback the callback function
@return mixed|null the f... | [
"Searches",
"the",
"array",
"with",
"a",
"given",
"callback",
"and",
"returns",
"all",
"matching",
"elements",
"."
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/ArrayObject.php#L447-L465 |
23,587 | nonzod/yii2-foundation | Widget.php | Widget.registerPlugin | protected function registerPlugin($name = '') {
$view = $this->getView();
//$id = $this->options['id'];
if ($this->clientOptions !== false) {
$options = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions);
$js = "$(document).foundation({ '$name' : { $options } });";
... | php | protected function registerPlugin($name = '') {
$view = $this->getView();
//$id = $this->options['id'];
if ($this->clientOptions !== false) {
$options = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions);
$js = "$(document).foundation({ '$name' : { $options } });";
... | [
"protected",
"function",
"registerPlugin",
"(",
"$",
"name",
"=",
"''",
")",
"{",
"$",
"view",
"=",
"$",
"this",
"->",
"getView",
"(",
")",
";",
"//$id = $this->options['id'];",
"if",
"(",
"$",
"this",
"->",
"clientOptions",
"!==",
"false",
")",
"{",
"$"... | Registers a specific Foundation plugin and call related methods
@param string $name the name of the Foundation plugin
@todo far caricare solo i js dei plugin in uso | [
"Registers",
"a",
"specific",
"Foundation",
"plugin",
"and",
"call",
"related",
"methods"
] | 5df93b8a39a73a7fade2f3189693fdb6625205d2 | https://github.com/nonzod/yii2-foundation/blob/5df93b8a39a73a7fade2f3189693fdb6625205d2/Widget.php#L51-L69 |
23,588 | oroinc/OroLayoutComponent | BlockOptionsResolver.php | BlockOptionsResolver.resolveOptions | public function resolveOptions($blockType, array $options = [])
{
$resolver = $this->getOptionResolver($blockType);
return $resolver->resolve($options);
} | php | public function resolveOptions($blockType, array $options = [])
{
$resolver = $this->getOptionResolver($blockType);
return $resolver->resolve($options);
} | [
"public",
"function",
"resolveOptions",
"(",
"$",
"blockType",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"resolver",
"=",
"$",
"this",
"->",
"getOptionResolver",
"(",
"$",
"blockType",
")",
";",
"return",
"$",
"resolver",
"->",
"resolve... | Returns the combination of the default options for the given block type and the passed options
@param string|BlockTypeInterface $blockType The block type name or instance of BlockTypeInterface
@param array $options The options
@return array A list of options and their values
@throws InvalidOpti... | [
"Returns",
"the",
"combination",
"of",
"the",
"default",
"options",
"for",
"the",
"given",
"block",
"type",
"and",
"the",
"passed",
"options"
] | 682a96672393d81c63728e47c4a4c3618c515be0 | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/BlockOptionsResolver.php#L34-L39 |
23,589 | mothership-ec/composer | src/Composer/Repository/FilesystemRepository.php | FilesystemRepository.write | public function write()
{
$data = array();
$dumper = new ArrayDumper();
foreach ($this->getCanonicalPackages() as $package) {
$data[] = $dumper->dump($package);
}
$this->file->write($data);
} | php | public function write()
{
$data = array();
$dumper = new ArrayDumper();
foreach ($this->getCanonicalPackages() as $package) {
$data[] = $dumper->dump($package);
}
$this->file->write($data);
} | [
"public",
"function",
"write",
"(",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"$",
"dumper",
"=",
"new",
"ArrayDumper",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getCanonicalPackages",
"(",
")",
"as",
"$",
"package",
")",
"{",
"$... | Writes writable repository. | [
"Writes",
"writable",
"repository",
"."
] | fa6ad031a939d8d33b211e428fdbdd28cfce238c | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Repository/FilesystemRepository.php#L76-L86 |
23,590 | leprephp/http-server | src/Server.php | Server.append | public function append($middleware, $priority = 0): Server
{
return $this->appendOnCondition(
$middleware,
$this->buildAlwaysTrue(),
$priority
);
} | php | public function append($middleware, $priority = 0): Server
{
return $this->appendOnCondition(
$middleware,
$this->buildAlwaysTrue(),
$priority
);
} | [
"public",
"function",
"append",
"(",
"$",
"middleware",
",",
"$",
"priority",
"=",
"0",
")",
":",
"Server",
"{",
"return",
"$",
"this",
"->",
"appendOnCondition",
"(",
"$",
"middleware",
",",
"$",
"this",
"->",
"buildAlwaysTrue",
"(",
")",
",",
"$",
"p... | Always adds a middleware to the stack.
The middleware will run in any case.
@param MiddlewareInterface|callable|array $middleware
@param int $priority
@return Server | [
"Always",
"adds",
"a",
"middleware",
"to",
"the",
"stack",
"."
] | 2e307c80986456f7c53248b792771cb13bb4234d | https://github.com/leprephp/http-server/blob/2e307c80986456f7c53248b792771cb13bb4234d/src/Server.php#L63-L70 |
23,591 | leprephp/http-server | src/Server.php | Server.appendOnPath | public function appendOnPath($middleware, string $path, $priority = 0): Server
{
return $this->appendOnCondition(
$middleware,
$this->buildPathCondition($path),
$priority
);
} | php | public function appendOnPath($middleware, string $path, $priority = 0): Server
{
return $this->appendOnCondition(
$middleware,
$this->buildPathCondition($path),
$priority
);
} | [
"public",
"function",
"appendOnPath",
"(",
"$",
"middleware",
",",
"string",
"$",
"path",
",",
"$",
"priority",
"=",
"0",
")",
":",
"Server",
"{",
"return",
"$",
"this",
"->",
"appendOnCondition",
"(",
"$",
"middleware",
",",
"$",
"this",
"->",
"buildPat... | Adds a middleware to the stack only if the request path matches.
The path must match exactly. If the "*" character is present, a comparison will be
made via regex. For example: the path '/api' matches only with request path '/api'.
But the path '/api/*' matches with all request paths that start with '/api/'.
The only... | [
"Adds",
"a",
"middleware",
"to",
"the",
"stack",
"only",
"if",
"the",
"request",
"path",
"matches",
"."
] | 2e307c80986456f7c53248b792771cb13bb4234d | https://github.com/leprephp/http-server/blob/2e307c80986456f7c53248b792771cb13bb4234d/src/Server.php#L90-L97 |
23,592 | leprephp/http-server | src/Server.php | Server.appendOnCondition | public function appendOnCondition($middleware, callable $condition, $priority = 0): Server
{
if (!is_array($middleware)) {
$middleware = [$middleware];
}
foreach ($middleware as $mw) {
$this->stack[$priority][] = [$condition, $mw];
}
return $this;
... | php | public function appendOnCondition($middleware, callable $condition, $priority = 0): Server
{
if (!is_array($middleware)) {
$middleware = [$middleware];
}
foreach ($middleware as $mw) {
$this->stack[$priority][] = [$condition, $mw];
}
return $this;
... | [
"public",
"function",
"appendOnCondition",
"(",
"$",
"middleware",
",",
"callable",
"$",
"condition",
",",
"$",
"priority",
"=",
"0",
")",
":",
"Server",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"middleware",
")",
")",
"{",
"$",
"middleware",
"=",
"[... | Adds a middleware to the stack only if the condition returns true.
The `$condition` parameter must be a callable and it will be called with the
`ServerRequestInterface` object as argument.
@param MiddlewareInterface|callable|array $middleware
@param callable $condition
@param int ... | [
"Adds",
"a",
"middleware",
"to",
"the",
"stack",
"only",
"if",
"the",
"condition",
"returns",
"true",
"."
] | 2e307c80986456f7c53248b792771cb13bb4234d | https://github.com/leprephp/http-server/blob/2e307c80986456f7c53248b792771cb13bb4234d/src/Server.php#L110-L121 |
23,593 | ComposePress/core | src/Traits/Component.php | Component.setup_components | protected function setup_components() {
$this->load_components();
$components = $this->get_components();
$this->set_component_parents( $components );
/** @var \ComposePress\Core\Abstracts\Component[] $components */
foreach ( $components as $component ) {
if ( method_exists( $component, 'init' ) ) {
$c... | php | protected function setup_components() {
$this->load_components();
$components = $this->get_components();
$this->set_component_parents( $components );
/** @var \ComposePress\Core\Abstracts\Component[] $components */
foreach ( $components as $component ) {
if ( method_exists( $component, 'init' ) ) {
$c... | [
"protected",
"function",
"setup_components",
"(",
")",
"{",
"$",
"this",
"->",
"load_components",
"(",
")",
";",
"$",
"components",
"=",
"$",
"this",
"->",
"get_components",
"(",
")",
";",
"$",
"this",
"->",
"set_component_parents",
"(",
"$",
"components",
... | Setup components and run init | [
"Setup",
"components",
"and",
"run",
"init"
] | f403f81d06a1e43017cb23c19c980fe3ef3bb6f7 | https://github.com/ComposePress/core/blob/f403f81d06a1e43017cb23c19c980fe3ef3bb6f7/src/Traits/Component.php#L86-L97 |
23,594 | ComposePress/core | src/Traits/Component.php | Component.get_components | protected function get_components() {
$components = ( new \ReflectionClass( $this ) )->getProperties();
$components = array_map(
/**
* @param \ReflectionProperty $property
*
* @return string
*/
function ( $property ) {
return $property->name;
}, $components );
$components = array_filter( $... | php | protected function get_components() {
$components = ( new \ReflectionClass( $this ) )->getProperties();
$components = array_map(
/**
* @param \ReflectionProperty $property
*
* @return string
*/
function ( $property ) {
return $property->name;
}, $components );
$components = array_filter( $... | [
"protected",
"function",
"get_components",
"(",
")",
"{",
"$",
"components",
"=",
"(",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
")",
")",
"->",
"getProperties",
"(",
")",
";",
"$",
"components",
"=",
"array_map",
"(",
"/**\n\t\t * @param \\ReflectionP... | Get all components with a getter and that uses the Component trait
@return array|\ReflectionProperty[] | [
"Get",
"all",
"components",
"with",
"a",
"getter",
"and",
"that",
"uses",
"the",
"Component",
"trait"
] | f403f81d06a1e43017cb23c19c980fe3ef3bb6f7 | https://github.com/ComposePress/core/blob/f403f81d06a1e43017cb23c19c980fe3ef3bb6f7/src/Traits/Component.php#L104-L129 |
23,595 | ComposePress/core | src/Traits/Component.php | Component.load | protected function load( $component, $args = [] ) {
$args = (array) $args;
if ( ! property_exists( $this, $component ) ) {
return false;
}
$class = $this->$component;
if ( ! is_string( $class ) ) {
return false;
}
if ( ! class_exists( $class ) ) {
throw new \Exception( sprintf( 'Can not find c... | php | protected function load( $component, $args = [] ) {
$args = (array) $args;
if ( ! property_exists( $this, $component ) ) {
return false;
}
$class = $this->$component;
if ( ! is_string( $class ) ) {
return false;
}
if ( ! class_exists( $class ) ) {
throw new \Exception( sprintf( 'Can not find c... | [
"protected",
"function",
"load",
"(",
"$",
"component",
",",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"args",
"=",
"(",
"array",
")",
"$",
"args",
";",
"if",
"(",
"!",
"property_exists",
"(",
"$",
"this",
",",
"$",
"component",
")",
")",
"{",
... | Load any property on the current component based on its string value as the class via the container
@param $component
@return bool
@throws \Exception | [
"Load",
"any",
"property",
"on",
"the",
"current",
"component",
"based",
"on",
"its",
"string",
"value",
"as",
"the",
"class",
"via",
"the",
"container"
] | f403f81d06a1e43017cb23c19c980fe3ef3bb6f7 | https://github.com/ComposePress/core/blob/f403f81d06a1e43017cb23c19c980fe3ef3bb6f7/src/Traits/Component.php#L139-L157 |
23,596 | zhouyl/mellivora | Mellivora/Database/Schema/Blueprint.php | Blueprint.toSql | public function toSql(Connection $connection, Grammar $grammar)
{
$this->addImpliedCommands();
$statements = [];
// Each type of command has a corresponding compiler function on the schema
// grammar which is used to build the necessary SQL statements to build
// the bluepr... | php | public function toSql(Connection $connection, Grammar $grammar)
{
$this->addImpliedCommands();
$statements = [];
// Each type of command has a corresponding compiler function on the schema
// grammar which is used to build the necessary SQL statements to build
// the bluepr... | [
"public",
"function",
"toSql",
"(",
"Connection",
"$",
"connection",
",",
"Grammar",
"$",
"grammar",
")",
"{",
"$",
"this",
"->",
"addImpliedCommands",
"(",
")",
";",
"$",
"statements",
"=",
"[",
"]",
";",
"// Each type of command has a corresponding compiler func... | Get the raw SQL statements for the blueprint.
@param \Mellivora\Database\Connection $connection
@param \Mellivora\Database\Schema\Grammars\Grammar $grammar
@return array | [
"Get",
"the",
"raw",
"SQL",
"statements",
"for",
"the",
"blueprint",
"."
] | 79f844c5c9c25ffbe18d142062e9bc3df00b36a1 | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Schema/Blueprint.php#L98-L118 |
23,597 | ShaoZeMing/laravel-merchant | src/Layout/Content.php | Content.render | public function render()
{
$items = [
'header' => $this->header,
'description' => $this->description,
'breadcrumb' => $this->breadcrumb,
'content' => $this->build(),
];
return view('merchant::content', $items)->render();
} | php | public function render()
{
$items = [
'header' => $this->header,
'description' => $this->description,
'breadcrumb' => $this->breadcrumb,
'content' => $this->build(),
];
return view('merchant::content', $items)->render();
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"items",
"=",
"[",
"'header'",
"=>",
"$",
"this",
"->",
"header",
",",
"'description'",
"=>",
"$",
"this",
"->",
"description",
",",
"'breadcrumb'",
"=>",
"$",
"this",
"->",
"breadcrumb",
",",
"'content... | Render this content.
@return string | [
"Render",
"this",
"content",
"."
] | 20801b1735e7832a6e58b37c2c391328f8d626fa | https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Layout/Content.php#L197-L207 |
23,598 | simbiosis-group/yii2-helper | models/ExcelImportForm.php | ExcelImportForm.getToolTipTemplate | public function getToolTipTemplate($field)
{
if (array_key_exists($field, $this->toolTips())) {
$toolTip = Html::tag('span', "{label}", [
'data-content'=> $this->toolTips()[$field],
'data-toggle'=>'popover',
'data-trigger'=>'hover',
'style'=>'cursor:help; border-bottom: 1px dashed #888'
... | php | public function getToolTipTemplate($field)
{
if (array_key_exists($field, $this->toolTips())) {
$toolTip = Html::tag('span', "{label}", [
'data-content'=> $this->toolTips()[$field],
'data-toggle'=>'popover',
'data-trigger'=>'hover',
'style'=>'cursor:help; border-bottom: 1px dashed #888'
... | [
"public",
"function",
"getToolTipTemplate",
"(",
"$",
"field",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"field",
",",
"$",
"this",
"->",
"toolTips",
"(",
")",
")",
")",
"{",
"$",
"toolTip",
"=",
"Html",
"::",
"tag",
"(",
"'span'",
",",
"\"{... | Generate the tool tip template to use in form.
@param string $field The table field name.
@return string Return the tool tip template. | [
"Generate",
"the",
"tool",
"tip",
"template",
"to",
"use",
"in",
"form",
"."
] | c85c4204dd06b16e54210e75fe6deb51869d1dd9 | https://github.com/simbiosis-group/yii2-helper/blob/c85c4204dd06b16e54210e75fe6deb51869d1dd9/models/ExcelImportForm.php#L86-L100 |
23,599 | simbiosis-group/yii2-helper | models/ExcelImportForm.php | ExcelImportForm.import | public function import($modelName, $defaultValues = [], $updateMultipleModel = false, $queryConfigs = [])
{
$isSuccessful = true;
$sheetData = $this->arrayFromExcel;
$this->header = array_shift($sheetData);
foreach ($sheetData as $record) {
if ($updateMultipleModel) {
$parentId = $this->g... | php | public function import($modelName, $defaultValues = [], $updateMultipleModel = false, $queryConfigs = [])
{
$isSuccessful = true;
$sheetData = $this->arrayFromExcel;
$this->header = array_shift($sheetData);
foreach ($sheetData as $record) {
if ($updateMultipleModel) {
$parentId = $this->g... | [
"public",
"function",
"import",
"(",
"$",
"modelName",
",",
"$",
"defaultValues",
"=",
"[",
"]",
",",
"$",
"updateMultipleModel",
"=",
"false",
",",
"$",
"queryConfigs",
"=",
"[",
"]",
")",
"{",
"$",
"isSuccessful",
"=",
"true",
";",
"$",
"sheetData",
... | Import the excel to the model using active record
@param string $model The model name to save the excel rows into
@param array $defaultValues The default values to be assigned
@return Return true if all records is saved | [
"Import",
"the",
"excel",
"to",
"the",
"model",
"using",
"active",
"record"
] | c85c4204dd06b16e54210e75fe6deb51869d1dd9 | https://github.com/simbiosis-group/yii2-helper/blob/c85c4204dd06b16e54210e75fe6deb51869d1dd9/models/ExcelImportForm.php#L108-L139 |
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.