repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
krystal-framework/krystal.framework | src/Krystal/Application/Controller/AbstractController.php | AbstractController.haltOnDemand | final protected function haltOnDemand()
{
switch (true) {
// If at least one of below conditions is true, then $this->halt() is called
case $this->hasOption('secure') && $this->getOptions('secure') == true && !$this->request->isSecure():
case $this->hasOption('ajax') && $this->getOptions('ajax') == true && !$this->request->isAjax():
case $this->hasOption('method') && (strtoupper($this->getOptions('method')) != $this->request->getMethod()):
$this->halt();
}
} | php | final protected function haltOnDemand()
{
switch (true) {
// If at least one of below conditions is true, then $this->halt() is called
case $this->hasOption('secure') && $this->getOptions('secure') == true && !$this->request->isSecure():
case $this->hasOption('ajax') && $this->getOptions('ajax') == true && !$this->request->isAjax():
case $this->hasOption('method') && (strtoupper($this->getOptions('method')) != $this->request->getMethod()):
$this->halt();
}
} | [
"final",
"protected",
"function",
"haltOnDemand",
"(",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"// If at least one of below conditions is true, then $this->halt() is called",
"case",
"$",
"this",
"->",
"hasOption",
"(",
"'secure'",
")",
"&&",
"$",
"this",
"->",
"... | Halts controller's execution on demand
@return void | [
"Halts",
"controller",
"s",
"execution",
"on",
"demand"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/Controller/AbstractController.php#L269-L280 | train |
krystal-framework/krystal.framework | src/Krystal/Application/Controller/AbstractController.php | AbstractController.loadTranslationMessages | private function loadTranslationMessages($language)
{
// Reset any previous translations if any
$this->moduleManager->clearTranslations();
$this->translator->reset();
// Now load new ones
$this->moduleManager->loadAllTranslations($language);
$this->translator->extend($this->moduleManager->getTranslations());
} | php | private function loadTranslationMessages($language)
{
// Reset any previous translations if any
$this->moduleManager->clearTranslations();
$this->translator->reset();
// Now load new ones
$this->moduleManager->loadAllTranslations($language);
$this->translator->extend($this->moduleManager->getTranslations());
} | [
"private",
"function",
"loadTranslationMessages",
"(",
"$",
"language",
")",
"{",
"// Reset any previous translations if any",
"$",
"this",
"->",
"moduleManager",
"->",
"clearTranslations",
"(",
")",
";",
"$",
"this",
"->",
"translator",
"->",
"reset",
"(",
")",
"... | Load translation messages from all available modules
@param string $language
@return void | [
"Load",
"translation",
"messages",
"from",
"all",
"available",
"modules"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/Controller/AbstractController.php#L288-L297 | train |
krystal-framework/krystal.framework | src/Krystal/Application/Controller/AbstractController.php | AbstractController.loadDefaultTranslations | private function loadDefaultTranslations()
{
$language = $this->appConfig->getLanguage();
if ($language !== null) {
$this->loadTranslationMessages($language);
}
} | php | private function loadDefaultTranslations()
{
$language = $this->appConfig->getLanguage();
if ($language !== null) {
$this->loadTranslationMessages($language);
}
} | [
"private",
"function",
"loadDefaultTranslations",
"(",
")",
"{",
"$",
"language",
"=",
"$",
"this",
"->",
"appConfig",
"->",
"getLanguage",
"(",
")",
";",
"if",
"(",
"$",
"language",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"loadTranslationMessages",
"(... | Loads default translations if default language is defined
@return void | [
"Loads",
"default",
"translations",
"if",
"default",
"language",
"is",
"defined"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/Controller/AbstractController.php#L304-L311 | train |
krystal-framework/krystal.framework | src/Krystal/Application/Controller/AbstractController.php | AbstractController.loadTranslations | final protected function loadTranslations($language)
{
// Don't load the same language twice, if that's the case
if ($this->appConfig->getLanguage() !== $language) {
$this->appConfig->setLanguage($language);
$this->loadTranslationMessages($language);
return true;
} else {
return false;
}
} | php | final protected function loadTranslations($language)
{
// Don't load the same language twice, if that's the case
if ($this->appConfig->getLanguage() !== $language) {
$this->appConfig->setLanguage($language);
$this->loadTranslationMessages($language);
return true;
} else {
return false;
}
} | [
"final",
"protected",
"function",
"loadTranslations",
"(",
"$",
"language",
")",
"{",
"// Don't load the same language twice, if that's the case",
"if",
"(",
"$",
"this",
"->",
"appConfig",
"->",
"getLanguage",
"(",
")",
"!==",
"$",
"language",
")",
"{",
"$",
"thi... | Load translation messages
@param string $language
@return boolean | [
"Load",
"translation",
"messages"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/Controller/AbstractController.php#L319-L331 | train |
krystal-framework/krystal.framework | src/Krystal/Application/Controller/AbstractController.php | AbstractController.initialize | final public function initialize($action)
{
$this->haltOnDemand();
// Configure view with defaults
$this->view->setModule($this->getModule())
->setTheme($this->appConfig->getTheme());
if (method_exists($this, 'bootstrap')) {
$this->bootstrap($action);
}
if (method_exists($this, 'onAuth')) {
$this->onAuth();
}
$this->loadDefaultTranslations();
} | php | final public function initialize($action)
{
$this->haltOnDemand();
// Configure view with defaults
$this->view->setModule($this->getModule())
->setTheme($this->appConfig->getTheme());
if (method_exists($this, 'bootstrap')) {
$this->bootstrap($action);
}
if (method_exists($this, 'onAuth')) {
$this->onAuth();
}
$this->loadDefaultTranslations();
} | [
"final",
"public",
"function",
"initialize",
"(",
"$",
"action",
")",
"{",
"$",
"this",
"->",
"haltOnDemand",
"(",
")",
";",
"// Configure view with defaults",
"$",
"this",
"->",
"view",
"->",
"setModule",
"(",
"$",
"this",
"->",
"getModule",
"(",
")",
")"... | Invoked right after class instantiation
@param string $action Current action to be executed
@return void | [
"Invoked",
"right",
"after",
"class",
"instantiation"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/Controller/AbstractController.php#L339-L356 | train |
luismanuelamengual/NeoPHP | src/NeoPHP/Controllers/Controllers.php | Controllers.get | public static function get($controllerClass) {
if (!isset(self::$controllers[$controllerClass])) {
if (class_exists($controllerClass)) {
$reflectionClass = new ReflectionClass($controllerClass);
self::$controllers[$controllerClass] = $reflectionClass->isAbstract()? $controllerClass : (new $controllerClass);
}
else {
self::$controllers[$controllerClass] = null;
}
}
return self::$controllers[$controllerClass];
} | php | public static function get($controllerClass) {
if (!isset(self::$controllers[$controllerClass])) {
if (class_exists($controllerClass)) {
$reflectionClass = new ReflectionClass($controllerClass);
self::$controllers[$controllerClass] = $reflectionClass->isAbstract()? $controllerClass : (new $controllerClass);
}
else {
self::$controllers[$controllerClass] = null;
}
}
return self::$controllers[$controllerClass];
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"controllerClass",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"controllers",
"[",
"$",
"controllerClass",
"]",
")",
")",
"{",
"if",
"(",
"class_exists",
"(",
"$",
"controllerClass",
")",
... | Returns a controller instance
@param string $controllerClass
@return mixed controller instance
@throws ReflectionException | [
"Returns",
"a",
"controller",
"instance"
] | da7c5831974b37dd4b0b170d9aa64e61404d819b | https://github.com/luismanuelamengual/NeoPHP/blob/da7c5831974b37dd4b0b170d9aa64e61404d819b/src/NeoPHP/Controllers/Controllers.php#L22-L33 | train |
katsana/katsana-sdk-laravel | src/Manager.php | Manager.createLaravelDriver | protected function createLaravelDriver(): Sdk\Client
{
return \tap($this->createHttpClient(), function ($client) {
if (isset($this->config['client_id']) || isset($this->config['client_secret'])) {
$client->setClientId($this->config['client_id'])
->setClientSecret($this->config['client_secret']);
}
if (isset($this->config['access_token'])) {
$client->setAccessToken($this->config['access_token']);
}
});
} | php | protected function createLaravelDriver(): Sdk\Client
{
return \tap($this->createHttpClient(), function ($client) {
if (isset($this->config['client_id']) || isset($this->config['client_secret'])) {
$client->setClientId($this->config['client_id'])
->setClientSecret($this->config['client_secret']);
}
if (isset($this->config['access_token'])) {
$client->setAccessToken($this->config['access_token']);
}
});
} | [
"protected",
"function",
"createLaravelDriver",
"(",
")",
":",
"Sdk",
"\\",
"Client",
"{",
"return",
"\\",
"tap",
"(",
"$",
"this",
"->",
"createHttpClient",
"(",
")",
",",
"function",
"(",
"$",
"client",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",... | Create laravel driver.
@return \Katsana\Sdk\Client | [
"Create",
"laravel",
"driver",
"."
] | e3d883daa0cf4211367af918ff42336877dfb4d0 | https://github.com/katsana/katsana-sdk-laravel/blob/e3d883daa0cf4211367af918ff42336877dfb4d0/src/Manager.php#L46-L58 | train |
krystal-framework/krystal.framework | src/Krystal/Cache/Memcached/MemcachedEngine.php | MemcachedEngine.set | public function set($key, $value, $ttl)
{
if (!$this->memcached->set($key, $value, $ttl)) {
// If set() returns false, that means the key already exists,
return $this->memcached->replace($key, $value, $ttl);
} else {
// set() returned true, so the key has been set successfully
return true;
}
} | php | public function set($key, $value, $ttl)
{
if (!$this->memcached->set($key, $value, $ttl)) {
// If set() returns false, that means the key already exists,
return $this->memcached->replace($key, $value, $ttl);
} else {
// set() returned true, so the key has been set successfully
return true;
}
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"ttl",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"memcached",
"->",
"set",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"ttl",
")",
")",
"{",
"// If set() returns fals... | Stores into the cache
@param string $key
@param mixed $value
@param integer $ttl
@return boolean | [
"Stores",
"into",
"the",
"cache"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Cache/Memcached/MemcachedEngine.php#L79-L88 | train |
krystal-framework/krystal.framework | src/Krystal/Cache/Memcached/MemcachedEngine.php | MemcachedEngine.get | public function get($key, $default = false)
{
$value = $this->memcached->get($key);
if ($this->memcached->getResultCode() == 0) {
return $value;
} else {
return $default;
}
} | php | public function get($key, $default = false)
{
$value = $this->memcached->get($key);
if ($this->memcached->getResultCode() == 0) {
return $value;
} else {
return $default;
}
} | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"false",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"memcached",
"->",
"get",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"this",
"->",
"memcached",
"->",
"getResultCode",
... | Returns from the cache
@param string $key
@param boolean $default
@return mixed | [
"Returns",
"from",
"the",
"cache"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Cache/Memcached/MemcachedEngine.php#L97-L106 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.setLayout | public function setLayout($layout, $layoutModule = null)
{
$this->layout = $layout;
$this->layoutModule = $layoutModule;
return $this;
} | php | public function setLayout($layout, $layoutModule = null)
{
$this->layout = $layout;
$this->layoutModule = $layoutModule;
return $this;
} | [
"public",
"function",
"setLayout",
"(",
"$",
"layout",
",",
"$",
"layoutModule",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"layout",
"=",
"$",
"layout",
";",
"$",
"this",
"->",
"layoutModule",
"=",
"$",
"layoutModule",
";",
"return",
"$",
"this",
";",
... | Defines global template's layout
@param string $layout Template name
@param string $layoutModule Just a basename of that layout inside theme's folder
@return \Krystal\Application\View\ViewManager | [
"Defines",
"global",
"template",
"s",
"layout"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L252-L258 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.addVariables | public function addVariables(array $variables)
{
foreach ($variables as $name => $value) {
$this->addVariable($name, $value);
}
return $this;
} | php | public function addVariables(array $variables)
{
foreach ($variables as $name => $value) {
$this->addVariable($name, $value);
}
return $this;
} | [
"public",
"function",
"addVariables",
"(",
"array",
"$",
"variables",
")",
"{",
"foreach",
"(",
"$",
"variables",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"addVariable",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"}",
... | Appends collection of variables
@param array $variables Collection of variables
@return \Krystal\Application\View\ViewManager | [
"Appends",
"collection",
"of",
"variables"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L328-L335 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.url | public function url()
{
$args = func_get_args();
$controller = array_shift($args);
$url = $this->urlBuilder->createUrl($controller, $args);
if ($url === false) {
return $controller;
} else {
return $url;
}
} | php | public function url()
{
$args = func_get_args();
$controller = array_shift($args);
$url = $this->urlBuilder->createUrl($controller, $args);
if ($url === false) {
return $controller;
} else {
return $url;
}
} | [
"public",
"function",
"url",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"controller",
"=",
"array_shift",
"(",
"$",
"args",
")",
";",
"$",
"url",
"=",
"$",
"this",
"->",
"urlBuilder",
"->",
"createUrl",
"(",
"$",
"controlle... | Generates URL by known controller's syntax and optional arguments
This should be used inside templates only
@return string | [
"Generates",
"URL",
"by",
"known",
"controller",
"s",
"syntax",
"and",
"optional",
"arguments",
"This",
"should",
"be",
"used",
"inside",
"templates",
"only"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L364-L376 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.mapUrl | public function mapUrl($controller, array $args = array(), $index = 0)
{
return $this->urlBuilder->createUrl($controller, $args, $index);
} | php | public function mapUrl($controller, array $args = array(), $index = 0)
{
return $this->urlBuilder->createUrl($controller, $args, $index);
} | [
"public",
"function",
"mapUrl",
"(",
"$",
"controller",
",",
"array",
"$",
"args",
"=",
"array",
"(",
")",
",",
"$",
"index",
"=",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"urlBuilder",
"->",
"createUrl",
"(",
"$",
"controller",
",",
"$",
"args",
... | Generates URL filtered by mapped index
@param string $controller
@param array $args
@param integer $index
@return string | [
"Generates",
"URL",
"filtered",
"by",
"mapped",
"index"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L386-L389 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.show | public function show($message, $translate = true)
{
if ($translate === true) {
$message = $this->translate($message);
}
echo $message;
} | php | public function show($message, $translate = true)
{
if ($translate === true) {
$message = $this->translate($message);
}
echo $message;
} | [
"public",
"function",
"show",
"(",
"$",
"message",
",",
"$",
"translate",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"translate",
"===",
"true",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"translate",
"(",
"$",
"message",
")",
";",
"}",
"echo",
... | Prints a string
@param string $message
@param boolean $translate Whether to translate a string
@return void | [
"Prints",
"a",
"string"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L412-L419 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.createPath | private function createPath($dir, $path, $module, $theme = null)
{
if ($theme !== null) {
return sprintf('%s/%s/%s/%s/%s', $path, self::TEMPLATE_PARAM_MODULES_DIR, $module, $dir, $theme);
} else {
return sprintf('%s/%s/%s/%s', $path, self::TEMPLATE_PARAM_MODULES_DIR, $module, $dir);
}
} | php | private function createPath($dir, $path, $module, $theme = null)
{
if ($theme !== null) {
return sprintf('%s/%s/%s/%s/%s', $path, self::TEMPLATE_PARAM_MODULES_DIR, $module, $dir, $theme);
} else {
return sprintf('%s/%s/%s/%s', $path, self::TEMPLATE_PARAM_MODULES_DIR, $module, $dir);
}
} | [
"private",
"function",
"createPath",
"(",
"$",
"dir",
",",
"$",
"path",
",",
"$",
"module",
",",
"$",
"theme",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"theme",
"!==",
"null",
")",
"{",
"return",
"sprintf",
"(",
"'%s/%s/%s/%s/%s'",
",",
"$",
"path",
... | Creates path to view template
@param string $dir Base directory when assets are stored
@param string $path
@param string $module
@param string $theme
@return string | [
"Creates",
"path",
"to",
"view",
"template"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L430-L437 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.createSharedThemePath | private function createSharedThemePath($module, $theme, $base)
{
if (is_null($theme)) {
$theme = $this->theme;
}
if (is_null($module)) {
$module = $this->module;
}
return sprintf('%s/%s/%s/%s', $base, $module, self::TEMPLATE_PARAM_BASE_DIR, $theme);
} | php | private function createSharedThemePath($module, $theme, $base)
{
if (is_null($theme)) {
$theme = $this->theme;
}
if (is_null($module)) {
$module = $this->module;
}
return sprintf('%s/%s/%s/%s', $base, $module, self::TEMPLATE_PARAM_BASE_DIR, $theme);
} | [
"private",
"function",
"createSharedThemePath",
"(",
"$",
"module",
",",
"$",
"theme",
",",
"$",
"base",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"theme",
")",
")",
"{",
"$",
"theme",
"=",
"$",
"this",
"->",
"theme",
";",
"}",
"if",
"(",
"is_null"... | Creates shared theme path
@param string $module
@param string $theme
@param string $base
@return string | [
"Creates",
"shared",
"theme",
"path"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L458-L469 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.createThemeUrl | public function createThemeUrl($module = null, $theme = null)
{
return $this->createSharedThemePath($module, $theme, '/'.self::TEMPLATE_PARAM_MODULES_DIR);
} | php | public function createThemeUrl($module = null, $theme = null)
{
return $this->createSharedThemePath($module, $theme, '/'.self::TEMPLATE_PARAM_MODULES_DIR);
} | [
"public",
"function",
"createThemeUrl",
"(",
"$",
"module",
"=",
"null",
",",
"$",
"theme",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"createSharedThemePath",
"(",
"$",
"module",
",",
"$",
"theme",
",",
"'/'",
".",
"self",
"::",
"TEMPLATE_PARAM... | Creates theme URL
@param string $module
@param string $theme
@return string | [
"Creates",
"theme",
"URL"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L478-L481 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.createThemePath | public function createThemePath($module = null, $theme = null)
{
return $this->createSharedThemePath($module, $theme, $this->moduleDir);
} | php | public function createThemePath($module = null, $theme = null)
{
return $this->createSharedThemePath($module, $theme, $this->moduleDir);
} | [
"public",
"function",
"createThemePath",
"(",
"$",
"module",
"=",
"null",
",",
"$",
"theme",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"createSharedThemePath",
"(",
"$",
"module",
",",
"$",
"theme",
",",
"$",
"this",
"->",
"moduleDir",
")",
"... | Resolves a base path
@param string $module
@param string $theme Optionally a theme can be overridden
@return string | [
"Resolves",
"a",
"base",
"path"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L490-L493 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.createAssetUrl | public function createAssetUrl($module = null, $path = null)
{
if (is_null($module)) {
$module = $this->module;
}
return sprintf('/%s/%s/%s', self::TEMPLATE_PARAM_MODULES_DIR, $module, self::TEMPLATE_PARAM_ASSETS_DIR) . $path;
} | php | public function createAssetUrl($module = null, $path = null)
{
if (is_null($module)) {
$module = $this->module;
}
return sprintf('/%s/%s/%s', self::TEMPLATE_PARAM_MODULES_DIR, $module, self::TEMPLATE_PARAM_ASSETS_DIR) . $path;
} | [
"public",
"function",
"createAssetUrl",
"(",
"$",
"module",
"=",
"null",
",",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"module",
")",
")",
"{",
"$",
"module",
"=",
"$",
"this",
"->",
"module",
";",
"}",
"return",
"sprintf... | Creates URL for asset
@param string $module
@param string $path Optional path to be appended
@return string | [
"Creates",
"URL",
"for",
"asset"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L502-L509 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.createAssetPath | private function createAssetPath($path, $module, $absolute, $fromAssets)
{
$baseUrl = '';
if ($absolute === true) {
$url = $baseUrl;
} else {
$url = null;
}
// If module isn't provided, then current one used by default
if (is_null($module)) {
$module = $this->module;
}
if ($fromAssets !== false) {
$dir = self::TEMPLATE_PARAM_ASSETS_DIR;
$theme = null;
} else {
$dir = self::TEMPLATE_PARAM_BASE_DIR;
$theme = $this->theme;
}
return $url.sprintf('%s/%s', $this->createPath($dir, $baseUrl, $module, $theme), $path);
} | php | private function createAssetPath($path, $module, $absolute, $fromAssets)
{
$baseUrl = '';
if ($absolute === true) {
$url = $baseUrl;
} else {
$url = null;
}
// If module isn't provided, then current one used by default
if (is_null($module)) {
$module = $this->module;
}
if ($fromAssets !== false) {
$dir = self::TEMPLATE_PARAM_ASSETS_DIR;
$theme = null;
} else {
$dir = self::TEMPLATE_PARAM_BASE_DIR;
$theme = $this->theme;
}
return $url.sprintf('%s/%s', $this->createPath($dir, $baseUrl, $module, $theme), $path);
} | [
"private",
"function",
"createAssetPath",
"(",
"$",
"path",
",",
"$",
"module",
",",
"$",
"absolute",
",",
"$",
"fromAssets",
")",
"{",
"$",
"baseUrl",
"=",
"''",
";",
"if",
"(",
"$",
"absolute",
"===",
"true",
")",
"{",
"$",
"url",
"=",
"$",
"base... | Returns asset path by module and its nested path
@param string $path
@param string $module Optionally default module can be replaced by another one
@param boolean $absolute Whether returned path should be absolute or relative
@param boolean $fromAssets Whether to use assets directory or theme's internal one
@return string | [
"Returns",
"asset",
"path",
"by",
"module",
"and",
"its",
"nested",
"path"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L520-L544 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.createInclusionPath | private function createInclusionPath($name, $module = null)
{
if (is_null($module)) {
$module = $this->module;
}
$base = $this->createPath(self::TEMPLATE_PARAM_BASE_DIR, dirname($this->moduleDir), $module, $this->theme);
$path = sprintf('%s.%s', $base . \DIRECTORY_SEPARATOR . $name, self::TEMPLATE_PARAM_EXTENSION);
return $path;
} | php | private function createInclusionPath($name, $module = null)
{
if (is_null($module)) {
$module = $this->module;
}
$base = $this->createPath(self::TEMPLATE_PARAM_BASE_DIR, dirname($this->moduleDir), $module, $this->theme);
$path = sprintf('%s.%s', $base . \DIRECTORY_SEPARATOR . $name, self::TEMPLATE_PARAM_EXTENSION);
return $path;
} | [
"private",
"function",
"createInclusionPath",
"(",
"$",
"name",
",",
"$",
"module",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"module",
")",
")",
"{",
"$",
"module",
"=",
"$",
"this",
"->",
"module",
";",
"}",
"$",
"base",
"=",
"$",
... | Returns full path to a file by its name
@param string $name File's basename
@param string $module Module name
@return string | [
"Returns",
"full",
"path",
"to",
"a",
"file",
"by",
"its",
"name"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L553-L563 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.moduleAsset | public function moduleAsset($asset, $module = null, $absolute = false)
{
return $this->createAssetPath($asset, $module, $absolute, true);
} | php | public function moduleAsset($asset, $module = null, $absolute = false)
{
return $this->createAssetPath($asset, $module, $absolute, true);
} | [
"public",
"function",
"moduleAsset",
"(",
"$",
"asset",
",",
"$",
"module",
"=",
"null",
",",
"$",
"absolute",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"createAssetPath",
"(",
"$",
"asset",
",",
"$",
"module",
",",
"$",
"absolute",
",",
"... | Generates a path to module asset file
@param string $path The target asset path
@param string $module Optionally module name can be overridden. By default the current is used
@param boolean $absolute Whether path must be absolute or not
@return string | [
"Generates",
"a",
"path",
"to",
"module",
"asset",
"file"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L573-L576 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.asset | public function asset($asset, $module = null, $absolute = false)
{
return $this->createAssetPath($asset, $module, $absolute, false);
} | php | public function asset($asset, $module = null, $absolute = false)
{
return $this->createAssetPath($asset, $module, $absolute, false);
} | [
"public",
"function",
"asset",
"(",
"$",
"asset",
",",
"$",
"module",
"=",
"null",
",",
"$",
"absolute",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"createAssetPath",
"(",
"$",
"asset",
",",
"$",
"module",
",",
"$",
"absolute",
",",
"false"... | Generates a full path to an asset
@param string $asset Path to the target asset
@param string $module
@param boolean $absolute Whether path must be absolute or not
@return string | [
"Generates",
"a",
"full",
"path",
"to",
"an",
"asset"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L586-L589 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.createContentWithLayout | private function createContentWithLayout($layout, $fragment)
{
// Create and append $fragment variable to the shared view stack
$this->variables[self::TEMPLATE_PARAM_FRAGMENT_VAR_NAME] = $this->createFileContent($fragment);
return $this->createFileContent($layout);
} | php | private function createContentWithLayout($layout, $fragment)
{
// Create and append $fragment variable to the shared view stack
$this->variables[self::TEMPLATE_PARAM_FRAGMENT_VAR_NAME] = $this->createFileContent($fragment);
return $this->createFileContent($layout);
} | [
"private",
"function",
"createContentWithLayout",
"(",
"$",
"layout",
",",
"$",
"fragment",
")",
"{",
"// Create and append $fragment variable to the shared view stack",
"$",
"this",
"->",
"variables",
"[",
"self",
"::",
"TEMPLATE_PARAM_FRAGMENT_VAR_NAME",
"]",
"=",
"$",
... | Returns content of glued layout and its fragment
@param string $layout Path to a layout
@param string $fragment Path to a fragment
@return string | [
"Returns",
"content",
"of",
"glued",
"layout",
"and",
"its",
"fragment"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L624-L630 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.render | public function render($template, array $vars = array())
{
// Make sure template file isn't empty string
if (empty($template)) {
throw new LogicException('Empty template name provided');
}
if (!$this->templateExists($template)) {
$base = $this->createPath(self::TEMPLATE_PARAM_BASE_DIR, dirname($this->moduleDir), $this->module, $this->theme);
throw new RuntimeException(sprintf('Cannot find "%s.%s" in %s', $template, self::TEMPLATE_PARAM_EXTENSION, $base));
}
// Template file
$file = $this->createInclusionPath($template);
$this->addVariables($vars);
if ($this->hasLayout()) {
$layout = $this->createInclusionPath($this->layout, $this->layoutModule);
$content = $this->createContentWithLayout($layout, $file);
} else {
$content = $this->createFileContent($file);
}
// Compress if needed
if ($this->compress === true) {
$compressor = new HtmlCompressor();
$content = $compressor->compress($content);
}
return $content;
} | php | public function render($template, array $vars = array())
{
// Make sure template file isn't empty string
if (empty($template)) {
throw new LogicException('Empty template name provided');
}
if (!$this->templateExists($template)) {
$base = $this->createPath(self::TEMPLATE_PARAM_BASE_DIR, dirname($this->moduleDir), $this->module, $this->theme);
throw new RuntimeException(sprintf('Cannot find "%s.%s" in %s', $template, self::TEMPLATE_PARAM_EXTENSION, $base));
}
// Template file
$file = $this->createInclusionPath($template);
$this->addVariables($vars);
if ($this->hasLayout()) {
$layout = $this->createInclusionPath($this->layout, $this->layoutModule);
$content = $this->createContentWithLayout($layout, $file);
} else {
$content = $this->createFileContent($file);
}
// Compress if needed
if ($this->compress === true) {
$compressor = new HtmlCompressor();
$content = $compressor->compress($content);
}
return $content;
} | [
"public",
"function",
"render",
"(",
"$",
"template",
",",
"array",
"$",
"vars",
"=",
"array",
"(",
")",
")",
"{",
"// Make sure template file isn't empty string",
"if",
"(",
"empty",
"(",
"$",
"template",
")",
")",
"{",
"throw",
"new",
"LogicException",
"("... | Passes variables and renders a template. If there's attached layout, then renders it with that layout
@param string $template Template's name without extension in themes directory
@param array $vars
@throws \RuntimeException if wrong template file provided
@throws \LogicException If empty template name provided
@return string | [
"Passes",
"variables",
"and",
"renders",
"a",
"template",
".",
"If",
"there",
"s",
"attached",
"layout",
"then",
"renders",
"it",
"with",
"that",
"layout"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L641-L673 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.renderRaw | public function renderRaw($module, $theme, $template, array $vars = array())
{
// Save initial values before overriding theme
$initialLayout = $this->layout;
$initialModule = $this->module;
$initialTheme = $this->theme;
// Configure view with new values
$this->setModule($module)
->setTheme($theme)
->disableLayout();
$response = $this->render($template, $vars);
// Restore initial values now
$this->layout = $initialLayout;
$this->module = $initialModule;
$this->theme = $initialTheme;
return $response;
} | php | public function renderRaw($module, $theme, $template, array $vars = array())
{
// Save initial values before overriding theme
$initialLayout = $this->layout;
$initialModule = $this->module;
$initialTheme = $this->theme;
// Configure view with new values
$this->setModule($module)
->setTheme($theme)
->disableLayout();
$response = $this->render($template, $vars);
// Restore initial values now
$this->layout = $initialLayout;
$this->module = $initialModule;
$this->theme = $initialTheme;
return $response;
} | [
"public",
"function",
"renderRaw",
"(",
"$",
"module",
",",
"$",
"theme",
",",
"$",
"template",
",",
"array",
"$",
"vars",
"=",
"array",
"(",
")",
")",
"{",
"// Save initial values before overriding theme",
"$",
"initialLayout",
"=",
"$",
"this",
"->",
"layo... | Renders a template with custom Module and its theme
@param string $module
@param string $theme Theme directory name
@param string $template Template file to be rendered
@param array $vars Variables to be passed to a template
@return string | [
"Renders",
"a",
"template",
"with",
"custom",
"Module",
"and",
"its",
"theme"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L684-L704 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/ViewManager.php | ViewManager.loadPartial | public function loadPartial($name, array $vars = array())
{
$partialTemplateFile = $this->getPartialBag()->getPartialFile($name);
if (is_file($partialTemplateFile)) {
extract(array_replace_recursive($vars, $this->variables));
include($partialTemplateFile);
} else {
return false;
}
} | php | public function loadPartial($name, array $vars = array())
{
$partialTemplateFile = $this->getPartialBag()->getPartialFile($name);
if (is_file($partialTemplateFile)) {
extract(array_replace_recursive($vars, $this->variables));
include($partialTemplateFile);
} else {
return false;
}
} | [
"public",
"function",
"loadPartial",
"(",
"$",
"name",
",",
"array",
"$",
"vars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"partialTemplateFile",
"=",
"$",
"this",
"->",
"getPartialBag",
"(",
")",
"->",
"getPartialFile",
"(",
"$",
"name",
")",
";",
"if",... | Loads partial template
@param string $name
@param array $vars Additional variables if needed
@return void | [
"Loads",
"partial",
"template"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/ViewManager.php#L724-L734 | train |
krystal-framework/krystal.framework | src/Krystal/Form/HtmlHelper.php | HtmlHelper.wrapOnDemand | public static function wrapOnDemand($condition, $tag, $content)
{
if ($condition) {
echo sprintf('<%s>%s</%s>', $tag, $content, $tag);
} else {
echo $content;
}
} | php | public static function wrapOnDemand($condition, $tag, $content)
{
if ($condition) {
echo sprintf('<%s>%s</%s>', $tag, $content, $tag);
} else {
echo $content;
}
} | [
"public",
"static",
"function",
"wrapOnDemand",
"(",
"$",
"condition",
",",
"$",
"tag",
",",
"$",
"content",
")",
"{",
"if",
"(",
"$",
"condition",
")",
"{",
"echo",
"sprintf",
"(",
"'<%s>%s</%s>'",
",",
"$",
"tag",
",",
"$",
"content",
",",
"$",
"ta... | Wraps content into a tag on demand
@param boolean $condition
@param string $tag
@param string $content
@return void | [
"Wraps",
"content",
"into",
"a",
"tag",
"on",
"demand"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Form/HtmlHelper.php#L40-L47 | train |
luismanuelamengual/NeoPHP | src/NeoPHP/Http/Request.php | Request.baseContext | public function baseContext() {
$baseContext = get_property("web.base_context", "");
if (empty($baseContext)) {
$baseContext = !empty($_SERVER["CONTEXT_PREFIX"])? $_SERVER["CONTEXT_PREFIX"] : "";
}
return $baseContext;
} | php | public function baseContext() {
$baseContext = get_property("web.base_context", "");
if (empty($baseContext)) {
$baseContext = !empty($_SERVER["CONTEXT_PREFIX"])? $_SERVER["CONTEXT_PREFIX"] : "";
}
return $baseContext;
} | [
"public",
"function",
"baseContext",
"(",
")",
"{",
"$",
"baseContext",
"=",
"get_property",
"(",
"\"web.base_context\"",
",",
"\"\"",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"baseContext",
")",
")",
"{",
"$",
"baseContext",
"=",
"!",
"empty",
"(",
"$",
... | Returns the base context | [
"Returns",
"the",
"base",
"context"
] | da7c5831974b37dd4b0b170d9aa64e61404d819b | https://github.com/luismanuelamengual/NeoPHP/blob/da7c5831974b37dd4b0b170d9aa64e61404d819b/src/NeoPHP/Http/Request.php#L77-L83 | train |
luismanuelamengual/NeoPHP | src/NeoPHP/Http/Request.php | Request.setData | public function setData(array $request = []) {
unset($this->parameters);
unset($this->path);
unset($this->pathParts);
$_REQUEST = $request;
} | php | public function setData(array $request = []) {
unset($this->parameters);
unset($this->path);
unset($this->pathParts);
$_REQUEST = $request;
} | [
"public",
"function",
"setData",
"(",
"array",
"$",
"request",
"=",
"[",
"]",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"parameters",
")",
";",
"unset",
"(",
"$",
"this",
"->",
"path",
")",
";",
"unset",
"(",
"$",
"this",
"->",
"pathParts",
")",
... | Establece nuevas variables de request
@param array $request nuevas variables de request | [
"Establece",
"nuevas",
"variables",
"de",
"request"
] | da7c5831974b37dd4b0b170d9aa64e61404d819b | https://github.com/luismanuelamengual/NeoPHP/blob/da7c5831974b37dd4b0b170d9aa64e61404d819b/src/NeoPHP/Http/Request.php#L306-L311 | train |
rocketweb-fed/module-checkout-enhancement | Plugin/Block/Checkout/LayoutProcessor.php | LayoutProcessor.beforeProcess | public function beforeProcess(
\Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
$jsLayout
) {
if (!$this->enhancementHelper->isActiveGoogleAddress()) {
if (isset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
['children']['shippingAddress']['children']['shipping-address-fieldset']
)) {
// Revert changes
$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
['children']['shippingAddress']['children']['shipping-address-fieldset']['component'] = 'uiComponent';
unset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
['children']['shippingAddress']['children']['shipping-address-fieldset']['config']['template']);
}
}
return [$jsLayout];
} | php | public function beforeProcess(
\Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
$jsLayout
) {
if (!$this->enhancementHelper->isActiveGoogleAddress()) {
if (isset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
['children']['shippingAddress']['children']['shipping-address-fieldset']
)) {
// Revert changes
$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
['children']['shippingAddress']['children']['shipping-address-fieldset']['component'] = 'uiComponent';
unset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
['children']['shippingAddress']['children']['shipping-address-fieldset']['config']['template']);
}
}
return [$jsLayout];
} | [
"public",
"function",
"beforeProcess",
"(",
"\\",
"Magento",
"\\",
"Checkout",
"\\",
"Block",
"\\",
"Checkout",
"\\",
"LayoutProcessor",
"$",
"subject",
",",
"$",
"jsLayout",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"enhancementHelper",
"->",
"isActiveGo... | Revert changes on component shipping-address-fieldset
@param \Magento\Checkout\Block\Checkout\LayoutProcessor $subject
@param array $jsLayout
@return array
@SuppressWarnings("PMD.UnusedFormalParameter") | [
"Revert",
"changes",
"on",
"component",
"shipping",
"-",
"address",
"-",
"fieldset"
] | 04e83847f817687b6c59e49f5bc330f57f5d636b | https://github.com/rocketweb-fed/module-checkout-enhancement/blob/04e83847f817687b6c59e49f5bc330f57f5d636b/Plugin/Block/Checkout/LayoutProcessor.php#L48-L64 | train |
graze/config-validation | src/ValidatorBuilderTrait.php | ValidatorBuilderTrait.hasMandatoryItem | protected function hasMandatoryItem(array $definition)
{
foreach ($definition as $key => $node) {
if (isset($node['required'])) {
if ($node['required']) {
return true;
}
} else {
if ($this->hasMandatoryItem($node)) {
return true;
}
}
}
return false;
} | php | protected function hasMandatoryItem(array $definition)
{
foreach ($definition as $key => $node) {
if (isset($node['required'])) {
if ($node['required']) {
return true;
}
} else {
if ($this->hasMandatoryItem($node)) {
return true;
}
}
}
return false;
} | [
"protected",
"function",
"hasMandatoryItem",
"(",
"array",
"$",
"definition",
")",
"{",
"foreach",
"(",
"$",
"definition",
"as",
"$",
"key",
"=>",
"$",
"node",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"node",
"[",
"'required'",
"]",
")",
")",
"{",
"if... | Traverse the definition to see if any children are required
@param array $definition
@return bool | [
"Traverse",
"the",
"definition",
"to",
"see",
"if",
"any",
"children",
"are",
"required"
] | 5c7adb14e53fe3149141d490f7fbe47dd2191dae | https://github.com/graze/config-validation/blob/5c7adb14e53fe3149141d490f7fbe47dd2191dae/src/ValidatorBuilderTrait.php#L176-L191 | train |
krystal-framework/krystal.framework | src/Krystal/Application/Route/MapManager.php | MapManager.getDataByUriTemplate | public function getDataByUriTemplate($uriTemplate, $option = null)
{
if (isset($this->map[$uriTemplate])) {
$target = $this->map[$uriTemplate];
if ($option !== null) {
// The option might not be set, so ensure
if (!isset($target[$option])) {
throw new RuntimeException(sprintf('Can not read non-existing option %s for "%s"', $option, $uriTemplate));
} else {
return $target[$option];
}
} else {
return $target;
}
} else {
throw new RuntimeException(sprintf(
'URI "%s" does not belong to route map. Cannot get a controller in %s', $uriTemplate, __METHOD__
));
}
} | php | public function getDataByUriTemplate($uriTemplate, $option = null)
{
if (isset($this->map[$uriTemplate])) {
$target = $this->map[$uriTemplate];
if ($option !== null) {
// The option might not be set, so ensure
if (!isset($target[$option])) {
throw new RuntimeException(sprintf('Can not read non-existing option %s for "%s"', $option, $uriTemplate));
} else {
return $target[$option];
}
} else {
return $target;
}
} else {
throw new RuntimeException(sprintf(
'URI "%s" does not belong to route map. Cannot get a controller in %s', $uriTemplate, __METHOD__
));
}
} | [
"public",
"function",
"getDataByUriTemplate",
"(",
"$",
"uriTemplate",
",",
"$",
"option",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"map",
"[",
"$",
"uriTemplate",
"]",
")",
")",
"{",
"$",
"target",
"=",
"$",
"this",
"->",
... | Gets associated options by URI template
@param string $uriTemplate
@param string $option Optionally can be filtered by some existing option
@return array | [
"Gets",
"associated",
"options",
"by",
"URI",
"template"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/Route/MapManager.php#L64-L86 | train |
krystal-framework/krystal.framework | src/Krystal/Application/Route/MapManager.php | MapManager.getControllers | public function getControllers()
{
$map = $this->map;
$result = array();
foreach ($map as $template => $options) {
if (isset($options['controller'])) {
$result[] = $options['controller'];
}
}
return $result;
} | php | public function getControllers()
{
$map = $this->map;
$result = array();
foreach ($map as $template => $options) {
if (isset($options['controller'])) {
$result[] = $options['controller'];
}
}
return $result;
} | [
"public",
"function",
"getControllers",
"(",
")",
"{",
"$",
"map",
"=",
"$",
"this",
"->",
"map",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"map",
"as",
"$",
"template",
"=>",
"$",
"options",
")",
"{",
"if",
"(",
"isse... | Returns all loaded controllers
@return array | [
"Returns",
"all",
"loaded",
"controllers"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/Route/MapManager.php#L93-L105 | train |
krystal-framework/krystal.framework | src/Krystal/Application/Route/MapManager.php | MapManager.findUriTemplatesByController | public function findUriTemplatesByController($controller)
{
$result = array();
foreach ($this->map as $uriTemplate => $options) {
if (isset($options['controller']) && $options['controller'] == $controller) {
array_push($result, $uriTemplate);
}
}
return $result;
} | php | public function findUriTemplatesByController($controller)
{
$result = array();
foreach ($this->map as $uriTemplate => $options) {
if (isset($options['controller']) && $options['controller'] == $controller) {
array_push($result, $uriTemplate);
}
}
return $result;
} | [
"public",
"function",
"findUriTemplatesByController",
"(",
"$",
"controller",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"map",
"as",
"$",
"uriTemplate",
"=>",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
... | Finds all URI templates associated with a controller
@param string $controller
@return string | [
"Finds",
"all",
"URI",
"templates",
"associated",
"with",
"a",
"controller"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/Route/MapManager.php#L113-L124 | train |
krystal-framework/krystal.framework | src/Krystal/Application/Route/MapManager.php | MapManager.getUrlTemplateByController | public function getUrlTemplateByController($controller)
{
$result = $this->findUriTemplatesByController($controller);
// Now check the results of search
if (isset($result[0])) {
return $result[0];
} else {
return false;
}
} | php | public function getUrlTemplateByController($controller)
{
$result = $this->findUriTemplatesByController($controller);
// Now check the results of search
if (isset($result[0])) {
return $result[0];
} else {
return false;
}
} | [
"public",
"function",
"getUrlTemplateByController",
"(",
"$",
"controller",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"findUriTemplatesByController",
"(",
"$",
"controller",
")",
";",
"// Now check the results of search",
"if",
"(",
"isset",
"(",
"$",
"resu... | Gets URL template by its associated controller
This method is basically used when building URLs by their associated controllers
@param string $controller (Module:Controler@action)
@return string|boolean | [
"Gets",
"URL",
"template",
"by",
"its",
"associated",
"controller",
"This",
"method",
"is",
"basically",
"used",
"when",
"building",
"URLs",
"by",
"their",
"associated",
"controllers"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/Route/MapManager.php#L133-L143 | train |
krystal-framework/krystal.framework | src/Krystal/Application/Route/MapManager.php | MapManager.getControllerByURITemplate | public function getControllerByURITemplate($uriTemplate)
{
$controller = $this->getDataByUriTemplate($uriTemplate, 'controller');
$separatorPosition = strpos($controller, '@');
if ($separatorPosition !== false) {
$controller = substr($controller, 0, $separatorPosition);
return $this->notation->toClassPath($controller);
} else {
// No separator
return false;
}
} | php | public function getControllerByURITemplate($uriTemplate)
{
$controller = $this->getDataByUriTemplate($uriTemplate, 'controller');
$separatorPosition = strpos($controller, '@');
if ($separatorPosition !== false) {
$controller = substr($controller, 0, $separatorPosition);
return $this->notation->toClassPath($controller);
} else {
// No separator
return false;
}
} | [
"public",
"function",
"getControllerByURITemplate",
"(",
"$",
"uriTemplate",
")",
"{",
"$",
"controller",
"=",
"$",
"this",
"->",
"getDataByUriTemplate",
"(",
"$",
"uriTemplate",
",",
"'controller'",
")",
";",
"$",
"separatorPosition",
"=",
"strpos",
"(",
"$",
... | Returns a controller by its associated URI template
@param string $uriTemplate URI template, not actual one
@throws \RuntimeException if URI doesn't belong to route map
@return string|boolean | [
"Returns",
"a",
"controller",
"by",
"its",
"associated",
"URI",
"template"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/Route/MapManager.php#L162-L174 | train |
krystal-framework/krystal.framework | src/Krystal/Application/Route/MapManager.php | MapManager.getActionByURITemplate | public function getActionByURITemplate($uriTemplate)
{
$controller = $this->getDataByUriTemplate($uriTemplate, 'controller');
$separatorPosition = strpos($controller, '@');
if ($separatorPosition !== false) {
$action = substr($controller, $separatorPosition + 1);
return $action;
} else {
// No separator
return false;
}
} | php | public function getActionByURITemplate($uriTemplate)
{
$controller = $this->getDataByUriTemplate($uriTemplate, 'controller');
$separatorPosition = strpos($controller, '@');
if ($separatorPosition !== false) {
$action = substr($controller, $separatorPosition + 1);
return $action;
} else {
// No separator
return false;
}
} | [
"public",
"function",
"getActionByURITemplate",
"(",
"$",
"uriTemplate",
")",
"{",
"$",
"controller",
"=",
"$",
"this",
"->",
"getDataByUriTemplate",
"(",
"$",
"uriTemplate",
",",
"'controller'",
")",
";",
"$",
"separatorPosition",
"=",
"strpos",
"(",
"$",
"co... | Returns action by associated URI template
@param string $uriTemplate
@throws \RuntimeException if $uriTemplate does not belong to route map
@return string|boolean | [
"Returns",
"action",
"by",
"associated",
"URI",
"template"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/Route/MapManager.php#L183-L195 | train |
phpcodecrafting/php-beanstalk | lib/Beanstalk/Connection/Stream/Socket.php | Socket.open | public function open($host, $port, $timeout)
{
if (($this->socket = @fsockopen($host, $port, $errno, $errstr, ($timeout / 1000))) === false) {
return false;
}
return true;
} | php | public function open($host, $port, $timeout)
{
if (($this->socket = @fsockopen($host, $port, $errno, $errstr, ($timeout / 1000))) === false) {
return false;
}
return true;
} | [
"public",
"function",
"open",
"(",
"$",
"host",
",",
"$",
"port",
",",
"$",
"timeout",
")",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"socket",
"=",
"@",
"fsockopen",
"(",
"$",
"host",
",",
"$",
"port",
",",
"$",
"errno",
",",
"$",
"errstr",
",",... | Open the stream
@param string $host Host or IP address to connect to
@param integer $port Port to connect on
@param float $timeout Connection timeout in milliseconds
@return boolean | [
"Open",
"the",
"stream"
] | 833c52122bb4879ef2945dab34b32992a6bd718c | https://github.com/phpcodecrafting/php-beanstalk/blob/833c52122bb4879ef2945dab34b32992a6bd718c/lib/Beanstalk/Connection/Stream/Socket.php#L26-L33 | train |
phpcodecrafting/php-beanstalk | lib/Beanstalk/Connection/Stream/Socket.php | Socket.isTimedOut | public function isTimedOut()
{
if (is_resource($this->socket)) {
$info = stream_get_meta_data($this->socket);
}
return $this->socket === null || $this->socket === false || $info['timed_out'] || feof($this->socket);
} | php | public function isTimedOut()
{
if (is_resource($this->socket)) {
$info = stream_get_meta_data($this->socket);
}
return $this->socket === null || $this->socket === false || $info['timed_out'] || feof($this->socket);
} | [
"public",
"function",
"isTimedOut",
"(",
")",
"{",
"if",
"(",
"is_resource",
"(",
"$",
"this",
"->",
"socket",
")",
")",
"{",
"$",
"info",
"=",
"stream_get_meta_data",
"(",
"$",
"this",
"->",
"socket",
")",
";",
"}",
"return",
"$",
"this",
"->",
"soc... | Has the connection timed out or otherwise gone away?
@return boolean | [
"Has",
"the",
"connection",
"timed",
"out",
"or",
"otherwise",
"gone",
"away?"
] | 833c52122bb4879ef2945dab34b32992a6bd718c | https://github.com/phpcodecrafting/php-beanstalk/blob/833c52122bb4879ef2945dab34b32992a6bd718c/lib/Beanstalk/Connection/Stream/Socket.php#L40-L47 | train |
phpcodecrafting/php-beanstalk | lib/Beanstalk/Connection/Stream/Socket.php | Socket.readLine | public function readLine()
{
do {
$line = rtrim(fgets($this->socket));
// server must have dropped the connection
if ($line === '' && feof($this->socket)) {
$this->close();
return false;
}
} while ($line === '');
return $line;
} | php | public function readLine()
{
do {
$line = rtrim(fgets($this->socket));
// server must have dropped the connection
if ($line === '' && feof($this->socket)) {
$this->close();
return false;
}
} while ($line === '');
return $line;
} | [
"public",
"function",
"readLine",
"(",
")",
"{",
"do",
"{",
"$",
"line",
"=",
"rtrim",
"(",
"fgets",
"(",
"$",
"this",
"->",
"socket",
")",
")",
";",
"// server must have dropped the connection",
"if",
"(",
"$",
"line",
"===",
"''",
"&&",
"feof",
"(",
... | Read the next line from the stream
@return string | [
"Read",
"the",
"next",
"line",
"from",
"the",
"stream"
] | 833c52122bb4879ef2945dab34b32992a6bd718c | https://github.com/phpcodecrafting/php-beanstalk/blob/833c52122bb4879ef2945dab34b32992a6bd718c/lib/Beanstalk/Connection/Stream/Socket.php#L77-L91 | train |
droath/project-x | src/Engine/EngineType.php | EngineType.getServiceNamesByType | public function getServiceNamesByType($type)
{
if (!$this->hasServices()) {
return [];
}
$types = [];
$services = $this->getServices();
foreach ($services as $name => $service) {
if ($service['type'] !== $type) {
continue;
}
$types[] = $name;
}
return $types;
} | php | public function getServiceNamesByType($type)
{
if (!$this->hasServices()) {
return [];
}
$types = [];
$services = $this->getServices();
foreach ($services as $name => $service) {
if ($service['type'] !== $type) {
continue;
}
$types[] = $name;
}
return $types;
} | [
"public",
"function",
"getServiceNamesByType",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasServices",
"(",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"types",
"=",
"[",
"]",
";",
"$",
"services",
"=",
"$",
"this",
"-... | Get service names by type.
@param $type
The service type to search for.
@return array | [
"Get",
"service",
"names",
"by",
"type",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Engine/EngineType.php#L156-L172 | train |
droath/project-x | src/Engine/EngineType.php | EngineType.getServiceInstances | public function getServiceInstances()
{
$instances = [];
foreach ($this->getServices() as $name => $info) {
if (!isset($info['type'])) {
continue;
}
$type = $info['type'];
unset($info['type']);
$instances[$name] = [
'type' => $type,
'options' => $info,
'instance' => static::loadService($this, $type, $name),
];
}
return $instances;
} | php | public function getServiceInstances()
{
$instances = [];
foreach ($this->getServices() as $name => $info) {
if (!isset($info['type'])) {
continue;
}
$type = $info['type'];
unset($info['type']);
$instances[$name] = [
'type' => $type,
'options' => $info,
'instance' => static::loadService($this, $type, $name),
];
}
return $instances;
} | [
"public",
"function",
"getServiceInstances",
"(",
")",
"{",
"$",
"instances",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getServices",
"(",
")",
"as",
"$",
"name",
"=>",
"$",
"info",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"info",... | Get defined service instances.
@return array
An array of services keyed by service name. | [
"Get",
"defined",
"service",
"instances",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Engine/EngineType.php#L200-L219 | train |
droath/project-x | src/Engine/EngineType.php | EngineType.getServiceInstanceByGroup | public function getServiceInstanceByGroup($group)
{
$services = [];
$services_map = static::services();
foreach ($this->getServiceInstances() as $name => $info) {
if (!isset($info['type']) || !isset($info['instance'])) {
continue;
}
$type = $info['type'];
if (!isset($services_map[$type])) {
continue;
}
$classname = $services_map[$type];
if ($group !== $classname::group()) {
continue;
}
$services[$name] = $info['instance'];
}
return $services;
} | php | public function getServiceInstanceByGroup($group)
{
$services = [];
$services_map = static::services();
foreach ($this->getServiceInstances() as $name => $info) {
if (!isset($info['type']) || !isset($info['instance'])) {
continue;
}
$type = $info['type'];
if (!isset($services_map[$type])) {
continue;
}
$classname = $services_map[$type];
if ($group !== $classname::group()) {
continue;
}
$services[$name] = $info['instance'];
}
return $services;
} | [
"public",
"function",
"getServiceInstanceByGroup",
"(",
"$",
"group",
")",
"{",
"$",
"services",
"=",
"[",
"]",
";",
"$",
"services_map",
"=",
"static",
"::",
"services",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getServiceInstances",
"(",
")",
... | Get service instance by group.
@param $group
The service group name.
@return array | [
"Get",
"service",
"instance",
"by",
"group",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Engine/EngineType.php#L229-L252 | train |
droath/project-x | src/Engine/EngineType.php | EngineType.getServiceInstanceByType | public function getServiceInstanceByType($type)
{
$services = [];
$instances = $this->getServiceInstances();
foreach ($this->getServiceNamesByType($type) as $name) {
if (!isset($instances[$name]['instance'])) {
continue;
}
$services[] = $instances[$name]['instance'];
}
return $services;
} | php | public function getServiceInstanceByType($type)
{
$services = [];
$instances = $this->getServiceInstances();
foreach ($this->getServiceNamesByType($type) as $name) {
if (!isset($instances[$name]['instance'])) {
continue;
}
$services[] = $instances[$name]['instance'];
}
return $services;
} | [
"public",
"function",
"getServiceInstanceByType",
"(",
"$",
"type",
")",
"{",
"$",
"services",
"=",
"[",
"]",
";",
"$",
"instances",
"=",
"$",
"this",
"->",
"getServiceInstances",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getServiceNamesByType",
"... | Get multiple service instance by type.
@param $type
The service instance type.
@return array | [
"Get",
"multiple",
"service",
"instance",
"by",
"type",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Engine/EngineType.php#L262-L275 | train |
droath/project-x | src/Engine/EngineType.php | EngineType.getServiceInstanceByInterface | public function getServiceInstanceByInterface($interface)
{
foreach ($this->getServiceInstances() as $info) {
if (!isset($info['instance'])) {
continue;
}
$instance = $info['instance'];
if ($instance instanceof $interface) {
return $instance;
}
}
return false;
} | php | public function getServiceInstanceByInterface($interface)
{
foreach ($this->getServiceInstances() as $info) {
if (!isset($info['instance'])) {
continue;
}
$instance = $info['instance'];
if ($instance instanceof $interface) {
return $instance;
}
}
return false;
} | [
"public",
"function",
"getServiceInstanceByInterface",
"(",
"$",
"interface",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getServiceInstances",
"(",
")",
"as",
"$",
"info",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"info",
"[",
"'instance'",
"]",
")... | Get single service instance by interface.
@param $interface
@return bool|ServiceInterface
Return the engine service; otherwise false if not found. | [
"Get",
"single",
"service",
"instance",
"by",
"interface",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Engine/EngineType.php#L285-L299 | train |
droath/project-x | src/Engine/EngineType.php | EngineType.loadService | public static function loadService(
EngineTypeInterface $engine,
$type,
$name = null
) {
$classname = static::serviceClassname($type);
if (!class_exists($classname)) {
throw new \RuntimeException(
sprintf("Service class %s doesn't exist.", $classname)
);
}
return new $classname($engine, $name);
} | php | public static function loadService(
EngineTypeInterface $engine,
$type,
$name = null
) {
$classname = static::serviceClassname($type);
if (!class_exists($classname)) {
throw new \RuntimeException(
sprintf("Service class %s doesn't exist.", $classname)
);
}
return new $classname($engine, $name);
} | [
"public",
"static",
"function",
"loadService",
"(",
"EngineTypeInterface",
"$",
"engine",
",",
"$",
"type",
",",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"classname",
"=",
"static",
"::",
"serviceClassname",
"(",
"$",
"type",
")",
";",
"if",
"(",
"!",
... | Load engine service.
@param EngineTypeInterface $engine
The engine object.
@param string $type
The service type.
@param string|null $name
The service machine name.
@return \Droath\ProjectX\Engine\ServiceInterface | [
"Load",
"engine",
"service",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Engine/EngineType.php#L323-L337 | train |
droath/project-x | src/Engine/EngineType.php | EngineType.serviceClassname | public static function serviceClassname($name)
{
$services = static::services();
if (!isset($services[$name])) {
throw new \InvalidArgumentException(
sprintf('The provided service %s does not exist.', $name)
);
}
return $services[$name];
} | php | public static function serviceClassname($name)
{
$services = static::services();
if (!isset($services[$name])) {
throw new \InvalidArgumentException(
sprintf('The provided service %s does not exist.', $name)
);
}
return $services[$name];
} | [
"public",
"static",
"function",
"serviceClassname",
"(",
"$",
"name",
")",
"{",
"$",
"services",
"=",
"static",
"::",
"services",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"services",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"\... | Get engine service classname.
@param $name
The service name.
@return string
The service fully qualified classname. | [
"Get",
"engine",
"service",
"classname",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Engine/EngineType.php#L369-L380 | train |
droath/project-x | src/Engine/EngineType.php | EngineType.getOptions | protected function getOptions()
{
$engine = $this->getConfigs()->getEngine();
$options = $this->getConfigs()->getOptions();
return isset($options[$engine])
? $options[$engine]
: [];
} | php | protected function getOptions()
{
$engine = $this->getConfigs()->getEngine();
$options = $this->getConfigs()->getOptions();
return isset($options[$engine])
? $options[$engine]
: [];
} | [
"protected",
"function",
"getOptions",
"(",
")",
"{",
"$",
"engine",
"=",
"$",
"this",
"->",
"getConfigs",
"(",
")",
"->",
"getEngine",
"(",
")",
";",
"$",
"options",
"=",
"$",
"this",
"->",
"getConfigs",
"(",
")",
"->",
"getOptions",
"(",
")",
";",
... | Get engine options.
@return array
An array of options for the given engine. | [
"Get",
"engine",
"options",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Engine/EngineType.php#L388-L396 | train |
Tecnocreaciones/ToolsBundle | Model/Exporter/ModelDocument.php | ModelDocument.getFilePathContent | public function getFilePathContent() {
if($this->filePathContent === null){
throw new InvalidArgumentException(sprintf("The filePathContent must be setter."));
}
$path = $this->filePathContent;
if($this->container){
$path = $this->container->get("kernel")->locateResource($this->filePathContent);
}
if(!$this->chainModel->getExporterManager()->getFs()->exists($path)){
throw new InvalidArgumentException(sprintf("The filePathContent '%s' does not exist.",$path));
}
return $path;
} | php | public function getFilePathContent() {
if($this->filePathContent === null){
throw new InvalidArgumentException(sprintf("The filePathContent must be setter."));
}
$path = $this->filePathContent;
if($this->container){
$path = $this->container->get("kernel")->locateResource($this->filePathContent);
}
if(!$this->chainModel->getExporterManager()->getFs()->exists($path)){
throw new InvalidArgumentException(sprintf("The filePathContent '%s' does not exist.",$path));
}
return $path;
} | [
"public",
"function",
"getFilePathContent",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"filePathContent",
"===",
"null",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"\"The filePathContent must be setter.\"",
")",
")",
";",
"}",
"... | Busca la ruta del archivo que se usara como contenido
@return type
@throws InvalidArgumentException | [
"Busca",
"la",
"ruta",
"del",
"archivo",
"que",
"se",
"usara",
"como",
"contenido"
] | 8edc159b91ea41d7a880d2ca0860352d7b05370f | https://github.com/Tecnocreaciones/ToolsBundle/blob/8edc159b91ea41d7a880d2ca0860352d7b05370f/Model/Exporter/ModelDocument.php#L61-L73 | train |
Tecnocreaciones/ToolsBundle | Model/Exporter/ModelDocument.php | ModelDocument.getFilePathHeader | public function getFilePathHeader() {
if($this->filePathHeader === null){
throw new InvalidArgumentException(sprintf("The filePathContent must be setter."));
}
$path = $this->filePathHeader;
if($this->container){
$path = $this->container->get("kernel")->locateResource($path);
}
if(!$this->chainModel->getExporterManager()->getFs()->exists($path)){
throw new InvalidArgumentException(sprintf("The filePathHeader '%s' does not exist.",$path));
}
return $path;
} | php | public function getFilePathHeader() {
if($this->filePathHeader === null){
throw new InvalidArgumentException(sprintf("The filePathContent must be setter."));
}
$path = $this->filePathHeader;
if($this->container){
$path = $this->container->get("kernel")->locateResource($path);
}
if(!$this->chainModel->getExporterManager()->getFs()->exists($path)){
throw new InvalidArgumentException(sprintf("The filePathHeader '%s' does not exist.",$path));
}
return $path;
} | [
"public",
"function",
"getFilePathHeader",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"filePathHeader",
"===",
"null",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"\"The filePathContent must be setter.\"",
")",
")",
";",
"}",
"$"... | Busca la ruta del archivo que se usara como encabezado
@return type
@throws InvalidArgumentException | [
"Busca",
"la",
"ruta",
"del",
"archivo",
"que",
"se",
"usara",
"como",
"encabezado"
] | 8edc159b91ea41d7a880d2ca0860352d7b05370f | https://github.com/Tecnocreaciones/ToolsBundle/blob/8edc159b91ea41d7a880d2ca0860352d7b05370f/Model/Exporter/ModelDocument.php#L80-L92 | train |
Tecnocreaciones/ToolsBundle | Model/Exporter/ModelDocument.php | ModelDocument.getDocumentPath | protected function getDocumentPath(array $parameters = []) {
$dirOut = $this->getDirOutput();
$dirOut = $dirOut.DIRECTORY_SEPARATOR.$this->getFileNameTranslate($parameters).'.'.$this->getFormat();
return $dirOut;
} | php | protected function getDocumentPath(array $parameters = []) {
$dirOut = $this->getDirOutput();
$dirOut = $dirOut.DIRECTORY_SEPARATOR.$this->getFileNameTranslate($parameters).'.'.$this->getFormat();
return $dirOut;
} | [
"protected",
"function",
"getDocumentPath",
"(",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"dirOut",
"=",
"$",
"this",
"->",
"getDirOutput",
"(",
")",
";",
"$",
"dirOut",
"=",
"$",
"dirOut",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"this",
... | Retorna la ruta completa del archivo
@return string | [
"Retorna",
"la",
"ruta",
"completa",
"del",
"archivo"
] | 8edc159b91ea41d7a880d2ca0860352d7b05370f | https://github.com/Tecnocreaciones/ToolsBundle/blob/8edc159b91ea41d7a880d2ca0860352d7b05370f/Model/Exporter/ModelDocument.php#L131-L135 | train |
stefk/JVal | src/Exception/ConstraintException.php | ConstraintException.getTargetNode | protected function getTargetNode()
{
if (null === $target = $this->getTarget()) {
$segments = explode('/', $this->getPath());
$target = '';
while (count($segments) > 0) {
$segment = array_pop($segments);
$target = $segment.'/'.$target;
if (!is_numeric($segment)) {
break;
}
}
return rtrim($target, '/');
}
return $target;
} | php | protected function getTargetNode()
{
if (null === $target = $this->getTarget()) {
$segments = explode('/', $this->getPath());
$target = '';
while (count($segments) > 0) {
$segment = array_pop($segments);
$target = $segment.'/'.$target;
if (!is_numeric($segment)) {
break;
}
}
return rtrim($target, '/');
}
return $target;
} | [
"protected",
"function",
"getTargetNode",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"target",
"=",
"$",
"this",
"->",
"getTarget",
"(",
")",
")",
"{",
"$",
"segments",
"=",
"explode",
"(",
"'/'",
",",
"$",
"this",
"->",
"getPath",
"(",
")",
")"... | Returns a printable representation of the exception
target. If no target has been explicitly passed in,
the last non-array segments of the path are returned.
@return string | [
"Returns",
"a",
"printable",
"representation",
"of",
"the",
"exception",
"target",
".",
"If",
"no",
"target",
"has",
"been",
"explicitly",
"passed",
"in",
"the",
"last",
"non",
"-",
"array",
"segments",
"of",
"the",
"path",
"are",
"returned",
"."
] | 1c26dd2c16e5273d1c0565ff6c9dc51e6316c564 | https://github.com/stefk/JVal/blob/1c26dd2c16e5273d1c0565ff6c9dc51e6316c564/src/Exception/ConstraintException.php#L72-L91 | train |
graze/config-validation | src/ObjectValidator.php | ObjectValidator.isValid | public function isValid($item)
{
if (!$item) {
$item = new \stdClass();
}
$validator = $this->getValidator();
return $validator->validate($item);
} | php | public function isValid($item)
{
if (!$item) {
$item = new \stdClass();
}
$validator = $this->getValidator();
return $validator->validate($item);
} | [
"public",
"function",
"isValid",
"(",
"$",
"item",
")",
"{",
"if",
"(",
"!",
"$",
"item",
")",
"{",
"$",
"item",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"}",
"$",
"validator",
"=",
"$",
"this",
"->",
"getValidator",
"(",
")",
";",
"return",
... | Determine if the provided object is valid or not
@param mixed $item
@return bool | [
"Determine",
"if",
"the",
"provided",
"object",
"is",
"valid",
"or",
"not"
] | 5c7adb14e53fe3149141d490f7fbe47dd2191dae | https://github.com/graze/config-validation/blob/5c7adb14e53fe3149141d490f7fbe47dd2191dae/src/ObjectValidator.php#L139-L147 | train |
g4b0/silverstripe-htmlpurifier | src/Purifier.php | Purifier.GetHTMLPurifierConfig | private static function GetHTMLPurifierConfig() {
$defaultConfig = \HTMLPurifier_Config::createDefault();
$customConfig = Config::inst()->get('g4b0\HtmlPurifier\Purifier', 'html_purifier_config');
if(is_array($customConfig)) {
foreach ($customConfig as $key => $value) {
$defaultConfig->set($key, $value);
}
}
return $defaultConfig;
} | php | private static function GetHTMLPurifierConfig() {
$defaultConfig = \HTMLPurifier_Config::createDefault();
$customConfig = Config::inst()->get('g4b0\HtmlPurifier\Purifier', 'html_purifier_config');
if(is_array($customConfig)) {
foreach ($customConfig as $key => $value) {
$defaultConfig->set($key, $value);
}
}
return $defaultConfig;
} | [
"private",
"static",
"function",
"GetHTMLPurifierConfig",
"(",
")",
"{",
"$",
"defaultConfig",
"=",
"\\",
"HTMLPurifier_Config",
"::",
"createDefault",
"(",
")",
";",
"$",
"customConfig",
"=",
"Config",
"::",
"inst",
"(",
")",
"->",
"get",
"(",
"'g4b0\\HtmlPur... | Get the HTML Purifier config
@return \HTMLPurifier_Config | [
"Get",
"the",
"HTML",
"Purifier",
"config"
] | 24bf960387c4578a5d26989927093121694f7b0e | https://github.com/g4b0/silverstripe-htmlpurifier/blob/24bf960387c4578a5d26989927093121694f7b0e/src/Purifier.php#L23-L35 | train |
g4b0/silverstripe-htmlpurifier | src/Purifier.php | Purifier.Purify | public static function Purify($html = null, $encoding = 'UTF-8') {
$config = self::GetHTMLPurifierConfig();
$config->set('Core.Encoding', $encoding);
$config->set('HTML.Allowed', 'span,p,br,a,h1,h2,h3,h4,h5,strong,em,u,ul,li,ol,hr,blockquote,sub,sup,p[class],img');
$config->set('HTML.AllowedElements', array('span', 'p', 'br', 'a', 'h1', 'h2', 'h3', 'h4', 'h5', 'strong', 'em', 'u', 'ul', 'li', 'ol', 'hr', 'blockquote', 'sub', 'sup', 'img'));
$config->set('HTML.AllowedAttributes', 'style,target,title,href,class,src,border,alt,width,height,title,name,id');
$config->set('CSS.AllowedProperties', 'text-align,font-weight,text-decoration');
$config->set('AutoFormat.RemoveEmpty', true);
$config->set('Attr.ForbiddenClasses', array('MsoNormal'));
$purifier = new \HTMLPurifier($config);
return $cleanCode = $purifier->purify($html);
} | php | public static function Purify($html = null, $encoding = 'UTF-8') {
$config = self::GetHTMLPurifierConfig();
$config->set('Core.Encoding', $encoding);
$config->set('HTML.Allowed', 'span,p,br,a,h1,h2,h3,h4,h5,strong,em,u,ul,li,ol,hr,blockquote,sub,sup,p[class],img');
$config->set('HTML.AllowedElements', array('span', 'p', 'br', 'a', 'h1', 'h2', 'h3', 'h4', 'h5', 'strong', 'em', 'u', 'ul', 'li', 'ol', 'hr', 'blockquote', 'sub', 'sup', 'img'));
$config->set('HTML.AllowedAttributes', 'style,target,title,href,class,src,border,alt,width,height,title,name,id');
$config->set('CSS.AllowedProperties', 'text-align,font-weight,text-decoration');
$config->set('AutoFormat.RemoveEmpty', true);
$config->set('Attr.ForbiddenClasses', array('MsoNormal'));
$purifier = new \HTMLPurifier($config);
return $cleanCode = $purifier->purify($html);
} | [
"public",
"static",
"function",
"Purify",
"(",
"$",
"html",
"=",
"null",
",",
"$",
"encoding",
"=",
"'UTF-8'",
")",
"{",
"$",
"config",
"=",
"self",
"::",
"GetHTMLPurifierConfig",
"(",
")",
";",
"$",
"config",
"->",
"set",
"(",
"'Core.Encoding'",
",",
... | Standard HTML purifier
@param String $html HTML to purify
@param String $encoding
@return String Valid HTML string | [
"Standard",
"HTML",
"purifier"
] | 24bf960387c4578a5d26989927093121694f7b0e | https://github.com/g4b0/silverstripe-htmlpurifier/blob/24bf960387c4578a5d26989927093121694f7b0e/src/Purifier.php#L43-L56 | train |
g4b0/silverstripe-htmlpurifier | src/Purifier.php | Purifier.PurifyXHTML | public static function PurifyXHTML($html = null, $encoding = 'UTF-8') {
$config = self::GetHTMLPurifierConfig();
$config->set('Core.Encoding', $encoding);
$config->set('HTML.Doctype', 'XHTML 1.0 Strict');
$config->set('HTML.TidyLevel', 'heavy'); // all changes, minus...
$config->set('CSS.AllowedProperties', array());
$config->set('Attr.AllowedClasses', array());
$config->set('HTML.Allowed', null);
$config->set('AutoFormat.RemoveEmpty', true); // Remove empty tags
$config->set('AutoFormat.Linkify', true); // add <A> to links
$config->set('AutoFormat.AutoParagraph', true);
$config->set('HTML.ForbiddenElements', array('span', 'center'));
$config->set('Core.EscapeNonASCIICharacters', true);
$config->set('Output.TidyFormat', true);
$purifier = new \HTMLPurifier($config);
$html = $purifier->purify($html);
// Rimpiazzo le parentesi quadre
$html = str_ireplace("%5B", "[", $html);
$html = str_ireplace("%5D", "]", $html);
return $html;
} | php | public static function PurifyXHTML($html = null, $encoding = 'UTF-8') {
$config = self::GetHTMLPurifierConfig();
$config->set('Core.Encoding', $encoding);
$config->set('HTML.Doctype', 'XHTML 1.0 Strict');
$config->set('HTML.TidyLevel', 'heavy'); // all changes, minus...
$config->set('CSS.AllowedProperties', array());
$config->set('Attr.AllowedClasses', array());
$config->set('HTML.Allowed', null);
$config->set('AutoFormat.RemoveEmpty', true); // Remove empty tags
$config->set('AutoFormat.Linkify', true); // add <A> to links
$config->set('AutoFormat.AutoParagraph', true);
$config->set('HTML.ForbiddenElements', array('span', 'center'));
$config->set('Core.EscapeNonASCIICharacters', true);
$config->set('Output.TidyFormat', true);
$purifier = new \HTMLPurifier($config);
$html = $purifier->purify($html);
// Rimpiazzo le parentesi quadre
$html = str_ireplace("%5B", "[", $html);
$html = str_ireplace("%5D", "]", $html);
return $html;
} | [
"public",
"static",
"function",
"PurifyXHTML",
"(",
"$",
"html",
"=",
"null",
",",
"$",
"encoding",
"=",
"'UTF-8'",
")",
"{",
"$",
"config",
"=",
"self",
"::",
"GetHTMLPurifierConfig",
"(",
")",
";",
"$",
"config",
"->",
"set",
"(",
"'Core.Encoding'",
",... | XHTML 1.0 Strict purifier
@param String $html HTML to purify
@param String $encoding
@return String XTML 1.0 Strict validating string | [
"XHTML",
"1",
".",
"0",
"Strict",
"purifier"
] | 24bf960387c4578a5d26989927093121694f7b0e | https://github.com/g4b0/silverstripe-htmlpurifier/blob/24bf960387c4578a5d26989927093121694f7b0e/src/Purifier.php#L64-L88 | train |
g4b0/silverstripe-htmlpurifier | src/Purifier.php | Purifier.PurifyTXT | public static function PurifyTXT($html = null, $encoding = 'UTF-8') {
$config = self::GetHTMLPurifierConfig();
$config->set('Core.Encoding', $encoding);
$config->set('HTML.Allowed', null); // Allow Nothing
$config->set('HTML.AllowedElements', array());
$purifier = new \HTMLPurifier($config);
return $purifier->purify($html);
} | php | public static function PurifyTXT($html = null, $encoding = 'UTF-8') {
$config = self::GetHTMLPurifierConfig();
$config->set('Core.Encoding', $encoding);
$config->set('HTML.Allowed', null); // Allow Nothing
$config->set('HTML.AllowedElements', array());
$purifier = new \HTMLPurifier($config);
return $purifier->purify($html);
} | [
"public",
"static",
"function",
"PurifyTXT",
"(",
"$",
"html",
"=",
"null",
",",
"$",
"encoding",
"=",
"'UTF-8'",
")",
"{",
"$",
"config",
"=",
"self",
"::",
"GetHTMLPurifierConfig",
"(",
")",
";",
"$",
"config",
"->",
"set",
"(",
"'Core.Encoding'",
",",... | Strip all HTML tags, like strip_tags, but encoding safe
@param String $html HTML to purify
@param String $encoding
@return String The input string without any html tags | [
"Strip",
"all",
"HTML",
"tags",
"like",
"strip_tags",
"but",
"encoding",
"safe"
] | 24bf960387c4578a5d26989927093121694f7b0e | https://github.com/g4b0/silverstripe-htmlpurifier/blob/24bf960387c4578a5d26989927093121694f7b0e/src/Purifier.php#L96-L104 | train |
Droeftoeter/pokapi | src/Pokapi/Request/DeviceInfo.php | DeviceInfo.toProtobuf | public function toProtobuf() : SignatureDeviceInfo
{
$deviceInfo = new SignatureDeviceInfo();
if ($this->deviceId !== null) {
$deviceInfo->setDeviceId($this->deviceId);
}
$deviceInfo->setDeviceBrand($this->deviceBrand);
$deviceInfo->setDeviceModel($this->deviceModel);
$deviceInfo->setDeviceModelBoot($this->deviceModelBoot);
$deviceInfo->setFirmwareType($this->firmwareType);
$deviceInfo->setFirmwareBrand($this->firmwareBrand);
$deviceInfo->setHardwareModel($this->hardwareModel);
$deviceInfo->setHardwareManufacturer($this->hardwareManufacturer);
return $deviceInfo;
} | php | public function toProtobuf() : SignatureDeviceInfo
{
$deviceInfo = new SignatureDeviceInfo();
if ($this->deviceId !== null) {
$deviceInfo->setDeviceId($this->deviceId);
}
$deviceInfo->setDeviceBrand($this->deviceBrand);
$deviceInfo->setDeviceModel($this->deviceModel);
$deviceInfo->setDeviceModelBoot($this->deviceModelBoot);
$deviceInfo->setFirmwareType($this->firmwareType);
$deviceInfo->setFirmwareBrand($this->firmwareBrand);
$deviceInfo->setHardwareModel($this->hardwareModel);
$deviceInfo->setHardwareManufacturer($this->hardwareManufacturer);
return $deviceInfo;
} | [
"public",
"function",
"toProtobuf",
"(",
")",
":",
"SignatureDeviceInfo",
"{",
"$",
"deviceInfo",
"=",
"new",
"SignatureDeviceInfo",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"deviceId",
"!==",
"null",
")",
"{",
"$",
"deviceInfo",
"->",
"setDeviceId",
"... | Convert to protobuf message
@return SignatureDeviceInfo | [
"Convert",
"to",
"protobuf",
"message"
] | 3fe0f0c1bd4dc09c5d439eb96294440a75b5e0f3 | https://github.com/Droeftoeter/pokapi/blob/3fe0f0c1bd4dc09c5d439eb96294440a75b5e0f3/src/Pokapi/Request/DeviceInfo.php#L105-L121 | train |
brainsonic/AzureDistributionBundle | DependencyInjection/WindowsAzureDistributionExtension.php | WindowsAzureDistributionExtension.loadKeyValueStore | protected function loadKeyValueStore($config, $container, $loader)
{
if (empty($config['key_value_store']['connection_name'])) {
return;
}
$loader->load('keyvaluestore.xml');
$container->setAlias('windows_azure_distribution.key_value_store.storage_client', 'windows_azure.table.' . $config['key_value_store']['connection_name']);
} | php | protected function loadKeyValueStore($config, $container, $loader)
{
if (empty($config['key_value_store']['connection_name'])) {
return;
}
$loader->load('keyvaluestore.xml');
$container->setAlias('windows_azure_distribution.key_value_store.storage_client', 'windows_azure.table.' . $config['key_value_store']['connection_name']);
} | [
"protected",
"function",
"loadKeyValueStore",
"(",
"$",
"config",
",",
"$",
"container",
",",
"$",
"loader",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"config",
"[",
"'key_value_store'",
"]",
"[",
"'connection_name'",
"]",
")",
")",
"{",
"return",
";",
"}"... | Create the services for Doctrine KeyValueStore with Windows Azure
@param array $config
@param ContainerBuilder $container
@param XmlFileLoader $loader | [
"Create",
"the",
"services",
"for",
"Doctrine",
"KeyValueStore",
"with",
"Windows",
"Azure"
] | 37ad5e94d0fd7618137fbc670df47b035b0029d7 | https://github.com/brainsonic/AzureDistributionBundle/blob/37ad5e94d0fd7618137fbc670df47b035b0029d7/DependencyInjection/WindowsAzureDistributionExtension.php#L59-L67 | train |
jarnix/nofussframework | Nf/Router.php | Router.getNamedUrl | public function getNamedUrl($name, $params = array(), $version = null, $locale = null)
{
if ($version == null) {
$version = Registry::get('version');
}
if ($locale == null) {
$locale = Registry::get('locale');
}
$foundRoute = false;
if (isset($this->allRoutesByVersionAndLocale[$version][$locale][$name])) {
$url = $this->allRoutesByVersionAndLocale[$version][$locale][$name]['regexp'];
$foundRoute = true;
} elseif (isset($this->allRoutesByVersionAndLocale[$version]['*'][$name])) {
$url = $this->allRoutesByVersionAndLocale[$version]['*'][$name]['regexp'];
$foundRoute = true;
} elseif (isset($this->allRoutesByVersionAndLocale['*']['*'][$name])) {
$url = $this->allRoutesByVersionAndLocale['*']['*'][$name]['regexp'];
$foundRoute = true;
}
if ($foundRoute) {
preg_match_all('/\(([\w_]+):([^)]+)\)/im', $url, $result, PREG_SET_ORDER);
for ($matchi = 0; $matchi < count($result); $matchi ++) {
if (isset($params[$result[$matchi][1]])) {
$url = str_replace($result[$matchi][0], $params[$result[$matchi][1]], $url);
}
}
return $url;
} else {
throw new \Exception('Cannot find route named "' . $name . '" (version=' . $version . ', locale=' . $locale . ')');
}
} | php | public function getNamedUrl($name, $params = array(), $version = null, $locale = null)
{
if ($version == null) {
$version = Registry::get('version');
}
if ($locale == null) {
$locale = Registry::get('locale');
}
$foundRoute = false;
if (isset($this->allRoutesByVersionAndLocale[$version][$locale][$name])) {
$url = $this->allRoutesByVersionAndLocale[$version][$locale][$name]['regexp'];
$foundRoute = true;
} elseif (isset($this->allRoutesByVersionAndLocale[$version]['*'][$name])) {
$url = $this->allRoutesByVersionAndLocale[$version]['*'][$name]['regexp'];
$foundRoute = true;
} elseif (isset($this->allRoutesByVersionAndLocale['*']['*'][$name])) {
$url = $this->allRoutesByVersionAndLocale['*']['*'][$name]['regexp'];
$foundRoute = true;
}
if ($foundRoute) {
preg_match_all('/\(([\w_]+):([^)]+)\)/im', $url, $result, PREG_SET_ORDER);
for ($matchi = 0; $matchi < count($result); $matchi ++) {
if (isset($params[$result[$matchi][1]])) {
$url = str_replace($result[$matchi][0], $params[$result[$matchi][1]], $url);
}
}
return $url;
} else {
throw new \Exception('Cannot find route named "' . $name . '" (version=' . $version . ', locale=' . $locale . ')');
}
} | [
"public",
"function",
"getNamedUrl",
"(",
"$",
"name",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"version",
"=",
"null",
",",
"$",
"locale",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"version",
"==",
"null",
")",
"{",
"$",
"version",
"="... | returns the url from the defined routes by its name | [
"returns",
"the",
"url",
"from",
"the",
"defined",
"routes",
"by",
"its",
"name"
] | 2177ebefd408bd9545ac64345b47cde1ff3cdccb | https://github.com/jarnix/nofussframework/blob/2177ebefd408bd9545ac64345b47cde1ff3cdccb/Nf/Router.php#L323-L353 | train |
krystal-framework/krystal.framework | src/Krystal/Form/NodeElement.php | NodeElement.appendChildWithText | public function appendChildWithText(NodeElement $nodeElement, $text, $append = true)
{
$content = $nodeElement->render();
if ($append === true) {
$content = $content.$text;
} else {
$content = $text.$content;
}
$this->setText($content);
return $this;
} | php | public function appendChildWithText(NodeElement $nodeElement, $text, $append = true)
{
$content = $nodeElement->render();
if ($append === true) {
$content = $content.$text;
} else {
$content = $text.$content;
}
$this->setText($content);
return $this;
} | [
"public",
"function",
"appendChildWithText",
"(",
"NodeElement",
"$",
"nodeElement",
",",
"$",
"text",
",",
"$",
"append",
"=",
"true",
")",
"{",
"$",
"content",
"=",
"$",
"nodeElement",
"->",
"render",
"(",
")",
";",
"if",
"(",
"$",
"append",
"===",
"... | Appends child element prepending or appending a text
@param \Krystal\Form\NodeElement $nodeElement
@param string $text
@param boolean $append Whether to append or prepend
@return \Krystal\Form\NodeElement | [
"Appends",
"child",
"element",
"prepending",
"or",
"appending",
"a",
"text"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Form/NodeElement.php#L149-L161 | train |
krystal-framework/krystal.framework | src/Krystal/Form/NodeElement.php | NodeElement.setText | public function setText($text, $finalize = true)
{
if ($finalize && !$this->isFinalized()) {
$this->finalize();
}
$this->append($text);
return $this;
} | php | public function setText($text, $finalize = true)
{
if ($finalize && !$this->isFinalized()) {
$this->finalize();
}
$this->append($text);
return $this;
} | [
"public",
"function",
"setText",
"(",
"$",
"text",
",",
"$",
"finalize",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"finalize",
"&&",
"!",
"$",
"this",
"->",
"isFinalized",
"(",
")",
")",
"{",
"$",
"this",
"->",
"finalize",
"(",
")",
";",
"}",
"$",
... | Sets a text
@param string $text
@param boolean $finalize Whether to finalize the tag
@return \Krystal\Form\NodeElement | [
"Sets",
"a",
"text"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Form/NodeElement.php#L182-L190 | train |
krystal-framework/krystal.framework | src/Krystal/Form/NodeElement.php | NodeElement.finalize | public function finalize($singular = false)
{
$this->finalized = true;
if ($singular === true) {
$text = ' />';
} else {
$text = '>';
}
$this->append($text);
return $this;
} | php | public function finalize($singular = false)
{
$this->finalized = true;
if ($singular === true) {
$text = ' />';
} else {
$text = '>';
}
$this->append($text);
return $this;
} | [
"public",
"function",
"finalize",
"(",
"$",
"singular",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"finalized",
"=",
"true",
";",
"if",
"(",
"$",
"singular",
"===",
"true",
")",
"{",
"$",
"text",
"=",
"' />'",
";",
"}",
"else",
"{",
"$",
"text",
... | Finalizes the opened tag
@param boolean $singular Whether element is singular
@return \Krystal\Form\NodeElement | [
"Finalizes",
"the",
"opened",
"tag"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Form/NodeElement.php#L208-L220 | train |
krystal-framework/krystal.framework | src/Krystal/Form/NodeElement.php | NodeElement.openTag | public function openTag($tagName)
{
$this->append(sprintf('<%s', $tagName));
$this->tag = $tagName;
return $this;
} | php | public function openTag($tagName)
{
$this->append(sprintf('<%s', $tagName));
$this->tag = $tagName;
return $this;
} | [
"public",
"function",
"openTag",
"(",
"$",
"tagName",
")",
"{",
"$",
"this",
"->",
"append",
"(",
"sprintf",
"(",
"'<%s'",
",",
"$",
"tagName",
")",
")",
";",
"$",
"this",
"->",
"tag",
"=",
"$",
"tagName",
";",
"return",
"$",
"this",
";",
"}"
] | Opens a tag
@param string $tagName
@return \Krystal\Form\NodeElement | [
"Opens",
"a",
"tag"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Form/NodeElement.php#L228-L234 | train |
krystal-framework/krystal.framework | src/Krystal/Form/NodeElement.php | NodeElement.closeTag | public function closeTag($tag = null)
{
if ($tag === null) {
$tag = $this->tag;
}
$this->append(sprintf('</%s>', $tag));
return $this;
} | php | public function closeTag($tag = null)
{
if ($tag === null) {
$tag = $this->tag;
}
$this->append(sprintf('</%s>', $tag));
return $this;
} | [
"public",
"function",
"closeTag",
"(",
"$",
"tag",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"tag",
"===",
"null",
")",
"{",
"$",
"tag",
"=",
"$",
"this",
"->",
"tag",
";",
"}",
"$",
"this",
"->",
"append",
"(",
"sprintf",
"(",
"'</%s>'",
",",
"$"... | Closes opened tag
@param string $tag
@return \Krystal\Form\NodeElement | [
"Closes",
"opened",
"tag"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Form/NodeElement.php#L242-L250 | train |
krystal-framework/krystal.framework | src/Krystal/Form/NodeElement.php | NodeElement.addPropertyOnDemand | public function addPropertyOnDemand($property, $value)
{
if ((bool) $value === true) {
$this->addProperty($property);
}
return $this;
} | php | public function addPropertyOnDemand($property, $value)
{
if ((bool) $value === true) {
$this->addProperty($property);
}
return $this;
} | [
"public",
"function",
"addPropertyOnDemand",
"(",
"$",
"property",
",",
"$",
"value",
")",
"{",
"if",
"(",
"(",
"bool",
")",
"$",
"value",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"addProperty",
"(",
"$",
"property",
")",
";",
"}",
"return",
"$",
... | Adds a property on demand
@param string $property
@param mixed $value
@return \Krystal\Form\NodeElement | [
"Adds",
"a",
"property",
"on",
"demand"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Form/NodeElement.php#L278-L285 | train |
krystal-framework/krystal.framework | src/Krystal/Form/NodeElement.php | NodeElement.addAttribute | public function addAttribute($attribute, $value)
{
// Escape special characters
$value = Filter::filterAttribute($value);
if ($this->isProperty($attribute)) {
$this->addPropertyOnDemand($attribute, $value);
} else {
if ($this->hasAttribute($attribute)) {
throw new LogicException(sprintf('The element already has "%s" attribute', $attribute));
}
$this->append(sprintf(' %s="%s"', $attribute, $value));
$this->attributes[$attribute] = $value;
}
return $this;
} | php | public function addAttribute($attribute, $value)
{
// Escape special characters
$value = Filter::filterAttribute($value);
if ($this->isProperty($attribute)) {
$this->addPropertyOnDemand($attribute, $value);
} else {
if ($this->hasAttribute($attribute)) {
throw new LogicException(sprintf('The element already has "%s" attribute', $attribute));
}
$this->append(sprintf(' %s="%s"', $attribute, $value));
$this->attributes[$attribute] = $value;
}
return $this;
} | [
"public",
"function",
"addAttribute",
"(",
"$",
"attribute",
",",
"$",
"value",
")",
"{",
"// Escape special characters",
"$",
"value",
"=",
"Filter",
"::",
"filterAttribute",
"(",
"$",
"value",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isProperty",
"(",
"$... | Adds an attribute
@param string $attribute
@param string $value
@throws \LogicException If trying to set existing attribute
@return \Krystal\Form\NodeElement | [
"Adds",
"an",
"attribute"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Form/NodeElement.php#L342-L359 | train |
krystal-framework/krystal.framework | src/Krystal/Form/NodeElement.php | NodeElement.addAttributes | public function addAttributes(array $attributes)
{
foreach ($attributes as $attribute => $value) {
$this->addAttribute($attribute, $value);
}
return $this;
} | php | public function addAttributes(array $attributes)
{
foreach ($attributes as $attribute => $value) {
$this->addAttribute($attribute, $value);
}
return $this;
} | [
"public",
"function",
"addAttributes",
"(",
"array",
"$",
"attributes",
")",
"{",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"attribute",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"addAttribute",
"(",
"$",
"attribute",
",",
"$",
"value",
")",
... | Adds attribute collection
@param array $attributes
@return \Krystal\Form\NodeElement | [
"Adds",
"attribute",
"collection"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Form/NodeElement.php#L367-L374 | train |
krystal-framework/krystal.framework | src/Krystal/Form/NodeElement.php | NodeElement.hasClass | public function hasClass($class = null)
{
if ($class !== null) {
$classes = explode(' ', $this->getClass());
return in_array($class, $classes);
} else {
return $this->hasAttribute('class');
}
} | php | public function hasClass($class = null)
{
if ($class !== null) {
$classes = explode(' ', $this->getClass());
return in_array($class, $classes);
} else {
return $this->hasAttribute('class');
}
} | [
"public",
"function",
"hasClass",
"(",
"$",
"class",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"class",
"!==",
"null",
")",
"{",
"$",
"classes",
"=",
"explode",
"(",
"' '",
",",
"$",
"this",
"->",
"getClass",
"(",
")",
")",
";",
"return",
"in_array",
... | Determines whether element has a class
@param string $class
@return boolean | [
"Determines",
"whether",
"element",
"has",
"a",
"class"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Form/NodeElement.php#L774-L782 | train |
rocketweb-fed/module-checkout-enhancement | Helper/Data.php | Data.isActiveDefaultPayment | public function isActiveDefaultPayment()
{
return $this->scopeConfig->isSetFlag(
self::XML_PAYMENT_DEFAULT_ACTIVE_DEFAULT_PAYMENT,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
} | php | public function isActiveDefaultPayment()
{
return $this->scopeConfig->isSetFlag(
self::XML_PAYMENT_DEFAULT_ACTIVE_DEFAULT_PAYMENT,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
} | [
"public",
"function",
"isActiveDefaultPayment",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"scopeConfig",
"->",
"isSetFlag",
"(",
"self",
"::",
"XML_PAYMENT_DEFAULT_ACTIVE_DEFAULT_PAYMENT",
",",
"\\",
"Magento",
"\\",
"Store",
"\\",
"Model",
"\\",
"ScopeInterface",... | Is active default payment
@return boolean
@codeCoverageIgnore | [
"Is",
"active",
"default",
"payment"
] | 04e83847f817687b6c59e49f5bc330f57f5d636b | https://github.com/rocketweb-fed/module-checkout-enhancement/blob/04e83847f817687b6c59e49f5bc330f57f5d636b/Helper/Data.php#L45-L51 | train |
rocketweb-fed/module-checkout-enhancement | Helper/Data.php | Data.getDefaultMethod | public function getDefaultMethod()
{
return $this->scopeConfig->getValue(
self::XML_PAYMENT_DEFAULT_METHOD,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
} | php | public function getDefaultMethod()
{
return $this->scopeConfig->getValue(
self::XML_PAYMENT_DEFAULT_METHOD,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
} | [
"public",
"function",
"getDefaultMethod",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"scopeConfig",
"->",
"getValue",
"(",
"self",
"::",
"XML_PAYMENT_DEFAULT_METHOD",
",",
"\\",
"Magento",
"\\",
"Store",
"\\",
"Model",
"\\",
"ScopeInterface",
"::",
"SCOPE_STORE... | Get default payment method
@return array
@codeCoverageIgnore | [
"Get",
"default",
"payment",
"method"
] | 04e83847f817687b6c59e49f5bc330f57f5d636b | https://github.com/rocketweb-fed/module-checkout-enhancement/blob/04e83847f817687b6c59e49f5bc330f57f5d636b/Helper/Data.php#L59-L65 | train |
rocketweb-fed/module-checkout-enhancement | Helper/Data.php | Data.isActiveGoogleAddress | public function isActiveGoogleAddress()
{
$flag = $this->scopeConfig->isSetFlag(
self::XML_GOOGLE_MAP_ADDRESS_ACTIVE_GOOGLE_ADDRESS,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
return $flag && $this->getGoogleMapApiKey();
} | php | public function isActiveGoogleAddress()
{
$flag = $this->scopeConfig->isSetFlag(
self::XML_GOOGLE_MAP_ADDRESS_ACTIVE_GOOGLE_ADDRESS,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
return $flag && $this->getGoogleMapApiKey();
} | [
"public",
"function",
"isActiveGoogleAddress",
"(",
")",
"{",
"$",
"flag",
"=",
"$",
"this",
"->",
"scopeConfig",
"->",
"isSetFlag",
"(",
"self",
"::",
"XML_GOOGLE_MAP_ADDRESS_ACTIVE_GOOGLE_ADDRESS",
",",
"\\",
"Magento",
"\\",
"Store",
"\\",
"Model",
"\\",
"Sco... | Is active Google Maps Address Search
@return boolean
@codeCoverageIgnore | [
"Is",
"active",
"Google",
"Maps",
"Address",
"Search"
] | 04e83847f817687b6c59e49f5bc330f57f5d636b | https://github.com/rocketweb-fed/module-checkout-enhancement/blob/04e83847f817687b6c59e49f5bc330f57f5d636b/Helper/Data.php#L73-L80 | train |
rocketweb-fed/module-checkout-enhancement | Helper/Data.php | Data.isActiveBillingGoogleAddress | public function isActiveBillingGoogleAddress()
{
$flag = $this->scopeConfig->isSetFlag(
self::XML_GOOGLE_MAP_ADDRESS_ACTIVE_GOOGLE_ADDRESS_BILLING,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
return $flag && $this->getGoogleMapApiKey();
} | php | public function isActiveBillingGoogleAddress()
{
$flag = $this->scopeConfig->isSetFlag(
self::XML_GOOGLE_MAP_ADDRESS_ACTIVE_GOOGLE_ADDRESS_BILLING,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
return $flag && $this->getGoogleMapApiKey();
} | [
"public",
"function",
"isActiveBillingGoogleAddress",
"(",
")",
"{",
"$",
"flag",
"=",
"$",
"this",
"->",
"scopeConfig",
"->",
"isSetFlag",
"(",
"self",
"::",
"XML_GOOGLE_MAP_ADDRESS_ACTIVE_GOOGLE_ADDRESS_BILLING",
",",
"\\",
"Magento",
"\\",
"Store",
"\\",
"Model",... | Is active Google Maps Address Search for billing address in Checkout
@return boolean
@codeCoverageIgnore | [
"Is",
"active",
"Google",
"Maps",
"Address",
"Search",
"for",
"billing",
"address",
"in",
"Checkout"
] | 04e83847f817687b6c59e49f5bc330f57f5d636b | https://github.com/rocketweb-fed/module-checkout-enhancement/blob/04e83847f817687b6c59e49f5bc330f57f5d636b/Helper/Data.php#L88-L95 | train |
rocketweb-fed/module-checkout-enhancement | Helper/Data.php | Data.getGoogleMapApiKey | public function getGoogleMapApiKey()
{
$str = $this->scopeConfig->getValue(
self::XML_GOOGLE_MAP_API_KEY,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$str = trim($str);
return $str;
} | php | public function getGoogleMapApiKey()
{
$str = $this->scopeConfig->getValue(
self::XML_GOOGLE_MAP_API_KEY,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$str = trim($str);
return $str;
} | [
"public",
"function",
"getGoogleMapApiKey",
"(",
")",
"{",
"$",
"str",
"=",
"$",
"this",
"->",
"scopeConfig",
"->",
"getValue",
"(",
"self",
"::",
"XML_GOOGLE_MAP_API_KEY",
",",
"\\",
"Magento",
"\\",
"Store",
"\\",
"Model",
"\\",
"ScopeInterface",
"::",
"SC... | Get Google Maps API key
@return array
@codeCoverageIgnore | [
"Get",
"Google",
"Maps",
"API",
"key"
] | 04e83847f817687b6c59e49f5bc330f57f5d636b | https://github.com/rocketweb-fed/module-checkout-enhancement/blob/04e83847f817687b6c59e49f5bc330f57f5d636b/Helper/Data.php#L104-L112 | train |
rocketweb-fed/module-checkout-enhancement | Helper/Data.php | Data.getGoogleMapAddressLibraries | public function getGoogleMapAddressLibraries()
{
return $this->scopeConfig->getValue(
self::XML_GOOGLE_MAP_ADDRESS_LIBRARIES,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
} | php | public function getGoogleMapAddressLibraries()
{
return $this->scopeConfig->getValue(
self::XML_GOOGLE_MAP_ADDRESS_LIBRARIES,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
} | [
"public",
"function",
"getGoogleMapAddressLibraries",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"scopeConfig",
"->",
"getValue",
"(",
"self",
"::",
"XML_GOOGLE_MAP_ADDRESS_LIBRARIES",
",",
"\\",
"Magento",
"\\",
"Store",
"\\",
"Model",
"\\",
"ScopeInterface",
":... | Get Google Maps API libraries
@return array
@codeCoverageIgnore | [
"Get",
"Google",
"Maps",
"API",
"libraries"
] | 04e83847f817687b6c59e49f5bc330f57f5d636b | https://github.com/rocketweb-fed/module-checkout-enhancement/blob/04e83847f817687b6c59e49f5bc330f57f5d636b/Helper/Data.php#L120-L126 | train |
rocketweb-fed/module-checkout-enhancement | Helper/Data.php | Data.getGoogleMapAddressCountries | public function getGoogleMapAddressCountries()
{
return explode(
',',
(string) $this->scopeConfig->getValue(
self::XML_GOOGLE_MAP_ADDRESS_COUNTRY,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
} | php | public function getGoogleMapAddressCountries()
{
return explode(
',',
(string) $this->scopeConfig->getValue(
self::XML_GOOGLE_MAP_ADDRESS_COUNTRY,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
} | [
"public",
"function",
"getGoogleMapAddressCountries",
"(",
")",
"{",
"return",
"explode",
"(",
"','",
",",
"(",
"string",
")",
"$",
"this",
"->",
"scopeConfig",
"->",
"getValue",
"(",
"self",
"::",
"XML_GOOGLE_MAP_ADDRESS_COUNTRY",
",",
"\\",
"Magento",
"\\",
... | Get Google Maps API countries
@return array | [
"Get",
"Google",
"Maps",
"API",
"countries"
] | 04e83847f817687b6c59e49f5bc330f57f5d636b | https://github.com/rocketweb-fed/module-checkout-enhancement/blob/04e83847f817687b6c59e49f5bc330f57f5d636b/Helper/Data.php#L133-L142 | train |
rocketweb-fed/module-checkout-enhancement | Helper/Data.php | Data.getGoogleMapAddressLanguage | public function getGoogleMapAddressLanguage()
{
return $this->scopeConfig->getValue(
self::XML_GOOGLE_MAP_ADDRESS_LANGUAGE,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
} | php | public function getGoogleMapAddressLanguage()
{
return $this->scopeConfig->getValue(
self::XML_GOOGLE_MAP_ADDRESS_LANGUAGE,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
} | [
"public",
"function",
"getGoogleMapAddressLanguage",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"scopeConfig",
"->",
"getValue",
"(",
"self",
"::",
"XML_GOOGLE_MAP_ADDRESS_LANGUAGE",
",",
"\\",
"Magento",
"\\",
"Store",
"\\",
"Model",
"\\",
"ScopeInterface",
"::"... | Get Google Maps API languages
@return array
@codeCoverageIgnore | [
"Get",
"Google",
"Maps",
"API",
"languages"
] | 04e83847f817687b6c59e49f5bc330f57f5d636b | https://github.com/rocketweb-fed/module-checkout-enhancement/blob/04e83847f817687b6c59e49f5bc330f57f5d636b/Helper/Data.php#L150-L156 | train |
Droeftoeter/pokapi | src/Pokapi/API.php | API.checkChallenge | public function checkChallenge()
{
$request = new CheckChallenge();
/** @var CheckChallengeResponse $response */
$response = $this->service->execute($request, $this->position);
$challengeUrl = trim($response->getChallengeUrl());
if ($response->getShowChallenge() || !empty($challengeUrl)) {
if (!$this->captchaSolver instanceof Solver) {
$this->getLogger()->alert("Account has been flagged for CAPTCHA. No CAPTCHA-solver defined, returning challenge.");
return $challengeUrl;
}
$this->getLogger()->alert("Account has been flagged for CAPTCHA. Attempting to solve CAPTCHA with defined resolver.");
/* Attempt to solve CAPTCHA */
$token = $this->captchaSolver->solve($challengeUrl);
$this->getLogger()->info("Received CAPTCHA solution. Verifying...");
/* Wait 1 second before firing verification request. */
sleep(1);
$verify = $this->verifyChallenge($token);
if ($verify->hasSuccess()) {
$this->getLogger()->info("Successfully solved CAPTCHA.");
return true;
}
throw new FailedCaptchaException("Failed to resolve CAPTCHA.");
}
return false;
} | php | public function checkChallenge()
{
$request = new CheckChallenge();
/** @var CheckChallengeResponse $response */
$response = $this->service->execute($request, $this->position);
$challengeUrl = trim($response->getChallengeUrl());
if ($response->getShowChallenge() || !empty($challengeUrl)) {
if (!$this->captchaSolver instanceof Solver) {
$this->getLogger()->alert("Account has been flagged for CAPTCHA. No CAPTCHA-solver defined, returning challenge.");
return $challengeUrl;
}
$this->getLogger()->alert("Account has been flagged for CAPTCHA. Attempting to solve CAPTCHA with defined resolver.");
/* Attempt to solve CAPTCHA */
$token = $this->captchaSolver->solve($challengeUrl);
$this->getLogger()->info("Received CAPTCHA solution. Verifying...");
/* Wait 1 second before firing verification request. */
sleep(1);
$verify = $this->verifyChallenge($token);
if ($verify->hasSuccess()) {
$this->getLogger()->info("Successfully solved CAPTCHA.");
return true;
}
throw new FailedCaptchaException("Failed to resolve CAPTCHA.");
}
return false;
} | [
"public",
"function",
"checkChallenge",
"(",
")",
"{",
"$",
"request",
"=",
"new",
"CheckChallenge",
"(",
")",
";",
"/** @var CheckChallengeResponse $response */",
"$",
"response",
"=",
"$",
"this",
"->",
"service",
"->",
"execute",
"(",
"$",
"request",
",",
"... | Check if there is a CAPTCHA challenge.
Returns the challenge if there is
Returns false if there is not.
Will attempt to solve the Captcha if a Solver is defined.
@return string|bool
@throws Exception
@throws FailedCaptchaException | [
"Check",
"if",
"there",
"is",
"a",
"CAPTCHA",
"challenge",
"."
] | 3fe0f0c1bd4dc09c5d439eb96294440a75b5e0f3 | https://github.com/Droeftoeter/pokapi/blob/3fe0f0c1bd4dc09c5d439eb96294440a75b5e0f3/src/Pokapi/API.php#L172-L205 | train |
Droeftoeter/pokapi | src/Pokapi/API.php | API.acceptTerms | public function acceptTerms() : MarkTutorialCompleteResponse
{
$request = new MarkTutorialComplete();
return $this->service->execute($request, $this->position);
} | php | public function acceptTerms() : MarkTutorialCompleteResponse
{
$request = new MarkTutorialComplete();
return $this->service->execute($request, $this->position);
} | [
"public",
"function",
"acceptTerms",
"(",
")",
":",
"MarkTutorialCompleteResponse",
"{",
"$",
"request",
"=",
"new",
"MarkTutorialComplete",
"(",
")",
";",
"return",
"$",
"this",
"->",
"service",
"->",
"execute",
"(",
"$",
"request",
",",
"$",
"this",
"->",
... | Accept the terms
@return MarkTutorialCompleteResponse | [
"Accept",
"the",
"terms"
] | 3fe0f0c1bd4dc09c5d439eb96294440a75b5e0f3 | https://github.com/Droeftoeter/pokapi/blob/3fe0f0c1bd4dc09c5d439eb96294440a75b5e0f3/src/Pokapi/API.php#L225-L229 | train |
Droeftoeter/pokapi | src/Pokapi/API.php | API.getPlayerData | public function getPlayerData() : GetPlayerResponse
{
$request = new GetPlayer();
return $this->service->execute($request, $this->position);
} | php | public function getPlayerData() : GetPlayerResponse
{
$request = new GetPlayer();
return $this->service->execute($request, $this->position);
} | [
"public",
"function",
"getPlayerData",
"(",
")",
":",
"GetPlayerResponse",
"{",
"$",
"request",
"=",
"new",
"GetPlayer",
"(",
")",
";",
"return",
"$",
"this",
"->",
"service",
"->",
"execute",
"(",
"$",
"request",
",",
"$",
"this",
"->",
"position",
")",... | Get player data
@return GetPlayerResponse | [
"Get",
"player",
"data"
] | 3fe0f0c1bd4dc09c5d439eb96294440a75b5e0f3 | https://github.com/Droeftoeter/pokapi/blob/3fe0f0c1bd4dc09c5d439eb96294440a75b5e0f3/src/Pokapi/API.php#L236-L240 | train |
Droeftoeter/pokapi | src/Pokapi/API.php | API.getInventory | public function getInventory() : GetInventoryResponse
{
$request = new GetInventory();
return $this->service->execute($request, $this->position);
} | php | public function getInventory() : GetInventoryResponse
{
$request = new GetInventory();
return $this->service->execute($request, $this->position);
} | [
"public",
"function",
"getInventory",
"(",
")",
":",
"GetInventoryResponse",
"{",
"$",
"request",
"=",
"new",
"GetInventory",
"(",
")",
";",
"return",
"$",
"this",
"->",
"service",
"->",
"execute",
"(",
"$",
"request",
",",
"$",
"this",
"->",
"position",
... | Get player inventory
@return GetInventoryResponse | [
"Get",
"player",
"inventory"
] | 3fe0f0c1bd4dc09c5d439eb96294440a75b5e0f3 | https://github.com/Droeftoeter/pokapi/blob/3fe0f0c1bd4dc09c5d439eb96294440a75b5e0f3/src/Pokapi/API.php#L247-L251 | train |
Droeftoeter/pokapi | src/Pokapi/API.php | API.getMapObjects | public function getMapObjects() : GetMapObjectsResponse
{
$request = new GetMapObjects($this->position);
return $this->service->execute($request, $this->position);
} | php | public function getMapObjects() : GetMapObjectsResponse
{
$request = new GetMapObjects($this->position);
return $this->service->execute($request, $this->position);
} | [
"public",
"function",
"getMapObjects",
"(",
")",
":",
"GetMapObjectsResponse",
"{",
"$",
"request",
"=",
"new",
"GetMapObjects",
"(",
"$",
"this",
"->",
"position",
")",
";",
"return",
"$",
"this",
"->",
"service",
"->",
"execute",
"(",
"$",
"request",
","... | Get map objects
@return GetMapObjectsResponse | [
"Get",
"map",
"objects"
] | 3fe0f0c1bd4dc09c5d439eb96294440a75b5e0f3 | https://github.com/Droeftoeter/pokapi/blob/3fe0f0c1bd4dc09c5d439eb96294440a75b5e0f3/src/Pokapi/API.php#L269-L273 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/PluginBag.php | PluginBag.appendInternal | private function appendInternal($unit, array &$stack)
{
$unit = $this->normalizeAssetPath($unit);
array_push($stack, $unit);
return $this;
} | php | private function appendInternal($unit, array &$stack)
{
$unit = $this->normalizeAssetPath($unit);
array_push($stack, $unit);
return $this;
} | [
"private",
"function",
"appendInternal",
"(",
"$",
"unit",
",",
"array",
"&",
"$",
"stack",
")",
"{",
"$",
"unit",
"=",
"$",
"this",
"->",
"normalizeAssetPath",
"(",
"$",
"unit",
")",
";",
"array_push",
"(",
"$",
"stack",
",",
"$",
"unit",
")",
";",
... | Appends a unit
@param string $unit A path to unit
@return \Krystal\Application\View\PluginBag | [
"Appends",
"a",
"unit"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/PluginBag.php#L81-L87 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/PluginBag.php | PluginBag.normalizeAssetPath | private function normalizeAssetPath($path)
{
$pattern = '~@(\w+)~';
$replacement = sprintf('/%s/$1/%s', ViewManager::TEMPLATE_PARAM_MODULES_DIR, ViewManager::TEMPLATE_PARAM_ASSETS_DIR);
return preg_replace($pattern, $replacement, $path);
} | php | private function normalizeAssetPath($path)
{
$pattern = '~@(\w+)~';
$replacement = sprintf('/%s/$1/%s', ViewManager::TEMPLATE_PARAM_MODULES_DIR, ViewManager::TEMPLATE_PARAM_ASSETS_DIR);
return preg_replace($pattern, $replacement, $path);
} | [
"private",
"function",
"normalizeAssetPath",
"(",
"$",
"path",
")",
"{",
"$",
"pattern",
"=",
"'~@(\\w+)~'",
";",
"$",
"replacement",
"=",
"sprintf",
"(",
"'/%s/$1/%s'",
",",
"ViewManager",
"::",
"TEMPLATE_PARAM_MODULES_DIR",
",",
"ViewManager",
"::",
"TEMPLATE_PA... | Replaces a module path inside provided path
@param string $path Target path
@return string | [
"Replaces",
"a",
"module",
"path",
"inside",
"provided",
"path"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/PluginBag.php#L95-L101 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/PluginBag.php | PluginBag.register | public function register(array $collection)
{
foreach ($collection as $name => $data) {
$this->plugins[$name] = $data;
}
return $this;
} | php | public function register(array $collection)
{
foreach ($collection as $name => $data) {
$this->plugins[$name] = $data;
}
return $this;
} | [
"public",
"function",
"register",
"(",
"array",
"$",
"collection",
")",
"{",
"foreach",
"(",
"$",
"collection",
"as",
"$",
"name",
"=>",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"plugins",
"[",
"$",
"name",
"]",
"=",
"$",
"data",
";",
"}",
"return... | Registers plugin collection
@return \Krystal\Application\View\PluginBag | [
"Registers",
"plugin",
"collection"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/PluginBag.php#L232-L239 | train |
krystal-framework/krystal.framework | src/Krystal/Application/View/PluginBag.php | PluginBag.load | public function load($plugins)
{
if (!is_array($plugins)) {
$plugins = (array) $plugins;
}
foreach ($plugins as $plugin) {
if (!isset($this->plugins[$plugin])) {
trigger_error(sprintf('Attempted to load non-existing plugin %s', $plugin));
return false;
}
if (isset($this->plugins[$plugin]['scripts'])) {
$this->appendScripts($this->plugins[$plugin]['scripts']);
}
if (isset($this->plugins[$plugin]['stylesheets'])) {
$this->appendStylesheets($this->plugins[$plugin]['stylesheets']);
}
}
return $this;
} | php | public function load($plugins)
{
if (!is_array($plugins)) {
$plugins = (array) $plugins;
}
foreach ($plugins as $plugin) {
if (!isset($this->plugins[$plugin])) {
trigger_error(sprintf('Attempted to load non-existing plugin %s', $plugin));
return false;
}
if (isset($this->plugins[$plugin]['scripts'])) {
$this->appendScripts($this->plugins[$plugin]['scripts']);
}
if (isset($this->plugins[$plugin]['stylesheets'])) {
$this->appendStylesheets($this->plugins[$plugin]['stylesheets']);
}
}
return $this;
} | [
"public",
"function",
"load",
"(",
"$",
"plugins",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"plugins",
")",
")",
"{",
"$",
"plugins",
"=",
"(",
"array",
")",
"$",
"plugins",
";",
"}",
"foreach",
"(",
"$",
"plugins",
"as",
"$",
"plugin",
")... | Loads plugins or a single plugin
@param string|array $name
@return \Krystal\Application\View\PluginBag | [
"Loads",
"plugins",
"or",
"a",
"single",
"plugin"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Application/View/PluginBag.php#L247-L269 | train |
droath/project-x | src/Task/ReportTasks.php | ReportTasks.reportLighthouse | public function reportLighthouse($opts = [
'hostname' => null,
'protocol' => 'http'
])
{
$host = ProjectX::getProjectConfig()
->getHost();
$protocol = $opts['protocol'];
$hostname = isset($opts['hostname'])
? $opts['hostname']
: (isset($host['name']) ? $host['name'] : 'localhost');
$path = $this->getReportsPath() . "/lighthouse-report-$hostname.html";
$this->taskGoogleLighthouse()
->setUrl("$protocol://$hostname")
->setOutputPath($path)
->run();
} | php | public function reportLighthouse($opts = [
'hostname' => null,
'protocol' => 'http'
])
{
$host = ProjectX::getProjectConfig()
->getHost();
$protocol = $opts['protocol'];
$hostname = isset($opts['hostname'])
? $opts['hostname']
: (isset($host['name']) ? $host['name'] : 'localhost');
$path = $this->getReportsPath() . "/lighthouse-report-$hostname.html";
$this->taskGoogleLighthouse()
->setUrl("$protocol://$hostname")
->setOutputPath($path)
->run();
} | [
"public",
"function",
"reportLighthouse",
"(",
"$",
"opts",
"=",
"[",
"'hostname'",
"=>",
"null",
",",
"'protocol'",
"=>",
"'http'",
"]",
")",
"{",
"$",
"host",
"=",
"ProjectX",
"::",
"getProjectConfig",
"(",
")",
"->",
"getHost",
"(",
")",
";",
"$",
"... | Run Google lighthouse report.
@param array $opts
@option string $hostname Set the hostname.
@option string $protocol Set the protocol to use https or http. | [
"Run",
"Google",
"lighthouse",
"report",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/ReportTasks.php#L22-L41 | train |
droath/project-x | src/Task/ReportTasks.php | ReportTasks.getReportsPath | protected function getReportsPath()
{
$project_root = ProjectX::projectRoot();
$reports_path = "$project_root/reports";
if (!file_exists($reports_path)) {
mkdir($reports_path);
}
return $reports_path;
} | php | protected function getReportsPath()
{
$project_root = ProjectX::projectRoot();
$reports_path = "$project_root/reports";
if (!file_exists($reports_path)) {
mkdir($reports_path);
}
return $reports_path;
} | [
"protected",
"function",
"getReportsPath",
"(",
")",
"{",
"$",
"project_root",
"=",
"ProjectX",
"::",
"projectRoot",
"(",
")",
";",
"$",
"reports_path",
"=",
"\"$project_root/reports\"",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"reports_path",
")",
")",
... | Get project-x reports path.
@return string
The project-x reports path. | [
"Get",
"project",
"-",
"x",
"reports",
"path",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/ReportTasks.php#L49-L59 | train |
droath/project-x | src/Task/EngineTasks.php | EngineTasks.engineUp | public function engineUp($opts = ['no-hostname' => false, 'no-browser' => false])
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->executeExistingCommand('env:up');
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | php | public function engineUp($opts = ['no-hostname' => false, 'no-browser' => false])
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->executeExistingCommand('env:up');
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | [
"public",
"function",
"engineUp",
"(",
"$",
"opts",
"=",
"[",
"'no-hostname'",
"=>",
"false",
",",
"'no-browser'",
"=>",
"false",
"]",
")",
"{",
"$",
"this",
"->",
"executeCommandHook",
"(",
"__FUNCTION__",
",",
"'before'",
")",
";",
"$",
"this",
"->",
"... | Startup engine environment.
@param array $opts An array of command options.
@option $no-hostname Don't add hostname to the system hosts file
regardless if it's defined in the project-x config.
@option $no-browser Don't open the browser window on startup regardless
if it's defined in the project-x config.
@hidden
@deprecated
@return EngineTasks
@throws \Exception | [
"Startup",
"engine",
"environment",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/EngineTasks.php#L29-L36 | train |
droath/project-x | src/Task/EngineTasks.php | EngineTasks.engineRebuild | public function engineRebuild()
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->executeExistingCommand('env:rebuild');
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | php | public function engineRebuild()
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->executeExistingCommand('env:rebuild');
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | [
"public",
"function",
"engineRebuild",
"(",
")",
"{",
"$",
"this",
"->",
"executeCommandHook",
"(",
"__FUNCTION__",
",",
"'before'",
")",
";",
"$",
"this",
"->",
"executeExistingCommand",
"(",
"'env:rebuild'",
")",
";",
"$",
"this",
"->",
"executeCommandHook",
... | Rebuild engine configuration.
@hidden
@deprecated | [
"Rebuild",
"engine",
"configuration",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/EngineTasks.php#L44-L51 | train |
droath/project-x | src/Task/EngineTasks.php | EngineTasks.engineDown | public function engineDown($opts = [
'include-network' => false
])
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->executeExistingCommand('env:down');
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | php | public function engineDown($opts = [
'include-network' => false
])
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->executeExistingCommand('env:down');
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | [
"public",
"function",
"engineDown",
"(",
"$",
"opts",
"=",
"[",
"'include-network'",
"=>",
"false",
"]",
")",
"{",
"$",
"this",
"->",
"executeCommandHook",
"(",
"__FUNCTION__",
",",
"'before'",
")",
";",
"$",
"this",
"->",
"executeExistingCommand",
"(",
"'en... | Shutdown engine environment.
@param array $opts
@option $include-network Shutdown the shared network proxy.
@hidden
@deprecated
@return EngineTasks
@throws \Exception | [
"Shutdown",
"engine",
"environment",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/EngineTasks.php#L64-L73 | train |
droath/project-x | src/Task/EngineTasks.php | EngineTasks.engineResume | public function engineResume()
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->executeExistingCommand('env:resume');
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | php | public function engineResume()
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->executeExistingCommand('env:resume');
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | [
"public",
"function",
"engineResume",
"(",
")",
"{",
"$",
"this",
"->",
"executeCommandHook",
"(",
"__FUNCTION__",
",",
"'before'",
")",
";",
"$",
"this",
"->",
"executeExistingCommand",
"(",
"'env:resume'",
")",
";",
"$",
"this",
"->",
"executeCommandHook",
"... | Resume halted engine environment.
@hidden
@deprecated | [
"Resume",
"halted",
"engine",
"environment",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/EngineTasks.php#L81-L88 | train |
droath/project-x | src/Task/EngineTasks.php | EngineTasks.engineRestart | public function engineRestart()
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->executeExistingCommand('env:restart');
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | php | public function engineRestart()
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->executeExistingCommand('env:restart');
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | [
"public",
"function",
"engineRestart",
"(",
")",
"{",
"$",
"this",
"->",
"executeCommandHook",
"(",
"__FUNCTION__",
",",
"'before'",
")",
";",
"$",
"this",
"->",
"executeExistingCommand",
"(",
"'env:restart'",
")",
";",
"$",
"this",
"->",
"executeCommandHook",
... | Restart engine environment.
@hidden
@deprecated | [
"Restart",
"engine",
"environment",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/EngineTasks.php#L96-L103 | train |
droath/project-x | src/Task/EngineTasks.php | EngineTasks.engineReboot | public function engineReboot()
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->executeExistingCommand('env:reboot');
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | php | public function engineReboot()
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->executeExistingCommand('env:reboot');
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | [
"public",
"function",
"engineReboot",
"(",
")",
"{",
"$",
"this",
"->",
"executeCommandHook",
"(",
"__FUNCTION__",
",",
"'before'",
")",
";",
"$",
"this",
"->",
"executeExistingCommand",
"(",
"'env:reboot'",
")",
";",
"$",
"this",
"->",
"executeCommandHook",
"... | Reboot engine environment.
@hidden
@deprecated | [
"Reboot",
"engine",
"environment",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/EngineTasks.php#L111-L118 | train |
droath/project-x | src/Task/EngineTasks.php | EngineTasks.engineInstall | public function engineInstall()
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->executeExistingCommand('env:install');
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | php | public function engineInstall()
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->executeExistingCommand('env:install');
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | [
"public",
"function",
"engineInstall",
"(",
")",
"{",
"$",
"this",
"->",
"executeCommandHook",
"(",
"__FUNCTION__",
",",
"'before'",
")",
";",
"$",
"this",
"->",
"executeExistingCommand",
"(",
"'env:install'",
")",
";",
"$",
"this",
"->",
"executeCommandHook",
... | Install engine configuration setup.
@hidden
@deprecated | [
"Install",
"engine",
"configuration",
"setup",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/EngineTasks.php#L139-L146 | train |
droath/project-x | src/Task/EngineTasks.php | EngineTasks.executeExistingCommand | protected function executeExistingCommand(
$command_name,
InputInterface $input = null,
OutputInterface $output = null
) {
if (!isset($command_name)) {
return 1;
}
$input = isset($input) ? $input : $this->input();
$output = isset($output) ? $output : $this->output();
return $this->getApplication()
->find($command_name)
->run($input, $output);
} | php | protected function executeExistingCommand(
$command_name,
InputInterface $input = null,
OutputInterface $output = null
) {
if (!isset($command_name)) {
return 1;
}
$input = isset($input) ? $input : $this->input();
$output = isset($output) ? $output : $this->output();
return $this->getApplication()
->find($command_name)
->run($input, $output);
} | [
"protected",
"function",
"executeExistingCommand",
"(",
"$",
"command_name",
",",
"InputInterface",
"$",
"input",
"=",
"null",
",",
"OutputInterface",
"$",
"output",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"command_name",
")",
")",
"{",
"... | Execute existing command.
@param $command_name
The name of the command.
@param InputInterface|null $input
@param OutputInterface|null $output
@return int
The execute command exit code.
@throws \Exception | [
"Execute",
"existing",
"command",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/Task/EngineTasks.php#L161-L175 | train |
krystal-framework/krystal.framework | src/Krystal/Http/Response/StatusGenerator.php | StatusGenerator.getDescriptionByStatusCode | public function getDescriptionByStatusCode($code)
{
// Make sure the expected type supplied
$code = (int) $code;
if (isset($this->statuses[$code])) {
return $this->statuses[$code];
} else {
throw new OutOfRangeException(
sprintf('The status code "%s" is out of allowed range', $code)
);
}
} | php | public function getDescriptionByStatusCode($code)
{
// Make sure the expected type supplied
$code = (int) $code;
if (isset($this->statuses[$code])) {
return $this->statuses[$code];
} else {
throw new OutOfRangeException(
sprintf('The status code "%s" is out of allowed range', $code)
);
}
} | [
"public",
"function",
"getDescriptionByStatusCode",
"(",
"$",
"code",
")",
"{",
"// Make sure the expected type supplied",
"$",
"code",
"=",
"(",
"int",
")",
"$",
"code",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"statuses",
"[",
"$",
"code",
"]",
"... | Returns description by its associated code
@param integer $code Status code
@throws \OutOfRangeException If the supplied code is out of range
@return string | [
"Returns",
"description",
"by",
"its",
"associated",
"code"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Http/Response/StatusGenerator.php#L131-L143 | train |
krystal-framework/krystal.framework | src/Krystal/Http/Response/StatusGenerator.php | StatusGenerator.generate | public function generate($code)
{
if ($this->isValid($code)) {
return sprintf('HTTP/%s %s %s', $this->version, $code, $this->getDescriptionByStatusCode($code));
} else {
return false;
}
} | php | public function generate($code)
{
if ($this->isValid($code)) {
return sprintf('HTTP/%s %s %s', $this->version, $code, $this->getDescriptionByStatusCode($code));
} else {
return false;
}
} | [
"public",
"function",
"generate",
"(",
"$",
"code",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isValid",
"(",
"$",
"code",
")",
")",
"{",
"return",
"sprintf",
"(",
"'HTTP/%s %s %s'",
",",
"$",
"this",
"->",
"version",
",",
"$",
"code",
",",
"$",
"thi... | Generates status header by associated code
@param integer $code
@return string|boolean | [
"Generates",
"status",
"header",
"by",
"associated",
"code"
] | a5ff72384f3efbe74f390538793feb7d522b9c39 | https://github.com/krystal-framework/krystal.framework/blob/a5ff72384f3efbe74f390538793feb7d522b9c39/src/Krystal/Http/Response/StatusGenerator.php#L151-L158 | train |
droath/project-x | src/ProjectX.php | ProjectX.discoverCommands | public function discoverCommands()
{
$commands = (new PhpClassDiscovery())
->addSearchLocation(APP_ROOT . '/src/Command')
->matchExtend('Symfony\Component\Console\Command\Command')
->discover();
foreach ($commands as $classname) {
$this->add(new $classname());
}
return $this;
} | php | public function discoverCommands()
{
$commands = (new PhpClassDiscovery())
->addSearchLocation(APP_ROOT . '/src/Command')
->matchExtend('Symfony\Component\Console\Command\Command')
->discover();
foreach ($commands as $classname) {
$this->add(new $classname());
}
return $this;
} | [
"public",
"function",
"discoverCommands",
"(",
")",
"{",
"$",
"commands",
"=",
"(",
"new",
"PhpClassDiscovery",
"(",
")",
")",
"->",
"addSearchLocation",
"(",
"APP_ROOT",
".",
"'/src/Command'",
")",
"->",
"matchExtend",
"(",
"'Symfony\\Component\\Console\\Command\\C... | Discover Project-X commands. | [
"Discover",
"Project",
"-",
"X",
"commands",
"."
] | 85a7a4879bd041f4c5cb565356646e5f5e2435b7 | https://github.com/droath/project-x/blob/85a7a4879bd041f4c5cb565356646e5f5e2435b7/src/ProjectX.php#L62-L74 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.