repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
chilimatic/chilimatic-framework | lib/file/File.php | File._get_path | private function _get_path()
{
if (empty($this->file) && is_string($this->file)) return false;
if (strpos($this->file, '/') !== false) {
$path = explode('/', $this->file);
array_pop($path);
$this->path = (string)implode('/', $path) . '/';
} elseif (strpo... | php | private function _get_path()
{
if (empty($this->file) && is_string($this->file)) return false;
if (strpos($this->file, '/') !== false) {
$path = explode('/', $this->file);
array_pop($path);
$this->path = (string)implode('/', $path) . '/';
} elseif (strpo... | [
"private",
"function",
"_get_path",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"file",
")",
"&&",
"is_string",
"(",
"$",
"this",
"->",
"file",
")",
")",
"return",
"false",
";",
"if",
"(",
"strpos",
"(",
"$",
"this",
"->",
"file",
... | gets the filename out of the entered path
@return bool | [
"gets",
"the",
"filename",
"out",
"of",
"the",
"entered",
"path"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/file/File.php#L405-L423 | train |
chilimatic/chilimatic-framework | lib/file/File.php | File.open | public function open($filename)
{
if (!is_file($filename)) return false;
$this->file = @(string)$filename;
$this->group = @(int)filegroup($filename);
$this->owner = @(int)fileowner($filename);
$this->size = @(int)filesize($filename);
$this->typ... | php | public function open($filename)
{
if (!is_file($filename)) return false;
$this->file = @(string)$filename;
$this->group = @(int)filegroup($filename);
$this->owner = @(int)fileowner($filename);
$this->size = @(int)filesize($filename);
$this->typ... | [
"public",
"function",
"open",
"(",
"$",
"filename",
")",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"filename",
")",
")",
"return",
"false",
";",
"$",
"this",
"->",
"file",
"=",
"@",
"(",
"string",
")",
"$",
"filename",
";",
"$",
"this",
"->",
"gr... | gets all the information about the file
@param $filename string
@return bool | [
"gets",
"all",
"the",
"information",
"about",
"the",
"file"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/file/File.php#L433-L456 | train |
chilimatic/chilimatic-framework | lib/file/File.php | File.open_fp | function open_fp($option = 'r')
{
if (empty($option) || !is_string($option)) return false;
switch (true) {
case (strpos($option, 'r') !== false) :
$mode = LOCK_SH;
break;
case (strpos($option, 'a') !== false || strpos($option, 'w') !== false)... | php | function open_fp($option = 'r')
{
if (empty($option) || !is_string($option)) return false;
switch (true) {
case (strpos($option, 'r') !== false) :
$mode = LOCK_SH;
break;
case (strpos($option, 'a') !== false || strpos($option, 'w') !== false)... | [
"function",
"open_fp",
"(",
"$",
"option",
"=",
"'r'",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"option",
")",
"||",
"!",
"is_string",
"(",
"$",
"option",
")",
")",
"return",
"false",
";",
"switch",
"(",
"true",
")",
"{",
"case",
"(",
"strpos",
"(... | opens a filepointer
@param $option string
@return bool | [
"opens",
"a",
"filepointer"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/file/File.php#L466-L494 | train |
chilimatic/chilimatic-framework | lib/file/File.php | File.read | public function read()
{
// if file is readable
if ($this->readable !== true) return false;
if (!empty($this->fp) && is_resource($this->fp)) fclose($this->fp);
$this->open_fp('r');
if (filesize($this->file) == 0) return false;
$this->lock(LOCK_SH);
$conte... | php | public function read()
{
// if file is readable
if ($this->readable !== true) return false;
if (!empty($this->fp) && is_resource($this->fp)) fclose($this->fp);
$this->open_fp('r');
if (filesize($this->file) == 0) return false;
$this->lock(LOCK_SH);
$conte... | [
"public",
"function",
"read",
"(",
")",
"{",
"// if file is readable",
"if",
"(",
"$",
"this",
"->",
"readable",
"!==",
"true",
")",
"return",
"false",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fp",
")",
"&&",
"is_resource",
"(",
"$",
"t... | read the current content of the file
@return string | [
"read",
"the",
"current",
"content",
"of",
"the",
"file"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/file/File.php#L502-L520 | train |
phramework/testphase | src/Binary.php | Binary.getArgumentSpecifications | public static function getArgumentSpecifications()
{
$specs = new OptionCollection;
$specs->add('d|dir:', 'Tests directory path')
->isa('String');
$specs->add('s|subdir+', 'Optional, subdirectory pattern, can be used multiple times as OR expression')
->isa('String')
... | php | public static function getArgumentSpecifications()
{
$specs = new OptionCollection;
$specs->add('d|dir:', 'Tests directory path')
->isa('String');
$specs->add('s|subdir+', 'Optional, subdirectory pattern, can be used multiple times as OR expression')
->isa('String')
... | [
"public",
"static",
"function",
"getArgumentSpecifications",
"(",
")",
"{",
"$",
"specs",
"=",
"new",
"OptionCollection",
";",
"$",
"specs",
"->",
"add",
"(",
"'d|dir:'",
",",
"'Tests directory path'",
")",
"->",
"isa",
"(",
"'String'",
")",
";",
"$",
"specs... | Get argument specifications
@return OptionCollection | [
"Get",
"argument",
"specifications"
] | b00107b7a37cf1a1b9b8860b3eb031aacfa2634c | https://github.com/phramework/testphase/blob/b00107b7a37cf1a1b9b8860b3eb031aacfa2634c/src/Binary.php#L52-L79 | train |
phramework/testphase | src/Binary.php | Binary.colored | public function colored($text, $color)
{
$colors = [
'black' => '0;30',
'red' => '0;31',
'green' => '0;32',
'blue' => '1;34',
'yellow' => '1;33'
];
$c = (
array_key_exists($color, $colors)
? $colors[$... | php | public function colored($text, $color)
{
$colors = [
'black' => '0;30',
'red' => '0;31',
'green' => '0;32',
'blue' => '1;34',
'yellow' => '1;33'
];
$c = (
array_key_exists($color, $colors)
? $colors[$... | [
"public",
"function",
"colored",
"(",
"$",
"text",
",",
"$",
"color",
")",
"{",
"$",
"colors",
"=",
"[",
"'black'",
"=>",
"'0;30'",
",",
"'red'",
"=>",
"'0;31'",
",",
"'green'",
"=>",
"'0;32'",
",",
"'blue'",
"=>",
"'1;34'",
",",
"'yellow'",
"=>",
"'... | Returned colored text
@param string $text
@param string $color
@return string | [
"Returned",
"colored",
"text"
] | b00107b7a37cf1a1b9b8860b3eb031aacfa2634c | https://github.com/phramework/testphase/blob/b00107b7a37cf1a1b9b8860b3eb031aacfa2634c/src/Binary.php#L504-L525 | train |
newup/core | src/Foundation/Composer/AutoLoaderManager.php | AutoLoaderManager.mergePackageLoader | public function mergePackageLoader($directory)
{
if ($vendor = $this->findVendor($directory)) {
$this->mergeComposerNamespaces($vendor);
$this->mergeComposerPsr4($vendor);
$this->mergeComposerClassMap($vendor);
}
} | php | public function mergePackageLoader($directory)
{
if ($vendor = $this->findVendor($directory)) {
$this->mergeComposerNamespaces($vendor);
$this->mergeComposerPsr4($vendor);
$this->mergeComposerClassMap($vendor);
}
} | [
"public",
"function",
"mergePackageLoader",
"(",
"$",
"directory",
")",
"{",
"if",
"(",
"$",
"vendor",
"=",
"$",
"this",
"->",
"findVendor",
"(",
"$",
"directory",
")",
")",
"{",
"$",
"this",
"->",
"mergeComposerNamespaces",
"(",
"$",
"vendor",
")",
";",... | Autoloads a packages dependencies by merging them with the current auto-loader.
@param $directory | [
"Autoloads",
"a",
"packages",
"dependencies",
"by",
"merging",
"them",
"with",
"the",
"current",
"auto",
"-",
"loader",
"."
] | 54128903e7775e67d63284d958b46862c8df71f9 | https://github.com/newup/core/blob/54128903e7775e67d63284d958b46862c8df71f9/src/Foundation/Composer/AutoLoaderManager.php#L48-L55 | train |
newup/core | src/Foundation/Composer/AutoLoaderManager.php | AutoLoaderManager.mergeComposerNamespaces | private function mergeComposerNamespaces($vendor)
{
if ($namespaceFile = $this->findComposerDirectory($vendor, 'autoload_namespaces.php')) {
$this->log->debug('Located autoload_namespaces.php file', ['path' => $namespaceFile]);
$map = require $namespaceFile;
foreach ($map... | php | private function mergeComposerNamespaces($vendor)
{
if ($namespaceFile = $this->findComposerDirectory($vendor, 'autoload_namespaces.php')) {
$this->log->debug('Located autoload_namespaces.php file', ['path' => $namespaceFile]);
$map = require $namespaceFile;
foreach ($map... | [
"private",
"function",
"mergeComposerNamespaces",
"(",
"$",
"vendor",
")",
"{",
"if",
"(",
"$",
"namespaceFile",
"=",
"$",
"this",
"->",
"findComposerDirectory",
"(",
"$",
"vendor",
",",
"'autoload_namespaces.php'",
")",
")",
"{",
"$",
"this",
"->",
"log",
"... | Merges the dependencies namespaces.
@param $vendor | [
"Merges",
"the",
"dependencies",
"namespaces",
"."
] | 54128903e7775e67d63284d958b46862c8df71f9 | https://github.com/newup/core/blob/54128903e7775e67d63284d958b46862c8df71f9/src/Foundation/Composer/AutoLoaderManager.php#L62-L72 | train |
newup/core | src/Foundation/Composer/AutoLoaderManager.php | AutoLoaderManager.mergeComposerPsr4 | private function mergeComposerPsr4($vendor)
{
if ($psr4Autoload = $this->findComposerDirectory($vendor, 'autoload_psr4.php')) {
$this->log->debug('Located autoload_psr4.php file', ['path' => $psr4Autoload]);
$map = require $psr4Autoload;
foreach ($map as $namespace => $pa... | php | private function mergeComposerPsr4($vendor)
{
if ($psr4Autoload = $this->findComposerDirectory($vendor, 'autoload_psr4.php')) {
$this->log->debug('Located autoload_psr4.php file', ['path' => $psr4Autoload]);
$map = require $psr4Autoload;
foreach ($map as $namespace => $pa... | [
"private",
"function",
"mergeComposerPsr4",
"(",
"$",
"vendor",
")",
"{",
"if",
"(",
"$",
"psr4Autoload",
"=",
"$",
"this",
"->",
"findComposerDirectory",
"(",
"$",
"vendor",
",",
"'autoload_psr4.php'",
")",
")",
"{",
"$",
"this",
"->",
"log",
"->",
"debug... | Merges the dependencies PSR-4 namespaces.
@param $vendor | [
"Merges",
"the",
"dependencies",
"PSR",
"-",
"4",
"namespaces",
"."
] | 54128903e7775e67d63284d958b46862c8df71f9 | https://github.com/newup/core/blob/54128903e7775e67d63284d958b46862c8df71f9/src/Foundation/Composer/AutoLoaderManager.php#L79-L89 | train |
newup/core | src/Foundation/Composer/AutoLoaderManager.php | AutoLoaderManager.mergeComposerClassMap | private function mergeComposerClassMap($vendor)
{
if ($composerClassMap = $this->findComposerDirectory($vendor, 'autoload_classmap.php')) {
$this->log->debug('Located autoload_classmap.php file', ['path' => $composerClassMap]);
$classMap = require $composerClassMap;
if ($... | php | private function mergeComposerClassMap($vendor)
{
if ($composerClassMap = $this->findComposerDirectory($vendor, 'autoload_classmap.php')) {
$this->log->debug('Located autoload_classmap.php file', ['path' => $composerClassMap]);
$classMap = require $composerClassMap;
if ($... | [
"private",
"function",
"mergeComposerClassMap",
"(",
"$",
"vendor",
")",
"{",
"if",
"(",
"$",
"composerClassMap",
"=",
"$",
"this",
"->",
"findComposerDirectory",
"(",
"$",
"vendor",
",",
"'autoload_classmap.php'",
")",
")",
"{",
"$",
"this",
"->",
"log",
"-... | Merges the dependencies class maps.
@param $vendor | [
"Merges",
"the",
"dependencies",
"class",
"maps",
"."
] | 54128903e7775e67d63284d958b46862c8df71f9 | https://github.com/newup/core/blob/54128903e7775e67d63284d958b46862c8df71f9/src/Foundation/Composer/AutoLoaderManager.php#L96-L105 | train |
newup/core | src/Foundation/Composer/AutoLoaderManager.php | AutoLoaderManager.findComposerDirectory | private function findComposerDirectory($vendor, $file = '')
{
$composerDirectory = $this->normalizePath($vendor . '/composer/' . $file);
if ($this->files->exists($composerDirectory)) {
return $composerDirectory;
}
return false;
} | php | private function findComposerDirectory($vendor, $file = '')
{
$composerDirectory = $this->normalizePath($vendor . '/composer/' . $file);
if ($this->files->exists($composerDirectory)) {
return $composerDirectory;
}
return false;
} | [
"private",
"function",
"findComposerDirectory",
"(",
"$",
"vendor",
",",
"$",
"file",
"=",
"''",
")",
"{",
"$",
"composerDirectory",
"=",
"$",
"this",
"->",
"normalizePath",
"(",
"$",
"vendor",
".",
"'/composer/'",
".",
"$",
"file",
")",
";",
"if",
"(",
... | Finds the composer directory.
Returns false if the directory does not exist.
@param $vendor The vendor directory.
@param string $file An optional file to look for.
@return bool|string | [
"Finds",
"the",
"composer",
"directory",
"."
] | 54128903e7775e67d63284d958b46862c8df71f9 | https://github.com/newup/core/blob/54128903e7775e67d63284d958b46862c8df71f9/src/Foundation/Composer/AutoLoaderManager.php#L116-L125 | train |
newup/core | src/Foundation/Composer/AutoLoaderManager.php | AutoLoaderManager.findVendor | private function findVendor($directory)
{
$vendorDirectory = $this->normalizePath($directory . '/_newup_vendor');
if ($this->files->exists($vendorDirectory) && $this->files->isDirectory($vendorDirectory)) {
return $vendorDirectory;
}
return false;
} | php | private function findVendor($directory)
{
$vendorDirectory = $this->normalizePath($directory . '/_newup_vendor');
if ($this->files->exists($vendorDirectory) && $this->files->isDirectory($vendorDirectory)) {
return $vendorDirectory;
}
return false;
} | [
"private",
"function",
"findVendor",
"(",
"$",
"directory",
")",
"{",
"$",
"vendorDirectory",
"=",
"$",
"this",
"->",
"normalizePath",
"(",
"$",
"directory",
".",
"'/_newup_vendor'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"files",
"->",
"exists",
"(",
"... | Gets the vendor directory location if it exists.
Returns false if the vendor directory does not exist.
@param $directory
@return bool|string | [
"Gets",
"the",
"vendor",
"directory",
"location",
"if",
"it",
"exists",
"."
] | 54128903e7775e67d63284d958b46862c8df71f9 | https://github.com/newup/core/blob/54128903e7775e67d63284d958b46862c8df71f9/src/Foundation/Composer/AutoLoaderManager.php#L135-L144 | train |
kiler129/TinyWs | src/WebSocketClient.php | WebSocketClient.disconnect | public function disconnect($drop = false)
{
$this->handler->onClose($this);
parent::disconnect($drop);
} | php | public function disconnect($drop = false)
{
$this->handler->onClose($this);
parent::disconnect($drop);
} | [
"public",
"function",
"disconnect",
"(",
"$",
"drop",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"handler",
"->",
"onClose",
"(",
"$",
"this",
")",
";",
"parent",
"::",
"disconnect",
"(",
"$",
"drop",
")",
";",
"}"
] | Disconnects client from server.
It also notifies clients handler about that fact.
@param bool $drop By default client is disconnected after delivering output buffer contents. Set to true to drop
it immediately.
@return void | [
"Disconnects",
"client",
"from",
"server",
".",
"It",
"also",
"notifies",
"clients",
"handler",
"about",
"that",
"fact",
"."
] | 85f0335b87b3ec73ab47f5a5631eb86ba70b64a1 | https://github.com/kiler129/TinyWs/blob/85f0335b87b3ec73ab47f5a5631eb86ba70b64a1/src/WebSocketClient.php#L52-L56 | train |
kiler129/TinyWs | src/WebSocketClient.php | WebSocketClient.ping | public function ping($payload = null)
{
if ($payload === null) {
$payload = microtime(true);
} elseif (isset($payload[125])) { //Much faster than strlen($payload) > 125
throw new LengthException("Ping payload cannot be larger than 125 bytes");
}
$this->curre... | php | public function ping($payload = null)
{
if ($payload === null) {
$payload = microtime(true);
} elseif (isset($payload[125])) { //Much faster than strlen($payload) > 125
throw new LengthException("Ping payload cannot be larger than 125 bytes");
}
$this->curre... | [
"public",
"function",
"ping",
"(",
"$",
"payload",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"payload",
"===",
"null",
")",
"{",
"$",
"payload",
"=",
"microtime",
"(",
"true",
")",
";",
"}",
"elseif",
"(",
"isset",
"(",
"$",
"payload",
"[",
"125",
"... | Sends "PING" frame to connected client.
@param mixed|null $payload Maximum of 125 bytes. If set to null current time will be used. It's possible to use
empty string.
@return string Used payload value
@throws LengthException In case of payload exceed 125 bytes. | [
"Sends",
"PING",
"frame",
"to",
"connected",
"client",
"."
] | 85f0335b87b3ec73ab47f5a5631eb86ba70b64a1 | https://github.com/kiler129/TinyWs/blob/85f0335b87b3ec73ab47f5a5631eb86ba70b64a1/src/WebSocketClient.php#L81-L96 | train |
cityware/city-format | src/Stringy.php | Stringy.isJson | public function isJson() {
if (!$this->endsWith('}') && !$this->endsWith(']')) {
return false;
}
return !is_null(json_decode($this->str));
} | php | public function isJson() {
if (!$this->endsWith('}') && !$this->endsWith(']')) {
return false;
}
return !is_null(json_decode($this->str));
} | [
"public",
"function",
"isJson",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"endsWith",
"(",
"'}'",
")",
"&&",
"!",
"$",
"this",
"->",
"endsWith",
"(",
"']'",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"!",
"is_null",
"(",
"json_... | Returns true if the string is JSON, false otherwise.
@return bool Whether or not $str is JSON | [
"Returns",
"true",
"if",
"the",
"string",
"is",
"JSON",
"false",
"otherwise",
"."
] | 1e292670639a950ecf561b545462427512950c74 | https://github.com/cityware/city-format/blob/1e292670639a950ecf561b545462427512950c74/src/Stringy.php#L1052-L1058 | train |
dankempster/axstrad-filesystem | Scanner/BaseIteratorScanner.php | BaseIteratorScanner.setFileClassname | public function setFileClassname($classname = null)
{
if ($classname === null) {
$this->fileClass = null;
}
elseif ( ! class_exists($classname)) {
throw ClassDoesNotExistException::create($classname);
}
else {
$this->fileClass = (string) $c... | php | public function setFileClassname($classname = null)
{
if ($classname === null) {
$this->fileClass = null;
}
elseif ( ! class_exists($classname)) {
throw ClassDoesNotExistException::create($classname);
}
else {
$this->fileClass = (string) $c... | [
"public",
"function",
"setFileClassname",
"(",
"$",
"classname",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"classname",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"fileClass",
"=",
"null",
";",
"}",
"elseif",
"(",
"!",
"class_exists",
"(",
"$",
"classnam... | Set file classname
If set, an instance of the class will be created for each file during
iteration. It is that object that will be added to the FileBag.
@param null|string $classname The classname of the File objects to create
@return self
@see getFileClassname
@throws ClassDoesNotExistException If $classname does no... | [
"Set",
"file",
"classname"
] | f47e52fcf093dc64cf54bc5702100ea881d0b010 | https://github.com/dankempster/axstrad-filesystem/blob/f47e52fcf093dc64cf54bc5702100ea881d0b010/Scanner/BaseIteratorScanner.php#L65-L77 | train |
phpalchemy/phpalchemy | Alchemy/Kernel/Event/ControllerEvent.php | ControllerEvent.setController | public function setController($controller)
{
// controller must be a callable
if (!is_callable($controller)) {
throw new \LogicException(sprintf(
'The controller must be a callable (%s given).',
gettype($controller)
));
}
$this... | php | public function setController($controller)
{
// controller must be a callable
if (!is_callable($controller)) {
throw new \LogicException(sprintf(
'The controller must be a callable (%s given).',
gettype($controller)
));
}
$this... | [
"public",
"function",
"setController",
"(",
"$",
"controller",
")",
"{",
"// controller must be a callable",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"controller",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
"(",
"'The controller must be... | Sets a controller
@param callable $controller | [
"Sets",
"a",
"controller"
] | 5b7e9b13acfda38c61b2da2639e8a56f298dc32e | https://github.com/phpalchemy/phpalchemy/blob/5b7e9b13acfda38c61b2da2639e8a56f298dc32e/Alchemy/Kernel/Event/ControllerEvent.php#L38-L49 | train |
gluephp/glue | src/Http/Request.php | Request.headers | public function headers($key = null, $fallback = null)
{
return $key
? $this->request->headers->get($key, $fallback)
: $this->request->headers;
} | php | public function headers($key = null, $fallback = null)
{
return $key
? $this->request->headers->get($key, $fallback)
: $this->request->headers;
} | [
"public",
"function",
"headers",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"fallback",
"=",
"null",
")",
"{",
"return",
"$",
"key",
"?",
"$",
"this",
"->",
"request",
"->",
"headers",
"->",
"get",
"(",
"$",
"key",
",",
"$",
"fallback",
")",
":",
"$... | Get a request header value
@param string $key
@param mixed $fallback
@return mixed | [
"Get",
"a",
"request",
"header",
"value"
] | d54e0905dfe74d1c114c04f33fa89a60e2651562 | https://github.com/gluephp/glue/blob/d54e0905dfe74d1c114c04f33fa89a60e2651562/src/Http/Request.php#L104-L109 | train |
selikhovleonid/nadir | src/core/CtrlWrapper.php | CtrlWrapper.callActon | private function callActon($sName, array $aArgs)
{
if (empty($aArgs)) {
$this->ctrl->{$sName}();
} else {
$oMethod = new \ReflectionMethod($this->ctrl, $sName);
$oMethod->invokeArgs($this->ctrl, $aArgs);
}
} | php | private function callActon($sName, array $aArgs)
{
if (empty($aArgs)) {
$this->ctrl->{$sName}();
} else {
$oMethod = new \ReflectionMethod($this->ctrl, $sName);
$oMethod->invokeArgs($this->ctrl, $aArgs);
}
} | [
"private",
"function",
"callActon",
"(",
"$",
"sName",
",",
"array",
"$",
"aArgs",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"aArgs",
")",
")",
"{",
"$",
"this",
"->",
"ctrl",
"->",
"{",
"$",
"sName",
"}",
"(",
")",
";",
"}",
"else",
"{",
"$",
... | It calls the controller action with passage the parameters if necessary.
@param string $sName The action name of target controller.
@param array $aArgs The action parameters. | [
"It",
"calls",
"the",
"controller",
"action",
"with",
"passage",
"the",
"parameters",
"if",
"necessary",
"."
] | 47545fccd8516c8f0a20c02ba62f68269c7199da | https://github.com/selikhovleonid/nadir/blob/47545fccd8516c8f0a20c02ba62f68269c7199da/src/core/CtrlWrapper.php#L30-L38 | train |
selikhovleonid/nadir | src/core/CtrlWrapper.php | CtrlWrapper.processAuth | protected function processAuth($sName, array $aArgs)
{
if (class_exists('\extensions\core\Auth')) {
$oAuth = new \extensions\core\Auth($this->ctrl->getRequest());
$oAuth->run();
if ($oAuth->isValid()) {
$this->callActon($sName, $aArgs);
} else ... | php | protected function processAuth($sName, array $aArgs)
{
if (class_exists('\extensions\core\Auth')) {
$oAuth = new \extensions\core\Auth($this->ctrl->getRequest());
$oAuth->run();
if ($oAuth->isValid()) {
$this->callActon($sName, $aArgs);
} else ... | [
"protected",
"function",
"processAuth",
"(",
"$",
"sName",
",",
"array",
"$",
"aArgs",
")",
"{",
"if",
"(",
"class_exists",
"(",
"'\\extensions\\core\\Auth'",
")",
")",
"{",
"$",
"oAuth",
"=",
"new",
"\\",
"extensions",
"\\",
"core",
"\\",
"Auth",
"(",
"... | The method calls user's auth checking, on successful complition of which
it invokes the target controller and the onFail method of Auth class in
other case.
@param string $sName The action name.
@param mixed[] $aArgs The action parameters. | [
"The",
"method",
"calls",
"user",
"s",
"auth",
"checking",
"on",
"successful",
"complition",
"of",
"which",
"it",
"invokes",
"the",
"target",
"controller",
"and",
"the",
"onFail",
"method",
"of",
"Auth",
"class",
"in",
"other",
"case",
"."
] | 47545fccd8516c8f0a20c02ba62f68269c7199da | https://github.com/selikhovleonid/nadir/blob/47545fccd8516c8f0a20c02ba62f68269c7199da/src/core/CtrlWrapper.php#L47-L60 | train |
deweller/php-cliopts | src/CLIOpts/Values/ArgumentValues.php | ArgumentValues.getValidator | public function getValidator() {
if (!isset($this->validator)) {
$this->validator = new ArgsValidator($this->arguments_spec, $this->parsed_args);
}
return $this->validator;
} | php | public function getValidator() {
if (!isset($this->validator)) {
$this->validator = new ArgsValidator($this->arguments_spec, $this->parsed_args);
}
return $this->validator;
} | [
"public",
"function",
"getValidator",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"validator",
")",
")",
"{",
"$",
"this",
"->",
"validator",
"=",
"new",
"ArgsValidator",
"(",
"$",
"this",
"->",
"arguments_spec",
",",
"$",
"this",
... | get the validator for these values
@return ArgsValidator the validator | [
"get",
"the",
"validator",
"for",
"these",
"values"
] | 1923f3a7ad24062c6279c725579ff3af15141dec | https://github.com/deweller/php-cliopts/blob/1923f3a7ad24062c6279c725579ff3af15141dec/src/CLIOpts/Values/ArgumentValues.php#L80-L85 | train |
deweller/php-cliopts | src/CLIOpts/Values/ArgumentValues.php | ArgumentValues.offsetGet | public function offsetGet($key) {
$resolved_key = $this->arguments_spec->normalizeOptionName($key);
if ($resolved_key === null) {
if (isset($this->merged_arg_values[$key])) {
return parent::offsetGet($key);
}
}
if (isset($this->merged_arg_values[$resolved_key])) {
return pare... | php | public function offsetGet($key) {
$resolved_key = $this->arguments_spec->normalizeOptionName($key);
if ($resolved_key === null) {
if (isset($this->merged_arg_values[$key])) {
return parent::offsetGet($key);
}
}
if (isset($this->merged_arg_values[$resolved_key])) {
return pare... | [
"public",
"function",
"offsetGet",
"(",
"$",
"key",
")",
"{",
"$",
"resolved_key",
"=",
"$",
"this",
"->",
"arguments_spec",
"->",
"normalizeOptionName",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"resolved_key",
"===",
"null",
")",
"{",
"if",
"(",
"is... | returns the argument or option value
@param string $key argument name or long option name
@return string argument or option value | [
"returns",
"the",
"argument",
"or",
"option",
"value"
] | 1923f3a7ad24062c6279c725579ff3af15141dec | https://github.com/deweller/php-cliopts/blob/1923f3a7ad24062c6279c725579ff3af15141dec/src/CLIOpts/Values/ArgumentValues.php#L96-L110 | train |
deweller/php-cliopts | src/CLIOpts/Values/ArgumentValues.php | ArgumentValues.offsetExists | public function offsetExists($key) {
$resolved_key = $this->arguments_spec->normalizeOptionName($key);
if ($resolved_key === null) {
return isset($this->merged_arg_values[$key]);
}
return isset($this->merged_arg_values[$resolved_key]);
} | php | public function offsetExists($key) {
$resolved_key = $this->arguments_spec->normalizeOptionName($key);
if ($resolved_key === null) {
return isset($this->merged_arg_values[$key]);
}
return isset($this->merged_arg_values[$resolved_key]);
} | [
"public",
"function",
"offsetExists",
"(",
"$",
"key",
")",
"{",
"$",
"resolved_key",
"=",
"$",
"this",
"->",
"arguments_spec",
"->",
"normalizeOptionName",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"resolved_key",
"===",
"null",
")",
"{",
"return",
"is... | returns true if the argument or option value exists
@param string $key argument name or long option name
@return bool true if the argument or option value exists | [
"returns",
"true",
"if",
"the",
"argument",
"or",
"option",
"value",
"exists"
] | 1923f3a7ad24062c6279c725579ff3af15141dec | https://github.com/deweller/php-cliopts/blob/1923f3a7ad24062c6279c725579ff3af15141dec/src/CLIOpts/Values/ArgumentValues.php#L120-L127 | train |
deweller/php-cliopts | src/CLIOpts/Values/ArgumentValues.php | ArgumentValues.extractAllLongOpts | protected function extractAllLongOpts(ArgumentsSpec $arguments_spec, $parsed_args) {
$long_opts = array();
foreach ($parsed_args['options'] as $option_name => $value) {
if ($long_option_name = $arguments_spec->normalizeOptionName($option_name)) {
$long_opts[$long_option_name] = $value;
}
... | php | protected function extractAllLongOpts(ArgumentsSpec $arguments_spec, $parsed_args) {
$long_opts = array();
foreach ($parsed_args['options'] as $option_name => $value) {
if ($long_option_name = $arguments_spec->normalizeOptionName($option_name)) {
$long_opts[$long_option_name] = $value;
}
... | [
"protected",
"function",
"extractAllLongOpts",
"(",
"ArgumentsSpec",
"$",
"arguments_spec",
",",
"$",
"parsed_args",
")",
"{",
"$",
"long_opts",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"parsed_args",
"[",
"'options'",
"]",
"as",
"$",
"option_name",
... | builds argument values by long option name
@param ArgumentsSpec $arguments_spec The arguments specification
@param array $parsed_args data parsed by the ArgumentsParser
@return array argument values by long option name | [
"builds",
"argument",
"values",
"by",
"long",
"option",
"name"
] | 1923f3a7ad24062c6279c725579ff3af15141dec | https://github.com/deweller/php-cliopts/blob/1923f3a7ad24062c6279c725579ff3af15141dec/src/CLIOpts/Values/ArgumentValues.php#L152-L162 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Config/Registry.php | Radial_Core_Model_Config_Registry._getStoreConfigValue | protected function _getStoreConfigValue($configKey, $store, $asFlag)
{
foreach ($this->_configModels as $configModel) {
if ($configModel->hasKey($configKey)) {
$configMethod = $asFlag ? 'getStoreConfigFlag' : 'getStoreConfig';
return Mage::$configMethod($configMod... | php | protected function _getStoreConfigValue($configKey, $store, $asFlag)
{
foreach ($this->_configModels as $configModel) {
if ($configModel->hasKey($configKey)) {
$configMethod = $asFlag ? 'getStoreConfigFlag' : 'getStoreConfig';
return Mage::$configMethod($configMod... | [
"protected",
"function",
"_getStoreConfigValue",
"(",
"$",
"configKey",
",",
"$",
"store",
",",
"$",
"asFlag",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_configModels",
"as",
"$",
"configModel",
")",
"{",
"if",
"(",
"$",
"configModel",
"->",
"hasKey",
... | Search through registered config models for one that knows about the key
and get the actual config path from it for the lookup.
@param string $configKey
@param null|string|bool|int|Mage_Core_Model_Store $store
@param bool $asFlag
@throws Mage_Core_Exception if the config path is not found.
@return string|bool | [
"Search",
"through",
"registered",
"config",
"models",
"for",
"one",
"that",
"knows",
"about",
"the",
"key",
"and",
"get",
"the",
"actual",
"config",
"path",
"from",
"it",
"for",
"the",
"lookup",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Config/Registry.php#L77-L86 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Config/Registry.php | Radial_Core_Model_Config_Registry.getConfigFlag | public function getConfigFlag($configKey, $store = null)
{
// if a value is given store, use it, even if it is null/false/empty string/whatever
$store = count(func_get_args()) > 1 ? $store : $this->getStore();
return $this->_getStoreConfigValue($configKey, $store, true);
} | php | public function getConfigFlag($configKey, $store = null)
{
// if a value is given store, use it, even if it is null/false/empty string/whatever
$store = count(func_get_args()) > 1 ? $store : $this->getStore();
return $this->_getStoreConfigValue($configKey, $store, true);
} | [
"public",
"function",
"getConfigFlag",
"(",
"$",
"configKey",
",",
"$",
"store",
"=",
"null",
")",
"{",
"// if a value is given store, use it, even if it is null/false/empty string/whatever",
"$",
"store",
"=",
"count",
"(",
"func_get_args",
"(",
")",
")",
">",
"1",
... | Get the configuration value represented by the given configKey
@param string $configKey
@param null|string|bool|int|Mage_Core_Model_Store $store
@return string | [
"Get",
"the",
"configuration",
"value",
"represented",
"by",
"the",
"given",
"configKey"
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Config/Registry.php#L94-L99 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Config/Registry.php | Radial_Core_Model_Config_Registry.getConfig | public function getConfig($configKey, $store = null)
{
// if a value is given store, use it, even if it is null/false/empty string/whatever
$store = count(func_get_args()) > 1 ? $store : $this->getStore();
return $this->_getStoreConfigValue($configKey, $store, false);
} | php | public function getConfig($configKey, $store = null)
{
// if a value is given store, use it, even if it is null/false/empty string/whatever
$store = count(func_get_args()) > 1 ? $store : $this->getStore();
return $this->_getStoreConfigValue($configKey, $store, false);
} | [
"public",
"function",
"getConfig",
"(",
"$",
"configKey",
",",
"$",
"store",
"=",
"null",
")",
"{",
"// if a value is given store, use it, even if it is null/false/empty string/whatever",
"$",
"store",
"=",
"count",
"(",
"func_get_args",
"(",
")",
")",
">",
"1",
"?"... | Get the configuration flag value represented by the given configKey
@param string $configKey
@param null|string|bool|int|Mage_Core_Model_Store $store
@return bool | [
"Get",
"the",
"configuration",
"flag",
"value",
"represented",
"by",
"the",
"given",
"configKey"
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Config/Registry.php#L107-L112 | train |
Phpillip/phpillip | src/Console/Command/BuildCommand.php | BuildCommand.dump | protected function dump(Route $route, $name)
{
if (!$route->isVisible()) {
return;
}
if (!in_array('GET', $route->getMethods())) {
throw new Exception(sprintf('Only GET mehtod supported, "%s" given.', $name));
}
if ($route->hasContent()) {
... | php | protected function dump(Route $route, $name)
{
if (!$route->isVisible()) {
return;
}
if (!in_array('GET', $route->getMethods())) {
throw new Exception(sprintf('Only GET mehtod supported, "%s" given.', $name));
}
if ($route->hasContent()) {
... | [
"protected",
"function",
"dump",
"(",
"Route",
"$",
"route",
",",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"route",
"->",
"isVisible",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"in_array",
"(",
"'GET'",
",",
"$",
"route",
"->",
... | Dump route content to destination file
@param Route $route
@param string $name | [
"Dump",
"route",
"content",
"to",
"destination",
"file"
] | c37afaafb536361e7e0b564659f1cd5b80b98be9 | https://github.com/Phpillip/phpillip/blob/c37afaafb536361e7e0b564659f1cd5b80b98be9/src/Console/Command/BuildCommand.php#L142-L166 | train |
Phpillip/phpillip | src/Console/Command/BuildCommand.php | BuildCommand.buildPaginatedRoute | protected function buildPaginatedRoute(Route $route, $name)
{
$contentType = $route->getContent();
$contents = $this->app['content_repository']->listContents($contentType);
$paginator = new Paginator($contents, $route->getPerPage());
$this->logger->log(sprintf(
'Bui... | php | protected function buildPaginatedRoute(Route $route, $name)
{
$contentType = $route->getContent();
$contents = $this->app['content_repository']->listContents($contentType);
$paginator = new Paginator($contents, $route->getPerPage());
$this->logger->log(sprintf(
'Bui... | [
"protected",
"function",
"buildPaginatedRoute",
"(",
"Route",
"$",
"route",
",",
"$",
"name",
")",
"{",
"$",
"contentType",
"=",
"$",
"route",
"->",
"getContent",
"(",
")",
";",
"$",
"contents",
"=",
"$",
"this",
"->",
"app",
"[",
"'content_repository'",
... | Build paginated route
@param Route $route
@param string $name | [
"Build",
"paginated",
"route"
] | c37afaafb536361e7e0b564659f1cd5b80b98be9 | https://github.com/Phpillip/phpillip/blob/c37afaafb536361e7e0b564659f1cd5b80b98be9/src/Console/Command/BuildCommand.php#L174-L194 | train |
Phpillip/phpillip | src/Console/Command/BuildCommand.php | BuildCommand.buildListRoute | protected function buildListRoute(Route $route, $name)
{
$contentType = $route->getContent();
$contents = $this->app['content_repository']->listContents($contentType);
$this->logger->log(sprintf(
'Building route <comment>%s</comment> with <info>%s</info> <comment>%s(s)</comme... | php | protected function buildListRoute(Route $route, $name)
{
$contentType = $route->getContent();
$contents = $this->app['content_repository']->listContents($contentType);
$this->logger->log(sprintf(
'Building route <comment>%s</comment> with <info>%s</info> <comment>%s(s)</comme... | [
"protected",
"function",
"buildListRoute",
"(",
"Route",
"$",
"route",
",",
"$",
"name",
")",
"{",
"$",
"contentType",
"=",
"$",
"route",
"->",
"getContent",
"(",
")",
";",
"$",
"contents",
"=",
"$",
"this",
"->",
"app",
"[",
"'content_repository'",
"]",... | Build list route
@param Route $route
@param string $name | [
"Build",
"list",
"route"
] | c37afaafb536361e7e0b564659f1cd5b80b98be9 | https://github.com/Phpillip/phpillip/blob/c37afaafb536361e7e0b564659f1cd5b80b98be9/src/Console/Command/BuildCommand.php#L202-L214 | train |
Phpillip/phpillip | src/Console/Command/BuildCommand.php | BuildCommand.buildContentRoute | protected function buildContentRoute(Route $route, $name)
{
$contentType = $route->getContent();
$contents = $this->app['content_repository']->listContents($contentType);
$this->logger->log(sprintf(
'Building route <comment>%s</comment> for <info>%s</info> <comment>%s(s)</com... | php | protected function buildContentRoute(Route $route, $name)
{
$contentType = $route->getContent();
$contents = $this->app['content_repository']->listContents($contentType);
$this->logger->log(sprintf(
'Building route <comment>%s</comment> for <info>%s</info> <comment>%s(s)</com... | [
"protected",
"function",
"buildContentRoute",
"(",
"Route",
"$",
"route",
",",
"$",
"name",
")",
"{",
"$",
"contentType",
"=",
"$",
"route",
"->",
"getContent",
"(",
")",
";",
"$",
"contents",
"=",
"$",
"this",
"->",
"app",
"[",
"'content_repository'",
"... | Build content route
@param Route $route
@param string $name | [
"Build",
"content",
"route"
] | c37afaafb536361e7e0b564659f1cd5b80b98be9 | https://github.com/Phpillip/phpillip/blob/c37afaafb536361e7e0b564659f1cd5b80b98be9/src/Console/Command/BuildCommand.php#L222-L242 | train |
Phpillip/phpillip | src/Console/Command/BuildCommand.php | BuildCommand.buildSitemap | protected function buildSitemap(Sitemap $sitemap)
{
$content = $this->app['twig']->render('@phpillip/sitemap.xml.twig', ['sitemap' => $sitemap]);
$this->builder->write('/', $content, 'xml', 'sitemap');
} | php | protected function buildSitemap(Sitemap $sitemap)
{
$content = $this->app['twig']->render('@phpillip/sitemap.xml.twig', ['sitemap' => $sitemap]);
$this->builder->write('/', $content, 'xml', 'sitemap');
} | [
"protected",
"function",
"buildSitemap",
"(",
"Sitemap",
"$",
"sitemap",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"app",
"[",
"'twig'",
"]",
"->",
"render",
"(",
"'@phpillip/sitemap.xml.twig'",
",",
"[",
"'sitemap'",
"=>",
"$",
"sitemap",
"]",
")"... | Build sitemap xml file from Sitemap
@param Sitemap $sitemap | [
"Build",
"sitemap",
"xml",
"file",
"from",
"Sitemap"
] | c37afaafb536361e7e0b564659f1cd5b80b98be9 | https://github.com/Phpillip/phpillip/blob/c37afaafb536361e7e0b564659f1cd5b80b98be9/src/Console/Command/BuildCommand.php#L249-L253 | train |
keeko/framework | src/security/AuthManager.php | AuthManager.authCookie | private function authCookie(Request $request) {
if ($request->cookies->has(self::COOKIE_TOKEN_NAME)) {
$token = $request->cookies->get(self::COOKIE_TOKEN_NAME);
return $this->authToken($token);
}
return null;
} | php | private function authCookie(Request $request) {
if ($request->cookies->has(self::COOKIE_TOKEN_NAME)) {
$token = $request->cookies->get(self::COOKIE_TOKEN_NAME);
return $this->authToken($token);
}
return null;
} | [
"private",
"function",
"authCookie",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"cookies",
"->",
"has",
"(",
"self",
"::",
"COOKIE_TOKEN_NAME",
")",
")",
"{",
"$",
"token",
"=",
"$",
"request",
"->",
"cookies",
"->",
"ge... | Authenticates a user by a token in a cookie
@param Request $request
@return Session|null | [
"Authenticates",
"a",
"user",
"by",
"a",
"token",
"in",
"a",
"cookie"
] | a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac | https://github.com/keeko/framework/blob/a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac/src/security/AuthManager.php#L71-L77 | train |
keeko/framework | src/security/AuthManager.php | AuthManager.authHeader | private function authHeader(Request $request) {
if ($request->headers->has('authorization')) {
$auth = $request->headers->get('authorization');
if (!empty($auth)) {
list(, $token) = explode(' ', $auth);
if (empty($token)) {
return null;
}
return $this->authToken($token);
}
}
return n... | php | private function authHeader(Request $request) {
if ($request->headers->has('authorization')) {
$auth = $request->headers->get('authorization');
if (!empty($auth)) {
list(, $token) = explode(' ', $auth);
if (empty($token)) {
return null;
}
return $this->authToken($token);
}
}
return n... | [
"private",
"function",
"authHeader",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"headers",
"->",
"has",
"(",
"'authorization'",
")",
")",
"{",
"$",
"auth",
"=",
"$",
"request",
"->",
"headers",
"->",
"get",
"(",
"'author... | Authenticates a user by an authorization header
@param Request $request
@return Session|null | [
"Authenticates",
"a",
"user",
"by",
"an",
"authorization",
"header"
] | a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac | https://github.com/keeko/framework/blob/a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac/src/security/AuthManager.php#L85-L97 | train |
keeko/framework | src/security/AuthManager.php | AuthManager.authBasic | private function authBasic(Request $request) {
$user = $this->findUser($request->getUser());
if ($user !== null && $this->verifyUser($user, $request->getPassword())) {
$session = $this->findSession($user);
if ($session === null) {
$session = $this->createSession($user);
}
$this->authenticated = true... | php | private function authBasic(Request $request) {
$user = $this->findUser($request->getUser());
if ($user !== null && $this->verifyUser($user, $request->getPassword())) {
$session = $this->findSession($user);
if ($session === null) {
$session = $this->createSession($user);
}
$this->authenticated = true... | [
"private",
"function",
"authBasic",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"findUser",
"(",
"$",
"request",
"->",
"getUser",
"(",
")",
")",
";",
"if",
"(",
"$",
"user",
"!==",
"null",
"&&",
"$",
"this",
"->",... | Authenticates a user by basic authentication
@param Request $request
@return Session|null | [
"Authenticates",
"a",
"user",
"by",
"basic",
"authentication"
] | a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac | https://github.com/keeko/framework/blob/a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac/src/security/AuthManager.php#L115-L127 | train |
valu-digital/valuso | src/ValuSo/Queue/Job/ServiceJob.php | ServiceJob.resolveIdentity | protected function resolveIdentity($username, $accountId)
{
$identitySeed = $this->getServiceBroker()
->service('User')
->resolveIdentity($username);
$accountIds = isset($identitySeed['accountIds']) ? $identitySeed['accountIds'] : [];
if (in_array($accou... | php | protected function resolveIdentity($username, $accountId)
{
$identitySeed = $this->getServiceBroker()
->service('User')
->resolveIdentity($username);
$accountIds = isset($identitySeed['accountIds']) ? $identitySeed['accountIds'] : [];
if (in_array($accou... | [
"protected",
"function",
"resolveIdentity",
"(",
"$",
"username",
",",
"$",
"accountId",
")",
"{",
"$",
"identitySeed",
"=",
"$",
"this",
"->",
"getServiceBroker",
"(",
")",
"->",
"service",
"(",
"'User'",
")",
"->",
"resolveIdentity",
"(",
"$",
"username",
... | Resolve identity based on username
@param string $username
@param string $accountId
@return boolean | [
"Resolve",
"identity",
"based",
"on",
"username"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Queue/Job/ServiceJob.php#L154-L172 | train |
valu-digital/valuso | src/ValuSo/Queue/Job/ServiceJob.php | ServiceJob.prepareIdentity | protected function prepareIdentity($identitySeed)
{
$this->getServiceBroker()
->service('Identity')
->setIdentity($identitySeed);
$identity = $this->getServiceBroker()
->service('Identity')
->getIdentity();
$this->getServiceBr... | php | protected function prepareIdentity($identitySeed)
{
$this->getServiceBroker()
->service('Identity')
->setIdentity($identitySeed);
$identity = $this->getServiceBroker()
->service('Identity')
->getIdentity();
$this->getServiceBr... | [
"protected",
"function",
"prepareIdentity",
"(",
"$",
"identitySeed",
")",
"{",
"$",
"this",
"->",
"getServiceBroker",
"(",
")",
"->",
"service",
"(",
"'Identity'",
")",
"->",
"setIdentity",
"(",
"$",
"identitySeed",
")",
";",
"$",
"identity",
"=",
"$",
"t... | Build new identity from identity seed
@param array $identitySeed | [
"Build",
"new",
"identity",
"from",
"identity",
"seed"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Queue/Job/ServiceJob.php#L179-L193 | train |
zbox/UnifiedPush | src/Zbox/UnifiedPush/NotificationService/NotificationServices.php | NotificationServices.validateServiceName | public static function validateServiceName($serviceName)
{
if (!in_array($serviceName, self::getAvailableServices())) {
throw new DomainException(sprintf("Notification service '%s' is not supported.", $serviceName));
}
return $serviceName;
} | php | public static function validateServiceName($serviceName)
{
if (!in_array($serviceName, self::getAvailableServices())) {
throw new DomainException(sprintf("Notification service '%s' is not supported.", $serviceName));
}
return $serviceName;
} | [
"public",
"static",
"function",
"validateServiceName",
"(",
"$",
"serviceName",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"serviceName",
",",
"self",
"::",
"getAvailableServices",
"(",
")",
")",
")",
"{",
"throw",
"new",
"DomainException",
"(",
"sprint... | Checks if notification service is supported
@param string $serviceName
@return string
@throws DomainException | [
"Checks",
"if",
"notification",
"service",
"is",
"supported"
] | 47da2d0577b18ac709cd947c68541014001e1866 | https://github.com/zbox/UnifiedPush/blob/47da2d0577b18ac709cd947c68541014001e1866/src/Zbox/UnifiedPush/NotificationService/NotificationServices.php#L50-L56 | train |
denkfabrik-neueMedien/silverstripe-siteinfo | src/extension/SiteInfo.php | SiteInfo._typesNice | protected function _typesNice() {
$enumValues = singleton("SilverStripe\SiteConfig\SiteConfig")->dbObject("Type")->enumValues();
$values = array();
foreach($enumValues as $enumValue) {
$values[$enumValue] = _t("SiteInfo.TYPE" . strtoupper($enumValue), $enumValue);
}
... | php | protected function _typesNice() {
$enumValues = singleton("SilverStripe\SiteConfig\SiteConfig")->dbObject("Type")->enumValues();
$values = array();
foreach($enumValues as $enumValue) {
$values[$enumValue] = _t("SiteInfo.TYPE" . strtoupper($enumValue), $enumValue);
}
... | [
"protected",
"function",
"_typesNice",
"(",
")",
"{",
"$",
"enumValues",
"=",
"singleton",
"(",
"\"SilverStripe\\SiteConfig\\SiteConfig\"",
")",
"->",
"dbObject",
"(",
"\"Type\"",
")",
"->",
"enumValues",
"(",
")",
";",
"$",
"values",
"=",
"array",
"(",
")",
... | Add translated labels for the dropdown field
@return array | [
"Add",
"translated",
"labels",
"for",
"the",
"dropdown",
"field"
] | cd59ea0cf5c13678ff8efd93028d35c726670c25 | https://github.com/denkfabrik-neueMedien/silverstripe-siteinfo/blob/cd59ea0cf5c13678ff8efd93028d35c726670c25/src/extension/SiteInfo.php#L214-L224 | train |
luoxiaojun1992/lb_framework | components/db/mysql/ActiveRecord.php | ActiveRecord.incrementByPk | public function incrementByPk($primary_key, $keys, $step = 1)
{
if ($this->is_single) {
return $this->incrementOrDecrementByPk($primary_key, $keys, $step);
}
return false;
} | php | public function incrementByPk($primary_key, $keys, $step = 1)
{
if ($this->is_single) {
return $this->incrementOrDecrementByPk($primary_key, $keys, $step);
}
return false;
} | [
"public",
"function",
"incrementByPk",
"(",
"$",
"primary_key",
",",
"$",
"keys",
",",
"$",
"step",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is_single",
")",
"{",
"return",
"$",
"this",
"->",
"incrementOrDecrementByPk",
"(",
"$",
"primary_key",... | Increase key or keys by primary key
@param $primary_key
@param $keys
@param int $step
@return bool | [
"Increase",
"key",
"or",
"keys",
"by",
"primary",
"key"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/db/mysql/ActiveRecord.php#L501-L507 | train |
luoxiaojun1992/lb_framework | components/db/mysql/ActiveRecord.php | ActiveRecord.decrementByPk | public function decrementByPk($primary_key, $keys, $step = 1)
{
if ($this->is_single) {
return $this->incrementOrDecrementByPk($primary_key, $keys, $step, self::MINUS_NOTIFICATION);
}
return false;
} | php | public function decrementByPk($primary_key, $keys, $step = 1)
{
if ($this->is_single) {
return $this->incrementOrDecrementByPk($primary_key, $keys, $step, self::MINUS_NOTIFICATION);
}
return false;
} | [
"public",
"function",
"decrementByPk",
"(",
"$",
"primary_key",
",",
"$",
"keys",
",",
"$",
"step",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is_single",
")",
"{",
"return",
"$",
"this",
"->",
"incrementOrDecrementByPk",
"(",
"$",
"primary_key",... | Decrease key or keys by primary key
@param $primary_key
@param $keys
@param int $step
@return bool | [
"Decrease",
"key",
"or",
"keys",
"by",
"primary",
"key"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/db/mysql/ActiveRecord.php#L517-L523 | train |
luoxiaojun1992/lb_framework | components/db/mysql/ActiveRecord.php | ActiveRecord.incrementOrDecrementByPk | public function incrementOrDecrementByPk($primary_key, $keys, $steps = 1, $op = self::PLUS_NOTIFICATION)
{
if ($this->is_single) {
$values = [];
if (is_array($keys)) {
foreach ($keys as $k => $key) {
if (is_array($steps) && isset($steps[$k])) {
... | php | public function incrementOrDecrementByPk($primary_key, $keys, $steps = 1, $op = self::PLUS_NOTIFICATION)
{
if ($this->is_single) {
$values = [];
if (is_array($keys)) {
foreach ($keys as $k => $key) {
if (is_array($steps) && isset($steps[$k])) {
... | [
"public",
"function",
"incrementOrDecrementByPk",
"(",
"$",
"primary_key",
",",
"$",
"keys",
",",
"$",
"steps",
"=",
"1",
",",
"$",
"op",
"=",
"self",
"::",
"PLUS_NOTIFICATION",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is_single",
")",
"{",
"$",
"value... | Increase or decrease key or keys by primary key
@param $primary_key
@param $keys
@param int $steps
@param string $op
@return bool | [
"Increase",
"or",
"decrease",
"key",
"or",
"keys",
"by",
"primary",
"key"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/db/mysql/ActiveRecord.php#L534-L559 | train |
nasumilu/geometry | src/Operation/AbstractLinearReferenceOpSubscriber.php | AbstractLinearReferenceOpSubscriber.locateAlong | public function locateAlong(LinearReferenceOpEvent $evt) {
$geometry = $evt->getGeometry();
$this->validGeometry($geometry);
$mValue = $evt['mValue'];
$offset = $evt['offset'];
try {
$results = $this->getLocateAlong($geometry, $mValue, $offset);
$evt->setR... | php | public function locateAlong(LinearReferenceOpEvent $evt) {
$geometry = $evt->getGeometry();
$this->validGeometry($geometry);
$mValue = $evt['mValue'];
$offset = $evt['offset'];
try {
$results = $this->getLocateAlong($geometry, $mValue, $offset);
$evt->setR... | [
"public",
"function",
"locateAlong",
"(",
"LinearReferenceOpEvent",
"$",
"evt",
")",
"{",
"$",
"geometry",
"=",
"$",
"evt",
"->",
"getGeometry",
"(",
")",
";",
"$",
"this",
"->",
"validGeometry",
"(",
"$",
"geometry",
")",
";",
"$",
"mValue",
"=",
"$",
... | Gets the derived geometry collection with elements that match the specified
measure.
@param LinearReferenceOpEvent | [
"Gets",
"the",
"derived",
"geometry",
"collection",
"with",
"elements",
"that",
"match",
"the",
"specified",
"measure",
"."
] | 000fafe3e61f1d0682952ad236b7486dded65eae | https://github.com/nasumilu/geometry/blob/000fafe3e61f1d0682952ad236b7486dded65eae/src/Operation/AbstractLinearReferenceOpSubscriber.php#L86-L97 | train |
nasumilu/geometry | src/Operation/AbstractLinearReferenceOpSubscriber.php | AbstractLinearReferenceOpSubscriber.locateBetween | public function locateBetween(LinearReferenceOpEvent $evt) {
$geometry = $evt->getGeometry();
$this->validGeometry($geometry);
$mStart = $evt['mStart'];
$mEnd = $evt['mEnd'];
$offset = $evt['offset'];
try {
$results = $this->getLocateBetween($geometry, $mStart... | php | public function locateBetween(LinearReferenceOpEvent $evt) {
$geometry = $evt->getGeometry();
$this->validGeometry($geometry);
$mStart = $evt['mStart'];
$mEnd = $evt['mEnd'];
$offset = $evt['offset'];
try {
$results = $this->getLocateBetween($geometry, $mStart... | [
"public",
"function",
"locateBetween",
"(",
"LinearReferenceOpEvent",
"$",
"evt",
")",
"{",
"$",
"geometry",
"=",
"$",
"evt",
"->",
"getGeometry",
"(",
")",
";",
"$",
"this",
"->",
"validGeometry",
"(",
"$",
"geometry",
")",
";",
"$",
"mStart",
"=",
"$",... | Gets the derived geometry collection with elements that match the specified
range of measured inclusively.
@param LinearReferenceOpEvent | [
"Gets",
"the",
"derived",
"geometry",
"collection",
"with",
"elements",
"that",
"match",
"the",
"specified",
"range",
"of",
"measured",
"inclusively",
"."
] | 000fafe3e61f1d0682952ad236b7486dded65eae | https://github.com/nasumilu/geometry/blob/000fafe3e61f1d0682952ad236b7486dded65eae/src/Operation/AbstractLinearReferenceOpSubscriber.php#L105-L117 | train |
UnionOfRAD/li3_quality | qa/rules/syntax/WeakComparisonOperators.php | WeakComparisonOperators.apply | public function apply($testable, array $config = array()) {
$tokens = $testable->tokens();
$message = 'Weak comparison operator {:key} used, try {:value} instead';
$filtered = $testable->findAll(array_keys($this->inspectableTokens));
foreach ($filtered as $id) {
$token = $tokens[$id];
$this->addWarning(a... | php | public function apply($testable, array $config = array()) {
$tokens = $testable->tokens();
$message = 'Weak comparison operator {:key} used, try {:value} instead';
$filtered = $testable->findAll(array_keys($this->inspectableTokens));
foreach ($filtered as $id) {
$token = $tokens[$id];
$this->addWarning(a... | [
"public",
"function",
"apply",
"(",
"$",
"testable",
",",
"array",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"$",
"tokens",
"=",
"$",
"testable",
"->",
"tokens",
"(",
")",
";",
"$",
"message",
"=",
"'Weak comparison operator {:key} used, try {:value} ... | Will iterate over each line checking if any weak comparison operators
are used within the code.
@param Testable $testable The testable object
@return void | [
"Will",
"iterate",
"over",
"each",
"line",
"checking",
"if",
"any",
"weak",
"comparison",
"operators",
"are",
"used",
"within",
"the",
"code",
"."
] | acb72a43ae835e6d200bc0eba1a61aee610e36bf | https://github.com/UnionOfRAD/li3_quality/blob/acb72a43ae835e6d200bc0eba1a61aee610e36bf/qa/rules/syntax/WeakComparisonOperators.php#L32-L47 | train |
apishka/easy-extend | source/Builder.php | Builder.addFindersByConfigs | protected function addFindersByConfigs(array $configs): self
{
foreach ($configs as $package => $path)
{
$data = @include $path;
if ($data && isset($data['easy-extend']))
{
$config = $data['easy-extend'];
if ($config)
... | php | protected function addFindersByConfigs(array $configs): self
{
foreach ($configs as $package => $path)
{
$data = @include $path;
if ($data && isset($data['easy-extend']))
{
$config = $data['easy-extend'];
if ($config)
... | [
"protected",
"function",
"addFindersByConfigs",
"(",
"array",
"$",
"configs",
")",
":",
"self",
"{",
"foreach",
"(",
"$",
"configs",
"as",
"$",
"package",
"=>",
"$",
"path",
")",
"{",
"$",
"data",
"=",
"@",
"include",
"$",
"path",
";",
"if",
"(",
"$"... | Add finders by configs
@param array $configs
@return Builder this | [
"Add",
"finders",
"by",
"configs"
] | 5e5c63c2509377abc3db6956e353623683703e09 | https://github.com/apishka/easy-extend/blob/5e5c63c2509377abc3db6956e353623683703e09/source/Builder.php#L90-L127 | train |
apishka/easy-extend | source/Builder.php | Builder.getConfigFilesByComposer | protected function getConfigFilesByComposer(): array
{
$this->getLogger()->write('<info>Searching for ".apishka" files</info>');
if ($this->getEvent() === null)
throw new \LogicException('Event not exists');
$configs = array();
if ($this->isDependantPackage($this->getEv... | php | protected function getConfigFilesByComposer(): array
{
$this->getLogger()->write('<info>Searching for ".apishka" files</info>');
if ($this->getEvent() === null)
throw new \LogicException('Event not exists');
$configs = array();
if ($this->isDependantPackage($this->getEv... | [
"protected",
"function",
"getConfigFilesByComposer",
"(",
")",
":",
"array",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"write",
"(",
"'<info>Searching for \".apishka\" files</info>'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getEvent",
"(",
")",
"==... | Get config files by composer
@return array | [
"Get",
"config",
"files",
"by",
"composer"
] | 5e5c63c2509377abc3db6956e353623683703e09 | https://github.com/apishka/easy-extend/blob/5e5c63c2509377abc3db6956e353623683703e09/source/Builder.php#L184-L226 | train |
apishka/easy-extend | source/Builder.php | Builder.getConfigPackagePath | protected function getConfigPackagePath(string $dir, PackageInterface $package): ?string
{
$dir = preg_replace(
'#^(' . preg_quote(getcwd() . DIRECTORY_SEPARATOR, '#') . ')#',
'.' . DIRECTORY_SEPARATOR,
$dir
);
$path = $this->getConfigPath($dir);
... | php | protected function getConfigPackagePath(string $dir, PackageInterface $package): ?string
{
$dir = preg_replace(
'#^(' . preg_quote(getcwd() . DIRECTORY_SEPARATOR, '#') . ')#',
'.' . DIRECTORY_SEPARATOR,
$dir
);
$path = $this->getConfigPath($dir);
... | [
"protected",
"function",
"getConfigPackagePath",
"(",
"string",
"$",
"dir",
",",
"PackageInterface",
"$",
"package",
")",
":",
"?",
"string",
"{",
"$",
"dir",
"=",
"preg_replace",
"(",
"'#^('",
".",
"preg_quote",
"(",
"getcwd",
"(",
")",
".",
"DIRECTORY_SEPA... | Get config package file path
@param string $dir
@param PackageInterface $package
@return null|string | [
"Get",
"config",
"package",
"file",
"path"
] | 5e5c63c2509377abc3db6956e353623683703e09 | https://github.com/apishka/easy-extend/blob/5e5c63c2509377abc3db6956e353623683703e09/source/Builder.php#L236-L258 | train |
bitrank-verified/php-client | src/BitRank/Score.php | Score.boundsCheck | protected function boundsCheck()
{
$scores = $this->bitrank->getScores();
if ($this->score > $scores->max) {
$this->score = $scores->max;
}
if ($this->score < $scores->min) {
$this->score = $scores->min;
}
} | php | protected function boundsCheck()
{
$scores = $this->bitrank->getScores();
if ($this->score > $scores->max) {
$this->score = $scores->max;
}
if ($this->score < $scores->min) {
$this->score = $scores->min;
}
} | [
"protected",
"function",
"boundsCheck",
"(",
")",
"{",
"$",
"scores",
"=",
"$",
"this",
"->",
"bitrank",
"->",
"getScores",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"score",
">",
"$",
"scores",
"->",
"max",
")",
"{",
"$",
"this",
"->",
"score",... | Ensure score is within bounds
@return void | [
"Ensure",
"score",
"is",
"within",
"bounds"
] | 8c1a2eb3b82e317852f70af9bb9ea75af34b715c | https://github.com/bitrank-verified/php-client/blob/8c1a2eb3b82e317852f70af9bb9ea75af34b715c/src/BitRank/Score.php#L111-L120 | train |
bitrank-verified/php-client | src/BitRank/Score.php | Score.getFlagsOfType | public function getFlagsOfType($type)
{
if ($this->flags === null) {
return [];
}
$matches = [];
foreach ($this->flags as $flag) {
if ($flag->type == $type) {
$matches []= $flag;
}
}
return $matches;
} | php | public function getFlagsOfType($type)
{
if ($this->flags === null) {
return [];
}
$matches = [];
foreach ($this->flags as $flag) {
if ($flag->type == $type) {
$matches []= $flag;
}
}
return $matches;
} | [
"public",
"function",
"getFlagsOfType",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"flags",
"===",
"null",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"matches",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"flags",
"as"... | Returns flags of the specified type associated with this address, if any.
@param $type The flag type you're looking for. Will be one of the Flag::TYPE_* constants.
@return array of Flag, or an empty array if none found. | [
"Returns",
"flags",
"of",
"the",
"specified",
"type",
"associated",
"with",
"this",
"address",
"if",
"any",
"."
] | 8c1a2eb3b82e317852f70af9bb9ea75af34b715c | https://github.com/bitrank-verified/php-client/blob/8c1a2eb3b82e317852f70af9bb9ea75af34b715c/src/BitRank/Score.php#L127-L142 | train |
bitrank-verified/php-client | src/BitRank/Score.php | Score.hasFlagsOfType | public function hasFlagsOfType($type)
{
if ($this->flags === null) {
return false;
}
foreach ($this->flags as $flag) {
if ($flag->type == $type) {
return true;
}
}
return false;
} | php | public function hasFlagsOfType($type)
{
if ($this->flags === null) {
return false;
}
foreach ($this->flags as $flag) {
if ($flag->type == $type) {
return true;
}
}
return false;
} | [
"public",
"function",
"hasFlagsOfType",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"flags",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"flags",
"as",
"$",
"flag",
")",
"{",
"if",
"(",
"... | Returns whether or not this address has any flags of type.
@param string $type The flag type you're looking for. Will be one of the Flag::TYPE_* constants.
@return boolean | [
"Returns",
"whether",
"or",
"not",
"this",
"address",
"has",
"any",
"flags",
"of",
"type",
"."
] | 8c1a2eb3b82e317852f70af9bb9ea75af34b715c | https://github.com/bitrank-verified/php-client/blob/8c1a2eb3b82e317852f70af9bb9ea75af34b715c/src/BitRank/Score.php#L149-L162 | train |
digipolisgent/robo-digipolis-deploy | src/Traits/SymlinkFolderFileContentsTrait.php | SymlinkFolderFileContentsTrait.taskSymlinkFolderFileContents | protected function taskSymlinkFolderFileContents($source, $destination, Finder $finder = null)
{
return $this->task(SymlinkFolderFileContents::class, $source, $destination, $finder);
} | php | protected function taskSymlinkFolderFileContents($source, $destination, Finder $finder = null)
{
return $this->task(SymlinkFolderFileContents::class, $source, $destination, $finder);
} | [
"protected",
"function",
"taskSymlinkFolderFileContents",
"(",
"$",
"source",
",",
"$",
"destination",
",",
"Finder",
"$",
"finder",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"task",
"(",
"SymlinkFolderFileContents",
"::",
"class",
",",
"$",
"source"... | Creates a SymlinkFolderFileContents task.
@param string $source
The directory containing the files to symlink.
@param string $destination
The directory where the symlinks should be placed.
@param null|\Symfony\Component\Finder\Finder $finder
The finder used to get the files from the source folder.
@return \DigipolisG... | [
"Creates",
"a",
"SymlinkFolderFileContents",
"task",
"."
] | fafa8967d98ed4d3f2265b17f4b1abe53bf0b5ab | https://github.com/digipolisgent/robo-digipolis-deploy/blob/fafa8967d98ed4d3f2265b17f4b1abe53bf0b5ab/src/Traits/SymlinkFolderFileContentsTrait.php#L24-L27 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.reset | public function reset()
{
$this->oosql_limit = null;
$this->oosql_order = null;
$this->oosql_where = null;
$this->oosql_join = null;
$this->oosql_stmt = null;
$this->oosql_conValues = array();
$this->oosql_numargs = null;
$this->oosql_fromFlag ... | php | public function reset()
{
$this->oosql_limit = null;
$this->oosql_order = null;
$this->oosql_where = null;
$this->oosql_join = null;
$this->oosql_stmt = null;
$this->oosql_conValues = array();
$this->oosql_numargs = null;
$this->oosql_fromFlag ... | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"oosql_limit",
"=",
"null",
";",
"$",
"this",
"->",
"oosql_order",
"=",
"null",
";",
"$",
"this",
"->",
"oosql_where",
"=",
"null",
";",
"$",
"this",
"->",
"oosql_join",
"=",
"null",
";... | Resets the class vars to their initial values for a new query
@return \Phiber\oosql\oosql Instance | [
"Resets",
"the",
"class",
"vars",
"to",
"their",
"initial",
"values",
"for",
"a",
"new",
"query"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L250-L304 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.sql | protected function sql($sql = null, $replace = false)
{
if (null !== $sql) {
if (!isset($this->oosql_sql[$this->oosql_table]) || $replace) {
$this->oosql_sql[$this->oosql_table] = $sql;
} else {
$this->oosql_sql[$this->oosql_table] .= $sql;
... | php | protected function sql($sql = null, $replace = false)
{
if (null !== $sql) {
if (!isset($this->oosql_sql[$this->oosql_table]) || $replace) {
$this->oosql_sql[$this->oosql_table] = $sql;
} else {
$this->oosql_sql[$this->oosql_table] .= $sql;
... | [
"protected",
"function",
"sql",
"(",
"$",
"sql",
"=",
"null",
",",
"$",
"replace",
"=",
"false",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"sql",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"oosql_sql",
"[",
"$",
"this",
"->",
"oo... | Append to the query string or return the current one
@param mixed $sql SQL
@param boolean $replace Replace current query or not | [
"Append",
"to",
"the",
"query",
"string",
"or",
"return",
"the",
"current",
"one"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L347-L359 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.select | public function select()
{
self::$instance->reset();
$this->sql('SELECT ');
if ($this->oosql_distinct) {
$this->sql('DISTINCT ');
}
$numargs = func_num_args();
if ($numargs > 0) {
$arg_list = func_get_args();
$this->oosql_fields ... | php | public function select()
{
self::$instance->reset();
$this->sql('SELECT ');
if ($this->oosql_distinct) {
$this->sql('DISTINCT ');
}
$numargs = func_num_args();
if ($numargs > 0) {
$arg_list = func_get_args();
$this->oosql_fields ... | [
"public",
"function",
"select",
"(",
")",
"{",
"self",
"::",
"$",
"instance",
"->",
"reset",
"(",
")",
";",
"$",
"this",
"->",
"sql",
"(",
"'SELECT '",
")",
";",
"if",
"(",
"$",
"this",
"->",
"oosql_distinct",
")",
"{",
"$",
"this",
"->",
"sql",
... | Create a select statement
@variadic
@return \Phiber\oosql\oosql Instance | [
"Create",
"a",
"select",
"statement"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L366-L397 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.getFields | public function getFields($table = null)
{
if (null == $table) {
$table = $this->oosql_table;
}
$newFields = array();
foreach ($this->oosql_fields as $field) {
$newFields[] = $table . '.' . $field;
}
return $newFields;
} | php | public function getFields($table = null)
{
if (null == $table) {
$table = $this->oosql_table;
}
$newFields = array();
foreach ($this->oosql_fields as $field) {
$newFields[] = $table . '.' . $field;
}
return $newFields;
} | [
"public",
"function",
"getFields",
"(",
"$",
"table",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"==",
"$",
"table",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"oosql_table",
";",
"}",
"$",
"newFields",
"=",
"array",
"(",
")",
";",
"foreach",
... | Get an array of fields of the current or given table
@param mixed $table table name
@return array Table fields | [
"Get",
"an",
"array",
"of",
"fields",
"of",
"the",
"current",
"or",
"given",
"table"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L404-L414 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.insert | public function insert()
{
self::$instance->reset();
$this->sql('INSERT INTO ' . $this->oosql_table);
$arg_list = func_get_args();
$numargs = func_num_args();
if ($numargs > 0) {
$this->oosql_numargs = $numargs;
$this->sql(' (');
$this->... | php | public function insert()
{
self::$instance->reset();
$this->sql('INSERT INTO ' . $this->oosql_table);
$arg_list = func_get_args();
$numargs = func_num_args();
if ($numargs > 0) {
$this->oosql_numargs = $numargs;
$this->sql(' (');
$this->... | [
"public",
"function",
"insert",
"(",
")",
"{",
"self",
"::",
"$",
"instance",
"->",
"reset",
"(",
")",
";",
"$",
"this",
"->",
"sql",
"(",
"'INSERT INTO '",
".",
"$",
"this",
"->",
"oosql_table",
")",
";",
"$",
"arg_list",
"=",
"func_get_args",
"(",
... | Creates an INSERT query
@return \Phiber\oosql\oosql Instance | [
"Creates",
"an",
"INSERT",
"query"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L429-L447 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.update | public function update()
{
self::$instance->reset();
$this->sql('UPDATE');
$numargs = func_num_args();
if ($numargs > 0) {
$arg_list = func_get_args();
$this->oosql_multiFlag = true;
$this->oosql_multi = $arg_list;
for ($i = 0; $i ... | php | public function update()
{
self::$instance->reset();
$this->sql('UPDATE');
$numargs = func_num_args();
if ($numargs > 0) {
$arg_list = func_get_args();
$this->oosql_multiFlag = true;
$this->oosql_multi = $arg_list;
for ($i = 0; $i ... | [
"public",
"function",
"update",
"(",
")",
"{",
"self",
"::",
"$",
"instance",
"->",
"reset",
"(",
")",
";",
"$",
"this",
"->",
"sql",
"(",
"'UPDATE'",
")",
";",
"$",
"numargs",
"=",
"func_num_args",
"(",
")",
";",
"if",
"(",
"$",
"numargs",
">",
... | Creates an UPDATE query
@return \Phiber\oosql\oosql Instance | [
"Creates",
"an",
"UPDATE",
"query"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L453-L480 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.delete | public function delete()
{
self::$instance->reset();
$this->sql('DELETE');
$this->oosql_where = null;
$numargs = func_num_args();
if ($numargs > 0) {
if ($numargs > 1) {
$this->oosql_del_multiFlag = true;
$this->oosql_del_numargs =... | php | public function delete()
{
self::$instance->reset();
$this->sql('DELETE');
$this->oosql_where = null;
$numargs = func_num_args();
if ($numargs > 0) {
if ($numargs > 1) {
$this->oosql_del_multiFlag = true;
$this->oosql_del_numargs =... | [
"public",
"function",
"delete",
"(",
")",
"{",
"self",
"::",
"$",
"instance",
"->",
"reset",
"(",
")",
";",
"$",
"this",
"->",
"sql",
"(",
"'DELETE'",
")",
";",
"$",
"this",
"->",
"oosql_where",
"=",
"null",
";",
"$",
"numargs",
"=",
"func_num_args",... | Creates a DELETE query
@return \Phiber\oosql\oosql Instance | [
"Creates",
"a",
"DELETE",
"query"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L486-L518 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.deleteRecord | public function deleteRecord($oosql = null, array $criteria)
{
if (null == $oosql) {
$oosql = $this;
}
$oosql->delete()->createWhere($criteria)->exe();
return $this;
} | php | public function deleteRecord($oosql = null, array $criteria)
{
if (null == $oosql) {
$oosql = $this;
}
$oosql->delete()->createWhere($criteria)->exe();
return $this;
} | [
"public",
"function",
"deleteRecord",
"(",
"$",
"oosql",
"=",
"null",
",",
"array",
"$",
"criteria",
")",
"{",
"if",
"(",
"null",
"==",
"$",
"oosql",
")",
"{",
"$",
"oosql",
"=",
"$",
"this",
";",
"}",
"$",
"oosql",
"->",
"delete",
"(",
")",
"->"... | Delete a record or more from a table
@param mixed $oosql Optional oosql\oosql instance to run query on
@param array $criteria Criteria of current opperation
@return \Phiber\oosql\oosql Instance | [
"Delete",
"a",
"record",
"or",
"more",
"from",
"a",
"table"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L526-L533 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.set | public function set(array $data)
{
$sql = '';
foreach ($data as $field => $value) {
$sql .= $field . ' = ?,';
$this->oosql_conValues[] = $value;
}
$this->sql(rtrim($sql, ','));
return $this;
} | php | public function set(array $data)
{
$sql = '';
foreach ($data as $field => $value) {
$sql .= $field . ' = ?,';
$this->oosql_conValues[] = $value;
}
$this->sql(rtrim($sql, ','));
return $this;
} | [
"public",
"function",
"set",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"sql",
"=",
"''",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"$",
"sql",
".=",
"$",
"field",
".",
"' = ?,'",
";",
"$",
"this",
"->",... | Sets the column, value pairs in update queries
@param array $data An array of the fields with their corresponding values in a key => value format
@return \Phiber\oosql\oosql Instance | [
"Sets",
"the",
"column",
"value",
"pairs",
"in",
"update",
"queries"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L540-L552 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.values | public function values()
{
$arg_list = func_get_args();
$numargs = func_num_args();
if (($this->oosql_numargs !== 0 && $numargs !== $this->oosql_numargs) || $numargs === 0) {
$msg = 'Insert numargs: ' . $this->oosql_numargs . ' | values numargs = ' . $numargs . ', Columns and ... | php | public function values()
{
$arg_list = func_get_args();
$numargs = func_num_args();
if (($this->oosql_numargs !== 0 && $numargs !== $this->oosql_numargs) || $numargs === 0) {
$msg = 'Insert numargs: ' . $this->oosql_numargs . ' | values numargs = ' . $numargs . ', Columns and ... | [
"public",
"function",
"values",
"(",
")",
"{",
"$",
"arg_list",
"=",
"func_get_args",
"(",
")",
";",
"$",
"numargs",
"=",
"func_num_args",
"(",
")",
";",
"if",
"(",
"(",
"$",
"this",
"->",
"oosql_numargs",
"!==",
"0",
"&&",
"$",
"numargs",
"!==",
"$"... | Assembles values part of an insert
@throws \Exception
@return \Phiber\oosql\oosql Instance | [
"Assembles",
"values",
"part",
"of",
"an",
"insert"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L682-L715 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.from | public function from()
{
$from = '';
$numargs = func_num_args();
if ($this->oosql_del_multiFlag) {
if ($numargs < $this->oosql_del_numargs) {
$msg = 'Columns and passed data do not match! ' . $this->sql();
throw new \Exception($msg, 9810, null)... | php | public function from()
{
$from = '';
$numargs = func_num_args();
if ($this->oosql_del_multiFlag) {
if ($numargs < $this->oosql_del_numargs) {
$msg = 'Columns and passed data do not match! ' . $this->sql();
throw new \Exception($msg, 9810, null)... | [
"public",
"function",
"from",
"(",
")",
"{",
"$",
"from",
"=",
"''",
";",
"$",
"numargs",
"=",
"func_num_args",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"oosql_del_multiFlag",
")",
"{",
"if",
"(",
"$",
"numargs",
"<",
"$",
"this",
"->",
"oosql_... | Assembles the FROM part of the query
@throws \Exception
@return \Phiber\oosql\oosql Instance | [
"Assembles",
"the",
"FROM",
"part",
"of",
"the",
"query"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L722-L771 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.where | public function where($condition, $value = null, $type = null)
{
switch ($type) {
case null:
$clause = 'WHERE';
break;
case 'or':
$clause = 'OR';
break;
case 'and':
$clause = 'AND';
... | php | public function where($condition, $value = null, $type = null)
{
switch ($type) {
case null:
$clause = 'WHERE';
break;
case 'or':
$clause = 'OR';
break;
case 'and':
$clause = 'AND';
... | [
"public",
"function",
"where",
"(",
"$",
"condition",
",",
"$",
"value",
"=",
"null",
",",
"$",
"type",
"=",
"null",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"null",
":",
"$",
"clause",
"=",
"'WHERE'",
";",
"break",
";",
"case",
"'... | Assembles a WHERE clause
@param string $condition
@param string $value
@param string $type
@return \Phiber\oosql\oosql | [
"Assembles",
"a",
"WHERE",
"clause"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L829-L857 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.sub | public function sub()
{
$this->oosql_sub = true;
$this->exe();
$this->sql('(' . $this->getSql() . ')', true);
return $this;
} | php | public function sub()
{
$this->oosql_sub = true;
$this->exe();
$this->sql('(' . $this->getSql() . ')', true);
return $this;
} | [
"public",
"function",
"sub",
"(",
")",
"{",
"$",
"this",
"->",
"oosql_sub",
"=",
"true",
";",
"$",
"this",
"->",
"exe",
"(",
")",
";",
"$",
"this",
"->",
"sql",
"(",
"'('",
".",
"$",
"this",
"->",
"getSql",
"(",
")",
".",
"')'",
",",
"true",
... | Declares current query as a sub-query
@return \Phiber\oosql\oosql | [
"Declares",
"current",
"query",
"as",
"a",
"sub",
"-",
"query"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L863-L870 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.prep | public function prep($values = null)
{
$hash = $this->queryHash();
$prepOnly = true;
if (is_array($values)) {
$prepOnly = false;
}
if ($this->oosql_prepParams) {
$this->oosql_stmt = $this->prepare(trim($this->sql()), $this->oosql_prepParams);
... | php | public function prep($values = null)
{
$hash = $this->queryHash();
$prepOnly = true;
if (is_array($values)) {
$prepOnly = false;
}
if ($this->oosql_prepParams) {
$this->oosql_stmt = $this->prepare(trim($this->sql()), $this->oosql_prepParams);
... | [
"public",
"function",
"prep",
"(",
"$",
"values",
"=",
"null",
")",
"{",
"$",
"hash",
"=",
"$",
"this",
"->",
"queryHash",
"(",
")",
";",
"$",
"prepOnly",
"=",
"true",
";",
"if",
"(",
"is_array",
"(",
"$",
"values",
")",
")",
"{",
"$",
"prepOnly"... | Prepare a query statement
@param array $values Bound values if any
@return mixed A \PDOStatement object or the boolean return of PDOStatement::execute | [
"Prepare",
"a",
"query",
"statement"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L901-L928 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.execBound | public function execBound(\PDOStatement $stmt, array $values)
{
$ord = 1;
foreach ($values as $val) {
if (is_bool($val)) {
$stmt->bindValue($ord, $val, \PDO::PARAM_BOOL);
} elseif (is_resource($val)) {
$stmt->bindValue($ord, $val, \PDO::PAR... | php | public function execBound(\PDOStatement $stmt, array $values)
{
$ord = 1;
foreach ($values as $val) {
if (is_bool($val)) {
$stmt->bindValue($ord, $val, \PDO::PARAM_BOOL);
} elseif (is_resource($val)) {
$stmt->bindValue($ord, $val, \PDO::PAR... | [
"public",
"function",
"execBound",
"(",
"\\",
"PDOStatement",
"$",
"stmt",
",",
"array",
"$",
"values",
")",
"{",
"$",
"ord",
"=",
"1",
";",
"foreach",
"(",
"$",
"values",
"as",
"$",
"val",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"val",
")",
")... | Executes a prepared statement with parameterized values
@param \PDOStatement $stmt
@param array $values
@return boolean True on success | [
"Executes",
"a",
"prepared",
"statement",
"with",
"parameterized",
"values"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L936-L961 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.exe | public function exe()
{
if ($this->oosql_fromFlag) {
$this->from();
}
if (null != $this->oosql_join) {
$this->sql($this->oosql_join);
}
if (null != $this->oosql_where) {
$this->sql($this->oosql_where);
}
if (null != $this->... | php | public function exe()
{
if ($this->oosql_fromFlag) {
$this->from();
}
if (null != $this->oosql_join) {
$this->sql($this->oosql_join);
}
if (null != $this->oosql_where) {
$this->sql($this->oosql_where);
}
if (null != $this->... | [
"public",
"function",
"exe",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oosql_fromFlag",
")",
"{",
"$",
"this",
"->",
"from",
"(",
")",
";",
"}",
"if",
"(",
"null",
"!=",
"$",
"this",
"->",
"oosql_join",
")",
"{",
"$",
"this",
"->",
"sql",
"... | Checks flags and clauses then assembles and executes the query
@throws \Exception
@return string|object
@throws \Exception | [
"Checks",
"flags",
"and",
"clauses",
"then",
"assembles",
"and",
"executes",
"the",
"query"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L969-L1029 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.prepFetch | protected function prepFetch()
{
if ($this->oosql_sub) {
return $this;
}
if (!$this->oosql_select instanceof oosql) {
$this->select();
}
$this->oosql_select->exe();
if (!$this->oosql_stmt) {
$msg = 'Query returned no results! ' . ... | php | protected function prepFetch()
{
if ($this->oosql_sub) {
return $this;
}
if (!$this->oosql_select instanceof oosql) {
$this->select();
}
$this->oosql_select->exe();
if (!$this->oosql_stmt) {
$msg = 'Query returned no results! ' . ... | [
"protected",
"function",
"prepFetch",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oosql_sub",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"oosql_select",
"instanceof",
"oosql",
")",
"{",
"$",
"this",
"->",
"select"... | Returns the results of a SELECT if any
@throws \InvalidArgumentException
@throws \Exception
@return \Phiber\oosql\oosql|\Phiber\oosql\collection | [
"Returns",
"the",
"results",
"of",
"a",
"SELECT",
"if",
"any"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1037-L1058 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.with | public function with(array $related)
{
$relations = $this->getEntityObject()->getRelations();
foreach ($relations as $fk => $target) {
$table = strstr($target, '.', true);
if (in_array($table, $related)) {
$this->sql(" ,$table.*");
$this->jo... | php | public function with(array $related)
{
$relations = $this->getEntityObject()->getRelations();
foreach ($relations as $fk => $target) {
$table = strstr($target, '.', true);
if (in_array($table, $related)) {
$this->sql(" ,$table.*");
$this->jo... | [
"public",
"function",
"with",
"(",
"array",
"$",
"related",
")",
"{",
"$",
"relations",
"=",
"$",
"this",
"->",
"getEntityObject",
"(",
")",
"->",
"getRelations",
"(",
")",
";",
"foreach",
"(",
"$",
"relations",
"as",
"$",
"fk",
"=>",
"$",
"target",
... | Creates a join automatically based on the relationships of current entity
@param array $related
@return \Phiber\oosql\oosql | [
"Creates",
"a",
"join",
"automatically",
"based",
"on",
"the",
"relationships",
"of",
"current",
"entity"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1144-L1164 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.limit | public function limit($from, $size)
{
if (!$this->oosql_multiFlag) {
$this->oosql_limit = ' LIMIT ' . $from . ', ' . $size;
}
return $this;
} | php | public function limit($from, $size)
{
if (!$this->oosql_multiFlag) {
$this->oosql_limit = ' LIMIT ' . $from . ', ' . $size;
}
return $this;
} | [
"public",
"function",
"limit",
"(",
"$",
"from",
",",
"$",
"size",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"oosql_multiFlag",
")",
"{",
"$",
"this",
"->",
"oosql_limit",
"=",
"' LIMIT '",
".",
"$",
"from",
".",
"', '",
".",
"$",
"size",
";",
... | Creates a limit clause for MySQL
@param integer $from Offset tostart from
@param integer $size Chunk size
@return \Phiber\oosql\oosql | [
"Creates",
"a",
"limit",
"clause",
"for",
"MySQL"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1172-L1178 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.orderBy | public function orderBy($field, $dir = 'ASC')
{
if (!$this->oosql_multiFlag) {
$this->oosql_order = ' ORDER BY ' . $field . ' ' . $dir;
}
return $this;
} | php | public function orderBy($field, $dir = 'ASC')
{
if (!$this->oosql_multiFlag) {
$this->oosql_order = ' ORDER BY ' . $field . ' ' . $dir;
}
return $this;
} | [
"public",
"function",
"orderBy",
"(",
"$",
"field",
",",
"$",
"dir",
"=",
"'ASC'",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"oosql_multiFlag",
")",
"{",
"$",
"this",
"->",
"oosql_order",
"=",
"' ORDER BY '",
".",
"$",
"field",
".",
"' '",
".",
... | Creates an ORDER BY clause
@param string $field Field name
@param string DESC|ASC
@return \Phiber\oosql\oosql | [
"Creates",
"an",
"ORDER",
"BY",
"clause"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1186-L1192 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.findOne | public function findOne($arg = null, $operator = '=', $fields = array('*'))
{
return $this->find($arg, $operator, $fields)->limit(0, 1);
} | php | public function findOne($arg = null, $operator = '=', $fields = array('*'))
{
return $this->find($arg, $operator, $fields)->limit(0, 1);
} | [
"public",
"function",
"findOne",
"(",
"$",
"arg",
"=",
"null",
",",
"$",
"operator",
"=",
"'='",
",",
"$",
"fields",
"=",
"array",
"(",
"'*'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"find",
"(",
"$",
"arg",
",",
"$",
"operator",
",",
"$",
... | Find first random value returned by the query
@param string $arg
@param string $operator
@param array $fields
@return \Phiber\oosql\oosql | [
"Find",
"first",
"random",
"value",
"returned",
"by",
"the",
"query"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1201-L1204 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.findLimited | public function findLimited($from, $to, $arg = null, $operator = '=', $fields = array('*'))
{
return $this->find($arg, $operator, $fields)->limit($from, $to);
} | php | public function findLimited($from, $to, $arg = null, $operator = '=', $fields = array('*'))
{
return $this->find($arg, $operator, $fields)->limit($from, $to);
} | [
"public",
"function",
"findLimited",
"(",
"$",
"from",
",",
"$",
"to",
",",
"$",
"arg",
"=",
"null",
",",
"$",
"operator",
"=",
"'='",
",",
"$",
"fields",
"=",
"array",
"(",
"'*'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"find",
"(",
"$",
"... | Find with limit
@param string $arg
@param integer $from
@param integer $to
@param string $operator
@param array $fields
@return \Phiber\oosql\oosql | [
"Find",
"with",
"limit"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1215-L1218 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.find | public function find($arg = null, $operator = '=', $fields = array('*'))
{
if ($fields[0] == '*') {
$this->select();
} else {
$select_args = '';
foreach ($fields as $key => $field) {
if (is_array($field) && is_string($key)) {
fo... | php | public function find($arg = null, $operator = '=', $fields = array('*'))
{
if ($fields[0] == '*') {
$this->select();
} else {
$select_args = '';
foreach ($fields as $key => $field) {
if (is_array($field) && is_string($key)) {
fo... | [
"public",
"function",
"find",
"(",
"$",
"arg",
"=",
"null",
",",
"$",
"operator",
"=",
"'='",
",",
"$",
"fields",
"=",
"array",
"(",
"'*'",
")",
")",
"{",
"if",
"(",
"$",
"fields",
"[",
"0",
"]",
"==",
"'*'",
")",
"{",
"$",
"this",
"->",
"sel... | Find records with a filtering condition
@param string $arg
@param string $operator
@param array $fields
@return \Phiber\oosql\oosql | [
"Find",
"records",
"with",
"a",
"filtering",
"condition"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1227-L1267 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.alias | public function alias($alias = null)
{
if (null === $alias) {
$alias = $this->getTableAlias();
}
$this->oosql_table_alias = $alias;
return $this;
} | php | public function alias($alias = null)
{
if (null === $alias) {
$alias = $this->getTableAlias();
}
$this->oosql_table_alias = $alias;
return $this;
} | [
"public",
"function",
"alias",
"(",
"$",
"alias",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"alias",
")",
"{",
"$",
"alias",
"=",
"$",
"this",
"->",
"getTableAlias",
"(",
")",
";",
"}",
"$",
"this",
"->",
"oosql_table_alias",
"=",
"$",
... | Creates or bind provided alias with the current loaded table class
@param string $alias
@return \Phiber\oosql\oosql | [
"Creates",
"or",
"bind",
"provided",
"alias",
"with",
"the",
"current",
"loaded",
"table",
"class"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1274-L1281 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.notIn | public function notIn($item, array $list, $cond = null, $not = true)
{
return $this->in($item, $list, $cond, $not);
} | php | public function notIn($item, array $list, $cond = null, $not = true)
{
return $this->in($item, $list, $cond, $not);
} | [
"public",
"function",
"notIn",
"(",
"$",
"item",
",",
"array",
"$",
"list",
",",
"$",
"cond",
"=",
"null",
",",
"$",
"not",
"=",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"in",
"(",
"$",
"item",
",",
"$",
"list",
",",
"$",
"cond",
",",
"... | Creates a NOT IN clause
@param mixed $item Subject of comparison
@param array $list A list of values
@param string $cond OR|AND
@param boolean $not | [
"Creates",
"a",
"NOT",
"IN",
"clause"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1332-L1335 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.orIn | public function orIn($item, array $list, $cond = 'or', $not = false)
{
return $this->in($item, $list, $cond, $not);
} | php | public function orIn($item, array $list, $cond = 'or', $not = false)
{
return $this->in($item, $list, $cond, $not);
} | [
"public",
"function",
"orIn",
"(",
"$",
"item",
",",
"array",
"$",
"list",
",",
"$",
"cond",
"=",
"'or'",
",",
"$",
"not",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"in",
"(",
"$",
"item",
",",
"$",
"list",
",",
"$",
"cond",
",",
"... | Creates a OR IN clause
@param mixed $item Subject of comparison
@param array $list A list of values
@param string $cond OR|AND
@param boolean $not | [
"Creates",
"a",
"OR",
"IN",
"clause"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1344-L1347 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.orNotIn | public function orNotIn($item, array $list, $cond = 'or', $not = true)
{
return $this->in($item, $list, $cond, $not);
} | php | public function orNotIn($item, array $list, $cond = 'or', $not = true)
{
return $this->in($item, $list, $cond, $not);
} | [
"public",
"function",
"orNotIn",
"(",
"$",
"item",
",",
"array",
"$",
"list",
",",
"$",
"cond",
"=",
"'or'",
",",
"$",
"not",
"=",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"in",
"(",
"$",
"item",
",",
"$",
"list",
",",
"$",
"cond",
",",
... | Creates an OR NOT IN clause
@param mixed $item Subject of comparison
@param array $list A list of values
@param string $cond OR|AND
@param boolean $not | [
"Creates",
"an",
"OR",
"NOT",
"IN",
"clause"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1356-L1359 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.in | public function in($item, array $list, $cond = null, $not = false)
{
$inClause = '';
if (null == $this->oosql_where && null == $this->oosql_in && null == $this->oosql_between) {
$inClause .= ' WHERE ';
} else {
$cnd = ' AND ';
if (null != $cond) {
... | php | public function in($item, array $list, $cond = null, $not = false)
{
$inClause = '';
if (null == $this->oosql_where && null == $this->oosql_in && null == $this->oosql_between) {
$inClause .= ' WHERE ';
} else {
$cnd = ' AND ';
if (null != $cond) {
... | [
"public",
"function",
"in",
"(",
"$",
"item",
",",
"array",
"$",
"list",
",",
"$",
"cond",
"=",
"null",
",",
"$",
"not",
"=",
"false",
")",
"{",
"$",
"inClause",
"=",
"''",
";",
"if",
"(",
"null",
"==",
"$",
"this",
"->",
"oosql_where",
"&&",
"... | Creates an IN clause
@param mixed $item Subject of comparison
@param array $list A list of values
@param string $cond OR|AND
@param boolean $not | [
"Creates",
"an",
"IN",
"clause"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1368-L1402 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.between | public function between($item, $low, $up, $cond = null, $not = false)
{
$bClause = '';
if (null == $this->oosql_where && null == $this->oosql_between && null == $this->oosql_in) {
$bClause .= ' WHERE ';
} else {
$cnd = ' AND ';
if (null != $cond) {
... | php | public function between($item, $low, $up, $cond = null, $not = false)
{
$bClause = '';
if (null == $this->oosql_where && null == $this->oosql_between && null == $this->oosql_in) {
$bClause .= ' WHERE ';
} else {
$cnd = ' AND ';
if (null != $cond) {
... | [
"public",
"function",
"between",
"(",
"$",
"item",
",",
"$",
"low",
",",
"$",
"up",
",",
"$",
"cond",
"=",
"null",
",",
"$",
"not",
"=",
"false",
")",
"{",
"$",
"bClause",
"=",
"''",
";",
"if",
"(",
"null",
"==",
"$",
"this",
"->",
"oosql_where... | Creates a BETWEEN clause
@param mixed $item
@param mixed $low
@param mixed $up
@param string $cond OR|AND
@param boolean $not
@return \Phiber\oosql\oosql | [
"Creates",
"a",
"BETWEEN",
"clause"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1413-L1440 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.transactional | public static function transactional($fn)
{
$oosql = self::getInstance('oosql', 'void');
if (!$oosql->beginTransaction()) {
$msg = 'Could not start this transaction. BeginTransaction failed!';
throw new \Exception($msg, 9815, null);
}
if (is_callable($fn)) {
... | php | public static function transactional($fn)
{
$oosql = self::getInstance('oosql', 'void');
if (!$oosql->beginTransaction()) {
$msg = 'Could not start this transaction. BeginTransaction failed!';
throw new \Exception($msg, 9815, null);
}
if (is_callable($fn)) {
... | [
"public",
"static",
"function",
"transactional",
"(",
"$",
"fn",
")",
"{",
"$",
"oosql",
"=",
"self",
"::",
"getInstance",
"(",
"'oosql'",
",",
"'void'",
")",
";",
"if",
"(",
"!",
"$",
"oosql",
"->",
"beginTransaction",
"(",
")",
")",
"{",
"$",
"msg"... | Starts a transaction if current driver supports it
@param callable $fn A Closure
@throws \Exception
@return mixed Whatever the Closure returns is passed to the higher scope variable if any | [
"Starts",
"a",
"transaction",
"if",
"current",
"driver",
"supports",
"it"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1474-L1487 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.getNamedLock | public function getNamedLock($name, $timeout = 15)
{
$stmt = $this->query('SELECT GET_LOCK("' . $name . '", '.$timeout .')');
return $stmt->fetch(self::FETCH_COLUMN);
} | php | public function getNamedLock($name, $timeout = 15)
{
$stmt = $this->query('SELECT GET_LOCK("' . $name . '", '.$timeout .')');
return $stmt->fetch(self::FETCH_COLUMN);
} | [
"public",
"function",
"getNamedLock",
"(",
"$",
"name",
",",
"$",
"timeout",
"=",
"15",
")",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"query",
"(",
"'SELECT GET_LOCK(\"'",
".",
"$",
"name",
".",
"'\", '",
".",
"$",
"timeout",
".",
"')'",
")",
";",
... | Try to obtain a named lock
@author Housseyn Guettaf
@param string $name - Lock name
@param int $timeout - Timeout
@return mixed | [
"Try",
"to",
"obtain",
"a",
"named",
"lock"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1499-L1504 | train |
ghousseyn/phiber | library/oosql/oosql.php | oosql.releaseNamedLock | public function releaseNamedLock($name)
{
$stmt = $this->query('SELECT RELEASE_LOCK("' . $name . '")');
return $stmt->fetch(self::FETCH_COLUMN);
} | php | public function releaseNamedLock($name)
{
$stmt = $this->query('SELECT RELEASE_LOCK("' . $name . '")');
return $stmt->fetch(self::FETCH_COLUMN);
} | [
"public",
"function",
"releaseNamedLock",
"(",
"$",
"name",
")",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"query",
"(",
"'SELECT RELEASE_LOCK(\"'",
".",
"$",
"name",
".",
"'\")'",
")",
";",
"return",
"$",
"stmt",
"->",
"fetch",
"(",
"self",
"::",
"FET... | releases a named lock
@author Housseyn Guettaf
@param string $name - Lock name
@return mixed | [
"releases",
"a",
"named",
"lock"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1514-L1519 | train |
zbox/UnifiedPush | src/Zbox/UnifiedPush/Notification/PayloadHandler/APNS.php | APNS.packPayload | public function packPayload($payload)
{
$payload = JsonEncoder::jsonEncode($payload);
/** @var APNSMessage $message */
$message = $this->message;
$recipientId = $message->getRecipientDeviceCollection()->current()->getIdentifier();
$messageRecipientId = $this->notificationI... | php | public function packPayload($payload)
{
$payload = JsonEncoder::jsonEncode($payload);
/** @var APNSMessage $message */
$message = $this->message;
$recipientId = $message->getRecipientDeviceCollection()->current()->getIdentifier();
$messageRecipientId = $this->notificationI... | [
"public",
"function",
"packPayload",
"(",
"$",
"payload",
")",
"{",
"$",
"payload",
"=",
"JsonEncoder",
"::",
"jsonEncode",
"(",
"$",
"payload",
")",
";",
"/** @var APNSMessage $message */",
"$",
"message",
"=",
"$",
"this",
"->",
"message",
";",
"$",
"recip... | Pack message body into binary string
@param array $payload
@return string | [
"Pack",
"message",
"body",
"into",
"binary",
"string"
] | 47da2d0577b18ac709cd947c68541014001e1866 | https://github.com/zbox/UnifiedPush/blob/47da2d0577b18ac709cd947c68541014001e1866/src/Zbox/UnifiedPush/Notification/PayloadHandler/APNS.php#L77-L99 | train |
newestindustry/ginger-rest | src/Ginger/Routes.php | Routes.set | public static function set($uri, $path = false)
{
$route = new \Ginger\Route($uri, $path);
self::$routes[$route->route] = $route;
} | php | public static function set($uri, $path = false)
{
$route = new \Ginger\Route($uri, $path);
self::$routes[$route->route] = $route;
} | [
"public",
"static",
"function",
"set",
"(",
"$",
"uri",
",",
"$",
"path",
"=",
"false",
")",
"{",
"$",
"route",
"=",
"new",
"\\",
"Ginger",
"\\",
"Route",
"(",
"$",
"uri",
",",
"$",
"path",
")",
";",
"self",
"::",
"$",
"routes",
"[",
"$",
"rout... | set function.
@access public
@static
@param mixed $uri
@param bool $path (default: false)
@return void | [
"set",
"function",
"."
] | 482b77dc122a60ab0bf143a3c4a1e67168985c83 | https://github.com/newestindustry/ginger-rest/blob/482b77dc122a60ab0bf143a3c4a1e67168985c83/src/Ginger/Routes.php#L48-L52 | train |
newestindustry/ginger-rest | src/Ginger/Routes.php | Routes.detect | public static function detect($uri)
{
$routes = self::get();
$found = false;
foreach($routes as $key => $route) {
$currentLength = strlen($route->route);
if(substr($uri, 0, $currentLength) == $route->route) {
$found = $route;
break;
... | php | public static function detect($uri)
{
$routes = self::get();
$found = false;
foreach($routes as $key => $route) {
$currentLength = strlen($route->route);
if(substr($uri, 0, $currentLength) == $route->route) {
$found = $route;
break;
... | [
"public",
"static",
"function",
"detect",
"(",
"$",
"uri",
")",
"{",
"$",
"routes",
"=",
"self",
"::",
"get",
"(",
")",
";",
"$",
"found",
"=",
"false",
";",
"foreach",
"(",
"$",
"routes",
"as",
"$",
"key",
"=>",
"$",
"route",
")",
"{",
"$",
"c... | detect function.
@access public
@static
@param string $uri
@return false|\Ginger\Route | [
"detect",
"function",
"."
] | 482b77dc122a60ab0bf143a3c4a1e67168985c83 | https://github.com/newestindustry/ginger-rest/blob/482b77dc122a60ab0bf143a3c4a1e67168985c83/src/Ginger/Routes.php#L74-L87 | train |
schpill/thin | src/Html/Qwerly.php | Qwerly._lookUpBy | private function _lookUpBy($service, $data)
{
$batch = false;
$urlFormat = self::$URLS[$service];
if (is_array($data)) {
$data = implode(',', $data);
$batch = true;
}
$url = self::BASE_URL . sprintf($urlFormat, urlenco... | php | private function _lookUpBy($service, $data)
{
$batch = false;
$urlFormat = self::$URLS[$service];
if (is_array($data)) {
$data = implode(',', $data);
$batch = true;
}
$url = self::BASE_URL . sprintf($urlFormat, urlenco... | [
"private",
"function",
"_lookUpBy",
"(",
"$",
"service",
",",
"$",
"data",
")",
"{",
"$",
"batch",
"=",
"false",
";",
"$",
"urlFormat",
"=",
"self",
"::",
"$",
"URLS",
"[",
"$",
"service",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
"... | Looks up an user using the given service data.
@param string $service Service to look up with.
@param mixed $data Data relevant to the service.
@return Qwerly_API_Response|null
@throws Qwerly_API_ErrorException
@throws Qwerly_API_NotFoundException | [
"Looks",
"up",
"an",
"user",
"using",
"the",
"given",
"service",
"data",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Qwerly.php#L120-L154 | train |
chilimatic/chilimatic-framework | lib/database/sql/mysql/Collection.php | Collection._checkdatabase | private function _checkdatabase($database)
{
if (count($this->_collection) == 0) {
$this->_collection[$database] = new $database();
return $this->_collection[$database];
}
$new = false;
foreach ($this->_collection as $db) {
if ($db === $database... | php | private function _checkdatabase($database)
{
if (count($this->_collection) == 0) {
$this->_collection[$database] = new $database();
return $this->_collection[$database];
}
$new = false;
foreach ($this->_collection as $db) {
if ($db === $database... | [
"private",
"function",
"_checkdatabase",
"(",
"$",
"database",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"_collection",
")",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"_collection",
"[",
"$",
"database",
"]",
"=",
"new",
"$",
"database",
"(... | checks if a database already exists
@param $database
@return $this | [
"checks",
"if",
"a",
"database",
"already",
"exists"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/database/sql/mysql/Collection.php#L79-L99 | train |
acacha/forge-publish | src/Console/Commands/Traits/PossibleEmails.php | PossibleEmails.getPossibleEmails | protected function getPossibleEmails()
{
$this->checkGit();
$github_email = null;
$github_email = str_replace(array("\r", "\n"), '', shell_exec('git config user.email'));
if (filter_var($github_email, FILTER_VALIDATE_EMAIL)) {
return [ $github_email ];
} else {
... | php | protected function getPossibleEmails()
{
$this->checkGit();
$github_email = null;
$github_email = str_replace(array("\r", "\n"), '', shell_exec('git config user.email'));
if (filter_var($github_email, FILTER_VALIDATE_EMAIL)) {
return [ $github_email ];
} else {
... | [
"protected",
"function",
"getPossibleEmails",
"(",
")",
"{",
"$",
"this",
"->",
"checkGit",
"(",
")",
";",
"$",
"github_email",
"=",
"null",
";",
"$",
"github_email",
"=",
"str_replace",
"(",
"array",
"(",
"\"\\r\"",
",",
"\"\\n\"",
")",
",",
"''",
",",
... | Get possible emails
@return array | [
"Get",
"possible",
"emails"
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/Traits/PossibleEmails.php#L20-L31 | train |
acacha/forge-publish | src/Console/Commands/PublishMySQLUsers.php | PublishMySQLUsers.createMySQLUser | protected function createMySQLUser()
{
$this->checkParameters();
$this->url = $this->obtainAPIURLEndpoint();
$this->http->post($this->url, [
'form_params' => $this->getData(),
'headers' => [
'X-Requested-With' => 'XMLHttpRequest',
... | php | protected function createMySQLUser()
{
$this->checkParameters();
$this->url = $this->obtainAPIURLEndpoint();
$this->http->post($this->url, [
'form_params' => $this->getData(),
'headers' => [
'X-Requested-With' => 'XMLHttpRequest',
... | [
"protected",
"function",
"createMySQLUser",
"(",
")",
"{",
"$",
"this",
"->",
"checkParameters",
"(",
")",
";",
"$",
"this",
"->",
"url",
"=",
"$",
"this",
"->",
"obtainAPIURLEndpoint",
"(",
")",
";",
"$",
"this",
"->",
"http",
"->",
"post",
"(",
"$",
... | Create MySQL user. | [
"Create",
"MySQL",
"user",
"."
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/PublishMySQLUsers.php#L75-L87 | train |
acacha/forge-publish | src/Console/Commands/PublishMySQLUsers.php | PublishMySQLUsers.listMySQLUsers | protected function listMySQLUsers()
{
$this->url = $this->obtainAPIURLEndpointForList();
$response = $this->http->get($this->url, [
'headers' => [
'X-Requested-With' => 'XMLHttpRequest',
'Authorization' => 'Bearer ' . fp_env('ACACHA_FORGE_ACCES... | php | protected function listMySQLUsers()
{
$this->url = $this->obtainAPIURLEndpointForList();
$response = $this->http->get($this->url, [
'headers' => [
'X-Requested-With' => 'XMLHttpRequest',
'Authorization' => 'Bearer ' . fp_env('ACACHA_FORGE_ACCES... | [
"protected",
"function",
"listMySQLUsers",
"(",
")",
"{",
"$",
"this",
"->",
"url",
"=",
"$",
"this",
"->",
"obtainAPIURLEndpointForList",
"(",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"http",
"->",
"get",
"(",
"$",
"this",
"->",
"url",
",",
... | List MySQL users. | [
"List",
"MySQL",
"users",
"."
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/PublishMySQLUsers.php#L92-L129 | train |
acacha/forge-publish | src/Console/Commands/Traits/InteractsWithEnvironment.php | InteractsWithEnvironment.addValueToEnv | protected function addValueToEnv($key, $value)
{
$env_path = base_path('.env');
$sed_command = "/bin/sed -i '/^$key=/d' " . $env_path;
passthru($sed_command);
File::append($env_path, "\n$key=$value\n");
} | php | protected function addValueToEnv($key, $value)
{
$env_path = base_path('.env');
$sed_command = "/bin/sed -i '/^$key=/d' " . $env_path;
passthru($sed_command);
File::append($env_path, "\n$key=$value\n");
} | [
"protected",
"function",
"addValueToEnv",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"env_path",
"=",
"base_path",
"(",
"'.env'",
")",
";",
"$",
"sed_command",
"=",
"\"/bin/sed -i '/^$key=/d' \"",
".",
"$",
"env_path",
";",
"passthru",
"(",
"$",
"s... | Add value to env.
@param $key
@param $value | [
"Add",
"value",
"to",
"env",
"."
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/Traits/InteractsWithEnvironment.php#L20-L26 | train |
PlatoCreative/silverstripe-sections | code/models/Section.php | Section.Anchor | public function Anchor(){
if ($this->MenuTitle && $this->ShowInMenus) {
return strtolower(trim(preg_replace('/[^a-zA-Z0-9]+/', '-',$this->MenuTitle), '-'));
}
return false;
} | php | public function Anchor(){
if ($this->MenuTitle && $this->ShowInMenus) {
return strtolower(trim(preg_replace('/[^a-zA-Z0-9]+/', '-',$this->MenuTitle), '-'));
}
return false;
} | [
"public",
"function",
"Anchor",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"MenuTitle",
"&&",
"$",
"this",
"->",
"ShowInMenus",
")",
"{",
"return",
"strtolower",
"(",
"trim",
"(",
"preg_replace",
"(",
"'/[^a-zA-Z0-9]+/'",
",",
"'-'",
",",
"$",
"this",
... | Applies anchor to section in template.
@return string $classes | [
"Applies",
"anchor",
"to",
"section",
"in",
"template",
"."
] | 54c96146ea8cc625b00ee009753539658f10d01a | https://github.com/PlatoCreative/silverstripe-sections/blob/54c96146ea8cc625b00ee009753539658f10d01a/code/models/Section.php#L245-L250 | train |
PlatoCreative/silverstripe-sections | code/models/Section.php | Section.Classes | public function Classes(){
$classes = array($this->config()->get('base_class'));
if ($this->Style) {
$classes[] = strtolower($this->Style).'-'.strtolower(preg_replace('/([a-z]+)([A-Z0-9])/', '$1-$2', get_called_class()));
}else{
$classes[] = strtolower(preg_replace('/([a-... | php | public function Classes(){
$classes = array($this->config()->get('base_class'));
if ($this->Style) {
$classes[] = strtolower($this->Style).'-'.strtolower(preg_replace('/([a-z]+)([A-Z0-9])/', '$1-$2', get_called_class()));
}else{
$classes[] = strtolower(preg_replace('/([a-... | [
"public",
"function",
"Classes",
"(",
")",
"{",
"$",
"classes",
"=",
"array",
"(",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'base_class'",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"Style",
")",
"{",
"$",
"classes",
"[",
"]",
... | Applies classes to section in template.
@return string $classes | [
"Applies",
"classes",
"to",
"section",
"in",
"template",
"."
] | 54c96146ea8cc625b00ee009753539658f10d01a | https://github.com/PlatoCreative/silverstripe-sections/blob/54c96146ea8cc625b00ee009753539658f10d01a/code/models/Section.php#L269-L277 | train |
smalldb/libSmalldb | class/Utils/Utils.php | Utils.write_json_file | static function write_json_file($filename, $json_array, array $whitelist = null, $json_options = null)
{
$stop_snippet = "<?php printf('_%c%c}%c',34,10,10);__halt_compiler();?>";
if ($whitelist === null) {
// Put stop snippet on begin.
$result = array_merge(array('_' => null), $json_array);
} else {
//... | php | static function write_json_file($filename, $json_array, array $whitelist = null, $json_options = null)
{
$stop_snippet = "<?php printf('_%c%c}%c',34,10,10);__halt_compiler();?>";
if ($whitelist === null) {
// Put stop snippet on begin.
$result = array_merge(array('_' => null), $json_array);
} else {
//... | [
"static",
"function",
"write_json_file",
"(",
"$",
"filename",
",",
"$",
"json_array",
",",
"array",
"$",
"whitelist",
"=",
"null",
",",
"$",
"json_options",
"=",
"null",
")",
"{",
"$",
"stop_snippet",
"=",
"\"<?php printf('_%c%c}%c',34,10,10);__halt_compiler();?>\"... | Encode array to JSON using json_encode, but insert PHP snippet to protect
sensitive data.
If $filename is set, JSON will be written to given file. Otherwise you are
expected to store returned string into *.json.php file.
Stop snippet: When JSON file is evaluated as PHP, stop snippet will
interrupt evaluation without ... | [
"Encode",
"array",
"to",
"JSON",
"using",
"json_encode",
"but",
"insert",
"PHP",
"snippet",
"to",
"protect",
"sensitive",
"data",
"."
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/Utils/Utils.php#L262-L297 | train |
SpoonX/SxBootstrap | src/SxBootstrap/Service/BootstrapFilter.php | BootstrapFilter.filterLoad | public function filterLoad(AssetInterface $asset)
{
$assetRoot = $asset->getSourceRoot();
$assetPath = $asset->getSourcePath();
$assetImportDir = dirname($assetRoot . '/' . $assetPath);
$importDir = $this->config->getBootstrapPath() . '/less';
$this->setupLoad... | php | public function filterLoad(AssetInterface $asset)
{
$assetRoot = $asset->getSourceRoot();
$assetPath = $asset->getSourcePath();
$assetImportDir = dirname($assetRoot . '/' . $assetPath);
$importDir = $this->config->getBootstrapPath() . '/less';
$this->setupLoad... | [
"public",
"function",
"filterLoad",
"(",
"AssetInterface",
"$",
"asset",
")",
"{",
"$",
"assetRoot",
"=",
"$",
"asset",
"->",
"getSourceRoot",
"(",
")",
";",
"$",
"assetPath",
"=",
"$",
"asset",
"->",
"getSourcePath",
"(",
")",
";",
"$",
"assetImportDir",
... | Sets the by-config generated imports on the asset.
{@inheritDoc} | [
"Sets",
"the",
"by",
"-",
"config",
"generated",
"imports",
"on",
"the",
"asset",
"."
] | 768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6 | https://github.com/SpoonX/SxBootstrap/blob/768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6/src/SxBootstrap/Service/BootstrapFilter.php#L86-L127 | train |
SpoonX/SxBootstrap | src/SxBootstrap/Service/BootstrapFilter.php | BootstrapFilter.extractImports | protected function extractImports($importsFile)
{
$str = file_get_contents($importsFile);
preg_match_all('/@import "(?!variables)(?<imports>[\w-_\.]+)";/', $str, $matches);
return array_map('trim', $matches['imports']);
} | php | protected function extractImports($importsFile)
{
$str = file_get_contents($importsFile);
preg_match_all('/@import "(?!variables)(?<imports>[\w-_\.]+)";/', $str, $matches);
return array_map('trim', $matches['imports']);
} | [
"protected",
"function",
"extractImports",
"(",
"$",
"importsFile",
")",
"{",
"$",
"str",
"=",
"file_get_contents",
"(",
"$",
"importsFile",
")",
";",
"preg_match_all",
"(",
"'/@import \"(?!variables)(?<imports>[\\w-_\\.]+)\";/'",
",",
"$",
"str",
",",
"$",
"matches... | Extract the imports from the import file.
@param string $importsFile
@return array The extracted imports | [
"Extract",
"the",
"imports",
"from",
"the",
"import",
"file",
"."
] | 768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6 | https://github.com/SpoonX/SxBootstrap/blob/768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6/src/SxBootstrap/Service/BootstrapFilter.php#L136-L143 | train |
SpoonX/SxBootstrap | src/SxBootstrap/Service/BootstrapFilter.php | BootstrapFilter.extractVariables | protected function extractVariables($variablesFile)
{
$str = file_get_contents($variablesFile);
$parts = explode(';', preg_replace('/(\/\/.*?\n|\s\n|\s{2,})/', '', $str));
$vars = array();
foreach ($parts as $part) {
$varMeta = explode(':', $part);
if (emp... | php | protected function extractVariables($variablesFile)
{
$str = file_get_contents($variablesFile);
$parts = explode(';', preg_replace('/(\/\/.*?\n|\s\n|\s{2,})/', '', $str));
$vars = array();
foreach ($parts as $part) {
$varMeta = explode(':', $part);
if (emp... | [
"protected",
"function",
"extractVariables",
"(",
"$",
"variablesFile",
")",
"{",
"$",
"str",
"=",
"file_get_contents",
"(",
"$",
"variablesFile",
")",
";",
"$",
"parts",
"=",
"explode",
"(",
"';'",
",",
"preg_replace",
"(",
"'/(\\/\\/.*?\\n|\\s\\n|\\s{2,})/'",
... | Extract the variables from the less file.
@param string $variablesFile The path to the less file
@return array The extracted variables | [
"Extract",
"the",
"variables",
"from",
"the",
"less",
"file",
"."
] | 768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6 | https://github.com/SpoonX/SxBootstrap/blob/768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6/src/SxBootstrap/Service/BootstrapFilter.php#L152-L167 | train |
SpoonX/SxBootstrap | src/SxBootstrap/Service/BootstrapFilter.php | BootstrapFilter.filterImportFiles | protected function filterImportFiles(array $imports)
{
$config = $this->config;
$excludedComponents = $config->getExcludedComponents();
$includedComponents = $config->getIncludedComponents();
if (!empty($excludedComponents) && !empty($includedComponents)) {
t... | php | protected function filterImportFiles(array $imports)
{
$config = $this->config;
$excludedComponents = $config->getExcludedComponents();
$includedComponents = $config->getIncludedComponents();
if (!empty($excludedComponents) && !empty($includedComponents)) {
t... | [
"protected",
"function",
"filterImportFiles",
"(",
"array",
"$",
"imports",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
";",
"$",
"excludedComponents",
"=",
"$",
"config",
"->",
"getExcludedComponents",
"(",
")",
";",
"$",
"includedComponents",
... | Filter the import files needed.
@param array $imports
@throws \SxBootstrap\Exception\RuntimeException
@return array | [
"Filter",
"the",
"import",
"files",
"needed",
"."
] | 768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6 | https://github.com/SpoonX/SxBootstrap/blob/768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6/src/SxBootstrap/Service/BootstrapFilter.php#L177-L202 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.