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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
193,200 | AlexyaFramework/Tools | Alexya/Tools/Inflector.php | Inflector.singular | public static function singular(string $word) : string
{
// Check that `$word` is countable.
if(in_array($word, Inflector::$_uncontable)) {
return $word;
}
// Now check that `$word` is regular.
if(isset(Inflector::$_singular["irregular"][$word])) {
re... | php | public static function singular(string $word) : string
{
// Check that `$word` is countable.
if(in_array($word, Inflector::$_uncontable)) {
return $word;
}
// Now check that `$word` is regular.
if(isset(Inflector::$_singular["irregular"][$word])) {
re... | [
"public",
"static",
"function",
"singular",
"(",
"string",
"$",
"word",
")",
":",
"string",
"{",
"// Check that `$word` is countable.",
"if",
"(",
"in_array",
"(",
"$",
"word",
",",
"Inflector",
"::",
"$",
"_uncontable",
")",
")",
"{",
"return",
"$",
"word",... | Returns the singular form of the word.
@param string $word Word to singularize.
@return string The singular form of `$word`. | [
"Returns",
"the",
"singular",
"form",
"of",
"the",
"word",
"."
] | 2ae7c91cde0517579b926dd872eaf7ea324fd1e4 | https://github.com/AlexyaFramework/Tools/blob/2ae7c91cde0517579b926dd872eaf7ea324fd1e4/Alexya/Tools/Inflector.php#L345-L374 |
193,201 | Wedeto/Auth | src/PasswordGenerator.php | PasswordGenerator.addCharacters | public function addCharacters($chars)
{
if (WF::is_array_like($chars))
{
foreach ($chars as $char)
{
if (!is_string($char))
throw new InvalidArgumentException("Invalid type: " . WF::str($chars));
$this->characters[$char] = t... | php | public function addCharacters($chars)
{
if (WF::is_array_like($chars))
{
foreach ($chars as $char)
{
if (!is_string($char))
throw new InvalidArgumentException("Invalid type: " . WF::str($chars));
$this->characters[$char] = t... | [
"public",
"function",
"addCharacters",
"(",
"$",
"chars",
")",
"{",
"if",
"(",
"WF",
"::",
"is_array_like",
"(",
"$",
"chars",
")",
")",
"{",
"foreach",
"(",
"$",
"chars",
"as",
"$",
"char",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"char",
... | Add one or more characters to the list of eligible characters
@param string|array $chars The characters to add
@return Wedeto\Auth\PasswordGenerator Provides fluent interface | [
"Add",
"one",
"or",
"more",
"characters",
"to",
"the",
"list",
"of",
"eligible",
"characters"
] | d53777d860a9e67154b84b425e29da5d4dcd28e0 | https://github.com/Wedeto/Auth/blob/d53777d860a9e67154b84b425e29da5d4dcd28e0/src/PasswordGenerator.php#L51-L72 |
193,202 | Wedeto/Auth | src/PasswordGenerator.php | PasswordGenerator.generatePassword | public function generatePassword(int $length = 8)
{
if ($length <= 0)
throw new DomainException("Cannot generate zero-length passwords");
if (empty($this->characters))
throw new UnderflowException("First add characters used to generate the password");
$chars = implo... | php | public function generatePassword(int $length = 8)
{
if ($length <= 0)
throw new DomainException("Cannot generate zero-length passwords");
if (empty($this->characters))
throw new UnderflowException("First add characters used to generate the password");
$chars = implo... | [
"public",
"function",
"generatePassword",
"(",
"int",
"$",
"length",
"=",
"8",
")",
"{",
"if",
"(",
"$",
"length",
"<=",
"0",
")",
"throw",
"new",
"DomainException",
"(",
"\"Cannot generate zero-length passwords\"",
")",
";",
"if",
"(",
"empty",
"(",
"$",
... | Generate a password of the specified length | [
"Generate",
"a",
"password",
"of",
"the",
"specified",
"length"
] | d53777d860a9e67154b84b425e29da5d4dcd28e0 | https://github.com/Wedeto/Auth/blob/d53777d860a9e67154b84b425e29da5d4dcd28e0/src/PasswordGenerator.php#L104-L121 |
193,203 | Wedeto/Auth | src/PasswordGenerator.php | PasswordGenerator.loadDictionary | public function loadDictionary(string $filename, $append = false, $regexp = "/^[a-z]{4,6}$/")
{
if (!file_exists($filename) || !is_readable($filename))
{
$orig = $filename;
$filename = "/usr/share/dict/" . $filename;
if (!file_exists($filename))
th... | php | public function loadDictionary(string $filename, $append = false, $regexp = "/^[a-z]{4,6}$/")
{
if (!file_exists($filename) || !is_readable($filename))
{
$orig = $filename;
$filename = "/usr/share/dict/" . $filename;
if (!file_exists($filename))
th... | [
"public",
"function",
"loadDictionary",
"(",
"string",
"$",
"filename",
",",
"$",
"append",
"=",
"false",
",",
"$",
"regexp",
"=",
"\"/^[a-z]{4,6}$/\"",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"filename",
")",
"||",
"!",
"is_readable",
"(",
"$... | Load a dictionary file for passphrase generation
@param string $filename The file to read. Can be a full path or a name
of a dictionary in /usr/share/dict
@param bool $append True to add to the list of words, false to replace
it. Defauls to false
@param string $regexp A regular expression to match each word to. Can be
... | [
"Load",
"a",
"dictionary",
"file",
"for",
"passphrase",
"generation"
] | d53777d860a9e67154b84b425e29da5d4dcd28e0 | https://github.com/Wedeto/Auth/blob/d53777d860a9e67154b84b425e29da5d4dcd28e0/src/PasswordGenerator.php#L136-L176 |
193,204 | Wedeto/Auth | src/PasswordGenerator.php | PasswordGenerator.generatePassphrase | public function generatePassphrase($num_words = 4)
{
if (count($this->dictionary) < $num_words)
{
throw new UnderflowException(
"Not enough words loaded to generate a passphrase of $num_words words"
);
}
$words = array();
$attempt = 0;... | php | public function generatePassphrase($num_words = 4)
{
if (count($this->dictionary) < $num_words)
{
throw new UnderflowException(
"Not enough words loaded to generate a passphrase of $num_words words"
);
}
$words = array();
$attempt = 0;... | [
"public",
"function",
"generatePassphrase",
"(",
"$",
"num_words",
"=",
"4",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"dictionary",
")",
"<",
"$",
"num_words",
")",
"{",
"throw",
"new",
"UnderflowException",
"(",
"\"Not enough words loaded to gene... | Generate a passphrase of the specified amount of words
@param int $num_words The number of words in the passphase
@retuern string The generated passprase
@throws UnderflowException If no or not enough words have been loaded | [
"Generate",
"a",
"passphrase",
"of",
"the",
"specified",
"amount",
"of",
"words"
] | d53777d860a9e67154b84b425e29da5d4dcd28e0 | https://github.com/Wedeto/Auth/blob/d53777d860a9e67154b84b425e29da5d4dcd28e0/src/PasswordGenerator.php#L184-L204 |
193,205 | juliangut/mapping | src/Metadata/MetadataResolver.php | MetadataResolver.normalizeMappingSources | protected function normalizeMappingSources(array $mappingSources): array
{
return \array_map(
function ($mappingSource): array {
if (!\is_array($mappingSource)) {
$mappingSource = [
'type' => DriverFactoryInterface::DRIVER_ANNOTATION,
... | php | protected function normalizeMappingSources(array $mappingSources): array
{
return \array_map(
function ($mappingSource): array {
if (!\is_array($mappingSource)) {
$mappingSource = [
'type' => DriverFactoryInterface::DRIVER_ANNOTATION,
... | [
"protected",
"function",
"normalizeMappingSources",
"(",
"array",
"$",
"mappingSources",
")",
":",
"array",
"{",
"return",
"\\",
"array_map",
"(",
"function",
"(",
"$",
"mappingSource",
")",
":",
"array",
"{",
"if",
"(",
"!",
"\\",
"is_array",
"(",
"$",
"m... | Normalize mapping sources format.
@param mixed[] $mappingSources
@return string[][] | [
"Normalize",
"mapping",
"sources",
"format",
"."
] | 1830ff84c054d8e3759df170a5664a97f7070be9 | https://github.com/juliangut/mapping/blob/1830ff84c054d8e3759df170a5664a97f7070be9/src/Metadata/MetadataResolver.php#L113-L128 |
193,206 | agentmedia/phine-core | src/Core/Snippets/FormParts/PageUrlSelector.php | PageUrlSelector.RenderScript | function RenderScript()
{
$templateFile = Path::RemoveExtension($this->TemplateFile());
$scriptFile = Path::AddExtension($templateFile, 'Script');
ob_start();
require Path::AddExtension($scriptFile, 'phtml');
return ob_get_clean();
} | php | function RenderScript()
{
$templateFile = Path::RemoveExtension($this->TemplateFile());
$scriptFile = Path::AddExtension($templateFile, 'Script');
ob_start();
require Path::AddExtension($scriptFile, 'phtml');
return ob_get_clean();
} | [
"function",
"RenderScript",
"(",
")",
"{",
"$",
"templateFile",
"=",
"Path",
"::",
"RemoveExtension",
"(",
"$",
"this",
"->",
"TemplateFile",
"(",
")",
")",
";",
"$",
"scriptFile",
"=",
"Path",
"::",
"AddExtension",
"(",
"$",
"templateFile",
",",
"'Script'... | Renderst necessary javascript
@return string Returns javascript for html output | [
"Renderst",
"necessary",
"javascript"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Snippets/FormParts/PageUrlSelector.php#L168-L175 |
193,207 | agentmedia/phine-core | src/Core/Snippets/FormParts/PageUrlSelector.php | PageUrlSelector.Check | public function Check($data)
{
$value = $data[$this->prefix . 'Page'];
return $this->pageField->Check($value);
} | php | public function Check($data)
{
$value = $data[$this->prefix . 'Page'];
return $this->pageField->Check($value);
} | [
"public",
"function",
"Check",
"(",
"$",
"data",
")",
"{",
"$",
"value",
"=",
"$",
"data",
"[",
"$",
"this",
"->",
"prefix",
".",
"'Page'",
"]",
";",
"return",
"$",
"this",
"->",
"pageField",
"->",
"Check",
"(",
"$",
"value",
")",
";",
"}"
] | Check the selector
@param array $data | [
"Check",
"the",
"selector"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Snippets/FormParts/PageUrlSelector.php#L203-L207 |
193,208 | agentmedia/phine-core | src/Core/Snippets/FormParts/PageUrlSelector.php | PageUrlSelector.Save | public function Save(PageUrl $pageUrl = null)
{
$exists = $pageUrl && $pageUrl->Exists();
$page = $this->Value('Page') ? Page::Schema()->ByID($this->Value('Page')) : null;
if (!$page) {
if ($exists) {
$pageUrl->Delete();
}
return null;
... | php | public function Save(PageUrl $pageUrl = null)
{
$exists = $pageUrl && $pageUrl->Exists();
$page = $this->Value('Page') ? Page::Schema()->ByID($this->Value('Page')) : null;
if (!$page) {
if ($exists) {
$pageUrl->Delete();
}
return null;
... | [
"public",
"function",
"Save",
"(",
"PageUrl",
"$",
"pageUrl",
"=",
"null",
")",
"{",
"$",
"exists",
"=",
"$",
"pageUrl",
"&&",
"$",
"pageUrl",
"->",
"Exists",
"(",
")",
";",
"$",
"page",
"=",
"$",
"this",
"->",
"Value",
"(",
"'Page'",
")",
"?",
"... | Saves the page url and returns it
@param PageUrl $pageUrl The page url
@return PageUrl Returns the page url with properties attached | [
"Saves",
"the",
"page",
"url",
"and",
"returns",
"it"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Snippets/FormParts/PageUrlSelector.php#L240-L258 |
193,209 | agentmedia/phine-core | src/Core/Snippets/FormParts/PageUrlSelector.php | PageUrlSelector.SaveParams | private function SaveParams(PageUrl $pageUrl)
{
$this->ClearParams($pageUrl);
$params = $this->serializer->LinesToArray($this->Value('Params'));
$prev = null;
foreach ($params as $name => $value) {
$param = new PageUrlParameter();
$param->SetPageUrl($pageUrl);... | php | private function SaveParams(PageUrl $pageUrl)
{
$this->ClearParams($pageUrl);
$params = $this->serializer->LinesToArray($this->Value('Params'));
$prev = null;
foreach ($params as $name => $value) {
$param = new PageUrlParameter();
$param->SetPageUrl($pageUrl);... | [
"private",
"function",
"SaveParams",
"(",
"PageUrl",
"$",
"pageUrl",
")",
"{",
"$",
"this",
"->",
"ClearParams",
"(",
"$",
"pageUrl",
")",
";",
"$",
"params",
"=",
"$",
"this",
"->",
"serializer",
"->",
"LinesToArray",
"(",
"$",
"this",
"->",
"Value",
... | Saves the page paramters after the page url is saved
@param PageUrl $pageUrl The page url | [
"Saves",
"the",
"page",
"paramters",
"after",
"the",
"page",
"url",
"is",
"saved"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Snippets/FormParts/PageUrlSelector.php#L264-L278 |
193,210 | agentmedia/phine-core | src/Core/Snippets/FormParts/PageUrlSelector.php | PageUrlSelector.Value | private function Value($name)
{
$value = Request::PostData($this->prefix . $name);
return Str::Trim($value);
} | php | private function Value($name)
{
$value = Request::PostData($this->prefix . $name);
return Str::Trim($value);
} | [
"private",
"function",
"Value",
"(",
"$",
"name",
")",
"{",
"$",
"value",
"=",
"Request",
"::",
"PostData",
"(",
"$",
"this",
"->",
"prefix",
".",
"$",
"name",
")",
";",
"return",
"Str",
"::",
"Trim",
"(",
"$",
"value",
")",
";",
"}"
] | Gets the value by pure name
@param string $name The name without prefix
@return string Returns the value | [
"Gets",
"the",
"value",
"by",
"pure",
"name"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Snippets/FormParts/PageUrlSelector.php#L285-L289 |
193,211 | agentmedia/phine-core | src/Core/Snippets/FormParts/PageUrlSelector.php | PageUrlSelector.ClearParams | private function ClearParams(PageUrl $pageUrl)
{
$sql = Access::SqlBuilder();
$tblParams = PageUrlParameter::Schema()->Table();
$where = $sql->Equals($tblParams->Field('PageUrl'), $sql->Value($pageUrl->GetID()));
PageUrlParameter::Schema()->Delete($where);
} | php | private function ClearParams(PageUrl $pageUrl)
{
$sql = Access::SqlBuilder();
$tblParams = PageUrlParameter::Schema()->Table();
$where = $sql->Equals($tblParams->Field('PageUrl'), $sql->Value($pageUrl->GetID()));
PageUrlParameter::Schema()->Delete($where);
} | [
"private",
"function",
"ClearParams",
"(",
"PageUrl",
"$",
"pageUrl",
")",
"{",
"$",
"sql",
"=",
"Access",
"::",
"SqlBuilder",
"(",
")",
";",
"$",
"tblParams",
"=",
"PageUrlParameter",
"::",
"Schema",
"(",
")",
"->",
"Table",
"(",
")",
";",
"$",
"where... | Clears the parameters of the page url
@param PageUrl $pageUrl The page url | [
"Clears",
"the",
"parameters",
"of",
"the",
"page",
"url"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Snippets/FormParts/PageUrlSelector.php#L295-L301 |
193,212 | myerscode/utilities-strings | src/Utility.php | Utility.append | public function append(string $postfix): Utility
{
return new static($this->string . new static($postfix, $this->encoding), $this->encoding);
} | php | public function append(string $postfix): Utility
{
return new static($this->string . new static($postfix, $this->encoding), $this->encoding);
} | [
"public",
"function",
"append",
"(",
"string",
"$",
"postfix",
")",
":",
"Utility",
"{",
"return",
"new",
"static",
"(",
"$",
"this",
"->",
"string",
".",
"new",
"static",
"(",
"$",
"postfix",
",",
"$",
"this",
"->",
"encoding",
")",
",",
"$",
"this"... | Append the string with a given value
@param string $postfix Value to append to the string
@return $this | [
"Append",
"the",
"string",
"with",
"a",
"given",
"value"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L68-L71 |
193,213 | myerscode/utilities-strings | src/Utility.php | Utility.at | public function at(int $position): Utility
{
if ($position < 0) {
return new static('', $this->encoding);
}
return $this->substring($position, 1);
} | php | public function at(int $position): Utility
{
if ($position < 0) {
return new static('', $this->encoding);
}
return $this->substring($position, 1);
} | [
"public",
"function",
"at",
"(",
"int",
"$",
"position",
")",
":",
"Utility",
"{",
"if",
"(",
"$",
"position",
"<",
"0",
")",
"{",
"return",
"new",
"static",
"(",
"''",
",",
"$",
"this",
"->",
"encoding",
")",
";",
"}",
"return",
"$",
"this",
"->... | Get the character at a specific index
@param int $position
@return Utility | [
"Get",
"the",
"character",
"at",
"a",
"specific",
"index"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L110-L117 |
193,214 | myerscode/utilities-strings | src/Utility.php | Utility.clean | public function clean(string $allowedTags = null): Utility
{
$string = strip_tags(trim($this->string), $allowedTags);
return new static($string, $this->encoding);
} | php | public function clean(string $allowedTags = null): Utility
{
$string = strip_tags(trim($this->string), $allowedTags);
return new static($string, $this->encoding);
} | [
"public",
"function",
"clean",
"(",
"string",
"$",
"allowedTags",
"=",
"null",
")",
":",
"Utility",
"{",
"$",
"string",
"=",
"strip_tags",
"(",
"trim",
"(",
"$",
"this",
"->",
"string",
")",
",",
"$",
"allowedTags",
")",
";",
"return",
"new",
"static",... | Remove tags and trim the string
@param null|string $allowedTags [optional] Tags to keep when passing through strip_tags
@return $this | [
"Remove",
"tags",
"and",
"trim",
"the",
"string"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L159-L164 |
193,215 | myerscode/utilities-strings | src/Utility.php | Utility.containsAll | public function containsAll($contains, int $offset = 0): bool
{
if (empty($contains)) {
return false;
}
$parameters = $this->parameters($contains);
if ($offset > $this->length()) {
return false;
}
foreach ($parameters as $needle) {
... | php | public function containsAll($contains, int $offset = 0): bool
{
if (empty($contains)) {
return false;
}
$parameters = $this->parameters($contains);
if ($offset > $this->length()) {
return false;
}
foreach ($parameters as $needle) {
... | [
"public",
"function",
"containsAll",
"(",
"$",
"contains",
",",
"int",
"$",
"offset",
"=",
"0",
")",
":",
"bool",
"{",
"if",
"(",
"empty",
"(",
"$",
"contains",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"parameters",
"=",
"$",
"this",
"->",
... | Check if a string contains all of the given values
@param string|array $contains Values to look for in the string
@param int $offset [optional] Search will start this number of characters from the beginning of the string.
@return bool | [
"Check",
"if",
"a",
"string",
"contains",
"all",
"of",
"the",
"given",
"values"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L174-L194 |
193,216 | myerscode/utilities-strings | src/Utility.php | Utility.explode | public function explode($delimiter, $limit = PHP_INT_MAX): array
{
return array_slice(array_map('trim', array_filter(explode($delimiter, $this->string, $limit))), 0);
} | php | public function explode($delimiter, $limit = PHP_INT_MAX): array
{
return array_slice(array_map('trim', array_filter(explode($delimiter, $this->string, $limit))), 0);
} | [
"public",
"function",
"explode",
"(",
"$",
"delimiter",
",",
"$",
"limit",
"=",
"PHP_INT_MAX",
")",
":",
"array",
"{",
"return",
"array_slice",
"(",
"array_map",
"(",
"'trim'",
",",
"array_filter",
"(",
"explode",
"(",
"$",
"delimiter",
",",
"$",
"this",
... | Explode the string on a given
@param $delimiter
@param $limit
@return array | [
"Explode",
"the",
"string",
"on",
"a",
"given"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L319-L322 |
193,217 | myerscode/utilities-strings | src/Utility.php | Utility.first | public function first(int $count): Utility
{
if ($count < 0) {
return new static('', $this->encoding);
}
return $this->substring(0, $count);
} | php | public function first(int $count): Utility
{
if ($count < 0) {
return new static('', $this->encoding);
}
return $this->substring(0, $count);
} | [
"public",
"function",
"first",
"(",
"int",
"$",
"count",
")",
":",
"Utility",
"{",
"if",
"(",
"$",
"count",
"<",
"0",
")",
"{",
"return",
"new",
"static",
"(",
"''",
",",
"$",
"this",
"->",
"encoding",
")",
";",
"}",
"return",
"$",
"this",
"->",
... | Get the first x characters from the string
@param int $count
@return Utility | [
"Get",
"the",
"first",
"x",
"characters",
"from",
"the",
"string"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L330-L337 |
193,218 | myerscode/utilities-strings | src/Utility.php | Utility.format | public function format(...$replacements): Utility
{
$string = $this->string;
foreach ($replacements as $index => $value) {
if (!is_scalar($value) || (is_object($value) && !method_exists($value, '__toString'))) {
$type = is_object($value) ? get_class($value) : gettype($va... | php | public function format(...$replacements): Utility
{
$string = $this->string;
foreach ($replacements as $index => $value) {
if (!is_scalar($value) || (is_object($value) && !method_exists($value, '__toString'))) {
$type = is_object($value) ? get_class($value) : gettype($va... | [
"public",
"function",
"format",
"(",
"...",
"$",
"replacements",
")",
":",
"Utility",
"{",
"$",
"string",
"=",
"$",
"this",
"->",
"string",
";",
"foreach",
"(",
"$",
"replacements",
"as",
"$",
"index",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
... | Inserts the given values into the chronological placeholders
@param array ...$replacements Collection of items to insert into the string
@return $this | [
"Inserts",
"the",
"given",
"values",
"into",
"the",
"chronological",
"placeholders"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L346-L362 |
193,219 | myerscode/utilities-strings | src/Utility.php | Utility.isFalse | public function isFalse(): bool
{
return (
in_array($this->string, ['']) ||
(false === filter_var($this->string, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE))
);
} | php | public function isFalse(): bool
{
return (
in_array($this->string, ['']) ||
(false === filter_var($this->string, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE))
);
} | [
"public",
"function",
"isFalse",
"(",
")",
":",
"bool",
"{",
"return",
"(",
"in_array",
"(",
"$",
"this",
"->",
"string",
",",
"[",
"''",
"]",
")",
"||",
"(",
"false",
"===",
"filter_var",
"(",
"$",
"this",
"->",
"string",
",",
"FILTER_VALIDATE_BOOLEAN... | Check if a given value can be perceived as false.
Will only return false if the value "looks false-y" by being a value of "false", "0", "no", "off", ""
@return bool | [
"Check",
"if",
"a",
"given",
"value",
"can",
"be",
"perceived",
"as",
"false",
".",
"Will",
"only",
"return",
"false",
"if",
"the",
"value",
"looks",
"false",
"-",
"y",
"by",
"being",
"a",
"value",
"of",
"false",
"0",
"no",
"off"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L400-L406 |
193,220 | myerscode/utilities-strings | src/Utility.php | Utility.isTrue | public function isTrue(): bool
{
return (
in_array($this->string, ['ok']) ||
(true === filter_var($this->string, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE))
);
} | php | public function isTrue(): bool
{
return (
in_array($this->string, ['ok']) ||
(true === filter_var($this->string, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE))
);
} | [
"public",
"function",
"isTrue",
"(",
")",
":",
"bool",
"{",
"return",
"(",
"in_array",
"(",
"$",
"this",
"->",
"string",
",",
"[",
"'ok'",
"]",
")",
"||",
"(",
"true",
"===",
"filter_var",
"(",
"$",
"this",
"->",
"string",
",",
"FILTER_VALIDATE_BOOLEAN... | Check if a given value can be perceived as true
Will on return true if the value "looks true-y"
"true", "1", "yes", "on", "ok"
@return bool | [
"Check",
"if",
"a",
"given",
"value",
"can",
"be",
"perceived",
"as",
"true",
"Will",
"on",
"return",
"true",
"if",
"the",
"value",
"looks",
"true",
"-",
"y",
"true",
"1",
"yes",
"on",
"ok"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L427-L433 |
193,221 | myerscode/utilities-strings | src/Utility.php | Utility.limit | public function limit(int $length)
{
$string = $this->string;
if ($this->length() > $length) {
$string = substr($string, 0, $length);
}
return new static($string, $this->encoding);
} | php | public function limit(int $length)
{
$string = $this->string;
if ($this->length() > $length) {
$string = substr($string, 0, $length);
}
return new static($string, $this->encoding);
} | [
"public",
"function",
"limit",
"(",
"int",
"$",
"length",
")",
"{",
"$",
"string",
"=",
"$",
"this",
"->",
"string",
";",
"if",
"(",
"$",
"this",
"->",
"length",
"(",
")",
">",
"$",
"length",
")",
"{",
"$",
"string",
"=",
"substr",
"(",
"$",
"s... | Limit the length of the string to a given value
@param int $length Desired length the string should be
@return $this | [
"Limit",
"the",
"length",
"of",
"the",
"string",
"to",
"a",
"given",
"value"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L452-L461 |
193,222 | myerscode/utilities-strings | src/Utility.php | Utility.minimise | public function minimise(): Utility
{
// remove redundant (white-space) characters
$replace = [
// remove tabs before and after HTML tags
'/\>[^\S ]+/s' => '>',
'/[^\S ]+\</s' => '<',
// shorten multiple whitespace sequences; keep new-line characters b... | php | public function minimise(): Utility
{
// remove redundant (white-space) characters
$replace = [
// remove tabs before and after HTML tags
'/\>[^\S ]+/s' => '>',
'/[^\S ]+\</s' => '<',
// shorten multiple whitespace sequences; keep new-line characters b... | [
"public",
"function",
"minimise",
"(",
")",
":",
"Utility",
"{",
"// remove redundant (white-space) characters",
"$",
"replace",
"=",
"[",
"// remove tabs before and after HTML tags",
"'/\\>[^\\S ]+/s'",
"=>",
"'>'",
",",
"'/[^\\S ]+\\</s'",
"=>",
"'<'",
",",
"// shorten ... | Minimise string, removing all extra spaces, new lines and any unneeded html content
@return $this | [
"Minimise",
"string",
"removing",
"all",
"extra",
"spaces",
"new",
"lines",
"and",
"any",
"unneeded",
"html",
"content"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L481-L533 |
193,223 | myerscode/utilities-strings | src/Utility.php | Utility.occurrences | public function occurrences(string $needle): array
{
$offset = 0;
$allPositions = [];
while (($position = strpos($this->string, $needle, $offset)) !== false) {
$offset = $position + 1;
$allPositions[] = $position;
}
return $allPositions;
} | php | public function occurrences(string $needle): array
{
$offset = 0;
$allPositions = [];
while (($position = strpos($this->string, $needle, $offset)) !== false) {
$offset = $position + 1;
$allPositions[] = $position;
}
return $allPositions;
} | [
"public",
"function",
"occurrences",
"(",
"string",
"$",
"needle",
")",
":",
"array",
"{",
"$",
"offset",
"=",
"0",
";",
"$",
"allPositions",
"=",
"[",
"]",
";",
"while",
"(",
"(",
"$",
"position",
"=",
"strpos",
"(",
"$",
"this",
"->",
"string",
"... | Find all the positions of occurrences of the given needle in the string
@param string $needle The value to find in the string
@return array | [
"Find",
"all",
"the",
"positions",
"of",
"occurrences",
"of",
"the",
"given",
"needle",
"in",
"the",
"string"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L542-L553 |
193,224 | myerscode/utilities-strings | src/Utility.php | Utility.pad | public function pad(int $length, string $padding = ' '): Utility
{
$padLength = $length - $this->length();
return $this->applyPadding(floor($padLength / 2), ceil($padLength / 2), $padding);
} | php | public function pad(int $length, string $padding = ' '): Utility
{
$padLength = $length - $this->length();
return $this->applyPadding(floor($padLength / 2), ceil($padLength / 2), $padding);
} | [
"public",
"function",
"pad",
"(",
"int",
"$",
"length",
",",
"string",
"$",
"padding",
"=",
"' '",
")",
":",
"Utility",
"{",
"$",
"padLength",
"=",
"$",
"length",
"-",
"$",
"this",
"->",
"length",
"(",
")",
";",
"return",
"$",
"this",
"->",
"applyP... | Pad the string with a value until it is the given length
@param int $length Desired string length after padding
@param string $padding Value to pad the string with
@return $this | [
"Pad",
"the",
"string",
"with",
"a",
"value",
"until",
"it",
"is",
"the",
"given",
"length"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L563-L568 |
193,225 | myerscode/utilities-strings | src/Utility.php | Utility.padLeft | public function padLeft($length, $padding = ' '): Utility
{
return $this->applyPadding($length - $this->length(), 0, $padding);
} | php | public function padLeft($length, $padding = ' '): Utility
{
return $this->applyPadding($length - $this->length(), 0, $padding);
} | [
"public",
"function",
"padLeft",
"(",
"$",
"length",
",",
"$",
"padding",
"=",
"' '",
")",
":",
"Utility",
"{",
"return",
"$",
"this",
"->",
"applyPadding",
"(",
"$",
"length",
"-",
"$",
"this",
"->",
"length",
"(",
")",
",",
"0",
",",
"$",
"paddin... | Pad the left the string with a value until it is the given length
@param int $length Desired string length after padding
@param string $padding Value to pad the string with
@return $this | [
"Pad",
"the",
"left",
"the",
"string",
"with",
"a",
"value",
"until",
"it",
"is",
"the",
"given",
"length"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L578-L581 |
193,226 | myerscode/utilities-strings | src/Utility.php | Utility.padRight | public function padRight($length, $padding = ' '): Utility
{
return $this->applyPadding(0, $length - $this->length(), $padding);
} | php | public function padRight($length, $padding = ' '): Utility
{
return $this->applyPadding(0, $length - $this->length(), $padding);
} | [
"public",
"function",
"padRight",
"(",
"$",
"length",
",",
"$",
"padding",
"=",
"' '",
")",
":",
"Utility",
"{",
"return",
"$",
"this",
"->",
"applyPadding",
"(",
"0",
",",
"$",
"length",
"-",
"$",
"this",
"->",
"length",
"(",
")",
",",
"$",
"paddi... | Pad the right the string with a value until it is the given length
@param int $length Desired string length after padding
@param string $padding Value to pad the string with
@return $this | [
"Pad",
"the",
"right",
"the",
"string",
"with",
"a",
"value",
"until",
"it",
"is",
"the",
"given",
"length"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L591-L594 |
193,227 | myerscode/utilities-strings | src/Utility.php | Utility.parameters | private function parameters($parameters): array
{
$values = (!is_array($parameters)) ? [$parameters] : $parameters;
$strings = [];
foreach ($values as $value) {
$strings[] = self::make($value, $this->encoding);
}
return $strings;
} | php | private function parameters($parameters): array
{
$values = (!is_array($parameters)) ? [$parameters] : $parameters;
$strings = [];
foreach ($values as $value) {
$strings[] = self::make($value, $this->encoding);
}
return $strings;
} | [
"private",
"function",
"parameters",
"(",
"$",
"parameters",
")",
":",
"array",
"{",
"$",
"values",
"=",
"(",
"!",
"is_array",
"(",
"$",
"parameters",
")",
")",
"?",
"[",
"$",
"parameters",
"]",
":",
"$",
"parameters",
";",
"$",
"strings",
"=",
"[",
... | Transform user input into a collection of Utility
@param string|array $parameters
@return Utility[] | [
"Transform",
"user",
"input",
"into",
"a",
"collection",
"of",
"Utility"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L603-L614 |
193,228 | myerscode/utilities-strings | src/Utility.php | Utility.prepareForCasing | private function prepareForCasing($string): array
{
$string = str_replace(['.', '_', '-'], ' ', $string);
// split on capital letters
$string = implode(' ', preg_split('/(?<=\\w)(?=[A-Z])/', $string));
// explode on numbers
$parts = preg_split('/(,?\s+)|((?<=[a-z])(?=\d))|(... | php | private function prepareForCasing($string): array
{
$string = str_replace(['.', '_', '-'], ' ', $string);
// split on capital letters
$string = implode(' ', preg_split('/(?<=\\w)(?=[A-Z])/', $string));
// explode on numbers
$parts = preg_split('/(,?\s+)|((?<=[a-z])(?=\d))|(... | [
"private",
"function",
"prepareForCasing",
"(",
"$",
"string",
")",
":",
"array",
"{",
"$",
"string",
"=",
"str_replace",
"(",
"[",
"'.'",
",",
"'_'",
",",
"'-'",
"]",
",",
"' '",
",",
"$",
"string",
")",
";",
"// split on capital letters",
"$",
"string"... | Clean up and chunk a string ready for use in casing the string value
@param string $string
@return array | [
"Clean",
"up",
"and",
"chunk",
"a",
"string",
"ready",
"for",
"use",
"in",
"casing",
"the",
"string",
"value"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L623-L637 |
193,229 | myerscode/utilities-strings | src/Utility.php | Utility.prepend | public function prepend($prefix): Utility
{
return new static(new static($prefix, $this->encoding) . $this->string, $this->encoding);
} | php | public function prepend($prefix): Utility
{
return new static(new static($prefix, $this->encoding) . $this->string, $this->encoding);
} | [
"public",
"function",
"prepend",
"(",
"$",
"prefix",
")",
":",
"Utility",
"{",
"return",
"new",
"static",
"(",
"new",
"static",
"(",
"$",
"prefix",
",",
"$",
"this",
"->",
"encoding",
")",
".",
"$",
"this",
"->",
"string",
",",
"$",
"this",
"->",
"... | Prepend the string with a given value
@param string $prefix
@return $this | [
"Prepend",
"the",
"string",
"with",
"a",
"given",
"value"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L646-L649 |
193,230 | myerscode/utilities-strings | src/Utility.php | Utility.removeRepeating | public function removeRepeating(string $repeatingValue = ' '): Utility
{
$string = preg_replace('{(' . preg_quote($repeatingValue) . ')\1+}', $repeatingValue, $this->string);
return new static($string, $this->encoding);
} | php | public function removeRepeating(string $repeatingValue = ' '): Utility
{
$string = preg_replace('{(' . preg_quote($repeatingValue) . ')\1+}', $repeatingValue, $this->string);
return new static($string, $this->encoding);
} | [
"public",
"function",
"removeRepeating",
"(",
"string",
"$",
"repeatingValue",
"=",
"' '",
")",
":",
"Utility",
"{",
"$",
"string",
"=",
"preg_replace",
"(",
"'{('",
".",
"preg_quote",
"(",
"$",
"repeatingValue",
")",
".",
"')\\1+}'",
",",
"$",
"repeatingVal... | Remove repeating characters from the value
@param string $repeatingValue Value to remove
@return $this | [
"Remove",
"repeating",
"characters",
"from",
"the",
"value"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L682-L687 |
193,231 | myerscode/utilities-strings | src/Utility.php | Utility.removeSpace | public function removeSpace(): Utility
{
$string = preg_replace('~[[:cntrl:][:space:]]~', '', trim($this->string));
return new static($string, $this->encoding);
} | php | public function removeSpace(): Utility
{
$string = preg_replace('~[[:cntrl:][:space:]]~', '', trim($this->string));
return new static($string, $this->encoding);
} | [
"public",
"function",
"removeSpace",
"(",
")",
":",
"Utility",
"{",
"$",
"string",
"=",
"preg_replace",
"(",
"'~[[:cntrl:][:space:]]~'",
",",
"''",
",",
"trim",
"(",
"$",
"this",
"->",
"string",
")",
")",
";",
"return",
"new",
"static",
"(",
"$",
"string... | Remove all spaces and white space from the string
@return $this | [
"Remove",
"all",
"spaces",
"and",
"white",
"space",
"from",
"the",
"string"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L694-L699 |
193,232 | myerscode/utilities-strings | src/Utility.php | Utility.repeat | public function repeat(int $multiplier): Utility
{
$string = str_repeat($this->string, $multiplier);
return new static($string, $this->encoding);
} | php | public function repeat(int $multiplier): Utility
{
$string = str_repeat($this->string, $multiplier);
return new static($string, $this->encoding);
} | [
"public",
"function",
"repeat",
"(",
"int",
"$",
"multiplier",
")",
":",
"Utility",
"{",
"$",
"string",
"=",
"str_repeat",
"(",
"$",
"this",
"->",
"string",
",",
"$",
"multiplier",
")",
";",
"return",
"new",
"static",
"(",
"$",
"string",
",",
"$",
"t... | Repeat the string by the amount of the multiplier
@param int $multiplier The number of times to repeat the string
@return $this | [
"Repeat",
"the",
"string",
"by",
"the",
"amount",
"of",
"the",
"multiplier"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L708-L713 |
193,233 | myerscode/utilities-strings | src/Utility.php | Utility.replace | public function replace($find, $with): Utility
{
$replace = [];
foreach ($this->parameters($find) as $parameter) {
$replace[] = preg_quote($parameter->value());
}
$withString = new static($with, $this->encoding);
$string = preg_replace('#(' . implode('|', $repl... | php | public function replace($find, $with): Utility
{
$replace = [];
foreach ($this->parameters($find) as $parameter) {
$replace[] = preg_quote($parameter->value());
}
$withString = new static($with, $this->encoding);
$string = preg_replace('#(' . implode('|', $repl... | [
"public",
"function",
"replace",
"(",
"$",
"find",
",",
"$",
"with",
")",
":",
"Utility",
"{",
"$",
"replace",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"parameters",
"(",
"$",
"find",
")",
"as",
"$",
"parameter",
")",
"{",
"$",
"rep... | Replace occurrences in the string with a given value
@param string|array $find Value(s) in the string to replace
@param string $with Value to replace occurrences with
@return $this | [
"Replace",
"occurrences",
"in",
"the",
"string",
"with",
"a",
"given",
"value"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L723-L736 |
193,234 | myerscode/utilities-strings | src/Utility.php | Utility.replaceNonAlpha | public function replaceNonAlpha(string $replacement = '', bool $strict = false): Utility
{
if ($strict) {
$pattern = '/[^a-zA-Z]/';
} else {
$pattern = '/[^a-zA-Z ]/';
}
$string = preg_replace($pattern, $replacement, trim($this->string));
return new ... | php | public function replaceNonAlpha(string $replacement = '', bool $strict = false): Utility
{
if ($strict) {
$pattern = '/[^a-zA-Z]/';
} else {
$pattern = '/[^a-zA-Z ]/';
}
$string = preg_replace($pattern, $replacement, trim($this->string));
return new ... | [
"public",
"function",
"replaceNonAlpha",
"(",
"string",
"$",
"replacement",
"=",
"''",
",",
"bool",
"$",
"strict",
"=",
"false",
")",
":",
"Utility",
"{",
"if",
"(",
"$",
"strict",
")",
"{",
"$",
"pattern",
"=",
"'/[^a-zA-Z]/'",
";",
"}",
"else",
"{",
... | Replace none alpha characters in the string with the given value
@param string $replacement Value to replace none alpha characters with
@param boolean $strict Should spaces be preserved
@return $this | [
"Replace",
"none",
"alpha",
"characters",
"in",
"the",
"string",
"with",
"the",
"given",
"value"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L746-L757 |
193,235 | myerscode/utilities-strings | src/Utility.php | Utility.reverse | public function reverse(): Utility
{
$string = '';
for ($i = $this->length() - 1; $i >= 0; $i--) {
$string .= \mb_substr($this->string, $i, 1, $this->encoding);
}
return new static($string, $this->encoding);
} | php | public function reverse(): Utility
{
$string = '';
for ($i = $this->length() - 1; $i >= 0; $i--) {
$string .= \mb_substr($this->string, $i, 1, $this->encoding);
}
return new static($string, $this->encoding);
} | [
"public",
"function",
"reverse",
"(",
")",
":",
"Utility",
"{",
"$",
"string",
"=",
"''",
";",
"for",
"(",
"$",
"i",
"=",
"$",
"this",
"->",
"length",
"(",
")",
"-",
"1",
";",
"$",
"i",
">=",
"0",
";",
"$",
"i",
"--",
")",
"{",
"$",
"string... | Reverse the string
@return $this | [
"Reverse",
"the",
"string"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L806-L815 |
193,236 | myerscode/utilities-strings | src/Utility.php | Utility.surround | public function surround($with): Utility
{
$surrounding = new static($with, $this->encoding);
return new static(implode('', [$surrounding, $this->string, $surrounding]), $this->encoding);
} | php | public function surround($with): Utility
{
$surrounding = new static($with, $this->encoding);
return new static(implode('', [$surrounding, $this->string, $surrounding]), $this->encoding);
} | [
"public",
"function",
"surround",
"(",
"$",
"with",
")",
":",
"Utility",
"{",
"$",
"surrounding",
"=",
"new",
"static",
"(",
"$",
"with",
",",
"$",
"this",
"->",
"encoding",
")",
";",
"return",
"new",
"static",
"(",
"implode",
"(",
"''",
",",
"[",
... | Wrap the the string with a value
@param $with
@return Utility | [
"Wrap",
"the",
"the",
"string",
"with",
"a",
"value"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L881-L886 |
193,237 | myerscode/utilities-strings | src/Utility.php | Utility.toCamelCase | public function toCamelCase(): Utility
{
// separate existing joined words
$string = preg_replace('/([a-z0-9])(?=[A-Z])/', '$1 ', $this->string);
$words = preg_split('/[\W_]/', $string);
$words = array_map(function ($word) {
return ucfirst(strtolower($word));
},... | php | public function toCamelCase(): Utility
{
// separate existing joined words
$string = preg_replace('/([a-z0-9])(?=[A-Z])/', '$1 ', $this->string);
$words = preg_split('/[\W_]/', $string);
$words = array_map(function ($word) {
return ucfirst(strtolower($word));
},... | [
"public",
"function",
"toCamelCase",
"(",
")",
":",
"Utility",
"{",
"// separate existing joined words",
"$",
"string",
"=",
"preg_replace",
"(",
"'/([a-z0-9])(?=[A-Z])/'",
",",
"'$1 '",
",",
"$",
"this",
"->",
"string",
")",
";",
"$",
"words",
"=",
"preg_split"... | Transform the value to into camelCase format
@return $this | [
"Transform",
"the",
"value",
"to",
"into",
"camelCase",
"format"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L913-L927 |
193,238 | myerscode/utilities-strings | src/Utility.php | Utility.toPascalCase | public function toPascalCase(): Utility
{
$string = ucfirst($this->toCamelCase()->value());
return new static($string, $this->encoding);
} | php | public function toPascalCase(): Utility
{
$string = ucfirst($this->toCamelCase()->value());
return new static($string, $this->encoding);
} | [
"public",
"function",
"toPascalCase",
"(",
")",
":",
"Utility",
"{",
"$",
"string",
"=",
"ucfirst",
"(",
"$",
"this",
"->",
"toCamelCase",
"(",
")",
"->",
"value",
"(",
")",
")",
";",
"return",
"new",
"static",
"(",
"$",
"string",
",",
"$",
"this",
... | Transform the value to into PascalCase format
@return $this | [
"Transform",
"the",
"value",
"to",
"into",
"PascalCase",
"format"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L966-L971 |
193,239 | myerscode/utilities-strings | src/Utility.php | Utility.toSentence | public function toSentence(): Utility
{
$sentences = preg_split(
'/([^\.\!\?;]+[\.\!\?;"]+)/',
$this->string,
-1,
PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
);
$sentences = array_map(function ($sentence) {
$sentence = trim($sen... | php | public function toSentence(): Utility
{
$sentences = preg_split(
'/([^\.\!\?;]+[\.\!\?;"]+)/',
$this->string,
-1,
PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
);
$sentences = array_map(function ($sentence) {
$sentence = trim($sen... | [
"public",
"function",
"toSentence",
"(",
")",
":",
"Utility",
"{",
"$",
"sentences",
"=",
"preg_split",
"(",
"'/([^\\.\\!\\?;]+[\\.\\!\\?;\"]+)/'",
",",
"$",
"this",
"->",
"string",
",",
"-",
"1",
",",
"PREG_SPLIT_NO_EMPTY",
"|",
"PREG_SPLIT_DELIM_CAPTURE",
")",
... | Turn the string into a sentence.
@return $this | [
"Turn",
"the",
"string",
"into",
"a",
"sentence",
"."
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L978-L1002 |
193,240 | myerscode/utilities-strings | src/Utility.php | Utility.toSlug | public function toSlug(string $separator = '-'): Utility
{
$string = mb_convert_encoding($this->string, 'UTF-8', $this->encoding);
$string = preg_replace('/[^\s\p{L}0-9\-' . $separator . ']/u', '', $string);
$string = htmlentities($string, ENT_QUOTES, 'UTF-8');
$string = preg_replace... | php | public function toSlug(string $separator = '-'): Utility
{
$string = mb_convert_encoding($this->string, 'UTF-8', $this->encoding);
$string = preg_replace('/[^\s\p{L}0-9\-' . $separator . ']/u', '', $string);
$string = htmlentities($string, ENT_QUOTES, 'UTF-8');
$string = preg_replace... | [
"public",
"function",
"toSlug",
"(",
"string",
"$",
"separator",
"=",
"'-'",
")",
":",
"Utility",
"{",
"$",
"string",
"=",
"mb_convert_encoding",
"(",
"$",
"this",
"->",
"string",
",",
"'UTF-8'",
",",
"$",
"this",
"->",
"encoding",
")",
";",
"$",
"stri... | Clean a string to only have alpha numeric characters,
turn spaces into a separator slug
@param string $separator Value to separate chunks with
@return $this | [
"Clean",
"a",
"string",
"to",
"only",
"have",
"alpha",
"numeric",
"characters",
"turn",
"spaces",
"into",
"a",
"separator",
"slug"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L1012-L1025 |
193,241 | myerscode/utilities-strings | src/Utility.php | Utility.toSlugUtf8 | public function toSlugUtf8(string $separator = '-'): Utility
{
$string = mb_convert_encoding($this->string, 'UTF-8', $this->encoding);
$string = preg_replace('/[^\s\p{L}0-9\-' . $separator . ']/u', '', $string);
$string = preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|sla... | php | public function toSlugUtf8(string $separator = '-'): Utility
{
$string = mb_convert_encoding($this->string, 'UTF-8', $this->encoding);
$string = preg_replace('/[^\s\p{L}0-9\-' . $separator . ']/u', '', $string);
$string = preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|sla... | [
"public",
"function",
"toSlugUtf8",
"(",
"string",
"$",
"separator",
"=",
"'-'",
")",
":",
"Utility",
"{",
"$",
"string",
"=",
"mb_convert_encoding",
"(",
"$",
"this",
"->",
"string",
",",
"'UTF-8'",
",",
"$",
"this",
"->",
"encoding",
")",
";",
"$",
"... | Same as toSlug but preserves UTF8 characters
@param string $separator Value to separate chunks with
@return $this | [
"Same",
"as",
"toSlug",
"but",
"preserves",
"UTF8",
"characters"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L1034-L1043 |
193,242 | myerscode/utilities-strings | src/Utility.php | Utility.toSnakeCase | public function toSnakeCase(): Utility
{
$string = mb_ereg_replace('\B([A-Z])', '-\1', trim($this->string));
$string = mb_strtolower($string, $this->encoding);
$string = mb_ereg_replace('[-_\s]+', '_', $string);
return new static($string, $this->encoding);
} | php | public function toSnakeCase(): Utility
{
$string = mb_ereg_replace('\B([A-Z])', '-\1', trim($this->string));
$string = mb_strtolower($string, $this->encoding);
$string = mb_ereg_replace('[-_\s]+', '_', $string);
return new static($string, $this->encoding);
} | [
"public",
"function",
"toSnakeCase",
"(",
")",
":",
"Utility",
"{",
"$",
"string",
"=",
"mb_ereg_replace",
"(",
"'\\B([A-Z])'",
",",
"'-\\1'",
",",
"trim",
"(",
"$",
"this",
"->",
"string",
")",
")",
";",
"$",
"string",
"=",
"mb_strtolower",
"(",
"$",
... | Transform the value to snake_case format
@return $this | [
"Transform",
"the",
"value",
"to",
"snake_case",
"format"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L1050-L1059 |
193,243 | myerscode/utilities-strings | src/Utility.php | Utility.toStudlyCase | public function toStudlyCase(): Utility
{
$string = implode(' ', $this->prepareForCasing($this->string));
$string = str_replace(' ', '', ucwords($string));
return new static($string, $this->encoding);
} | php | public function toStudlyCase(): Utility
{
$string = implode(' ', $this->prepareForCasing($this->string));
$string = str_replace(' ', '', ucwords($string));
return new static($string, $this->encoding);
} | [
"public",
"function",
"toStudlyCase",
"(",
")",
":",
"Utility",
"{",
"$",
"string",
"=",
"implode",
"(",
"' '",
",",
"$",
"this",
"->",
"prepareForCasing",
"(",
"$",
"this",
"->",
"string",
")",
")",
";",
"$",
"string",
"=",
"str_replace",
"(",
"' '",
... | Transform the value to StudlyCase format
@return $this | [
"Transform",
"the",
"value",
"to",
"StudlyCase",
"format"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L1066-L1073 |
193,244 | myerscode/utilities-strings | src/Utility.php | Utility.toTitleCase | public function toTitleCase(): Utility
{
$words = explode(' ', $this->string);
$string = mb_convert_case(implode(' ', $words), MB_CASE_TITLE, $this->encoding());
return new static($string, $this->encoding);
} | php | public function toTitleCase(): Utility
{
$words = explode(' ', $this->string);
$string = mb_convert_case(implode(' ', $words), MB_CASE_TITLE, $this->encoding());
return new static($string, $this->encoding);
} | [
"public",
"function",
"toTitleCase",
"(",
")",
":",
"Utility",
"{",
"$",
"words",
"=",
"explode",
"(",
"' '",
",",
"$",
"this",
"->",
"string",
")",
";",
"$",
"string",
"=",
"mb_convert_case",
"(",
"implode",
"(",
"' '",
",",
"$",
"words",
")",
",",
... | Transform the value to into Title Case format
@return $this | [
"Transform",
"the",
"value",
"to",
"into",
"Title",
"Case",
"format"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L1080-L1087 |
193,245 | myerscode/utilities-strings | src/Utility.php | Utility.trim | public function trim($values = " \t\n\r\0\x0B"): Utility
{
$parameters = $this->parameters($values);
$string = trim($this->string, implode('', $parameters));
return new static($string, $this->encoding);
} | php | public function trim($values = " \t\n\r\0\x0B"): Utility
{
$parameters = $this->parameters($values);
$string = trim($this->string, implode('', $parameters));
return new static($string, $this->encoding);
} | [
"public",
"function",
"trim",
"(",
"$",
"values",
"=",
"\" \\t\\n\\r\\0\\x0B\"",
")",
":",
"Utility",
"{",
"$",
"parameters",
"=",
"$",
"this",
"->",
"parameters",
"(",
"$",
"values",
")",
";",
"$",
"string",
"=",
"trim",
"(",
"$",
"this",
"->",
"strin... | Trim a collection of values from the string using trim
@param mixed $values Values to be trimmed from the string
@return $this | [
"Trim",
"a",
"collection",
"of",
"values",
"from",
"the",
"string",
"using",
"trim"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L1106-L1113 |
193,246 | myerscode/utilities-strings | src/Utility.php | Utility.trimLeft | public function trimLeft($values = " \t\n\r\0\x0B"): Utility
{
$parameters = $this->parameters($values);
$string = ltrim($this->string, implode('', $parameters));
return new static($string, $this->encoding);
} | php | public function trimLeft($values = " \t\n\r\0\x0B"): Utility
{
$parameters = $this->parameters($values);
$string = ltrim($this->string, implode('', $parameters));
return new static($string, $this->encoding);
} | [
"public",
"function",
"trimLeft",
"(",
"$",
"values",
"=",
"\" \\t\\n\\r\\0\\x0B\"",
")",
":",
"Utility",
"{",
"$",
"parameters",
"=",
"$",
"this",
"->",
"parameters",
"(",
"$",
"values",
")",
";",
"$",
"string",
"=",
"ltrim",
"(",
"$",
"this",
"->",
"... | Trim a collection of values from the string using rtrim
@param mixed $values Values to be trimmed from the string
@return $this | [
"Trim",
"a",
"collection",
"of",
"values",
"from",
"the",
"string",
"using",
"rtrim"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L1122-L1129 |
193,247 | myerscode/utilities-strings | src/Utility.php | Utility.trimRight | public function trimRight($values = " \t\n\r\0\x0B"): Utility
{
$parameters = $this->parameters($values);
$string = rtrim($this->string, implode('', $parameters));
return new static($string, $this->encoding);
} | php | public function trimRight($values = " \t\n\r\0\x0B"): Utility
{
$parameters = $this->parameters($values);
$string = rtrim($this->string, implode('', $parameters));
return new static($string, $this->encoding);
} | [
"public",
"function",
"trimRight",
"(",
"$",
"values",
"=",
"\" \\t\\n\\r\\0\\x0B\"",
")",
":",
"Utility",
"{",
"$",
"parameters",
"=",
"$",
"this",
"->",
"parameters",
"(",
"$",
"values",
")",
";",
"$",
"string",
"=",
"rtrim",
"(",
"$",
"this",
"->",
... | Trim a collection of values from the string using ltrim
@param mixed $values Values to be trimmed from the string
@return $this | [
"Trim",
"a",
"collection",
"of",
"values",
"from",
"the",
"string",
"using",
"ltrim"
] | e7adb907a57de060295a7f3886d43230f66f6b76 | https://github.com/myerscode/utilities-strings/blob/e7adb907a57de060295a7f3886d43230f66f6b76/src/Utility.php#L1138-L1145 |
193,248 | hschletz/NADA | src/Table/Sqlite.php | Sqlite.alterColumn | public function alterColumn($name, $attrib, $value)
{
$this->requireColumn($name);
// Derive new column specification from existing one
$newColumns = $this->_columns;
if ($attrib === null) {
unset($newColumns[$name]);
} else {
$newColumn = $newColumns... | php | public function alterColumn($name, $attrib, $value)
{
$this->requireColumn($name);
// Derive new column specification from existing one
$newColumns = $this->_columns;
if ($attrib === null) {
unset($newColumns[$name]);
} else {
$newColumn = $newColumns... | [
"public",
"function",
"alterColumn",
"(",
"$",
"name",
",",
"$",
"attrib",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"requireColumn",
"(",
"$",
"name",
")",
";",
"// Derive new column specification from existing one",
"$",
"newColumns",
"=",
"$",
"this",... | Internal method to alter a column
Since SQLite's ALTER TABLE statement only supports renaming tables and
adding columns, this method does everything else:
1. The table is renamed to a unique temporary name.
2. A new table with the original name and altered columns is created.
3. Data is copied to the new table.
4. Th... | [
"Internal",
"method",
"to",
"alter",
"a",
"column"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Table/Sqlite.php#L115-L189 |
193,249 | hschletz/NADA | src/Table/Sqlite.php | Sqlite._renameToTmp | protected function _renameToTmp()
{
$tmpTableName = $this->_name;
$tableNames = $this->_database->getTableNames();
do {
$tmpTableName .= '_bak';
} while (in_array($tmpTableName, $tableNames));
// Use quoteIdentifier() instead of prepareIdentifier() because the
... | php | protected function _renameToTmp()
{
$tmpTableName = $this->_name;
$tableNames = $this->_database->getTableNames();
do {
$tmpTableName .= '_bak';
} while (in_array($tmpTableName, $tableNames));
// Use quoteIdentifier() instead of prepareIdentifier() because the
... | [
"protected",
"function",
"_renameToTmp",
"(",
")",
"{",
"$",
"tmpTableName",
"=",
"$",
"this",
"->",
"_name",
";",
"$",
"tableNames",
"=",
"$",
"this",
"->",
"_database",
"->",
"getTableNames",
"(",
")",
";",
"do",
"{",
"$",
"tmpTableName",
".=",
"'_bak'... | Rename table to a unique temporary name
@return string New table name | [
"Rename",
"table",
"to",
"a",
"unique",
"temporary",
"name"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Table/Sqlite.php#L248-L260 |
193,250 | zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php | YamlDumper.dump | public function dump(array $options = array())
{
if (!class_exists('zxf\Symfony\Component\Yaml\Dumper')) {
throw new RuntimeException('Unable to dump the container as the Symfony Yaml Component is not installed.');
}
if (null === $this->dumper) {
$this->dumper = new ... | php | public function dump(array $options = array())
{
if (!class_exists('zxf\Symfony\Component\Yaml\Dumper')) {
throw new RuntimeException('Unable to dump the container as the Symfony Yaml Component is not installed.');
}
if (null === $this->dumper) {
$this->dumper = new ... | [
"public",
"function",
"dump",
"(",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"'zxf\\Symfony\\Component\\Yaml\\Dumper'",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Unable to dump the container as ... | Dumps the service container as an YAML string.
@return string A YAML string representing of the service container | [
"Dumps",
"the",
"service",
"container",
"as",
"an",
"YAML",
"string",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php#L44-L55 |
193,251 | zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php | YamlDumper.addServices | private function addServices()
{
if (!$this->container->getDefinitions()) {
return '';
}
$code = "services:\n";
foreach ($this->container->getDefinitions() as $id => $definition) {
$code .= $this->addService($id, $definition);
}
$aliases = $t... | php | private function addServices()
{
if (!$this->container->getDefinitions()) {
return '';
}
$code = "services:\n";
foreach ($this->container->getDefinitions() as $id => $definition) {
$code .= $this->addService($id, $definition);
}
$aliases = $t... | [
"private",
"function",
"addServices",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"->",
"getDefinitions",
"(",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"code",
"=",
"\"services:\\n\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"... | Adds services.
@return string | [
"Adds",
"services",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php#L192-L212 |
193,252 | zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php | YamlDumper.prepareParameters | private function prepareParameters(array $parameters, $escape = true)
{
$filtered = array();
foreach ($parameters as $key => $value) {
if (is_array($value)) {
$value = $this->prepareParameters($value, $escape);
} elseif ($value instanceof Reference || is_strin... | php | private function prepareParameters(array $parameters, $escape = true)
{
$filtered = array();
foreach ($parameters as $key => $value) {
if (is_array($value)) {
$value = $this->prepareParameters($value, $escape);
} elseif ($value instanceof Reference || is_strin... | [
"private",
"function",
"prepareParameters",
"(",
"array",
"$",
"parameters",
",",
"$",
"escape",
"=",
"true",
")",
"{",
"$",
"filtered",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"... | Prepares parameters.
@param array $parameters
@param bool $escape
@return array | [
"Prepares",
"parameters",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php#L345-L359 |
193,253 | werx/core | src/Template.php | Template.render | public function render($view, array $data = null)
{
// Sanitize variables already in the template.
foreach (get_object_vars($this) as $key => $value) {
if (!in_array($key, $this->unguarded)) {
$this->$key = $this->scrub($value);
}
}
// Also sanitize any variables we are passing in to the template
... | php | public function render($view, array $data = null)
{
// Sanitize variables already in the template.
foreach (get_object_vars($this) as $key => $value) {
if (!in_array($key, $this->unguarded)) {
$this->$key = $this->scrub($value);
}
}
// Also sanitize any variables we are passing in to the template
... | [
"public",
"function",
"render",
"(",
"$",
"view",
",",
"array",
"$",
"data",
"=",
"null",
")",
"{",
"// Sanitize variables already in the template.",
"foreach",
"(",
"get_object_vars",
"(",
"$",
"this",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
... | Return our compiled view.
Sanitize the data before rendering.
@param string $view
@param array $data
@return string | [
"Return",
"our",
"compiled",
"view",
".",
"Sanitize",
"the",
"data",
"before",
"rendering",
"."
] | 9ab7a9f7a8c02e1d41ca40301afada8129ea0a79 | https://github.com/werx/core/blob/9ab7a9f7a8c02e1d41ca40301afada8129ea0a79/src/Template.php#L46-L59 |
193,254 | werx/core | src/Template.php | Template.output | public function output($view, array $data = null)
{
$response = new Response($this->render($view, $data), Response::HTTP_OK, ['Content-Type' => 'text/html']);
$response->send();
} | php | public function output($view, array $data = null)
{
$response = new Response($this->render($view, $data), Response::HTTP_OK, ['Content-Type' => 'text/html']);
$response->send();
} | [
"public",
"function",
"output",
"(",
"$",
"view",
",",
"array",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"response",
"=",
"new",
"Response",
"(",
"$",
"this",
"->",
"render",
"(",
"$",
"view",
",",
"$",
"data",
")",
",",
"Response",
"::",
"HTTP_OK"... | Output the content instead of just render.
@param $view
@param array $data | [
"Output",
"the",
"content",
"instead",
"of",
"just",
"render",
"."
] | 9ab7a9f7a8c02e1d41ca40301afada8129ea0a79 | https://github.com/werx/core/blob/9ab7a9f7a8c02e1d41ca40301afada8129ea0a79/src/Template.php#L66-L70 |
193,255 | werx/core | src/Template.php | Template.scrub | public function scrub($var)
{
if (is_string($var)) {
// Sanitize strings
return $this->escape($var);
} elseif (is_array($var)) {
// Sanitize arrays
foreach($var as $key => $value){
// casting key to string for the case of numeric indexed arrays
// i.e. 0, 1, etc. b/c 0 == ... | php | public function scrub($var)
{
if (is_string($var)) {
// Sanitize strings
return $this->escape($var);
} elseif (is_array($var)) {
// Sanitize arrays
foreach($var as $key => $value){
// casting key to string for the case of numeric indexed arrays
// i.e. 0, 1, etc. b/c 0 == ... | [
"public",
"function",
"scrub",
"(",
"$",
"var",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"var",
")",
")",
"{",
"// Sanitize strings",
"return",
"$",
"this",
"->",
"escape",
"(",
"$",
"var",
")",
";",
"}",
"elseif",
"(",
"is_array",
"(",
"$",
"va... | Recursively sanitize output.
@param $var
@return array | [
"Recursively",
"sanitize",
"output",
"."
] | 9ab7a9f7a8c02e1d41ca40301afada8129ea0a79 | https://github.com/werx/core/blob/9ab7a9f7a8c02e1d41ca40301afada8129ea0a79/src/Template.php#L89-L119 |
193,256 | werx/core | src/Template.php | Template.unguard | public function unguard($key)
{
if (is_array($key)) {
foreach ($key as $k) {
$this->unguard($k);
}
} else {
$this->unguarded[] = $key;
}
} | php | public function unguard($key)
{
if (is_array($key)) {
foreach ($key as $k) {
$this->unguard($k);
}
} else {
$this->unguarded[] = $key;
}
} | [
"public",
"function",
"unguard",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"foreach",
"(",
"$",
"key",
"as",
"$",
"k",
")",
"{",
"$",
"this",
"->",
"unguard",
"(",
"$",
"k",
")",
";",
"}",
"}",
"else",
... | Don't escape template variables with the specified name.
@param $key | [
"Don",
"t",
"escape",
"template",
"variables",
"with",
"the",
"specified",
"name",
"."
] | 9ab7a9f7a8c02e1d41ca40301afada8129ea0a79 | https://github.com/werx/core/blob/9ab7a9f7a8c02e1d41ca40301afada8129ea0a79/src/Template.php#L126-L135 |
193,257 | SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Rectangle.php | Rectangle.contains | public final function contains( Rectangle $rect ) : bool
{
return (
(
(
(
$this->point->x <= $rect->point->x
)
&& (
( $rect->point->x + $rect->size->width ) <= ( $this->point->x + $this->size->width )
... | php | public final function contains( Rectangle $rect ) : bool
{
return (
(
(
(
$this->point->x <= $rect->point->x
)
&& (
( $rect->point->x + $rect->size->width ) <= ( $this->point->x + $this->size->width )
... | [
"public",
"final",
"function",
"contains",
"(",
"Rectangle",
"$",
"rect",
")",
":",
"bool",
"{",
"return",
"(",
"(",
"(",
"(",
"$",
"this",
"->",
"point",
"->",
"x",
"<=",
"$",
"rect",
"->",
"point",
"->",
"x",
")",
"&&",
"(",
"(",
"$",
"rect",
... | Returns, if the current rectangle contains the defined rectangle.
@param \Beluga\Drawing\Rectangle $rect
@return boolean | [
"Returns",
"if",
"the",
"current",
"rectangle",
"contains",
"the",
"defined",
"rectangle",
"."
] | 9c82874cf4ec68cb0af78757b65f19783540004a | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Rectangle.php#L125-L149 |
193,258 | SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Rectangle.php | Rectangle.containsLocation | public final function containsLocation( $xOrPoint, int $y = null ) : bool
{
$x = $xOrPoint;
if ( $x instanceof Point )
{
$y = $x->y;
$x = $x->x;
}
else if ( \is_integer( $xOrPoint ) )
{
$x = $xOrPoint;
}
else if ( TypeTool::IsInteger( $xOrP... | php | public final function containsLocation( $xOrPoint, int $y = null ) : bool
{
$x = $xOrPoint;
if ( $x instanceof Point )
{
$y = $x->y;
$x = $x->x;
}
else if ( \is_integer( $xOrPoint ) )
{
$x = $xOrPoint;
}
else if ( TypeTool::IsInteger( $xOrP... | [
"public",
"final",
"function",
"containsLocation",
"(",
"$",
"xOrPoint",
",",
"int",
"$",
"y",
"=",
"null",
")",
":",
"bool",
"{",
"$",
"x",
"=",
"$",
"xOrPoint",
";",
"if",
"(",
"$",
"x",
"instanceof",
"Point",
")",
"{",
"$",
"y",
"=",
"$",
"x",... | Returns, if the current rectangle contains the defined location.
@param int|\Beluga\Drawing\Point $xOrPoint
@param int|null $y
@return boolean | [
"Returns",
"if",
"the",
"current",
"rectangle",
"contains",
"the",
"defined",
"location",
"."
] | 9c82874cf4ec68cb0af78757b65f19783540004a | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Rectangle.php#L158-L200 |
193,259 | SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Rectangle.php | Rectangle.containsSize | public final function containsSize( $widthOrSize, int $height = null ) : bool
{
$width = $widthOrSize;
if ( $width instanceof Size )
{
$height = $width->height;
$width = $width->width;
}
else if ( \is_integer( $widthOrSize ) )
{
$width = $widthOrSize;... | php | public final function containsSize( $widthOrSize, int $height = null ) : bool
{
$width = $widthOrSize;
if ( $width instanceof Size )
{
$height = $width->height;
$width = $width->width;
}
else if ( \is_integer( $widthOrSize ) )
{
$width = $widthOrSize;... | [
"public",
"final",
"function",
"containsSize",
"(",
"$",
"widthOrSize",
",",
"int",
"$",
"height",
"=",
"null",
")",
":",
"bool",
"{",
"$",
"width",
"=",
"$",
"widthOrSize",
";",
"if",
"(",
"$",
"width",
"instanceof",
"Size",
")",
"{",
"$",
"height",
... | Returns, if the current rectangle contains the defined Size.
@param \Beluga\Drawing\Size|integer $widthOrSize
@param integer $height
@return boolean | [
"Returns",
"if",
"the",
"current",
"rectangle",
"contains",
"the",
"defined",
"Size",
"."
] | 9c82874cf4ec68cb0af78757b65f19783540004a | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Rectangle.php#L209-L242 |
193,260 | SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Rectangle.php | Rectangle.getClone | public function getClone() : Rectangle
{
return new Rectangle(
new Point( $this->point->x , $this->point->y ),
new Size ( $this->size->width, $this->size->height )
);
} | php | public function getClone() : Rectangle
{
return new Rectangle(
new Point( $this->point->x , $this->point->y ),
new Size ( $this->size->width, $this->size->height )
);
} | [
"public",
"function",
"getClone",
"(",
")",
":",
"Rectangle",
"{",
"return",
"new",
"Rectangle",
"(",
"new",
"Point",
"(",
"$",
"this",
"->",
"point",
"->",
"x",
",",
"$",
"this",
"->",
"point",
"->",
"y",
")",
",",
"new",
"Size",
"(",
"$",
"this",... | Gets a clone of the current instance.
@return \Beluga\Drawing\Rectangle | [
"Gets",
"a",
"clone",
"of",
"the",
"current",
"instance",
"."
] | 9c82874cf4ec68cb0af78757b65f19783540004a | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Rectangle.php#L249-L257 |
193,261 | SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Rectangle.php | Rectangle.toArray | public function toArray() : array
{
return [
'x' => $this->point->x,
'y' => $this->point->y,
'width' => $this->size->width,
'height' => $this->size->height
];
} | php | public function toArray() : array
{
return [
'x' => $this->point->x,
'y' => $this->point->y,
'width' => $this->size->width,
'height' => $this->size->height
];
} | [
"public",
"function",
"toArray",
"(",
")",
":",
"array",
"{",
"return",
"[",
"'x'",
"=>",
"$",
"this",
"->",
"point",
"->",
"x",
",",
"'y'",
"=>",
"$",
"this",
"->",
"point",
"->",
"y",
",",
"'width'",
"=>",
"$",
"this",
"->",
"size",
"->",
"widt... | Returns a array with all instance data. Used array keys are 'x', 'y', 'width' and 'height'.
@return array | [
"Returns",
"a",
"array",
"with",
"all",
"instance",
"data",
".",
"Used",
"array",
"keys",
"are",
"x",
"y",
"width",
"and",
"height",
"."
] | 9c82874cf4ec68cb0af78757b65f19783540004a | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Rectangle.php#L401-L411 |
193,262 | kitpages/KitpagesStepBundle | Proxy/ProxyGenerator.php | ProxyGenerator.generateProcessProxy | public function generateProcessProxy($arguments = array())
{
if (!$this->isProxyLoaded()) {
$this->loadProxyClass();
}
$reflect = new ReflectionClass($this->proxyClass);
return $reflect->newInstanceArgs($arguments);
} | php | public function generateProcessProxy($arguments = array())
{
if (!$this->isProxyLoaded()) {
$this->loadProxyClass();
}
$reflect = new ReflectionClass($this->proxyClass);
return $reflect->newInstanceArgs($arguments);
} | [
"public",
"function",
"generateProcessProxy",
"(",
"$",
"arguments",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isProxyLoaded",
"(",
")",
")",
"{",
"$",
"this",
"->",
"loadProxyClass",
"(",
")",
";",
"}",
"$",
"reflect",
"=... | Instantiate and returns a step proxy.
@param array $arguments (optionnal) The arguments to pass to the constructor of the Proxy Class if needed
@return mixed The instanciated Proxy | [
"Instantiate",
"and",
"returns",
"a",
"step",
"proxy",
"."
] | 2ac421c8364d41b87b515a91a94513f3d1ab20c1 | https://github.com/kitpages/KitpagesStepBundle/blob/2ac421c8364d41b87b515a91a94513f3d1ab20c1/Proxy/ProxyGenerator.php#L84-L93 |
193,263 | kitpages/KitpagesStepBundle | Proxy/ProxyGenerator.php | ProxyGenerator.writeProxyClassCache | public function writeProxyClassCache()
{
$parameters = array(
'proxyNameSpace' => $this->getProxyNameSpace(),
'proxyClassName' => $this->proxyClass,
'shortClassName' => $this->getShortClassName(),
'originalClassName' => $this->class,
);
$proxyC... | php | public function writeProxyClassCache()
{
$parameters = array(
'proxyNameSpace' => $this->getProxyNameSpace(),
'proxyClassName' => $this->proxyClass,
'shortClassName' => $this->getShortClassName(),
'originalClassName' => $this->class,
);
$proxyC... | [
"public",
"function",
"writeProxyClassCache",
"(",
")",
"{",
"$",
"parameters",
"=",
"array",
"(",
"'proxyNameSpace'",
"=>",
"$",
"this",
"->",
"getProxyNameSpace",
"(",
")",
",",
"'proxyClassName'",
"=>",
"$",
"this",
"->",
"proxyClass",
",",
"'shortClassName'"... | Writes the proxy class definition into a cache file.
@return $this | [
"Writes",
"the",
"proxy",
"class",
"definition",
"into",
"a",
"cache",
"file",
"."
] | 2ac421c8364d41b87b515a91a94513f3d1ab20c1 | https://github.com/kitpages/KitpagesStepBundle/blob/2ac421c8364d41b87b515a91a94513f3d1ab20c1/Proxy/ProxyGenerator.php#L100-L112 |
193,264 | kitpages/KitpagesStepBundle | Proxy/ProxyGenerator.php | ProxyGenerator.loadProxyClass | public function loadProxyClass()
{
if (!$this->cacheFileExists() || $this->debug) {
$this->writeProxyClassCache();
}
if (!$this->isProxyLoaded()) {
require $this->proxyClassCacheFilename;
}
return $this;
} | php | public function loadProxyClass()
{
if (!$this->cacheFileExists() || $this->debug) {
$this->writeProxyClassCache();
}
if (!$this->isProxyLoaded()) {
require $this->proxyClassCacheFilename;
}
return $this;
} | [
"public",
"function",
"loadProxyClass",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"cacheFileExists",
"(",
")",
"||",
"$",
"this",
"->",
"debug",
")",
"{",
"$",
"this",
"->",
"writeProxyClassCache",
"(",
")",
";",
"}",
"if",
"(",
"!",
"$",
"... | Loads the proxy class for usage.
@return self | [
"Loads",
"the",
"proxy",
"class",
"for",
"usage",
"."
] | 2ac421c8364d41b87b515a91a94513f3d1ab20c1 | https://github.com/kitpages/KitpagesStepBundle/blob/2ac421c8364d41b87b515a91a94513f3d1ab20c1/Proxy/ProxyGenerator.php#L119-L130 |
193,265 | MatiasNAmendola/slimpower-slim | src/DownloadView.php | DownloadView.render | protected function render($filepath, $data = NULL) {
if (!file_exists($filepath)) {
throw new \RuntimeException("View cannot render `$filepath` because the template does not exist");
}
$data = $this->getData();
$contentType = 'application/octet-stream';
if (isset($... | php | protected function render($filepath, $data = NULL) {
if (!file_exists($filepath)) {
throw new \RuntimeException("View cannot render `$filepath` because the template does not exist");
}
$data = $this->getData();
$contentType = 'application/octet-stream';
if (isset($... | [
"protected",
"function",
"render",
"(",
"$",
"filepath",
",",
"$",
"data",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"filepath",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"View cannot render `$filepath` because the t... | Render -> Download file.
@param string $filepath Filepath
@param array|null $data
@return void
@throws \RuntimeException | [
"Render",
"-",
">",
"Download",
"file",
"."
] | c78ebbd4124d75ec82fe19b6dd62504da097fd15 | https://github.com/MatiasNAmendola/slimpower-slim/blob/c78ebbd4124d75ec82fe19b6dd62504da097fd15/src/DownloadView.php#L43-L82 |
193,266 | dms-org/common.structure | src/FileSystem/RelativePathCalculator.php | RelativePathCalculator.getRelativePath | public function getRelativePath(string $fromDir, string $to) : string
{
if (strpos($to, 'data://') === 0) {
return $to;
}
list($fromStreamWrapper, $fromDirPath) = $this->splitStreamWrapperAndPath($fromDir);
list($toStreamWrapper, $toPath) = $this->splitStreamWrapperAndPa... | php | public function getRelativePath(string $fromDir, string $to) : string
{
if (strpos($to, 'data://') === 0) {
return $to;
}
list($fromStreamWrapper, $fromDirPath) = $this->splitStreamWrapperAndPath($fromDir);
list($toStreamWrapper, $toPath) = $this->splitStreamWrapperAndPa... | [
"public",
"function",
"getRelativePath",
"(",
"string",
"$",
"fromDir",
",",
"string",
"$",
"to",
")",
":",
"string",
"{",
"if",
"(",
"strpos",
"(",
"$",
"to",
",",
"'data://'",
")",
"===",
"0",
")",
"{",
"return",
"$",
"to",
";",
"}",
"list",
"(",... | Gets the relative path from the first path to the second path.
@param string $fromDir
@param string $to
@return string
@throws InvalidArgumentException | [
"Gets",
"the",
"relative",
"path",
"from",
"the",
"first",
"path",
"to",
"the",
"second",
"path",
"."
] | 23f122182f60df5ec847047a81a39c8aab019ff1 | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/FileSystem/RelativePathCalculator.php#L27-L83 |
193,267 | dms-org/common.structure | src/FileSystem/RelativePathCalculator.php | RelativePathCalculator.resolveRelativePath | public function resolveRelativePath(string $basePath, string $relativePath) : string
{
if (strpos($relativePath, 'data://') === 0) {
return $relativePath;
}
list($basePathStreamWrapper, $basePath) = $this->splitStreamWrapperAndPath($basePath);
list($relativeStreamWrapper... | php | public function resolveRelativePath(string $basePath, string $relativePath) : string
{
if (strpos($relativePath, 'data://') === 0) {
return $relativePath;
}
list($basePathStreamWrapper, $basePath) = $this->splitStreamWrapperAndPath($basePath);
list($relativeStreamWrapper... | [
"public",
"function",
"resolveRelativePath",
"(",
"string",
"$",
"basePath",
",",
"string",
"$",
"relativePath",
")",
":",
"string",
"{",
"if",
"(",
"strpos",
"(",
"$",
"relativePath",
",",
"'data://'",
")",
"===",
"0",
")",
"{",
"return",
"$",
"relativePa... | Combines the two paths and resolves '..' and '.' relative traversals.
@param string $basePath
@param string $relativePath
@return string | [
"Combines",
"the",
"two",
"paths",
"and",
"resolves",
"..",
"and",
".",
"relative",
"traversals",
"."
] | 23f122182f60df5ec847047a81a39c8aab019ff1 | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/FileSystem/RelativePathCalculator.php#L93-L146 |
193,268 | gocom/rah_cache_minify | rah_cache_minify.php | Rah_Cache_Minify.isHTML | protected function isHTML()
{
if (function_exists('headers_list') && $headers = headers_list())
{
foreach ((array) $headers as $header)
{
$header = strtolower($header);
if (strpos($header, 'content-type:') === 0 && !strpos($header, 'text/html'... | php | protected function isHTML()
{
if (function_exists('headers_list') && $headers = headers_list())
{
foreach ((array) $headers as $header)
{
$header = strtolower($header);
if (strpos($header, 'content-type:') === 0 && !strpos($header, 'text/html'... | [
"protected",
"function",
"isHTML",
"(",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'headers_list'",
")",
"&&",
"$",
"headers",
"=",
"headers_list",
"(",
")",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"headers",
"as",
"$",
"header",
")",
"{",... | Whether the page is a plain old HTML.
@return bool | [
"Whether",
"the",
"page",
"is",
"a",
"plain",
"old",
"HTML",
"."
] | dc5fc02b74213f65fddb2de2a2eb6e30378e5014 | https://github.com/gocom/rah_cache_minify/blob/dc5fc02b74213f65fddb2de2a2eb6e30378e5014/rah_cache_minify.php#L48-L64 |
193,269 | gocom/rah_cache_minify | rah_cache_minify.php | Rah_Cache_Minify.minify | public function minify()
{
if ($this->isHTML() && class_exists('Minify_HTML'))
{
$page = ob_get_contents();
ob_clean();
echo Minify_HTML::minify($page);
}
} | php | public function minify()
{
if ($this->isHTML() && class_exists('Minify_HTML'))
{
$page = ob_get_contents();
ob_clean();
echo Minify_HTML::minify($page);
}
} | [
"public",
"function",
"minify",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isHTML",
"(",
")",
"&&",
"class_exists",
"(",
"'Minify_HTML'",
")",
")",
"{",
"$",
"page",
"=",
"ob_get_contents",
"(",
")",
";",
"ob_clean",
"(",
")",
";",
"echo",
"Minify... | Minifies the HTML page.
Replaces output buffer with minified HTML. | [
"Minifies",
"the",
"HTML",
"page",
"."
] | dc5fc02b74213f65fddb2de2a2eb6e30378e5014 | https://github.com/gocom/rah_cache_minify/blob/dc5fc02b74213f65fddb2de2a2eb6e30378e5014/rah_cache_minify.php#L72-L80 |
193,270 | ibonly/Potato-ORM | src/Database/DBConfig.php | DBConfig.pgsqlConnectionString | protected function pgsqlConnectionString()
{
return $this->driver . ':host=' . $this->host . ';port=' . $this->port . ';dbname=' . $this->dbname . ';user=' . $this->user . ';password=' . $this->password;
} | php | protected function pgsqlConnectionString()
{
return $this->driver . ':host=' . $this->host . ';port=' . $this->port . ';dbname=' . $this->dbname . ';user=' . $this->user . ';password=' . $this->password;
} | [
"protected",
"function",
"pgsqlConnectionString",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"driver",
".",
"':host='",
".",
"$",
"this",
"->",
"host",
".",
"';port='",
".",
"$",
"this",
"->",
"port",
".",
"';dbname='",
".",
"$",
"this",
"->",
"dbname",... | pgsqlConnectionString Postgres connection string
@return string | [
"pgsqlConnectionString",
"Postgres",
"connection",
"string"
] | 644962a99e1c0191b732d7729cd466d52c5d8652 | https://github.com/ibonly/Potato-ORM/blob/644962a99e1c0191b732d7729cd466d52c5d8652/src/Database/DBConfig.php#L64-L67 |
193,271 | phossa/phossa-shared | src/Phossa/Shared/Pattern/SetPropertiesTrait.php | SetPropertiesTrait.setProperties | protected function setProperties(array $properties = [])
{
foreach ($properties as $name => $value) {
// set property
if (property_exists($this, $name)) {
$this->$name = $value;
// unknown property found
} else {
trigger_error(... | php | protected function setProperties(array $properties = [])
{
foreach ($properties as $name => $value) {
// set property
if (property_exists($this, $name)) {
$this->$name = $value;
// unknown property found
} else {
trigger_error(... | [
"protected",
"function",
"setProperties",
"(",
"array",
"$",
"properties",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"properties",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"// set property",
"if",
"(",
"property_exists",
"(",
"$",
"this",
","... | Set properties, trigger warning if unknown property found
@param array $properties (optional) object properties
@access protected | [
"Set",
"properties",
"trigger",
"warning",
"if",
"unknown",
"property",
"found"
] | fcf140c09e94c3a441ee4e285de0b4c18cb6504b | https://github.com/phossa/phossa-shared/blob/fcf140c09e94c3a441ee4e285de0b4c18cb6504b/src/Phossa/Shared/Pattern/SetPropertiesTrait.php#L35-L54 |
193,272 | nicodevs/laito | src/Laito/App.php | App.config | public function config($name, $value = null)
{
// Check for massive assignaments
if (is_array($name)) {
foreach ($name as $key => $value) {
$this->config($key, $value);
}
return true;
}
// Assign a new value
if (isset($valu... | php | public function config($name, $value = null)
{
// Check for massive assignaments
if (is_array($name)) {
foreach ($name as $key => $value) {
$this->config($key, $value);
}
return true;
}
// Assign a new value
if (isset($valu... | [
"public",
"function",
"config",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"null",
")",
"{",
"// Check for massive assignaments",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"foreach",
"(",
"$",
"name",
"as",
"$",
"key",
"=>",
"$",
"value",
... | Configure application settings
@param string|array $name Setting to set or retrieve
@param mixed $value If passed, value to apply on the setting
@return mixed Value of a setting | [
"Configure",
"application",
"settings"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/App.php#L99-L121 |
193,273 | nicodevs/laito | src/Laito/App.php | App.make | public function make($className)
{
// Create a reflection to access the class properties
$reflection = new \ReflectionClass($className);
// If the class has no constructor, just return a new instance
$constructor = $reflection->getConstructor();
if (is_null($constructor)) {
... | php | public function make($className)
{
// Create a reflection to access the class properties
$reflection = new \ReflectionClass($className);
// If the class has no constructor, just return a new instance
$constructor = $reflection->getConstructor();
if (is_null($constructor)) {
... | [
"public",
"function",
"make",
"(",
"$",
"className",
")",
"{",
"// Create a reflection to access the class properties",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"className",
")",
";",
"// If the class has no constructor, just return a new instance",
... | Makes an instance of a class
@param string $className Class name
@return object Class instance | [
"Makes",
"an",
"instance",
"of",
"a",
"class"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/App.php#L129-L166 |
193,274 | nicodevs/laito | src/Laito/App.php | App.runAction | private function runAction()
{
// Get URL
$url = $this->request->url();
// Get route action
$action = $this->router->getAction($url);
// Perform the filter
if ($action['filter']) {
$filter = $this->router->performFilter($action['filter']);
}
... | php | private function runAction()
{
// Get URL
$url = $this->request->url();
// Get route action
$action = $this->router->getAction($url);
// Perform the filter
if ($action['filter']) {
$filter = $this->router->performFilter($action['filter']);
}
... | [
"private",
"function",
"runAction",
"(",
")",
"{",
"// Get URL",
"$",
"url",
"=",
"$",
"this",
"->",
"request",
"->",
"url",
"(",
")",
";",
"// Get route action",
"$",
"action",
"=",
"$",
"this",
"->",
"router",
"->",
"getAction",
"(",
"$",
"url",
")",... | Setups a database connection for models
@return void | [
"Setups",
"a",
"database",
"connection",
"for",
"models"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/App.php#L243-L266 |
193,275 | nicodevs/laito | src/Laito/App.php | App.returnValidationErrorResponse | private function returnValidationErrorResponse($e)
{
return $this->response->error($e->getCode(), $e->getMessage(), ['error' => ['errors' => $e->getErrors()]]);
} | php | private function returnValidationErrorResponse($e)
{
return $this->response->error($e->getCode(), $e->getMessage(), ['error' => ['errors' => $e->getErrors()]]);
} | [
"private",
"function",
"returnValidationErrorResponse",
"(",
"$",
"e",
")",
"{",
"return",
"$",
"this",
"->",
"response",
"->",
"error",
"(",
"$",
"e",
"->",
"getCode",
"(",
")",
",",
"$",
"e",
"->",
"getMessage",
"(",
")",
",",
"[",
"'error'",
"=>",
... | Returns a validation error response
@return array Response | [
"Returns",
"a",
"validation",
"error",
"response"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/App.php#L273-L276 |
193,276 | nicodevs/laito | src/Laito/App.php | App.returnDatabaseErrorResponse | private function returnDatabaseErrorResponse($e)
{
$info = $this->config('debug.queries')? ['error' => ['errors' => $this->db->statement->errorInfo(), 'last_query' => $this->db->lastQuery()]] : [];
return $this->response->error(500, 'Database error', $info);
} | php | private function returnDatabaseErrorResponse($e)
{
$info = $this->config('debug.queries')? ['error' => ['errors' => $this->db->statement->errorInfo(), 'last_query' => $this->db->lastQuery()]] : [];
return $this->response->error(500, 'Database error', $info);
} | [
"private",
"function",
"returnDatabaseErrorResponse",
"(",
"$",
"e",
")",
"{",
"$",
"info",
"=",
"$",
"this",
"->",
"config",
"(",
"'debug.queries'",
")",
"?",
"[",
"'error'",
"=>",
"[",
"'errors'",
"=>",
"$",
"this",
"->",
"db",
"->",
"statement",
"->",... | Returns a database error response
@return array Response | [
"Returns",
"a",
"database",
"error",
"response"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/App.php#L283-L287 |
193,277 | nicodevs/laito | src/Laito/App.php | App.returnGeneralErrorResponse | private function returnGeneralErrorResponse($e)
{
$backtrace = $this->config('debug.backtrace')? ['error' => ['backtrace' => $e->getTrace()]] : [];
return $this->response->error($e->getCode(), $e->getMessage(), $backtrace);
} | php | private function returnGeneralErrorResponse($e)
{
$backtrace = $this->config('debug.backtrace')? ['error' => ['backtrace' => $e->getTrace()]] : [];
return $this->response->error($e->getCode(), $e->getMessage(), $backtrace);
} | [
"private",
"function",
"returnGeneralErrorResponse",
"(",
"$",
"e",
")",
"{",
"$",
"backtrace",
"=",
"$",
"this",
"->",
"config",
"(",
"'debug.backtrace'",
")",
"?",
"[",
"'error'",
"=>",
"[",
"'backtrace'",
"=>",
"$",
"e",
"->",
"getTrace",
"(",
")",
"]... | Returns a generic error response
@return array Response | [
"Returns",
"a",
"generic",
"error",
"response"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/App.php#L294-L298 |
193,278 | mikyprog/LocationBundle | Manager/CountryManager.php | CountryManager.updateCountry | public function updateCountry(Country $country, $andFlush = true)
{
$this->objectManager->persist($country);
if ($andFlush) {
$this->objectManager->flush();
}
} | php | public function updateCountry(Country $country, $andFlush = true)
{
$this->objectManager->persist($country);
if ($andFlush) {
$this->objectManager->flush();
}
} | [
"public",
"function",
"updateCountry",
"(",
"Country",
"$",
"country",
",",
"$",
"andFlush",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"objectManager",
"->",
"persist",
"(",
"$",
"country",
")",
";",
"if",
"(",
"$",
"andFlush",
")",
"{",
"$",
"this",
... | Updates a Country.
@param Country $country
@param Boolean $andFlush Whether to flush the changes (default true) | [
"Updates",
"a",
"Country",
"."
] | ffbbc8e6b7c759f0dbf0dec6d36a8f3150322f23 | https://github.com/mikyprog/LocationBundle/blob/ffbbc8e6b7c759f0dbf0dec6d36a8f3150322f23/Manager/CountryManager.php#L134-L140 |
193,279 | mikyprog/LocationBundle | Manager/CountryManager.php | CountryManager.refreshCountry | public function refreshCountry(Country $country)
{
$refreshedCountry = $this->findCountryBy(array('id' => $country->getId()));
if (null === $refreshedCountry) {
throw new UsernameNotFoundException(sprintf('User with ID "%d" could not be reloaded.', $country->getId()));
}
... | php | public function refreshCountry(Country $country)
{
$refreshedCountry = $this->findCountryBy(array('id' => $country->getId()));
if (null === $refreshedCountry) {
throw new UsernameNotFoundException(sprintf('User with ID "%d" could not be reloaded.', $country->getId()));
}
... | [
"public",
"function",
"refreshCountry",
"(",
"Country",
"$",
"country",
")",
"{",
"$",
"refreshedCountry",
"=",
"$",
"this",
"->",
"findCountryBy",
"(",
"array",
"(",
"'id'",
"=>",
"$",
"country",
"->",
"getId",
"(",
")",
")",
")",
";",
"if",
"(",
"nul... | Refreshed a Country by Country Instance
@param Country $country
@return Ad | [
"Refreshed",
"a",
"Country",
"by",
"Country",
"Instance"
] | ffbbc8e6b7c759f0dbf0dec6d36a8f3150322f23 | https://github.com/mikyprog/LocationBundle/blob/ffbbc8e6b7c759f0dbf0dec6d36a8f3150322f23/Manager/CountryManager.php#L161-L169 |
193,280 | rollerworks/search-core | Field/SearchField.php | SearchField.finalizeConfig | public function finalizeConfig(): void
{
if ($this->locked) {
return;
}
if (null === $this->valueComparator) {
foreach ($this->supportedValueTypes as $type => $supported) {
if ($supported && isset(class_implements($type)[RequiresComparatorValueHolder:... | php | public function finalizeConfig(): void
{
if ($this->locked) {
return;
}
if (null === $this->valueComparator) {
foreach ($this->supportedValueTypes as $type => $supported) {
if ($supported && isset(class_implements($type)[RequiresComparatorValueHolder:... | [
"public",
"function",
"finalizeConfig",
"(",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"locked",
")",
"{",
"return",
";",
"}",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"valueComparator",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"... | Finalize the configuration and mark config as locked.
After calling this method, setter methods can be no longer called.
@throws InvalidConfigurationException when a supported value-type requires
a value comparator but none is set | [
"Finalize",
"the",
"configuration",
"and",
"mark",
"config",
"as",
"locked",
"."
] | 6b5671b8c4d6298906ded768261b0a59845140fb | https://github.com/rollerworks/search-core/blob/6b5671b8c4d6298906ded768261b0a59845140fb/Field/SearchField.php#L189-L211 |
193,281 | modulusphp/http | Redirect.php | Redirect.to | public static function to(?string $path = '/', ?int $code = null)
{
$redirect = new Redirect;
$redirect->url = $path;
if ($code !== null) {
$redirect->code = $code;
return $redirect->send();
}
return $redirect;
} | php | public static function to(?string $path = '/', ?int $code = null)
{
$redirect = new Redirect;
$redirect->url = $path;
if ($code !== null) {
$redirect->code = $code;
return $redirect->send();
}
return $redirect;
} | [
"public",
"static",
"function",
"to",
"(",
"?",
"string",
"$",
"path",
"=",
"'/'",
",",
"?",
"int",
"$",
"code",
"=",
"null",
")",
"{",
"$",
"redirect",
"=",
"new",
"Redirect",
";",
"$",
"redirect",
"->",
"url",
"=",
"$",
"path",
";",
"if",
"(",
... | Redirect to path
@param string $path
@param integer $code
@return Redirect | [
"Redirect",
"to",
"path"
] | fc5c0f2b582a04de1685578d3fb790686a0a240c | https://github.com/modulusphp/http/blob/fc5c0f2b582a04de1685578d3fb790686a0a240c/Redirect.php#L52-L63 |
193,282 | modulusphp/http | Redirect.php | Redirect.back | public static function back(?int $code = null)
{
if (isset(getallheaders()['Referer'])) {
return Redirect::to(getallheaders()['Referer'], $code);
}
return new Redirect('/');
} | php | public static function back(?int $code = null)
{
if (isset(getallheaders()['Referer'])) {
return Redirect::to(getallheaders()['Referer'], $code);
}
return new Redirect('/');
} | [
"public",
"static",
"function",
"back",
"(",
"?",
"int",
"$",
"code",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"getallheaders",
"(",
")",
"[",
"'Referer'",
"]",
")",
")",
"{",
"return",
"Redirect",
"::",
"to",
"(",
"getallheaders",
"(",
")",
... | Redirect back to the previous page
@param mixed ?int
@return void | [
"Redirect",
"back",
"to",
"the",
"previous",
"page"
] | fc5c0f2b582a04de1685578d3fb790686a0a240c | https://github.com/modulusphp/http/blob/fc5c0f2b582a04de1685578d3fb790686a0a240c/Redirect.php#L71-L78 |
193,283 | modulusphp/http | Redirect.php | Redirect.route | public function route(string $name, ?array $parameters = [], ?int $code = null)
{
$this->url = Route::url($name, $parameters);
if ($code !== null) {
$this->code = $code;
return $this->send();
}
return $this;
} | php | public function route(string $name, ?array $parameters = [], ?int $code = null)
{
$this->url = Route::url($name, $parameters);
if ($code !== null) {
$this->code = $code;
return $this->send();
}
return $this;
} | [
"public",
"function",
"route",
"(",
"string",
"$",
"name",
",",
"?",
"array",
"$",
"parameters",
"=",
"[",
"]",
",",
"?",
"int",
"$",
"code",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"url",
"=",
"Route",
"::",
"url",
"(",
"$",
"name",
",",
"$"... | Redirect to route
@param string $name
@param mixed ?array
@param integer $code
@return Redirect | [
"Redirect",
"to",
"route"
] | fc5c0f2b582a04de1685578d3fb790686a0a240c | https://github.com/modulusphp/http/blob/fc5c0f2b582a04de1685578d3fb790686a0a240c/Redirect.php#L88-L98 |
193,284 | modulusphp/http | Redirect.php | Redirect.with | public function with(string $name, $value, ?int $code = null)
{
$this->with = array_merge([$name => $value], $this->with);
if ($code != null) {
$this->code = $code;
return $this->send();
}
return $this;
} | php | public function with(string $name, $value, ?int $code = null)
{
$this->with = array_merge([$name => $value], $this->with);
if ($code != null) {
$this->code = $code;
return $this->send();
}
return $this;
} | [
"public",
"function",
"with",
"(",
"string",
"$",
"name",
",",
"$",
"value",
",",
"?",
"int",
"$",
"code",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"with",
"=",
"array_merge",
"(",
"[",
"$",
"name",
"=>",
"$",
"value",
"]",
",",
"$",
"this",
"... | Attach variables with redirect
@param string $name
@param mixed $value
@param integer $code
@return Redirect | [
"Attach",
"variables",
"with",
"redirect"
] | fc5c0f2b582a04de1685578d3fb790686a0a240c | https://github.com/modulusphp/http/blob/fc5c0f2b582a04de1685578d3fb790686a0a240c/Redirect.php#L108-L118 |
193,285 | modulusphp/http | Redirect.php | Redirect.old | public function old(array $value, ?int $code = null)
{
$this->with = array_merge(['form.old' => $value], $this->with);
if ($code != null) {
$this->code = $code;
return $this->send();
}
return $this;
} | php | public function old(array $value, ?int $code = null)
{
$this->with = array_merge(['form.old' => $value], $this->with);
if ($code != null) {
$this->code = $code;
return $this->send();
}
return $this;
} | [
"public",
"function",
"old",
"(",
"array",
"$",
"value",
",",
"?",
"int",
"$",
"code",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"with",
"=",
"array_merge",
"(",
"[",
"'form.old'",
"=>",
"$",
"value",
"]",
",",
"$",
"this",
"->",
"with",
")",
";"... | Attach old variables with redirect
@param array $value
@param integer $code
@return Redirect | [
"Attach",
"old",
"variables",
"with",
"redirect"
] | fc5c0f2b582a04de1685578d3fb790686a0a240c | https://github.com/modulusphp/http/blob/fc5c0f2b582a04de1685578d3fb790686a0a240c/Redirect.php#L127-L137 |
193,286 | modulusphp/http | Redirect.php | Redirect.return | public function return(?int $code = null, ?string $path = null)
{
$info = ((isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '/') === '/' ? '' : $_SERVER['PATH_INFO']);
if ($info !== '') $path = '?url=' . $info;
if (count($_GET) > 0) {
$path .= '&' . $_SERVER['QUERY_STRING'];
}
$thi... | php | public function return(?int $code = null, ?string $path = null)
{
$info = ((isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '/') === '/' ? '' : $_SERVER['PATH_INFO']);
if ($info !== '') $path = '?url=' . $info;
if (count($_GET) > 0) {
$path .= '&' . $_SERVER['QUERY_STRING'];
}
$thi... | [
"public",
"function",
"return",
"(",
"?",
"int",
"$",
"code",
"=",
"null",
",",
"?",
"string",
"$",
"path",
"=",
"null",
")",
"{",
"$",
"info",
"=",
"(",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'PATH_INFO'",
"]",
")",
"?",
"$",
"_SERVER",
"[",
... | Allow redirect to return to current url
@param integer $code
@return Redirect | [
"Allow",
"redirect",
"to",
"return",
"to",
"current",
"url"
] | fc5c0f2b582a04de1685578d3fb790686a0a240c | https://github.com/modulusphp/http/blob/fc5c0f2b582a04de1685578d3fb790686a0a240c/Redirect.php#L145-L163 |
193,287 | mosbth/phpmvc-comment | src/Comment/CommentsInSession.php | CommentsInSession.add | public function add($comment)
{
$comments = $this->session->get('comments', []);
$comments[] = $comment;
$this->session->set('comments', $comments);
} | php | public function add($comment)
{
$comments = $this->session->get('comments', []);
$comments[] = $comment;
$this->session->set('comments', $comments);
} | [
"public",
"function",
"add",
"(",
"$",
"comment",
")",
"{",
"$",
"comments",
"=",
"$",
"this",
"->",
"session",
"->",
"get",
"(",
"'comments'",
",",
"[",
"]",
")",
";",
"$",
"comments",
"[",
"]",
"=",
"$",
"comment",
";",
"$",
"this",
"->",
"sess... | Add a new comment.
@param array $comment with all details.
@return void | [
"Add",
"a",
"new",
"comment",
"."
] | ea5c43e8bb3f723d6fb69c892500d26c7390eb37 | https://github.com/mosbth/phpmvc-comment/blob/ea5c43e8bb3f723d6fb69c892500d26c7390eb37/src/Comment/CommentsInSession.php#L22-L27 |
193,288 | fulgurio/LightCMSBundle | EventListener/BeforeListener.php | BeforeListener.onKernelController | public function onKernelController(FilterControllerEvent $event)
{
$controller = $event->getController();
/**
* $controller passed can be either a class or a Closure. This is not usual in Symfony2 but it may happen.
* If it is a class, it comes in array format
*/
i... | php | public function onKernelController(FilterControllerEvent $event)
{
$controller = $event->getController();
/**
* $controller passed can be either a class or a Closure. This is not usual in Symfony2 but it may happen.
* If it is a class, it comes in array format
*/
i... | [
"public",
"function",
"onKernelController",
"(",
"FilterControllerEvent",
"$",
"event",
")",
"{",
"$",
"controller",
"=",
"$",
"event",
"->",
"getController",
"(",
")",
";",
"/**\n * $controller passed can be either a class or a Closure. This is not usual in Symfony2 bu... | OnKernelControler event filter
Try to find the page into database.
@param FilterControllerEvent $event
@throws NotFoundHttpException
@throws AccessDeniedHttpException
@return void|\Fulgurio\LightCMSBundle\EventListener\RedirectResponse | [
"OnKernelControler",
"event",
"filter",
"Try",
"to",
"find",
"the",
"page",
"into",
"database",
"."
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/EventListener/BeforeListener.php#L59-L104 |
193,289 | Bistro/session | lib/Bistro/Session/Native.php | Native.setOptions | protected function setOptions(array $options)
{
$whitelist = array('save_path', 'name', 'save_handler', 'auto_start',
'gc_probability', 'gc_divisor', 'gc_maxlifetime', 'serialize_handler',
'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure',
'cookie_httponly', 'use_cookies', 'use_only_cookie... | php | protected function setOptions(array $options)
{
$whitelist = array('save_path', 'name', 'save_handler', 'auto_start',
'gc_probability', 'gc_divisor', 'gc_maxlifetime', 'serialize_handler',
'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure',
'cookie_httponly', 'use_cookies', 'use_only_cookie... | [
"protected",
"function",
"setOptions",
"(",
"array",
"$",
"options",
")",
"{",
"$",
"whitelist",
"=",
"array",
"(",
"'save_path'",
",",
"'name'",
",",
"'save_handler'",
",",
"'auto_start'",
",",
"'gc_probability'",
",",
"'gc_divisor'",
",",
"'gc_maxlifetime'",
"... | Sets session options.
@param array $options Options array | [
"Sets",
"session",
"options",
"."
] | cebd8c77288458abde9ffdcd8efd69004a536a49 | https://github.com/Bistro/session/blob/cebd8c77288458abde9ffdcd8efd69004a536a49/lib/Bistro/Session/Native.php#L64-L85 |
193,290 | shgysk8zer0/core_api | traits/domimporthtml.php | DOMImportHTML.importHTML | final public function importHTML($html)
{
$tmp_doc = new \DOMDocument('1.0', 'UTF-8');
$tmp_doc->loadHTML($html);
$nodes = array();
foreach ($tmp_doc->documentElement->childNodes as $node) {
array_push($nodes, $node);
$this->appendChild($this->ownerDocument->importNode($node, true));
}
return $nodes;... | php | final public function importHTML($html)
{
$tmp_doc = new \DOMDocument('1.0', 'UTF-8');
$tmp_doc->loadHTML($html);
$nodes = array();
foreach ($tmp_doc->documentElement->childNodes as $node) {
array_push($nodes, $node);
$this->appendChild($this->ownerDocument->importNode($node, true));
}
return $nodes;... | [
"final",
"public",
"function",
"importHTML",
"(",
"$",
"html",
")",
"{",
"$",
"tmp_doc",
"=",
"new",
"\\",
"DOMDocument",
"(",
"'1.0'",
",",
"'UTF-8'",
")",
";",
"$",
"tmp_doc",
"->",
"loadHTML",
"(",
"$",
"html",
")",
";",
"$",
"nodes",
"=",
"array"... | Import HTML into a DOMElement
@param string $html A string of HTML
@return void | [
"Import",
"HTML",
"into",
"a",
"DOMElement"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/domimporthtml.php#L35-L45 |
193,291 | Soneritics/Database | Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php | MySQLTrait.getSet | protected function getSet(array $queryParts)
{
if (isset($queryParts['set']) && !empty($queryParts['set'])) {
$updates = array();
foreach ($queryParts['set'] as $k => $v) {
$updates[] = sprintf(
'%s = %s',
$this->quoteIdentifie... | php | protected function getSet(array $queryParts)
{
if (isset($queryParts['set']) && !empty($queryParts['set'])) {
$updates = array();
foreach ($queryParts['set'] as $k => $v) {
$updates[] = sprintf(
'%s = %s',
$this->quoteIdentifie... | [
"protected",
"function",
"getSet",
"(",
"array",
"$",
"queryParts",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"queryParts",
"[",
"'set'",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"queryParts",
"[",
"'set'",
"]",
")",
")",
"{",
"$",
"updates",
"=",
"ar... | Prepare the SET part of the MySQL query.
@param array $queryParts
@return null|string | [
"Prepare",
"the",
"SET",
"part",
"of",
"the",
"MySQL",
"query",
"."
] | 20cb74f2a2ee8d9161d3144b5c061a6da11cd066 | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php#L134-L151 |
193,292 | Soneritics/Database | Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php | MySQLTrait.getTable | protected function getTable(array $queryParts)
{
if (isset($queryParts['table'])) {
$from =
(isset($queryParts['fields']) && !empty($queryParts['fields'])) ||
strtoupper($queryParts['type']) === 'DELETE' ?
'FROM ' :
'';
... | php | protected function getTable(array $queryParts)
{
if (isset($queryParts['table'])) {
$from =
(isset($queryParts['fields']) && !empty($queryParts['fields'])) ||
strtoupper($queryParts['type']) === 'DELETE' ?
'FROM ' :
'';
... | [
"protected",
"function",
"getTable",
"(",
"array",
"$",
"queryParts",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"queryParts",
"[",
"'table'",
"]",
")",
")",
"{",
"$",
"from",
"=",
"(",
"isset",
"(",
"$",
"queryParts",
"[",
"'fields'",
"]",
")",
"&&",
... | Prepare the table name for use in the MySQL query.
@param array $queryParts
@return null|string | [
"Prepare",
"the",
"table",
"name",
"for",
"use",
"in",
"the",
"MySQL",
"query",
"."
] | 20cb74f2a2ee8d9161d3144b5c061a6da11cd066 | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php#L158-L185 |
193,293 | Soneritics/Database | Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php | MySQLTrait.getJoins | protected function getJoins(array $queryParts)
{
$result = null;
if (isset($queryParts['join']) && !empty($queryParts['join'])) {
$result = [];
foreach ($queryParts['join'] as $join) {
$piece = trim($join[0] . ' JOIN') . ' ';
$piece .= is_a($... | php | protected function getJoins(array $queryParts)
{
$result = null;
if (isset($queryParts['join']) && !empty($queryParts['join'])) {
$result = [];
foreach ($queryParts['join'] as $join) {
$piece = trim($join[0] . ' JOIN') . ' ';
$piece .= is_a($... | [
"protected",
"function",
"getJoins",
"(",
"array",
"$",
"queryParts",
")",
"{",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"queryParts",
"[",
"'join'",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"queryParts",
"[",
"'join'",
"]",
")",... | Prepare the joins for use in the MySQL query.
@param array $queryParts
@return array|null|string | [
"Prepare",
"the",
"joins",
"for",
"use",
"in",
"the",
"MySQL",
"query",
"."
] | 20cb74f2a2ee8d9161d3144b5c061a6da11cd066 | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php#L192-L216 |
193,294 | Soneritics/Database | Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php | MySQLTrait.formatWhere | private function formatWhere($where, $operator = 'AND')
{
if (is_string($where)) {
return $where;
}
$fullWhere = [];
if (is_array($where)) {
foreach ($where as $key => $value) {
$fullWhere[] = sprintf(
'%s = %s',
... | php | private function formatWhere($where, $operator = 'AND')
{
if (is_string($where)) {
return $where;
}
$fullWhere = [];
if (is_array($where)) {
foreach ($where as $key => $value) {
$fullWhere[] = sprintf(
'%s = %s',
... | [
"private",
"function",
"formatWhere",
"(",
"$",
"where",
",",
"$",
"operator",
"=",
"'AND'",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"where",
")",
")",
"{",
"return",
"$",
"where",
";",
"}",
"$",
"fullWhere",
"=",
"[",
"]",
";",
"if",
"(",
"i... | Format the where clause of a MySQL query from a mixed range of types.
@param $where
@param string $operator
@return string | [
"Format",
"the",
"where",
"clause",
"of",
"a",
"MySQL",
"query",
"from",
"a",
"mixed",
"range",
"of",
"types",
"."
] | 20cb74f2a2ee8d9161d3144b5c061a6da11cd066 | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php#L224-L266 |
193,295 | Soneritics/Database | Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php | MySQLTrait.getWhere | protected function getWhere(array $queryParts)
{
if (!isset($queryParts['where']) || empty($queryParts['where'])) {
return null;
}
$where = array();
foreach ($queryParts['where'] as $w) {
$where[] = $this->formatWhere($w);
}
return 'WHERE ' .... | php | protected function getWhere(array $queryParts)
{
if (!isset($queryParts['where']) || empty($queryParts['where'])) {
return null;
}
$where = array();
foreach ($queryParts['where'] as $w) {
$where[] = $this->formatWhere($w);
}
return 'WHERE ' .... | [
"protected",
"function",
"getWhere",
"(",
"array",
"$",
"queryParts",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"queryParts",
"[",
"'where'",
"]",
")",
"||",
"empty",
"(",
"$",
"queryParts",
"[",
"'where'",
"]",
")",
")",
"{",
"return",
"null",
";... | Prepare the where clause for use in the MySQL query.
@param array $queryParts
@return null|string | [
"Prepare",
"the",
"where",
"clause",
"for",
"use",
"in",
"the",
"MySQL",
"query",
"."
] | 20cb74f2a2ee8d9161d3144b5c061a6da11cd066 | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php#L273-L285 |
193,296 | Soneritics/Database | Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php | MySQLTrait.getGroup | protected function getGroup(array $queryParts)
{
if (isset($queryParts['group'])) {
$group = [];
foreach ($queryParts['group'] as $column) {
$group[] = $this->quoteIdentifier($column);
}
return 'GROUP BY ' . implode(', ', $group);
}
... | php | protected function getGroup(array $queryParts)
{
if (isset($queryParts['group'])) {
$group = [];
foreach ($queryParts['group'] as $column) {
$group[] = $this->quoteIdentifier($column);
}
return 'GROUP BY ' . implode(', ', $group);
}
... | [
"protected",
"function",
"getGroup",
"(",
"array",
"$",
"queryParts",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"queryParts",
"[",
"'group'",
"]",
")",
")",
"{",
"$",
"group",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"queryParts",
"[",
"'group'",
"]",
... | Prepare the group for use in the MySQL query.
@param array $queryParts
@return null|string | [
"Prepare",
"the",
"group",
"for",
"use",
"in",
"the",
"MySQL",
"query",
"."
] | 20cb74f2a2ee8d9161d3144b5c061a6da11cd066 | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php#L292-L305 |
193,297 | Soneritics/Database | Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php | MySQLTrait.getOrder | protected function getOrder(array $queryParts)
{
if (isset($queryParts['order'])) {
$order = [];
foreach ($queryParts['order'] as $array) {
$order[] =
$this->quoteIdentifier($array[0]) .
(strtolower($array[1]) === 'asc' ? ' ASC... | php | protected function getOrder(array $queryParts)
{
if (isset($queryParts['order'])) {
$order = [];
foreach ($queryParts['order'] as $array) {
$order[] =
$this->quoteIdentifier($array[0]) .
(strtolower($array[1]) === 'asc' ? ' ASC... | [
"protected",
"function",
"getOrder",
"(",
"array",
"$",
"queryParts",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"queryParts",
"[",
"'order'",
"]",
")",
")",
"{",
"$",
"order",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"queryParts",
"[",
"'order'",
"]",
... | Prepare the order for use in the MySQL query.
@param array $queryParts
@return null|string | [
"Prepare",
"the",
"order",
"for",
"use",
"in",
"the",
"MySQL",
"query",
"."
] | 20cb74f2a2ee8d9161d3144b5c061a6da11cd066 | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php#L312-L327 |
193,298 | Soneritics/Database | Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php | MySQLTrait.getLimit | protected function getLimit(array $queryParts)
{
if (isset($queryParts['limit']) && !empty($queryParts['limit'])) {
$limit = [];
foreach ($queryParts['limit'] as $int) {
$limit[] = (int)$int;
}
return 'LIMIT ' . implode(', ', $limit);
... | php | protected function getLimit(array $queryParts)
{
if (isset($queryParts['limit']) && !empty($queryParts['limit'])) {
$limit = [];
foreach ($queryParts['limit'] as $int) {
$limit[] = (int)$int;
}
return 'LIMIT ' . implode(', ', $limit);
... | [
"protected",
"function",
"getLimit",
"(",
"array",
"$",
"queryParts",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"queryParts",
"[",
"'limit'",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"queryParts",
"[",
"'limit'",
"]",
")",
")",
"{",
"$",
"limit",
"=",
... | Prepare the limit for use in the MySQL query.
@param array $queryParts
@return null|string | [
"Prepare",
"the",
"limit",
"for",
"use",
"in",
"the",
"MySQL",
"query",
"."
] | 20cb74f2a2ee8d9161d3144b5c061a6da11cd066 | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php#L334-L346 |
193,299 | Soneritics/Database | Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php | MySQLTrait.buildQuery | public function buildQuery(QueryAbstract $query)
{
$queryParts = $query->getQueryParts();
return implode(
' ',
array_filter(
[
$queryParts['type'],
$this->getFields($queryParts),
$this->getTable($quer... | php | public function buildQuery(QueryAbstract $query)
{
$queryParts = $query->getQueryParts();
return implode(
' ',
array_filter(
[
$queryParts['type'],
$this->getFields($queryParts),
$this->getTable($quer... | [
"public",
"function",
"buildQuery",
"(",
"QueryAbstract",
"$",
"query",
")",
"{",
"$",
"queryParts",
"=",
"$",
"query",
"->",
"getQueryParts",
"(",
")",
";",
"return",
"implode",
"(",
"' '",
",",
"array_filter",
"(",
"[",
"$",
"queryParts",
"[",
"'type'",
... | Build a query string from a QueryAbstract
@param QueryAbstract $query
@return string | [
"Build",
"a",
"query",
"string",
"from",
"a",
"QueryAbstract"
] | 20cb74f2a2ee8d9161d3144b5c061a6da11cd066 | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/DatabaseConnection/DatabaseTypeTraits/MySQLTrait.php#L353-L376 |
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.