repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
Nicklas766/Comment | src/Comment/HTMLForm/User/UserLoginForm.php | UserLoginForm.callbackSubmit | public function callbackSubmit()
{
// Get values from the submitted form
$name = $this->form->value("user");
$password = $this->form->value("password");
$user = new User();
$user->setDb($this->di->get("db"));
$res = $user->verifyPassword($name, $password);... | php | public function callbackSubmit()
{
// Get values from the submitted form
$name = $this->form->value("user");
$password = $this->form->value("password");
$user = new User();
$user->setDb($this->di->get("db"));
$res = $user->verifyPassword($name, $password);... | [
"public",
"function",
"callbackSubmit",
"(",
")",
"{",
"// Get values from the submitted form",
"$",
"name",
"=",
"$",
"this",
"->",
"form",
"->",
"value",
"(",
"\"user\"",
")",
";",
"$",
"password",
"=",
"$",
"this",
"->",
"form",
"->",
"value",
"(",
"\"p... | Callback for submit-button which should return true if it could
carry out its work and false if something failed.
@return boolean true if okey, false if something went wrong. | [
"Callback",
"for",
"submit",
"-",
"button",
"which",
"should",
"return",
"true",
"if",
"it",
"could",
"carry",
"out",
"its",
"work",
"and",
"false",
"if",
"something",
"failed",
"."
] | train | https://github.com/Nicklas766/Comment/blob/1483eaf1ebb120b8bd6c2a1552c084b3a288ff25/src/Comment/HTMLForm/User/UserLoginForm.php#L63-L81 |
CampaignChain/security-authentication-client-oauth | Entity/Token.php | Token.setApplication | public function setApplication(\CampaignChain\Security\Authentication\Client\OAuthBundle\Entity\Application $application = null)
{
$this->application = $application;
return $this;
} | php | public function setApplication(\CampaignChain\Security\Authentication\Client\OAuthBundle\Entity\Application $application = null)
{
$this->application = $application;
return $this;
} | [
"public",
"function",
"setApplication",
"(",
"\\",
"CampaignChain",
"\\",
"Security",
"\\",
"Authentication",
"\\",
"Client",
"\\",
"OAuthBundle",
"\\",
"Entity",
"\\",
"Application",
"$",
"application",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"application",
... | Set application
@param \CampaignChain\Security\Authentication\Client\OAuthBundle\Entity\Application $application
@return Token | [
"Set",
"application"
] | train | https://github.com/CampaignChain/security-authentication-client-oauth/blob/06800ccd0ee6b5ca9f53b85146228467ff6a7529/Entity/Token.php#L218-L223 |
CampaignChain/security-authentication-client-oauth | Entity/Token.php | Token.setLocation | public function setLocation(\CampaignChain\CoreBundle\Entity\Location $location = null)
{
$this->location = $location;
return $this;
} | php | public function setLocation(\CampaignChain\CoreBundle\Entity\Location $location = null)
{
$this->location = $location;
return $this;
} | [
"public",
"function",
"setLocation",
"(",
"\\",
"CampaignChain",
"\\",
"CoreBundle",
"\\",
"Entity",
"\\",
"Location",
"$",
"location",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"location",
"=",
"$",
"location",
";",
"return",
"$",
"this",
";",
"}"
] | Set location
@param \CampaignChain\CoreBundle\Entity\Location $location
@return Token | [
"Set",
"location"
] | train | https://github.com/CampaignChain/security-authentication-client-oauth/blob/06800ccd0ee6b5ca9f53b85146228467ff6a7529/Entity/Token.php#L264-L269 |
CrunchPHP/fastcgi | src/Protocol/Record.php | Record.encode | public function encode()
{
return $this->header->encode() . $this->getContent() . \str_repeat("\0", $this->header->getPaddingLength());
} | php | public function encode()
{
return $this->header->encode() . $this->getContent() . \str_repeat("\0", $this->header->getPaddingLength());
} | [
"public",
"function",
"encode",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"header",
"->",
"encode",
"(",
")",
".",
"$",
"this",
"->",
"getContent",
"(",
")",
".",
"\\",
"str_repeat",
"(",
"\"\\0\"",
",",
"$",
"this",
"->",
"header",
"->",
"getPaddi... | Compiles record into struct to send.
@return string | [
"Compiles",
"record",
"into",
"struct",
"to",
"send",
"."
] | train | https://github.com/CrunchPHP/fastcgi/blob/102437193e67e5a841ec5a897549ec345788d1bd/src/Protocol/Record.php#L59-L62 |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Adapter/Curl/MultiAdapter.php | MultiAdapter.throwMultiError | public static function throwMultiError($code)
{
$buffer = function_exists('curl_multi_strerror')
? curl_multi_strerror($code)
: self::ERROR_STR;
throw new AdapterException(sprintf('cURL error %s: %s', $code, $buffer));
} | php | public static function throwMultiError($code)
{
$buffer = function_exists('curl_multi_strerror')
? curl_multi_strerror($code)
: self::ERROR_STR;
throw new AdapterException(sprintf('cURL error %s: %s', $code, $buffer));
} | [
"public",
"static",
"function",
"throwMultiError",
"(",
"$",
"code",
")",
"{",
"$",
"buffer",
"=",
"function_exists",
"(",
"'curl_multi_strerror'",
")",
"?",
"curl_multi_strerror",
"(",
"$",
"code",
")",
":",
"self",
"::",
"ERROR_STR",
";",
"throw",
"new",
"... | Throw an exception for a cURL multi response
@param int $code Curl response code
@throws AdapterException | [
"Throw",
"an",
"exception",
"for",
"a",
"cURL",
"multi",
"response"
] | train | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Adapter/Curl/MultiAdapter.php#L98-L105 |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Adapter/Curl/MultiAdapter.php | MultiAdapter.checkoutMultiHandle | private function checkoutMultiHandle()
{
// Find an unused handle in the cache
$key = array_search(false, $this->multiOwned, true);
if (false !== $key) {
$this->multiOwned[$key] = true;
return $this->multiHandles[$key];
}
// Add a new handle
$... | php | private function checkoutMultiHandle()
{
// Find an unused handle in the cache
$key = array_search(false, $this->multiOwned, true);
if (false !== $key) {
$this->multiOwned[$key] = true;
return $this->multiHandles[$key];
}
// Add a new handle
$... | [
"private",
"function",
"checkoutMultiHandle",
"(",
")",
"{",
"// Find an unused handle in the cache",
"$",
"key",
"=",
"array_search",
"(",
"false",
",",
"$",
"this",
"->",
"multiOwned",
",",
"true",
")",
";",
"if",
"(",
"false",
"!==",
"$",
"key",
")",
"{",... | Returns a curl_multi handle from the cache or creates a new one
@return resource | [
"Returns",
"a",
"curl_multi",
"handle",
"from",
"the",
"cache",
"or",
"creates",
"a",
"new",
"one"
] | train | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Adapter/Curl/MultiAdapter.php#L270-L286 |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Adapter/Curl/MultiAdapter.php | MultiAdapter.releaseMultiHandle | private function releaseMultiHandle($handle, $maxHandles)
{
$id = (int) $handle;
if (count($this->multiHandles) <= $maxHandles) {
$this->multiOwned[$id] = false;
} elseif (isset($this->multiHandles[$id], $this->multiOwned[$id])) {
// Prune excessive handles
... | php | private function releaseMultiHandle($handle, $maxHandles)
{
$id = (int) $handle;
if (count($this->multiHandles) <= $maxHandles) {
$this->multiOwned[$id] = false;
} elseif (isset($this->multiHandles[$id], $this->multiOwned[$id])) {
// Prune excessive handles
... | [
"private",
"function",
"releaseMultiHandle",
"(",
"$",
"handle",
",",
"$",
"maxHandles",
")",
"{",
"$",
"id",
"=",
"(",
"int",
")",
"$",
"handle",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"multiHandles",
")",
"<=",
"$",
"maxHandles",
")",
"{"... | Releases a curl_multi handle back into the cache and removes excess cache
@param resource $handle Curl multi handle to remove
@param int $maxHandles (Optional) Maximum number of existing multiHandles to allow before pruning. | [
"Releases",
"a",
"curl_multi",
"handle",
"back",
"into",
"the",
"cache",
"and",
"removes",
"excess",
"cache"
] | train | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Adapter/Curl/MultiAdapter.php#L294-L305 |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Adapter/Curl/MultiAdapter.php | MultiAdapter.validateResponseWasSet | private function validateResponseWasSet(
TransactionInterface $transaction,
BatchContext $context
) {
if ($transaction->getResponse()) {
return true;
}
$body = $transaction->getRequest()->getBody();
if (!$body) {
// This is weird and should p... | php | private function validateResponseWasSet(
TransactionInterface $transaction,
BatchContext $context
) {
if ($transaction->getResponse()) {
return true;
}
$body = $transaction->getRequest()->getBody();
if (!$body) {
// This is weird and should p... | [
"private",
"function",
"validateResponseWasSet",
"(",
"TransactionInterface",
"$",
"transaction",
",",
"BatchContext",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"transaction",
"->",
"getResponse",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"body",
... | This function ensures that a response was set on a transaction. If one
was not set, then the request is retried if possible. This error
typically means you are sending a payload, curl encountered a
"Connection died, retrying a fresh connect" error, tried to rewind the
stream, and then encountered a "necessary data rewi... | [
"This",
"function",
"ensures",
"that",
"a",
"response",
"was",
"set",
"on",
"a",
"transaction",
".",
"If",
"one",
"was",
"not",
"set",
"then",
"the",
"request",
"is",
"retried",
"if",
"possible",
".",
"This",
"error",
"typically",
"means",
"you",
"are",
... | train | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Adapter/Curl/MultiAdapter.php#L323-L361 |
Vectrex/vxPHP | src/Http/AcceptHeader.php | AcceptHeader.get | public function get($value) {
return isset($this->items[$value]) ? $this->items[$value] : NULL;
} | php | public function get($value) {
return isset($this->items[$value]) ? $this->items[$value] : NULL;
} | [
"public",
"function",
"get",
"(",
"$",
"value",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"items",
"[",
"$",
"value",
"]",
")",
"?",
"$",
"this",
"->",
"items",
"[",
"$",
"value",
"]",
":",
"NULL",
";",
"}"
] | Returns given value's item, if exists.
@param string $value
@return AcceptHeaderItem|NULL | [
"Returns",
"given",
"value",
"s",
"item",
"if",
"exists",
"."
] | train | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/AcceptHeader.php#L108-L112 |
Vectrex/vxPHP | src/Http/AcceptHeader.php | AcceptHeader.add | public function add(AcceptHeaderItem $item) {
$this->items[$item->getValue()] = $item;
$this->sorted = FALSE;
return $this;
} | php | public function add(AcceptHeaderItem $item) {
$this->items[$item->getValue()] = $item;
$this->sorted = FALSE;
return $this;
} | [
"public",
"function",
"add",
"(",
"AcceptHeaderItem",
"$",
"item",
")",
"{",
"$",
"this",
"->",
"items",
"[",
"$",
"item",
"->",
"getValue",
"(",
")",
"]",
"=",
"$",
"item",
";",
"$",
"this",
"->",
"sorted",
"=",
"FALSE",
";",
"return",
"$",
"this"... | Adds an item.
@param AcceptHeaderItem $item
@return AcceptHeader | [
"Adds",
"an",
"item",
"."
] | train | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/AcceptHeader.php#L121-L128 |
Vectrex/vxPHP | src/Http/AcceptHeader.php | AcceptHeader.first | public function first() {
$this->sort();
return !empty($this->items) ? reset($this->items) : NULL;
} | php | public function first() {
$this->sort();
return !empty($this->items) ? reset($this->items) : NULL;
} | [
"public",
"function",
"first",
"(",
")",
"{",
"$",
"this",
"->",
"sort",
"(",
")",
";",
"return",
"!",
"empty",
"(",
"$",
"this",
"->",
"items",
")",
"?",
"reset",
"(",
"$",
"this",
"->",
"items",
")",
":",
"NULL",
";",
"}"
] | Returns first item.
@return AcceptHeaderItem|NULL | [
"Returns",
"first",
"item",
"."
] | train | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/AcceptHeader.php#L162-L168 |
DeimosProject/Helper | src/Helper/Helpers/Json.php | Json.options | protected function options($target)
{
$options = JSON_ERROR_NONE;
if (isset($this->options[$target]))
{
foreach ($this->options[$target] as $option)
{
$options |= $option;
}
}
return $options;
} | php | protected function options($target)
{
$options = JSON_ERROR_NONE;
if (isset($this->options[$target]))
{
foreach ($this->options[$target] as $option)
{
$options |= $option;
}
}
return $options;
} | [
"protected",
"function",
"options",
"(",
"$",
"target",
")",
"{",
"$",
"options",
"=",
"JSON_ERROR_NONE",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"$",
"target",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options"... | @param int $target
@return int | [
"@param",
"int",
"$target"
] | train | https://github.com/DeimosProject/Helper/blob/39c67de21a87c7c6391b2f98416063f41c94e26f/src/Helper/Helpers/Json.php#L70-L83 |
cmsgears/module-sns-connect | common/services/base/SnsProfileService.php | SnsProfileService.update | public function update( $model, $config = [] ) {
$snsUser = $config[ 'snsUser' ];
$accessToken = $config[ 'accessToken' ];
// Copy Attributes
$model->token = $accessToken;
$model->data = json_encode( $snsUser );
// Return updated SnsProfile
return parent::update( $model, [
'attributes' => [ 'token'... | php | public function update( $model, $config = [] ) {
$snsUser = $config[ 'snsUser' ];
$accessToken = $config[ 'accessToken' ];
// Copy Attributes
$model->token = $accessToken;
$model->data = json_encode( $snsUser );
// Return updated SnsProfile
return parent::update( $model, [
'attributes' => [ 'token'... | [
"public",
"function",
"update",
"(",
"$",
"model",
",",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"snsUser",
"=",
"$",
"config",
"[",
"'snsUser'",
"]",
";",
"$",
"accessToken",
"=",
"$",
"config",
"[",
"'accessToken'",
"]",
";",
"// Copy Attributes"... | Update ------------- | [
"Update",
"-------------"
] | train | https://github.com/cmsgears/module-sns-connect/blob/753ee4157d41c81a701689624f4c44760a6cada3/common/services/base/SnsProfileService.php#L97-L110 |
fulgurio/LightCMSBundle | Form/Handler/AdminMediaHandler.php | AdminMediaHandler.process | public function process(Media $media)
{
if ($this->request->getMethod() == 'POST')
{
$this->form->handleRequest($this->request);
if ($this->form->isValid())
{
$file = $this->form->get('media')->getData();
if (!is_null($file))
... | php | public function process(Media $media)
{
if ($this->request->getMethod() == 'POST')
{
$this->form->handleRequest($this->request);
if ($this->form->isValid())
{
$file = $this->form->get('media')->getData();
if (!is_null($file))
... | [
"public",
"function",
"process",
"(",
"Media",
"$",
"media",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"request",
"->",
"getMethod",
"(",
")",
"==",
"'POST'",
")",
"{",
"$",
"this",
"->",
"form",
"->",
"handleRequest",
"(",
"$",
"this",
"->",
"request"... | Processing form values
@param Media $media
@return boolean | [
"Processing",
"form",
"values"
] | train | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Form/Handler/AdminMediaHandler.php#L25-L67 |
Wedeto/FileFormats | src/AbstractReader.php | AbstractReader.read | public function read($param)
{
if ($param instanceof File)
return $this->readFile($param->getFullPath());
if (is_resource($param))
return $this->readFileHandle($param);
if (!is_string($param))
throw new \InvalidArgumentException("Cannot read argument: " ... | php | public function read($param)
{
if ($param instanceof File)
return $this->readFile($param->getFullPath());
if (is_resource($param))
return $this->readFileHandle($param);
if (!is_string($param))
throw new \InvalidArgumentException("Cannot read argument: " ... | [
"public",
"function",
"read",
"(",
"$",
"param",
")",
"{",
"if",
"(",
"$",
"param",
"instanceof",
"File",
")",
"return",
"$",
"this",
"->",
"readFile",
"(",
"$",
"param",
"->",
"getFullPath",
"(",
")",
")",
";",
"if",
"(",
"is_resource",
"(",
"$",
... | Read provided data. The method auto-detects if it is a file,
a resource or a string that contains the formatted data.
@param mixed $param The data to read
@return array The read data
@throws InvalidArgumentException When an unrecognized argument is provided
@throws Wedeto\IO\IOException When reading fails | [
"Read",
"provided",
"data",
".",
"The",
"method",
"auto",
"-",
"detects",
"if",
"it",
"is",
"a",
"file",
"a",
"resource",
"or",
"a",
"string",
"that",
"contains",
"the",
"formatted",
"data",
"."
] | train | https://github.com/Wedeto/FileFormats/blob/65b71fbd38a2ee6b504622aca4f4047ce9d31e9f/src/AbstractReader.php#L52-L67 |
Wedeto/FileFormats | src/AbstractReader.php | AbstractReader.readFile | public function readFile(string $file_name)
{
$contents = @file_get_contents($file_name);
if ($contents === false)
throw new IOException("Failed to read file contents");
$contents = Encoding::removeBOM($contents);
return $this->readString(file_get_contents($file_name));
... | php | public function readFile(string $file_name)
{
$contents = @file_get_contents($file_name);
if ($contents === false)
throw new IOException("Failed to read file contents");
$contents = Encoding::removeBOM($contents);
return $this->readString(file_get_contents($file_name));
... | [
"public",
"function",
"readFile",
"(",
"string",
"$",
"file_name",
")",
"{",
"$",
"contents",
"=",
"@",
"file_get_contents",
"(",
"$",
"file_name",
")",
";",
"if",
"(",
"$",
"contents",
"===",
"false",
")",
"throw",
"new",
"IOException",
"(",
"\"Failed to ... | Read data from a file
@param string $file_name The file to read
@return array The read data
@throws Wedeto\IO\IOException On read errors | [
"Read",
"data",
"from",
"a",
"file"
] | train | https://github.com/Wedeto/FileFormats/blob/65b71fbd38a2ee6b504622aca4f4047ce9d31e9f/src/AbstractReader.php#L75-L83 |
Wedeto/FileFormats | src/AbstractReader.php | AbstractReader.readFileHandle | public function readFileHandle($file_handle)
{
if (!is_resource($file_handle))
throw new \InvalidArgumentException("No file handle was provided");
$contents = stream_get_contents($file_handle);
$contents = Encoding::removeBOM($contents);
return $this->readString($conten... | php | public function readFileHandle($file_handle)
{
if (!is_resource($file_handle))
throw new \InvalidArgumentException("No file handle was provided");
$contents = stream_get_contents($file_handle);
$contents = Encoding::removeBOM($contents);
return $this->readString($conten... | [
"public",
"function",
"readFileHandle",
"(",
"$",
"file_handle",
")",
"{",
"if",
"(",
"!",
"is_resource",
"(",
"$",
"file_handle",
")",
")",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"No file handle was provided\"",
")",
";",
"$",
"contents",
"=",... | Read from a file handle to an open file or resource
@param resource $file_handle The resource to read
@throws Wedeto\IO\IOException On read errors | [
"Read",
"from",
"a",
"file",
"handle",
"to",
"an",
"open",
"file",
"or",
"resource"
] | train | https://github.com/Wedeto/FileFormats/blob/65b71fbd38a2ee6b504622aca4f4047ce9d31e9f/src/AbstractReader.php#L90-L99 |
dms-org/common.structure | src/Table/TableData.php | TableData.hasColumn | public function hasColumn($columnKey) : bool
{
$this->validateColumnKey(__METHOD__, $columnKey);
$this->loadColumns();
$columnHash = ValueHasher::hash($columnKey);
return isset($this->columns[$columnHash]);
} | php | public function hasColumn($columnKey) : bool
{
$this->validateColumnKey(__METHOD__, $columnKey);
$this->loadColumns();
$columnHash = ValueHasher::hash($columnKey);
return isset($this->columns[$columnHash]);
} | [
"public",
"function",
"hasColumn",
"(",
"$",
"columnKey",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"validateColumnKey",
"(",
"__METHOD__",
",",
"$",
"columnKey",
")",
";",
"$",
"this",
"->",
"loadColumns",
"(",
")",
";",
"$",
"columnHash",
"=",
"ValueHa... | Returns whether the table data contains a column with the supplied key.
@param mixed $columnKey
@return bool
@throws TypeMismatchException | [
"Returns",
"whether",
"the",
"table",
"data",
"contains",
"a",
"column",
"with",
"the",
"supplied",
"key",
"."
] | train | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/Table/TableData.php#L230-L238 |
dms-org/common.structure | src/Table/TableData.php | TableData.getColumn | public function getColumn($columnKey) : TableDataColumn
{
$this->validateColumnKey(__METHOD__, $columnKey);
$this->loadColumns();
$columnHash = ValueHasher::hash($columnKey);
if (!isset($this->columns[$columnHash])) {
throw InvalidArgumentException::format(
... | php | public function getColumn($columnKey) : TableDataColumn
{
$this->validateColumnKey(__METHOD__, $columnKey);
$this->loadColumns();
$columnHash = ValueHasher::hash($columnKey);
if (!isset($this->columns[$columnHash])) {
throw InvalidArgumentException::format(
... | [
"public",
"function",
"getColumn",
"(",
"$",
"columnKey",
")",
":",
"TableDataColumn",
"{",
"$",
"this",
"->",
"validateColumnKey",
"(",
"__METHOD__",
",",
"$",
"columnKey",
")",
";",
"$",
"this",
"->",
"loadColumns",
"(",
")",
";",
"$",
"columnHash",
"=",... | Gets the table column with the supplied key.
@param mixed $columnKey
@return TableDataColumn
@throws InvalidArgumentException
@throws TypeMismatchException | [
"Gets",
"the",
"table",
"column",
"with",
"the",
"supplied",
"key",
"."
] | train | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/Table/TableData.php#L249-L264 |
dms-org/common.structure | src/Table/TableData.php | TableData.hasRow | public function hasRow($rowKey) : bool
{
$this->validateRowKey(__METHOD__, $rowKey);
$this->loadRows();
$rowHash = ValueHasher::hash($rowKey);
return isset($this->rows[$rowHash]);
} | php | public function hasRow($rowKey) : bool
{
$this->validateRowKey(__METHOD__, $rowKey);
$this->loadRows();
$rowHash = ValueHasher::hash($rowKey);
return isset($this->rows[$rowHash]);
} | [
"public",
"function",
"hasRow",
"(",
"$",
"rowKey",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"validateRowKey",
"(",
"__METHOD__",
",",
"$",
"rowKey",
")",
";",
"$",
"this",
"->",
"loadRows",
"(",
")",
";",
"$",
"rowHash",
"=",
"ValueHasher",
"::",
"... | Returns whether the table data contains a row with the supplied key.
@param mixed $rowKey
@return bool
@throws TypeMismatchException | [
"Returns",
"whether",
"the",
"table",
"data",
"contains",
"a",
"row",
"with",
"the",
"supplied",
"key",
"."
] | train | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/Table/TableData.php#L274-L282 |
dms-org/common.structure | src/Table/TableData.php | TableData.getRow | public function getRow($rowKey) : TableDataRow
{
$this->validateRowKey(__METHOD__, $rowKey);
$this->loadRows();
$rowHash = ValueHasher::hash($rowKey);
if (!isset($this->rows[$rowHash])) {
throw InvalidArgumentException::format(
'Invalid row key supplied ... | php | public function getRow($rowKey) : TableDataRow
{
$this->validateRowKey(__METHOD__, $rowKey);
$this->loadRows();
$rowHash = ValueHasher::hash($rowKey);
if (!isset($this->rows[$rowHash])) {
throw InvalidArgumentException::format(
'Invalid row key supplied ... | [
"public",
"function",
"getRow",
"(",
"$",
"rowKey",
")",
":",
"TableDataRow",
"{",
"$",
"this",
"->",
"validateRowKey",
"(",
"__METHOD__",
",",
"$",
"rowKey",
")",
";",
"$",
"this",
"->",
"loadRows",
"(",
")",
";",
"$",
"rowHash",
"=",
"ValueHasher",
"... | Gets the table row with the supplied key.
@param mixed $rowKey
@return TableDataRow
@throws InvalidArgumentException
@throws TypeMismatchException | [
"Gets",
"the",
"table",
"row",
"with",
"the",
"supplied",
"key",
"."
] | train | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/Table/TableData.php#L293-L308 |
dms-org/common.structure | src/Table/TableData.php | TableData.hasCell | public function hasCell($columnKey, $rowKey) : bool
{
$this->validateColumnKey(__METHOD__, $columnKey);
$this->validateRowKey(__METHOD__, $rowKey);
$this->loadColumns();
$this->loadRows();
$columnHash = ValueHasher::hash($columnKey);
if (!isset($this->columns[$colum... | php | public function hasCell($columnKey, $rowKey) : bool
{
$this->validateColumnKey(__METHOD__, $columnKey);
$this->validateRowKey(__METHOD__, $rowKey);
$this->loadColumns();
$this->loadRows();
$columnHash = ValueHasher::hash($columnKey);
if (!isset($this->columns[$colum... | [
"public",
"function",
"hasCell",
"(",
"$",
"columnKey",
",",
"$",
"rowKey",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"validateColumnKey",
"(",
"__METHOD__",
",",
"$",
"columnKey",
")",
";",
"$",
"this",
"->",
"validateRowKey",
"(",
"__METHOD__",
",",
"$... | Returns whether their is a cell value at the supplied row and column.
@param mixed $columnKey
@param mixed $rowKey
@return bool
@throws TypeMismatchException | [
"Returns",
"whether",
"their",
"is",
"a",
"cell",
"value",
"at",
"the",
"supplied",
"row",
"and",
"column",
"."
] | train | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/Table/TableData.php#L319-L338 |
dms-org/common.structure | src/Table/TableData.php | TableData.getCell | public function getCell($columnKey, $rowKey)
{
$column = $this->getColumn($columnKey);
$row = $this->getRow($rowKey);
return $row[$column];
} | php | public function getCell($columnKey, $rowKey)
{
$column = $this->getColumn($columnKey);
$row = $this->getRow($rowKey);
return $row[$column];
} | [
"public",
"function",
"getCell",
"(",
"$",
"columnKey",
",",
"$",
"rowKey",
")",
"{",
"$",
"column",
"=",
"$",
"this",
"->",
"getColumn",
"(",
"$",
"columnKey",
")",
";",
"$",
"row",
"=",
"$",
"this",
"->",
"getRow",
"(",
"$",
"rowKey",
")",
";",
... | Gets the value of the cell or NULL if the cell does not exist.
@param mixed $columnKey
@param mixed $rowKey
@return mixed
@throws TypeMismatchException | [
"Gets",
"the",
"value",
"of",
"the",
"cell",
"or",
"NULL",
"if",
"the",
"cell",
"does",
"not",
"exist",
"."
] | train | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/Table/TableData.php#L349-L355 |
Dhii/regex-abstract | src/GetAllMatchesRegexCapablePcreTrait.php | GetAllMatchesRegexCapablePcreTrait._getAllMatchesRegex | protected function _getAllMatchesRegex($pattern, $subject)
{
$matches = [];
$pattern = $this->_normalizeString($pattern);
$subject = $this->_normalizeString($subject);
try {
$result = @preg_match_all($pattern, $subject, $matches);
} catch (RootException $e) {
... | php | protected function _getAllMatchesRegex($pattern, $subject)
{
$matches = [];
$pattern = $this->_normalizeString($pattern);
$subject = $this->_normalizeString($subject);
try {
$result = @preg_match_all($pattern, $subject, $matches);
} catch (RootException $e) {
... | [
"protected",
"function",
"_getAllMatchesRegex",
"(",
"$",
"pattern",
",",
"$",
"subject",
")",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"$",
"pattern",
"=",
"$",
"this",
"->",
"_normalizeString",
"(",
"$",
"pattern",
")",
";",
"$",
"subject",
"=",
"$",... | Retrieves all matches that correspond to a RegEx pattern from a string.
@since [*next-version*]
@see preg_match_all()
@param string|Stringable $pattern The RegEx pattern to use for matching.
@param string|Stringable $subject The subject that will be searched for matches.
@throw InvalidArgumentException If the patter... | [
"Retrieves",
"all",
"matches",
"that",
"correspond",
"to",
"a",
"RegEx",
"pattern",
"from",
"a",
"string",
"."
] | train | https://github.com/Dhii/regex-abstract/blob/0751f9c91a6f86d5f901b6b7f3613dc80bb69a8a/src/GetAllMatchesRegexCapablePcreTrait.php#L35-L54 |
ARCANESOFT/Blog | database/migrations/2015_02_01_000004_create_blog_post_tag_pivot.php | CreateBlogPostTagPivot.up | public function up()
{
$this->createSchema(function(Blueprint $table) {
$table->unsignedInteger('post_id');
$table->unsignedInteger('tag_id');
$table->primary(['post_id', 'tag_id']);
});
} | php | public function up()
{
$this->createSchema(function(Blueprint $table) {
$table->unsignedInteger('post_id');
$table->unsignedInteger('tag_id');
$table->primary(['post_id', 'tag_id']);
});
} | [
"public",
"function",
"up",
"(",
")",
"{",
"$",
"this",
"->",
"createSchema",
"(",
"function",
"(",
"Blueprint",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"unsignedInteger",
"(",
"'post_id'",
")",
";",
"$",
"table",
"->",
"unsignedInteger",
"(",
"'tag_... | {@inheritdoc} | [
"{"
] | train | https://github.com/ARCANESOFT/Blog/blob/2078fdfdcbccda161c02899b9e1f344f011b2859/database/migrations/2015_02_01_000004_create_blog_post_tag_pivot.php#L36-L44 |
ARCANESOFT/Auth | src/Http/Controllers/Admin/PasswordResetsController.php | PasswordResetsController.index | public function index()
{
$this->authorize(PasswordResetsPolicy::PERMISSION_LIST);
$resets = PasswordReset::with(['user'])
->orderBy('created_at', 'desc')
->paginate($this->perPage);
$this->setTitle($title = trans('auth::password-resets.titles.password-resets-list')... | php | public function index()
{
$this->authorize(PasswordResetsPolicy::PERMISSION_LIST);
$resets = PasswordReset::with(['user'])
->orderBy('created_at', 'desc')
->paginate($this->perPage);
$this->setTitle($title = trans('auth::password-resets.titles.password-resets-list')... | [
"public",
"function",
"index",
"(",
")",
"{",
"$",
"this",
"->",
"authorize",
"(",
"PasswordResetsPolicy",
"::",
"PERMISSION_LIST",
")",
";",
"$",
"resets",
"=",
"PasswordReset",
"::",
"with",
"(",
"[",
"'user'",
"]",
")",
"->",
"orderBy",
"(",
"'created_a... | /* -----------------------------------------------------------------
| Main Methods
| ----------------------------------------------------------------- | [
"/",
"*",
"-----------------------------------------------------------------",
"|",
"Main",
"Methods",
"|",
"-----------------------------------------------------------------"
] | train | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/Http/Controllers/Admin/PasswordResetsController.php#L52-L64 |
PenoaksDev/Milky-Framework | src/Milky/Database/Migrations/Migrator.php | Migrator.reset | public function reset($pretend = false)
{
$this->notes = [];
$migrations = array_reverse($this->repository->getRan());
$count = count($migrations);
if ($count === 0) {
$this->note('<info>Nothing to rollback.</info>');
} else {
foreach ($migrations as $migration) {
$this->runDown((object) ['migra... | php | public function reset($pretend = false)
{
$this->notes = [];
$migrations = array_reverse($this->repository->getRan());
$count = count($migrations);
if ($count === 0) {
$this->note('<info>Nothing to rollback.</info>');
} else {
foreach ($migrations as $migration) {
$this->runDown((object) ['migra... | [
"public",
"function",
"reset",
"(",
"$",
"pretend",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"notes",
"=",
"[",
"]",
";",
"$",
"migrations",
"=",
"array_reverse",
"(",
"$",
"this",
"->",
"repository",
"->",
"getRan",
"(",
")",
")",
";",
"$",
"cou... | Rolls all of the currently applied migrations back.
@param bool $pretend
@return int | [
"Rolls",
"all",
"of",
"the",
"currently",
"applied",
"migrations",
"back",
"."
] | train | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Migrations/Migrator.php#L192-L209 |
rawphp/RawCodeStandards | RawPHP/Sniffs/ControlStructures/SwitchDeclarationSniff.php | RawPHP_Sniffs_ControlStructures_SwitchDeclarationSniff.process | public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr )
{
$tokens = $phpcsFile->getTokens();
// We can't process SWITCH statements unless we know where they start and end.
if ( isset( $tokens[ $stackPtr ][ 'scope_opener' ] ) === FALSE ||
isset( $tokens[ $stackPtr ]... | php | public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr )
{
$tokens = $phpcsFile->getTokens();
// We can't process SWITCH statements unless we know where they start and end.
if ( isset( $tokens[ $stackPtr ][ 'scope_opener' ] ) === FALSE ||
isset( $tokens[ $stackPtr ]... | [
"public",
"function",
"process",
"(",
"PHP_CodeSniffer_File",
"$",
"phpcsFile",
",",
"$",
"stackPtr",
")",
"{",
"$",
"tokens",
"=",
"$",
"phpcsFile",
"->",
"getTokens",
"(",
")",
";",
"// We can't process SWITCH statements unless we know where they start and end.",
"if"... | Processes this test, when one of its tokens is encountered.
@param PHP_CodeSniffer_File $phpcsFile The file being scanned.
@param int $stackPtr The position of the current token in the
stack passed in $tokens.
@return void | [
"Processes",
"this",
"test",
"when",
"one",
"of",
"its",
"tokens",
"is",
"encountered",
"."
] | train | https://github.com/rawphp/RawCodeStandards/blob/aa40b4b085bfb3317843883124da246c32c4bb92/RawPHP/Sniffs/ControlStructures/SwitchDeclarationSniff.php#L65-L305 |
bkstg/schedule-bundle | Repository/EventRepository.php | EventRepository.searchEvents | public function searchEvents(
Production $production,
\DateTime $from,
\DateTime $to,
bool $active = true
) {
$qb = $this->createQueryBuilder('e');
return $qb
->join('e.groups', 'g')
// Add conditions.
->andWhere($qb->expr()->eq('... | php | public function searchEvents(
Production $production,
\DateTime $from,
\DateTime $to,
bool $active = true
) {
$qb = $this->createQueryBuilder('e');
return $qb
->join('e.groups', 'g')
// Add conditions.
->andWhere($qb->expr()->eq('... | [
"public",
"function",
"searchEvents",
"(",
"Production",
"$",
"production",
",",
"\\",
"DateTime",
"$",
"from",
",",
"\\",
"DateTime",
"$",
"to",
",",
"bool",
"$",
"active",
"=",
"true",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"createQueryBuilder",
... | Search for events within a production.
@param Production $production The production to search in.
@param \DateTime $from The time to start searching from.
@param \DateTime $to The time to end searching from.
@param bool $active The active state of the events.
@return Event[] | [
"Search",
"for",
"events",
"within",
"a",
"production",
"."
] | train | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Repository/EventRepository.php#L32-L57 |
bkstg/schedule-bundle | Repository/EventRepository.php | EventRepository.searchEventsByUser | public function searchEventsByUser(
UserInterface $user,
\DateTime $from,
\DateTime $to,
bool $active = true
) {
$qb = $this->createQueryBuilder('e');
return $qb
->join('e.invitations', 'i')
// Add conditions.
->andWhere($qb->expr... | php | public function searchEventsByUser(
UserInterface $user,
\DateTime $from,
\DateTime $to,
bool $active = true
) {
$qb = $this->createQueryBuilder('e');
return $qb
->join('e.invitations', 'i')
// Add conditions.
->andWhere($qb->expr... | [
"public",
"function",
"searchEventsByUser",
"(",
"UserInterface",
"$",
"user",
",",
"\\",
"DateTime",
"$",
"from",
",",
"\\",
"DateTime",
"$",
"to",
",",
"bool",
"$",
"active",
"=",
"true",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"createQueryBuilder... | Search for events for a user.
@param UserInterface $user The production to search in.
@param \DateTime $from The time to start searching from.
@param \DateTime $to The time to end searching from.
@param bool $active The active state of the events.
@return Event[] | [
"Search",
"for",
"events",
"for",
"a",
"user",
"."
] | train | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Repository/EventRepository.php#L69-L99 |
bkstg/schedule-bundle | Repository/EventRepository.php | EventRepository.findArchivedEventsQuery | public function findArchivedEventsQuery(Production $production)
{
$qb = $this->createQueryBuilder('e');
return $qb
// Add joins.
->join('e.groups', 'g')
// Add conditions.
->andWhere($qb->expr()->eq('g', ':production'))
->andWhere($qb->ex... | php | public function findArchivedEventsQuery(Production $production)
{
$qb = $this->createQueryBuilder('e');
return $qb
// Add joins.
->join('e.groups', 'g')
// Add conditions.
->andWhere($qb->expr()->eq('g', ':production'))
->andWhere($qb->ex... | [
"public",
"function",
"findArchivedEventsQuery",
"(",
"Production",
"$",
"production",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
"'e'",
")",
";",
"return",
"$",
"qb",
"// Add joins.",
"->",
"join",
"(",
"'e.groups'",
",",
"'g'",... | Helper function to search for events that are not active.
@param Production $production The production to search in.
@return Event[] | [
"Helper",
"function",
"to",
"search",
"for",
"events",
"that",
"are",
"not",
"active",
"."
] | train | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Repository/EventRepository.php#L108-L130 |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Expression/Operand/Size.php | Size.isEquivalent | public function isEquivalent(OperandInterface $operand)
{
if (!$operand instanceof self) {
return false;
}
return $this->path === $operand->path;
} | php | public function isEquivalent(OperandInterface $operand)
{
if (!$operand instanceof self) {
return false;
}
return $this->path === $operand->path;
} | [
"public",
"function",
"isEquivalent",
"(",
"OperandInterface",
"$",
"operand",
")",
"{",
"if",
"(",
"!",
"$",
"operand",
"instanceof",
"self",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"path",
"===",
"$",
"operand",
"->",
"path"... | {@inheritdoc} | [
"{"
] | train | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Expression/Operand/Size.php#L64-L71 |
togucms/ApplicationModelsBundle | Phpcr/DocumentRepository.php | DocumentRepository.constraintField | protected function constraintField(ConstraintFactory $where, $field, $value, $alias) {
if(! is_array($value)) {
/* $metadata = $this->getClassMetadata();
$fieldMapping = $metadata->getField($field);
$value = array($fieldMapping['defaultConstraint'] => $value);
*/ $value = array('eq' => $value);
}
foreac... | php | protected function constraintField(ConstraintFactory $where, $field, $value, $alias) {
if(! is_array($value)) {
/* $metadata = $this->getClassMetadata();
$fieldMapping = $metadata->getField($field);
$value = array($fieldMapping['defaultConstraint'] => $value);
*/ $value = array('eq' => $value);
}
foreac... | [
"protected",
"function",
"constraintField",
"(",
"ConstraintFactory",
"$",
"where",
",",
"$",
"field",
",",
"$",
"value",
",",
"$",
"alias",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"/*\t\t\t$metadata = $this->getClassMetadata();... | {@inheritDoc} | [
"{"
] | train | https://github.com/togucms/ApplicationModelsBundle/blob/125ab47e0327d17afdedb8db074c9d7e211e6417/Phpcr/DocumentRepository.php#L31-L45 |
kitpages/KitpagesSimpleCacheBundle | Model/CacheManager.php | CacheManager.clear | public function clear($id)
{
// check if $id exists in cache
$query = $this->em->createQuery("
SELECT backend FROM Kitpages\SimpleCacheBundle\Entity\Backend backend
WHERE backend.id like :backendId
")->setParameter('backendId', $id);
$backendList = $query->get... | php | public function clear($id)
{
// check if $id exists in cache
$query = $this->em->createQuery("
SELECT backend FROM Kitpages\SimpleCacheBundle\Entity\Backend backend
WHERE backend.id like :backendId
")->setParameter('backendId', $id);
$backendList = $query->get... | [
"public",
"function",
"clear",
"(",
"$",
"id",
")",
"{",
"// check if $id exists in cache",
"$",
"query",
"=",
"$",
"this",
"->",
"em",
"->",
"createQuery",
"(",
"\"\n SELECT backend FROM Kitpages\\SimpleCacheBundle\\Entity\\Backend backend\n WHERE backend... | clear cache
@param string $id cache id, comparison with like and % if you want | [
"clear",
"cache"
] | train | https://github.com/kitpages/KitpagesSimpleCacheBundle/blob/bed7bd238dbbc54364ae7a9f5e1beb20b5444989/Model/CacheManager.php#L28-L40 |
bseddon/XPath20 | SequenceType.php | SequenceType.WithTypeCodeAndCardinality | public static function WithTypeCodeAndCardinality( $typeCode, $cardinality )
{
$result = SequenceType::WithTypeCodeWithQNameTest( $typeCode, XmlQualifiedNameTest::getWildcard() );
$result->Cardinality = $cardinality;
return $result;
} | php | public static function WithTypeCodeAndCardinality( $typeCode, $cardinality )
{
$result = SequenceType::WithTypeCodeWithQNameTest( $typeCode, XmlQualifiedNameTest::getWildcard() );
$result->Cardinality = $cardinality;
return $result;
} | [
"public",
"static",
"function",
"WithTypeCodeAndCardinality",
"(",
"$",
"typeCode",
",",
"$",
"cardinality",
")",
"{",
"$",
"result",
"=",
"SequenceType",
"::",
"WithTypeCodeWithQNameTest",
"(",
"$",
"typeCode",
",",
"XmlQualifiedNameTest",
"::",
"getWildcard",
"(",... | WithTypeCodeAndCardinality
@param XmlTypeCode $typeCode
@param XmlTypeCardinality $cardinality
@return SequenceType | [
"WithTypeCodeAndCardinality"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L150-L155 |
bseddon/XPath20 | SequenceType.php | SequenceType.WithElement | public static function WithElement( $schemaElement )
{
$result = new SequenceType();
$result->TypeCode = XmlTypeCode::Element;
$result->SchemaElement = $schemaElement;
$result->IsNode = true;
$result->ItemType = $result->TypeCodeToItemType( $result->TypeCode, $result->SchemaType );
return $resul... | php | public static function WithElement( $schemaElement )
{
$result = new SequenceType();
$result->TypeCode = XmlTypeCode::Element;
$result->SchemaElement = $schemaElement;
$result->IsNode = true;
$result->ItemType = $result->TypeCodeToItemType( $result->TypeCode, $result->SchemaType );
return $resul... | [
"public",
"static",
"function",
"WithElement",
"(",
"$",
"schemaElement",
")",
"{",
"$",
"result",
"=",
"new",
"SequenceType",
"(",
")",
";",
"$",
"result",
"->",
"TypeCode",
"=",
"XmlTypeCode",
"::",
"Element",
";",
"$",
"result",
"->",
"SchemaElement",
"... | WithElement
@param XmlSchemaElement $schemaElement
@return SequenceType | [
"WithElement"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L217-L227 |
bseddon/XPath20 | SequenceType.php | SequenceType.WithAttribute | public static function WithAttribute( $schemaAttribute )
{
$result = new SequenceType();
$result->TypeCode = XmlTypeCode::Attribute;
$result->SchemaAttribute = $schemaAttribute;
$result->IsNode = true;
$result->ItemType = $result->TypeCodeToItemType( $result->TypeCode, $result->SchemaType );
ret... | php | public static function WithAttribute( $schemaAttribute )
{
$result = new SequenceType();
$result->TypeCode = XmlTypeCode::Attribute;
$result->SchemaAttribute = $schemaAttribute;
$result->IsNode = true;
$result->ItemType = $result->TypeCodeToItemType( $result->TypeCode, $result->SchemaType );
ret... | [
"public",
"static",
"function",
"WithAttribute",
"(",
"$",
"schemaAttribute",
")",
"{",
"$",
"result",
"=",
"new",
"SequenceType",
"(",
")",
";",
"$",
"result",
"->",
"TypeCode",
"=",
"XmlTypeCode",
"::",
"Attribute",
";",
"$",
"result",
"->",
"SchemaAttribu... | WithAttribute
@param XmlSchemaAttribute $schemaAttribute
@return SequenceType | [
"WithAttribute"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L234-L244 |
bseddon/XPath20 | SequenceType.php | SequenceType.WithSchemaTypeWithCardinality | public static function WithSchemaTypeWithCardinality( $schemaType, $cardinality )
{
$result = new SequenceType();
$result->TypeCode = $schemaType->TypeCode;
$result->SchemaType = $schemaType;
$result->Cardinality = $cardinality;
$result->IsNode = $result->TypeCodeIsNodeType( $result->TypeCode );
$... | php | public static function WithSchemaTypeWithCardinality( $schemaType, $cardinality )
{
$result = new SequenceType();
$result->TypeCode = $schemaType->TypeCode;
$result->SchemaType = $schemaType;
$result->Cardinality = $cardinality;
$result->IsNode = $result->TypeCodeIsNodeType( $result->TypeCode );
$... | [
"public",
"static",
"function",
"WithSchemaTypeWithCardinality",
"(",
"$",
"schemaType",
",",
"$",
"cardinality",
")",
"{",
"$",
"result",
"=",
"new",
"SequenceType",
"(",
")",
";",
"$",
"result",
"->",
"TypeCode",
"=",
"$",
"schemaType",
"->",
"TypeCode",
"... | WithSchemaTypeWithCardinality
@param XmlSchemaType $schemaType
@param XmlTypeCardinality $cardinality
@return SequenceType | [
"WithSchemaTypeWithCardinality"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L252-L263 |
bseddon/XPath20 | SequenceType.php | SequenceType.FromSequenceType | public static function FromSequenceType( $src )
{
$result = new SequenceType();
$result->TypeCode = $src->TypeCode;
$result->NameTest = $src->NameTest;
$result->Cardinality = $src->Cardinality;
$result->SchemaType = $src->SchemaType;
$result->SchemaElement = $src->SchemaElement;
$result->Schema... | php | public static function FromSequenceType( $src )
{
$result = new SequenceType();
$result->TypeCode = $src->TypeCode;
$result->NameTest = $src->NameTest;
$result->Cardinality = $src->Cardinality;
$result->SchemaType = $src->SchemaType;
$result->SchemaElement = $src->SchemaElement;
$result->Schema... | [
"public",
"static",
"function",
"FromSequenceType",
"(",
"$",
"src",
")",
"{",
"$",
"result",
"=",
"new",
"SequenceType",
"(",
")",
";",
"$",
"result",
"->",
"TypeCode",
"=",
"$",
"src",
"->",
"TypeCode",
";",
"$",
"result",
"->",
"NameTest",
"=",
"$",... | FromSequenceType
@param SequenceType $src
@return SequenceType | [
"FromSequenceType"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L270-L285 |
bseddon/XPath20 | SequenceType.php | SequenceType.getValueType | public function getValueType()
{
if ( $this->Cardinality == XmlTypeCardinality::ZeroOrMore ||
$this->Cardinality == XmlTypeCardinality::OneOrMore )
return "\lyquidity\XPath2\XPath2NodeIterator";
if ( $this->IsNode )
return "\lyquidity\xml\xpath\XPathNavigator";
if ($this->Cardinality == XmlT... | php | public function getValueType()
{
if ( $this->Cardinality == XmlTypeCardinality::ZeroOrMore ||
$this->Cardinality == XmlTypeCardinality::OneOrMore )
return "\lyquidity\XPath2\XPath2NodeIterator";
if ( $this->IsNode )
return "\lyquidity\xml\xpath\XPathNavigator";
if ($this->Cardinality == XmlT... | [
"public",
"function",
"getValueType",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"Cardinality",
"==",
"XmlTypeCardinality",
"::",
"ZeroOrMore",
"||",
"$",
"this",
"->",
"Cardinality",
"==",
"XmlTypeCardinality",
"::",
"OneOrMore",
")",
"return",
"\"\\lyquidity... | Get the type of the value
@var Type $ValueType | [
"Get",
"the",
"type",
"of",
"the",
"value"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L291-L304 |
bseddon/XPath20 | SequenceType.php | SequenceType.getAtomizedValueType | public function getAtomizedValueType()
{
if ( $this->IsNode )
{
switch ( $this->TypeCode )
{
case XmlTypeCode::Text:
case XmlTypeCode::ProcessingInstruction:
case XmlTypeCode::Comment:
case XmlTypeCode::UntypedAtomic:
return Types::$UntypedAtomicType;
default:
if... | php | public function getAtomizedValueType()
{
if ( $this->IsNode )
{
switch ( $this->TypeCode )
{
case XmlTypeCode::Text:
case XmlTypeCode::ProcessingInstruction:
case XmlTypeCode::Comment:
case XmlTypeCode::UntypedAtomic:
return Types::$UntypedAtomicType;
default:
if... | [
"public",
"function",
"getAtomizedValueType",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"IsNode",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"TypeCode",
")",
"{",
"case",
"XmlTypeCode",
"::",
"Text",
":",
"case",
"XmlTypeCode",
"::",
"ProcessingInstruc... | Get the type of the atomized value
@return Type | [
"Get",
"the",
"type",
"of",
"the",
"atomized",
"value"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L310-L341 |
bseddon/XPath20 | SequenceType.php | SequenceType.getIsNumeric | public function getIsNumeric()
{
switch ( $this->TypeCode )
{
case XmlTypeCode::Decimal:
case XmlTypeCode::Float:
case XmlTypeCode::Double:
case XmlTypeCode::Integer:
case XmlTypeCode::NonPositiveInteger:
case XmlTypeCode::NegativeInteger:
case XmlTypeCode::Long:
case XmlTypeCode... | php | public function getIsNumeric()
{
switch ( $this->TypeCode )
{
case XmlTypeCode::Decimal:
case XmlTypeCode::Float:
case XmlTypeCode::Double:
case XmlTypeCode::Integer:
case XmlTypeCode::NonPositiveInteger:
case XmlTypeCode::NegativeInteger:
case XmlTypeCode::Long:
case XmlTypeCode... | [
"public",
"function",
"getIsNumeric",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"TypeCode",
")",
"{",
"case",
"XmlTypeCode",
"::",
"Decimal",
":",
"case",
"XmlTypeCode",
"::",
"Float",
":",
"case",
"XmlTypeCode",
"::",
"Double",
":",
"case",
"XmlTyp... | Returns true if the value is numeric
@return bool | [
"Returns",
"true",
"if",
"the",
"value",
"is",
"numeric"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L347-L370 |
bseddon/XPath20 | SequenceType.php | SequenceType.MatchName | private function MatchName( $nav, $context )
{
return ( $this->NameTest->IsNamespaceWildcard() || $this->NameTest->namespaceURI == $nav->getNamespaceURI() ) &&
($this->NameTest->IsNameWildcard() || $this->NameTest->localName == $nav->getLocalName() );
} | php | private function MatchName( $nav, $context )
{
return ( $this->NameTest->IsNamespaceWildcard() || $this->NameTest->namespaceURI == $nav->getNamespaceURI() ) &&
($this->NameTest->IsNameWildcard() || $this->NameTest->localName == $nav->getLocalName() );
} | [
"private",
"function",
"MatchName",
"(",
"$",
"nav",
",",
"$",
"context",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"NameTest",
"->",
"IsNamespaceWildcard",
"(",
")",
"||",
"$",
"this",
"->",
"NameTest",
"->",
"namespaceURI",
"==",
"$",
"nav",
"->",
... | MatchName
@param XPathNavigator $nav
@param XPath2Context $context
@return bool | [
"MatchName"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L387-L391 |
bseddon/XPath20 | SequenceType.php | SequenceType.GetNodeKind | public function GetNodeKind()
{
switch ( $this->TypeCode )
{
case XmlTypeCode::Item:
return XPathNodeType::All;
case XmlTypeCode::Document:
return XPathNodeType::Root;
case XmlTypeCode::Element:
return XPathNodeType::Element;
case XmlTypeCode::Attribute:
return XPathNodeType:... | php | public function GetNodeKind()
{
switch ( $this->TypeCode )
{
case XmlTypeCode::Item:
return XPathNodeType::All;
case XmlTypeCode::Document:
return XPathNodeType::Root;
case XmlTypeCode::Element:
return XPathNodeType::Element;
case XmlTypeCode::Attribute:
return XPathNodeType:... | [
"public",
"function",
"GetNodeKind",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"TypeCode",
")",
"{",
"case",
"XmlTypeCode",
"::",
"Item",
":",
"return",
"XPathNodeType",
"::",
"All",
";",
"case",
"XmlTypeCode",
"::",
"Document",
":",
"return",
"XPat... | GetNodeKind
@return XPathNodeType | [
"GetNodeKind"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L397-L420 |
bseddon/XPath20 | SequenceType.php | SequenceType.Match | public function Match( $item, $context )
{
if ( $this->TypeCode == $item->getSchemaType()->TypeCode ) return true;
switch ( $this->TypeCode )
{
case XmlTypeCode::None:
return false;
case XmlTypeCode::Item:
return true;
case XmlTypeCode::Node:
return $item->getIsNode();
... | php | public function Match( $item, $context )
{
if ( $this->TypeCode == $item->getSchemaType()->TypeCode ) return true;
switch ( $this->TypeCode )
{
case XmlTypeCode::None:
return false;
case XmlTypeCode::Item:
return true;
case XmlTypeCode::Node:
return $item->getIsNode();
... | [
"public",
"function",
"Match",
"(",
"$",
"item",
",",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"TypeCode",
"==",
"$",
"item",
"->",
"getSchemaType",
"(",
")",
"->",
"TypeCode",
")",
"return",
"true",
";",
"switch",
"(",
"$",
"this",
... | Match
@param XPathItem $item
@param XPath2Context $context
@return bool | [
"Match"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L428-L802 |
bseddon/XPath20 | SequenceType.php | SequenceType.ToString | public function ToString()
{
$sb = array();
switch ( $this->TypeCode )
{
case XmlTypeCode::AnyAtomicType:
$sb[] = "AnyAtomicType";
break;
case XmlTypeCode::UntypedAtomic:
$sb[] = "UntypedAtomic";
break;
case XmlTypeCode::None:
$sb[] = "empty-sequence()";
break;
... | php | public function ToString()
{
$sb = array();
switch ( $this->TypeCode )
{
case XmlTypeCode::AnyAtomicType:
$sb[] = "AnyAtomicType";
break;
case XmlTypeCode::UntypedAtomic:
$sb[] = "UntypedAtomic";
break;
case XmlTypeCode::None:
$sb[] = "empty-sequence()";
break;
... | [
"public",
"function",
"ToString",
"(",
")",
"{",
"$",
"sb",
"=",
"array",
"(",
")",
";",
"switch",
"(",
"$",
"this",
"->",
"TypeCode",
")",
"{",
"case",
"XmlTypeCode",
"::",
"AnyAtomicType",
":",
"$",
"sb",
"[",
"]",
"=",
"\"AnyAtomicType\"",
";",
"b... | ToString
@return string | [
"ToString"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L817-L1133 |
bseddon/XPath20 | SequenceType.php | SequenceType.GetXmlTypeCodeFromObject | static public function GetXmlTypeCodeFromObject( $value )
{
if ( $value instanceof XPathNavigator )
{
/**
* @var XPathNavigator $nav
*/
$nav = $value;
switch ( $nav->getNodeType() )
{
case XPathNodeType::Attribute:
return XmlTypeCode::Attribute;
case XPathNodeType::Co... | php | static public function GetXmlTypeCodeFromObject( $value )
{
if ( $value instanceof XPathNavigator )
{
/**
* @var XPathNavigator $nav
*/
$nav = $value;
switch ( $nav->getNodeType() )
{
case XPathNodeType::Attribute:
return XmlTypeCode::Attribute;
case XPathNodeType::Co... | [
"static",
"public",
"function",
"GetXmlTypeCodeFromObject",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"XPathNavigator",
")",
"{",
"/**\r\n\t\t\t * @var XPathNavigator $nav\r\n\t\t\t */",
"$",
"nav",
"=",
"$",
"value",
";",
"switch",
"(",
... | GetXmlTypeCode
@param object $value
@return XmlTypeCode | [
"GetXmlTypeCode"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L1140-L1192 |
bseddon/XPath20 | SequenceType.php | SequenceType.TypeCodeIsNodeType | public static function TypeCodeIsNodeType( $typeCode )
{
switch ( $typeCode )
{
case XmlTypeCode::Node:
case XmlTypeCode::Element:
case XmlTypeCode::Attribute:
case XmlTypeCode::Document:
case XmlTypeCode::Comment:
case XmlTypeCode::Text:
case XmlTypeCode::ProcessingInstruc... | php | public static function TypeCodeIsNodeType( $typeCode )
{
switch ( $typeCode )
{
case XmlTypeCode::Node:
case XmlTypeCode::Element:
case XmlTypeCode::Attribute:
case XmlTypeCode::Document:
case XmlTypeCode::Comment:
case XmlTypeCode::Text:
case XmlTypeCode::ProcessingInstruc... | [
"public",
"static",
"function",
"TypeCodeIsNodeType",
"(",
"$",
"typeCode",
")",
"{",
"switch",
"(",
"$",
"typeCode",
")",
"{",
"case",
"XmlTypeCode",
"::",
"Node",
":",
"case",
"XmlTypeCode",
"::",
"Element",
":",
"case",
"XmlTypeCode",
"::",
"Attribute",
"... | TypeCodeIsNodeType
@param XmlTypeCode $typeCode
@return bool | [
"TypeCodeIsNodeType"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L1199-L1213 |
bseddon/XPath20 | SequenceType.php | SequenceType.TypeCodeToItemType | public static function TypeCodeToItemType( $typeCode, $schemaType )
{
switch ($typeCode)
{
case XmlTypeCode::Boolean:
return Types::$BooleanType;
case XmlTypeCode::Short:
return Types::$ShortType;
case XmlTypeCode::Int:
return Types::$IntType;
case XmlTypeCode::Long:
re... | php | public static function TypeCodeToItemType( $typeCode, $schemaType )
{
switch ($typeCode)
{
case XmlTypeCode::Boolean:
return Types::$BooleanType;
case XmlTypeCode::Short:
return Types::$ShortType;
case XmlTypeCode::Int:
return Types::$IntType;
case XmlTypeCode::Long:
re... | [
"public",
"static",
"function",
"TypeCodeToItemType",
"(",
"$",
"typeCode",
",",
"$",
"schemaType",
")",
"{",
"switch",
"(",
"$",
"typeCode",
")",
"{",
"case",
"XmlTypeCode",
"::",
"Boolean",
":",
"return",
"Types",
"::",
"$",
"BooleanType",
";",
"case",
"... | TypeCodeToItemType
@param XmlTypeCode $typeCode
@param XmlSchemaType $schemaType
@return Type | [
"TypeCodeToItemType"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L1221-L1331 |
bseddon/XPath20 | SequenceType.php | SequenceType.GetXmlTypeCodeFromType | public static function GetXmlTypeCodeFromType( $type )
{
/**
* @var TypeCode
*/
switch ( $type->getTypeCode() )
{
case TypeCode::Boolean:
return XmlTypeCode::Boolean;
case TypeCode::Int16:
return XmlTypeCode::Short;
case TypeCode::Int32:
return XmlTypeCode::Int;
case Ty... | php | public static function GetXmlTypeCodeFromType( $type )
{
/**
* @var TypeCode
*/
switch ( $type->getTypeCode() )
{
case TypeCode::Boolean:
return XmlTypeCode::Boolean;
case TypeCode::Int16:
return XmlTypeCode::Short;
case TypeCode::Int32:
return XmlTypeCode::Int;
case Ty... | [
"public",
"static",
"function",
"GetXmlTypeCodeFromType",
"(",
"$",
"type",
")",
"{",
"/**\r\n\t\t * @var TypeCode\r\n\t\t */",
"switch",
"(",
"$",
"type",
"->",
"getTypeCode",
"(",
")",
")",
"{",
"case",
"TypeCode",
"::",
"Boolean",
":",
"return",
"XmlTypeCode",
... | GetXmlTypeCode
@param Type $type
@return XmlTypeCode | [
"GetXmlTypeCode"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L1338-L1418 |
bseddon/XPath20 | SequenceType.php | SequenceType.IsDerivedFrom | public function IsDerivedFrom( $src )
{
switch ( $src->TypeCode )
{
case XmlTypeCode::Node:
if ( ! $this->IsNode )
return false;
break;
case XmlTypeCode::AnyAtomicType:
case XmlTypeCode::UntypedAtomic:
if ( $this->IsNode )
return false;
break;
case XmlTypeCode... | php | public function IsDerivedFrom( $src )
{
switch ( $src->TypeCode )
{
case XmlTypeCode::Node:
if ( ! $this->IsNode )
return false;
break;
case XmlTypeCode::AnyAtomicType:
case XmlTypeCode::UntypedAtomic:
if ( $this->IsNode )
return false;
break;
case XmlTypeCode... | [
"public",
"function",
"IsDerivedFrom",
"(",
"$",
"src",
")",
"{",
"switch",
"(",
"$",
"src",
"->",
"TypeCode",
")",
"{",
"case",
"XmlTypeCode",
"::",
"Node",
":",
"if",
"(",
"!",
"$",
"this",
"->",
"IsNode",
")",
"return",
"false",
";",
"break",
";",... | IsDerivedFrom
@param SequenceType $src
@return bool | [
"IsDerivedFrom"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L1425-L1491 |
bseddon/XPath20 | SequenceType.php | SequenceType.Equals | public function Equals( $obj )
{
/**
* @var SequenceType $dest
*/
$dest = $obj;
if ( ! is_null( $obj ) )
{
return $this->TypeCode == $dest->TypeCode &&
$this->SchemaElement == $dest->SchemaElement &&
$this->SchemaAttribute == $dest->SchemaAttribute &&
$this->SchemaType == $dest-... | php | public function Equals( $obj )
{
/**
* @var SequenceType $dest
*/
$dest = $obj;
if ( ! is_null( $obj ) )
{
return $this->TypeCode == $dest->TypeCode &&
$this->SchemaElement == $dest->SchemaElement &&
$this->SchemaAttribute == $dest->SchemaAttribute &&
$this->SchemaType == $dest-... | [
"public",
"function",
"Equals",
"(",
"$",
"obj",
")",
"{",
"/**\r\n\t\t * @var SequenceType $dest\r\n\t\t */",
"$",
"dest",
"=",
"$",
"obj",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"obj",
")",
")",
"{",
"return",
"$",
"this",
"->",
"TypeCode",
"==",
"$... | Equals
@param object $obj
@return bool | [
"Equals"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L1498-L1513 |
bseddon/XPath20 | SequenceType.php | SequenceType.Create | public static function Create( $name )
{
if ( $name == "" || $name == "empty-sequence()")
return null;
else
{
/**
* @var XmlTypeCardinality $cardinality
*/
$cardinality = XmlTypeCardinality::One;
if ( SchemaTypes::endsWith( $name, "?" ) )
{
$cardinality = XmlTypeCardinality... | php | public static function Create( $name )
{
if ( $name == "" || $name == "empty-sequence()")
return null;
else
{
/**
* @var XmlTypeCardinality $cardinality
*/
$cardinality = XmlTypeCardinality::One;
if ( SchemaTypes::endsWith( $name, "?" ) )
{
$cardinality = XmlTypeCardinality... | [
"public",
"static",
"function",
"Create",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"\"\"",
"||",
"$",
"name",
"==",
"\"empty-sequence()\"",
")",
"return",
"null",
";",
"else",
"{",
"/**\r\n\t\t\t * @var XmlTypeCardinality $cardinality\r\n\t\t\t */... | Create
@param string $name
@return SequenceType | [
"Create"
] | train | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/SequenceType.php#L1520-L1580 |
vainproject/vain-user | src/User/Observers/UserObserver.php | UserObserver.deleting | public function deleting($model)
{
foreach ($this->relations as $relation) {
if ($model->{$relation}()->count() > 0) {
// Returning false from an Eloquent event listener will cancel the operation.
return false;
}
}
} | php | public function deleting($model)
{
foreach ($this->relations as $relation) {
if ($model->{$relation}()->count() > 0) {
// Returning false from an Eloquent event listener will cancel the operation.
return false;
}
}
} | [
"public",
"function",
"deleting",
"(",
"$",
"model",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"relations",
"as",
"$",
"relation",
")",
"{",
"if",
"(",
"$",
"model",
"->",
"{",
"$",
"relation",
"}",
"(",
")",
"->",
"count",
"(",
")",
">",
"0",... | Post delete check if a user has any relevant relations,
if so we cancel the deletion and ask the user to
manually remove all relations for now.
@param $model
@return bool | [
"Post",
"delete",
"check",
"if",
"a",
"user",
"has",
"any",
"relevant",
"relations",
"if",
"so",
"we",
"cancel",
"the",
"deletion",
"and",
"ask",
"the",
"user",
"to",
"manually",
"remove",
"all",
"relations",
"for",
"now",
"."
] | train | https://github.com/vainproject/vain-user/blob/1c059faa61ebf289fcaea39a90b4523cfc9d6efc/src/User/Observers/UserObserver.php#L22-L30 |
Wedeto/Util | src/ErrorInterceptor.php | ErrorInterceptor.execute | public function execute()
{
$registered = false;
if (self::$interceptor_stack === null)
{
$registered = true;
self::registerErrorHandler();
}
array_push(self::$interceptor_stack, $this);
$response = null;
try
{
... | php | public function execute()
{
$registered = false;
if (self::$interceptor_stack === null)
{
$registered = true;
self::registerErrorHandler();
}
array_push(self::$interceptor_stack, $this);
$response = null;
try
{
... | [
"public",
"function",
"execute",
"(",
")",
"{",
"$",
"registered",
"=",
"false",
";",
"if",
"(",
"self",
"::",
"$",
"interceptor_stack",
"===",
"null",
")",
"{",
"$",
"registered",
"=",
"true",
";",
"self",
"::",
"registerErrorHandler",
"(",
")",
";",
... | Execute the configured callback
@params Any parameters to pass to the callback
@return mixed The return value of the callback | [
"Execute",
"the",
"configured",
"callback"
] | train | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/ErrorInterceptor.php#L82-L105 |
Wedeto/Util | src/ErrorInterceptor.php | ErrorInterceptor.intercept | protected function intercept($errno, $errstr, $errfile, $errline, $errcontext)
{
foreach ($this->expected as $warning)
{
if ($errno & $warning[0] && strpos($errstr, $warning[1]) !== false)
{
$this->intercepted[] = new \ErrorException($errstr, 0, $errno, $errfi... | php | protected function intercept($errno, $errstr, $errfile, $errline, $errcontext)
{
foreach ($this->expected as $warning)
{
if ($errno & $warning[0] && strpos($errstr, $warning[1]) !== false)
{
$this->intercepted[] = new \ErrorException($errstr, 0, $errno, $errfi... | [
"protected",
"function",
"intercept",
"(",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
",",
"$",
"errline",
",",
"$",
"errcontext",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"expected",
"as",
"$",
"warning",
")",
"{",
"if",
"(",
"$",
... | Check if the produced error should be intercepted by the interceptor, based on the
defined expected errors.
@param int $errno Error type
@param string $errstr The error string
@param string $errfile The file the error occured in
@param int $errline The line the error occured on
@param array $errcontext Local variables... | [
"Check",
"if",
"the",
"produced",
"error",
"should",
"be",
"intercepted",
"by",
"the",
"interceptor",
"based",
"on",
"the",
"defined",
"expected",
"errors",
"."
] | train | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/ErrorInterceptor.php#L126-L137 |
Wedeto/Util | src/ErrorInterceptor.php | ErrorInterceptor.errorHandler | public static function errorHandler($errno, $errstr, $errfile, $errline, $errcontext)
{
if (count(self::$interceptor_stack) > 0)
{
$interceptor = end(self::$interceptor_stack);
if ($interceptor->intercept($errno, $errstr, $errfile, $errline, $errcontext))
{
... | php | public static function errorHandler($errno, $errstr, $errfile, $errline, $errcontext)
{
if (count(self::$interceptor_stack) > 0)
{
$interceptor = end(self::$interceptor_stack);
if ($interceptor->intercept($errno, $errstr, $errfile, $errline, $errcontext))
{
... | [
"public",
"static",
"function",
"errorHandler",
"(",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
",",
"$",
"errline",
",",
"$",
"errcontext",
")",
"{",
"if",
"(",
"count",
"(",
"self",
"::",
"$",
"interceptor_stack",
")",
">",
"0",
")",
"{... | Catch all PHP errors, notices and throw them as an exception instead. If
an interceptor was registered, the message is passed to the interceptor instead.
@param int $errno Error number
@param string $errstr Error description
@param string $errfile The file where the error occured
@param int $errline The line where the... | [
"Catch",
"all",
"PHP",
"errors",
"notices",
"and",
"throw",
"them",
"as",
"an",
"exception",
"instead",
".",
"If",
"an",
"interceptor",
"was",
"registered",
"the",
"message",
"is",
"passed",
"to",
"the",
"interceptor",
"instead",
"."
] | train | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/ErrorInterceptor.php#L154-L166 |
linpax/microphp-framework | src/auth/drivers/FileRbac.php | FileRbac.assign | public function assign($userId, $name)
{
if ($this->searchRoleRecursive($this->roles, $name)) {
$exists = $this->db->exists('rbac_user', ['user' => $userId, 'role' => $name]);
if (!$exists) {
return $this->db->insert('rbac_user', ['role' => $name, 'user' => $userId]);... | php | public function assign($userId, $name)
{
if ($this->searchRoleRecursive($this->roles, $name)) {
$exists = $this->db->exists('rbac_user', ['user' => $userId, 'role' => $name]);
if (!$exists) {
return $this->db->insert('rbac_user', ['role' => $name, 'user' => $userId]);... | [
"public",
"function",
"assign",
"(",
"$",
"userId",
",",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"searchRoleRecursive",
"(",
"$",
"this",
"->",
"roles",
",",
"$",
"name",
")",
")",
"{",
"$",
"exists",
"=",
"$",
"this",
"->",
"db",
"-... | Assign RBAC element into user
@access public
@param integer $userId user id
@param string $name element name
@return bool | [
"Assign",
"RBAC",
"element",
"into",
"user"
] | train | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/auth/drivers/FileRbac.php#L55-L65 |
devlabmtl/haven-core | Twig/Extension/HavenRoutingExtension.php | HavenRoutingExtension.isUrlGenerationSafe | public function isUrlGenerationSafe(\Twig_Node $argsNode)
{
// support named arguments
$paramsNode = $argsNode->hasNode('parameters') ? $argsNode->getNode('parameters') : (
$argsNode->hasNode(1) ? $argsNode->getNode(1) : null
);
if (null === $paramsNode || $paramsNode in... | php | public function isUrlGenerationSafe(\Twig_Node $argsNode)
{
// support named arguments
$paramsNode = $argsNode->hasNode('parameters') ? $argsNode->getNode('parameters') : (
$argsNode->hasNode(1) ? $argsNode->getNode(1) : null
);
if (null === $paramsNode || $paramsNode in... | [
"public",
"function",
"isUrlGenerationSafe",
"(",
"\\",
"Twig_Node",
"$",
"argsNode",
")",
"{",
"// support named arguments",
"$",
"paramsNode",
"=",
"$",
"argsNode",
"->",
"hasNode",
"(",
"'parameters'",
")",
"?",
"$",
"argsNode",
"->",
"getNode",
"(",
"'parame... | Determines at compile time whether the generated URL will be safe and thus
saving the unneeded automatic escaping for performance reasons.
The URL generation process percent encodes non-alphanumeric characters. So there is no risk
that malicious/invalid characters are part of the URL. The only character within an URL ... | [
"Determines",
"at",
"compile",
"time",
"whether",
"the",
"generated",
"URL",
"will",
"be",
"safe",
"and",
"thus",
"saving",
"the",
"unneeded",
"automatic",
"escaping",
"for",
"performance",
"reasons",
"."
] | train | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Twig/Extension/HavenRoutingExtension.php#L66-L80 |
jitesoft/php-exceptions | src/Json/JsonException.php | JsonException.toArray | public function toArray() {
$arr = parent::toArray();
$arr['json'] = $this->json;
$arr['file_name'] = $this->fileName;
$arr['file_path'] = $this->path;
return $arr;
} | php | public function toArray() {
$arr = parent::toArray();
$arr['json'] = $this->json;
$arr['file_name'] = $this->fileName;
$arr['file_path'] = $this->path;
return $arr;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"arr",
"=",
"parent",
"::",
"toArray",
"(",
")",
";",
"$",
"arr",
"[",
"'json'",
"]",
"=",
"$",
"this",
"->",
"json",
";",
"$",
"arr",
"[",
"'file_name'",
"]",
"=",
"$",
"this",
"->",
"fileName... | Get the exception as an associative array.
<pre>
{
'type' => (string)
'error' => (string)
'code' => (int)
'file' => (string)
'line' => (int)
'trace' => (array)
'inner' => (array)
'json' => (string)
}
</pre>
@return array | [
"Get",
"the",
"exception",
"as",
"an",
"associative",
"array",
"."
] | train | https://github.com/jitesoft/php-exceptions/blob/f391c5afd75a08c65338ad874dd43c5ab69e061c/src/Json/JsonException.php#L81-L87 |
OxfordInfoLabs/kinikit-core | src/Util/Configuration/ConfigFile.php | ConfigFile.getParameter | public function getParameter($key) {
if (array_key_exists ( $key, $this->parameters ))
return $this->parameters [$key];
else
return null;
} | php | public function getParameter($key) {
if (array_key_exists ( $key, $this->parameters ))
return $this->parameters [$key];
else
return null;
} | [
"public",
"function",
"getParameter",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"parameters",
")",
")",
"return",
"$",
"this",
"->",
"parameters",
"[",
"$",
"key",
"]",
";",
"else",
"return",
"... | Get the parameter matching the passed key
or null if non existent
@param string $key | [
"Get",
"the",
"parameter",
"matching",
"the",
"passed",
"key",
"or",
"null",
"if",
"non",
"existent"
] | train | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Configuration/ConfigFile.php#L37-L42 |
OxfordInfoLabs/kinikit-core | src/Util/Configuration/ConfigFile.php | ConfigFile.getConfigFileText | public function getConfigFileText() {
$configFileText = "";
foreach ( $this->parameters as $key => $value ) {
$configFileText .= $key . "=" . $value . "\n";
}
return $configFileText;
} | php | public function getConfigFileText() {
$configFileText = "";
foreach ( $this->parameters as $key => $value ) {
$configFileText .= $key . "=" . $value . "\n";
}
return $configFileText;
} | [
"public",
"function",
"getConfigFileText",
"(",
")",
"{",
"$",
"configFileText",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"parameters",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"configFileText",
".=",
"$",
"key",
".",
"\"=\"",
"... | Return the actual text which would be written out by the save method.
This is particularly useful in situations like the PropertiesResource
where the output needs to be injected into a resource.
@return string | [
"Return",
"the",
"actual",
"text",
"which",
"would",
"be",
"written",
"out",
"by",
"the",
"save",
"method",
".",
"This",
"is",
"particularly",
"useful",
"in",
"situations",
"like",
"the",
"PropertiesResource",
"where",
"the",
"output",
"needs",
"to",
"be",
"... | train | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Configuration/ConfigFile.php#L88-L94 |
OxfordInfoLabs/kinikit-core | src/Util/Configuration/ConfigFile.php | ConfigFile.save | public function save($filePath = null) {
// Determine the correct file path.
$filePath = ($filePath == null) ? $this->configFilePath : $filePath;
// Store the file
file_put_contents ( $filePath, $this->getConfigFileText () );
} | php | public function save($filePath = null) {
// Determine the correct file path.
$filePath = ($filePath == null) ? $this->configFilePath : $filePath;
// Store the file
file_put_contents ( $filePath, $this->getConfigFileText () );
} | [
"public",
"function",
"save",
"(",
"$",
"filePath",
"=",
"null",
")",
"{",
"// Determine the correct file path.",
"$",
"filePath",
"=",
"(",
"$",
"filePath",
"==",
"null",
")",
"?",
"$",
"this",
"->",
"configFilePath",
":",
"$",
"filePath",
";",
"// Store th... | Save the config file back out. If null supplied for filepath, the constructed configFilePath is used | [
"Save",
"the",
"config",
"file",
"back",
"out",
".",
"If",
"null",
"supplied",
"for",
"filepath",
"the",
"constructed",
"configFilePath",
"is",
"used"
] | train | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Configuration/ConfigFile.php#L100-L107 |
OxfordInfoLabs/kinikit-core | src/Util/Configuration/ConfigFile.php | ConfigFile.parseFile | private function parseFile($configFilePath) {
$configFileText = file_get_contents ( $configFilePath );
// Now split each line on carriage return
$lines = explode ( "\n", $configFileText );
// Now loop through each line, attempting a split by equals sign to get key value pairs out.
foreach ( $lines as $l... | php | private function parseFile($configFilePath) {
$configFileText = file_get_contents ( $configFilePath );
// Now split each line on carriage return
$lines = explode ( "\n", $configFileText );
// Now loop through each line, attempting a split by equals sign to get key value pairs out.
foreach ( $lines as $l... | [
"private",
"function",
"parseFile",
"(",
"$",
"configFilePath",
")",
"{",
"$",
"configFileText",
"=",
"file_get_contents",
"(",
"$",
"configFilePath",
")",
";",
"// Now split each line on carriage return",
"$",
"lines",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"c... | Parse function. Splits the config file into lines and
then looks for key value pairs of the form key=value | [
"Parse",
"function",
".",
"Splits",
"the",
"config",
"file",
"into",
"lines",
"and",
"then",
"looks",
"for",
"key",
"value",
"pairs",
"of",
"the",
"form",
"key",
"=",
"value"
] | train | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Configuration/ConfigFile.php#L113-L143 |
lasallecms/lasallecms-l5-usermanagement-pkg | src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php | TwoFactorAuthHelper.doTwoFactorAuthLogin | public function doTwoFactorAuthLogin($userId) {
// Get the 2FA code
$codeToInput = $this->getCodeToInput();
// Update the user's database record wtih the 2FA code & timestamp
$this->updateUserRecordWithTwoFactorAuthCode($codeToInput, $userId);
// Put together the SMS message
... | php | public function doTwoFactorAuthLogin($userId) {
// Get the 2FA code
$codeToInput = $this->getCodeToInput();
// Update the user's database record wtih the 2FA code & timestamp
$this->updateUserRecordWithTwoFactorAuthCode($codeToInput, $userId);
// Put together the SMS message
... | [
"public",
"function",
"doTwoFactorAuthLogin",
"(",
"$",
"userId",
")",
"{",
"// Get the 2FA code",
"$",
"codeToInput",
"=",
"$",
"this",
"->",
"getCodeToInput",
"(",
")",
";",
"// Update the user's database record wtih the 2FA code & timestamp",
"$",
"this",
"->",
"upda... | Two Factor Authorization for the front-end LOGIN
@param int $userId User ID
@return void | [
"Two",
"Factor",
"Authorization",
"for",
"the",
"front",
"-",
"end",
"LOGIN"
] | train | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php#L88-L102 |
lasallecms/lasallecms-l5-usermanagement-pkg | src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php | TwoFactorAuthHelper.doTwoFactorAuthRegistration | public function doTwoFactorAuthRegistration($data) {
// Get the 2FA code
$codeToInput = $this->getCodeToInput();
// Set this 2FA code into a session variable, since
// this is the only opportunity to so save the ephemerally generated 2FA
$this->request->session()->put('codeToIn... | php | public function doTwoFactorAuthRegistration($data) {
// Get the 2FA code
$codeToInput = $this->getCodeToInput();
// Set this 2FA code into a session variable, since
// this is the only opportunity to so save the ephemerally generated 2FA
$this->request->session()->put('codeToIn... | [
"public",
"function",
"doTwoFactorAuthRegistration",
"(",
"$",
"data",
")",
"{",
"// Get the 2FA code",
"$",
"codeToInput",
"=",
"$",
"this",
"->",
"getCodeToInput",
"(",
")",
";",
"// Set this 2FA code into a session variable, since",
"// this is the only opportunity to so s... | Two Factor Authorization for the front-end REGISTRATION
@param array $data
@return void | [
"Two",
"Factor",
"Authorization",
"for",
"the",
"front",
"-",
"end",
"REGISTRATION"
] | train | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php#L110-L127 |
lasallecms/lasallecms-l5-usermanagement-pkg | src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php | TwoFactorAuthHelper.isTwoFactorAuthFormTimeout | public function isTwoFactorAuthFormTimeout($userId=null, $startTime=null ) {
if (isset($userId)) {
// User wants to login, performing 2FA for this login
$startTime = strtotime($this->getUserSmsTokenCreatedAt($userId));
} else {
// New front-end registration, perfor... | php | public function isTwoFactorAuthFormTimeout($userId=null, $startTime=null ) {
if (isset($userId)) {
// User wants to login, performing 2FA for this login
$startTime = strtotime($this->getUserSmsTokenCreatedAt($userId));
} else {
// New front-end registration, perfor... | [
"public",
"function",
"isTwoFactorAuthFormTimeout",
"(",
"$",
"userId",
"=",
"null",
",",
"$",
"startTime",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"userId",
")",
")",
"{",
"// User wants to login, performing 2FA for this login",
"$",
"startTime",
"... | Has too much time passed between issuing the 2FA code and this code being
entered into the verification form?
@param int $userId User ID --> if null, then called by 2FA registration
@param datetime $startTime Time 2FA form created --> if null, then called by 2FA login
@return bool | [
"Has",
"too",
"much",
"time",
"passed",
"between",
"issuing",
"the",
"2FA",
"code",
"and",
"this",
"code",
"being",
"entered",
"into",
"the",
"verification",
"form?"
] | train | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php#L137-L172 |
lasallecms/lasallecms-l5-usermanagement-pkg | src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php | TwoFactorAuthHelper.isInputtedTwoFactorAuthCodeCorrect | public function isInputtedTwoFactorAuthCodeCorrect($userId=null) {
$inputted2faCode = $this->request->input('2facode');
if (isset($userId)) {
$sent2faCode = $this->getUserSmsToken($userId);
} else {
$sent2faCode = $this->request->session()->get('codeToInput');
... | php | public function isInputtedTwoFactorAuthCodeCorrect($userId=null) {
$inputted2faCode = $this->request->input('2facode');
if (isset($userId)) {
$sent2faCode = $this->getUserSmsToken($userId);
} else {
$sent2faCode = $this->request->session()->get('codeToInput');
... | [
"public",
"function",
"isInputtedTwoFactorAuthCodeCorrect",
"(",
"$",
"userId",
"=",
"null",
")",
"{",
"$",
"inputted2faCode",
"=",
"$",
"this",
"->",
"request",
"->",
"input",
"(",
"'2facode'",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"userId",
")",
")",
... | Did the user input the correct 2FA code?
@param int $userId User ID --> if null, then called by 2FA registration;
otherwise, called by 2FA login
@return bool | [
"Did",
"the",
"user",
"input",
"the",
"correct",
"2FA",
"code?"
] | train | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php#L182-L197 |
lasallecms/lasallecms-l5-usermanagement-pkg | src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php | TwoFactorAuthHelper.isUserTwoFactorAuthEnabled | public function isUserTwoFactorAuthEnabled($userId) {
$result = DB::table('users')
->where('id', '=', $userId)
->value('two_factor_auth_enabled')
;
if ($result) {
return true;
}
return false;
} | php | public function isUserTwoFactorAuthEnabled($userId) {
$result = DB::table('users')
->where('id', '=', $userId)
->value('two_factor_auth_enabled')
;
if ($result) {
return true;
}
return false;
} | [
"public",
"function",
"isUserTwoFactorAuthEnabled",
"(",
"$",
"userId",
")",
"{",
"$",
"result",
"=",
"DB",
"::",
"table",
"(",
"'users'",
")",
"->",
"where",
"(",
"'id'",
",",
"'='",
",",
"$",
"userId",
")",
"->",
"value",
"(",
"'two_factor_auth_enabled'"... | Is user enabled for Two Factor Authorization
@param int $userId User ID
@return bool | [
"Is",
"user",
"enabled",
"for",
"Two",
"Factor",
"Authorization"
] | train | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php#L253-L263 |
lasallecms/lasallecms-l5-usermanagement-pkg | src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php | TwoFactorAuthHelper.existstUserCountryCodeAndPhoneNumber | public function existstUserCountryCodeAndPhoneNumber($userId) {
$countryCode = DB::table('users')
->where('id', '=', $userId)
->value('phone_country_code')
;
$phoneNumber = DB::table('users')
->where('id', '=', $userId)
->value('phone_number')
... | php | public function existstUserCountryCodeAndPhoneNumber($userId) {
$countryCode = DB::table('users')
->where('id', '=', $userId)
->value('phone_country_code')
;
$phoneNumber = DB::table('users')
->where('id', '=', $userId)
->value('phone_number')
... | [
"public",
"function",
"existstUserCountryCodeAndPhoneNumber",
"(",
"$",
"userId",
")",
"{",
"$",
"countryCode",
"=",
"DB",
"::",
"table",
"(",
"'users'",
")",
"->",
"where",
"(",
"'id'",
",",
"'='",
",",
"$",
"userId",
")",
"->",
"value",
"(",
"'phone_coun... | Does the user have a country code and phone number for 2FA?
@param int $userId User ID | [
"Does",
"the",
"user",
"have",
"a",
"country",
"code",
"and",
"phone",
"number",
"for",
"2FA?"
] | train | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php#L270-L286 |
lasallecms/lasallecms-l5-usermanagement-pkg | src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php | TwoFactorAuthHelper.updateUserRecordWithTwoFactorAuthCode | public function updateUserRecordWithTwoFactorAuthCode($codeToInput, $userId) {
$now = Carbon::now();
DB::table('users')
->where('id', $userId)
->update(['sms_token' => $codeToInput, 'sms_token_created_at' => $now] )
;
} | php | public function updateUserRecordWithTwoFactorAuthCode($codeToInput, $userId) {
$now = Carbon::now();
DB::table('users')
->where('id', $userId)
->update(['sms_token' => $codeToInput, 'sms_token_created_at' => $now] )
;
} | [
"public",
"function",
"updateUserRecordWithTwoFactorAuthCode",
"(",
"$",
"codeToInput",
",",
"$",
"userId",
")",
"{",
"$",
"now",
"=",
"Carbon",
"::",
"now",
"(",
")",
";",
"DB",
"::",
"table",
"(",
"'users'",
")",
"->",
"where",
"(",
"'id'",
",",
"$",
... | UPDATE the user record for fields "sms_token" and "sms_token_created_at"
@param text $codeToInput The code sent to the user via sms that has to be entered into a form to allow login
@param int $userId User ID
@return void | [
"UPDATE",
"the",
"user",
"record",
"for",
"fields",
"sms_token",
"and",
"sms_token_created_at"
] | train | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php#L344-L352 |
lasallecms/lasallecms-l5-usermanagement-pkg | src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php | TwoFactorAuthHelper.updateUserRecordWithLastlogin | public function updateUserRecordWithLastlogin($userId) {
$now = Carbon::now();
$ip = $this->request->getClientIp();
DB::table('users')
->where('id', $userId)
->update(['last_login' => $now, 'last_login_ip' => $ip] )
;
} | php | public function updateUserRecordWithLastlogin($userId) {
$now = Carbon::now();
$ip = $this->request->getClientIp();
DB::table('users')
->where('id', $userId)
->update(['last_login' => $now, 'last_login_ip' => $ip] )
;
} | [
"public",
"function",
"updateUserRecordWithLastlogin",
"(",
"$",
"userId",
")",
"{",
"$",
"now",
"=",
"Carbon",
"::",
"now",
"(",
")",
";",
"$",
"ip",
"=",
"$",
"this",
"->",
"request",
"->",
"getClientIp",
"(",
")",
";",
"DB",
"::",
"table",
"(",
"'... | UPDATE the user record for fields "last_login" and "last_login_ip"
This method is here because it is convenient, as this class is already injected in the auth classes
@param int $userId User ID
@return void | [
"UPDATE",
"the",
"user",
"record",
"for",
"fields",
"last_login",
"and",
"last_login_ip"
] | train | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php#L386-L395 |
lasallecms/lasallecms-l5-usermanagement-pkg | src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php | TwoFactorAuthHelper.setCookie | public function setCookie($response) {
if (!Cookie::has('successful_login')) {
// what is the cookie's lifetime, in minutes
$numberOfDays = config('lasallecmsusermanagement.auth_2fa_cookie_lifetime_days');
// the max number of days is 30, and the min is 1
if (... | php | public function setCookie($response) {
if (!Cookie::has('successful_login')) {
// what is the cookie's lifetime, in minutes
$numberOfDays = config('lasallecmsusermanagement.auth_2fa_cookie_lifetime_days');
// the max number of days is 30, and the min is 1
if (... | [
"public",
"function",
"setCookie",
"(",
"$",
"response",
")",
"{",
"if",
"(",
"!",
"Cookie",
"::",
"has",
"(",
"'successful_login'",
")",
")",
"{",
"// what is the cookie's lifetime, in minutes",
"$",
"numberOfDays",
"=",
"config",
"(",
"'lasallecmsusermanagement.au... | Set (make) the 2FA cookie
@param Illuminate\Http\Response $response
@return Illuminate\Http\Response | [
"Set",
"(",
"make",
")",
"the",
"2FA",
"cookie"
] | train | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php#L409-L432 |
lasallecms/lasallecms-l5-usermanagement-pkg | src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php | TwoFactorAuthHelper.redirectPathUponSuccessfulFrontendLogin | public function redirectPathUponSuccessfulFrontendLogin()
{
if (property_exists($this, 'redirectPath')) {
return $this->redirectPath;
}
if (property_exists($this, 'redirectPath')) {
return $this->redirectTo;
}
if (config('lasasllecmsfrontend.frontend... | php | public function redirectPathUponSuccessfulFrontendLogin()
{
if (property_exists($this, 'redirectPath')) {
return $this->redirectPath;
}
if (property_exists($this, 'redirectPath')) {
return $this->redirectTo;
}
if (config('lasasllecmsfrontend.frontend... | [
"public",
"function",
"redirectPathUponSuccessfulFrontendLogin",
"(",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
",",
"'redirectPath'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"redirectPath",
";",
"}",
"if",
"(",
"property_exists",
"(",
"$",... | Upon successful front-end login, redirect to this path
@return string | [
"Upon",
"successful",
"front",
"-",
"end",
"login",
"redirect",
"to",
"this",
"path"
] | train | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Helpers/TwoFactorAuthorization/TwoFactorAuthHelper.php#L495-L510 |
Mandarin-Medien/MMCmfContentBundle | DependencyInjection/MMCmfContentExtension.php | MMCmfContentExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$config = array();
foreach ($configs as $subConfig) {
$config = array_merge_recursive($config, $subConfig);
}
$configuration = new Configuration();
$config = $this->processConfiguration($configu... | php | public function load(array $configs, ContainerBuilder $container)
{
$config = array();
foreach ($configs as $subConfig) {
$config = array_merge_recursive($config, $subConfig);
}
$configuration = new Configuration();
$config = $this->processConfiguration($configu... | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"config",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"configs",
"as",
"$",
"subConfig",
")",
"{",
"$",
"config",
"=",
"array_me... | {@inheritdoc} | [
"{"
] | train | https://github.com/Mandarin-Medien/MMCmfContentBundle/blob/503ab31cef3ce068f767de5b72f833526355b726/DependencyInjection/MMCmfContentExtension.php#L20-L37 |
apioo/psx-validate | src/Validate.php | Validate.apply | public function apply($value, $type = self::TYPE_STRING, array $filters = array(), $title = null, $required = true)
{
$result = $this->validate($value, $type, $filters, $title, $required);
if ($result->hasError()) {
throw new ValidationException($result->getFirstError(), $title, $result... | php | public function apply($value, $type = self::TYPE_STRING, array $filters = array(), $title = null, $required = true)
{
$result = $this->validate($value, $type, $filters, $title, $required);
if ($result->hasError()) {
throw new ValidationException($result->getFirstError(), $title, $result... | [
"public",
"function",
"apply",
"(",
"$",
"value",
",",
"$",
"type",
"=",
"self",
"::",
"TYPE_STRING",
",",
"array",
"$",
"filters",
"=",
"array",
"(",
")",
",",
"$",
"title",
"=",
"null",
",",
"$",
"required",
"=",
"true",
")",
"{",
"$",
"result",
... | Applies filter on the given value and returns the value on success or
throws an exception if an error occured
@param string $value
@param string $type
@param \PSX\Validate\FilterInterface[]|callable $filters
@param string $title
@param boolean $required
@return mixed | [
"Applies",
"filter",
"on",
"the",
"given",
"value",
"and",
"returns",
"the",
"value",
"on",
"success",
"or",
"throws",
"an",
"exception",
"if",
"an",
"error",
"occured"
] | train | https://github.com/apioo/psx-validate/blob/4860c6a2c7f7ca52d3bd6d7e6ec7d6a7ddcfd83d/src/Validate.php#L53-L64 |
apioo/psx-validate | src/Validate.php | Validate.validate | public function validate($value, $type = self::TYPE_STRING, array $filters = array(), $title = null, $required = true)
{
$result = new Result();
if ($title === null) {
$title = 'Unknown';
}
if ($value === null) {
if ($required === true) {
$re... | php | public function validate($value, $type = self::TYPE_STRING, array $filters = array(), $title = null, $required = true)
{
$result = new Result();
if ($title === null) {
$title = 'Unknown';
}
if ($value === null) {
if ($required === true) {
$re... | [
"public",
"function",
"validate",
"(",
"$",
"value",
",",
"$",
"type",
"=",
"self",
"::",
"TYPE_STRING",
",",
"array",
"$",
"filters",
"=",
"array",
"(",
")",
",",
"$",
"title",
"=",
"null",
",",
"$",
"required",
"=",
"true",
")",
"{",
"$",
"result... | Applies the $filter array containing PSX\Validate\FilterInterface on the
$value. Returns a result object which contains the value and error
messages from the filter. If $required is set to true an error will be
added if the $value is null
@param string $value
@param string $type
@param \PSX\Validate\FilterInterface[]|... | [
"Applies",
"the",
"$filter",
"array",
"containing",
"PSX",
"\\",
"Validate",
"\\",
"FilterInterface",
"on",
"the",
"$value",
".",
"Returns",
"a",
"result",
"object",
"which",
"contains",
"the",
"value",
"and",
"error",
"messages",
"from",
"the",
"filter",
".",... | train | https://github.com/apioo/psx-validate/blob/4860c6a2c7f7ca52d3bd6d7e6ec7d6a7ddcfd83d/src/Validate.php#L79-L129 |
wakerscz/cms-base-module | src/Util/Validator.php | Validator.json | public static function json(IControl $field) : bool
{
try
{
Json::decode($field->getValue());
}
catch (JsonException $exception)
{
return FALSE;
}
return TRUE;
} | php | public static function json(IControl $field) : bool
{
try
{
Json::decode($field->getValue());
}
catch (JsonException $exception)
{
return FALSE;
}
return TRUE;
} | [
"public",
"static",
"function",
"json",
"(",
"IControl",
"$",
"field",
")",
":",
"bool",
"{",
"try",
"{",
"Json",
"::",
"decode",
"(",
"$",
"field",
"->",
"getValue",
"(",
")",
")",
";",
"}",
"catch",
"(",
"JsonException",
"$",
"exception",
")",
"{",... | Ověřuje JSON zda-li je obsah fieldu JSON
Pokud chcete upravovat toto pravidlo, je potřeba upravit i JS pravidlo v souboru:
Module ./assets/Common/validator/js/validator.js
@param IControl $field
@return bool | [
"Ověřuje",
"JSON",
"zda",
"-",
"li",
"je",
"obsah",
"fieldu",
"JSON",
"Pokud",
"chcete",
"upravovat",
"toto",
"pravidlo",
"je",
"potřeba",
"upravit",
"i",
"JS",
"pravidlo",
"v",
"souboru",
":",
"Module",
".",
"/",
"assets",
"/",
"Common",
"/",
"validator",... | train | https://github.com/wakerscz/cms-base-module/blob/3a14ea5d6a41999eb5b92fb956b55363806ff872/src/Util/Validator.php#L43-L55 |
LartTyler/PHP-DaybreakCommons | src/DaybreakStudios/Common/Utility/Counter.php | Counter.clear | public function clear($key = null) {
if ($key === null)
$this->counts->clear();
else
$this->counts->remove($key);
} | php | public function clear($key = null) {
if ($key === null)
$this->counts->clear();
else
$this->counts->remove($key);
} | [
"public",
"function",
"clear",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"key",
"===",
"null",
")",
"$",
"this",
"->",
"counts",
"->",
"clear",
"(",
")",
";",
"else",
"$",
"this",
"->",
"counts",
"->",
"remove",
"(",
"$",
"key",
"... | Clears the given key, or the entire counter if the key is not given.
@param mixed $key the key to clear; pass null to clear the entire counter | [
"Clears",
"the",
"given",
"key",
"or",
"the",
"entire",
"counter",
"if",
"the",
"key",
"is",
"not",
"given",
"."
] | train | https://github.com/LartTyler/PHP-DaybreakCommons/blob/db25b5d6cea9b5a1d5afc4c5548a2cbc3018bc0d/src/DaybreakStudios/Common/Utility/Counter.php#L61-L66 |
LartTyler/PHP-DaybreakCommons | src/DaybreakStudios/Common/Utility/Counter.php | Counter.add | public function add($key, $amount) {
if (!$this->allowed($key))
throw new OutOfBoundsException(sprintf('"%s" is not an allowed key in strict mode', $key));
else if (!$this->has($key))
$this->counts->put($key, 0);
$this->counts->put($key, $this->counts->get($key) + $amount);
return $this->counts->g... | php | public function add($key, $amount) {
if (!$this->allowed($key))
throw new OutOfBoundsException(sprintf('"%s" is not an allowed key in strict mode', $key));
else if (!$this->has($key))
$this->counts->put($key, 0);
$this->counts->put($key, $this->counts->get($key) + $amount);
return $this->counts->g... | [
"public",
"function",
"add",
"(",
"$",
"key",
",",
"$",
"amount",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"allowed",
"(",
"$",
"key",
")",
")",
"throw",
"new",
"OutOfBoundsException",
"(",
"sprintf",
"(",
"'\"%s\" is not an allowed key in strict mode'",... | Adds the given amount to a key. If the key does not exist and the counter is not running in strict mode, it
will be initialized to zero.
@throws OutOfBoundsException if the counter is in strict mode and the key was not defined at construction
@param mixed $key the key to add to
@param int|float $amount the a... | [
"Adds",
"the",
"given",
"amount",
"to",
"a",
"key",
".",
"If",
"the",
"key",
"does",
"not",
"exist",
"and",
"the",
"counter",
"is",
"not",
"running",
"in",
"strict",
"mode",
"it",
"will",
"be",
"initialized",
"to",
"zero",
"."
] | train | https://github.com/LartTyler/PHP-DaybreakCommons/blob/db25b5d6cea9b5a1d5afc4c5548a2cbc3018bc0d/src/DaybreakStudios/Common/Utility/Counter.php#L78-L87 |
staticka/staticka | src/Page.php | Page.uris | public function uris()
{
$uri = (string) $this->uri;
$exists = isset($this->data['permalink']);
$exists && $uri = $this->data['permalink'];
$items = explode('/', (string) $uri);
$items = array_filter((array) $items);
return (array) array_values($items);
} | php | public function uris()
{
$uri = (string) $this->uri;
$exists = isset($this->data['permalink']);
$exists && $uri = $this->data['permalink'];
$items = explode('/', (string) $uri);
$items = array_filter((array) $items);
return (array) array_values($items);
} | [
"public",
"function",
"uris",
"(",
")",
"{",
"$",
"uri",
"=",
"(",
"string",
")",
"$",
"this",
"->",
"uri",
";",
"$",
"exists",
"=",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'permalink'",
"]",
")",
";",
"$",
"exists",
"&&",
"$",
"uri",
"=... | Returns an array of URI segments.
@return array | [
"Returns",
"an",
"array",
"of",
"URI",
"segments",
"."
] | train | https://github.com/staticka/staticka/blob/6e3b814c391ed03b0bd409803e11579bae677ce4/src/Page.php#L80-L93 |
staticka/staticka | src/Page.php | Page.layout | public function layout()
{
$exists = (boolean) isset($this->data['layout']);
return $exists ? $this->data['layout'] : null;
} | php | public function layout()
{
$exists = (boolean) isset($this->data['layout']);
return $exists ? $this->data['layout'] : null;
} | [
"public",
"function",
"layout",
"(",
")",
"{",
"$",
"exists",
"=",
"(",
"boolean",
")",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'layout'",
"]",
")",
";",
"return",
"$",
"exists",
"?",
"$",
"this",
"->",
"data",
"[",
"'layout'",
"]",
":",
"... | Returns the layout of the page.
@return string|null | [
"Returns",
"the",
"layout",
"of",
"the",
"page",
"."
] | train | https://github.com/staticka/staticka/blob/6e3b814c391ed03b0bd409803e11579bae677ce4/src/Page.php#L100-L105 |
SCLInternet/SclZfGenericMapper | src/SclZfGenericMapper/DoctrineMapper.php | DoctrineMapper.save | public function save($entity)
{
$this->checkIsEntity($entity);
if (null !== $this->flushLock) {
$this->flushLock->lock();
$this->entityManager->persist($entity);
return $this->flushLock->unlock();
}
$this->entityManager->persist($entity);
... | php | public function save($entity)
{
$this->checkIsEntity($entity);
if (null !== $this->flushLock) {
$this->flushLock->lock();
$this->entityManager->persist($entity);
return $this->flushLock->unlock();
}
$this->entityManager->persist($entity);
... | [
"public",
"function",
"save",
"(",
"$",
"entity",
")",
"{",
"$",
"this",
"->",
"checkIsEntity",
"(",
"$",
"entity",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"flushLock",
")",
"{",
"$",
"this",
"->",
"flushLock",
"->",
"lock",
"(",
")"... | {@inheritDoc} | [
"{"
] | train | https://github.com/SCLInternet/SclZfGenericMapper/blob/c61c61546bfbc07e9c9a4b425e8e02fd7182d80b/src/SclZfGenericMapper/DoctrineMapper.php#L59-L76 |
SCLInternet/SclZfGenericMapper | src/SclZfGenericMapper/DoctrineMapper.php | DoctrineMapper.remove | public function remove($entity)
{
$this->checkIsEntity($entity);
if (null !== $this->flushLock) {
$this->flushLock->lock();
$this->entityManager->remove($entity);
return $this->flushLock->unlock();
}
$this->entityManager->remove($entity);
... | php | public function remove($entity)
{
$this->checkIsEntity($entity);
if (null !== $this->flushLock) {
$this->flushLock->lock();
$this->entityManager->remove($entity);
return $this->flushLock->unlock();
}
$this->entityManager->remove($entity);
... | [
"public",
"function",
"remove",
"(",
"$",
"entity",
")",
"{",
"$",
"this",
"->",
"checkIsEntity",
"(",
"$",
"entity",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"flushLock",
")",
"{",
"$",
"this",
"->",
"flushLock",
"->",
"lock",
"(",
"... | {@inheritDoc} | [
"{"
] | train | https://github.com/SCLInternet/SclZfGenericMapper/blob/c61c61546bfbc07e9c9a4b425e8e02fd7182d80b/src/SclZfGenericMapper/DoctrineMapper.php#L105-L122 |
kaiohken1982/Neobazaar | src/Neobazaar/Entity/Repository/UserRepository.php | UserRepository.get | public function get($user, ServiceManager $sm)
{
if(!$user instanceof UserEntity) {
if(is_numeric($user)) {
$user = $this->find($user);
} else {
if(self::CURRENT_KEYWORD == $user) {
// @todo Not a wok of the repo, do it in another place!
$zfcUserAuth = $sm->get('ControllerPluginManager')-... | php | public function get($user, ServiceManager $sm)
{
if(!$user instanceof UserEntity) {
if(is_numeric($user)) {
$user = $this->find($user);
} else {
if(self::CURRENT_KEYWORD == $user) {
// @todo Not a wok of the repo, do it in another place!
$zfcUserAuth = $sm->get('ControllerPluginManager')-... | [
"public",
"function",
"get",
"(",
"$",
"user",
",",
"ServiceManager",
"$",
"sm",
")",
"{",
"if",
"(",
"!",
"$",
"user",
"instanceof",
"UserEntity",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"user",
")",
")",
"{",
"$",
"user",
"=",
"$",
"this",
... | Return a normalized representation of a document
@param int|\Neobazaar\Entity\Document $id
@return \stdClass | [
"Return",
"a",
"normalized",
"representation",
"of",
"a",
"document"
] | train | https://github.com/kaiohken1982/Neobazaar/blob/288c972dea981d715c4e136edb5dba0318c9e6cb/src/Neobazaar/Entity/Repository/UserRepository.php#L32-L57 |
kaiohken1982/Neobazaar | src/Neobazaar/Entity/Repository/UserRepository.php | UserRepository.getList | public function getList($params = array(), ServiceManager $sm)
{
$page = isset($params['page']) ? (int)$params['page'] : 1;
unset($params['page']);
$params['limit'] = isset($params['limit']) ? (int) $params['limit'] : 30;
// The eventual presence of 'offset' key has priority over calculated 'page' value
... | php | public function getList($params = array(), ServiceManager $sm)
{
$page = isset($params['page']) ? (int)$params['page'] : 1;
unset($params['page']);
$params['limit'] = isset($params['limit']) ? (int) $params['limit'] : 30;
// The eventual presence of 'offset' key has priority over calculated 'page' value
... | [
"public",
"function",
"getList",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"ServiceManager",
"$",
"sm",
")",
"{",
"$",
"page",
"=",
"isset",
"(",
"$",
"params",
"[",
"'page'",
"]",
")",
"?",
"(",
"int",
")",
"$",
"params",
"[",
"'page'",
"... | User list
@param unknown $params
@param ServiceLocatorAwareInterface $sm
@throws \Exception
@return array | [
"User",
"list"
] | train | https://github.com/kaiohken1982/Neobazaar/blob/288c972dea981d715c4e136edb5dba0318c9e6cb/src/Neobazaar/Entity/Repository/UserRepository.php#L67-L104 |
kaiohken1982/Neobazaar | src/Neobazaar/Entity/Repository/UserRepository.php | UserRepository.getPaginator | public function getPaginator($params = array())
{
$page = isset($params['page']) ? (int)$params['page'] : 1;
$email = isset($params['email']) ? $params['email'] : null;
$limit = isset($params['limit']) ? (int) $params['limit'] : 10;
$offset = isset($params['offset']) ? (int) $params['offset'] : 0;
$qb... | php | public function getPaginator($params = array())
{
$page = isset($params['page']) ? (int)$params['page'] : 1;
$email = isset($params['email']) ? $params['email'] : null;
$limit = isset($params['limit']) ? (int) $params['limit'] : 10;
$offset = isset($params['offset']) ? (int) $params['offset'] : 0;
$qb... | [
"public",
"function",
"getPaginator",
"(",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"page",
"=",
"isset",
"(",
"$",
"params",
"[",
"'page'",
"]",
")",
"?",
"(",
"int",
")",
"$",
"params",
"[",
"'page'",
"]",
":",
"1",
";",
"$",
"em... | Return the paginator
@param array $params
@return \Zend\Paginator\Paginator | [
"Return",
"the",
"paginator"
] | train | https://github.com/kaiohken1982/Neobazaar/blob/288c972dea981d715c4e136edb5dba0318c9e6cb/src/Neobazaar/Entity/Repository/UserRepository.php#L112-L149 |
bytic/auth | src/Models/Users/Traits/Authentication/AuthenticationUserTrait.php | AuthenticationUserTrait.authenticate | public function authenticate($request = [])
{
if ($request) {
$this->email = clean($request['email']);
$this->password = $this->getPasswordHelper()->hash(clean($request['password']));
} else {
$this->password = $this->getPasswordHelper()->hash(clean($this->passwor... | php | public function authenticate($request = [])
{
if ($request) {
$this->email = clean($request['email']);
$this->password = $this->getPasswordHelper()->hash(clean($request['password']));
} else {
$this->password = $this->getPasswordHelper()->hash(clean($this->passwor... | [
"public",
"function",
"authenticate",
"(",
"$",
"request",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"email",
"=",
"clean",
"(",
"$",
"request",
"[",
"'email'",
"]",
")",
";",
"$",
"this",
"->",
"password",
... | Authenticate user from request
@param array $request
@return bool|null | [
"Authenticate",
"user",
"from",
"request"
] | train | https://github.com/bytic/auth/blob/c155687840e9cd160e0c55a94f24a3608f72604c/src/Models/Users/Traits/Authentication/AuthenticationUserTrait.php#L36-L59 |
asen477/gaussian_blur | src/ImagesGaussianBlur.php | ImagesGaussianBlur.gaussian_blur | public function gaussian_blur($srcImg,$savepath=null,$savename=null,$blurFactor=3){
$is_img_files = @file_exists($srcImg);
if(empty($is_img_files)) return '图片不存在'; //保存失败
$gdImageResource=$this->image_create_from_ext($srcImg);
$srcImgObj=$this->blur($gdImageResource,$blurFactor);
... | php | public function gaussian_blur($srcImg,$savepath=null,$savename=null,$blurFactor=3){
$is_img_files = @file_exists($srcImg);
if(empty($is_img_files)) return '图片不存在'; //保存失败
$gdImageResource=$this->image_create_from_ext($srcImg);
$srcImgObj=$this->blur($gdImageResource,$blurFactor);
... | [
"public",
"function",
"gaussian_blur",
"(",
"$",
"srcImg",
",",
"$",
"savepath",
"=",
"null",
",",
"$",
"savename",
"=",
"null",
",",
"$",
"blurFactor",
"=",
"3",
")",
"{",
"$",
"is_img_files",
"=",
"@",
"file_exists",
"(",
"$",
"srcImg",
")",
";",
"... | 图片高斯模糊(适用于png/jpg/gif格式)
@param $srcImg 原图片
@param $savepath 保存路径
@param $savename 保存名字
@param $positon 模糊程度
基于Martijn Frazer代码的扩充, 感谢 Martijn Frazer | [
"图片高斯模糊(适用于png",
"/",
"jpg",
"/",
"gif格式)",
"@param",
"$srcImg",
"原图片",
"@param",
"$savepath",
"保存路径",
"@param",
"$savename",
"保存名字",
"@param",
"$positon",
"模糊程度"
] | train | https://github.com/asen477/gaussian_blur/blob/1d4ef3e317041b159ab288d17dddd3b6154043a5/src/ImagesGaussianBlur.php#L20-L43 |
asen477/gaussian_blur | src/ImagesGaussianBlur.php | ImagesGaussianBlur.blur | private function blur($gdImageResource, $blurFactor = 3)
{
// blurFactor has to be an integer
$blurFactor = round($blurFactor);
$originalWidth = imagesx($gdImageResource);
$originalHeight = imagesy($gdImageResource);
$smallestWidth = ceil($originalWidth * po... | php | private function blur($gdImageResource, $blurFactor = 3)
{
// blurFactor has to be an integer
$blurFactor = round($blurFactor);
$originalWidth = imagesx($gdImageResource);
$originalHeight = imagesy($gdImageResource);
$smallestWidth = ceil($originalWidth * po... | [
"private",
"function",
"blur",
"(",
"$",
"gdImageResource",
",",
"$",
"blurFactor",
"=",
"3",
")",
"{",
"// blurFactor has to be an integer ",
"$",
"blurFactor",
"=",
"round",
"(",
"$",
"blurFactor",
")",
";",
"$",
"originalWidth",
"=",
"imagesx",
"(",
"$",
... | Strong Blur
@param $gdImageResource 图片资源
@param $blurFactor 可选择的模糊程度
可选择的模糊程度 0使用 3默认 超过5时 极其模糊
@return GD image 图片资源类型
@author Martijn Frazer, idea based on http://stackoverflow.com/a/20264482 | [
"Strong",
"Blur"
] | train | https://github.com/asen477/gaussian_blur/blob/1d4ef3e317041b159ab288d17dddd3b6154043a5/src/ImagesGaussianBlur.php#L54-L101 |
OxfordInfoLabs/kinikit-core | src/Util/Multithreading/Thread.php | Thread.run | public function run($parameters = array()) {
// Grab a process ID for a new forked process
$this->pid = \pcntl_fork();
if (!$this->pid) {
$this->process($parameters);
posix_kill(getmypid(), 9);
}
return $this->pid;
} | php | public function run($parameters = array()) {
// Grab a process ID for a new forked process
$this->pid = \pcntl_fork();
if (!$this->pid) {
$this->process($parameters);
posix_kill(getmypid(), 9);
}
return $this->pid;
} | [
"public",
"function",
"run",
"(",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"// Grab a process ID for a new forked process",
"$",
"this",
"->",
"pid",
"=",
"\\",
"pcntl_fork",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"pid",
")",
"{",
... | Main run method called to start the thread. | [
"Main",
"run",
"method",
"called",
"to",
"start",
"the",
"thread",
"."
] | train | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Multithreading/Thread.php#L22-L33 |
OxfordInfoLabs/kinikit-core | src/Util/Multithreading/Thread.php | Thread.wait | public function wait() {
if ($this->pid) {
\pcntl_waitpid($this->pid, $status, WUNTRACED);
return $status;
} else {
return false;
}
} | php | public function wait() {
if ($this->pid) {
\pcntl_waitpid($this->pid, $status, WUNTRACED);
return $status;
} else {
return false;
}
} | [
"public",
"function",
"wait",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"pid",
")",
"{",
"\\",
"pcntl_waitpid",
"(",
"$",
"this",
"->",
"pid",
",",
"$",
"status",
",",
"WUNTRACED",
")",
";",
"return",
"$",
"status",
";",
"}",
"else",
"{",
"ret... | Blocking method called by another thread which waits until this
thread has completed. | [
"Blocking",
"method",
"called",
"by",
"another",
"thread",
"which",
"waits",
"until",
"this",
"thread",
"has",
"completed",
"."
] | train | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Multithreading/Thread.php#L40-L47 |
OxfordInfoLabs/kinikit-core | src/Util/Multithreading/Thread.php | Thread.getStatus | public function getStatus() {
if ($this->pid) {
$waitPID = \pcntl_waitpid($this->pid, $status, WNOHANG);
if ($waitPID == $this->pid) {
return Thread::THREAD_EXITED;
} else {
return Thread::THREAD_RUNNING;
}
}
} | php | public function getStatus() {
if ($this->pid) {
$waitPID = \pcntl_waitpid($this->pid, $status, WNOHANG);
if ($waitPID == $this->pid) {
return Thread::THREAD_EXITED;
} else {
return Thread::THREAD_RUNNING;
}
}
} | [
"public",
"function",
"getStatus",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"pid",
")",
"{",
"$",
"waitPID",
"=",
"\\",
"pcntl_waitpid",
"(",
"$",
"this",
"->",
"pid",
",",
"$",
"status",
",",
"WNOHANG",
")",
";",
"if",
"(",
"$",
"waitPID",
"... | Get the current status for this thread. | [
"Get",
"the",
"current",
"status",
"for",
"this",
"thread",
"."
] | train | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Multithreading/Thread.php#L53-L63 |
miBadger/miBadger.Settings | src/Settings.php | Settings.load | public function load($path = self::DEFAULT_FILENAME)
{
$file = new File($path);
if (($data = json_decode($file->read(), true)) === null) {
throw new \UnexpectedValueException('Invalid JSON.');
}
$this->data = (array) $data;
return $this;
} | php | public function load($path = self::DEFAULT_FILENAME)
{
$file = new File($path);
if (($data = json_decode($file->read(), true)) === null) {
throw new \UnexpectedValueException('Invalid JSON.');
}
$this->data = (array) $data;
return $this;
} | [
"public",
"function",
"load",
"(",
"$",
"path",
"=",
"self",
"::",
"DEFAULT_FILENAME",
")",
"{",
"$",
"file",
"=",
"new",
"File",
"(",
"$",
"path",
")",
";",
"if",
"(",
"(",
"$",
"data",
"=",
"json_decode",
"(",
"$",
"file",
"->",
"read",
"(",
")... | Load the settings file from the given location.
@param $path = self::DEFAULT_FILENAME
@return $this
@throws FileException on failure.
@throws \UnexpectedValueException on failure. | [
"Load",
"the",
"settings",
"file",
"from",
"the",
"given",
"location",
"."
] | train | https://github.com/miBadger/miBadger.Settings/blob/dc2be14d96e2db84acb9fba543099380b1f14bd8/src/Settings.php#L144-L155 |
miBadger/miBadger.Settings | src/Settings.php | Settings.save | public function save($path = self::DEFAULT_FILENAME)
{
$file = new File($path);
$file->write(json_encode($this->data));
return $this;
} | php | public function save($path = self::DEFAULT_FILENAME)
{
$file = new File($path);
$file->write(json_encode($this->data));
return $this;
} | [
"public",
"function",
"save",
"(",
"$",
"path",
"=",
"self",
"::",
"DEFAULT_FILENAME",
")",
"{",
"$",
"file",
"=",
"new",
"File",
"(",
"$",
"path",
")",
";",
"$",
"file",
"->",
"write",
"(",
"json_encode",
"(",
"$",
"this",
"->",
"data",
")",
")",
... | Save the settings file at the given location.
@param $path = self::DEFAULT_FILENAME
@return $this
@throws FileException on failure. | [
"Save",
"the",
"settings",
"file",
"at",
"the",
"given",
"location",
"."
] | train | https://github.com/miBadger/miBadger.Settings/blob/dc2be14d96e2db84acb9fba543099380b1f14bd8/src/Settings.php#L164-L171 |
WellCommerce/PaymentBundle | DataFixtures/ORM/LoadPaymentMethodData.php | LoadPaymentMethodData.load | public function load(ObjectManager $manager)
{
if (!$this->isEnabled()) {
return;
}
$faker = $this->getFakerGenerator();
$shippingMethods = new ArrayCollection();
$shippingMethods->add($this->getReference('shipping_method_fedex'));
$shippingMeth... | php | public function load(ObjectManager $manager)
{
if (!$this->isEnabled()) {
return;
}
$faker = $this->getFakerGenerator();
$shippingMethods = new ArrayCollection();
$shippingMethods->add($this->getReference('shipping_method_fedex'));
$shippingMeth... | [
"public",
"function",
"load",
"(",
"ObjectManager",
"$",
"manager",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isEnabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"faker",
"=",
"$",
"this",
"->",
"getFakerGenerator",
"(",
")",
";",
"$",
"sh... | {@inheritDoc} | [
"{"
] | train | https://github.com/WellCommerce/PaymentBundle/blob/7fdeb0b5155646f2b638082d2135bec05eb8be98/DataFixtures/ORM/LoadPaymentMethodData.php#L30-L98 |
PenoaksDev/Milky-Framework | src/Milky/Queue/Console/TableCommand.php | TableCommand.fire | public function fire()
{
$table = $this->laravel['config']['queue.connections.database.table'];
$tableClassName = Str::studly($table);
$fullPath = $this->createBaseMigration($table);
$stub = str_replace(
['{{table}}', '{{tableClassName}}'], [$table, $tableClassName], $this->files->get(__DIR__.'/stubs/job... | php | public function fire()
{
$table = $this->laravel['config']['queue.connections.database.table'];
$tableClassName = Str::studly($table);
$fullPath = $this->createBaseMigration($table);
$stub = str_replace(
['{{table}}', '{{tableClassName}}'], [$table, $tableClassName], $this->files->get(__DIR__.'/stubs/job... | [
"public",
"function",
"fire",
"(",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"laravel",
"[",
"'config'",
"]",
"[",
"'queue.connections.database.table'",
"]",
";",
"$",
"tableClassName",
"=",
"Str",
"::",
"studly",
"(",
"$",
"table",
")",
";",
"$",
... | Execute the console command.
@return void | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Queue/Console/TableCommand.php#L56-L73 |
wearenolte/wp-endpoints-routes | src/Routes.php | Routes.endpoint_callback | public function endpoint_callback( \WP_REST_Request $request ) {
$data = [];
$home_url = home_url();
$page_on_front = get_option( 'page_on_front' );
$blog_page = get_option( 'page_for_posts' );
// Create a route for each page.
$pages_query = new \WP_Query([
'post_type' => 'page',
// @codingStandar... | php | public function endpoint_callback( \WP_REST_Request $request ) {
$data = [];
$home_url = home_url();
$page_on_front = get_option( 'page_on_front' );
$blog_page = get_option( 'page_for_posts' );
// Create a route for each page.
$pages_query = new \WP_Query([
'post_type' => 'page',
// @codingStandar... | [
"public",
"function",
"endpoint_callback",
"(",
"\\",
"WP_REST_Request",
"$",
"request",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"home_url",
"=",
"home_url",
"(",
")",
";",
"$",
"page_on_front",
"=",
"get_option",
"(",
"'page_on_front'",
")",
";",
... | Get the data.
@Override
@param \WP_REST_Request $request The request.
@return array|\WP_Error | [
"Get",
"the",
"data",
"."
] | train | https://github.com/wearenolte/wp-endpoints-routes/blob/d86e77908f9d7ddc862d1a902cd8d2d7c0449473/src/Routes.php#L41-L84 |
wearenolte/wp-endpoints-routes | src/Routes.php | Routes.get_blog_routes | private function get_blog_routes() {
$data = [];
$blog_url = false;
$home_url = home_url();
$page_on_front = get_option( 'page_on_front' );
$blog_page = get_option( 'page_for_posts' );
if ( ! $page_on_front ) {
$blog_url = '/';
} elseif ( $blog_page ) {
$blog_url = rtrim( str_replace( $home_url... | php | private function get_blog_routes() {
$data = [];
$blog_url = false;
$home_url = home_url();
$page_on_front = get_option( 'page_on_front' );
$blog_page = get_option( 'page_for_posts' );
if ( ! $page_on_front ) {
$blog_url = '/';
} elseif ( $blog_page ) {
$blog_url = rtrim( str_replace( $home_url... | [
"private",
"function",
"get_blog_routes",
"(",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"blog_url",
"=",
"false",
";",
"$",
"home_url",
"=",
"home_url",
"(",
")",
";",
"$",
"page_on_front",
"=",
"get_option",
"(",
"'page_on_front'",
")",
";",
"$... | Create routes for the blog page and single posts if active..
@return array | [
"Create",
"routes",
"for",
"the",
"blog",
"page",
"and",
"single",
"posts",
"if",
"active",
".."
] | train | https://github.com/wearenolte/wp-endpoints-routes/blob/d86e77908f9d7ddc862d1a902cd8d2d7c0449473/src/Routes.php#L91-L131 |
phpguard/plugin-behat | src/Session.php | Session.serialize | public function serialize()
{
$data = array(
'features' => $this->features,
'scenarios' => $this->scenarios,
'steps' => $this->steps,
'results' => $this->results,
'path' => $this->path,
'fs' => $this->fs,
);
... | php | public function serialize()
{
$data = array(
'features' => $this->features,
'scenarios' => $this->scenarios,
'steps' => $this->steps,
'results' => $this->results,
'path' => $this->path,
'fs' => $this->fs,
);
... | [
"public",
"function",
"serialize",
"(",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"'features'",
"=>",
"$",
"this",
"->",
"features",
",",
"'scenarios'",
"=>",
"$",
"this",
"->",
"scenarios",
",",
"'steps'",
"=>",
"$",
"this",
"->",
"steps",
",",
"'resu... | {inheritdoc} | [
"{",
"inheritdoc",
"}"
] | train | https://github.com/phpguard/plugin-behat/blob/9fa140c4355935196943d2bd8f84232cde1d7d15/src/Session.php#L84-L96 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.