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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
12,200 | bishopb/vanilla | library/core/class.autoloader.php | Gdn_Autoloader_Map.Index | public function Index($ExtraPaths = NULL) {
$FileMasks = array(
sprintf(self::LOOKUP_CLASS_MASK, '*'),
sprintf(self::LOOKUP_INTERFACE_MASK, '*')
);
$ExtraPathsRemove = NULL;
if (!is_null($ExtraPaths)) {
$ExtraPathsRemove = array();
foreach ($Extr... | php | public function Index($ExtraPaths = NULL) {
$FileMasks = array(
sprintf(self::LOOKUP_CLASS_MASK, '*'),
sprintf(self::LOOKUP_INTERFACE_MASK, '*')
);
$ExtraPathsRemove = NULL;
if (!is_null($ExtraPaths)) {
$ExtraPathsRemove = array();
foreach ($Extr... | [
"public",
"function",
"Index",
"(",
"$",
"ExtraPaths",
"=",
"NULL",
")",
"{",
"$",
"FileMasks",
"=",
"array",
"(",
"sprintf",
"(",
"self",
"::",
"LOOKUP_CLASS_MASK",
",",
"'*'",
")",
",",
"sprintf",
"(",
"self",
"::",
"LOOKUP_INTERFACE_MASK",
",",
"'*'",
... | Try to index the entire map
@return void | [
"Try",
"to",
"index",
"the",
"entire",
"map"
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.autoloader.php#L798-L851 |
12,201 | phlexible/phlexible | src/Phlexible/Bundle/TeaserBundle/Twig/Extension/TeaserExtension.php | TeaserExtension.renderTeaser | public function renderTeaser(ContentTeaser $teaser, array $parameters = array(), array $options = array())
{
$parameters['teaserId'] = $teaser->getId();
if ($this->requestStack->getMasterRequest()->attributes->get('_preview')) {
$parameters['preview'] = true;
}
$uri = $... | php | public function renderTeaser(ContentTeaser $teaser, array $parameters = array(), array $options = array())
{
$parameters['teaserId'] = $teaser->getId();
if ($this->requestStack->getMasterRequest()->attributes->get('_preview')) {
$parameters['preview'] = true;
}
$uri = $... | [
"public",
"function",
"renderTeaser",
"(",
"ContentTeaser",
"$",
"teaser",
",",
"array",
"$",
"parameters",
"=",
"array",
"(",
")",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"parameters",
"[",
"'teaserId'",
"]",
"=",
"$",
"te... | Renders a teaser.
@param ContentTeaser $teaser
@param array $parameters
@param array $options
@return string The fragment content
@see FragmentHandler::render() | [
"Renders",
"a",
"teaser",
"."
] | 132f24924c9bb0dbb6c1ea84db0a463f97fa3893 | https://github.com/phlexible/phlexible/blob/132f24924c9bb0dbb6c1ea84db0a463f97fa3893/src/Phlexible/Bundle/TeaserBundle/Twig/Extension/TeaserExtension.php#L71-L85 |
12,202 | crisu83/yii-caviar | src/helpers/Line.php | Line.text | public function text($string, $color = null, $bold = false)
{
if ($color !== null) {
$this->colorize($color, (int) $bold);
}
if (!empty($string)) {
$this->content .= $string . ' ';
}
$this->normalize();
return $this;
} | php | public function text($string, $color = null, $bold = false)
{
if ($color !== null) {
$this->colorize($color, (int) $bold);
}
if (!empty($string)) {
$this->content .= $string . ' ';
}
$this->normalize();
return $this;
} | [
"public",
"function",
"text",
"(",
"$",
"string",
",",
"$",
"color",
"=",
"null",
",",
"$",
"bold",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"color",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"colorize",
"(",
"$",
"color",
",",
"(",
"int",
")"... | Adds texts to this line.
@param string $string text to add.
@param int|null $color text color.
@param bool $bold whether to use bold text.
@return Line this line. | [
"Adds",
"texts",
"to",
"this",
"line",
"."
] | c85286b88e68558224e7f2ea7fff8f6975e46283 | https://github.com/crisu83/yii-caviar/blob/c85286b88e68558224e7f2ea7fff8f6975e46283/src/helpers/Line.php#L65-L78 |
12,203 | crisu83/yii-caviar | src/helpers/Line.php | Line.colorize | protected function colorize($color, $bold = 0)
{
if (!isset(self::$colors[$color])) {
throw new Exception("Unknown color '$color'.");
}
$code = self::$colors[$color];
$this->content .= "\033[{$bold};{$code}m";
} | php | protected function colorize($color, $bold = 0)
{
if (!isset(self::$colors[$color])) {
throw new Exception("Unknown color '$color'.");
}
$code = self::$colors[$color];
$this->content .= "\033[{$bold};{$code}m";
} | [
"protected",
"function",
"colorize",
"(",
"$",
"color",
",",
"$",
"bold",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"colors",
"[",
"$",
"color",
"]",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Unknown color '$color... | Adds a color code to this line.
@param int $color color code.
@param int $bold whether to use bold text.
@throws Exception if the color is invalid. | [
"Adds",
"a",
"color",
"code",
"to",
"this",
"line",
"."
] | c85286b88e68558224e7f2ea7fff8f6975e46283 | https://github.com/crisu83/yii-caviar/blob/c85286b88e68558224e7f2ea7fff8f6975e46283/src/helpers/Line.php#L138-L146 |
12,204 | crisu83/yii-caviar | src/helpers/Line.php | Line.begin | public static function begin($string = '', $color = null, $bold = false)
{
return new Line($string, $color, $bold);
} | php | public static function begin($string = '', $color = null, $bold = false)
{
return new Line($string, $color, $bold);
} | [
"public",
"static",
"function",
"begin",
"(",
"$",
"string",
"=",
"''",
",",
"$",
"color",
"=",
"null",
",",
"$",
"bold",
"=",
"false",
")",
"{",
"return",
"new",
"Line",
"(",
"$",
"string",
",",
"$",
"color",
",",
"$",
"bold",
")",
";",
"}"
] | Creates a new line and returns it.
@param string $string initial content.
@param int|null $color text color.
@param bool $bold whether to use bold text.
@return Line a new line. | [
"Creates",
"a",
"new",
"line",
"and",
"returns",
"it",
"."
] | c85286b88e68558224e7f2ea7fff8f6975e46283 | https://github.com/crisu83/yii-caviar/blob/c85286b88e68558224e7f2ea7fff8f6975e46283/src/helpers/Line.php#L174-L177 |
12,205 | neat-php/http | classes/Input.php | Input.load | public function load(...$sources)
{
if (!$sources) {
throw new \RuntimeException('Sources must not be empty');
}
$this->clear();
foreach ($sources as $source) {
switch ($source) {
case 'query':
case 'post':
case... | php | public function load(...$sources)
{
if (!$sources) {
throw new \RuntimeException('Sources must not be empty');
}
$this->clear();
foreach ($sources as $source) {
switch ($source) {
case 'query':
case 'post':
case... | [
"public",
"function",
"load",
"(",
"...",
"$",
"sources",
")",
"{",
"if",
"(",
"!",
"$",
"sources",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Sources must not be empty'",
")",
";",
"}",
"$",
"this",
"->",
"clear",
"(",
")",
";",
"forea... | Load input from the requested sources and the session
Flushes all previously applied filters and validations
@param array $sources | [
"Load",
"input",
"from",
"the",
"requested",
"sources",
"and",
"the",
"session"
] | 5d4781a8481c1f708fd642292e44244435a8369c | https://github.com/neat-php/http/blob/5d4781a8481c1f708fd642292e44244435a8369c/classes/Input.php#L70-L97 |
12,206 | neat-php/http | classes/Input.php | Input.retry | public function retry()
{
$this->session->set('input', [
'data' => $this->data,
'errors' => $this->errors,
]);
return Response::redirect($this->request->header('referer'));
} | php | public function retry()
{
$this->session->set('input', [
'data' => $this->data,
'errors' => $this->errors,
]);
return Response::redirect($this->request->header('referer'));
} | [
"public",
"function",
"retry",
"(",
")",
"{",
"$",
"this",
"->",
"session",
"->",
"set",
"(",
"'input'",
",",
"[",
"'data'",
"=>",
"$",
"this",
"->",
"data",
",",
"'errors'",
"=>",
"$",
"this",
"->",
"errors",
",",
"]",
")",
";",
"return",
"Respons... | Retry the input at the referring URL
Retains the input data using the session and returns a redirect response
so the user can safely resume entering the input at the referring URL.
@return Response | [
"Retry",
"the",
"input",
"at",
"the",
"referring",
"URL"
] | 5d4781a8481c1f708fd642292e44244435a8369c | https://github.com/neat-php/http/blob/5d4781a8481c1f708fd642292e44244435a8369c/classes/Input.php#L107-L115 |
12,207 | neat-php/http | classes/Input.php | Input.filter | public function filter($var, $filters, $type = null)
{
if (!is_array($filters)) {
$filters = $filters ? explode('|', $filters) : [];
}
$value = &$this->data[$var] ?? null;
if ($value === null) {
return null;
}
foreach ($filters as $key => $fil... | php | public function filter($var, $filters, $type = null)
{
if (!is_array($filters)) {
$filters = $filters ? explode('|', $filters) : [];
}
$value = &$this->data[$var] ?? null;
if ($value === null) {
return null;
}
foreach ($filters as $key => $fil... | [
"public",
"function",
"filter",
"(",
"$",
"var",
",",
"$",
"filters",
",",
"$",
"type",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"filters",
")",
")",
"{",
"$",
"filters",
"=",
"$",
"filters",
"?",
"explode",
"(",
"'|'",
",",
... | Filter an input variable
@param string $var
@param string|array $filters
@param string $type
@return mixed|null | [
"Filter",
"an",
"input",
"variable"
] | 5d4781a8481c1f708fd642292e44244435a8369c | https://github.com/neat-php/http/blob/5d4781a8481c1f708fd642292e44244435a8369c/classes/Input.php#L190-L222 |
12,208 | info-com/econtext-lib-file | src/php/econtext-lib-file/File.php | File.isReadable | public function isReadable() {
$m = substr($this->mode, 0, 1);
$p = strlen($this->mode) > 1 ? substr($this->mode, 1, 2) : "";
return ($m == "r" || $p == "+");
} | php | public function isReadable() {
$m = substr($this->mode, 0, 1);
$p = strlen($this->mode) > 1 ? substr($this->mode, 1, 2) : "";
return ($m == "r" || $p == "+");
} | [
"public",
"function",
"isReadable",
"(",
")",
"{",
"$",
"m",
"=",
"substr",
"(",
"$",
"this",
"->",
"mode",
",",
"0",
",",
"1",
")",
";",
"$",
"p",
"=",
"strlen",
"(",
"$",
"this",
"->",
"mode",
")",
">",
"1",
"?",
"substr",
"(",
"$",
"this",... | Is the file readable?
@return boolean | [
"Is",
"the",
"file",
"readable?"
] | 1ad828ddd90a4d36ec67bd60f938ef1bfc7229e1 | https://github.com/info-com/econtext-lib-file/blob/1ad828ddd90a4d36ec67bd60f938ef1bfc7229e1/src/php/econtext-lib-file/File.php#L79-L83 |
12,209 | info-com/econtext-lib-file | src/php/econtext-lib-file/File.php | File.write | public function write($string, $length=null) {
$this->assertWritable();
return $this->format->write($this->file, $string, $length);
} | php | public function write($string, $length=null) {
$this->assertWritable();
return $this->format->write($this->file, $string, $length);
} | [
"public",
"function",
"write",
"(",
"$",
"string",
",",
"$",
"length",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"assertWritable",
"(",
")",
";",
"return",
"$",
"this",
"->",
"format",
"->",
"write",
"(",
"$",
"this",
"->",
"file",
",",
"$",
"strin... | Write the string to file
@param string $string Content to write to file
@param mixed $length If the length argument is given, writing will stop after length bytes have been written or the end of string is reached, whichever comes first
@see http://us3.php.net/manual/en/function.fwrite.php | [
"Write",
"the",
"string",
"to",
"file"
] | 1ad828ddd90a4d36ec67bd60f938ef1bfc7229e1 | https://github.com/info-com/econtext-lib-file/blob/1ad828ddd90a4d36ec67bd60f938ef1bfc7229e1/src/php/econtext-lib-file/File.php#L132-L135 |
12,210 | info-com/econtext-lib-file | src/php/econtext-lib-file/File.php | File.readline | public function readline($length=null) {
$this->assertReadable();
return $this->format->readline($this->file, $length);
} | php | public function readline($length=null) {
$this->assertReadable();
return $this->format->readline($this->file, $length);
} | [
"public",
"function",
"readline",
"(",
"$",
"length",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"assertReadable",
"(",
")",
";",
"return",
"$",
"this",
"->",
"format",
"->",
"readline",
"(",
"$",
"this",
"->",
"file",
",",
"$",
"length",
")",
";",
... | Read a line from the file
@param int $length If specified, read this many bytes
@see http://www.php.net/manual/en/function.fgets.php | [
"Read",
"a",
"line",
"from",
"the",
"file"
] | 1ad828ddd90a4d36ec67bd60f938ef1bfc7229e1 | https://github.com/info-com/econtext-lib-file/blob/1ad828ddd90a4d36ec67bd60f938ef1bfc7229e1/src/php/econtext-lib-file/File.php#L143-L146 |
12,211 | info-com/econtext-lib-file | src/php/econtext-lib-file/File.php | File.unlink | public function unlink() {
if($this->isOpen()) {
$this->close();
}
if($this->exists()) {
if(unlink($this->filepath)) {
$this->unlinked = true;
}
}
} | php | public function unlink() {
if($this->isOpen()) {
$this->close();
}
if($this->exists()) {
if(unlink($this->filepath)) {
$this->unlinked = true;
}
}
} | [
"public",
"function",
"unlink",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isOpen",
"(",
")",
")",
"{",
"$",
"this",
"->",
"close",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"unlink",
"(",
... | Remove the file from the filesystem
@return boolean Successfully deleted the file | [
"Remove",
"the",
"file",
"from",
"the",
"filesystem"
] | 1ad828ddd90a4d36ec67bd60f938ef1bfc7229e1 | https://github.com/info-com/econtext-lib-file/blob/1ad828ddd90a4d36ec67bd60f938ef1bfc7229e1/src/php/econtext-lib-file/File.php#L196-L205 |
12,212 | Persata/SymfonyApiExtension | src/ServiceContainer/SymfonyApiExtension.php | SymfonyApiExtension.initialize | public function initialize(ExtensionManager $extensionManager)
{
$symfonyExtension = $extensionManager->getExtension('fob_symfony');
if (null === $symfonyExtension) {
throw new ExtensionInitializationException(sprintf('The %s extension must be enabled for this extension to function.', S... | php | public function initialize(ExtensionManager $extensionManager)
{
$symfonyExtension = $extensionManager->getExtension('fob_symfony');
if (null === $symfonyExtension) {
throw new ExtensionInitializationException(sprintf('The %s extension must be enabled for this extension to function.', S... | [
"public",
"function",
"initialize",
"(",
"ExtensionManager",
"$",
"extensionManager",
")",
"{",
"$",
"symfonyExtension",
"=",
"$",
"extensionManager",
"->",
"getExtension",
"(",
"'fob_symfony'",
")",
";",
"if",
"(",
"null",
"===",
"$",
"symfonyExtension",
")",
"... | Initializes other extensions.
This method is called immediately after all extensions are activated but
before any extension `configure()` method is called. This allows extensions
to hook into the configuration of other extensions providing such an
extension point.
@param ExtensionManager $extensionManager | [
"Initializes",
"other",
"extensions",
"."
] | 89fcfbd13b462c184ab208215b8b12199e8647dd | https://github.com/Persata/SymfonyApiExtension/blob/89fcfbd13b462c184ab208215b8b12199e8647dd/src/ServiceContainer/SymfonyApiExtension.php#L60-L67 |
12,213 | stevenberg/responsible-images-php | src/Values/Size.php | Size.add | public function add(self $other): self
{
return self::from($this->value + $other->value);
} | php | public function add(self $other): self
{
return self::from($this->value + $other->value);
} | [
"public",
"function",
"add",
"(",
"self",
"$",
"other",
")",
":",
"self",
"{",
"return",
"self",
"::",
"from",
"(",
"$",
"this",
"->",
"value",
"+",
"$",
"other",
"->",
"value",
")",
";",
"}"
] | Add two Sizes and return the sum. | [
"Add",
"two",
"Sizes",
"and",
"return",
"the",
"sum",
"."
] | a890fc2b3d011c660161aae0e18709dadf00e43f | https://github.com/stevenberg/responsible-images-php/blob/a890fc2b3d011c660161aae0e18709dadf00e43f/src/Values/Size.php#L23-L26 |
12,214 | parfumix/laravel-translator | src/Drivers/Yandex.php | Yandex.getStoreTranslation | protected function getStoreTranslation($key, $locale) {
if( ! isset($this->translations[$locale][$key]) ) {
$response = $this->apiRequest(
$this->getAttribute('api_url'), [ 'text' => $key, 'lang' => $locale]
);
$response = json_decode($response, true);
... | php | protected function getStoreTranslation($key, $locale) {
if( ! isset($this->translations[$locale][$key]) ) {
$response = $this->apiRequest(
$this->getAttribute('api_url'), [ 'text' => $key, 'lang' => $locale]
);
$response = json_decode($response, true);
... | [
"protected",
"function",
"getStoreTranslation",
"(",
"$",
"key",
",",
"$",
"locale",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"translations",
"[",
"$",
"locale",
"]",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"response",
"=",
"$",... | Get translation and cache it .
@param $key
@param null $locale
@return mixed | [
"Get",
"translation",
"and",
"cache",
"it",
"."
] | b85f17cbfebd4f35d1bfb817fbf13bff2c3f487e | https://github.com/parfumix/laravel-translator/blob/b85f17cbfebd4f35d1bfb817fbf13bff2c3f487e/src/Drivers/Yandex.php#L89-L101 |
12,215 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/db.php | DB.list_columns | public static function list_columns($table = null, $like = null, $db = null)
{
return \Database_Connection::instance($db)->list_columns($table, $like);
} | php | public static function list_columns($table = null, $like = null, $db = null)
{
return \Database_Connection::instance($db)->list_columns($table, $like);
} | [
"public",
"static",
"function",
"list_columns",
"(",
"$",
"table",
"=",
"null",
",",
"$",
"like",
"=",
"null",
",",
"$",
"db",
"=",
"null",
")",
"{",
"return",
"\\",
"Database_Connection",
"::",
"instance",
"(",
"$",
"db",
")",
"->",
"list_columns",
"(... | Lists all of the columns in a table. Optionally, a LIKE string can be
used to search for specific fields.
// Get all columns from the "users" table
$columns = DB::list_columns('users');
// Get all name-related columns
$columns = DB::list_columns('users', '%name%');
@param string table to get columns from
@param ... | [
"Lists",
"all",
"of",
"the",
"columns",
"in",
"a",
"table",
".",
"Optionally",
"a",
"LIKE",
"string",
"can",
"be",
"used",
"to",
"search",
"for",
"specific",
"fields",
"."
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/db.php#L275-L278 |
12,216 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/db.php | DB.rollback_transaction | public static function rollback_transaction($db = null, $rollback_all = true)
{
return \Database_Connection::instance($db)->rollback_transaction($rollback_all);
} | php | public static function rollback_transaction($db = null, $rollback_all = true)
{
return \Database_Connection::instance($db)->rollback_transaction($rollback_all);
} | [
"public",
"static",
"function",
"rollback_transaction",
"(",
"$",
"db",
"=",
"null",
",",
"$",
"rollback_all",
"=",
"true",
")",
"{",
"return",
"\\",
"Database_Connection",
"::",
"instance",
"(",
"$",
"db",
")",
"->",
"rollback_transaction",
"(",
"$",
"rollb... | Rollsback pending transactional queries
Rollback to the current level uses SAVEPOINT,
it does not work if current RDBMS does not support them.
In this case system rollsback all queries and closes the transaction
DB::rollback_transaction();
@param string $db connection
@param bool $rollback_all:
true - rollba... | [
"Rollsback",
"pending",
"transactional",
"queries",
"Rollback",
"to",
"the",
"current",
"level",
"uses",
"SAVEPOINT",
"it",
"does",
"not",
"work",
"if",
"current",
"RDBMS",
"does",
"not",
"support",
"them",
".",
"In",
"this",
"case",
"system",
"rollsback",
"al... | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/db.php#L404-L407 |
12,217 | novuso/system | src/Collection/Traits/ItemTypeMethods.php | ItemTypeMethods.setItemType | protected function setItemType(?string $itemType = null): void
{
if ($itemType !== null) {
$itemType = trim($itemType);
}
$this->itemType = $itemType;
} | php | protected function setItemType(?string $itemType = null): void
{
if ($itemType !== null) {
$itemType = trim($itemType);
}
$this->itemType = $itemType;
} | [
"protected",
"function",
"setItemType",
"(",
"?",
"string",
"$",
"itemType",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"$",
"itemType",
"!==",
"null",
")",
"{",
"$",
"itemType",
"=",
"trim",
"(",
"$",
"itemType",
")",
";",
"}",
"$",
"this",
"-... | Sets the item type
If a type is not provided, the item type is dynamic.
The type can be any fully-qualified class or interface name,
or one of the following type strings:
[array, object, bool, int, float, string, callable]
@param string|null $itemType The item type
@return void | [
"Sets",
"the",
"item",
"type"
] | e34038b391826edc68d0b5fccfba96642de9d6f0 | https://github.com/novuso/system/blob/e34038b391826edc68d0b5fccfba96642de9d6f0/src/Collection/Traits/ItemTypeMethods.php#L48-L55 |
12,218 | novuso/system | src/Collection/Traits/ItemTypeMethods.php | ItemTypeMethods.itemTypeError | protected function itemTypeError(string $method, $item): string
{
$itemType = is_object($item) ? get_class($item) : gettype($item);
return sprintf(
'%s::%s expects item type (%s); received (%s) %s',
static::class,
$method,
$this->itemType(),
... | php | protected function itemTypeError(string $method, $item): string
{
$itemType = is_object($item) ? get_class($item) : gettype($item);
return sprintf(
'%s::%s expects item type (%s); received (%s) %s',
static::class,
$method,
$this->itemType(),
... | [
"protected",
"function",
"itemTypeError",
"(",
"string",
"$",
"method",
",",
"$",
"item",
")",
":",
"string",
"{",
"$",
"itemType",
"=",
"is_object",
"(",
"$",
"item",
")",
"?",
"get_class",
"(",
"$",
"item",
")",
":",
"gettype",
"(",
"$",
"item",
")... | Retrieves the item type error message
@param string $method The calling method
@param mixed $item The item
@return string | [
"Retrieves",
"the",
"item",
"type",
"error",
"message"
] | e34038b391826edc68d0b5fccfba96642de9d6f0 | https://github.com/novuso/system/blob/e34038b391826edc68d0b5fccfba96642de9d6f0/src/Collection/Traits/ItemTypeMethods.php#L65-L77 |
12,219 | synapsestudios/synapse-base | src/Synapse/Migration/CreateMigrationCommand.php | CreateMigrationCommand.execute | public function execute(InputInterface $input, OutputInterface $output)
{
$description = $input->getArgument('description');
$time = date('YmdHis');
$classname = $this->generateClassName($time, $description);
$filepath = APPDIR.'/src/'.$this->namespaceToPath().$classname.... | php | public function execute(InputInterface $input, OutputInterface $output)
{
$description = $input->getArgument('description');
$time = date('YmdHis');
$classname = $this->generateClassName($time, $description);
$filepath = APPDIR.'/src/'.$this->namespaceToPath().$classname.... | [
"public",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"description",
"=",
"$",
"input",
"->",
"getArgument",
"(",
"'description'",
")",
";",
"$",
"time",
"=",
"date",
"(",
"'YmdHis'",
")... | Execute this console command, in order to create a new migration
@param InputInterface $input Command line input interface
@param OutputInterface $output Command line output interface | [
"Execute",
"this",
"console",
"command",
"in",
"order",
"to",
"create",
"a",
"new",
"migration"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/Migration/CreateMigrationCommand.php#L56-L79 |
12,220 | synapsestudios/synapse-base | src/Synapse/Migration/CreateMigrationCommand.php | CreateMigrationCommand.generateClassName | protected function generateClassName($time, $description)
{
$description = substr(strtolower($description), 0, 30);
$description = ucwords($description);
$description = preg_replace('/[^a-zA-Z]+/', '', $description);
return 'Migration'.$time.$description;
} | php | protected function generateClassName($time, $description)
{
$description = substr(strtolower($description), 0, 30);
$description = ucwords($description);
$description = preg_replace('/[^a-zA-Z]+/', '', $description);
return 'Migration'.$time.$description;
} | [
"protected",
"function",
"generateClassName",
"(",
"$",
"time",
",",
"$",
"description",
")",
"{",
"$",
"description",
"=",
"substr",
"(",
"strtolower",
"(",
"$",
"description",
")",
",",
"0",
",",
"30",
")",
";",
"$",
"description",
"=",
"ucwords",
"(",... | Get the name of the new migration class
Converts description to PascalCase and prepends constant string and timestamp.
Example:
// From:
Example description of a migration
// To:
Migration20140220001906ExampleDescriptionOfAMigration
@param string $time Timestamp
@param string $description User-provided desc... | [
"Get",
"the",
"name",
"of",
"the",
"new",
"migration",
"class"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/Migration/CreateMigrationCommand.php#L96-L102 |
12,221 | Hexmedia/Administrator-Bundle | Controller/CrudController.php | CrudController.createCreateForm | protected function createCreateForm($entity)
{
$form = $this->createForm(
$this->getAddFormType(), $entity, [
'action' => $this->generateUrl($this->getRouteName() . "Add", $this->getRouteParams()),
'method' => 'POST',
]
);
return $form... | php | protected function createCreateForm($entity)
{
$form = $this->createForm(
$this->getAddFormType(), $entity, [
'action' => $this->generateUrl($this->getRouteName() . "Add", $this->getRouteParams()),
'method' => 'POST',
]
);
return $form... | [
"protected",
"function",
"createCreateForm",
"(",
"$",
"entity",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"$",
"this",
"->",
"getAddFormType",
"(",
")",
",",
"$",
"entity",
",",
"[",
"'action'",
"=>",
"$",
"this",
"->",
"genera... | Creates a form to create an entity.
@param mixed $entity The entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"create",
"an",
"entity",
"."
] | ac76cf3d226cd645a0976cfb6f3e6b058fa89890 | https://github.com/Hexmedia/Administrator-Bundle/blob/ac76cf3d226cd645a0976cfb6f3e6b058fa89890/Controller/CrudController.php#L149-L159 |
12,222 | Hexmedia/Administrator-Bundle | Controller/CrudController.php | CrudController.createEditForm | protected function createEditForm($entity)
{
$form = $this->createForm(
$this->getEditFormType(), $entity, [
'action' => $this->generateUrl($this->getRouteName() . "Edit", $this->getRouteParams(['id' => $entity->getId()])),
'method' => 'POST',
]
... | php | protected function createEditForm($entity)
{
$form = $this->createForm(
$this->getEditFormType(), $entity, [
'action' => $this->generateUrl($this->getRouteName() . "Edit", $this->getRouteParams(['id' => $entity->getId()])),
'method' => 'POST',
]
... | [
"protected",
"function",
"createEditForm",
"(",
"$",
"entity",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"$",
"this",
"->",
"getEditFormType",
"(",
")",
",",
"$",
"entity",
",",
"[",
"'action'",
"=>",
"$",
"this",
"->",
"generat... | Creates a form to edit an entity.
@param mixed $entity The entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"edit",
"an",
"entity",
"."
] | ac76cf3d226cd645a0976cfb6f3e6b058fa89890 | https://github.com/Hexmedia/Administrator-Bundle/blob/ac76cf3d226cd645a0976cfb6f3e6b058fa89890/Controller/CrudController.php#L210-L220 |
12,223 | zepi/turbo-base | Zepi/Core/AccessControl/src/Manager/AccessControlManager.php | AccessControlManager.getPermissionForId | public function getPermissionForId($id)
{
$permission = $this->permissionsDataSource->getPermissionForId($id);
if ($permission instanceof \Zepi\Core\AccessControl\Entity\Permission) {
$accessEntity = $this->getAccessEntityForUuid($permission->getAccessEntityClass(), $permission-... | php | public function getPermissionForId($id)
{
$permission = $this->permissionsDataSource->getPermissionForId($id);
if ($permission instanceof \Zepi\Core\AccessControl\Entity\Permission) {
$accessEntity = $this->getAccessEntityForUuid($permission->getAccessEntityClass(), $permission-... | [
"public",
"function",
"getPermissionForId",
"(",
"$",
"id",
")",
"{",
"$",
"permission",
"=",
"$",
"this",
"->",
"permissionsDataSource",
"->",
"getPermissionForId",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"permission",
"instanceof",
"\\",
"Zepi",
"\\",
... | Returns the permission object for the given id
@access public
@param integer $id
@return false|\Zepi\Core\AccessControl\Entity\Permission | [
"Returns",
"the",
"permission",
"object",
"for",
"the",
"given",
"id"
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Core/AccessControl/src/Manager/AccessControlManager.php#L240-L253 |
12,224 | zepi/turbo-base | Zepi/Core/AccessControl/src/Manager/AccessControlManager.php | AccessControlManager.updatePermissions | public function updatePermissions(AccessEntity $accessEntity, $accessLevels, AccessEntity $donor)
{
$permissions = $this->getPermissionsRawForUuid($accessEntity->getUuid());
$grantedPermissions = array_diff($accessLevels, $permissions);
$revokedPermissions = array_diff($permissions,... | php | public function updatePermissions(AccessEntity $accessEntity, $accessLevels, AccessEntity $donor)
{
$permissions = $this->getPermissionsRawForUuid($accessEntity->getUuid());
$grantedPermissions = array_diff($accessLevels, $permissions);
$revokedPermissions = array_diff($permissions,... | [
"public",
"function",
"updatePermissions",
"(",
"AccessEntity",
"$",
"accessEntity",
",",
"$",
"accessLevels",
",",
"AccessEntity",
"$",
"donor",
")",
"{",
"$",
"permissions",
"=",
"$",
"this",
"->",
"getPermissionsRawForUuid",
"(",
"$",
"accessEntity",
"->",
"g... | Adds and removes an array with access level to the given access
entity uuid. If the donor hasn't the permission for the access
level no action is taken.
@access public
@param \Zepi\Core\AccessControl\Entity\AccessEntity $accessEntity
@param array $accessLevels
@param \Zepi\Core\AccessControl\Entity\AccessEntity $donor | [
"Adds",
"and",
"removes",
"an",
"array",
"with",
"access",
"level",
"to",
"the",
"given",
"access",
"entity",
"uuid",
".",
"If",
"the",
"donor",
"hasn",
"t",
"the",
"permission",
"for",
"the",
"access",
"level",
"no",
"action",
"is",
"taken",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Core/AccessControl/src/Manager/AccessControlManager.php#L345-L369 |
12,225 | Webiny/BackupService | src/Webiny/BackupService/Lib/BackupMongo.php | BackupMongo.exportDatabases | public function exportDatabases()
{
$exports = [];
foreach ($this->databases as $db) {
$exports[] = $this->createExport($db);
}
return $exports;
} | php | public function exportDatabases()
{
$exports = [];
foreach ($this->databases as $db) {
$exports[] = $this->createExport($db);
}
return $exports;
} | [
"public",
"function",
"exportDatabases",
"(",
")",
"{",
"$",
"exports",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"databases",
"as",
"$",
"db",
")",
"{",
"$",
"exports",
"[",
"]",
"=",
"$",
"this",
"->",
"createExport",
"(",
"$",
"db",... | Loops over the list of databases and calls createExport method.
@return array List of database export directories.
@throws \Exception | [
"Loops",
"over",
"the",
"list",
"of",
"databases",
"and",
"calls",
"createExport",
"method",
"."
] | 9728ddaa67e5703ac7898a6f69a0ad14ac37a256 | https://github.com/Webiny/BackupService/blob/9728ddaa67e5703ac7898a6f69a0ad14ac37a256/src/Webiny/BackupService/Lib/BackupMongo.php#L54-L62 |
12,226 | Webiny/BackupService | src/Webiny/BackupService/Lib/BackupMongo.php | BackupMongo.createExport | private function createExport($db)
{
Service::$log->msg(sprintf('Mongodb: exporting "%s" database.', $db['Database']));
$cmd = 'mongodump';
if (!isset($db['Database'])) {
throw new \Exception(sprintf('Missing "Database" parameter for one of the MongoDatabases'));
}
... | php | private function createExport($db)
{
Service::$log->msg(sprintf('Mongodb: exporting "%s" database.', $db['Database']));
$cmd = 'mongodump';
if (!isset($db['Database'])) {
throw new \Exception(sprintf('Missing "Database" parameter for one of the MongoDatabases'));
}
... | [
"private",
"function",
"createExport",
"(",
"$",
"db",
")",
"{",
"Service",
"::",
"$",
"log",
"->",
"msg",
"(",
"sprintf",
"(",
"'Mongodb: exporting \"%s\" database.'",
",",
"$",
"db",
"[",
"'Database'",
"]",
")",
")",
";",
"$",
"cmd",
"=",
"'mongodump'",
... | Private method that does the actual database export.
@param array $db Database entry configuration.
@return string Path to the created database export.
@throws \Exception | [
"Private",
"method",
"that",
"does",
"the",
"actual",
"database",
"export",
"."
] | 9728ddaa67e5703ac7898a6f69a0ad14ac37a256 | https://github.com/Webiny/BackupService/blob/9728ddaa67e5703ac7898a6f69a0ad14ac37a256/src/Webiny/BackupService/Lib/BackupMongo.php#L72-L132 |
12,227 | in2pire/in2pire-cli-compiler | src/In2pire/Compiler/Component/Git.php | Git.getLastCommitDate | public function getLastCommitDate()
{
$process = new Process('git log -n1 --pretty=%ci HEAD', $this->directory);
if ($process->run() != 0) {
throw new \RuntimeException('Can\'t run git log. You must ensure that git binary is available.');
}
$date = new \DateTime(trim($p... | php | public function getLastCommitDate()
{
$process = new Process('git log -n1 --pretty=%ci HEAD', $this->directory);
if ($process->run() != 0) {
throw new \RuntimeException('Can\'t run git log. You must ensure that git binary is available.');
}
$date = new \DateTime(trim($p... | [
"public",
"function",
"getLastCommitDate",
"(",
")",
"{",
"$",
"process",
"=",
"new",
"Process",
"(",
"'git log -n1 --pretty=%ci HEAD'",
",",
"$",
"this",
"->",
"directory",
")",
";",
"if",
"(",
"$",
"process",
"->",
"run",
"(",
")",
"!=",
"0",
")",
"{",... | Get last commit date in repository.
@return string
Date. | [
"Get",
"last",
"commit",
"date",
"in",
"repository",
"."
] | 3210393759c024d70ce15032d7f20a320afc9abe | https://github.com/in2pire/in2pire-cli-compiler/blob/3210393759c024d70ce15032d7f20a320afc9abe/src/In2pire/Compiler/Component/Git.php#L100-L112 |
12,228 | in2pire/in2pire-cli-compiler | src/In2pire/Compiler/Component/Git.php | Git.findGitRepository | public static function findGitRepository($directory)
{
$process = new Process('git rev-parse --show-toplevel', $directory);
$process->run();
if (!$process->isSuccessful()) {
return false;
}
$rootPath = trim($process->getOutput());
return new Git($rootPat... | php | public static function findGitRepository($directory)
{
$process = new Process('git rev-parse --show-toplevel', $directory);
$process->run();
if (!$process->isSuccessful()) {
return false;
}
$rootPath = trim($process->getOutput());
return new Git($rootPat... | [
"public",
"static",
"function",
"findGitRepository",
"(",
"$",
"directory",
")",
"{",
"$",
"process",
"=",
"new",
"Process",
"(",
"'git rev-parse --show-toplevel'",
",",
"$",
"directory",
")",
";",
"$",
"process",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!"... | Find a git repository.
@return mixed
Git object or false. | [
"Find",
"a",
"git",
"repository",
"."
] | 3210393759c024d70ce15032d7f20a320afc9abe | https://github.com/in2pire/in2pire-cli-compiler/blob/3210393759c024d70ce15032d7f20a320afc9abe/src/In2pire/Compiler/Component/Git.php#L120-L131 |
12,229 | lrc-se/bth-anax-repository | src/Repository/SoftReferenceResolverTrait.php | SoftReferenceResolverTrait.getReferenceSoft | public function getReferenceSoft($repository, $attr, $key = 'id')
{
if (isset($this->$attr)) {
return ($repository->findSoft($key, $this->$attr) ?: null);
}
return null;
} | php | public function getReferenceSoft($repository, $attr, $key = 'id')
{
if (isset($this->$attr)) {
return ($repository->findSoft($key, $this->$attr) ?: null);
}
return null;
} | [
"public",
"function",
"getReferenceSoft",
"(",
"$",
"repository",
",",
"$",
"attr",
",",
"$",
"key",
"=",
"'id'",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"$",
"attr",
")",
")",
"{",
"return",
"(",
"$",
"repository",
"->",
"findSoft",
... | Retrieve a reference by foreign key, ignoring soft-deleted entries.
@param SoftRepositoryInterface $repository Repository to query.
@param string $attr Name of foreign key attribute.
@param string $key Name of primary key attribute in referenced table.
@return mixe... | [
"Retrieve",
"a",
"reference",
"by",
"foreign",
"key",
"ignoring",
"soft",
"-",
"deleted",
"entries",
"."
] | 344a0795fbfadf34ea768719dc5cf2f1d90154df | https://github.com/lrc-se/bth-anax-repository/blob/344a0795fbfadf34ea768719dc5cf2f1d90154df/src/Repository/SoftReferenceResolverTrait.php#L22-L28 |
12,230 | factorio-item-browser/api-database | src/Entity/RecipeProduct.php | RecipeProduct.setAmountMin | public function setAmountMin(float $amountMin): self
{
$this->amountMin = (int) ($amountMin * self::FACTOR_AMOUNT_MIN);
return $this;
} | php | public function setAmountMin(float $amountMin): self
{
$this->amountMin = (int) ($amountMin * self::FACTOR_AMOUNT_MIN);
return $this;
} | [
"public",
"function",
"setAmountMin",
"(",
"float",
"$",
"amountMin",
")",
":",
"self",
"{",
"$",
"this",
"->",
"amountMin",
"=",
"(",
"int",
")",
"(",
"$",
"amountMin",
"*",
"self",
"::",
"FACTOR_AMOUNT_MIN",
")",
";",
"return",
"$",
"this",
";",
"}"
... | Sets the minimal amount of the product in the recipe.
@param float $amountMin
@return $this Implementing fluent interface. | [
"Sets",
"the",
"minimal",
"amount",
"of",
"the",
"product",
"in",
"the",
"recipe",
"."
] | c3a27e5673462a58b5afafc0ea0e0002f6db9803 | https://github.com/factorio-item-browser/api-database/blob/c3a27e5673462a58b5afafc0ea0e0002f6db9803/src/Entity/RecipeProduct.php#L122-L126 |
12,231 | factorio-item-browser/api-database | src/Entity/RecipeProduct.php | RecipeProduct.setAmountMax | public function setAmountMax(float $amountMax): self
{
$this->amountMax = (int) ($amountMax * self::FACTOR_AMOUNT_MAX);
return $this;
} | php | public function setAmountMax(float $amountMax): self
{
$this->amountMax = (int) ($amountMax * self::FACTOR_AMOUNT_MAX);
return $this;
} | [
"public",
"function",
"setAmountMax",
"(",
"float",
"$",
"amountMax",
")",
":",
"self",
"{",
"$",
"this",
"->",
"amountMax",
"=",
"(",
"int",
")",
"(",
"$",
"amountMax",
"*",
"self",
"::",
"FACTOR_AMOUNT_MAX",
")",
";",
"return",
"$",
"this",
";",
"}"
... | Sets the maximal amount of the product in the recipe.
@param float $amountMax
@return $this Implementing fluent interface. | [
"Sets",
"the",
"maximal",
"amount",
"of",
"the",
"product",
"in",
"the",
"recipe",
"."
] | c3a27e5673462a58b5afafc0ea0e0002f6db9803 | https://github.com/factorio-item-browser/api-database/blob/c3a27e5673462a58b5afafc0ea0e0002f6db9803/src/Entity/RecipeProduct.php#L142-L146 |
12,232 | factorio-item-browser/api-database | src/Entity/RecipeProduct.php | RecipeProduct.setProbability | public function setProbability(float $probability): self
{
$this->probability = (int) ($probability * self::FACTOR_AMOUNT_PROBABILITY);
return $this;
} | php | public function setProbability(float $probability): self
{
$this->probability = (int) ($probability * self::FACTOR_AMOUNT_PROBABILITY);
return $this;
} | [
"public",
"function",
"setProbability",
"(",
"float",
"$",
"probability",
")",
":",
"self",
"{",
"$",
"this",
"->",
"probability",
"=",
"(",
"int",
")",
"(",
"$",
"probability",
"*",
"self",
"::",
"FACTOR_AMOUNT_PROBABILITY",
")",
";",
"return",
"$",
"this... | Sets the probability of the product in the recipe.
@param float $probability
@return $this Implementing fluent interface. | [
"Sets",
"the",
"probability",
"of",
"the",
"product",
"in",
"the",
"recipe",
"."
] | c3a27e5673462a58b5afafc0ea0e0002f6db9803 | https://github.com/factorio-item-browser/api-database/blob/c3a27e5673462a58b5afafc0ea0e0002f6db9803/src/Entity/RecipeProduct.php#L162-L166 |
12,233 | mszewcz/php-light-framework | src/Session/Revalidation.php | Revalidation.setRevalidationTime | public static function setRevalidationTime(string $variableName = '_MF_SESSION_REVALIDATED_AT_'): bool
{
$variableName = (string)$variableName;
$vHandler = Variables::getInstance();
$vHandler->session->set($variableName, \time());
return true;
} | php | public static function setRevalidationTime(string $variableName = '_MF_SESSION_REVALIDATED_AT_'): bool
{
$variableName = (string)$variableName;
$vHandler = Variables::getInstance();
$vHandler->session->set($variableName, \time());
return true;
} | [
"public",
"static",
"function",
"setRevalidationTime",
"(",
"string",
"$",
"variableName",
"=",
"'_MF_SESSION_REVALIDATED_AT_'",
")",
":",
"bool",
"{",
"$",
"variableName",
"=",
"(",
"string",
")",
"$",
"variableName",
";",
"$",
"vHandler",
"=",
"Variables",
"::... | Sets revalidation timestamp
@param string $variableName
@return bool | [
"Sets",
"revalidation",
"timestamp"
] | 4d3b46781c387202c2dfbdb8760151b3ae8ef49c | https://github.com/mszewcz/php-light-framework/blob/4d3b46781c387202c2dfbdb8760151b3ae8ef49c/src/Session/Revalidation.php#L45-L51 |
12,234 | mszewcz/php-light-framework | src/Session/Revalidation.php | Revalidation.doesNeedRevalidation | public static function doesNeedRevalidation(string $variableName = '_MF_SESSION_REVALIDATED_AT_'): bool
{
static::init();
$variableName = (string)$variableName;
$vHandler = Variables::getInstance();
$validationTS = $vHandler->session->get($variableName, $vHandler::TYPE_INT);
... | php | public static function doesNeedRevalidation(string $variableName = '_MF_SESSION_REVALIDATED_AT_'): bool
{
static::init();
$variableName = (string)$variableName;
$vHandler = Variables::getInstance();
$validationTS = $vHandler->session->get($variableName, $vHandler::TYPE_INT);
... | [
"public",
"static",
"function",
"doesNeedRevalidation",
"(",
"string",
"$",
"variableName",
"=",
"'_MF_SESSION_REVALIDATED_AT_'",
")",
":",
"bool",
"{",
"static",
"::",
"init",
"(",
")",
";",
"$",
"variableName",
"=",
"(",
"string",
")",
"$",
"variableName",
"... | Checks if session deas need revalidation
@param string $variableName
@return bool | [
"Checks",
"if",
"session",
"deas",
"need",
"revalidation"
] | 4d3b46781c387202c2dfbdb8760151b3ae8ef49c | https://github.com/mszewcz/php-light-framework/blob/4d3b46781c387202c2dfbdb8760151b3ae8ef49c/src/Session/Revalidation.php#L59-L66 |
12,235 | mszewcz/php-light-framework | src/Session/Revalidation.php | Revalidation.setRevalidationCounter | public static function setRevalidationCounter(string $variableName = '_MF_SESSION_REVALIDATION_COUNTER_',
int $value = 0): void
{
static::init();
$variableName = (string)$variableName;
$vHandler = Variables::getInstance();
$vHandler->... | php | public static function setRevalidationCounter(string $variableName = '_MF_SESSION_REVALIDATION_COUNTER_',
int $value = 0): void
{
static::init();
$variableName = (string)$variableName;
$vHandler = Variables::getInstance();
$vHandler->... | [
"public",
"static",
"function",
"setRevalidationCounter",
"(",
"string",
"$",
"variableName",
"=",
"'_MF_SESSION_REVALIDATION_COUNTER_'",
",",
"int",
"$",
"value",
"=",
"0",
")",
":",
"void",
"{",
"static",
"::",
"init",
"(",
")",
";",
"$",
"variableName",
"="... | Sets revalidation counter value
@param string $variableName
@param int $value | [
"Sets",
"revalidation",
"counter",
"value"
] | 4d3b46781c387202c2dfbdb8760151b3ae8ef49c | https://github.com/mszewcz/php-light-framework/blob/4d3b46781c387202c2dfbdb8760151b3ae8ef49c/src/Session/Revalidation.php#L74-L81 |
12,236 | mszewcz/php-light-framework | src/Session/Revalidation.php | Revalidation.increaseRevalidationCounter | public static function increaseRevalidationCounter(string $variableName = '_MF_SESSION_REVALIDATION_COUNTER_'): void
{
static::init();
$variableName = (string)$variableName;
$vHandler = Variables::getInstance();
$vHandler->session->set($variableName, $vHandler->session->get($variable... | php | public static function increaseRevalidationCounter(string $variableName = '_MF_SESSION_REVALIDATION_COUNTER_'): void
{
static::init();
$variableName = (string)$variableName;
$vHandler = Variables::getInstance();
$vHandler->session->set($variableName, $vHandler->session->get($variable... | [
"public",
"static",
"function",
"increaseRevalidationCounter",
"(",
"string",
"$",
"variableName",
"=",
"'_MF_SESSION_REVALIDATION_COUNTER_'",
")",
":",
"void",
"{",
"static",
"::",
"init",
"(",
")",
";",
"$",
"variableName",
"=",
"(",
"string",
")",
"$",
"varia... | Increases revalidation counter
@param string $variableName | [
"Increases",
"revalidation",
"counter"
] | 4d3b46781c387202c2dfbdb8760151b3ae8ef49c | https://github.com/mszewcz/php-light-framework/blob/4d3b46781c387202c2dfbdb8760151b3ae8ef49c/src/Session/Revalidation.php#L88-L94 |
12,237 | mszewcz/php-light-framework | src/Session/Revalidation.php | Revalidation.resetRevalidationCounter | public static function resetRevalidationCounter(string $variableName = '_MF_SESSION_REVALIDATION_COUNTER_'): void
{
static::init();
$variableName = (string)$variableName;
$vHandler = Variables::getInstance();
if ($vHandler->session->get($variableName, Variables::TYPE_INT) > 0) {
... | php | public static function resetRevalidationCounter(string $variableName = '_MF_SESSION_REVALIDATION_COUNTER_'): void
{
static::init();
$variableName = (string)$variableName;
$vHandler = Variables::getInstance();
if ($vHandler->session->get($variableName, Variables::TYPE_INT) > 0) {
... | [
"public",
"static",
"function",
"resetRevalidationCounter",
"(",
"string",
"$",
"variableName",
"=",
"'_MF_SESSION_REVALIDATION_COUNTER_'",
")",
":",
"void",
"{",
"static",
"::",
"init",
"(",
")",
";",
"$",
"variableName",
"=",
"(",
"string",
")",
"$",
"variable... | Resets revalidation counter & regenerates session id
@param string $variableName | [
"Resets",
"revalidation",
"counter",
"&",
"regenerates",
"session",
"id"
] | 4d3b46781c387202c2dfbdb8760151b3ae8ef49c | https://github.com/mszewcz/php-light-framework/blob/4d3b46781c387202c2dfbdb8760151b3ae8ef49c/src/Session/Revalidation.php#L101-L110 |
12,238 | DBRisinajumi/d2person | models/PprsPerson.php | PprsPerson.getPersonsByRole | public static function getPersonsByRole($role = false){
$ccuc_status = CcucUserCompany::CCUC_STATUS_SYS;
$sys_ccmp_id = Yii::app()->sysCompany->getActiveCompany();
$sql = "
SELECT DISTINCT
pprs_id,
CONCAT(
pprs_second_name... | php | public static function getPersonsByRole($role = false){
$ccuc_status = CcucUserCompany::CCUC_STATUS_SYS;
$sys_ccmp_id = Yii::app()->sysCompany->getActiveCompany();
$sql = "
SELECT DISTINCT
pprs_id,
CONCAT(
pprs_second_name... | [
"public",
"static",
"function",
"getPersonsByRole",
"(",
"$",
"role",
"=",
"false",
")",
"{",
"$",
"ccuc_status",
"=",
"CcucUserCompany",
"::",
"CCUC_STATUS_SYS",
";",
"$",
"sys_ccmp_id",
"=",
"Yii",
"::",
"app",
"(",
")",
"->",
"sysCompany",
"->",
"getActiv... | get users list by role, roles or all
@param string/array/boolean $role
@return array(
array(pprs_id=>'1','full_name' => 'Andris Berzins',
array(pprs_id=>'2','full_name' => 'Karlis Berzins',
) | [
"get",
"users",
"list",
"by",
"role",
"roles",
"or",
"all"
] | de3967d0ef0646b7f95774743cf2a2ec8128681a | https://github.com/DBRisinajumi/d2person/blob/de3967d0ef0646b7f95774743cf2a2ec8128681a/models/PprsPerson.php#L195-L234 |
12,239 | DBRisinajumi/d2person | models/PprsPerson.php | PprsPerson.translitStringToAscii | public static function translitStringToAscii($str) {
$LATV=array("ā","Ā","č","Č","ē","Ē","ģ","Ģ","ī","Ī","ķ","Ķ","ļ","Ļ","ņ","Ņ","š","Š","ū","Ū","ž","Ž",".",'"'," ","-","_","/"); //Latviešu garie un mīkste burti un neatļautie simboli
$LATIN=array("a","A","c","C","e","E","g","G","i","I","k","K","l","L"... | php | public static function translitStringToAscii($str) {
$LATV=array("ā","Ā","č","Č","ē","Ē","ģ","Ģ","ī","Ī","ķ","Ķ","ļ","Ļ","ņ","Ņ","š","Š","ū","Ū","ž","Ž",".",'"'," ","-","_","/"); //Latviešu garie un mīkste burti un neatļautie simboli
$LATIN=array("a","A","c","C","e","E","g","G","i","I","k","K","l","L"... | [
"public",
"static",
"function",
"translitStringToAscii",
"(",
"$",
"str",
")",
"{",
"$",
"LATV",
"=",
"array",
"(",
"\"ā\",",
"\"",
"Ā\",\"",
"č",
"\",\"Č",
"\"",
",\"ē\"",
",",
"\"Ē\",",
"\"",
"ģ\",\"",
"Ģ",
"\",\"ī",
"\"",
",\"Ī\"",
",",
"\"ķ\",",
"\""... | replace latvian special characters to latin characters
@param string $str
@return string | [
"replace",
"latvian",
"special",
"characters",
"to",
"latin",
"characters"
] | de3967d0ef0646b7f95774743cf2a2ec8128681a | https://github.com/DBRisinajumi/d2person/blob/de3967d0ef0646b7f95774743cf2a2ec8128681a/models/PprsPerson.php#L308-L314 |
12,240 | DBRisinajumi/d2person | models/PprsPerson.php | PprsPerson.createUser | public function createUser(){
$password = DbrLib::rand_string(8);
/**
* create username
*/
$firstName = strtolower(self::translitStringToAscii($this->pprs_first_name));
$secondName = strtolower(self::translitStringToAscii($this->pprs_second_name));
... | php | public function createUser(){
$password = DbrLib::rand_string(8);
/**
* create username
*/
$firstName = strtolower(self::translitStringToAscii($this->pprs_first_name));
$secondName = strtolower(self::translitStringToAscii($this->pprs_second_name));
... | [
"public",
"function",
"createUser",
"(",
")",
"{",
"$",
"password",
"=",
"DbrLib",
"::",
"rand_string",
"(",
"8",
")",
";",
"/**\n * create username \n */",
"$",
"firstName",
"=",
"strtolower",
"(",
"self",
"::",
"translitStringToAscii",
"(",
"$",
... | create user account from person data
@return boolean|array - error | [
"create",
"user",
"account",
"from",
"person",
"data"
] | de3967d0ef0646b7f95774743cf2a2ec8128681a | https://github.com/DBRisinajumi/d2person/blob/de3967d0ef0646b7f95774743cf2a2ec8128681a/models/PprsPerson.php#L320-L379 |
12,241 | eghojansu/nutrition | src/Security/Authorization.php | Authorization.guard | public function guard($loginRoute = null)
{
$base = Base::instance();
$currentPath = $base['PATH'];
$this->parseFirewalls();
if (
$this->firewalls['pattern']
&& preg_match($this->firewalls['pattern'], $currentPath, $matches)
) {
$key = st... | php | public function guard($loginRoute = null)
{
$base = Base::instance();
$currentPath = $base['PATH'];
$this->parseFirewalls();
if (
$this->firewalls['pattern']
&& preg_match($this->firewalls['pattern'], $currentPath, $matches)
) {
$key = st... | [
"public",
"function",
"guard",
"(",
"$",
"loginRoute",
"=",
"null",
")",
"{",
"$",
"base",
"=",
"Base",
"::",
"instance",
"(",
")",
";",
"$",
"currentPath",
"=",
"$",
"base",
"[",
"'PATH'",
"]",
";",
"$",
"this",
"->",
"parseFirewalls",
"(",
")",
"... | Do guarding controller
@param string|null $loginRoute
@return $this | [
"Do",
"guarding",
"controller"
] | 3941c62aeb6dafda55349a38dd4107d521f8964a | https://github.com/eghojansu/nutrition/blob/3941c62aeb6dafda55349a38dd4107d521f8964a/src/Security/Authorization.php#L23-L43 |
12,242 | eghojansu/nutrition | src/Security/Authorization.php | Authorization.isGranted | public function isGranted($roles)
{
$this->parseRoles();
$roles = (array) $roles;
$intersection = array_intersect($roles, $this->roles);
return count($intersection) > 0;
} | php | public function isGranted($roles)
{
$this->parseRoles();
$roles = (array) $roles;
$intersection = array_intersect($roles, $this->roles);
return count($intersection) > 0;
} | [
"public",
"function",
"isGranted",
"(",
"$",
"roles",
")",
"{",
"$",
"this",
"->",
"parseRoles",
"(",
")",
";",
"$",
"roles",
"=",
"(",
"array",
")",
"$",
"roles",
";",
"$",
"intersection",
"=",
"array_intersect",
"(",
"$",
"roles",
",",
"$",
"this",... | Check if user granted for roles
@param string|array $roles
@return boolean | [
"Check",
"if",
"user",
"granted",
"for",
"roles"
] | 3941c62aeb6dafda55349a38dd4107d521f8964a | https://github.com/eghojansu/nutrition/blob/3941c62aeb6dafda55349a38dd4107d521f8964a/src/Security/Authorization.php#L50-L58 |
12,243 | eghojansu/nutrition | src/Security/Authorization.php | Authorization.parseFirewalls | protected function parseFirewalls($force = false)
{
if (null == $this->firewalls || $force) {
$firewalls = ['pattern'=>null,'paths'=>[]];
$pattern = '';
foreach (Base::instance()->get('SECURITY.firewalls') ?: [] as $name => $config) {
$pattern .= ($patter... | php | protected function parseFirewalls($force = false)
{
if (null == $this->firewalls || $force) {
$firewalls = ['pattern'=>null,'paths'=>[]];
$pattern = '';
foreach (Base::instance()->get('SECURITY.firewalls') ?: [] as $name => $config) {
$pattern .= ($patter... | [
"protected",
"function",
"parseFirewalls",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"null",
"==",
"$",
"this",
"->",
"firewalls",
"||",
"$",
"force",
")",
"{",
"$",
"firewalls",
"=",
"[",
"'pattern'",
"=>",
"null",
",",
"'paths'",
"=>",
... | Parse firewalls from configuration
@param boolean $force force parsing
@return void | [
"Parse",
"firewalls",
"from",
"configuration"
] | 3941c62aeb6dafda55349a38dd4107d521f8964a | https://github.com/eghojansu/nutrition/blob/3941c62aeb6dafda55349a38dd4107d521f8964a/src/Security/Authorization.php#L65-L86 |
12,244 | eghojansu/nutrition | src/Security/Authorization.php | Authorization.parseRoles | protected function parseRoles($force = false)
{
if (null == $this->roles || $force) {
$user = UserManager::instance()->getuser();
$userRoles = $user ? $user->getRoles() : ['ROLE_ANONYMOUS'];
$roleHierarchy = Base::instance()->get('SECURITY.role_hierarchy') ?: [];
... | php | protected function parseRoles($force = false)
{
if (null == $this->roles || $force) {
$user = UserManager::instance()->getuser();
$userRoles = $user ? $user->getRoles() : ['ROLE_ANONYMOUS'];
$roleHierarchy = Base::instance()->get('SECURITY.role_hierarchy') ?: [];
... | [
"protected",
"function",
"parseRoles",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"null",
"==",
"$",
"this",
"->",
"roles",
"||",
"$",
"force",
")",
"{",
"$",
"user",
"=",
"UserManager",
"::",
"instance",
"(",
")",
"->",
"getuser",
"(",
... | Parse user roles
@param boolean $force force parsing
@return void | [
"Parse",
"user",
"roles"
] | 3941c62aeb6dafda55349a38dd4107d521f8964a | https://github.com/eghojansu/nutrition/blob/3941c62aeb6dafda55349a38dd4107d521f8964a/src/Security/Authorization.php#L93-L111 |
12,245 | eghojansu/nutrition | src/Security/Authorization.php | Authorization.getHierarchy | protected function getHierarchy($role, array $roleHierarchy)
{
$roles = [];
if (array_key_exists($role, $roleHierarchy)) {
$roleRoles = (array) $roleHierarchy[$role];
foreach ($roleRoles as $role) {
$roles = array_merge($roles, $this->getHierarchy($role, $role... | php | protected function getHierarchy($role, array $roleHierarchy)
{
$roles = [];
if (array_key_exists($role, $roleHierarchy)) {
$roleRoles = (array) $roleHierarchy[$role];
foreach ($roleRoles as $role) {
$roles = array_merge($roles, $this->getHierarchy($role, $role... | [
"protected",
"function",
"getHierarchy",
"(",
"$",
"role",
",",
"array",
"$",
"roleHierarchy",
")",
"{",
"$",
"roles",
"=",
"[",
"]",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"role",
",",
"$",
"roleHierarchy",
")",
")",
"{",
"$",
"roleRoles",
"=",... | Get hierarchy for role
@param string $role
@param array $roleHierarchy
@return array | [
"Get",
"hierarchy",
"for",
"role"
] | 3941c62aeb6dafda55349a38dd4107d521f8964a | https://github.com/eghojansu/nutrition/blob/3941c62aeb6dafda55349a38dd4107d521f8964a/src/Security/Authorization.php#L119-L131 |
12,246 | faithmade/churchthemes | includes/classes/breadcrumbs.php | CTFW_WIDGETS_Breadcrumbs.taxonomy_term_breadcrumbs | public function taxonomy_term_breadcrumbs( $term, $taxonomy ) {
$term_breadcrumbs = array();
if ( ! empty( $term ) ) {
$term_obj = get_term( $term, $taxonomy ); // in case $term is ID, not already object
// Current term
$this->add_breadcrumb( $term_breadcrumbs, array(
$term_obj->name,
get_term_... | php | public function taxonomy_term_breadcrumbs( $term, $taxonomy ) {
$term_breadcrumbs = array();
if ( ! empty( $term ) ) {
$term_obj = get_term( $term, $taxonomy ); // in case $term is ID, not already object
// Current term
$this->add_breadcrumb( $term_breadcrumbs, array(
$term_obj->name,
get_term_... | [
"public",
"function",
"taxonomy_term_breadcrumbs",
"(",
"$",
"term",
",",
"$",
"taxonomy",
")",
"{",
"$",
"term_breadcrumbs",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"term",
")",
")",
"{",
"$",
"term_obj",
"=",
"get_term",
"(",
... | Get taxonomy term breadcrumbs
@since 0.9
@access public
@param mixed $term Taxonomy term as ID or object
@param string $taxonomy Taxonomy slug to get breadcrumb ancestors for
@return array Breadcrumb ancestors for taxonomy term | [
"Get",
"taxonomy",
"term",
"breadcrumbs"
] | b121e840edaec8fdb3189fc9324cc88d7a0db81c | https://github.com/faithmade/churchthemes/blob/b121e840edaec8fdb3189fc9324cc88d7a0db81c/includes/classes/breadcrumbs.php#L179-L223 |
12,247 | faithmade/churchthemes | includes/classes/breadcrumbs.php | CTFW_WIDGETS_Breadcrumbs.date_breadcrumbs | public function date_breadcrumbs( $base_url = false ) {
$date_breadcrumbs = array();
// Year
$year = get_query_var( 'year' );
if ( ! empty( $year ) ) {
$dateformatstring = _x( 'Y', 'breadcrumb year format', 'church-theme-framework' );
if ( ! empty( $base_url ) ) { // if base URL given, use it (such as... | php | public function date_breadcrumbs( $base_url = false ) {
$date_breadcrumbs = array();
// Year
$year = get_query_var( 'year' );
if ( ! empty( $year ) ) {
$dateformatstring = _x( 'Y', 'breadcrumb year format', 'church-theme-framework' );
if ( ! empty( $base_url ) ) { // if base URL given, use it (such as... | [
"public",
"function",
"date_breadcrumbs",
"(",
"$",
"base_url",
"=",
"false",
")",
"{",
"$",
"date_breadcrumbs",
"=",
"array",
"(",
")",
";",
"// Year",
"$",
"year",
"=",
"get_query_var",
"(",
"'year'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"yea... | Get date breadcrumbs
@since 0.9
@access public
@param string $base_url Provide a base URL for custom post type archives
@return array Date breadcrumbs | [
"Get",
"date",
"breadcrumbs"
] | b121e840edaec8fdb3189fc9324cc88d7a0db81c | https://github.com/faithmade/churchthemes/blob/b121e840edaec8fdb3189fc9324cc88d7a0db81c/includes/classes/breadcrumbs.php#L233-L299 |
12,248 | jaredtking/jaqb | src/Statement/FromStatement.php | FromStatement.buildJoins | private function buildJoins(array $joins)
{
foreach ($joins as &$join) {
// table(s)
foreach ($join[1] as &$table) {
$table = $this->escapeIdentifier($table);
}
$join[1] = implode(', ', array_filter($join[1]));
// on clause
... | php | private function buildJoins(array $joins)
{
foreach ($joins as &$join) {
// table(s)
foreach ($join[1] as &$table) {
$table = $this->escapeIdentifier($table);
}
$join[1] = implode(', ', array_filter($join[1]));
// on clause
... | [
"private",
"function",
"buildJoins",
"(",
"array",
"$",
"joins",
")",
"{",
"foreach",
"(",
"$",
"joins",
"as",
"&",
"$",
"join",
")",
"{",
"// table(s)",
"foreach",
"(",
"$",
"join",
"[",
"1",
"]",
"as",
"&",
"$",
"table",
")",
"{",
"$",
"table",
... | Builds a list of joins.
@param array $joins
@return string | [
"Builds",
"a",
"list",
"of",
"joins",
"."
] | 04a853b530fcc12a9863349d3d0da6377d1b9995 | https://github.com/jaredtking/jaqb/blob/04a853b530fcc12a9863349d3d0da6377d1b9995/src/Statement/FromStatement.php#L165-L196 |
12,249 | Innmind/RestBundle | Client/Server.php | Server.remove | public function remove($name, $id)
{
$this->client->remove(
$this->capabilities->get($name)->getUrl() . (string) $id
);
return $this;
} | php | public function remove($name, $id)
{
$this->client->remove(
$this->capabilities->get($name)->getUrl() . (string) $id
);
return $this;
} | [
"public",
"function",
"remove",
"(",
"$",
"name",
",",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"client",
"->",
"remove",
"(",
"$",
"this",
"->",
"capabilities",
"->",
"get",
"(",
"$",
"name",
")",
"->",
"getUrl",
"(",
")",
".",
"(",
"string",
")"... | Delete a resource
@param string $name
@param mixed $id
@return Server self | [
"Delete",
"a",
"resource"
] | 46de57d9b45dfbfcf98867be3c601fba57f2edc2 | https://github.com/Innmind/RestBundle/blob/46de57d9b45dfbfcf98867be3c601fba57f2edc2/Client/Server.php#L89-L96 |
12,250 | Innmind/RestBundle | Client/Server.php | Server.getResources | public function getResources()
{
$keys = $this->capabilities->keys();
$definitions = [];
foreach ($keys as $key) {
$definitions[$key] = $this->capabilities->get($key);
}
return $definitions;
} | php | public function getResources()
{
$keys = $this->capabilities->keys();
$definitions = [];
foreach ($keys as $key) {
$definitions[$key] = $this->capabilities->get($key);
}
return $definitions;
} | [
"public",
"function",
"getResources",
"(",
")",
"{",
"$",
"keys",
"=",
"$",
"this",
"->",
"capabilities",
"->",
"keys",
"(",
")",
";",
"$",
"definitions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"$",
"definition... | Return the list of resource definitions exposed via the capabilities route
@return array | [
"Return",
"the",
"list",
"of",
"resource",
"definitions",
"exposed",
"via",
"the",
"capabilities",
"route"
] | 46de57d9b45dfbfcf98867be3c601fba57f2edc2 | https://github.com/Innmind/RestBundle/blob/46de57d9b45dfbfcf98867be3c601fba57f2edc2/Client/Server.php#L103-L113 |
12,251 | synapsestudios/synapse-base | src/Synapse/Email/MandrillSender.php | MandrillSender.buildMessage | protected function buildMessage(EmailEntity $email)
{
// Create attachments array
$attachments = json_decode($email->getAttachments(), true);
$recipientEmail = $email->getRecipientEmail();
$to = [
[
'email' => $this->filterThroughWhitelist($recipientEmai... | php | protected function buildMessage(EmailEntity $email)
{
// Create attachments array
$attachments = json_decode($email->getAttachments(), true);
$recipientEmail = $email->getRecipientEmail();
$to = [
[
'email' => $this->filterThroughWhitelist($recipientEmai... | [
"protected",
"function",
"buildMessage",
"(",
"EmailEntity",
"$",
"email",
")",
"{",
"// Create attachments array",
"$",
"attachments",
"=",
"json_decode",
"(",
"$",
"email",
"->",
"getAttachments",
"(",
")",
",",
"true",
")",
";",
"$",
"recipientEmail",
"=",
... | Build Mandrill compatible message array from email entity
Documentation at https://mandrillapp.com/api/docs/messages.php.html
@param EmailEntity $emails
@return array | [
"Build",
"Mandrill",
"compatible",
"message",
"array",
"from",
"email",
"entity"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/Email/MandrillSender.php#L61-L97 |
12,252 | laasti/lazydata | src/Resolvers/FilterResolver.php | FilterResolver.resolve | public function resolve($value, $default = 'value')
{
$matches = [];
if (is_string($value) && preg_match('/^('.self::KEY_REGEX.')'. preg_quote($this->separator).'(.*)/', $value, $matches)) {
if (isset($this->filters[$matches[1]])) {
return call_user_func_array($this->fil... | php | public function resolve($value, $default = 'value')
{
$matches = [];
if (is_string($value) && preg_match('/^('.self::KEY_REGEX.')'. preg_quote($this->separator).'(.*)/', $value, $matches)) {
if (isset($this->filters[$matches[1]])) {
return call_user_func_array($this->fil... | [
"public",
"function",
"resolve",
"(",
"$",
"value",
",",
"$",
"default",
"=",
"'value'",
")",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
"&&",
"preg_match",
"(",
"'/^('",
".",
"self",
"::",
"KEY_REGEX",
... | Attempts to resolve through defined filters
@param mixed $value | [
"Attempts",
"to",
"resolve",
"through",
"defined",
"filters"
] | 44ceab7475177fc94eeb4fa3b8b630f5fc4fa301 | https://github.com/laasti/lazydata/blob/44ceab7475177fc94eeb4fa3b8b630f5fc4fa301/src/Resolvers/FilterResolver.php#L54-L66 |
12,253 | laasti/lazydata | src/Resolvers/FilterResolver.php | FilterResolver.setFilter | public function setFilter($key, $callable)
{
if (!is_callable($callable)) {
throw new InvalidArgumentException('Invalid callable for filter: "'.$key.'"');
}
if (!preg_match('/^'.self::KEY_REGEX.'$/', $key)) {
throw new InvalidArgumentException('Invalid name for filter... | php | public function setFilter($key, $callable)
{
if (!is_callable($callable)) {
throw new InvalidArgumentException('Invalid callable for filter: "'.$key.'"');
}
if (!preg_match('/^'.self::KEY_REGEX.'$/', $key)) {
throw new InvalidArgumentException('Invalid name for filter... | [
"public",
"function",
"setFilter",
"(",
"$",
"key",
",",
"$",
"callable",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callable",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Invalid callable for filter: \"'",
".",
"$",
"key",
"."... | Map a filter to a callable
@param string $key
@param callable $callable
@return FilterResolver
@throws InvalidArgumentException | [
"Map",
"a",
"filter",
"to",
"a",
"callable"
] | 44ceab7475177fc94eeb4fa3b8b630f5fc4fa301 | https://github.com/laasti/lazydata/blob/44ceab7475177fc94eeb4fa3b8b630f5fc4fa301/src/Resolvers/FilterResolver.php#L75-L88 |
12,254 | konservs/brilliant.framework | libraries/CMS/BBreadcrumbs.php | BBreadcrumbs.add_element | public function add_element($url,$name,$active=true,$class='',$children=array()){
$this->elements[]=(object)array(
'url'=>$url,
'name'=>$name,
'active'=>$active,
'class'=>$class,
'children'=>$children,
);
} | php | public function add_element($url,$name,$active=true,$class='',$children=array()){
$this->elements[]=(object)array(
'url'=>$url,
'name'=>$name,
'active'=>$active,
'class'=>$class,
'children'=>$children,
);
} | [
"public",
"function",
"add_element",
"(",
"$",
"url",
",",
"$",
"name",
",",
"$",
"active",
"=",
"true",
",",
"$",
"class",
"=",
"''",
",",
"$",
"children",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"elements",
"[",
"]",
"=",
"(",
"o... | Add breadcrumb element into array. | [
"Add",
"breadcrumb",
"element",
"into",
"array",
"."
] | 95f03f1917f746fee98bea8a906ba0588c87762d | https://github.com/konservs/brilliant.framework/blob/95f03f1917f746fee98bea8a906ba0588c87762d/libraries/CMS/BBreadcrumbs.php#L22-L30 |
12,255 | konservs/brilliant.framework | libraries/CMS/BBreadcrumbs.php | BBreadcrumbs.draw | public function draw(){
$bRouter=\Application\BRouter::getInstance();
$template=$bRouter->templatename;
$suffix=\Brilliant\HTTP\BBrowserUseragent::getDeviceSuffix();
$fn=BTEMPLATESPATH.$template.DIRECTORY_SEPARATOR.'breadcrumbs'.$suffix.'.php';
if(!file_exists($fn)){
$fn=BTEMPLATESPATH.$template.DIRECTORY... | php | public function draw(){
$bRouter=\Application\BRouter::getInstance();
$template=$bRouter->templatename;
$suffix=\Brilliant\HTTP\BBrowserUseragent::getDeviceSuffix();
$fn=BTEMPLATESPATH.$template.DIRECTORY_SEPARATOR.'breadcrumbs'.$suffix.'.php';
if(!file_exists($fn)){
$fn=BTEMPLATESPATH.$template.DIRECTORY... | [
"public",
"function",
"draw",
"(",
")",
"{",
"$",
"bRouter",
"=",
"\\",
"Application",
"\\",
"BRouter",
"::",
"getInstance",
"(",
")",
";",
"$",
"template",
"=",
"$",
"bRouter",
"->",
"templatename",
";",
"$",
"suffix",
"=",
"\\",
"Brilliant",
"\\",
"H... | Draw breadcrumbs HTML | [
"Draw",
"breadcrumbs",
"HTML"
] | 95f03f1917f746fee98bea8a906ba0588c87762d | https://github.com/konservs/brilliant.framework/blob/95f03f1917f746fee98bea8a906ba0588c87762d/libraries/CMS/BBreadcrumbs.php#L34-L54 |
12,256 | zepi/turbo-base | Zepi/Web/UserInterface/src/Table/Column.php | Column.getHtmlWidth | public function getHtmlWidth()
{
if (is_string($this->width) && $this->width === self::WIDTH_AUTO) {
return '';
} else if (intval($this->width) > 0) {
return $this->width . '%';
}
return $this->width;
} | php | public function getHtmlWidth()
{
if (is_string($this->width) && $this->width === self::WIDTH_AUTO) {
return '';
} else if (intval($this->width) > 0) {
return $this->width . '%';
}
return $this->width;
} | [
"public",
"function",
"getHtmlWidth",
"(",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"this",
"->",
"width",
")",
"&&",
"$",
"this",
"->",
"width",
"===",
"self",
"::",
"WIDTH_AUTO",
")",
"{",
"return",
"''",
";",
"}",
"else",
"if",
"(",
"intval",
... | Returns the correct with for the html attribute
@access public
@return string | [
"Returns",
"the",
"correct",
"with",
"for",
"the",
"html",
"attribute"
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/UserInterface/src/Table/Column.php#L158-L167 |
12,257 | bugadani/Annotiny | src/AnnotationParser.php | AnnotationParser.parse | public function parse($commentString, $target)
{
// Extract the description part of the comment block
$commentString = $this->stripCommentDecoration($commentString);
$parts = preg_split('/^\s*(?=@[a-zA-Z]+)/m', $commentString, 2);
$comment = new Comment(trim($parts[0]));
... | php | public function parse($commentString, $target)
{
// Extract the description part of the comment block
$commentString = $this->stripCommentDecoration($commentString);
$parts = preg_split('/^\s*(?=@[a-zA-Z]+)/m', $commentString, 2);
$comment = new Comment(trim($parts[0]));
... | [
"public",
"function",
"parse",
"(",
"$",
"commentString",
",",
"$",
"target",
")",
"{",
"// Extract the description part of the comment block",
"$",
"commentString",
"=",
"$",
"this",
"->",
"stripCommentDecoration",
"(",
"$",
"commentString",
")",
";",
"$",
"parts",... | Parses a documentation comment.
@param string $commentString
@param $target
@return Comment | [
"Parses",
"a",
"documentation",
"comment",
"."
] | 9f28202192350c84b8158efc3984b00c5cdd1946 | https://github.com/bugadani/Annotiny/blob/9f28202192350c84b8158efc3984b00c5cdd1946/src/AnnotationParser.php#L59-L99 |
12,258 | bkazuo/common-helper-utilities | src/Helper/UtilityHelper.php | UtilityHelper.getDistance | public function getDistance($lat1, $lgn1, $lat2, $lgn2){
$earth_radius = 6371;
$alpha = $lat1 - $lat2;
$beta = $lgn1 - $lgn2;
$h = pow((sin(deg2rad($alpha/2))), 2) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * pow(sin(deg2rad($beta/2)),2);
$dist = 2*$earth_radius*sqrt($h);
... | php | public function getDistance($lat1, $lgn1, $lat2, $lgn2){
$earth_radius = 6371;
$alpha = $lat1 - $lat2;
$beta = $lgn1 - $lgn2;
$h = pow((sin(deg2rad($alpha/2))), 2) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * pow(sin(deg2rad($beta/2)),2);
$dist = 2*$earth_radius*sqrt($h);
... | [
"public",
"function",
"getDistance",
"(",
"$",
"lat1",
",",
"$",
"lgn1",
",",
"$",
"lat2",
",",
"$",
"lgn2",
")",
"{",
"$",
"earth_radius",
"=",
"6371",
";",
"$",
"alpha",
"=",
"$",
"lat1",
"-",
"$",
"lat2",
";",
"$",
"beta",
"=",
"$",
"lgn1",
... | Get distance between two lat and lng
@param string $lat1
@param string $lng1
@param string $lat2
@param string $lng2 | [
"Get",
"distance",
"between",
"two",
"lat",
"and",
"lng"
] | 668fec3333a9db61ffe20e392346e1787dc85d38 | https://github.com/bkazuo/common-helper-utilities/blob/668fec3333a9db61ffe20e392346e1787dc85d38/src/Helper/UtilityHelper.php#L57-L65 |
12,259 | bkazuo/common-helper-utilities | src/Helper/UtilityHelper.php | UtilityHelper.hourRange | public function hourRange($openingTime, $closingTime){
$time1 = strtotime($openingTime);
$time2 = strtotime($closingTime);
return round(abs($time2 - $time1) / 3600,2);
} | php | public function hourRange($openingTime, $closingTime){
$time1 = strtotime($openingTime);
$time2 = strtotime($closingTime);
return round(abs($time2 - $time1) / 3600,2);
} | [
"public",
"function",
"hourRange",
"(",
"$",
"openingTime",
",",
"$",
"closingTime",
")",
"{",
"$",
"time1",
"=",
"strtotime",
"(",
"$",
"openingTime",
")",
";",
"$",
"time2",
"=",
"strtotime",
"(",
"$",
"closingTime",
")",
";",
"return",
"round",
"(",
... | Get difference of hours between hours
@param string $startHour
@param string $endHour | [
"Get",
"difference",
"of",
"hours",
"between",
"hours"
] | 668fec3333a9db61ffe20e392346e1787dc85d38 | https://github.com/bkazuo/common-helper-utilities/blob/668fec3333a9db61ffe20e392346e1787dc85d38/src/Helper/UtilityHelper.php#L231-L235 |
12,260 | tkhatibi/php-field | src/Field.php | Field.array2attrs | public static function array2attrs($assoc){
$attrs = [];
foreach ((array) $assoc as $key => $value) {
$attrs[] = is_string($key)
? "$key='$value'"
: trim($value);
}
return implode(' ', $attrs);
} | php | public static function array2attrs($assoc){
$attrs = [];
foreach ((array) $assoc as $key => $value) {
$attrs[] = is_string($key)
? "$key='$value'"
: trim($value);
}
return implode(' ', $attrs);
} | [
"public",
"static",
"function",
"array2attrs",
"(",
"$",
"assoc",
")",
"{",
"$",
"attrs",
"=",
"[",
"]",
";",
"foreach",
"(",
"(",
"array",
")",
"$",
"assoc",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"attrs",
"[",
"]",
"=",
"is_string... | Get array and make attributes string
@example
['class'=>'testClass', 'name'=>'foo' 'value'=>'bar', "id='exampleId'"]
class='testClass' name='foo' value='bar' id='exampleId'
@category Rendering
@param array|object html attributes
@return string html attributes | [
"Get",
"array",
"and",
"make",
"attributes",
"string"
] | 629657a7f96353ab6caf11ca9319a17ede719b76 | https://github.com/tkhatibi/php-field/blob/629657a7f96353ab6caf11ca9319a17ede719b76/src/Field.php#L127-L135 |
12,261 | tkhatibi/php-field | src/Field.php | Field.__tostring | public function __tostring() {
// Prepare field label
if (!$this->label)
$this->label = $this->name;
// Prepare errors
$errors = [];
foreach ((array) $this->errors as $error) {
// Get Html code by $error
$errors[] = $this->renderError($... | php | public function __tostring() {
// Prepare field label
if (!$this->label)
$this->label = $this->name;
// Prepare errors
$errors = [];
foreach ((array) $this->errors as $error) {
// Get Html code by $error
$errors[] = $this->renderError($... | [
"public",
"function",
"__tostring",
"(",
")",
"{",
"// Prepare field label\r",
"if",
"(",
"!",
"$",
"this",
"->",
"label",
")",
"$",
"this",
"->",
"label",
"=",
"$",
"this",
"->",
"name",
";",
"// Prepare errors\r",
"$",
"errors",
"=",
"[",
"]",
";",
"... | Prepare some config and render element
@uses self::prepareAttributes() to make html code related to the attributes
@uses self::array2attrs() to make html code related to the attributes
@category Rendering
@return string Rendered element | [
"Prepare",
"some",
"config",
"and",
"render",
"element"
] | 629657a7f96353ab6caf11ca9319a17ede719b76 | https://github.com/tkhatibi/php-field/blob/629657a7f96353ab6caf11ca9319a17ede719b76/src/Field.php#L147-L165 |
12,262 | tkhatibi/php-field | src/Field.php | Field.validate | public function validate() {
// Deny if rules array is empty
if (empty($this->rules))
return true;
// If rules are invalid
if (!is_array($this->rules))
throw new \Exception("The rules must be an array of the validator|sanitize rules", 1);
// Loop th... | php | public function validate() {
// Deny if rules array is empty
if (empty($this->rules))
return true;
// If rules are invalid
if (!is_array($this->rules))
throw new \Exception("The rules must be an array of the validator|sanitize rules", 1);
// Loop th... | [
"public",
"function",
"validate",
"(",
")",
"{",
"// Deny if rules array is empty\r",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"rules",
")",
")",
"return",
"true",
";",
"// If rules are invalid\r",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"rule... | Run the rule of the rules
Each rule can push error to the field or change the value of the field
@category Validation
@return boolean The result of validation | [
"Run",
"the",
"rule",
"of",
"the",
"rules",
"Each",
"rule",
"can",
"push",
"error",
"to",
"the",
"field",
"or",
"change",
"the",
"value",
"of",
"the",
"field"
] | 629657a7f96353ab6caf11ca9319a17ede719b76 | https://github.com/tkhatibi/php-field/blob/629657a7f96353ab6caf11ca9319a17ede719b76/src/Field.php#L246-L262 |
12,263 | wpfulcrum/foundation | src/Foundation/ServiceProvider/Provider.php | Provider.initDefaults | protected function initDefaults()
{
if (!$this->hasDefaults) {
return '';
}
$this->defaultsLocation = get_calling_class_directory($this) . DIRECTORY_SEPARATOR . $this->defaultsLocation;
return ConfigFactory::loadConfigFile($this->defaultsLocation);
} | php | protected function initDefaults()
{
if (!$this->hasDefaults) {
return '';
}
$this->defaultsLocation = get_calling_class_directory($this) . DIRECTORY_SEPARATOR . $this->defaultsLocation;
return ConfigFactory::loadConfigFile($this->defaultsLocation);
} | [
"protected",
"function",
"initDefaults",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasDefaults",
")",
"{",
"return",
"''",
";",
"}",
"$",
"this",
"->",
"defaultsLocation",
"=",
"get_calling_class_directory",
"(",
"$",
"this",
")",
".",
"DIRECTORY_... | Initialize the defaults.
@since 3.0.0
@return void | [
"Initialize",
"the",
"defaults",
"."
] | a9655d8fa3bcc4b9d99586bb84a9f36dfa63ed56 | https://github.com/wpfulcrum/foundation/blob/a9655d8fa3bcc4b9d99586bb84a9f36dfa63ed56/src/Foundation/ServiceProvider/Provider.php#L96-L105 |
12,264 | wpfulcrum/foundation | src/Foundation/ServiceProvider/Provider.php | Provider.register | public function register(array $concreteConfig, $uniqueId)
{
$concreteConfig = $this->parseWithDefaultStructure($concreteConfig);
if (!Validator::okayToRegister($uniqueId, $concreteConfig, $this->defaultStructure, __CLASS__)) {
return false;
}
$concrete = $this->getConc... | php | public function register(array $concreteConfig, $uniqueId)
{
$concreteConfig = $this->parseWithDefaultStructure($concreteConfig);
if (!Validator::okayToRegister($uniqueId, $concreteConfig, $this->defaultStructure, __CLASS__)) {
return false;
}
$concrete = $this->getConc... | [
"public",
"function",
"register",
"(",
"array",
"$",
"concreteConfig",
",",
"$",
"uniqueId",
")",
"{",
"$",
"concreteConfig",
"=",
"$",
"this",
"->",
"parseWithDefaultStructure",
"(",
"$",
"concreteConfig",
")",
";",
"if",
"(",
"!",
"Validator",
"::",
"okayT... | Register a concrete into the container.
@since 3.0.0
@param array $concreteConfig Concrete's runtime configuration parameters.
@param string $uniqueId Container's unique key ID for this instance.
@returns mixed | [
"Register",
"a",
"concrete",
"into",
"the",
"container",
"."
] | a9655d8fa3bcc4b9d99586bb84a9f36dfa63ed56 | https://github.com/wpfulcrum/foundation/blob/a9655d8fa3bcc4b9d99586bb84a9f36dfa63ed56/src/Foundation/ServiceProvider/Provider.php#L133-L148 |
12,265 | wpfulcrum/foundation | src/Foundation/ServiceProvider/Provider.php | Provider.registerConcrete | protected function registerConcrete(array $concrete, $uniqueId)
{
$this->uniqueIds[] = $uniqueId;
return $this->fulcrum->registerConcrete($concrete, $uniqueId);
} | php | protected function registerConcrete(array $concrete, $uniqueId)
{
$this->uniqueIds[] = $uniqueId;
return $this->fulcrum->registerConcrete($concrete, $uniqueId);
} | [
"protected",
"function",
"registerConcrete",
"(",
"array",
"$",
"concrete",
",",
"$",
"uniqueId",
")",
"{",
"$",
"this",
"->",
"uniqueIds",
"[",
"]",
"=",
"$",
"uniqueId",
";",
"return",
"$",
"this",
"->",
"fulcrum",
"->",
"registerConcrete",
"(",
"$",
"... | Register the concrete into the Container.
@since 3.0.0
@param array $concrete Array for the concrete to be registered.
@param string $uniqueId Container's unique key ID for this instance.
@return mixed | [
"Register",
"the",
"concrete",
"into",
"the",
"Container",
"."
] | a9655d8fa3bcc4b9d99586bb84a9f36dfa63ed56 | https://github.com/wpfulcrum/foundation/blob/a9655d8fa3bcc4b9d99586bb84a9f36dfa63ed56/src/Foundation/ServiceProvider/Provider.php#L176-L181 |
12,266 | kore/CTXParser | src/php/CTXParser/Tokenizer/Regexp.php | Regexp.tokenize | public function tokenize($string)
{
$line = 1;
$position = 1;
$tokens = array();
while (strlen($string)) {
foreach ($this->expressions as $rule) {
if (!preg_match($rule['match'], $string, $match)) {
continue;
}
... | php | public function tokenize($string)
{
$line = 1;
$position = 1;
$tokens = array();
while (strlen($string)) {
foreach ($this->expressions as $rule) {
if (!preg_match($rule['match'], $string, $match)) {
continue;
}
... | [
"public",
"function",
"tokenize",
"(",
"$",
"string",
")",
"{",
"$",
"line",
"=",
"1",
";",
"$",
"position",
"=",
"1",
";",
"$",
"tokens",
"=",
"array",
"(",
")",
";",
"while",
"(",
"strlen",
"(",
"$",
"string",
")",
")",
"{",
"foreach",
"(",
"... | Tokenize the input string
Returns an array of Token structs representing the tokens.
@param string $string
@return Token[] | [
"Tokenize",
"the",
"input",
"string"
] | 9b11c2311a9de61baee7edafe46d1671dd5833c4 | https://github.com/kore/CTXParser/blob/9b11c2311a9de61baee7edafe46d1671dd5833c4/src/php/CTXParser/Tokenizer/Regexp.php#L70-L111 |
12,267 | SocietyCMS/User | Repositories/Entrust/EntrustUserRepository.php | EntrustUserRepository.create | public function create(array $data)
{
if (array_key_exists('password', $data)) {
$data['password'] = bcrypt($data['password']);
}
return parent::create($data);
} | php | public function create(array $data)
{
if (array_key_exists('password', $data)) {
$data['password'] = bcrypt($data['password']);
}
return parent::create($data);
} | [
"public",
"function",
"create",
"(",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'password'",
",",
"$",
"data",
")",
")",
"{",
"$",
"data",
"[",
"'password'",
"]",
"=",
"bcrypt",
"(",
"$",
"data",
"[",
"'password'",
"]",
")",... | Encrypt password before creating a new user instance.
@param array $data
@return EloquentUser | [
"Encrypt",
"password",
"before",
"creating",
"a",
"new",
"user",
"instance",
"."
] | 76f7b52b27e8a9740f8d5a9c3b86181e1c231634 | https://github.com/SocietyCMS/User/blob/76f7b52b27e8a9740f8d5a9c3b86181e1c231634/Repositories/Entrust/EntrustUserRepository.php#L27-L34 |
12,268 | SocietyCMS/User | Repositories/Entrust/EntrustUserRepository.php | EntrustUserRepository.update | public function update(array $data, $id)
{
if (array_key_exists('password', $data)) {
$data['password'] = bcrypt($data['password']);
}
return parent::update($data, $id);
} | php | public function update(array $data, $id)
{
if (array_key_exists('password', $data)) {
$data['password'] = bcrypt($data['password']);
}
return parent::update($data, $id);
} | [
"public",
"function",
"update",
"(",
"array",
"$",
"data",
",",
"$",
"id",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'password'",
",",
"$",
"data",
")",
")",
"{",
"$",
"data",
"[",
"'password'",
"]",
"=",
"bcrypt",
"(",
"$",
"data",
"[",
"'pas... | Encrypt password before updating a user instance.
@param array $data
@return EloquentUser | [
"Encrypt",
"password",
"before",
"updating",
"a",
"user",
"instance",
"."
] | 76f7b52b27e8a9740f8d5a9c3b86181e1c231634 | https://github.com/SocietyCMS/User/blob/76f7b52b27e8a9740f8d5a9c3b86181e1c231634/Repositories/Entrust/EntrustUserRepository.php#L43-L50 |
12,269 | e-commerce-passaro/compra | src/Compra/Manager.php | Manager.generateListByIterator | private function generateListByIterator(Iterator $iterator)
{
$resultado = array();
foreach ($iterator as $compra) {
$resultado[] = $this->preencherCompra($compra);
}
return $resultado;
} | php | private function generateListByIterator(Iterator $iterator)
{
$resultado = array();
foreach ($iterator as $compra) {
$resultado[] = $this->preencherCompra($compra);
}
return $resultado;
} | [
"private",
"function",
"generateListByIterator",
"(",
"Iterator",
"$",
"iterator",
")",
"{",
"$",
"resultado",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"iterator",
"as",
"$",
"compra",
")",
"{",
"$",
"resultado",
"[",
"]",
"=",
"$",
"this",
"-... | Gera um lista completa de compras a partir de um iterator
@param Iterator $iterator | [
"Gera",
"um",
"lista",
"completa",
"de",
"compras",
"a",
"partir",
"de",
"um",
"iterator"
] | 8acf4ec2dbcb32305b7855bf6d936c8b95ddd105 | https://github.com/e-commerce-passaro/compra/blob/8acf4ec2dbcb32305b7855bf6d936c8b95ddd105/src/Compra/Manager.php#L61-L69 |
12,270 | e-commerce-passaro/compra | src/Compra/Manager.php | Manager.preencherCompra | public function preencherCompra(Compra $compra)
{
$compra->setProduto($this->getProdutoManager()->getProduto($compra->getProdutoId()));
$compra->setAutenticacao($this->getAutenticacaoManager()->obterAutenticacaoBasica($compra->getAutenticacaoId()));
$compra->setStatus($this->getStatusManager... | php | public function preencherCompra(Compra $compra)
{
$compra->setProduto($this->getProdutoManager()->getProduto($compra->getProdutoId()));
$compra->setAutenticacao($this->getAutenticacaoManager()->obterAutenticacaoBasica($compra->getAutenticacaoId()));
$compra->setStatus($this->getStatusManager... | [
"public",
"function",
"preencherCompra",
"(",
"Compra",
"$",
"compra",
")",
"{",
"$",
"compra",
"->",
"setProduto",
"(",
"$",
"this",
"->",
"getProdutoManager",
"(",
")",
"->",
"getProduto",
"(",
"$",
"compra",
"->",
"getProdutoId",
"(",
")",
")",
")",
"... | Preenche as entidades relacionadas na compra
@param Compra $compra
@return \Compra\Compra | [
"Preenche",
"as",
"entidades",
"relacionadas",
"na",
"compra"
] | 8acf4ec2dbcb32305b7855bf6d936c8b95ddd105 | https://github.com/e-commerce-passaro/compra/blob/8acf4ec2dbcb32305b7855bf6d936c8b95ddd105/src/Compra/Manager.php#L111-L117 |
12,271 | arkanmgerges/multi-tier-architecture | src/MultiTierArchitecture/Mapper/Definition/EntityMapperAbstract.php | EntityMapperAbstract.getMappedSecondEntitiesByEntityType | public function getMappedSecondEntitiesByEntityType($secondEntityName)
{
$secondEntities = [];
foreach ($this->data as $data) {
$secondEntity = $this->createAndReturnNewSecondEntity($data, $secondEntityName);
if ($secondEntity) {
$secondEntities[] = $secondEnt... | php | public function getMappedSecondEntitiesByEntityType($secondEntityName)
{
$secondEntities = [];
foreach ($this->data as $data) {
$secondEntity = $this->createAndReturnNewSecondEntity($data, $secondEntityName);
if ($secondEntity) {
$secondEntities[] = $secondEnt... | [
"public",
"function",
"getMappedSecondEntitiesByEntityType",
"(",
"$",
"secondEntityName",
")",
"{",
"$",
"secondEntities",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"data",
")",
"{",
"$",
"secondEntity",
"=",
"$",
"this",
"... | Get second entities for the passed argument that represents the name of the second entity
@param string $secondEntityName Second entity name
@return array Array of entities | [
"Get",
"second",
"entities",
"for",
"the",
"passed",
"argument",
"that",
"represents",
"the",
"name",
"of",
"the",
"second",
"entity"
] | e8729841db66de7de0bdc9ed79ab73fe2bc262c0 | https://github.com/arkanmgerges/multi-tier-architecture/blob/e8729841db66de7de0bdc9ed79ab73fe2bc262c0/src/MultiTierArchitecture/Mapper/Definition/EntityMapperAbstract.php#L149-L160 |
12,272 | arkanmgerges/multi-tier-architecture | src/MultiTierArchitecture/Mapper/Definition/EntityMapperAbstract.php | EntityMapperAbstract.createAndReturnNewSecondEntity | private function createAndReturnNewSecondEntity($data, $secondEntityName)
{
/** @var EntityInterface $entity */
$entity = $this->getSecondEntityByName($secondEntityName);
if (is_array($data)) {
return $this->mapAttributesFromFirstEntityToSecondEntityAndReturnEntity($data, $entity... | php | private function createAndReturnNewSecondEntity($data, $secondEntityName)
{
/** @var EntityInterface $entity */
$entity = $this->getSecondEntityByName($secondEntityName);
if (is_array($data)) {
return $this->mapAttributesFromFirstEntityToSecondEntityAndReturnEntity($data, $entity... | [
"private",
"function",
"createAndReturnNewSecondEntity",
"(",
"$",
"data",
",",
"$",
"secondEntityName",
")",
"{",
"/** @var EntityInterface $entity */",
"$",
"entity",
"=",
"$",
"this",
"->",
"getSecondEntityByName",
"(",
"$",
"secondEntityName",
")",
";",
"if",
"(... | Return a new second entity
@param array $data Data array that represents entity's attributes
@param string $secondEntityName Name of the entity
@return EntityInterface|null | [
"Return",
"a",
"new",
"second",
"entity"
] | e8729841db66de7de0bdc9ed79ab73fe2bc262c0 | https://github.com/arkanmgerges/multi-tier-architecture/blob/e8729841db66de7de0bdc9ed79ab73fe2bc262c0/src/MultiTierArchitecture/Mapper/Definition/EntityMapperAbstract.php#L170-L179 |
12,273 | arkanmgerges/multi-tier-architecture | src/MultiTierArchitecture/Mapper/Definition/EntityMapperAbstract.php | EntityMapperAbstract.setSecondEntityAttribute | private function setSecondEntityAttribute($secondEntity, $attributeName, $attributeData)
{
$entityAttribute = $this->mappingFirstEntityToSecondEntityAttributes[$attributeName];
$setterMethod = 'set' . ucfirst($entityAttribute);
if (method_exists($secondEntity, $setterMethod)) {
... | php | private function setSecondEntityAttribute($secondEntity, $attributeName, $attributeData)
{
$entityAttribute = $this->mappingFirstEntityToSecondEntityAttributes[$attributeName];
$setterMethod = 'set' . ucfirst($entityAttribute);
if (method_exists($secondEntity, $setterMethod)) {
... | [
"private",
"function",
"setSecondEntityAttribute",
"(",
"$",
"secondEntity",
",",
"$",
"attributeName",
",",
"$",
"attributeData",
")",
"{",
"$",
"entityAttribute",
"=",
"$",
"this",
"->",
"mappingFirstEntityToSecondEntityAttributes",
"[",
"$",
"attributeName",
"]",
... | Set second entity attribute based on the attribute name and attribute data
@param EntityInterface $secondEntity Second entity name
@param string $attributeName Attribute name of the entity
@param mixed $attributeData Attribute data of the entity
@return void | [
"Set",
"second",
"entity",
"attribute",
"based",
"on",
"the",
"attribute",
"name",
"and",
"attribute",
"data"
] | e8729841db66de7de0bdc9ed79ab73fe2bc262c0 | https://github.com/arkanmgerges/multi-tier-architecture/blob/e8729841db66de7de0bdc9ed79ab73fe2bc262c0/src/MultiTierArchitecture/Mapper/Definition/EntityMapperAbstract.php#L221-L229 |
12,274 | arkanmgerges/multi-tier-architecture | src/MultiTierArchitecture/Mapper/Definition/EntityMapperAbstract.php | EntityMapperAbstract.getMappedFirstEntitiesByEntityType | public function getMappedFirstEntitiesByEntityType($entityName)
{
$entities = [];
foreach ($this->data as $data) {
$entity = $this->createAndReturnNewFirstEntity($data, $entityName);
if ($entity) {
$entities[] = $entity;
}
}
return ... | php | public function getMappedFirstEntitiesByEntityType($entityName)
{
$entities = [];
foreach ($this->data as $data) {
$entity = $this->createAndReturnNewFirstEntity($data, $entityName);
if ($entity) {
$entities[] = $entity;
}
}
return ... | [
"public",
"function",
"getMappedFirstEntitiesByEntityType",
"(",
"$",
"entityName",
")",
"{",
"$",
"entities",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"data",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"createAndRe... | Get entities for the passed argument that represents the name of the entity
@param string $entityName Entity name
@return array Array of entities | [
"Get",
"entities",
"for",
"the",
"passed",
"argument",
"that",
"represents",
"the",
"name",
"of",
"the",
"entity"
] | e8729841db66de7de0bdc9ed79ab73fe2bc262c0 | https://github.com/arkanmgerges/multi-tier-architecture/blob/e8729841db66de7de0bdc9ed79ab73fe2bc262c0/src/MultiTierArchitecture/Mapper/Definition/EntityMapperAbstract.php#L238-L248 |
12,275 | arkanmgerges/multi-tier-architecture | src/MultiTierArchitecture/Mapper/Definition/EntityMapperAbstract.php | EntityMapperAbstract.returnKey | private static function returnKey($key, $mappingArray)
{
if (!is_array($mappingArray)) {
return $key;
}
foreach ($mappingArray as $mappingKey => $mappingData) {
if (is_array($mappingData)) {
if (isset($mappingData[$key])) {
return ... | php | private static function returnKey($key, $mappingArray)
{
if (!is_array($mappingArray)) {
return $key;
}
foreach ($mappingArray as $mappingKey => $mappingData) {
if (is_array($mappingData)) {
if (isset($mappingData[$key])) {
return ... | [
"private",
"static",
"function",
"returnKey",
"(",
"$",
"key",
",",
"$",
"mappingArray",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"mappingArray",
")",
")",
"{",
"return",
"$",
"key",
";",
"}",
"foreach",
"(",
"$",
"mappingArray",
"as",
"$",
"m... | Search for mapping key
@param int|string $key Key that will be used in the search
@param array $mappingArray Array of array that has mapping data
@return mixed | [
"Search",
"for",
"mapping",
"key"
] | e8729841db66de7de0bdc9ed79ab73fe2bc262c0 | https://github.com/arkanmgerges/multi-tier-architecture/blob/e8729841db66de7de0bdc9ed79ab73fe2bc262c0/src/MultiTierArchitecture/Mapper/Definition/EntityMapperAbstract.php#L336-L355 |
12,276 | arkanmgerges/multi-tier-architecture | src/MultiTierArchitecture/Mapper/Definition/EntityMapperAbstract.php | EntityMapperAbstract.setFirstEntityAttribute | private function setFirstEntityAttribute($entity, $attributeName, $attributeData)
{
$entityAttribute = $this->mappingSecondEntityToFirstEntityAttributes[$attributeName];
$setterMethod = 'set' . ucfirst($entityAttribute);
if (method_exists($entity, $setterMethod)) {
$entity->$s... | php | private function setFirstEntityAttribute($entity, $attributeName, $attributeData)
{
$entityAttribute = $this->mappingSecondEntityToFirstEntityAttributes[$attributeName];
$setterMethod = 'set' . ucfirst($entityAttribute);
if (method_exists($entity, $setterMethod)) {
$entity->$s... | [
"private",
"function",
"setFirstEntityAttribute",
"(",
"$",
"entity",
",",
"$",
"attributeName",
",",
"$",
"attributeData",
")",
"{",
"$",
"entityAttribute",
"=",
"$",
"this",
"->",
"mappingSecondEntityToFirstEntityAttributes",
"[",
"$",
"attributeName",
"]",
";",
... | Set entity attribute based on the attribute name and attribute data
@param \MultiTierArchitecture\Entity\Definition\EntityInterface $entity Entity name
@param string $attributeName Attribute name of the entity
@param mixed ... | [
"Set",
"entity",
"attribute",
"based",
"on",
"the",
"attribute",
"name",
"and",
"attribute",
"data"
] | e8729841db66de7de0bdc9ed79ab73fe2bc262c0 | https://github.com/arkanmgerges/multi-tier-architecture/blob/e8729841db66de7de0bdc9ed79ab73fe2bc262c0/src/MultiTierArchitecture/Mapper/Definition/EntityMapperAbstract.php#L367-L374 |
12,277 | arkanmgerges/multi-tier-architecture | src/MultiTierArchitecture/Mapper/Definition/EntityMapperAbstract.php | EntityMapperAbstract.getMappedSecondAttributes | public function getMappedSecondAttributes()
{
$attributes = [];
/* Only the first array in data will be examined, and map its attributes to db attributes,
the attributes that are not present, will not be included
*/
if (is_array($this->data[0])) {
foreach ($th... | php | public function getMappedSecondAttributes()
{
$attributes = [];
/* Only the first array in data will be examined, and map its attributes to db attributes,
the attributes that are not present, will not be included
*/
if (is_array($this->data[0])) {
foreach ($th... | [
"public",
"function",
"getMappedSecondAttributes",
"(",
")",
"{",
"$",
"attributes",
"=",
"[",
"]",
";",
"/* Only the first array in data will be examined, and map its attributes to db attributes,\n the attributes that are not present, will not be included\n */",
"if",
"... | Get mapped attributes from the 'data' member mapped to second attributes
@return array Attributes after mapping them into second attributes | [
"Get",
"mapped",
"attributes",
"from",
"the",
"data",
"member",
"mapped",
"to",
"second",
"attributes"
] | e8729841db66de7de0bdc9ed79ab73fe2bc262c0 | https://github.com/arkanmgerges/multi-tier-architecture/blob/e8729841db66de7de0bdc9ed79ab73fe2bc262c0/src/MultiTierArchitecture/Mapper/Definition/EntityMapperAbstract.php#L425-L441 |
12,278 | clacy-builders/xml-express-php | src/Attributes.php | Attributes.setBooleanAttrib | public function setBooleanAttrib($name, $value = true, $comparisonAttribute = null)
{
if (!is_bool($value) && !is_null($comparisonAttribute)) {
$compare = $this->getAttrib($comparisonAttribute);
if (is_array($value)) {
$value = in_array($compare, $value, true);
}
else {
$value = $value === $compa... | php | public function setBooleanAttrib($name, $value = true, $comparisonAttribute = null)
{
if (!is_bool($value) && !is_null($comparisonAttribute)) {
$compare = $this->getAttrib($comparisonAttribute);
if (is_array($value)) {
$value = in_array($compare, $value, true);
}
else {
$value = $value === $compa... | [
"public",
"function",
"setBooleanAttrib",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"true",
",",
"$",
"comparisonAttribute",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"value",
")",
"&&",
"!",
"is_null",
"(",
"$",
"comparisonAttribute",
... | Sets a boolean attribute by comparing a value with the value of another attribute.
Helpful for attributes like <code>selected</code> in HTML.
@param string $name Name of the attribute.
@param mixed $value One or more (array) values.
@param string $delimiter The boundary string.
@param boolean ... | [
"Sets",
"a",
"boolean",
"attribute",
"by",
"comparing",
"a",
"value",
"with",
"the",
"value",
"of",
"another",
"attribute",
"."
] | 9c66fd640738b0e87b05047c3f3b8f1cba8aa7e0 | https://github.com/clacy-builders/xml-express-php/blob/9c66fd640738b0e87b05047c3f3b8f1cba8aa7e0/src/Attributes.php#L86-L98 |
12,279 | clacy-builders/xml-express-php | src/Attributes.php | Attributes.str | public function str()
{
$str = '';
foreach ($this->attributes as $name => $value) {
$str .= $this->getAttribStr($name);
}
return $str;
} | php | public function str()
{
$str = '';
foreach ($this->attributes as $name => $value) {
$str .= $this->getAttribStr($name);
}
return $str;
} | [
"public",
"function",
"str",
"(",
")",
"{",
"$",
"str",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"attributes",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"str",
".=",
"$",
"this",
"->",
"getAttribStr",
"(",
"$",
"name",
")",
... | Returns the string representation of all attributes.
@return string | [
"Returns",
"the",
"string",
"representation",
"of",
"all",
"attributes",
"."
] | 9c66fd640738b0e87b05047c3f3b8f1cba8aa7e0 | https://github.com/clacy-builders/xml-express-php/blob/9c66fd640738b0e87b05047c3f3b8f1cba8aa7e0/src/Attributes.php#L128-L135 |
12,280 | clacy-builders/xml-express-php | src/Attributes.php | Attributes.getAttribStr | public function getAttribStr($name)
{
$value = $this->attributes[$name];
if ($value === null || $value === false || $name === null) {
return '';
}
if ($value === true) {
if ($this->element) {
$class = get_class($this->element);
if ($class::HTML_MODE) {
return ' ' . $name;
}
}
$valu... | php | public function getAttribStr($name)
{
$value = $this->attributes[$name];
if ($value === null || $value === false || $name === null) {
return '';
}
if ($value === true) {
if ($this->element) {
$class = get_class($this->element);
if ($class::HTML_MODE) {
return ' ' . $name;
}
}
$valu... | [
"public",
"function",
"getAttribStr",
"(",
"$",
"name",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"attributes",
"[",
"$",
"name",
"]",
";",
"if",
"(",
"$",
"value",
"===",
"null",
"||",
"$",
"value",
"===",
"false",
"||",
"$",
"name",
"===",
... | Returns the string representation of a single attribute.
@param string $name Name of the attribute.
@return string | [
"Returns",
"the",
"string",
"representation",
"of",
"a",
"single",
"attribute",
"."
] | 9c66fd640738b0e87b05047c3f3b8f1cba8aa7e0 | https://github.com/clacy-builders/xml-express-php/blob/9c66fd640738b0e87b05047c3f3b8f1cba8aa7e0/src/Attributes.php#L143-L159 |
12,281 | TagPlanet/universal-analytics | src/TagPlanet/UniversalAnalytics/UniversalAnalytics.php | UniversalAnalytics.get | public function get($name)
{
if($name == '')
{
// If no name was passed, we'll assume they wanted the first (and usually only)
if(count($this->instances) == 1)
{
// Grab the instance without knowing tracker name
$instances = array_v... | php | public function get($name)
{
if($name == '')
{
// If no name was passed, we'll assume they wanted the first (and usually only)
if(count($this->instances) == 1)
{
// Grab the instance without knowing tracker name
$instances = array_v... | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"''",
")",
"{",
"// If no name was passed, we'll assume they wanted the first (and usually only)",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"instances",
")",
"==",
"1",
"... | Find a single tracker instance
@return TagPlanet\UniversalAnalytics\UniversalAnalyticsInstance | [
"Find",
"a",
"single",
"tracker",
"instance"
] | 0b370fd8d20397e585a550d86f6fb9ccb9e1c783 | https://github.com/TagPlanet/universal-analytics/blob/0b370fd8d20397e585a550d86f6fb9ccb9e1c783/src/TagPlanet/UniversalAnalytics/UniversalAnalytics.php#L101-L123 |
12,282 | TagPlanet/universal-analytics | src/TagPlanet/UniversalAnalytics/UniversalAnalytics.php | UniversalAnalytics.create | protected function create($account, $config = array())
{
if(!isset($config['name']))
{
// This shouldn't happen anymore... but just in case, force it!
$config['name'] = 't' . count($this->instances);
}
// Grab overall config options
$debug = $... | php | protected function create($account, $config = array())
{
if(!isset($config['name']))
{
// This shouldn't happen anymore... but just in case, force it!
$config['name'] = 't' . count($this->instances);
}
// Grab overall config options
$debug = $... | [
"protected",
"function",
"create",
"(",
"$",
"account",
",",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"config",
"[",
"'name'",
"]",
")",
")",
"{",
"// This shouldn't happen anymore... but just in case, force it!",
"... | Create a new tracker instance, or update an existing a new config
@return TagPlanet\UniversalAnalytics\UniversalAnalyticsInstance | [
"Create",
"a",
"new",
"tracker",
"instance",
"or",
"update",
"an",
"existing",
"a",
"new",
"config"
] | 0b370fd8d20397e585a550d86f6fb9ccb9e1c783 | https://github.com/TagPlanet/universal-analytics/blob/0b370fd8d20397e585a550d86f6fb9ccb9e1c783/src/TagPlanet/UniversalAnalytics/UniversalAnalytics.php#L130-L147 |
12,283 | TagPlanet/universal-analytics | src/TagPlanet/UniversalAnalytics/UniversalAnalytics.php | UniversalAnalytics.render | public function render($renderedCodeBlock = true, $renderScriptTag = true)
{
// Setup our return array
$js = array();
// Do we need to add script tags?
if($renderScriptTag)
$js[] = '<script>';
foreach($this->instances as $instance)
{
... | php | public function render($renderedCodeBlock = true, $renderScriptTag = true)
{
// Setup our return array
$js = array();
// Do we need to add script tags?
if($renderScriptTag)
$js[] = '<script>';
foreach($this->instances as $instance)
{
... | [
"public",
"function",
"render",
"(",
"$",
"renderedCodeBlock",
"=",
"true",
",",
"$",
"renderScriptTag",
"=",
"true",
")",
"{",
"// Setup our return array",
"$",
"js",
"=",
"array",
"(",
")",
";",
"// Do we need to add script tags?",
"if",
"(",
"$",
"renderScrip... | Render the Universal Analytics code
@return string | [
"Render",
"the",
"Universal",
"Analytics",
"code"
] | 0b370fd8d20397e585a550d86f6fb9ccb9e1c783 | https://github.com/TagPlanet/universal-analytics/blob/0b370fd8d20397e585a550d86f6fb9ccb9e1c783/src/TagPlanet/UniversalAnalytics/UniversalAnalytics.php#L154-L178 |
12,284 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/validation/error.php | Validation_Error._replace_tags | protected function _replace_tags($msg)
{
// prepare label & value
$label = is_array($this->field->label) ? $this->field->label['label'] : $this->field->label;
$value = is_array($this->value) ? implode(', ', $this->value) : $this->value;
if (\Config::get('validation.quote_labels', false) and strpos($label... | php | protected function _replace_tags($msg)
{
// prepare label & value
$label = is_array($this->field->label) ? $this->field->label['label'] : $this->field->label;
$value = is_array($this->value) ? implode(', ', $this->value) : $this->value;
if (\Config::get('validation.quote_labels', false) and strpos($label... | [
"protected",
"function",
"_replace_tags",
"(",
"$",
"msg",
")",
"{",
"// prepare label & value",
"$",
"label",
"=",
"is_array",
"(",
"$",
"this",
"->",
"field",
"->",
"label",
")",
"?",
"$",
"this",
"->",
"field",
"->",
"label",
"[",
"'label'",
"]",
":",... | Replace templating tags with values
@param error message to parse
@return string | [
"Replace",
"templating",
"tags",
"with",
"values"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/validation/error.php#L113-L169 |
12,285 | odtimetracker/odtimetracker-php-lib | src/Model/AbstractMapper.php | AbstractMapper.selectById | public function selectById($id)
{
$sql = "SELECT * FROM `$this->tableName` WHERE `$this->pkColName` = %d ";
$stmt = $this->pdo->prepare(sprintf($sql, $id));
$res = $stmt->execute();
if ($res === false) {
return null;
}
$rows = $stmt->fetchAll();
if (count($rows) !== 1) {
return null;
}
retu... | php | public function selectById($id)
{
$sql = "SELECT * FROM `$this->tableName` WHERE `$this->pkColName` = %d ";
$stmt = $this->pdo->prepare(sprintf($sql, $id));
$res = $stmt->execute();
if ($res === false) {
return null;
}
$rows = $stmt->fetchAll();
if (count($rows) !== 1) {
return null;
}
retu... | [
"public",
"function",
"selectById",
"(",
"$",
"id",
")",
"{",
"$",
"sql",
"=",
"\"SELECT * FROM `$this->tableName` WHERE `$this->pkColName` = %d \"",
";",
"$",
"stmt",
"=",
"$",
"this",
"->",
"pdo",
"->",
"prepare",
"(",
"sprintf",
"(",
"$",
"sql",
",",
"$",
... | Select entity by its ID.
@param integer $id
@return EntityInterface|null | [
"Select",
"entity",
"by",
"its",
"ID",
"."
] | 0bb9081fea8b921241a53c46785441696022590d | https://github.com/odtimetracker/odtimetracker-php-lib/blob/0bb9081fea8b921241a53c46785441696022590d/src/Model/AbstractMapper.php#L59-L76 |
12,286 | odtimetracker/odtimetracker-php-lib | src/Model/AbstractMapper.php | AbstractMapper.deleteById | public function deleteById($id)
{
$sql = "DELETE FROM `$this->tableName` WHERE `$this->pkColName` = :entityId ";
$stmt = $this->pdo->prepare($sql);
$stmt->bindParam(':entityId', intval($id), \PDO::PARAM_INT);
$res = $stmt->execute();
return ($res !== false && $stmt->rowCount() === 1);
} | php | public function deleteById($id)
{
$sql = "DELETE FROM `$this->tableName` WHERE `$this->pkColName` = :entityId ";
$stmt = $this->pdo->prepare($sql);
$stmt->bindParam(':entityId', intval($id), \PDO::PARAM_INT);
$res = $stmt->execute();
return ($res !== false && $stmt->rowCount() === 1);
} | [
"public",
"function",
"deleteById",
"(",
"$",
"id",
")",
"{",
"$",
"sql",
"=",
"\"DELETE FROM `$this->tableName` WHERE `$this->pkColName` = :entityId \"",
";",
"$",
"stmt",
"=",
"$",
"this",
"->",
"pdo",
"->",
"prepare",
"(",
"$",
"sql",
")",
";",
"$",
"stmt",... | Delete record by its identifier.
@param integer $id
@return boolean | [
"Delete",
"record",
"by",
"its",
"identifier",
"."
] | 0bb9081fea8b921241a53c46785441696022590d | https://github.com/odtimetracker/odtimetracker-php-lib/blob/0bb9081fea8b921241a53c46785441696022590d/src/Model/AbstractMapper.php#L111-L120 |
12,287 | uthando-cms/uthando-twitter | src/UthandoTwitter/View/TweetFeed.php | TweetFeed.setPartial | public function setPartial($partial)
{
if (null === $partial || is_string($partial) || is_array($partial)) {
$this->partial = $partial;
}
return $this;
} | php | public function setPartial($partial)
{
if (null === $partial || is_string($partial) || is_array($partial)) {
$this->partial = $partial;
}
return $this;
} | [
"public",
"function",
"setPartial",
"(",
"$",
"partial",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"partial",
"||",
"is_string",
"(",
"$",
"partial",
")",
"||",
"is_array",
"(",
"$",
"partial",
")",
")",
"{",
"$",
"this",
"->",
"partial",
"=",
"$",
... | Sets which partial view script to use for rendering tweets
@param string|array $partial
@return \UthandoTwitter\View\TweetFeed | [
"Sets",
"which",
"partial",
"view",
"script",
"to",
"use",
"for",
"rendering",
"tweets"
] | 003914b2df2255d52314ed8eb5c92f192dab0f12 | https://github.com/uthando-cms/uthando-twitter/blob/003914b2df2255d52314ed8eb5c92f192dab0f12/src/UthandoTwitter/View/TweetFeed.php#L89-L96 |
12,288 | uthando-cms/uthando-twitter | src/UthandoTwitter/View/TweetFeed.php | TweetFeed.getTwitter | public function getTwitter()
{
if (!$this->twitter) {
$this->twitter = $this->getServiceLocator()
->getServiceLocator()
->get(Twitter::class);
}
return $this->twitter;
} | php | public function getTwitter()
{
if (!$this->twitter) {
$this->twitter = $this->getServiceLocator()
->getServiceLocator()
->get(Twitter::class);
}
return $this->twitter;
} | [
"public",
"function",
"getTwitter",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"twitter",
")",
"{",
"$",
"this",
"->",
"twitter",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"Tw... | Gets the twitter instance
@return \UthandoTwitter\Service\Twitter | [
"Gets",
"the",
"twitter",
"instance"
] | 003914b2df2255d52314ed8eb5c92f192dab0f12 | https://github.com/uthando-cms/uthando-twitter/blob/003914b2df2255d52314ed8eb5c92f192dab0f12/src/UthandoTwitter/View/TweetFeed.php#L144-L153 |
12,289 | mimmi20/modernizr-server | src/Modernizr.php | Modernizr.getData | public static function getData($key = self::KEY, $cookieExtra = '')
{
if (!empty(self::$data)) {
return self::$data;
}
$key .= $cookieExtra;
if (PHP_SESSION_ACTIVE === session_status() && isset($_SESSION[$key])) {
self::$data = $_SESSION[$key];
... | php | public static function getData($key = self::KEY, $cookieExtra = '')
{
if (!empty(self::$data)) {
return self::$data;
}
$key .= $cookieExtra;
if (PHP_SESSION_ACTIVE === session_status() && isset($_SESSION[$key])) {
self::$data = $_SESSION[$key];
... | [
"public",
"static",
"function",
"getData",
"(",
"$",
"key",
"=",
"self",
"::",
"KEY",
",",
"$",
"cookieExtra",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"self",
"::",
"$",
"data",
")",
")",
"{",
"return",
"self",
"::",
"$",
"data",
";",
... | returns the data
@param string $key
@param string $cookieExtra
@return array|null | [
"returns",
"the",
"data"
] | 1143f4f62c7d473657d1d461338208a01b16e57e | https://github.com/mimmi20/modernizr-server/blob/1143f4f62c7d473657d1d461338208a01b16e57e/src/Modernizr.php#L367-L392 |
12,290 | mimmi20/modernizr-server | src/Modernizr.php | Modernizr.buildJsCode | public static function buildJsCode($cookieExtra = '')
{
$js = self::buildJs();
$js .= self::buildConvertJs(self::KEY, $cookieExtra, true);
return $js;
} | php | public static function buildJsCode($cookieExtra = '')
{
$js = self::buildJs();
$js .= self::buildConvertJs(self::KEY, $cookieExtra, true);
return $js;
} | [
"public",
"static",
"function",
"buildJsCode",
"(",
"$",
"cookieExtra",
"=",
"''",
")",
"{",
"$",
"js",
"=",
"self",
"::",
"buildJs",
"(",
")",
";",
"$",
"js",
".=",
"self",
"::",
"buildConvertJs",
"(",
"self",
"::",
"KEY",
",",
"$",
"cookieExtra",
"... | builds the complete javascript code to output modernizr.js, new checkes and
to write the detection result into the session
@param string $cookieExtra
@return string | [
"builds",
"the",
"complete",
"javascript",
"code",
"to",
"output",
"modernizr",
".",
"js",
"new",
"checkes",
"and",
"to",
"write",
"the",
"detection",
"result",
"into",
"the",
"session"
] | 1143f4f62c7d473657d1d461338208a01b16e57e | https://github.com/mimmi20/modernizr-server/blob/1143f4f62c7d473657d1d461338208a01b16e57e/src/Modernizr.php#L402-L408 |
12,291 | mimmi20/modernizr-server | src/Modernizr.php | Modernizr.buildJs | public static function buildJs()
{
$js = '';
foreach (self::collectJsFiles() as $file) {
$js .= file_get_contents(__DIR__ . '/../web' . $file);
}
return $js;
} | php | public static function buildJs()
{
$js = '';
foreach (self::collectJsFiles() as $file) {
$js .= file_get_contents(__DIR__ . '/../web' . $file);
}
return $js;
} | [
"public",
"static",
"function",
"buildJs",
"(",
")",
"{",
"$",
"js",
"=",
"''",
";",
"foreach",
"(",
"self",
"::",
"collectJsFiles",
"(",
")",
"as",
"$",
"file",
")",
"{",
"$",
"js",
".=",
"file_get_contents",
"(",
"__DIR__",
".",
"'/../web'",
".",
"... | builds the javascript code to output modernizr.js and new checkes
@return string | [
"builds",
"the",
"javascript",
"code",
"to",
"output",
"modernizr",
".",
"js",
"and",
"new",
"checkes"
] | 1143f4f62c7d473657d1d461338208a01b16e57e | https://github.com/mimmi20/modernizr-server/blob/1143f4f62c7d473657d1d461338208a01b16e57e/src/Modernizr.php#L415-L424 |
12,292 | mimmi20/modernizr-server | src/Modernizr.php | Modernizr.buildConvertJs | public static function buildConvertJs($key, $cookieExtra = '', $reload = true)
{
$content = file_get_contents(__DIR__ . '/../web/convert/start.js.tmp');
ksort(self::$properties);
foreach (array_keys(self::$properties) as $i => $property) {
if (is_array(self::$properties[$proper... | php | public static function buildConvertJs($key, $cookieExtra = '', $reload = true)
{
$content = file_get_contents(__DIR__ . '/../web/convert/start.js.tmp');
ksort(self::$properties);
foreach (array_keys(self::$properties) as $i => $property) {
if (is_array(self::$properties[$proper... | [
"public",
"static",
"function",
"buildConvertJs",
"(",
"$",
"key",
",",
"$",
"cookieExtra",
"=",
"''",
",",
"$",
"reload",
"=",
"true",
")",
"{",
"$",
"content",
"=",
"file_get_contents",
"(",
"__DIR__",
".",
"'/../web/convert/start.js.tmp'",
")",
";",
"ksor... | builds the javascript code to write the detection result into a cookie
@param string $key
@param string $cookieExtra
@param bool $reload
@return string | [
"builds",
"the",
"javascript",
"code",
"to",
"write",
"the",
"detection",
"result",
"into",
"a",
"cookie"
] | 1143f4f62c7d473657d1d461338208a01b16e57e | https://github.com/mimmi20/modernizr-server/blob/1143f4f62c7d473657d1d461338208a01b16e57e/src/Modernizr.php#L455-L514 |
12,293 | mimmi20/modernizr-server | src/Modernizr.php | Modernizr.ang | private static function ang($cookie)
{
$data = new \stdClass();
$features = json_decode($cookie);
var_dump($cookie, $features);exit;
return $data;
} | php | private static function ang($cookie)
{
$data = new \stdClass();
$features = json_decode($cookie);
var_dump($cookie, $features);exit;
return $data;
} | [
"private",
"static",
"function",
"ang",
"(",
"$",
"cookie",
")",
"{",
"$",
"data",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"features",
"=",
"json_decode",
"(",
"$",
"cookie",
")",
";",
"var_dump",
"(",
"$",
"cookie",
",",
"$",
"features",
... | extracts the feature data from the cookie
@param string $cookie
@return \stdClass | [
"extracts",
"the",
"feature",
"data",
"from",
"the",
"cookie"
] | 1143f4f62c7d473657d1d461338208a01b16e57e | https://github.com/mimmi20/modernizr-server/blob/1143f4f62c7d473657d1d461338208a01b16e57e/src/Modernizr.php#L523-L531 |
12,294 | kuria/clock | src/Clock.php | Clock.override | static function override($now): void
{
if ($now instanceof \DateTimeInterface) {
$now = $now->getTimestamp() + ($now->format('u') / 1e6); // extract timestamp with microseconds
} elseif (!is_int($now) && !is_float($now)) {
throw new \InvalidArgumentException(sprintf(
... | php | static function override($now): void
{
if ($now instanceof \DateTimeInterface) {
$now = $now->getTimestamp() + ($now->format('u') / 1e6); // extract timestamp with microseconds
} elseif (!is_int($now) && !is_float($now)) {
throw new \InvalidArgumentException(sprintf(
... | [
"static",
"function",
"override",
"(",
"$",
"now",
")",
":",
"void",
"{",
"if",
"(",
"$",
"now",
"instanceof",
"\\",
"DateTimeInterface",
")",
"{",
"$",
"now",
"=",
"$",
"now",
"->",
"getTimestamp",
"(",
")",
"+",
"(",
"$",
"now",
"->",
"format",
"... | Override the current time
- this change only affects methods of this class
- this method is intended to be used only for testing purposes
- the new time can include microseconds
@see Clock::resume()
@param \DateTimeInterface|int|float $now UNIX timestamp or \DateTimeInterface instance
@throws \InvalidArgumentExcepti... | [
"Override",
"the",
"current",
"time"
] | 591468bdb175e230f7cc81b8c472fcc2bcfeb938 | https://github.com/kuria/clock/blob/591468bdb175e230f7cc81b8c472fcc2bcfeb938/src/Clock.php#L25-L37 |
12,295 | kuria/clock | src/Clock.php | Clock.microtime | static function microtime(): float
{
if (self::$now !== null) {
return (float) self::$now;
}
return microtime(true);
} | php | static function microtime(): float
{
if (self::$now !== null) {
return (float) self::$now;
}
return microtime(true);
} | [
"static",
"function",
"microtime",
"(",
")",
":",
"float",
"{",
"if",
"(",
"self",
"::",
"$",
"now",
"!==",
"null",
")",
"{",
"return",
"(",
"float",
")",
"self",
"::",
"$",
"now",
";",
"}",
"return",
"microtime",
"(",
"true",
")",
";",
"}"
] | Get the current UNIX timestamp with microsecond precision | [
"Get",
"the",
"current",
"UNIX",
"timestamp",
"with",
"microsecond",
"precision"
] | 591468bdb175e230f7cc81b8c472fcc2bcfeb938 | https://github.com/kuria/clock/blob/591468bdb175e230f7cc81b8c472fcc2bcfeb938/src/Clock.php#L76-L83 |
12,296 | kuria/clock | src/Clock.php | Clock.dateTime | static function dateTime(?\DateTimeZone $timezone = null): \DateTime
{
if (self::$now !== null) {
$now = \DateTime::createFromFormat('U.u', sprintf('%.6F', self::$now));
$now->setTimezone($timezone ?? new \DateTimeZone(date_default_timezone_get()));
return $now;
... | php | static function dateTime(?\DateTimeZone $timezone = null): \DateTime
{
if (self::$now !== null) {
$now = \DateTime::createFromFormat('U.u', sprintf('%.6F', self::$now));
$now->setTimezone($timezone ?? new \DateTimeZone(date_default_timezone_get()));
return $now;
... | [
"static",
"function",
"dateTime",
"(",
"?",
"\\",
"DateTimeZone",
"$",
"timezone",
"=",
"null",
")",
":",
"\\",
"DateTime",
"{",
"if",
"(",
"self",
"::",
"$",
"now",
"!==",
"null",
")",
"{",
"$",
"now",
"=",
"\\",
"DateTime",
"::",
"createFromFormat",
... | Get the current date-time
If no time zone is specified, then the default time zone will be used.
The default time zone is specified by the date.timezone INI setting or the date_default_timezone_set() function. | [
"Get",
"the",
"current",
"date",
"-",
"time"
] | 591468bdb175e230f7cc81b8c472fcc2bcfeb938 | https://github.com/kuria/clock/blob/591468bdb175e230f7cc81b8c472fcc2bcfeb938/src/Clock.php#L92-L102 |
12,297 | kuria/clock | src/Clock.php | Clock.dateTimeImmutable | static function dateTimeImmutable(?\DateTimeZone $timezone = null): \DateTimeImmutable
{
if (self::$now !== null) {
$now = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', self::$now));
$now = $now->setTimezone($timezone ?? new \DateTimeZone(date_default_timezone_get()));
... | php | static function dateTimeImmutable(?\DateTimeZone $timezone = null): \DateTimeImmutable
{
if (self::$now !== null) {
$now = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', self::$now));
$now = $now->setTimezone($timezone ?? new \DateTimeZone(date_default_timezone_get()));
... | [
"static",
"function",
"dateTimeImmutable",
"(",
"?",
"\\",
"DateTimeZone",
"$",
"timezone",
"=",
"null",
")",
":",
"\\",
"DateTimeImmutable",
"{",
"if",
"(",
"self",
"::",
"$",
"now",
"!==",
"null",
")",
"{",
"$",
"now",
"=",
"\\",
"DateTimeImmutable",
"... | Get the current date-time as an immutable instance
If no time zone is specified, then the default time zone will be used.
The default time zone is specified by the date.timezone INI setting or the date_default_timezone_set() function. | [
"Get",
"the",
"current",
"date",
"-",
"time",
"as",
"an",
"immutable",
"instance"
] | 591468bdb175e230f7cc81b8c472fcc2bcfeb938 | https://github.com/kuria/clock/blob/591468bdb175e230f7cc81b8c472fcc2bcfeb938/src/Clock.php#L111-L121 |
12,298 | factorio-item-browser/api-database | src/Repository/TranslationRepository.php | TranslationRepository.findDataByTypesAndNames | public function findDataByTypesAndNames(string $locale, array $namesByTypes, array $modCombinationIds = []): array
{
$columns = [
't.locale AS locale',
't.type AS type',
't.name AS name',
't.value AS value',
't.description AS description',
... | php | public function findDataByTypesAndNames(string $locale, array $namesByTypes, array $modCombinationIds = []): array
{
$columns = [
't.locale AS locale',
't.type AS type',
't.name AS name',
't.value AS value',
't.description AS description',
... | [
"public",
"function",
"findDataByTypesAndNames",
"(",
"string",
"$",
"locale",
",",
"array",
"$",
"namesByTypes",
",",
"array",
"$",
"modCombinationIds",
"=",
"[",
"]",
")",
":",
"array",
"{",
"$",
"columns",
"=",
"[",
"'t.locale AS locale'",
",",
"'t.type AS ... | Finds the translation data with the specified types and names.
@param string $locale The locale to prefer in the results.
@param array|string[][] $namesByTypes The names to search, grouped by their types.
@param array|int[] $modCombinationIds The IDs of the mod combinations, or empty to use all translations.
@return ar... | [
"Finds",
"the",
"translation",
"data",
"with",
"the",
"specified",
"types",
"and",
"names",
"."
] | c3a27e5673462a58b5afafc0ea0e0002f6db9803 | https://github.com/factorio-item-browser/api-database/blob/c3a27e5673462a58b5afafc0ea0e0002f6db9803/src/Repository/TranslationRepository.php#L28-L87 |
12,299 | factorio-item-browser/api-database | src/Repository/TranslationRepository.php | TranslationRepository.mapTranslationDataResult | protected function mapTranslationDataResult(array $translationData): array
{
$result = [];
foreach ($translationData as $data) {
$result[] = TranslationData::createFromArray($data);
}
return $result;
} | php | protected function mapTranslationDataResult(array $translationData): array
{
$result = [];
foreach ($translationData as $data) {
$result[] = TranslationData::createFromArray($data);
}
return $result;
} | [
"protected",
"function",
"mapTranslationDataResult",
"(",
"array",
"$",
"translationData",
")",
":",
"array",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"translationData",
"as",
"$",
"data",
")",
"{",
"$",
"result",
"[",
"]",
"=",
"Tran... | Maps the query result to instances of TranslationData.
@param array $translationData
@return array|TranslationData[] | [
"Maps",
"the",
"query",
"result",
"to",
"instances",
"of",
"TranslationData",
"."
] | c3a27e5673462a58b5afafc0ea0e0002f6db9803 | https://github.com/factorio-item-browser/api-database/blob/c3a27e5673462a58b5afafc0ea0e0002f6db9803/src/Repository/TranslationRepository.php#L94-L101 |
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.