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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Etenil/assegai | src/assegai/modules/validator/Validator.php | Validator.oneOf | public function oneOf($allowed, $message = null)
{
if (is_string($allowed)) {
$allowed = explode(',', $allowed);
}
$this->setRule(__FUNCTION__, function($val, $args)
{
return in_array($val, $args[0]);
}, $m... | php | public function oneOf($allowed, $message = null)
{
if (is_string($allowed)) {
$allowed = explode(',', $allowed);
}
$this->setRule(__FUNCTION__, function($val, $args)
{
return in_array($val, $args[0]);
}, $m... | [
"public",
"function",
"oneOf",
"(",
"$",
"allowed",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"allowed",
")",
")",
"{",
"$",
"allowed",
"=",
"explode",
"(",
"','",
",",
"$",
"allowed",
")",
";",
"}",
"$",
"this... | Field has to be one of the allowed ones.
@param string|array $allowed Allowed values.
@param string $message
@return FormValidator | [
"Field",
"has",
"to",
"be",
"one",
"of",
"the",
"allowed",
"ones",
"."
] | d43cce1a88f1c332f60dd0a4374b17764852af9e | https://github.com/Etenil/assegai/blob/d43cce1a88f1c332f60dd0a4374b17764852af9e/src/assegai/modules/validator/Validator.php#L604-L615 | train |
Etenil/assegai | src/assegai/modules/validator/Validator.php | Validator._applyFilter | protected function _applyFilter(&$val)
{
if (is_array($val)) {
foreach($val as $key => &$item) {
$this->_applyFilter($item);
}
} else {
foreach($this->filters as $filter) {
$val = $filter($val);
}
}
} | php | protected function _applyFilter(&$val)
{
if (is_array($val)) {
foreach($val as $key => &$item) {
$this->_applyFilter($item);
}
} else {
foreach($this->filters as $filter) {
$val = $filter($val);
}
}
} | [
"protected",
"function",
"_applyFilter",
"(",
"&",
"$",
"val",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"val",
")",
")",
"{",
"foreach",
"(",
"$",
"val",
"as",
"$",
"key",
"=>",
"&",
"$",
"item",
")",
"{",
"$",
"this",
"->",
"_applyFilter",
"("... | recursively apply filters to a value
@access protected
@param mixed $val reference
@return void | [
"recursively",
"apply",
"filters",
"to",
"a",
"value"
] | d43cce1a88f1c332f60dd0a4374b17764852af9e | https://github.com/Etenil/assegai/blob/d43cce1a88f1c332f60dd0a4374b17764852af9e/src/assegai/modules/validator/Validator.php#L686-L697 | train |
Etenil/assegai | src/assegai/modules/validator/Validator.php | Validator._validate | protected function _validate($key, $val)
{
// try each rule function
foreach ($this->rules as $rule => $is_true) {
if ($is_true) {
$function = $this->functions[$rule];
$args = $this->arguments[$rule]; // Arguments of rule
$valid = true;
... | php | protected function _validate($key, $val)
{
// try each rule function
foreach ($this->rules as $rule => $is_true) {
if ($is_true) {
$function = $this->functions[$rule];
$args = $this->arguments[$rule]; // Arguments of rule
$valid = true;
... | [
"protected",
"function",
"_validate",
"(",
"$",
"key",
",",
"$",
"val",
")",
"{",
"// try each rule function",
"foreach",
"(",
"$",
"this",
"->",
"rules",
"as",
"$",
"rule",
"=>",
"$",
"is_true",
")",
"{",
"if",
"(",
"$",
"is_true",
")",
"{",
"$",
"f... | recursively validates a value
@access protected
@param string $key
@param mixed $val
@return bool | [
"recursively",
"validates",
"a",
"value"
] | d43cce1a88f1c332f60dd0a4374b17764852af9e | https://github.com/Etenil/assegai/blob/d43cce1a88f1c332f60dd0a4374b17764852af9e/src/assegai/modules/validator/Validator.php#L732-L761 | train |
Etenil/assegai | src/assegai/modules/validator/Validator.php | Validator.getAllErrors | public function getAllErrors($keys = true)
{
return ($keys == true) ? $this->errors : array_values($this->errors);
} | php | public function getAllErrors($keys = true)
{
return ($keys == true) ? $this->errors : array_values($this->errors);
} | [
"public",
"function",
"getAllErrors",
"(",
"$",
"keys",
"=",
"true",
")",
"{",
"return",
"(",
"$",
"keys",
"==",
"true",
")",
"?",
"$",
"this",
"->",
"errors",
":",
"array_values",
"(",
"$",
"this",
"->",
"errors",
")",
";",
"}"
] | Get all errors.
@return array | [
"Get",
"all",
"errors",
"."
] | d43cce1a88f1c332f60dd0a4374b17764852af9e | https://github.com/Etenil/assegai/blob/d43cce1a88f1c332f60dd0a4374b17764852af9e/src/assegai/modules/validator/Validator.php#L788-L791 | train |
Etenil/assegai | src/assegai/modules/validator/Validator.php | Validator.registerError | protected function registerError($rule, $key, $message = null)
{
if (empty($message)) {
$message = $this->messages[$rule];
}
$this->errors[$key] = sprintf($message, $this->fields[$key]);
} | php | protected function registerError($rule, $key, $message = null)
{
if (empty($message)) {
$message = $this->messages[$rule];
}
$this->errors[$key] = sprintf($message, $this->fields[$key]);
} | [
"protected",
"function",
"registerError",
"(",
"$",
"rule",
",",
"$",
"key",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"message",
")",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"messages",
"[",
"$",
"rule",
... | Register error.
@param string $rule
@param string $key
@param string $message | [
"Register",
"error",
"."
] | d43cce1a88f1c332f60dd0a4374b17764852af9e | https://github.com/Etenil/assegai/blob/d43cce1a88f1c332f60dd0a4374b17764852af9e/src/assegai/modules/validator/Validator.php#L853-L860 | train |
Etenil/assegai | src/assegai/modules/validator/Validator.php | Validator.setRule | public function setRule($rule, $function, $message = '', $args = array())
{
if (!array_key_exists($rule, $this->rules)) {
$this->rules[$rule] = TRUE;
if (!array_key_exists($rule, $this->functions)) {
if (!is_callable($function)) {
die('Invalid func... | php | public function setRule($rule, $function, $message = '', $args = array())
{
if (!array_key_exists($rule, $this->rules)) {
$this->rules[$rule] = TRUE;
if (!array_key_exists($rule, $this->functions)) {
if (!is_callable($function)) {
die('Invalid func... | [
"public",
"function",
"setRule",
"(",
"$",
"rule",
",",
"$",
"function",
",",
"$",
"message",
"=",
"''",
",",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"rule",
",",
"$",
"this",
"->",
"rules",
")... | Set rule.
@param string $rule
@param closure $function
@param string $message
@param array $args | [
"Set",
"rule",
"."
] | d43cce1a88f1c332f60dd0a4374b17764852af9e | https://github.com/Etenil/assegai/blob/d43cce1a88f1c332f60dd0a4374b17764852af9e/src/assegai/modules/validator/Validator.php#L870-L884 | train |
datto/core-enumerator | src/Core/Enumerator.php | Enumerator.getClasses | public static function getClasses($namespace, $conditions = [])
{
self::_setupRoot();
$namespace = explode('\\', trim($namespace, '\\'));
$composerNamespaces = self::getComposerNamespaces();
$searchPaths = [];
// for each Composer namespace, assess whether it may contain the namespace $namespace.
fo... | php | public static function getClasses($namespace, $conditions = [])
{
self::_setupRoot();
$namespace = explode('\\', trim($namespace, '\\'));
$composerNamespaces = self::getComposerNamespaces();
$searchPaths = [];
// for each Composer namespace, assess whether it may contain the namespace $namespace.
fo... | [
"public",
"static",
"function",
"getClasses",
"(",
"$",
"namespace",
",",
"$",
"conditions",
"=",
"[",
"]",
")",
"{",
"self",
"::",
"_setupRoot",
"(",
")",
";",
"$",
"namespace",
"=",
"explode",
"(",
"'\\\\'",
",",
"trim",
"(",
"$",
"namespace",
",",
... | Return a list of classes under a given namespace. It is an error to enumerate the root namespace.
@param string Namespace name. Trailing backslash may be omitted.
@param Limiting rules. An array of constraints on the returned results. Currently
the only supported constraints are "implements" (string - class name) and "... | [
"Return",
"a",
"list",
"of",
"classes",
"under",
"a",
"given",
"namespace",
".",
"It",
"is",
"an",
"error",
"to",
"enumerate",
"the",
"root",
"namespace",
"."
] | 90cdcc90cc0453c35e7b2d2e941d23abd6e9cf39 | https://github.com/datto/core-enumerator/blob/90cdcc90cc0453c35e7b2d2e941d23abd6e9cf39/src/Core/Enumerator.php#L53-L102 | train |
datto/core-enumerator | src/Core/Enumerator.php | Enumerator.getComposerModule | public static function getComposerModule($className)
{
global $Composer;
if ( $result = $Composer->findFile($className) ) {
$result = substr($result, strlen(self::$root));
if ( preg_match('#^vendor/([a-z0-9_-]+/[a-z0-9_-]+)/#', $result, $match) ) {
return $match[1];
}
}
return null;
} | php | public static function getComposerModule($className)
{
global $Composer;
if ( $result = $Composer->findFile($className) ) {
$result = substr($result, strlen(self::$root));
if ( preg_match('#^vendor/([a-z0-9_-]+/[a-z0-9_-]+)/#', $result, $match) ) {
return $match[1];
}
}
return null;
} | [
"public",
"static",
"function",
"getComposerModule",
"(",
"$",
"className",
")",
"{",
"global",
"$",
"Composer",
";",
"if",
"(",
"$",
"result",
"=",
"$",
"Composer",
"->",
"findFile",
"(",
"$",
"className",
")",
")",
"{",
"$",
"result",
"=",
"substr",
... | Return the name of the composer module where a given class lives.
@param string Class name
@return mixed String if it lives in a module, or null if the root | [
"Return",
"the",
"name",
"of",
"the",
"composer",
"module",
"where",
"a",
"given",
"class",
"lives",
"."
] | 90cdcc90cc0453c35e7b2d2e941d23abd6e9cf39 | https://github.com/datto/core-enumerator/blob/90cdcc90cc0453c35e7b2d2e941d23abd6e9cf39/src/Core/Enumerator.php#L110-L123 | train |
datto/core-enumerator | src/Core/Enumerator.php | Enumerator.getComposerNamespaces | private static function getComposerNamespaces()
{
static $result = null;
if ( !is_array($result) ) {
$result = require self::$root . 'vendor/composer/autoload_namespaces.php';
foreach ( $result as $ns => &$paths ) {
$subpath = trim(str_replace('\\', DIRECTORY_SEPARATOR, $ns), DIRECTORY_SEPARATOR);... | php | private static function getComposerNamespaces()
{
static $result = null;
if ( !is_array($result) ) {
$result = require self::$root . 'vendor/composer/autoload_namespaces.php';
foreach ( $result as $ns => &$paths ) {
$subpath = trim(str_replace('\\', DIRECTORY_SEPARATOR, $ns), DIRECTORY_SEPARATOR);... | [
"private",
"static",
"function",
"getComposerNamespaces",
"(",
")",
"{",
"static",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"result",
")",
")",
"{",
"$",
"result",
"=",
"require",
"self",
"::",
"$",
"root",
".",
"'vendor/c... | Get Composer's namespace list.
@return array
@access private
@static | [
"Get",
"Composer",
"s",
"namespace",
"list",
"."
] | 90cdcc90cc0453c35e7b2d2e941d23abd6e9cf39 | https://github.com/datto/core-enumerator/blob/90cdcc90cc0453c35e7b2d2e941d23abd6e9cf39/src/Core/Enumerator.php#L132-L165 | train |
datto/core-enumerator | src/Core/Enumerator.php | Enumerator.searchPath | private static function searchPath($prefix, $path, $conditions)
{
$result = [];
$dir = new DirectoryIterator($path);
foreach ( $dir as $entry ) {
if ( $entry->isDot() ) {
continue;
}
$de = $entry->getFilename();
if ( $entry->isDir() && preg_match('/^[A-Za-z_]+$/', $de) ) {
// it's ... | php | private static function searchPath($prefix, $path, $conditions)
{
$result = [];
$dir = new DirectoryIterator($path);
foreach ( $dir as $entry ) {
if ( $entry->isDot() ) {
continue;
}
$de = $entry->getFilename();
if ( $entry->isDir() && preg_match('/^[A-Za-z_]+$/', $de) ) {
// it's ... | [
"private",
"static",
"function",
"searchPath",
"(",
"$",
"prefix",
",",
"$",
"path",
",",
"$",
"conditions",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"dir",
"=",
"new",
"DirectoryIterator",
"(",
"$",
"path",
")",
";",
"foreach",
"(",
"$",
... | Search one directory recursively for classes belonging to a given namespace.
@param string Namespace to search for
@param string Directory to search
@param array Search conditions
@return array
@access private
@static | [
"Search",
"one",
"directory",
"recursively",
"for",
"classes",
"belonging",
"to",
"a",
"given",
"namespace",
"."
] | 90cdcc90cc0453c35e7b2d2e941d23abd6e9cf39 | https://github.com/datto/core-enumerator/blob/90cdcc90cc0453c35e7b2d2e941d23abd6e9cf39/src/Core/Enumerator.php#L177-L287 | train |
datto/core-enumerator | src/Core/Enumerator.php | Enumerator._setupRoot | private static function _setupRoot()
{
if ( !empty(self::$root) ) {
// avoid duplicating efforts... only set root if it's not already set
return;
}
if ( defined('ROOT') ) {
self::$root = rtrim(ROOT, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
}
else if ( !empty($GLOBALS['baseDir']) ) {
self::... | php | private static function _setupRoot()
{
if ( !empty(self::$root) ) {
// avoid duplicating efforts... only set root if it's not already set
return;
}
if ( defined('ROOT') ) {
self::$root = rtrim(ROOT, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
}
else if ( !empty($GLOBALS['baseDir']) ) {
self::... | [
"private",
"static",
"function",
"_setupRoot",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"self",
"::",
"$",
"root",
")",
")",
"{",
"// avoid duplicating efforts... only set root if it's not already set ",
"return",
";",
"}",
"if",
"(",
"defined",
"(",
"'ROOT'... | Determine the project root directory. | [
"Determine",
"the",
"project",
"root",
"directory",
"."
] | 90cdcc90cc0453c35e7b2d2e941d23abd6e9cf39 | https://github.com/datto/core-enumerator/blob/90cdcc90cc0453c35e7b2d2e941d23abd6e9cf39/src/Core/Enumerator.php#L292-L335 | train |
phramework/phramework | src/URIStrategy/URITemplate.php | URITemplate.URI | public static function URI()
{
$REDIRECT_QUERY_STRING =
isset($_SERVER['QUERY_STRING'])
? $_SERVER['QUERY_STRING']
: '';
$REDIRECT_URL = '';
if (isset($_SERVER['REQUEST_URI'])) {
$url_parts = parse_url($_SERVER['REQUEST_URI']);
$R... | php | public static function URI()
{
$REDIRECT_QUERY_STRING =
isset($_SERVER['QUERY_STRING'])
? $_SERVER['QUERY_STRING']
: '';
$REDIRECT_URL = '';
if (isset($_SERVER['REQUEST_URI'])) {
$url_parts = parse_url($_SERVER['REQUEST_URI']);
$R... | [
"public",
"static",
"function",
"URI",
"(",
")",
"{",
"$",
"REDIRECT_QUERY_STRING",
"=",
"isset",
"(",
"$",
"_SERVER",
"[",
"'QUERY_STRING'",
"]",
")",
"?",
"$",
"_SERVER",
"[",
"'QUERY_STRING'",
"]",
":",
"''",
";",
"$",
"REDIRECT_URL",
"=",
"''",
";",
... | Get current URI and GET parameters from the requested URI
@return string[2] Returns an array with current URI and GET parameters | [
"Get",
"current",
"URI",
"and",
"GET",
"parameters",
"from",
"the",
"requested",
"URI"
] | 40041d1ef23b1f8cdbd26fb112448d6a3dbef012 | https://github.com/phramework/phramework/blob/40041d1ef23b1f8cdbd26fb112448d6a3dbef012/src/URIStrategy/URITemplate.php#L120-L150 | train |
ThomasMarinissen/FileDownloader | src/FileDownloader/Exceptions/DownloadException.php | DownloadException.codeToMessage | private function codeToMessage($code) {
// get the error message belong to the given code
switch ($code) {
case \Th\FileDownloader::FILE_WRONG_MIME:
$message = "File is of the wrong MIME type";
break;
case \Th\FileDownloader::FILE_WRONG_EXTENSION:
... | php | private function codeToMessage($code) {
// get the error message belong to the given code
switch ($code) {
case \Th\FileDownloader::FILE_WRONG_MIME:
$message = "File is of the wrong MIME type";
break;
case \Th\FileDownloader::FILE_WRONG_EXTENSION:
... | [
"private",
"function",
"codeToMessage",
"(",
"$",
"code",
")",
"{",
"// get the error message belong to the given code",
"switch",
"(",
"$",
"code",
")",
"{",
"case",
"\\",
"Th",
"\\",
"FileDownloader",
"::",
"FILE_WRONG_MIME",
":",
"$",
"message",
"=",
"\"File is... | Method that switches the error code constants till it finds the messages
that belongs to the error code and then returns the message.
@param int The error code
@return string The error message | [
"Method",
"that",
"switches",
"the",
"error",
"code",
"constants",
"till",
"it",
"finds",
"the",
"messages",
"that",
"belongs",
"to",
"the",
"error",
"code",
"and",
"then",
"returns",
"the",
"message",
"."
] | a69a1c88674038597bcd2e8f0777abf39f58c215 | https://github.com/ThomasMarinissen/FileDownloader/blob/a69a1c88674038597bcd2e8f0777abf39f58c215/src/FileDownloader/Exceptions/DownloadException.php#L33-L52 | train |
hal-platform/hal-core | src/Entity/Target.php | Target.isAWS | public function isAWS()
{
return in_array($this->type(), [TargetEnum::TYPE_CD, TargetEnum::TYPE_EB, TargetEnum::TYPE_S3]);
} | php | public function isAWS()
{
return in_array($this->type(), [TargetEnum::TYPE_CD, TargetEnum::TYPE_EB, TargetEnum::TYPE_S3]);
} | [
"public",
"function",
"isAWS",
"(",
")",
"{",
"return",
"in_array",
"(",
"$",
"this",
"->",
"type",
"(",
")",
",",
"[",
"TargetEnum",
"::",
"TYPE_CD",
",",
"TargetEnum",
"::",
"TYPE_EB",
",",
"TargetEnum",
"::",
"TYPE_S3",
"]",
")",
";",
"}"
] | Is this group for AWS?
@return bool | [
"Is",
"this",
"group",
"for",
"AWS?"
] | 30d456f8392fc873301ad4217d2ae90436c67090 | https://github.com/hal-platform/hal-core/blob/30d456f8392fc873301ad4217d2ae90436c67090/src/Entity/Target.php#L253-L256 | train |
hal-platform/hal-core | src/Entity/Target.php | Target.formatParameters | public function formatParameters()
{
switch ($this->type()) {
case TargetEnum::TYPE_CD:
return $this->parameter('group') ?: '???';
case TargetEnum::TYPE_EB:
return $this->parameter('environment') ?: '???';
case TargetEnum::TYPE_S3:
... | php | public function formatParameters()
{
switch ($this->type()) {
case TargetEnum::TYPE_CD:
return $this->parameter('group') ?: '???';
case TargetEnum::TYPE_EB:
return $this->parameter('environment') ?: '???';
case TargetEnum::TYPE_S3:
... | [
"public",
"function",
"formatParameters",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"type",
"(",
")",
")",
"{",
"case",
"TargetEnum",
"::",
"TYPE_CD",
":",
"return",
"$",
"this",
"->",
"parameter",
"(",
"'group'",
")",
"?",
":",
"'???'",
";",
... | Format parameters into something readable.
@return string | [
"Format",
"parameters",
"into",
"something",
"readable",
"."
] | 30d456f8392fc873301ad4217d2ae90436c67090 | https://github.com/hal-platform/hal-core/blob/30d456f8392fc873301ad4217d2ae90436c67090/src/Entity/Target.php#L263-L293 | train |
ncou/Chiron-Pipeline | src/Pipeline.php | Pipeline.handle | public function handle(ServerRequestInterface $request): ResponseInterface
{
if ($this->index >= count($this->middlewares)) {
throw new OutOfBoundsException('Reached end of middleware stack. Does your controller return a response ?');
}
$middleware = $this->middlewares[$this->in... | php | public function handle(ServerRequestInterface $request): ResponseInterface
{
if ($this->index >= count($this->middlewares)) {
throw new OutOfBoundsException('Reached end of middleware stack. Does your controller return a response ?');
}
$middleware = $this->middlewares[$this->in... | [
"public",
"function",
"handle",
"(",
"ServerRequestInterface",
"$",
"request",
")",
":",
"ResponseInterface",
"{",
"if",
"(",
"$",
"this",
"->",
"index",
">=",
"count",
"(",
"$",
"this",
"->",
"middlewares",
")",
")",
"{",
"throw",
"new",
"OutOfBoundsExcepti... | Execute the middleware stack.
@param ServerRequestInterface $request
@return ResponseInterface | [
"Execute",
"the",
"middleware",
"stack",
"."
] | dda743d797bc85c24a947dc332f3cfb41f6bf05a | https://github.com/ncou/Chiron-Pipeline/blob/dda743d797bc85c24a947dc332f3cfb41f6bf05a/src/Pipeline.php#L149-L158 | train |
mlocati/concrete5-translation-library | src/Parser/Cif.php | Cif.parseXml | private static function parseXml(\Gettext\Translations $translations, $realPath, $shownPath)
{
if (@filesize($realPath) !== 0) {
$xml = new \DOMDocument();
if ($xml->load($realPath) === false) {
global $php_errormsg;
if (isset($php_errormsg) && $php_er... | php | private static function parseXml(\Gettext\Translations $translations, $realPath, $shownPath)
{
if (@filesize($realPath) !== 0) {
$xml = new \DOMDocument();
if ($xml->load($realPath) === false) {
global $php_errormsg;
if (isset($php_errormsg) && $php_er... | [
"private",
"static",
"function",
"parseXml",
"(",
"\\",
"Gettext",
"\\",
"Translations",
"$",
"translations",
",",
"$",
"realPath",
",",
"$",
"shownPath",
")",
"{",
"if",
"(",
"@",
"filesize",
"(",
"$",
"realPath",
")",
"!==",
"0",
")",
"{",
"$",
"xml"... | Parses an XML CIF file and extracts translatable strings.
@param \Gettext\Translations $translations
@param string $realPath
@param string $shownPath
@throws \Exception | [
"Parses",
"an",
"XML",
"CIF",
"file",
"and",
"extracts",
"translatable",
"strings",
"."
] | 26f806c8c1ecb6ce63115a4058ab396303622e00 | https://github.com/mlocati/concrete5-translation-library/blob/26f806c8c1ecb6ce63115a4058ab396303622e00/src/Parser/Cif.php#L65-L84 | train |
mlocati/concrete5-translation-library | src/Parser/Cif.php | Cif.readXmlNodeAttribute | private static function readXmlNodeAttribute(\Gettext\Translations $translations, $filenameRel, \DOMNode $node, $attributeName, $context = '')
{
$value = (string) $node->getAttribute($attributeName);
if ($value !== '') {
$translation = $translations->insert($context, $value);
... | php | private static function readXmlNodeAttribute(\Gettext\Translations $translations, $filenameRel, \DOMNode $node, $attributeName, $context = '')
{
$value = (string) $node->getAttribute($attributeName);
if ($value !== '') {
$translation = $translations->insert($context, $value);
... | [
"private",
"static",
"function",
"readXmlNodeAttribute",
"(",
"\\",
"Gettext",
"\\",
"Translations",
"$",
"translations",
",",
"$",
"filenameRel",
",",
"\\",
"DOMNode",
"$",
"node",
",",
"$",
"attributeName",
",",
"$",
"context",
"=",
"''",
")",
"{",
"$",
... | Parse a node attribute and create a POEntry item if it has a value.
@param \Gettext\Translations $translations Will be populated with found entries
@param string $filenameRel The relative file name of the xml file being read
@param \DOMNode $node The current node
@param string ... | [
"Parse",
"a",
"node",
"attribute",
"and",
"create",
"a",
"POEntry",
"item",
"if",
"it",
"has",
"a",
"value",
"."
] | 26f806c8c1ecb6ce63115a4058ab396303622e00 | https://github.com/mlocati/concrete5-translation-library/blob/26f806c8c1ecb6ce63115a4058ab396303622e00/src/Parser/Cif.php#L409-L416 | train |
mlocati/concrete5-translation-library | src/Parser/Cif.php | Cif.readXmlPageKeywords | private static function readXmlPageKeywords(\Gettext\Translations $translations, $filenameRel, \DOMNode $node, $pageUrl)
{
$keywords = (string) $node->nodeValue;
if ($keywords !== '') {
$translation = $translations->insert('', $keywords);
$translation->addReference($filenameR... | php | private static function readXmlPageKeywords(\Gettext\Translations $translations, $filenameRel, \DOMNode $node, $pageUrl)
{
$keywords = (string) $node->nodeValue;
if ($keywords !== '') {
$translation = $translations->insert('', $keywords);
$translation->addReference($filenameR... | [
"private",
"static",
"function",
"readXmlPageKeywords",
"(",
"\\",
"Gettext",
"\\",
"Translations",
"$",
"translations",
",",
"$",
"filenameRel",
",",
"\\",
"DOMNode",
"$",
"node",
",",
"$",
"pageUrl",
")",
"{",
"$",
"keywords",
"=",
"(",
"string",
")",
"$... | Parse a node attribute which contains the keywords for a page.
@param \Gettext\Translations $translations Will be populated with found entries
@param string $filenameRel The relative file name of the xml file being read
@param \DOMNode $node The current node
@param string ... | [
"Parse",
"a",
"node",
"attribute",
"which",
"contains",
"the",
"keywords",
"for",
"a",
"page",
"."
] | 26f806c8c1ecb6ce63115a4058ab396303622e00 | https://github.com/mlocati/concrete5-translation-library/blob/26f806c8c1ecb6ce63115a4058ab396303622e00/src/Parser/Cif.php#L424-L435 | train |
mlocati/concrete5-translation-library | src/Parser/Cif.php | Cif.parseXmlNodeValue | private static function parseXmlNodeValue(\Gettext\Translations $translations, $filenameRel, \DOMNode $node, $context = '')
{
$value = (string) $node->nodeValue;
if ($value !== '') {
$translation = $translations->insert($context, $value);
$translation->addReference($filenameR... | php | private static function parseXmlNodeValue(\Gettext\Translations $translations, $filenameRel, \DOMNode $node, $context = '')
{
$value = (string) $node->nodeValue;
if ($value !== '') {
$translation = $translations->insert($context, $value);
$translation->addReference($filenameR... | [
"private",
"static",
"function",
"parseXmlNodeValue",
"(",
"\\",
"Gettext",
"\\",
"Translations",
"$",
"translations",
",",
"$",
"filenameRel",
",",
"\\",
"DOMNode",
"$",
"node",
",",
"$",
"context",
"=",
"''",
")",
"{",
"$",
"value",
"=",
"(",
"string",
... | Parse a node value and create a POEntry item if it has a value.
@param \Gettext\Translations $translations Will be populated with found entries
@param string $filenameRel The relative file name of the xml file being read
@param \DOMNode $node The current node
@param string ... | [
"Parse",
"a",
"node",
"value",
"and",
"create",
"a",
"POEntry",
"item",
"if",
"it",
"has",
"a",
"value",
"."
] | 26f806c8c1ecb6ce63115a4058ab396303622e00 | https://github.com/mlocati/concrete5-translation-library/blob/26f806c8c1ecb6ce63115a4058ab396303622e00/src/Parser/Cif.php#L445-L452 | train |
digipolisgent/robo-digipolis-deploy | src/PartialCleanDirs.php | PartialCleanDirs.dirs | public function dirs(array $dirs)
{
foreach ($dirs as $k => $v) {
if (is_numeric($v)) {
$this->dir($k, $v);
continue;
}
$this->dir($v);
}
return $this;
} | php | public function dirs(array $dirs)
{
foreach ($dirs as $k => $v) {
if (is_numeric($v)) {
$this->dir($k, $v);
continue;
}
$this->dir($v);
}
return $this;
} | [
"public",
"function",
"dirs",
"(",
"array",
"$",
"dirs",
")",
"{",
"foreach",
"(",
"$",
"dirs",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"v",
")",
")",
"{",
"$",
"this",
"->",
"dir",
"(",
"$",
"k",
",",
"... | Add directories to clean.
@param array $dirs
Either an array of directories or an array keyed by directory with the
number of items to keep within this directory as value.
@return $this | [
"Add",
"directories",
"to",
"clean",
"."
] | fafa8967d98ed4d3f2265b17f4b1abe53bf0b5ab | https://github.com/digipolisgent/robo-digipolis-deploy/blob/fafa8967d98ed4d3f2265b17f4b1abe53bf0b5ab/src/PartialCleanDirs.php#L138-L149 | train |
digipolisgent/robo-digipolis-deploy | src/PartialCleanDirs.php | PartialCleanDirs.cleanDir | protected function cleanDir($dir, $keep)
{
$finder = clone $this->finder;
$finder->in($dir);
$finder->depth(0);
$this->doSort($finder);
$items = iterator_to_array($finder->getIterator());
if ($keep) {
array_splice($items, -$keep);
}
while (... | php | protected function cleanDir($dir, $keep)
{
$finder = clone $this->finder;
$finder->in($dir);
$finder->depth(0);
$this->doSort($finder);
$items = iterator_to_array($finder->getIterator());
if ($keep) {
array_splice($items, -$keep);
}
while (... | [
"protected",
"function",
"cleanDir",
"(",
"$",
"dir",
",",
"$",
"keep",
")",
"{",
"$",
"finder",
"=",
"clone",
"$",
"this",
"->",
"finder",
";",
"$",
"finder",
"->",
"in",
"(",
"$",
"dir",
")",
";",
"$",
"finder",
"->",
"depth",
"(",
"0",
")",
... | Clean a directory.
@param string $dir
The directory to clean.
@param int $keep
The number of items to keep. | [
"Clean",
"a",
"directory",
"."
] | fafa8967d98ed4d3f2265b17f4b1abe53bf0b5ab | https://github.com/digipolisgent/robo-digipolis-deploy/blob/fafa8967d98ed4d3f2265b17f4b1abe53bf0b5ab/src/PartialCleanDirs.php#L221-L247 | train |
digipolisgent/robo-digipolis-deploy | src/PartialCleanDirs.php | PartialCleanDirs.doSort | protected function doSort(Finder $finder)
{
switch ($this->sort) {
case static::SORT_NAME:
$finder->sortByName();
break;
case static::SORT_TYPE:
$finder->sortByType();
break;
case static::SORT_ACCESS_TIME:
... | php | protected function doSort(Finder $finder)
{
switch ($this->sort) {
case static::SORT_NAME:
$finder->sortByName();
break;
case static::SORT_TYPE:
$finder->sortByType();
break;
case static::SORT_ACCESS_TIME:
... | [
"protected",
"function",
"doSort",
"(",
"Finder",
"$",
"finder",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"sort",
")",
"{",
"case",
"static",
"::",
"SORT_NAME",
":",
"$",
"finder",
"->",
"sortByName",
"(",
")",
";",
"break",
";",
"case",
"static",
... | Sort the finder.
@param Finder $finder
The finder to sort. | [
"Sort",
"the",
"finder",
"."
] | fafa8967d98ed4d3f2265b17f4b1abe53bf0b5ab | https://github.com/digipolisgent/robo-digipolis-deploy/blob/fafa8967d98ed4d3f2265b17f4b1abe53bf0b5ab/src/PartialCleanDirs.php#L255-L282 | train |
bennybi/yii2-cza-base | behaviors/CmsMediaBehavior.php | CmsMediaBehavior.setup | protected function setup() {
if (!$this->_isSetup) {
$defaultConfig = array(
'srcBasePath' => Yii::getAlias('@webroot'),
'dstBasePath' => Yii::$app->czaHelper->folderOrganizer->getEntityUploadPath(true),
'dstUrlBase' => Yii::$app->czaHelper->folderOrga... | php | protected function setup() {
if (!$this->_isSetup) {
$defaultConfig = array(
'srcBasePath' => Yii::getAlias('@webroot'),
'dstBasePath' => Yii::$app->czaHelper->folderOrganizer->getEntityUploadPath(true),
'dstUrlBase' => Yii::$app->czaHelper->folderOrga... | [
"protected",
"function",
"setup",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_isSetup",
")",
"{",
"$",
"defaultConfig",
"=",
"array",
"(",
"'srcBasePath'",
"=>",
"Yii",
"::",
"getAlias",
"(",
"'@webroot'",
")",
",",
"'dstBasePath'",
"=>",
"Yii",
... | setup config on flying | [
"setup",
"config",
"on",
"flying"
] | 8257db8034bd948712fa469062921f210f0ba8da | https://github.com/bennybi/yii2-cza-base/blob/8257db8034bd948712fa469062921f210f0ba8da/behaviors/CmsMediaBehavior.php#L82-L103 | train |
phPoirot/AuthSystem | Authenticate/Identifier/aIdentifier.php | aIdentifier.giveIdentity | function giveIdentity(iIdentity $identity)
{
if ($this->identity)
throw new \Exception('Identity is immutable.');
$defIdentity = $this->_newDefaultIdentity();
$defIdentity->import($identity);
if (!$defIdentity->isFulfilled())
throw new \InvalidArgumen... | php | function giveIdentity(iIdentity $identity)
{
if ($this->identity)
throw new \Exception('Identity is immutable.');
$defIdentity = $this->_newDefaultIdentity();
$defIdentity->import($identity);
if (!$defIdentity->isFulfilled())
throw new \InvalidArgumen... | [
"function",
"giveIdentity",
"(",
"iIdentity",
"$",
"identity",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"identity",
")",
"throw",
"new",
"\\",
"Exception",
"(",
"'Identity is immutable.'",
")",
";",
"$",
"defIdentity",
"=",
"$",
"this",
"->",
"_newDefaultIden... | Set Immutable Identity
@param iIdentity $identity
@return $this
@throws \Exception immutable error; identity not met requirement | [
"Set",
"Immutable",
"Identity"
] | bb8d02f72a7c2686d7d453021143361fa704a5a6 | https://github.com/phPoirot/AuthSystem/blob/bb8d02f72a7c2686d7d453021143361fa704a5a6/Authenticate/Identifier/aIdentifier.php#L95-L111 | train |
phPoirot/AuthSystem | Authenticate/Identifier/aIdentifier.php | aIdentifier.issueException | final function issueException(exAuthentication $exception = null)
{
$callable = ($this->issuer_exception)
? $this->issuer_exception
: $this->doIssueExceptionDefault();
return call_user_func($callable, $exception);
} | php | final function issueException(exAuthentication $exception = null)
{
$callable = ($this->issuer_exception)
? $this->issuer_exception
: $this->doIssueExceptionDefault();
return call_user_func($callable, $exception);
} | [
"final",
"function",
"issueException",
"(",
"exAuthentication",
"$",
"exception",
"=",
"null",
")",
"{",
"$",
"callable",
"=",
"(",
"$",
"this",
"->",
"issuer_exception",
")",
"?",
"$",
"this",
"->",
"issuer_exception",
":",
"$",
"this",
"->",
"doIssueExcept... | Issue To Handle Authentication Exception
usually called when authentication exception rise
to challenge client to login form or something.
@param exAuthentication $exception Maybe support for specific error
@return mixed Result Handle in Dispatch Listener Events | [
"Issue",
"To",
"Handle",
"Authentication",
"Exception"
] | bb8d02f72a7c2686d7d453021143361fa704a5a6 | https://github.com/phPoirot/AuthSystem/blob/bb8d02f72a7c2686d7d453021143361fa704a5a6/Authenticate/Identifier/aIdentifier.php#L150-L157 | train |
phPoirot/AuthSystem | Authenticate/Identifier/aIdentifier.php | aIdentifier.setIssuerException | function setIssuerException(/*callable*/ $callable)
{
if (!is_callable($callable))
throw new \InvalidArgumentException(sprintf(
'Issuer must be callable; given: (%s).'
, \Poirot\Std\flatten($callable)
));
$this->issuer_exception = $cal... | php | function setIssuerException(/*callable*/ $callable)
{
if (!is_callable($callable))
throw new \InvalidArgumentException(sprintf(
'Issuer must be callable; given: (%s).'
, \Poirot\Std\flatten($callable)
));
$this->issuer_exception = $cal... | [
"function",
"setIssuerException",
"(",
"/*callable*/",
"$",
"callable",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callable",
")",
")",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Issuer must be callable; given: (%s).'",
",",
... | Set Exception Issuer
callable:
function(exAuthentication $e)
@param callable $callable
@return $this | [
"Set",
"Exception",
"Issuer"
] | bb8d02f72a7c2686d7d453021143361fa704a5a6 | https://github.com/phPoirot/AuthSystem/blob/bb8d02f72a7c2686d7d453021143361fa704a5a6/Authenticate/Identifier/aIdentifier.php#L213-L223 | train |
jlaso/slim-routing-manager | JLaso/SlimRoutingManager/RoutingCacheManager.php | RoutingCacheManager.writeCache | protected function writeCache($class, $content)
{
$date = date("Y-m-d h:i:s");
$content = <<<EOD
<?php
/**
* Generated with RoutingCacheManager
*
* on {$date}
*/
\$app = Slim\Slim::getInstance();
{$content}
EOD;
$fileName = $this->cacheFile($class);
file_put_contents($fileNa... | php | protected function writeCache($class, $content)
{
$date = date("Y-m-d h:i:s");
$content = <<<EOD
<?php
/**
* Generated with RoutingCacheManager
*
* on {$date}
*/
\$app = Slim\Slim::getInstance();
{$content}
EOD;
$fileName = $this->cacheFile($class);
file_put_contents($fileNa... | [
"protected",
"function",
"writeCache",
"(",
"$",
"class",
",",
"$",
"content",
")",
"{",
"$",
"date",
"=",
"date",
"(",
"\"Y-m-d h:i:s\"",
")",
";",
"$",
"content",
"=",
" <<<EOD\n<?php\n\n\n/**\n * Generated with RoutingCacheManager\n *\n * on {$date}\n */\n\n\\$app = Sl... | This method writes the cache content into cache file
@param $class
@param $content
@return string | [
"This",
"method",
"writes",
"the",
"cache",
"content",
"into",
"cache",
"file"
] | a9fb697e03377b1694add048418a484ef62eae08 | https://github.com/jlaso/slim-routing-manager/blob/a9fb697e03377b1694add048418a484ef62eae08/JLaso/SlimRoutingManager/RoutingCacheManager.php#L68-L90 | train |
php-kit/power-primitives | src/PowerString.php | PowerString.indexOfPattern | function indexOfPattern ($pattern)
{
self::toUnicodeRegex ($pattern);
if (!preg_match ($pattern, $this->S, $m, PREG_OFFSET_CAPTURE)) return false;
return $m[0][1];
} | php | function indexOfPattern ($pattern)
{
self::toUnicodeRegex ($pattern);
if (!preg_match ($pattern, $this->S, $m, PREG_OFFSET_CAPTURE)) return false;
return $m[0][1];
} | [
"function",
"indexOfPattern",
"(",
"$",
"pattern",
")",
"{",
"self",
"::",
"toUnicodeRegex",
"(",
"$",
"pattern",
")",
";",
"if",
"(",
"!",
"preg_match",
"(",
"$",
"pattern",
",",
"$",
"this",
"->",
"S",
",",
"$",
"m",
",",
"PREG_OFFSET_CAPTURE",
")",
... | Searches for a pattern on a string and returns the index of the matched substring.
><p>This is a simpler version of {@see search}.
@param string $pattern A regular expression pattern.
@return int The index of the matched substring. | [
"Searches",
"for",
"a",
"pattern",
"on",
"a",
"string",
"and",
"returns",
"the",
"index",
"of",
"the",
"matched",
"substring",
"."
] | 98450f8c1c34abe86ef293a4764c62c51852632b | https://github.com/php-kit/power-primitives/blob/98450f8c1c34abe86ef293a4764c62c51852632b/src/PowerString.php#L195-L200 | train |
php-kit/power-primitives | src/PowerString.php | PowerString.search | function search ($pattern, $from = 0, &$match = null)
{
self::toUnicodeRegex ($pattern);
if (preg_match ($pattern, $this->S, $m, PREG_OFFSET_CAPTURE)) {
list ($match, $ofs) = $m[0];
return $ofs;
}
return false;
} | php | function search ($pattern, $from = 0, &$match = null)
{
self::toUnicodeRegex ($pattern);
if (preg_match ($pattern, $this->S, $m, PREG_OFFSET_CAPTURE)) {
list ($match, $ofs) = $m[0];
return $ofs;
}
return false;
} | [
"function",
"search",
"(",
"$",
"pattern",
",",
"$",
"from",
"=",
"0",
",",
"&",
"$",
"match",
"=",
"null",
")",
"{",
"self",
"::",
"toUnicodeRegex",
"(",
"$",
"pattern",
")",
";",
"if",
"(",
"preg_match",
"(",
"$",
"pattern",
",",
"$",
"this",
"... | Finds the position of the first occurrence of a pattern in the current string.
><p>This is an extended version of {@see indexOfPattern}.
@param string $pattern A regular expression.
@param int $from The position where the search begins, counted from the beginning of the current string.
@param string $match [o... | [
"Finds",
"the",
"position",
"of",
"the",
"first",
"occurrence",
"of",
"a",
"pattern",
"in",
"the",
"current",
"string",
"."
] | 98450f8c1c34abe86ef293a4764c62c51852632b | https://github.com/php-kit/power-primitives/blob/98450f8c1c34abe86ef293a4764c62c51852632b/src/PowerString.php#L289-L297 | train |
nasumilu/geometry | src/Operation/AbstractOpEvent.php | AbstractOpEvent.addError | public function addError(OperationError $ex, bool $stopPropagation = false) {
$this->lastError = $ex;
if ($stopPropagation) {
$this->stopPropagation();
}
} | php | public function addError(OperationError $ex, bool $stopPropagation = false) {
$this->lastError = $ex;
if ($stopPropagation) {
$this->stopPropagation();
}
} | [
"public",
"function",
"addError",
"(",
"OperationError",
"$",
"ex",
",",
"bool",
"$",
"stopPropagation",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"lastError",
"=",
"$",
"ex",
";",
"if",
"(",
"$",
"stopPropagation",
")",
"{",
"$",
"this",
"->",
"stopP... | Adds an OperationError to the operation events error list.
If the argument <code>$stopPropagation</code> is true than this operation
will stop propagating once complete.
@param \Nasumilu\Geometry\Operation\OperationError $ex
@param bool $stopPropagation | [
"Adds",
"an",
"OperationError",
"to",
"the",
"operation",
"events",
"error",
"list",
"."
] | 000fafe3e61f1d0682952ad236b7486dded65eae | https://github.com/nasumilu/geometry/blob/000fafe3e61f1d0682952ad236b7486dded65eae/src/Operation/AbstractOpEvent.php#L111-L116 | train |
nasumilu/geometry | src/Operation/AbstractOpEvent.php | AbstractOpEvent.setResults | public function setResults($results = null, bool $stopPropagation = false) {
$this->result = $results;
if ($stopPropagation) {
$this->stopPropagation();
}
} | php | public function setResults($results = null, bool $stopPropagation = false) {
$this->result = $results;
if ($stopPropagation) {
$this->stopPropagation();
}
} | [
"public",
"function",
"setResults",
"(",
"$",
"results",
"=",
"null",
",",
"bool",
"$",
"stopPropagation",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"result",
"=",
"$",
"results",
";",
"if",
"(",
"$",
"stopPropagation",
")",
"{",
"$",
"this",
"->",
... | Sets the operations result.
To stop the operations propagation set <code>$stopPropagation</code> to
true.
@param mixed $results
@param bool $stopPropagation | [
"Sets",
"the",
"operations",
"result",
"."
] | 000fafe3e61f1d0682952ad236b7486dded65eae | https://github.com/nasumilu/geometry/blob/000fafe3e61f1d0682952ad236b7486dded65eae/src/Operation/AbstractOpEvent.php#L232-L237 | train |
schpill/thin | src/Vertica.php | Vertica.query | public function query($query, $params = null, $fetchResult = false)
{
$this->checkConnection(true);
$this->log('Query: ' . $query);
if(!empty($params)) {
$this->log('Params: ' . print_r($params, true));
}
$start = microtime(true);
... | php | public function query($query, $params = null, $fetchResult = false)
{
$this->checkConnection(true);
$this->log('Query: ' . $query);
if(!empty($params)) {
$this->log('Params: ' . print_r($params, true));
}
$start = microtime(true);
... | [
"public",
"function",
"query",
"(",
"$",
"query",
",",
"$",
"params",
"=",
"null",
",",
"$",
"fetchResult",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"checkConnection",
"(",
"true",
")",
";",
"$",
"this",
"->",
"log",
"(",
"'Query: '",
".",
"$",
"... | Execute a query and return the results
@param string $query
@param array $params
@param bool $fetchResult Return a ressource or a an array
@return resource|array
@throws Exception | [
"Execute",
"a",
"query",
"and",
"return",
"the",
"results"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Vertica.php#L36-L66 | train |
schpill/thin | src/Vertica.php | Vertica.executeQuery | protected function executeQuery($query)
{
$res = @odbc_exec($this->_lnk, $query);
if(!$res) {
$error = odbc_errormsg($this->_lnk);
$this->log('Query failed: '.$error);
throw new Exception('Executing query failed ' . $error, self::QUERY_FAIL... | php | protected function executeQuery($query)
{
$res = @odbc_exec($this->_lnk, $query);
if(!$res) {
$error = odbc_errormsg($this->_lnk);
$this->log('Query failed: '.$error);
throw new Exception('Executing query failed ' . $error, self::QUERY_FAIL... | [
"protected",
"function",
"executeQuery",
"(",
"$",
"query",
")",
"{",
"$",
"res",
"=",
"@",
"odbc_exec",
"(",
"$",
"this",
"->",
"_lnk",
",",
"$",
"query",
")",
";",
"if",
"(",
"!",
"$",
"res",
")",
"{",
"$",
"error",
"=",
"odbc_errormsg",
"(",
"... | Execute a query and returns an ODBC result identifier
@param string $query
@return resource
@throws Exception | [
"Execute",
"a",
"query",
"and",
"returns",
"an",
"ODBC",
"result",
"identifier"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Vertica.php#L74-L83 | train |
schpill/thin | src/Vertica.php | Vertica.executePreparedStatement | protected function executePreparedStatement($query, $params)
{
$res = odbc_prepare($this->_lnk, $query);
if(!$res) {
$error = odbc_errormsg($this->_lnk);
$this->log('Prepare failed: ' . $error);
throw new Exception('Preparing query failed '... | php | protected function executePreparedStatement($query, $params)
{
$res = odbc_prepare($this->_lnk, $query);
if(!$res) {
$error = odbc_errormsg($this->_lnk);
$this->log('Prepare failed: ' . $error);
throw new Exception('Preparing query failed '... | [
"protected",
"function",
"executePreparedStatement",
"(",
"$",
"query",
",",
"$",
"params",
")",
"{",
"$",
"res",
"=",
"odbc_prepare",
"(",
"$",
"this",
"->",
"_lnk",
",",
"$",
"query",
")",
";",
"if",
"(",
"!",
"$",
"res",
")",
"{",
"$",
"error",
... | Prepare a query, execute it and return an ODBC result identifier
@param string $query
@param array $params
@return bool|resource
@throws Exception | [
"Prepare",
"a",
"query",
"execute",
"it",
"and",
"return",
"an",
"ODBC",
"result",
"identifier"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Vertica.php#L92-L107 | train |
schpill/thin | src/Vertica.php | Vertica.checkConnection | protected function checkConnection($reconnect = false)
{
if(empty($this->_lnk)) {
$this->log('CheckConnection: link is not valid');
if($reconnect) {
$this->log('CheckConnection: try to reconnect');
$this->_lnk = @odbc_connect('D... | php | protected function checkConnection($reconnect = false)
{
if(empty($this->_lnk)) {
$this->log('CheckConnection: link is not valid');
if($reconnect) {
$this->log('CheckConnection: try to reconnect');
$this->_lnk = @odbc_connect('D... | [
"protected",
"function",
"checkConnection",
"(",
"$",
"reconnect",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_lnk",
")",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"'CheckConnection: link is not valid'",
")",
";",
"if",
"(",
"$",... | Check if the connection failed and try to reconnect if asked
@param bool $reconnect
@throws Exception | [
"Check",
"if",
"the",
"connection",
"failed",
"and",
"try",
"to",
"reconnect",
"if",
"asked"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Vertica.php#L128-L144 | train |
infusephp/auth | src/Libs/RememberMeCookie.php | RememberMeCookie.decode | public static function decode($cookie)
{
$params = (array) json_decode(base64_decode($cookie), true);
return new self((string) array_value($params, 'user_email'),
(string) array_value($params, 'agent'),
(string) array_value($params, 'series'),
... | php | public static function decode($cookie)
{
$params = (array) json_decode(base64_decode($cookie), true);
return new self((string) array_value($params, 'user_email'),
(string) array_value($params, 'agent'),
(string) array_value($params, 'series'),
... | [
"public",
"static",
"function",
"decode",
"(",
"$",
"cookie",
")",
"{",
"$",
"params",
"=",
"(",
"array",
")",
"json_decode",
"(",
"base64_decode",
"(",
"$",
"cookie",
")",
",",
"true",
")",
";",
"return",
"new",
"self",
"(",
"(",
"string",
")",
"arr... | Decodes an encoded remember me cookie string.
@param string $cookie
@return self | [
"Decodes",
"an",
"encoded",
"remember",
"me",
"cookie",
"string",
"."
] | 720280b4b2635572f331afe8d082e3e88cf54eb7 | https://github.com/infusephp/auth/blob/720280b4b2635572f331afe8d082e3e88cf54eb7/src/Libs/RememberMeCookie.php#L130-L138 | train |
infusephp/auth | src/Libs/RememberMeCookie.php | RememberMeCookie.encode | public function encode()
{
$json = json_encode([
'user_email' => $this->email,
'agent' => $this->userAgent,
'series' => $this->series,
'token' => $this->token,
]);
return base64_encode($json);
} | php | public function encode()
{
$json = json_encode([
'user_email' => $this->email,
'agent' => $this->userAgent,
'series' => $this->series,
'token' => $this->token,
]);
return base64_encode($json);
} | [
"public",
"function",
"encode",
"(",
")",
"{",
"$",
"json",
"=",
"json_encode",
"(",
"[",
"'user_email'",
"=>",
"$",
"this",
"->",
"email",
",",
"'agent'",
"=>",
"$",
"this",
"->",
"userAgent",
",",
"'series'",
"=>",
"$",
"this",
"->",
"series",
",",
... | Encodes a remember me cookie.
@return string | [
"Encodes",
"a",
"remember",
"me",
"cookie",
"."
] | 720280b4b2635572f331afe8d082e3e88cf54eb7 | https://github.com/infusephp/auth/blob/720280b4b2635572f331afe8d082e3e88cf54eb7/src/Libs/RememberMeCookie.php#L145-L155 | train |
infusephp/auth | src/Libs/RememberMeCookie.php | RememberMeCookie.isValid | public function isValid()
{
if (!filter_var($this->email, FILTER_VALIDATE_EMAIL)) {
return false;
}
if (empty($this->userAgent)) {
return false;
}
if (empty($this->series)) {
return false;
}
if (empty($this->token)) {
... | php | public function isValid()
{
if (!filter_var($this->email, FILTER_VALIDATE_EMAIL)) {
return false;
}
if (empty($this->userAgent)) {
return false;
}
if (empty($this->series)) {
return false;
}
if (empty($this->token)) {
... | [
"public",
"function",
"isValid",
"(",
")",
"{",
"if",
"(",
"!",
"filter_var",
"(",
"$",
"this",
"->",
"email",
",",
"FILTER_VALIDATE_EMAIL",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"userAgent",
")",
")"... | Checks if the cookie contains valid values.
@return bool | [
"Checks",
"if",
"the",
"cookie",
"contains",
"valid",
"values",
"."
] | 720280b4b2635572f331afe8d082e3e88cf54eb7 | https://github.com/infusephp/auth/blob/720280b4b2635572f331afe8d082e3e88cf54eb7/src/Libs/RememberMeCookie.php#L162-L181 | train |
infusephp/auth | src/Libs/RememberMeCookie.php | RememberMeCookie.verify | public function verify(Request $req, AuthManager $auth)
{
if (!$this->isValid()) {
return false;
}
// verify the user agent matches the one in the request
if ($this->userAgent != $req->agent()) {
return false;
}
// look up the user with a mat... | php | public function verify(Request $req, AuthManager $auth)
{
if (!$this->isValid()) {
return false;
}
// verify the user agent matches the one in the request
if ($this->userAgent != $req->agent()) {
return false;
}
// look up the user with a mat... | [
"public",
"function",
"verify",
"(",
"Request",
"$",
"req",
",",
"AuthManager",
"$",
"auth",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValid",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"// verify the user agent matches the one in the request",
"... | Looks for a remembered user using this cookie
from an incoming request.
@param Request $req
@param AuthManager $auth
@return UserInterface|false remembered user | [
"Looks",
"for",
"a",
"remembered",
"user",
"using",
"this",
"cookie",
"from",
"an",
"incoming",
"request",
"."
] | 720280b4b2635572f331afe8d082e3e88cf54eb7 | https://github.com/infusephp/auth/blob/720280b4b2635572f331afe8d082e3e88cf54eb7/src/Libs/RememberMeCookie.php#L192-L264 | train |
infusephp/auth | src/Libs/RememberMeCookie.php | RememberMeCookie.persist | public function persist(UserInterface $user)
{
$session = new PersistentSession();
$session->email = $this->email;
$session->series = $this->hash($this->series);
$session->token = $this->hash($this->token);
$session->user_id = $user->id();
$session->two_factor_verifie... | php | public function persist(UserInterface $user)
{
$session = new PersistentSession();
$session->email = $this->email;
$session->series = $this->hash($this->series);
$session->token = $this->hash($this->token);
$session->user_id = $user->id();
$session->two_factor_verifie... | [
"public",
"function",
"persist",
"(",
"UserInterface",
"$",
"user",
")",
"{",
"$",
"session",
"=",
"new",
"PersistentSession",
"(",
")",
";",
"$",
"session",
"->",
"email",
"=",
"$",
"this",
"->",
"email",
";",
"$",
"session",
"->",
"series",
"=",
"$",... | Persists this cookie to the database.
@param UserInterface $user
@throws \Exception when the model cannot be saved.
@return PersistentSession | [
"Persists",
"this",
"cookie",
"to",
"the",
"database",
"."
] | 720280b4b2635572f331afe8d082e3e88cf54eb7 | https://github.com/infusephp/auth/blob/720280b4b2635572f331afe8d082e3e88cf54eb7/src/Libs/RememberMeCookie.php#L275-L291 | train |
infusephp/auth | src/Libs/RememberMeCookie.php | RememberMeCookie.destroy | function destroy()
{
$seriesHash = $this->hash($this->series);
PersistentSession::where('email', $this->email)
->where('series', $seriesHash)
->delete();
} | php | function destroy()
{
$seriesHash = $this->hash($this->series);
PersistentSession::where('email', $this->email)
->where('series', $seriesHash)
->delete();
} | [
"function",
"destroy",
"(",
")",
"{",
"$",
"seriesHash",
"=",
"$",
"this",
"->",
"hash",
"(",
"$",
"this",
"->",
"series",
")",
";",
"PersistentSession",
"::",
"where",
"(",
"'email'",
",",
"$",
"this",
"->",
"email",
")",
"->",
"where",
"(",
"'serie... | Destroys the persisted cookie in the data store. | [
"Destroys",
"the",
"persisted",
"cookie",
"in",
"the",
"data",
"store",
"."
] | 720280b4b2635572f331afe8d082e3e88cf54eb7 | https://github.com/infusephp/auth/blob/720280b4b2635572f331afe8d082e3e88cf54eb7/src/Libs/RememberMeCookie.php#L296-L302 | train |
infusephp/auth | src/Libs/RememberMeCookie.php | RememberMeCookie.hash | private function hash($token)
{
$app = Application::getDefault();
$salt = $app['config']->get('app.salt');
return hash_hmac('sha512', $token, $salt);
} | php | private function hash($token)
{
$app = Application::getDefault();
$salt = $app['config']->get('app.salt');
return hash_hmac('sha512', $token, $salt);
} | [
"private",
"function",
"hash",
"(",
"$",
"token",
")",
"{",
"$",
"app",
"=",
"Application",
"::",
"getDefault",
"(",
")",
";",
"$",
"salt",
"=",
"$",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'app.salt'",
")",
";",
"return",
"hash_hmac",
"(",
... | Hashes a token.
@param string $token
@return string hashed token | [
"Hashes",
"a",
"token",
"."
] | 720280b4b2635572f331afe8d082e3e88cf54eb7 | https://github.com/infusephp/auth/blob/720280b4b2635572f331afe8d082e3e88cf54eb7/src/Libs/RememberMeCookie.php#L323-L329 | train |
gplcart/file_manager | handlers/commands/Listing.php | Listing.getFilesListing | protected function getFilesListing($path, array $params)
{
$files = $this->getFiles($path, $params);
return $this->prepareFiles($files);
} | php | protected function getFilesListing($path, array $params)
{
$files = $this->getFiles($path, $params);
return $this->prepareFiles($files);
} | [
"protected",
"function",
"getFilesListing",
"(",
"$",
"path",
",",
"array",
"$",
"params",
")",
"{",
"$",
"files",
"=",
"$",
"this",
"->",
"getFiles",
"(",
"$",
"path",
",",
"$",
"params",
")",
";",
"return",
"$",
"this",
"->",
"prepareFiles",
"(",
"... | Returns an array of scanned and prepared files
@param string $path
@param array $params
@return array | [
"Returns",
"an",
"array",
"of",
"scanned",
"and",
"prepared",
"files"
] | 45424e93eafea75d31af6410ac9cf110f08e500a | https://github.com/gplcart/file_manager/blob/45424e93eafea75d31af6410ac9cf110f08e500a/handlers/commands/Listing.php#L91-L95 | train |
gplcart/file_manager | handlers/commands/Listing.php | Listing.prepareFiles | protected function prepareFiles(array $files)
{
$prepared = array();
foreach ($files as $file) {
$type = $file->getType();
$path = $file->getRealPath();
$relative_path = gplcart_file_relative($path);
$item = array(
'info' => $file,
... | php | protected function prepareFiles(array $files)
{
$prepared = array();
foreach ($files as $file) {
$type = $file->getType();
$path = $file->getRealPath();
$relative_path = gplcart_file_relative($path);
$item = array(
'info' => $file,
... | [
"protected",
"function",
"prepareFiles",
"(",
"array",
"$",
"files",
")",
"{",
"$",
"prepared",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
"$",
"type",
"=",
"$",
"file",
"->",
"getType",
"(",
")",
";",
... | Prepares an array of scanned files
@param array $files
@return array | [
"Prepares",
"an",
"array",
"of",
"scanned",
"files"
] | 45424e93eafea75d31af6410ac9cf110f08e500a | https://github.com/gplcart/file_manager/blob/45424e93eafea75d31af6410ac9cf110f08e500a/handlers/commands/Listing.php#L102-L128 | train |
gplcart/file_manager | handlers/commands/Listing.php | Listing.renderIcon | protected function renderIcon(array $item)
{
static $rendered = array();
if (isset($rendered[$item['extension']])) {
return $rendered[$item['extension']];
}
$template = "file_manager|icons/ext/{$item['extension']}";
if ($item['type'] === 'dir') {
$t... | php | protected function renderIcon(array $item)
{
static $rendered = array();
if (isset($rendered[$item['extension']])) {
return $rendered[$item['extension']];
}
$template = "file_manager|icons/ext/{$item['extension']}";
if ($item['type'] === 'dir') {
$t... | [
"protected",
"function",
"renderIcon",
"(",
"array",
"$",
"item",
")",
"{",
"static",
"$",
"rendered",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"rendered",
"[",
"$",
"item",
"[",
"'extension'",
"]",
"]",
")",
")",
"{",
"return",
"... | Returns a rendered icon for the given file extension and type
@param array $item
@return string | [
"Returns",
"a",
"rendered",
"icon",
"for",
"the",
"given",
"file",
"extension",
"and",
"type"
] | 45424e93eafea75d31af6410ac9cf110f08e500a | https://github.com/gplcart/file_manager/blob/45424e93eafea75d31af6410ac9cf110f08e500a/handlers/commands/Listing.php#L135-L154 | train |
AbuseIO/collector-common | src/Collector.php | Collector.isKnownFeed | protected function isKnownFeed()
{
if (empty(config("{$this->configBase}.feeds.{$this->feedName}"))) {
$this->warningCount++;
Log::warning(
"The feed referred as '{$this->feedName}' is not configured in the collector " .
config("{$this->configBase}.col... | php | protected function isKnownFeed()
{
if (empty(config("{$this->configBase}.feeds.{$this->feedName}"))) {
$this->warningCount++;
Log::warning(
"The feed referred as '{$this->feedName}' is not configured in the collector " .
config("{$this->configBase}.col... | [
"protected",
"function",
"isKnownFeed",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"config",
"(",
"\"{$this->configBase}.feeds.{$this->feedName}\"",
")",
")",
")",
"{",
"$",
"this",
"->",
"warningCount",
"++",
";",
"Log",
"::",
"warning",
"(",
"\"The feed referred ... | Check if the feed specified is known in the collector config.
@return Boolean Returns true or false | [
"Check",
"if",
"the",
"feed",
"specified",
"is",
"known",
"in",
"the",
"collector",
"config",
"."
] | fe887083371ac50c9112f313b2441b9852dfd263 | https://github.com/AbuseIO/collector-common/blob/fe887083371ac50c9112f313b2441b9852dfd263/src/Collector.php#L170-L183 | train |
temp/media-converter | src/Transmuter.php | Transmuter.transmute | public function transmute($inFilename, Specification $targetFormat, $outFilename)
{
$extractedFile = $this->extractor->extract($inFilename, $targetFormat);
if (!$extractedFile) {
return null;
}
$this->converter->convert($extractedFile, $targetFormat, $outFilename);
... | php | public function transmute($inFilename, Specification $targetFormat, $outFilename)
{
$extractedFile = $this->extractor->extract($inFilename, $targetFormat);
if (!$extractedFile) {
return null;
}
$this->converter->convert($extractedFile, $targetFormat, $outFilename);
... | [
"public",
"function",
"transmute",
"(",
"$",
"inFilename",
",",
"Specification",
"$",
"targetFormat",
",",
"$",
"outFilename",
")",
"{",
"$",
"extractedFile",
"=",
"$",
"this",
"->",
"extractor",
"->",
"extract",
"(",
"$",
"inFilename",
",",
"$",
"targetForm... | Transmute file to target format
@param string $inFilename
@param Specification $targetFormat
@param string $outFilename
@return string|null | [
"Transmute",
"file",
"to",
"target",
"format"
] | a6e8768c583aa461be568f13e592ae49294e5e33 | https://github.com/temp/media-converter/blob/a6e8768c583aa461be568f13e592ae49294e5e33/src/Transmuter.php#L54-L65 | train |
schpill/thin | src/Html/Attributes.php | Attributes.add | public function add($attribute, $value = array())
{
if(is_array($attribute)) {
foreach($attribute as $k => $v) {
$this->add($k, $v);
}
} else {
if($attribute instanceof \Thin\Html\Attributes) {
$this-... | php | public function add($attribute, $value = array())
{
if(is_array($attribute)) {
foreach($attribute as $k => $v) {
$this->add($k, $v);
}
} else {
if($attribute instanceof \Thin\Html\Attributes) {
$this-... | [
"public",
"function",
"add",
"(",
"$",
"attribute",
",",
"$",
"value",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"attribute",
")",
")",
"{",
"foreach",
"(",
"$",
"attribute",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$... | Add an attribute or an array thereof. If the attribute already exists, the specified values will be added to it, without overwriting the previous ones. Duplicate values are removed.
@param string|array|\Thin\Html\Attributes $attribute The name of the attribute to add, a name-value array of attributes or an attributes ... | [
"Add",
"an",
"attribute",
"or",
"an",
"array",
"thereof",
".",
"If",
"the",
"attribute",
"already",
"exists",
"the",
"specified",
"values",
"will",
"be",
"added",
"to",
"it",
"without",
"overwriting",
"the",
"previous",
"ones",
".",
"Duplicate",
"values",
"a... | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Attributes.php#L19-L54 | train |
schpill/thin | src/Html/Attributes.php | Attributes.set | public function set($attribute, $value = array())
{
if(is_array($attribute)) {
$this->attributes = array();
foreach($attribute as $k => $v) {
$this->set($k, $v);
}
} else {
if($attribute instanceof \Thin\... | php | public function set($attribute, $value = array())
{
if(is_array($attribute)) {
$this->attributes = array();
foreach($attribute as $k => $v) {
$this->set($k, $v);
}
} else {
if($attribute instanceof \Thin\... | [
"public",
"function",
"set",
"(",
"$",
"attribute",
",",
"$",
"value",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"attribute",
")",
")",
"{",
"$",
"this",
"->",
"attributes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$... | Set the value or values of an attribute or an array thereof. Already existent attributes are overwritten.
@param string|array|\Thin\Html\Attributes $attribute The name of the attribute to set, a name-value array of attributes or an attributes object
@param string|array $value In case the first parametre is a string, v... | [
"Set",
"the",
"value",
"or",
"values",
"of",
"an",
"attribute",
"or",
"an",
"array",
"thereof",
".",
"Already",
"existent",
"attributes",
"are",
"overwritten",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Attributes.php#L64-L93 | train |
schpill/thin | src/Html/Attributes.php | Attributes.remove | public function remove($attribute, $value = null)
{
$attribute = strval($attribute);
if(\Thin\Arrays::exists($attribute, $this->attributes)) {
if(null === $value) {
unset($this->attributes[$attribute]);
} else {
$va... | php | public function remove($attribute, $value = null)
{
$attribute = strval($attribute);
if(\Thin\Arrays::exists($attribute, $this->attributes)) {
if(null === $value) {
unset($this->attributes[$attribute]);
} else {
$va... | [
"public",
"function",
"remove",
"(",
"$",
"attribute",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"attribute",
"=",
"strval",
"(",
"$",
"attribute",
")",
";",
"if",
"(",
"\\",
"Thin",
"\\",
"Arrays",
"::",
"exists",
"(",
"$",
"attribute",
",",
... | Remove an attribute or a value
@param string $attribute The attribute name to remove(or to remove a value from)
@param string $value The value to remove from the attribute. Omit the parametre to remove the entire attribute.
@return \Thin\Html\Attributes Provides a fluent interface | [
"Remove",
"an",
"attribute",
"or",
"a",
"value"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Attributes.php#L103-L121 | train |
schpill/thin | src/Html/Attributes.php | Attributes.getArray | public function getArray($attribute = null)
{
if(null === $attribute) {
return $this->attributes;
} else {
$attribute = strval($attribute);
if(ake($attribute, $this->attributes)) {
return $this->attributes[$attribute];
... | php | public function getArray($attribute = null)
{
if(null === $attribute) {
return $this->attributes;
} else {
$attribute = strval($attribute);
if(ake($attribute, $this->attributes)) {
return $this->attributes[$attribute];
... | [
"public",
"function",
"getArray",
"(",
"$",
"attribute",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"attribute",
")",
"{",
"return",
"$",
"this",
"->",
"attributes",
";",
"}",
"else",
"{",
"$",
"attribute",
"=",
"strval",
"(",
"$",
"attrib... | Get the entire attributes array or the array of values for a single attribute.
@param string $attribute The attribute whose values are to be retrieved. Omit the parametre to fetch the entire array of attributes.
@return array|null The attribute or attributes or null in case a nonexistent attribute is requested | [
"Get",
"the",
"entire",
"attributes",
"array",
"or",
"the",
"array",
"of",
"values",
"for",
"a",
"single",
"attribute",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Attributes.php#L130-L142 | train |
schpill/thin | src/Html/Attributes.php | Attributes.getHtml | public function getHtml($attribute = null)
{
if(null !== $attribute) {
$attribute = strval($attribute);
if(\Thin\Arrays::exists($attribute, $this->attributes)) {
return $attribute . '="' . implode(' ', $this->attributes[$attribute]) . '"';
... | php | public function getHtml($attribute = null)
{
if(null !== $attribute) {
$attribute = strval($attribute);
if(\Thin\Arrays::exists($attribute, $this->attributes)) {
return $attribute . '="' . implode(' ', $this->attributes[$attribute]) . '"';
... | [
"public",
"function",
"getHtml",
"(",
"$",
"attribute",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"attribute",
")",
"{",
"$",
"attribute",
"=",
"strval",
"(",
"$",
"attribute",
")",
";",
"if",
"(",
"\\",
"Thin",
"\\",
"Arrays",
"::",
"e... | Generate the HTML code for the attributes
@param string $attribute The attribute for which HTML code is to be generated. Omit the parametre to generate HTML code for all attributes.
@return string HTML code | [
"Generate",
"the",
"HTML",
"code",
"for",
"the",
"attributes"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Attributes.php#L151-L167 | train |
schpill/thin | src/Html/Attributes.php | Attributes.exists | public function exists($attribute, $value = null)
{
$attribute = strval($attribute);
if(\Thin\Arrays::exists($attribute, $this->attributes)) {
if(null === $value || in_array(strval($value), $this->attributes[$attribute])) {
return true;
... | php | public function exists($attribute, $value = null)
{
$attribute = strval($attribute);
if(\Thin\Arrays::exists($attribute, $this->attributes)) {
if(null === $value || in_array(strval($value), $this->attributes[$attribute])) {
return true;
... | [
"public",
"function",
"exists",
"(",
"$",
"attribute",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"attribute",
"=",
"strval",
"(",
"$",
"attribute",
")",
";",
"if",
"(",
"\\",
"Thin",
"\\",
"Arrays",
"::",
"exists",
"(",
"$",
"attribute",
",",
... | Check whether a given attribute or attribute value exists
@param string $attribute Attribute name whose existence is to be checked
@param string $value The attribute's value to be checked. Omit the parametre to check the existence of the attribute.
@return boolean | [
"Check",
"whether",
"a",
"given",
"attribute",
"or",
"attribute",
"value",
"exists"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Attributes.php#L187-L198 | train |
PhoxPHP/Glider | src/Query/Builder/Type.php | Type.getStatementType | public static function getStatementType(String $query) : Int
{
$type = 0;
if (preg_match("/^SELECT|select|Select([^ ]+)/", $query)) {
$type = 1;
}
if (preg_match("/^INSERT([^ ]+)/", $query)) {
$type = 2;
}
if (preg_match("/^UPDATE([^ ]+)/", $query)) {
$type = 3;
}
if (preg_match("/^DELETE([... | php | public static function getStatementType(String $query) : Int
{
$type = 0;
if (preg_match("/^SELECT|select|Select([^ ]+)/", $query)) {
$type = 1;
}
if (preg_match("/^INSERT([^ ]+)/", $query)) {
$type = 2;
}
if (preg_match("/^UPDATE([^ ]+)/", $query)) {
$type = 3;
}
if (preg_match("/^DELETE([... | [
"public",
"static",
"function",
"getStatementType",
"(",
"String",
"$",
"query",
")",
":",
"Int",
"{",
"$",
"type",
"=",
"0",
";",
"if",
"(",
"preg_match",
"(",
"\"/^SELECT|select|Select([^ ]+)/\"",
",",
"$",
"query",
")",
")",
"{",
"$",
"type",
"=",
"1"... | This method gets and returns the statement type.
@param $query <String>
@access public
@return <Integer> | [
"This",
"method",
"gets",
"and",
"returns",
"the",
"statement",
"type",
"."
] | 17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042 | https://github.com/PhoxPHP/Glider/blob/17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042/src/Query/Builder/Type.php#L35-L55 | train |
skeeks-cms/cms-search | src/console/controllers/ClearController.php | ClearController.actionPhrase | public function actionPhrase()
{
$this->stdout('phraseLiveTime: ' . \Yii::$app->cmsSearch->phraseLiveTime . "\n");
if (\Yii::$app->cmsSearch->phraseLiveTime) {
$deleted = CmsSearchPhrase::deleteAll([
'<=',
'created_at',
\Yii::$app->formatt... | php | public function actionPhrase()
{
$this->stdout('phraseLiveTime: ' . \Yii::$app->cmsSearch->phraseLiveTime . "\n");
if (\Yii::$app->cmsSearch->phraseLiveTime) {
$deleted = CmsSearchPhrase::deleteAll([
'<=',
'created_at',
\Yii::$app->formatt... | [
"public",
"function",
"actionPhrase",
"(",
")",
"{",
"$",
"this",
"->",
"stdout",
"(",
"'phraseLiveTime: '",
".",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"cmsSearch",
"->",
"phraseLiveTime",
".",
"\"\\n\"",
")",
";",
"if",
"(",
"\\",
"Yii",
"::",
"$",
"ap... | Remove old searches | [
"Remove",
"old",
"searches"
] | 2fcd8c6343f46938c5cc5829bbb4c9a83593092d | https://github.com/skeeks-cms/cms-search/blob/2fcd8c6343f46938c5cc5829bbb4c9a83593092d/src/console/controllers/ClearController.php#L26-L41 | train |
diasbruno/stc | lib/stc/DataWriter.php | DataWriter.write_to | private function write_to($file, $data)
{
$handler = fopen($file, "w");
fwrite($handler, $data);
fclose($handler);
} | php | private function write_to($file, $data)
{
$handler = fopen($file, "w");
fwrite($handler, $data);
fclose($handler);
} | [
"private",
"function",
"write_to",
"(",
"$",
"file",
",",
"$",
"data",
")",
"{",
"$",
"handler",
"=",
"fopen",
"(",
"$",
"file",
",",
"\"w\"",
")",
";",
"fwrite",
"(",
"$",
"handler",
",",
"$",
"data",
")",
";",
"fclose",
"(",
"$",
"handler",
")"... | Creates the handler and writes the files.
@param $file string | The filename.
@return string | [
"Creates",
"the",
"handler",
"and",
"writes",
"the",
"files",
"."
] | 43f62c3b28167bff76274f954e235413a9e9c707 | https://github.com/diasbruno/stc/blob/43f62c3b28167bff76274f954e235413a9e9c707/lib/stc/DataWriter.php#L21-L26 | train |
diasbruno/stc | lib/stc/DataWriter.php | DataWriter.write | public function write($path = '', $file = '', $content = '')
{
$the_path = Application::config()->public_folder() . '/' . $path;
@mkdir($the_path, 0755, true);
$this->write_to($the_path . '/'. $file, $content);
} | php | public function write($path = '', $file = '', $content = '')
{
$the_path = Application::config()->public_folder() . '/' . $path;
@mkdir($the_path, 0755, true);
$this->write_to($the_path . '/'. $file, $content);
} | [
"public",
"function",
"write",
"(",
"$",
"path",
"=",
"''",
",",
"$",
"file",
"=",
"''",
",",
"$",
"content",
"=",
"''",
")",
"{",
"$",
"the_path",
"=",
"Application",
"::",
"config",
"(",
")",
"->",
"public_folder",
"(",
")",
".",
"'/'",
".",
"$... | Write the file.
@param $path string | The path where the file is located.
@param $file string | The filename.
@param $content string | The file content.
@return string | [
"Write",
"the",
"file",
"."
] | 43f62c3b28167bff76274f954e235413a9e9c707 | https://github.com/diasbruno/stc/blob/43f62c3b28167bff76274f954e235413a9e9c707/lib/stc/DataWriter.php#L35-L41 | train |
RadialCorp/magento-core | src/lib/Radial/RiskService/Sdk/Api.php | Radial_RiskService_Sdk_Api._deserializeResponse | protected function _deserializeResponse($responseData)
{
try {
$this->getResponseBody()->deserialize($responseData);
} catch (Radial_RiskService_Sdk_Exception_Invalid_Payload_Exception $e) {
$logMessage = sprintf('[%s] Error Payload Response Body: %s', __CLASS__, $this->cleanAuthXml($responseData));
... | php | protected function _deserializeResponse($responseData)
{
try {
$this->getResponseBody()->deserialize($responseData);
} catch (Radial_RiskService_Sdk_Exception_Invalid_Payload_Exception $e) {
$logMessage = sprintf('[%s] Error Payload Response Body: %s', __CLASS__, $this->cleanAuthXml($responseData));
... | [
"protected",
"function",
"_deserializeResponse",
"(",
"$",
"responseData",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"getResponseBody",
"(",
")",
"->",
"deserialize",
"(",
"$",
"responseData",
")",
";",
"}",
"catch",
"(",
"Radial_RiskService_Sdk_Exception_Invalid_P... | Deserialized the response xml into response payload if an exception is thrown catch it
and set the error payload and deserialized the response xml into it.
@param string
@return self | [
"Deserialized",
"the",
"response",
"xml",
"into",
"response",
"payload",
"if",
"an",
"exception",
"is",
"thrown",
"catch",
"it",
"and",
"set",
"the",
"error",
"payload",
"and",
"deserialized",
"the",
"response",
"xml",
"into",
"it",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/lib/Radial/RiskService/Sdk/Api.php#L94-L107 | train |
RadialCorp/magento-core | src/lib/Radial/RiskService/Sdk/Api.php | Radial_RiskService_Sdk_Api._sendRequest | protected function _sendRequest()
{
// clear the old response
$this->_lastRequestsResponse = null;
$httpMethod = strtolower($this->_config->getHttpMethod());
if (!method_exists($this, $httpMethod)) {
throw Mage::exception(
'Radial_RiskService_Sdk_Exception_Unsupported_Http_Action',
sprintf('HTTP act... | php | protected function _sendRequest()
{
// clear the old response
$this->_lastRequestsResponse = null;
$httpMethod = strtolower($this->_config->getHttpMethod());
if (!method_exists($this, $httpMethod)) {
throw Mage::exception(
'Radial_RiskService_Sdk_Exception_Unsupported_Http_Action',
sprintf('HTTP act... | [
"protected",
"function",
"_sendRequest",
"(",
")",
"{",
"// clear the old response",
"$",
"this",
"->",
"_lastRequestsResponse",
"=",
"null",
";",
"$",
"httpMethod",
"=",
"strtolower",
"(",
"$",
"this",
"->",
"_config",
"->",
"getHttpMethod",
"(",
")",
")",
";... | Send get or post CURL request to the API URI.
@return boolean
@throws Radial_RiskService_Sdk_Exception_Unsupported_Http_Action_Exception | [
"Send",
"get",
"or",
"post",
"CURL",
"request",
"to",
"the",
"API",
"URI",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/lib/Radial/RiskService/Sdk/Api.php#L175-L188 | train |
RadialCorp/magento-core | src/lib/Radial/RiskService/Sdk/Api.php | Radial_RiskService_Sdk_Api._post | protected function _post()
{
$requestXml = $this->getRequestBody()->serialize();
if ($this->_helperConfig->isDebugMode()) {
$logMessage = sprintf('[%s] Request Body: %s', __CLASS__, $this->cleanAuthXml($requestXml));
Mage::log($logMessage, Zend_Log::DEBUG);
}
$xml = simplexml_load_string($requestXml);
... | php | protected function _post()
{
$requestXml = $this->getRequestBody()->serialize();
if ($this->_helperConfig->isDebugMode()) {
$logMessage = sprintf('[%s] Request Body: %s', __CLASS__, $this->cleanAuthXml($requestXml));
Mage::log($logMessage, Zend_Log::DEBUG);
}
$xml = simplexml_load_string($requestXml);
... | [
"protected",
"function",
"_post",
"(",
")",
"{",
"$",
"requestXml",
"=",
"$",
"this",
"->",
"getRequestBody",
"(",
")",
"->",
"serialize",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_helperConfig",
"->",
"isDebugMode",
"(",
")",
")",
"{",
"$",
"lo... | Send post CURL request.
@return Requests_Response
@throws Requests_Exception | [
"Send",
"post",
"CURL",
"request",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/lib/Radial/RiskService/Sdk/Api.php#L196-L231 | train |
RadialCorp/magento-core | src/lib/Radial/RiskService/Sdk/Api.php | Radial_RiskService_Sdk_Api._get | protected function _get()
{
$this->_lastRequestsResponse = Requests::post(
$this->_config->getEndpoint(),
$this->_buildHeader()
);
return $this->_lastRequestsResponse->success;
} | php | protected function _get()
{
$this->_lastRequestsResponse = Requests::post(
$this->_config->getEndpoint(),
$this->_buildHeader()
);
return $this->_lastRequestsResponse->success;
} | [
"protected",
"function",
"_get",
"(",
")",
"{",
"$",
"this",
"->",
"_lastRequestsResponse",
"=",
"Requests",
"::",
"post",
"(",
"$",
"this",
"->",
"_config",
"->",
"getEndpoint",
"(",
")",
",",
"$",
"this",
"->",
"_buildHeader",
"(",
")",
")",
";",
"re... | Send get CURL request.
@return Requests_Response
@throws Requests_Exception | [
"Send",
"get",
"CURL",
"request",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/lib/Radial/RiskService/Sdk/Api.php#L252-L259 | train |
RadialCorp/magento-core | src/lib/Radial/RiskService/Sdk/Api.php | Radial_RiskService_Sdk_Api.cleanAuthXml | public function cleanAuthXml($xml)
{
$xml = preg_replace('#(\<(?:Encrypted)?CardSecurityCode\>).*(\</(?:Encrypted)?CardSecurityCode\>)#', '$1***$2', $xml);
$xml = preg_replace('#(\<(?:Encrypted)?PaymentAccountUniqueId.*?\>).*(\</(?:Encrypted)?PaymentAccountUniqueId\>)#', '$1***$2', $xm... | php | public function cleanAuthXml($xml)
{
$xml = preg_replace('#(\<(?:Encrypted)?CardSecurityCode\>).*(\</(?:Encrypted)?CardSecurityCode\>)#', '$1***$2', $xml);
$xml = preg_replace('#(\<(?:Encrypted)?PaymentAccountUniqueId.*?\>).*(\</(?:Encrypted)?PaymentAccountUniqueId\>)#', '$1***$2', $xm... | [
"public",
"function",
"cleanAuthXml",
"(",
"$",
"xml",
")",
"{",
"$",
"xml",
"=",
"preg_replace",
"(",
"'#(\\<(?:Encrypted)?CardSecurityCode\\>).*(\\</(?:Encrypted)?CardSecurityCode\\>)#'",
",",
"'$1***$2'",
",",
"$",
"xml",
")",
";",
"$",
"xml",
"=",
"preg_replace",
... | Scrub the auth request XML message of any sensitive data - CVV, CC number.
@param string $xml
@return string | [
"Scrub",
"the",
"auth",
"request",
"XML",
"message",
"of",
"any",
"sensitive",
"data",
"-",
"CVV",
"CC",
"number",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/lib/Radial/RiskService/Sdk/Api.php#L266-L272 | train |
drmvc/router | src/Router/Router.php | Router.set | public function set(array $methods, array $args): RouterInterface
{
list($pattern, $callable) = $args;
$route = new Route($methods, $pattern, $callable);
$this->setRoute($route);
return $this;
} | php | public function set(array $methods, array $args): RouterInterface
{
list($pattern, $callable) = $args;
$route = new Route($methods, $pattern, $callable);
$this->setRoute($route);
return $this;
} | [
"public",
"function",
"set",
"(",
"array",
"$",
"methods",
",",
"array",
"$",
"args",
")",
":",
"RouterInterface",
"{",
"list",
"(",
"$",
"pattern",
",",
"$",
"callable",
")",
"=",
"$",
"args",
";",
"$",
"route",
"=",
"new",
"Route",
"(",
"$",
"met... | Abstraction of setter
@param array $methods
@param array $args
@return RouterInterface | [
"Abstraction",
"of",
"setter"
] | ecbf5f4380a060af83af23334b9f81054bc6c64c | https://github.com/drmvc/router/blob/ecbf5f4380a060af83af23334b9f81054bc6c64c/src/Router/Router.php#L80-L86 | train |
drmvc/router | src/Router/Router.php | Router.checkMethods | public function checkMethods(array $methods): array
{
return array_map(
function($method) {
$method = strtolower($method);
if (!\in_array($method, self::METHODS, false)) {
throw new Exception("Method \"$method\" is not in allowed list [" . impl... | php | public function checkMethods(array $methods): array
{
return array_map(
function($method) {
$method = strtolower($method);
if (!\in_array($method, self::METHODS, false)) {
throw new Exception("Method \"$method\" is not in allowed list [" . impl... | [
"public",
"function",
"checkMethods",
"(",
"array",
"$",
"methods",
")",
":",
"array",
"{",
"return",
"array_map",
"(",
"function",
"(",
"$",
"method",
")",
"{",
"$",
"method",
"=",
"strtolower",
"(",
"$",
"method",
")",
";",
"if",
"(",
"!",
"\\",
"i... | Check if passed methods in allowed list
@param array $methods list of methods for check
@throws Exception
@return array | [
"Check",
"if",
"passed",
"methods",
"in",
"allowed",
"list"
] | ecbf5f4380a060af83af23334b9f81054bc6c64c | https://github.com/drmvc/router/blob/ecbf5f4380a060af83af23334b9f81054bc6c64c/src/Router/Router.php#L95-L108 | train |
drmvc/router | src/Router/Router.php | Router.map | public function map(array $methods, string $pattern, $callable): MethodsInterface
{
// Check if method in allowed list
$methods = $this->checkMethods($methods);
// Set new route with parameters
$this->set($methods, [$pattern, $callable]);
return $this;
} | php | public function map(array $methods, string $pattern, $callable): MethodsInterface
{
// Check if method in allowed list
$methods = $this->checkMethods($methods);
// Set new route with parameters
$this->set($methods, [$pattern, $callable]);
return $this;
} | [
"public",
"function",
"map",
"(",
"array",
"$",
"methods",
",",
"string",
"$",
"pattern",
",",
"$",
"callable",
")",
":",
"MethodsInterface",
"{",
"// Check if method in allowed list",
"$",
"methods",
"=",
"$",
"this",
"->",
"checkMethods",
"(",
"$",
"methods"... | Callable must be only selected methods
@param array $methods
@param string $pattern
@param callable|string $callable
@throws Exception
@return MethodsInterface | [
"Callable",
"must",
"be",
"only",
"selected",
"methods"
] | ecbf5f4380a060af83af23334b9f81054bc6c64c | https://github.com/drmvc/router/blob/ecbf5f4380a060af83af23334b9f81054bc6c64c/src/Router/Router.php#L119-L128 | train |
drmvc/router | src/Router/Router.php | Router.any | public function any(string $pattern, $callable): MethodsInterface
{
// Set new route with all methods
$this->set(self::METHODS, [$pattern, $callable]);
return $this;
} | php | public function any(string $pattern, $callable): MethodsInterface
{
// Set new route with all methods
$this->set(self::METHODS, [$pattern, $callable]);
return $this;
} | [
"public",
"function",
"any",
"(",
"string",
"$",
"pattern",
",",
"$",
"callable",
")",
":",
"MethodsInterface",
"{",
"// Set new route with all methods",
"$",
"this",
"->",
"set",
"(",
"self",
"::",
"METHODS",
",",
"[",
"$",
"pattern",
",",
"$",
"callable",
... | Any method should be callable
@param string $pattern
@param callable|string $callable
@return MethodsInterface | [
"Any",
"method",
"should",
"be",
"callable"
] | ecbf5f4380a060af83af23334b9f81054bc6c64c | https://github.com/drmvc/router/blob/ecbf5f4380a060af83af23334b9f81054bc6c64c/src/Router/Router.php#L137-L143 | train |
drmvc/router | src/Router/Router.php | Router.setRoute | public function setRoute(RouteInterface $route): RouterInterface
{
$regexp = $route->getRegexp();
$this->_routes[$regexp] = $route;
return $this;
} | php | public function setRoute(RouteInterface $route): RouterInterface
{
$regexp = $route->getRegexp();
$this->_routes[$regexp] = $route;
return $this;
} | [
"public",
"function",
"setRoute",
"(",
"RouteInterface",
"$",
"route",
")",
":",
"RouterInterface",
"{",
"$",
"regexp",
"=",
"$",
"route",
"->",
"getRegexp",
"(",
")",
";",
"$",
"this",
"->",
"_routes",
"[",
"$",
"regexp",
"]",
"=",
"$",
"route",
";",
... | Add route into the array of routes
@param RouteInterface $route
@return RouterInterface | [
"Add",
"route",
"into",
"the",
"array",
"of",
"routes"
] | ecbf5f4380a060af83af23334b9f81054bc6c64c | https://github.com/drmvc/router/blob/ecbf5f4380a060af83af23334b9f81054bc6c64c/src/Router/Router.php#L225-L230 | train |
drmvc/router | src/Router/Router.php | Router.checkMatches | private function checkMatches(string $uri, string $method): array
{
return array_map(
function($regexp, $route) use ($uri, $method) {
$match = preg_match_all($regexp, $uri, $matches);
// If something found and method is correct
if ($match && $rout... | php | private function checkMatches(string $uri, string $method): array
{
return array_map(
function($regexp, $route) use ($uri, $method) {
$match = preg_match_all($regexp, $uri, $matches);
// If something found and method is correct
if ($match && $rout... | [
"private",
"function",
"checkMatches",
"(",
"string",
"$",
"uri",
",",
"string",
"$",
"method",
")",
":",
"array",
"{",
"return",
"array_map",
"(",
"function",
"(",
"$",
"regexp",
",",
"$",
"route",
")",
"use",
"(",
"$",
"uri",
",",
"$",
"method",
")... | Find route object by URL nad method
@param string $uri
@param string $method
@return array | [
"Find",
"route",
"object",
"by",
"URL",
"nad",
"method"
] | ecbf5f4380a060af83af23334b9f81054bc6c64c | https://github.com/drmvc/router/blob/ecbf5f4380a060af83af23334b9f81054bc6c64c/src/Router/Router.php#L239-L258 | train |
drmvc/router | src/Router/Router.php | Router.getMatches | private function getMatches(): array
{
// Extract URI of current query
$uri = $this->getRequest()->getUri()->getPath();
// Extract method of current request
$method = $this->getRequest()->getMethod();
$method = strtolower($method);
// Foreach emulation
retur... | php | private function getMatches(): array
{
// Extract URI of current query
$uri = $this->getRequest()->getUri()->getPath();
// Extract method of current request
$method = $this->getRequest()->getMethod();
$method = strtolower($method);
// Foreach emulation
retur... | [
"private",
"function",
"getMatches",
"(",
")",
":",
"array",
"{",
"// Extract URI of current query",
"$",
"uri",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getUri",
"(",
")",
"->",
"getPath",
"(",
")",
";",
"// Extract method of current request",
"... | Find optimal route from array of routes by regexp and uri
@return array | [
"Find",
"optimal",
"route",
"from",
"array",
"of",
"routes",
"by",
"regexp",
"and",
"uri"
] | ecbf5f4380a060af83af23334b9f81054bc6c64c | https://github.com/drmvc/router/blob/ecbf5f4380a060af83af23334b9f81054bc6c64c/src/Router/Router.php#L265-L276 | train |
drmvc/router | src/Router/Router.php | Router.getRoute | public function getRoute(): RouteInterface
{
// Find route by regexp and URI
$matches = $this->getMatches();
// Cleanup the array of matches, then reindex array
$matches = array_values(array_filter($matches));
// If we have some classes in result of regexp
$result =... | php | public function getRoute(): RouteInterface
{
// Find route by regexp and URI
$matches = $this->getMatches();
// Cleanup the array of matches, then reindex array
$matches = array_values(array_filter($matches));
// If we have some classes in result of regexp
$result =... | [
"public",
"function",
"getRoute",
"(",
")",
":",
"RouteInterface",
"{",
"// Find route by regexp and URI",
"$",
"matches",
"=",
"$",
"this",
"->",
"getMatches",
"(",
")",
";",
"// Cleanup the array of matches, then reindex array",
"$",
"matches",
"=",
"array_values",
... | Parse URI by Regexp from routes and return single route
@return RouteInterface | [
"Parse",
"URI",
"by",
"Regexp",
"from",
"routes",
"and",
"return",
"single",
"route"
] | ecbf5f4380a060af83af23334b9f81054bc6c64c | https://github.com/drmvc/router/blob/ecbf5f4380a060af83af23334b9f81054bc6c64c/src/Router/Router.php#L283-L299 | train |
drmvc/router | src/Router/Router.php | Router.getRoutes | public function getRoutes(bool $keys = false): array
{
return $keys
? array_keys($this->_routes)
: $this->_routes;
} | php | public function getRoutes(bool $keys = false): array
{
return $keys
? array_keys($this->_routes)
: $this->_routes;
} | [
"public",
"function",
"getRoutes",
"(",
"bool",
"$",
"keys",
"=",
"false",
")",
":",
"array",
"{",
"return",
"$",
"keys",
"?",
"array_keys",
"(",
"$",
"this",
"->",
"_routes",
")",
":",
"$",
"this",
"->",
"_routes",
";",
"}"
] | Get all available routes
@param bool $keys - Return only keys
@return array | [
"Get",
"all",
"available",
"routes"
] | ecbf5f4380a060af83af23334b9f81054bc6c64c | https://github.com/drmvc/router/blob/ecbf5f4380a060af83af23334b9f81054bc6c64c/src/Router/Router.php#L307-L312 | train |
wigedev/farm | src/Utility/ValueMap.php | ValueMap.get | public function get(string $index) : string
{
if (!$this->isValid($index)) {
throw new \InvalidArgumentException('The specified value does not exist');
}
return $this->map[$index];
} | php | public function get(string $index) : string
{
if (!$this->isValid($index)) {
throw new \InvalidArgumentException('The specified value does not exist');
}
return $this->map[$index];
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"index",
")",
":",
"string",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValid",
"(",
"$",
"index",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The specified value does not exist'",
... | Retrieve a value
@param string $index
@return string | [
"Retrieve",
"a",
"value"
] | 7a1729ec78628b7e5435e4a42e42d547a07af851 | https://github.com/wigedev/farm/blob/7a1729ec78628b7e5435e4a42e42d547a07af851/src/Utility/ValueMap.php#L22-L28 | train |
wigedev/farm | src/Utility/ValueMap.php | ValueMap.addValue | public function addValue(string $key, string $value) : void
{
$this->map[$key] = $value;
} | php | public function addValue(string $key, string $value) : void
{
$this->map[$key] = $value;
} | [
"public",
"function",
"addValue",
"(",
"string",
"$",
"key",
",",
"string",
"$",
"value",
")",
":",
"void",
"{",
"$",
"this",
"->",
"map",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}"
] | Add a new value to the map
@param string $key
@param string $value | [
"Add",
"a",
"new",
"value",
"to",
"the",
"map"
] | 7a1729ec78628b7e5435e4a42e42d547a07af851 | https://github.com/wigedev/farm/blob/7a1729ec78628b7e5435e4a42e42d547a07af851/src/Utility/ValueMap.php#L47-L50 | train |
wigedev/farm | src/Utility/ValueMap.php | ValueMap.deleteValue | public function deleteValue(string $key) : void
{
if (isset($this->map[$key])) {
unset($this->map[$key]);
}
} | php | public function deleteValue(string $key) : void
{
if (isset($this->map[$key])) {
unset($this->map[$key]);
}
} | [
"public",
"function",
"deleteValue",
"(",
"string",
"$",
"key",
")",
":",
"void",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"map",
"[",
"$",
"key",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"map",
"[",
"$",
"key",
"]",
")",
... | Delete a value from the map based on the key
@param string $key | [
"Delete",
"a",
"value",
"from",
"the",
"map",
"based",
"on",
"the",
"key"
] | 7a1729ec78628b7e5435e4a42e42d547a07af851 | https://github.com/wigedev/farm/blob/7a1729ec78628b7e5435e4a42e42d547a07af851/src/Utility/ValueMap.php#L56-L61 | train |
valu-digital/valuso | src/ValuSo/Broker/ServiceBrokerFactory.php | ServiceBrokerFactory.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
$evm = $serviceLocator->get('EventManager');
$config = $serviceLocator->get('Config');
$config = empty($config['valu_so']) ? [] : $config['valu_so'];
$cacheConfig = isset($config['cache']) ? $config[... | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
$evm = $serviceLocator->get('EventManager');
$config = $serviceLocator->get('Config');
$config = empty($config['valu_so']) ? [] : $config['valu_so'];
$cacheConfig = isset($config['cache']) ? $config[... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"$",
"evm",
"=",
"$",
"serviceLocator",
"->",
"get",
"(",
"'EventManager'",
")",
";",
"$",
"config",
"=",
"$",
"serviceLocator",
"->",
"get",
"(",
"'Config'... | Create a ServiceBroker
{@see ValuSo\Broker\ServiceBroker} uses {@see Zend\ServiceManager\ServiceManager} internally to initialize service
instances. {@see Zend\Mvc\Service\ServiceManagerConfig} for how to configure service manager.
This factory uses following configuration scheme:
<code>
[
'valu_so' => [
// See Zend\... | [
"Create",
"a",
"ServiceBroker"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Broker/ServiceBrokerFactory.php#L76-L144 | train |
IftekherSunny/Planet-Framework | src/Sun/Filesystem/Filesystem.php | Filesystem.create | public function create($filename, $content)
{
$filename = str::path($filename);
$this->createDirectory(dirname($filename));
return file_put_contents($filename, $content);
} | php | public function create($filename, $content)
{
$filename = str::path($filename);
$this->createDirectory(dirname($filename));
return file_put_contents($filename, $content);
} | [
"public",
"function",
"create",
"(",
"$",
"filename",
",",
"$",
"content",
")",
"{",
"$",
"filename",
"=",
"str",
"::",
"path",
"(",
"$",
"filename",
")",
";",
"$",
"this",
"->",
"createDirectory",
"(",
"dirname",
"(",
"$",
"filename",
")",
")",
";",... | To create file
@param string $filename
@param string $content
@return int | [
"To",
"create",
"file"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Filesystem/Filesystem.php#L20-L27 | train |
IftekherSunny/Planet-Framework | src/Sun/Filesystem/Filesystem.php | Filesystem.delete | public function delete($filename)
{
if ($this->exists($filename) && $this->isFile($filename)) {
return @unlink($filename);
}
throw new FileNotFoundException('File not found in the path [ ' . $filename . ' ].');
} | php | public function delete($filename)
{
if ($this->exists($filename) && $this->isFile($filename)) {
return @unlink($filename);
}
throw new FileNotFoundException('File not found in the path [ ' . $filename . ' ].');
} | [
"public",
"function",
"delete",
"(",
"$",
"filename",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"exists",
"(",
"$",
"filename",
")",
"&&",
"$",
"this",
"->",
"isFile",
"(",
"$",
"filename",
")",
")",
"{",
"return",
"@",
"unlink",
"(",
"$",
"filename"... | To delete file
@param string $filename
@return bool
@throws FileNotFoundException | [
"To",
"delete",
"file"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Filesystem/Filesystem.php#L37-L44 | train |
IftekherSunny/Planet-Framework | src/Sun/Filesystem/Filesystem.php | Filesystem.update | public function update($filename, $content)
{
if ($this->exists($filename) && $this->isFile($filename)) {
return $this->create($filename, $content);
}
throw new FileNotFoundException('File not found in the path [ ' . $filename . ' ].');
} | php | public function update($filename, $content)
{
if ($this->exists($filename) && $this->isFile($filename)) {
return $this->create($filename, $content);
}
throw new FileNotFoundException('File not found in the path [ ' . $filename . ' ].');
} | [
"public",
"function",
"update",
"(",
"$",
"filename",
",",
"$",
"content",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"exists",
"(",
"$",
"filename",
")",
"&&",
"$",
"this",
"->",
"isFile",
"(",
"$",
"filename",
")",
")",
"{",
"return",
"$",
"this",
... | To update file
@param string $filename
@param string $content
@return int
@throws FileNotFoundException | [
"To",
"update",
"file"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Filesystem/Filesystem.php#L71-L78 | train |
IftekherSunny/Planet-Framework | src/Sun/Filesystem/Filesystem.php | Filesystem.get | public function get($filename)
{
if ($this->exists($filename) && $this->isFile($filename)) {
return file_get_contents($filename);
}
throw new FileNotFoundException('File not found in the path [ ' . $filename . ' ].');
} | php | public function get($filename)
{
if ($this->exists($filename) && $this->isFile($filename)) {
return file_get_contents($filename);
}
throw new FileNotFoundException('File not found in the path [ ' . $filename . ' ].');
} | [
"public",
"function",
"get",
"(",
"$",
"filename",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"exists",
"(",
"$",
"filename",
")",
"&&",
"$",
"this",
"->",
"isFile",
"(",
"$",
"filename",
")",
")",
"{",
"return",
"file_get_contents",
"(",
"$",
"filename... | To get file content
@param string $filename
@return string
@throws FileNotFoundException | [
"To",
"get",
"file",
"content"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Filesystem/Filesystem.php#L88-L95 | train |
IftekherSunny/Planet-Framework | src/Sun/Filesystem/Filesystem.php | Filesystem.append | public function append($filename, $content)
{
if ($this->exists($filename) && $this->isFile($filename)) {
return file_put_contents($filename, $content, FILE_APPEND);
}
throw new FileNotFoundException('File not found in the path [ ' . $filename . ' ].');
} | php | public function append($filename, $content)
{
if ($this->exists($filename) && $this->isFile($filename)) {
return file_put_contents($filename, $content, FILE_APPEND);
}
throw new FileNotFoundException('File not found in the path [ ' . $filename . ' ].');
} | [
"public",
"function",
"append",
"(",
"$",
"filename",
",",
"$",
"content",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"exists",
"(",
"$",
"filename",
")",
"&&",
"$",
"this",
"->",
"isFile",
"(",
"$",
"filename",
")",
")",
"{",
"return",
"file_put_conten... | To append file
@param string $filename
@param string $content
@return int
@throws FileNotFoundException | [
"To",
"append",
"file"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Filesystem/Filesystem.php#L106-L113 | train |
IftekherSunny/Planet-Framework | src/Sun/Filesystem/Filesystem.php | Filesystem.size | public function size($filename)
{
if ($this->exists($filename) && $this->isFile($filename)) {
return filesize($filename);
}
throw new FileNotFoundException('File not found in the path [ ' . $filename . ' ].');
} | php | public function size($filename)
{
if ($this->exists($filename) && $this->isFile($filename)) {
return filesize($filename);
}
throw new FileNotFoundException('File not found in the path [ ' . $filename . ' ].');
} | [
"public",
"function",
"size",
"(",
"$",
"filename",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"exists",
"(",
"$",
"filename",
")",
"&&",
"$",
"this",
"->",
"isFile",
"(",
"$",
"filename",
")",
")",
"{",
"return",
"filesize",
"(",
"$",
"filename",
")"... | To get a filesize in byte
@param string $filename
@return int
@throws FileNotFoundException | [
"To",
"get",
"a",
"filesize",
"in",
"byte"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Filesystem/Filesystem.php#L149-L155 | train |
IftekherSunny/Planet-Framework | src/Sun/Filesystem/Filesystem.php | Filesystem.files | public function files($directoryName)
{
if (!$this->isDir($directoryName)) {
throw new FileNotFoundException('Directory not found in the path [ ' . $directoryName . ' ].');
}
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($directoryName... | php | public function files($directoryName)
{
if (!$this->isDir($directoryName)) {
throw new FileNotFoundException('Directory not found in the path [ ' . $directoryName . ' ].');
}
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($directoryName... | [
"public",
"function",
"files",
"(",
"$",
"directoryName",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isDir",
"(",
"$",
"directoryName",
")",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
"'Directory not found in the path [ '",
".",
"$",
"directory... | To get all files in a directory
@param string $directoryName
@return array
@throws FileNotFoundException | [
"To",
"get",
"all",
"files",
"in",
"a",
"directory"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Filesystem/Filesystem.php#L165-L178 | train |
IftekherSunny/Planet-Framework | src/Sun/Filesystem/Filesystem.php | Filesystem.directories | public function directories($directoryName)
{
if (!$this->isDir($directoryName)) {
throw new FileNotFoundException('Directory not found in the path [ ' . $directoryName . ' ].');
}
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($dire... | php | public function directories($directoryName)
{
if (!$this->isDir($directoryName)) {
throw new FileNotFoundException('Directory not found in the path [ ' . $directoryName . ' ].');
}
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($dire... | [
"public",
"function",
"directories",
"(",
"$",
"directoryName",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isDir",
"(",
"$",
"directoryName",
")",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
"'Directory not found in the path [ '",
".",
"$",
"dir... | To get all directories in a directory
@param string $directoryName
@return array
@throws FileNotFoundException | [
"To",
"get",
"all",
"directories",
"in",
"a",
"directory"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Filesystem/Filesystem.php#L188-L212 | train |
IftekherSunny/Planet-Framework | src/Sun/Filesystem/Filesystem.php | Filesystem.cleanDirectory | public function cleanDirectory($directoryName, $deleteRootDirectory = false)
{
if(is_dir($directoryName)){
$files = glob( $directoryName . '/*', GLOB_NOSORT );
foreach( $files as $file )
{
$this->cleanDirectory( $file, true );
}
... | php | public function cleanDirectory($directoryName, $deleteRootDirectory = false)
{
if(is_dir($directoryName)){
$files = glob( $directoryName . '/*', GLOB_NOSORT );
foreach( $files as $file )
{
$this->cleanDirectory( $file, true );
}
... | [
"public",
"function",
"cleanDirectory",
"(",
"$",
"directoryName",
",",
"$",
"deleteRootDirectory",
"=",
"false",
")",
"{",
"if",
"(",
"is_dir",
"(",
"$",
"directoryName",
")",
")",
"{",
"$",
"files",
"=",
"glob",
"(",
"$",
"directoryName",
".",
"'/*'",
... | To clean a directory
@param string $directoryName
@param bool $deleteRootDirectory
@return bool | [
"To",
"clean",
"a",
"directory"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Filesystem/Filesystem.php#L250-L272 | train |
ARCANEDEV/Markup | src/Entities/Tag.php | Tag.addElement | public function addElement($tag, array $attributes = [])
{
if ($tag instanceof self) {
$htmlTag = $tag;
$htmlTag->top = $this->top;
$htmlTag->attrs($attributes);
$this->elements->add($htmlTag);
return $htmlTag;
}
return self:... | php | public function addElement($tag, array $attributes = [])
{
if ($tag instanceof self) {
$htmlTag = $tag;
$htmlTag->top = $this->top;
$htmlTag->attrs($attributes);
$this->elements->add($htmlTag);
return $htmlTag;
}
return self:... | [
"public",
"function",
"addElement",
"(",
"$",
"tag",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"tag",
"instanceof",
"self",
")",
"{",
"$",
"htmlTag",
"=",
"$",
"tag",
";",
"$",
"htmlTag",
"->",
"top",
"=",
"$",
"th... | Add element at an existing Markup
@param Tag|string $tag
@param array $attributes
@return Tag | [
"Add",
"element",
"at",
"an",
"existing",
"Markup"
] | 881331df74b27614d025c365daacbae6aa865612 | https://github.com/ARCANEDEV/Markup/blob/881331df74b27614d025c365daacbae6aa865612/src/Entities/Tag.php#L187-L203 | train |
ARCANEDEV/Markup | src/Entities/Tag.php | Tag.getFirst | public function getFirst()
{
$element = null;
if (
$this->hasParent() and
$this->parent->hasElements()
) {
$element = $this->parent->elements[0];
}
return $element;
} | php | public function getFirst()
{
$element = null;
if (
$this->hasParent() and
$this->parent->hasElements()
) {
$element = $this->parent->elements[0];
}
return $element;
} | [
"public",
"function",
"getFirst",
"(",
")",
"{",
"$",
"element",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"hasParent",
"(",
")",
"and",
"$",
"this",
"->",
"parent",
"->",
"hasElements",
"(",
")",
")",
"{",
"$",
"element",
"=",
"$",
"this",
... | Return first child of parent of current object
@return Tag|null | [
"Return",
"first",
"child",
"of",
"parent",
"of",
"current",
"object"
] | 881331df74b27614d025c365daacbae6aa865612 | https://github.com/ARCANEDEV/Markup/blob/881331df74b27614d025c365daacbae6aa865612/src/Entities/Tag.php#L220-L232 | train |
phossa2/storage | src/Storage/Traits/MountableTrait.php | MountableTrait.getMountPoint | protected function getMountPoint(/*# string */ $path)/*# : string */
{
while ($path !== '') {
if (isset($this->filesystems[$path])) {
return $path;
}
$path = substr($path, 0, strrpos($path, '/'));
}
return '/';
} | php | protected function getMountPoint(/*# string */ $path)/*# : string */
{
while ($path !== '') {
if (isset($this->filesystems[$path])) {
return $path;
}
$path = substr($path, 0, strrpos($path, '/'));
}
return '/';
} | [
"protected",
"function",
"getMountPoint",
"(",
"/*# string */",
"$",
"path",
")",
"/*# : string */",
"{",
"while",
"(",
"$",
"path",
"!==",
"''",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"filesystems",
"[",
"$",
"path",
"]",
")",
")",
"{",... | Find mount point of the path
@param string $path
@return string
@access protected | [
"Find",
"mount",
"point",
"of",
"the",
"path"
] | 777f174559359deb56e63101c4962750eb15cfde | https://github.com/phossa2/storage/blob/777f174559359deb56e63101c4962750eb15cfde/src/Storage/Traits/MountableTrait.php#L119-L128 | train |
schpill/thin | src/Hash.php | Hash.make | public static function make($value, $rounds = 8)
{
$work = str_pad($rounds, 2, '0', STR_PAD_LEFT);
// Bcrypt expects the salt to be 22 base64 encoded characters including
// dots and slashes. We will get rid of the plus signs included in the
// base64 data and re... | php | public static function make($value, $rounds = 8)
{
$work = str_pad($rounds, 2, '0', STR_PAD_LEFT);
// Bcrypt expects the salt to be 22 base64 encoded characters including
// dots and slashes. We will get rid of the plus signs included in the
// base64 data and re... | [
"public",
"static",
"function",
"make",
"(",
"$",
"value",
",",
"$",
"rounds",
"=",
"8",
")",
"{",
"$",
"work",
"=",
"str_pad",
"(",
"$",
"rounds",
",",
"2",
",",
"'0'",
",",
"STR_PAD_LEFT",
")",
";",
"// Bcrypt expects the salt to be 22 base64 encoded chara... | Hash a password using the Bcrypt hashing scheme.
<code>
// Create a Bcrypt hash of a value
$hash = Hash::make('secret');
// Use a specified number of iterations when creating the hash
$hash = Hash::make('secret', 12);
</code>
@param string $value
@param int $rounds
@return string | [
"Hash",
"a",
"password",
"using",
"the",
"Bcrypt",
"hashing",
"scheme",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Hash.php#L25-L41 | train |
CandleLight-Project/Framework | src/Error.php | Error.registerSystemErrors | public static function registerSystemErrors(Slim $app): void{
/** @var Container $c */
$c = $app->getContainer();
// Exception Handler
$c['errorHandler'] = function ($c){
/**
* Custom exception cather for the slim-framework
* @param Request $request ... | php | public static function registerSystemErrors(Slim $app): void{
/** @var Container $c */
$c = $app->getContainer();
// Exception Handler
$c['errorHandler'] = function ($c){
/**
* Custom exception cather for the slim-framework
* @param Request $request ... | [
"public",
"static",
"function",
"registerSystemErrors",
"(",
"Slim",
"$",
"app",
")",
":",
"void",
"{",
"/** @var Container $c */",
"$",
"c",
"=",
"$",
"app",
"->",
"getContainer",
"(",
")",
";",
"// Exception Handler",
"$",
"c",
"[",
"'errorHandler'",
"]",
... | Injects a custom error handling into the Slim-framework
@param Slim $app Slim Framework instance | [
"Injects",
"a",
"custom",
"error",
"handling",
"into",
"the",
"Slim",
"-",
"framework"
] | 13c5cc34bd1118601406b0129f7b61c7b78d08f4 | https://github.com/CandleLight-Project/Framework/blob/13c5cc34bd1118601406b0129f7b61c7b78d08f4/src/Error.php#L32-L74 | train |
ARCANEDEV/Markup | src/Support/Builder.php | Builder.make | public static function make(TagInterface $tag)
{
if (
$tag->getType() === '' and
$tag->getText() !== ''
) {
return $tag->getText();
}
return self::isAutoClosed($tag->getType())
? self::open($tag, true)
: self::open($tag) . ... | php | public static function make(TagInterface $tag)
{
if (
$tag->getType() === '' and
$tag->getText() !== ''
) {
return $tag->getText();
}
return self::isAutoClosed($tag->getType())
? self::open($tag, true)
: self::open($tag) . ... | [
"public",
"static",
"function",
"make",
"(",
"TagInterface",
"$",
"tag",
")",
"{",
"if",
"(",
"$",
"tag",
"->",
"getType",
"(",
")",
"===",
"''",
"and",
"$",
"tag",
"->",
"getText",
"(",
")",
"!==",
"''",
")",
"{",
"return",
"$",
"tag",
"->",
"ge... | Render a Tag and its elements
@param TagInterface $tag
@return string | [
"Render",
"a",
"Tag",
"and",
"its",
"elements"
] | 881331df74b27614d025c365daacbae6aa865612 | https://github.com/ARCANEDEV/Markup/blob/881331df74b27614d025c365daacbae6aa865612/src/Support/Builder.php#L28-L40 | train |
ARCANEDEV/Markup | src/Support/Builder.php | Builder.open | private static function open(TagInterface $tag, $autoClosed = false)
{
$output = '<' . $tag->getType();
if ($tag->hasAttributes()) {
$output .= ' ' . $tag->renderAttributes();
}
$output .= ($autoClosed ? '/>' : '>');
return $output;
} | php | private static function open(TagInterface $tag, $autoClosed = false)
{
$output = '<' . $tag->getType();
if ($tag->hasAttributes()) {
$output .= ' ' . $tag->renderAttributes();
}
$output .= ($autoClosed ? '/>' : '>');
return $output;
} | [
"private",
"static",
"function",
"open",
"(",
"TagInterface",
"$",
"tag",
",",
"$",
"autoClosed",
"=",
"false",
")",
"{",
"$",
"output",
"=",
"'<'",
".",
"$",
"tag",
"->",
"getType",
"(",
")",
";",
"if",
"(",
"$",
"tag",
"->",
"hasAttributes",
"(",
... | Render open Tag
@param TagInterface $tag
@param bool $autoClosed
@return string | [
"Render",
"open",
"Tag"
] | 881331df74b27614d025c365daacbae6aa865612 | https://github.com/ARCANEDEV/Markup/blob/881331df74b27614d025c365daacbae6aa865612/src/Support/Builder.php#L50-L61 | train |
chilimatic/chilimatic-framework | lib/database/sql/mysql/Statement.php | Statement.bindParam | public function bindParam($placeholder, &$var, $type = null)
{
$this->param_list[$placeholder] = &$var;
if (!empty($type) && in_array($type, $this->_type_list)) {
$this->type_list[$placeholder] = &$type;
}
return true;
} | php | public function bindParam($placeholder, &$var, $type = null)
{
$this->param_list[$placeholder] = &$var;
if (!empty($type) && in_array($type, $this->_type_list)) {
$this->type_list[$placeholder] = &$type;
}
return true;
} | [
"public",
"function",
"bindParam",
"(",
"$",
"placeholder",
",",
"&",
"$",
"var",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"param_list",
"[",
"$",
"placeholder",
"]",
"=",
"&",
"$",
"var",
";",
"if",
"(",
"!",
"empty",
"(",
"$"... | binds a parameter
@param string $placeholder
@param mixed $var
@param null $type
@return bool | [
"binds",
"a",
"parameter"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/database/sql/mysql/Statement.php#L142-L152 | train |
chilimatic/chilimatic-framework | lib/database/sql/mysql/Statement.php | Statement.fetchAll | public function fetchAll($type = null)
{
try {
if ($this->res === false) {
throw new DatabaseException(__METHOD__ . " No ressource has been given", MySQL::NO_RESSOURCE, MySQL::SEVERITY_DEBUG, __FILE__, __LINE__);
}
switch ($type) {
case My... | php | public function fetchAll($type = null)
{
try {
if ($this->res === false) {
throw new DatabaseException(__METHOD__ . " No ressource has been given", MySQL::NO_RESSOURCE, MySQL::SEVERITY_DEBUG, __FILE__, __LINE__);
}
switch ($type) {
case My... | [
"public",
"function",
"fetchAll",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"res",
"===",
"false",
")",
"{",
"throw",
"new",
"DatabaseException",
"(",
"__METHOD__",
".",
"\" No ressource has been given\"",
",",
"MyS... | fetch all option
@param null $type
@return array
@throws DatabaseException
@throws \Exception | [
"fetch",
"all",
"option"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/database/sql/mysql/Statement.php#L225-L249 | train |
andyburton/Sonic-Framework | src/Model/Tools/Comment.php | Comment.hasTag | public function hasTag ($tag)
{
foreach ($this->lines as $line)
{
if (strpos ($line, '@' . $tag) === 0)
{
return TRUE;
}
}
return FALSE;
} | php | public function hasTag ($tag)
{
foreach ($this->lines as $line)
{
if (strpos ($line, '@' . $tag) === 0)
{
return TRUE;
}
}
return FALSE;
} | [
"public",
"function",
"hasTag",
"(",
"$",
"tag",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"lines",
"as",
"$",
"line",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"line",
",",
"'@'",
".",
"$",
"tag",
")",
"===",
"0",
")",
"{",
"return",
"TRUE",... | Check if a tag is set in the comment
@param string $tag Tag to check for e.g. ignore = @ignore
@return boolean | [
"Check",
"if",
"a",
"tag",
"is",
"set",
"in",
"the",
"comment"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model/Tools/Comment.php#L36-L49 | train |
andyburton/Sonic-Framework | src/Model/Tools/Comment.php | Comment.getTags | public function getTags ($tag)
{
$tags = array ();
foreach ($this->lines as $line)
{
if (strpos ($line, '@' . $tag) === 0)
{
$tags[] = trim (substr ($line, strlen ('@' . $tag)));
}
}
return $tags;
} | php | public function getTags ($tag)
{
$tags = array ();
foreach ($this->lines as $line)
{
if (strpos ($line, '@' . $tag) === 0)
{
$tags[] = trim (substr ($line, strlen ('@' . $tag)));
}
}
return $tags;
} | [
"public",
"function",
"getTags",
"(",
"$",
"tag",
")",
"{",
"$",
"tags",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"lines",
"as",
"$",
"line",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"line",
",",
"'@'",
".",
"$",
"tag",
... | Return array of matching tags
@param string $tag Tags to return
@return array | [
"Return",
"array",
"of",
"matching",
"tags"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model/Tools/Comment.php#L57-L72 | train |
andyburton/Sonic-Framework | src/Model/Tools/Comment.php | Comment.getLongDescription | public function getLongDescription ()
{
$comment = '';
foreach ($this->lines as $key => $line)
{
if ($key == 0 || ($line && $line[0] == '@'))
{
continue;
}
if ($comment)
{
$comment .= "\n";
}
$comment .= $line;
}
return $comment;
} | php | public function getLongDescription ()
{
$comment = '';
foreach ($this->lines as $key => $line)
{
if ($key == 0 || ($line && $line[0] == '@'))
{
continue;
}
if ($comment)
{
$comment .= "\n";
}
$comment .= $line;
}
return $comment;
} | [
"public",
"function",
"getLongDescription",
"(",
")",
"{",
"$",
"comment",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"lines",
"as",
"$",
"key",
"=>",
"$",
"line",
")",
"{",
"if",
"(",
"$",
"key",
"==",
"0",
"||",
"(",
"$",
"line",
"&&",
... | Return long description
This is every other line of a comment besides the first line and any tags
@return string | [
"Return",
"long",
"description",
"This",
"is",
"every",
"other",
"line",
"of",
"a",
"comment",
"besides",
"the",
"first",
"line",
"and",
"any",
"tags"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model/Tools/Comment.php#L93-L117 | train |
andyburton/Sonic-Framework | src/Model/Tools/Comment.php | Comment.starComment | public static function starComment ($strComment, $intTabs = 0)
{
// Set return
$strReturn = '';
// Split comment into lines
$arrComment = explode ("\n", $strComment);
// Find the position of the first /
$intFirstSlash = strpos ($arrComment[0], '/');
// Set prefix
$strPrefix = ... | php | public static function starComment ($strComment, $intTabs = 0)
{
// Set return
$strReturn = '';
// Split comment into lines
$arrComment = explode ("\n", $strComment);
// Find the position of the first /
$intFirstSlash = strpos ($arrComment[0], '/');
// Set prefix
$strPrefix = ... | [
"public",
"static",
"function",
"starComment",
"(",
"$",
"strComment",
",",
"$",
"intTabs",
"=",
"0",
")",
"{",
"// Set return",
"$",
"strReturn",
"=",
"''",
";",
"// Split comment into lines",
"$",
"arrComment",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"st... | Return a stared comment
@param string $strComment Comment
@param integer $intTabs Tabs before line
@return string | [
"Return",
"a",
"stared",
"comment"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model/Tools/Comment.php#L127-L231 | train |
andyburton/Sonic-Framework | src/Model/Tools/Comment.php | Comment.lineComment | public static function lineComment ($strComment, $intTabs = 0)
{
// Set return
$strReturn = '';
// Split comment into lines
$arrComment = explode ("\n", $strComment);
// Find the position of the first /
$intFirstSlash = strpos ($arrComment[0], '/');
// Set prefix
$strPrefix = (... | php | public static function lineComment ($strComment, $intTabs = 0)
{
// Set return
$strReturn = '';
// Split comment into lines
$arrComment = explode ("\n", $strComment);
// Find the position of the first /
$intFirstSlash = strpos ($arrComment[0], '/');
// Set prefix
$strPrefix = (... | [
"public",
"static",
"function",
"lineComment",
"(",
"$",
"strComment",
",",
"$",
"intTabs",
"=",
"0",
")",
"{",
"// Set return",
"$",
"strReturn",
"=",
"''",
";",
"// Split comment into lines",
"$",
"arrComment",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"st... | Return a lined comment
@param type $strComment Comment
@param type $intTabs Tabs before line
@return string | [
"Return",
"a",
"lined",
"comment"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Model/Tools/Comment.php#L241-L296 | train |
pascalchevrel/vcs | src/VCS/Git.php | Git.getCommits | public function getCommits()
{
$log = $this->execute(
"git log --no-merges --format='changeset: %H%nuser: %aN <%aE>%ndate: %ad%nsummary: %s%n' "
. $this->repository_path
);
$this->repository_type = 'git';
return $this->parseLog($log);
} | php | public function getCommits()
{
$log = $this->execute(
"git log --no-merges --format='changeset: %H%nuser: %aN <%aE>%ndate: %ad%nsummary: %s%n' "
. $this->repository_path
);
$this->repository_type = 'git';
return $this->parseLog($log);
} | [
"public",
"function",
"getCommits",
"(",
")",
"{",
"$",
"log",
"=",
"$",
"this",
"->",
"execute",
"(",
"\"git log --no-merges --format='changeset: %H%nuser: %aN <%aE>%ndate: %ad%nsummary: %s%n' \"",
".",
"$",
"this",
"->",
"repository_path",
")",
";",
"$",
"this",
"->... | Get the list of Git commits for the repository as a structured array
@return array List of commits | [
"Get",
"the",
"list",
"of",
"Git",
"commits",
"for",
"the",
"repository",
"as",
"a",
"structured",
"array"
] | 23d4827d5f8f44f20cd9a59fdf71ee7dfc895bfa | https://github.com/pascalchevrel/vcs/blob/23d4827d5f8f44f20cd9a59fdf71ee7dfc895bfa/src/VCS/Git.php#L11-L20 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.