id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
231,100 | cygnite/framework | src/Cygnite/Validation/Validator.php | Validator.hasError | public function hasError($key) : bool
{
return isset($this->errors[$key.self::ERROR]) ? true : false;
} | php | public function hasError($key) : bool
{
return isset($this->errors[$key.self::ERROR]) ? true : false;
} | [
"public",
"function",
"hasError",
"(",
"$",
"key",
")",
":",
"bool",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"errors",
"[",
"$",
"key",
".",
"self",
"::",
"ERROR",
"]",
")",
"?",
"true",
":",
"false",
";",
"}"
] | Check if validation error exists for particular input element.
@param $key
@return bool | [
"Check",
"if",
"validation",
"error",
"exists",
"for",
"particular",
"input",
"element",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Validation/Validator.php#L906-L909 |
231,101 | inetprocess/libsugarcrm | src/Database/Metadata.php | Metadata.loadFromFile | public function loadFromFile()
{
$this->getLogger()->debug('Reading metadata from ' . $this->defFile);
$fields = Yaml::parse($this->defFile);
if (!is_array($fields)) {
$fields = array();
$this->getLogger()->warning('No definition found in metadata file.');
}
$res = array();
foreach ($fields as $field_data) {
$res[$field_data['id']] = $field_data;
}
ksort($res);
return $res;
} | php | public function loadFromFile()
{
$this->getLogger()->debug('Reading metadata from ' . $this->defFile);
$fields = Yaml::parse($this->defFile);
if (!is_array($fields)) {
$fields = array();
$this->getLogger()->warning('No definition found in metadata file.');
}
$res = array();
foreach ($fields as $field_data) {
$res[$field_data['id']] = $field_data;
}
ksort($res);
return $res;
} | [
"public",
"function",
"loadFromFile",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"debug",
"(",
"'Reading metadata from '",
".",
"$",
"this",
"->",
"defFile",
")",
";",
"$",
"fields",
"=",
"Yaml",
"::",
"parse",
"(",
"$",
"this",
"->... | Fetch metadata array from the definition file | [
"Fetch",
"metadata",
"array",
"from",
"the",
"definition",
"file"
] | 493bb105c29996dc583181431fcb0987fd1fed70 | https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Database/Metadata.php#L48-L62 |
231,102 | franzliedke/lti | src/OAuth/Signer.php | Signer.sign | public function sign(RequestInterface $request)
{
$oAuthParams = array_merge(
$this->getDefaultOAuthParams(),
['oauth_signature_method' => $this->signatureMethod->getName()]
);
$oAuthParams['oauth_signature'] = $this->signatureMethod->buildSignature(
$request,
$oAuthParams,
$this->consumer,
$this->token
);
return $request->withHeader(
'authorization',
$this->buildAuthorizationHeader($oAuthParams)
);
} | php | public function sign(RequestInterface $request)
{
$oAuthParams = array_merge(
$this->getDefaultOAuthParams(),
['oauth_signature_method' => $this->signatureMethod->getName()]
);
$oAuthParams['oauth_signature'] = $this->signatureMethod->buildSignature(
$request,
$oAuthParams,
$this->consumer,
$this->token
);
return $request->withHeader(
'authorization',
$this->buildAuthorizationHeader($oAuthParams)
);
} | [
"public",
"function",
"sign",
"(",
"RequestInterface",
"$",
"request",
")",
"{",
"$",
"oAuthParams",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"getDefaultOAuthParams",
"(",
")",
",",
"[",
"'oauth_signature_method'",
"=>",
"$",
"this",
"->",
"signatureMethod",
... | Sign the given request and return the signed request.
@param RequestInterface $request
@return RequestInterface | [
"Sign",
"the",
"given",
"request",
"and",
"return",
"the",
"signed",
"request",
"."
] | 131cf331f2cb87fcc29049ac739c8751e9e5133b | https://github.com/franzliedke/lti/blob/131cf331f2cb87fcc29049ac739c8751e9e5133b/src/OAuth/Signer.php#L38-L56 |
231,103 | cygnite/framework | src/Cygnite/Common/SessionManager/Session.php | Session.factory | public function factory()
{
$method = $class = null;
$class = __NAMESPACE__.'\\'.$this->drivers[$this->config['driver']];
$name = $this->getName();
if ($name != 'cygnite-session' && !is_null($this->cacheLimiter())) {
$session = new $class($name, $this->cacheLimiter(), $this);
} else {
$session = new $class($this->name, null, $this);
}
return $session;
} | php | public function factory()
{
$method = $class = null;
$class = __NAMESPACE__.'\\'.$this->drivers[$this->config['driver']];
$name = $this->getName();
if ($name != 'cygnite-session' && !is_null($this->cacheLimiter())) {
$session = new $class($name, $this->cacheLimiter(), $this);
} else {
$session = new $class($this->name, null, $this);
}
return $session;
} | [
"public",
"function",
"factory",
"(",
")",
"{",
"$",
"method",
"=",
"$",
"class",
"=",
"null",
";",
"$",
"class",
"=",
"__NAMESPACE__",
".",
"'\\\\'",
".",
"$",
"this",
"->",
"drivers",
"[",
"$",
"this",
"->",
"config",
"[",
"'driver'",
"]",
"]",
"... | Factory method. We will get the session driver and call methods.
@param $args
@return mixed | [
"Factory",
"method",
".",
"We",
"will",
"get",
"the",
"session",
"driver",
"and",
"call",
"methods",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Common/SessionManager/Session.php#L137-L150 |
231,104 | bpolaszek/querystring | src/QueryString.php | QueryString.getPairs | public function getPairs(bool $decodeKeys = false, bool $decodeValues = false): Traversable
{
return new Pairs((string) $this, $decodeKeys, $decodeValues, $this->getRenderer()->getSeparator());
} | php | public function getPairs(bool $decodeKeys = false, bool $decodeValues = false): Traversable
{
return new Pairs((string) $this, $decodeKeys, $decodeValues, $this->getRenderer()->getSeparator());
} | [
"public",
"function",
"getPairs",
"(",
"bool",
"$",
"decodeKeys",
"=",
"false",
",",
"bool",
"$",
"decodeValues",
"=",
"false",
")",
":",
"Traversable",
"{",
"return",
"new",
"Pairs",
"(",
"(",
"string",
")",
"$",
"this",
",",
"$",
"decodeKeys",
",",
"... | Yield key => value pairs.
@param bool $decodeKeys
@param bool $decodeValues
@return Traversable | [
"Yield",
"key",
"=",
">",
"value",
"pairs",
"."
] | 159f36755794c2e3f6bb418890f4dcbd7157ad9b | https://github.com/bpolaszek/querystring/blob/159f36755794c2e3f6bb418890f4dcbd7157ad9b/src/QueryString.php#L160-L163 |
231,105 | ctbsea/phalapi-smarty | src/Smarty/sysplugins/smarty_template_cached.php | Smarty_Template_Cached.render | public function render(Smarty_Internal_Template $_template, $no_output_filter = true)
{
if ($this->isCached($_template)) {
if ($_template->smarty->debugging) {
$_template->smarty->_debug->start_cache($_template);
}
if (!$this->processed) {
$this->process($_template);
}
$this->getRenderedTemplateCode($_template);
if ($_template->smarty->debugging) {
$_template->smarty->_debug->end_cache($_template);
}
return;
} else {
$_template->smarty->ext->_updateCache->updateCache($this, $_template, $no_output_filter);
}
} | php | public function render(Smarty_Internal_Template $_template, $no_output_filter = true)
{
if ($this->isCached($_template)) {
if ($_template->smarty->debugging) {
$_template->smarty->_debug->start_cache($_template);
}
if (!$this->processed) {
$this->process($_template);
}
$this->getRenderedTemplateCode($_template);
if ($_template->smarty->debugging) {
$_template->smarty->_debug->end_cache($_template);
}
return;
} else {
$_template->smarty->ext->_updateCache->updateCache($this, $_template, $no_output_filter);
}
} | [
"public",
"function",
"render",
"(",
"Smarty_Internal_Template",
"$",
"_template",
",",
"$",
"no_output_filter",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isCached",
"(",
"$",
"_template",
")",
")",
"{",
"if",
"(",
"$",
"_template",
"->",
"sm... | Render cache template
@param \Smarty_Internal_Template $_template
@param bool $no_output_filter
@throws \Exception | [
"Render",
"cache",
"template"
] | 4d40da3e4482c0749f3cfd1605265a109a1c495f | https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_template_cached.php#L117-L134 |
231,106 | ctbsea/phalapi-smarty | src/Smarty/sysplugins/smarty_template_cached.php | Smarty_Template_Cached.process | public function process(Smarty_Internal_Template $_template, $update = false)
{
if ($this->handler->process($_template, $this, $update) === false) {
$this->valid = false;
}
if ($this->valid) {
$this->processed = true;
} else {
$this->processed = false;
}
} | php | public function process(Smarty_Internal_Template $_template, $update = false)
{
if ($this->handler->process($_template, $this, $update) === false) {
$this->valid = false;
}
if ($this->valid) {
$this->processed = true;
} else {
$this->processed = false;
}
} | [
"public",
"function",
"process",
"(",
"Smarty_Internal_Template",
"$",
"_template",
",",
"$",
"update",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"handler",
"->",
"process",
"(",
"$",
"_template",
",",
"$",
"this",
",",
"$",
"update",
")",
... | Process cached template
@param Smarty_Internal_Template $_template template object
@param bool $update flag if called because cache update | [
"Process",
"cached",
"template"
] | 4d40da3e4482c0749f3cfd1605265a109a1c495f | https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_template_cached.php#L220-L230 |
231,107 | ctbsea/phalapi-smarty | src/Smarty/sysplugins/smarty_template_cached.php | Smarty_Template_Cached.read | public function read(Smarty_Internal_Template $_template)
{
if (!$_template->source->handler->recompiled) {
return $this->handler->readCachedContent($_template);
}
return false;
} | php | public function read(Smarty_Internal_Template $_template)
{
if (!$_template->source->handler->recompiled) {
return $this->handler->readCachedContent($_template);
}
return false;
} | [
"public",
"function",
"read",
"(",
"Smarty_Internal_Template",
"$",
"_template",
")",
"{",
"if",
"(",
"!",
"$",
"_template",
"->",
"source",
"->",
"handler",
"->",
"recompiled",
")",
"{",
"return",
"$",
"this",
"->",
"handler",
"->",
"readCachedContent",
"("... | Read cache content from handler
@param Smarty_Internal_Template $_template template object
@return string content | [
"Read",
"cache",
"content",
"from",
"handler"
] | 4d40da3e4482c0749f3cfd1605265a109a1c495f | https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_template_cached.php#L239-L245 |
231,108 | cygnite/framework | src/Cygnite/Cache/Storage/MemcachedConnector.php | MemcachedConnector.create | public function create(array $servers)
{
if (empty($servers)) {
throw new \RuntimeException(sprintf('Empty configuration passed to %s::create() method.', __CLASS__));
}
foreach ($servers as $server) {
$this->memcached->addServer(
$server['host'], $server['port'], $server['weight']
);
}
$status = $this->memcached->getVersion();
if (in_array('255.255.255', $status) && count(array_unique($status)) === 1) {
throw new \RuntimeException('Could not establish Memcached connection.');
}
return $this->memcached;
} | php | public function create(array $servers)
{
if (empty($servers)) {
throw new \RuntimeException(sprintf('Empty configuration passed to %s::create() method.', __CLASS__));
}
foreach ($servers as $server) {
$this->memcached->addServer(
$server['host'], $server['port'], $server['weight']
);
}
$status = $this->memcached->getVersion();
if (in_array('255.255.255', $status) && count(array_unique($status)) === 1) {
throw new \RuntimeException('Could not establish Memcached connection.');
}
return $this->memcached;
} | [
"public",
"function",
"create",
"(",
"array",
"$",
"servers",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"servers",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"sprintf",
"(",
"'Empty configuration passed to %s::create() method.'",
",",
"__CLASS__... | Connect Memcached based on its host, port, weight.
@false string $host
@false mix $port
@param array $servers
@throws \RuntimeException
@internal param string $host
@internal param string $port
@return void | [
"Connect",
"Memcached",
"based",
"on",
"its",
"host",
"port",
"weight",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Cache/Storage/MemcachedConnector.php#L53-L72 |
231,109 | dshafik/guzzlehttp-vcr | src/VcrHandler.php | VcrHandler.decodeResponses | protected static function decodeResponses($cassette)
{
$responses = json_decode(file_get_contents($cassette), true);
array_walk($responses, function(&$response){
$response['body'] = base64_decode($response['body']);
});
return $responses;
} | php | protected static function decodeResponses($cassette)
{
$responses = json_decode(file_get_contents($cassette), true);
array_walk($responses, function(&$response){
$response['body'] = base64_decode($response['body']);
});
return $responses;
} | [
"protected",
"static",
"function",
"decodeResponses",
"(",
"$",
"cassette",
")",
"{",
"$",
"responses",
"=",
"json_decode",
"(",
"file_get_contents",
"(",
"$",
"cassette",
")",
",",
"true",
")",
";",
"array_walk",
"(",
"$",
"responses",
",",
"function",
"(",... | Decodes every responses body from base64
@param $cassette
@return array | [
"Decodes",
"every",
"responses",
"body",
"from",
"base64"
] | 6ce63e610ae5ce11c3943fb7c78dcb141b58430d | https://github.com/dshafik/guzzlehttp-vcr/blob/6ce63e610ae5ce11c3943fb7c78dcb141b58430d/src/VcrHandler.php#L58-L67 |
231,110 | ctbsea/phalapi-smarty | src/Smarty/sysplugins/smarty_internal_method_clearconfig.php | Smarty_Internal_Method_ClearConfig.clearConfig | public function clearConfig(Smarty_Internal_Data $data, $name = null)
{
if (isset($name)) {
unset($data->config_vars[$name]);
} else {
$data->config_vars = array();
}
return $data;
} | php | public function clearConfig(Smarty_Internal_Data $data, $name = null)
{
if (isset($name)) {
unset($data->config_vars[$name]);
} else {
$data->config_vars = array();
}
return $data;
} | [
"public",
"function",
"clearConfig",
"(",
"Smarty_Internal_Data",
"$",
"data",
",",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"name",
")",
")",
"{",
"unset",
"(",
"$",
"data",
"->",
"config_vars",
"[",
"$",
"name",
"]",
")",
... | clear a single or all config variables
@api Smarty::clearConfig()
@link http://www.smarty.net/docs/en/api.clear.config.tpl
@param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
@param string|null $name variable name or null
@return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty | [
"clear",
"a",
"single",
"or",
"all",
"config",
"variables"
] | 4d40da3e4482c0749f3cfd1605265a109a1c495f | https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_internal_method_clearconfig.php#L32-L40 |
231,111 | cygnite/framework | src/Cygnite/Services/SocialOAuth/Providers/SocialAuthServiceProvider.php | SocialAuthServiceProvider.registerSocialAuth | protected function registerSocialAuth()
{
// Session storage
$storage = new Session();
$factory = new \OAuth\ServiceFactory();
foreach ($this->config['active'] as $key => $social) {
$this->app->singleton($social, function ($c) use ($social, $factory, $storage) {
// Setup the credentials for the requests
$credentials = new Credentials(
$this->config[$social]['key'],
$this->config[$social]['secret'],
$this->app->request->getFullUrl()
);
return $factory->createService($social, $credentials, $storage, []);
});
}
} | php | protected function registerSocialAuth()
{
// Session storage
$storage = new Session();
$factory = new \OAuth\ServiceFactory();
foreach ($this->config['active'] as $key => $social) {
$this->app->singleton($social, function ($c) use ($social, $factory, $storage) {
// Setup the credentials for the requests
$credentials = new Credentials(
$this->config[$social]['key'],
$this->config[$social]['secret'],
$this->app->request->getFullUrl()
);
return $factory->createService($social, $credentials, $storage, []);
});
}
} | [
"protected",
"function",
"registerSocialAuth",
"(",
")",
"{",
"// Session storage",
"$",
"storage",
"=",
"new",
"Session",
"(",
")",
";",
"$",
"factory",
"=",
"new",
"\\",
"OAuth",
"\\",
"ServiceFactory",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
... | Register the Social OAuth API class.
@return void | [
"Register",
"the",
"Social",
"OAuth",
"API",
"class",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Services/SocialOAuth/Providers/SocialAuthServiceProvider.php#L42-L60 |
231,112 | cygnite/framework | src/Cygnite/Services/SocialOAuth/Providers/SocialAuthServiceProvider.php | SocialAuthServiceProvider.configureSocialAuth | protected function configureSocialAuth()
{
$this->config = Config::get('global.config', 'social.config');
if (isset($this->config['active']) && !empty($this->config['active'])) {
return true;
}
return false;
} | php | protected function configureSocialAuth()
{
$this->config = Config::get('global.config', 'social.config');
if (isset($this->config['active']) && !empty($this->config['active'])) {
return true;
}
return false;
} | [
"protected",
"function",
"configureSocialAuth",
"(",
")",
"{",
"$",
"this",
"->",
"config",
"=",
"Config",
"::",
"get",
"(",
"'global.config'",
",",
"'social.config'",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"config",
"[",
"'active'",
"]",
... | Set Social OAuth Configuration.
@return void | [
"Set",
"Social",
"OAuth",
"Configuration",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Services/SocialOAuth/Providers/SocialAuthServiceProvider.php#L67-L76 |
231,113 | ctbsea/phalapi-smarty | src/Smarty/sysplugins/smarty_internal_resource_registered.php | Smarty_Internal_Resource_Registered.getContent | public function getContent(Smarty_Template_Source $source)
{
// return template string
$content = null;
$t = call_user_func_array($source->smarty->registered_resources[$source->type][0][0], array($source->name, &$content, $source->smarty));
if (is_bool($t) && !$t) {
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
}
return $content;
} | php | public function getContent(Smarty_Template_Source $source)
{
// return template string
$content = null;
$t = call_user_func_array($source->smarty->registered_resources[$source->type][0][0], array($source->name, &$content, $source->smarty));
if (is_bool($t) && !$t) {
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
}
return $content;
} | [
"public",
"function",
"getContent",
"(",
"Smarty_Template_Source",
"$",
"source",
")",
"{",
"// return template string",
"$",
"content",
"=",
"null",
";",
"$",
"t",
"=",
"call_user_func_array",
"(",
"$",
"source",
"->",
"smarty",
"->",
"registered_resources",
"[",... | Load template's source by invoking the registered callback into current template object
@param Smarty_Template_Source $source source object
@return string template source
@throws SmartyException if source cannot be loaded | [
"Load",
"template",
"s",
"source",
"by",
"invoking",
"the",
"registered",
"callback",
"into",
"current",
"template",
"object"
] | 4d40da3e4482c0749f3cfd1605265a109a1c495f | https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_internal_resource_registered.php#L76-L86 |
231,114 | DaneEveritt/login-notifications | src/NotificationServiceProvider.php | NotificationServiceProvider.boot | public function boot()
{
$this->app['events']->listen($this->failedEvent, function ($event) {
if (isset($event->user) && is_a($event->user, 'Illuminate\Database\Eloquent\Model')) {
$event->user->notify(new FailedLoginNotification(
$this->app['request']->ip()
));
}
});
$this->app['events']->listen($this->successEvent, function ($event) {
if (isset($event->user) && is_a($event->user, 'Illuminate\Database\Eloquent\Model')) {
$event->user->notify(new SuccessfulLoginNotification(
$this->app['request']->ip()
));
}
});
} | php | public function boot()
{
$this->app['events']->listen($this->failedEvent, function ($event) {
if (isset($event->user) && is_a($event->user, 'Illuminate\Database\Eloquent\Model')) {
$event->user->notify(new FailedLoginNotification(
$this->app['request']->ip()
));
}
});
$this->app['events']->listen($this->successEvent, function ($event) {
if (isset($event->user) && is_a($event->user, 'Illuminate\Database\Eloquent\Model')) {
$event->user->notify(new SuccessfulLoginNotification(
$this->app['request']->ip()
));
}
});
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"[",
"'events'",
"]",
"->",
"listen",
"(",
"$",
"this",
"->",
"failedEvent",
",",
"function",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"event",
"->",
"user",
... | Boot the notification provider.
@return void | [
"Boot",
"the",
"notification",
"provider",
"."
] | e1d177e7a96d7c4db169d1a93899790b26234b7f | https://github.com/DaneEveritt/login-notifications/blob/e1d177e7a96d7c4db169d1a93899790b26234b7f/src/NotificationServiceProvider.php#L54-L71 |
231,115 | cygnite/framework | src/Cygnite/Validation/ValidationTrait.php | ValidationTrait.addRule | public function addRule()
{
foreach ($this->rules as $field => $rule) {
$this->validation->addRule($field, $rule);
}
return $this;
} | php | public function addRule()
{
foreach ($this->rules as $field => $rule) {
$this->validation->addRule($field, $rule);
}
return $this;
} | [
"public",
"function",
"addRule",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"rules",
"as",
"$",
"field",
"=>",
"$",
"rule",
")",
"{",
"$",
"this",
"->",
"validation",
"->",
"addRule",
"(",
"$",
"field",
",",
"$",
"rule",
")",
";",
"}",
"re... | Add rules to validator.
@return $this | [
"Add",
"rules",
"to",
"validator",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Validation/ValidationTrait.php#L49-L56 |
231,116 | cygnite/framework | src/Cygnite/Validation/ValidationTrait.php | ValidationTrait.validate | public function validate($inputs)
{
if (empty($this->rules)) {
throw new \RuntimeException('You must set rules for validator.');
return false;
}
if (empty($inputs)) {
throw new \RuntimeException('Empty array passed to validate method');
}
$this->validator($inputs)->addRule();
if (!$this->run()) {
$this->setErrors($this->validation->getErrors());
return false;
}
return true;
} | php | public function validate($inputs)
{
if (empty($this->rules)) {
throw new \RuntimeException('You must set rules for validator.');
return false;
}
if (empty($inputs)) {
throw new \RuntimeException('Empty array passed to validate method');
}
$this->validator($inputs)->addRule();
if (!$this->run()) {
$this->setErrors($this->validation->getErrors());
return false;
}
return true;
} | [
"public",
"function",
"validate",
"(",
"$",
"inputs",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"rules",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'You must set rules for validator.'",
")",
";",
"return",
"false",
";",
"}",... | We will validate for and return boolean
value.
@param $inputs
@throws \RuntimeException
@return bool | [
"We",
"will",
"validate",
"for",
"and",
"return",
"boolean",
"value",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Validation/ValidationTrait.php#L76-L96 |
231,117 | ctbsea/phalapi-smarty | src/Smarty/sysplugins/smarty_internal_method_getautoloadfilters.php | Smarty_Internal_Method_GetAutoloadFilters.getAutoloadFilters | public function getAutoloadFilters(Smarty_Internal_TemplateBase $obj, $type = null)
{
$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
if ($type !== null) {
$this->_checkFilterType($type);
return isset($smarty->autoload_filters[$type]) ? $smarty->autoload_filters[$type] : array();
}
return $smarty->autoload_filters;
} | php | public function getAutoloadFilters(Smarty_Internal_TemplateBase $obj, $type = null)
{
$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
if ($type !== null) {
$this->_checkFilterType($type);
return isset($smarty->autoload_filters[$type]) ? $smarty->autoload_filters[$type] : array();
}
return $smarty->autoload_filters;
} | [
"public",
"function",
"getAutoloadFilters",
"(",
"Smarty_Internal_TemplateBase",
"$",
"obj",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"smarty",
"=",
"isset",
"(",
"$",
"obj",
"->",
"smarty",
")",
"?",
"$",
"obj",
"->",
"smarty",
":",
"$",
"obj",
"... | Get autoload filters
@api Smarty::getAutoloadFilters()
@param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
@param string $type type of filter to get auto loads
for. Defaults to all autoload
filters
@return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type
was specified | [
"Get",
"autoload",
"filters"
] | 4d40da3e4482c0749f3cfd1605265a109a1c495f | https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_internal_method_getautoloadfilters.php#L28-L36 |
231,118 | cygnite/framework | src/Cygnite/Router/Router.php | Router.collection | public function collection($namespace)
{
if (!class_exists($namespace)) {
throw new InvalidRouterCollectionException('Route Collection Class $namespace doesn\'t exists');
}
$routeCollection = $this->getContainer()->make($namespace);
return $routeCollection->setRouter($this);
} | php | public function collection($namespace)
{
if (!class_exists($namespace)) {
throw new InvalidRouterCollectionException('Route Collection Class $namespace doesn\'t exists');
}
$routeCollection = $this->getContainer()->make($namespace);
return $routeCollection->setRouter($this);
} | [
"public",
"function",
"collection",
"(",
"$",
"namespace",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"namespace",
")",
")",
"{",
"throw",
"new",
"InvalidRouterCollectionException",
"(",
"'Route Collection Class $namespace doesn\\'t exists'",
")",
";",
"}",... | Set RouteCollection.
@param $namespace
@throws InvalidRouterCollectionException
@return mixed | [
"Set",
"RouteCollection",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L115-L124 |
231,119 | cygnite/framework | src/Cygnite/Router/Router.php | Router.setContainer | public function setContainer($container) : Router
{
$this->container = $container;
$this->routeController->setContainer($container);
$this->resourceController->setRouter($this);
return $this;
} | php | public function setContainer($container) : Router
{
$this->container = $container;
$this->routeController->setContainer($container);
$this->resourceController->setRouter($this);
return $this;
} | [
"public",
"function",
"setContainer",
"(",
"$",
"container",
")",
":",
"Router",
"{",
"$",
"this",
"->",
"container",
"=",
"$",
"container",
";",
"$",
"this",
"->",
"routeController",
"->",
"setContainer",
"(",
"$",
"container",
")",
";",
"$",
"this",
"-... | Set application instance.
@param $container
@return $this | [
"Set",
"application",
"instance",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L132-L139 |
231,120 | cygnite/framework | src/Cygnite/Router/Router.php | Router.before | public function before($methods, $pattern, $func)
{
$pattern = $this->setBaseRoute($pattern);
foreach (explode('|', $methods) as $method) {
$this->before[$method][] = ['pattern' => $pattern, 'fn' => $func];
}
} | php | public function before($methods, $pattern, $func)
{
$pattern = $this->setBaseRoute($pattern);
foreach (explode('|', $methods) as $method) {
$this->before[$method][] = ['pattern' => $pattern, 'fn' => $func];
}
} | [
"public",
"function",
"before",
"(",
"$",
"methods",
",",
"$",
"pattern",
",",
"$",
"func",
")",
"{",
"$",
"pattern",
"=",
"$",
"this",
"->",
"setBaseRoute",
"(",
"$",
"pattern",
")",
";",
"foreach",
"(",
"explode",
"(",
"'|'",
",",
"$",
"methods",
... | Store a before middle-ware route and a handling function to be executed
when accessed using one of the specified methods.
@param string $methods Allowed methods, | delimited
@param string $pattern A route pattern such as /home/system
@param object $func The handling function to be executed
@return mixed|void | [
"Store",
"a",
"before",
"middle",
"-",
"ware",
"route",
"and",
"a",
"handling",
"function",
"to",
"be",
"executed",
"when",
"accessed",
"using",
"one",
"of",
"the",
"specified",
"methods",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L182-L189 |
231,121 | cygnite/framework | src/Cygnite/Router/Router.php | Router.after | public function after(callable $func)
{
$pattern = $this->setBaseRoute('{:all}');
foreach (explode('|', 'GET|POST|PUT|PATCH|DELETE') as $method) {
$this->after[$method][] = ['pattern' => $pattern, 'fn' => $func];
}
} | php | public function after(callable $func)
{
$pattern = $this->setBaseRoute('{:all}');
foreach (explode('|', 'GET|POST|PUT|PATCH|DELETE') as $method) {
$this->after[$method][] = ['pattern' => $pattern, 'fn' => $func];
}
} | [
"public",
"function",
"after",
"(",
"callable",
"$",
"func",
")",
"{",
"$",
"pattern",
"=",
"$",
"this",
"->",
"setBaseRoute",
"(",
"'{:all}'",
")",
";",
"foreach",
"(",
"explode",
"(",
"'|'",
",",
"'GET|POST|PUT|PATCH|DELETE'",
")",
"as",
"$",
"method",
... | After routing event.
@param $func
@return mixed|void | [
"After",
"routing",
"event",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L210-L216 |
231,122 | cygnite/framework | src/Cygnite/Router/Router.php | Router.callStaticRoute | public function callStaticRoute($uri)
{
$params = array_slice($this->getUrlSegments(), 2);
return $this->callController([$uri, $params]);
} | php | public function callStaticRoute($uri)
{
$params = array_slice($this->getUrlSegments(), 2);
return $this->callController([$uri, $params]);
} | [
"public",
"function",
"callStaticRoute",
"(",
"$",
"uri",
")",
"{",
"$",
"params",
"=",
"array_slice",
"(",
"$",
"this",
"->",
"getUrlSegments",
"(",
")",
",",
"2",
")",
";",
"return",
"$",
"this",
"->",
"callController",
"(",
"[",
"$",
"uri",
",",
"... | Call static routes to controller.
@param $uri
@return object | [
"Call",
"static",
"routes",
"to",
"controller",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L290-L295 |
231,123 | cygnite/framework | src/Cygnite/Router/Router.php | Router.match | public function match($methods, $pattern, $func)
{
$pattern = $this->setBaseRoute($pattern);
foreach (explode('|', $methods) as $method) {
$this->routes[$method][] = ['pattern' => $pattern, 'fn' => $func];
}
return $this;
} | php | public function match($methods, $pattern, $func)
{
$pattern = $this->setBaseRoute($pattern);
foreach (explode('|', $methods) as $method) {
$this->routes[$method][] = ['pattern' => $pattern, 'fn' => $func];
}
return $this;
} | [
"public",
"function",
"match",
"(",
"$",
"methods",
",",
"$",
"pattern",
",",
"$",
"func",
")",
"{",
"$",
"pattern",
"=",
"$",
"this",
"->",
"setBaseRoute",
"(",
"$",
"pattern",
")",
";",
"foreach",
"(",
"explode",
"(",
"'|'",
",",
"$",
"methods",
... | Store a route and a handling function to be executed.
Routes will execute when accessed using specific url pattern and methods.
@param string $methods Allowed methods, | delimited
@param string $pattern A route pattern such as /service/contact-us
@param object $func The handling function to be executed
@return bool | [
"Store",
"a",
"route",
"and",
"a",
"handling",
"function",
"to",
"be",
"executed",
".",
"Routes",
"will",
"execute",
"when",
"accessed",
"using",
"specific",
"url",
"pattern",
"and",
"methods",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L307-L316 |
231,124 | cygnite/framework | src/Cygnite/Router/Router.php | Router.post | public function post(string $pattern, $func)
{
$method = strtoupper(__FUNCTION__);
if (is_array($func)) {
if ($this->isPatternMatches($pattern)) {
$this->middleware = $func['middleware'];
}
$func = end($func);
}
if (!$func instanceof \Closure) {
return $this->override($pattern, $func, false, $method);
}
return $this->match($method, $pattern, $func);
} | php | public function post(string $pattern, $func)
{
$method = strtoupper(__FUNCTION__);
if (is_array($func)) {
if ($this->isPatternMatches($pattern)) {
$this->middleware = $func['middleware'];
}
$func = end($func);
}
if (!$func instanceof \Closure) {
return $this->override($pattern, $func, false, $method);
}
return $this->match($method, $pattern, $func);
} | [
"public",
"function",
"post",
"(",
"string",
"$",
"pattern",
",",
"$",
"func",
")",
"{",
"$",
"method",
"=",
"strtoupper",
"(",
"__FUNCTION__",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"func",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isPatte... | Shorthand for a route accessed using POST.
@param string $pattern A route pattern such as /home/system
@param object $func The handling function to be executed
@return bool | [
"Shorthand",
"for",
"a",
"route",
"accessed",
"using",
"POST",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L326-L340 |
231,125 | cygnite/framework | src/Cygnite/Router/Router.php | Router.delete | public function delete(string $pattern, $func)
{
$method = strtoupper(__FUNCTION__);
if (is_array($func)) {
if ($this->isPatternMatches($pattern)) {
$this->middleware = $func['middleware'];
}
$func = end($func);
}
return $this->match($method, $pattern, $func);
} | php | public function delete(string $pattern, $func)
{
$method = strtoupper(__FUNCTION__);
if (is_array($func)) {
if ($this->isPatternMatches($pattern)) {
$this->middleware = $func['middleware'];
}
$func = end($func);
}
return $this->match($method, $pattern, $func);
} | [
"public",
"function",
"delete",
"(",
"string",
"$",
"pattern",
",",
"$",
"func",
")",
"{",
"$",
"method",
"=",
"strtoupper",
"(",
"__FUNCTION__",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"func",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isPat... | Shorthand for a route accessed using DELETE.
@param string $pattern A route pattern such as /about/system
@param object $func The handling function to be executed
@return bool | [
"Shorthand",
"for",
"a",
"route",
"accessed",
"using",
"DELETE",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L350-L361 |
231,126 | cygnite/framework | src/Cygnite/Router/Router.php | Router.options | public function options(string $pattern, $func)
{
if (is_array($func)) {
if ($this->isPatternMatches($pattern)) {
$this->middleware = $func['middleware'];
}
$func = end($func);
}
return $this->match(strtoupper(__FUNCTION__), $pattern, $func);
} | php | public function options(string $pattern, $func)
{
if (is_array($func)) {
if ($this->isPatternMatches($pattern)) {
$this->middleware = $func['middleware'];
}
$func = end($func);
}
return $this->match(strtoupper(__FUNCTION__), $pattern, $func);
} | [
"public",
"function",
"options",
"(",
"string",
"$",
"pattern",
",",
"$",
"func",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"func",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isPatternMatches",
"(",
"$",
"pattern",
")",
")",
"{",
"$",
"this",
... | Shorthand for a route accessed using OPTIONS.
@param string $pattern A route pattern such as /home/system
@param object $func The handling function to be executed
@return bool | [
"Shorthand",
"for",
"a",
"route",
"accessed",
"using",
"OPTIONS",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L414-L424 |
231,127 | cygnite/framework | src/Cygnite/Router/Router.php | Router.any | public function any(string $pattern, $func)
{
if (is_array($func)) {
if ($this->isPatternMatches($pattern)) {
$this->middleware = $func['middleware'];
}
$func = end($func);
}
return $this->match('GET|POST|PUT|PATCH|DELETE|OPTIONS', $pattern, $func);
} | php | public function any(string $pattern, $func)
{
if (is_array($func)) {
if ($this->isPatternMatches($pattern)) {
$this->middleware = $func['middleware'];
}
$func = end($func);
}
return $this->match('GET|POST|PUT|PATCH|DELETE|OPTIONS', $pattern, $func);
} | [
"public",
"function",
"any",
"(",
"string",
"$",
"pattern",
",",
"$",
"func",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"func",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isPatternMatches",
"(",
"$",
"pattern",
")",
")",
"{",
"$",
"this",
"->... | This method respond to any HTTP method.
@param $pattern
@param $func
@return bool | [
"This",
"method",
"respond",
"to",
"any",
"HTTP",
"method",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L434-L444 |
231,128 | cygnite/framework | src/Cygnite/Router/Router.php | Router.getPattern | public function getPattern($key = null)
{
return isset($this->patterns[$key]) ? $this->patterns[$key] : $this->patterns;
} | php | public function getPattern($key = null)
{
return isset($this->patterns[$key]) ? $this->patterns[$key] : $this->patterns;
} | [
"public",
"function",
"getPattern",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"patterns",
"[",
"$",
"key",
"]",
")",
"?",
"$",
"this",
"->",
"patterns",
"[",
"$",
"key",
"]",
":",
"$",
"this",
"->",
"patte... | Get defined routes patterns.
@param $key
@return string | [
"Get",
"defined",
"routes",
"patterns",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L480-L483 |
231,129 | cygnite/framework | src/Cygnite/Router/Router.php | Router.group | public function group($groupRoute, \Closure $callback)
{
// Track current base path
$curBaseRoute = $this->routeBasePath;
// Build new route base path string
$this->routeBasePath .= $groupRoute;
// Call the Closure callback
call_user_func(function () use ($callback) {
return $callback($this);
});
// Restore original route base path
$this->routeBasePath = $curBaseRoute;
} | php | public function group($groupRoute, \Closure $callback)
{
// Track current base path
$curBaseRoute = $this->routeBasePath;
// Build new route base path string
$this->routeBasePath .= $groupRoute;
// Call the Closure callback
call_user_func(function () use ($callback) {
return $callback($this);
});
// Restore original route base path
$this->routeBasePath = $curBaseRoute;
} | [
"public",
"function",
"group",
"(",
"$",
"groupRoute",
",",
"\\",
"Closure",
"$",
"callback",
")",
"{",
"// Track current base path",
"$",
"curBaseRoute",
"=",
"$",
"this",
"->",
"routeBasePath",
";",
"// Build new route base path string",
"$",
"this",
"->",
"rout... | Allow you to apply nested sub routing.
@param $groupRoute
@param callable $callback | [
"Allow",
"you",
"to",
"apply",
"nested",
"sub",
"routing",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L496-L510 |
231,130 | cygnite/framework | src/Cygnite/Router/Router.php | Router.resource | public function resource(string $name, string $controller) : ResourceController
{
return $this->resourceController->resourceController($this, $name, $controller);
} | php | public function resource(string $name, string $controller) : ResourceController
{
return $this->resourceController->resourceController($this, $name, $controller);
} | [
"public",
"function",
"resource",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"controller",
")",
":",
"ResourceController",
"{",
"return",
"$",
"this",
"->",
"resourceController",
"->",
"resourceController",
"(",
"$",
"this",
",",
"$",
"name",
",",
"$",
... | Set the controller as Resource Controller
Router knows how to respond to resource controller
request automatically.
@param $name
@param $controller
@return $this | [
"Set",
"the",
"controller",
"as",
"Resource",
"Controller",
"Router",
"knows",
"how",
"to",
"respond",
"to",
"resource",
"controller",
"request",
"automatically",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L522-L525 |
231,131 | cygnite/framework | src/Cygnite/Router/Router.php | Router.run | public function run($callback = null)
{
// Check before routing middle ware and trigger
$this->beforeRoutingMiddleware();
// Set after routing event
$this->setAfterRoutingMiddleWare();
// Handle all routes
$handledRequest = 0;
if (isset($this->routes[$this->request->server->get('REQUEST_METHOD')])) {
$flag = (!is_null($this->afterRouter)) ? true : false;
$handledRequest = $this->handle($this->routes[$this->request->server->get('REQUEST_METHOD')], $flag);
}
// If no route was handled, trigger the 404 (if any)
if ($handledRequest == 0) {
if (!is_null($this->notFound) && is_callable($this->notFound)) {
return call_user_func($this->notFound);
}
}
} | php | public function run($callback = null)
{
// Check before routing middle ware and trigger
$this->beforeRoutingMiddleware();
// Set after routing event
$this->setAfterRoutingMiddleWare();
// Handle all routes
$handledRequest = 0;
if (isset($this->routes[$this->request->server->get('REQUEST_METHOD')])) {
$flag = (!is_null($this->afterRouter)) ? true : false;
$handledRequest = $this->handle($this->routes[$this->request->server->get('REQUEST_METHOD')], $flag);
}
// If no route was handled, trigger the 404 (if any)
if ($handledRequest == 0) {
if (!is_null($this->notFound) && is_callable($this->notFound)) {
return call_user_func($this->notFound);
}
}
} | [
"public",
"function",
"run",
"(",
"$",
"callback",
"=",
"null",
")",
"{",
"// Check before routing middle ware and trigger",
"$",
"this",
"->",
"beforeRoutingMiddleware",
"(",
")",
";",
"// Set after routing event",
"$",
"this",
"->",
"setAfterRoutingMiddleWare",
"(",
... | Execute the router. Loop all defined routes,
and call function to handle request if matching pattern found.
@param null $callback
@return mixed | [
"Execute",
"the",
"router",
".",
"Loop",
"all",
"defined",
"routes",
"and",
"call",
"function",
"to",
"handle",
"request",
"if",
"matching",
"pattern",
"found",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L584-L604 |
231,132 | cygnite/framework | src/Cygnite/Router/Router.php | Router.handle | private function handle($routes, $fireAfterRoutingCallback = false)
{
// Counter to keep track of the number of routes we've handled
$handledRequest = 0;
$i = 0;
// Loop all routes
foreach ($routes as $route) {
if ($matches = $this->isPatternMatches($route['pattern'], true)) {
if ($this->middleware) {
$this->handleMiddleware();
}
// Extract the matched URL (and only the parameters)
$params = $this->extractParams($matches);
array_unshift($params, $this);
// call the handling function with the URL
$this->handledRoute = call_user_func_array($route['fn'], $params);
$this->container->set('response', $this->handledRoute);
$handledRequest++;
// If we need to quit, then quit
if ($fireAfterRoutingCallback) {
// If a route was handled, perform the finish callback (if any)
$this->handle($this->afterRouter);
}
}
$i++;
}
// Return the number of routes handled
return $handledRequest;
} | php | private function handle($routes, $fireAfterRoutingCallback = false)
{
// Counter to keep track of the number of routes we've handled
$handledRequest = 0;
$i = 0;
// Loop all routes
foreach ($routes as $route) {
if ($matches = $this->isPatternMatches($route['pattern'], true)) {
if ($this->middleware) {
$this->handleMiddleware();
}
// Extract the matched URL (and only the parameters)
$params = $this->extractParams($matches);
array_unshift($params, $this);
// call the handling function with the URL
$this->handledRoute = call_user_func_array($route['fn'], $params);
$this->container->set('response', $this->handledRoute);
$handledRequest++;
// If we need to quit, then quit
if ($fireAfterRoutingCallback) {
// If a route was handled, perform the finish callback (if any)
$this->handle($this->afterRouter);
}
}
$i++;
}
// Return the number of routes handled
return $handledRequest;
} | [
"private",
"function",
"handle",
"(",
"$",
"routes",
",",
"$",
"fireAfterRoutingCallback",
"=",
"false",
")",
"{",
"// Counter to keep track of the number of routes we've handled",
"$",
"handledRequest",
"=",
"0",
";",
"$",
"i",
"=",
"0",
";",
"// Loop all routes",
... | Handle a a set of routes. If a pattern match is found, execute the handling function.
@param $routes Collection of route patterns
@param bool $fireAfterRoutingCallback
@return int The number of routes handled | [
"Handle",
"a",
"a",
"set",
"of",
"routes",
".",
"If",
"a",
"pattern",
"match",
"is",
"found",
"execute",
"the",
"handling",
"function",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L622-L656 |
231,133 | cygnite/framework | src/Cygnite/Router/Router.php | Router.isPatternMatches | public function isPatternMatches($pattern, $routePattern = false)
{
$uri = $this->removeIndexDotPhpAndTrillingSlash($this->getCurrentUri());
$hasPattern = $this->hasNamedPattern($pattern);
$pattern = ($hasPattern == false) ? $pattern : $hasPattern;
if (preg_match_all(
'#^' . $pattern . '$#',
$uri,
$matches,
PREG_SET_ORDER
)) {
return $matches;
}
} | php | public function isPatternMatches($pattern, $routePattern = false)
{
$uri = $this->removeIndexDotPhpAndTrillingSlash($this->getCurrentUri());
$hasPattern = $this->hasNamedPattern($pattern);
$pattern = ($hasPattern == false) ? $pattern : $hasPattern;
if (preg_match_all(
'#^' . $pattern . '$#',
$uri,
$matches,
PREG_SET_ORDER
)) {
return $matches;
}
} | [
"public",
"function",
"isPatternMatches",
"(",
"$",
"pattern",
",",
"$",
"routePattern",
"=",
"false",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"removeIndexDotPhpAndTrillingSlash",
"(",
"$",
"this",
"->",
"getCurrentUri",
"(",
")",
")",
";",
"$",
"has... | Checks if pattern matches.
@param $pattern
@param bool $routePattern
@return mixed | [
"Checks",
"if",
"pattern",
"matches",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L913-L926 |
231,134 | cygnite/framework | src/Cygnite/Router/Router.php | Router.getUrlSegments | public function getUrlSegments() : array
{
$newUrl = str_replace('/'.Router::$indexPage, '', rtrim($this->getCurrentUri()));
return array_filter(explode('/', $newUrl));
} | php | public function getUrlSegments() : array
{
$newUrl = str_replace('/'.Router::$indexPage, '', rtrim($this->getCurrentUri()));
return array_filter(explode('/', $newUrl));
} | [
"public",
"function",
"getUrlSegments",
"(",
")",
":",
"array",
"{",
"$",
"newUrl",
"=",
"str_replace",
"(",
"'/'",
".",
"Router",
"::",
"$",
"indexPage",
",",
"''",
",",
"rtrim",
"(",
"$",
"this",
"->",
"getCurrentUri",
"(",
")",
")",
")",
";",
"ret... | Get url segments.
@return array | [
"Get",
"url",
"segments",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Router/Router.php#L933-L938 |
231,135 | cygnite/framework | src/Cygnite/Database/Service/Providers/EloquentServiceProvider.php | EloquentServiceProvider.register | public function register(Application $app)
{
$this->eloquent = new EloquentCapsule();
$config = Database::getDatabaseConfiguration();
/*
| We will loop over all connections
| and set connection
*/
foreach ($config as $key => $c) {
$this->setConnection($c);
}
$this->eloquent->setEventDispatcher(new Dispatcher(new Container()));
// Make this Capsule instance available globally via static methods... (optional)
$this->eloquent->setAsGlobal();
// Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
$this->eloquent->bootEloquent();
} | php | public function register(Application $app)
{
$this->eloquent = new EloquentCapsule();
$config = Database::getDatabaseConfiguration();
/*
| We will loop over all connections
| and set connection
*/
foreach ($config as $key => $c) {
$this->setConnection($c);
}
$this->eloquent->setEventDispatcher(new Dispatcher(new Container()));
// Make this Capsule instance available globally via static methods... (optional)
$this->eloquent->setAsGlobal();
// Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
$this->eloquent->bootEloquent();
} | [
"public",
"function",
"register",
"(",
"Application",
"$",
"app",
")",
"{",
"$",
"this",
"->",
"eloquent",
"=",
"new",
"EloquentCapsule",
"(",
")",
";",
"$",
"config",
"=",
"Database",
"::",
"getDatabaseConfiguration",
"(",
")",
";",
"/*\n | We will lo... | Setup Eloquent ORM Service Provider.
@param Application $app
@source https://github.com/illuminate/database | [
"Setup",
"Eloquent",
"ORM",
"Service",
"Provider",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Database/Service/Providers/EloquentServiceProvider.php#L39-L57 |
231,136 | marein/php-nchan-client | src/Api/Status.php | Status.information | public function information(): StatusInformation
{
$response = $this->client->get(
new Request(
$this->statusUrl,
[
'Accept' => 'text/plain'
]
)
);
if ($response->statusCode() !== Response::OK) {
throw new NchanException(
sprintf(
'Unable to retrieve status information. HTTP status code was %s.',
$response->statusCode()
)
);
}
return StatusInformation::fromPlainText($response->body());
} | php | public function information(): StatusInformation
{
$response = $this->client->get(
new Request(
$this->statusUrl,
[
'Accept' => 'text/plain'
]
)
);
if ($response->statusCode() !== Response::OK) {
throw new NchanException(
sprintf(
'Unable to retrieve status information. HTTP status code was %s.',
$response->statusCode()
)
);
}
return StatusInformation::fromPlainText($response->body());
} | [
"public",
"function",
"information",
"(",
")",
":",
"StatusInformation",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"new",
"Request",
"(",
"$",
"this",
"->",
"statusUrl",
",",
"[",
"'Accept'",
"=>",
"'text/plain'",
"]",
")"... | Returns the current nchan status.
@return StatusInformation
@throws AuthenticationRequiredException
@throws NchanException | [
"Returns",
"the",
"current",
"nchan",
"status",
"."
] | 958d7ccb06e49139f3bf720ff3f1bd9dbe33caa9 | https://github.com/marein/php-nchan-client/blob/958d7ccb06e49139f3bf720ff3f1bd9dbe33caa9/src/Api/Status.php#L48-L69 |
231,137 | ctbsea/phalapi-smarty | src/Smarty/sysplugins/smarty_internal_runtime_updatecache.php | Smarty_Internal_Runtime_UpdateCache.removeNoCacheHash | public function removeNoCacheHash(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template,
$no_output_filter)
{
$content = ob_get_clean();
unset($cached->hashes[$_template->compiled->nocache_hash]);
if (!empty($cached->hashes)) {
$hash_array = array();
foreach ($cached->hashes as $hash => $foo) {
$hash_array[] = "/{$hash}/";
}
$content = preg_replace($hash_array, $_template->compiled->nocache_hash, $content);
}
$_template->cached->has_nocache_code = false;
// get text between non-cached items
$cache_split =
preg_split("!/\*%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*/!s",
$content);
// get non-cached items
preg_match_all("!/\*%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*/!s",
$content, $cache_parts);
$content = '';
// loop over items, stitch back together
foreach ($cache_split as $curr_idx => $curr_split) {
// escape PHP tags in template content
$content .= preg_replace('/(<%|%>|<\?php|<\?|\?>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>)/',
"<?php echo '\$1'; ?>\n", $curr_split);
if (isset($cache_parts[0][$curr_idx])) {
$_template->cached->has_nocache_code = true;
$content .= $cache_parts[1][$curr_idx];
}
}
if (!$no_output_filter && !$_template->compiled->has_nocache_code &&
(isset($_template->smarty->autoload_filters['output']) ||
isset($_template->smarty->registered_filters['output']))
) {
$content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template);
}
// write cache file content
$this->writeCachedContent($cached, $_template, $content);
} | php | public function removeNoCacheHash(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template,
$no_output_filter)
{
$content = ob_get_clean();
unset($cached->hashes[$_template->compiled->nocache_hash]);
if (!empty($cached->hashes)) {
$hash_array = array();
foreach ($cached->hashes as $hash => $foo) {
$hash_array[] = "/{$hash}/";
}
$content = preg_replace($hash_array, $_template->compiled->nocache_hash, $content);
}
$_template->cached->has_nocache_code = false;
// get text between non-cached items
$cache_split =
preg_split("!/\*%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*/!s",
$content);
// get non-cached items
preg_match_all("!/\*%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*/!s",
$content, $cache_parts);
$content = '';
// loop over items, stitch back together
foreach ($cache_split as $curr_idx => $curr_split) {
// escape PHP tags in template content
$content .= preg_replace('/(<%|%>|<\?php|<\?|\?>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>)/',
"<?php echo '\$1'; ?>\n", $curr_split);
if (isset($cache_parts[0][$curr_idx])) {
$_template->cached->has_nocache_code = true;
$content .= $cache_parts[1][$curr_idx];
}
}
if (!$no_output_filter && !$_template->compiled->has_nocache_code &&
(isset($_template->smarty->autoload_filters['output']) ||
isset($_template->smarty->registered_filters['output']))
) {
$content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template);
}
// write cache file content
$this->writeCachedContent($cached, $_template, $content);
} | [
"public",
"function",
"removeNoCacheHash",
"(",
"Smarty_Template_Cached",
"$",
"cached",
",",
"Smarty_Internal_Template",
"$",
"_template",
",",
"$",
"no_output_filter",
")",
"{",
"$",
"content",
"=",
"ob_get_clean",
"(",
")",
";",
"unset",
"(",
"$",
"cached",
"... | Sanitize content and write it to cache resource
@param \Smarty_Template_Cached $cached
@param Smarty_Internal_Template $_template
@param bool $no_output_filter
@throws \SmartyException | [
"Sanitize",
"content",
"and",
"write",
"it",
"to",
"cache",
"resource"
] | 4d40da3e4482c0749f3cfd1605265a109a1c495f | https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_internal_runtime_updatecache.php#L33-L72 |
231,138 | ctbsea/phalapi-smarty | src/Smarty/sysplugins/smarty_internal_runtime_updatecache.php | Smarty_Internal_Runtime_UpdateCache.updateCache | public function updateCache(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $no_output_filter)
{
if ($_template->source->handler->uncompiled) {
ob_start();
$_template->source->render($_template);
} else {
ob_start();
if (!isset($_template->compiled)) {
$_template->loadCompiled();
}
$_template->compiled->render($_template);
}
if ($_template->smarty->debugging) {
$_template->smarty->_debug->start_cache($_template);
}
$this->removeNoCacheHash($cached, $_template, $no_output_filter);
$compile_check = $_template->smarty->compile_check;
$_template->smarty->compile_check = false;
if (isset($_template->parent) && $_template->parent->_objType == 2) {
$_template->compiled->unifunc = $_template->parent->compiled->unifunc;
}
if (!$_template->cached->processed) {
$_template->cached->process($_template, true);
}
$_template->smarty->compile_check = $compile_check;
$cached->getRenderedTemplateCode($_template);
if ($_template->smarty->debugging) {
$_template->smarty->_debug->end_cache($_template);
}
} | php | public function updateCache(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $no_output_filter)
{
if ($_template->source->handler->uncompiled) {
ob_start();
$_template->source->render($_template);
} else {
ob_start();
if (!isset($_template->compiled)) {
$_template->loadCompiled();
}
$_template->compiled->render($_template);
}
if ($_template->smarty->debugging) {
$_template->smarty->_debug->start_cache($_template);
}
$this->removeNoCacheHash($cached, $_template, $no_output_filter);
$compile_check = $_template->smarty->compile_check;
$_template->smarty->compile_check = false;
if (isset($_template->parent) && $_template->parent->_objType == 2) {
$_template->compiled->unifunc = $_template->parent->compiled->unifunc;
}
if (!$_template->cached->processed) {
$_template->cached->process($_template, true);
}
$_template->smarty->compile_check = $compile_check;
$cached->getRenderedTemplateCode($_template);
if ($_template->smarty->debugging) {
$_template->smarty->_debug->end_cache($_template);
}
} | [
"public",
"function",
"updateCache",
"(",
"Smarty_Template_Cached",
"$",
"cached",
",",
"Smarty_Internal_Template",
"$",
"_template",
",",
"$",
"no_output_filter",
")",
"{",
"if",
"(",
"$",
"_template",
"->",
"source",
"->",
"handler",
"->",
"uncompiled",
")",
"... | Cache was invalid , so render from compiled and write to cache
@param \Smarty_Template_Cached $cached
@param \Smarty_Internal_Template $_template
@param $no_output_filter
@throws \Exception | [
"Cache",
"was",
"invalid",
"so",
"render",
"from",
"compiled",
"and",
"write",
"to",
"cache"
] | 4d40da3e4482c0749f3cfd1605265a109a1c495f | https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_internal_runtime_updatecache.php#L83-L112 |
231,139 | ARCANEDEV/GeoIP | src/Support/IpValidator.php | IpValidator.validate | public static function validate($ipAddress)
{
if (filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4|FILTER_FLAG_NO_PRIV_RANGE|FILTER_FLAG_NO_RES_RANGE))
return true;
if (filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6|FILTER_FLAG_NO_PRIV_RANGE))
return true;
return true;
} | php | public static function validate($ipAddress)
{
if (filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4|FILTER_FLAG_NO_PRIV_RANGE|FILTER_FLAG_NO_RES_RANGE))
return true;
if (filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6|FILTER_FLAG_NO_PRIV_RANGE))
return true;
return true;
} | [
"public",
"static",
"function",
"validate",
"(",
"$",
"ipAddress",
")",
"{",
"if",
"(",
"filter_var",
"(",
"$",
"ipAddress",
",",
"FILTER_VALIDATE_IP",
",",
"FILTER_FLAG_IPV4",
"|",
"FILTER_FLAG_NO_PRIV_RANGE",
"|",
"FILTER_FLAG_NO_RES_RANGE",
")",
")",
"return",
... | Validate the IP Address.
@param string $ipAddress
@return bool | [
"Validate",
"the",
"IP",
"Address",
"."
] | 2b7b5590cbbbb99e9d1a3a2c85ce9e39dd39b318 | https://github.com/ARCANEDEV/GeoIP/blob/2b7b5590cbbbb99e9d1a3a2c85ce9e39dd39b318/src/Support/IpValidator.php#L23-L32 |
231,140 | cygnite/framework | src/Cygnite/Console/Command/ModelGeneratorCommand.php | ModelGeneratorCommand.process | public function process()
{
$table = $this->argument('name');
// Your model name
$this->model = Inflector::classify($table);
/*
| Check for argument database name if not given
| we will use default database connection
*/
$this->database = $this->getDatabase();
$this->columns = $this->getColumns();
if (empty($this->columns)) {
exit($this->error("Please check your model name. It seems table '$table' doesn't exists!"));
}
$this->applicationDir = CYGNITE_BASE.DS.APPPATH;
$this->generateModel();
$modelPath = APPPATH.DS.'Models'.DS.$this->model.EXT;
$this->info("Model $this->model Generated Successfully Into ".$modelPath);
} | php | public function process()
{
$table = $this->argument('name');
// Your model name
$this->model = Inflector::classify($table);
/*
| Check for argument database name if not given
| we will use default database connection
*/
$this->database = $this->getDatabase();
$this->columns = $this->getColumns();
if (empty($this->columns)) {
exit($this->error("Please check your model name. It seems table '$table' doesn't exists!"));
}
$this->applicationDir = CYGNITE_BASE.DS.APPPATH;
$this->generateModel();
$modelPath = APPPATH.DS.'Models'.DS.$this->model.EXT;
$this->info("Model $this->model Generated Successfully Into ".$modelPath);
} | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"argument",
"(",
"'name'",
")",
";",
"// Your model name",
"$",
"this",
"->",
"model",
"=",
"Inflector",
"::",
"classify",
"(",
"$",
"table",
")",
";",
"/*\n | ... | We will execute the command and generate model class.
@return int|null|void | [
"We",
"will",
"execute",
"the",
"command",
"and",
"generate",
"model",
"class",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Console/Command/ModelGeneratorCommand.php#L125-L147 |
231,141 | cygnite/framework | src/Cygnite/Console/Command/ModelGeneratorCommand.php | ModelGeneratorCommand.generateModel | private function generateModel()
{
$modelInstance = Model::instance($this);
$modelTemplateDir =
dirname(dirname(__FILE__)).DS.'src'.DS.ucfirst('apps').DS.ucfirst('models').DS;
$modelInstance->setModelTemplatePath($modelTemplateDir);
$modelInstance->updateTemplate();
$modelInstance->generate();
return true;
} | php | private function generateModel()
{
$modelInstance = Model::instance($this);
$modelTemplateDir =
dirname(dirname(__FILE__)).DS.'src'.DS.ucfirst('apps').DS.ucfirst('models').DS;
$modelInstance->setModelTemplatePath($modelTemplateDir);
$modelInstance->updateTemplate();
$modelInstance->generate();
return true;
} | [
"private",
"function",
"generateModel",
"(",
")",
"{",
"$",
"modelInstance",
"=",
"Model",
"::",
"instance",
"(",
"$",
"this",
")",
";",
"$",
"modelTemplateDir",
"=",
"dirname",
"(",
"dirname",
"(",
"__FILE__",
")",
")",
".",
"DS",
".",
"'src'",
".",
"... | We will generate model here. | [
"We",
"will",
"generate",
"model",
"here",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Console/Command/ModelGeneratorCommand.php#L164-L175 |
231,142 | cygnite/framework | src/Cygnite/Helpers/Inflector.php | Inflector.classify | protected function classify($word)
{
$s = strtolower(trim($word));
$s = preg_replace('#([.-])(?=[a-z])#', '$1 ', $s);
$s = preg_replace('#([._])(?=[a-z])#', '$1 ', $s);
$s = ucwords($s);
$s = str_replace('. ', ':', $s);
return $s = str_replace(['_ ', '- '], '', $s);
} | php | protected function classify($word)
{
$s = strtolower(trim($word));
$s = preg_replace('#([.-])(?=[a-z])#', '$1 ', $s);
$s = preg_replace('#([._])(?=[a-z])#', '$1 ', $s);
$s = ucwords($s);
$s = str_replace('. ', ':', $s);
return $s = str_replace(['_ ', '- '], '', $s);
} | [
"protected",
"function",
"classify",
"(",
"$",
"word",
")",
"{",
"$",
"s",
"=",
"strtolower",
"(",
"trim",
"(",
"$",
"word",
")",
")",
";",
"$",
"s",
"=",
"preg_replace",
"(",
"'#([.-])(?=[a-z])#'",
",",
"'$1 '",
",",
"$",
"s",
")",
";",
"$",
"s",
... | class_name - ClassName
Convert underscore or - separated string to class name.
foo_bar -> FooBar
foo-bar -> FooBar
@param $word string
@return mixed | [
"class_name",
"-",
"ClassName",
"Convert",
"underscore",
"or",
"-",
"separated",
"string",
"to",
"class",
"name",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Helpers/Inflector.php#L37-L46 |
231,143 | cygnite/framework | src/Cygnite/Helpers/Inflector.php | Inflector.pathAction | protected function pathAction($s)
{
$s = strtolower($s);
$s = preg_replace('#-(?=[a-z])#', ' ', $s);
$s = preg_replace('#_(?=[a-z])#', ' ', $s);
$s = substr(ucwords('x'.$s), 1);
$s = str_replace(' ', '', $s);
return $s;
} | php | protected function pathAction($s)
{
$s = strtolower($s);
$s = preg_replace('#-(?=[a-z])#', ' ', $s);
$s = preg_replace('#_(?=[a-z])#', ' ', $s);
$s = substr(ucwords('x'.$s), 1);
$s = str_replace(' ', '', $s);
return $s;
} | [
"protected",
"function",
"pathAction",
"(",
"$",
"s",
")",
"{",
"$",
"s",
"=",
"strtolower",
"(",
"$",
"s",
")",
";",
"$",
"s",
"=",
"preg_replace",
"(",
"'#-(?=[a-z])#'",
",",
"' '",
",",
"$",
"s",
")",
";",
"$",
"s",
"=",
"preg_replace",
"(",
"... | dash-separated -> camelCaseAction name.
dash_separated -> camelCaseAction name.
@false string
@param $s
@return string | [
"dash",
"-",
"separated",
"-",
">",
"camelCaseAction",
"name",
".",
"dash_separated",
"-",
">",
"camelCaseAction",
"name",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Helpers/Inflector.php#L76-L85 |
231,144 | teamreflex/TidalPHP | src/Tidal/Parts/Part.php | Part.getPublicAttributes | public function getPublicAttributes()
{
$atts = [];
foreach ($this->attributes as $key => $value) {
$atts[$key] = $this->__get($key);
}
return $atts;
} | php | public function getPublicAttributes()
{
$atts = [];
foreach ($this->attributes as $key => $value) {
$atts[$key] = $this->__get($key);
}
return $atts;
} | [
"public",
"function",
"getPublicAttributes",
"(",
")",
"{",
"$",
"atts",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"attributes",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"atts",
"[",
"$",
"key",
"]",
"=",
"$",
"this",
"->... | Gets the public attributes.
@return array Public attributes. | [
"Gets",
"the",
"public",
"attributes",
"."
] | 5d4948c75ae483d4baf318d94ba338801ec50cfc | https://github.com/teamreflex/TidalPHP/blob/5d4948c75ae483d4baf318d94ba338801ec50cfc/src/Tidal/Parts/Part.php#L130-L139 |
231,145 | tapestry-cloud/tapestry | src/ArrayContainer.php | ArrayContainer.arrayMergeRecursive | private function arrayMergeRecursive(array &$left, array &$right)
{
$merged = $left;
foreach ($right as $key => $value) {
if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
$merged[$key] = $this->arrayMergeRecursive($merged[$key], $value);
} else {
if (is_numeric($key)) {
if (! in_array($value, $merged)) {
$merged[] = $value;
}
} else {
$merged[$key] = $value;
}
}
}
return $merged;
} | php | private function arrayMergeRecursive(array &$left, array &$right)
{
$merged = $left;
foreach ($right as $key => $value) {
if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
$merged[$key] = $this->arrayMergeRecursive($merged[$key], $value);
} else {
if (is_numeric($key)) {
if (! in_array($value, $merged)) {
$merged[] = $value;
}
} else {
$merged[$key] = $value;
}
}
}
return $merged;
} | [
"private",
"function",
"arrayMergeRecursive",
"(",
"array",
"&",
"$",
"left",
",",
"array",
"&",
"$",
"right",
")",
"{",
"$",
"merged",
"=",
"$",
"left",
";",
"foreach",
"(",
"$",
"right",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
... | Recursive array merge found from stackoverflow.
@link http://stackoverflow.com/a/25712428/1225977
@param array $left
@param array $right
@return array | [
"Recursive",
"array",
"merge",
"found",
"from",
"stackoverflow",
"."
] | f3fc980b2484ccbe609a7f811c65b91254e8720e | https://github.com/tapestry-cloud/tapestry/blob/f3fc980b2484ccbe609a7f811c65b91254e8720e/src/ArrayContainer.php#L154-L172 |
231,146 | tapestry-cloud/tapestry | src/ArrayContainer.php | ArrayContainer.sortMultiDimension | public function sortMultiDimension(Closure $callback)
{
foreach ($this->items as &$sortable) {
uasort($sortable, $callback);
}
unset($sortable);
return $this;
} | php | public function sortMultiDimension(Closure $callback)
{
foreach ($this->items as &$sortable) {
uasort($sortable, $callback);
}
unset($sortable);
return $this;
} | [
"public",
"function",
"sortMultiDimension",
"(",
"Closure",
"$",
"callback",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"&",
"$",
"sortable",
")",
"{",
"uasort",
"(",
"$",
"sortable",
",",
"$",
"callback",
")",
";",
"}",
"unset",
"(",
... | A 2D array sort, useful for when you need to sort a two dimensional array.
@param Closure $callback
@return $this | [
"A",
"2D",
"array",
"sort",
"useful",
"for",
"when",
"you",
"need",
"to",
"sort",
"a",
"two",
"dimensional",
"array",
"."
] | f3fc980b2484ccbe609a7f811c65b91254e8720e | https://github.com/tapestry-cloud/tapestry/blob/f3fc980b2484ccbe609a7f811c65b91254e8720e/src/ArrayContainer.php#L474-L482 |
231,147 | tapestry-cloud/tapestry | src/ArrayContainer.php | ArrayContainer.filterKeys | public function filterKeys(array $filteredKeys = [])
{
$this->items = array_filter($this->items, function ($key) use ($filteredKeys) {
return ! isset($filteredKeys[$key]);
}, ARRAY_FILTER_USE_KEY);
} | php | public function filterKeys(array $filteredKeys = [])
{
$this->items = array_filter($this->items, function ($key) use ($filteredKeys) {
return ! isset($filteredKeys[$key]);
}, ARRAY_FILTER_USE_KEY);
} | [
"public",
"function",
"filterKeys",
"(",
"array",
"$",
"filteredKeys",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"items",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"items",
",",
"function",
"(",
"$",
"key",
")",
"use",
"(",
"$",
"filteredKeys",
... | Allow the filtering of items by key.
@param array $filteredKeys | [
"Allow",
"the",
"filtering",
"of",
"items",
"by",
"key",
"."
] | f3fc980b2484ccbe609a7f811c65b91254e8720e | https://github.com/tapestry-cloud/tapestry/blob/f3fc980b2484ccbe609a7f811c65b91254e8720e/src/ArrayContainer.php#L489-L494 |
231,148 | cygnite/framework | src/Cygnite/Console/Foundation/Application.php | Application.registerCommands | public function registerCommands()
{
foreach ($this->commandsStack as $key => $command) {
$this->resolveConsoleCommand('\\'.$command);
}
return $this;
} | php | public function registerCommands()
{
foreach ($this->commandsStack as $key => $command) {
$this->resolveConsoleCommand('\\'.$command);
}
return $this;
} | [
"public",
"function",
"registerCommands",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"commandsStack",
"as",
"$",
"key",
"=>",
"$",
"command",
")",
"{",
"$",
"this",
"->",
"resolveConsoleCommand",
"(",
"'\\\\'",
".",
"$",
"command",
")",
";",
"}",
... | We will register all the cyrus console command into container.
@return void | [
"We",
"will",
"register",
"all",
"the",
"cyrus",
"console",
"command",
"into",
"container",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Console/Foundation/Application.php#L121-L128 |
231,149 | marein/php-nchan-client | src/Api/Channel.php | Channel.publish | public function publish(Message $message): ChannelInformation
{
$response = $this->client->post(
new Request(
$this->channelUrl,
[
'Accept' => 'application/json',
'Content-Type' => $message->contentType(),
'X-EventSource-Event' => $message->name()
],
$message->content()
)
);
if (!in_array($response->statusCode(), [Response::CREATED, Response::ACCEPTED])) {
throw new NchanException(
sprintf(
'Unable to publish to channel. Maybe the channel does not exists. HTTP status code was %s.',
$response->statusCode()
)
);
}
return ChannelInformation::fromJson($response->body());
} | php | public function publish(Message $message): ChannelInformation
{
$response = $this->client->post(
new Request(
$this->channelUrl,
[
'Accept' => 'application/json',
'Content-Type' => $message->contentType(),
'X-EventSource-Event' => $message->name()
],
$message->content()
)
);
if (!in_array($response->statusCode(), [Response::CREATED, Response::ACCEPTED])) {
throw new NchanException(
sprintf(
'Unable to publish to channel. Maybe the channel does not exists. HTTP status code was %s.',
$response->statusCode()
)
);
}
return ChannelInformation::fromJson($response->body());
} | [
"public",
"function",
"publish",
"(",
"Message",
"$",
"message",
")",
":",
"ChannelInformation",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"new",
"Request",
"(",
"$",
"this",
"->",
"channelUrl",
",",
"[",
"'Accept'",
"=>"... | Publish a message to this channel.
@param Message $message
@return ChannelInformation
@throws AuthenticationRequiredException
@throws NchanException | [
"Publish",
"a",
"message",
"to",
"this",
"channel",
"."
] | 958d7ccb06e49139f3bf720ff3f1bd9dbe33caa9 | https://github.com/marein/php-nchan-client/blob/958d7ccb06e49139f3bf720ff3f1bd9dbe33caa9/src/Api/Channel.php#L51-L75 |
231,150 | marein/php-nchan-client | src/Api/Channel.php | Channel.information | public function information(): ChannelInformation
{
$response = $this->client->get(
new Request(
$this->channelUrl,
[
'Accept' => 'application/json'
]
)
);
if ($response->statusCode() !== Response::OK) {
throw new NchanException(
sprintf(
'Unable to get channel information. Maybe the channel does not exists. HTTP status code was %s.',
$response->statusCode()
)
);
}
return ChannelInformation::fromJson($response->body());
} | php | public function information(): ChannelInformation
{
$response = $this->client->get(
new Request(
$this->channelUrl,
[
'Accept' => 'application/json'
]
)
);
if ($response->statusCode() !== Response::OK) {
throw new NchanException(
sprintf(
'Unable to get channel information. Maybe the channel does not exists. HTTP status code was %s.',
$response->statusCode()
)
);
}
return ChannelInformation::fromJson($response->body());
} | [
"public",
"function",
"information",
"(",
")",
":",
"ChannelInformation",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"new",
"Request",
"(",
"$",
"this",
"->",
"channelUrl",
",",
"[",
"'Accept'",
"=>",
"'application/json'",
"]... | Returns the information from this channel.
@return ChannelInformation
@throws AuthenticationRequiredException
@throws NchanException | [
"Returns",
"the",
"information",
"from",
"this",
"channel",
"."
] | 958d7ccb06e49139f3bf720ff3f1bd9dbe33caa9 | https://github.com/marein/php-nchan-client/blob/958d7ccb06e49139f3bf720ff3f1bd9dbe33caa9/src/Api/Channel.php#L84-L105 |
231,151 | marein/php-nchan-client | src/Api/Channel.php | Channel.delete | public function delete(): void
{
$response = $this->client->delete(
new Request(
$this->channelUrl,
[
'Accept' => 'application/json'
]
)
);
if (!in_array($response->statusCode(), [Response::OK, RESPONSE::NOT_FOUND])) {
throw new NchanException(
sprintf(
'Unable to delete channel. Maybe the channel does not exists. HTTP status code was %s.',
$response->statusCode()
)
);
}
} | php | public function delete(): void
{
$response = $this->client->delete(
new Request(
$this->channelUrl,
[
'Accept' => 'application/json'
]
)
);
if (!in_array($response->statusCode(), [Response::OK, RESPONSE::NOT_FOUND])) {
throw new NchanException(
sprintf(
'Unable to delete channel. Maybe the channel does not exists. HTTP status code was %s.',
$response->statusCode()
)
);
}
} | [
"public",
"function",
"delete",
"(",
")",
":",
"void",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"delete",
"(",
"new",
"Request",
"(",
"$",
"this",
"->",
"channelUrl",
",",
"[",
"'Accept'",
"=>",
"'application/json'",
"]",
")",
")",... | Delete this channel.
@throws AuthenticationRequiredException
@throws NchanException | [
"Delete",
"this",
"channel",
"."
] | 958d7ccb06e49139f3bf720ff3f1bd9dbe33caa9 | https://github.com/marein/php-nchan-client/blob/958d7ccb06e49139f3bf720ff3f1bd9dbe33caa9/src/Api/Channel.php#L113-L132 |
231,152 | DevGroup-ru/yii2-jstree-widget | src/actions/nestedset/FullTreeDataAction.php | FullTreeDataAction.prepareNestedData | public function prepareNestedData($data, $lft = 0, $rgt = null, $root = 0)
{
$res = [];
foreach ($data as $row) {
$currentRoot = isset($row[$this->rootAttribute]) ? $row[$this->rootAttribute] : 0;
if (is_null($rgt) || $row[$this->rightAttribute] < $rgt && $root == $currentRoot) {
if ($lft + 1 == $row[$this->leftAttribute]) {
if ($row[$this->leftAttribute] + 1 !== $row[$this->rightAttribute]) {
$res[] = [
'id' => $row['id'],
'text' => $row[$this->modelLabelAttribute],
'a_attr' => [
'data-id' => $row['id'],
],
'children' => self::prepareNestedData(
$data,
$row[$this->leftAttribute],
$row[$this->rightAttribute],
$currentRoot
),
'state' => [
'selected' => in_array($row['id'], $this->selectedNodes),
],
];
} else {
$res[] = [
'id' => $row['id'],
'text' => $row[$this->modelLabelAttribute],
'a_attr' => [
'data-id' => $row['id'],
],
'children' => [],
'state' => [
'selected' => in_array($row['id'], $this->selectedNodes),
],
];
}
$lft = $row[$this->rightAttribute];
} else if ($row[$this->leftAttribute] == 1 && $root !== $currentRoot) {
$res[] = [
'id' => $row['id'],
'text' => $row[$this->modelLabelAttribute],
'a_attr' => [
'data-id' => $row['id'],
],
'children' => self::prepareNestedData(
$data,
$row[$this->leftAttribute],
$row[$this->rightAttribute],
$currentRoot
),
'state' => [
'selected' => in_array($row['id'], $this->selectedNodes),
],
];
}
}
}
return $res;
} | php | public function prepareNestedData($data, $lft = 0, $rgt = null, $root = 0)
{
$res = [];
foreach ($data as $row) {
$currentRoot = isset($row[$this->rootAttribute]) ? $row[$this->rootAttribute] : 0;
if (is_null($rgt) || $row[$this->rightAttribute] < $rgt && $root == $currentRoot) {
if ($lft + 1 == $row[$this->leftAttribute]) {
if ($row[$this->leftAttribute] + 1 !== $row[$this->rightAttribute]) {
$res[] = [
'id' => $row['id'],
'text' => $row[$this->modelLabelAttribute],
'a_attr' => [
'data-id' => $row['id'],
],
'children' => self::prepareNestedData(
$data,
$row[$this->leftAttribute],
$row[$this->rightAttribute],
$currentRoot
),
'state' => [
'selected' => in_array($row['id'], $this->selectedNodes),
],
];
} else {
$res[] = [
'id' => $row['id'],
'text' => $row[$this->modelLabelAttribute],
'a_attr' => [
'data-id' => $row['id'],
],
'children' => [],
'state' => [
'selected' => in_array($row['id'], $this->selectedNodes),
],
];
}
$lft = $row[$this->rightAttribute];
} else if ($row[$this->leftAttribute] == 1 && $root !== $currentRoot) {
$res[] = [
'id' => $row['id'],
'text' => $row[$this->modelLabelAttribute],
'a_attr' => [
'data-id' => $row['id'],
],
'children' => self::prepareNestedData(
$data,
$row[$this->leftAttribute],
$row[$this->rightAttribute],
$currentRoot
),
'state' => [
'selected' => in_array($row['id'], $this->selectedNodes),
],
];
}
}
}
return $res;
} | [
"public",
"function",
"prepareNestedData",
"(",
"$",
"data",
",",
"$",
"lft",
"=",
"0",
",",
"$",
"rgt",
"=",
"null",
",",
"$",
"root",
"=",
"0",
")",
"{",
"$",
"res",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"row",
")",
"{... | Converts single or multi root Nested Set database data into multidimensional array for using in the
jsTree widget
@param array $data
@param int $lft
@param null $rgt
@param int $root
@return array | [
"Converts",
"single",
"or",
"multi",
"root",
"Nested",
"Set",
"database",
"data",
"into",
"multidimensional",
"array",
"for",
"using",
"in",
"the",
"jsTree",
"widget"
] | 6ae0311254eb757a13fc5c318d6a15544d84b105 | https://github.com/DevGroup-ru/yii2-jstree-widget/blob/6ae0311254eb757a13fc5c318d6a15544d84b105/src/actions/nestedset/FullTreeDataAction.php#L104-L163 |
231,153 | tapestry-cloud/tapestry | src/Modules/Content/LoadSourceFiles.php | LoadSourceFiles.canAutoPublish | private function canAutoPublish(File $file)
{
if ($this->autoPublish === false) {
return false;
}
if ($file->getData('date', new \DateTime()) <= $this->now) {
return true;
}
return false;
} | php | private function canAutoPublish(File $file)
{
if ($this->autoPublish === false) {
return false;
}
if ($file->getData('date', new \DateTime()) <= $this->now) {
return true;
}
return false;
} | [
"private",
"function",
"canAutoPublish",
"(",
"File",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"autoPublish",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"file",
"->",
"getData",
"(",
"'date'",
",",
"new",
"\\",... | If the file is a draft, but auto publish is enabled and the files date is in the past then it should be published.
@param File $file
@version 1.0.9
@return bool | [
"If",
"the",
"file",
"is",
"a",
"draft",
"but",
"auto",
"publish",
"is",
"enabled",
"and",
"the",
"files",
"date",
"is",
"in",
"the",
"past",
"then",
"it",
"should",
"be",
"published",
"."
] | f3fc980b2484ccbe609a7f811c65b91254e8720e | https://github.com/tapestry-cloud/tapestry/blob/f3fc980b2484ccbe609a7f811c65b91254e8720e/src/Modules/Content/LoadSourceFiles.php#L156-L167 |
231,154 | iionly/tidypics | classes/TidypicsAlbum.php | TidypicsAlbum.save | public function save() {
if (!isset($this->new_album)) {
$this->new_album = 1;
}
if (!isset($this->last_notified)) {
$this->last_notified = 0;
}
if (!parent::save()) {
return false;
}
mkdir(tp_get_img_dir($this->guid), 0755, true);
return true;
} | php | public function save() {
if (!isset($this->new_album)) {
$this->new_album = 1;
}
if (!isset($this->last_notified)) {
$this->last_notified = 0;
}
if (!parent::save()) {
return false;
}
mkdir(tp_get_img_dir($this->guid), 0755, true);
return true;
} | [
"public",
"function",
"save",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"new_album",
")",
")",
"{",
"$",
"this",
"->",
"new_album",
"=",
"1",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"last_notified",
")",
... | Save an album
@return bool | [
"Save",
"an",
"album"
] | 6dc7d2728a7074a28f5440d191e4832b0d04367e | https://github.com/iionly/tidypics/blob/6dc7d2728a7074a28f5440d191e4832b0d04367e/classes/TidypicsAlbum.php#L43-L59 |
231,155 | iionly/tidypics | classes/TidypicsAlbum.php | TidypicsAlbum.getImages | public function getImages($limit, $offset = 0) {
$imageList = $this->getImageList();
if ($offset > count($imageList)) {
return [];
}
$imageList = array_slice($imageList, $offset, $limit);
$images = [];
foreach ($imageList as $guid) {
$images[] = get_entity($guid);
}
return $images;
} | php | public function getImages($limit, $offset = 0) {
$imageList = $this->getImageList();
if ($offset > count($imageList)) {
return [];
}
$imageList = array_slice($imageList, $offset, $limit);
$images = [];
foreach ($imageList as $guid) {
$images[] = get_entity($guid);
}
return $images;
} | [
"public",
"function",
"getImages",
"(",
"$",
"limit",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"$",
"imageList",
"=",
"$",
"this",
"->",
"getImageList",
"(",
")",
";",
"if",
"(",
"$",
"offset",
">",
"count",
"(",
"$",
"imageList",
")",
")",
"{",
"... | Get an array of image objects
@param int $limit
@param int $offset
@return array | [
"Get",
"an",
"array",
"of",
"image",
"objects"
] | 6dc7d2728a7074a28f5440d191e4832b0d04367e | https://github.com/iionly/tidypics/blob/6dc7d2728a7074a28f5440d191e4832b0d04367e/classes/TidypicsAlbum.php#L100-L113 |
231,156 | iionly/tidypics | classes/TidypicsAlbum.php | TidypicsAlbum.viewImages | public function viewImages(array $options = []) {
$count = $this->getSize();
if ($count == 0) {
return '';
}
$defaults = [
'count' => $count,
'limit' => (int) get_input('limit', 16),
'offset' => (int) get_input('offset', 0),
'full_view' => false,
'list_type' => 'gallery',
'list_type_toggle' => false,
'pagination' => true,
'gallery_class' => 'tidypics-gallery',
];
$options = array_merge($defaults, (array) $options);
$images = $this->getImages($options['limit'], $options['offset']);
if (count($images) == 0) {
return '';
}
return elgg_view_entity_list($images, $options);
} | php | public function viewImages(array $options = []) {
$count = $this->getSize();
if ($count == 0) {
return '';
}
$defaults = [
'count' => $count,
'limit' => (int) get_input('limit', 16),
'offset' => (int) get_input('offset', 0),
'full_view' => false,
'list_type' => 'gallery',
'list_type_toggle' => false,
'pagination' => true,
'gallery_class' => 'tidypics-gallery',
];
$options = array_merge($defaults, (array) $options);
$images = $this->getImages($options['limit'], $options['offset']);
if (count($images) == 0) {
return '';
}
return elgg_view_entity_list($images, $options);
} | [
"public",
"function",
"viewImages",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"count",
"=",
"$",
"this",
"->",
"getSize",
"(",
")",
";",
"if",
"(",
"$",
"count",
"==",
"0",
")",
"{",
"return",
"''",
";",
"}",
"$",
"defaults",
... | View a list of images
@param array $options Options to pass to elgg_view_entity_list()
@return string | [
"View",
"a",
"list",
"of",
"images"
] | 6dc7d2728a7074a28f5440d191e4832b0d04367e | https://github.com/iionly/tidypics/blob/6dc7d2728a7074a28f5440d191e4832b0d04367e/classes/TidypicsAlbum.php#L121-L147 |
231,157 | iionly/tidypics | classes/TidypicsAlbum.php | TidypicsAlbum.getCoverImageGuid | public function getCoverImageGuid() {
if ($this->getSize() == 0) {
return 0;
}
$guid = $this->cover;
$imageList = $this->getImageList();
if (!in_array($guid, $imageList)) {
// select random photo to be cover
$index = array_rand($imageList, 1);
$guid = $imageList[$index];
$this->cover = $guid;
}
return $guid;
} | php | public function getCoverImageGuid() {
if ($this->getSize() == 0) {
return 0;
}
$guid = $this->cover;
$imageList = $this->getImageList();
if (!in_array($guid, $imageList)) {
// select random photo to be cover
$index = array_rand($imageList, 1);
$guid = $imageList[$index];
$this->cover = $guid;
}
return $guid;
} | [
"public",
"function",
"getCoverImageGuid",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getSize",
"(",
")",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"$",
"guid",
"=",
"$",
"this",
"->",
"cover",
";",
"$",
"imageList",
"=",
"$",
"this",
"->"... | Get the GUID of the album cover
@return int | [
"Get",
"the",
"GUID",
"of",
"the",
"album",
"cover"
] | 6dc7d2728a7074a28f5440d191e4832b0d04367e | https://github.com/iionly/tidypics/blob/6dc7d2728a7074a28f5440d191e4832b0d04367e/classes/TidypicsAlbum.php#L162-L176 |
231,158 | iionly/tidypics | classes/TidypicsAlbum.php | TidypicsAlbum.setCoverImageGuid | public function setCoverImageGuid($guid) {
$imageList = $this->getImageList();
if (!in_array($guid, $imageList)) {
return false;
}
$this->cover = $guid;
return true;
} | php | public function setCoverImageGuid($guid) {
$imageList = $this->getImageList();
if (!in_array($guid, $imageList)) {
return false;
}
$this->cover = $guid;
return true;
} | [
"public",
"function",
"setCoverImageGuid",
"(",
"$",
"guid",
")",
"{",
"$",
"imageList",
"=",
"$",
"this",
"->",
"getImageList",
"(",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"guid",
",",
"$",
"imageList",
")",
")",
"{",
"return",
"false",
";"... | Set the GUID for the album cover
@param int $guid
@return bool | [
"Set",
"the",
"GUID",
"for",
"the",
"album",
"cover"
] | 6dc7d2728a7074a28f5440d191e4832b0d04367e | https://github.com/iionly/tidypics/blob/6dc7d2728a7074a28f5440d191e4832b0d04367e/classes/TidypicsAlbum.php#L184-L191 |
231,159 | iionly/tidypics | classes/TidypicsAlbum.php | TidypicsAlbum.getImageList | public function getImageList() {
$listString = $this->orderedImages;
if (!$listString) {
return [];
}
$list = unserialize($listString);
// if empty don't need to check the permissions.
if (!$list) {
return [];
}
// check access levels
$guidsString = implode(',', $list);
$list = elgg_get_entities([
'wheres' => ["e.guid IN ($guidsString)"],
'order_by' => "FIELD(e.guid, $guidsString)",
'callback' => 'tp_guid_callback',
'limit' => false,
]);
return $list;
} | php | public function getImageList() {
$listString = $this->orderedImages;
if (!$listString) {
return [];
}
$list = unserialize($listString);
// if empty don't need to check the permissions.
if (!$list) {
return [];
}
// check access levels
$guidsString = implode(',', $list);
$list = elgg_get_entities([
'wheres' => ["e.guid IN ($guidsString)"],
'order_by' => "FIELD(e.guid, $guidsString)",
'callback' => 'tp_guid_callback',
'limit' => false,
]);
return $list;
} | [
"public",
"function",
"getImageList",
"(",
")",
"{",
"$",
"listString",
"=",
"$",
"this",
"->",
"orderedImages",
";",
"if",
"(",
"!",
"$",
"listString",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"list",
"=",
"unserialize",
"(",
"$",
"listString",
... | Returns an order list of image guids
@return array | [
"Returns",
"an",
"order",
"list",
"of",
"image",
"guids"
] | 6dc7d2728a7074a28f5440d191e4832b0d04367e | https://github.com/iionly/tidypics/blob/6dc7d2728a7074a28f5440d191e4832b0d04367e/classes/TidypicsAlbum.php#L207-L229 |
231,160 | iionly/tidypics | classes/TidypicsAlbum.php | TidypicsAlbum.setImageList | public function setImageList($list) {
// validate data
foreach ($list as $guid) {
if (!filter_var($guid, FILTER_VALIDATE_INT)) {
return false;
}
}
$listString = serialize($list);
$this->orderedImages = $listString;
return true;
} | php | public function setImageList($list) {
// validate data
foreach ($list as $guid) {
if (!filter_var($guid, FILTER_VALIDATE_INT)) {
return false;
}
}
$listString = serialize($list);
$this->orderedImages = $listString;
return true;
} | [
"public",
"function",
"setImageList",
"(",
"$",
"list",
")",
"{",
"// validate data",
"foreach",
"(",
"$",
"list",
"as",
"$",
"guid",
")",
"{",
"if",
"(",
"!",
"filter_var",
"(",
"$",
"guid",
",",
"FILTER_VALIDATE_INT",
")",
")",
"{",
"return",
"false",
... | Sets the album image order
@param array $list An indexed array of image guids
@return bool | [
"Sets",
"the",
"album",
"image",
"order"
] | 6dc7d2728a7074a28f5440d191e4832b0d04367e | https://github.com/iionly/tidypics/blob/6dc7d2728a7074a28f5440d191e4832b0d04367e/classes/TidypicsAlbum.php#L237-L248 |
231,161 | iionly/tidypics | classes/TidypicsAlbum.php | TidypicsAlbum.prependImageList | public function prependImageList($list) {
$currentList = $this->getImageList();
$list = array_merge($list, $currentList);
return $this->setImageList($list);
} | php | public function prependImageList($list) {
$currentList = $this->getImageList();
$list = array_merge($list, $currentList);
return $this->setImageList($list);
} | [
"public",
"function",
"prependImageList",
"(",
"$",
"list",
")",
"{",
"$",
"currentList",
"=",
"$",
"this",
"->",
"getImageList",
"(",
")",
";",
"$",
"list",
"=",
"array_merge",
"(",
"$",
"list",
",",
"$",
"currentList",
")",
";",
"return",
"$",
"this"... | Add new images to the front of the image list
@param array $list An indexed array of image guids
@return bool | [
"Add",
"new",
"images",
"to",
"the",
"front",
"of",
"the",
"image",
"list"
] | 6dc7d2728a7074a28f5440d191e4832b0d04367e | https://github.com/iionly/tidypics/blob/6dc7d2728a7074a28f5440d191e4832b0d04367e/classes/TidypicsAlbum.php#L256-L260 |
231,162 | iionly/tidypics | classes/TidypicsAlbum.php | TidypicsAlbum.getPreviousImage | public function getPreviousImage($guid) {
$imageList = $this->getImageList();
$key = array_search($guid, $imageList);
if ($key === false) {
return null;
}
$key--;
if ($key < 0) {
return get_entity(end($imageList));
}
return get_entity($imageList[$key]);
} | php | public function getPreviousImage($guid) {
$imageList = $this->getImageList();
$key = array_search($guid, $imageList);
if ($key === false) {
return null;
}
$key--;
if ($key < 0) {
return get_entity(end($imageList));
}
return get_entity($imageList[$key]);
} | [
"public",
"function",
"getPreviousImage",
"(",
"$",
"guid",
")",
"{",
"$",
"imageList",
"=",
"$",
"this",
"->",
"getImageList",
"(",
")",
";",
"$",
"key",
"=",
"array_search",
"(",
"$",
"guid",
",",
"$",
"imageList",
")",
";",
"if",
"(",
"$",
"key",
... | Get the previous image in the album. Wraps around to the last image if given the first.
@param int $guid GUID of the current image
@return TidypicsImage | [
"Get",
"the",
"previous",
"image",
"in",
"the",
"album",
".",
"Wraps",
"around",
"to",
"the",
"last",
"image",
"if",
"given",
"the",
"first",
"."
] | 6dc7d2728a7074a28f5440d191e4832b0d04367e | https://github.com/iionly/tidypics/blob/6dc7d2728a7074a28f5440d191e4832b0d04367e/classes/TidypicsAlbum.php#L268-L279 |
231,163 | iionly/tidypics | classes/TidypicsAlbum.php | TidypicsAlbum.getNextImage | public function getNextImage($guid) {
$imageList = $this->getImageList();
$key = array_search($guid, $imageList);
if ($key === false) {
return null;
}
$key++;
if ($key >= count($imageList)) {
return get_entity($imageList[0]);
}
return get_entity($imageList[$key]);
} | php | public function getNextImage($guid) {
$imageList = $this->getImageList();
$key = array_search($guid, $imageList);
if ($key === false) {
return null;
}
$key++;
if ($key >= count($imageList)) {
return get_entity($imageList[0]);
}
return get_entity($imageList[$key]);
} | [
"public",
"function",
"getNextImage",
"(",
"$",
"guid",
")",
"{",
"$",
"imageList",
"=",
"$",
"this",
"->",
"getImageList",
"(",
")",
";",
"$",
"key",
"=",
"array_search",
"(",
"$",
"guid",
",",
"$",
"imageList",
")",
";",
"if",
"(",
"$",
"key",
"=... | Get the next image in the album. Wraps around to the first image if given the last.
@param int $guid GUID of the current image
@return TidypicsImage | [
"Get",
"the",
"next",
"image",
"in",
"the",
"album",
".",
"Wraps",
"around",
"to",
"the",
"first",
"image",
"if",
"given",
"the",
"last",
"."
] | 6dc7d2728a7074a28f5440d191e4832b0d04367e | https://github.com/iionly/tidypics/blob/6dc7d2728a7074a28f5440d191e4832b0d04367e/classes/TidypicsAlbum.php#L287-L298 |
231,164 | iionly/tidypics | classes/TidypicsAlbum.php | TidypicsAlbum.removeImage | public function removeImage($imageGuid) {
$imageList = $this->getImageList();
$key = array_search($imageGuid, $imageList);
if ($key === false) {
return false;
}
unset($imageList[$key]);
$this->setImageList($imageList);
return true;
} | php | public function removeImage($imageGuid) {
$imageList = $this->getImageList();
$key = array_search($imageGuid, $imageList);
if ($key === false) {
return false;
}
unset($imageList[$key]);
$this->setImageList($imageList);
return true;
} | [
"public",
"function",
"removeImage",
"(",
"$",
"imageGuid",
")",
"{",
"$",
"imageList",
"=",
"$",
"this",
"->",
"getImageList",
"(",
")",
";",
"$",
"key",
"=",
"array_search",
"(",
"$",
"imageGuid",
",",
"$",
"imageList",
")",
";",
"if",
"(",
"$",
"k... | Remove an image from the album list
@param int $imageGuid
@return bool | [
"Remove",
"an",
"image",
"from",
"the",
"album",
"list"
] | 6dc7d2728a7074a28f5440d191e4832b0d04367e | https://github.com/iionly/tidypics/blob/6dc7d2728a7074a28f5440d191e4832b0d04367e/classes/TidypicsAlbum.php#L316-L327 |
231,165 | iionly/tidypics | classes/TidypicsAlbum.php | TidypicsAlbum.deleteImages | protected function deleteImages() {
$images_count = elgg_get_entities([
'type' => 'object',
'subtype' => TidypicsImage::SUBTYPE,
'container_guid' => $this->guid,
'count' => true,
]);
if ($images_count > 0) {
$images = elgg_get_entities([
'type' => 'object',
'subtype' => TidypicsImage::SUBTYPE,
'container_guid' => $this->guid,
'limit' => false,
'batch' => true,
'batch_inc_offset' => false,
]);
foreach ($images as $image) {
if ($image) {
$image->delete();
}
}
}
} | php | protected function deleteImages() {
$images_count = elgg_get_entities([
'type' => 'object',
'subtype' => TidypicsImage::SUBTYPE,
'container_guid' => $this->guid,
'count' => true,
]);
if ($images_count > 0) {
$images = elgg_get_entities([
'type' => 'object',
'subtype' => TidypicsImage::SUBTYPE,
'container_guid' => $this->guid,
'limit' => false,
'batch' => true,
'batch_inc_offset' => false,
]);
foreach ($images as $image) {
if ($image) {
$image->delete();
}
}
}
} | [
"protected",
"function",
"deleteImages",
"(",
")",
"{",
"$",
"images_count",
"=",
"elgg_get_entities",
"(",
"[",
"'type'",
"=>",
"'object'",
",",
"'subtype'",
"=>",
"TidypicsImage",
"::",
"SUBTYPE",
",",
"'container_guid'",
"=>",
"$",
"this",
"->",
"guid",
","... | Delete all the images in this album | [
"Delete",
"all",
"the",
"images",
"in",
"this",
"album"
] | 6dc7d2728a7074a28f5440d191e4832b0d04367e | https://github.com/iionly/tidypics/blob/6dc7d2728a7074a28f5440d191e4832b0d04367e/classes/TidypicsAlbum.php#L341-L363 |
231,166 | iionly/tidypics | classes/TidypicsAlbum.php | TidypicsAlbum.deleteAlbumDir | protected function deleteAlbumDir() {
$tmpfile = new ElggFile();
$tmpfile->setFilename('image/' . $this->guid . '/._tmp_del_tidypics_album_');
$tmpfile->subtype = TidypicsImage::SUBTYPE;
$tmpfile->owner_guid = $this->owner_guid;
$tmpfile->container_guid = $this->guid;
$tmpfile->open("write");
$tmpfile->write('');
$tmpfile->close();
$tmpfile->save();
$albumdir = preg_replace('#/._tmp_del_tidypics_album_#i', '', $tmpfile->getFilenameOnFilestore());
$tmpfile->delete();
// sanity check: must be a directory
if (!$handle = opendir($albumdir)) {
return false;
}
// loop through all files that might still remain undeleted in this directory and delete them
// note: this does not delete the corresponding image entities from the database
while (($file = readdir($handle)) !== false) {
if (in_array($file, ['.', '..'])) {
continue;
}
$path = "$albumdir/$file";
unlink($path);
}
// remove empty directory
closedir($handle);
return rmdir($albumdir);
} | php | protected function deleteAlbumDir() {
$tmpfile = new ElggFile();
$tmpfile->setFilename('image/' . $this->guid . '/._tmp_del_tidypics_album_');
$tmpfile->subtype = TidypicsImage::SUBTYPE;
$tmpfile->owner_guid = $this->owner_guid;
$tmpfile->container_guid = $this->guid;
$tmpfile->open("write");
$tmpfile->write('');
$tmpfile->close();
$tmpfile->save();
$albumdir = preg_replace('#/._tmp_del_tidypics_album_#i', '', $tmpfile->getFilenameOnFilestore());
$tmpfile->delete();
// sanity check: must be a directory
if (!$handle = opendir($albumdir)) {
return false;
}
// loop through all files that might still remain undeleted in this directory and delete them
// note: this does not delete the corresponding image entities from the database
while (($file = readdir($handle)) !== false) {
if (in_array($file, ['.', '..'])) {
continue;
}
$path = "$albumdir/$file";
unlink($path);
}
// remove empty directory
closedir($handle);
return rmdir($albumdir);
} | [
"protected",
"function",
"deleteAlbumDir",
"(",
")",
"{",
"$",
"tmpfile",
"=",
"new",
"ElggFile",
"(",
")",
";",
"$",
"tmpfile",
"->",
"setFilename",
"(",
"'image/'",
".",
"$",
"this",
"->",
"guid",
".",
"'/._tmp_del_tidypics_album_'",
")",
";",
"$",
"tmpf... | Delete the album directory on disk | [
"Delete",
"the",
"album",
"directory",
"on",
"disk"
] | 6dc7d2728a7074a28f5440d191e4832b0d04367e | https://github.com/iionly/tidypics/blob/6dc7d2728a7074a28f5440d191e4832b0d04367e/classes/TidypicsAlbum.php#L368-L399 |
231,167 | cygnite/framework | src/Cygnite/Services/Omnipay/GatewayManager.php | GatewayManager.gateway | public function gateway($class = null)
{
$class = $class ?: $this->getDefaultGateway();
if (!isset($this->gateways[$class])) {
$gateway = $this->factory->create($class);
$gateway->initialize($this->getConfig($class));
$this->gateways[$class] = $gateway;
}
return $this->gateways[$class];
} | php | public function gateway($class = null)
{
$class = $class ?: $this->getDefaultGateway();
if (!isset($this->gateways[$class])) {
$gateway = $this->factory->create($class);
$gateway->initialize($this->getConfig($class));
$this->gateways[$class] = $gateway;
}
return $this->gateways[$class];
} | [
"public",
"function",
"gateway",
"(",
"$",
"class",
"=",
"null",
")",
"{",
"$",
"class",
"=",
"$",
"class",
"?",
":",
"$",
"this",
"->",
"getDefaultGateway",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"gateways",
"[",
"$",
"c... | Gateway factory return the gateway instance.
@param null $class
@return mixed | [
"Gateway",
"factory",
"return",
"the",
"gateway",
"instance",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Services/Omnipay/GatewayManager.php#L47-L58 |
231,168 | cygnite/framework | src/Cygnite/Services/Omnipay/GatewayManager.php | GatewayManager.getGateway | public function getGateway()
{
return (!isset($this->gateway)) ?
$this->gateway = $this->getDefaultGateway() :
$this->gateway;
} | php | public function getGateway()
{
return (!isset($this->gateway)) ?
$this->gateway = $this->getDefaultGateway() :
$this->gateway;
} | [
"public",
"function",
"getGateway",
"(",
")",
"{",
"return",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"gateway",
")",
")",
"?",
"$",
"this",
"->",
"gateway",
"=",
"$",
"this",
"->",
"getDefaultGateway",
"(",
")",
":",
"$",
"this",
"->",
"gateway",
... | Get the Gateway.
@return string | [
"Get",
"the",
"Gateway",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Services/Omnipay/GatewayManager.php#L113-L118 |
231,169 | cygnite/framework | src/Cygnite/Helpers/Config.php | Config.init | protected function init(string $path, array $files = [])
{
static::$path = $path;
$this->addConfigFile($files);
$this->load();
} | php | protected function init(string $path, array $files = [])
{
static::$path = $path;
$this->addConfigFile($files);
$this->load();
} | [
"protected",
"function",
"init",
"(",
"string",
"$",
"path",
",",
"array",
"$",
"files",
"=",
"[",
"]",
")",
"{",
"static",
"::",
"$",
"path",
"=",
"$",
"path",
";",
"$",
"this",
"->",
"addConfigFile",
"(",
"$",
"files",
")",
";",
"$",
"this",
"-... | Set the Configuration path and customizable files array
@param $path
@param array $files | [
"Set",
"the",
"Configuration",
"path",
"and",
"customizable",
"files",
"array"
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Helpers/Config.php#L38-L43 |
231,170 | cygnite/framework | src/Cygnite/Helpers/Config.php | Config.get | protected function get($key, $value = false)
{
if (is_null($key)) {
throw new \InvalidArgumentException('Null argument passed to '.__METHOD__);
}
$config = [];
$config = static::$config;
if (empty($config)) {
throw new \Exception('Config stack is empty!');
}
if ($value == false && array_key_exists($key, $config)) {
return isset($config[$key]) ? $config[$key] : null;
}
if (array_key_exists($key, $config) && $value == true) {
return $config[$key][$value];
}
/*
| We will access array value as string with dot separator
| 'module.config' => [
| "config" => [
| "name" => "Welcome To Module"
| ]
| ]
| Config::get('module-config.config.name');
*/
return ArrayAccessor::make($config, function ($a) use ($key) {
return $a->toString($key);
});
} | php | protected function get($key, $value = false)
{
if (is_null($key)) {
throw new \InvalidArgumentException('Null argument passed to '.__METHOD__);
}
$config = [];
$config = static::$config;
if (empty($config)) {
throw new \Exception('Config stack is empty!');
}
if ($value == false && array_key_exists($key, $config)) {
return isset($config[$key]) ? $config[$key] : null;
}
if (array_key_exists($key, $config) && $value == true) {
return $config[$key][$value];
}
/*
| We will access array value as string with dot separator
| 'module.config' => [
| "config" => [
| "name" => "Welcome To Module"
| ]
| ]
| Config::get('module-config.config.name');
*/
return ArrayAccessor::make($config, function ($a) use ($key) {
return $a->toString($key);
});
} | [
"protected",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"false",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Null argument passed to '",
".",
"__METHOD__",
")",
... | Get the configuration by index.
@param $key
@param bool $value
@throws \InvalidArgumentException
@throws \Exception
@return mixed|null | [
"Get",
"the",
"configuration",
"by",
"index",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Helpers/Config.php#L54-L87 |
231,171 | cygnite/framework | src/Cygnite/Mvc/View/Widget.php | Widget.make | public function make(string $name, array $data = [], \Closure $callback = null)
{
$this->setWidgetName($name);
$this->data = $data;
/*
| If second param given as closure then we will
| return callback
*/
if (!is_null($callback) && $callback instanceof \Closure) {
return $callback($this);
}
/*
| return object
*/
return $this->render();
} | php | public function make(string $name, array $data = [], \Closure $callback = null)
{
$this->setWidgetName($name);
$this->data = $data;
/*
| If second param given as closure then we will
| return callback
*/
if (!is_null($callback) && $callback instanceof \Closure) {
return $callback($this);
}
/*
| return object
*/
return $this->render();
} | [
"public",
"function",
"make",
"(",
"string",
"$",
"name",
",",
"array",
"$",
"data",
"=",
"[",
"]",
",",
"\\",
"Closure",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setWidgetName",
"(",
"$",
"name",
")",
";",
"$",
"this",
"->",
"... | Create widget view and returns content.
@param string $name The name of the widget.
@param array $data Data to be passed in widget.
@param \Closure|null $callback
@return string | [
"Create",
"widget",
"view",
"and",
"returns",
"content",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Mvc/View/Widget.php#L94-L110 |
231,172 | cygnite/framework | src/Cygnite/Mvc/View/Widget.php | Widget.setupModule | protected function setupModule()
{
if (string_has($this->getWidgetName(), ':')) {
$exp = [];
$exp = explode(':', $this->getWidgetName());
$moduleName = $exp[0];
$view = $exp[1];
$path = $this->getWidgetPath($view, $moduleName, true);
$this->setWidgetName(null);
$this->setModule(false);
return $path;
}
} | php | protected function setupModule()
{
if (string_has($this->getWidgetName(), ':')) {
$exp = [];
$exp = explode(':', $this->getWidgetName());
$moduleName = $exp[0];
$view = $exp[1];
$path = $this->getWidgetPath($view, $moduleName, true);
$this->setWidgetName(null);
$this->setModule(false);
return $path;
}
} | [
"protected",
"function",
"setupModule",
"(",
")",
"{",
"if",
"(",
"string_has",
"(",
"$",
"this",
"->",
"getWidgetName",
"(",
")",
",",
"':'",
")",
")",
"{",
"$",
"exp",
"=",
"[",
"]",
";",
"$",
"exp",
"=",
"explode",
"(",
"':'",
",",
"$",
"this"... | We will setup module view path.
@return string | [
"We",
"will",
"setup",
"module",
"view",
"path",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Mvc/View/Widget.php#L133-L146 |
231,173 | cygnite/framework | src/Cygnite/Mvc/View/Widget.php | Widget.setupWidget | protected function setupWidget()
{
/*
| If widget not belongs to HMVC modules and
| has ":" in the view name, we will convert name as path
*/
if (string_has($this->getWidgetName(), ':')) {
$widget = null;
$widget = str_replace(':', DS, $this->getWidgetName());
return $this->getWidgetPath($widget, '', false);
}
} | php | protected function setupWidget()
{
/*
| If widget not belongs to HMVC modules and
| has ":" in the view name, we will convert name as path
*/
if (string_has($this->getWidgetName(), ':')) {
$widget = null;
$widget = str_replace(':', DS, $this->getWidgetName());
return $this->getWidgetPath($widget, '', false);
}
} | [
"protected",
"function",
"setupWidget",
"(",
")",
"{",
"/*\n | If widget not belongs to HMVC modules and\n | has \":\" in the view name, we will convert name as path\n */",
"if",
"(",
"string_has",
"(",
"$",
"this",
"->",
"getWidgetName",
"(",
")",
",",
"'... | Set up widget view path.
@return string | [
"Set",
"up",
"widget",
"view",
"path",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Mvc/View/Widget.php#L153-L166 |
231,174 | cygnite/framework | src/Cygnite/Mvc/View/Widget.php | Widget.getWidgetPath | private function getWidgetPath($widget, $moduleName = '', $isModule = false)
{
$modulePath = 'Views';
if ($isModule) {
$modulePath = $this->moduleDir.DS.$moduleName.DS.'Views';
}
return $this->paths['app.path'].DS.$modulePath.DS.$widget.'.view.php';
} | php | private function getWidgetPath($widget, $moduleName = '', $isModule = false)
{
$modulePath = 'Views';
if ($isModule) {
$modulePath = $this->moduleDir.DS.$moduleName.DS.'Views';
}
return $this->paths['app.path'].DS.$modulePath.DS.$widget.'.view.php';
} | [
"private",
"function",
"getWidgetPath",
"(",
"$",
"widget",
",",
"$",
"moduleName",
"=",
"''",
",",
"$",
"isModule",
"=",
"false",
")",
"{",
"$",
"modulePath",
"=",
"'Views'",
";",
"if",
"(",
"$",
"isModule",
")",
"{",
"$",
"modulePath",
"=",
"$",
"t... | Check if isModule parameter passed true, then system will Module widget view
otherwise normal mvc view path;
@param $widget
@param string $moduleName
@param bool $isModule
@return string | [
"Check",
"if",
"isModule",
"parameter",
"passed",
"true",
"then",
"system",
"will",
"Module",
"widget",
"view",
"otherwise",
"normal",
"mvc",
"view",
"path",
";"
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Mvc/View/Widget.php#L177-L185 |
231,175 | cygnite/framework | src/Cygnite/Common/ArrayManipulator/ArrayAccessor.php | ArrayAccessor.manipulate | protected function manipulate($string)
{
$chunks = $this->getKeysFromString($string);
$array = $this->getArray();
return $this->formatArray($array, $chunks);
} | php | protected function manipulate($string)
{
$chunks = $this->getKeysFromString($string);
$array = $this->getArray();
return $this->formatArray($array, $chunks);
} | [
"protected",
"function",
"manipulate",
"(",
"$",
"string",
")",
"{",
"$",
"chunks",
"=",
"$",
"this",
"->",
"getKeysFromString",
"(",
"$",
"string",
")",
";",
"$",
"array",
"=",
"$",
"this",
"->",
"getArray",
"(",
")",
";",
"return",
"$",
"this",
"->... | We will manipulate the string to get each array index
and find array value.
@param string $string
@return mixed | [
"We",
"will",
"manipulate",
"the",
"string",
"to",
"get",
"each",
"array",
"index",
"and",
"find",
"array",
"value",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Common/ArrayManipulator/ArrayAccessor.php#L78-L84 |
231,176 | cygnite/framework | src/Cygnite/Common/ArrayManipulator/ArrayAccessor.php | ArrayAccessor.keyExists | public function keyExists($key, $array)
{
if (array_key_exists($key, $array)) {
return true;
}
foreach ($array as $k => $value) {
if (!is_array($value)) {
continue;
}
if (array_key_exists($key, $value)) {
return true;
}
}
return false;
} | php | public function keyExists($key, $array)
{
if (array_key_exists($key, $array)) {
return true;
}
foreach ($array as $k => $value) {
if (!is_array($value)) {
continue;
}
if (array_key_exists($key, $value)) {
return true;
}
}
return false;
} | [
"public",
"function",
"keyExists",
"(",
"$",
"key",
",",
"$",
"array",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"array",
")",
")",
"{",
"return",
"true",
";",
"}",
"foreach",
"(",
"$",
"array",
"as",
"$",
"k",
"=>",
"$"... | Determine if array key exists from multi-dimensional array.
@param $key
@param $array
@return bool | [
"Determine",
"if",
"array",
"key",
"exists",
"from",
"multi",
"-",
"dimensional",
"array",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Common/ArrayManipulator/ArrayAccessor.php#L106-L123 |
231,177 | AppShed/extension-api | src/AppShed/Remote/Style/Image.php | Image.toCSS | public function toCSS(CSSDocument $css, $selector)
{
if ($this->url) {
$size = 'contain';
$repeat = 'no-repeat';
$positionHor = 'center';
$positionVer = 'center';
switch ($this->style) {
case self::TYPE_STRETCH:
$size = '100% 100%';
break;
case self::TYPE_TILE:
$repeat = 'repeat';
break;
case self::TYPE_CENTER:
if (is_array($this->size)) {
$size = "{$this->size['width']}px {$this->size['height']}px";
} else {
$size = 'auto';
}
break;
case self::TYPE_FILL:
$size = 'cover';
break;
}
if ($this->attachment) {
$i = $this->attachment & 3;
if ($i == 1) {
$positionHor = 'left';
} else {
if ($i == 3) {
$positionHor = 'right';
}
}
$i = $this->attachment & 12;
if ($i == 4) {
$positionVer = 'top';
} else {
if ($i == 12) {
$positionVer = 'bottom';
}
}
}
$css->addRule($selector, 'background-image', $css->getURLValue($this->url));
$css->addRule($selector, 'background-repeat', $repeat);
$css->addRule($selector, 'background-position', "$positionHor $positionVer");
$css->addRule($selector, 'background-size', $size);
}
$css->addRule($selector, 'background-color', $css->getColorValue($this->color));
} | php | public function toCSS(CSSDocument $css, $selector)
{
if ($this->url) {
$size = 'contain';
$repeat = 'no-repeat';
$positionHor = 'center';
$positionVer = 'center';
switch ($this->style) {
case self::TYPE_STRETCH:
$size = '100% 100%';
break;
case self::TYPE_TILE:
$repeat = 'repeat';
break;
case self::TYPE_CENTER:
if (is_array($this->size)) {
$size = "{$this->size['width']}px {$this->size['height']}px";
} else {
$size = 'auto';
}
break;
case self::TYPE_FILL:
$size = 'cover';
break;
}
if ($this->attachment) {
$i = $this->attachment & 3;
if ($i == 1) {
$positionHor = 'left';
} else {
if ($i == 3) {
$positionHor = 'right';
}
}
$i = $this->attachment & 12;
if ($i == 4) {
$positionVer = 'top';
} else {
if ($i == 12) {
$positionVer = 'bottom';
}
}
}
$css->addRule($selector, 'background-image', $css->getURLValue($this->url));
$css->addRule($selector, 'background-repeat', $repeat);
$css->addRule($selector, 'background-position', "$positionHor $positionVer");
$css->addRule($selector, 'background-size', $size);
}
$css->addRule($selector, 'background-color', $css->getColorValue($this->color));
} | [
"public",
"function",
"toCSS",
"(",
"CSSDocument",
"$",
"css",
",",
"$",
"selector",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"url",
")",
"{",
"$",
"size",
"=",
"'contain'",
";",
"$",
"repeat",
"=",
"'no-repeat'",
";",
"$",
"positionHor",
"=",
"'cente... | Add CSS rules for this element to the given document
@param CSSDocument $css
@param string $selector | [
"Add",
"CSS",
"rules",
"for",
"this",
"element",
"to",
"the",
"given",
"document"
] | c030f489e419cc5240f6e48b828b9349bb27cfaf | https://github.com/AppShed/extension-api/blob/c030f489e419cc5240f6e48b828b9349bb27cfaf/src/AppShed/Remote/Style/Image.php#L169-L221 |
231,178 | ctbsea/phalapi-smarty | src/Smarty/sysplugins/smarty_template_compiled.php | Smarty_Template_Compiled.process | public function process(Smarty_Internal_Template $_template)
{
$_smarty_tpl = $_template;
if ($_template->source->handler->recompiled || !$_template->compiled->exists ||
$_template->smarty->force_compile || ($_template->smarty->compile_check &&
$_template->source->getTimeStamp() > $_template->compiled->getTimeStamp())
) {
$this->compileTemplateSource($_template);
$compileCheck = $_template->smarty->compile_check;
$_template->smarty->compile_check = false;
if ($_template->source->handler->recompiled) {
$level = ob_get_level();
ob_start();
try {
eval("?>" . $this->content);
}
catch (Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
ob_get_clean();
$this->content = null;
} else {
$this->loadCompiledTemplate($_template);
}
$_template->smarty->compile_check = $compileCheck;
} else {
$_template->mustCompile = true;
@include($_template->compiled->filepath);
if ($_template->mustCompile) {
$this->compileTemplateSource($_template);
$compileCheck = $_template->smarty->compile_check;
$_template->smarty->compile_check = false;
$this->loadCompiledTemplate($_template);
$_template->smarty->compile_check = $compileCheck;
}
}
$_template->smarty->ext->_subTemplate->registerSubTemplates($_template);
$this->processed = true;
} | php | public function process(Smarty_Internal_Template $_template)
{
$_smarty_tpl = $_template;
if ($_template->source->handler->recompiled || !$_template->compiled->exists ||
$_template->smarty->force_compile || ($_template->smarty->compile_check &&
$_template->source->getTimeStamp() > $_template->compiled->getTimeStamp())
) {
$this->compileTemplateSource($_template);
$compileCheck = $_template->smarty->compile_check;
$_template->smarty->compile_check = false;
if ($_template->source->handler->recompiled) {
$level = ob_get_level();
ob_start();
try {
eval("?>" . $this->content);
}
catch (Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
ob_get_clean();
$this->content = null;
} else {
$this->loadCompiledTemplate($_template);
}
$_template->smarty->compile_check = $compileCheck;
} else {
$_template->mustCompile = true;
@include($_template->compiled->filepath);
if ($_template->mustCompile) {
$this->compileTemplateSource($_template);
$compileCheck = $_template->smarty->compile_check;
$_template->smarty->compile_check = false;
$this->loadCompiledTemplate($_template);
$_template->smarty->compile_check = $compileCheck;
}
}
$_template->smarty->ext->_subTemplate->registerSubTemplates($_template);
$this->processed = true;
} | [
"public",
"function",
"process",
"(",
"Smarty_Internal_Template",
"$",
"_template",
")",
"{",
"$",
"_smarty_tpl",
"=",
"$",
"_template",
";",
"if",
"(",
"$",
"_template",
"->",
"source",
"->",
"handler",
"->",
"recompiled",
"||",
"!",
"$",
"_template",
"->",... | load compiled template or compile from source
@param Smarty_Internal_Template $_template
@throws Exception | [
"load",
"compiled",
"template",
"or",
"compile",
"from",
"source"
] | 4d40da3e4482c0749f3cfd1605265a109a1c495f | https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_template_compiled.php#L116-L158 |
231,179 | ctbsea/phalapi-smarty | src/Smarty/sysplugins/smarty_template_compiled.php | Smarty_Template_Compiled.loadCompiledTemplate | private function loadCompiledTemplate(Smarty_Internal_Template $_template)
{
if (function_exists('opcache_invalidate')) {
opcache_invalidate($_template->compiled->filepath);
}
$_smarty_tpl = $_template;
if (defined('HHVM_VERSION')) {
$_template->smarty->ext->_hhvm->includeHhvm($_template, $_template->compiled->filepath);
} else {
include($_template->compiled->filepath);
}
} | php | private function loadCompiledTemplate(Smarty_Internal_Template $_template)
{
if (function_exists('opcache_invalidate')) {
opcache_invalidate($_template->compiled->filepath);
}
$_smarty_tpl = $_template;
if (defined('HHVM_VERSION')) {
$_template->smarty->ext->_hhvm->includeHhvm($_template, $_template->compiled->filepath);
} else {
include($_template->compiled->filepath);
}
} | [
"private",
"function",
"loadCompiledTemplate",
"(",
"Smarty_Internal_Template",
"$",
"_template",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'opcache_invalidate'",
")",
")",
"{",
"opcache_invalidate",
"(",
"$",
"_template",
"->",
"compiled",
"->",
"filepath",
")"... | Load fresh compiled template by including the PHP file
HHVM requires a work around because of a PHP incompatibility
@param \Smarty_Internal_Template $_template | [
"Load",
"fresh",
"compiled",
"template",
"by",
"including",
"the",
"PHP",
"file",
"HHVM",
"requires",
"a",
"work",
"around",
"because",
"of",
"a",
"PHP",
"incompatibility"
] | 4d40da3e4482c0749f3cfd1605265a109a1c495f | https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_template_compiled.php#L166-L177 |
231,180 | ctbsea/phalapi-smarty | src/Smarty/sysplugins/smarty_template_compiled.php | Smarty_Template_Compiled.compileTemplateSource | public function compileTemplateSource(Smarty_Internal_Template $_template)
{
$_template->source->compileds = array();
$this->file_dependency = array();
$this->tpl_function = array();
$this->includes = array();
$this->nocache_hash = null;
$this->unifunc = null;
// compile locking
if (!$_template->source->handler->recompiled) {
if ($saved_timestamp = $_template->compiled->getTimeStamp()) {
touch($_template->compiled->filepath);
}
}
// call compiler
try {
$_template->loadCompiler();
$code = $_template->compiler->compileTemplate($_template);
}
catch (Exception $e) {
// restore old timestamp in case of error
if (!$_template->source->handler->recompiled && $saved_timestamp) {
touch($_template->compiled->filepath, $saved_timestamp);
}
throw $e;
}
// compiling succeeded
if ($_template->compiler->write_compiled_code) {
// write compiled template
$this->write($_template, $code);
$code = '';
}
// release compiler object to free memory
unset($_template->compiler);
return $code;
} | php | public function compileTemplateSource(Smarty_Internal_Template $_template)
{
$_template->source->compileds = array();
$this->file_dependency = array();
$this->tpl_function = array();
$this->includes = array();
$this->nocache_hash = null;
$this->unifunc = null;
// compile locking
if (!$_template->source->handler->recompiled) {
if ($saved_timestamp = $_template->compiled->getTimeStamp()) {
touch($_template->compiled->filepath);
}
}
// call compiler
try {
$_template->loadCompiler();
$code = $_template->compiler->compileTemplate($_template);
}
catch (Exception $e) {
// restore old timestamp in case of error
if (!$_template->source->handler->recompiled && $saved_timestamp) {
touch($_template->compiled->filepath, $saved_timestamp);
}
throw $e;
}
// compiling succeeded
if ($_template->compiler->write_compiled_code) {
// write compiled template
$this->write($_template, $code);
$code = '';
}
// release compiler object to free memory
unset($_template->compiler);
return $code;
} | [
"public",
"function",
"compileTemplateSource",
"(",
"Smarty_Internal_Template",
"$",
"_template",
")",
"{",
"$",
"_template",
"->",
"source",
"->",
"compileds",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"file_dependency",
"=",
"array",
"(",
")",
";",
"... | compile template from source
@param Smarty_Internal_Template $_template
@return string
@throws Exception | [
"compile",
"template",
"from",
"source"
] | 4d40da3e4482c0749f3cfd1605265a109a1c495f | https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_template_compiled.php#L219-L254 |
231,181 | ctbsea/phalapi-smarty | src/Smarty/sysplugins/smarty_template_compiled.php | Smarty_Template_Compiled.write | public function write(Smarty_Internal_Template $_template, $code)
{
if (!$_template->source->handler->recompiled) {
if ($_template->smarty->ext->_writeFile->writeFile($this->filepath, $code, $_template->smarty) === true) {
$this->timestamp = $this->exists = is_file($this->filepath);
if ($this->exists) {
$this->timestamp = filemtime($this->filepath);
return true;
}
}
return false;
} else {
$this->content = $code;
}
$this->timestamp = time();
$this->exists = true;
return true;
} | php | public function write(Smarty_Internal_Template $_template, $code)
{
if (!$_template->source->handler->recompiled) {
if ($_template->smarty->ext->_writeFile->writeFile($this->filepath, $code, $_template->smarty) === true) {
$this->timestamp = $this->exists = is_file($this->filepath);
if ($this->exists) {
$this->timestamp = filemtime($this->filepath);
return true;
}
}
return false;
} else {
$this->content = $code;
}
$this->timestamp = time();
$this->exists = true;
return true;
} | [
"public",
"function",
"write",
"(",
"Smarty_Internal_Template",
"$",
"_template",
",",
"$",
"code",
")",
"{",
"if",
"(",
"!",
"$",
"_template",
"->",
"source",
"->",
"handler",
"->",
"recompiled",
")",
"{",
"if",
"(",
"$",
"_template",
"->",
"smarty",
"-... | Write compiled code by handler
@param Smarty_Internal_Template $_template template object
@param string $code compiled code
@return boolean success | [
"Write",
"compiled",
"code",
"by",
"handler"
] | 4d40da3e4482c0749f3cfd1605265a109a1c495f | https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_template_compiled.php#L264-L281 |
231,182 | ctbsea/phalapi-smarty | src/Smarty/sysplugins/smarty_template_compiled.php | Smarty_Template_Compiled.read | public function read(Smarty_Internal_Template $_template)
{
if (!$_template->source->handler->recompiled) {
return file_get_contents($this->filepath);
}
return isset($this->content) ? $this->content : false;
} | php | public function read(Smarty_Internal_Template $_template)
{
if (!$_template->source->handler->recompiled) {
return file_get_contents($this->filepath);
}
return isset($this->content) ? $this->content : false;
} | [
"public",
"function",
"read",
"(",
"Smarty_Internal_Template",
"$",
"_template",
")",
"{",
"if",
"(",
"!",
"$",
"_template",
"->",
"source",
"->",
"handler",
"->",
"recompiled",
")",
"{",
"return",
"file_get_contents",
"(",
"$",
"this",
"->",
"filepath",
")"... | Read compiled content from handler
@param Smarty_Internal_Template $_template template object
@return string content | [
"Read",
"compiled",
"content",
"from",
"handler"
] | 4d40da3e4482c0749f3cfd1605265a109a1c495f | https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_template_compiled.php#L290-L296 |
231,183 | tapestry-cloud/tapestry | src/Entities/Generators/FileGenerator.php | FileGenerator.canGenerate | private function canGenerate()
{
foreach ($this->generatedFiles as $file) {
if ($uses = $file->getData('generator')) {
if (count($uses) > 0) {
return true;
}
}
}
return false;
} | php | private function canGenerate()
{
foreach ($this->generatedFiles as $file) {
if ($uses = $file->getData('generator')) {
if (count($uses) > 0) {
return true;
}
}
}
return false;
} | [
"private",
"function",
"canGenerate",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"generatedFiles",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"uses",
"=",
"$",
"file",
"->",
"getData",
"(",
"'generator'",
")",
")",
"{",
"if",
"(",
"count",
... | Identify whether we can continue generating.
@return bool | [
"Identify",
"whether",
"we",
"can",
"continue",
"generating",
"."
] | f3fc980b2484ccbe609a7f811c65b91254e8720e | https://github.com/tapestry-cloud/tapestry/blob/f3fc980b2484ccbe609a7f811c65b91254e8720e/src/Entities/Generators/FileGenerator.php#L74-L85 |
231,184 | tapestry-cloud/tapestry | src/Entities/Generators/FileGenerator.php | FileGenerator.mergeGenerated | private function mergeGenerated($generated)
{
if (! is_array($generated)) {
$this->generatedFiles[$generated->getUid()] = $generated;
} else {
foreach ($generated as $file) {
$this->mergeGenerated($file);
}
}
} | php | private function mergeGenerated($generated)
{
if (! is_array($generated)) {
$this->generatedFiles[$generated->getUid()] = $generated;
} else {
foreach ($generated as $file) {
$this->mergeGenerated($file);
}
}
} | [
"private",
"function",
"mergeGenerated",
"(",
"$",
"generated",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"generated",
")",
")",
"{",
"$",
"this",
"->",
"generatedFiles",
"[",
"$",
"generated",
"->",
"getUid",
"(",
")",
"]",
"=",
"$",
"generated"... | Merge the generated files into our local generatedFiles list.
@param File|File[] $generated | [
"Merge",
"the",
"generated",
"files",
"into",
"our",
"local",
"generatedFiles",
"list",
"."
] | f3fc980b2484ccbe609a7f811c65b91254e8720e | https://github.com/tapestry-cloud/tapestry/blob/f3fc980b2484ccbe609a7f811c65b91254e8720e/src/Entities/Generators/FileGenerator.php#L92-L101 |
231,185 | tapestry-cloud/tapestry | src/Providers/CommandServiceProvider.php | CommandServiceProvider.registerInitCommand | protected function registerInitCommand()
{
$this->getContainer()->add(InitCommand::class)
->withArguments([
\Symfony\Component\Filesystem\Filesystem::class,
\Symfony\Component\Finder\Finder::class,
]);
} | php | protected function registerInitCommand()
{
$this->getContainer()->add(InitCommand::class)
->withArguments([
\Symfony\Component\Filesystem\Filesystem::class,
\Symfony\Component\Finder\Finder::class,
]);
} | [
"protected",
"function",
"registerInitCommand",
"(",
")",
"{",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"add",
"(",
"InitCommand",
"::",
"class",
")",
"->",
"withArguments",
"(",
"[",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Filesystem",
"\\",
... | Register init command.
@return void | [
"Register",
"init",
"command",
"."
] | f3fc980b2484ccbe609a7f811c65b91254e8720e | https://github.com/tapestry-cloud/tapestry/blob/f3fc980b2484ccbe609a7f811c65b91254e8720e/src/Providers/CommandServiceProvider.php#L61-L68 |
231,186 | tapestry-cloud/tapestry | src/Providers/CommandServiceProvider.php | CommandServiceProvider.registerBuildCommand | protected function registerBuildCommand()
{
$steps = $this->getContainer()->get('Compile.Steps');
$this->getContainer()->add(BuildCommand::class)
->withArguments([
Tapestry::class,
$steps,
]);
} | php | protected function registerBuildCommand()
{
$steps = $this->getContainer()->get('Compile.Steps');
$this->getContainer()->add(BuildCommand::class)
->withArguments([
Tapestry::class,
$steps,
]);
} | [
"protected",
"function",
"registerBuildCommand",
"(",
")",
"{",
"$",
"steps",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'Compile.Steps'",
")",
";",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"add",
"(",
"BuildCommand",
... | Register build command.
@throws ContainerExceptionInterface
@throws NotFoundExceptionInterface
@return void | [
"Register",
"build",
"command",
"."
] | f3fc980b2484ccbe609a7f811c65b91254e8720e | https://github.com/tapestry-cloud/tapestry/blob/f3fc980b2484ccbe609a7f811c65b91254e8720e/src/Providers/CommandServiceProvider.php#L88-L96 |
231,187 | tapestry-cloud/tapestry | src/Providers/CommandServiceProvider.php | CommandServiceProvider.registerSelfUpdateCommand | protected function registerSelfUpdateCommand()
{
$this->getContainer()->add(SelfUpdateCommand::class)
->withArguments([
\Symfony\Component\Filesystem\Filesystem::class,
\Symfony\Component\Finder\Finder::class,
]);
} | php | protected function registerSelfUpdateCommand()
{
$this->getContainer()->add(SelfUpdateCommand::class)
->withArguments([
\Symfony\Component\Filesystem\Filesystem::class,
\Symfony\Component\Finder\Finder::class,
]);
} | [
"protected",
"function",
"registerSelfUpdateCommand",
"(",
")",
"{",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"add",
"(",
"SelfUpdateCommand",
"::",
"class",
")",
"->",
"withArguments",
"(",
"[",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Filesystem"... | Register self update command if executed within a Phar.
@return void | [
"Register",
"self",
"update",
"command",
"if",
"executed",
"within",
"a",
"Phar",
"."
] | f3fc980b2484ccbe609a7f811c65b91254e8720e | https://github.com/tapestry-cloud/tapestry/blob/f3fc980b2484ccbe609a7f811c65b91254e8720e/src/Providers/CommandServiceProvider.php#L103-L110 |
231,188 | inetprocess/libsugarcrm | src/MetadataParser.php | MetadataParser.getParser | protected function getParser($module)
{
$parser = \ParserFactory::getParser('recordview', $module);
if (empty($parser->_viewdefs['panels'])) {
throw new SugarException("Can't work with the view, try to redeploy it with the Studio");
}
return $parser;
} | php | protected function getParser($module)
{
$parser = \ParserFactory::getParser('recordview', $module);
if (empty($parser->_viewdefs['panels'])) {
throw new SugarException("Can't work with the view, try to redeploy it with the Studio");
}
return $parser;
} | [
"protected",
"function",
"getParser",
"(",
"$",
"module",
")",
"{",
"$",
"parser",
"=",
"\\",
"ParserFactory",
"::",
"getParser",
"(",
"'recordview'",
",",
"$",
"module",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"parser",
"->",
"_viewdefs",
"[",
"'panels'... | Return the parser
@param string $module
@return AbstractMetaDataParser | [
"Return",
"the",
"parser"
] | 493bb105c29996dc583181431fcb0987fd1fed70 | https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/MetadataParser.php#L140-L149 |
231,189 | inetprocess/libsugarcrm | src/MetadataParser.php | MetadataParser.getRecordViewButtons | protected function getRecordViewButtons(\AbstractMetaDataParser $parser, $type)
{
$keyDp = null;
foreach ($parser->_viewdefs['buttons'] as $key => $buttonsType) {
if ($buttonsType['type'] === $type) {
$keyDp = $key;
break;
}
}
if (is_null($keyDp)) {
throw new SugarException("Can't find the $type array in record.php");
}
return $parser->_viewdefs['buttons'][$keyDp]['buttons'];
} | php | protected function getRecordViewButtons(\AbstractMetaDataParser $parser, $type)
{
$keyDp = null;
foreach ($parser->_viewdefs['buttons'] as $key => $buttonsType) {
if ($buttonsType['type'] === $type) {
$keyDp = $key;
break;
}
}
if (is_null($keyDp)) {
throw new SugarException("Can't find the $type array in record.php");
}
return $parser->_viewdefs['buttons'][$keyDp]['buttons'];
} | [
"protected",
"function",
"getRecordViewButtons",
"(",
"\\",
"AbstractMetaDataParser",
"$",
"parser",
",",
"$",
"type",
")",
"{",
"$",
"keyDp",
"=",
"null",
";",
"foreach",
"(",
"$",
"parser",
"->",
"_viewdefs",
"[",
"'buttons'",
"]",
"as",
"$",
"key",
"=>"... | Get the record view buttons defined for a view
@param \AbstractMetaDataParser $parser
@param string $module
@param string $type Buttons Types (such as actiondropdown)
@return array | [
"Get",
"the",
"record",
"view",
"buttons",
"defined",
"for",
"a",
"view"
] | 493bb105c29996dc583181431fcb0987fd1fed70 | https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/MetadataParser.php#L158-L173 |
231,190 | inetprocess/libsugarcrm | src/MetadataParser.php | MetadataParser.setRecordViewButtons | protected function setRecordViewButtons(\AbstractMetaDataParser $parser, $type, array $buttons)
{
foreach ($parser->_viewdefs['buttons'] as $key => $buttonsType) {
if ($buttonsType['type'] === $type) {
$keyDp = $key;
break;
}
}
$parser->_viewdefs['buttons'][$keyDp]['buttons'] = $buttons;
$parser->handleSave(false);
} | php | protected function setRecordViewButtons(\AbstractMetaDataParser $parser, $type, array $buttons)
{
foreach ($parser->_viewdefs['buttons'] as $key => $buttonsType) {
if ($buttonsType['type'] === $type) {
$keyDp = $key;
break;
}
}
$parser->_viewdefs['buttons'][$keyDp]['buttons'] = $buttons;
$parser->handleSave(false);
} | [
"protected",
"function",
"setRecordViewButtons",
"(",
"\\",
"AbstractMetaDataParser",
"$",
"parser",
",",
"$",
"type",
",",
"array",
"$",
"buttons",
")",
"{",
"foreach",
"(",
"$",
"parser",
"->",
"_viewdefs",
"[",
"'buttons'",
"]",
"as",
"$",
"key",
"=>",
... | Save a new configuration of buttons
@param \AbstractMetaDataParser $parser
@param string $type Buttons Types (such as actiondropdown) | [
"Save",
"a",
"new",
"configuration",
"of",
"buttons"
] | 493bb105c29996dc583181431fcb0987fd1fed70 | https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/MetadataParser.php#L180-L191 |
231,191 | inetprocess/libsugarcrm | src/Database/Query.php | Query.getRawSql | public function getRawSql()
{
$search = array();
$replace = array();
$params = $this->getParams();
ksort($params, SORT_STRING);
foreach ($params as $key => $value) {
if (is_int($key)) {
$key = '?';
}
$search[] = $key;
if (is_string($value)) {
$value = "'$value'";
}
$replace[] = $value;
}
return str_replace($search, $replace, $this->getSql());
} | php | public function getRawSql()
{
$search = array();
$replace = array();
$params = $this->getParams();
ksort($params, SORT_STRING);
foreach ($params as $key => $value) {
if (is_int($key)) {
$key = '?';
}
$search[] = $key;
if (is_string($value)) {
$value = "'$value'";
}
$replace[] = $value;
}
return str_replace($search, $replace, $this->getSql());
} | [
"public",
"function",
"getRawSql",
"(",
")",
"{",
"$",
"search",
"=",
"array",
"(",
")",
";",
"$",
"replace",
"=",
"array",
"(",
")",
";",
"$",
"params",
"=",
"$",
"this",
"->",
"getParams",
"(",
")",
";",
"ksort",
"(",
"$",
"params",
",",
"SORT_... | Interpolate the sql query with the parameters.
Do not try to execute this query directly as it can lead to SQL Injection.
@todo Quote with pdo. | [
"Interpolate",
"the",
"sql",
"query",
"with",
"the",
"parameters",
".",
"Do",
"not",
"try",
"to",
"execute",
"this",
"query",
"directly",
"as",
"it",
"can",
"lead",
"to",
"SQL",
"Injection",
"."
] | 493bb105c29996dc583181431fcb0987fd1fed70 | https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Database/Query.php#L57-L74 |
231,192 | lennerd/vipx-bot-detect | Metadata/Loader/YamlFileLoader.php | YamlFileLoader.parseBots | private function parseBots(MetadataCollection $collection, $content)
{
if (!isset($content['bots'])) {
return;
}
foreach ($content['bots'] as $name => $bot) {
$ip = isset($bot['ip']) ? $bot['ip'] : null;
$metadata = new Metadata($name, $bot['agent'], $ip);
if (isset($bot['type'])) {
$metadata->setType($bot['type']);
}
if (isset($bot['meta'])) {
$metadata->setMeta($bot['meta']);
}
if (isset($bot['agent_match'])) {
$metadata->setAgentMatch($bot['agent_match']);
}
$collection->addMetadata($metadata);
}
} | php | private function parseBots(MetadataCollection $collection, $content)
{
if (!isset($content['bots'])) {
return;
}
foreach ($content['bots'] as $name => $bot) {
$ip = isset($bot['ip']) ? $bot['ip'] : null;
$metadata = new Metadata($name, $bot['agent'], $ip);
if (isset($bot['type'])) {
$metadata->setType($bot['type']);
}
if (isset($bot['meta'])) {
$metadata->setMeta($bot['meta']);
}
if (isset($bot['agent_match'])) {
$metadata->setAgentMatch($bot['agent_match']);
}
$collection->addMetadata($metadata);
}
} | [
"private",
"function",
"parseBots",
"(",
"MetadataCollection",
"$",
"collection",
",",
"$",
"content",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"content",
"[",
"'bots'",
"]",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"content",
"[",
... | Parses all bot metadatas
@param MetadataCollection $collection
@param $content
@return array | [
"Parses",
"all",
"bot",
"metadatas"
] | b35c10c99841f6372646dd26429ed140137febb1 | https://github.com/lennerd/vipx-bot-detect/blob/b35c10c99841f6372646dd26429ed140137febb1/Metadata/Loader/YamlFileLoader.php#L82-L106 |
231,193 | AppShed/extension-api | src/AppShed/Remote/HTML/Remote.php | Remote.getSettings | public function getSettings()
{
$settings = new Settings();
$requestUrl = $this->getRequestUrl();
$settings->setFetchUrl($requestUrl);
$settings->setPrefix(sha1($requestUrl));
$settings->setEmailPreview(isset($_REQUEST['emailPreview']) ? $_REQUEST['emailPreview'] === 'true' : false);
$settings->setPhonePreview(isset($_REQUEST['telPreview']) ? $_REQUEST['telPreview'] === 'true' : false);
return $settings;
} | php | public function getSettings()
{
$settings = new Settings();
$requestUrl = $this->getRequestUrl();
$settings->setFetchUrl($requestUrl);
$settings->setPrefix(sha1($requestUrl));
$settings->setEmailPreview(isset($_REQUEST['emailPreview']) ? $_REQUEST['emailPreview'] === 'true' : false);
$settings->setPhonePreview(isset($_REQUEST['telPreview']) ? $_REQUEST['telPreview'] === 'true' : false);
return $settings;
} | [
"public",
"function",
"getSettings",
"(",
")",
"{",
"$",
"settings",
"=",
"new",
"Settings",
"(",
")",
";",
"$",
"requestUrl",
"=",
"$",
"this",
"->",
"getRequestUrl",
"(",
")",
";",
"$",
"settings",
"->",
"setFetchUrl",
"(",
"$",
"requestUrl",
")",
";... | Get the settings sent from the app
@return \AppShed\Remote\HTML\Settings | [
"Get",
"the",
"settings",
"sent",
"from",
"the",
"app"
] | c030f489e419cc5240f6e48b828b9349bb27cfaf | https://github.com/AppShed/extension-api/blob/c030f489e419cc5240f6e48b828b9349bb27cfaf/src/AppShed/Remote/HTML/Remote.php#L70-L79 |
231,194 | AppShed/extension-api | src/AppShed/Remote/HTML/Remote.php | Remote.getResponseObject | public function getResponseObject($settings = null)
{
if (!$settings) {
$settings = $this->getSettings();
}
$xml = new DOMDocument();
$this->root->getHTMLNode($xml, $settings);
foreach ($this->roots as $root) {
$root->getHTMLNode($xml, $settings);
}
return [
'app' => $settings->getApps(),
'screen' => $settings->getScreens(),
'settings' => [
'main' => $settings->getPrefix() . $this->root->getId(),
'maintype' => $this->root instanceof App ? 'app' : 'screen'
]
];
} | php | public function getResponseObject($settings = null)
{
if (!$settings) {
$settings = $this->getSettings();
}
$xml = new DOMDocument();
$this->root->getHTMLNode($xml, $settings);
foreach ($this->roots as $root) {
$root->getHTMLNode($xml, $settings);
}
return [
'app' => $settings->getApps(),
'screen' => $settings->getScreens(),
'settings' => [
'main' => $settings->getPrefix() . $this->root->getId(),
'maintype' => $this->root instanceof App ? 'app' : 'screen'
]
];
} | [
"public",
"function",
"getResponseObject",
"(",
"$",
"settings",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"settings",
")",
"{",
"$",
"settings",
"=",
"$",
"this",
"->",
"getSettings",
"(",
")",
";",
"}",
"$",
"xml",
"=",
"new",
"DOMDocument",
"(",... | Get the JSON object that should be sent to the client
@param \AppShed\Remote\HTML\Settings $settings
@return array | [
"Get",
"the",
"JSON",
"object",
"that",
"should",
"be",
"sent",
"to",
"the",
"client"
] | c030f489e419cc5240f6e48b828b9349bb27cfaf | https://github.com/AppShed/extension-api/blob/c030f489e419cc5240f6e48b828b9349bb27cfaf/src/AppShed/Remote/HTML/Remote.php#L88-L108 |
231,195 | AppShed/extension-api | src/AppShed/Remote/HTML/Remote.php | Remote.getResponse | public function getResponse(Settings $settings = null, $header = true, $return = false)
{
$callback = $this->getCallback();
if ($header) {
if (static::getCORSResponse()) {
return null;
}
if ($callback) {
header('Content-type: application/javascript');
} else {
header('Content-type: application/json');
}
}
if (!$settings) {
$settings = $this->getSettings();
}
$data = $this->getResponseObject($settings);
$data['remote'] = [
'url' => $settings->getFetchUrl(),
'refreshAfter' => $this->refreshAfter
];
$data['remote'][$settings->getFetchUrl()] = $data['settings']['main'];
$json = json_encode($data);
if ($callback) {
$ret = "$callback(" . $json . ");";
} else {
$ret = $json;
}
if ($return) {
return $ret;
}
echo $ret;
return null;
} | php | public function getResponse(Settings $settings = null, $header = true, $return = false)
{
$callback = $this->getCallback();
if ($header) {
if (static::getCORSResponse()) {
return null;
}
if ($callback) {
header('Content-type: application/javascript');
} else {
header('Content-type: application/json');
}
}
if (!$settings) {
$settings = $this->getSettings();
}
$data = $this->getResponseObject($settings);
$data['remote'] = [
'url' => $settings->getFetchUrl(),
'refreshAfter' => $this->refreshAfter
];
$data['remote'][$settings->getFetchUrl()] = $data['settings']['main'];
$json = json_encode($data);
if ($callback) {
$ret = "$callback(" . $json . ");";
} else {
$ret = $json;
}
if ($return) {
return $ret;
}
echo $ret;
return null;
} | [
"public",
"function",
"getResponse",
"(",
"Settings",
"$",
"settings",
"=",
"null",
",",
"$",
"header",
"=",
"true",
",",
"$",
"return",
"=",
"false",
")",
"{",
"$",
"callback",
"=",
"$",
"this",
"->",
"getCallback",
"(",
")",
";",
"if",
"(",
"$",
... | Get the response text for the client, as either json, or jsonp
@param \AppShed\Remote\HTML\Settings $settings
@param bool $header Whether to set the correct headers
@param bool $return if true the response is returned, otherwise it will be echoed
@return string | [
"Get",
"the",
"response",
"text",
"for",
"the",
"client",
"as",
"either",
"json",
"or",
"jsonp"
] | c030f489e419cc5240f6e48b828b9349bb27cfaf | https://github.com/AppShed/extension-api/blob/c030f489e419cc5240f6e48b828b9349bb27cfaf/src/AppShed/Remote/HTML/Remote.php#L119-L159 |
231,196 | AppShed/extension-api | src/AppShed/Remote/HTML/Remote.php | Remote.getSymfonyResponse | public function getSymfonyResponse($settings = null)
{
$headers = static::getCORSResponseHeaders();
if (static::isOptionsRequest()) {
return new \Symfony\Component\HttpFoundation\Response('', 200, $headers);
}
if (!$settings) {
$settings = $this->getSettings();
}
$data = $this->getResponseObject($settings);
$data['remote'] = [
'url' => $settings->getFetchUrl(),
'refreshAfter' => $this->refreshAfter
];
$data['remote'][$settings->getFetchUrl()] = $data['settings']['main'];
$response = new \Symfony\Component\HttpFoundation\JsonResponse($data, 200, $headers);
if (($callback = $this->getCallback())) {
$response->setCallback($callback);
}
return $response;
} | php | public function getSymfonyResponse($settings = null)
{
$headers = static::getCORSResponseHeaders();
if (static::isOptionsRequest()) {
return new \Symfony\Component\HttpFoundation\Response('', 200, $headers);
}
if (!$settings) {
$settings = $this->getSettings();
}
$data = $this->getResponseObject($settings);
$data['remote'] = [
'url' => $settings->getFetchUrl(),
'refreshAfter' => $this->refreshAfter
];
$data['remote'][$settings->getFetchUrl()] = $data['settings']['main'];
$response = new \Symfony\Component\HttpFoundation\JsonResponse($data, 200, $headers);
if (($callback = $this->getCallback())) {
$response->setCallback($callback);
}
return $response;
} | [
"public",
"function",
"getSymfonyResponse",
"(",
"$",
"settings",
"=",
"null",
")",
"{",
"$",
"headers",
"=",
"static",
"::",
"getCORSResponseHeaders",
"(",
")",
";",
"if",
"(",
"static",
"::",
"isOptionsRequest",
"(",
")",
")",
"{",
"return",
"new",
"\\",... | Creates a Symfony response object to simplify using the API in Symfony or frameworks that use the
HttpFoundation component
@param \AppShed\Remote\HTML\Settings $settings
@return \Symfony\Component\HttpFoundation\Response | [
"Creates",
"a",
"Symfony",
"response",
"object",
"to",
"simplify",
"using",
"the",
"API",
"in",
"Symfony",
"or",
"frameworks",
"that",
"use",
"the",
"HttpFoundation",
"component"
] | c030f489e419cc5240f6e48b828b9349bb27cfaf | https://github.com/AppShed/extension-api/blob/c030f489e419cc5240f6e48b828b9349bb27cfaf/src/AppShed/Remote/HTML/Remote.php#L169-L195 |
231,197 | AppShed/extension-api | src/AppShed/Remote/HTML/Remote.php | Remote.getCORSResponseHeaders | public static function getCORSResponseHeaders()
{
$headers = [];
if (isset($_SERVER['HTTP_ORIGIN'])) {
$headers['Access-Control-Allow-Origin'] = $_SERVER['HTTP_ORIGIN'];
$headers['Access-Control-Allow-Credentials'] = 'true';
$headers['Access-Control-Max-Age'] = '86400';
}
if (static::isOptionsRequest()) {
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) {
$headers['Access-Control-Allow-Methods'] = 'GET, POST, OPTIONS';
}
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
$headers['Access-Control-Allow-Headers'] = $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'];
}
}
return $headers;
} | php | public static function getCORSResponseHeaders()
{
$headers = [];
if (isset($_SERVER['HTTP_ORIGIN'])) {
$headers['Access-Control-Allow-Origin'] = $_SERVER['HTTP_ORIGIN'];
$headers['Access-Control-Allow-Credentials'] = 'true';
$headers['Access-Control-Max-Age'] = '86400';
}
if (static::isOptionsRequest()) {
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) {
$headers['Access-Control-Allow-Methods'] = 'GET, POST, OPTIONS';
}
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
$headers['Access-Control-Allow-Headers'] = $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'];
}
}
return $headers;
} | [
"public",
"static",
"function",
"getCORSResponseHeaders",
"(",
")",
"{",
"$",
"headers",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'HTTP_ORIGIN'",
"]",
")",
")",
"{",
"$",
"headers",
"[",
"'Access-Control-Allow-Origin'",
"]",
"=",
... | Get the default CORS headers
@return array | [
"Get",
"the",
"default",
"CORS",
"headers"
] | c030f489e419cc5240f6e48b828b9349bb27cfaf | https://github.com/AppShed/extension-api/blob/c030f489e419cc5240f6e48b828b9349bb27cfaf/src/AppShed/Remote/HTML/Remote.php#L212-L232 |
231,198 | cygnite/framework | src/Cygnite/Translation/Translator.php | Translator.make | public static function make(\Closure $callback = null)
{
if (is_null(static::$instance)) {
static::$instance = new static();
}
if ($callback instanceof \Closure) {
return $callback(static::$instance);
}
return static::$instance;
} | php | public static function make(\Closure $callback = null)
{
if (is_null(static::$instance)) {
static::$instance = new static();
}
if ($callback instanceof \Closure) {
return $callback(static::$instance);
}
return static::$instance;
} | [
"public",
"static",
"function",
"make",
"(",
"\\",
"Closure",
"$",
"callback",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"static",
"::",
"$",
"instance",
")",
")",
"{",
"static",
"::",
"$",
"instance",
"=",
"new",
"static",
"(",
")",
";",
"... | Create Translator instance and return.
Translator::make(function($trans)
{
$trans->locale('es');
});
@param callable $callback
@return static | [
"Create",
"Translator",
"instance",
"and",
"return",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Translation/Translator.php#L49-L60 |
231,199 | cygnite/framework | src/Cygnite/Translation/Translator.php | Translator.locale | public function locale($locale = null)
{
if ($locale) {
// Normalize the language
self::$locale = strtolower(str_replace([' ', '_'], '-', $locale));
}
return self::$locale;
} | php | public function locale($locale = null)
{
if ($locale) {
// Normalize the language
self::$locale = strtolower(str_replace([' ', '_'], '-', $locale));
}
return self::$locale;
} | [
"public",
"function",
"locale",
"(",
"$",
"locale",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"locale",
")",
"{",
"// Normalize the language",
"self",
"::",
"$",
"locale",
"=",
"strtolower",
"(",
"str_replace",
"(",
"[",
"' '",
",",
"'_'",
"]",
",",
"'-'"... | Get and set the target language.
// Get the current language
$locale = $trans->locale();
// Change the current language to Spanish
$trans->locale('es');
@param string $locale new language setting
@return string | [
"Get",
"and",
"set",
"the",
"target",
"language",
"."
] | 58d0cc1c946415eb0867d76218bd35166e999093 | https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Translation/Translator.php#L75-L83 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.