repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/TagsFilterer.php | TagsFilterer.filter | public function filter()
{
$count = 0;
$tags = $this->getParameter('Tags');
if($tags === null)
$tags = $this->getLocal('LinkTags');
$maxRows = $this->getParameter('MaxRows');
$partial = $this->getParameter('Partial');
$partials = array();
if(!... | php | public function filter()
{
$count = 0;
$tags = $this->getParameter('Tags');
if($tags === null)
$tags = $this->getLocal('LinkTags');
$maxRows = $this->getParameter('MaxRows');
$partial = $this->getParameter('Partial');
$partials = array();
if(!... | [
"public",
"function",
"filter",
"(",
")",
"{",
"$",
"count",
"=",
"0",
";",
"$",
"tags",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"'Tags'",
")",
";",
"if",
"(",
"$",
"tags",
"===",
"null",
")",
"$",
"tags",
"=",
"$",
"this",
"->",
"getLocal",... | Returns a subset of tags filtered according to the params passed.
Expected Params:
Tags array An Array of tags that we want to filter
Partial string (optional) A CSV string of types that we want
FilterElement string (required only with FilterType. Optional otherwise) The tag element t... | [
"Returns",
"a",
"subset",
"of",
"tags",
"filtered",
"according",
"to",
"the",
"params",
"passed",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/TagsFilterer.php#L100-L162 | train |
Dhii/config | src/ReplaceReferencesCapableTrait.php | ReplaceReferencesCapableTrait._replaceReferences | protected function _replaceReferences($input, ContainerInterface $container, $default = null, $startDelimiter = '${', $endDelimiter = '}')
{
$regexpDelimiter = '/';
$input = $this->_normalizeString($input);
$defaultValue = $default === null ? '' : $this->_normalizeString($defaul... | php | protected function _replaceReferences($input, ContainerInterface $container, $default = null, $startDelimiter = '${', $endDelimiter = '}')
{
$regexpDelimiter = '/';
$input = $this->_normalizeString($input);
$defaultValue = $default === null ? '' : $this->_normalizeString($defaul... | [
"protected",
"function",
"_replaceReferences",
"(",
"$",
"input",
",",
"ContainerInterface",
"$",
"container",
",",
"$",
"default",
"=",
"null",
",",
"$",
"startDelimiter",
"=",
"'${'",
",",
"$",
"endDelimiter",
"=",
"'}'",
")",
"{",
"$",
"regexpDelimiter",
... | Replaces all tokens wrapped with some delimiters in a string with corresponding values retrieved from a container.
@since [*next-version*]
@param string|Stringable $input Input string to find and replace references
@param ContainerInterface $container Container to retrieve values for replace.
@param st... | [
"Replaces",
"all",
"tokens",
"wrapped",
"with",
"some",
"delimiters",
"in",
"a",
"string",
"with",
"corresponding",
"values",
"retrieved",
"from",
"a",
"container",
"."
] | 1ab9a7ccf9c0ebd7c6fcbce600b4c00b52b2fdcf | https://github.com/Dhii/config/blob/1ab9a7ccf9c0ebd7c6fcbce600b4c00b52b2fdcf/src/ReplaceReferencesCapableTrait.php#L35-L59 | train |
carno-php/http | src/Client/Responding.php | Responding.data | public function data() : string
{
$code = $this->response->getStatusCode();
if ($code >= 400 && $code < 600) {
throw new ErrorResponseException($this->response->getReasonPhrase(), $code);
}
return $this->payload();
} | php | public function data() : string
{
$code = $this->response->getStatusCode();
if ($code >= 400 && $code < 600) {
throw new ErrorResponseException($this->response->getReasonPhrase(), $code);
}
return $this->payload();
} | [
"public",
"function",
"data",
"(",
")",
":",
"string",
"{",
"$",
"code",
"=",
"$",
"this",
"->",
"response",
"->",
"getStatusCode",
"(",
")",
";",
"if",
"(",
"$",
"code",
">=",
"400",
"&&",
"$",
"code",
"<",
"600",
")",
"{",
"throw",
"new",
"Erro... | parsed data with status checking
@return string
@throws ErrorResponseException | [
"parsed",
"data",
"with",
"status",
"checking"
] | 0a873d1feb9ae6ec50e84e03f2075ac87997aa44 | https://github.com/carno-php/http/blob/0a873d1feb9ae6ec50e84e03f2075ac87997aa44/src/Client/Responding.php#L69-L78 | train |
arrounded/core | src/ParameterBag.php | ParameterBag.only | public function only($keys)
{
$keys = is_array($keys) ? $keys : func_get_args();
return array_only($this->parameters, $keys);
} | php | public function only($keys)
{
$keys = is_array($keys) ? $keys : func_get_args();
return array_only($this->parameters, $keys);
} | [
"public",
"function",
"only",
"(",
"$",
"keys",
")",
"{",
"$",
"keys",
"=",
"is_array",
"(",
"$",
"keys",
")",
"?",
"$",
"keys",
":",
"func_get_args",
"(",
")",
";",
"return",
"array_only",
"(",
"$",
"this",
"->",
"parameters",
",",
"$",
"keys",
")... | Get only certain attributes.
@param string[]|string $keys,...
@return array | [
"Get",
"only",
"certain",
"attributes",
"."
] | 9573d9ae63f5173bdfd51077ce065e9e8c176ac4 | https://github.com/arrounded/core/blob/9573d9ae63f5173bdfd51077ce065e9e8c176ac4/src/ParameterBag.php#L23-L28 | train |
dms-org/common.structure | src/Colour/ColourStringParser.php | ColourStringParser.parseRgbString | public static function parseRgbString(string $string) : array
{
if (!preg_match(self::REGEX_RGB, $string, $matches)) {
throw InvalidArgumentException::format(
'Invalid rgb string passed to %s: expecting format "rgb(0-255, 0-255, 0-255)", "%s" given',
__MET... | php | public static function parseRgbString(string $string) : array
{
if (!preg_match(self::REGEX_RGB, $string, $matches)) {
throw InvalidArgumentException::format(
'Invalid rgb string passed to %s: expecting format "rgb(0-255, 0-255, 0-255)", "%s" given',
__MET... | [
"public",
"static",
"function",
"parseRgbString",
"(",
"string",
"$",
"string",
")",
":",
"array",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"self",
"::",
"REGEX_RGB",
",",
"$",
"string",
",",
"$",
"matches",
")",
")",
"{",
"throw",
"InvalidArgumentException... | Parses the supplied rgb string into an array of channels.
@param string $string eg: "rgb(100, 100, 100)"
@return int[] eg: [100, 100, 100]
@throws InvalidArgumentException | [
"Parses",
"the",
"supplied",
"rgb",
"string",
"into",
"an",
"array",
"of",
"channels",
"."
] | 23f122182f60df5ec847047a81a39c8aab019ff1 | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/Colour/ColourStringParser.php#L26-L36 | train |
dms-org/common.structure | src/Colour/ColourStringParser.php | ColourStringParser.parseHexString | public static function parseHexString(string $string) : array
{
if (!preg_match(self::REGEX_HEX, $string, $matches)) {
throw InvalidArgumentException::format(
'Invalid rgba string passed to %s: expecting format "#...", "%s" given',
__METHOD__, $string
... | php | public static function parseHexString(string $string) : array
{
if (!preg_match(self::REGEX_HEX, $string, $matches)) {
throw InvalidArgumentException::format(
'Invalid rgba string passed to %s: expecting format "#...", "%s" given',
__METHOD__, $string
... | [
"public",
"static",
"function",
"parseHexString",
"(",
"string",
"$",
"string",
")",
":",
"array",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"self",
"::",
"REGEX_HEX",
",",
"$",
"string",
",",
"$",
"matches",
")",
")",
"{",
"throw",
"InvalidArgumentException... | Parses the supplied hex string into an array of channels.
@param string $string
@return \int[] eg: [100, 100, 100]
@throws InvalidArgumentException | [
"Parses",
"the",
"supplied",
"hex",
"string",
"into",
"an",
"array",
"of",
"channels",
"."
] | 23f122182f60df5ec847047a81a39c8aab019ff1 | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/Colour/ColourStringParser.php#L46-L68 | train |
dms-org/common.structure | src/Colour/ColourStringParser.php | ColourStringParser.parseRgbaString | public static function parseRgbaString(string $string) : array
{
if (!preg_match(self::REGEX_RGBA, $string, $matches)) {
throw InvalidArgumentException::format(
'Invalid rgba string passed to %s: expecting format "rgb(0-255, 0-255, 0-255, 0-1)", "%s" given',
... | php | public static function parseRgbaString(string $string) : array
{
if (!preg_match(self::REGEX_RGBA, $string, $matches)) {
throw InvalidArgumentException::format(
'Invalid rgba string passed to %s: expecting format "rgb(0-255, 0-255, 0-255, 0-1)", "%s" given',
... | [
"public",
"static",
"function",
"parseRgbaString",
"(",
"string",
"$",
"string",
")",
":",
"array",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"self",
"::",
"REGEX_RGBA",
",",
"$",
"string",
",",
"$",
"matches",
")",
")",
"{",
"throw",
"InvalidArgumentExcepti... | Parses the supplied rgba string into an array of channels.
@param string $string eg: "rgba(100, 100, 100, 0.5)"
@return int[] eg: [100, 100, 100, 0.5]
@throws InvalidArgumentException | [
"Parses",
"the",
"supplied",
"rgba",
"string",
"into",
"an",
"array",
"of",
"channels",
"."
] | 23f122182f60df5ec847047a81a39c8aab019ff1 | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/Colour/ColourStringParser.php#L78-L88 | train |
eventerza/module-core | src/App.php | App.loadModules | private function loadModules()
{
/** @var ModuleRepository $repo */
$repo = $this->getContainer()->get('module_repository');
/** @var Module $module */
foreach ($repo->getAll() as $module) {
$moduleClass = $module->getClass();
new $moduleClass($this);
... | php | private function loadModules()
{
/** @var ModuleRepository $repo */
$repo = $this->getContainer()->get('module_repository');
/** @var Module $module */
foreach ($repo->getAll() as $module) {
$moduleClass = $module->getClass();
new $moduleClass($this);
... | [
"private",
"function",
"loadModules",
"(",
")",
"{",
"/** @var ModuleRepository $repo */",
"$",
"repo",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'module_repository'",
")",
";",
"/** @var Module $module */",
"foreach",
"(",
"$",
"repo",
... | add modules to App | [
"add",
"modules",
"to",
"App"
] | 9be33859d352c2943991e5fa0eeaed92585da22f | https://github.com/eventerza/module-core/blob/9be33859d352c2943991e5fa0eeaed92585da22f/src/App.php#L56-L66 | train |
eventerza/module-core | src/App.php | App.configureDI | private function configureDI()
{
/** @var \DI\Container $container */
$container = $this->getContainer();
$this->add(new NotificationMiddleware($container));
$this->add(new OldInputDataMiddleware($container));
// Random Number Generator
$container->set(Generator::cl... | php | private function configureDI()
{
/** @var \DI\Container $container */
$container = $this->getContainer();
$this->add(new NotificationMiddleware($container));
$this->add(new OldInputDataMiddleware($container));
// Random Number Generator
$container->set(Generator::cl... | [
"private",
"function",
"configureDI",
"(",
")",
"{",
"/** @var \\DI\\Container $container */",
"$",
"container",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
";",
"$",
"this",
"->",
"add",
"(",
"new",
"NotificationMiddleware",
"(",
"$",
"container",
")",
... | Configure the dependency injection container | [
"Configure",
"the",
"dependency",
"injection",
"container"
] | 9be33859d352c2943991e5fa0eeaed92585da22f | https://github.com/eventerza/module-core/blob/9be33859d352c2943991e5fa0eeaed92585da22f/src/App.php#L71-L116 | train |
ZFrapid/zfrapid-library | src/View/LayoutListener.php | LayoutListener.renderLayoutSegments | public function renderLayoutSegments(MvcEvent $e)
{
/* @var $viewModel ViewModel */
$viewModel = $e->getViewModel();
// skip if current ViewModel is of expected type
if ('Zend\View\Model\ViewModel' != get_class($viewModel)) {
return;
}
/** @var Aggregate... | php | public function renderLayoutSegments(MvcEvent $e)
{
/* @var $viewModel ViewModel */
$viewModel = $e->getViewModel();
// skip if current ViewModel is of expected type
if ('Zend\View\Model\ViewModel' != get_class($viewModel)) {
return;
}
/** @var Aggregate... | [
"public",
"function",
"renderLayoutSegments",
"(",
"MvcEvent",
"$",
"e",
")",
"{",
"/* @var $viewModel ViewModel */",
"$",
"viewModel",
"=",
"$",
"e",
"->",
"getViewModel",
"(",
")",
";",
"// skip if current ViewModel is of expected type",
"if",
"(",
"'Zend\\View\\Model... | Listen to the "render" event and render additional layout segments
@param MvcEvent $e
@return null | [
"Listen",
"to",
"the",
"render",
"event",
"and",
"render",
"additional",
"layout",
"segments"
] | 3eca4f465dd1f2dee889532892c5052e830bc03c | https://github.com/ZFrapid/zfrapid-library/blob/3eca4f465dd1f2dee889532892c5052e830bc03c/src/View/LayoutListener.php#L62-L90 | train |
anime-db/ani-db-filler-bundle | src/Controller/MediaController.php | MediaController.coverAction | public function coverAction($id, Request $request)
{
$body = $this->getAnime($id);
/* @var $response Response */
$response = $this->get('cache_time_keeper')->getResponse([], self::CACHE_LIFETIME)
->setEtag(sha1($body->html()));
$response->headers->set('Content-Type', 'ima... | php | public function coverAction($id, Request $request)
{
$body = $this->getAnime($id);
/* @var $response Response */
$response = $this->get('cache_time_keeper')->getResponse([], self::CACHE_LIFETIME)
->setEtag(sha1($body->html()));
$response->headers->set('Content-Type', 'ima... | [
"public",
"function",
"coverAction",
"(",
"$",
"id",
",",
"Request",
"$",
"request",
")",
"{",
"$",
"body",
"=",
"$",
"this",
"->",
"getAnime",
"(",
"$",
"id",
")",
";",
"/* @var $response Response */",
"$",
"response",
"=",
"$",
"this",
"->",
"get",
"... | Get cover from anidb.net item id.
@param string $id
@param Request $request
@return Response | [
"Get",
"cover",
"from",
"anidb",
".",
"net",
"item",
"id",
"."
] | 7581beda0cd46b11867a703ca429147f0c5b5b46 | https://github.com/anime-db/ani-db-filler-bundle/blob/7581beda0cd46b11867a703ca429147f0c5b5b46/src/Controller/MediaController.php#L32-L57 | train |
agentmedia/phine-core | src/Core/Logic/Tree/AreaListProvider.php | AreaListProvider.TopMost | public function TopMost()
{
$sql = Access::SqlBuilder();
$tblArea = Area::Schema()->Table();
$where = $sql->Equals($tblArea->Field('Layout'), $sql->Value($this->layout->GetID()))
->And_($sql->IsNull($tblArea->Field('Previous')));
return Area::Schema()->First(... | php | public function TopMost()
{
$sql = Access::SqlBuilder();
$tblArea = Area::Schema()->Table();
$where = $sql->Equals($tblArea->Field('Layout'), $sql->Value($this->layout->GetID()))
->And_($sql->IsNull($tblArea->Field('Previous')));
return Area::Schema()->First(... | [
"public",
"function",
"TopMost",
"(",
")",
"{",
"$",
"sql",
"=",
"Access",
"::",
"SqlBuilder",
"(",
")",
";",
"$",
"tblArea",
"=",
"Area",
"::",
"Schema",
"(",
")",
"->",
"Table",
"(",
")",
";",
"$",
"where",
"=",
"$",
"sql",
"->",
"Equals",
"(",... | Returns the top most area
@return Area | [
"Returns",
"the",
"top",
"most",
"area"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Tree/AreaListProvider.php#L68-L76 | train |
Wedeto/Util | src/Cache/Cache.php | Cache.set | public function set($key, $val)
{
parent::set(func_get_args(), null);
$this->values['_changed'] = true;
return $this;
} | php | public function set($key, $val)
{
parent::set(func_get_args(), null);
$this->values['_changed'] = true;
return $this;
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"val",
")",
"{",
"parent",
"::",
"set",
"(",
"func_get_args",
"(",
")",
",",
"null",
")",
";",
"$",
"this",
"->",
"values",
"[",
"'_changed'",
"]",
"=",
"true",
";",
"return",
"$",
"this",
"... | Set a value in the cache
@param $key scalar The key under which to store. Can be repeated to go deeper.
@param $val mixed The value to store. Should be PHP-serializable. If
this is null, the entry will be removed from the cache
@return Cache Provides fluent interface | [
"Set",
"a",
"value",
"in",
"the",
"cache"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/Cache/Cache.php#L81-L86 | train |
Wedeto/Util | src/Cache/Cache.php | Cache.clear | public function clear()
{
$expiry = $this->values['_expiry'] ?? null;
parent::clear();
$this->set('_changed', true);
$this->set('_timestamp', time());
if ($expiry)
$this->setExpiry($expiry);
return $this;
} | php | public function clear()
{
$expiry = $this->values['_expiry'] ?? null;
parent::clear();
$this->set('_changed', true);
$this->set('_timestamp', time());
if ($expiry)
$this->setExpiry($expiry);
return $this;
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"$",
"expiry",
"=",
"$",
"this",
"->",
"values",
"[",
"'_expiry'",
"]",
"??",
"null",
";",
"parent",
"::",
"clear",
"(",
")",
";",
"$",
"this",
"->",
"set",
"(",
"'_changed'",
",",
"true",
")",
";",
"... | Remove all contents from the cache
@return Cache Provides fluent interface | [
"Remove",
"all",
"contents",
"from",
"the",
"cache"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/Cache/Cache.php#L118-L127 | train |
Wedeto/DB | src/Query/OffsetClause.php | OffsetClause.toSQL | public function toSQL(Parameters $params, bool $inner_clause)
{
return "OFFSET " . $params->getDriver()->toSQL($params, $this->getOffset());
} | php | public function toSQL(Parameters $params, bool $inner_clause)
{
return "OFFSET " . $params->getDriver()->toSQL($params, $this->getOffset());
} | [
"public",
"function",
"toSQL",
"(",
"Parameters",
"$",
"params",
",",
"bool",
"$",
"inner_clause",
")",
"{",
"return",
"\"OFFSET \"",
".",
"$",
"params",
"->",
"getDriver",
"(",
")",
"->",
"toSQL",
"(",
"$",
"params",
",",
"$",
"this",
"->",
"getOffset",... | Write a OFFSET clause to SQL query syntax
@param Parameters $params The query parameters: tables and placeholder values
@return string The generated SQL | [
"Write",
"a",
"OFFSET",
"clause",
"to",
"SQL",
"query",
"syntax"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/OffsetClause.php#L59-L62 | train |
bandama-framework/bandama-framework | src/App.php | App.getInstance | public static function getInstance($configFile = null, $mode = self::APP_MODE_PROD) {
$c = get_called_class();
if (!isset(self::$_instances[$c])) {
// Create an instance
self::$_instances[$c] = new $c($configFile, $mode);
// Setup application
self::$_insta... | php | public static function getInstance($configFile = null, $mode = self::APP_MODE_PROD) {
$c = get_called_class();
if (!isset(self::$_instances[$c])) {
// Create an instance
self::$_instances[$c] = new $c($configFile, $mode);
// Setup application
self::$_insta... | [
"public",
"static",
"function",
"getInstance",
"(",
"$",
"configFile",
"=",
"null",
",",
"$",
"mode",
"=",
"self",
"::",
"APP_MODE_PROD",
")",
"{",
"$",
"c",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"_i... | Initialize and return App uniq instance
@param array $configFile Application configuration file
@return App | [
"Initialize",
"and",
"return",
"App",
"uniq",
"instance"
] | 234ed703baf9e31268941c9d5f6d5e004cc53066 | https://github.com/bandama-framework/bandama-framework/blob/234ed703baf9e31268941c9d5f6d5e004cc53066/src/App.php#L119-L129 | train |
bandama-framework/bandama-framework | src/App.php | App.run | public function run() {
// Start session
$session = $this->get('session');
$session->start();
// Route the request
$uri = '';
if (strcmp($this->mode, self::APP_MODE_DEV) == 0) {
$uri = $_SERVER['REQUEST_URI'];
} else {
$uri = $_GET['url'];... | php | public function run() {
// Start session
$session = $this->get('session');
$session->start();
// Route the request
$uri = '';
if (strcmp($this->mode, self::APP_MODE_DEV) == 0) {
$uri = $_SERVER['REQUEST_URI'];
} else {
$uri = $_GET['url'];... | [
"public",
"function",
"run",
"(",
")",
"{",
"// Start session",
"$",
"session",
"=",
"$",
"this",
"->",
"get",
"(",
"'session'",
")",
";",
"$",
"session",
"->",
"start",
"(",
")",
";",
"// Route the request",
"$",
"uri",
"=",
"''",
";",
"if",
"(",
"s... | Run Bandama application
@return mixed | [
"Run",
"Bandama",
"application"
] | 234ed703baf9e31268941c9d5f6d5e004cc53066 | https://github.com/bandama-framework/bandama-framework/blob/234ed703baf9e31268941c9d5f6d5e004cc53066/src/App.php#L136-L156 | train |
bandama-framework/bandama-framework | src/App.php | App.addService | public function addService($key, $callable) {
$instance = Container::newInstance($callable);
$this->container->set($key, function() use ($instance) {
return $instance;
});
} | php | public function addService($key, $callable) {
$instance = Container::newInstance($callable);
$this->container->set($key, function() use ($instance) {
return $instance;
});
} | [
"public",
"function",
"addService",
"(",
"$",
"key",
",",
"$",
"callable",
")",
"{",
"$",
"instance",
"=",
"Container",
"::",
"newInstance",
"(",
"$",
"callable",
")",
";",
"$",
"this",
"->",
"container",
"->",
"set",
"(",
"$",
"key",
",",
"function",
... | Add an instance of class in container with custom key
@return void | [
"Add",
"an",
"instance",
"of",
"class",
"in",
"container",
"with",
"custom",
"key"
] | 234ed703baf9e31268941c9d5f6d5e004cc53066 | https://github.com/bandama-framework/bandama-framework/blob/234ed703baf9e31268941c9d5f6d5e004cc53066/src/App.php#L174-L179 | train |
bandama-framework/bandama-framework | src/App.php | App.registerConfig | protected function registerConfig() {
$config = new Configuration($this->configFile);
$this->container->set('config', function() use ($config) {
return $config;
});
} | php | protected function registerConfig() {
$config = new Configuration($this->configFile);
$this->container->set('config', function() use ($config) {
return $config;
});
} | [
"protected",
"function",
"registerConfig",
"(",
")",
"{",
"$",
"config",
"=",
"new",
"Configuration",
"(",
"$",
"this",
"->",
"configFile",
")",
";",
"$",
"this",
"->",
"container",
"->",
"set",
"(",
"'config'",
",",
"function",
"(",
")",
"use",
"(",
"... | Create and add config in container
@return void | [
"Create",
"and",
"add",
"config",
"in",
"container"
] | 234ed703baf9e31268941c9d5f6d5e004cc53066 | https://github.com/bandama-framework/bandama-framework/blob/234ed703baf9e31268941c9d5f6d5e004cc53066/src/App.php#L219-L224 | train |
bandama-framework/bandama-framework | src/App.php | App.registerFlash | protected function registerFlash() {
$container = $this->container;
$this->container->set('flash', function() use ($container) {
return new Flash($container->get('session'));
});
} | php | protected function registerFlash() {
$container = $this->container;
$this->container->set('flash', function() use ($container) {
return new Flash($container->get('session'));
});
} | [
"protected",
"function",
"registerFlash",
"(",
")",
"{",
"$",
"container",
"=",
"$",
"this",
"->",
"container",
";",
"$",
"this",
"->",
"container",
"->",
"set",
"(",
"'flash'",
",",
"function",
"(",
")",
"use",
"(",
"$",
"container",
")",
"{",
"return... | Create and add session flash object to container
@return void | [
"Create",
"and",
"add",
"session",
"flash",
"object",
"to",
"container"
] | 234ed703baf9e31268941c9d5f6d5e004cc53066 | https://github.com/bandama-framework/bandama-framework/blob/234ed703baf9e31268941c9d5f6d5e004cc53066/src/App.php#L267-L272 | train |
erenmustafaozdal/laravel-modules-base | src/Services/PermissionService.php | PermissionService.setCounts | private function setCounts()
{
foreach($this->routes as $module) {
$this->counts['module']++;
foreach($module['routes'] as $route) {
$this->counts['route']++;
}
}
} | php | private function setCounts()
{
foreach($this->routes as $module) {
$this->counts['module']++;
foreach($module['routes'] as $route) {
$this->counts['route']++;
}
}
} | [
"private",
"function",
"setCounts",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"module",
")",
"{",
"$",
"this",
"->",
"counts",
"[",
"'module'",
"]",
"++",
";",
"foreach",
"(",
"$",
"module",
"[",
"'routes'",
"]",
"as",
... | set module, part, route counts
@return void | [
"set",
"module",
"part",
"route",
"counts"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Services/PermissionService.php#L74-L82 | train |
erenmustafaozdal/laravel-modules-base | src/Services/PermissionService.php | PermissionService.getMyModules | protected function getMyModules()
{
$all = array_keys( app()->getLoadedProviders() );
$modules = [];
foreach($all as $provider) {
$parts = explode('\\', $provider);
if ($parts[0] === 'ErenMustafaOzdal' && array_search($parts[1],$modules) === false) {
... | php | protected function getMyModules()
{
$all = array_keys( app()->getLoadedProviders() );
$modules = [];
foreach($all as $provider) {
$parts = explode('\\', $provider);
if ($parts[0] === 'ErenMustafaOzdal' && array_search($parts[1],$modules) === false) {
... | [
"protected",
"function",
"getMyModules",
"(",
")",
"{",
"$",
"all",
"=",
"array_keys",
"(",
"app",
"(",
")",
"->",
"getLoadedProviders",
"(",
")",
")",
";",
"$",
"modules",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"all",
"as",
"$",
"provider",
")",
... | get ErenMustafaOzdal namespace provider
@return array | [
"get",
"ErenMustafaOzdal",
"namespace",
"provider"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Services/PermissionService.php#L89-L100 | train |
selamiphp/views | src/ExtensionsAbstract.php | ExtensionsAbstract.loadFunctions | protected function loadFunctions() : void
{
$this->extendForTranslator();
$this->extendForWidget();
$this->extendForSiteUrl();
$this->extendForGetUrl();
$this->extendForQueryParams();
$this->extendForPagination();
$this->extendForVarDump();
} | php | protected function loadFunctions() : void
{
$this->extendForTranslator();
$this->extendForWidget();
$this->extendForSiteUrl();
$this->extendForGetUrl();
$this->extendForQueryParams();
$this->extendForPagination();
$this->extendForVarDump();
} | [
"protected",
"function",
"loadFunctions",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"extendForTranslator",
"(",
")",
";",
"$",
"this",
"->",
"extendForWidget",
"(",
")",
";",
"$",
"this",
"->",
"extendForSiteUrl",
"(",
")",
";",
"$",
"this",
"->",
... | Load functions that will be used in the templates | [
"Load",
"functions",
"that",
"will",
"be",
"used",
"in",
"the",
"templates"
] | 94081fc3093b160988e228d6ce63736d21c9f175 | https://github.com/selamiphp/views/blob/94081fc3093b160988e228d6ce63736d21c9f175/src/ExtensionsAbstract.php#L17-L26 | train |
iron-bound-designs/IronBound-Cache | src/Cache.php | Cache.update | public static function update( Cacheable $object ) {
return wp_cache_set( $object->get_pk(), $object->get_data_to_cache(), $object::get_cache_group() );
} | php | public static function update( Cacheable $object ) {
return wp_cache_set( $object->get_pk(), $object->get_data_to_cache(), $object::get_cache_group() );
} | [
"public",
"static",
"function",
"update",
"(",
"Cacheable",
"$",
"object",
")",
"{",
"return",
"wp_cache_set",
"(",
"$",
"object",
"->",
"get_pk",
"(",
")",
",",
"$",
"object",
"->",
"get_data_to_cache",
"(",
")",
",",
"$",
"object",
"::",
"get_cache_group... | Update an item in the cache.
@since 1.0
@param Cacheable $object
@return bool | [
"Update",
"an",
"item",
"in",
"the",
"cache",
"."
] | 6f706e7dd0d1cfa1a153dbd6de79e2db99fe0589 | https://github.com/iron-bound-designs/IronBound-Cache/blob/6f706e7dd0d1cfa1a153dbd6de79e2db99fe0589/src/Cache.php#L43-L45 | train |
internetofvoice/vsms-core | src/Helper/LogHelper.php | LogHelper.logRequest | public function logRequest($request, $extra = [], $includeHeader = true) {
$extra = count($extra) ? ' ' . json_encode($extra) : '';
// Caller info
$trace = debug_backtrace(false, 2);
if(isset($trace[1])) {
$caller = substr(strrchr($trace[1]['class'], '\\'), 1) . '::' . $tra... | php | public function logRequest($request, $extra = [], $includeHeader = true) {
$extra = count($extra) ? ' ' . json_encode($extra) : '';
// Caller info
$trace = debug_backtrace(false, 2);
if(isset($trace[1])) {
$caller = substr(strrchr($trace[1]['class'], '\\'), 1) . '::' . $tra... | [
"public",
"function",
"logRequest",
"(",
"$",
"request",
",",
"$",
"extra",
"=",
"[",
"]",
",",
"$",
"includeHeader",
"=",
"true",
")",
"{",
"$",
"extra",
"=",
"count",
"(",
"$",
"extra",
")",
"?",
"' '",
".",
"json_encode",
"(",
"$",
"extra",
")",... | Log server request
@param \Slim\Http\Request $request Request object
@param array $extra Additional log data
@param bool $includeHeader Whether to include header data
@access public
@author a.schmidt@internet-of-voice.de | [
"Log",
"server",
"request"
] | bd1eb6ca90a55f4928c35b9f0742a5cc922298ef | https://github.com/internetofvoice/vsms-core/blob/bd1eb6ca90a55f4928c35b9f0742a5cc922298ef/src/Helper/LogHelper.php#L48-L92 | train |
loevgaard/dandomain-foundation-entities | src/Entity/Price.php | Price.create | public static function create(int $amount, int $avance, string $b2bGroupId, CurrencyInterface $currency, int $specialOfferPrice, int $unitPrice): PriceInterface
{
$specialOfferPrice = new Money($specialOfferPrice, new \Money\Currency($currency->getIsoCodeAlpha()));
$unitPrice = new Money($unitPrice,... | php | public static function create(int $amount, int $avance, string $b2bGroupId, CurrencyInterface $currency, int $specialOfferPrice, int $unitPrice): PriceInterface
{
$specialOfferPrice = new Money($specialOfferPrice, new \Money\Currency($currency->getIsoCodeAlpha()));
$unitPrice = new Money($unitPrice,... | [
"public",
"static",
"function",
"create",
"(",
"int",
"$",
"amount",
",",
"int",
"$",
"avance",
",",
"string",
"$",
"b2bGroupId",
",",
"CurrencyInterface",
"$",
"currency",
",",
"int",
"$",
"specialOfferPrice",
",",
"int",
"$",
"unitPrice",
")",
":",
"Pric... | Creates a valid Price.
@param int $amount
@param int $avance
@param string $b2bGroupId
@param CurrencyInterface $currency
@param int $specialOfferPrice In cents/ører (in danish)
@param int $unitPrice In cents/ører (in danish)
@return PriceInte... | [
"Creates",
"a",
"valid",
"Price",
"."
] | 256f7aa8b40d2bd9488046c3c2b1e04e982d78ad | https://github.com/loevgaard/dandomain-foundation-entities/blob/256f7aa8b40d2bd9488046c3c2b1e04e982d78ad/src/Entity/Price.php#L112-L128 | train |
freialib/ran.tools | src/Form.php | Form.composite | function composite($label) {
$args = func_get_args();
array_shift($args); # remove $label
$composite = \ran\CompositeField::instance($this->confs);
$composite->fieldlabel_is($label);
if (count($args) >= 1) {
if (is_array($args[0])) {
$array_shorthand = array_shift($args);
foreach ($array_shorthan... | php | function composite($label) {
$args = func_get_args();
array_shift($args); # remove $label
$composite = \ran\CompositeField::instance($this->confs);
$composite->fieldlabel_is($label);
if (count($args) >= 1) {
if (is_array($args[0])) {
$array_shorthand = array_shift($args);
foreach ($array_shorthan... | [
"function",
"composite",
"(",
"$",
"label",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"array_shift",
"(",
"$",
"args",
")",
";",
"# remove $label",
"$",
"composite",
"=",
"\\",
"ran",
"\\",
"CompositeField",
"::",
"instance",
"(",
"$",
... | Any additonal parameters are interpreted as Fields that are part of the
composite. If an array is passed as second parameter the fields will be
interpreted as text Field.
Therefore the following:
$form->composite('Name', ['given_name', 'family_name']);
Is equivalent to this:
$form->composite
(
'Name',
$form->text(n... | [
"Any",
"additonal",
"parameters",
"are",
"interpreted",
"as",
"Fields",
"that",
"are",
"part",
"of",
"the",
"composite",
".",
"If",
"an",
"array",
"is",
"passed",
"as",
"second",
"parameter",
"the",
"fields",
"will",
"be",
"interpreted",
"as",
"text",
"Field... | f4cbb926ef54da357b102cbfa4b6ce273be6ce63 | https://github.com/freialib/ran.tools/blob/f4cbb926ef54da357b102cbfa4b6ce273be6ce63/src/Form.php#L130-L166 | train |
freialib/ran.tools | src/Form.php | Form.autocomplete_array | function autocomplete_array(array &$hints = null) {
if ($this->autocomplete === null) {
$this->autocomplete = &$hints;
}
else if ($hints !== null) {
foreach ($hints as $key => $hint) {
$this->autocomplete[$key] = $hint;
}
}
return $this;
} | php | function autocomplete_array(array &$hints = null) {
if ($this->autocomplete === null) {
$this->autocomplete = &$hints;
}
else if ($hints !== null) {
foreach ($hints as $key => $hint) {
$this->autocomplete[$key] = $hint;
}
}
return $this;
} | [
"function",
"autocomplete_array",
"(",
"array",
"&",
"$",
"hints",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"autocomplete",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"autocomplete",
"=",
"&",
"$",
"hints",
";",
"}",
"else",
"if",
"(",
... | The given values will be used to autofill the form. They may be however
ignored depending on context.
@return static $this | [
"The",
"given",
"values",
"will",
"be",
"used",
"to",
"autofill",
"the",
"form",
".",
"They",
"may",
"be",
"however",
"ignored",
"depending",
"on",
"context",
"."
] | f4cbb926ef54da357b102cbfa4b6ce273be6ce63 | https://github.com/freialib/ran.tools/blob/f4cbb926ef54da357b102cbfa4b6ce273be6ce63/src/Form.php#L176-L187 | train |
freialib/ran.tools | src/Form.php | Form.autovalue | function autovalue($fieldname, $default = null) {
if ($this->autocomplete !== null) {
$fieldname = rtrim($fieldname, '[]');
if (isset($this->autocomplete[$fieldname])) {
return $this->autocomplete[$fieldname];
}
}
// no auto complete value found
return $default;
} | php | function autovalue($fieldname, $default = null) {
if ($this->autocomplete !== null) {
$fieldname = rtrim($fieldname, '[]');
if (isset($this->autocomplete[$fieldname])) {
return $this->autocomplete[$fieldname];
}
}
// no auto complete value found
return $default;
} | [
"function",
"autovalue",
"(",
"$",
"fieldname",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"autocomplete",
"!==",
"null",
")",
"{",
"$",
"fieldname",
"=",
"rtrim",
"(",
"$",
"fieldname",
",",
"'[]'",
")",
";",
"if",
"... | Retrieve autocomplete value for given field or null.
@return mixed or null | [
"Retrieve",
"autocomplete",
"value",
"for",
"given",
"field",
"or",
"null",
"."
] | f4cbb926ef54da357b102cbfa4b6ce273be6ce63 | https://github.com/freialib/ran.tools/blob/f4cbb926ef54da357b102cbfa4b6ce273be6ce63/src/Form.php#L194-L204 | train |
freialib/ran.tools | src/Form.php | Form.signature | function signature($id = null) {
if ( ! $this->unsigned) {
if ($this->get('id', null) === null) {
$formsignature = 'freiaform'.$this->formindex;
}
else { # custom signature
$formsignature = $this->get('id');
}
if ($id !== null) {
return "{$formsignature}_field$id";
}
else { # form si... | php | function signature($id = null) {
if ( ! $this->unsigned) {
if ($this->get('id', null) === null) {
$formsignature = 'freiaform'.$this->formindex;
}
else { # custom signature
$formsignature = $this->get('id');
}
if ($id !== null) {
return "{$formsignature}_field$id";
}
else { # form si... | [
"function",
"signature",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"unsigned",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"get",
"(",
"'id'",
",",
"null",
")",
"===",
"null",
")",
"{",
"$",
"formsignature",
"=",
"'f... | Returns the form signature or creates signature using given id and form
signature.
@return string | [
"Returns",
"the",
"form",
"signature",
"or",
"creates",
"signature",
"using",
"given",
"id",
"and",
"form",
"signature",
"."
] | f4cbb926ef54da357b102cbfa4b6ce273be6ce63 | https://github.com/freialib/ran.tools/blob/f4cbb926ef54da357b102cbfa4b6ce273be6ce63/src/Form.php#L214-L233 | train |
freialib/ran.tools | src/Form.php | Form.render | function render() {
if ($this->show_metainfo) {
$this->appendtagbody($this->hidden('form')
->value_is($this->signature()));
}
return parent::render();
} | php | function render() {
if ($this->show_metainfo) {
$this->appendtagbody($this->hidden('form')
->value_is($this->signature()));
}
return parent::render();
} | [
"function",
"render",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"show_metainfo",
")",
"{",
"$",
"this",
"->",
"appendtagbody",
"(",
"$",
"this",
"->",
"hidden",
"(",
"'form'",
")",
"->",
"value_is",
"(",
"$",
"this",
"->",
"signature",
"(",
")",
... | A "form" hidden field will be inserted into the form to identify the
data submitted belonged to this form.
@return string | [
"A",
"form",
"hidden",
"field",
"will",
"be",
"inserted",
"into",
"the",
"form",
"to",
"identify",
"the",
"data",
"submitted",
"belonged",
"to",
"this",
"form",
"."
] | f4cbb926ef54da357b102cbfa4b6ce273be6ce63 | https://github.com/freialib/ran.tools/blob/f4cbb926ef54da357b102cbfa4b6ce273be6ce63/src/Form.php#L261-L268 | train |
vegas-cmf/oauth | src/OAuth/ServiceAbstract.php | ServiceAbstract.setupCredentials | public function setupCredentials(array $credentials)
{
if (!array_key_exists('key', $credentials)) {
throw new InvalidApplicationKeyException();
}
if (!array_key_exists('secret', $credentials)) {
throw new InvalidApplicationSecretKeyException();
}
if (... | php | public function setupCredentials(array $credentials)
{
if (!array_key_exists('key', $credentials)) {
throw new InvalidApplicationKeyException();
}
if (!array_key_exists('secret', $credentials)) {
throw new InvalidApplicationSecretKeyException();
}
if (... | [
"public",
"function",
"setupCredentials",
"(",
"array",
"$",
"credentials",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'key'",
",",
"$",
"credentials",
")",
")",
"{",
"throw",
"new",
"InvalidApplicationKeyException",
"(",
")",
";",
"}",
"if",
"(",
... | Setups provider credentials
@param array $credentials
@throws Exception\InvalidApplicationKeyException
@throws Exception\InvalidApplicationSecretKeyException | [
"Setups",
"provider",
"credentials"
] | 5183a60d02cdf3b7db9f3168be1c0bbe1306cddf | https://github.com/vegas-cmf/oauth/blob/5183a60d02cdf3b7db9f3168be1c0bbe1306cddf/src/OAuth/ServiceAbstract.php#L159-L175 | train |
vegas-cmf/oauth | src/OAuth/ServiceAbstract.php | ServiceAbstract.setAllScopes | public function setAllScopes()
{
$scopes = array();
$reflectionClass = new \ReflectionClass(__CLASS__);
foreach ($reflectionClass->getConstants() as $constantName => $constantValue) {
if (strpos($constantName, 'SCOPE_') !== false) {
$scopes = $constantValue;
... | php | public function setAllScopes()
{
$scopes = array();
$reflectionClass = new \ReflectionClass(__CLASS__);
foreach ($reflectionClass->getConstants() as $constantName => $constantValue) {
if (strpos($constantName, 'SCOPE_') !== false) {
$scopes = $constantValue;
... | [
"public",
"function",
"setAllScopes",
"(",
")",
"{",
"$",
"scopes",
"=",
"array",
"(",
")",
";",
"$",
"reflectionClass",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"__CLASS__",
")",
";",
"foreach",
"(",
"$",
"reflectionClass",
"->",
"getConstants",
"(",
")"... | Sets all permissions, which user will be asked for during authentication process | [
"Sets",
"all",
"permissions",
"which",
"user",
"will",
"be",
"asked",
"for",
"during",
"authentication",
"process"
] | 5183a60d02cdf3b7db9f3168be1c0bbe1306cddf | https://github.com/vegas-cmf/oauth/blob/5183a60d02cdf3b7db9f3168be1c0bbe1306cddf/src/OAuth/ServiceAbstract.php#L190-L201 | train |
vegas-cmf/oauth | src/OAuth/ServiceAbstract.php | ServiceAbstract.addScope | public function addScope($scope)
{
if (!in_array($scope, $this->scopes)) {
$this->scopes[] = $scope;
}
return $this;
} | php | public function addScope($scope)
{
if (!in_array($scope, $this->scopes)) {
$this->scopes[] = $scope;
}
return $this;
} | [
"public",
"function",
"addScope",
"(",
"$",
"scope",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"scope",
",",
"$",
"this",
"->",
"scopes",
")",
")",
"{",
"$",
"this",
"->",
"scopes",
"[",
"]",
"=",
"$",
"scope",
";",
"}",
"return",
"$",
"t... | Adds provider scope
@param $scope
@return $this | [
"Adds",
"provider",
"scope"
] | 5183a60d02cdf3b7db9f3168be1c0bbe1306cddf | https://github.com/vegas-cmf/oauth/blob/5183a60d02cdf3b7db9f3168be1c0bbe1306cddf/src/OAuth/ServiceAbstract.php#L222-L229 | train |
vegas-cmf/oauth | src/OAuth/ServiceAbstract.php | ServiceAbstract.isAuthenticated | public function isAuthenticated()
{
try {
$session = $this->sessionStorage->retrieveAccessToken($this->getServiceName());
if (!$session) {
return false;
}
return $session->getEndOfLife() > time();
} catch (TokenNotFoundException $e) {
... | php | public function isAuthenticated()
{
try {
$session = $this->sessionStorage->retrieveAccessToken($this->getServiceName());
if (!$session) {
return false;
}
return $session->getEndOfLife() > time();
} catch (TokenNotFoundException $e) {
... | [
"public",
"function",
"isAuthenticated",
"(",
")",
"{",
"try",
"{",
"$",
"session",
"=",
"$",
"this",
"->",
"sessionStorage",
"->",
"retrieveAccessToken",
"(",
"$",
"this",
"->",
"getServiceName",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"session",
")",
... | Obtains authentication for current service
@return bool | [
"Obtains",
"authentication",
"for",
"current",
"service"
] | 5183a60d02cdf3b7db9f3168be1c0bbe1306cddf | https://github.com/vegas-cmf/oauth/blob/5183a60d02cdf3b7db9f3168be1c0bbe1306cddf/src/OAuth/ServiceAbstract.php#L303-L314 | train |
SagittariusX/Beluga.Core | src/Beluga/BelugaError.php | BelugaError.getErrorMessage | public function getErrorMessage( bool $appendPreviousByNewline = false ) : string
{
// Getting a optional previous exception
$prev = $this->getPrevious();
if ( \is_null( $prev ) )
{
// If no previous exception is used
return \sprintf(
'%s(%d): %s',
... | php | public function getErrorMessage( bool $appendPreviousByNewline = false ) : string
{
// Getting a optional previous exception
$prev = $this->getPrevious();
if ( \is_null( $prev ) )
{
// If no previous exception is used
return \sprintf(
'%s(%d): %s',
... | [
"public",
"function",
"getErrorMessage",
"(",
"bool",
"$",
"appendPreviousByNewline",
"=",
"false",
")",
":",
"string",
"{",
"// Getting a optional previous exception",
"$",
"prev",
"=",
"$",
"this",
"->",
"getPrevious",
"(",
")",
";",
"if",
"(",
"\\",
"is_null"... | Extends the origin getMessage method, so also previous messages are include, if defined.
@param bool $appendPreviousByNewline If a prev. Exception is defined append it by a new line? (' ' other)
@return string | [
"Extends",
"the",
"origin",
"getMessage",
"method",
"so",
"also",
"previous",
"messages",
"are",
"include",
"if",
"defined",
"."
] | 51057b362707157a4b075df42bb49f397e2d310b | https://github.com/SagittariusX/Beluga.Core/blob/51057b362707157a4b075df42bb49f397e2d310b/src/Beluga/BelugaError.php#L126-L167 | train |
SagittariusX/Beluga.Core | src/Beluga/BelugaError.php | BelugaError.GetCodeName | public static function GetCodeName( $code ) : string
{
switch ( $code )
{
case \E_ERROR:
case \E_USER_ERROR:
return 'ERROR';
case \E_WARNING:
case \E_USER_WARNING:
return 'WARNING';
case \E_DEPRECATED:
case \E_USER_DEPRECAT... | php | public static function GetCodeName( $code ) : string
{
switch ( $code )
{
case \E_ERROR:
case \E_USER_ERROR:
return 'ERROR';
case \E_WARNING:
case \E_USER_WARNING:
return 'WARNING';
case \E_DEPRECATED:
case \E_USER_DEPRECAT... | [
"public",
"static",
"function",
"GetCodeName",
"(",
"$",
"code",
")",
":",
"string",
"{",
"switch",
"(",
"$",
"code",
")",
"{",
"case",
"\\",
"E_ERROR",
":",
"case",
"\\",
"E_USER_ERROR",
":",
"return",
"'ERROR'",
";",
"case",
"\\",
"E_WARNING",
":",
"... | Returns a string, representing the defined error code.
@param int|string $code e.g.: \E_USER_ERROR
@return string | [
"Returns",
"a",
"string",
"representing",
"the",
"defined",
"error",
"code",
"."
] | 51057b362707157a4b075df42bb49f397e2d310b | https://github.com/SagittariusX/Beluga.Core/blob/51057b362707157a4b075df42bb49f397e2d310b/src/Beluga/BelugaError.php#L239-L278 | train |
Vectrex/vxPHP | src/Mail/Email.php | Email.sendMail | private function sendMail() {
// check for configured mailer
if(is_null($this->mailer) && !is_null(Application::getInstance()->getConfig()->mail->mailer)) {
$mailer = Application::getInstance()->getConfig()->mail->mailer;
$reflection = new \ReflectionClass(str_replace('/', '\\', $mailer->class));
$p... | php | private function sendMail() {
// check for configured mailer
if(is_null($this->mailer) && !is_null(Application::getInstance()->getConfig()->mail->mailer)) {
$mailer = Application::getInstance()->getConfig()->mail->mailer;
$reflection = new \ReflectionClass(str_replace('/', '\\', $mailer->class));
$p... | [
"private",
"function",
"sendMail",
"(",
")",
"{",
"// check for configured mailer",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"mailer",
")",
"&&",
"!",
"is_null",
"(",
"Application",
"::",
"getInstance",
"(",
")",
"->",
"getConfig",
"(",
")",
"->",
"ma... | evaluate mailer class and send mail
@return boolean
@throws \ReflectionException
@throws \vxPHP\Application\Exception\ApplicationException | [
"evaluate",
"mailer",
"class",
"and",
"send",
"mail"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Mail/Email.php#L323-L395 | train |
Vectrex/vxPHP | src/Mail/Email.php | Email.buildHeaders | private function buildHeaders() {
$this->headers = [
'From' => $this->sender,
'Return-Path' => $this->sender,
'Reply-To' => $this->sender,
'Date' => (new \DateTime())->format('r'),
'Message-ID' => '<'.sha1(microtime()) . '@' . substr($this->sender, strpos($this->sender, '@') + 1) . '>',
'User-Agent... | php | private function buildHeaders() {
$this->headers = [
'From' => $this->sender,
'Return-Path' => $this->sender,
'Reply-To' => $this->sender,
'Date' => (new \DateTime())->format('r'),
'Message-ID' => '<'.sha1(microtime()) . '@' . substr($this->sender, strpos($this->sender, '@') + 1) . '>',
'User-Agent... | [
"private",
"function",
"buildHeaders",
"(",
")",
"{",
"$",
"this",
"->",
"headers",
"=",
"[",
"'From'",
"=>",
"$",
"this",
"->",
"sender",
",",
"'Return-Path'",
"=>",
"$",
"this",
"->",
"sender",
",",
"'Reply-To'",
"=>",
"$",
"this",
"->",
"sender",
",... | fill headers array | [
"fill",
"headers",
"array"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Mail/Email.php#L424-L453 | train |
Vectrex/vxPHP | src/Mail/Email.php | Email.buildMsg | private function buildMsg() {
if(isset($this->boundary)) {
$this->msg = '--' . $this->boundary . self::CRLF;
$this->msg .= 'Content-type: text/' . ($this->htmlMail ? 'html' : 'plain') . '; charset=' .$this->encoding . self::CRLF;
$this->msg .= 'Content-Transfer-Encoding: 8bit' . self::CRLF . self::CRLF;
}... | php | private function buildMsg() {
if(isset($this->boundary)) {
$this->msg = '--' . $this->boundary . self::CRLF;
$this->msg .= 'Content-type: text/' . ($this->htmlMail ? 'html' : 'plain') . '; charset=' .$this->encoding . self::CRLF;
$this->msg .= 'Content-Transfer-Encoding: 8bit' . self::CRLF . self::CRLF;
}... | [
"private",
"function",
"buildMsg",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"boundary",
")",
")",
"{",
"$",
"this",
"->",
"msg",
"=",
"'--'",
".",
"$",
"this",
"->",
"boundary",
".",
"self",
"::",
"CRLF",
";",
"$",
"this",
"->",... | build message body | [
"build",
"message",
"body"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Mail/Email.php#L458-L505 | train |
rawphp/RawLog | src/RawPHP/RawLog/Log.php | Log.init | public function init( $config = [ ] )
{
$handlers = array_values( $config[ 'handlers' ] );
foreach ( $handlers as $conf )
{
$class = $conf[ 'class' ];
$handler = new $class( $conf );
$this->addHandler( $handler );
}
} | php | public function init( $config = [ ] )
{
$handlers = array_values( $config[ 'handlers' ] );
foreach ( $handlers as $conf )
{
$class = $conf[ 'class' ];
$handler = new $class( $conf );
$this->addHandler( $handler );
}
} | [
"public",
"function",
"init",
"(",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"handlers",
"=",
"array_values",
"(",
"$",
"config",
"[",
"'handlers'",
"]",
")",
";",
"foreach",
"(",
"$",
"handlers",
"as",
"$",
"conf",
")",
"{",
"$",
"class",
"=",
... | Initialises the log.
@param array $config configuration array
@throws LogException if log file is missing | [
"Initialises",
"the",
"log",
"."
] | caee6c1ae92015c9b8481302d0bda5bf4ef9d1b6 | https://github.com/rawphp/RawLog/blob/caee6c1ae92015c9b8481302d0bda5bf4ef9d1b6/src/RawPHP/RawLog/Log.php#L73-L85 | train |
rawphp/RawLog | src/RawPHP/RawLog/Log.php | Log._logIt | private function _logIt( $level, $message, $context = [ ] )
{
foreach ( $this->_handlers as $handler )
{
$args[ 'message' ] = $message;
/** @var IHandler $handler */
$record = $handler->createRecord( $level, $args, $context );
$handler->handle( $reco... | php | private function _logIt( $level, $message, $context = [ ] )
{
foreach ( $this->_handlers as $handler )
{
$args[ 'message' ] = $message;
/** @var IHandler $handler */
$record = $handler->createRecord( $level, $args, $context );
$handler->handle( $reco... | [
"private",
"function",
"_logIt",
"(",
"$",
"level",
",",
"$",
"message",
",",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_handlers",
"as",
"$",
"handler",
")",
"{",
"$",
"args",
"[",
"'message'",
"]",
"=",
"$",
"... | Logs messages to the log.
@param int $level the log level
@param string $message the log message
@param array $context | [
"Logs",
"messages",
"to",
"the",
"log",
"."
] | caee6c1ae92015c9b8481302d0bda5bf4ef9d1b6 | https://github.com/rawphp/RawLog/blob/caee6c1ae92015c9b8481302d0bda5bf4ef9d1b6/src/RawPHP/RawLog/Log.php#L258-L269 | train |
rawphp/RawLog | src/RawPHP/RawLog/Log.php | Log.getLevelString | public static function getLevelString( $level )
{
$name = '';
switch ( $level )
{
case self::LEVEL_DEBUG:
$name = 'DEBUG';
break;
case self::LEVEL_INFO:
$name = 'INFO';
break;
case self::LE... | php | public static function getLevelString( $level )
{
$name = '';
switch ( $level )
{
case self::LEVEL_DEBUG:
$name = 'DEBUG';
break;
case self::LEVEL_INFO:
$name = 'INFO';
break;
case self::LE... | [
"public",
"static",
"function",
"getLevelString",
"(",
"$",
"level",
")",
"{",
"$",
"name",
"=",
"''",
";",
"switch",
"(",
"$",
"level",
")",
"{",
"case",
"self",
"::",
"LEVEL_DEBUG",
":",
"$",
"name",
"=",
"'DEBUG'",
";",
"break",
";",
"case",
"self... | Returns the level as string.
@param int $level the level number
@return string the level label | [
"Returns",
"the",
"level",
"as",
"string",
"."
] | caee6c1ae92015c9b8481302d0bda5bf4ef9d1b6 | https://github.com/rawphp/RawLog/blob/caee6c1ae92015c9b8481302d0bda5bf4ef9d1b6/src/RawPHP/RawLog/Log.php#L278-L322 | train |
MatiasNAmendola/slimpower-jwt | src/JwtGenerator.php | JwtGenerator.setTokenValidity | public function setTokenValidity($tokenValidity) {
$tknVal = intval($tokenValidity);
if (empty($tknVal)) {
$tknVal = self::BASIC_VALIDITY;
}
$this->tokenValidity = intval($tknVal);
} | php | public function setTokenValidity($tokenValidity) {
$tknVal = intval($tokenValidity);
if (empty($tknVal)) {
$tknVal = self::BASIC_VALIDITY;
}
$this->tokenValidity = intval($tknVal);
} | [
"public",
"function",
"setTokenValidity",
"(",
"$",
"tokenValidity",
")",
"{",
"$",
"tknVal",
"=",
"intval",
"(",
"$",
"tokenValidity",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"tknVal",
")",
")",
"{",
"$",
"tknVal",
"=",
"self",
"::",
"BASIC_VALIDITY",
... | Sets token validity
@param int $tokenValidity Token validity. | [
"Sets",
"token",
"validity"
] | 5afc151e8a37b06fe6cb6a44ff776e7ec9f40e98 | https://github.com/MatiasNAmendola/slimpower-jwt/blob/5afc151e8a37b06fe6cb6a44ff776e7ec9f40e98/src/JwtGenerator.php#L93-L101 | train |
SagittariusX/Beluga.DynamicProperties | src/Beluga/DynamicProperties/ExplicitGetter.php | ExplicitGetter.hasReadableProperty | public function hasReadableProperty( string $name, &$getterName ) : bool
{
if ( \in_array( $name, $this->ignoreGetProperties ) )
{
return false;
}
$getterName = 'get' . \ucfirst( $name );
return \method_exists( $this, $getterName );
} | php | public function hasReadableProperty( string $name, &$getterName ) : bool
{
if ( \in_array( $name, $this->ignoreGetProperties ) )
{
return false;
}
$getterName = 'get' . \ucfirst( $name );
return \method_exists( $this, $getterName );
} | [
"public",
"function",
"hasReadableProperty",
"(",
"string",
"$",
"name",
",",
"&",
"$",
"getterName",
")",
":",
"bool",
"{",
"if",
"(",
"\\",
"in_array",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"ignoreGetProperties",
")",
")",
"{",
"return",
"false",
... | Returns, if a property with the defined name exists for read access.
@param string $name The name of the property.
@param string $getterName Returns the name of the associated get method, if method returns TRUE.
@return boolean | [
"Returns",
"if",
"a",
"property",
"with",
"the",
"defined",
"name",
"exists",
"for",
"read",
"access",
"."
] | 39a036030d768d64e5a9c5d715c4218bf06b1ce5 | https://github.com/SagittariusX/Beluga.DynamicProperties/blob/39a036030d768d64e5a9c5d715c4218bf06b1ce5/src/Beluga/DynamicProperties/ExplicitGetter.php#L76-L88 | train |
Mandarin-Medien/MMCmfContentBundle | Twig/CmfContentParserExtension.php | CmfContentParserExtension.checkUser | private function checkUser()
{
static $enabled;
if (!isset($enabled)) {
$token = $this->tokenStorage->getToken();
if ($token) {
$user = $token->getUser();
if ($user instanceof \FOS\UserBundle\Model\User) {
if ($user->ha... | php | private function checkUser()
{
static $enabled;
if (!isset($enabled)) {
$token = $this->tokenStorage->getToken();
if ($token) {
$user = $token->getUser();
if ($user instanceof \FOS\UserBundle\Model\User) {
if ($user->ha... | [
"private",
"function",
"checkUser",
"(",
")",
"{",
"static",
"$",
"enabled",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"enabled",
")",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"tokenStorage",
"->",
"getToken",
"(",
")",
";",
"if",
"(",
"$",
... | checks if the current User is ROLE_USER
@return bool | [
"checks",
"if",
"the",
"current",
"User",
"is",
"ROLE_USER"
] | 503ab31cef3ce068f767de5b72f833526355b726 | https://github.com/Mandarin-Medien/MMCmfContentBundle/blob/503ab31cef3ce068f767de5b72f833526355b726/Twig/CmfContentParserExtension.php#L43-L64 | train |
koolkode/context | src/Bind/ContainerModuleLoader.php | ContainerModuleLoader.getHash | public function getHash()
{
$names = array_keys($this->modules);
sort($names);
return md5(implode('|', $names));
} | php | public function getHash()
{
$names = array_keys($this->modules);
sort($names);
return md5(implode('|', $names));
} | [
"public",
"function",
"getHash",
"(",
")",
"{",
"$",
"names",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"modules",
")",
";",
"sort",
"(",
"$",
"names",
")",
";",
"return",
"md5",
"(",
"implode",
"(",
"'|'",
",",
"$",
"names",
")",
")",
";",
"}"
... | Get an MD5 hash computed from the sorted type names of all modules.
@return string | [
"Get",
"an",
"MD5",
"hash",
"computed",
"from",
"the",
"sorted",
"type",
"names",
"of",
"all",
"modules",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Bind/ContainerModuleLoader.php#L63-L69 | train |
koolkode/context | src/Bind/ContainerModuleLoader.php | ContainerModuleLoader.getLastModified | public function getLastModified()
{
$mtime = 0;
foreach($this->modules as $module)
{
$mtime = max($mtime, filemtime((new \ReflectionClass(get_class($module)))->getFileName()));
}
return $mtime;
} | php | public function getLastModified()
{
$mtime = 0;
foreach($this->modules as $module)
{
$mtime = max($mtime, filemtime((new \ReflectionClass(get_class($module)))->getFileName()));
}
return $mtime;
} | [
"public",
"function",
"getLastModified",
"(",
")",
"{",
"$",
"mtime",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"modules",
"as",
"$",
"module",
")",
"{",
"$",
"mtime",
"=",
"max",
"(",
"$",
"mtime",
",",
"filemtime",
"(",
"(",
"new",
"\\",
... | Get the time of the most recent modification to any registered module.
@return integer | [
"Get",
"the",
"time",
"of",
"the",
"most",
"recent",
"modification",
"to",
"any",
"registered",
"module",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Bind/ContainerModuleLoader.php#L76-L86 | train |
fridge-project/dbal | src/Fridge/DBAL/Platform/MySQLPlatform.php | MySQLPlatform.getIntegerSQLDeclarationSnippet | private function getIntegerSQLDeclarationSnippet(array $options = array())
{
$length = isset($options['length']) ? (int) $options['length'] : null;
$unsigned = isset($options['unsigned']) && $options['unsigned'] ? ' UNSIGNED' : null;
$autoIncrement = isset($options['auto_increment']) && $opt... | php | private function getIntegerSQLDeclarationSnippet(array $options = array())
{
$length = isset($options['length']) ? (int) $options['length'] : null;
$unsigned = isset($options['unsigned']) && $options['unsigned'] ? ' UNSIGNED' : null;
$autoIncrement = isset($options['auto_increment']) && $opt... | [
"private",
"function",
"getIntegerSQLDeclarationSnippet",
"(",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"length",
"=",
"isset",
"(",
"$",
"options",
"[",
"'length'",
"]",
")",
"?",
"(",
"int",
")",
"$",
"options",
"[",
"'length'",
... | Gets the integer SQL declaration snippet.
@param array $options The integer options.
@return string The integer SQL declaration snippet. | [
"Gets",
"the",
"integer",
"SQL",
"declaration",
"snippet",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Platform/MySQLPlatform.php#L375-L388 | train |
fridge-project/dbal | src/Fridge/DBAL/Platform/MySQLPlatform.php | MySQLPlatform.getStringTypePrefix | private function getStringTypePrefix($length = null)
{
if ($length === null) {
return 'LONG';
}
if (!is_int($length) || ($length <= 0)) {
throw PlatformException::invalidStringTypePrefixLength();
}
$prefixLimits = array(
'TINY' => 255,
... | php | private function getStringTypePrefix($length = null)
{
if ($length === null) {
return 'LONG';
}
if (!is_int($length) || ($length <= 0)) {
throw PlatformException::invalidStringTypePrefixLength();
}
$prefixLimits = array(
'TINY' => 255,
... | [
"private",
"function",
"getStringTypePrefix",
"(",
"$",
"length",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"length",
"===",
"null",
")",
"{",
"return",
"'LONG'",
";",
"}",
"if",
"(",
"!",
"is_int",
"(",
"$",
"length",
")",
"||",
"(",
"$",
"length",
"... | Gets the string type prefix for the given length.
@link http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html String types length.
@param null|integer $length The length of the type.
@throws \Fridge\DBAL\Exception\PlatformException If the length is not a strict positive integer.
@return string The prefix... | [
"Gets",
"the",
"string",
"type",
"prefix",
"for",
"the",
"given",
"length",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Platform/MySQLPlatform.php#L401-L427 | train |
phossa/phossa-cache | src/Phossa/Cache/Extension/TaggableExtension.php | TaggableExtension.clearByTag | public function clearByTag(
CachePoolInterface $cache,
/*# string */ $tag
)/*# : bool */ {
// get tagItem for $tag
$tagKey = $this->getTagKey($tag);
$tagItem = $cache->getItem($tagKey);
// read array of keys from $tagItem
if ($tagItem->isHit()) {
... | php | public function clearByTag(
CachePoolInterface $cache,
/*# string */ $tag
)/*# : bool */ {
// get tagItem for $tag
$tagKey = $this->getTagKey($tag);
$tagItem = $cache->getItem($tagKey);
// read array of keys from $tagItem
if ($tagItem->isHit()) {
... | [
"public",
"function",
"clearByTag",
"(",
"CachePoolInterface",
"$",
"cache",
",",
"/*# string */",
"$",
"tag",
")",
"/*# : bool */",
"{",
"// get tagItem for $tag",
"$",
"tagKey",
"=",
"$",
"this",
"->",
"getTagKey",
"(",
"$",
"tag",
")",
";",
"$",
"tagItem",
... | Clear by tags
@param CachePoolInterface $cache
@param string $tag tag
@return bool
@access public | [
"Clear",
"by",
"tags"
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Extension/TaggableExtension.php#L127-L163 | train |
devaloka/mu-plugin-installer | src/Installer/MuPluginInstaller.php | MuPluginInstaller.getLoaderInstallPath | public function getLoaderInstallPath(PackageInterface $package)
{
$config = $this->getInstallerConfig($package);
$installPath = 'wp-content/mu-plugins/';
if (!$this->composer->getPackage()) {
return $this->parseTemplate($installPath, $config);
}
$extra ... | php | public function getLoaderInstallPath(PackageInterface $package)
{
$config = $this->getInstallerConfig($package);
$installPath = 'wp-content/mu-plugins/';
if (!$this->composer->getPackage()) {
return $this->parseTemplate($installPath, $config);
}
$extra ... | [
"public",
"function",
"getLoaderInstallPath",
"(",
"PackageInterface",
"$",
"package",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getInstallerConfig",
"(",
"$",
"package",
")",
";",
"$",
"installPath",
"=",
"'wp-content/mu-plugins/'",
";",
"if",
"(",
"!... | Gets the install path for the loader script of an MU plugin.
@param PackageInterface $package An instance of PackageInterface.
@return string|bool The install path, or `false` if the path cannot be resolved. | [
"Gets",
"the",
"install",
"path",
"for",
"the",
"loader",
"script",
"of",
"an",
"MU",
"plugin",
"."
] | beefc2d8ef523187e8cb1f3b41ba71fd0aeb49fe | https://github.com/devaloka/mu-plugin-installer/blob/beefc2d8ef523187e8cb1f3b41ba71fd0aeb49fe/src/Installer/MuPluginInstaller.php#L86-L108 | train |
devaloka/mu-plugin-installer | src/Installer/MuPluginInstaller.php | MuPluginInstaller.getLoaderFilePackagePath | public function getLoaderFilePackagePath(PackageInterface $package)
{
$installPath = $this->getInstallPath($package);
if ($installPath === false) {
return false;
}
$config = $this->getInstallerConfig($package);
$packagePath = $installPath . $config['loader'... | php | public function getLoaderFilePackagePath(PackageInterface $package)
{
$installPath = $this->getInstallPath($package);
if ($installPath === false) {
return false;
}
$config = $this->getInstallerConfig($package);
$packagePath = $installPath . $config['loader'... | [
"public",
"function",
"getLoaderFilePackagePath",
"(",
"PackageInterface",
"$",
"package",
")",
"{",
"$",
"installPath",
"=",
"$",
"this",
"->",
"getInstallPath",
"(",
"$",
"package",
")",
";",
"if",
"(",
"$",
"installPath",
"===",
"false",
")",
"{",
"return... | Gets the file path where a loader script is located.
@param PackageInterface $package An instance of PackageInterface.
@return string The file path, or `false` if the path cannot be resolved. | [
"Gets",
"the",
"file",
"path",
"where",
"a",
"loader",
"script",
"is",
"located",
"."
] | beefc2d8ef523187e8cb1f3b41ba71fd0aeb49fe | https://github.com/devaloka/mu-plugin-installer/blob/beefc2d8ef523187e8cb1f3b41ba71fd0aeb49fe/src/Installer/MuPluginInstaller.php#L117-L129 | train |
devaloka/mu-plugin-installer | src/Installer/MuPluginInstaller.php | MuPluginInstaller.getLoaderFileInstallPath | public function getLoaderFileInstallPath(PackageInterface $package)
{
$installPath = $this->getLoaderInstallPath($package);
if ($installPath === false) {
return false;
}
$config = $this->getInstallerConfig($package);
$installPath = $installPath . basename($... | php | public function getLoaderFileInstallPath(PackageInterface $package)
{
$installPath = $this->getLoaderInstallPath($package);
if ($installPath === false) {
return false;
}
$config = $this->getInstallerConfig($package);
$installPath = $installPath . basename($... | [
"public",
"function",
"getLoaderFileInstallPath",
"(",
"PackageInterface",
"$",
"package",
")",
"{",
"$",
"installPath",
"=",
"$",
"this",
"->",
"getLoaderInstallPath",
"(",
"$",
"package",
")",
";",
"if",
"(",
"$",
"installPath",
"===",
"false",
")",
"{",
"... | Gets the file path where a loader script is installed.
@param PackageInterface $package An instance of PackageInterface.
@return string The file path, or `false` if the path cannot be resolved. | [
"Gets",
"the",
"file",
"path",
"where",
"a",
"loader",
"script",
"is",
"installed",
"."
] | beefc2d8ef523187e8cb1f3b41ba71fd0aeb49fe | https://github.com/devaloka/mu-plugin-installer/blob/beefc2d8ef523187e8cb1f3b41ba71fd0aeb49fe/src/Installer/MuPluginInstaller.php#L138-L150 | train |
devaloka/mu-plugin-installer | src/Installer/MuPluginInstaller.php | MuPluginInstaller.getInstallerConfig | protected function getInstallerConfig(PackageInterface $package)
{
if ($this->installerConfig !== null) {
return $this->installerConfig;
}
$type = $package->getType();
$prettyName = $package->getPrettyName();
if (strpos($prettyName, '/') !== false) {
... | php | protected function getInstallerConfig(PackageInterface $package)
{
if ($this->installerConfig !== null) {
return $this->installerConfig;
}
$type = $package->getType();
$prettyName = $package->getPrettyName();
if (strpos($prettyName, '/') !== false) {
... | [
"protected",
"function",
"getInstallerConfig",
"(",
"PackageInterface",
"$",
"package",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"installerConfig",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"installerConfig",
";",
"}",
"$",
"type",
"=",
"$",
"pa... | Retrieves configuration values from a packages's `composer.json`.
@param PackageInterface $package An instance of PackageInterface.
@return string[] The configuration values. | [
"Retrieves",
"configuration",
"values",
"from",
"a",
"packages",
"s",
"composer",
".",
"json",
"."
] | beefc2d8ef523187e8cb1f3b41ba71fd0aeb49fe | https://github.com/devaloka/mu-plugin-installer/blob/beefc2d8ef523187e8cb1f3b41ba71fd0aeb49fe/src/Installer/MuPluginInstaller.php#L159-L188 | train |
devaloka/mu-plugin-installer | src/Installer/MuPluginInstaller.php | MuPluginInstaller.parseTemplate | protected function parseTemplate($template, array $vars = array())
{
if (strpos($template, '{') === false) {
return $template;
}
if (preg_match_all('@\{\$([A-Za-z0-9_]+)\}@i', $template, $matches)) {
foreach ($matches[1] as $varName) {
$template = str... | php | protected function parseTemplate($template, array $vars = array())
{
if (strpos($template, '{') === false) {
return $template;
}
if (preg_match_all('@\{\$([A-Za-z0-9_]+)\}@i', $template, $matches)) {
foreach ($matches[1] as $varName) {
$template = str... | [
"protected",
"function",
"parseTemplate",
"(",
"$",
"template",
",",
"array",
"$",
"vars",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"template",
",",
"'{'",
")",
"===",
"false",
")",
"{",
"return",
"$",
"template",
";",
"}",
... | Parses a template string.
@param string $template A template string.
@param mixed[] $vars Template variables.
@return string The parsed template string.
@see https://github.com/composer/installers This code is based on the Composer Installer. | [
"Parses",
"a",
"template",
"string",
"."
] | beefc2d8ef523187e8cb1f3b41ba71fd0aeb49fe | https://github.com/devaloka/mu-plugin-installer/blob/beefc2d8ef523187e8cb1f3b41ba71fd0aeb49fe/src/Installer/MuPluginInstaller.php#L200-L213 | train |
devaloka/mu-plugin-installer | src/Installer/MuPluginInstaller.php | MuPluginInstaller.resolveInstallPath | protected function resolveInstallPath(array $paths, $name)
{
foreach ($paths as $path => $names) {
if (in_array($name, $names, true) || in_array('type:' . static::TYPE, $names, true)) {
return $path;
}
}
return false;
} | php | protected function resolveInstallPath(array $paths, $name)
{
foreach ($paths as $path => $names) {
if (in_array($name, $names, true) || in_array('type:' . static::TYPE, $names, true)) {
return $path;
}
}
return false;
} | [
"protected",
"function",
"resolveInstallPath",
"(",
"array",
"$",
"paths",
",",
"$",
"name",
")",
"{",
"foreach",
"(",
"$",
"paths",
"as",
"$",
"path",
"=>",
"$",
"names",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"name",
",",
"$",
"names",
",",
"... | Searches the install path based on a package name and a paths array.
@param array[] $paths A paths array.
@param string $name A package name.
@return string|bool The install path, or `false` if the path cannot be resolved.
@see https://github.com/composer/installers This code is based on the Composer Installer. | [
"Searches",
"the",
"install",
"path",
"based",
"on",
"a",
"package",
"name",
"and",
"a",
"paths",
"array",
"."
] | beefc2d8ef523187e8cb1f3b41ba71fd0aeb49fe | https://github.com/devaloka/mu-plugin-installer/blob/beefc2d8ef523187e8cb1f3b41ba71fd0aeb49fe/src/Installer/MuPluginInstaller.php#L225-L234 | train |
devaloka/mu-plugin-installer | src/Installer/MuPluginInstaller.php | MuPluginInstaller.installLoader | protected function installLoader(PackageInterface $package)
{
$source = $this->getLoaderFilePackagePath($package);
$target = $this->getLoaderFileInstallPath($package);
copy($source, $target);
} | php | protected function installLoader(PackageInterface $package)
{
$source = $this->getLoaderFilePackagePath($package);
$target = $this->getLoaderFileInstallPath($package);
copy($source, $target);
} | [
"protected",
"function",
"installLoader",
"(",
"PackageInterface",
"$",
"package",
")",
"{",
"$",
"source",
"=",
"$",
"this",
"->",
"getLoaderFilePackagePath",
"(",
"$",
"package",
")",
";",
"$",
"target",
"=",
"$",
"this",
"->",
"getLoaderFileInstallPath",
"(... | Installs the loader script of an MU plugin.
@param PackageInterface $package An instance of PackageInterface. | [
"Installs",
"the",
"loader",
"script",
"of",
"an",
"MU",
"plugin",
"."
] | beefc2d8ef523187e8cb1f3b41ba71fd0aeb49fe | https://github.com/devaloka/mu-plugin-installer/blob/beefc2d8ef523187e8cb1f3b41ba71fd0aeb49fe/src/Installer/MuPluginInstaller.php#L251-L257 | train |
devaloka/mu-plugin-installer | src/Installer/MuPluginInstaller.php | MuPluginInstaller.removeLoader | protected function removeLoader(PackageInterface $package)
{
$target = $this->getLoaderFileInstallPath($package);
if (!$this->filesystem->remove($target)) {
throw new \RuntimeException('Could not completely delete ' . $target . ', aborting.');
}
} | php | protected function removeLoader(PackageInterface $package)
{
$target = $this->getLoaderFileInstallPath($package);
if (!$this->filesystem->remove($target)) {
throw new \RuntimeException('Could not completely delete ' . $target . ', aborting.');
}
} | [
"protected",
"function",
"removeLoader",
"(",
"PackageInterface",
"$",
"package",
")",
"{",
"$",
"target",
"=",
"$",
"this",
"->",
"getLoaderFileInstallPath",
"(",
"$",
"package",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"filesystem",
"->",
"remove",
"... | Removes the loader script of an MU plugin.
@param PackageInterface $package An instance of PackageInterface. | [
"Removes",
"the",
"loader",
"script",
"of",
"an",
"MU",
"plugin",
"."
] | beefc2d8ef523187e8cb1f3b41ba71fd0aeb49fe | https://github.com/devaloka/mu-plugin-installer/blob/beefc2d8ef523187e8cb1f3b41ba71fd0aeb49fe/src/Installer/MuPluginInstaller.php#L274-L281 | train |
pMatviienko/zf2-common | SbxCommon/src/SbxCommon/Form/View/Helper/Bootstrap/FormElement.php | FormElement.renderHelper | protected function renderHelper($name, ElementInterface $element)
{
$helper = $this->getView()->plugin($name);
return $helper($element);
} | php | protected function renderHelper($name, ElementInterface $element)
{
$helper = $this->getView()->plugin($name);
return $helper($element);
} | [
"protected",
"function",
"renderHelper",
"(",
"$",
"name",
",",
"ElementInterface",
"$",
"element",
")",
"{",
"$",
"helper",
"=",
"$",
"this",
"->",
"getView",
"(",
")",
"->",
"plugin",
"(",
"$",
"name",
")",
";",
"return",
"$",
"helper",
"(",
"$",
"... | Render element by helper name
@param string $name
@param ElementInterface $element
@return string | [
"Render",
"element",
"by",
"helper",
"name"
] | e59aa9b1eece72437cf0fd7c8466c0daeffcc481 | https://github.com/pMatviienko/zf2-common/blob/e59aa9b1eece72437cf0fd7c8466c0daeffcc481/SbxCommon/src/SbxCommon/Form/View/Helper/Bootstrap/FormElement.php#L79-L83 | train |
JamesMcAvoy/PsrRouter | src/PsrRouter.php | PsrRouter.getRoutes | public function getRoutes() : Array {
$return = array();
foreach($this->routes as $route) {
array_push($return, [$route->getPath(), $route->getMethod()]);
}
return $return;
} | php | public function getRoutes() : Array {
$return = array();
foreach($this->routes as $route) {
array_push($return, [$route->getPath(), $route->getMethod()]);
}
return $return;
} | [
"public",
"function",
"getRoutes",
"(",
")",
":",
"Array",
"{",
"$",
"return",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"{",
"array_push",
"(",
"$",
"return",
",",
"[",
"$",
"route",
"->",
... | Return all defined routes with their method
@return Array | [
"Return",
"all",
"defined",
"routes",
"with",
"their",
"method"
] | 00a3e15f8d1f87aef0eadde1074bea2179cd53fe | https://github.com/JamesMcAvoy/PsrRouter/blob/00a3e15f8d1f87aef0eadde1074bea2179cd53fe/src/PsrRouter.php#L141-L149 | train |
JamesMcAvoy/PsrRouter | src/PsrRouter.php | PsrRouter.get | public function get(String $path, Callable $callback) : Route {
return $this->collectRoute('GET', $path, $callback);
} | php | public function get(String $path, Callable $callback) : Route {
return $this->collectRoute('GET', $path, $callback);
} | [
"public",
"function",
"get",
"(",
"String",
"$",
"path",
",",
"Callable",
"$",
"callback",
")",
":",
"Route",
"{",
"return",
"$",
"this",
"->",
"collectRoute",
"(",
"'GET'",
",",
"$",
"path",
",",
"$",
"callback",
")",
";",
"}"
] | Create and collect a new Route with GET request
@param String $path
@param mixed $callback callback or closure function
@return Route | [
"Create",
"and",
"collect",
"a",
"new",
"Route",
"with",
"GET",
"request"
] | 00a3e15f8d1f87aef0eadde1074bea2179cd53fe | https://github.com/JamesMcAvoy/PsrRouter/blob/00a3e15f8d1f87aef0eadde1074bea2179cd53fe/src/PsrRouter.php#L177-L181 | train |
JamesMcAvoy/PsrRouter | src/PsrRouter.php | PsrRouter.post | public function post(String $path, Callable $callback) : Route {
return $this->collectRoute('POST', $path, $callback);
} | php | public function post(String $path, Callable $callback) : Route {
return $this->collectRoute('POST', $path, $callback);
} | [
"public",
"function",
"post",
"(",
"String",
"$",
"path",
",",
"Callable",
"$",
"callback",
")",
":",
"Route",
"{",
"return",
"$",
"this",
"->",
"collectRoute",
"(",
"'POST'",
",",
"$",
"path",
",",
"$",
"callback",
")",
";",
"}"
] | Create and collect a new Route with POST request
@param String $path
@param mixed $callback callback or closure function
@return Route | [
"Create",
"and",
"collect",
"a",
"new",
"Route",
"with",
"POST",
"request"
] | 00a3e15f8d1f87aef0eadde1074bea2179cd53fe | https://github.com/JamesMcAvoy/PsrRouter/blob/00a3e15f8d1f87aef0eadde1074bea2179cd53fe/src/PsrRouter.php#L189-L193 | train |
JamesMcAvoy/PsrRouter | src/PsrRouter.php | PsrRouter.put | public function put(String $path, Callable $callback) : Route {
return $this->collectRoute('PUT', $path, $callback);
} | php | public function put(String $path, Callable $callback) : Route {
return $this->collectRoute('PUT', $path, $callback);
} | [
"public",
"function",
"put",
"(",
"String",
"$",
"path",
",",
"Callable",
"$",
"callback",
")",
":",
"Route",
"{",
"return",
"$",
"this",
"->",
"collectRoute",
"(",
"'PUT'",
",",
"$",
"path",
",",
"$",
"callback",
")",
";",
"}"
] | Create and collect a new Route with PUT request
@param String $path
@param mixed $callback callback or closure function
@return Route | [
"Create",
"and",
"collect",
"a",
"new",
"Route",
"with",
"PUT",
"request"
] | 00a3e15f8d1f87aef0eadde1074bea2179cd53fe | https://github.com/JamesMcAvoy/PsrRouter/blob/00a3e15f8d1f87aef0eadde1074bea2179cd53fe/src/PsrRouter.php#L201-L205 | train |
JamesMcAvoy/PsrRouter | src/PsrRouter.php | PsrRouter.delete | public function delete(String $path, Callable $callback) : Route {
return $this->collectRoute('DELETE', $path, $callback);
} | php | public function delete(String $path, Callable $callback) : Route {
return $this->collectRoute('DELETE', $path, $callback);
} | [
"public",
"function",
"delete",
"(",
"String",
"$",
"path",
",",
"Callable",
"$",
"callback",
")",
":",
"Route",
"{",
"return",
"$",
"this",
"->",
"collectRoute",
"(",
"'DELETE'",
",",
"$",
"path",
",",
"$",
"callback",
")",
";",
"}"
] | Create and collect a new Route with DELETE request
@param String $path
@param mixed $callback callback or closure function
@return Route | [
"Create",
"and",
"collect",
"a",
"new",
"Route",
"with",
"DELETE",
"request"
] | 00a3e15f8d1f87aef0eadde1074bea2179cd53fe | https://github.com/JamesMcAvoy/PsrRouter/blob/00a3e15f8d1f87aef0eadde1074bea2179cd53fe/src/PsrRouter.php#L213-L217 | train |
JamesMcAvoy/PsrRouter | src/PsrRouter.php | PsrRouter.options | public function options(String $path, Callable $callback) : Route {
return $this->collectRoute('OPTIONS', $path, $callback);
} | php | public function options(String $path, Callable $callback) : Route {
return $this->collectRoute('OPTIONS', $path, $callback);
} | [
"public",
"function",
"options",
"(",
"String",
"$",
"path",
",",
"Callable",
"$",
"callback",
")",
":",
"Route",
"{",
"return",
"$",
"this",
"->",
"collectRoute",
"(",
"'OPTIONS'",
",",
"$",
"path",
",",
"$",
"callback",
")",
";",
"}"
] | Create and collect a new Route with OPTIONS request
@param String $path
@param mixed $callback callback or closure function
@return Route | [
"Create",
"and",
"collect",
"a",
"new",
"Route",
"with",
"OPTIONS",
"request"
] | 00a3e15f8d1f87aef0eadde1074bea2179cd53fe | https://github.com/JamesMcAvoy/PsrRouter/blob/00a3e15f8d1f87aef0eadde1074bea2179cd53fe/src/PsrRouter.php#L225-L229 | train |
JamesMcAvoy/PsrRouter | src/PsrRouter.php | PsrRouter.patch | public function patch(String $path, Callable $callback) : Route {
return $this->collectRoute('PATCH', $path, $callback);
} | php | public function patch(String $path, Callable $callback) : Route {
return $this->collectRoute('PATCH', $path, $callback);
} | [
"public",
"function",
"patch",
"(",
"String",
"$",
"path",
",",
"Callable",
"$",
"callback",
")",
":",
"Route",
"{",
"return",
"$",
"this",
"->",
"collectRoute",
"(",
"'PATCH'",
",",
"$",
"path",
",",
"$",
"callback",
")",
";",
"}"
] | Create and collect a new Route with PATCH request
@param String $path
@param mixed $callback callback or closure function
@return Route | [
"Create",
"and",
"collect",
"a",
"new",
"Route",
"with",
"PATCH",
"request"
] | 00a3e15f8d1f87aef0eadde1074bea2179cd53fe | https://github.com/JamesMcAvoy/PsrRouter/blob/00a3e15f8d1f87aef0eadde1074bea2179cd53fe/src/PsrRouter.php#L237-L241 | train |
mtils/cmsable | src/Cmsable/Resource/ResourceValidator.php | ResourceValidator.validateOrFail | public function validateOrFail(array $data, $model=null)
{
$this->publish('validating', [$this, $data, $model]);
$rules = $this->rules();
$parsedRules = $this->parseRules($rules, $data, $model);
$this->publish('validation-rules.parsed', [&$parsedRules]);
$validator = $th... | php | public function validateOrFail(array $data, $model=null)
{
$this->publish('validating', [$this, $data, $model]);
$rules = $this->rules();
$parsedRules = $this->parseRules($rules, $data, $model);
$this->publish('validation-rules.parsed', [&$parsedRules]);
$validator = $th... | [
"public",
"function",
"validateOrFail",
"(",
"array",
"$",
"data",
",",
"$",
"model",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"publish",
"(",
"'validating'",
",",
"[",
"$",
"this",
",",
"$",
"data",
",",
"$",
"model",
"]",
")",
";",
"$",
"rules",... | Validate the data. If validation failes, throw a exception
If a model is passed as the second parameter, parse the rules
to match the model. If no model is passed, considerate it as
a new model
@param array $data The (request) data
@param mixed $model (optional)
@return bool
@throw \Illuminate\Contracts\Validation\Val... | [
"Validate",
"the",
"data",
".",
"If",
"validation",
"failes",
"throw",
"a",
"exception",
"If",
"a",
"model",
"is",
"passed",
"as",
"the",
"second",
"parameter",
"parse",
"the",
"rules",
"to",
"match",
"the",
"model",
".",
"If",
"no",
"model",
"is",
"pass... | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Resource/ResourceValidator.php#L52-L72 | train |
mtils/cmsable | src/Cmsable/Resource/ResourceValidator.php | ResourceValidator.getValidatorInstance | protected function getValidatorInstance($rules, $data, $model=null)
{
$factory = $this->container->make('Illuminate\Validation\Factory');
if (method_exists($this, 'validatorInstance'))
{
return $this->container->call(
[$this, 'validatorInstance'],
... | php | protected function getValidatorInstance($rules, $data, $model=null)
{
$factory = $this->container->make('Illuminate\Validation\Factory');
if (method_exists($this, 'validatorInstance'))
{
return $this->container->call(
[$this, 'validatorInstance'],
... | [
"protected",
"function",
"getValidatorInstance",
"(",
"$",
"rules",
",",
"$",
"data",
",",
"$",
"model",
"=",
"null",
")",
"{",
"$",
"factory",
"=",
"$",
"this",
"->",
"container",
"->",
"make",
"(",
"'Illuminate\\Validation\\Factory'",
")",
";",
"if",
"("... | Get the validator instance to perform the actual validation
@return \Illuminate\Validation\Validator | [
"Get",
"the",
"validator",
"instance",
"to",
"perform",
"the",
"actual",
"validation"
] | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Resource/ResourceValidator.php#L89-L104 | train |
mtils/cmsable | src/Cmsable/Resource/ResourceValidator.php | ResourceValidator.customAttributes | public function customAttributes()
{
if (!$form = $this->distributor->form(null, $this->resourceName())){
return [];
}
return $form->getValidator()->buildAttributeNames($form);
} | php | public function customAttributes()
{
if (!$form = $this->distributor->form(null, $this->resourceName())){
return [];
}
return $form->getValidator()->buildAttributeNames($form);
} | [
"public",
"function",
"customAttributes",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"form",
"=",
"$",
"this",
"->",
"distributor",
"->",
"form",
"(",
"null",
",",
"$",
"this",
"->",
"resourceName",
"(",
")",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
... | Set custom attributes for validator errors.
@return array | [
"Set",
"custom",
"attributes",
"for",
"validator",
"errors",
"."
] | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Resource/ResourceValidator.php#L121-L128 | train |
rollerworks/search-core | Extension/Core/ChoiceList/ArrayChoiceList.php | ArrayChoiceList.flatten | private function flatten(array $choices, callable $value, &$choicesByValues, &$keysByValues, &$structuredValues): void
{
if (null === $choicesByValues) {
$choicesByValues = [];
$keysByValues = [];
$structuredValues = [];
}
foreach ($choices as $key => $ch... | php | private function flatten(array $choices, callable $value, &$choicesByValues, &$keysByValues, &$structuredValues): void
{
if (null === $choicesByValues) {
$choicesByValues = [];
$keysByValues = [];
$structuredValues = [];
}
foreach ($choices as $key => $ch... | [
"private",
"function",
"flatten",
"(",
"array",
"$",
"choices",
",",
"callable",
"$",
"value",
",",
"&",
"$",
"choicesByValues",
",",
"&",
"$",
"keysByValues",
",",
"&",
"$",
"structuredValues",
")",
":",
"void",
"{",
"if",
"(",
"null",
"===",
"$",
"ch... | Flattens an array into the given output variables.
@param array $choices The array to flatten
@param callable $value The callable for generating choice values
@param array|null $choicesByValues The flattened choices indexed by the
corresponding values
@param array|null $keysByValues The... | [
"Flattens",
"an",
"array",
"into",
"the",
"given",
"output",
"variables",
"."
] | 6b5671b8c4d6298906ded768261b0a59845140fb | https://github.com/rollerworks/search-core/blob/6b5671b8c4d6298906ded768261b0a59845140fb/Extension/Core/ChoiceList/ArrayChoiceList.php#L180-L200 | train |
kambalabs/KmbPuppetDb | src/KmbPuppetDb/Proxy/NodeProxy.php | NodeProxy.getFacts | public function getFacts()
{
if ($this->facts === null) {
$this->setFacts($this->nodeService->getNodeFacts($this->getName()));
}
return $this->facts;
} | php | public function getFacts()
{
if ($this->facts === null) {
$this->setFacts($this->nodeService->getNodeFacts($this->getName()));
}
return $this->facts;
} | [
"public",
"function",
"getFacts",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"facts",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"setFacts",
"(",
"$",
"this",
"->",
"nodeService",
"->",
"getNodeFacts",
"(",
"$",
"this",
"->",
"getName",
"(",
")",
... | Get facts.
@return array | [
"Get",
"facts",
"."
] | df56a275cf00f4402cf121a2e99149168f1f8b2d | https://github.com/kambalabs/KmbPuppetDb/blob/df56a275cf00f4402cf121a2e99149168f1f8b2d/src/KmbPuppetDb/Proxy/NodeProxy.php#L164-L170 | train |
kambalabs/KmbPuppetDb | src/KmbPuppetDb/Proxy/NodeProxy.php | NodeProxy.hasFact | public function hasFact($name)
{
if ($this->hasFacts() && array_key_exists($name, $this->facts)) {
return true;
}
return false;
} | php | public function hasFact($name)
{
if ($this->hasFacts() && array_key_exists($name, $this->facts)) {
return true;
}
return false;
} | [
"public",
"function",
"hasFact",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasFacts",
"(",
")",
"&&",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"facts",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"fals... | Determine if the node has the specified fact.
@param string $name
@return bool | [
"Determine",
"if",
"the",
"node",
"has",
"the",
"specified",
"fact",
"."
] | df56a275cf00f4402cf121a2e99149168f1f8b2d | https://github.com/kambalabs/KmbPuppetDb/blob/df56a275cf00f4402cf121a2e99149168f1f8b2d/src/KmbPuppetDb/Proxy/NodeProxy.php#L186-L192 | train |
covex-nn/JooS_Stream | src/JooS/Stream/Wrapper/FS/Changes.php | Wrapper_FS_Changes.get | public function get($path)
{
$entity = null;
$name = null;
$subtree = $this->subtree($path, $name);
if (!is_null($subtree) && isset($subtree->_ownData[$name])) {
$entity = $subtree->_ownData[$name];
}
return $entity;
} | php | public function get($path)
{
$entity = null;
$name = null;
$subtree = $this->subtree($path, $name);
if (!is_null($subtree) && isset($subtree->_ownData[$name])) {
$entity = $subtree->_ownData[$name];
}
return $entity;
} | [
"public",
"function",
"get",
"(",
"$",
"path",
")",
"{",
"$",
"entity",
"=",
"null",
";",
"$",
"name",
"=",
"null",
";",
"$",
"subtree",
"=",
"$",
"this",
"->",
"subtree",
"(",
"$",
"path",
",",
"$",
"name",
")",
";",
"if",
"(",
"!",
"is_null",... | Return stream entiry
@param string $path Path
@return Entity_Interface | [
"Return",
"stream",
"entiry"
] | e9841b804190a9f624b9e44caa0af7a18f3816d1 | https://github.com/covex-nn/JooS_Stream/blob/e9841b804190a9f624b9e44caa0af7a18f3816d1/src/JooS/Stream/Wrapper/FS/Changes.php#L43-L54 | train |
covex-nn/JooS_Stream | src/JooS/Stream/Wrapper/FS/Changes.php | Wrapper_FS_Changes.add | public function add($path, Entity_Interface $entity)
{
$result = false;
if (strlen($path)) {
$name = null;
$subtree = $this->subtree($path, $name, true);
$subtree->_ownData[$name] = $entity;
$result = true;
}
return $result;
} | php | public function add($path, Entity_Interface $entity)
{
$result = false;
if (strlen($path)) {
$name = null;
$subtree = $this->subtree($path, $name, true);
$subtree->_ownData[$name] = $entity;
$result = true;
}
return $result;
} | [
"public",
"function",
"add",
"(",
"$",
"path",
",",
"Entity_Interface",
"$",
"entity",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"strlen",
"(",
"$",
"path",
")",
")",
"{",
"$",
"name",
"=",
"null",
";",
"$",
"subtree",
"=",
"$",
"thi... | Add stream entity to changes array
@param string $path Path
@param Entity_Interface $entity Stream entity
@return boolean | [
"Add",
"stream",
"entity",
"to",
"changes",
"array"
] | e9841b804190a9f624b9e44caa0af7a18f3816d1 | https://github.com/covex-nn/JooS_Stream/blob/e9841b804190a9f624b9e44caa0af7a18f3816d1/src/JooS/Stream/Wrapper/FS/Changes.php#L64-L77 | train |
covex-nn/JooS_Stream | src/JooS/Stream/Wrapper/FS/Changes.php | Wrapper_FS_Changes.delete | public function delete($path)
{
$result = false;
$parts = $this->split($path);
$name = array_shift($parts);
if (!sizeof($parts)) {
if (isset($this->_ownData[$name])) {
unset($this->_ownData[$name]);
$result = true;
}
} elseif (isset($this->_subTrees[$name])) {
$s... | php | public function delete($path)
{
$result = false;
$parts = $this->split($path);
$name = array_shift($parts);
if (!sizeof($parts)) {
if (isset($this->_ownData[$name])) {
unset($this->_ownData[$name]);
$result = true;
}
} elseif (isset($this->_subTrees[$name])) {
$s... | [
"public",
"function",
"delete",
"(",
"$",
"path",
")",
"{",
"$",
"result",
"=",
"false",
";",
"$",
"parts",
"=",
"$",
"this",
"->",
"split",
"(",
"$",
"path",
")",
";",
"$",
"name",
"=",
"array_shift",
"(",
"$",
"parts",
")",
";",
"if",
"(",
"!... | Delete stream entity from array
@param string $path Path
@return boolean | [
"Delete",
"stream",
"entity",
"from",
"array"
] | e9841b804190a9f624b9e44caa0af7a18f3816d1 | https://github.com/covex-nn/JooS_Stream/blob/e9841b804190a9f624b9e44caa0af7a18f3816d1/src/JooS/Stream/Wrapper/FS/Changes.php#L86-L108 | train |
covex-nn/JooS_Stream | src/JooS/Stream/Wrapper/FS/Changes.php | Wrapper_FS_Changes.own | public function own($path = "")
{
if ($path) {
$parts = $this->split($path);
$name = array_shift($parts);
$own = array();
if (isset($this->_subTrees[$name])) {
$subtree = $this->_subTrees[$name];
/* @var $subtree Wrapper_FS_Changes */
$this->_appendChildren(
... | php | public function own($path = "")
{
if ($path) {
$parts = $this->split($path);
$name = array_shift($parts);
$own = array();
if (isset($this->_subTrees[$name])) {
$subtree = $this->_subTrees[$name];
/* @var $subtree Wrapper_FS_Changes */
$this->_appendChildren(
... | [
"public",
"function",
"own",
"(",
"$",
"path",
"=",
"\"\"",
")",
"{",
"if",
"(",
"$",
"path",
")",
"{",
"$",
"parts",
"=",
"$",
"this",
"->",
"split",
"(",
"$",
"path",
")",
";",
"$",
"name",
"=",
"array_shift",
"(",
"$",
"parts",
")",
";",
"... | Return subtree's own changes
@param string $path Path
@return array | [
"Return",
"subtree",
"s",
"own",
"changes"
] | e9841b804190a9f624b9e44caa0af7a18f3816d1 | https://github.com/covex-nn/JooS_Stream/blob/e9841b804190a9f624b9e44caa0af7a18f3816d1/src/JooS/Stream/Wrapper/FS/Changes.php#L142-L160 | train |
covex-nn/JooS_Stream | src/JooS/Stream/Wrapper/FS/Changes.php | Wrapper_FS_Changes._appendChildren | private function _appendChildren(array &$children, $name, array $_children)
{
foreach ($_children as $key => $value) {
$children[$name . "/" . $key] = $value;
}
} | php | private function _appendChildren(array &$children, $name, array $_children)
{
foreach ($_children as $key => $value) {
$children[$name . "/" . $key] = $value;
}
} | [
"private",
"function",
"_appendChildren",
"(",
"array",
"&",
"$",
"children",
",",
"$",
"name",
",",
"array",
"$",
"_children",
")",
"{",
"foreach",
"(",
"$",
"_children",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"children",
"[",
"$",
"na... | Add new children to array
@param array &$children Children array
@param string $name Current name
@param array $_children Children of subtrees
@return null | [
"Add",
"new",
"children",
"to",
"array"
] | e9841b804190a9f624b9e44caa0af7a18f3816d1 | https://github.com/covex-nn/JooS_Stream/blob/e9841b804190a9f624b9e44caa0af7a18f3816d1/src/JooS/Stream/Wrapper/FS/Changes.php#L205-L210 | train |
covex-nn/JooS_Stream | src/JooS/Stream/Wrapper/FS/Changes.php | Wrapper_FS_Changes.subtree | public function subtree($path, &$name, $create = false)
{
$parts = $this->split($path);
$_name = array_shift($parts);
if (!sizeof($parts)) {
$name = $_name;
$subtree = $this;
} else {
$exists = isset($this->_subTrees[$_name]);
if (!$exists && !$create) {
$subtree = nu... | php | public function subtree($path, &$name, $create = false)
{
$parts = $this->split($path);
$_name = array_shift($parts);
if (!sizeof($parts)) {
$name = $_name;
$subtree = $this;
} else {
$exists = isset($this->_subTrees[$_name]);
if (!$exists && !$create) {
$subtree = nu... | [
"public",
"function",
"subtree",
"(",
"$",
"path",
",",
"&",
"$",
"name",
",",
"$",
"create",
"=",
"false",
")",
"{",
"$",
"parts",
"=",
"$",
"this",
"->",
"split",
"(",
"$",
"path",
")",
";",
"$",
"_name",
"=",
"array_shift",
"(",
"$",
"parts",
... | Return subtree by path
@param string $path Path
@param string &$name Name of new element
@param boolean $create Auto create subtree ?
@return Wrapper_FS_Changes | [
"Return",
"subtree",
"by",
"path"
] | e9841b804190a9f624b9e44caa0af7a18f3816d1 | https://github.com/covex-nn/JooS_Stream/blob/e9841b804190a9f624b9e44caa0af7a18f3816d1/src/JooS/Stream/Wrapper/FS/Changes.php#L221-L244 | train |
covex-nn/JooS_Stream | src/JooS/Stream/Wrapper/FS/Changes.php | Wrapper_FS_Changes.split | protected function split($path)
{
if (is_array($path)) {
$parts = $path;
} else {
$parts = explode("/", $path);
}
return $parts;
} | php | protected function split($path)
{
if (is_array($path)) {
$parts = $path;
} else {
$parts = explode("/", $path);
}
return $parts;
} | [
"protected",
"function",
"split",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"path",
")",
")",
"{",
"$",
"parts",
"=",
"$",
"path",
";",
"}",
"else",
"{",
"$",
"parts",
"=",
"explode",
"(",
"\"/\"",
",",
"$",
"path",
")",
";",... | Split path into dir names
@param string $path Path
@return array | [
"Split",
"path",
"into",
"dir",
"names"
] | e9841b804190a9f624b9e44caa0af7a18f3816d1 | https://github.com/covex-nn/JooS_Stream/blob/e9841b804190a9f624b9e44caa0af7a18f3816d1/src/JooS/Stream/Wrapper/FS/Changes.php#L263-L271 | train |
eureka-framework/component-orm | src/Orm/DataMapper/DataAbstract.php | DataAbstract.isUpdated | public function isUpdated($property = null)
{
if (null === $property) {
return (count($this->updated) > 0);
}
return (isset($this->updated[$property]) && $this->updated[$property] === true);
} | php | public function isUpdated($property = null)
{
if (null === $property) {
return (count($this->updated) > 0);
}
return (isset($this->updated[$property]) && $this->updated[$property] === true);
} | [
"public",
"function",
"isUpdated",
"(",
"$",
"property",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"property",
")",
"{",
"return",
"(",
"count",
"(",
"$",
"this",
"->",
"updated",
")",
">",
"0",
")",
";",
"}",
"return",
"(",
"isset",
... | If at least one data has been updated.
If property name is specified, check only property.
@param string $property
@return bool | [
"If",
"at",
"least",
"one",
"data",
"has",
"been",
"updated",
".",
"If",
"property",
"name",
"is",
"specified",
"check",
"only",
"property",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/DataMapper/DataAbstract.php#L116-L123 | train |
eureka-framework/component-orm | src/Orm/DataMapper/DataAbstract.php | DataAbstract.initDependencyContainer | public function initDependencyContainer(Dependency\ContainerInterface $container = null)
{
if (null === $container) {
$container = Dependency\Container::getInstance();
}
$this->dependencyContainer = $container;
return $this;
} | php | public function initDependencyContainer(Dependency\ContainerInterface $container = null)
{
if (null === $container) {
$container = Dependency\Container::getInstance();
}
$this->dependencyContainer = $container;
return $this;
} | [
"public",
"function",
"initDependencyContainer",
"(",
"Dependency",
"\\",
"ContainerInterface",
"$",
"container",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"container",
")",
"{",
"$",
"container",
"=",
"Dependency",
"\\",
"Container",
"::",
"getIns... | Initialize dependency container.
@param Dependency\ContainerInterface $container
@return self | [
"Initialize",
"dependency",
"container",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/DataMapper/DataAbstract.php#L143-L152 | train |
mtils/cmsable | src/Cmsable/Mail/Mailer.php | Mailer.overwrite | public function overwrite($key, $value=null)
{
if (!is_array($key)) {
$this->overwrittenData[$key] = $value;
return $this;
}
foreach ($key as $k=>$v) {
$this->overwrite($k, $v);
}
return $this;
} | php | public function overwrite($key, $value=null)
{
if (!is_array($key)) {
$this->overwrittenData[$key] = $value;
return $this;
}
foreach ($key as $k=>$v) {
$this->overwrite($k, $v);
}
return $this;
} | [
"public",
"function",
"overwrite",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"overwrittenData",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"return"... | Overwrite one or more view variables
@param string|array $key
@param mixed $value (optional)
@return self | [
"Overwrite",
"one",
"or",
"more",
"view",
"variables"
] | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Mail/Mailer.php#L195-L207 | train |
mtils/cmsable | src/Cmsable/Mail/Mailer.php | Mailer.finalRecipients | protected function finalRecipients($passedTo)
{
if (!$this->overwrittenTo) {
return $passedTo;
}
$overwrittenTo = $this->overwrittenTo;
$this->overwrittenTo = [];
return $overwrittenTo;
} | php | protected function finalRecipients($passedTo)
{
if (!$this->overwrittenTo) {
return $passedTo;
}
$overwrittenTo = $this->overwrittenTo;
$this->overwrittenTo = [];
return $overwrittenTo;
} | [
"protected",
"function",
"finalRecipients",
"(",
"$",
"passedTo",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"overwrittenTo",
")",
"{",
"return",
"$",
"passedTo",
";",
"}",
"$",
"overwrittenTo",
"=",
"$",
"this",
"->",
"overwrittenTo",
";",
"$",
"this"... | Returns only the overwritten recipients or if non set the passed ones
@param array $passedTo
@return array | [
"Returns",
"only",
"the",
"overwritten",
"recipients",
"or",
"if",
"non",
"set",
"the",
"passed",
"ones"
] | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Mail/Mailer.php#L254-L263 | train |
mtils/cmsable | src/Cmsable/Mail/Mailer.php | Mailer.finalView | protected function finalView($passedView)
{
if (!$this->overwrittenView ) {
return $passedView;
}
$overwrittenView = $this->overwrittenView;
$this->overwrittenView = '';
if (!is_array($overwrittenView) && !is_array($passedView)) {
return $overwritte... | php | protected function finalView($passedView)
{
if (!$this->overwrittenView ) {
return $passedView;
}
$overwrittenView = $this->overwrittenView;
$this->overwrittenView = '';
if (!is_array($overwrittenView) && !is_array($passedView)) {
return $overwritte... | [
"protected",
"function",
"finalView",
"(",
"$",
"passedView",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"overwrittenView",
")",
"{",
"return",
"$",
"passedView",
";",
"}",
"$",
"overwrittenView",
"=",
"$",
"this",
"->",
"overwrittenView",
";",
"$",
"t... | Returns the overwritten view if one set, otherwise the passed one
@param string|array $passedView
@return string|array | [
"Returns",
"the",
"overwritten",
"view",
"if",
"one",
"set",
"otherwise",
"the",
"passed",
"one"
] | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Mail/Mailer.php#L271-L295 | train |
mtils/cmsable | src/Cmsable/Mail/Mailer.php | Mailer.finalData | protected function finalData($passedData)
{
$overwrittenData = $this->overwrittenData;
$this->overwrittenData = [];
foreach ($overwrittenData as $key=>$value) {
$passedData[$key] = $value;
}
return $passedData;
} | php | protected function finalData($passedData)
{
$overwrittenData = $this->overwrittenData;
$this->overwrittenData = [];
foreach ($overwrittenData as $key=>$value) {
$passedData[$key] = $value;
}
return $passedData;
} | [
"protected",
"function",
"finalData",
"(",
"$",
"passedData",
")",
"{",
"$",
"overwrittenData",
"=",
"$",
"this",
"->",
"overwrittenData",
";",
"$",
"this",
"->",
"overwrittenData",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"overwrittenData",
"as",
"$",
"ke... | Merges the passed view data with the assigned one
@param array $passedData
@return array | [
"Merges",
"the",
"passed",
"view",
"data",
"with",
"the",
"assigned",
"one"
] | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Mail/Mailer.php#L303-L315 | train |
mtils/cmsable | src/Cmsable/Mail/Mailer.php | Mailer.flushRecipients | protected function flushRecipients($closure)
{
$recipients = (array)$this->temporaryTo;
$this->temporaryTo = null;
if(!$recipients && !is_callable($closure)){
throw new BadMethodCallException('Recipient not determinable: Neither a recipient was set by to() nor a callable was pas... | php | protected function flushRecipients($closure)
{
$recipients = (array)$this->temporaryTo;
$this->temporaryTo = null;
if(!$recipients && !is_callable($closure)){
throw new BadMethodCallException('Recipient not determinable: Neither a recipient was set by to() nor a callable was pas... | [
"protected",
"function",
"flushRecipients",
"(",
"$",
"closure",
")",
"{",
"$",
"recipients",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"temporaryTo",
";",
"$",
"this",
"->",
"temporaryTo",
"=",
"null",
";",
"if",
"(",
"!",
"$",
"recipients",
"&&",
"!... | Returns the recipients and clears em
@param callable $closure
@return array | [
"Returns",
"the",
"recipients",
"and",
"clears",
"em"
] | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Mail/Mailer.php#L323-L333 | train |
mtils/cmsable | src/Cmsable/Mail/Mailer.php | Mailer.createBuilder | protected function createBuilder(array $recipients, $data, $callback)
{
$messageBuilder = new MessageBuilder($recipients, $data, $callback);
if ($developerTo = $this->config->get('mail.overwrite_to')) {
$messageBuilder->setOverwriteTo($developerTo);
}
return $messageBui... | php | protected function createBuilder(array $recipients, $data, $callback)
{
$messageBuilder = new MessageBuilder($recipients, $data, $callback);
if ($developerTo = $this->config->get('mail.overwrite_to')) {
$messageBuilder->setOverwriteTo($developerTo);
}
return $messageBui... | [
"protected",
"function",
"createBuilder",
"(",
"array",
"$",
"recipients",
",",
"$",
"data",
",",
"$",
"callback",
")",
"{",
"$",
"messageBuilder",
"=",
"new",
"MessageBuilder",
"(",
"$",
"recipients",
",",
"$",
"data",
",",
"$",
"callback",
")",
";",
"i... | Create the pseudo closure creator
@param array $recipients
@param array $data
@param callable|null $callback
@return \Cmsable\Mail\MessageBuilder | [
"Create",
"the",
"pseudo",
"closure",
"creator"
] | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Mail/Mailer.php#L343-L352 | train |
mtils/cmsable | src/Cmsable/Mail/Mailer.php | Mailer.parseTexts | protected function parseTexts(array $data)
{
foreach ($this->parseKeys as $key) {
if (!isset($data[$key]) || !is_string($data[$key])) {
continue;
}
$data[$key] = $this->textParser->parse($data[$key], $data);
}
return $data;
} | php | protected function parseTexts(array $data)
{
foreach ($this->parseKeys as $key) {
if (!isset($data[$key]) || !is_string($data[$key])) {
continue;
}
$data[$key] = $this->textParser->parse($data[$key], $data);
}
return $data;
} | [
"protected",
"function",
"parseTexts",
"(",
"array",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"parseKeys",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"[",
"$",
"key",
"]",
")",
"||",
"!",
"is_string",
... | Parse all keys that have to be parsed by text parser
@param array $data
@return array | [
"Parse",
"all",
"keys",
"that",
"have",
"to",
"be",
"parsed",
"by",
"text",
"parser"
] | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Mail/Mailer.php#L360-L373 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/stores/MemcacheCacheStore.php | MemcacheCacheStore.getConnection | protected function getConnection()
{
if (empty($this->memcache)) {
//ini_set('memcache.chunk_size', 32768);
//ini_set('memcache.allow_failover', false); // default is usually true
//ini_set('memcache.hash_strategy', 'consistent');
$this->memcache = new Memca... | php | protected function getConnection()
{
if (empty($this->memcache)) {
//ini_set('memcache.chunk_size', 32768);
//ini_set('memcache.allow_failover', false); // default is usually true
//ini_set('memcache.hash_strategy', 'consistent');
$this->memcache = new Memca... | [
"protected",
"function",
"getConnection",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"memcache",
")",
")",
"{",
"//ini_set('memcache.chunk_size', 32768);",
"//ini_set('memcache.allow_failover', false); // default is usually true",
"//ini_set('memcache.hash_strat... | Returns a connection to the memcached server
@return Memcache an active Memcache object | [
"Returns",
"a",
"connection",
"to",
"the",
"memcached",
"server"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/stores/MemcacheCacheStore.php#L143-L182 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/stores/MemcacheCacheStore.php | MemcacheCacheStore.getStats | public function getStats()
{
if (!$this->enabled)
return array();
$stats = @$this->getConnection()->getStats();
$this->Logger->debug('Retrieved Stats');
$this->Logger->debug($stats);
return $stats;
} | php | public function getStats()
{
if (!$this->enabled)
return array();
$stats = @$this->getConnection()->getStats();
$this->Logger->debug('Retrieved Stats');
$this->Logger->debug($stats);
return $stats;
} | [
"public",
"function",
"getStats",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"enabled",
")",
"return",
"array",
"(",
")",
";",
"$",
"stats",
"=",
"@",
"$",
"this",
"->",
"getConnection",
"(",
")",
"->",
"getStats",
"(",
")",
";",
"$",
"thi... | Implementation specific array of statistics
@return array An associative array of statistics, determined by the
implementation | [
"Implementation",
"specific",
"array",
"of",
"statistics"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/stores/MemcacheCacheStore.php#L434-L445 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/stores/MemcacheCacheStore.php | MemcacheCacheStore.increment | public function increment($key, $step = 1)
{
if (!$this->enabled)
return false;
$has_replaced = $has_set = false;
try {
// Store the cache object
$nKey = $this->key($key);
$has_replaced = @$this->getConnection()->add($nKey, $step, 0);
... | php | public function increment($key, $step = 1)
{
if (!$this->enabled)
return false;
$has_replaced = $has_set = false;
try {
// Store the cache object
$nKey = $this->key($key);
$has_replaced = @$this->getConnection()->add($nKey, $step, 0);
... | [
"public",
"function",
"increment",
"(",
"$",
"key",
",",
"$",
"step",
"=",
"1",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"enabled",
")",
"return",
"false",
";",
"$",
"has_replaced",
"=",
"$",
"has_set",
"=",
"false",
";",
"try",
"{",
"// Store ... | Increment a value in the cache store
@param string $key Cache key associated to the data
@param int $step Number to increment by
@return int New value on success or FALSE on failure
@throws CacheException | [
"Increment",
"a",
"value",
"in",
"the",
"cache",
"store"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/stores/MemcacheCacheStore.php#L494-L516 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/stores/MemcacheCacheStore.php | MemcacheCacheStore.decrement | public function decrement($key, $step = 1)
{
if (!$this->enabled)
return false;
$has_replaced = $has_set = false;
try {
// Store the cache object
$nKey = $this->key($key);
$has_set = @$this->getConnection()->decrement($nKey, $step);
}... | php | public function decrement($key, $step = 1)
{
if (!$this->enabled)
return false;
$has_replaced = $has_set = false;
try {
// Store the cache object
$nKey = $this->key($key);
$has_set = @$this->getConnection()->decrement($nKey, $step);
}... | [
"public",
"function",
"decrement",
"(",
"$",
"key",
",",
"$",
"step",
"=",
"1",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"enabled",
")",
"return",
"false",
";",
"$",
"has_replaced",
"=",
"$",
"has_set",
"=",
"false",
";",
"try",
"{",
"// Store ... | Decrement a value in the cache store
@param string $key Cache key associated to the data
@param int $step Number to decrement by
@return int New value on success or FALSE on failure
@throws CacheException | [
"Decrement",
"a",
"value",
"in",
"the",
"cache",
"store"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/stores/MemcacheCacheStore.php#L527-L547 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/stores/MemcacheCacheStore.php | MemcacheCacheStore.getIncrement | public function getIncrement($key)
{
if (!$this->enabled)
return false;
return @$this->getConnection()->get($this->key($key));
} | php | public function getIncrement($key)
{
if (!$this->enabled)
return false;
return @$this->getConnection()->get($this->key($key));
} | [
"public",
"function",
"getIncrement",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"enabled",
")",
"return",
"false",
";",
"return",
"@",
"$",
"this",
"->",
"getConnection",
"(",
")",
"->",
"get",
"(",
"$",
"this",
"->",
"key",
"("... | Get incremented value in the cache store
@param string $key Cache key associated to the data
@return int Stored value on success or FALSE on failure
@throws CacheException | [
"Get",
"incremented",
"value",
"in",
"the",
"cache",
"store"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/stores/MemcacheCacheStore.php#L558-L565 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/stores/MemcacheCacheStore.php | MemcacheCacheStore.add | public function add($key, $data, $ttl)
{
if (!$this->enabled)
return true;
try {
$data = $this->storageFormat($key, $data, $ttl);
$nKey = $this->key($key);
// Store the cache object
$ret = @$this->getConnection()->add($nKey, $data, $this-... | php | public function add($key, $data, $ttl)
{
if (!$this->enabled)
return true;
try {
$data = $this->storageFormat($key, $data, $ttl);
$nKey = $this->key($key);
// Store the cache object
$ret = @$this->getConnection()->add($nKey, $data, $this-... | [
"public",
"function",
"add",
"(",
"$",
"key",
",",
"$",
"data",
",",
"$",
"ttl",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"enabled",
")",
"return",
"true",
";",
"try",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"storageFormat",
"(",
"$",
"ke... | Stores data into the cache store by key, with a given timeout in seconds
UNLESS an entry already exists under that key.
The implementation must support native serialization of objects and arrays
so that the caller does not need to serialize manually.
@param string $key Cache key associated to the data
@param mixed $... | [
"Stores",
"data",
"into",
"the",
"cache",
"store",
"by",
"key",
"with",
"a",
"given",
"timeout",
"in",
"seconds",
"UNLESS",
"an",
"entry",
"already",
"exists",
"under",
"that",
"key",
".",
"The",
"implementation",
"must",
"support",
"native",
"serialization",
... | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/stores/MemcacheCacheStore.php#L582-L601 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/router/Router.php | Router.route | public function route()
{
$this->Logger->debug("Request: {$this->Request->getFullURL()}");
$uri = $this->Request->getAdjustedRequestURI();
// $uri = $this->sanitizeURI($uri);
$this->Logger->debug("Routing URI: {$uri}");
$result = array();
$qs = array_merge($_POST... | php | public function route()
{
$this->Logger->debug("Request: {$this->Request->getFullURL()}");
$uri = $this->Request->getAdjustedRequestURI();
// $uri = $this->sanitizeURI($uri);
$this->Logger->debug("Routing URI: {$uri}");
$result = array();
$qs = array_merge($_POST... | [
"public",
"function",
"route",
"(",
")",
"{",
"$",
"this",
"->",
"Logger",
"->",
"debug",
"(",
"\"Request: {$this->Request->getFullURL()}\"",
")",
";",
"$",
"uri",
"=",
"$",
"this",
"->",
"Request",
"->",
"getAdjustedRequestURI",
"(",
")",
";",
"// $uri... | Returns an array that describes the result of the current route.
The resultant array will contain keys like 'view', and 'paging', etc.
For full details, see the routes file as the array is built from that.
@return array | [
"Returns",
"an",
"array",
"that",
"describes",
"the",
"result",
"of",
"the",
"current",
"route",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/router/Router.php#L119-L198 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/router/Router.php | Router.checkRedirects | public function checkRedirects()
{
// remove trailing slash and lowercase so there aren't multiple copies to cache
$uri = strtolower(rtrim($this->Request->getAdjustedRequestURI(), '/'));
$qs = $this->Request->getQueryString();
if (($previousRedirect = $this->TemplateCache->get('redi... | php | public function checkRedirects()
{
// remove trailing slash and lowercase so there aren't multiple copies to cache
$uri = strtolower(rtrim($this->Request->getAdjustedRequestURI(), '/'));
$qs = $this->Request->getQueryString();
if (($previousRedirect = $this->TemplateCache->get('redi... | [
"public",
"function",
"checkRedirects",
"(",
")",
"{",
"// remove trailing slash and lowercase so there aren't multiple copies to cache",
"$",
"uri",
"=",
"strtolower",
"(",
"rtrim",
"(",
"$",
"this",
"->",
"Request",
"->",
"getAdjustedRequestURI",
"(",
")",
",",
"'/'",... | Checks the redirects against the current URI and redirects the user's browser
if they've hit a redirect URL
@return void | [
"Checks",
"the",
"redirects",
"against",
"the",
"current",
"URI",
"and",
"redirects",
"the",
"user",
"s",
"browser",
"if",
"they",
"ve",
"hit",
"a",
"redirect",
"URL"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/router/Router.php#L220-L270 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Message/Response.php | Response.handleOptions | protected function handleOptions(array &$options = [])
{
parent::handleOptions($options);
if (isset($options['reason_phrase'])) {
$this->reasonPhrase = $options['reason_phrase'];
}
} | php | protected function handleOptions(array &$options = [])
{
parent::handleOptions($options);
if (isset($options['reason_phrase'])) {
$this->reasonPhrase = $options['reason_phrase'];
}
} | [
"protected",
"function",
"handleOptions",
"(",
"array",
"&",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"parent",
"::",
"handleOptions",
"(",
"$",
"options",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'reason_phrase'",
"]",
")",
")",
"{",
... | Accepts and modifies the options provided to the response in the
constructor.
@param array $options Options array passed by reference. | [
"Accepts",
"and",
"modifies",
"the",
"options",
"provided",
"to",
"the",
"response",
"in",
"the",
"constructor",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Message/Response.php#L193-L199 | train |
phossa/phossa-event | src/Phossa/Event/Interfaces/EventManagerTrait.php | EventManagerTrait.runEventQueue | protected function runEventQueue(
EventInterface $event,
EventQueueInterface $queue,
callable $callback = null
)/*# : EventManagerInterface */ {
try {
foreach ($queue as $data) {
// execute each callable from the queue
$res = call_user_func... | php | protected function runEventQueue(
EventInterface $event,
EventQueueInterface $queue,
callable $callback = null
)/*# : EventManagerInterface */ {
try {
foreach ($queue as $data) {
// execute each callable from the queue
$res = call_user_func... | [
"protected",
"function",
"runEventQueue",
"(",
"EventInterface",
"$",
"event",
",",
"EventQueueInterface",
"$",
"queue",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"/*# : EventManagerInterface */",
"{",
"try",
"{",
"foreach",
"(",
"$",
"queue",
"as",
"$... | Run an event with the provided queue
The $callback defined as `function($event, $response) {}`, where
$reponse is the return value from previous event handler.
@param EventInterface $event
@param EventQueueInterface $queue
@param callable $callback (optional) a callback returns bool
@return EventManagerInterface t... | [
"Run",
"an",
"event",
"with",
"the",
"provided",
"queue"
] | 0044888fcc9b21584233c73cf20fc160e1b1f295 | https://github.com/phossa/phossa-event/blob/0044888fcc9b21584233c73cf20fc160e1b1f295/src/Phossa/Event/Interfaces/EventManagerTrait.php#L197-L237 | train |
phossa/phossa-event | src/Phossa/Event/Interfaces/EventManagerTrait.php | EventManagerTrait.isListener | protected function isListener($listener)/*# : bool */
{
// object
if (is_object($listener) &&
$listener instanceof EventListenerInterface) {
return true;
}
// static class name
if (is_string($listener) &&
is_a(
$listener,
... | php | protected function isListener($listener)/*# : bool */
{
// object
if (is_object($listener) &&
$listener instanceof EventListenerInterface) {
return true;
}
// static class name
if (is_string($listener) &&
is_a(
$listener,
... | [
"protected",
"function",
"isListener",
"(",
"$",
"listener",
")",
"/*# : bool */",
"{",
"// object",
"if",
"(",
"is_object",
"(",
"$",
"listener",
")",
"&&",
"$",
"listener",
"instanceof",
"EventListenerInterface",
")",
"{",
"return",
"true",
";",
"}",
"// sta... | Test if it is a valid listener
@param EventListenerInterface|string $listener object/static class name
@return bool
@access protected | [
"Test",
"if",
"it",
"is",
"a",
"valid",
"listener"
] | 0044888fcc9b21584233c73cf20fc160e1b1f295 | https://github.com/phossa/phossa-event/blob/0044888fcc9b21584233c73cf20fc160e1b1f295/src/Phossa/Event/Interfaces/EventManagerTrait.php#L246-L265 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.