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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
11,400 | gwsn/transformer | src/Mapping/BaseMapping.php | BaseMapping.buildMappingOnObject | protected function buildMappingOnObject($source = null, array $blacklist = []):array {
if(!is_object($source)) {
return [];
}
try {
$mapping = [];
$reflection = new \ReflectionClass($source);
$properties = $reflection->getProperties();
... | php | protected function buildMappingOnObject($source = null, array $blacklist = []):array {
if(!is_object($source)) {
return [];
}
try {
$mapping = [];
$reflection = new \ReflectionClass($source);
$properties = $reflection->getProperties();
... | [
"protected",
"function",
"buildMappingOnObject",
"(",
"$",
"source",
"=",
"null",
",",
"array",
"$",
"blacklist",
"=",
"[",
"]",
")",
":",
"array",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"source",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"... | Build a mapping based on properties of a entity.
@param object $source
@param array $blacklist
@return array | [
"Build",
"a",
"mapping",
"based",
"on",
"properties",
"of",
"a",
"entity",
"."
] | 716b3a59bfb4676f6c23d9f21b3fd3a44b192401 | https://github.com/gwsn/transformer/blob/716b3a59bfb4676f6c23d9f21b3fd3a44b192401/src/Mapping/BaseMapping.php#L37-L57 |
11,401 | Webiny/Hrc | src/Webiny/Hrc/Hrc.php | Hrc.getCacheRule | public function getCacheRule($name = null)
{
if (is_null($name)) {
return $this->cacheRules;
} else {
foreach ($this->cacheRules as $r) {
if ($r->getName() == $name) {
return $r;
}
}
return false;
... | php | public function getCacheRule($name = null)
{
if (is_null($name)) {
return $this->cacheRules;
} else {
foreach ($this->cacheRules as $r) {
if ($r->getName() == $name) {
return $r;
}
}
return false;
... | [
"public",
"function",
"getCacheRule",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"this",
"->",
"cacheRules",
";",
"}",
"else",
"{",
"foreach",
"(",
"$",
"this",
"->",
"cacheRules",
... | Get a specific cache rule, or all of them.
@param null|string $name If provided, only the matching rule will be returned.
@return bool|CacheRule | [
"Get",
"a",
"specific",
"cache",
"rule",
"or",
"all",
"of",
"them",
"."
] | 2594d645dd79a579916d90ec93ce815bd413558f | https://github.com/Webiny/Hrc/blob/2594d645dd79a579916d90ec93ce815bd413558f/src/Webiny/Hrc/Hrc.php#L190-L203 |
11,402 | Webiny/Hrc | src/Webiny/Hrc/Hrc.php | Hrc.setCacheRules | public function setCacheRules(array $cacheRules)
{
foreach ($cacheRules as $crName => $cr) {
if (isset($cr['Ttl']) && isset($cr['Tags']) && isset($cr['Match'])) {
$this->cacheRules[$crName] = new CacheRule($crName, $cr['Ttl'], $cr['Tags'], $cr['Match'], $cr);
} else {... | php | public function setCacheRules(array $cacheRules)
{
foreach ($cacheRules as $crName => $cr) {
if (isset($cr['Ttl']) && isset($cr['Tags']) && isset($cr['Match'])) {
$this->cacheRules[$crName] = new CacheRule($crName, $cr['Ttl'], $cr['Tags'], $cr['Match'], $cr);
} else {... | [
"public",
"function",
"setCacheRules",
"(",
"array",
"$",
"cacheRules",
")",
"{",
"foreach",
"(",
"$",
"cacheRules",
"as",
"$",
"crName",
"=>",
"$",
"cr",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"cr",
"[",
"'Ttl'",
"]",
")",
"&&",
"isset",
"(",
"$"... | Overwrite the current cache rule list.
@param array $cacheRules
@throws HrcException | [
"Overwrite",
"the",
"current",
"cache",
"rule",
"list",
"."
] | 2594d645dd79a579916d90ec93ce815bd413558f | https://github.com/Webiny/Hrc/blob/2594d645dd79a579916d90ec93ce815bd413558f/src/Webiny/Hrc/Hrc.php#L212-L222 |
11,403 | Webiny/Hrc | src/Webiny/Hrc/Hrc.php | Hrc.save | public function save($name, $content, $cacheRule = null, $cacheTagsAppend = [])
{
// initialize log
$log = new DebugLog();
$log->addMessage('State', 'Save');
// check if get
if (!isset($_SERVER['REQUEST_METHOD']) || strtolower($_SERVER['REQUEST_METHOD']) != 'get') {
... | php | public function save($name, $content, $cacheRule = null, $cacheTagsAppend = [])
{
// initialize log
$log = new DebugLog();
$log->addMessage('State', 'Save');
// check if get
if (!isset($_SERVER['REQUEST_METHOD']) || strtolower($_SERVER['REQUEST_METHOD']) != 'get') {
... | [
"public",
"function",
"save",
"(",
"$",
"name",
",",
"$",
"content",
",",
"$",
"cacheRule",
"=",
"null",
",",
"$",
"cacheTagsAppend",
"=",
"[",
"]",
")",
"{",
"// initialize log",
"$",
"log",
"=",
"new",
"DebugLog",
"(",
")",
";",
"$",
"log",
"->",
... | Save a value into cache.
In case if no cache rule was matched, false is returned.
@param string $name Name that will be used to construct the cache key.
@param string $content Content that should be save, must be a string.
@param string $cacheRule The name of the cache rule that should be used, instead of the matched... | [
"Save",
"a",
"value",
"into",
"cache",
".",
"In",
"case",
"if",
"no",
"cache",
"rule",
"was",
"matched",
"false",
"is",
"returned",
"."
] | 2594d645dd79a579916d90ec93ce815bd413558f | https://github.com/Webiny/Hrc/blob/2594d645dd79a579916d90ec93ce815bd413558f/src/Webiny/Hrc/Hrc.php#L351-L413 |
11,404 | Webiny/Hrc | src/Webiny/Hrc/Hrc.php | Hrc.purgeByCacheKey | public function purgeByCacheKey($cacheKey)
{
// initialize log
$log = new DebugLog();
$log->addMessage('State', 'Purge by cache key');
// remove the key from index
$this->indexStorage->deleteEntryByKey($cacheKey);
// purges from cache storage
return $this->c... | php | public function purgeByCacheKey($cacheKey)
{
// initialize log
$log = new DebugLog();
$log->addMessage('State', 'Purge by cache key');
// remove the key from index
$this->indexStorage->deleteEntryByKey($cacheKey);
// purges from cache storage
return $this->c... | [
"public",
"function",
"purgeByCacheKey",
"(",
"$",
"cacheKey",
")",
"{",
"// initialize log",
"$",
"log",
"=",
"new",
"DebugLog",
"(",
")",
";",
"$",
"log",
"->",
"addMessage",
"(",
"'State'",
",",
"'Purge by cache key'",
")",
";",
"// remove the key from index"... | Purge the given cache key.
@param string $cacheKey Cache key that should be purged.
@return bool True if purge was successful, otherwise false. | [
"Purge",
"the",
"given",
"cache",
"key",
"."
] | 2594d645dd79a579916d90ec93ce815bd413558f | https://github.com/Webiny/Hrc/blob/2594d645dd79a579916d90ec93ce815bd413558f/src/Webiny/Hrc/Hrc.php#L422-L433 |
11,405 | Webiny/Hrc | src/Webiny/Hrc/Hrc.php | Hrc.getMatchedRule | public function getMatchedRule($cacheRule = null)
{
$request = $this->getRequest();
if (!empty($cacheRule)) {
if (isset($this->cacheRules[$cacheRule])) {
$cr = $this->cacheRules[$cacheRule];
$cacheKey = $cr->match($request);
return new Ma... | php | public function getMatchedRule($cacheRule = null)
{
$request = $this->getRequest();
if (!empty($cacheRule)) {
if (isset($this->cacheRules[$cacheRule])) {
$cr = $this->cacheRules[$cacheRule];
$cacheKey = $cr->match($request);
return new Ma... | [
"public",
"function",
"getMatchedRule",
"(",
"$",
"cacheRule",
"=",
"null",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"cacheRule",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
... | Returns a MatchedRule instance of the matched cache rule.
@return bool|MatchedRule MatchedRule instance. or false if no cache rule matched the request. | [
"Returns",
"a",
"MatchedRule",
"instance",
"of",
"the",
"matched",
"cache",
"rule",
"."
] | 2594d645dd79a579916d90ec93ce815bd413558f | https://github.com/Webiny/Hrc/blob/2594d645dd79a579916d90ec93ce815bd413558f/src/Webiny/Hrc/Hrc.php#L528-L549 |
11,406 | Webiny/Hrc | src/Webiny/Hrc/Hrc.php | Hrc.canPurge | private function canPurge()
{
// check if purge header exists
if (!$this->request->matchHeader(self::H_PURGE)) {
return false;
}
if ($this->controlKey == '') {
return true; // everybody can purge
}
// only users with valid control key can pur... | php | private function canPurge()
{
// check if purge header exists
if (!$this->request->matchHeader(self::H_PURGE)) {
return false;
}
if ($this->controlKey == '') {
return true; // everybody can purge
}
// only users with valid control key can pur... | [
"private",
"function",
"canPurge",
"(",
")",
"{",
"// check if purge header exists",
"if",
"(",
"!",
"$",
"this",
"->",
"request",
"->",
"matchHeader",
"(",
"self",
"::",
"H_PURGE",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->"... | Checks if user can purge the cache by validating the control key and purge flag inside the request headers.
@return bool | [
"Checks",
"if",
"user",
"can",
"purge",
"the",
"cache",
"by",
"validating",
"the",
"control",
"key",
"and",
"purge",
"flag",
"inside",
"the",
"request",
"headers",
"."
] | 2594d645dd79a579916d90ec93ce815bd413558f | https://github.com/Webiny/Hrc/blob/2594d645dd79a579916d90ec93ce815bd413558f/src/Webiny/Hrc/Hrc.php#L569-L586 |
11,407 | Webiny/Hrc | src/Webiny/Hrc/Hrc.php | Hrc.canDebug | private function canDebug()
{
// check if debug header exists
if (!$this->request->matchHeader(self::H_DEBUG)) {
return false;
}
if ($this->controlKey == '') {
return true; // everybody can debug
}
// only users with valid control key can deb... | php | private function canDebug()
{
// check if debug header exists
if (!$this->request->matchHeader(self::H_DEBUG)) {
return false;
}
if ($this->controlKey == '') {
return true; // everybody can debug
}
// only users with valid control key can deb... | [
"private",
"function",
"canDebug",
"(",
")",
"{",
"// check if debug header exists",
"if",
"(",
"!",
"$",
"this",
"->",
"request",
"->",
"matchHeader",
"(",
"self",
"::",
"H_DEBUG",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->"... | Checks if user can retrieve debug log by validating the control key and debug flag inside the request headers.
@return bool | [
"Checks",
"if",
"user",
"can",
"retrieve",
"debug",
"log",
"by",
"validating",
"the",
"control",
"key",
"and",
"debug",
"flag",
"inside",
"the",
"request",
"headers",
"."
] | 2594d645dd79a579916d90ec93ce815bd413558f | https://github.com/Webiny/Hrc/blob/2594d645dd79a579916d90ec93ce815bd413558f/src/Webiny/Hrc/Hrc.php#L593-L610 |
11,408 | phapi/di | src/Phapi/Di/Validator/Contract.php | Contract.validate | public function validate($value)
{
$original = $value;
// Check if we are using a callable to get the pipeline
if (is_callable($value) && $value instanceof \Closure) {
$value = $value($this->container);
}
// Check if we have a valid pipeline instance
if ... | php | public function validate($value)
{
$original = $value;
// Check if we are using a callable to get the pipeline
if (is_callable($value) && $value instanceof \Closure) {
$value = $value($this->container);
}
// Check if we have a valid pipeline instance
if ... | [
"public",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"$",
"original",
"=",
"$",
"value",
";",
"// Check if we are using a callable to get the pipeline",
"if",
"(",
"is_callable",
"(",
"$",
"value",
")",
"&&",
"$",
"value",
"instanceof",
"\\",
"Closure"... | Validate middleware pipeline
@trows \RuntimeException when the configured pipeline does not implement the Pipeline Contract
@param $value
@return mixed | [
"Validate",
"middleware",
"pipeline"
] | 869f0f0245540f167192ddf72a195adb70aae5a9 | https://github.com/phapi/di/blob/869f0f0245540f167192ddf72a195adb70aae5a9/src/Phapi/Di/Validator/Contract.php#L51-L67 |
11,409 | LastCallMedia/Mannequin-Core | Asset/AssetManager.php | AssetManager.get | public function get(string $path): SplFileInfo
{
$path = ltrim($path, '\\/');
foreach ($this->assets as $asset) {
if ($asset->getRelativePathname() === $path) {
return $asset;
}
}
throw new NotFoundHttpException(sprintf('Unknown asset: %s', $pa... | php | public function get(string $path): SplFileInfo
{
$path = ltrim($path, '\\/');
foreach ($this->assets as $asset) {
if ($asset->getRelativePathname() === $path) {
return $asset;
}
}
throw new NotFoundHttpException(sprintf('Unknown asset: %s', $pa... | [
"public",
"function",
"get",
"(",
"string",
"$",
"path",
")",
":",
"SplFileInfo",
"{",
"$",
"path",
"=",
"ltrim",
"(",
"$",
"path",
",",
"'\\\\/'",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"assets",
"as",
"$",
"asset",
")",
"{",
"if",
"(",
"$... | Get a single relative asset.
@param string $path the relative path to the asset
@return SplFileInfo | [
"Get",
"a",
"single",
"relative",
"asset",
"."
] | 1d5cacd54a5060b8fbfc0e2dfee035a1aacb9c81 | https://github.com/LastCallMedia/Mannequin-Core/blob/1d5cacd54a5060b8fbfc0e2dfee035a1aacb9c81/Asset/AssetManager.php#L38-L47 |
11,410 | osflab/controller | Router.php | Router.getAppUri | public function getAppUri()
{
$uri = filter_input(INPUT_SERVER, 'REQUEST_URI');
$scriptPath = $this->getBaseUrl();
$appUri = substr($uri, strlen($scriptPath));
return $appUri === false ? '' : $appUri;
} | php | public function getAppUri()
{
$uri = filter_input(INPUT_SERVER, 'REQUEST_URI');
$scriptPath = $this->getBaseUrl();
$appUri = substr($uri, strlen($scriptPath));
return $appUri === false ? '' : $appUri;
} | [
"public",
"function",
"getAppUri",
"(",
")",
"{",
"$",
"uri",
"=",
"filter_input",
"(",
"INPUT_SERVER",
",",
"'REQUEST_URI'",
")",
";",
"$",
"scriptPath",
"=",
"$",
"this",
"->",
"getBaseUrl",
"(",
")",
";",
"$",
"appUri",
"=",
"substr",
"(",
"$",
"uri... | Get the application URI calculated from REQUEST_URI
@return string | [
"Get",
"the",
"application",
"URI",
"calculated",
"from",
"REQUEST_URI"
] | d59344fc204a74995224e3da39b9debd78fdb974 | https://github.com/osflab/controller/blob/d59344fc204a74995224e3da39b9debd78fdb974/Router.php#L43-L49 |
11,411 | osflab/controller | Router.php | Router.getBaseUrl | public function getBaseUrl(bool $withHostName = false):string
{
if (!$this->baseUrl) {
$this->baseUrl = dirname(filter_input(INPUT_SERVER, 'SCRIPT_NAME'));
}
return ($withHostName ? self::getHttpHost() : '') . $this->baseUrl;
} | php | public function getBaseUrl(bool $withHostName = false):string
{
if (!$this->baseUrl) {
$this->baseUrl = dirname(filter_input(INPUT_SERVER, 'SCRIPT_NAME'));
}
return ($withHostName ? self::getHttpHost() : '') . $this->baseUrl;
} | [
"public",
"function",
"getBaseUrl",
"(",
"bool",
"$",
"withHostName",
"=",
"false",
")",
":",
"string",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"baseUrl",
")",
"{",
"$",
"this",
"->",
"baseUrl",
"=",
"dirname",
"(",
"filter_input",
"(",
"INPUT_SERVER",
... | Get the application base url
@return string
@task [ROUTER] gerer https | [
"Get",
"the",
"application",
"base",
"url"
] | d59344fc204a74995224e3da39b9debd78fdb974 | https://github.com/osflab/controller/blob/d59344fc204a74995224e3da39b9debd78fdb974/Router.php#L56-L62 |
11,412 | osflab/controller | Router.php | Router.route | public function route($uri = null)
{
if ($uri === null) {
$uri = $this->getAppUri();
}
//$uri = ltrim(preg_replace('/^([^&]*)&.*$/', '$1', $uri), '/');
$urlElements = parse_url($uri);
$uri = isset($urlElements['path']) ? $urlElements['path'] ... | php | public function route($uri = null)
{
if ($uri === null) {
$uri = $this->getAppUri();
}
//$uri = ltrim(preg_replace('/^([^&]*)&.*$/', '$1', $uri), '/');
$urlElements = parse_url($uri);
$uri = isset($urlElements['path']) ? $urlElements['path'] ... | [
"public",
"function",
"route",
"(",
"$",
"uri",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"uri",
"===",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getAppUri",
"(",
")",
";",
"}",
"//$uri = ltrim(preg_replace('/^([^&]*)&.*$/', '$1', $uri), '/');",
... | Update Request with params from url
@param string $uri
@return Router | [
"Update",
"Request",
"with",
"params",
"from",
"url"
] | d59344fc204a74995224e3da39b9debd78fdb974 | https://github.com/osflab/controller/blob/d59344fc204a74995224e3da39b9debd78fdb974/Router.php#L97-L132 |
11,413 | osflab/controller | Router.php | Router.buildUri | public function buildUri(array $params = null, $controller = null, $action = null, $prepareUri = true)
{
$request = Container::getRequest();
$request->setBaseUrl($this->getBaseUrl());
if ($prepareUri) {
[$params, $controller, $action] = $this->prepareUri($params, $controller, $ac... | php | public function buildUri(array $params = null, $controller = null, $action = null, $prepareUri = true)
{
$request = Container::getRequest();
$request->setBaseUrl($this->getBaseUrl());
if ($prepareUri) {
[$params, $controller, $action] = $this->prepareUri($params, $controller, $ac... | [
"public",
"function",
"buildUri",
"(",
"array",
"$",
"params",
"=",
"null",
",",
"$",
"controller",
"=",
"null",
",",
"$",
"action",
"=",
"null",
",",
"$",
"prepareUri",
"=",
"true",
")",
"{",
"$",
"request",
"=",
"Container",
"::",
"getRequest",
"(",
... | Build an URL from specified params
@param array $params
@param string $controller
@param string $action
@param bool $prepareUri
@return string | [
"Build",
"an",
"URL",
"from",
"specified",
"params"
] | d59344fc204a74995224e3da39b9debd78fdb974 | https://github.com/osflab/controller/blob/d59344fc204a74995224e3da39b9debd78fdb974/Router.php#L155-L188 |
11,414 | coolms/doctrine | src/Session/Container.php | Container.getEventAdapter | protected function getEventAdapter(EventArgs $args)
{
$class = get_class($args);
if (preg_match('@Doctrine\\\([^\\\]+)@', $class, $m) && in_array($m[1], ['ODM', 'ORM'])) {
if (!isset($this->adapters[$m[1]])) {
$adapterClass = 'Gedmo\\Mapping\\Event\\Adapter\\' . $m[1];
... | php | protected function getEventAdapter(EventArgs $args)
{
$class = get_class($args);
if (preg_match('@Doctrine\\\([^\\\]+)@', $class, $m) && in_array($m[1], ['ODM', 'ORM'])) {
if (!isset($this->adapters[$m[1]])) {
$adapterClass = 'Gedmo\\Mapping\\Event\\Adapter\\' . $m[1];
... | [
"protected",
"function",
"getEventAdapter",
"(",
"EventArgs",
"$",
"args",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"args",
")",
";",
"if",
"(",
"preg_match",
"(",
"'@Doctrine\\\\\\([^\\\\\\]+)@'",
",",
"$",
"class",
",",
"$",
"m",
")",
"&&",
... | Get an event adapter to handle event specific methods
@param EventArgs $args
@throws \InvalidArgumentException - if event is not recognized
@return AdapterInterface | [
"Get",
"an",
"event",
"adapter",
"to",
"handle",
"event",
"specific",
"methods"
] | d7d233594b37cd0c3abc37a46e4e4b965767c3b4 | https://github.com/coolms/doctrine/blob/d7d233594b37cd0c3abc37a46e4e4b965767c3b4/src/Session/Container.php#L142-L156 |
11,415 | SocietyCMS/Setting | Providers/ThemeServiceProvider.php | ThemeServiceProvider.registerAllThemes | private function registerAllThemes()
{
$directories = $this->app['files']->directories(base_path('themes'));
foreach ($directories as $directory) {
$this->app['stylist']->registerPath($directory);
}
} | php | private function registerAllThemes()
{
$directories = $this->app['files']->directories(base_path('themes'));
foreach ($directories as $directory) {
$this->app['stylist']->registerPath($directory);
}
} | [
"private",
"function",
"registerAllThemes",
"(",
")",
"{",
"$",
"directories",
"=",
"$",
"this",
"->",
"app",
"[",
"'files'",
"]",
"->",
"directories",
"(",
"base_path",
"(",
"'themes'",
")",
")",
";",
"foreach",
"(",
"$",
"directories",
"as",
"$",
"dire... | Register all themes with activating them. | [
"Register",
"all",
"themes",
"with",
"activating",
"them",
"."
] | a2726098cd596d2979750cd47d6fcec61c77e391 | https://github.com/SocietyCMS/Setting/blob/a2726098cd596d2979750cd47d6fcec61c77e391/Providers/ThemeServiceProvider.php#L27-L34 |
11,416 | SocietyCMS/Setting | Providers/ThemeServiceProvider.php | ThemeServiceProvider.setActiveTheme | private function setActiveTheme()
{
if ($this->inAdministration()) {
$themeName = $this->app['config']->get('society.core.core.admin-theme');
return $this->app['stylist']->activate($themeName, true);
}
return $this->app['stylist']->activate($this->app['config']->get... | php | private function setActiveTheme()
{
if ($this->inAdministration()) {
$themeName = $this->app['config']->get('society.core.core.admin-theme');
return $this->app['stylist']->activate($themeName, true);
}
return $this->app['stylist']->activate($this->app['config']->get... | [
"private",
"function",
"setActiveTheme",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"inAdministration",
"(",
")",
")",
"{",
"$",
"themeName",
"=",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'society.core.core.admin-theme'",
")",
... | Set the active theme based on the settings. | [
"Set",
"the",
"active",
"theme",
"based",
"on",
"the",
"settings",
"."
] | a2726098cd596d2979750cd47d6fcec61c77e391 | https://github.com/SocietyCMS/Setting/blob/a2726098cd596d2979750cd47d6fcec61c77e391/Providers/ThemeServiceProvider.php#L39-L48 |
11,417 | rseyferth/activerecord | lib/Inflector.php | Inflector.camelize | public function camelize($s)
{
$s = preg_replace('/[_-]+/','_',trim($s));
$s = str_replace(' ', '_', $s);
$camelized = '';
for ($i=0,$n=strlen($s); $i<$n; ++$i)
{
if ($s[$i] == '_' && $i+1 < $n)
$camelized .= strtoupper($s[++$i]);
else
$camelized .= $s[$i];
}
$camelized = ... | php | public function camelize($s)
{
$s = preg_replace('/[_-]+/','_',trim($s));
$s = str_replace(' ', '_', $s);
$camelized = '';
for ($i=0,$n=strlen($s); $i<$n; ++$i)
{
if ($s[$i] == '_' && $i+1 < $n)
$camelized .= strtoupper($s[++$i]);
else
$camelized .= $s[$i];
}
$camelized = ... | [
"public",
"function",
"camelize",
"(",
"$",
"s",
")",
"{",
"$",
"s",
"=",
"preg_replace",
"(",
"'/[_-]+/'",
",",
"'_'",
",",
"trim",
"(",
"$",
"s",
")",
")",
";",
"$",
"s",
"=",
"str_replace",
"(",
"' '",
",",
"'_'",
",",
"$",
"s",
")",
";",
... | Turn a string into its camelized version.
@param string $s string to convert
@return string | [
"Turn",
"a",
"string",
"into",
"its",
"camelized",
"version",
"."
] | 0e7b1cbddd6f967c3a09adf38753babd5f698e39 | https://github.com/rseyferth/activerecord/blob/0e7b1cbddd6f967c3a09adf38753babd5f698e39/lib/Inflector.php#L31-L52 |
11,418 | rseyferth/activerecord | lib/Inflector.php | Inflector.uncamelize | public function uncamelize($s)
{
$normalized = '';
for ($i=0,$n=strlen($s); $i<$n; ++$i)
{
if (ctype_alpha($s[$i]) && self::is_upper($s[$i]))
$normalized .= '_' . strtolower($s[$i]);
else
$normalized .= $s[$i];
}
return trim($normalized,' _');
} | php | public function uncamelize($s)
{
$normalized = '';
for ($i=0,$n=strlen($s); $i<$n; ++$i)
{
if (ctype_alpha($s[$i]) && self::is_upper($s[$i]))
$normalized .= '_' . strtolower($s[$i]);
else
$normalized .= $s[$i];
}
return trim($normalized,' _');
} | [
"public",
"function",
"uncamelize",
"(",
"$",
"s",
")",
"{",
"$",
"normalized",
"=",
"''",
";",
"for",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"n",
"=",
"strlen",
"(",
"$",
"s",
")",
";",
"$",
"i",
"<",
"$",
"n",
";",
"++",
"$",
"i",
")",
"{",... | Convert a camelized string to a lowercase, underscored string.
@param string $s string to convert
@return string | [
"Convert",
"a",
"camelized",
"string",
"to",
"a",
"lowercase",
"underscored",
"string",
"."
] | 0e7b1cbddd6f967c3a09adf38753babd5f698e39 | https://github.com/rseyferth/activerecord/blob/0e7b1cbddd6f967c3a09adf38753babd5f698e39/lib/Inflector.php#L82-L94 |
11,419 | fortifi/sdk | api/Foundation/Fids/FidHelper.php | FidHelper.compressFid | public static function compressFid($fid)
{
// remove FID: prefix
$fid = preg_replace('/^FID:/', '', $fid);
// subtract 2010 from timestamp
$fid = preg_replace_callback(
'/:([0-9]{10}):/',
function ($v) {
return ':' . base_convert($v[1], 10, 36) . ':';
},
$fid
);
... | php | public static function compressFid($fid)
{
// remove FID: prefix
$fid = preg_replace('/^FID:/', '', $fid);
// subtract 2010 from timestamp
$fid = preg_replace_callback(
'/:([0-9]{10}):/',
function ($v) {
return ':' . base_convert($v[1], 10, 36) . ':';
},
$fid
);
... | [
"public",
"static",
"function",
"compressFid",
"(",
"$",
"fid",
")",
"{",
"// remove FID: prefix",
"$",
"fid",
"=",
"preg_replace",
"(",
"'/^FID:/'",
",",
"''",
",",
"$",
"fid",
")",
";",
"// subtract 2010 from timestamp",
"$",
"fid",
"=",
"preg_replace_callback... | Compress a fid into a short, url friendly format
@param $fid
@return string | [
"Compress",
"a",
"fid",
"into",
"a",
"short",
"url",
"friendly",
"format"
] | 4d0471c72c7954271c692d32265fd42f698392e4 | https://github.com/fortifi/sdk/blob/4d0471c72c7954271c692d32265fd42f698392e4/api/Foundation/Fids/FidHelper.php#L160-L174 |
11,420 | fortifi/sdk | api/Foundation/Fids/FidHelper.php | FidHelper.expandFid | public static function expandFid($compressedFid)
{
// replace `:` with `-`
$fid = str_replace('-', ':', $compressedFid);
// add 2010 from timestamp
$fid = preg_replace_callback(
'/:([0-9a-z]{5,6}):/',
function ($v) {
return ':' . base_convert($v[1], 36, 10) . ':';
},
$f... | php | public static function expandFid($compressedFid)
{
// replace `:` with `-`
$fid = str_replace('-', ':', $compressedFid);
// add 2010 from timestamp
$fid = preg_replace_callback(
'/:([0-9a-z]{5,6}):/',
function ($v) {
return ':' . base_convert($v[1], 36, 10) . ':';
},
$f... | [
"public",
"static",
"function",
"expandFid",
"(",
"$",
"compressedFid",
")",
"{",
"// replace `:` with `-`",
"$",
"fid",
"=",
"str_replace",
"(",
"'-'",
",",
"':'",
",",
"$",
"compressedFid",
")",
";",
"// add 2010 from timestamp",
"$",
"fid",
"=",
"preg_replace... | Decompress a compressed fid into its full version
@param $compressedFid
@return string | [
"Decompress",
"a",
"compressed",
"fid",
"into",
"its",
"full",
"version"
] | 4d0471c72c7954271c692d32265fd42f698392e4 | https://github.com/fortifi/sdk/blob/4d0471c72c7954271c692d32265fd42f698392e4/api/Foundation/Fids/FidHelper.php#L183-L197 |
11,421 | academic/VipaImportBundle | Importer/PKP/JournalImporter.php | JournalImporter.importAndSetPublisher | private function importAndSetPublisher($name, $locale)
{
$translation = $this->em
->getRepository('VipaJournalBundle:PublisherTranslation')
->findOneBy(['name' => $name]);
$publisher = $translation !== null ? $translation->getTranslatable() : null;
if (!$publisher) {... | php | private function importAndSetPublisher($name, $locale)
{
$translation = $this->em
->getRepository('VipaJournalBundle:PublisherTranslation')
->findOneBy(['name' => $name]);
$publisher = $translation !== null ? $translation->getTranslatable() : null;
if (!$publisher) {... | [
"private",
"function",
"importAndSetPublisher",
"(",
"$",
"name",
",",
"$",
"locale",
")",
"{",
"$",
"translation",
"=",
"$",
"this",
"->",
"em",
"->",
"getRepository",
"(",
"'VipaJournalBundle:PublisherTranslation'",
")",
"->",
"findOneBy",
"(",
"[",
"'name'",
... | Imports the publisher with given name and assigns it to
the journal. It uses the one from the database in case
it exists.
@param String $name Publisher's name
@param String $locale Locale of the settings | [
"Imports",
"the",
"publisher",
"with",
"given",
"name",
"and",
"assigns",
"it",
"to",
"the",
"journal",
".",
"It",
"uses",
"the",
"one",
"from",
"the",
"database",
"in",
"case",
"it",
"exists",
"."
] | cee7d9e51613706a4fd6e2eade44041ce1af9ad3 | https://github.com/academic/VipaImportBundle/blob/cee7d9e51613706a4fd6e2eade44041ce1af9ad3/Importer/PKP/JournalImporter.php#L293-L314 |
11,422 | academic/VipaImportBundle | Importer/PKP/JournalImporter.php | JournalImporter.getUnknownPublisher | private function getUnknownPublisher($locale)
{
$translation = $this->em
->getRepository('VipaJournalBundle:PublisherTranslation')
->findOneBy(['name' => 'Unknown Publisher']);
$publisher = $translation !== null ? $translation->getTranslatable() : null;
if (!$publish... | php | private function getUnknownPublisher($locale)
{
$translation = $this->em
->getRepository('VipaJournalBundle:PublisherTranslation')
->findOneBy(['name' => 'Unknown Publisher']);
$publisher = $translation !== null ? $translation->getTranslatable() : null;
if (!$publish... | [
"private",
"function",
"getUnknownPublisher",
"(",
"$",
"locale",
")",
"{",
"$",
"translation",
"=",
"$",
"this",
"->",
"em",
"->",
"getRepository",
"(",
"'VipaJournalBundle:PublisherTranslation'",
")",
"->",
"findOneBy",
"(",
"[",
"'name'",
"=>",
"'Unknown Publis... | Fetches the publisher with the name "Unknown Publisher".
@param string $locale Locale of translatable fields
@return Publisher Publisher with the name "Unknown Publisher" | [
"Fetches",
"the",
"publisher",
"with",
"the",
"name",
"Unknown",
"Publisher",
"."
] | cee7d9e51613706a4fd6e2eade44041ce1af9ad3 | https://github.com/academic/VipaImportBundle/blob/cee7d9e51613706a4fd6e2eade44041ce1af9ad3/Importer/PKP/JournalImporter.php#L321-L335 |
11,423 | academic/VipaImportBundle | Importer/PKP/JournalImporter.php | JournalImporter.createPublisher | private function createPublisher($name, $url, $locale)
{
$publisher = new Publisher();
$publisher
->setCurrentLocale(mb_substr($locale, 0, 2, 'UTF-8'))
->setName($name)
->setEmail('[email protected]')
->setAddress('-')
->setPhone('-')
... | php | private function createPublisher($name, $url, $locale)
{
$publisher = new Publisher();
$publisher
->setCurrentLocale(mb_substr($locale, 0, 2, 'UTF-8'))
->setName($name)
->setEmail('[email protected]')
->setAddress('-')
->setPhone('-')
... | [
"private",
"function",
"createPublisher",
"(",
"$",
"name",
",",
"$",
"url",
",",
"$",
"locale",
")",
"{",
"$",
"publisher",
"=",
"new",
"Publisher",
"(",
")",
";",
"$",
"publisher",
"->",
"setCurrentLocale",
"(",
"mb_substr",
"(",
"$",
"locale",
",",
... | Creates a publisher with given properties.
@param string $name
@param string $url
@param string $locale
@return Publisher Created publisher | [
"Creates",
"a",
"publisher",
"with",
"given",
"properties",
"."
] | cee7d9e51613706a4fd6e2eade44041ce1af9ad3 | https://github.com/academic/VipaImportBundle/blob/cee7d9e51613706a4fd6e2eade44041ce1af9ad3/Importer/PKP/JournalImporter.php#L344-L356 |
11,424 | fduch2k/yii-flagged-activerecord | src/TSFlaggedActiveRecord.php | TSFlaggedActiveRecord.setAttributes | public function setAttributes($values, $safeOnly=true)
{
$flags = $this->cachedFlags();
$notFlags = array();
foreach ($values as $key => $val) {
if (array_key_exists($key, $flags)) {
$this->setFlag($key, $val);
}
else {
$not... | php | public function setAttributes($values, $safeOnly=true)
{
$flags = $this->cachedFlags();
$notFlags = array();
foreach ($values as $key => $val) {
if (array_key_exists($key, $flags)) {
$this->setFlag($key, $val);
}
else {
$not... | [
"public",
"function",
"setAttributes",
"(",
"$",
"values",
",",
"$",
"safeOnly",
"=",
"true",
")",
"{",
"$",
"flags",
"=",
"$",
"this",
"->",
"cachedFlags",
"(",
")",
";",
"$",
"notFlags",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"values",
... | Sets the attribute and flags values in a massive way.
@param array $values attribute values (name=>value) to be set.
@param boolean $safeOnly whether the assignments should only be done to the safe attributes.
A safe attribute is one that is associated with a validation rule in the current {@link scenario}.
@see getSaf... | [
"Sets",
"the",
"attribute",
"and",
"flags",
"values",
"in",
"a",
"massive",
"way",
"."
] | 6ed1ad08657acb3a2ff598b77d7ed35d9efdea8d | https://github.com/fduch2k/yii-flagged-activerecord/blob/6ed1ad08657acb3a2ff598b77d7ed35d9efdea8d/src/TSFlaggedActiveRecord.php#L201-L214 |
11,425 | fduch2k/yii-flagged-activerecord | src/TSFlaggedActiveRecord.php | TSFlaggedActiveRecord.getAttributes | public function getAttributes($names = null) {
$attributes = parent::getAttributes($names);
if (is_array($names)) {
$flags = $this->cachedFlags();
$flagNames = array_intersect(array_keys($flags), $names);
foreach ($flagNames as $name) {
$attributes[$na... | php | public function getAttributes($names = null) {
$attributes = parent::getAttributes($names);
if (is_array($names)) {
$flags = $this->cachedFlags();
$flagNames = array_intersect(array_keys($flags), $names);
foreach ($flagNames as $name) {
$attributes[$na... | [
"public",
"function",
"getAttributes",
"(",
"$",
"names",
"=",
"null",
")",
"{",
"$",
"attributes",
"=",
"parent",
"::",
"getAttributes",
"(",
"$",
"names",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"names",
")",
")",
"{",
"$",
"flags",
"=",
"$",
... | Returns all attribute and flags values.
@param array $names list of attributes whose value needs to be returned.
Defaults to null, meaning all attributes as listed in {@link attributeNames} and flags as listed in
{@link flagNames} will be returned. If it is an array, only the attributes in the array will be returned.
@... | [
"Returns",
"all",
"attribute",
"and",
"flags",
"values",
"."
] | 6ed1ad08657acb3a2ff598b77d7ed35d9efdea8d | https://github.com/fduch2k/yii-flagged-activerecord/blob/6ed1ad08657acb3a2ff598b77d7ed35d9efdea8d/src/TSFlaggedActiveRecord.php#L223-L233 |
11,426 | fduch2k/yii-flagged-activerecord | src/TSFlaggedActiveRecord.php | TSFlaggedActiveRecord.withFlag | public function withFlag($flag)
{
$flagValue = (is_string($flag)) ? $this->flagsFromText($flag) : $flag;
if ($flagValue) {
$this->getDbCriteria()->mergeWith(array(
'condition' => $this->getTableAlias() . '.' . $this->flagsField . '&' . $flagValue . '<>0', //:flag<>0',
... | php | public function withFlag($flag)
{
$flagValue = (is_string($flag)) ? $this->flagsFromText($flag) : $flag;
if ($flagValue) {
$this->getDbCriteria()->mergeWith(array(
'condition' => $this->getTableAlias() . '.' . $this->flagsField . '&' . $flagValue . '<>0', //:flag<>0',
... | [
"public",
"function",
"withFlag",
"(",
"$",
"flag",
")",
"{",
"$",
"flagValue",
"=",
"(",
"is_string",
"(",
"$",
"flag",
")",
")",
"?",
"$",
"this",
"->",
"flagsFromText",
"(",
"$",
"flag",
")",
":",
"$",
"flag",
";",
"if",
"(",
"$",
"flagValue",
... | Scope for select records with given flag
@param mixed $flag the flag value or flag name
@return instancetype | [
"Scope",
"for",
"select",
"records",
"with",
"given",
"flag"
] | 6ed1ad08657acb3a2ff598b77d7ed35d9efdea8d | https://github.com/fduch2k/yii-flagged-activerecord/blob/6ed1ad08657acb3a2ff598b77d7ed35d9efdea8d/src/TSFlaggedActiveRecord.php#L241-L251 |
11,427 | fduch2k/yii-flagged-activerecord | src/TSFlaggedActiveRecord.php | TSFlaggedActiveRecord.applyFlags | public function applyFlags($criteria, $flags, $operator = 'AND')
{
$flagList = $this->cachedFlags();
$flags = CPropertyValue::ensureArray($flags);
$newCriteria = new CDbCriteria();
foreach ($flags as $flag) {
if (is_string($flag)) {
if ($invert = ($flag[... | php | public function applyFlags($criteria, $flags, $operator = 'AND')
{
$flagList = $this->cachedFlags();
$flags = CPropertyValue::ensureArray($flags);
$newCriteria = new CDbCriteria();
foreach ($flags as $flag) {
if (is_string($flag)) {
if ($invert = ($flag[... | [
"public",
"function",
"applyFlags",
"(",
"$",
"criteria",
",",
"$",
"flags",
",",
"$",
"operator",
"=",
"'AND'",
")",
"{",
"$",
"flagList",
"=",
"$",
"this",
"->",
"cachedFlags",
"(",
")",
";",
"$",
"flags",
"=",
"CPropertyValue",
"::",
"ensureArray",
... | Apply flags conditions to given criteria
@param CDbCriteria $criteria the criteria to apply flags condition
@param array $flags the array with flags (as flag name or as flag value). Flag name started with '!' is mean 'not flag'
@param string $operator the operator that connect flags conditions
@return CDbCriteria the C... | [
"Apply",
"flags",
"conditions",
"to",
"given",
"criteria"
] | 6ed1ad08657acb3a2ff598b77d7ed35d9efdea8d | https://github.com/fduch2k/yii-flagged-activerecord/blob/6ed1ad08657acb3a2ff598b77d7ed35d9efdea8d/src/TSFlaggedActiveRecord.php#L279-L302 |
11,428 | sportic/omniresult-common | src/Common/Helper.php | Helper.convertToLowercase | protected static function convertToLowercase($str)
{
$explodedStr = explode('_', $str);
if (count($explodedStr) > 1) {
$lowerCasedStr = [];
foreach ($explodedStr as $value) {
$lowerCasedStr[] = strtolower($value);
}
$str = implode('_',... | php | protected static function convertToLowercase($str)
{
$explodedStr = explode('_', $str);
if (count($explodedStr) > 1) {
$lowerCasedStr = [];
foreach ($explodedStr as $value) {
$lowerCasedStr[] = strtolower($value);
}
$str = implode('_',... | [
"protected",
"static",
"function",
"convertToLowercase",
"(",
"$",
"str",
")",
"{",
"$",
"explodedStr",
"=",
"explode",
"(",
"'_'",
",",
"$",
"str",
")",
";",
"if",
"(",
"count",
"(",
"$",
"explodedStr",
")",
">",
"1",
")",
"{",
"$",
"lowerCasedStr",
... | Convert strings with underscores to be all lowercase before camelCase is preformed.
@param string $str The input string
@return string The output string | [
"Convert",
"strings",
"with",
"underscores",
"to",
"be",
"all",
"lowercase",
"before",
"camelCase",
"is",
"preformed",
"."
] | 0208c9ad02d65fe4b1f8c818ab158b3956730bc6 | https://github.com/sportic/omniresult-common/blob/0208c9ad02d65fe4b1f8c818ab158b3956730bc6/src/Common/Helper.php#L67-L80 |
11,429 | phlexible/phlexible | src/Phlexible/Bundle/FrontendMediaBundle/Controller/MediaController.php | MediaController.downloadAction | public function downloadAction($fileId)
{
$volumeManager = $this->get('phlexible_media_manager.volume_manager');
try {
$volume = $volumeManager->getByFileId($fileId);
} catch (\Exception $e) {
throw $this->createNotFoundException($e->getMessage(), $e);
}
... | php | public function downloadAction($fileId)
{
$volumeManager = $this->get('phlexible_media_manager.volume_manager');
try {
$volume = $volumeManager->getByFileId($fileId);
} catch (\Exception $e) {
throw $this->createNotFoundException($e->getMessage(), $e);
}
... | [
"public",
"function",
"downloadAction",
"(",
"$",
"fileId",
")",
"{",
"$",
"volumeManager",
"=",
"$",
"this",
"->",
"get",
"(",
"'phlexible_media_manager.volume_manager'",
")",
";",
"try",
"{",
"$",
"volume",
"=",
"$",
"volumeManager",
"->",
"getByFileId",
"("... | Download a media file.
@param string $fileId
@return Response
@Route("/download/{fileId}", name="frontendmedia_download") | [
"Download",
"a",
"media",
"file",
"."
] | 132f24924c9bb0dbb6c1ea84db0a463f97fa3893 | https://github.com/phlexible/phlexible/blob/132f24924c9bb0dbb6c1ea84db0a463f97fa3893/src/Phlexible/Bundle/FrontendMediaBundle/Controller/MediaController.php#L104-L129 |
11,430 | agentmedia/phine-forms | src/Forms/Modules/Backend/TextfieldForm.php | TextfieldForm.AddTypeField | private function AddTypeField()
{
$name = 'Type';
$select = new Select($name, $this->textfield->GetType());
$select->AddOption('', Trans('Core.PleaseSelect'));
$values = TextfieldType::AllowedValues();
foreach ($values as $value)
{
$select->AddOption($valu... | php | private function AddTypeField()
{
$name = 'Type';
$select = new Select($name, $this->textfield->GetType());
$select->AddOption('', Trans('Core.PleaseSelect'));
$values = TextfieldType::AllowedValues();
foreach ($values as $value)
{
$select->AddOption($valu... | [
"private",
"function",
"AddTypeField",
"(",
")",
"{",
"$",
"name",
"=",
"'Type'",
";",
"$",
"select",
"=",
"new",
"Select",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"textfield",
"->",
"GetType",
"(",
")",
")",
";",
"$",
"select",
"->",
"AddOption",
... | Adds the type field | [
"Adds",
"the",
"type",
"field"
] | cd7a92ea443756bef5885a9e8f59ad6b8d2771fc | https://github.com/agentmedia/phine-forms/blob/cd7a92ea443756bef5885a9e8f59ad6b8d2771fc/src/Forms/Modules/Backend/TextfieldForm.php#L80-L92 |
11,431 | zepi/turbo-base | Zepi/Core/Defaults/src/EventHandler/DefaultRouteNotFound.php | DefaultRouteNotFound.execute | public function execute(Framework $framework, RequestAbstract $request, Response $response)
{
$response->setOutputPart('404', 'The requested route is not available. We can\'t execute the request. Route: "' . $request->getRoute() . '"');
} | php | public function execute(Framework $framework, RequestAbstract $request, Response $response)
{
$response->setOutputPart('404', 'The requested route is not available. We can\'t execute the request. Route: "' . $request->getRoute() . '"');
} | [
"public",
"function",
"execute",
"(",
"Framework",
"$",
"framework",
",",
"RequestAbstract",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"$",
"response",
"->",
"setOutputPart",
"(",
"'404'",
",",
"'The requested route is not available. We can\\'t execu... | The DefaultRouteNotFound event handler will generate a
route not found error message.
@access public
@param \Zepi\Turbo\Framework $framework
@param \Zepi\Turbo\Request\RequestAbstract $request
@param \Zepi\Turbo\Response\Response $response | [
"The",
"DefaultRouteNotFound",
"event",
"handler",
"will",
"generate",
"a",
"route",
"not",
"found",
"error",
"message",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Core/Defaults/src/EventHandler/DefaultRouteNotFound.php#L62-L65 |
11,432 | arvici/framework | src/Arvici/Heart/Database/Driver/MySQL/Driver.php | Driver.connect | public function connect(array $config, $username = null, $password = null, array $options = array())
{
// Validate config
if (! isset($config['host'], $config['database'])) {
throw new DatabaseDriverException("No 'host' or 'database' given in the configuration of the connection!");
... | php | public function connect(array $config, $username = null, $password = null, array $options = array())
{
// Validate config
if (! isset($config['host'], $config['database'])) {
throw new DatabaseDriverException("No 'host' or 'database' given in the configuration of the connection!");
... | [
"public",
"function",
"connect",
"(",
"array",
"$",
"config",
",",
"$",
"username",
"=",
"null",
",",
"$",
"password",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"// Validate config",
"if",
"(",
"!",
"isset",
"(",
"$... | Create the connection. Will return a connection instance.
@param array $config Specific configuration for the driver to establish connection and maintain it.
@param string|null $username Username to connect, could be optional. Driver specific.
@param string|null $password Password to connect, could be optional. Driver... | [
"Create",
"the",
"connection",
".",
"Will",
"return",
"a",
"connection",
"instance",
"."
] | 4d0933912fef8f9edc756ef1ace009e96d9fc4b1 | https://github.com/arvici/framework/blob/4d0933912fef8f9edc756ef1ace009e96d9fc4b1/src/Arvici/Heart/Database/Driver/MySQL/Driver.php#L33-L52 |
11,433 | gentry-php/gentry | src/Wrapper.php | Wrapper.createObject | public static function createObject($class, ...$args) : object
{
$work = self::wrapObject($class);
$work->__gentryConstruct(...$args);
return $work;
} | php | public static function createObject($class, ...$args) : object
{
$work = self::wrapObject($class);
$work->__gentryConstruct(...$args);
return $work;
} | [
"public",
"static",
"function",
"createObject",
"(",
"$",
"class",
",",
"...",
"$",
"args",
")",
":",
"object",
"{",
"$",
"work",
"=",
"self",
"::",
"wrapObject",
"(",
"$",
"class",
")",
";",
"$",
"work",
"->",
"__gentryConstruct",
"(",
"...",
"$",
"... | Creates an anonymous object based on a reflection.
@param mixed $class A class, object or trait to wrap.
@param mixed ...$args Arguments for use during construction.
@return object An anonymous, wrapped object.
@see Wrapper::wrapObject | [
"Creates",
"an",
"anonymous",
"object",
"based",
"on",
"a",
"reflection",
"."
] | 1e6a909f63cdf653e640540b116c92885c3329cf | https://github.com/gentry-php/gentry/blob/1e6a909f63cdf653e640540b116c92885c3329cf/src/Wrapper.php#L154-L159 |
11,434 | gentry-php/gentry | src/Wrapper.php | Wrapper.tostring | private static function tostring($value) : string
{
if (!isset($value)) {
return 'NULL';
}
if ($value === true) {
return 'true';
}
if ($value === false) {
return 'false';
}
if (is_numeric($value)) {
return $value... | php | private static function tostring($value) : string
{
if (!isset($value)) {
return 'NULL';
}
if ($value === true) {
return 'true';
}
if ($value === false) {
return 'false';
}
if (is_numeric($value)) {
return $value... | [
"private",
"static",
"function",
"tostring",
"(",
"$",
"value",
")",
":",
"string",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"value",
")",
")",
"{",
"return",
"'NULL'",
";",
"}",
"if",
"(",
"$",
"value",
"===",
"true",
")",
"{",
"return",
"'true'",
... | Internal helper method to get an echo'able representation of a random
value for reporting and code generation.
@param mixed $value
@return string | [
"Internal",
"helper",
"method",
"to",
"get",
"an",
"echo",
"able",
"representation",
"of",
"a",
"random",
"value",
"for",
"reporting",
"and",
"code",
"generation",
"."
] | 1e6a909f63cdf653e640540b116c92885c3329cf | https://github.com/gentry-php/gentry/blob/1e6a909f63cdf653e640540b116c92885c3329cf/src/Wrapper.php#L228-L265 |
11,435 | mkjpryor/option | src/Option.php | Option.none | public static function none() {
if( self::$empty === null ) self::$empty = new Option(null);
return self::$empty;
} | php | public static function none() {
if( self::$empty === null ) self::$empty = new Option(null);
return self::$empty;
} | [
"public",
"static",
"function",
"none",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"empty",
"===",
"null",
")",
"self",
"::",
"$",
"empty",
"=",
"new",
"Option",
"(",
"null",
")",
";",
"return",
"self",
"::",
"$",
"empty",
";",
"}"
] | Get an empty option | [
"Get",
"an",
"empty",
"option"
] | 202af894c6fac89b4cb3769acfa4f81813167706 | https://github.com/mkjpryor/option/blob/202af894c6fac89b4cb3769acfa4f81813167706/src/Option.php#L140-L143 |
11,436 | jeromeklam/freefw | src/FreeFW/Middleware/Pipeline.php | Pipeline.pipeFromDI | public function pipeFromDI(string $p_middleware)
{
$middleware = \FreeFW\DI\DI::get($p_middleware);
$this->middlewares->enqueue($middleware);
return $this;
} | php | public function pipeFromDI(string $p_middleware)
{
$middleware = \FreeFW\DI\DI::get($p_middleware);
$this->middlewares->enqueue($middleware);
return $this;
} | [
"public",
"function",
"pipeFromDI",
"(",
"string",
"$",
"p_middleware",
")",
"{",
"$",
"middleware",
"=",
"\\",
"FreeFW",
"\\",
"DI",
"\\",
"DI",
"::",
"get",
"(",
"$",
"p_middleware",
")",
";",
"$",
"this",
"->",
"middlewares",
"->",
"enqueue",
"(",
"... | Add new middleware to pipeline
@param string $p_middleware
@return \FreeFW\Middleware\Pipeline | [
"Add",
"new",
"middleware",
"to",
"pipeline"
] | 16ecf24192375c920a070296f396b9d3fd994a1e | https://github.com/jeromeklam/freefw/blob/16ecf24192375c920a070296f396b9d3fd994a1e/src/FreeFW/Middleware/Pipeline.php#L69-L74 |
11,437 | edunola13/enolaphp-framework | src/Http/Models/En_HttpResponse.php | En_HttpResponse.setCookieParams | public function setCookieParams($lifetime, $path=NULL, $domain=NULL, $secure=FALSE, $httponly= FALSE){
session_set_cookie_params($lifetime, $path, $domain, $secure, $httponly);
} | php | public function setCookieParams($lifetime, $path=NULL, $domain=NULL, $secure=FALSE, $httponly= FALSE){
session_set_cookie_params($lifetime, $path, $domain, $secure, $httponly);
} | [
"public",
"function",
"setCookieParams",
"(",
"$",
"lifetime",
",",
"$",
"path",
"=",
"NULL",
",",
"$",
"domain",
"=",
"NULL",
",",
"$",
"secure",
"=",
"FALSE",
",",
"$",
"httponly",
"=",
"FALSE",
")",
"{",
"session_set_cookie_params",
"(",
"$",
"lifetim... | Setea parametros de cookie
@param int $lifetime
@param string $path
@param string $domain
@param bool $secure
@param bool $httponly
@return bool | [
"Setea",
"parametros",
"de",
"cookie"
] | a962bfcd53d7bc129d8c9946aaa71d264285229d | https://github.com/edunola13/enolaphp-framework/blob/a962bfcd53d7bc129d8c9946aaa71d264285229d/src/Http/Models/En_HttpResponse.php#L162-L164 |
11,438 | edunola13/enolaphp-framework | src/Http/Models/En_HttpResponse.php | En_HttpResponse.setContentType | public function setContentType($contentType, $charset=NULL){
$this->setHeader("Content-Type", $contentType);
if($charset != NULL){
$this->setHeader("charset", $charset);
}
} | php | public function setContentType($contentType, $charset=NULL){
$this->setHeader("Content-Type", $contentType);
if($charset != NULL){
$this->setHeader("charset", $charset);
}
} | [
"public",
"function",
"setContentType",
"(",
"$",
"contentType",
",",
"$",
"charset",
"=",
"NULL",
")",
"{",
"$",
"this",
"->",
"setHeader",
"(",
"\"Content-Type\"",
",",
"$",
"contentType",
")",
";",
"if",
"(",
"$",
"charset",
"!=",
"NULL",
")",
"{",
... | Setea el tipo de contenido a enviar
@param string $contentType
@param string $charset | [
"Setea",
"el",
"tipo",
"de",
"contenido",
"a",
"enviar"
] | a962bfcd53d7bc129d8c9946aaa71d264285229d | https://github.com/edunola13/enolaphp-framework/blob/a962bfcd53d7bc129d8c9946aaa71d264285229d/src/Http/Models/En_HttpResponse.php#L187-L192 |
11,439 | edunola13/enolaphp-framework | src/Http/Models/En_HttpResponse.php | En_HttpResponse.sendFile | public function sendFile($file, $name=NULL, $contentType='application/octet-stream', $contentDisposition='attachment'){
if($name == NULL){
$name= basename($file);
}
header('Content-Description: File Transfer');
header('Content-Type: '.$contentType);
header('Content-Di... | php | public function sendFile($file, $name=NULL, $contentType='application/octet-stream', $contentDisposition='attachment'){
if($name == NULL){
$name= basename($file);
}
header('Content-Description: File Transfer');
header('Content-Type: '.$contentType);
header('Content-Di... | [
"public",
"function",
"sendFile",
"(",
"$",
"file",
",",
"$",
"name",
"=",
"NULL",
",",
"$",
"contentType",
"=",
"'application/octet-stream'",
",",
"$",
"contentDisposition",
"=",
"'attachment'",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"NULL",
")",
"{",
... | Envia un archivo como respuesta. Se indican distintos parametros del header
@param string $file
@param string $name
@param string $contentType
@param string $contentDisposition | [
"Envia",
"un",
"archivo",
"como",
"respuesta",
".",
"Se",
"indican",
"distintos",
"parametros",
"del",
"header"
] | a962bfcd53d7bc129d8c9946aaa71d264285229d | https://github.com/edunola13/enolaphp-framework/blob/a962bfcd53d7bc129d8c9946aaa71d264285229d/src/Http/Models/En_HttpResponse.php#L207-L217 |
11,440 | edunola13/enolaphp-framework | src/Http/Models/En_HttpResponse.php | En_HttpResponse.sendApiRestEncode | public function sendApiRestEncode($code=200, $data = NULL, $options= 0, $contentType='application/json'){
$this->sendApiRest($code, json_encode($data, $options), $contentType);
} | php | public function sendApiRestEncode($code=200, $data = NULL, $options= 0, $contentType='application/json'){
$this->sendApiRest($code, json_encode($data, $options), $contentType);
} | [
"public",
"function",
"sendApiRestEncode",
"(",
"$",
"code",
"=",
"200",
",",
"$",
"data",
"=",
"NULL",
",",
"$",
"options",
"=",
"0",
",",
"$",
"contentType",
"=",
"'application/json'",
")",
"{",
"$",
"this",
"->",
"sendApiRest",
"(",
"$",
"code",
","... | Metodo para API REST.
Envia una respuesta json con un codigo de respuesta codificando los datos
@param int $code
@param string $data
@param int $options
@param string $contentType | [
"Metodo",
"para",
"API",
"REST",
".",
"Envia",
"una",
"respuesta",
"json",
"con",
"un",
"codigo",
"de",
"respuesta",
"codificando",
"los",
"datos"
] | a962bfcd53d7bc129d8c9946aaa71d264285229d | https://github.com/edunola13/enolaphp-framework/blob/a962bfcd53d7bc129d8c9946aaa71d264285229d/src/Http/Models/En_HttpResponse.php#L226-L228 |
11,441 | edunola13/enolaphp-framework | src/Http/Models/En_HttpResponse.php | En_HttpResponse.sendApiRest | public function sendApiRest($code=200, $jsonString= '', $contentType='application/json'){
$this->setStatusCode($code);
$this->setContentType($contentType);
$this->setContent($jsonString);
$this->sendContent();
} | php | public function sendApiRest($code=200, $jsonString= '', $contentType='application/json'){
$this->setStatusCode($code);
$this->setContentType($contentType);
$this->setContent($jsonString);
$this->sendContent();
} | [
"public",
"function",
"sendApiRest",
"(",
"$",
"code",
"=",
"200",
",",
"$",
"jsonString",
"=",
"''",
",",
"$",
"contentType",
"=",
"'application/json'",
")",
"{",
"$",
"this",
"->",
"setStatusCode",
"(",
"$",
"code",
")",
";",
"$",
"this",
"->",
"setC... | Metodo para API REST.
Envia una respuesta json con un codigo de respuesta
@param int $code
@param string $jsonString
@param string $contentType | [
"Metodo",
"para",
"API",
"REST",
".",
"Envia",
"una",
"respuesta",
"json",
"con",
"un",
"codigo",
"de",
"respuesta"
] | a962bfcd53d7bc129d8c9946aaa71d264285229d | https://github.com/edunola13/enolaphp-framework/blob/a962bfcd53d7bc129d8c9946aaa71d264285229d/src/Http/Models/En_HttpResponse.php#L236-L241 |
11,442 | las93/attila | Attila/lib/Db.php | Db.connect | public static function connect(Container $oContainerConnection)
{
if (self::getContainer() === null) { self::setContainer($oContainerConnection); }
if (!isset(self::$_oPdo[$oContainerConnection->getName()])) {
if ($oContainerConnection->getType() == 'mysql') {
try {
if ($oCont... | php | public static function connect(Container $oContainerConnection)
{
if (self::getContainer() === null) { self::setContainer($oContainerConnection); }
if (!isset(self::$_oPdo[$oContainerConnection->getName()])) {
if ($oContainerConnection->getType() == 'mysql') {
try {
if ($oCont... | [
"public",
"static",
"function",
"connect",
"(",
"Container",
"$",
"oContainerConnection",
")",
"{",
"if",
"(",
"self",
"::",
"getContainer",
"(",
")",
"===",
"null",
")",
"{",
"self",
"::",
"setContainer",
"(",
"$",
"oContainerConnection",
")",
";",
"}",
"... | get instance of Pdo
@access public
@param string sName name of the configuration
@param string $sType kind of database
@param string $sHost host of the connection (path for sqlite)
@param string $sUser user of the connection
@param string $sPassword password of the connection
@param string $sDbName name of the c... | [
"get",
"instance",
"of",
"Pdo"
] | ad73611956ee96a95170a6340f110a948cfe5965 | https://github.com/las93/attila/blob/ad73611956ee96a95170a6340f110a948cfe5965/Attila/lib/Db.php#L63-L98 |
11,443 | wearenolte/wp-utils | src/Text.php | Text.trim_to_nearest_word | public static function trim_to_nearest_word( $text, $char_limit ) {
if ( strlen( $text ) <= $char_limit ) {
return $text;
}
$wrapped_text = explode( '\n', wordwrap( $text , $char_limit, '\n' ) );
return is_array( $wrapped_text ) ? $wrapped_text[0] : substr( $text, 0, $char_limit );
} | php | public static function trim_to_nearest_word( $text, $char_limit ) {
if ( strlen( $text ) <= $char_limit ) {
return $text;
}
$wrapped_text = explode( '\n', wordwrap( $text , $char_limit, '\n' ) );
return is_array( $wrapped_text ) ? $wrapped_text[0] : substr( $text, 0, $char_limit );
} | [
"public",
"static",
"function",
"trim_to_nearest_word",
"(",
"$",
"text",
",",
"$",
"char_limit",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"text",
")",
"<=",
"$",
"char_limit",
")",
"{",
"return",
"$",
"text",
";",
"}",
"$",
"wrapped_text",
"=",
"explo... | Get text trimmed to the nearest word.
@param string $text The text to trim.
@param int $char_limit The maximum chars to allow.
@return string | [
"Get",
"text",
"trimmed",
"to",
"the",
"nearest",
"word",
"."
] | f0ba691ee7c678784f6b01ff154fab150ffb409b | https://github.com/wearenolte/wp-utils/blob/f0ba691ee7c678784f6b01ff154fab150ffb409b/src/Text.php#L18-L26 |
11,444 | native5/native5-sdk-common-php | src/Native5/Core/Log/Impl/AbstractLogAdapter.php | AbstractLogAdapter.log | public function log($message, $args, $priority='LOG_INFO')
{
if (array_key_exists('FILENAME', $args) === false) {
$backtrace = debug_backtrace();
$args['FILENAME'] = $backtrace[0]['file'];
$args['LINENO'] = $backtrace[0]['line'];
}//end if
$newAr... | php | public function log($message, $args, $priority='LOG_INFO')
{
if (array_key_exists('FILENAME', $args) === false) {
$backtrace = debug_backtrace();
$args['FILENAME'] = $backtrace[0]['file'];
$args['LINENO'] = $backtrace[0]['line'];
}//end if
$newAr... | [
"public",
"function",
"log",
"(",
"$",
"message",
",",
"$",
"args",
",",
"$",
"priority",
"=",
"'LOG_INFO'",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'FILENAME'",
",",
"$",
"args",
")",
"===",
"false",
")",
"{",
"$",
"backtrace",
"=",
"debug_back... | Implementation of `log` method in Logger
@param mixed $message Message to log
@param mixed $args Arguments to message
@param mixed $priority Priority of message
@access public
@return void | [
"Implementation",
"of",
"log",
"method",
"in",
"Logger"
] | c8bd5b219bd05ea4d317d21ae9c0c8dddcede7fe | https://github.com/native5/native5-sdk-common-php/blob/c8bd5b219bd05ea4d317d21ae9c0c8dddcede7fe/src/Native5/Core/Log/Impl/AbstractLogAdapter.php#L83-L114 |
11,445 | native5/native5-sdk-common-php | src/Native5/Core/Log/Impl/AbstractLogAdapter.php | AbstractLogAdapter.info | public function info($message, $args=array())
{
$backtrace = debug_backtrace();
$args['FILENAME'] = $backtrace[0]['file'];
$args['LINENO'] = $backtrace[0]['line'];
$this->log($message, $args, 'LOG_INFO');
} | php | public function info($message, $args=array())
{
$backtrace = debug_backtrace();
$args['FILENAME'] = $backtrace[0]['file'];
$args['LINENO'] = $backtrace[0]['line'];
$this->log($message, $args, 'LOG_INFO');
} | [
"public",
"function",
"info",
"(",
"$",
"message",
",",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"$",
"backtrace",
"=",
"debug_backtrace",
"(",
")",
";",
"$",
"args",
"[",
"'FILENAME'",
"]",
"=",
"$",
"backtrace",
"[",
"0",
"]",
"[",
"'file'"... | Implementation of Info in Logger
@param mixed $message Message to log
@param mixed $args Arguments to message
@access public
@return void | [
"Implementation",
"of",
"Info",
"in",
"Logger"
] | c8bd5b219bd05ea4d317d21ae9c0c8dddcede7fe | https://github.com/native5/native5-sdk-common-php/blob/c8bd5b219bd05ea4d317d21ae9c0c8dddcede7fe/src/Native5/Core/Log/Impl/AbstractLogAdapter.php#L126-L133 |
11,446 | native5/native5-sdk-common-php | src/Native5/Core/Log/Impl/AbstractLogAdapter.php | AbstractLogAdapter.debug | public function debug($message, $args=array())
{
$backtrace = debug_backtrace();
$args['FILENAME'] = $backtrace[0]['file'];
$args['LINENO'] = $backtrace[0]['line'];
$this->log($message, $args, 'LOG_DEBUG');
} | php | public function debug($message, $args=array())
{
$backtrace = debug_backtrace();
$args['FILENAME'] = $backtrace[0]['file'];
$args['LINENO'] = $backtrace[0]['line'];
$this->log($message, $args, 'LOG_DEBUG');
} | [
"public",
"function",
"debug",
"(",
"$",
"message",
",",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"$",
"backtrace",
"=",
"debug_backtrace",
"(",
")",
";",
"$",
"args",
"[",
"'FILENAME'",
"]",
"=",
"$",
"backtrace",
"[",
"0",
"]",
"[",
"'file'... | Implementation of debug in Logger
@param mixed $message Message to log
@param mixed $args Arguments to message
@access public
@return void | [
"Implementation",
"of",
"debug",
"in",
"Logger"
] | c8bd5b219bd05ea4d317d21ae9c0c8dddcede7fe | https://github.com/native5/native5-sdk-common-php/blob/c8bd5b219bd05ea4d317d21ae9c0c8dddcede7fe/src/Native5/Core/Log/Impl/AbstractLogAdapter.php#L145-L152 |
11,447 | native5/native5-sdk-common-php | src/Native5/Core/Log/Impl/AbstractLogAdapter.php | AbstractLogAdapter.warn | public function warn($message, $args=array())
{
$backtrace = debug_backtrace();
$args['FILENAME'] = $backtrace[0]['file'];
$args['LINENO'] = $backtrace[0]['line'];
$this->log($message, $args, 'LOG_WARNING');
} | php | public function warn($message, $args=array())
{
$backtrace = debug_backtrace();
$args['FILENAME'] = $backtrace[0]['file'];
$args['LINENO'] = $backtrace[0]['line'];
$this->log($message, $args, 'LOG_WARNING');
} | [
"public",
"function",
"warn",
"(",
"$",
"message",
",",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"$",
"backtrace",
"=",
"debug_backtrace",
"(",
")",
";",
"$",
"args",
"[",
"'FILENAME'",
"]",
"=",
"$",
"backtrace",
"[",
"0",
"]",
"[",
"'file'"... | Implementation of warn in Logger
@param mixed $message Message to log
@param mixed $args Arguments to message
@access public
@return void | [
"Implementation",
"of",
"warn",
"in",
"Logger"
] | c8bd5b219bd05ea4d317d21ae9c0c8dddcede7fe | https://github.com/native5/native5-sdk-common-php/blob/c8bd5b219bd05ea4d317d21ae9c0c8dddcede7fe/src/Native5/Core/Log/Impl/AbstractLogAdapter.php#L164-L171 |
11,448 | native5/native5-sdk-common-php | src/Native5/Core/Log/Impl/AbstractLogAdapter.php | AbstractLogAdapter.error | public function error($message, $args=array())
{
$backtrace = debug_backtrace();
$args['FILENAME'] = $backtrace[0]['file'];
$args['LINENO'] = $backtrace[0]['line'];
$this->log($message, $args, 'LOG_ERR');
} | php | public function error($message, $args=array())
{
$backtrace = debug_backtrace();
$args['FILENAME'] = $backtrace[0]['file'];
$args['LINENO'] = $backtrace[0]['line'];
$this->log($message, $args, 'LOG_ERR');
} | [
"public",
"function",
"error",
"(",
"$",
"message",
",",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"$",
"backtrace",
"=",
"debug_backtrace",
"(",
")",
";",
"$",
"args",
"[",
"'FILENAME'",
"]",
"=",
"$",
"backtrace",
"[",
"0",
"]",
"[",
"'file'... | Implementation of error in Logger
@param mixed $message Message to log
@param mixed $args Arguments to message
@access public
@return void | [
"Implementation",
"of",
"error",
"in",
"Logger"
] | c8bd5b219bd05ea4d317d21ae9c0c8dddcede7fe | https://github.com/native5/native5-sdk-common-php/blob/c8bd5b219bd05ea4d317d21ae9c0c8dddcede7fe/src/Native5/Core/Log/Impl/AbstractLogAdapter.php#L183-L190 |
11,449 | native5/native5-sdk-common-php | src/Native5/Core/Log/Impl/AbstractLogAdapter.php | AbstractLogAdapter.alert | public function alert($message, $args=array())
{
$backtrace = debug_backtrace();
$args['FILENAME'] = $backtrace[0]['file'];
$args['LINENO'] = $backtrace[0]['line'];
$this->log($message, $args, 'LOG_ALERT');
} | php | public function alert($message, $args=array())
{
$backtrace = debug_backtrace();
$args['FILENAME'] = $backtrace[0]['file'];
$args['LINENO'] = $backtrace[0]['line'];
$this->log($message, $args, 'LOG_ALERT');
} | [
"public",
"function",
"alert",
"(",
"$",
"message",
",",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"$",
"backtrace",
"=",
"debug_backtrace",
"(",
")",
";",
"$",
"args",
"[",
"'FILENAME'",
"]",
"=",
"$",
"backtrace",
"[",
"0",
"]",
"[",
"'file'... | Implementation of alert in Logger
@param mixed $message Message to log
@param mixed $args Arguments to message
@access public
@return void | [
"Implementation",
"of",
"alert",
"in",
"Logger"
] | c8bd5b219bd05ea4d317d21ae9c0c8dddcede7fe | https://github.com/native5/native5-sdk-common-php/blob/c8bd5b219bd05ea4d317d21ae9c0c8dddcede7fe/src/Native5/Core/Log/Impl/AbstractLogAdapter.php#L202-L209 |
11,450 | native5/native5-sdk-common-php | src/Native5/Core/Log/Impl/AbstractLogAdapter.php | AbstractLogAdapter.addHandler | public function addHandler($destination, $pattern=Logger::ALL, $level='LOG_INFO', $type='file')
{
$this->_logPatterns[$pattern] = $this->buildHandler($destination, $level, $type);
} | php | public function addHandler($destination, $pattern=Logger::ALL, $level='LOG_INFO', $type='file')
{
$this->_logPatterns[$pattern] = $this->buildHandler($destination, $level, $type);
} | [
"public",
"function",
"addHandler",
"(",
"$",
"destination",
",",
"$",
"pattern",
"=",
"Logger",
"::",
"ALL",
",",
"$",
"level",
"=",
"'LOG_INFO'",
",",
"$",
"type",
"=",
"'file'",
")",
"{",
"$",
"this",
"->",
"_logPatterns",
"[",
"$",
"pattern",
"]",
... | Implementation of addHandler in Logger
@param mixed $destination Destination to which to send handler to
@param mixed $pattern Regex pattern
@access public
@return void | [
"Implementation",
"of",
"addHandler",
"in",
"Logger"
] | c8bd5b219bd05ea4d317d21ae9c0c8dddcede7fe | https://github.com/native5/native5-sdk-common-php/blob/c8bd5b219bd05ea4d317d21ae9c0c8dddcede7fe/src/Native5/Core/Log/Impl/AbstractLogAdapter.php#L221-L225 |
11,451 | webriq/core | module/User/src/Grid/User/Controller/DatasheetController.php | DatasheetController.viewAction | public function viewAction()
{
$params = $this->params();
$service = $this->getServiceLocator();
$displayn = $params->fromRoute( 'displayName' );
// prevent "Invalid Encoding Attack"
if ( ! mb_check_encoding( $displayn, 'UTF-8' ) )
{
$this->getRe... | php | public function viewAction()
{
$params = $this->params();
$service = $this->getServiceLocator();
$displayn = $params->fromRoute( 'displayName' );
// prevent "Invalid Encoding Attack"
if ( ! mb_check_encoding( $displayn, 'UTF-8' ) )
{
$this->getRe... | [
"public",
"function",
"viewAction",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"params",
"(",
")",
";",
"$",
"service",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
";",
"$",
"displayn",
"=",
"$",
"params",
"->",
"fromRoute",
"("... | View a user | [
"View",
"a",
"user"
] | cfeb6e8a4732561c2215ec94e736c07f9b8bc990 | https://github.com/webriq/core/blob/cfeb6e8a4732561c2215ec94e736c07f9b8bc990/module/User/src/Grid/User/Controller/DatasheetController.php#L57-L94 |
11,452 | pokap/pool-dbm | src/Pok/PoolDBM/Transaction.php | Transaction.persist | public function persist($model)
{
$class = $this->manager->getClassMetadata(get_class($model));
$managers = $class->getFieldManagerNames();
$pool = $this->manager->getPool();
$priority = $pool->getPriority('transaction');
$id = null;
if ($class->hasManagerRef... | php | public function persist($model)
{
$class = $this->manager->getClassMetadata(get_class($model));
$managers = $class->getFieldManagerNames();
$pool = $this->manager->getPool();
$priority = $pool->getPriority('transaction');
$id = null;
if ($class->hasManagerRef... | [
"public",
"function",
"persist",
"(",
"$",
"model",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"manager",
"->",
"getClassMetadata",
"(",
"get_class",
"(",
"$",
"model",
")",
")",
";",
"$",
"managers",
"=",
"$",
"class",
"->",
"getFieldManagerNames",... | Saves a model.
@param mixed $model | [
"Saves",
"a",
"model",
"."
] | cce32d7cb5f13f42c358c8140b2f97ddf1d9435a | https://github.com/pokap/pool-dbm/blob/cce32d7cb5f13f42c358c8140b2f97ddf1d9435a/src/Pok/PoolDBM/Transaction.php#L54-L84 |
11,453 | pokap/pool-dbm | src/Pok/PoolDBM/Transaction.php | Transaction.commit | public function commit()
{
$this->launch(function ($manager) {
$manager->commit();
});
$this->executeQueue();
$this->manager->flush();
} | php | public function commit()
{
$this->launch(function ($manager) {
$manager->commit();
});
$this->executeQueue();
$this->manager->flush();
} | [
"public",
"function",
"commit",
"(",
")",
"{",
"$",
"this",
"->",
"launch",
"(",
"function",
"(",
"$",
"manager",
")",
"{",
"$",
"manager",
"->",
"commit",
"(",
")",
";",
"}",
")",
";",
"$",
"this",
"->",
"executeQueue",
"(",
")",
";",
"$",
"this... | Commits a transaction on the underlying database connection.
@return void | [
"Commits",
"a",
"transaction",
"on",
"the",
"underlying",
"database",
"connection",
"."
] | cce32d7cb5f13f42c358c8140b2f97ddf1d9435a | https://github.com/pokap/pool-dbm/blob/cce32d7cb5f13f42c358c8140b2f97ddf1d9435a/src/Pok/PoolDBM/Transaction.php#L115-L123 |
11,454 | pokap/pool-dbm | src/Pok/PoolDBM/Transaction.php | Transaction.launch | protected function launch(\Closure $func)
{
foreach ($this->manager->getPool()->getPriority('transaction') as $managerName) {
$func($this->manager->getPool()->getManager($managerName));
}
} | php | protected function launch(\Closure $func)
{
foreach ($this->manager->getPool()->getPriority('transaction') as $managerName) {
$func($this->manager->getPool()->getManager($managerName));
}
} | [
"protected",
"function",
"launch",
"(",
"\\",
"Closure",
"$",
"func",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"manager",
"->",
"getPool",
"(",
")",
"->",
"getPriority",
"(",
"'transaction'",
")",
"as",
"$",
"managerName",
")",
"{",
"$",
"func",
"(... | Launch function for each manager in transaction priority.
@param \Closure $func | [
"Launch",
"function",
"for",
"each",
"manager",
"in",
"transaction",
"priority",
"."
] | cce32d7cb5f13f42c358c8140b2f97ddf1d9435a | https://github.com/pokap/pool-dbm/blob/cce32d7cb5f13f42c358c8140b2f97ddf1d9435a/src/Pok/PoolDBM/Transaction.php#L162-L167 |
11,455 | pokap/pool-dbm | src/Pok/PoolDBM/Transaction.php | Transaction.addQueue | protected function addQueue($action, $managerName, $model, $id = null)
{
if (!in_array($action, array( self::QUEUE_ACTION_PERSIST, self::QUEUE_ACTION_REMOVE))) {
throw new \InvalidArgumentException(sprintf('Action unknown, manager name : "%s".', $managerName));
}
$this->queueAct... | php | protected function addQueue($action, $managerName, $model, $id = null)
{
if (!in_array($action, array( self::QUEUE_ACTION_PERSIST, self::QUEUE_ACTION_REMOVE))) {
throw new \InvalidArgumentException(sprintf('Action unknown, manager name : "%s".', $managerName));
}
$this->queueAct... | [
"protected",
"function",
"addQueue",
"(",
"$",
"action",
",",
"$",
"managerName",
",",
"$",
"model",
",",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"action",
",",
"array",
"(",
"self",
"::",
"QUEUE_ACTION_PERSIST",
",",
... | Add action with model reference in queue.
@param integer $action
@param string $managerName
@param mixed $model
@param null|mixed $id
@throws \InvalidArgumentException | [
"Add",
"action",
"with",
"model",
"reference",
"in",
"queue",
"."
] | cce32d7cb5f13f42c358c8140b2f97ddf1d9435a | https://github.com/pokap/pool-dbm/blob/cce32d7cb5f13f42c358c8140b2f97ddf1d9435a/src/Pok/PoolDBM/Transaction.php#L179-L189 |
11,456 | pokap/pool-dbm | src/Pok/PoolDBM/Transaction.php | Transaction.executeQueue | protected function executeQueue()
{
foreach ($this->queueActions as $key => $action) {
if (self::QUEUE_ACTION_PERSIST === $action) {
$this->doPersist($this->queueManagerNames[$key], $this->queueModels[$key], $this->queueIds[$key]);
} else {
$this->mana... | php | protected function executeQueue()
{
foreach ($this->queueActions as $key => $action) {
if (self::QUEUE_ACTION_PERSIST === $action) {
$this->doPersist($this->queueManagerNames[$key], $this->queueModels[$key], $this->queueIds[$key]);
} else {
$this->mana... | [
"protected",
"function",
"executeQueue",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"queueActions",
"as",
"$",
"key",
"=>",
"$",
"action",
")",
"{",
"if",
"(",
"self",
"::",
"QUEUE_ACTION_PERSIST",
"===",
"$",
"action",
")",
"{",
"$",
"this",
"-... | Execute all data in queue. | [
"Execute",
"all",
"data",
"in",
"queue",
"."
] | cce32d7cb5f13f42c358c8140b2f97ddf1d9435a | https://github.com/pokap/pool-dbm/blob/cce32d7cb5f13f42c358c8140b2f97ddf1d9435a/src/Pok/PoolDBM/Transaction.php#L194-L205 |
11,457 | sirbrillig/just-the-snaps | src/JustSnaps/FileDriver.php | FileDriver.addSerializerToDriver | public static function addSerializerToDriver(Serializer $serializer, FileDriverProvider $provider): FileDriverProvider {
if ($provider instanceof FileDriverWithSerializer) {
$provider->addSerializer($serializer);
return $provider;
}
return new FileDriverWithSerializer($serializer, $provider);
} | php | public static function addSerializerToDriver(Serializer $serializer, FileDriverProvider $provider): FileDriverProvider {
if ($provider instanceof FileDriverWithSerializer) {
$provider->addSerializer($serializer);
return $provider;
}
return new FileDriverWithSerializer($serializer, $provider);
} | [
"public",
"static",
"function",
"addSerializerToDriver",
"(",
"Serializer",
"$",
"serializer",
",",
"FileDriverProvider",
"$",
"provider",
")",
":",
"FileDriverProvider",
"{",
"if",
"(",
"$",
"provider",
"instanceof",
"FileDriverWithSerializer",
")",
"{",
"$",
"prov... | Add a serializer to a FileDriverProvider
@param Serializer $serializer The Serializer to add
@param FileDriverProvider $driver The driver to which to add the Serializer
@return FileDriverProvider The modified FileDriverProvider | [
"Add",
"a",
"serializer",
"to",
"a",
"FileDriverProvider"
] | 37a020b91459684c693f7ad53ed6fded1a0f89f9 | https://github.com/sirbrillig/just-the-snaps/blob/37a020b91459684c693f7ad53ed6fded1a0f89f9/src/JustSnaps/FileDriver.php#L29-L35 |
11,458 | crazedsanity/siteconfig | src/SiteConfig/SiteConfig.class.php | SiteConfig.get_section | public function get_section($section) {
if($this->isInitialized === true) {
$retval = $this->fullConfig[$section];
}
else {
throw new exception(__METHOD__ .": not initialized");
}
return($retval);
} | php | public function get_section($section) {
if($this->isInitialized === true) {
$retval = $this->fullConfig[$section];
}
else {
throw new exception(__METHOD__ .": not initialized");
}
return($retval);
} | [
"public",
"function",
"get_section",
"(",
"$",
"section",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isInitialized",
"===",
"true",
")",
"{",
"$",
"retval",
"=",
"$",
"this",
"->",
"fullConfig",
"[",
"$",
"section",
"]",
";",
"}",
"else",
"{",
"throw",... | Retrieve all data about the given section.
@param $section (str) section to retrieve.
@return array (PASS) array contains section data.
@return exception (FAIL) exception indicates problem. | [
"Retrieve",
"all",
"data",
"about",
"the",
"given",
"section",
"."
] | 1f0881517b748c7e9344159eaf8daf093475e4f2 | https://github.com/crazedsanity/siteconfig/blob/1f0881517b748c7e9344159eaf8daf093475e4f2/src/SiteConfig/SiteConfig.class.php#L132-L141 |
11,459 | gios-asu/nectary | src/factories/implementations/dependency-injection-factory.php | Dependency_Injection_Factory.build | public function build() : array {
$reflector = new \ReflectionMethod(
$this->class_name,
$this->method_name
);
$dependencies = $this->get_dependencies(
$reflector,
$this->arguments
);
$obj = $this->make(
$this->class_name,
$this->arguments
);
return [ $obj, $dependencies, $this->valid... | php | public function build() : array {
$reflector = new \ReflectionMethod(
$this->class_name,
$this->method_name
);
$dependencies = $this->get_dependencies(
$reflector,
$this->arguments
);
$obj = $this->make(
$this->class_name,
$this->arguments
);
return [ $obj, $dependencies, $this->valid... | [
"public",
"function",
"build",
"(",
")",
":",
"array",
"{",
"$",
"reflector",
"=",
"new",
"\\",
"ReflectionMethod",
"(",
"$",
"this",
"->",
"class_name",
",",
"$",
"this",
"->",
"method_name",
")",
";",
"$",
"dependencies",
"=",
"$",
"this",
"->",
"get... | Build the object, its dependencies, and list
any validators that should be checked
@override
@throws \ReflectionException | [
"Build",
"the",
"object",
"its",
"dependencies",
"and",
"list",
"any",
"validators",
"that",
"should",
"be",
"checked"
] | f972c737a9036a3090652950a1309a62c07d86c0 | https://github.com/gios-asu/nectary/blob/f972c737a9036a3090652950a1309a62c07d86c0/src/factories/implementations/dependency-injection-factory.php#L46-L63 |
11,460 | gios-asu/nectary | src/factories/implementations/dependency-injection-factory.php | Dependency_Injection_Factory.get_dependencies | private function get_dependencies( \ReflectionMethod $reflector, $named_arguments ) : array {
$reflector_parameters = $reflector->getParameters();
$dependencies = $this->resolve_dependencies( $reflector_parameters, $named_arguments );
return $dependencies;
} | php | private function get_dependencies( \ReflectionMethod $reflector, $named_arguments ) : array {
$reflector_parameters = $reflector->getParameters();
$dependencies = $this->resolve_dependencies( $reflector_parameters, $named_arguments );
return $dependencies;
} | [
"private",
"function",
"get_dependencies",
"(",
"\\",
"ReflectionMethod",
"$",
"reflector",
",",
"$",
"named_arguments",
")",
":",
"array",
"{",
"$",
"reflector_parameters",
"=",
"$",
"reflector",
"->",
"getParameters",
"(",
")",
";",
"$",
"dependencies",
"=",
... | Get the dependencies for a given reflection object
@param \ReflectionMethod $reflector Reflection object to gather dependencies from
@param array $named_arguments An associative array of suggested arguments
@return array
@throws \ReflectionException | [
"Get",
"the",
"dependencies",
"for",
"a",
"given",
"reflection",
"object"
] | f972c737a9036a3090652950a1309a62c07d86c0 | https://github.com/gios-asu/nectary/blob/f972c737a9036a3090652950a1309a62c07d86c0/src/factories/implementations/dependency-injection-factory.php#L73-L79 |
11,461 | gios-asu/nectary | src/factories/implementations/dependency-injection-factory.php | Dependency_Injection_Factory.make | private function make( $class_name, $named_arguments ) {
$reflector = new \ReflectionClass( $class_name );
$constructor = $reflector->getConstructor();
if ( is_subclass_of( $class_name, Singleton::class ) ) {
return $class_name::get_instance();
}
if ( $reflector->isAbstract() ) {
return null;
}
... | php | private function make( $class_name, $named_arguments ) {
$reflector = new \ReflectionClass( $class_name );
$constructor = $reflector->getConstructor();
if ( is_subclass_of( $class_name, Singleton::class ) ) {
return $class_name::get_instance();
}
if ( $reflector->isAbstract() ) {
return null;
}
... | [
"private",
"function",
"make",
"(",
"$",
"class_name",
",",
"$",
"named_arguments",
")",
"{",
"$",
"reflector",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"class_name",
")",
";",
"$",
"constructor",
"=",
"$",
"reflector",
"->",
"getConstructor",
"(",
"... | Given a class and arguments to inject into that class, this
will create an instance of the given object.
This will handle special cases as well.
@param string $class_name The name of the class to make
@param array $named_arguments The arguments to inject into the class
@return mixed An insta... | [
"Given",
"a",
"class",
"and",
"arguments",
"to",
"inject",
"into",
"that",
"class",
"this",
"will",
"create",
"an",
"instance",
"of",
"the",
"given",
"object",
"."
] | f972c737a9036a3090652950a1309a62c07d86c0 | https://github.com/gios-asu/nectary/blob/f972c737a9036a3090652950a1309a62c07d86c0/src/factories/implementations/dependency-injection-factory.php#L126-L151 |
11,462 | AnonymPHP/Anonym-Library | src/Anonym/Security/Security.php | Security.ip | public static function ip()
{
if (getenv("HTTP_CLIENT_IP")) {
$ip = getenv("HTTP_CLIENT_IP");
} elseif (getenv("HTTP_X_FORWARDED_FOR")) {
$ip = getenv("HTTP_X_FORWARDED_FOR");
if (strstr($ip, ',')) {
$tmp = explode(',',... | php | public static function ip()
{
if (getenv("HTTP_CLIENT_IP")) {
$ip = getenv("HTTP_CLIENT_IP");
} elseif (getenv("HTTP_X_FORWARDED_FOR")) {
$ip = getenv("HTTP_X_FORWARDED_FOR");
if (strstr($ip, ',')) {
$tmp = explode(',',... | [
"public",
"static",
"function",
"ip",
"(",
")",
"{",
"if",
"(",
"getenv",
"(",
"\"HTTP_CLIENT_IP\"",
")",
")",
"{",
"$",
"ip",
"=",
"getenv",
"(",
"\"HTTP_CLIENT_IP\"",
")",
";",
"}",
"elseif",
"(",
"getenv",
"(",
"\"HTTP_X_FORWARDED_FOR\"",
")",
")",
"{... | return the user ip
@return string | [
"return",
"the",
"user",
"ip"
] | c967ad804f84e8fb204593a0959cda2fed5ae075 | https://github.com/AnonymPHP/Anonym-Library/blob/c967ad804f84e8fb204593a0959cda2fed5ae075/src/Anonym/Security/Security.php#L88-L103 |
11,463 | sw2eu/load-common | src/Bridges/Nette/DI/LoadExtension.php | LoadExtension.registerDebugger | protected function registerDebugger()
{
if ($this->config['debugger']) {
$builder = $this->getContainerBuilder();
if (!$builder->hasDefinition(self::TRACY_PANEL)) {
$builder->addDefinition(self::TRACY_PANEL)->setClass(LoadPanel::class);
}
$builder->getDefinition(self::TRACY_PANEL)
->addSetup('add... | php | protected function registerDebugger()
{
if ($this->config['debugger']) {
$builder = $this->getContainerBuilder();
if (!$builder->hasDefinition(self::TRACY_PANEL)) {
$builder->addDefinition(self::TRACY_PANEL)->setClass(LoadPanel::class);
}
$builder->getDefinition(self::TRACY_PANEL)
->addSetup('add... | [
"protected",
"function",
"registerDebugger",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"config",
"[",
"'debugger'",
"]",
")",
"{",
"$",
"builder",
"=",
"$",
"this",
"->",
"getContainerBuilder",
"(",
")",
";",
"if",
"(",
"!",
"$",
"builder",
"->",
... | Add debug panel, if needed. | [
"Add",
"debug",
"panel",
"if",
"needed",
"."
] | ce9cb997c1a179907edadabbc4eebd1145ef72ae | https://github.com/sw2eu/load-common/blob/ce9cb997c1a179907edadabbc4eebd1145ef72ae/src/Bridges/Nette/DI/LoadExtension.php#L85-L95 |
11,464 | sw2eu/load-common | src/Bridges/Nette/DI/LoadExtension.php | LoadExtension.afterCompile | public function afterCompile(Nette\PhpGenerator\ClassType $class)
{
$initialize = $class->getMethod('initialize');
$builder = $this->getContainerBuilder();
if ($builder->parameters['debugMode'] && $builder->hasDefinition(self::TRACY_PANEL)) {
$initialize->addBody($builder->formatPhp('?;', [
new Nette\DI\... | php | public function afterCompile(Nette\PhpGenerator\ClassType $class)
{
$initialize = $class->getMethod('initialize');
$builder = $this->getContainerBuilder();
if ($builder->parameters['debugMode'] && $builder->hasDefinition(self::TRACY_PANEL)) {
$initialize->addBody($builder->formatPhp('?;', [
new Nette\DI\... | [
"public",
"function",
"afterCompile",
"(",
"Nette",
"\\",
"PhpGenerator",
"\\",
"ClassType",
"$",
"class",
")",
"{",
"$",
"initialize",
"=",
"$",
"class",
"->",
"getMethod",
"(",
"'initialize'",
")",
";",
"$",
"builder",
"=",
"$",
"this",
"->",
"getContain... | Adjusts DI container compiled to PHP class. Intended to be overridden by descendant.
@param Nette\PhpGenerator\ClassType $class | [
"Adjusts",
"DI",
"container",
"compiled",
"to",
"PHP",
"class",
".",
"Intended",
"to",
"be",
"overridden",
"by",
"descendant",
"."
] | ce9cb997c1a179907edadabbc4eebd1145ef72ae | https://github.com/sw2eu/load-common/blob/ce9cb997c1a179907edadabbc4eebd1145ef72ae/src/Bridges/Nette/DI/LoadExtension.php#L102-L112 |
11,465 | krakphp/auto-args | src/AutoArgs.php | AutoArgs.resolveArguments | public function resolveArguments($callable, array $context) {
$resolve_arg = $this->resolve_arg;
$rf = $this->callableToReflectionFunctionAbstract($callable);
$args = [];
foreach ($rf->getParameters() as $i => $arg_meta) {
$arg = $resolve_arg($arg_meta, $context);
... | php | public function resolveArguments($callable, array $context) {
$resolve_arg = $this->resolve_arg;
$rf = $this->callableToReflectionFunctionAbstract($callable);
$args = [];
foreach ($rf->getParameters() as $i => $arg_meta) {
$arg = $resolve_arg($arg_meta, $context);
... | [
"public",
"function",
"resolveArguments",
"(",
"$",
"callable",
",",
"array",
"$",
"context",
")",
"{",
"$",
"resolve_arg",
"=",
"$",
"this",
"->",
"resolve_arg",
";",
"$",
"rf",
"=",
"$",
"this",
"->",
"callableToReflectionFunctionAbstract",
"(",
"$",
"call... | resolves the arguments for the callable and returns the array of args | [
"resolves",
"the",
"arguments",
"for",
"the",
"callable",
"and",
"returns",
"the",
"array",
"of",
"args"
] | 75e099b4c81448fc6d238236a9417247871064d9 | https://github.com/krakphp/auto-args/blob/75e099b4c81448fc6d238236a9417247871064d9/src/AutoArgs.php#L34-L52 |
11,466 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/redis/db.php | Redis_Db.forge | public static function forge($name = 'default', $config = array())
{
empty(static::$instances) and \Config::load('db', true);
if ( ! ($conf = \Config::get('db.redis.'.$name)))
{
throw new \RedisException('Invalid instance name given.');
}
$config = \Arr::merge($conf, $config);
static::$instances[$name... | php | public static function forge($name = 'default', $config = array())
{
empty(static::$instances) and \Config::load('db', true);
if ( ! ($conf = \Config::get('db.redis.'.$name)))
{
throw new \RedisException('Invalid instance name given.');
}
$config = \Arr::merge($conf, $config);
static::$instances[$name... | [
"public",
"static",
"function",
"forge",
"(",
"$",
"name",
"=",
"'default'",
",",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"empty",
"(",
"static",
"::",
"$",
"instances",
")",
"and",
"\\",
"Config",
"::",
"load",
"(",
"'db'",
",",
"true",
"... | create an instance of the Redis class | [
"create",
"an",
"instance",
"of",
"the",
"Redis",
"class"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/redis/db.php#L57-L70 |
11,467 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/redis/db.php | Redis_Db.execute | public function execute()
{
// open a Redis connection and execute the queued commands
foreach ($this->queue as $command)
{
for ($written = 0; $written < strlen($command); $written += $fwrite)
{
$fwrite = fwrite($this->connection, substr($command, $written));
if ($fwrite === false)
{
throw... | php | public function execute()
{
// open a Redis connection and execute the queued commands
foreach ($this->queue as $command)
{
for ($written = 0; $written < strlen($command); $written += $fwrite)
{
$fwrite = fwrite($this->connection, substr($command, $written));
if ($fwrite === false)
{
throw... | [
"public",
"function",
"execute",
"(",
")",
"{",
"// open a Redis connection and execute the queued commands",
"foreach",
"(",
"$",
"this",
"->",
"queue",
"as",
"$",
"command",
")",
"{",
"for",
"(",
"$",
"written",
"=",
"0",
";",
"$",
"written",
"<",
"strlen",
... | Flushes the commands in the pipeline queue to Redis and returns the responses.
@see pipeline | [
"Flushes",
"the",
"commands",
"in",
"the",
"pipeline",
"queue",
"to",
"Redis",
"and",
"returns",
"the",
"responses",
"."
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/redis/db.php#L141-L175 |
11,468 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/redis/db.php | Redis_Db.psubscribe | public function psubscribe($pattern, $callback)
{
$args = array('PSUBSCRIBE', $pattern);
$command = sprintf('*%d%s%s%s', 2, CRLF, implode(array_map(function($arg) {
return sprintf('$%d%s%s', strlen($arg), CRLF, $arg);
}, $args), CRLF), CRLF);
for ($written = 0; $written... | php | public function psubscribe($pattern, $callback)
{
$args = array('PSUBSCRIBE', $pattern);
$command = sprintf('*%d%s%s%s', 2, CRLF, implode(array_map(function($arg) {
return sprintf('$%d%s%s', strlen($arg), CRLF, $arg);
}, $args), CRLF), CRLF);
for ($written = 0; $written... | [
"public",
"function",
"psubscribe",
"(",
"$",
"pattern",
",",
"$",
"callback",
")",
"{",
"$",
"args",
"=",
"array",
"(",
"'PSUBSCRIBE'",
",",
"$",
"pattern",
")",
";",
"$",
"command",
"=",
"sprintf",
"(",
"'*%d%s%s%s'",
",",
"2",
",",
"CRLF",
",",
"i... | Alias for the redis PSUBSCRIBE command. It allows you to listen, and
have the callback called for every response.
@params string pattern to subscribe to
@params callable callback, to process the responses
@throws RedisException if writing the command failed | [
"Alias",
"for",
"the",
"redis",
"PSUBSCRIBE",
"command",
".",
"It",
"allows",
"you",
"to",
"listen",
"and",
"have",
"the",
"callback",
"called",
"for",
"every",
"response",
"."
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/redis/db.php#L186-L215 |
11,469 | agalbourdin/agl-core | src/Db/Collection/CollectionAbstract.php | CollectionAbstract._fetch | protected function _fetch()
{
if ($this->_select === NULL) {
return false;
}
$this->_data = $this->_select->fetchAllAsItems();
return true;
} | php | protected function _fetch()
{
if ($this->_select === NULL) {
return false;
}
$this->_data = $this->_select->fetchAllAsItems();
return true;
} | [
"protected",
"function",
"_fetch",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_select",
"===",
"NULL",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"_data",
"=",
"$",
"this",
"->",
"_select",
"->",
"fetchAllAsItems",
"(",
")",
";",
... | Fetch MySQL results.
@return bool | [
"Fetch",
"MySQL",
"results",
"."
] | 1db556f9a49488aa9fab6887fefb7141a79ad97d | https://github.com/agalbourdin/agl-core/blob/1db556f9a49488aa9fab6887fefb7141a79ad97d/src/Db/Collection/CollectionAbstract.php#L131-L140 |
11,470 | agalbourdin/agl-core | src/Db/Collection/CollectionAbstract.php | CollectionAbstract.load | public function load(array $pArgs = array())
{
$select = new Select($this->_dbContainer);
/*$select->addFields(array(
ItemInterface::IDFIELD => true
));*/
if (isset($pArgs[DbInterface::FILTER_LIMIT])) {
$select->limit($pArgs[DbInterface::FILTER_LIMIT]);
... | php | public function load(array $pArgs = array())
{
$select = new Select($this->_dbContainer);
/*$select->addFields(array(
ItemInterface::IDFIELD => true
));*/
if (isset($pArgs[DbInterface::FILTER_LIMIT])) {
$select->limit($pArgs[DbInterface::FILTER_LIMIT]);
... | [
"public",
"function",
"load",
"(",
"array",
"$",
"pArgs",
"=",
"array",
"(",
")",
")",
"{",
"$",
"select",
"=",
"new",
"Select",
"(",
"$",
"this",
"->",
"_dbContainer",
")",
";",
"/*$select->addFields(array(\n ItemInterface::IDFIELD => true\n ));*/... | Load all the collection's items with optional filters.
@param array $pArgs Optional arguments (Conditions, Limit, Order)
@return CollectionAbstract | [
"Load",
"all",
"the",
"collection",
"s",
"items",
"with",
"optional",
"filters",
"."
] | 1db556f9a49488aa9fab6887fefb7141a79ad97d | https://github.com/agalbourdin/agl-core/blob/1db556f9a49488aa9fab6887fefb7141a79ad97d/src/Db/Collection/CollectionAbstract.php#L148-L178 |
11,471 | agalbourdin/agl-core | src/Db/Collection/CollectionAbstract.php | CollectionAbstract.countAll | public function countAll($pConditions = NULL)
{
$count = new Count($this->_dbContainer);
if ($pConditions instanceof Conditions) {
$count->loadConditions($pConditions);
}
return $count->commit();
} | php | public function countAll($pConditions = NULL)
{
$count = new Count($this->_dbContainer);
if ($pConditions instanceof Conditions) {
$count->loadConditions($pConditions);
}
return $count->commit();
} | [
"public",
"function",
"countAll",
"(",
"$",
"pConditions",
"=",
"NULL",
")",
"{",
"$",
"count",
"=",
"new",
"Count",
"(",
"$",
"this",
"->",
"_dbContainer",
")",
";",
"if",
"(",
"$",
"pConditions",
"instanceof",
"Conditions",
")",
"{",
"$",
"count",
"-... | Count a collection without loading items.
@param Conditions $pConditions Filter the results
@return int | [
"Count",
"a",
"collection",
"without",
"loading",
"items",
"."
] | 1db556f9a49488aa9fab6887fefb7141a79ad97d | https://github.com/agalbourdin/agl-core/blob/1db556f9a49488aa9fab6887fefb7141a79ad97d/src/Db/Collection/CollectionAbstract.php#L248-L257 |
11,472 | agalbourdin/agl-core | src/Db/Collection/CollectionAbstract.php | CollectionAbstract.deleteItems | public function deleteItems($pWithChilds = false)
{
foreach ($this as $item) {
if ($item->getId()) {
$item->delete($pWithChilds);
}
}
return $this;
} | php | public function deleteItems($pWithChilds = false)
{
foreach ($this as $item) {
if ($item->getId()) {
$item->delete($pWithChilds);
}
}
return $this;
} | [
"public",
"function",
"deleteItems",
"(",
"$",
"pWithChilds",
"=",
"false",
")",
"{",
"foreach",
"(",
"$",
"this",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"item",
"->",
"getId",
"(",
")",
")",
"{",
"$",
"item",
"->",
"delete",
"(",
"$",
"pWi... | Delete all items from the database and reset the collection.
@param bool $pWithChilds Delete also all item's childs in other
collections
@return CollectionAbstract | [
"Delete",
"all",
"items",
"from",
"the",
"database",
"and",
"reset",
"the",
"collection",
"."
] | 1db556f9a49488aa9fab6887fefb7141a79ad97d | https://github.com/agalbourdin/agl-core/blob/1db556f9a49488aa9fab6887fefb7141a79ad97d/src/Db/Collection/CollectionAbstract.php#L298-L307 |
11,473 | webriq/core | module/Core/src/Grid/Core/Model/FileSystem.php | FileSystem.realPath | protected function realPath( $path )
{
$path = trim( str_replace( '\\', '/', $path ), '/' );
$path = str_replace( '/./', '/', $path );
$path = preg_replace( '#[^/]+/\\.\\./#', '/', $path );
$path = preg_replace( '#/?\\.\\.?/#', '', $path );
$path = preg_replace( '#/+#', '/', ... | php | protected function realPath( $path )
{
$path = trim( str_replace( '\\', '/', $path ), '/' );
$path = str_replace( '/./', '/', $path );
$path = preg_replace( '#[^/]+/\\.\\./#', '/', $path );
$path = preg_replace( '#/?\\.\\.?/#', '', $path );
$path = preg_replace( '#/+#', '/', ... | [
"protected",
"function",
"realPath",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"trim",
"(",
"str_replace",
"(",
"'\\\\'",
",",
"'/'",
",",
"$",
"path",
")",
",",
"'/'",
")",
";",
"$",
"path",
"=",
"str_replace",
"(",
"'/./'",
",",
"'/'",
",",
... | Get real path
@param string $path
@return string | [
"Get",
"real",
"path"
] | cfeb6e8a4732561c2215ec94e736c07f9b8bc990 | https://github.com/webriq/core/blob/cfeb6e8a4732561c2215ec94e736c07f9b8bc990/module/Core/src/Grid/Core/Model/FileSystem.php#L134-L149 |
11,474 | webriq/core | module/Core/src/Grid/Core/Model/FileSystem.php | FileSystem.createDir | public function createDir( $path )
{
if ( empty( $path ) )
{
return false;
}
$path = $this->validPath( $path );
$base = $this->baseUrl . '/' . $path;
$full = $this->baseDir . '/' . $base;
if ( ! is_dir( $full ) && ! is_file( $full ) )
{
... | php | public function createDir( $path )
{
if ( empty( $path ) )
{
return false;
}
$path = $this->validPath( $path );
$base = $this->baseUrl . '/' . $path;
$full = $this->baseDir . '/' . $base;
if ( ! is_dir( $full ) && ! is_file( $full ) )
{
... | [
"public",
"function",
"createDir",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"path",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"path",
"=",
"$",
"this",
"->",
"validPath",
"(",
"$",
"path",
")",
";",
"$",
"base",
"=",
"$"... | Create a dir
@param string $path
@return bool|string failed / new | [
"Create",
"a",
"dir"
] | cfeb6e8a4732561c2215ec94e736c07f9b8bc990 | https://github.com/webriq/core/blob/cfeb6e8a4732561c2215ec94e736c07f9b8bc990/module/Core/src/Grid/Core/Model/FileSystem.php#L474-L496 |
11,475 | webriq/core | module/Core/src/Grid/Core/Model/FileSystem.php | FileSystem._copy | protected function _copy( $path, $to )
{
if ( is_file( $to ) )
{
return false;
}
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator( $path,
RecursiveDirectoryIterator::CURRENT_AS_FILEINFO |
RecursiveDirec... | php | protected function _copy( $path, $to )
{
if ( is_file( $to ) )
{
return false;
}
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator( $path,
RecursiveDirectoryIterator::CURRENT_AS_FILEINFO |
RecursiveDirec... | [
"protected",
"function",
"_copy",
"(",
"$",
"path",
",",
"$",
"to",
")",
"{",
"if",
"(",
"is_file",
"(",
"$",
"to",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"iterator",
"=",
"new",
"RecursiveIteratorIterator",
"(",
"new",
"RecursiveDirectoryItera... | Copy entire dir
@param string $path
@param string $to
@return bool | [
"Copy",
"entire",
"dir"
] | cfeb6e8a4732561c2215ec94e736c07f9b8bc990 | https://github.com/webriq/core/blob/cfeb6e8a4732561c2215ec94e736c07f9b8bc990/module/Core/src/Grid/Core/Model/FileSystem.php#L505-L539 |
11,476 | webriq/core | module/Core/src/Grid/Core/Model/FileSystem.php | FileSystem.uploaded | public function uploaded( $temp, $to )
{
if ( null === $this->identity )
{
return false;
}
if ( is_array( $temp ) || is_object( $temp ) ||
is_array( $to ) || is_object( $to ) )
{
if ( ( ! is_array( $temp ) && ! is_object( $temp ) ) ||
... | php | public function uploaded( $temp, $to )
{
if ( null === $this->identity )
{
return false;
}
if ( is_array( $temp ) || is_object( $temp ) ||
is_array( $to ) || is_object( $to ) )
{
if ( ( ! is_array( $temp ) && ! is_object( $temp ) ) ||
... | [
"public",
"function",
"uploaded",
"(",
"$",
"temp",
",",
"$",
"to",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"identity",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"temp",
")",
"||",
"is_object",
"(",
"$... | Handle uploaded file
@param string|array $temp
@param string|array $to
@return bool|string failed / to | [
"Handle",
"uploaded",
"file"
] | cfeb6e8a4732561c2215ec94e736c07f9b8bc990 | https://github.com/webriq/core/blob/cfeb6e8a4732561c2215ec94e736c07f9b8bc990/module/Core/src/Grid/Core/Model/FileSystem.php#L729-L794 |
11,477 | abreu1234/acl | src/Controller/UserGroupPermissionController.php | UserGroupPermissionController.addAjax | public function addAjax()
{
$this->request->allowMethod(['ajax']);
$data['group_or_user'] = $this->request->data['group_or_user'];
$data['group_or_user_id'] = $this->request->data['group_or_user_id'];
$permissions = json_decode($this->request->data['permissions']);
... | php | public function addAjax()
{
$this->request->allowMethod(['ajax']);
$data['group_or_user'] = $this->request->data['group_or_user'];
$data['group_or_user_id'] = $this->request->data['group_or_user_id'];
$permissions = json_decode($this->request->data['permissions']);
... | [
"public",
"function",
"addAjax",
"(",
")",
"{",
"$",
"this",
"->",
"request",
"->",
"allowMethod",
"(",
"[",
"'ajax'",
"]",
")",
";",
"$",
"data",
"[",
"'group_or_user'",
"]",
"=",
"$",
"this",
"->",
"request",
"->",
"data",
"[",
"'group_or_user'",
"]"... | Add by ajax | [
"Add",
"by",
"ajax"
] | e004ab43308c3629f8cc32e2bd60b07c4dc8c1df | https://github.com/abreu1234/acl/blob/e004ab43308c3629f8cc32e2bd60b07c4dc8c1df/src/Controller/UserGroupPermissionController.php#L88-L119 |
11,478 | abreu1234/acl | src/Controller/UserGroupPermissionController.php | UserGroupPermissionController.getPermission | public function getPermission()
{
$this->request->allowMethod(['ajax']);
$group_or_user = isset($this->request->data['group_or_user']) ? $this->request->data['group_or_user'] : null;
$group_or_user_id = isset($this->request->data['group_or_user_id']) ? $this->request->data['group_or_user_id... | php | public function getPermission()
{
$this->request->allowMethod(['ajax']);
$group_or_user = isset($this->request->data['group_or_user']) ? $this->request->data['group_or_user'] : null;
$group_or_user_id = isset($this->request->data['group_or_user_id']) ? $this->request->data['group_or_user_id... | [
"public",
"function",
"getPermission",
"(",
")",
"{",
"$",
"this",
"->",
"request",
"->",
"allowMethod",
"(",
"[",
"'ajax'",
"]",
")",
";",
"$",
"group_or_user",
"=",
"isset",
"(",
"$",
"this",
"->",
"request",
"->",
"data",
"[",
"'group_or_user'",
"]",
... | Get all permissions by ajax | [
"Get",
"all",
"permissions",
"by",
"ajax"
] | e004ab43308c3629f8cc32e2bd60b07c4dc8c1df | https://github.com/abreu1234/acl/blob/e004ab43308c3629f8cc32e2bd60b07c4dc8c1df/src/Controller/UserGroupPermissionController.php#L124-L144 |
11,479 | gossi/trixionary | src/model/Base/PictureQuery.php | PictureQuery.filterByThumbUrl | public function filterByThumbUrl($thumbUrl = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($thumbUrl)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $thumbUrl)) {
$thumbUrl = str_replace('*', '%', $thumbUrl);
... | php | public function filterByThumbUrl($thumbUrl = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($thumbUrl)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $thumbUrl)) {
$thumbUrl = str_replace('*', '%', $thumbUrl);
... | [
"public",
"function",
"filterByThumbUrl",
"(",
"$",
"thumbUrl",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"thumbUrl",
")",
")",
"{",
"$",
"compa... | Filter the query on the thumb_url column
Example usage:
<code>
$query->filterByThumbUrl('fooValue'); // WHERE thumb_url = 'fooValue'
$query->filterByThumbUrl('%fooValue%'); // WHERE thumb_url LIKE '%fooValue%'
</code>
@param string $thumbUrl The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)... | [
"Filter",
"the",
"query",
"on",
"the",
"thumb_url",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/PictureQuery.php#L428-L440 |
11,480 | gossi/trixionary | src/model/Base/PictureQuery.php | PictureQuery.filterBySkillId | public function filterBySkillId($skillId = null, $comparison = null)
{
if (is_array($skillId)) {
$useMinMax = false;
if (isset($skillId['min'])) {
$this->addUsingAlias(PictureTableMap::COL_SKILL_ID, $skillId['min'], Criteria::GREATER_EQUAL);
$useMinMax... | php | public function filterBySkillId($skillId = null, $comparison = null)
{
if (is_array($skillId)) {
$useMinMax = false;
if (isset($skillId['min'])) {
$this->addUsingAlias(PictureTableMap::COL_SKILL_ID, $skillId['min'], Criteria::GREATER_EQUAL);
$useMinMax... | [
"public",
"function",
"filterBySkillId",
"(",
"$",
"skillId",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"skillId",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
... | Filter the query on the skill_id column
Example usage:
<code>
$query->filterBySkillId(1234); // WHERE skill_id = 1234
$query->filterBySkillId(array(12, 34)); // WHERE skill_id IN (12, 34)
$query->filterBySkillId(array('min' => 12)); // WHERE skill_id > 12
</code>
@see filterBySkill()
@param mixed $skillId ... | [
"Filter",
"the",
"query",
"on",
"the",
"skill_id",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/PictureQuery.php#L462-L483 |
11,481 | gossi/trixionary | src/model/Base/PictureQuery.php | PictureQuery.filterByPhotographer | public function filterByPhotographer($photographer = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($photographer)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $photographer)) {
$photographer = str_replace('*', ... | php | public function filterByPhotographer($photographer = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($photographer)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $photographer)) {
$photographer = str_replace('*', ... | [
"public",
"function",
"filterByPhotographer",
"(",
"$",
"photographer",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"photographer",
")",
")",
"{",
"... | Filter the query on the photographer column
Example usage:
<code>
$query->filterByPhotographer('fooValue'); // WHERE photographer = 'fooValue'
$query->filterByPhotographer('%fooValue%'); // WHERE photographer LIKE '%fooValue%'
</code>
@param string $photographer The value to use as filter.
Accepts wildcards (* ... | [
"Filter",
"the",
"query",
"on",
"the",
"photographer",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/PictureQuery.php#L500-L512 |
11,482 | gossi/trixionary | src/model/Base/PictureQuery.php | PictureQuery.filterByPhotographerId | public function filterByPhotographerId($photographerId = null, $comparison = null)
{
if (is_array($photographerId)) {
$useMinMax = false;
if (isset($photographerId['min'])) {
$this->addUsingAlias(PictureTableMap::COL_PHOTOGRAPHER_ID, $photographerId['min'], Criteria::... | php | public function filterByPhotographerId($photographerId = null, $comparison = null)
{
if (is_array($photographerId)) {
$useMinMax = false;
if (isset($photographerId['min'])) {
$this->addUsingAlias(PictureTableMap::COL_PHOTOGRAPHER_ID, $photographerId['min'], Criteria::... | [
"public",
"function",
"filterByPhotographerId",
"(",
"$",
"photographerId",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"photographerId",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"iss... | Filter the query on the photographer_id column
Example usage:
<code>
$query->filterByPhotographerId(1234); // WHERE photographer_id = 1234
$query->filterByPhotographerId(array(12, 34)); // WHERE photographer_id IN (12, 34)
$query->filterByPhotographerId(array('min' => 12)); // WHERE photographer_id > 12
</code>
@para... | [
"Filter",
"the",
"query",
"on",
"the",
"photographer_id",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/PictureQuery.php#L532-L553 |
11,483 | gossi/trixionary | src/model/Base/PictureQuery.php | PictureQuery.filterByAthlete | public function filterByAthlete($athlete = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($athlete)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $athlete)) {
$athlete = str_replace('*', '%', $athlete);
... | php | public function filterByAthlete($athlete = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($athlete)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $athlete)) {
$athlete = str_replace('*', '%', $athlete);
... | [
"public",
"function",
"filterByAthlete",
"(",
"$",
"athlete",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"athlete",
")",
")",
"{",
"$",
"comparis... | Filter the query on the athlete column
Example usage:
<code>
$query->filterByAthlete('fooValue'); // WHERE athlete = 'fooValue'
$query->filterByAthlete('%fooValue%'); // WHERE athlete LIKE '%fooValue%'
</code>
@param string $athlete The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param ... | [
"Filter",
"the",
"query",
"on",
"the",
"athlete",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/PictureQuery.php#L570-L582 |
11,484 | Solve/Storage | ArrayStorage.php | ArrayStorage.setData | public function setData($data) {
if (!empty($data)) {
foreach($data as $key=>$value) {
$this->_data[$key] = $value;
}
} else {
$this->_data = array();
}
} | php | public function setData($data) {
if (!empty($data)) {
foreach($data as $key=>$value) {
$this->_data[$key] = $value;
}
} else {
$this->_data = array();
}
} | [
"public",
"function",
"setData",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"_data",
"[",
"$",
"key",
"... | Set data for current instance
@param $data
@return mixed | [
"Set",
"data",
"for",
"current",
"instance"
] | 37955bcc4677063b21637208884f4520e4cc7385 | https://github.com/Solve/Storage/blob/37955bcc4677063b21637208884f4520e4cc7385/ArrayStorage.php#L88-L96 |
11,485 | Solve/Storage | ArrayStorage.php | ArrayStorage.getArray | public function getArray($key = null) {
if (!is_null($key)) {
return $this->getDeepValue($key);
} else {
return $this->_data;
}
} | php | public function getArray($key = null) {
if (!is_null($key)) {
return $this->getDeepValue($key);
} else {
return $this->_data;
}
} | [
"public",
"function",
"getArray",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"key",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getDeepValue",
"(",
"$",
"key",
")",
";",
"}",
"else",
"{",
"return",
"$",
"this",
... | Return Array with all data
@param string $key
@return mixed | [
"Return",
"Array",
"with",
"all",
"data"
] | 37955bcc4677063b21637208884f4520e4cc7385 | https://github.com/Solve/Storage/blob/37955bcc4677063b21637208884f4520e4cc7385/ArrayStorage.php#L111-L117 |
11,486 | ironedgesoftware/common-utils | src/Exception/CommandException.php | CommandException.create | public static function create(
string $msg,
int $exitCode,
array $output,
string $cmd, array
$arguments = []
) : self {
$e = new self($msg, $exitCode);
$e->setOutput($output)
->setCmd($cmd)
->setArguments($arguments);
return $... | php | public static function create(
string $msg,
int $exitCode,
array $output,
string $cmd, array
$arguments = []
) : self {
$e = new self($msg, $exitCode);
$e->setOutput($output)
->setCmd($cmd)
->setArguments($arguments);
return $... | [
"public",
"static",
"function",
"create",
"(",
"string",
"$",
"msg",
",",
"int",
"$",
"exitCode",
",",
"array",
"$",
"output",
",",
"string",
"$",
"cmd",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
":",
"self",
"{",
"$",
"e",
"=",
"new",
... | Creates an instance of this exception.
@param string $msg - Message.
@param int $exitCode - Exit Code.
@param array $output - Output.
@param string $cmd - Command executed.
@param array $arguments - Command arguments.
@return self | [
"Creates",
"an",
"instance",
"of",
"this",
"exception",
"."
] | 1cbe4c77a4abeb17a45250b9b86353457ce6c2b4 | https://github.com/ironedgesoftware/common-utils/blob/1cbe4c77a4abeb17a45250b9b86353457ce6c2b4/src/Exception/CommandException.php#L125-L139 |
11,487 | Softpampa/moip-sdk-php | src/Payments/Resources/Payments.php | Payments.initialize | public function initialize()
{
parent::initialize();
$this->data->installmentCount = 1;
$this->data->fundingInstrument = new stdClass();
$this->data->fundingInstrument->method = self::METHOD_CREDIT_CARD;
} | php | public function initialize()
{
parent::initialize();
$this->data->installmentCount = 1;
$this->data->fundingInstrument = new stdClass();
$this->data->fundingInstrument->method = self::METHOD_CREDIT_CARD;
} | [
"public",
"function",
"initialize",
"(",
")",
"{",
"parent",
"::",
"initialize",
"(",
")",
";",
"$",
"this",
"->",
"data",
"->",
"installmentCount",
"=",
"1",
";",
"$",
"this",
"->",
"data",
"->",
"fundingInstrument",
"=",
"new",
"stdClass",
"(",
")",
... | Initialize a resource
@return void | [
"Initialize",
"a",
"resource"
] | 621a71bd2ef1f9b690cd3431507af608152f6ad2 | https://github.com/Softpampa/moip-sdk-php/blob/621a71bd2ef1f9b690cd3431507af608152f6ad2/src/Payments/Resources/Payments.php#L56-L63 |
11,488 | Softpampa/moip-sdk-php | src/Payments/Resources/Payments.php | Payments.execute | public function execute()
{
$this->client->setResource($this->order->getResource());
return $this->client->post('/{order_id}/payments', [$this->order->id], $this->data)->getResults();
} | php | public function execute()
{
$this->client->setResource($this->order->getResource());
return $this->client->post('/{order_id}/payments', [$this->order->id], $this->data)->getResults();
} | [
"public",
"function",
"execute",
"(",
")",
"{",
"$",
"this",
"->",
"client",
"->",
"setResource",
"(",
"$",
"this",
"->",
"order",
"->",
"getResource",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"'/{order_id}/payments'"... | Execute a payment
@return $this | [
"Execute",
"a",
"payment"
] | 621a71bd2ef1f9b690cd3431507af608152f6ad2 | https://github.com/Softpampa/moip-sdk-php/blob/621a71bd2ef1f9b690cd3431507af608152f6ad2/src/Payments/Resources/Payments.php#L81-L86 |
11,489 | Softpampa/moip-sdk-php | src/Payments/Resources/Payments.php | Payments.setCreditCard | public function setCreditCard(CreditCard $creditCard)
{
$creditCard->setContext(Moip::PAYMENT);
$this->data->fundingInstrument->method = self::METHOD_CREDIT_CARD;
$this->data->fundingInstrument->creditCard = $creditCard->getData();
//$this->setCreditCardHolder($holder);
retu... | php | public function setCreditCard(CreditCard $creditCard)
{
$creditCard->setContext(Moip::PAYMENT);
$this->data->fundingInstrument->method = self::METHOD_CREDIT_CARD;
$this->data->fundingInstrument->creditCard = $creditCard->getData();
//$this->setCreditCardHolder($holder);
retu... | [
"public",
"function",
"setCreditCard",
"(",
"CreditCard",
"$",
"creditCard",
")",
"{",
"$",
"creditCard",
"->",
"setContext",
"(",
"Moip",
"::",
"PAYMENT",
")",
";",
"$",
"this",
"->",
"data",
"->",
"fundingInstrument",
"->",
"method",
"=",
"self",
"::",
"... | Set a credit card
@param \Softpampa\Moip\Helpers\CreditCard $creditCard
@return $this | [
"Set",
"a",
"credit",
"card"
] | 621a71bd2ef1f9b690cd3431507af608152f6ad2 | https://github.com/Softpampa/moip-sdk-php/blob/621a71bd2ef1f9b690cd3431507af608152f6ad2/src/Payments/Resources/Payments.php#L114-L122 |
11,490 | Softpampa/moip-sdk-php | src/Payments/Resources/Payments.php | Payments.setCreditCardHash | public function setCreditCardHash($hash, Customers $holder)
{
$this->data->fundingInstrument->method = self::METHOD_CREDIT_CARD;
$this->data->fundingInstrument->creditCard = new stdClass();
$this->data->fundingInstrument->creditCard->hash = $hash;
$this->setCreditCardHolder($holder);... | php | public function setCreditCardHash($hash, Customers $holder)
{
$this->data->fundingInstrument->method = self::METHOD_CREDIT_CARD;
$this->data->fundingInstrument->creditCard = new stdClass();
$this->data->fundingInstrument->creditCard->hash = $hash;
$this->setCreditCardHolder($holder);... | [
"public",
"function",
"setCreditCardHash",
"(",
"$",
"hash",
",",
"Customers",
"$",
"holder",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"fundingInstrument",
"->",
"method",
"=",
"self",
"::",
"METHOD_CREDIT_CARD",
";",
"$",
"this",
"->",
"data",
"->",
"fu... | Set credit card hash.
@param string $hash
@param \Softpampa\Moip\Payments\Resources\Customers $holder
@return $this | [
"Set",
"credit",
"card",
"hash",
"."
] | 621a71bd2ef1f9b690cd3431507af608152f6ad2 | https://github.com/Softpampa/moip-sdk-php/blob/621a71bd2ef1f9b690cd3431507af608152f6ad2/src/Payments/Resources/Payments.php#L152-L160 |
11,491 | Softpampa/moip-sdk-php | src/Payments/Resources/Payments.php | Payments.setBoleto | public function setBoleto(Boleto $boleto)
{
$boleto->setContext(Moip::PAYMENT);
$this->data->fundingInstrument->method = self::METHOD_BOLETO;
$this->data->fundingInstrument->boleto = $boleto->getData();
return $this;
} | php | public function setBoleto(Boleto $boleto)
{
$boleto->setContext(Moip::PAYMENT);
$this->data->fundingInstrument->method = self::METHOD_BOLETO;
$this->data->fundingInstrument->boleto = $boleto->getData();
return $this;
} | [
"public",
"function",
"setBoleto",
"(",
"Boleto",
"$",
"boleto",
")",
"{",
"$",
"boleto",
"->",
"setContext",
"(",
"Moip",
"::",
"PAYMENT",
")",
";",
"$",
"this",
"->",
"data",
"->",
"fundingInstrument",
"->",
"method",
"=",
"self",
"::",
"METHOD_BOLETO",
... | Set boleto payment method
@param \Softpampa\Moip\Helpers\Boleto $boleto
@return $this | [
"Set",
"boleto",
"payment",
"method"
] | 621a71bd2ef1f9b690cd3431507af608152f6ad2 | https://github.com/Softpampa/moip-sdk-php/blob/621a71bd2ef1f9b690cd3431507af608152f6ad2/src/Payments/Resources/Payments.php#L168-L175 |
11,492 | bishopb/vanilla | applications/dashboard/controllers/class.authenticationcontroller.php | AuthenticationController.Initialize | public function Initialize() {
parent::Initialize();
Gdn_Theme::Section('Dashboard');
if ($this->Menu)
$this->Menu->HighlightRoute('/dashboard/authentication');
$this->EnableSlicing($this);
$Authenticators = Gdn::Authenticator()->GetAvailable();
$this->Choos... | php | public function Initialize() {
parent::Initialize();
Gdn_Theme::Section('Dashboard');
if ($this->Menu)
$this->Menu->HighlightRoute('/dashboard/authentication');
$this->EnableSlicing($this);
$Authenticators = Gdn::Authenticator()->GetAvailable();
$this->Choos... | [
"public",
"function",
"Initialize",
"(",
")",
"{",
"parent",
"::",
"Initialize",
"(",
")",
";",
"Gdn_Theme",
"::",
"Section",
"(",
"'Dashboard'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"Menu",
")",
"$",
"this",
"->",
"Menu",
"->",
"HighlightRoute",
"(... | Highlight route and do authenticator setup.
Always called by dispatcher before controller's requested method.
@since 2.0.3
@access public | [
"Highlight",
"route",
"and",
"do",
"authenticator",
"setup",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.authenticationcontroller.php#L54-L72 |
11,493 | bishopb/vanilla | applications/dashboard/controllers/class.authenticationcontroller.php | AuthenticationController.Choose | public function Choose($AuthenticationSchemeAlias = NULL) {
$this->Permission('Garden.Settings.Manage');
$this->AddSideMenu('dashboard/authentication');
$this->Title(T('Authentication'));
$this->AddCssFile('authentication.css');
$PreFocusAuthenticationScheme = NULL;
if (!is_nu... | php | public function Choose($AuthenticationSchemeAlias = NULL) {
$this->Permission('Garden.Settings.Manage');
$this->AddSideMenu('dashboard/authentication');
$this->Title(T('Authentication'));
$this->AddCssFile('authentication.css');
$PreFocusAuthenticationScheme = NULL;
if (!is_nu... | [
"public",
"function",
"Choose",
"(",
"$",
"AuthenticationSchemeAlias",
"=",
"NULL",
")",
"{",
"$",
"this",
"->",
"Permission",
"(",
"'Garden.Settings.Manage'",
")",
";",
"$",
"this",
"->",
"AddSideMenu",
"(",
"'dashboard/authentication'",
")",
";",
"$",
"this",
... | Select Authentication method.
@since 2.0.3
@access public
@param string $AuthenticationSchemeAlias | [
"Select",
"Authentication",
"method",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.authenticationcontroller.php#L95-L127 |
11,494 | bishopb/vanilla | applications/dashboard/controllers/class.authenticationcontroller.php | AuthenticationController.Configure | public function Configure($AuthenticationSchemeAlias = NULL) {
$Message = T("Please choose an authenticator to configure.");
if (!is_null($AuthenticationSchemeAlias)) {
$AuthenticatorInfo = Gdn::Authenticator()->GetAuthenticatorInfo($AuthenticationSchemeAlias);
if ($AuthenticatorInfo !== F... | php | public function Configure($AuthenticationSchemeAlias = NULL) {
$Message = T("Please choose an authenticator to configure.");
if (!is_null($AuthenticationSchemeAlias)) {
$AuthenticatorInfo = Gdn::Authenticator()->GetAuthenticatorInfo($AuthenticationSchemeAlias);
if ($AuthenticatorInfo !== F... | [
"public",
"function",
"Configure",
"(",
"$",
"AuthenticationSchemeAlias",
"=",
"NULL",
")",
"{",
"$",
"Message",
"=",
"T",
"(",
"\"Please choose an authenticator to configure.\"",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"AuthenticationSchemeAlias",
")",
")"... | Configure authentication method.
@since 2.0.3
@access public
@param string $AuthenticationSchemeAlias | [
"Configure",
"authentication",
"method",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.authenticationcontroller.php#L137-L153 |
11,495 | flextype-components/number | Number.php | Number.byteFormat | public static function byteFormat(int $bytes = 0, int $decimals = 0)
{
$quant = [
'TB' => 1099511627776, // pow( 1024, 4)
'GB' => 1073741824, // pow( 1024, 3)
'MB' => 1048576, // pow( 1024, 2)
'KB' => 1024, // pow( 1024, 1)
'B... | php | public static function byteFormat(int $bytes = 0, int $decimals = 0)
{
$quant = [
'TB' => 1099511627776, // pow( 1024, 4)
'GB' => 1073741824, // pow( 1024, 3)
'MB' => 1048576, // pow( 1024, 2)
'KB' => 1024, // pow( 1024, 1)
'B... | [
"public",
"static",
"function",
"byteFormat",
"(",
"int",
"$",
"bytes",
"=",
"0",
",",
"int",
"$",
"decimals",
"=",
"0",
")",
"{",
"$",
"quant",
"=",
"[",
"'TB'",
"=>",
"1099511627776",
",",
"// pow( 1024, 4)",
"'GB'",
"=>",
"1073741824",
",",
"// pow( 1... | Converts a number of bytes to a human readable number by taking the
number of that unit that the bytes will go into it.
echo Num::format_bytes('204800'); // 200 kB
echo Num::format_bytes('214901', 1); // 209.9 kB
echo Num::format_bytes('2249010', 1); // 2.1 MB
echo Num::format_bytes('badbyteshere'); // false
@pa... | [
"Converts",
"a",
"number",
"of",
"bytes",
"to",
"a",
"human",
"readable",
"number",
"by",
"taking",
"the",
"number",
"of",
"that",
"unit",
"that",
"the",
"bytes",
"will",
"go",
"into",
"it",
"."
] | a6f28a4506325eadb52a93eacd0c746866055e81 | https://github.com/flextype-components/number/blob/a6f28a4506325eadb52a93eacd0c746866055e81/Number.php#L80-L97 |
11,496 | flextype-components/number | Number.php | Number.convertToBytes | public static function convertToBytes(string $size = null) : float
{
// Prepare the size
$size = trim((string) $size);
// Construct an OR list of byte units for the regex
$accepted = implode('|', array_keys(Number::$byte_units));
// Construct the regex pattern for verifying... | php | public static function convertToBytes(string $size = null) : float
{
// Prepare the size
$size = trim((string) $size);
// Construct an OR list of byte units for the regex
$accepted = implode('|', array_keys(Number::$byte_units));
// Construct the regex pattern for verifying... | [
"public",
"static",
"function",
"convertToBytes",
"(",
"string",
"$",
"size",
"=",
"null",
")",
":",
"float",
"{",
"// Prepare the size",
"$",
"size",
"=",
"trim",
"(",
"(",
"string",
")",
"$",
"size",
")",
";",
"// Construct an OR list of byte units for the reg... | Converts a file size number to a byte value.
echo Number::convertToBytes('200K'); // 204800
echo Number::convertToBytes('5MiB'); // 5242880
echo Number::convertToBytes('2.5GB'); // 2684354560
@param string $size file size in SB format
@return float | [
"Converts",
"a",
"file",
"size",
"number",
"to",
"a",
"byte",
"value",
"."
] | a6f28a4506325eadb52a93eacd0c746866055e81 | https://github.com/flextype-components/number/blob/a6f28a4506325eadb52a93eacd0c746866055e81/Number.php#L109-L135 |
11,497 | rseyferth/activerecord | lib/CallBack.php | CallBack.getCallbacks | public function getCallbacks($name)
{
return isset($this->registry[$name]) ? $this->registry[$name] : null;
} | php | public function getCallbacks($name)
{
return isset($this->registry[$name]) ? $this->registry[$name] : null;
} | [
"public",
"function",
"getCallbacks",
"(",
"$",
"name",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"registry",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->",
"registry",
"[",
"$",
"name",
"]",
":",
"null",
";",
"}"
] | Returns all the callbacks registered for a callback type.
@param string Name of a callback (see $validCallbacks)
@return array Array of callbacks or null if invalid callback name. | [
"Returns",
"all",
"the",
"callbacks",
"registered",
"for",
"a",
"callback",
"type",
"."
] | 0e7b1cbddd6f967c3a09adf38753babd5f698e39 | https://github.com/rseyferth/activerecord/blob/0e7b1cbddd6f967c3a09adf38753babd5f698e39/lib/CallBack.php#L147-L150 |
11,498 | rseyferth/activerecord | lib/CallBack.php | CallBack.invoke | public function invoke($model, $name, $mustExist=true)
{
// Check if callback exists
if ($mustExist && !array_key_exists($name, $this->registry)) {
throw new ActiveRecordException("No callbacks were defined for: $name on " . get_class($model));
}
// if it doesn't exist it might be a /(after|before)_(creat... | php | public function invoke($model, $name, $mustExist=true)
{
// Check if callback exists
if ($mustExist && !array_key_exists($name, $this->registry)) {
throw new ActiveRecordException("No callbacks were defined for: $name on " . get_class($model));
}
// if it doesn't exist it might be a /(after|before)_(creat... | [
"public",
"function",
"invoke",
"(",
"$",
"model",
",",
"$",
"name",
",",
"$",
"mustExist",
"=",
"true",
")",
"{",
"// Check if callback exists",
"if",
"(",
"$",
"mustExist",
"&&",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"regis... | Invokes a callback.
@internal This is the only piece of the CallBack class that carries its own logic for the
model object. For (after|before)_(create|update) callbacks, it will merge with
a generic 'save' callback which is called first for the lease amount of precision.
@param string Model to invoke the callback on... | [
"Invokes",
"a",
"callback",
"."
] | 0e7b1cbddd6f967c3a09adf38753babd5f698e39 | https://github.com/rseyferth/activerecord/blob/0e7b1cbddd6f967c3a09adf38753babd5f698e39/lib/CallBack.php#L166-L209 |
11,499 | rseyferth/activerecord | lib/CallBack.php | CallBack.register | public function register($name, $closure = null, $options = array())
{
// Set default options
$options = array_merge(array(
'prepend' => false)
, $options);
// No method given?
if (!$closure) {
// Use the name instead
$closure = $name;
}
// Not valid?
if (!in_array($name,self::$validCallba... | php | public function register($name, $closure = null, $options = array())
{
// Set default options
$options = array_merge(array(
'prepend' => false)
, $options);
// No method given?
if (!$closure) {
// Use the name instead
$closure = $name;
}
// Not valid?
if (!in_array($name,self::$validCallba... | [
"public",
"function",
"register",
"(",
"$",
"name",
",",
"$",
"closure",
"=",
"null",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"// Set default options",
"$",
"options",
"=",
"array_merge",
"(",
"array",
"(",
"'prepend'",
"=>",
"false",
")",... | Register a new callback.
The option array can contain the following parameters:
<ul>
<li><b>prepend:</b> Add this callback at the beginning of the existing callbacks (true) or at the end (false, default)</li>
</ul>
@param string Name of callback type (see $validCallbacks)
@param mixed Either a closure or the name... | [
"Register",
"a",
"new",
"callback",
"."
] | 0e7b1cbddd6f967c3a09adf38753babd5f698e39 | https://github.com/rseyferth/activerecord/blob/0e7b1cbddd6f967c3a09adf38753babd5f698e39/lib/CallBack.php#L225-L283 |
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.