id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
197,800 | itkg/core | src/Itkg/Core/Command/DatabaseUpdateCommand.php | DatabaseUpdateCommand.setup | protected function setup(InputInterface $input)
{
return $this->setup
->setForcedRollback($input->getOption('force-rollback'))
->setExecuteQueries($input->getOption('execute'))
->setRollbackedFirst($input->getOption('rollback-first'))
->run();
} | php | protected function setup(InputInterface $input)
{
return $this->setup
->setForcedRollback($input->getOption('force-rollback'))
->setExecuteQueries($input->getOption('execute'))
->setRollbackedFirst($input->getOption('rollback-first'))
->run();
} | [
"protected",
"function",
"setup",
"(",
"InputInterface",
"$",
"input",
")",
"{",
"return",
"$",
"this",
"->",
"setup",
"->",
"setForcedRollback",
"(",
"$",
"input",
"->",
"getOption",
"(",
"'force-rollback'",
")",
")",
"->",
"setExecuteQueries",
"(",
"$",
"i... | Start migration setup
@param \Symfony\Component\Console\Input\InputInterface $input
@return array | [
"Start",
"migration",
"setup"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Command/DatabaseUpdateCommand.php#L141-L148 |
197,801 | stellaqua/Waltz.Stagehand | src/Waltz/Stagehand/ClassUtility/MethodObject/PhpMethodObject.php | PhpMethodObject.getDocComment | public function getDocComment ( $withCommentMark = false ) {
$docComment = $this->_reflectionMethod->getDocComment();
if ( $withCommentMark === true ) {
$docComment = PhpDocCommentObject::ltrim($docComment);
} else {
$docComment = PhpDocCommentObject::stripCommentMarks($d... | php | public function getDocComment ( $withCommentMark = false ) {
$docComment = $this->_reflectionMethod->getDocComment();
if ( $withCommentMark === true ) {
$docComment = PhpDocCommentObject::ltrim($docComment);
} else {
$docComment = PhpDocCommentObject::stripCommentMarks($d... | [
"public",
"function",
"getDocComment",
"(",
"$",
"withCommentMark",
"=",
"false",
")",
"{",
"$",
"docComment",
"=",
"$",
"this",
"->",
"_reflectionMethod",
"->",
"getDocComment",
"(",
")",
";",
"if",
"(",
"$",
"withCommentMark",
"===",
"true",
")",
"{",
"$... | Get DocComment of method
@param bool $withCommentMark
@return string DocComment | [
"Get",
"DocComment",
"of",
"method"
] | 01df286751f5b9a5c90c47138dca3709e5bc383b | https://github.com/stellaqua/Waltz.Stagehand/blob/01df286751f5b9a5c90c47138dca3709e5bc383b/src/Waltz/Stagehand/ClassUtility/MethodObject/PhpMethodObject.php#L72-L80 |
197,802 | koolkode/view-express | src/Tree/ExpressionNode.php | ExpressionNode.compile | public function compile(ExpressCompiler $compiler, $flags = 0)
{
try
{
if($flags & self::FLAG_RAW)
{
$compiler->write($this->expression->compile($compiler->getExpressionContextFactory(), false, '$this->exp'));
}
else
{
$compiler->write("\t\ttry {\n");
if($this->stringify)
{
... | php | public function compile(ExpressCompiler $compiler, $flags = 0)
{
try
{
if($flags & self::FLAG_RAW)
{
$compiler->write($this->expression->compile($compiler->getExpressionContextFactory(), false, '$this->exp'));
}
else
{
$compiler->write("\t\ttry {\n");
if($this->stringify)
{
... | [
"public",
"function",
"compile",
"(",
"ExpressCompiler",
"$",
"compiler",
",",
"$",
"flags",
"=",
"0",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"flags",
"&",
"self",
"::",
"FLAG_RAW",
")",
"{",
"$",
"compiler",
"->",
"write",
"(",
"$",
"this",
"->",
"... | Compiles an expression into PHP code.
@param ExpressCompiler $compiler
@param integer $flags Raw mode is active when an element is morphed from a TagBuilder. | [
"Compiles",
"an",
"expression",
"into",
"PHP",
"code",
"."
] | a8ebe6f373b6bfe8b8818d6264535e8fe063a596 | https://github.com/koolkode/view-express/blob/a8ebe6f373b6bfe8b8818d6264535e8fe063a596/src/Tree/ExpressionNode.php#L76-L122 |
197,803 | Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Inflector/Inflector.php | Inflector.normalize | public function normalize(&$data, $format)
{
if (!is_array($data)) {
return $this->$format($data);
}
foreach ($data as $key => $value) {
// already formatted ?
if ($key != ($normalizedKey = $this->$format($key))) {
if (array_key_exists($no... | php | public function normalize(&$data, $format)
{
if (!is_array($data)) {
return $this->$format($data);
}
foreach ($data as $key => $value) {
// already formatted ?
if ($key != ($normalizedKey = $this->$format($key))) {
if (array_key_exists($no... | [
"public",
"function",
"normalize",
"(",
"&",
"$",
"data",
",",
"$",
"format",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"return",
"$",
"this",
"->",
"$",
"format",
"(",
"$",
"data",
")",
";",
"}",
"foreach",
"(",
"$... | Normalize given data
If an array is given, normalize keys, according to given method
@param string|array &$data
@param string $format
@return string|array
@see for inspiration https://github.com/FriendsOfSymfony/FOSRestBundle/blob/master/Normalizer/CamelKeysNormalizer.php | [
"Normalize",
"given",
"data",
"If",
"an",
"array",
"is",
"given",
"normalize",
"keys",
"according",
"to",
"given",
"method"
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Inflector/Inflector.php#L163-L190 |
197,804 | Kris-Kuiper/sFire-Framework | src/HTTP/Request.php | Request.fromCurrent | public static function fromCurrent($key = null, $default = null) {
switch(static :: getMethod()) {
case 'get' : $data = $_GET; break;
case 'post' : $data = $_POST; break;
default : $data = null;
}
return static :: from(static :: getMethod(), $key, $default, $data);
} | php | public static function fromCurrent($key = null, $default = null) {
switch(static :: getMethod()) {
case 'get' : $data = $_GET; break;
case 'post' : $data = $_POST; break;
default : $data = null;
}
return static :: from(static :: getMethod(), $key, $default, $data);
} | [
"public",
"static",
"function",
"fromCurrent",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"switch",
"(",
"static",
"::",
"getMethod",
"(",
")",
")",
"{",
"case",
"'get'",
":",
"$",
"data",
"=",
"$",
"_GET",
";",
"brea... | Get variable from the current HTTP method
@param mixed $key
@param mixed $default
@return mixed | [
"Get",
"variable",
"from",
"the",
"current",
"HTTP",
"method"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Request.php#L169-L179 |
197,805 | Kris-Kuiper/sFire-Framework | src/HTTP/Request.php | Request.getHeader | public static function getHeader($header) {
$headers = static :: getHeaders();
if(true === isset($headers[$header])) {
return $headers[$header];
}
return null;
} | php | public static function getHeader($header) {
$headers = static :: getHeaders();
if(true === isset($headers[$header])) {
return $headers[$header];
}
return null;
} | [
"public",
"static",
"function",
"getHeader",
"(",
"$",
"header",
")",
"{",
"$",
"headers",
"=",
"static",
"::",
"getHeaders",
"(",
")",
";",
"if",
"(",
"true",
"===",
"isset",
"(",
"$",
"headers",
"[",
"$",
"header",
"]",
")",
")",
"{",
"return",
"... | Get request header by key
@param string $header
@return string | [
"Get",
"request",
"header",
"by",
"key"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Request.php#L367-L376 |
197,806 | Kris-Kuiper/sFire-Framework | src/HTTP/Request.php | Request.all | public static function all() {
if(true === isset(static :: $method['data'])) {
return static :: $method['data'];
}
parse_str(static :: getBody(), $vars);
return [
'get' => $_GET,
'post' => $_POST,
'put' => static :: isMethod('put') ? $vars : [],
'delete' => static :: ... | php | public static function all() {
if(true === isset(static :: $method['data'])) {
return static :: $method['data'];
}
parse_str(static :: getBody(), $vars);
return [
'get' => $_GET,
'post' => $_POST,
'put' => static :: isMethod('put') ? $vars : [],
'delete' => static :: ... | [
"public",
"static",
"function",
"all",
"(",
")",
"{",
"if",
"(",
"true",
"===",
"isset",
"(",
"static",
"::",
"$",
"method",
"[",
"'data'",
"]",
")",
")",
"{",
"return",
"static",
"::",
"$",
"method",
"[",
"'data'",
"]",
";",
"}",
"parse_str",
"(",... | Return all the data from get, post, put, delete, patch, connect, head, options and trace
@return array | [
"Return",
"all",
"the",
"data",
"from",
"get",
"post",
"put",
"delete",
"patch",
"connect",
"head",
"options",
"and",
"trace"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Request.php#L396-L416 |
197,807 | Kris-Kuiper/sFire-Framework | src/HTTP/Request.php | Request.getIp | public static function getIp() {
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
if(isset($_SERVER['HTTP-X-FORWARDED-FOR'])) {
return $_SERVER['HTTP-X-FORWARDED-FOR'];
}
if(isset($_SERVER['HTTP_VIA'])) {
return $_SERVER['HTTP_VIA'];
}
... | php | public static function getIp() {
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
if(isset($_SERVER['HTTP-X-FORWARDED-FOR'])) {
return $_SERVER['HTTP-X-FORWARDED-FOR'];
}
if(isset($_SERVER['HTTP_VIA'])) {
return $_SERVER['HTTP_VIA'];
}
... | [
"public",
"static",
"function",
"getIp",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'HTTP_X_FORWARDED_FOR'",
"]",
")",
")",
"{",
"return",
"$",
"_SERVER",
"[",
"'HTTP_X_FORWARDED_FOR'",
"]",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"_... | Returns the request IP address
@return string | [
"Returns",
"the",
"request",
"IP",
"address"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Request.php#L579-L596 |
197,808 | Kris-Kuiper/sFire-Framework | src/HTTP/Request.php | Request.parseUrl | public static function parseUrl($key = null) {
if(null !== $key && false === is_string($key)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($key)), E_USER_ERROR);
}
$url = [];
$types = [
'host' => 'HTTP_HOST',
... | php | public static function parseUrl($key = null) {
if(null !== $key && false === is_string($key)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($key)), E_USER_ERROR);
}
$url = [];
$types = [
'host' => 'HTTP_HOST',
... | [
"public",
"static",
"function",
"parseUrl",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"key",
"&&",
"false",
"===",
"is_string",
"(",
"$",
"key",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 pa... | Returns parsed url by giving an option key for only the value of that key to return
@param string $key
@return array|string|null | [
"Returns",
"parsed",
"url",
"by",
"giving",
"an",
"option",
"key",
"for",
"only",
"the",
"value",
"of",
"that",
"key",
"to",
"return"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Request.php#L604-L640 |
197,809 | Kris-Kuiper/sFire-Framework | src/HTTP/Request.php | Request.get | private static function get($key = null, $default = null) {
if(null !== $key && isset(static :: $method['method'], static :: $method['data'])) {
if(static :: isMethod(static :: $method['method'])) {
$helper = new StringToArray();
$data = $helper -> execute($key, $default, static :: $method['da... | php | private static function get($key = null, $default = null) {
if(null !== $key && isset(static :: $method['method'], static :: $method['data'])) {
if(static :: isMethod(static :: $method['method'])) {
$helper = new StringToArray();
$data = $helper -> execute($key, $default, static :: $method['da... | [
"private",
"static",
"function",
"get",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"key",
"&&",
"isset",
"(",
"static",
"::",
"$",
"method",
"[",
"'method'",
"]",
",",
"static",
"::",
... | Returns variable from source while converting an array from string
@param mixed $key
@param mixed $default
@return mixed | [
"Returns",
"variable",
"from",
"source",
"while",
"converting",
"an",
"array",
"from",
"string"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Request.php#L649-L689 |
197,810 | Kris-Kuiper/sFire-Framework | src/HTTP/Request.php | Request.from | private static function from($type, $key, $default, &$source = null) {
if(null === $source) {
if(static :: isMethod($type)) {
$source = [];
static :: parseRawHttpRequest($source);
}
}
static :: $method = ['method' => $type, 'data' => &$source];
if(null !==... | php | private static function from($type, $key, $default, &$source = null) {
if(null === $source) {
if(static :: isMethod($type)) {
$source = [];
static :: parseRawHttpRequest($source);
}
}
static :: $method = ['method' => $type, 'data' => &$source];
if(null !==... | [
"private",
"static",
"function",
"from",
"(",
"$",
"type",
",",
"$",
"key",
",",
"$",
"default",
",",
"&",
"$",
"source",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"source",
")",
"{",
"if",
"(",
"static",
"::",
"isMethod",
"(",
"$",
... | Get variable from variable source
@param string $type
@param mixed $key
@param mixed $default
@param array $source
@return mixed | [
"Get",
"variable",
"from",
"variable",
"source"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Request.php#L700-L718 |
197,811 | Kris-Kuiper/sFire-Framework | src/HTTP/Request.php | Request.parseRawHttpRequest | private static function parseRawHttpRequest(array &$data) {
if(false === isset($_SERVER['CONTENT_TYPE'])) {
$_SERVER['CONTENT_TYPE'] = '';
}
$input = static :: getBody();
preg_match('/boundary=(.*)$/', $_SERVER['CONTENT_TYPE'], $matches);
if(0 === count($matches)) {
$json = @js... | php | private static function parseRawHttpRequest(array &$data) {
if(false === isset($_SERVER['CONTENT_TYPE'])) {
$_SERVER['CONTENT_TYPE'] = '';
}
$input = static :: getBody();
preg_match('/boundary=(.*)$/', $_SERVER['CONTENT_TYPE'], $matches);
if(0 === count($matches)) {
$json = @js... | [
"private",
"static",
"function",
"parseRawHttpRequest",
"(",
"array",
"&",
"$",
"data",
")",
"{",
"if",
"(",
"false",
"===",
"isset",
"(",
"$",
"_SERVER",
"[",
"'CONTENT_TYPE'",
"]",
")",
")",
"{",
"$",
"_SERVER",
"[",
"'CONTENT_TYPE'",
"]",
"=",
"''",
... | Parses raw HTTP request string
@param array $data | [
"Parses",
"raw",
"HTTP",
"request",
"string"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Request.php#L725-L771 |
197,812 | melisplatform/melis-calendar | src/Controller/CalendarController.php | CalendarController.renderCalendarLeftmenuAction | public function renderCalendarLeftmenuAction()
{
$melisKey = $this->params()->fromRoute('melisKey', '');
$view = new ViewModel();
$view->melisKey = $melisKey;
return $view;
} | php | public function renderCalendarLeftmenuAction()
{
$melisKey = $this->params()->fromRoute('melisKey', '');
$view = new ViewModel();
$view->melisKey = $melisKey;
return $view;
} | [
"public",
"function",
"renderCalendarLeftmenuAction",
"(",
")",
"{",
"$",
"melisKey",
"=",
"$",
"this",
"->",
"params",
"(",
")",
"->",
"fromRoute",
"(",
"'melisKey'",
",",
"''",
")",
";",
"$",
"view",
"=",
"new",
"ViewModel",
"(",
")",
";",
"$",
"view... | Render the leftmenu | [
"Render",
"the",
"leftmenu"
] | 1e6df34adc14f03dfdcc6e4ac05d4fa08cb7d223 | https://github.com/melisplatform/melis-calendar/blob/1e6df34adc14f03dfdcc6e4ac05d4fa08cb7d223/src/Controller/CalendarController.php#L21-L27 |
197,813 | eureka-framework/component-http | src/Http/Session.php | Session.set | public function set($name, $value)
{
parent::set($name, $value);
$_SESSION[$name] = $value;
return $this;
} | php | public function set($name, $value)
{
parent::set($name, $value);
$_SESSION[$name] = $value;
return $this;
} | [
"public",
"function",
"set",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"parent",
"::",
"set",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"$",
"_SESSION",
"[",
"$",
"name",
"]",
"=",
"$",
"value",
";",
"return",
"$",
"this",
";",
"}"
] | Set value in session.
@param string $name
@param mixed $value
@return self | [
"Set",
"value",
"in",
"session",
"."
] | 698c3b73581a9703a9c932890c57e50f8774607a | https://github.com/eureka-framework/component-http/blob/698c3b73581a9703a9c932890c57e50f8774607a/src/Http/Session.php#L86-L93 |
197,814 | pixelpolishers/resolver-php-server | src/PixelPolishers/Resolver/Server/Router/Router.php | Router.find | public function find($url)
{
if (!array_key_exists($url, $this->controllerMap)) {
return null;
}
return $this->controllerMap[$url];
} | php | public function find($url)
{
if (!array_key_exists($url, $this->controllerMap)) {
return null;
}
return $this->controllerMap[$url];
} | [
"public",
"function",
"find",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"url",
",",
"$",
"this",
"->",
"controllerMap",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"controllerMap",
"[",
"$",
... | Finds the controller for the given url.
@param string $url The url to parse.
@return ControllerInterface | [
"Finds",
"the",
"controller",
"for",
"the",
"given",
"url",
"."
] | c07505a768b32b30c7c300b3fb7e41d1776cb6e9 | https://github.com/pixelpolishers/resolver-php-server/blob/c07505a768b32b30c7c300b3fb7e41d1776cb6e9/src/PixelPolishers/Resolver/Server/Router/Router.php#L60-L67 |
197,815 | translationexchange/tml-php-clientsdk | library/Tr8n/Tokens/PipedToken.php | PipedToken.parse | public function parse() {
$name_without_parens = preg_replace('/[{}]/', '', $this->full_name);
$parts = explode('|', $name_without_parens);
$name_without_pipes = trim($parts[0]);
$parts = explode('::', $name_without_pipes);
$name_without_case_keys = trim($parts[0]);
arr... | php | public function parse() {
$name_without_parens = preg_replace('/[{}]/', '', $this->full_name);
$parts = explode('|', $name_without_parens);
$name_without_pipes = trim($parts[0]);
$parts = explode('::', $name_without_pipes);
$name_without_case_keys = trim($parts[0]);
arr... | [
"public",
"function",
"parse",
"(",
")",
"{",
"$",
"name_without_parens",
"=",
"preg_replace",
"(",
"'/[{}]/'",
",",
"''",
",",
"$",
"this",
"->",
"full_name",
")",
";",
"$",
"parts",
"=",
"explode",
"(",
"'|'",
",",
"$",
"name_without_parens",
")",
";",... | Parses token elements | [
"Parses",
"token",
"elements"
] | fe51473824e62cfd883c6aa0c6a3783a16ce8425 | https://github.com/translationexchange/tml-php-clientsdk/blob/fe51473824e62cfd883c6aa0c6a3783a16ce8425/library/Tr8n/Tokens/PipedToken.php#L83-L109 |
197,816 | mossphp/moss-storage | Moss/Storage/Query/AbstractRelational.php | AbstractRelational.with | public function with($relation)
{
foreach ((array) $relation as $node) {
$instance = $this->factory->build($this->model(), $node);
$this->relations[$instance->name()] = $instance;
}
return $this;
} | php | public function with($relation)
{
foreach ((array) $relation as $node) {
$instance = $this->factory->build($this->model(), $node);
$this->relations[$instance->name()] = $instance;
}
return $this;
} | [
"public",
"function",
"with",
"(",
"$",
"relation",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"relation",
"as",
"$",
"node",
")",
"{",
"$",
"instance",
"=",
"$",
"this",
"->",
"factory",
"->",
"build",
"(",
"$",
"this",
"->",
"model",
"(",
... | Adds relation to query
@param string|array $relation
@return $this
@throws QueryException | [
"Adds",
"relation",
"to",
"query"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/AbstractRelational.php#L51-L59 |
197,817 | mossphp/moss-storage | Moss/Storage/Query/AbstractRelational.php | AbstractRelational.relation | public function relation($relation)
{
list($name, $furtherRelations) = $this->factory->splitRelationName($relation);
if (!isset($this->relations[$name])) {
throw new QueryException(sprintf('Unable to retrieve relation "%s" query, relation does not exists in query "%s"', $name, $this->mo... | php | public function relation($relation)
{
list($name, $furtherRelations) = $this->factory->splitRelationName($relation);
if (!isset($this->relations[$name])) {
throw new QueryException(sprintf('Unable to retrieve relation "%s" query, relation does not exists in query "%s"', $name, $this->mo... | [
"public",
"function",
"relation",
"(",
"$",
"relation",
")",
"{",
"list",
"(",
"$",
"name",
",",
"$",
"furtherRelations",
")",
"=",
"$",
"this",
"->",
"factory",
"->",
"splitRelationName",
"(",
"$",
"relation",
")",
";",
"if",
"(",
"!",
"isset",
"(",
... | Returns relation instance
@param string $relation
@return RelationInterface
@throws QueryException | [
"Returns",
"relation",
"instance"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/AbstractRelational.php#L69-L82 |
197,818 | Stinger-Soft/PlatformBundle | Entity/User.php | User.getRealName | public function getRealName() {
if($this->firstname || $this->surname) {
return trim($this->getFirstname() . ' ' . $this->getSurname());
}
return null;
} | php | public function getRealName() {
if($this->firstname || $this->surname) {
return trim($this->getFirstname() . ' ' . $this->getSurname());
}
return null;
} | [
"public",
"function",
"getRealName",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"firstname",
"||",
"$",
"this",
"->",
"surname",
")",
"{",
"return",
"trim",
"(",
"$",
"this",
"->",
"getFirstname",
"(",
")",
".",
"' '",
".",
"$",
"this",
"->",
"ge... | Get realname "Firstname Surname"
@return string | [
"Get",
"realname",
"Firstname",
"Surname"
] | 922b9405e5ddc474f288b6be84af2de9a335ac28 | https://github.com/Stinger-Soft/PlatformBundle/blob/922b9405e5ddc474f288b6be84af2de9a335ac28/Entity/User.php#L91-L96 |
197,819 | wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/interfaces/TemplateCache.php | TemplateCache.putTemplate | public function putTemplate($cacheKey, Template $template)
{
if ($template->getCacheTime() == null && !is_numeric($template->getCacheTime()))
$template->setCacheTime($this->defaultCacheTime);
$this->put($cacheKey, $template, (int)$template->getCacheTime());
return true;
} | php | public function putTemplate($cacheKey, Template $template)
{
if ($template->getCacheTime() == null && !is_numeric($template->getCacheTime()))
$template->setCacheTime($this->defaultCacheTime);
$this->put($cacheKey, $template, (int)$template->getCacheTime());
return true;
} | [
"public",
"function",
"putTemplate",
"(",
"$",
"cacheKey",
",",
"Template",
"$",
"template",
")",
"{",
"if",
"(",
"$",
"template",
"->",
"getCacheTime",
"(",
")",
"==",
"null",
"&&",
"!",
"is_numeric",
"(",
"$",
"template",
"->",
"getCacheTime",
"(",
")"... | Stores the specified template to cache using the cacheKey specified.
@param string $cacheKey The cacheKey for the Template
@param Template $template The template to store in the cache
@return true | [
"Stores",
"the",
"specified",
"template",
"to",
"cache",
"using",
"the",
"cacheKey",
"specified",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/interfaces/TemplateCache.php#L169-L177 |
197,820 | wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/interfaces/TemplateCache.php | TemplateCache.getTemplateCacheKey | public function getTemplateCacheKey(Template $template, $globals)
{
$locals = $template->getLocals();
$cachekey = '';
if($template->isTopTemplate())
$cachekey .= $this->Request->getAdjustedRequestURI();
else
$cachekey .= $template->getContentType().$template... | php | public function getTemplateCacheKey(Template $template, $globals)
{
$locals = $template->getLocals();
$cachekey = '';
if($template->isTopTemplate())
$cachekey .= $this->Request->getAdjustedRequestURI();
else
$cachekey .= $template->getContentType().$template... | [
"public",
"function",
"getTemplateCacheKey",
"(",
"Template",
"$",
"template",
",",
"$",
"globals",
")",
"{",
"$",
"locals",
"=",
"$",
"template",
"->",
"getLocals",
"(",
")",
";",
"$",
"cachekey",
"=",
"''",
";",
"if",
"(",
"$",
"template",
"->",
"isT... | Returns a cacheKey for the specified Template
@param Template $template The template to generate the cacheKey for
@param array $globals An array of globals set on this template
@return string The cache key | [
"Returns",
"a",
"cacheKey",
"for",
"the",
"specified",
"Template"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/interfaces/TemplateCache.php#L187-L229 |
197,821 | siriusSupreme/sirius-support | src/Traits/InteractsWithConfig.php | InteractsWithConfig.ensureRepository | protected function ensureRepository( $repository ) {
if ( $repository === null ) {
return new Repository();
}
if ( $repository instanceof RepostoryContract ) {
return $repository;
}
if ( is_array( $repository ) ) {
return new Repository( $repository );
}
throw new \Logic... | php | protected function ensureRepository( $repository ) {
if ( $repository === null ) {
return new Repository();
}
if ( $repository instanceof RepostoryContract ) {
return $repository;
}
if ( is_array( $repository ) ) {
return new Repository( $repository );
}
throw new \Logic... | [
"protected",
"function",
"ensureRepository",
"(",
"$",
"repository",
")",
"{",
"if",
"(",
"$",
"repository",
"===",
"null",
")",
"{",
"return",
"new",
"Repository",
"(",
")",
";",
"}",
"if",
"(",
"$",
"repository",
"instanceof",
"RepostoryContract",
")",
"... | Ensure a Repository instance.
@param null|array|Repository $repository
@return Repository repository instance
@throw LogicException | [
"Ensure",
"a",
"Repository",
"instance",
"."
] | 80436cf8ae7b95d96bb34cd7297be00c77fc1033 | https://github.com/siriusSupreme/sirius-support/blob/80436cf8ae7b95d96bb34cd7297be00c77fc1033/src/Traits/InteractsWithConfig.php#L60-L74 |
197,822 | Wedeto/DB | src/Query/ConstantValue.php | ConstantValue.toSQL | public function toSQL(Parameters $params, bool $inner_clause)
{
if ($key = $this->getKey())
{
try
{
$params->get($key);
}
catch (\OutOfRangeException $e)
{
$key = null;
}
}
if ($k... | php | public function toSQL(Parameters $params, bool $inner_clause)
{
if ($key = $this->getKey())
{
try
{
$params->get($key);
}
catch (\OutOfRangeException $e)
{
$key = null;
}
}
if ($k... | [
"public",
"function",
"toSQL",
"(",
"Parameters",
"$",
"params",
",",
"bool",
"$",
"inner_clause",
")",
"{",
"if",
"(",
"$",
"key",
"=",
"$",
"this",
"->",
"getKey",
"(",
")",
")",
"{",
"try",
"{",
"$",
"params",
"->",
"get",
"(",
"$",
"key",
")"... | Write a constant as SQL query syntax
@param Parameters $params The query parameters: tables and placeholder values
@return string The generated SQL | [
"Write",
"a",
"constant",
"as",
"SQL",
"query",
"syntax"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/ConstantValue.php#L111-L135 |
197,823 | squareproton/Bond | src/Bond/Pg/Catalog/PgAttribute.php | PgAttribute.getChildren | public function getChildren()
{
$output = new BaseContainer();
foreach( $this->getRelation()->getChildren() as $childRelation ) {
$childAttribute = $childRelation->getAttributeByName($this->name);
$output->add(
$childAttribute,
$childAttribut... | php | public function getChildren()
{
$output = new BaseContainer();
foreach( $this->getRelation()->getChildren() as $childRelation ) {
$childAttribute = $childRelation->getAttributeByName($this->name);
$output->add(
$childAttribute,
$childAttribut... | [
"public",
"function",
"getChildren",
"(",
")",
"{",
"$",
"output",
"=",
"new",
"BaseContainer",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getRelation",
"(",
")",
"->",
"getChildren",
"(",
")",
"as",
"$",
"childRelation",
")",
"{",
"$",
"childA... | Get all inherited Attributes
@return Container | [
"Get",
"all",
"inherited",
"Attributes"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Catalog/PgAttribute.php#L111-L126 |
197,824 | squareproton/Bond | src/Bond/Pg/Catalog/PgAttribute.php | PgAttribute.isInherited | public function isInherited( &$originalColumn = null )
{
$inhcount = $this->attinhcount;
if( $inhcount == 0 ) {
$originalColumn = null;
return false;
}
// short cut to prevent the work of finding the original column
if( func_num_args() === 0 ) {
... | php | public function isInherited( &$originalColumn = null )
{
$inhcount = $this->attinhcount;
if( $inhcount == 0 ) {
$originalColumn = null;
return false;
}
// short cut to prevent the work of finding the original column
if( func_num_args() === 0 ) {
... | [
"public",
"function",
"isInherited",
"(",
"&",
"$",
"originalColumn",
"=",
"null",
")",
"{",
"$",
"inhcount",
"=",
"$",
"this",
"->",
"attinhcount",
";",
"if",
"(",
"$",
"inhcount",
"==",
"0",
")",
"{",
"$",
"originalColumn",
"=",
"null",
";",
"return"... | Is this column inheritied from another relation
@param Column The original inherited column.
@return bool | [
"Is",
"this",
"column",
"inheritied",
"from",
"another",
"relation"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Catalog/PgAttribute.php#L150-L174 |
197,825 | squareproton/Bond | src/Bond/Pg/Catalog/PgAttribute.php | PgAttribute.addReference | public function addReference( PgAttribute $primaryKey, $includeChildTables = true )
{
$this->references->add( $primaryKey );
$primaryKey->isReferencedBy->add( $this );
if( $includeChildTables || true ) {
foreach( $primaryKey->getRelation()->getChildren() as $child ) {
... | php | public function addReference( PgAttribute $primaryKey, $includeChildTables = true )
{
$this->references->add( $primaryKey );
$primaryKey->isReferencedBy->add( $this );
if( $includeChildTables || true ) {
foreach( $primaryKey->getRelation()->getChildren() as $child ) {
... | [
"public",
"function",
"addReference",
"(",
"PgAttribute",
"$",
"primaryKey",
",",
"$",
"includeChildTables",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"references",
"->",
"add",
"(",
"$",
"primaryKey",
")",
";",
"$",
"primaryKey",
"->",
"isReferencedBy",
"->... | Add a reference to this attribute
@param Attribute $primaryKey The attribute we're referencing | [
"Add",
"a",
"reference",
"to",
"this",
"attribute"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Catalog/PgAttribute.php#L180-L203 |
197,826 | squareproton/Bond | src/Bond/Pg/Catalog/PgAttribute.php | PgAttribute.getSequence | public function getSequence()
{
if( preg_match( "/^nextval\\('([^']+)'::regclass\\)$/", $this->default, $matches ) ) {
return $this->catalog->pgClasses->findOneByName($matches[1]);
}
return null;
} | php | public function getSequence()
{
if( preg_match( "/^nextval\\('([^']+)'::regclass\\)$/", $this->default, $matches ) ) {
return $this->catalog->pgClasses->findOneByName($matches[1]);
}
return null;
} | [
"public",
"function",
"getSequence",
"(",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"/^nextval\\\\('([^']+)'::regclass\\\\)$/\"",
",",
"$",
"this",
"->",
"default",
",",
"$",
"matches",
")",
")",
"{",
"return",
"$",
"this",
"->",
"catalog",
"->",
"pgClasses",
... | Is this column a sequence
@return Sequence|null | [
"Is",
"this",
"column",
"a",
"sequence"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Catalog/PgAttribute.php#L209-L215 |
197,827 | squareproton/Bond | src/Bond/Pg/Catalog/PgAttribute.php | PgAttribute.getEntity | public function getEntity()
{
// primary key only
$references = $this->getReferences();
// debug // print_r( $references->map(function($e){ return $e->get('fullyQualifiedName');}) );
foreach( $references as $reference ) {
// only manage references where the reference c... | php | public function getEntity()
{
// primary key only
$references = $this->getReferences();
// debug // print_r( $references->map(function($e){ return $e->get('fullyQualifiedName');}) );
foreach( $references as $reference ) {
// only manage references where the reference c... | [
"public",
"function",
"getEntity",
"(",
")",
"{",
"// primary key only",
"$",
"references",
"=",
"$",
"this",
"->",
"getReferences",
"(",
")",
";",
"// debug // print_r( $references->map(function($e){ return $e->get('fullyQualifiedName');}) );",
"foreach",
"(",
"$",
"refere... | Return a reference to the entity
@return string | [
"Return",
"a",
"reference",
"to",
"the",
"entity"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Catalog/PgAttribute.php#L221-L290 |
197,828 | squareproton/Bond | src/Bond/Pg/Catalog/PgAttribute.php | PgAttribute.isZombie | public function isZombie()
{
$ref = $this->getReferences();
if( $this->isPrimaryKey() and !$ref->isEmpty() ) {
return true;
}
if( $this->notNull and !$ref->isEmpty() ) {
return true;
}
// comment
// if( \Bond\extract_tags( $this->get... | php | public function isZombie()
{
$ref = $this->getReferences();
if( $this->isPrimaryKey() and !$ref->isEmpty() ) {
return true;
}
if( $this->notNull and !$ref->isEmpty() ) {
return true;
}
// comment
// if( \Bond\extract_tags( $this->get... | [
"public",
"function",
"isZombie",
"(",
")",
"{",
"$",
"ref",
"=",
"$",
"this",
"->",
"getReferences",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isPrimaryKey",
"(",
")",
"and",
"!",
"$",
"ref",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
"t... | Is this column a zombie-column candidate?
Happens when at least one of the following is true,
1. A column is a primary key fragment and references something else. [Pete. This is essentially the same as 2. because primary key fragments have to be not null]
2. A column references something and is not null
TODO 3. A colu... | [
"Is",
"this",
"column",
"a",
"zombie",
"-",
"column",
"candidate?",
"Happens",
"when",
"at",
"least",
"one",
"of",
"the",
"following",
"is",
"true"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Catalog/PgAttribute.php#L302-L317 |
197,829 | andela-doladosu/liteorm | src/Helpers/BaseModelHelper.php | BaseModelHelper.getTableFields | protected function getTableFields()
{
$connection = Connection::connect();
$driver = getenv('P_DRIVER');
if ($driver == 'pgsql') {
$describe = '\d ';
}
$describe = 'describe ';
$q = $connection->prepare($describe.$this->getTableName($this->cl... | php | protected function getTableFields()
{
$connection = Connection::connect();
$driver = getenv('P_DRIVER');
if ($driver == 'pgsql') {
$describe = '\d ';
}
$describe = 'describe ';
$q = $connection->prepare($describe.$this->getTableName($this->cl... | [
"protected",
"function",
"getTableFields",
"(",
")",
"{",
"$",
"connection",
"=",
"Connection",
"::",
"connect",
"(",
")",
";",
"$",
"driver",
"=",
"getenv",
"(",
"'P_DRIVER'",
")",
";",
"if",
"(",
"$",
"driver",
"==",
"'pgsql'",
")",
"{",
"$",
"descri... | Get all the column names in a table
@return array | [
"Get",
"all",
"the",
"column",
"names",
"in",
"a",
"table"
] | e97f69e20be4ce0c078a0c25a9a777307d85e9e4 | https://github.com/andela-doladosu/liteorm/blob/e97f69e20be4ce0c078a0c25a9a777307d85e9e4/src/Helpers/BaseModelHelper.php#L18-L33 |
197,830 | andela-doladosu/liteorm | src/Helpers/BaseModelHelper.php | BaseModelHelper.getAssignedValues | protected function getAssignedValues()
{
$tableFields = $this->getTableFields();
$newPropertiesArray = get_object_vars($this);
$columns = $values = $tableData = [];
foreach ($newPropertiesArray as $index => $value) {
if (in_array($index, $tableFields)) {
... | php | protected function getAssignedValues()
{
$tableFields = $this->getTableFields();
$newPropertiesArray = get_object_vars($this);
$columns = $values = $tableData = [];
foreach ($newPropertiesArray as $index => $value) {
if (in_array($index, $tableFields)) {
... | [
"protected",
"function",
"getAssignedValues",
"(",
")",
"{",
"$",
"tableFields",
"=",
"$",
"this",
"->",
"getTableFields",
"(",
")",
";",
"$",
"newPropertiesArray",
"=",
"get_object_vars",
"(",
"$",
"this",
")",
";",
"$",
"columns",
"=",
"$",
"values",
"="... | Get user assigned column values
@return array | [
"Get",
"user",
"assigned",
"column",
"values"
] | e97f69e20be4ce0c078a0c25a9a777307d85e9e4 | https://github.com/andela-doladosu/liteorm/blob/e97f69e20be4ce0c078a0c25a9a777307d85e9e4/src/Helpers/BaseModelHelper.php#L65-L83 |
197,831 | g4code/utility | src/Tools.php | Tools.getSpinnerCombinations | public static function getSpinnerCombinations($text)
{
$matches = self::getSpinnerMatches($text);
foreach ($matches as $row) {
if(!preg_match('/[{}]/', $row)) {
$all[] = explode('|', $row);
}
}
$combinations = call_user_func_array(__CLASS__ .... | php | public static function getSpinnerCombinations($text)
{
$matches = self::getSpinnerMatches($text);
foreach ($matches as $row) {
if(!preg_match('/[{}]/', $row)) {
$all[] = explode('|', $row);
}
}
$combinations = call_user_func_array(__CLASS__ .... | [
"public",
"static",
"function",
"getSpinnerCombinations",
"(",
"$",
"text",
")",
"{",
"$",
"matches",
"=",
"self",
"::",
"getSpinnerMatches",
"(",
"$",
"text",
")",
";",
"foreach",
"(",
"$",
"matches",
"as",
"$",
"row",
")",
"{",
"if",
"(",
"!",
"preg_... | Get all combinations for spinner sentence
@param string $text
@return array | [
"Get",
"all",
"combinations",
"for",
"spinner",
"sentence"
] | e0c9138aab61a53d88f32bb66201b075f3f44f1d | https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Tools.php#L57-L73 |
197,832 | g4code/utility | src/Tools.php | Tools.arrayCartesian | public static function arrayCartesian() {
$args = func_get_args();
if(count($args) == 0) {
return [[]]; // array with empty array is expected "empty" result
}
$work = array_shift($args);
$cartesian = call_user_func_array(__METHOD__, $args);
$result =... | php | public static function arrayCartesian() {
$args = func_get_args();
if(count($args) == 0) {
return [[]]; // array with empty array is expected "empty" result
}
$work = array_shift($args);
$cartesian = call_user_func_array(__METHOD__, $args);
$result =... | [
"public",
"static",
"function",
"arrayCartesian",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"args",
")",
"==",
"0",
")",
"{",
"return",
"[",
"[",
"]",
"]",
";",
"// array with empty array is expected \... | Calculate cartesian product of multiple arrays
@return multitype:multitype: | [
"Calculate",
"cartesian",
"product",
"of",
"multiple",
"arrays"
] | e0c9138aab61a53d88f32bb66201b075f3f44f1d | https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Tools.php#L79-L97 |
197,833 | g4code/utility | src/Tools.php | Tools.arrayChangeKeys | public static function arrayChangeKeys($data, $keyName = 'id')
{
$temp = [];
if (is_array($data)) {
foreach ($data as $key => $row) {
if (isset($row[$keyName])) {
$temp[$row[$keyName]] = $row;
} else {
$temp[] = $row... | php | public static function arrayChangeKeys($data, $keyName = 'id')
{
$temp = [];
if (is_array($data)) {
foreach ($data as $key => $row) {
if (isset($row[$keyName])) {
$temp[$row[$keyName]] = $row;
} else {
$temp[] = $row... | [
"public",
"static",
"function",
"arrayChangeKeys",
"(",
"$",
"data",
",",
"$",
"keyName",
"=",
"'id'",
")",
"{",
"$",
"temp",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key... | Rearange array keys to use selected field from row element
@param array $data
@param string $keyName
@return array | [
"Rearange",
"array",
"keys",
"to",
"use",
"selected",
"field",
"from",
"row",
"element"
] | e0c9138aab61a53d88f32bb66201b075f3f44f1d | https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Tools.php#L106-L119 |
197,834 | g4code/utility | src/Tools.php | Tools.elapsedTime | public static function elapsedTime($timestamp)
{
// @todo: deprecated - use timeDiff instead of this
$dateDiff = self::timeDiff($timestamp);
unset ($dateDiff['month']);
$dateDiff['week'] = floor($dateDiff['days_total'] / 7);
$dateDiff['day'] = $dateDiff['days_total'] % 7;... | php | public static function elapsedTime($timestamp)
{
// @todo: deprecated - use timeDiff instead of this
$dateDiff = self::timeDiff($timestamp);
unset ($dateDiff['month']);
$dateDiff['week'] = floor($dateDiff['days_total'] / 7);
$dateDiff['day'] = $dateDiff['days_total'] % 7;... | [
"public",
"static",
"function",
"elapsedTime",
"(",
"$",
"timestamp",
")",
"{",
"// @todo: deprecated - use timeDiff instead of this",
"$",
"dateDiff",
"=",
"self",
"::",
"timeDiff",
"(",
"$",
"timestamp",
")",
";",
"unset",
"(",
"$",
"dateDiff",
"[",
"'month'",
... | Calculate time period and return it in separated time segments
@param int $timestamp timestamp for data in past you want to calculate elapsed period
@return array | [
"Calculate",
"time",
"period",
"and",
"return",
"it",
"in",
"separated",
"time",
"segments"
] | e0c9138aab61a53d88f32bb66201b075f3f44f1d | https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Tools.php#L167-L179 |
197,835 | g4code/utility | src/Tools.php | Tools.getRealIP | public function getRealIP($allowPrivateRange = false, array $prependHeaders = null)
{
$headers = [
'HTTP_CF_CONNECTING_IP', // CloudFlare sent IP
'CLIENT_IP',
'FORWARDED',
'FORWARDED_FOR',
'FORWARDED_FOR_IP',
'HTTP_CLIENT_IP',
... | php | public function getRealIP($allowPrivateRange = false, array $prependHeaders = null)
{
$headers = [
'HTTP_CF_CONNECTING_IP', // CloudFlare sent IP
'CLIENT_IP',
'FORWARDED',
'FORWARDED_FOR',
'FORWARDED_FOR_IP',
'HTTP_CLIENT_IP',
... | [
"public",
"function",
"getRealIP",
"(",
"$",
"allowPrivateRange",
"=",
"false",
",",
"array",
"$",
"prependHeaders",
"=",
"null",
")",
"{",
"$",
"headers",
"=",
"[",
"'HTTP_CF_CONNECTING_IP'",
",",
"// CloudFlare sent IP",
"'CLIENT_IP'",
",",
"'FORWARDED'",
",",
... | Return real users IP address even if behind proxy
@param bool $allowPrivateRange
@param array $prependHeaders if list of additional headers is set, prepend them to list and test first
(used for example on CloudFlare)
@return mixed - string containing IP address or (bool) false if not found | [
"Return",
"real",
"users",
"IP",
"address",
"even",
"if",
"behind",
"proxy"
] | e0c9138aab61a53d88f32bb66201b075f3f44f1d | https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Tools.php#L190-L246 |
197,836 | g4code/utility | src/Tools.php | Tools.timeDiff | public static function timeDiff($timestamp)
{
$dateRef = new \DateTime('@' . $timestamp);
$dateNow = new \DateTime();
$dateDiff = $dateNow->diff($dateRef);
return [
'past_time' => $dateDiff->invert,
'year' => $dateDiff->y,
'month' => $dateDiff->m... | php | public static function timeDiff($timestamp)
{
$dateRef = new \DateTime('@' . $timestamp);
$dateNow = new \DateTime();
$dateDiff = $dateNow->diff($dateRef);
return [
'past_time' => $dateDiff->invert,
'year' => $dateDiff->y,
'month' => $dateDiff->m... | [
"public",
"static",
"function",
"timeDiff",
"(",
"$",
"timestamp",
")",
"{",
"$",
"dateRef",
"=",
"new",
"\\",
"DateTime",
"(",
"'@'",
".",
"$",
"timestamp",
")",
";",
"$",
"dateNow",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"$",
"dateDiff",
"=",... | Calculates time difference between current time and specified timestamp
and returns array with human readable properties of time interval
@param integer $timestamp
@return array | [
"Calculates",
"time",
"difference",
"between",
"current",
"time",
"and",
"specified",
"timestamp",
"and",
"returns",
"array",
"with",
"human",
"readable",
"properties",
"of",
"time",
"interval"
] | e0c9138aab61a53d88f32bb66201b075f3f44f1d | https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Tools.php#L255-L272 |
197,837 | raymondjavaxx/php5-browserid | libraries/browserid/Verifier.php | Verifier.verify | public function verify($assertion) {
$response = $this->_post(array(
'audience' => $this->audience,
'assertion' => $assertion
));
if ($response->status !== 'okay') {
throw new Exception('Invalid assertion - ' . $response->reason);
}
return $response;
} | php | public function verify($assertion) {
$response = $this->_post(array(
'audience' => $this->audience,
'assertion' => $assertion
));
if ($response->status !== 'okay') {
throw new Exception('Invalid assertion - ' . $response->reason);
}
return $response;
} | [
"public",
"function",
"verify",
"(",
"$",
"assertion",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"_post",
"(",
"array",
"(",
"'audience'",
"=>",
"$",
"this",
"->",
"audience",
",",
"'assertion'",
"=>",
"$",
"assertion",
")",
")",
";",
"if",
... | Verifies a BrowserID assertion
@param string $assertion assertion to be verified
@return object
BrowserID verification response object with the following attributes:
email: email address of the user
audience: hostname that the assertion is valid for
expires: expiration timestamp of the assertion
issuer: the entity wh... | [
"Verifies",
"a",
"BrowserID",
"assertion"
] | 1028776ef7a4b2a4f8e4e831e186a3bf2c187657 | https://github.com/raymondjavaxx/php5-browserid/blob/1028776ef7a4b2a4f8e4e831e186a3bf2c187657/libraries/browserid/Verifier.php#L51-L62 |
197,838 | raymondjavaxx/php5-browserid | libraries/browserid/Verifier.php | Verifier._post | protected function _post($data) {
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => static::ENDPOINT,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HEADER => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => tr... | php | protected function _post($data) {
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => static::ENDPOINT,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HEADER => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => tr... | [
"protected",
"function",
"_post",
"(",
"$",
"data",
")",
"{",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt_array",
"(",
"$",
"ch",
",",
"array",
"(",
"CURLOPT_URL",
"=>",
"static",
"::",
"ENDPOINT",
",",
"CURLOPT_POST",
"=>",
"true",
",",
"... | Makes an HTTP POST request to verification endpoint
@param array $data data to be sent to endpoint
@return object verification response
@throws \browserid\Exception | [
"Makes",
"an",
"HTTP",
"POST",
"request",
"to",
"verification",
"endpoint"
] | 1028776ef7a4b2a4f8e4e831e186a3bf2c187657 | https://github.com/raymondjavaxx/php5-browserid/blob/1028776ef7a4b2a4f8e4e831e186a3bf2c187657/libraries/browserid/Verifier.php#L71-L98 |
197,839 | phpffcms/ffcms-core | src/Helper/Simplify.php | Simplify.parseUserNick | public static function parseUserNick($userId = null, $onEmpty = 'guest'): ?string
{
if (!Any::isInt($userId)) {
return \App::$Security->strip_tags($onEmpty);
}
// try to find user active record as object
$identity = App::$User->identity($userId);
if (!$identity) ... | php | public static function parseUserNick($userId = null, $onEmpty = 'guest'): ?string
{
if (!Any::isInt($userId)) {
return \App::$Security->strip_tags($onEmpty);
}
// try to find user active record as object
$identity = App::$User->identity($userId);
if (!$identity) ... | [
"public",
"static",
"function",
"parseUserNick",
"(",
"$",
"userId",
"=",
"null",
",",
"$",
"onEmpty",
"=",
"'guest'",
")",
":",
"?",
"string",
"{",
"if",
"(",
"!",
"Any",
"::",
"isInt",
"(",
"$",
"userId",
")",
")",
"{",
"return",
"\\",
"App",
"::... | Get user nickname by user id with predefined value on empty or not exist profile
@param $userId
@param string $onEmpty
@return string | [
"Get",
"user",
"nickname",
"by",
"user",
"id",
"with",
"predefined",
"value",
"on",
"empty",
"or",
"not",
"exist",
"profile"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/Simplify.php#L21-L35 |
197,840 | buildok/validator | src/types/base/BaseValidator.php | BaseValidator.validate | public function validate($value, $options)
{
$this->value = $value;
$this->options = $options;
$this->errors = [];
return $this->checkIt();
} | php | public function validate($value, $options)
{
$this->value = $value;
$this->options = $options;
$this->errors = [];
return $this->checkIt();
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
",",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"$",
"value",
";",
"$",
"this",
"->",
"options",
"=",
"$",
"options",
";",
"$",
"this",
"->",
"errors",
"=",
"[",
"]",
";",
"retu... | Main validation function
@param mixed $value Value to check
@param buildok\helpers\ArrayWrapper $options Validation options
@return boolean | [
"Main",
"validation",
"function"
] | 3612ebca7901c84be2f26f641470933e468a0811 | https://github.com/buildok/validator/blob/3612ebca7901c84be2f26f641470933e468a0811/src/types/base/BaseValidator.php#L55-L62 |
197,841 | stevenliebregt/crispysystem | src/Container/Container.php | Container.resolveDependencies | protected function resolveDependencies(array $dependencies, array $parameters = [])
{
$results = [];
foreach ($dependencies as $dependency) {
if (array_key_exists($dependency->name, $parameters)) { // Parameter value is given
$results[] = $parameters[$dependency->name];
... | php | protected function resolveDependencies(array $dependencies, array $parameters = [])
{
$results = [];
foreach ($dependencies as $dependency) {
if (array_key_exists($dependency->name, $parameters)) { // Parameter value is given
$results[] = $parameters[$dependency->name];
... | [
"protected",
"function",
"resolveDependencies",
"(",
"array",
"$",
"dependencies",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"dependencies",
"as",
"$",
"dependency",
")",
"{",
"if",... | Resolves dependencies recursively
@param array $dependencies List of dependencies
@param array $parameters Fill parameter slots with pre-given data
@return array The resolved dependencies
@since 1.0.0 | [
"Resolves",
"dependencies",
"recursively"
] | 06547dae100dae1023a93ec903f2d2abacce9aec | https://github.com/stevenliebregt/crispysystem/blob/06547dae100dae1023a93ec903f2d2abacce9aec/src/Container/Container.php#L68-L82 |
197,842 | stevenliebregt/crispysystem | src/Container/Container.php | Container.resolveMethod | public function resolveMethod($instance, string $method, array $parameters = [])
{
$name = get_class($instance);
$reflection = new \ReflectionMethod($name, $method);
$dependencies = $reflection->getParameters();
$instances = $this->resolveDependencies($dependencies, $parameters); //... | php | public function resolveMethod($instance, string $method, array $parameters = [])
{
$name = get_class($instance);
$reflection = new \ReflectionMethod($name, $method);
$dependencies = $reflection->getParameters();
$instances = $this->resolveDependencies($dependencies, $parameters); //... | [
"public",
"function",
"resolveMethod",
"(",
"$",
"instance",
",",
"string",
"$",
"method",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"name",
"=",
"get_class",
"(",
"$",
"instance",
")",
";",
"$",
"reflection",
"=",
"new",
"\\",
"... | Calls the method of an instance after resolving dependencies
@param object $instance Instance to use when calling method
@param string $method Name of the method
@param array $parameters Pre-given data to fill slots that have no default value
@return mixed Value returned in method
@since 1.0.0 | [
"Calls",
"the",
"method",
"of",
"an",
"instance",
"after",
"resolving",
"dependencies"
] | 06547dae100dae1023a93ec903f2d2abacce9aec | https://github.com/stevenliebregt/crispysystem/blob/06547dae100dae1023a93ec903f2d2abacce9aec/src/Container/Container.php#L92-L102 |
197,843 | stevenliebregt/crispysystem | src/Container/Container.php | Container.resolveClosure | public function resolveClosure(\Closure $closure)
{
$reflection = new \ReflectionFunction($closure);
$dependencies = $reflection->getParameters();
$instances = $this->resolveDependencies($dependencies); // Actually resolve the dependencies
$o = $reflection->invokeArgs($instances);
... | php | public function resolveClosure(\Closure $closure)
{
$reflection = new \ReflectionFunction($closure);
$dependencies = $reflection->getParameters();
$instances = $this->resolveDependencies($dependencies); // Actually resolve the dependencies
$o = $reflection->invokeArgs($instances);
... | [
"public",
"function",
"resolveClosure",
"(",
"\\",
"Closure",
"$",
"closure",
")",
"{",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionFunction",
"(",
"$",
"closure",
")",
";",
"$",
"dependencies",
"=",
"$",
"reflection",
"->",
"getParameters",
"(",
")",
... | Resolves the dependencies of a function
@param \Closure $closure The closure to resolve
@return mixed Value returned in method
@since 1.0.0 | [
"Resolves",
"the",
"dependencies",
"of",
"a",
"function"
] | 06547dae100dae1023a93ec903f2d2abacce9aec | https://github.com/stevenliebregt/crispysystem/blob/06547dae100dae1023a93ec903f2d2abacce9aec/src/Container/Container.php#L110-L119 |
197,844 | teonsystems/php-base | src/View/Helper/LayoutDataContainer.php | LayoutDataContainer.setView | public function setView(\Zend\View\Renderer\RendererInterface $view)
{
$this->view = $view;
return $this;
} | php | public function setView(\Zend\View\Renderer\RendererInterface $view)
{
$this->view = $view;
return $this;
} | [
"public",
"function",
"setView",
"(",
"\\",
"Zend",
"\\",
"View",
"\\",
"Renderer",
"\\",
"RendererInterface",
"$",
"view",
")",
"{",
"$",
"this",
"->",
"view",
"=",
"$",
"view",
";",
"return",
"$",
"this",
";",
"}"
] | Set the View object
@param Renderer $view
@return AbstractHelper | [
"Set",
"the",
"View",
"object"
] | 010418fd9df3c447a74b36cf0d31e2d38a6527ac | https://github.com/teonsystems/php-base/blob/010418fd9df3c447a74b36cf0d31e2d38a6527ac/src/View/Helper/LayoutDataContainer.php#L64-L68 |
197,845 | Subscribo/dependencyresolver | src/Subscribo/DependencyResolver/FlatDependencyResolver.php | FlatDependencyResolver._isResolved | private static function _isResolved(array $dependenciesList, array $resolved)
{
foreach($dependenciesList as $dependency) {
if ( ! array_key_exists($dependency, $resolved)) {
return false;
}
}
return true;
} | php | private static function _isResolved(array $dependenciesList, array $resolved)
{
foreach($dependenciesList as $dependency) {
if ( ! array_key_exists($dependency, $resolved)) {
return false;
}
}
return true;
} | [
"private",
"static",
"function",
"_isResolved",
"(",
"array",
"$",
"dependenciesList",
",",
"array",
"$",
"resolved",
")",
"{",
"foreach",
"(",
"$",
"dependenciesList",
"as",
"$",
"dependency",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"depende... | Checks, whether all items from dependencies list are among keys in resolved
@param array $dependenciesList
@param array $resolved
@return bool | [
"Checks",
"whether",
"all",
"items",
"from",
"dependencies",
"list",
"are",
"among",
"keys",
"in",
"resolved"
] | c345569ca497b6d7e2ade4a93eb19bb535b8b857 | https://github.com/Subscribo/dependencyresolver/blob/c345569ca497b6d7e2ade4a93eb19bb535b8b857/src/Subscribo/DependencyResolver/FlatDependencyResolver.php#L52-L60 |
197,846 | raulfraile/ladybug-plugin-extra | Type/ImageType.php | ImageType.setImage | public function setImage($image)
{
$this->image = base64_encode($image);
// create temp file
$this->tempPath = sys_get_temp_dir() . '/' . uniqid('ladybug_');
file_put_contents($this->tempPath, $image);
} | php | public function setImage($image)
{
$this->image = base64_encode($image);
// create temp file
$this->tempPath = sys_get_temp_dir() . '/' . uniqid('ladybug_');
file_put_contents($this->tempPath, $image);
} | [
"public",
"function",
"setImage",
"(",
"$",
"image",
")",
"{",
"$",
"this",
"->",
"image",
"=",
"base64_encode",
"(",
"$",
"image",
")",
";",
"// create temp file",
"$",
"this",
"->",
"tempPath",
"=",
"sys_get_temp_dir",
"(",
")",
".",
"'/'",
".",
"uniqi... | Sets image content
@param $image | [
"Sets",
"image",
"content"
] | 0d569c28eb4706506f0057d95a1da9dd2c76c329 | https://github.com/raulfraile/ladybug-plugin-extra/blob/0d569c28eb4706506f0057d95a1da9dd2c76c329/Type/ImageType.php#L73-L80 |
197,847 | honey-comb/resources | src/Services/HCResourceService.php | HCResourceService.generateCachePath | protected function generateCachePath(
string $resourceId,
string $disk,
string $extension,
int $width = 0,
int $height = 0,
$fit = null
): string {
if ($this->isLocalOrPublic($disk)) {
$folder = config('filesystems.disks.' . $disk . '.root') . '/ca... | php | protected function generateCachePath(
string $resourceId,
string $disk,
string $extension,
int $width = 0,
int $height = 0,
$fit = null
): string {
if ($this->isLocalOrPublic($disk)) {
$folder = config('filesystems.disks.' . $disk . '.root') . '/ca... | [
"protected",
"function",
"generateCachePath",
"(",
"string",
"$",
"resourceId",
",",
"string",
"$",
"disk",
",",
"string",
"$",
"extension",
",",
"int",
"$",
"width",
"=",
"0",
",",
"int",
"$",
"height",
"=",
"0",
",",
"$",
"fit",
"=",
"null",
")",
"... | Generating resource cache location and name
@param string $resourceId
@param string $disk
@param string $extension
@param int|null $width
@param int|null $height
@param null $fit
@return string | [
"Generating",
"resource",
"cache",
"location",
"and",
"name"
] | 9b82eb2fd99be99edfdc4e76803d95caf981e14b | https://github.com/honey-comb/resources/blob/9b82eb2fd99be99edfdc4e76803d95caf981e14b/src/Services/HCResourceService.php#L673-L698 |
197,848 | honey-comb/resources | src/Services/HCResourceService.php | HCResourceService.createImage | protected function createImage(string $disk, $source, $destination, $width = 0, $height = 0, $fit = false): bool
{
if ($width == 0) {
$width = null;
}
if ($height == 0) {
$height = null;
}
if ($this->isLocalOrPublic($disk)) {
$source = co... | php | protected function createImage(string $disk, $source, $destination, $width = 0, $height = 0, $fit = false): bool
{
if ($width == 0) {
$width = null;
}
if ($height == 0) {
$height = null;
}
if ($this->isLocalOrPublic($disk)) {
$source = co... | [
"protected",
"function",
"createImage",
"(",
"string",
"$",
"disk",
",",
"$",
"source",
",",
"$",
"destination",
",",
"$",
"width",
"=",
"0",
",",
"$",
"height",
"=",
"0",
",",
"$",
"fit",
"=",
"false",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"wid... | Creating image based on provided data
@param string $disk
@param $source
@param $destination
@param int $width
@param int $height
@param bool $fit
@return bool | [
"Creating",
"image",
"based",
"on",
"provided",
"data"
] | 9b82eb2fd99be99edfdc4e76803d95caf981e14b | https://github.com/honey-comb/resources/blob/9b82eb2fd99be99edfdc4e76803d95caf981e14b/src/Services/HCResourceService.php#L711-L750 |
197,849 | phospr/DoubleEntryBundle | Model/PostingHandler.php | PostingHandler.findPostingForId | public function findPostingForId($id)
{
$dql = '
SELECT p
FROM %s p
WHERE p.id = :id
AND p.organization = :organization
';
return $this->em
->createQuery(sprintf($dql, $this->postingFqcn))
->setParamet... | php | public function findPostingForId($id)
{
$dql = '
SELECT p
FROM %s p
WHERE p.id = :id
AND p.organization = :organization
';
return $this->em
->createQuery(sprintf($dql, $this->postingFqcn))
->setParamet... | [
"public",
"function",
"findPostingForId",
"(",
"$",
"id",
")",
"{",
"$",
"dql",
"=",
"'\n SELECT p\n FROM %s p\n WHERE p.id = :id\n AND p.organization = :organization\n '",
";",
"return",
"$",
"this",
"->",
"em",
... | Find Posting for id
@author Tom Haskins-Vaughan <tom@tomhv.uk>
@since 0.8.0
@param int $id
@return Posting | [
"Find",
"Posting",
"for",
"id"
] | d9c421f30922b461483731983c59beb26047fb7f | https://github.com/phospr/DoubleEntryBundle/blob/d9c421f30922b461483731983c59beb26047fb7f/Model/PostingHandler.php#L98-L113 |
197,850 | phospr/DoubleEntryBundle | Model/PostingHandler.php | PostingHandler.createPosting | public function createPosting(AccountInterface $account = null, $amount = null)
{
$posting = new $this->postingFqcn($account, $amount);
$posting->setOrganization($this->oh->getOrganization());
return $posting;
} | php | public function createPosting(AccountInterface $account = null, $amount = null)
{
$posting = new $this->postingFqcn($account, $amount);
$posting->setOrganization($this->oh->getOrganization());
return $posting;
} | [
"public",
"function",
"createPosting",
"(",
"AccountInterface",
"$",
"account",
"=",
"null",
",",
"$",
"amount",
"=",
"null",
")",
"{",
"$",
"posting",
"=",
"new",
"$",
"this",
"->",
"postingFqcn",
"(",
"$",
"account",
",",
"$",
"amount",
")",
";",
"$"... | Create new Posting
@author Tom Haskins-Vaughan <tom@tomhv.uk>
@since 0.8.0
@param AccountInterface $account
@param float $amount
@return Posting | [
"Create",
"new",
"Posting"
] | d9c421f30922b461483731983c59beb26047fb7f | https://github.com/phospr/DoubleEntryBundle/blob/d9c421f30922b461483731983c59beb26047fb7f/Model/PostingHandler.php#L126-L132 |
197,851 | linpax/microphp-cache | src/adapter/Memcached.php | Memcached.check | public function check($driver)
{
switch ($driver) {
case self::DRIVER_MEMCACHE:
return extension_loaded('memcache');
case self::DRIVER_MEMCACHED:
return extension_loaded('memcached');
}
return false;
} | php | public function check($driver)
{
switch ($driver) {
case self::DRIVER_MEMCACHE:
return extension_loaded('memcache');
case self::DRIVER_MEMCACHED:
return extension_loaded('memcached');
}
return false;
} | [
"public",
"function",
"check",
"(",
"$",
"driver",
")",
"{",
"switch",
"(",
"$",
"driver",
")",
"{",
"case",
"self",
"::",
"DRIVER_MEMCACHE",
":",
"return",
"extension_loaded",
"(",
"'memcache'",
")",
";",
"case",
"self",
"::",
"DRIVER_MEMCACHED",
":",
"re... | Checks installed extensions
@return bool | [
"Checks",
"installed",
"extensions"
] | 15dda63a3fac9ad769fdc8d825ff60e256e14c4d | https://github.com/linpax/microphp-cache/blob/15dda63a3fac9ad769fdc8d825ff60e256e14c4d/src/adapter/Memcached.php#L75-L84 |
197,852 | cubicmushroom/valueobjects | src/Geography/Country.php | Country.fromNative | public static function fromNative()
{
$codeString = \func_get_arg(0);
$code = CountryCode::getByName($codeString);
$country = new self($code);
return $country;
} | php | public static function fromNative()
{
$codeString = \func_get_arg(0);
$code = CountryCode::getByName($codeString);
$country = new self($code);
return $country;
} | [
"public",
"static",
"function",
"fromNative",
"(",
")",
"{",
"$",
"codeString",
"=",
"\\",
"func_get_arg",
"(",
"0",
")",
";",
"$",
"code",
"=",
"CountryCode",
"::",
"getByName",
"(",
"$",
"codeString",
")",
";",
"$",
"country",
"=",
"new",
"self",
"("... | Returns a new Country object given a native PHP string country code
@param string $code
@return self | [
"Returns",
"a",
"new",
"Country",
"object",
"given",
"a",
"native",
"PHP",
"string",
"country",
"code"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Geography/Country.php#L19-L26 |
197,853 | cubicmushroom/valueobjects | src/Geography/Country.php | Country.sameValueAs | public function sameValueAs(ValueObjectInterface $country)
{
if (false === Util::classEquals($this, $country)) {
return false;
}
return $this->getCode()->sameValueAs($country->getCode());
} | php | public function sameValueAs(ValueObjectInterface $country)
{
if (false === Util::classEquals($this, $country)) {
return false;
}
return $this->getCode()->sameValueAs($country->getCode());
} | [
"public",
"function",
"sameValueAs",
"(",
"ValueObjectInterface",
"$",
"country",
")",
"{",
"if",
"(",
"false",
"===",
"Util",
"::",
"classEquals",
"(",
"$",
"this",
",",
"$",
"country",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
... | Tells whether two Country are equal
@param ValueObjectInterface $country
@return bool | [
"Tells",
"whether",
"two",
"Country",
"are",
"equal"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Geography/Country.php#L44-L51 |
197,854 | phossa/phossa-db | src/Phossa/Db/Manager/Manager.php | Manager.driverMatcher | protected function driverMatcher(/*# string */ $tag)/*# : array */
{
$matched = [];
foreach ($this->drivers as $id => $driver) {
// disconnected or tag not match
if (!$driver->ping() ||
'' !== $tag &&
(
!$driver inst... | php | protected function driverMatcher(/*# string */ $tag)/*# : array */
{
$matched = [];
foreach ($this->drivers as $id => $driver) {
// disconnected or tag not match
if (!$driver->ping() ||
'' !== $tag &&
(
!$driver inst... | [
"protected",
"function",
"driverMatcher",
"(",
"/*# string */",
"$",
"tag",
")",
"/*# : array */",
"{",
"$",
"matched",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"drivers",
"as",
"$",
"id",
"=>",
"$",
"driver",
")",
"{",
"// disconnected or ta... | Driver tag matcher
@param string $tag tag to match
@return array
@access protected | [
"Driver",
"tag",
"matcher"
] | 9ef2c0e0c3047f4ff2ce6b0a218187025ac64d29 | https://github.com/phossa/phossa-db/blob/9ef2c0e0c3047f4ff2ce6b0a218187025ac64d29/src/Phossa/Db/Manager/Manager.php#L146-L168 |
197,855 | rafrsr/lib-array2object | src/Traits/ParsersAwareTrait.php | ParsersAwareTrait.prependParser | public function prependParser(ValueParserInterface $parser)
{
$parsers = $this->parsers;
if (array_key_exists($parser->getName(), $parsers)) {
unset($parsers[$parser->getName()]);
}
$this->parsers = array_merge([$parser->getName() => $parser], $parsers);
return ... | php | public function prependParser(ValueParserInterface $parser)
{
$parsers = $this->parsers;
if (array_key_exists($parser->getName(), $parsers)) {
unset($parsers[$parser->getName()]);
}
$this->parsers = array_merge([$parser->getName() => $parser], $parsers);
return ... | [
"public",
"function",
"prependParser",
"(",
"ValueParserInterface",
"$",
"parser",
")",
"{",
"$",
"parsers",
"=",
"$",
"this",
"->",
"parsers",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"parser",
"->",
"getName",
"(",
")",
",",
"$",
"parsers",
")",
"... | Prepend parser to list of parsers, HIGH priority.
@param ValueParserInterface $parser
@return $this | [
"Prepend",
"parser",
"to",
"list",
"of",
"parsers",
"HIGH",
"priority",
"."
] | d15db63b5f5740dbc7c2213373320445785856ef | https://github.com/rafrsr/lib-array2object/blob/d15db63b5f5740dbc7c2213373320445785856ef/src/Traits/ParsersAwareTrait.php#L69-L79 |
197,856 | LartTyler/SalesforceClient | src/DaybreakStudios/Salesforce/ClientUtil.php | ClientUtil.getSObjectFields | public static function getSObjectFields(SObject $sob) {
if (!isset($sob->fields))
return null;
$fields = $sob->fields;
if (is_object($fields))
$fields = get_object_vars($fields);
return $fields;
} | php | public static function getSObjectFields(SObject $sob) {
if (!isset($sob->fields))
return null;
$fields = $sob->fields;
if (is_object($fields))
$fields = get_object_vars($fields);
return $fields;
} | [
"public",
"static",
"function",
"getSObjectFields",
"(",
"SObject",
"$",
"sob",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"sob",
"->",
"fields",
")",
")",
"return",
"null",
";",
"$",
"fields",
"=",
"$",
"sob",
"->",
"fields",
";",
"if",
"(",
"is... | Gets the Salesforce fields member out of an SObject, and guarentees conversion to an associative array.
@param SObject $sob the SObject to retrieve the fields member from
@return array|null the fields member as an associative array, or null if fields is not defined | [
"Gets",
"the",
"Salesforce",
"fields",
"member",
"out",
"of",
"an",
"SObject",
"and",
"guarentees",
"conversion",
"to",
"an",
"associative",
"array",
"."
] | 8fc0197c0b80a78d88d5d62486567af69661a2c9 | https://github.com/LartTyler/SalesforceClient/blob/8fc0197c0b80a78d88d5d62486567af69661a2c9/src/DaybreakStudios/Salesforce/ClientUtil.php#L11-L21 |
197,857 | LartTyler/SalesforceClient | src/DaybreakStudios/Salesforce/ClientUtil.php | ClientUtil.updateSObjectFields | public static function updateSObjectFields(SObject $sob, $fields) {
if (!is_array($fields) && !is_object($fields))
throw new InvalidArgumentException('$fields must be an array or object');
if (is_object($sob->fields))
$fields = (object)$fields;
$sob->fields = $fields;
return $sob;
} | php | public static function updateSObjectFields(SObject $sob, $fields) {
if (!is_array($fields) && !is_object($fields))
throw new InvalidArgumentException('$fields must be an array or object');
if (is_object($sob->fields))
$fields = (object)$fields;
$sob->fields = $fields;
return $sob;
} | [
"public",
"static",
"function",
"updateSObjectFields",
"(",
"SObject",
"$",
"sob",
",",
"$",
"fields",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"fields",
")",
"&&",
"!",
"is_object",
"(",
"$",
"fields",
")",
")",
"throw",
"new",
"InvalidArgumentEx... | Updates an SObject's fields member using either an object or an associative array.
@throws InvalidArgumentException if $fields is not an array or an object
@param SObject $sob the SObject to update
@param array|object $fields the array or object to update the fields member from
@return SObject the updat... | [
"Updates",
"an",
"SObject",
"s",
"fields",
"member",
"using",
"either",
"an",
"object",
"or",
"an",
"associative",
"array",
"."
] | 8fc0197c0b80a78d88d5d62486567af69661a2c9 | https://github.com/LartTyler/SalesforceClient/blob/8fc0197c0b80a78d88d5d62486567af69661a2c9/src/DaybreakStudios/Salesforce/ClientUtil.php#L32-L42 |
197,858 | smalldb/smalldb-rest | class/JsonResponse.php | JsonResponse.sendException | public static function sendException(\Exception $ex)
{
$class = get_class($ex);
switch ($class) {
case 'Smalldb\\StateMachine\\TransitionAccessException':
$http_code = '403';
break;
case 'Smalldb\\StateMachine\\InstanceDoesNotExistException':
$http_code = '404';
break;
default:
$http_c... | php | public static function sendException(\Exception $ex)
{
$class = get_class($ex);
switch ($class) {
case 'Smalldb\\StateMachine\\TransitionAccessException':
$http_code = '403';
break;
case 'Smalldb\\StateMachine\\InstanceDoesNotExistException':
$http_code = '404';
break;
default:
$http_c... | [
"public",
"static",
"function",
"sendException",
"(",
"\\",
"Exception",
"$",
"ex",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"ex",
")",
";",
"switch",
"(",
"$",
"class",
")",
"{",
"case",
"'Smalldb\\\\StateMachine\\\\TransitionAccessException'",
":"... | Send info about thrown exception and set proper HTTP code. | [
"Send",
"info",
"about",
"thrown",
"exception",
"and",
"set",
"proper",
"HTTP",
"code",
"."
] | ff393ee39060b4524d41835921e86ed40af006fe | https://github.com/smalldb/smalldb-rest/blob/ff393ee39060b4524d41835921e86ed40af006fe/class/JsonResponse.php#L39-L57 |
197,859 | smalldb/smalldb-rest | class/JsonResponse.php | JsonResponse.writeException | public static function writeException(\Exception $ex)
{
$response = array(
'exception' => get_class($ex),
'message' => $ex->getMessage(),
'code' => $ex->getCode(),
);
static::writeJson($response);
} | php | public static function writeException(\Exception $ex)
{
$response = array(
'exception' => get_class($ex),
'message' => $ex->getMessage(),
'code' => $ex->getCode(),
);
static::writeJson($response);
} | [
"public",
"static",
"function",
"writeException",
"(",
"\\",
"Exception",
"$",
"ex",
")",
"{",
"$",
"response",
"=",
"array",
"(",
"'exception'",
"=>",
"get_class",
"(",
"$",
"ex",
")",
",",
"'message'",
"=>",
"$",
"ex",
"->",
"getMessage",
"(",
")",
"... | Render exception as JSON string | [
"Render",
"exception",
"as",
"JSON",
"string"
] | ff393ee39060b4524d41835921e86ed40af006fe | https://github.com/smalldb/smalldb-rest/blob/ff393ee39060b4524d41835921e86ed40af006fe/class/JsonResponse.php#L63-L71 |
197,860 | RocketPropelledTortoise/Core | src/Taxonomy/Term.php | Term.string | public function string($key, $language = '')
{
if (!$this->hasTranslations()) {
return $this->container['lang'][$key];
}
if ($language == '') {
$language = I18N::getCurrent();
}
if (array_key_exists('lang_' . $language, $this->container)) {
... | php | public function string($key, $language = '')
{
if (!$this->hasTranslations()) {
return $this->container['lang'][$key];
}
if ($language == '') {
$language = I18N::getCurrent();
}
if (array_key_exists('lang_' . $language, $this->container)) {
... | [
"public",
"function",
"string",
"(",
"$",
"key",
",",
"$",
"language",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasTranslations",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"container",
"[",
"'lang'",
"]",
"[",
"$",
"key",
"... | Return the textual version of the term
@param string $key
@param string $language
@return string | [
"Return",
"the",
"textual",
"version",
"of",
"the",
"term"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/Term.php#L148-L163 |
197,861 | RocketPropelledTortoise/Core | src/Taxonomy/Term.php | Term.translated | public function translated($language = '')
{
if (!$this->hasTranslations()) {
return true;
}
if ($language == '') {
$language = I18N::getCurrent();
}
if (array_key_exists('lang_' . $language, $this->container)) {
return $this->container['... | php | public function translated($language = '')
{
if (!$this->hasTranslations()) {
return true;
}
if ($language == '') {
$language = I18N::getCurrent();
}
if (array_key_exists('lang_' . $language, $this->container)) {
return $this->container['... | [
"public",
"function",
"translated",
"(",
"$",
"language",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasTranslations",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"language",
"==",
"''",
")",
"{",
"$",
"language",
... | Is it translated in this language ?
@param string $language
@return bool | [
"Is",
"it",
"translated",
"in",
"this",
"language",
"?"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/Term.php#L171-L186 |
197,862 | RocketPropelledTortoise/Core | src/Taxonomy/Term.php | Term.editLanguage | public function editLanguage($language = '')
{
if (!array_key_exists('lang_' . $language, $this->container)) {
throw new UndefinedLanguageException;
}
return $this->container['lang_' . $language];
} | php | public function editLanguage($language = '')
{
if (!array_key_exists('lang_' . $language, $this->container)) {
throw new UndefinedLanguageException;
}
return $this->container['lang_' . $language];
} | [
"public",
"function",
"editLanguage",
"(",
"$",
"language",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'lang_'",
".",
"$",
"language",
",",
"$",
"this",
"->",
"container",
")",
")",
"{",
"throw",
"new",
"UndefinedLanguageException",
";"... | Retrieve a language for edition
@param string $language
@throws UndefinedLanguageException
@return Model\TermData | [
"Retrieve",
"a",
"language",
"for",
"edition"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/Term.php#L240-L247 |
197,863 | rawphp/RawYaml | lib/Yaml.php | Yaml.load | public function load( $file )
{
$retVal = array( );
try
{
$retVal = SymFonyYaml::parse( $file );
}
catch ( \Exception $e )
{
throw new YamlException( $e->getmessage( ), $e->getCode( ), $e );
}
return $this->filter( self::ON_YA... | php | public function load( $file )
{
$retVal = array( );
try
{
$retVal = SymFonyYaml::parse( $file );
}
catch ( \Exception $e )
{
throw new YamlException( $e->getmessage( ), $e->getCode( ), $e );
}
return $this->filter( self::ON_YA... | [
"public",
"function",
"load",
"(",
"$",
"file",
")",
"{",
"$",
"retVal",
"=",
"array",
"(",
")",
";",
"try",
"{",
"$",
"retVal",
"=",
"SymFonyYaml",
"::",
"parse",
"(",
"$",
"file",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
... | Parses yaml file and returns an array.
@param string $file the yaml file.
@fitler ON_YAML_LOAD_FILTER(2)
@return array the configuration array | [
"Parses",
"yaml",
"file",
"and",
"returns",
"an",
"array",
"."
] | d680b1964d5da42c67838df3aefb10e988c9cfcf | https://github.com/rawphp/RawYaml/blob/d680b1964d5da42c67838df3aefb10e988c9cfcf/lib/Yaml.php#L77-L91 |
197,864 | rawphp/RawYaml | lib/Yaml.php | Yaml.save | public function save( $array, $file )
{
try
{
ob_start( );
$this->dump( $array );
$data = ob_get_clean( );
file_put_contents( $file, $this->filter( self::ON_YAML_SAVE_FILTER, $data, $array, $file ) );
}
catch ( \Exception $e )
... | php | public function save( $array, $file )
{
try
{
ob_start( );
$this->dump( $array );
$data = ob_get_clean( );
file_put_contents( $file, $this->filter( self::ON_YAML_SAVE_FILTER, $data, $array, $file ) );
}
catch ( \Exception $e )
... | [
"public",
"function",
"save",
"(",
"$",
"array",
",",
"$",
"file",
")",
"{",
"try",
"{",
"ob_start",
"(",
")",
";",
"$",
"this",
"->",
"dump",
"(",
"$",
"array",
")",
";",
"$",
"data",
"=",
"ob_get_clean",
"(",
")",
";",
"file_put_contents",
"(",
... | Save array as yml to file.
@param array $array the array to save
@param string $file file path
@filter ON_YAML_SAVE_FILTER(3)
@throws YamlException on saving problems | [
"Save",
"array",
"as",
"yml",
"to",
"file",
"."
] | d680b1964d5da42c67838df3aefb10e988c9cfcf | https://github.com/rawphp/RawYaml/blob/d680b1964d5da42c67838df3aefb10e988c9cfcf/lib/Yaml.php#L103-L119 |
197,865 | squareproton/Bond | src/Bond/Pg/Catalog/PgClass.php | PgClass.getEntityName | public function getEntityName()
{
// we got a entityname set already
$tags = $this->getTags();
if( isset( $tags['entity-name'] ) ) {
return $tags['entity-name'];
}
$name = ucwords( $this->name );
$name = \str_replace( '_', '', $name );
return $... | php | public function getEntityName()
{
// we got a entityname set already
$tags = $this->getTags();
if( isset( $tags['entity-name'] ) ) {
return $tags['entity-name'];
}
$name = ucwords( $this->name );
$name = \str_replace( '_', '', $name );
return $... | [
"public",
"function",
"getEntityName",
"(",
")",
"{",
"// we got a entityname set already",
"$",
"tags",
"=",
"$",
"this",
"->",
"getTags",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"tags",
"[",
"'entity-name'",
"]",
")",
")",
"{",
"return",
"$",
"tag... | The name of this relation as per the Bond convention
Uppercase first letter. Replace '_' with ''
@return string | [
"The",
"name",
"of",
"this",
"relation",
"as",
"per",
"the",
"Bond",
"convention",
"Uppercase",
"first",
"letter",
".",
"Replace",
"_",
"with"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Catalog/PgClass.php#L151-L166 |
197,866 | squareproton/Bond | src/Bond/Pg/Catalog/PgClass.php | PgClass.getLinks | public function getLinks()
{
if( isset( $this->links ) ) {
return $this->links;
}
// build links
$this->links = array();
foreach( $this->getAttributes() as $column ) {
/* This relation has a link if it has a attribute which has all of the following... | php | public function getLinks()
{
if( isset( $this->links ) ) {
return $this->links;
}
// build links
$this->links = array();
foreach( $this->getAttributes() as $column ) {
/* This relation has a link if it has a attribute which has all of the following... | [
"public",
"function",
"getLinks",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"links",
")",
")",
"{",
"return",
"$",
"this",
"->",
"links",
";",
"}",
"// build links",
"$",
"this",
"->",
"links",
"=",
"array",
"(",
")",
";",
"foreach... | Get array of links to this table
@return array | [
"Get",
"array",
"of",
"links",
"to",
"this",
"table"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Catalog/PgClass.php#L172-L276 |
197,867 | squareproton/Bond | src/Bond/Pg/Catalog/PgClass.php | PgClass.getAttributes | public function getAttributes( $includeParents = true )
{
if( !$this->columns ) {
$this->columns = $this->catalog->pgAttributes->findByAttrelid( $this->oid )->sortByAttnum();
}
$output = $this->columns->copy();
// include parents
if( !$includeParents ) {
... | php | public function getAttributes( $includeParents = true )
{
if( !$this->columns ) {
$this->columns = $this->catalog->pgAttributes->findByAttrelid( $this->oid )->sortByAttnum();
}
$output = $this->columns->copy();
// include parents
if( !$includeParents ) {
... | [
"public",
"function",
"getAttributes",
"(",
"$",
"includeParents",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"columns",
")",
"{",
"$",
"this",
"->",
"columns",
"=",
"$",
"this",
"->",
"catalog",
"->",
"pgAttributes",
"->",
"findByAttrelid... | Get all columns on this relation
@return Container | [
"Get",
"all",
"columns",
"on",
"this",
"relation"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Catalog/PgClass.php#L326-L344 |
197,868 | squareproton/Bond | src/Bond/Pg/Catalog/PgClass.php | PgClass.isLogTable | public function isLogTable( $default = false )
{
$tags = $this->getTags();
if( array_key_exists( 'isLogTable', $tags ) ) {
return boolval( $tags['isLogTable'] );
} elseif( array_key_exists( 'logging', $tags ) ) {
return true;
}
return (bool) $default;
... | php | public function isLogTable( $default = false )
{
$tags = $this->getTags();
if( array_key_exists( 'isLogTable', $tags ) ) {
return boolval( $tags['isLogTable'] );
} elseif( array_key_exists( 'logging', $tags ) ) {
return true;
}
return (bool) $default;
... | [
"public",
"function",
"isLogTable",
"(",
"$",
"default",
"=",
"false",
")",
"{",
"$",
"tags",
"=",
"$",
"this",
"->",
"getTags",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"'isLogTable'",
",",
"$",
"tags",
")",
")",
"{",
"return",
"boolval",
... | Is this relation a logTable (ie, is it tagged logtable
@param bool The default value to return in the event of logTable status not defined
@return bool | [
"Is",
"this",
"relation",
"a",
"logTable",
"(",
"ie",
"is",
"it",
"tagged",
"logtable"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Catalog/PgClass.php#L378-L387 |
197,869 | zhaoxianfang/tools | src/Symfony/Component/Config/Definition/Processor.php | Processor.normalizeConfig | public static function normalizeConfig($config, $key, $plural = null)
{
if (null === $plural) {
$plural = $key.'s';
}
if (isset($config[$plural])) {
return $config[$plural];
}
if (isset($config[$key])) {
if (is_string($config[$key]) || !i... | php | public static function normalizeConfig($config, $key, $plural = null)
{
if (null === $plural) {
$plural = $key.'s';
}
if (isset($config[$plural])) {
return $config[$plural];
}
if (isset($config[$key])) {
if (is_string($config[$key]) || !i... | [
"public",
"static",
"function",
"normalizeConfig",
"(",
"$",
"config",
",",
"$",
"key",
",",
"$",
"plural",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"plural",
")",
"{",
"$",
"plural",
"=",
"$",
"key",
".",
"'s'",
";",
"}",
"if",
"(",... | Normalizes a configuration entry.
This method returns a normalize configuration array for a given key
to remove the differences due to the original format (YAML and XML mainly).
Here is an example.
The configuration in XML:
<twig:extension>twig.extension.foo</twig:extension>
<twig:extension>twig.extension.bar</twig... | [
"Normalizes",
"a",
"configuration",
"entry",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/Config/Definition/Processor.php#L76-L96 |
197,870 | libreworks/caridea-container | src/Builder.php | Builder.addProvider | public function addProvider(string $name, Provider $provider): self
{
$this->providers[$name] = $provider;
return $this;
} | php | public function addProvider(string $name, Provider $provider): self
{
$this->providers[$name] = $provider;
return $this;
} | [
"public",
"function",
"addProvider",
"(",
"string",
"$",
"name",
",",
"Provider",
"$",
"provider",
")",
":",
"self",
"{",
"$",
"this",
"->",
"providers",
"[",
"$",
"name",
"]",
"=",
"$",
"provider",
";",
"return",
"$",
"this",
";",
"}"
] | Adds a new Provider.
This method exists only for completeness. You'd probably spend less
effort if you call `->eager`, `->lazy`, or `->proto`.
@param string $name The component name
@param \Caridea\Container\Provider $provider The provider
@return $this provides a fluent interface | [
"Adds",
"a",
"new",
"Provider",
"."
] | b93087ff5bf49f5885025da691575093335bfe8f | https://github.com/libreworks/caridea-container/blob/b93087ff5bf49f5885025da691575093335bfe8f/src/Builder.php#L50-L54 |
197,871 | libreworks/caridea-container | src/Builder.php | Builder.eager | public function eager(string $name, string $type, $factory): self
{
$provider = new Provider($type, $factory);
$this->eager[] = $name;
return $this->addProvider($name, $provider);
} | php | public function eager(string $name, string $type, $factory): self
{
$provider = new Provider($type, $factory);
$this->eager[] = $name;
return $this->addProvider($name, $provider);
} | [
"public",
"function",
"eager",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"type",
",",
"$",
"factory",
")",
":",
"self",
"{",
"$",
"provider",
"=",
"new",
"Provider",
"(",
"$",
"type",
",",
"$",
"factory",
")",
";",
"$",
"this",
"->",
"eager",... | Adds a singleton component to be instantiated after the container is.
```php
$builder->eager('foobar', 'Acme\Mail\Service', function($c) {
return new \Acme\Mail\Service($c['dependency']);
});
```
@param string $name The component name
@param string $type The class name of the component
@param object $factory A `Closu... | [
"Adds",
"a",
"singleton",
"component",
"to",
"be",
"instantiated",
"after",
"the",
"container",
"is",
"."
] | b93087ff5bf49f5885025da691575093335bfe8f | https://github.com/libreworks/caridea-container/blob/b93087ff5bf49f5885025da691575093335bfe8f/src/Builder.php#L70-L75 |
197,872 | libreworks/caridea-container | src/Builder.php | Builder.lazy | public function lazy(string $name, string $type, $factory): self
{
return $this->addProvider($name, new Provider($type, $factory));
} | php | public function lazy(string $name, string $type, $factory): self
{
return $this->addProvider($name, new Provider($type, $factory));
} | [
"public",
"function",
"lazy",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"type",
",",
"$",
"factory",
")",
":",
"self",
"{",
"return",
"$",
"this",
"->",
"addProvider",
"(",
"$",
"name",
",",
"new",
"Provider",
"(",
"$",
"type",
",",
"$",
"fac... | Adds a singleton component to be instantiated on demand.
```php
$builder->lazy('foobar', 'Acme\Mail\Service', function($c) {
return new \Acme\Mail\Service($c['dependency']);
});
```
@param string $name The component name
@param string $type The class name of the component
@param object $factory A `Closure` or class w... | [
"Adds",
"a",
"singleton",
"component",
"to",
"be",
"instantiated",
"on",
"demand",
"."
] | b93087ff5bf49f5885025da691575093335bfe8f | https://github.com/libreworks/caridea-container/blob/b93087ff5bf49f5885025da691575093335bfe8f/src/Builder.php#L91-L94 |
197,873 | libreworks/caridea-container | src/Builder.php | Builder.proto | public function proto(string $name, string $type, $factory): self
{
return $this->addProvider($name, new Provider($type, $factory, false));
} | php | public function proto(string $name, string $type, $factory): self
{
return $this->addProvider($name, new Provider($type, $factory, false));
} | [
"public",
"function",
"proto",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"type",
",",
"$",
"factory",
")",
":",
"self",
"{",
"return",
"$",
"this",
"->",
"addProvider",
"(",
"$",
"name",
",",
"new",
"Provider",
"(",
"$",
"type",
",",
"$",
"fa... | Adds a component that provides a new instance each time it's instantiated.
```php
$builder->lazy('objectStorage', 'SplObjectStorage', function($c) {
return new \SplObjectStorage();
});
```
@param string $name The component name
@param string $type The class name of the component
@param object $factory A `Closure` or ... | [
"Adds",
"a",
"component",
"that",
"provides",
"a",
"new",
"instance",
"each",
"time",
"it",
"s",
"instantiated",
"."
] | b93087ff5bf49f5885025da691575093335bfe8f | https://github.com/libreworks/caridea-container/blob/b93087ff5bf49f5885025da691575093335bfe8f/src/Builder.php#L110-L113 |
197,874 | libreworks/caridea-container | src/Builder.php | Builder.build | public function build(Container $parent = null): Objects
{
$container = new Objects($this->providers, $parent);
if (!empty($this->eager)) {
foreach ($this->eager as $v) {
$container->get($v);
}
}
$this->providers = [];
$this->eager = []... | php | public function build(Container $parent = null): Objects
{
$container = new Objects($this->providers, $parent);
if (!empty($this->eager)) {
foreach ($this->eager as $v) {
$container->get($v);
}
}
$this->providers = [];
$this->eager = []... | [
"public",
"function",
"build",
"(",
"Container",
"$",
"parent",
"=",
"null",
")",
":",
"Objects",
"{",
"$",
"container",
"=",
"new",
"Objects",
"(",
"$",
"this",
"->",
"providers",
",",
"$",
"parent",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"t... | Builds a container using the settings called.
Any *eager* components will be instantiated at this time.
When this method is called, this builder is reset to its default state.
@param Container $parent An optional parent container
@return Objects The constructed `Objects` container | [
"Builds",
"a",
"container",
"using",
"the",
"settings",
"called",
"."
] | b93087ff5bf49f5885025da691575093335bfe8f | https://github.com/libreworks/caridea-container/blob/b93087ff5bf49f5885025da691575093335bfe8f/src/Builder.php#L125-L136 |
197,875 | locomotivemtl/charcoal-config | src/Charcoal/Config/ConfigurableTrait.php | ConfigurableTrait.setConfig | public function setConfig($config)
{
if (is_string($config)) {
// Treat the parameter as a filepath
$this->config = $this->createConfig($config);
} elseif (is_array($config)) {
$this->config = $this->createConfig($config);
} elseif ($config instanceof Conf... | php | public function setConfig($config)
{
if (is_string($config)) {
// Treat the parameter as a filepath
$this->config = $this->createConfig($config);
} elseif (is_array($config)) {
$this->config = $this->createConfig($config);
} elseif ($config instanceof Conf... | [
"public",
"function",
"setConfig",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"config",
")",
")",
"{",
"// Treat the parameter as a filepath",
"$",
"this",
"->",
"config",
"=",
"$",
"this",
"->",
"createConfig",
"(",
"$",
"config",
")"... | Sets the object's configuration container.
@param mixed $config The Config object, datamap, or filepath.
@throws InvalidArgumentException If the parameter is invalid.
@return self Chainable | [
"Sets",
"the",
"object",
"s",
"configuration",
"container",
"."
] | 722b34955360c287dea8fffb3b5491866ce5f6cb | https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/ConfigurableTrait.php#L28-L45 |
197,876 | locomotivemtl/charcoal-config | src/Charcoal/Config/ConfigurableTrait.php | ConfigurableTrait.config | public function config($key = null, $default = null)
{
if ($this->config === null) {
$this->config = $this->createConfig();
}
if ($key !== null) {
if ($this->config->has($key)) {
return $this->config->get($key);
} elseif (!is_string($defau... | php | public function config($key = null, $default = null)
{
if ($this->config === null) {
$this->config = $this->createConfig();
}
if ($key !== null) {
if ($this->config->has($key)) {
return $this->config->get($key);
} elseif (!is_string($defau... | [
"public",
"function",
"config",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"config",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"config",
"=",
"$",
"this",
"->",
"createConfig",
"(",
"... | Gets the object's configuration container or a specific key from the container.
@param string|null $key If provided, the data key to retrieve.
@param mixed $default The fallback value to return if $key does not exist.
@return mixed If $key is NULL, the Config object is returned.
If $key is given, its value... | [
"Gets",
"the",
"object",
"s",
"configuration",
"container",
"or",
"a",
"specific",
"key",
"from",
"the",
"container",
"."
] | 722b34955360c287dea8fffb3b5491866ce5f6cb | https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/ConfigurableTrait.php#L56-L73 |
197,877 | wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/stores/LocalCacheStore.php | LocalCacheStore.getData | protected function getData($key)
{
$cacheKey = $this->key($key);
return array_key_exists($cacheKey, $this->cache)?$this->cache[$this->key($key)]:false;
} | php | protected function getData($key)
{
$cacheKey = $this->key($key);
return array_key_exists($cacheKey, $this->cache)?$this->cache[$this->key($key)]:false;
} | [
"protected",
"function",
"getData",
"(",
"$",
"key",
")",
"{",
"$",
"cacheKey",
"=",
"$",
"this",
"->",
"key",
"(",
"$",
"key",
")",
";",
"return",
"array_key_exists",
"(",
"$",
"cacheKey",
",",
"$",
"this",
"->",
"cache",
")",
"?",
"$",
"this",
"-... | Performs a fetch of our data from the cache without logging in the logger.
That allows this method to be used in other functions.
@param string $key The key to fetch
@return mixed Data in this->storageFormat format or FALSE if data is invalid | [
"Performs",
"a",
"fetch",
"of",
"our",
"data",
"from",
"the",
"cache",
"without",
"logging",
"in",
"the",
"logger",
".",
"That",
"allows",
"this",
"method",
"to",
"be",
"used",
"in",
"other",
"functions",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/stores/LocalCacheStore.php#L72-L76 |
197,878 | horntell/php-sdk | lib/guzzle/GuzzleHttp/Url.php | Url.getPort | public function getPort()
{
if ($this->port) {
return $this->port;
} elseif (isset(self::$defaultPorts[$this->scheme])) {
return self::$defaultPorts[$this->scheme];
}
return null;
} | php | public function getPort()
{
if ($this->port) {
return $this->port;
} elseif (isset(self::$defaultPorts[$this->scheme])) {
return self::$defaultPorts[$this->scheme];
}
return null;
} | [
"public",
"function",
"getPort",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"port",
")",
"{",
"return",
"$",
"this",
"->",
"port",
";",
"}",
"elseif",
"(",
"isset",
"(",
"self",
"::",
"$",
"defaultPorts",
"[",
"$",
"this",
"->",
"scheme",
"]",
... | Get the port part of the URl.
If no port was set, this method will return the default port for the
scheme of the URI.
@return int|null | [
"Get",
"the",
"port",
"part",
"of",
"the",
"URl",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Url.php#L273-L282 |
197,879 | horntell/php-sdk | lib/guzzle/GuzzleHttp/Url.php | Url.combine | public function combine($url)
{
$url = static::fromString($url);
// Use the more absolute URL as the base URL
if (!$this->isAbsolute() && $url->isAbsolute()) {
$url = $url->combine($this);
}
$parts = $url->getParts();
// Passing a URL with a scheme over... | php | public function combine($url)
{
$url = static::fromString($url);
// Use the more absolute URL as the base URL
if (!$this->isAbsolute() && $url->isAbsolute()) {
$url = $url->combine($this);
}
$parts = $url->getParts();
// Passing a URL with a scheme over... | [
"public",
"function",
"combine",
"(",
"$",
"url",
")",
"{",
"$",
"url",
"=",
"static",
"::",
"fromString",
"(",
"$",
"url",
")",
";",
"// Use the more absolute URL as the base URL",
"if",
"(",
"!",
"$",
"this",
"->",
"isAbsolute",
"(",
")",
"&&",
"$",
"u... | Combine the URL with another URL and return a new URL instance.
Follows the rules specific in RFC 3986 section 5.4.
@param string $url Relative URL to combine with
@return Url
@throws \InvalidArgumentException
@link http://tools.ietf.org/html/rfc3986#section-5.4 | [
"Combine",
"the",
"URL",
"with",
"another",
"URL",
"and",
"return",
"a",
"new",
"URL",
"instance",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Url.php#L519-L591 |
197,880 | cubicmushroom/valueobjects | src/Person/Name.php | Name.fromNative | public static function fromNative()
{
$args = func_get_args();
$firstName = new StringLiteral($args[0]);
$middleName = new StringLiteral($args[1]);
$lastName = new StringLiteral($args[2]);
return new self($firstName, $middleName, $lastName);
} | php | public static function fromNative()
{
$args = func_get_args();
$firstName = new StringLiteral($args[0]);
$middleName = new StringLiteral($args[1]);
$lastName = new StringLiteral($args[2]);
return new self($firstName, $middleName, $lastName);
} | [
"public",
"static",
"function",
"fromNative",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"firstName",
"=",
"new",
"StringLiteral",
"(",
"$",
"args",
"[",
"0",
"]",
")",
";",
"$",
"middleName",
"=",
"new",
"StringLiteral",
"("... | Returns a Name objects form PHP native values
@param string $first_name
@param string $middle_name
@param string $last_name
@return Name | [
"Returns",
"a",
"Name",
"objects",
"form",
"PHP",
"native",
"values"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Person/Name.php#L40-L49 |
197,881 | cubicmushroom/valueobjects | src/Person/Name.php | Name.sameValueAs | public function sameValueAs(ValueObjectInterface $name)
{
if (false === Util::classEquals($this, $name)) {
return false;
}
return $this->getFullName() == $name->getFullName();
} | php | public function sameValueAs(ValueObjectInterface $name)
{
if (false === Util::classEquals($this, $name)) {
return false;
}
return $this->getFullName() == $name->getFullName();
} | [
"public",
"function",
"sameValueAs",
"(",
"ValueObjectInterface",
"$",
"name",
")",
"{",
"if",
"(",
"false",
"===",
"Util",
"::",
"classEquals",
"(",
"$",
"this",
",",
"$",
"name",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->"... | Tells whether two names are equal by comparing their values
@param ValueObjectInterface $name
@return bool | [
"Tells",
"whether",
"two",
"names",
"are",
"equal",
"by",
"comparing",
"their",
"values"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Person/Name.php#L117-L124 |
197,882 | Stinger-Soft/PhpCommons | src/StingerSoft/PhpCommons/Arrays/Utils.php | Utils.insertElement | public static function insertElement(array $array, $element, $position) {
$res = array_slice($array, 0, $position, true);
if(is_array($element)) {
$res = array_merge($res, $element);
} else {
array_push($res, $element);
}
$res = array_merge($res, array_slice($array, $position, count($array) - 1, t... | php | public static function insertElement(array $array, $element, $position) {
$res = array_slice($array, 0, $position, true);
if(is_array($element)) {
$res = array_merge($res, $element);
} else {
array_push($res, $element);
}
$res = array_merge($res, array_slice($array, $position, count($array) - 1, t... | [
"public",
"static",
"function",
"insertElement",
"(",
"array",
"$",
"array",
",",
"$",
"element",
",",
"$",
"position",
")",
"{",
"$",
"res",
"=",
"array_slice",
"(",
"$",
"array",
",",
"0",
",",
"$",
"position",
",",
"true",
")",
";",
"if",
"(",
"... | Adds a given element into the array on the given position without replacing the old entry
@param array $array
The array the element should be insert into
@param mixed $element
The element to insert
@param integer $position
The position to insert the element into the array.
If this value is greater than the array size,... | [
"Adds",
"a",
"given",
"element",
"into",
"the",
"array",
"on",
"the",
"given",
"position",
"without",
"replacing",
"the",
"old",
"entry"
] | e1d7e2bb7b384fb9182903d3b6138aa3bbd05d9b | https://github.com/Stinger-Soft/PhpCommons/blob/e1d7e2bb7b384fb9182903d3b6138aa3bbd05d9b/src/StingerSoft/PhpCommons/Arrays/Utils.php#L31-L43 |
197,883 | Stinger-Soft/PhpCommons | src/StingerSoft/PhpCommons/Arrays/Utils.php | Utils.getPrevKey | public static function getPrevKey($key, array $array) {
$keys = array_keys($array);
$found_index = array_search($key, $keys);
if($found_index === false || $found_index === 0)
return false;
return $keys[$found_index - 1];
} | php | public static function getPrevKey($key, array $array) {
$keys = array_keys($array);
$found_index = array_search($key, $keys);
if($found_index === false || $found_index === 0)
return false;
return $keys[$found_index - 1];
} | [
"public",
"static",
"function",
"getPrevKey",
"(",
"$",
"key",
",",
"array",
"$",
"array",
")",
"{",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"array",
")",
";",
"$",
"found_index",
"=",
"array_search",
"(",
"$",
"key",
",",
"$",
"keys",
")",
";",
... | Returns the previous key from an array
@param mixed $key
@param array $array
@return boolean|mixed previous key or false if no previous key is available | [
"Returns",
"the",
"previous",
"key",
"from",
"an",
"array"
] | e1d7e2bb7b384fb9182903d3b6138aa3bbd05d9b | https://github.com/Stinger-Soft/PhpCommons/blob/e1d7e2bb7b384fb9182903d3b6138aa3bbd05d9b/src/StingerSoft/PhpCommons/Arrays/Utils.php#L80-L86 |
197,884 | Stinger-Soft/PhpCommons | src/StingerSoft/PhpCommons/Arrays/Utils.php | Utils.getNextKey | public static function getNextKey($key, array $array) {
$keys = array_keys($array);
$found_index = array_search($key, $keys);
if($found_index === false || $found_index + 1 === count($keys))
return false;
return $keys[$found_index + 1];
} | php | public static function getNextKey($key, array $array) {
$keys = array_keys($array);
$found_index = array_search($key, $keys);
if($found_index === false || $found_index + 1 === count($keys))
return false;
return $keys[$found_index + 1];
} | [
"public",
"static",
"function",
"getNextKey",
"(",
"$",
"key",
",",
"array",
"$",
"array",
")",
"{",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"array",
")",
";",
"$",
"found_index",
"=",
"array_search",
"(",
"$",
"key",
",",
"$",
"keys",
")",
";",
... | Returns the next key from an array
@param mixed $key
@param array $array
@return boolean|mixed next key or false if no next key is available | [
"Returns",
"the",
"next",
"key",
"from",
"an",
"array"
] | e1d7e2bb7b384fb9182903d3b6138aa3bbd05d9b | https://github.com/Stinger-Soft/PhpCommons/blob/e1d7e2bb7b384fb9182903d3b6138aa3bbd05d9b/src/StingerSoft/PhpCommons/Arrays/Utils.php#L95-L101 |
197,885 | Eden-PHP/Validation | src/Index.php | Index.lengthGreaterThan | public function lengthGreaterThan($number)
{
//argument 1 must be numeric
Argument::i()->test(1, 'numeric');
return strlen((string)$this->value) > (float)$number;
} | php | public function lengthGreaterThan($number)
{
//argument 1 must be numeric
Argument::i()->test(1, 'numeric');
return strlen((string)$this->value) > (float)$number;
} | [
"public",
"function",
"lengthGreaterThan",
"(",
"$",
"number",
")",
"{",
"//argument 1 must be numeric",
"Argument",
"::",
"i",
"(",
")",
"->",
"test",
"(",
"1",
",",
"'numeric'",
")",
";",
"return",
"strlen",
"(",
"(",
"string",
")",
"$",
"this",
"->",
... | Returns true if the value length is greater than the passed argument
@param *int $number Number to test against
@return bool | [
"Returns",
"true",
"if",
"the",
"value",
"length",
"is",
"greater",
"than",
"the",
"passed",
"argument"
] | 480fd3b745a1d5feb432cf1cb427a7fb606d87c4 | https://github.com/Eden-PHP/Validation/blob/480fd3b745a1d5feb432cf1cb427a7fb606d87c4/src/Index.php#L191-L197 |
197,886 | Eden-PHP/Validation | src/Index.php | Index.isSoftBool | protected function isSoftBool($string)
{
if (!is_scalar($string) || $string === null) {
return false;
}
$string = (string) $string;
return $string == '0' || $string == '1';
} | php | protected function isSoftBool($string)
{
if (!is_scalar($string) || $string === null) {
return false;
}
$string = (string) $string;
return $string == '0' || $string == '1';
} | [
"protected",
"function",
"isSoftBool",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"string",
")",
"||",
"$",
"string",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"$",
"string",
"=",
"(",
"string",
")",
"$",
"stri... | Test if 0 or 1 or string 1 oe 0
@param *scalar $string Value to test
@return bool | [
"Test",
"if",
"0",
"or",
"1",
"or",
"string",
"1",
"oe",
"0"
] | 480fd3b745a1d5feb432cf1cb427a7fb606d87c4 | https://github.com/Eden-PHP/Validation/blob/480fd3b745a1d5feb432cf1cb427a7fb606d87c4/src/Index.php#L396-L405 |
197,887 | Eden-PHP/Validation | src/Index.php | Index.isSoftFloat | protected function isSoftFloat($number)
{
if (!is_scalar($number) || $number === null) {
return false;
}
$number = (string) $number;
return preg_match('/^[-+]?(\d*)?\.\d+$/', $number);
} | php | protected function isSoftFloat($number)
{
if (!is_scalar($number) || $number === null) {
return false;
}
$number = (string) $number;
return preg_match('/^[-+]?(\d*)?\.\d+$/', $number);
} | [
"protected",
"function",
"isSoftFloat",
"(",
"$",
"number",
")",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"number",
")",
"||",
"$",
"number",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"$",
"number",
"=",
"(",
"string",
")",
"$",
"num... | Test if float or string float
@param *scalar $number Value to test
@return bool | [
"Test",
"if",
"float",
"or",
"string",
"float"
] | 480fd3b745a1d5feb432cf1cb427a7fb606d87c4 | https://github.com/Eden-PHP/Validation/blob/480fd3b745a1d5feb432cf1cb427a7fb606d87c4/src/Index.php#L414-L423 |
197,888 | Eden-PHP/Validation | src/Index.php | Index.isSoftInteger | protected function isSoftInteger($number)
{
if (!is_scalar($number) || $number === null) {
return false;
}
$number = (string) $number;
return preg_match('/^[-+]?\d+$/', $number);
} | php | protected function isSoftInteger($number)
{
if (!is_scalar($number) || $number === null) {
return false;
}
$number = (string) $number;
return preg_match('/^[-+]?\d+$/', $number);
} | [
"protected",
"function",
"isSoftInteger",
"(",
"$",
"number",
")",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"number",
")",
"||",
"$",
"number",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"$",
"number",
"=",
"(",
"string",
")",
"$",
"n... | Test if integer or string integer
@param *scalar $number Value to test
@return bool | [
"Test",
"if",
"integer",
"or",
"string",
"integer"
] | 480fd3b745a1d5feb432cf1cb427a7fb606d87c4 | https://github.com/Eden-PHP/Validation/blob/480fd3b745a1d5feb432cf1cb427a7fb606d87c4/src/Index.php#L432-L441 |
197,889 | Eden-PHP/Validation | src/Index.php | Index.isSoftSmall | protected function isSoftSmall($value)
{
if (!is_scalar($value) || $value === null) {
return false;
}
$value = (float) $value;
return $value >= 0 && $value <= 9;
} | php | protected function isSoftSmall($value)
{
if (!is_scalar($value) || $value === null) {
return false;
}
$value = (float) $value;
return $value >= 0 && $value <= 9;
} | [
"protected",
"function",
"isSoftSmall",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"value",
")",
"||",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"$",
"value",
"=",
"(",
"float",
")",
"$",
"value",
... | Returns true if the value is between 0 and 9
@param *scalar $value Value to test
@return bool | [
"Returns",
"true",
"if",
"the",
"value",
"is",
"between",
"0",
"and",
"9"
] | 480fd3b745a1d5feb432cf1cb427a7fb606d87c4 | https://github.com/Eden-PHP/Validation/blob/480fd3b745a1d5feb432cf1cb427a7fb606d87c4/src/Index.php#L450-L459 |
197,890 | jabernardo/lollipop-php | Library/Utils/Collection.php | Collection.arrayMerge | static function arrayMerge() {
$output = [];
foreach(func_get_args() as $array) {
foreach($array as $key => $value) {
$output[$key] = isset($output[$key]) ?
array_merge($output[$key], $value) : $value;
}
}
retu... | php | static function arrayMerge() {
$output = [];
foreach(func_get_args() as $array) {
foreach($array as $key => $value) {
$output[$key] = isset($output[$key]) ?
array_merge($output[$key], $value) : $value;
}
}
retu... | [
"static",
"function",
"arrayMerge",
"(",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"foreach",
"(",
"func_get_args",
"(",
")",
"as",
"$",
"array",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"out... | Array merge including integers as key
@access public
@param array ...$args Arguments
@return array | [
"Array",
"merge",
"including",
"integers",
"as",
"key"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/Utils/Collection.php#L22-L33 |
197,891 | jabernardo/lollipop-php | Library/Utils/Collection.php | Collection.arrayGet | static function arrayGet(&$var, $key, $default = null) {
$toks = explode('.', $key);
for ($i = 0; $i < count($toks); $i++) {
$var = &$var[$toks[$i]];
}
return is_array($var) || is_object($var)
? json_decode(json_encode($var))
... | php | static function arrayGet(&$var, $key, $default = null) {
$toks = explode('.', $key);
for ($i = 0; $i < count($toks); $i++) {
$var = &$var[$toks[$i]];
}
return is_array($var) || is_object($var)
? json_decode(json_encode($var))
... | [
"static",
"function",
"arrayGet",
"(",
"&",
"$",
"var",
",",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"toks",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"co... | Array get using dots to traverse keys
@example
$arr = ['test' => ['word' => 'hello']];
print_r(arrayGet($arr, 'test.word'));
@access public
@param array $var Local declared variable
@param string $key Key
@param mixed $default Default value if $key isn't existing
@return mixed | [
"Array",
"get",
"using",
"dots",
"to",
"traverse",
"keys"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/Utils/Collection.php#L50-L60 |
197,892 | jabernardo/lollipop-php | Library/Utils/Collection.php | Collection.arraySet | static function arraySet(&$var, $key, $val) {
$toks = explode('.', $key);
for ($i = 0; $i < count($toks); $i++) {
$var = &$var[$toks[$i]];
}
$var = $val;
} | php | static function arraySet(&$var, $key, $val) {
$toks = explode('.', $key);
for ($i = 0; $i < count($toks); $i++) {
$var = &$var[$toks[$i]];
}
$var = $val;
} | [
"static",
"function",
"arraySet",
"(",
"&",
"$",
"var",
",",
"$",
"key",
",",
"$",
"val",
")",
"{",
"$",
"toks",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"count",
"(",
"$",
... | Set array key value using dots to traverse keys
@example
$arr = [];
arraySet($arr, 'sample.word', 'Hello');
@access public
@param array $var Local declared variable
@param string $key Array key
@param mixed $val Value
@return void | [
"Set",
"array",
"key",
"value",
"using",
"dots",
"to",
"traverse",
"keys"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/Utils/Collection.php#L77-L85 |
197,893 | jabernardo/lollipop-php | Library/Utils/Collection.php | Collection.arrayUnset | static function arrayUnset(&$var, $key) {
$toks = explode('.', $key);
$toks_len = count($toks);
$last = null;
for ($i = 0; $i < $toks_len - 1; $i++) {
$var = &$var[$toks[$i]];
}
if (isset($toks[$toks_len - 1])) {
$last = $toks[$toks_len -... | php | static function arrayUnset(&$var, $key) {
$toks = explode('.', $key);
$toks_len = count($toks);
$last = null;
for ($i = 0; $i < $toks_len - 1; $i++) {
$var = &$var[$toks[$i]];
}
if (isset($toks[$toks_len - 1])) {
$last = $toks[$toks_len -... | [
"static",
"function",
"arrayUnset",
"(",
"&",
"$",
"var",
",",
"$",
"key",
")",
"{",
"$",
"toks",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"$",
"toks_len",
"=",
"count",
"(",
"$",
"toks",
")",
";",
"$",
"last",
"=",
"null",
";",
... | Remove array key using dots to traverse keys
$arr = ['test' => ['word' => 'hello']];
arrayUnset($arr, 'sample.word');
@access public
@param array $var Local declared variable
@param string $key Array key
@param mixed $val Value
@return void | [
"Remove",
"array",
"key",
"using",
"dots",
"to",
"traverse",
"keys"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/Utils/Collection.php#L100-L114 |
197,894 | mtils/cmsable | src/Cmsable/View/FallbackFileViewFinder.php | FallbackFileViewFinder.fromOther | public static function fromOther(FileViewFinder $otherFinder){
$copy = new static($otherFinder->getFilesystem(),
$otherFinder->getPaths(),
$otherFinder->getExtensions());
if($otherFinder instanceof FallbackFileViewFinder){
$copy->setFal... | php | public static function fromOther(FileViewFinder $otherFinder){
$copy = new static($otherFinder->getFilesystem(),
$otherFinder->getPaths(),
$otherFinder->getExtensions());
if($otherFinder instanceof FallbackFileViewFinder){
$copy->setFal... | [
"public",
"static",
"function",
"fromOther",
"(",
"FileViewFinder",
"$",
"otherFinder",
")",
"{",
"$",
"copy",
"=",
"new",
"static",
"(",
"$",
"otherFinder",
"->",
"getFilesystem",
"(",
")",
",",
"$",
"otherFinder",
"->",
"getPaths",
"(",
")",
",",
"$",
... | Copy a FileViewFinder to a FallbackFileViewFinder
@param \Illuminate\View\FileViewFinder $otherFinder
@return static | [
"Copy",
"a",
"FileViewFinder",
"to",
"a",
"FallbackFileViewFinder"
] | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/View/FallbackFileViewFinder.php#L160-L172 |
197,895 | kambalabs/KmbDomain | src/KmbDomain/Service/GroupClassFactory.php | GroupClassFactory.createFromImportedData | public function createFromImportedData($name, $data)
{
$class = new GroupClass($name);
foreach ($data as $parameterName => $parameterData) {
$class->addParameter($this->getGroupParameterFactory()->createFromImportedData($parameterName, $parameterData));
}
return $class;
... | php | public function createFromImportedData($name, $data)
{
$class = new GroupClass($name);
foreach ($data as $parameterName => $parameterData) {
$class->addParameter($this->getGroupParameterFactory()->createFromImportedData($parameterName, $parameterData));
}
return $class;
... | [
"public",
"function",
"createFromImportedData",
"(",
"$",
"name",
",",
"$",
"data",
")",
"{",
"$",
"class",
"=",
"new",
"GroupClass",
"(",
"$",
"name",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"parameterName",
"=>",
"$",
"parameterData",
")",
... | Create GroupClass instance from imported data.
@param string $name
@param array $data
@return GroupClass | [
"Create",
"GroupClass",
"instance",
"from",
"imported",
"data",
"."
] | b1631bd936c6c6798076b51dfaebd706e1bdc8c2 | https://github.com/kambalabs/KmbDomain/blob/b1631bd936c6c6798076b51dfaebd706e1bdc8c2/src/KmbDomain/Service/GroupClassFactory.php#L37-L44 |
197,896 | pharmonic/container | src/Container.php | Container.get | public function get($id)
{
if ($id instanceof \Closure) {
return $id($this);
}
if (!$this->has($id)) {
$service = $this->factory->create($id, $this);
$this->repository->set($id, $service);
}
return $this->repository->get($id);
} | php | public function get($id)
{
if ($id instanceof \Closure) {
return $id($this);
}
if (!$this->has($id)) {
$service = $this->factory->create($id, $this);
$this->repository->set($id, $service);
}
return $this->repository->get($id);
} | [
"public",
"function",
"get",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"id",
"instanceof",
"\\",
"Closure",
")",
"{",
"return",
"$",
"id",
"(",
"$",
"this",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"id",
")",
")",
... | Get a service or params and create it first if it's not already defined.
@param int $id
@return mixed | [
"Get",
"a",
"service",
"or",
"params",
"and",
"create",
"it",
"first",
"if",
"it",
"s",
"not",
"already",
"defined",
"."
] | 100e6e1ab34d111da559fa50f40d5fef6dbb1ec3 | https://github.com/pharmonic/container/blob/100e6e1ab34d111da559fa50f40d5fef6dbb1ec3/src/Container.php#L30-L42 |
197,897 | pharmonic/container | src/Container.php | Container.set | public function set($id, $service)
{
if (!$this->has($id)) {
$this->repository->set($id, $service);
}
} | php | public function set($id, $service)
{
if (!$this->has($id)) {
$this->repository->set($id, $service);
}
} | [
"public",
"function",
"set",
"(",
"$",
"id",
",",
"$",
"service",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"repository",
"->",
"set",
"(",
"$",
"id",
",",
"$",
"service",
")",
";",
... | Bypass factory and register a service directly into repository.
@param string $id
@param mixed $service | [
"Bypass",
"factory",
"and",
"register",
"a",
"service",
"directly",
"into",
"repository",
"."
] | 100e6e1ab34d111da559fa50f40d5fef6dbb1ec3 | https://github.com/pharmonic/container/blob/100e6e1ab34d111da559fa50f40d5fef6dbb1ec3/src/Container.php#L61-L66 |
197,898 | koolkode/view-express | src/ExpressViewRenderer.php | ExpressViewRenderer.triggerContextBound | public function triggerContextBound(ExpressContext $context)
{
if($this->eventDispatcher)
{
$this->eventDispatcher->notify(new ExpressContextBoundEvent($context));
}
} | php | public function triggerContextBound(ExpressContext $context)
{
if($this->eventDispatcher)
{
$this->eventDispatcher->notify(new ExpressContextBoundEvent($context));
}
} | [
"public",
"function",
"triggerContextBound",
"(",
"ExpressContext",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"eventDispatcher",
")",
"{",
"$",
"this",
"->",
"eventDispatcher",
"->",
"notify",
"(",
"new",
"ExpressContextBoundEvent",
"(",
"$",
"co... | Trigger the context-bound event for the given context.
@param ExpressContext $context | [
"Trigger",
"the",
"context",
"-",
"bound",
"event",
"for",
"the",
"given",
"context",
"."
] | a8ebe6f373b6bfe8b8818d6264535e8fe063a596 | https://github.com/koolkode/view-express/blob/a8ebe6f373b6bfe8b8818d6264535e8fe063a596/src/ExpressViewRenderer.php#L105-L111 |
197,899 | koolkode/view-express | src/ExpressViewRenderer.php | ExpressViewRenderer.generateXmlSchemaBuilders | public function generateXmlSchemaBuilders()
{
$result = [];
foreach($this->helpers->findAll() as $key => $helper)
{
list($namespace, $name) = explode('>', $key, 2);
if(empty($result[$namespace]))
{
$result[$namespace] = new HelperXmlSchemaBuilder($namespace);
}
$result[$namespace]->... | php | public function generateXmlSchemaBuilders()
{
$result = [];
foreach($this->helpers->findAll() as $key => $helper)
{
list($namespace, $name) = explode('>', $key, 2);
if(empty($result[$namespace]))
{
$result[$namespace] = new HelperXmlSchemaBuilder($namespace);
}
$result[$namespace]->... | [
"public",
"function",
"generateXmlSchemaBuilders",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"helpers",
"->",
"findAll",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"helper",
")",
"{",
"list",
"(",
"$",
"namespac... | Generate XML-schema builders for each registered view helper namespace.
@return array<string, HelperXmlSchemaBuilder> | [
"Generate",
"XML",
"-",
"schema",
"builders",
"for",
"each",
"registered",
"view",
"helper",
"namespace",
"."
] | a8ebe6f373b6bfe8b8818d6264535e8fe063a596 | https://github.com/koolkode/view-express/blob/a8ebe6f373b6bfe8b8818d6264535e8fe063a596/src/ExpressViewRenderer.php#L165-L182 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.