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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
36,100 | yawik/install | src/Factory/Controller/Plugin/UserCreatorFactory.php | UserCreatorFactory.createDocumentManager | public function createDocumentManager($connection,$config)
{
$dbConn = new Connection($connection);
$dm = DocumentManager::create($dbConn,$config);
return $dm;
} | php | public function createDocumentManager($connection,$config)
{
$dbConn = new Connection($connection);
$dm = DocumentManager::create($dbConn,$config);
return $dm;
} | [
"public",
"function",
"createDocumentManager",
"(",
"$",
"connection",
",",
"$",
"config",
")",
"{",
"$",
"dbConn",
"=",
"new",
"Connection",
"(",
"$",
"connection",
")",
";",
"$",
"dm",
"=",
"DocumentManager",
"::",
"create",
"(",
"$",
"dbConn",
",",
"$... | Create a document manager
@param $connection
@param $config
@return DocumentManager
@codeCoverageIgnore | [
"Create",
"a",
"document",
"manager"
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Factory/Controller/Plugin/UserCreatorFactory.php#L67-L72 |
36,101 | yawik/install | src/Validator/MongoDbConnection.php | MongoDbConnection.isValid | public function isValid($value)
{
$this->databaseError = null;
// @codeCoverageIgnoreStart
// This cannot be testes until we have a test database environment.
try {
$connection = new Client($value);
$connection->listDatabases();
} catch (ConnectionTim... | php | public function isValid($value)
{
$this->databaseError = null;
// @codeCoverageIgnoreStart
// This cannot be testes until we have a test database environment.
try {
$connection = new Client($value);
$connection->listDatabases();
} catch (ConnectionTim... | [
"public",
"function",
"isValid",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"databaseError",
"=",
"null",
";",
"// @codeCoverageIgnoreStart",
"// This cannot be testes until we have a test database environment.",
"try",
"{",
"$",
"connection",
"=",
"new",
"Client",... | Returns true if and only if a mongodb connection can be established.
@param string $value The mongodb connection string
@return bool | [
"Returns",
"true",
"if",
"and",
"only",
"if",
"a",
"mongodb",
"connection",
"can",
"be",
"established",
"."
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Validator/MongoDbConnection.php#L72-L93 |
36,102 | eccube2/plugin-installer | src/Eccube2/Composer/Installers/Installer.php | Installer.getLocationPattern | protected function getLocationPattern($frameworkType)
{
$pattern = false;
if (!empty($this->supportedTypes[$frameworkType])) {
$frameworkClass = 'Eccube2\\Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
/** @var BaseInstaller $framework */
$framew... | php | protected function getLocationPattern($frameworkType)
{
$pattern = false;
if (!empty($this->supportedTypes[$frameworkType])) {
$frameworkClass = 'Eccube2\\Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
/** @var BaseInstaller $framework */
$framew... | [
"protected",
"function",
"getLocationPattern",
"(",
"$",
"frameworkType",
")",
"{",
"$",
"pattern",
"=",
"false",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"supportedTypes",
"[",
"$",
"frameworkType",
"]",
")",
")",
"{",
"$",
"frameworkClass",
... | Get the second part of the regular expression to check for support of a
package type
@param string $frameworkType
@return string | [
"Get",
"the",
"second",
"part",
"of",
"the",
"regular",
"expression",
"to",
"check",
"for",
"support",
"of",
"a",
"package",
"type"
] | 809e24b241410693f5f5e0a9d73c0633a1acfc7d | https://github.com/eccube2/plugin-installer/blob/809e24b241410693f5f5e0a9d73c0633a1acfc7d/src/Eccube2/Composer/Installers/Installer.php#L45-L57 |
36,103 | yawik/install | src/Controller/Index.php | Index.preDispatch | public function preDispatch(MvcEvent $event)
{
$this->layout()->setVariable('lang', $this->params('lang'));
$p = $this->params()->fromQuery('p');
$request = $this->getRequest();
if ($p && $request->isXmlHttpRequest()) {
$routeMatch = $event->getRouteMatch();
... | php | public function preDispatch(MvcEvent $event)
{
$this->layout()->setVariable('lang', $this->params('lang'));
$p = $this->params()->fromQuery('p');
$request = $this->getRequest();
if ($p && $request->isXmlHttpRequest()) {
$routeMatch = $event->getRouteMatch();
... | [
"public",
"function",
"preDispatch",
"(",
"MvcEvent",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"layout",
"(",
")",
"->",
"setVariable",
"(",
"'lang'",
",",
"$",
"this",
"->",
"params",
"(",
"'lang'",
")",
")",
";",
"$",
"p",
"=",
"$",
"this",
"->... | Hook for custom preDispatch event.
@param MvcEvent $event | [
"Hook",
"for",
"custom",
"preDispatch",
"event",
"."
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Controller/Index.php#L52-L67 |
36,104 | yawik/install | src/Controller/Index.php | Index.prereqAction | public function prereqAction()
{
$prereqs = $this->plugin('Install/Prerequisites')->check();
$model = $this->createViewModel(array('prerequisites' => $prereqs), true);
$model->setTemplate('install/index/prerequisites.ajax.phtml');
return $model;
} | php | public function prereqAction()
{
$prereqs = $this->plugin('Install/Prerequisites')->check();
$model = $this->createViewModel(array('prerequisites' => $prereqs), true);
$model->setTemplate('install/index/prerequisites.ajax.phtml');
return $model;
} | [
"public",
"function",
"prereqAction",
"(",
")",
"{",
"$",
"prereqs",
"=",
"$",
"this",
"->",
"plugin",
"(",
"'Install/Prerequisites'",
")",
"->",
"check",
"(",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"createViewModel",
"(",
"array",
"(",
"'prereq... | Action to check prerequisites via ajax request.
@return ViewModel|ResponseInterface | [
"Action",
"to",
"check",
"prerequisites",
"via",
"ajax",
"request",
"."
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Controller/Index.php#L99-L107 |
36,105 | yawik/install | src/Controller/Index.php | Index.installAction | public function installAction()
{
$form = $this->installForm;
$form->setData($_POST);
if (!$form->isValid()) {
return $this->createJsonResponse(
array(
'ok' => false,
'errors' => $form->getMessages(),
)
... | php | public function installAction()
{
$form = $this->installForm;
$form->setData($_POST);
if (!$form->isValid()) {
return $this->createJsonResponse(
array(
'ok' => false,
'errors' => $form->getMessages(),
)
... | [
"public",
"function",
"installAction",
"(",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"installForm",
";",
"$",
"form",
"->",
"setData",
"(",
"$",
"_POST",
")",
";",
"if",
"(",
"!",
"$",
"form",
"->",
"isValid",
"(",
")",
")",
"{",
"return",
... | Main working action. Creates the configuration.
@return ResponseInterface|ViewModel | [
"Main",
"working",
"action",
".",
"Creates",
"the",
"configuration",
"."
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Controller/Index.php#L114-L155 |
36,106 | yawik/install | src/Controller/Index.php | Index.createViewModel | protected function createViewModel(array $params, $terminal = false)
{
if (!isset($params['lang'])) {
$params['lang'] = $this->params('lang');
}
$model = new ViewModel($params);
$terminal && $model->setTerminal($terminal);
return $model;
} | php | protected function createViewModel(array $params, $terminal = false)
{
if (!isset($params['lang'])) {
$params['lang'] = $this->params('lang');
}
$model = new ViewModel($params);
$terminal && $model->setTerminal($terminal);
return $model;
} | [
"protected",
"function",
"createViewModel",
"(",
"array",
"$",
"params",
",",
"$",
"terminal",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"params",
"[",
"'lang'",
"]",
")",
")",
"{",
"$",
"params",
"[",
"'lang'",
"]",
"=",
"$",
"thi... | Creates a view model
@param array $params
@param bool $terminal
@return ViewModel | [
"Creates",
"a",
"view",
"model"
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Controller/Index.php#L176-L187 |
36,107 | yawik/install | src/Controller/Index.php | Index.createJsonResponse | protected function createJsonResponse(array $variables)
{
$response = $this->getResponse();
$json = Json::encode($variables);
$response->setContent($json);
return $response;
} | php | protected function createJsonResponse(array $variables)
{
$response = $this->getResponse();
$json = Json::encode($variables);
$response->setContent($json);
return $response;
} | [
"protected",
"function",
"createJsonResponse",
"(",
"array",
"$",
"variables",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getResponse",
"(",
")",
";",
"$",
"json",
"=",
"Json",
"::",
"encode",
"(",
"$",
"variables",
")",
";",
"$",
"response",
... | Create a json response object for ajax requests.
@param array $variables
@return \Zend\Stdlib\ResponseInterface | [
"Create",
"a",
"json",
"response",
"object",
"for",
"ajax",
"requests",
"."
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Controller/Index.php#L196-L203 |
36,108 | systemson/cache | src/Driver/Base/FileCache.php | FileCache.filesystem | public function filesystem(string $path = null)
{
if (!$this->filesystem instanceof Filesystem) {
$local = new Local($path);
$this->filesystem = new Filesystem($local);
}
return $this->filesystem;
} | php | public function filesystem(string $path = null)
{
if (!$this->filesystem instanceof Filesystem) {
$local = new Local($path);
$this->filesystem = new Filesystem($local);
}
return $this->filesystem;
} | [
"public",
"function",
"filesystem",
"(",
"string",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"filesystem",
"instanceof",
"Filesystem",
")",
"{",
"$",
"local",
"=",
"new",
"Local",
"(",
"$",
"path",
")",
";",
"$",
"this",
... | Gets a Filesystem instance.
@return instance Filesystem | [
"Gets",
"a",
"Filesystem",
"instance",
"."
] | a85de2648fe8c1f73be6cfdcea4d1ee27e42f15c | https://github.com/systemson/cache/blob/a85de2648fe8c1f73be6cfdcea4d1ee27e42f15c/src/Driver/Base/FileCache.php#L37-L46 |
36,109 | systemson/cache | src/Driver/Base/FileCache.php | FileCache.clear | public function clear()
{
foreach ($this->filesystem()->listContents() as $file) {
$this->filesystem()->delete($file['path']);
}
return true;
} | php | public function clear()
{
foreach ($this->filesystem()->listContents() as $file) {
$this->filesystem()->delete($file['path']);
}
return true;
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"filesystem",
"(",
")",
"->",
"listContents",
"(",
")",
"as",
"$",
"file",
")",
"{",
"$",
"this",
"->",
"filesystem",
"(",
")",
"->",
"delete",
"(",
"$",
"file",
"[",
... | Deletes the cache folder.
@return bool True on success and false on failure. | [
"Deletes",
"the",
"cache",
"folder",
"."
] | a85de2648fe8c1f73be6cfdcea4d1ee27e42f15c | https://github.com/systemson/cache/blob/a85de2648fe8c1f73be6cfdcea4d1ee27e42f15c/src/Driver/Base/FileCache.php#L129-L136 |
36,110 | systemson/cache | src/Driver/Base/FileCache.php | FileCache.has | public function has($key)
{
/* If $key is not valid string throws InvalidArgumentException */
if (!$this->isString($key)) {
throw new InvalidArgumentException('Cache key must be not empty string');
}
if ($this->getRaw($key)) {
return true;
}
... | php | public function has($key)
{
/* If $key is not valid string throws InvalidArgumentException */
if (!$this->isString($key)) {
throw new InvalidArgumentException('Cache key must be not empty string');
}
if ($this->getRaw($key)) {
return true;
}
... | [
"public",
"function",
"has",
"(",
"$",
"key",
")",
"{",
"/* If $key is not valid string throws InvalidArgumentException */",
"if",
"(",
"!",
"$",
"this",
"->",
"isString",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Cache key... | Whether an item is present in the cache.
@param string $key The cache item key.
@throws \Psr\SimpleCache\InvalidArgumentException
@return bool | [
"Whether",
"an",
"item",
"is",
"present",
"in",
"the",
"cache",
"."
] | a85de2648fe8c1f73be6cfdcea4d1ee27e42f15c | https://github.com/systemson/cache/blob/a85de2648fe8c1f73be6cfdcea4d1ee27e42f15c/src/Driver/Base/FileCache.php#L147-L159 |
36,111 | systemson/cache | src/Driver/Base/FileCache.php | FileCache.getCachedItem | public function getCachedItem($key)
{
$path = sha1($key);
if ($this->filesystem()->has($path)) {
$item = explode(PHP_EOL, $this->filesystem()->read($path), 2);
return new CacheItemClass($key, $item[1] ?? null, $item[0] ?? null);
}
} | php | public function getCachedItem($key)
{
$path = sha1($key);
if ($this->filesystem()->has($path)) {
$item = explode(PHP_EOL, $this->filesystem()->read($path), 2);
return new CacheItemClass($key, $item[1] ?? null, $item[0] ?? null);
}
} | [
"public",
"function",
"getCachedItem",
"(",
"$",
"key",
")",
"{",
"$",
"path",
"=",
"sha1",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"this",
"->",
"filesystem",
"(",
")",
"->",
"has",
"(",
"$",
"path",
")",
")",
"{",
"$",
"item",
"=",
"explod... | Returns a CacheItemClass for the.
@param string $key The cache item key.
@throws \Psr\SimpleCache\InvalidArgumentException
@return CacheItemInterface | [
"Returns",
"a",
"CacheItemClass",
"for",
"the",
"."
] | a85de2648fe8c1f73be6cfdcea4d1ee27e42f15c | https://github.com/systemson/cache/blob/a85de2648fe8c1f73be6cfdcea4d1ee27e42f15c/src/Driver/Base/FileCache.php#L170-L179 |
36,112 | systemson/cache | src/Driver/Base/FileCache.php | FileCache.isExpired | public function isExpired(CacheItemInterface $item)
{
if ($item->isExpired()) {
$this->delete($item->getKey());
return true;
}
return false;
} | php | public function isExpired(CacheItemInterface $item)
{
if ($item->isExpired()) {
$this->delete($item->getKey());
return true;
}
return false;
} | [
"public",
"function",
"isExpired",
"(",
"CacheItemInterface",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"item",
"->",
"isExpired",
"(",
")",
")",
"{",
"$",
"this",
"->",
"delete",
"(",
"$",
"item",
"->",
"getKey",
"(",
")",
")",
";",
"return",
"true",
... | Whether an item from the cache is expired. If it does, deletes it from the file system.
@param CacheItemInterface $item The item to evaluate.
@return | [
"Whether",
"an",
"item",
"from",
"the",
"cache",
"is",
"expired",
".",
"If",
"it",
"does",
"deletes",
"it",
"from",
"the",
"file",
"system",
"."
] | a85de2648fe8c1f73be6cfdcea4d1ee27e42f15c | https://github.com/systemson/cache/blob/a85de2648fe8c1f73be6cfdcea4d1ee27e42f15c/src/Driver/Base/FileCache.php#L188-L197 |
36,113 | yawik/install | src/Controller/Plugin/Prerequisites.php | Prerequisites.check | public function check($directories = null)
{
null == $directories && $directories = $this->directories;
$return = array();
$valid = true;
foreach ($directories as $path => $validationSpec) {
$result = $this->checkDirectory($path, $validationSpec);
... | php | public function check($directories = null)
{
null == $directories && $directories = $this->directories;
$return = array();
$valid = true;
foreach ($directories as $path => $validationSpec) {
$result = $this->checkDirectory($path, $validationSpec);
... | [
"public",
"function",
"check",
"(",
"$",
"directories",
"=",
"null",
")",
"{",
"null",
"==",
"$",
"directories",
"&&",
"$",
"directories",
"=",
"$",
"this",
"->",
"directories",
";",
"$",
"return",
"=",
"array",
"(",
")",
";",
"$",
"valid",
"=",
"tru... | Checks directories.
Calls {@link checkDirectory()} for each directory in the array.
Checks, if all directories has passed as valid according to the specs.
@param null|array $directories
@return array | [
"Checks",
"directories",
"."
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Controller/Plugin/Prerequisites.php#L63-L77 |
36,114 | yawik/install | src/Controller/Plugin/Prerequisites.php | Prerequisites.checkDirectory | public function checkDirectory($dir, $validationSpec)
{
$exists = file_exists($dir);
$writable = $exists && is_writable($dir);
$missing = !$exists;
$creatable = $missing && is_writable(dirname($dir));
$return = array(
'exists' => $exists,
'wr... | php | public function checkDirectory($dir, $validationSpec)
{
$exists = file_exists($dir);
$writable = $exists && is_writable($dir);
$missing = !$exists;
$creatable = $missing && is_writable(dirname($dir));
$return = array(
'exists' => $exists,
'wr... | [
"public",
"function",
"checkDirectory",
"(",
"$",
"dir",
",",
"$",
"validationSpec",
")",
"{",
"$",
"exists",
"=",
"file_exists",
"(",
"$",
"dir",
")",
";",
"$",
"writable",
"=",
"$",
"exists",
"&&",
"is_writable",
"(",
"$",
"dir",
")",
";",
"$",
"mi... | Checks a directory.
@param string $dir
@param string $validationSpec
@return array | [
"Checks",
"a",
"directory",
"."
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Controller/Plugin/Prerequisites.php#L87-L104 |
36,115 | yawik/install | src/Controller/Plugin/Prerequisites.php | Prerequisites.validateDirectory | public function validateDirectory($result, $spec)
{
$spec = explode('|', $spec);
$valid = false;
foreach ($spec as $s) {
if (isset($result[$s]) && $result[$s]) {
$valid = true;
break;
}
}
return $valid;
} | php | public function validateDirectory($result, $spec)
{
$spec = explode('|', $spec);
$valid = false;
foreach ($spec as $s) {
if (isset($result[$s]) && $result[$s]) {
$valid = true;
break;
}
}
return $valid;
} | [
"public",
"function",
"validateDirectory",
"(",
"$",
"result",
",",
"$",
"spec",
")",
"{",
"$",
"spec",
"=",
"explode",
"(",
"'|'",
",",
"$",
"spec",
")",
";",
"$",
"valid",
"=",
"false",
";",
"foreach",
"(",
"$",
"spec",
"as",
"$",
"s",
")",
"{"... | Validates a directory according to the spec
@param array $result
@param string $spec
@return bool | [
"Validates",
"a",
"directory",
"according",
"to",
"the",
"spec"
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Controller/Plugin/Prerequisites.php#L114-L127 |
36,116 | n2n/n2n-web | src/app/n2n/web/http/Response.php | Response.serverPush | public function serverPush(ServerPushDirective $directive) {
if ($this->request->getProtocolVersion()->getMajorNum() < 2) {
return;
}
$this->setHeader($directive->toHeader());
} | php | public function serverPush(ServerPushDirective $directive) {
if ($this->request->getProtocolVersion()->getMajorNum() < 2) {
return;
}
$this->setHeader($directive->toHeader());
} | [
"public",
"function",
"serverPush",
"(",
"ServerPushDirective",
"$",
"directive",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"request",
"->",
"getProtocolVersion",
"(",
")",
"->",
"getMajorNum",
"(",
")",
"<",
"2",
")",
"{",
"return",
";",
"}",
"$",
"this",... | Server push will be ignored if HTTP version of request is lower than 2 or if sever push is disabled in app.ini
@param ServerPushDirective $directive | [
"Server",
"push",
"will",
"be",
"ignored",
"if",
"HTTP",
"version",
"of",
"request",
"is",
"lower",
"than",
"2",
"or",
"if",
"sever",
"push",
"is",
"disabled",
"in",
"app",
".",
"ini"
] | 1640c79f05d10d73093b98b70860ef8076d23e81 | https://github.com/n2n/n2n-web/blob/1640c79f05d10d73093b98b70860ef8076d23e81/src/app/n2n/web/http/Response.php#L493-L499 |
36,117 | yawik/install | src/Listener/LanguageSetter.php | LanguageSetter.onRoute | public function onRoute(MvcEvent $e)
{
/* @var $request \Zend\Http\PhpEnvironment\Request */
$request = $e->getRequest();
/* Detect language */
$lang = $request->getQuery('lang');
if (!$lang) {
$headers = $request->getHeaders();
if ($headers->has('Ac... | php | public function onRoute(MvcEvent $e)
{
/* @var $request \Zend\Http\PhpEnvironment\Request */
$request = $e->getRequest();
/* Detect language */
$lang = $request->getQuery('lang');
if (!$lang) {
$headers = $request->getHeaders();
if ($headers->has('Ac... | [
"public",
"function",
"onRoute",
"(",
"MvcEvent",
"$",
"e",
")",
"{",
"/* @var $request \\Zend\\Http\\PhpEnvironment\\Request */",
"$",
"request",
"=",
"$",
"e",
"->",
"getRequest",
"(",
")",
";",
"/* Detect language */",
"$",
"lang",
"=",
"$",
"request",
"->",
... | Listens to the route event.
Detects the language to use and sets translator locale.
The language is detected either via query parameter "lang" or
browser setting (ACCEPT-LANGUAGE header)
@param MvcEvent $e | [
"Listens",
"to",
"the",
"route",
"event",
"."
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Listener/LanguageSetter.php#L59-L106 |
36,118 | systemson/cache | src/Driver/ApcuCache.php | ApcuCache.isCli | public static function isCli()
{
if (defined('STDIN')) {
return true;
}
if (php_sapi_name() === 'cli') {
return true;
}
if (array_key_exists('SHELL', $_ENV)) {
return true;
}
if (empty($_SERVER['REMOTE_ADDR']) and !isset(... | php | public static function isCli()
{
if (defined('STDIN')) {
return true;
}
if (php_sapi_name() === 'cli') {
return true;
}
if (array_key_exists('SHELL', $_ENV)) {
return true;
}
if (empty($_SERVER['REMOTE_ADDR']) and !isset(... | [
"public",
"static",
"function",
"isCli",
"(",
")",
"{",
"if",
"(",
"defined",
"(",
"'STDIN'",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"php_sapi_name",
"(",
")",
"===",
"'cli'",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"array_k... | Determines whether the script is being run on the CLI.
@todo This method MUST be move to a helper.
@return bool | [
"Determines",
"whether",
"the",
"script",
"is",
"being",
"run",
"on",
"the",
"CLI",
"."
] | a85de2648fe8c1f73be6cfdcea4d1ee27e42f15c | https://github.com/systemson/cache/blob/a85de2648fe8c1f73be6cfdcea4d1ee27e42f15c/src/Driver/ApcuCache.php#L130-L153 |
36,119 | yawik/install | src/Controller/Plugin/YawikConfigCreator.php | YawikConfigCreator.process | public function process($dbConn, $email)
{
// extract database
$dbName = $this->dbNameExctractor->filter($dbConn);
$config = array(
'doctrine' => array(
'connection' => array(
'odm_default' => array(
'connectionStrin... | php | public function process($dbConn, $email)
{
// extract database
$dbName = $this->dbNameExctractor->filter($dbConn);
$config = array(
'doctrine' => array(
'connection' => array(
'odm_default' => array(
'connectionStrin... | [
"public",
"function",
"process",
"(",
"$",
"dbConn",
",",
"$",
"email",
")",
"{",
"// extract database",
"$",
"dbName",
"=",
"$",
"this",
"->",
"dbNameExctractor",
"->",
"filter",
"(",
"$",
"dbConn",
")",
";",
"$",
"config",
"=",
"array",
"(",
"'doctrine... | Generates a configuration file.
@param string $dbConn
@param string $email
@return bool|string | [
"Generates",
"a",
"configuration",
"file",
"."
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Controller/Plugin/YawikConfigCreator.php#L52-L80 |
36,120 | yawik/install | src/Controller/Plugin/YawikConfigCreator.php | YawikConfigCreator.generateConfigContent | protected function generateConfigContent(array $config)
{
/* This code is taken from ZF2s' classmap_generator.php script. */
// Create a file with the class/file map.
// Stupid syntax highlighters make separating < from PHP declaration necessary
$content = '<' . "?php\n"
... | php | protected function generateConfigContent(array $config)
{
/* This code is taken from ZF2s' classmap_generator.php script. */
// Create a file with the class/file map.
// Stupid syntax highlighters make separating < from PHP declaration necessary
$content = '<' . "?php\n"
... | [
"protected",
"function",
"generateConfigContent",
"(",
"array",
"$",
"config",
")",
"{",
"/* This code is taken from ZF2s' classmap_generator.php script. */",
"// Create a file with the class/file map.",
"// Stupid syntax highlighters make separating < from PHP declaration necessary",
"$",
... | Generates the content for the configuration file.
@param array $config
@return string | [
"Generates",
"the",
"content",
"for",
"the",
"configuration",
"file",
"."
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Controller/Plugin/YawikConfigCreator.php#L89-L115 |
36,121 | yawik/install | src/Controller/Plugin/YawikConfigCreator.php | YawikConfigCreator.writeConfigFile | protected function writeConfigFile($content)
{
if (!is_writable('config/autoload')) {
return false;
}
$file = 'config/autoload/yawik.config.global.php';
// need to chmod 777 to be usable by docker and local environment
@touch($file);
@chmod($file, 0777);
... | php | protected function writeConfigFile($content)
{
if (!is_writable('config/autoload')) {
return false;
}
$file = 'config/autoload/yawik.config.global.php';
// need to chmod 777 to be usable by docker and local environment
@touch($file);
@chmod($file, 0777);
... | [
"protected",
"function",
"writeConfigFile",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"!",
"is_writable",
"(",
"'config/autoload'",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"file",
"=",
"'config/autoload/yawik.config.global.php'",
";",
"// need to chmod 77... | Writes the configuration content in a file.
Returns false, if file cannot be created.
@param string $content
@return bool | [
"Writes",
"the",
"configuration",
"content",
"in",
"a",
"file",
"."
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Controller/Plugin/YawikConfigCreator.php#L126-L137 |
36,122 | elgentos/parser | src/Parser/StoryMetrics.php | StoryMetrics.addStories | public function addStories(Story ...$stories): void
{
\array_walk($stories, function ($story) {
$this->stories[] = $story;
$this->storyCount++;
});
} | php | public function addStories(Story ...$stories): void
{
\array_walk($stories, function ($story) {
$this->stories[] = $story;
$this->storyCount++;
});
} | [
"public",
"function",
"addStories",
"(",
"Story",
"...",
"$",
"stories",
")",
":",
"void",
"{",
"\\",
"array_walk",
"(",
"$",
"stories",
",",
"function",
"(",
"$",
"story",
")",
"{",
"$",
"this",
"->",
"stories",
"[",
"]",
"=",
"$",
"story",
";",
"... | Add story to book
@param []Story ...$stories | [
"Add",
"story",
"to",
"book"
] | 3580a4f55c725123eab643628d1fc3d5dd0968b3 | https://github.com/elgentos/parser/blob/3580a4f55c725123eab643628d1fc3d5dd0968b3/src/Parser/StoryMetrics.php#L26-L32 |
36,123 | elgentos/parser | src/Parser/StoryMetrics.php | StoryMetrics.createStory | public function createStory(string $name, RuleInterface ...$rules): Story
{
$story = new Story($name, ...$rules);
$this->addStories($story);
return $story;
} | php | public function createStory(string $name, RuleInterface ...$rules): Story
{
$story = new Story($name, ...$rules);
$this->addStories($story);
return $story;
} | [
"public",
"function",
"createStory",
"(",
"string",
"$",
"name",
",",
"RuleInterface",
"...",
"$",
"rules",
")",
":",
"Story",
"{",
"$",
"story",
"=",
"new",
"Story",
"(",
"$",
"name",
",",
"...",
"$",
"rules",
")",
";",
"$",
"this",
"->",
"addStorie... | Create a story from rules and add to book
@param string $name
@param RuleInterface ...$rules
@return Story | [
"Create",
"a",
"story",
"from",
"rules",
"and",
"add",
"to",
"book"
] | 3580a4f55c725123eab643628d1fc3d5dd0968b3 | https://github.com/elgentos/parser/blob/3580a4f55c725123eab643628d1fc3d5dd0968b3/src/Parser/StoryMetrics.php#L41-L47 |
36,124 | elgentos/parser | src/Parser/StoryMetrics.php | StoryMetrics.getStoriesSortedByName | private function getStoriesSortedByName(): array
{
$stories = $this->stories;
\usort($stories, function(Story $storyA, Story $storyB) {
return $storyA->getName() <=> $storyB->getName();
});
return $stories;
} | php | private function getStoriesSortedByName(): array
{
$stories = $this->stories;
\usort($stories, function(Story $storyA, Story $storyB) {
return $storyA->getName() <=> $storyB->getName();
});
return $stories;
} | [
"private",
"function",
"getStoriesSortedByName",
"(",
")",
":",
"array",
"{",
"$",
"stories",
"=",
"$",
"this",
"->",
"stories",
";",
"\\",
"usort",
"(",
"$",
"stories",
",",
"function",
"(",
"Story",
"$",
"storyA",
",",
"Story",
"$",
"storyB",
")",
"{... | Sort stories by name
@return array | [
"Sort",
"stories",
"by",
"name"
] | 3580a4f55c725123eab643628d1fc3d5dd0968b3 | https://github.com/elgentos/parser/blob/3580a4f55c725123eab643628d1fc3d5dd0968b3/src/Parser/StoryMetrics.php#L130-L138 |
36,125 | elgentos/parser | src/Parser.php | Parser.readFile | public static function readFile(string $filename, string $rootDir = '.', ParserInterface $parser = null): array
{
$data = ['@import' => $filename];
$story = new Complex($rootDir);
$parser = $parser ?? new Standard;
$parser->parse($data, $story);
return $data;
} | php | public static function readFile(string $filename, string $rootDir = '.', ParserInterface $parser = null): array
{
$data = ['@import' => $filename];
$story = new Complex($rootDir);
$parser = $parser ?? new Standard;
$parser->parse($data, $story);
return $data;
} | [
"public",
"static",
"function",
"readFile",
"(",
"string",
"$",
"filename",
",",
"string",
"$",
"rootDir",
"=",
"'.'",
",",
"ParserInterface",
"$",
"parser",
"=",
"null",
")",
":",
"array",
"{",
"$",
"data",
"=",
"[",
"'@import'",
"=>",
"$",
"filename",
... | Read a file in a given basedir
defaults to current workdir
optional, give a own parser if you want to debug
@param string $filename
@param string $rootDir
@param ParserInterface|null $parser
@return array | [
"Read",
"a",
"file",
"in",
"a",
"given",
"basedir",
"defaults",
"to",
"current",
"workdir"
] | 3580a4f55c725123eab643628d1fc3d5dd0968b3 | https://github.com/elgentos/parser/blob/3580a4f55c725123eab643628d1fc3d5dd0968b3/src/Parser.php#L33-L42 |
36,126 | elgentos/parser | src/Parser.php | Parser.readSimple | public static function readSimple(string $filename, string $rootDir = '.', ParserInterface $parser = null): array
{
$data = ['@import' => $filename];
$story = new Simple($rootDir);
$parser = $parser ?? new Standard;
$parser->parse($data, $story);
return $data;
} | php | public static function readSimple(string $filename, string $rootDir = '.', ParserInterface $parser = null): array
{
$data = ['@import' => $filename];
$story = new Simple($rootDir);
$parser = $parser ?? new Standard;
$parser->parse($data, $story);
return $data;
} | [
"public",
"static",
"function",
"readSimple",
"(",
"string",
"$",
"filename",
",",
"string",
"$",
"rootDir",
"=",
"'.'",
",",
"ParserInterface",
"$",
"parser",
"=",
"null",
")",
":",
"array",
"{",
"$",
"data",
"=",
"[",
"'@import'",
"=>",
"$",
"filename"... | Read a file without recursion
@param string $filename
@param string $rootDir
@param ParserInterface|null $parser
@return array | [
"Read",
"a",
"file",
"without",
"recursion"
] | 3580a4f55c725123eab643628d1fc3d5dd0968b3 | https://github.com/elgentos/parser/blob/3580a4f55c725123eab643628d1fc3d5dd0968b3/src/Parser.php#L52-L61 |
36,127 | elgentos/parser | src/Parser/Rule/FileAbstract.php | FileAbstract.safePath | private function safePath(string $path): string
{
while (($newPath = \str_replace('..', '', $path)) !== $path) {
$path = $newPath;
}
return $path;
} | php | private function safePath(string $path): string
{
while (($newPath = \str_replace('..', '', $path)) !== $path) {
$path = $newPath;
}
return $path;
} | [
"private",
"function",
"safePath",
"(",
"string",
"$",
"path",
")",
":",
"string",
"{",
"while",
"(",
"(",
"$",
"newPath",
"=",
"\\",
"str_replace",
"(",
"'..'",
",",
"''",
",",
"$",
"path",
")",
")",
"!==",
"$",
"path",
")",
"{",
"$",
"path",
"=... | Filter nasty strings from path
@param string $path
@return string | [
"Filter",
"nasty",
"strings",
"from",
"path"
] | 3580a4f55c725123eab643628d1fc3d5dd0968b3 | https://github.com/elgentos/parser/blob/3580a4f55c725123eab643628d1fc3d5dd0968b3/src/Parser/Rule/FileAbstract.php#L22-L29 |
36,128 | elgentos/parser | src/Parser/Rule/MergeDown.php | MergeDown.niceMerge | private function niceMerge(array &$source, array &$destination): array
{
$merged = $source;
foreach ($destination as $key => &$value) {
if (
$this->mergeRecursive &&
isset($merged[$key]) &&
is_array($merged[$key])
)... | php | private function niceMerge(array &$source, array &$destination): array
{
$merged = $source;
foreach ($destination as $key => &$value) {
if (
$this->mergeRecursive &&
isset($merged[$key]) &&
is_array($merged[$key])
)... | [
"private",
"function",
"niceMerge",
"(",
"array",
"&",
"$",
"source",
",",
"array",
"&",
"$",
"destination",
")",
":",
"array",
"{",
"$",
"merged",
"=",
"$",
"source",
";",
"foreach",
"(",
"$",
"destination",
"as",
"$",
"key",
"=>",
"&",
"$",
"value"... | Recursive nice merge
@param array $source
@param array $destination
@return array | [
"Recursive",
"nice",
"merge"
] | 3580a4f55c725123eab643628d1fc3d5dd0968b3 | https://github.com/elgentos/parser/blob/3580a4f55c725123eab643628d1fc3d5dd0968b3/src/Parser/Rule/MergeDown.php#L65-L83 |
36,129 | KnpLabs/KnpPiwikBundle | DependencyInjection/KnpPiwikExtension.php | KnpPiwikExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
if (!$container->hasDefinition('piwik.client')) {
$loader->load('piwik.xml');
}
$config = $this->mergeConfigs($c... | php | public function load(array $configs, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
if (!$container->hasDefinition('piwik.client')) {
$loader->load('piwik.xml');
}
$config = $this->mergeConfigs($c... | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"loader",
"=",
"new",
"XmlFileLoader",
"(",
"$",
"container",
",",
"new",
"FileLocator",
"(",
"__DIR__",
".",
"'/../Resources/config'",
")",
... | Loads the piwik configuration.
@param array $config An array of configuration settings
@param \Symfony\Component\DependencyInjection\ContainerBuilder $container A ContainerBuilder instance | [
"Loads",
"the",
"piwik",
"configuration",
"."
] | e905ed745237fb6fc71175a5b571b771b97b3f7f | https://github.com/KnpLabs/KnpPiwikBundle/blob/e905ed745237fb6fc71175a5b571b771b97b3f7f/DependencyInjection/KnpPiwikExtension.php#L28-L56 |
36,130 | KnpLabs/KnpPiwikBundle | DependencyInjection/KnpPiwikExtension.php | KnpPiwikExtension.mergeConfigs | protected function mergeConfigs(array $configs)
{
$merged = array();
foreach ($configs as $config) {
$merged = array_merge($merged, $config);
}
return $merged;
} | php | protected function mergeConfigs(array $configs)
{
$merged = array();
foreach ($configs as $config) {
$merged = array_merge($merged, $config);
}
return $merged;
} | [
"protected",
"function",
"mergeConfigs",
"(",
"array",
"$",
"configs",
")",
"{",
"$",
"merged",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"configs",
"as",
"$",
"config",
")",
"{",
"$",
"merged",
"=",
"array_merge",
"(",
"$",
"merged",
",",
"$... | Merges the given configurations array
@param array $config
@return array | [
"Merges",
"the",
"given",
"configurations",
"array"
] | e905ed745237fb6fc71175a5b571b771b97b3f7f | https://github.com/KnpLabs/KnpPiwikBundle/blob/e905ed745237fb6fc71175a5b571b771b97b3f7f/DependencyInjection/KnpPiwikExtension.php#L65-L73 |
36,131 | matthiasnoback/phpunit-asynchronicity | src/Asynchronicity/Polling/Poller.php | Poller.poll | public function poll(callable $probe, Timeout $timeout): void
{
$timeout->start();
$lastException = null;
while (true) {
try {
$probe();
// the probe was successful, so we can return now
return;
} catch (Exception $exc... | php | public function poll(callable $probe, Timeout $timeout): void
{
$timeout->start();
$lastException = null;
while (true) {
try {
$probe();
// the probe was successful, so we can return now
return;
} catch (Exception $exc... | [
"public",
"function",
"poll",
"(",
"callable",
"$",
"probe",
",",
"Timeout",
"$",
"timeout",
")",
":",
"void",
"{",
"$",
"timeout",
"->",
"start",
"(",
")",
";",
"$",
"lastException",
"=",
"null",
";",
"while",
"(",
"true",
")",
"{",
"try",
"{",
"$... | Invoke the provided callable until it doesn't throw an exception anymore, or a timeout occurs. The poller will wait before invoking the
callable again.
@param callable $probe
@param Timeout $timeout | [
"Invoke",
"the",
"provided",
"callable",
"until",
"it",
"doesn",
"t",
"throw",
"an",
"exception",
"anymore",
"or",
"a",
"timeout",
"occurs",
".",
"The",
"poller",
"will",
"wait",
"before",
"invoking",
"the",
"callable",
"again",
"."
] | b7f7ff4485de7d569be18e4343855c1fcbe05c14 | https://github.com/matthiasnoback/phpunit-asynchronicity/blob/b7f7ff4485de7d569be18e4343855c1fcbe05c14/src/Asynchronicity/Polling/Poller.php#L17-L40 |
36,132 | KnpLabs/PiwikClient | src/Knp/PiwikClient/Client.php | Client.call | public function call($method, array $params = array(), $format = 'php')
{
$params['method'] = $method;
$params['token_auth'] = $this->token;
$params['format'] = $format;
$data = $this->getConnection()->send($params);
if ('php' === $format) {
$objec... | php | public function call($method, array $params = array(), $format = 'php')
{
$params['method'] = $method;
$params['token_auth'] = $this->token;
$params['format'] = $format;
$data = $this->getConnection()->send($params);
if ('php' === $format) {
$objec... | [
"public",
"function",
"call",
"(",
"$",
"method",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"format",
"=",
"'php'",
")",
"{",
"$",
"params",
"[",
"'method'",
"]",
"=",
"$",
"method",
";",
"$",
"params",
"[",
"'token_auth'",
"]"... | Call specific method & return it's response.
@param string $method method name
@param array $params method parameters
@param string $format return format (php, json, xml, csv, tsv, html, rss)
@return mixed | [
"Call",
"specific",
"method",
"&",
"return",
"it",
"s",
"response",
"."
] | 853f427b7506141477dc2a699945be1473baa8d3 | https://github.com/KnpLabs/PiwikClient/blob/853f427b7506141477dc2a699945be1473baa8d3/src/Knp/PiwikClient/Client.php#L49-L68 |
36,133 | KnpLabs/PiwikClient | src/Knp/PiwikClient/Connection/PiwikConnection.php | PiwikConnection.convertParamsToQuery | protected function convertParamsToQuery(array $params)
{
$query = array();
foreach ($params as $key => $val) {
if (is_array($val)) {
$val = implode(',', $val);
} elseif ($val instanceof \DateTime) {
$val = $val->format('Y-m-d');
} ... | php | protected function convertParamsToQuery(array $params)
{
$query = array();
foreach ($params as $key => $val) {
if (is_array($val)) {
$val = implode(',', $val);
} elseif ($val instanceof \DateTime) {
$val = $val->format('Y-m-d');
} ... | [
"protected",
"function",
"convertParamsToQuery",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"query",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"val",
... | Convert hash of parameters to query string.
@param array $params hash
@return string query string | [
"Convert",
"hash",
"of",
"parameters",
"to",
"query",
"string",
"."
] | 853f427b7506141477dc2a699945be1473baa8d3 | https://github.com/KnpLabs/PiwikClient/blob/853f427b7506141477dc2a699945be1473baa8d3/src/Knp/PiwikClient/Connection/PiwikConnection.php#L47-L69 |
36,134 | fillup/walmart-partner-api-sdk-php | src/mock/MockResponse.php | MockResponse.getResourceTypeFromUrl | public static function getResourceTypeFromUrl($url)
{
$matchFound = preg_match('/\/v[23]\/(\w+)[\/?]?/', $url, $matches);
if( ! $matchFound || ! is_array($matches) || ! isset($matches[1])) {
throw new \Exception('Unable to find resource type in url', 1462733277);
}
if ($... | php | public static function getResourceTypeFromUrl($url)
{
$matchFound = preg_match('/\/v[23]\/(\w+)[\/?]?/', $url, $matches);
if( ! $matchFound || ! is_array($matches) || ! isset($matches[1])) {
throw new \Exception('Unable to find resource type in url', 1462733277);
}
if ($... | [
"public",
"static",
"function",
"getResourceTypeFromUrl",
"(",
"$",
"url",
")",
"{",
"$",
"matchFound",
"=",
"preg_match",
"(",
"'/\\/v[23]\\/(\\w+)[\\/?]?/'",
",",
"$",
"url",
",",
"$",
"matches",
")",
";",
"if",
"(",
"!",
"$",
"matchFound",
"||",
"!",
"i... | Parse resource type out of url
@param string $url
@return string
@throws \Exception | [
"Parse",
"resource",
"type",
"out",
"of",
"url"
] | 8344dc8e7580364a6ad9ce6f3cf8f050e0a463c7 | https://github.com/fillup/walmart-partner-api-sdk-php/blob/8344dc8e7580364a6ad9ce6f3cf8f050e0a463c7/src/mock/MockResponse.php#L94-L108 |
36,135 | fillup/walmart-partner-api-sdk-php | src/mock/MockResponse.php | MockResponse.getPath | public static function getPath($url)
{
$matchFound = preg_match('/(\/v[23]\/.*$)/', $url, $matches);
if( ! $matchFound || ! is_array($matches) || ! isset($matches[1])) {
throw new \Exception('Unable to parse url path', 1462733286);
}
return $matches[1];
} | php | public static function getPath($url)
{
$matchFound = preg_match('/(\/v[23]\/.*$)/', $url, $matches);
if( ! $matchFound || ! is_array($matches) || ! isset($matches[1])) {
throw new \Exception('Unable to parse url path', 1462733286);
}
return $matches[1];
} | [
"public",
"static",
"function",
"getPath",
"(",
"$",
"url",
")",
"{",
"$",
"matchFound",
"=",
"preg_match",
"(",
"'/(\\/v[23]\\/.*$)/'",
",",
"$",
"url",
",",
"$",
"matches",
")",
";",
"if",
"(",
"!",
"$",
"matchFound",
"||",
"!",
"is_array",
"(",
"$",... | Parse request path out of url
@param string $url
@return string
@throws \Exception | [
"Parse",
"request",
"path",
"out",
"of",
"url"
] | 8344dc8e7580364a6ad9ce6f3cf8f050e0a463c7 | https://github.com/fillup/walmart-partner-api-sdk-php/blob/8344dc8e7580364a6ad9ce6f3cf8f050e0a463c7/src/mock/MockResponse.php#L116-L124 |
36,136 | fillup/walmart-partner-api-sdk-php | src/BaseClient.php | BaseClient.getEnvBaseUrl | public function getEnvBaseUrl($env)
{
switch ($env) {
case self::ENV_PROD:
return self::BASE_URL_PROD;
case self::ENV_STAGE:
return self::BASE_URL_STAGE;
case self::ENV_MOCK:
return null;
}
} | php | public function getEnvBaseUrl($env)
{
switch ($env) {
case self::ENV_PROD:
return self::BASE_URL_PROD;
case self::ENV_STAGE:
return self::BASE_URL_STAGE;
case self::ENV_MOCK:
return null;
}
} | [
"public",
"function",
"getEnvBaseUrl",
"(",
"$",
"env",
")",
"{",
"switch",
"(",
"$",
"env",
")",
"{",
"case",
"self",
"::",
"ENV_PROD",
":",
"return",
"self",
"::",
"BASE_URL_PROD",
";",
"case",
"self",
"::",
"ENV_STAGE",
":",
"return",
"self",
"::",
... | Get baseUrl for given environment
@param string $env
@return null|string | [
"Get",
"baseUrl",
"for",
"given",
"environment"
] | 8344dc8e7580364a6ad9ce6f3cf8f050e0a463c7 | https://github.com/fillup/walmart-partner-api-sdk-php/blob/8344dc8e7580364a6ad9ce6f3cf8f050e0a463c7/src/BaseClient.php#L93-L103 |
36,137 | fillup/walmart-partner-api-sdk-php | src/Order.php | Order.listReleased | public function listReleased(array $config = [])
{
try {
return $this->privateListReleased($config);
} catch (\Exception $e) {
if ($e instanceof RequestException) {
/*
* ListReleased and List return 404 error if no results are found, even for ... | php | public function listReleased(array $config = [])
{
try {
return $this->privateListReleased($config);
} catch (\Exception $e) {
if ($e instanceof RequestException) {
/*
* ListReleased and List return 404 error if no results are found, even for ... | [
"public",
"function",
"listReleased",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"privateListReleased",
"(",
"$",
"config",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"if",
... | List released orders
@param array $config
@return array
@throws \Exception | [
"List",
"released",
"orders"
] | 8344dc8e7580364a6ad9ce6f3cf8f050e0a463c7 | https://github.com/fillup/walmart-partner-api-sdk-php/blob/8344dc8e7580364a6ad9ce6f3cf8f050e0a463c7/src/Order.php#L76-L104 |
36,138 | fillup/walmart-partner-api-sdk-php | src/Order.php | Order.listAll | public function listAll(array $config = [])
{
try {
return $this->privateList($config);
} catch (\Exception $e) {
if ($e instanceof RequestException) {
/*
* ListReleased and List return 404 error if no results are found, even for successful AP... | php | public function listAll(array $config = [])
{
try {
return $this->privateList($config);
} catch (\Exception $e) {
if ($e instanceof RequestException) {
/*
* ListReleased and List return 404 error if no results are found, even for successful AP... | [
"public",
"function",
"listAll",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"privateList",
"(",
"$",
"config",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"if",
"(",
"$",... | List all orders
@param array $config
@return array
@throws \Exception | [
"List",
"all",
"orders"
] | 8344dc8e7580364a6ad9ce6f3cf8f050e0a463c7 | https://github.com/fillup/walmart-partner-api-sdk-php/blob/8344dc8e7580364a6ad9ce6f3cf8f050e0a463c7/src/Order.php#L112-L140 |
36,139 | fillup/walmart-partner-api-sdk-php | src/Order.php | Order.ship | public function ship($purchaseOrderId, $order)
{
if(!is_numeric($purchaseOrderId)){
throw new \Exception("purchaseOrderId must be numeric",1448480750);
}
$schema = [
'/orderShipment' => [
'namespace' => 'ns3',
'childNamespace' => 'ns3'... | php | public function ship($purchaseOrderId, $order)
{
if(!is_numeric($purchaseOrderId)){
throw new \Exception("purchaseOrderId must be numeric",1448480750);
}
$schema = [
'/orderShipment' => [
'namespace' => 'ns3',
'childNamespace' => 'ns3'... | [
"public",
"function",
"ship",
"(",
"$",
"purchaseOrderId",
",",
"$",
"order",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"purchaseOrderId",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"purchaseOrderId must be numeric\"",
",",
"1448480750",
... | Ship an order
@param string $purchaseOrderId
@param array $order
@return array
@throws \Exception | [
"Ship",
"an",
"order"
] | 8344dc8e7580364a6ad9ce6f3cf8f050e0a463c7 | https://github.com/fillup/walmart-partner-api-sdk-php/blob/8344dc8e7580364a6ad9ce6f3cf8f050e0a463c7/src/Order.php#L188-L217 |
36,140 | fillup/walmart-partner-api-sdk-php | src/Order.php | Order.refund | public function refund($purchaseOrderId, $order)
{
if(!is_numeric($purchaseOrderId)){
throw new \Exception("purchaseOrderId must be numeric",1448480783);
}
$schema = [
'/orderRefund' => [
'namespace' => 'ns3',
'childNamespace' => 'ns3'... | php | public function refund($purchaseOrderId, $order)
{
if(!is_numeric($purchaseOrderId)){
throw new \Exception("purchaseOrderId must be numeric",1448480783);
}
$schema = [
'/orderRefund' => [
'namespace' => 'ns3',
'childNamespace' => 'ns3'... | [
"public",
"function",
"refund",
"(",
"$",
"purchaseOrderId",
",",
"$",
"order",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"purchaseOrderId",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"purchaseOrderId must be numeric\"",
",",
"1448480783"... | Refund an order
@param string $purchaseOrderId
@param array $order
@return array
@throws \Exception | [
"Refund",
"an",
"order"
] | 8344dc8e7580364a6ad9ce6f3cf8f050e0a463c7 | https://github.com/fillup/walmart-partner-api-sdk-php/blob/8344dc8e7580364a6ad9ce6f3cf8f050e0a463c7/src/Order.php#L226-L258 |
36,141 | fillup/walmart-partner-api-sdk-php | src/Utils.php | Utils.stripNamespacesFromXml | public static function stripNamespacesFromXml($xml)
{
$xml = preg_replace('/<[a-zA-Z0-9]+:/','<',$xml);
$xml = preg_replace('/<\/[a-zA-Z0-9]+:/','</',$xml);
$xml = preg_replace('/ xmlns:[a-zA-Z0-9]+=".*">/','>',$xml);
return $xml;
} | php | public static function stripNamespacesFromXml($xml)
{
$xml = preg_replace('/<[a-zA-Z0-9]+:/','<',$xml);
$xml = preg_replace('/<\/[a-zA-Z0-9]+:/','</',$xml);
$xml = preg_replace('/ xmlns:[a-zA-Z0-9]+=".*">/','>',$xml);
return $xml;
} | [
"public",
"static",
"function",
"stripNamespacesFromXml",
"(",
"$",
"xml",
")",
"{",
"$",
"xml",
"=",
"preg_replace",
"(",
"'/<[a-zA-Z0-9]+:/'",
",",
"'<'",
",",
"$",
"xml",
")",
";",
"$",
"xml",
"=",
"preg_replace",
"(",
"'/<\\/[a-zA-Z0-9]+:/'",
",",
"'</'"... | Remove namespaces from XML
@param string $xml
@return string | [
"Remove",
"namespaces",
"from",
"XML"
] | 8344dc8e7580364a6ad9ce6f3cf8f050e0a463c7 | https://github.com/fillup/walmart-partner-api-sdk-php/blob/8344dc8e7580364a6ad9ce6f3cf8f050e0a463c7/src/Utils.php#L20-L27 |
36,142 | Wandu/Framework | src/Wandu/Http/Factory/ServerRequestFactory.php | ServerRequestFactory.getPhpServerValuesFromPlainHeader | protected function getPhpServerValuesFromPlainHeader(array $plainHeaders)
{
$httpInformation = explode(' ', array_shift($plainHeaders));
$servers = [
'REQUEST_METHOD' => $httpInformation[0],
'REQUEST_URI' => $httpInformation[1],
'SERVER_PROTOCOL' => $httpInformati... | php | protected function getPhpServerValuesFromPlainHeader(array $plainHeaders)
{
$httpInformation = explode(' ', array_shift($plainHeaders));
$servers = [
'REQUEST_METHOD' => $httpInformation[0],
'REQUEST_URI' => $httpInformation[1],
'SERVER_PROTOCOL' => $httpInformati... | [
"protected",
"function",
"getPhpServerValuesFromPlainHeader",
"(",
"array",
"$",
"plainHeaders",
")",
"{",
"$",
"httpInformation",
"=",
"explode",
"(",
"' '",
",",
"array_shift",
"(",
"$",
"plainHeaders",
")",
")",
";",
"$",
"servers",
"=",
"[",
"'REQUEST_METHOD... | Parse plain headers.
@param array $plainHeaders
@return array | [
"Parse",
"plain",
"headers",
"."
] | 765c9af25a649a5a33985f7bdb267b8f05d3d782 | https://github.com/Wandu/Framework/blob/765c9af25a649a5a33985f7bdb267b8f05d3d782/src/Wandu/Http/Factory/ServerRequestFactory.php#L105-L118 |
36,143 | oat-sa/lib-tao-dtms | src/DateTime.php | DateTime.getMicroseconds | public function getMicroseconds($asSeconds = false)
{
if ($asSeconds) {
return round($this->microseconds * 1/1e6, 6);
}
return intval($this->microseconds);
} | php | public function getMicroseconds($asSeconds = false)
{
if ($asSeconds) {
return round($this->microseconds * 1/1e6, 6);
}
return intval($this->microseconds);
} | [
"public",
"function",
"getMicroseconds",
"(",
"$",
"asSeconds",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"asSeconds",
")",
"{",
"return",
"round",
"(",
"$",
"this",
"->",
"microseconds",
"*",
"1",
"/",
"1e6",
",",
"6",
")",
";",
"}",
"return",
"intval... | Gets microseconds data from object
@param boolean $asSeconds If defined, microseconds will be converted to seconds with fractions
@return int|float | [
"Gets",
"microseconds",
"data",
"from",
"object"
] | dc3979af897154850756bc72e19a9670064b9f25 | https://github.com/oat-sa/lib-tao-dtms/blob/dc3979af897154850756bc72e19a9670064b9f25/src/DateTime.php#L35-L42 |
36,144 | oat-sa/lib-tao-dtms | src/DateTime.php | DateTime.addMicroseconds | protected function addMicroseconds($microseconds)
{
if ($microseconds < 0) {
throw new \InvalidArgumentException("Value of microseconds should be positive.");
}
$diff = $this->getMicroseconds() + $microseconds;
$seconds = floor($diff / 1e6);
$diff -= $seconds * 1... | php | protected function addMicroseconds($microseconds)
{
if ($microseconds < 0) {
throw new \InvalidArgumentException("Value of microseconds should be positive.");
}
$diff = $this->getMicroseconds() + $microseconds;
$seconds = floor($diff / 1e6);
$diff -= $seconds * 1... | [
"protected",
"function",
"addMicroseconds",
"(",
"$",
"microseconds",
")",
"{",
"if",
"(",
"$",
"microseconds",
"<",
"0",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Value of microseconds should be positive.\"",
")",
";",
"}",
"$",
"diff",
... | Subtracts an amount of microseconds from a DateTime object
@param $microseconds | [
"Subtracts",
"an",
"amount",
"of",
"microseconds",
"from",
"a",
"DateTime",
"object"
] | dc3979af897154850756bc72e19a9670064b9f25 | https://github.com/oat-sa/lib-tao-dtms/blob/dc3979af897154850756bc72e19a9670064b9f25/src/DateTime.php#L104-L121 |
36,145 | oat-sa/lib-tao-dtms | src/DateTime.php | DateTime.subMicroseconds | protected function subMicroseconds($microseconds)
{
if ($microseconds < 0) {
throw new \InvalidArgumentException("Value of microseconds should be positive.");
}
$diff = $this->getMicroseconds() - $microseconds;
$seconds = floor($diff / 1e6);
$diff -= $seconds * 1... | php | protected function subMicroseconds($microseconds)
{
if ($microseconds < 0) {
throw new \InvalidArgumentException("Value of microseconds should be positive.");
}
$diff = $this->getMicroseconds() - $microseconds;
$seconds = floor($diff / 1e6);
$diff -= $seconds * 1... | [
"protected",
"function",
"subMicroseconds",
"(",
"$",
"microseconds",
")",
"{",
"if",
"(",
"$",
"microseconds",
"<",
"0",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Value of microseconds should be positive.\"",
")",
";",
"}",
"$",
"diff",
... | Adds an amount of microseconds to a DateTime object
@param $microseconds | [
"Adds",
"an",
"amount",
"of",
"microseconds",
"to",
"a",
"DateTime",
"object"
] | dc3979af897154850756bc72e19a9670064b9f25 | https://github.com/oat-sa/lib-tao-dtms/blob/dc3979af897154850756bc72e19a9670064b9f25/src/DateTime.php#L128-L145 |
36,146 | oat-sa/lib-tao-dtms | src/DateTime.php | DateTime.add | public function add($interval)
{
parent::add($interval);
if ($interval instanceof DateInterval) {
if ($interval->invert) { // is negative, then sub
$this->subMicroseconds($interval->u);
} else {
$this->addMicroseconds($interval->u);
... | php | public function add($interval)
{
parent::add($interval);
if ($interval instanceof DateInterval) {
if ($interval->invert) { // is negative, then sub
$this->subMicroseconds($interval->u);
} else {
$this->addMicroseconds($interval->u);
... | [
"public",
"function",
"add",
"(",
"$",
"interval",
")",
"{",
"parent",
"::",
"add",
"(",
"$",
"interval",
")",
";",
"if",
"(",
"$",
"interval",
"instanceof",
"DateInterval",
")",
"{",
"if",
"(",
"$",
"interval",
"->",
"invert",
")",
"{",
"// is negativ... | Adds an amount of days, months, years, hours, minutes, seconds and microseconds to a DateTime object
@param DateInterval $interval
@return DateTime $this | [
"Adds",
"an",
"amount",
"of",
"days",
"months",
"years",
"hours",
"minutes",
"seconds",
"and",
"microseconds",
"to",
"a",
"DateTime",
"object"
] | dc3979af897154850756bc72e19a9670064b9f25 | https://github.com/oat-sa/lib-tao-dtms/blob/dc3979af897154850756bc72e19a9670064b9f25/src/DateTime.php#L153-L166 |
36,147 | eleven-lab/laravel-geo | src/Eloquent/Model.php | Model.boot | protected static function boot()
{
parent::boot();
static::creating(function($model){
self::updateGeoAttributes($model);
});
static::created(function($model){
self::updateGeoAttributes($model);
});
static::updating(function($model){
... | php | protected static function boot()
{
parent::boot();
static::creating(function($model){
self::updateGeoAttributes($model);
});
static::created(function($model){
self::updateGeoAttributes($model);
});
static::updating(function($model){
... | [
"protected",
"static",
"function",
"boot",
"(",
")",
"{",
"parent",
"::",
"boot",
"(",
")",
";",
"static",
"::",
"creating",
"(",
"function",
"(",
"$",
"model",
")",
"{",
"self",
"::",
"updateGeoAttributes",
"(",
"$",
"model",
")",
";",
"}",
")",
";"... | Overriding the "booting" method of the model.
@return void | [
"Overriding",
"the",
"booting",
"method",
"of",
"the",
"model",
"."
] | 3bd89e4b20563f79153c5dacc7b7f79a0c2ae0fa | https://github.com/eleven-lab/laravel-geo/blob/3bd89e4b20563f79153c5dacc7b7f79a0c2ae0fa/src/Eloquent/Model.php#L31-L50 |
36,148 | theodorejb/peachy-sql | lib/SqlServer.php | SqlServer.query | public function query(string $sql, array $params = []): Statement
{
if (!$stmt = sqlsrv_query($this->connection, $sql, $params)) {
throw new SqlException('Query failed', sqlsrv_errors(), $sql, $params);
}
$statement = new Statement($stmt, false, $sql, $params);
$statemen... | php | public function query(string $sql, array $params = []): Statement
{
if (!$stmt = sqlsrv_query($this->connection, $sql, $params)) {
throw new SqlException('Query failed', sqlsrv_errors(), $sql, $params);
}
$statement = new Statement($stmt, false, $sql, $params);
$statemen... | [
"public",
"function",
"query",
"(",
"string",
"$",
"sql",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
":",
"Statement",
"{",
"if",
"(",
"!",
"$",
"stmt",
"=",
"sqlsrv_query",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"sql",
",",
"$",
"... | Prepares and executes a single SQL Server query with bound parameters
@throws SqlException if an error occurs | [
"Prepares",
"and",
"executes",
"a",
"single",
"SQL",
"Server",
"query",
"with",
"bound",
"parameters"
] | f179c6fa6c4293c2713b6b59022f3cfc90890a98 | https://github.com/theodorejb/peachy-sql/blob/f179c6fa6c4293c2713b6b59022f3cfc90890a98/lib/SqlServer.php#L101-L110 |
36,149 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.values2string | public static function values2string(array $array, $arrayColumnKey = '', $separator = ',')
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$values = [];
foreach ($array as $key => $value) {
$appen... | php | public static function values2string(array $array, $arrayColumnKey = '', $separator = ',')
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$values = [];
foreach ($array as $key => $value) {
$appen... | [
"public",
"static",
"function",
"values2string",
"(",
"array",
"$",
"array",
",",
"$",
"arrayColumnKey",
"=",
"''",
",",
"$",
"separator",
"=",
"','",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
"$",
"ar... | Converts given array's column to string.
Recursive call is made for multi-dimensional arrays.
@param array $array Data to be converted
@param int|string $arrayColumnKey (optional) Column name. Default: "".
@param string $separator (optional) Separator used between values. Default: ",".
@return n... | [
"Converts",
"given",
"array",
"s",
"column",
"to",
"string",
".",
"Recursive",
"call",
"is",
"made",
"for",
"multi",
"-",
"dimensional",
"arrays",
"."
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L35-L78 |
36,150 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.values2csv | public static function values2csv(array $array, $separator = ',')
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$rows = [];
$lineSeparator = "\n";
foreach ($array as $row) {
/*
... | php | public static function values2csv(array $array, $separator = ',')
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$rows = [];
$lineSeparator = "\n";
foreach ($array as $row) {
/*
... | [
"public",
"static",
"function",
"values2csv",
"(",
"array",
"$",
"array",
",",
"$",
"separator",
"=",
"','",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"return",
"null",
"... | Converts given array's rows to csv string
@param array $array Data to be converted. It have to be an array that represents database table.
@param string $separator (optional) Separator used between values. Default: ",".
@return null|string | [
"Converts",
"given",
"array",
"s",
"rows",
"to",
"csv",
"string"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L128-L161 |
36,151 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.isFirstElement | public static function isFirstElement(array $array, $element, $firstLevelOnly = true)
{
$firstElement = self::getFirstElement($array, $firstLevelOnly);
return $element === $firstElement;
} | php | public static function isFirstElement(array $array, $element, $firstLevelOnly = true)
{
$firstElement = self::getFirstElement($array, $firstLevelOnly);
return $element === $firstElement;
} | [
"public",
"static",
"function",
"isFirstElement",
"(",
"array",
"$",
"array",
",",
"$",
"element",
",",
"$",
"firstLevelOnly",
"=",
"true",
")",
"{",
"$",
"firstElement",
"=",
"self",
"::",
"getFirstElement",
"(",
"$",
"array",
",",
"$",
"firstLevelOnly",
... | Returns information if given element is the first one
@param array $array The array to get the first element of
@param mixed $element The element to check / verify
@param bool $firstLevelOnly (optional) If is set to true, first element is returned. Otherwise - totally
first element is returned (first ... | [
"Returns",
"information",
"if",
"given",
"element",
"is",
"the",
"first",
"one"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L172-L177 |
36,152 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.getFirstElement | public static function getFirstElement(array $array, $firstLevelOnly = true)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$firstKey = self::getFirstKey($array);
$first = $array[$firstKey];
if (!$fi... | php | public static function getFirstElement(array $array, $firstLevelOnly = true)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$firstKey = self::getFirstKey($array);
$first = $array[$firstKey];
if (!$fi... | [
"public",
"static",
"function",
"getFirstElement",
"(",
"array",
"$",
"array",
",",
"$",
"firstLevelOnly",
"=",
"true",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"return",
... | Returns the first element of given array
It may be first element of given array or the totally first element from the all elements (first element of the
first array).
@param array $array The array to get the first element of
@param bool $firstLevelOnly (optional) If is set to true, first element is returned... | [
"Returns",
"the",
"first",
"element",
"of",
"given",
"array"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L190-L208 |
36,153 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.isLastElement | public static function isLastElement(array $array, $element, $firstLevelOnly = true)
{
$lastElement = self::getLastElement($array, $firstLevelOnly);
return $element === $lastElement;
} | php | public static function isLastElement(array $array, $element, $firstLevelOnly = true)
{
$lastElement = self::getLastElement($array, $firstLevelOnly);
return $element === $lastElement;
} | [
"public",
"static",
"function",
"isLastElement",
"(",
"array",
"$",
"array",
",",
"$",
"element",
",",
"$",
"firstLevelOnly",
"=",
"true",
")",
"{",
"$",
"lastElement",
"=",
"self",
"::",
"getLastElement",
"(",
"$",
"array",
",",
"$",
"firstLevelOnly",
")"... | Returns information if given element is the last one
@param array $array The array to get the last element of
@param mixed $element The element to check / verify
@param bool $firstLevelOnly (optional) If is set to true, last element is returned. Otherwise - totally
last element is returned (last of th... | [
"Returns",
"information",
"if",
"given",
"element",
"is",
"the",
"last",
"one"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L240-L245 |
36,154 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.getLastElement | public static function getLastElement(array $array, $firstLevelOnly = true)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$last = end($array);
if (!$firstLevelOnly && is_array($last)) {
$last = ... | php | public static function getLastElement(array $array, $firstLevelOnly = true)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$last = end($array);
if (!$firstLevelOnly && is_array($last)) {
$last = ... | [
"public",
"static",
"function",
"getLastElement",
"(",
"array",
"$",
"array",
",",
"$",
"firstLevelOnly",
"=",
"true",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"return",
"... | Returns the last element of given array
It may be last element of given array or the totally last element from the all elements (last element of the
latest array).
@param array $array The array to get the last element of
@param bool $firstLevelOnly (optional) If is set to true, last element is returned. Oth... | [
"Returns",
"the",
"last",
"element",
"of",
"given",
"array"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L258-L275 |
36,155 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.getLastRow | public static function getLastRow(array $array)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$effect = [];
$last = end($array);
if (is_array($last)) {
// We've got an array, so looking ... | php | public static function getLastRow(array $array)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$effect = [];
$last = end($array);
if (is_array($last)) {
// We've got an array, so looking ... | [
"public",
"static",
"function",
"getLastRow",
"(",
"array",
"$",
"array",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"effect",
"=",
"[",
... | Returns the last row of array
@param array $array The array to get the last row of
@return mixed | [
"Returns",
"the",
"last",
"row",
"of",
"array"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L317-L344 |
36,156 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.replaceArrayKeys | public static function replaceArrayKeys($dataArray, $oldKeyPattern, $newKey)
{
$effect = [];
if (is_array($dataArray) && !empty($dataArray)) {
foreach ($dataArray as $key => $value) {
if (preg_match($oldKeyPattern, $key)) {
$key = $newKey;
... | php | public static function replaceArrayKeys($dataArray, $oldKeyPattern, $newKey)
{
$effect = [];
if (is_array($dataArray) && !empty($dataArray)) {
foreach ($dataArray as $key => $value) {
if (preg_match($oldKeyPattern, $key)) {
$key = $newKey;
... | [
"public",
"static",
"function",
"replaceArrayKeys",
"(",
"$",
"dataArray",
",",
"$",
"oldKeyPattern",
",",
"$",
"newKey",
")",
"{",
"$",
"effect",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"dataArray",
")",
"&&",
"!",
"empty",
"(",
"$",
"d... | Replaces array keys that match given pattern with new key name
@param array $dataArray The array
@param string $oldKeyPattern Old key pattern
@param string $newKey New key name
@return array | [
"Replaces",
"array",
"keys",
"that",
"match",
"given",
"pattern",
"with",
"new",
"key",
"name"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L354-L373 |
36,157 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.array2JavaScript | public static function array2JavaScript(array $array, $jsVariableName = '', $preserveIndexes = false)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$result = '';
$counter = 0;
$arrayCount = count($a... | php | public static function array2JavaScript(array $array, $jsVariableName = '', $preserveIndexes = false)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$result = '';
$counter = 0;
$arrayCount = count($a... | [
"public",
"static",
"function",
"array2JavaScript",
"(",
"array",
"$",
"array",
",",
"$",
"jsVariableName",
"=",
"''",
",",
"$",
"preserveIndexes",
"=",
"false",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
... | Generates JavaScript code for given PHP array
@param array $array The array that should be generated to JavaScript
@param string $jsVariableName (optional) Name of the variable that will be in generated JavaScript code
@param bool $preserveIndexes (optional) If is set to true and $jsVariableName isn't em... | [
"Generates",
"JavaScript",
"code",
"for",
"given",
"PHP",
"array"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L384-L472 |
36,158 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.setKeysAsValues | public static function setKeysAsValues(array $array, $ignoreDuplicatedValues = true)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$replaced = [];
foreach ($array as $key => $value) {
/*
... | php | public static function setKeysAsValues(array $array, $ignoreDuplicatedValues = true)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$replaced = [];
foreach ($array as $key => $value) {
/*
... | [
"public",
"static",
"function",
"setKeysAsValues",
"(",
"array",
"$",
"array",
",",
"$",
"ignoreDuplicatedValues",
"=",
"true",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"ret... | Sets keys as values and values as keys in given array.
Replaces keys with values.
@param array $array The array to change values with keys
@param bool $ignoreDuplicatedValues (optional) If is set to true, duplicated values are ignored. This means that
when there is more than 1 value and that values b... | [
"Sets",
"keys",
"as",
"values",
"and",
"values",
"as",
"keys",
"in",
"given",
"array",
".",
"Replaces",
"keys",
"with",
"values",
"."
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L656-L696 |
36,159 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.string2array | public static function string2array($string, $separator = '|', $valuesKeysSeparator = ':')
{
/*
* Empty string?
* Nothing to do
*/
if (empty($string)) {
return null;
}
$array = [];
$exploded = explode($separator, $string);
fore... | php | public static function string2array($string, $separator = '|', $valuesKeysSeparator = ':')
{
/*
* Empty string?
* Nothing to do
*/
if (empty($string)) {
return null;
}
$array = [];
$exploded = explode($separator, $string);
fore... | [
"public",
"static",
"function",
"string2array",
"(",
"$",
"string",
",",
"$",
"separator",
"=",
"'|'",
",",
"$",
"valuesKeysSeparator",
"=",
"':'",
")",
"{",
"/*\n * Empty string?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
"$",
"string... | Converts given string with special separators to array
Example:
~ string:
"light:jasny|dark:ciemny"
~ array as a result:
[
'light' => 'jasny',
'dark' => 'ciemny',
]
@param string $string The string to be converted
@param string $separator (optional) Separator used between name-value pairs in ... | [
"Converts",
"given",
"string",
"with",
"special",
"separators",
"to",
"array"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L777-L802 |
36,160 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.areKeysInArray | public static function areKeysInArray(array $keys, array $array, $explicit = true)
{
$result = false;
if (!empty($array)) {
$firstKey = true;
foreach ($keys as $key) {
$exists = array_key_exists($key, $array);
if ($firstKey) {
... | php | public static function areKeysInArray(array $keys, array $array, $explicit = true)
{
$result = false;
if (!empty($array)) {
$firstKey = true;
foreach ($keys as $key) {
$exists = array_key_exists($key, $array);
if ($firstKey) {
... | [
"public",
"static",
"function",
"areKeysInArray",
"(",
"array",
"$",
"keys",
",",
"array",
"$",
"array",
",",
"$",
"explicit",
"=",
"true",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"$",
... | Returns information if given keys exist in given array
@param array $keys The keys to find
@param array $array The array that maybe contains keys
@param bool $explicit (optional) If is set to true, all keys should exist in given array. Otherwise - not all.
@return bool | [
"Returns",
"information",
"if",
"given",
"keys",
"exist",
"in",
"given",
"array"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L812-L842 |
36,161 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.getLastElementsPaths | public static function getLastElementsPaths(array $array, $separator = '.', $parentPath = '', $stopIfMatchedBy = '')
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
if (!empty($stopIfMatchedBy)) {
$stopIfM... | php | public static function getLastElementsPaths(array $array, $separator = '.', $parentPath = '', $stopIfMatchedBy = '')
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
if (!empty($stopIfMatchedBy)) {
$stopIfM... | [
"public",
"static",
"function",
"getLastElementsPaths",
"(",
"array",
"$",
"array",
",",
"$",
"separator",
"=",
"'.'",
",",
"$",
"parentPath",
"=",
"''",
",",
"$",
"stopIfMatchedBy",
"=",
"''",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n ... | Returns paths of the last elements
@param array $array The array with elements
@param string $separator (optional) Separator used between elements. Default: ".".
@param string $parentPath (optional) Path of the parent element. Default: "".
@param array|string $stopIfMatchedBy (o... | [
"Returns",
"paths",
"of",
"the",
"last",
"elements"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L862-L929 |
36,162 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.getValueByKeysPath | public static function getValueByKeysPath(array $array, array $keys)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$value = null;
if (self::issetRecursive($array, $keys)) {
foreach ($keys as $ke... | php | public static function getValueByKeysPath(array $array, array $keys)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$value = null;
if (self::issetRecursive($array, $keys)) {
foreach ($keys as $ke... | [
"public",
"static",
"function",
"getValueByKeysPath",
"(",
"array",
"$",
"array",
",",
"array",
"$",
"keys",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"return",
"null",
";"... | Returns value of given array set under given path of keys, of course if the value exists.
The keys should be delivered in the same order as used by source array.
@param array $array The array which should contains a value
@param array $keys Keys, path of keys, to find in given array
@return mixed
Examples:
a) $array... | [
"Returns",
"value",
"of",
"given",
"array",
"set",
"under",
"given",
"path",
"of",
"keys",
"of",
"course",
"if",
"the",
"value",
"exists",
".",
"The",
"keys",
"should",
"be",
"delivered",
"in",
"the",
"same",
"order",
"as",
"used",
"by",
"source",
"array... | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L1043-L1069 |
36,163 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.issetRecursive | public static function issetRecursive(array $array, array $keys)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return false;
}
$isset = false;
foreach ($keys as $key) {
$isset = isset($array[$key]);
... | php | public static function issetRecursive(array $array, array $keys)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return false;
}
$isset = false;
foreach ($keys as $key) {
$isset = isset($array[$key]);
... | [
"public",
"static",
"function",
"issetRecursive",
"(",
"array",
"$",
"array",
",",
"array",
"$",
"keys",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"return",
"false",
";",
... | Returns information if given path of keys are set is given array.
The keys should be delivered in the same order as used by source array.
@param array $array The array to check
@param array $keys Keys, path of keys, to find in given array
@return bool
Examples:
a) $array
[
'some key' => [
'another some key' => [
'ye... | [
"Returns",
"information",
"if",
"given",
"path",
"of",
"keys",
"are",
"set",
"is",
"given",
"array",
".",
"The",
"keys",
"should",
"be",
"delivered",
"in",
"the",
"same",
"order",
"as",
"used",
"by",
"source",
"array",
"."
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L1097-L1125 |
36,164 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.getAllValuesOfKey | public static function getAllValuesOfKey(array $array, $key)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$values = [];
foreach ($array as $index => $value) {
if ($index === $key) {
... | php | public static function getAllValuesOfKey(array $array, $key)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$values = [];
foreach ($array as $index => $value) {
if ($index === $key) {
... | [
"public",
"static",
"function",
"getAllValuesOfKey",
"(",
"array",
"$",
"array",
",",
"$",
"key",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"return",
"null",
";",
"}",
"$... | Returns all values of given key.
It may be useful when you want to retrieve all values of one column.
@param array $array The array which should contain values of the key
@param string $key The key
@return null|array | [
"Returns",
"all",
"values",
"of",
"given",
"key",
".",
"It",
"may",
"be",
"useful",
"when",
"you",
"want",
"to",
"retrieve",
"all",
"values",
"of",
"one",
"column",
"."
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L1135-L1165 |
36,165 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.trimRecursive | public static function trimRecursive(array $array)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return [];
}
$result = [];
foreach ($array as $key => $value) {
if (is_array($value)) {
$result[... | php | public static function trimRecursive(array $array)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return [];
}
$result = [];
foreach ($array as $key => $value) {
if (is_array($value)) {
$result[... | [
"public",
"static",
"function",
"trimRecursive",
"(",
"array",
"$",
"array",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"result",
"=",
... | Trims string values of given array and returns the new array
@param array $array The array which values should be trimmed
@return array | [
"Trims",
"string",
"values",
"of",
"given",
"array",
"and",
"returns",
"the",
"new",
"array"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L1211-L1238 |
36,166 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.sortByCustomKeysOrder | public static function sortByCustomKeysOrder(array $array, array $keysOrder)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$ordered = [];
/*
* 1st iteration:
* Get elements in proper / req... | php | public static function sortByCustomKeysOrder(array $array, array $keysOrder)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
$ordered = [];
/*
* 1st iteration:
* Get elements in proper / req... | [
"public",
"static",
"function",
"sortByCustomKeysOrder",
"(",
"array",
"$",
"array",
",",
"array",
"$",
"keysOrder",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"return",
"null... | Sorts an array by keys given in second array as values.
Keys which are not in array with order are pushed after sorted elements.
Example:
- array to sort:
<code>
array(
'lorem' => array(
'ipsum'
),
'dolor' => array(
'sit',
'amet'
),
'neque' => 'neque'
)
</code>
- keys order:
<code>
array(
'dolor',
'lorem'
)
</code>
- ... | [
"Sorts",
"an",
"array",
"by",
"keys",
"given",
"in",
"second",
"array",
"as",
"values",
".",
"Keys",
"which",
"are",
"not",
"in",
"array",
"with",
"order",
"are",
"pushed",
"after",
"sorted",
"elements",
"."
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L1283-L1319 |
36,167 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.implodeSmart | public static function implodeSmart(array $array, $separator)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
foreach ($array as &$element) {
if (is_array($element)) {
$element = self::impl... | php | public static function implodeSmart(array $array, $separator)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}
foreach ($array as &$element) {
if (is_array($element)) {
$element = self::impl... | [
"public",
"static",
"function",
"implodeSmart",
"(",
"array",
"$",
"array",
",",
"$",
"separator",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"return",
"null",
";",
"}",
"... | Returns smartly imploded string
Separators located at the beginning or end of elements are removed.
It's required to avoid problems with duplicated separator, e.g. "first//second/third", where separator is a
"/" string.
@param array $array The array with elements to implode
@param string $separator Separator use... | [
"Returns",
"smartly",
"imploded",
"string"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L1332-L1357 |
36,168 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.areAllValuesEmpty | public static function areAllValuesEmpty(array $array, $strictNull = false)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return false;
}
foreach ($array as $element) {
/*
* If elements are verified if the... | php | public static function areAllValuesEmpty(array $array, $strictNull = false)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return false;
}
foreach ($array as $element) {
/*
* If elements are verified if the... | [
"public",
"static",
"function",
"areAllValuesEmpty",
"(",
"array",
"$",
"array",
",",
"$",
"strictNull",
"=",
"false",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"return",
"... | Returns information if given array is empty, iow. information if all elements of given array are empty
@param array $array The array to verify
@param bool $strictNull (optional) If is set to true elements are verified if they are null. Otherwise - only
if they are empty (e.g. null, '', 0, array()).
@return bool | [
"Returns",
"information",
"if",
"given",
"array",
"is",
"empty",
"iow",
".",
"information",
"if",
"all",
"elements",
"of",
"given",
"array",
"are",
"empty"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L1367-L1393 |
36,169 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.arrayDiffRecursive | public static function arrayDiffRecursive(array $array1, array $array2, $valuesOnly = false)
{
$effect = [];
/*
* Values should be compared only and both arrays are one-dimensional?
* Let's find difference by using simple function
*/
if ($valuesOnly && 1 === self:... | php | public static function arrayDiffRecursive(array $array1, array $array2, $valuesOnly = false)
{
$effect = [];
/*
* Values should be compared only and both arrays are one-dimensional?
* Let's find difference by using simple function
*/
if ($valuesOnly && 1 === self:... | [
"public",
"static",
"function",
"arrayDiffRecursive",
"(",
"array",
"$",
"array1",
",",
"array",
"$",
"array2",
",",
"$",
"valuesOnly",
"=",
"false",
")",
"{",
"$",
"effect",
"=",
"[",
"]",
";",
"/*\n * Values should be compared only and both arrays are one-... | Returns an array containing all the entries from 1st array that are not present in 2nd array.
An item from 1st array is the same as in 2nd array if both, keys and values, are the same.
Example of difference:
$array1 = [
1 => 'Lorem',
2 => 'ipsum,
];
$array2 = [
1 => 'Lorem',
5 => 'ipsum, // <-- The same values... | [
"Returns",
"an",
"array",
"containing",
"all",
"the",
"entries",
"from",
"1st",
"array",
"that",
"are",
"not",
"present",
"in",
"2nd",
"array",
".",
"An",
"item",
"from",
"1st",
"array",
"is",
"the",
"same",
"as",
"in",
"2nd",
"array",
"if",
"both",
"k... | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L1416-L1481 |
36,170 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.getDimensionsCount | public static function getDimensionsCount(array $array)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return 0;
}
$dimensionsCount = 1;
foreach ($array as $value) {
if (is_array($value)) {
/*
... | php | public static function getDimensionsCount(array $array)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return 0;
}
$dimensionsCount = 1;
foreach ($array as $value) {
if (is_array($value)) {
/*
... | [
"public",
"static",
"function",
"getDimensionsCount",
"(",
"array",
"$",
"array",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"return",
"0",
";",
"}",
"$",
"dimensionsCount",
... | Returns count of dimensions, maximum nesting level actually, in given array
@param array $array The array to verify
@return int | [
"Returns",
"count",
"of",
"dimensions",
"maximum",
"nesting",
"level",
"actually",
"in",
"given",
"array"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L1618-L1645 |
36,171 | meritoo/common-library | src/Utilities/Arrays.php | Arrays.getNonEmptyValuesAsString | public static function getNonEmptyValuesAsString(array $values, $separator = ', ')
{
/*
* No elements?
* Nothing to do
*/
if (empty($values)) {
return null;
}
$nonEmpty = self::getNonEmptyValues($values);
/*
* No values?
... | php | public static function getNonEmptyValuesAsString(array $values, $separator = ', ')
{
/*
* No elements?
* Nothing to do
*/
if (empty($values)) {
return null;
}
$nonEmpty = self::getNonEmptyValues($values);
/*
* No values?
... | [
"public",
"static",
"function",
"getNonEmptyValuesAsString",
"(",
"array",
"$",
"values",
",",
"$",
"separator",
"=",
"', '",
")",
"{",
"/*\n * No elements?\n * Nothing to do\n */",
"if",
"(",
"empty",
"(",
"$",
"values",
")",
")",
"{",
"retu... | Returns non-empty values concatenated by given separator
@param array $values The values to filter
@param string $separator (optional) Separator used to implode the values. Default: ", ".
@return null|string | [
"Returns",
"non",
"-",
"empty",
"values",
"concatenated",
"by",
"given",
"separator"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Arrays.php#L1678-L1699 |
36,172 | CeusMedia/Common | src/Deprecation.php | Deprecation.message | public function message( $message ){
$trace = debug_backtrace();
$caller = next( $trace );
$message .= ', invoked in '.$caller['file'].' on line '.$caller['line'];
if( $this->exceptionVersion )
if( version_compare( $this->version, $this->exceptionVersion ) >= 0 )
throw new Exception( 'Deprecated: '.$mess... | php | public function message( $message ){
$trace = debug_backtrace();
$caller = next( $trace );
$message .= ', invoked in '.$caller['file'].' on line '.$caller['line'];
if( $this->exceptionVersion )
if( version_compare( $this->version, $this->exceptionVersion ) >= 0 )
throw new Exception( 'Deprecated: '.$mess... | [
"public",
"function",
"message",
"(",
"$",
"message",
")",
"{",
"$",
"trace",
"=",
"debug_backtrace",
"(",
")",
";",
"$",
"caller",
"=",
"next",
"(",
"$",
"trace",
")",
";",
"$",
"message",
".=",
"', invoked in '",
".",
"$",
"caller",
"[",
"'file'",
... | Show message as exception or deprecation error, depending on set versions and PHP version.
Will throw an exception if set exception version reached detected library version.
Will throw a deprecation error if set error version reached detected library version using PHP 5.3+.
Will throw a deprecation notice if set error ... | [
"Show",
"message",
"as",
"exception",
"or",
"deprecation",
"error",
"depending",
"on",
"set",
"versions",
"and",
"PHP",
"version",
".",
"Will",
"throw",
"an",
"exception",
"if",
"set",
"exception",
"version",
"reached",
"detected",
"library",
"version",
".",
"... | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Deprecation.php#L68-L78 |
36,173 | CeusMedia/Common | src/XML/DOM/GoogleSitemapBuilder.php | XML_DOM_GoogleSitemapBuilder.buildSitemap | public static function buildSitemap( $links, $baseUrl = "" )
{
$root = new XML_DOM_Node( "urlset" );
$root->setAttribute( 'xmlns', "http://www.google.com/schemas/sitemap/0.84" );
foreach( $links as $link )
{
$child = new XML_DOM_Node( "url" );
$loc = new XML_DOM_Node( "loc", $baseUrl.$link );
$child->... | php | public static function buildSitemap( $links, $baseUrl = "" )
{
$root = new XML_DOM_Node( "urlset" );
$root->setAttribute( 'xmlns', "http://www.google.com/schemas/sitemap/0.84" );
foreach( $links as $link )
{
$child = new XML_DOM_Node( "url" );
$loc = new XML_DOM_Node( "loc", $baseUrl.$link );
$child->... | [
"public",
"static",
"function",
"buildSitemap",
"(",
"$",
"links",
",",
"$",
"baseUrl",
"=",
"\"\"",
")",
"{",
"$",
"root",
"=",
"new",
"XML_DOM_Node",
"(",
"\"urlset\"",
")",
";",
"$",
"root",
"->",
"setAttribute",
"(",
"'xmlns'",
",",
"\"http://www.googl... | Builds and return XML of Sitemap.
@access public
@static
@param string $links List of Sitemap Link
@param string $baseUrl Basic URL to add to every Link
@return bool | [
"Builds",
"and",
"return",
"XML",
"of",
"Sitemap",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/DOM/GoogleSitemapBuilder.php#L77-L90 |
36,174 | CeusMedia/Common | src/FS/File/CSS/Theme/Finder.php | FS_File_CSS_Theme_Finder.getThemes | public function getThemes( $withBrowsers = FALSE )
{
$list = array();
$dir = new DirectoryIterator( $this->themePath );
foreach( $dir as $entry )
{
if( !$entry->isDir() )
continue;
if( substr( $entry->getFilename(), 0, 1 ) == "." )
continue;
$themeName = $entry->getFilename();
if( $withBro... | php | public function getThemes( $withBrowsers = FALSE )
{
$list = array();
$dir = new DirectoryIterator( $this->themePath );
foreach( $dir as $entry )
{
if( !$entry->isDir() )
continue;
if( substr( $entry->getFilename(), 0, 1 ) == "." )
continue;
$themeName = $entry->getFilename();
if( $withBro... | [
"public",
"function",
"getThemes",
"(",
"$",
"withBrowsers",
"=",
"FALSE",
")",
"{",
"$",
"list",
"=",
"array",
"(",
")",
";",
"$",
"dir",
"=",
"new",
"DirectoryIterator",
"(",
"$",
"this",
"->",
"themePath",
")",
";",
"foreach",
"(",
"$",
"dir",
"as... | Returns found Themes as List.
@access public
@param bool $withBrowsers Flag: Stylesheets with Browser Folders
@return array | [
"Returns",
"found",
"Themes",
"as",
"List",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/CSS/Theme/Finder.php#L59-L88 |
36,175 | CeusMedia/Common | src/Alg/Math/Analysis/Progression.php | Alg_Math_Analysis_Progression.getPartialSum | public function getPartialSum( $from, $to )
{
for( $i=$from; $i<=$to; $i++ )
$sum += $this->getValue( $i );
return $sum;
} | php | public function getPartialSum( $from, $to )
{
for( $i=$from; $i<=$to; $i++ )
$sum += $this->getValue( $i );
return $sum;
} | [
"public",
"function",
"getPartialSum",
"(",
"$",
"from",
",",
"$",
"to",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"$",
"from",
";",
"$",
"i",
"<=",
"$",
"to",
";",
"$",
"i",
"++",
")",
"$",
"sum",
"+=",
"$",
"this",
"->",
"getValue",
"(",
"$",
... | Calculates partial Sum of Progression.
@access public
@param int $from Interval Start
@param int $to Interval End
@return double | [
"Calculates",
"partial",
"Sum",
"of",
"Progression",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Math/Analysis/Progression.php#L73-L78 |
36,176 | CeusMedia/Common | src/Alg/Math/Analysis/Progression.php | Alg_Math_Analysis_Progression.isConvergent | public function isConvergent ()
{
$is = true;
for( $i=$this->interval->getStart(); $i<$this->interval->getEnd(); $i++ )
{
$an = $this->getPartialSum( $this->interval->getStart(), $i );
$an1 = $this->getPartialSum( $this->interval->getStart(), $i+1 );
$diff = abs( $an1 - $an );
// echo "<br>an1... | php | public function isConvergent ()
{
$is = true;
for( $i=$this->interval->getStart(); $i<$this->interval->getEnd(); $i++ )
{
$an = $this->getPartialSum( $this->interval->getStart(), $i );
$an1 = $this->getPartialSum( $this->interval->getStart(), $i+1 );
$diff = abs( $an1 - $an );
// echo "<br>an1... | [
"public",
"function",
"isConvergent",
"(",
")",
"{",
"$",
"is",
"=",
"true",
";",
"for",
"(",
"$",
"i",
"=",
"$",
"this",
"->",
"interval",
"->",
"getStart",
"(",
")",
";",
"$",
"i",
"<",
"$",
"this",
"->",
"interval",
"->",
"getEnd",
"(",
")",
... | Indicates whether this Progression is convergent.
@access public
@return bool
@todo correct Function: harmonic progression is convergent which is WRONG | [
"Indicates",
"whether",
"this",
"Progression",
"is",
"convergent",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Math/Analysis/Progression.php#L96-L110 |
36,177 | CeusMedia/Common | src/Alg/Math/Analysis/Progression.php | Alg_Math_Analysis_Progression.toArray | public function toArray()
{
$array = array();
for( $i=$this->interval->getStart(); $i<$this->interval->getEnd(); $i++ )
{
$value = $this->getPartialSum( $this->interval->getStart(), $i );
$array[$i] = $value;
}
return $array;
} | php | public function toArray()
{
$array = array();
for( $i=$this->interval->getStart(); $i<$this->interval->getEnd(); $i++ )
{
$value = $this->getPartialSum( $this->interval->getStart(), $i );
$array[$i] = $value;
}
return $array;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"array",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"$",
"this",
"->",
"interval",
"->",
"getStart",
"(",
")",
";",
"$",
"i",
"<",
"$",
"this",
"->",
"interval",
"->",
"getEnd",
... | Returns Sequence of Partial Sums as Array.
@access public
@return array | [
"Returns",
"Sequence",
"of",
"Partial",
"Sums",
"as",
"Array",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Math/Analysis/Progression.php#L128-L137 |
36,178 | CeusMedia/Common | src/Alg/Math/Analysis/Progression.php | Alg_Math_Analysis_Progression.toTable | public function toTable()
{
$array = $this->toArray();
$code = "<table cellpadding=2 cellspacing=0 border=1>";
foreach( $array as $key => $value )
$code .= "<tr><td>".$key."</td><td>".round( $value,8 )."</td></tr>";
$code .= "</table>";
return $code;
} | php | public function toTable()
{
$array = $this->toArray();
$code = "<table cellpadding=2 cellspacing=0 border=1>";
foreach( $array as $key => $value )
$code .= "<tr><td>".$key."</td><td>".round( $value,8 )."</td></tr>";
$code .= "</table>";
return $code;
} | [
"public",
"function",
"toTable",
"(",
")",
"{",
"$",
"array",
"=",
"$",
"this",
"->",
"toArray",
"(",
")",
";",
"$",
"code",
"=",
"\"<table cellpadding=2 cellspacing=0 border=1>\"",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
... | Returns Sequence of Partial Sums as HTML Table.
@access public
@return array | [
"Returns",
"Sequence",
"of",
"Partial",
"Sums",
"as",
"HTML",
"Table",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Math/Analysis/Progression.php#L144-L152 |
36,179 | RhubarbPHP/Scaffold.TokenBasedRestApi | src/Model/ApiToken.php | ApiToken.validateToken | public static function validateToken($tokenString)
{
$tokens = ApiToken::find(new AndGroup(
[
new Equals("Token", $tokenString),
new GreaterThan("Expires", "now", true)
]
));
if (count($tokens) != 1) {
throw new TokenInvali... | php | public static function validateToken($tokenString)
{
$tokens = ApiToken::find(new AndGroup(
[
new Equals("Token", $tokenString),
new GreaterThan("Expires", "now", true)
]
));
if (count($tokens) != 1) {
throw new TokenInvali... | [
"public",
"static",
"function",
"validateToken",
"(",
"$",
"tokenString",
")",
"{",
"$",
"tokens",
"=",
"ApiToken",
"::",
"find",
"(",
"new",
"AndGroup",
"(",
"[",
"new",
"Equals",
"(",
"\"Token\"",
",",
"$",
"tokenString",
")",
",",
"new",
"GreaterThan",
... | Validates a given token string is valid and returns the authenticated user model.
@param $tokenString
@return mixed
@throws \Rhubarb\Scaffolds\TokenBasedRestApi\Exceptions\TokenInvalidException Thrown if the token is invalid. | [
"Validates",
"a",
"given",
"token",
"string",
"is",
"valid",
"and",
"returns",
"the",
"authenticated",
"user",
"model",
"."
] | 581deee0eb6a675afa82c55f792a67a7895fdda2 | https://github.com/RhubarbPHP/Scaffold.TokenBasedRestApi/blob/581deee0eb6a675afa82c55f792a67a7895fdda2/src/Model/ApiToken.php#L68-L90 |
36,180 | RhubarbPHP/Scaffold.TokenBasedRestApi | src/Model/ApiToken.php | ApiToken.retrieveOrCreateToken | public static function retrieveOrCreateToken(Model $user, $ipAddress)
{
try {
$token = self::findFirst(new AndGroup([
new Equals("AuthenticatedUserID", $user->UniqueIdentifier),
new Equals("IpAddress", $ipAddress),
new GreaterThan("Expires", "now",... | php | public static function retrieveOrCreateToken(Model $user, $ipAddress)
{
try {
$token = self::findFirst(new AndGroup([
new Equals("AuthenticatedUserID", $user->UniqueIdentifier),
new Equals("IpAddress", $ipAddress),
new GreaterThan("Expires", "now",... | [
"public",
"static",
"function",
"retrieveOrCreateToken",
"(",
"Model",
"$",
"user",
",",
"$",
"ipAddress",
")",
"{",
"try",
"{",
"$",
"token",
"=",
"self",
"::",
"findFirst",
"(",
"new",
"AndGroup",
"(",
"[",
"new",
"Equals",
"(",
"\"AuthenticatedUserID\"",
... | Looks up an existing valid token for the user at the specified IP address. If none is found, it
creates a new one.
@param Model $user
@param string $ipAddress Usually the current HTTP requester's IP, retrieved from $_SERVER[REMOTE_ADDR]
@return ApiToken | [
"Looks",
"up",
"an",
"existing",
"valid",
"token",
"for",
"the",
"user",
"at",
"the",
"specified",
"IP",
"address",
".",
"If",
"none",
"is",
"found",
"it",
"creates",
"a",
"new",
"one",
"."
] | 581deee0eb6a675afa82c55f792a67a7895fdda2 | https://github.com/RhubarbPHP/Scaffold.TokenBasedRestApi/blob/581deee0eb6a675afa82c55f792a67a7895fdda2/src/Model/ApiToken.php#L113-L128 |
36,181 | CeusMedia/Common | src/XML/DOM/FeedIdentifier.php | XML_DOM_FeedIdentifier.identifyFromFile | public function identifyFromFile( $fileName )
{
$file = new FS_File_Reader( $fileName );
$xml = $file->readString();
return $this->identify( $xml );
} | php | public function identifyFromFile( $fileName )
{
$file = new FS_File_Reader( $fileName );
$xml = $file->readString();
return $this->identify( $xml );
} | [
"public",
"function",
"identifyFromFile",
"(",
"$",
"fileName",
")",
"{",
"$",
"file",
"=",
"new",
"FS_File_Reader",
"(",
"$",
"fileName",
")",
";",
"$",
"xml",
"=",
"$",
"file",
"->",
"readString",
"(",
")",
";",
"return",
"$",
"this",
"->",
"identify... | Identifies Feed from a File.
@access public
@param string $fileName XML File of Feed
@return string | [
"Identifies",
"Feed",
"from",
"a",
"File",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/DOM/FeedIdentifier.php#L88-L93 |
36,182 | CeusMedia/Common | src/XML/DOM/FeedIdentifier.php | XML_DOM_FeedIdentifier.identifyFromTree | public function identifyFromTree( $tree )
{
$this->type = "";
$this->version = "";
$nodename = strtolower( $tree->getNodeName() );
switch( $nodename )
{
case 'feed':
$type = "ATOM";
$version = $tree->getAttribute( 'version' );
break;
case 'rss':
$type = "RSS";
$version... | php | public function identifyFromTree( $tree )
{
$this->type = "";
$this->version = "";
$nodename = strtolower( $tree->getNodeName() );
switch( $nodename )
{
case 'feed':
$type = "ATOM";
$version = $tree->getAttribute( 'version' );
break;
case 'rss':
$type = "RSS";
$version... | [
"public",
"function",
"identifyFromTree",
"(",
"$",
"tree",
")",
"{",
"$",
"this",
"->",
"type",
"=",
"\"\"",
";",
"$",
"this",
"->",
"version",
"=",
"\"\"",
";",
"$",
"nodename",
"=",
"strtolower",
"(",
"$",
"tree",
"->",
"getNodeName",
"(",
")",
")... | Identifies Feed from XML Tree.
@access public
@param XML_DOM_Node $tree XML Tree of Feed
@return string | [
"Identifies",
"Feed",
"from",
"XML",
"Tree",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/DOM/FeedIdentifier.php#L101-L128 |
36,183 | CeusMedia/Common | src/UI/Image/Rotator.php | UI_Image_Rotator.rotate | public function rotate( $angle, $type = NULL )
{
if( !$this->sourceUri )
throw new RuntimeException( 'No source image set' );
# if( function_exists( 'imageantialias' ) )
# imageantialias( $this->target, TRUE );
$this->target = imagerotate( $this->source, $angle, 0 );
if( $this->targetUri )
return $thi... | php | public function rotate( $angle, $type = NULL )
{
if( !$this->sourceUri )
throw new RuntimeException( 'No source image set' );
# if( function_exists( 'imageantialias' ) )
# imageantialias( $this->target, TRUE );
$this->target = imagerotate( $this->source, $angle, 0 );
if( $this->targetUri )
return $thi... | [
"public",
"function",
"rotate",
"(",
"$",
"angle",
",",
"$",
"type",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"sourceUri",
")",
"throw",
"new",
"RuntimeException",
"(",
"'No source image set'",
")",
";",
"#\t\tif( function_exists( 'imageantial... | Invertes Source Image.
@access public
@param int $angle Rotation angle in degrees
@param int $type Output format type
@return bool | [
"Invertes",
"Source",
"Image",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image/Rotator.php#L50-L62 |
36,184 | CeusMedia/Common | src/UI/Image/Rotator.php | UI_Image_Rotator.rotateImage | public static function rotateImage( $imageUri, $angle, $quality = 100 )
{
$modifier = new UI_Image_Rotator( $imageUri, $imageUri, $quality );
return $modifier->rotate( $angle );
} | php | public static function rotateImage( $imageUri, $angle, $quality = 100 )
{
$modifier = new UI_Image_Rotator( $imageUri, $imageUri, $quality );
return $modifier->rotate( $angle );
} | [
"public",
"static",
"function",
"rotateImage",
"(",
"$",
"imageUri",
",",
"$",
"angle",
",",
"$",
"quality",
"=",
"100",
")",
"{",
"$",
"modifier",
"=",
"new",
"UI_Image_Rotator",
"(",
"$",
"imageUri",
",",
"$",
"imageUri",
",",
"$",
"quality",
")",
";... | Rotates an Image statically.
@access public
@static
@param string $imageUri URI of Image File
@param int $angle Rotation angle in degrees
@param int $quality JPEG Quality in percent | [
"Rotates",
"an",
"Image",
"statically",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/Image/Rotator.php#L72-L76 |
36,185 | CeusMedia/Common | src/FS/File/Log/Tracker/Reader.php | FS_File_Log_Tracker_Reader.callback | protected function callback( $matches )
{
// print_m( $matches );
$data = array(
'timestamp' => $matches[1],
'datetime' => $matches[2],
'remote_addr' => $matches[3],
'request_uri' => $matches[4],
'referer_uri' => $matches[5],
'useragent' => $matches[6],
);
return serialize( $data... | php | protected function callback( $matches )
{
// print_m( $matches );
$data = array(
'timestamp' => $matches[1],
'datetime' => $matches[2],
'remote_addr' => $matches[3],
'request_uri' => $matches[4],
'referer_uri' => $matches[5],
'useragent' => $matches[6],
);
return serialize( $data... | [
"protected",
"function",
"callback",
"(",
"$",
"matches",
")",
"{",
"//\t\tprint_m( $matches );\r",
"$",
"data",
"=",
"array",
"(",
"'timestamp'",
"=>",
"$",
"matches",
"[",
"1",
"]",
",",
"'datetime'",
"=>",
"$",
"matches",
"[",
"2",
"]",
",",
"'remote_ad... | Callback for Line Parser.
@access protected
@return string | [
"Callback",
"for",
"Line",
"Parser",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Log/Tracker/Reader.php#L72-L84 |
36,186 | CeusMedia/Common | src/FS/File/Log/Tracker/Reader.php | FS_File_Log_Tracker_Reader.getPagesPerVisitor | public function getPagesPerVisitor()
{
$remote_addrs = array();
$visitors = array();
$visitor = 0;
foreach( $this->data as $entry )
{
if( $entry['remote_addr'] != $this->skip )
{
if( isset( $remote_addrs[$entry['remote_addr']] ) )
{
if( $remote_addrs[$entry['remote_addr']] < ... | php | public function getPagesPerVisitor()
{
$remote_addrs = array();
$visitors = array();
$visitor = 0;
foreach( $this->data as $entry )
{
if( $entry['remote_addr'] != $this->skip )
{
if( isset( $remote_addrs[$entry['remote_addr']] ) )
{
if( $remote_addrs[$entry['remote_addr']] < ... | [
"public",
"function",
"getPagesPerVisitor",
"(",
")",
"{",
"$",
"remote_addrs",
"=",
"array",
"(",
")",
";",
"$",
"visitors",
"=",
"array",
"(",
")",
";",
"$",
"visitor",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"entry",
... | Calculates Page View Average of unique Visitors.
@access public
@return float | [
"Calculates",
"Page",
"View",
"Average",
"of",
"unique",
"Visitors",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Log/Tracker/Reader.php#L143-L174 |
36,187 | CeusMedia/Common | src/FS/File/Log/Tracker/Reader.php | FS_File_Log_Tracker_Reader.getReferers | public function getReferers( $skip )
{
$referers = array();
foreach( $this->data as $entry )
{
if( $entry['remote_addr'] != $this->skip )
{
if( $entry['referer_uri'] && !preg_match( "#.*".$skip.".*#si", $entry['referer_uri'] ) )
{
if( isset( $referers[$entry['referer_uri']] ) )
... | php | public function getReferers( $skip )
{
$referers = array();
foreach( $this->data as $entry )
{
if( $entry['remote_addr'] != $this->skip )
{
if( $entry['referer_uri'] && !preg_match( "#.*".$skip.".*#si", $entry['referer_uri'] ) )
{
if( isset( $referers[$entry['referer_uri']] ) )
... | [
"public",
"function",
"getReferers",
"(",
"$",
"skip",
")",
"{",
"$",
"referers",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"$",
"entry",
"[",
"'remote_addr'",
"]",
"!=",
"$",
... | Returns Referers of unique Visitors.
@access public
@return array | [
"Returns",
"Referers",
"of",
"unique",
"Visitors",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Log/Tracker/Reader.php#L181-L203 |
36,188 | CeusMedia/Common | src/XML/DOM/ObjectSerializer.php | XML_DOM_ObjectSerializer.serialize | public static function serialize( $object, $encoding = "utf-8" )
{
$root = new XML_DOM_Node( "object" );
$root->setAttribute( 'class', get_class( $object ) );
$vars = get_object_vars( $object );
self::serializeVarsRec( $vars, $root );
$builder = new XML_DOM_Builder();
$serial = $builder->build( $ro... | php | public static function serialize( $object, $encoding = "utf-8" )
{
$root = new XML_DOM_Node( "object" );
$root->setAttribute( 'class', get_class( $object ) );
$vars = get_object_vars( $object );
self::serializeVarsRec( $vars, $root );
$builder = new XML_DOM_Builder();
$serial = $builder->build( $ro... | [
"public",
"static",
"function",
"serialize",
"(",
"$",
"object",
",",
"$",
"encoding",
"=",
"\"utf-8\"",
")",
"{",
"$",
"root",
"=",
"new",
"XML_DOM_Node",
"(",
"\"object\"",
")",
";",
"$",
"root",
"->",
"setAttribute",
"(",
"'class'",
",",
"get_class",
... | Builds XML String from an Object.
@access public
@static
@param mixed $object Object to serialize
@param string $encoding Encoding Type
@return string | [
"Builds",
"XML",
"String",
"from",
"an",
"Object",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/DOM/ObjectSerializer.php#L52-L61 |
36,189 | CeusMedia/Common | src/XML/DOM/ObjectSerializer.php | XML_DOM_ObjectSerializer.serializeVarsRec | protected static function serializeVarsRec( $array, &$node )
{
foreach( $array as $key => $value)
{
switch( gettype( $value ) )
{
case 'NULL':
$child = new XML_DOM_Node( "null" );
$child->setAttribute( "name", $key );
$node->addChild( $child );
break;
case 'boolean':
... | php | protected static function serializeVarsRec( $array, &$node )
{
foreach( $array as $key => $value)
{
switch( gettype( $value ) )
{
case 'NULL':
$child = new XML_DOM_Node( "null" );
$child->setAttribute( "name", $key );
$node->addChild( $child );
break;
case 'boolean':
... | [
"protected",
"static",
"function",
"serializeVarsRec",
"(",
"$",
"array",
",",
"&",
"$",
"node",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"switch",
"(",
"gettype",
"(",
"$",
"value",
")",
")",
"{",
"ca... | Adds XML Nodes to a XML Tree by their Type while supporting nested Arrays.
@access protected
@static
@param array $array Array of Vars to add
@param XML_DOM_Node $node current XML Tree Node
@return string | [
"Adds",
"XML",
"Nodes",
"to",
"a",
"XML",
"Tree",
"by",
"their",
"Type",
"while",
"supporting",
"nested",
"Arrays",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/DOM/ObjectSerializer.php#L71-L118 |
36,190 | CeusMedia/Common | src/XML/DOM/Parser.php | XML_DOM_Parser.loadXml | protected function loadXml( $xml )
{
$xsv = new XML_DOM_SyntaxValidator;
if( !$xsv->validate( $xml ) )
throw new Exception( "XML Document is not valid:".$xsv->getErrors() );
$this->document = $xsv->getDocument();
$this->clearOptions();
foreach( $this->attributes as $attribute )
if( isset( $this... | php | protected function loadXml( $xml )
{
$xsv = new XML_DOM_SyntaxValidator;
if( !$xsv->validate( $xml ) )
throw new Exception( "XML Document is not valid:".$xsv->getErrors() );
$this->document = $xsv->getDocument();
$this->clearOptions();
foreach( $this->attributes as $attribute )
if( isset( $this... | [
"protected",
"function",
"loadXml",
"(",
"$",
"xml",
")",
"{",
"$",
"xsv",
"=",
"new",
"XML_DOM_SyntaxValidator",
";",
"if",
"(",
"!",
"$",
"xsv",
"->",
"validate",
"(",
"$",
"xml",
")",
")",
"throw",
"new",
"Exception",
"(",
"\"XML Document is not valid:\... | Loads XML String into DOM Document Object before parsing.
@access public
@param string $xml XML to be parsed
@return void | [
"Loads",
"XML",
"String",
"into",
"DOM",
"Document",
"Object",
"before",
"parsing",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/DOM/Parser.php#L71-L81 |
36,191 | CeusMedia/Common | src/XML/DOM/Parser.php | XML_DOM_Parser.parse | public function parse( $xml )
{
$this->loadXml( $xml );
$root = $this->document->firstChild;
while( $root->nodeType == XML_COMMENT_NODE )
$root = $root->nextSibling;
$tree = new XML_DOM_Node( $root->nodeName );
if( $root->hasAttributes())
{
$attributeNodes = $root->attributes;
foreach(... | php | public function parse( $xml )
{
$this->loadXml( $xml );
$root = $this->document->firstChild;
while( $root->nodeType == XML_COMMENT_NODE )
$root = $root->nextSibling;
$tree = new XML_DOM_Node( $root->nodeName );
if( $root->hasAttributes())
{
$attributeNodes = $root->attributes;
foreach(... | [
"public",
"function",
"parse",
"(",
"$",
"xml",
")",
"{",
"$",
"this",
"->",
"loadXml",
"(",
"$",
"xml",
")",
";",
"$",
"root",
"=",
"$",
"this",
"->",
"document",
"->",
"firstChild",
";",
"while",
"(",
"$",
"root",
"->",
"nodeType",
"==",
"XML_COM... | Parses XML String to XML Tree.
@access public
@param string $xml XML to parse
@return XML_DOM_Node | [
"Parses",
"XML",
"String",
"to",
"XML",
"Tree",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/DOM/Parser.php#L89-L105 |
36,192 | CeusMedia/Common | src/XML/DOM/Parser.php | XML_DOM_Parser.parseRecursive | protected function parseRecursive( $root, $tree )
{
$nodes = array();
if( $child = $root->firstChild )
{
while( $child )
{
$attributes = $child->hasAttributes()? $child->attributes : array();
switch( $child->nodeType )
{
case XML_ELEMENT_NODE:
$node = new XML_DOM_Node( $ch... | php | protected function parseRecursive( $root, $tree )
{
$nodes = array();
if( $child = $root->firstChild )
{
while( $child )
{
$attributes = $child->hasAttributes()? $child->attributes : array();
switch( $child->nodeType )
{
case XML_ELEMENT_NODE:
$node = new XML_DOM_Node( $ch... | [
"protected",
"function",
"parseRecursive",
"(",
"$",
"root",
",",
"$",
"tree",
")",
"{",
"$",
"nodes",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"child",
"=",
"$",
"root",
"->",
"firstChild",
")",
"{",
"while",
"(",
"$",
"child",
")",
"{",
"$"... | Parses XML File to XML Tree recursive.
@access protected
@param DOMElement $root DOM Node Element
@param XML_DOM_Node $tree Parent XML Node
@return bool | [
"Parses",
"XML",
"File",
"to",
"XML",
"Tree",
"recursive",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/DOM/Parser.php#L114-L155 |
36,193 | CeusMedia/Common | src/Net/XMPP/JID.php | Net_XMPP_JID.disassemble | static public function disassemble( $jid ){
if( !self::isValid( $jid ) )
throw new InvalidArgumentException( 'Given JID is not valid.' );
$matches = array();
preg_match_all( self::$regexJid, $jid, $matches );
return array(
'domain' => $matches[2][0],
'node' => $matches[1][0],
'resource' => $matches... | php | static public function disassemble( $jid ){
if( !self::isValid( $jid ) )
throw new InvalidArgumentException( 'Given JID is not valid.' );
$matches = array();
preg_match_all( self::$regexJid, $jid, $matches );
return array(
'domain' => $matches[2][0],
'node' => $matches[1][0],
'resource' => $matches... | [
"static",
"public",
"function",
"disassemble",
"(",
"$",
"jid",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isValid",
"(",
"$",
"jid",
")",
")",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Given JID is not valid.'",
")",
";",
"$",
"matches",
"=",
"arra... | Spilts JID into parts.
@static
@access public
@return array | [
"Spilts",
"JID",
"into",
"parts",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/XMPP/JID.php#L68-L78 |
36,194 | CeusMedia/Common | src/Net/XMPP/JID.php | Net_XMPP_JID.getJid | static public function getJid( $domain, $node = NULL, $resource = NULL ){
$jid = $domain;
if( strlen( trim( $node ) ) )
$jid = $node.'@'.$domain;
if( strlen( trim( $resource ) ) )
$jid .= "/".$resource;
return $jid;
} | php | static public function getJid( $domain, $node = NULL, $resource = NULL ){
$jid = $domain;
if( strlen( trim( $node ) ) )
$jid = $node.'@'.$domain;
if( strlen( trim( $resource ) ) )
$jid .= "/".$resource;
return $jid;
} | [
"static",
"public",
"function",
"getJid",
"(",
"$",
"domain",
",",
"$",
"node",
"=",
"NULL",
",",
"$",
"resource",
"=",
"NULL",
")",
"{",
"$",
"jid",
"=",
"$",
"domain",
";",
"if",
"(",
"strlen",
"(",
"trim",
"(",
"$",
"node",
")",
")",
")",
"$... | Builds and returns JID from parts.
@static
@access public
@param string $domain Domain name of XMPP server
@param string $node Name of node on XMPP server
@param string $resource Name of client resource
@return string | [
"Builds",
"and",
"returns",
"JID",
"from",
"parts",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/XMPP/JID.php#L107-L114 |
36,195 | CeusMedia/Common | src/Net/XMPP/JID.php | Net_XMPP_JID.set | public function set( $domain, $node = NULL, $resource = NULL ){
if( !strlen( trim( $domain ) ) )
throw new InvalidArgumentException( 'Domain is missing' );
$this->domain = $domain;
$this->node = $node;
$this->resource = $resource;
} | php | public function set( $domain, $node = NULL, $resource = NULL ){
if( !strlen( trim( $domain ) ) )
throw new InvalidArgumentException( 'Domain is missing' );
$this->domain = $domain;
$this->node = $node;
$this->resource = $resource;
} | [
"public",
"function",
"set",
"(",
"$",
"domain",
",",
"$",
"node",
"=",
"NULL",
",",
"$",
"resource",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"strlen",
"(",
"trim",
"(",
"$",
"domain",
")",
")",
")",
"throw",
"new",
"InvalidArgumentException",
"(",
... | Sets JID by parts.
@access public
@param string $domain Domain name of XMPP server
@param string $node Name of node on XMPP server
@param string $resource Name of client resource
@return void | [
"Sets",
"JID",
"by",
"parts",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/XMPP/JID.php#L152-L158 |
36,196 | CeusMedia/Common | src/Net/XMPP/JID.php | Net_XMPP_JID.setJid | public function setJid( $jid ){
extract( self::disassemble( $jid ) );
$this->set( $domain, $node, $resource );
} | php | public function setJid( $jid ){
extract( self::disassemble( $jid ) );
$this->set( $domain, $node, $resource );
} | [
"public",
"function",
"setJid",
"(",
"$",
"jid",
")",
"{",
"extract",
"(",
"self",
"::",
"disassemble",
"(",
"$",
"jid",
")",
")",
";",
"$",
"this",
"->",
"set",
"(",
"$",
"domain",
",",
"$",
"node",
",",
"$",
"resource",
")",
";",
"}"
] | Sets JID.
@access public
@param string $jid JID: domain + optional node and resource
@return void | [
"Sets",
"JID",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/XMPP/JID.php#L166-L169 |
36,197 | CeusMedia/Common | src/Alg/Search/Interpolation.php | Alg_Search_Interpolation.calculateIndex | protected function calculateIndex( $list, $search, $lowbound, $highbound )
{
$spanIndex = $list[$highbound] - $list[$lowbound];
$spanValues = $highbound - $lowbound;
$spanDiff = $search - $list[$lowbound];
$index = $lowbound + round( $spanValues * ( $spanDiff / $spanIndex ) );
return $index;
} | php | protected function calculateIndex( $list, $search, $lowbound, $highbound )
{
$spanIndex = $list[$highbound] - $list[$lowbound];
$spanValues = $highbound - $lowbound;
$spanDiff = $search - $list[$lowbound];
$index = $lowbound + round( $spanValues * ( $spanDiff / $spanIndex ) );
return $index;
} | [
"protected",
"function",
"calculateIndex",
"(",
"$",
"list",
",",
"$",
"search",
",",
"$",
"lowbound",
",",
"$",
"highbound",
")",
"{",
"$",
"spanIndex",
"=",
"$",
"list",
"[",
"$",
"highbound",
"]",
"-",
"$",
"list",
"[",
"$",
"lowbound",
"]",
";",
... | Calculates next bound index.
@access protected
@param array $ist List to search in
@param mixed $search Element to search
@param int $lowbound Last lower bound
@param int $highbound Last higher bound
@return int | [
"Calculates",
"next",
"bound",
"index",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Search/Interpolation.php#L49-L56 |
36,198 | CeusMedia/Common | src/Alg/Search/Interpolation.php | Alg_Search_Interpolation.search | public function search( $list, $search )
{
$lowbound = 0; // lowbound - untergrenze
$highbound = sizeof( $list ) - 1; // highbound - obergrenze
do
{
$index = $this->calculateIndex( $list, $search, $lowbound, $highbound );
// echo "[".$lowbound."|".$highbound."] search_index: ".$index."... | php | public function search( $list, $search )
{
$lowbound = 0; // lowbound - untergrenze
$highbound = sizeof( $list ) - 1; // highbound - obergrenze
do
{
$index = $this->calculateIndex( $list, $search, $lowbound, $highbound );
// echo "[".$lowbound."|".$highbound."] search_index: ".$index."... | [
"public",
"function",
"search",
"(",
"$",
"list",
",",
"$",
"search",
")",
"{",
"$",
"lowbound",
"=",
"0",
";",
"// lowbound - untergrenze\r",
"$",
"highbound",
"=",
"sizeof",
"(",
"$",
"list",
")",
"-",
"1",
";",
"// highbound - obergrenze\r",
"do",
"{",
... | Searches in List and returns position if found, else -1.
@access public
@param array $ist List to search in
@param mixed $search Element to search
@return int | [
"Searches",
"in",
"List",
"and",
"returns",
"position",
"if",
"found",
"else",
"-",
"1",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Search/Interpolation.php#L64-L83 |
36,199 | CeusMedia/Common | src/Net/HTTP/Reader.php | Net_HTTP_Reader.applyCurlOptions | protected function applyCurlOptions( Net_CURL $curl, $options = array() )
{
foreach( $options as $key => $value )
{
if( is_string( $key ) )
{
if( !( preg_match( "@^CURLOPT_@", $key ) && defined( $key ) ) )
throw new InvalidArgumentException( 'Invalid option constant key "'.$key.'"' );
$key = con... | php | protected function applyCurlOptions( Net_CURL $curl, $options = array() )
{
foreach( $options as $key => $value )
{
if( is_string( $key ) )
{
if( !( preg_match( "@^CURLOPT_@", $key ) && defined( $key ) ) )
throw new InvalidArgumentException( 'Invalid option constant key "'.$key.'"' );
$key = con... | [
"protected",
"function",
"applyCurlOptions",
"(",
"Net_CURL",
"$",
"curl",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"options",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"key",... | Applies cURL Options to a cURL Object.
@access protected
@param Net_CURL $curl cURL Object
@param array $options Map of cURL Options
@return void | [
"Applies",
"cURL",
"Options",
"to",
"a",
"cURL",
"Object",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/HTTP/Reader.php#L72-L86 |
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.