repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
CakeCMS/Core
src/Plugin.php
Plugin._checkData
protected static function _checkData($plugin) { return (Arr::in($plugin, self::$_data)) ? self::$_data[$plugin] : []; }
php
protected static function _checkData($plugin) { return (Arr::in($plugin, self::$_data)) ? self::$_data[$plugin] : []; }
[ "protected", "static", "function", "_checkData", "(", "$", "plugin", ")", "{", "return", "(", "Arr", "::", "in", "(", "$", "plugin", ",", "self", "::", "$", "_data", ")", ")", "?", "self", "::", "$", "_data", "[", "$", "plugin", "]", ":", "[", "]...
Check plugin data. @param string $plugin @return array
[ "Check", "plugin", "data", "." ]
train
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Plugin.php#L243-L246
CakeCMS/Core
src/Plugin.php
Plugin._findPlugin
protected static function _findPlugin($name) { $output = null; $paths = App::path('Plugin'); $plugin = Configure::read('plugins.' . $name); if ($plugin !== null) { return $plugin; } foreach ($paths as $path) { $plgPath = $path . $name . DS; ...
php
protected static function _findPlugin($name) { $output = null; $paths = App::path('Plugin'); $plugin = Configure::read('plugins.' . $name); if ($plugin !== null) { return $plugin; } foreach ($paths as $path) { $plgPath = $path . $name . DS; ...
[ "protected", "static", "function", "_findPlugin", "(", "$", "name", ")", "{", "$", "output", "=", "null", ";", "$", "paths", "=", "App", "::", "path", "(", "'Plugin'", ")", ";", "$", "plugin", "=", "Configure", "::", "read", "(", "'plugins.'", ".", "...
Find plugin dir in registered paths. @param string $name @return null|string
[ "Find", "plugin", "dir", "in", "registered", "paths", "." ]
train
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Plugin.php#L254-L273
CakeCMS/Core
src/Plugin.php
Plugin._getConfigForLoad
protected static function _getConfigForLoad($path) { $config = ['autoload' => true]; $routes = $path . 'config' . DS . Plugin::FILE_ROUTES; $bootstrap = $path . 'config' . DS . Plugin::FILE_BOOTSTRAP; if (FS::isFile($bootstrap)) { $config['bootstrap'] = true; ...
php
protected static function _getConfigForLoad($path) { $config = ['autoload' => true]; $routes = $path . 'config' . DS . Plugin::FILE_ROUTES; $bootstrap = $path . 'config' . DS . Plugin::FILE_BOOTSTRAP; if (FS::isFile($bootstrap)) { $config['bootstrap'] = true; ...
[ "protected", "static", "function", "_getConfigForLoad", "(", "$", "path", ")", "{", "$", "config", "=", "[", "'autoload'", "=>", "true", "]", ";", "$", "routes", "=", "$", "path", ".", "'config'", ".", "DS", ".", "Plugin", "::", "FILE_ROUTES", ";", "$"...
Get plugin configuration for load plugin. @param string $path @return array
[ "Get", "plugin", "configuration", "for", "load", "plugin", "." ]
train
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Plugin.php#L281-L298
CakeCMS/Core
src/Plugin.php
Plugin._getPluginData
protected static function _getPluginData(array $data, $key = null) { if (isset($data[$key])) { $data = $data[$key]; } return new Data($data); }
php
protected static function _getPluginData(array $data, $key = null) { if (isset($data[$key])) { $data = $data[$key]; } return new Data($data); }
[ "protected", "static", "function", "_getPluginData", "(", "array", "$", "data", ",", "$", "key", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "data", "[", "$", "key", "]", ")", ")", "{", "$", "data", "=", "$", "data", "[", "$", "key", "...
Get current plugin data. @param array $data @param null|string $key @return Data
[ "Get", "current", "plugin", "data", "." ]
train
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Plugin.php#L307-L314
CakeCMS/Core
src/Plugin.php
Plugin._isCallablePluginData
protected static function _isCallablePluginData($name, $plugin, $callback) { if (Arr::in($name, self::$_manifestEvents) && !isset(self::$_eventList[$name][$plugin]) && is_callable($callback) ) { return true; } return false; }
php
protected static function _isCallablePluginData($name, $plugin, $callback) { if (Arr::in($name, self::$_manifestEvents) && !isset(self::$_eventList[$name][$plugin]) && is_callable($callback) ) { return true; } return false; }
[ "protected", "static", "function", "_isCallablePluginData", "(", "$", "name", ",", "$", "plugin", ",", "$", "callback", ")", "{", "if", "(", "Arr", "::", "in", "(", "$", "name", ",", "self", "::", "$", "_manifestEvents", ")", "&&", "!", "isset", "(", ...
Check manifest param on callable. @param string $name @param string $plugin @param mixed $callback @return bool
[ "Check", "manifest", "param", "on", "callable", "." ]
train
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Plugin.php#L324-L334
yuncms/framework
src/helpers/PasswordHelper.php
PasswordHelper.hash
public static function hash($password, $cost = 10): string { return Yii::$app->security->generatePasswordHash($password, $cost); }
php
public static function hash($password, $cost = 10): string { return Yii::$app->security->generatePasswordHash($password, $cost); }
[ "public", "static", "function", "hash", "(", "$", "password", ",", "$", "cost", "=", "10", ")", ":", "string", "{", "return", "Yii", "::", "$", "app", "->", "security", "->", "generatePasswordHash", "(", "$", "password", ",", "$", "cost", ")", ";", "...
Wrapper for yii security helper method. @param string $password @param int $cost @return string @throws \yii\base\Exception
[ "Wrapper", "for", "yii", "security", "helper", "method", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/PasswordHelper.php#L28-L31
yuncms/framework
src/helpers/PasswordHelper.php
PasswordHelper.validate
public static function validate($password, $hash): bool { return Yii::$app->security->validatePassword($password, $hash); }
php
public static function validate($password, $hash): bool { return Yii::$app->security->validatePassword($password, $hash); }
[ "public", "static", "function", "validate", "(", "$", "password", ",", "$", "hash", ")", ":", "bool", "{", "return", "Yii", "::", "$", "app", "->", "security", "->", "validatePassword", "(", "$", "password", ",", "$", "hash", ")", ";", "}" ]
Wrapper for yii security helper method. @param $password @param $hash @return boolean
[ "Wrapper", "for", "yii", "security", "helper", "method", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/PasswordHelper.php#L41-L44
yuncms/framework
src/helpers/PasswordHelper.php
PasswordHelper.generate
public static function generate($length): string { $sets = ['abcdefghjkmnpqrstuvwxyz', 'ABCDEFGHJKMNPQRSTUVWXYZ', '23456789']; $all = ''; $password = ''; foreach ($sets as $set) { $password .= $set[array_rand(str_split($set))]; $all .= $set; } ...
php
public static function generate($length): string { $sets = ['abcdefghjkmnpqrstuvwxyz', 'ABCDEFGHJKMNPQRSTUVWXYZ', '23456789']; $all = ''; $password = ''; foreach ($sets as $set) { $password .= $set[array_rand(str_split($set))]; $all .= $set; } ...
[ "public", "static", "function", "generate", "(", "$", "length", ")", ":", "string", "{", "$", "sets", "=", "[", "'abcdefghjkmnpqrstuvwxyz'", ",", "'ABCDEFGHJKMNPQRSTUVWXYZ'", ",", "'23456789'", "]", ";", "$", "all", "=", "''", ";", "$", "password", "=", "'...
Generates user-friendly random password containing at least one lower case letter, one uppercase letter and one digit. The remaining characters in the password are chosen at random from those three sets. @see https://gist.github.com/tylerhall/521810 @param $length @return string
[ "Generates", "user", "-", "friendly", "random", "password", "containing", "at", "least", "one", "lower", "case", "letter", "one", "uppercase", "letter", "and", "one", "digit", ".", "The", "remaining", "characters", "in", "the", "password", "are", "chosen", "at...
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/PasswordHelper.php#L56-L74
titon/db
src/Titon/Db/Entity.php
Entity.toArray
public function toArray() { return array_map(function($value) { return ($value instanceof Arrayable) ? $value->toArray() : $value; }, $this->_data); }
php
public function toArray() { return array_map(function($value) { return ($value instanceof Arrayable) ? $value->toArray() : $value; }, $this->_data); }
[ "public", "function", "toArray", "(", ")", "{", "return", "array_map", "(", "function", "(", "$", "value", ")", "{", "return", "(", "$", "value", "instanceof", "Arrayable", ")", "?", "$", "value", "->", "toArray", "(", ")", ":", "$", "value", ";", "}...
{@inheritdoc}
[ "{" ]
train
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Entity.php#L116-L120
devemio/php-readable-timer
src/TimerPool.php
TimerPool.stop
public function stop($marker) { if (array_key_exists($marker, $this->timers)) { $this->timers[$marker]->stop(); } }
php
public function stop($marker) { if (array_key_exists($marker, $this->timers)) { $this->timers[$marker]->stop(); } }
[ "public", "function", "stop", "(", "$", "marker", ")", "{", "if", "(", "array_key_exists", "(", "$", "marker", ",", "$", "this", "->", "timers", ")", ")", "{", "$", "this", "->", "timers", "[", "$", "marker", "]", "->", "stop", "(", ")", ";", "}"...
Stop timer with a specific marker. @param string $marker
[ "Stop", "timer", "with", "a", "specific", "marker", "." ]
train
https://github.com/devemio/php-readable-timer/blob/50916b630eda07999dc6676528afe59fb2105615/src/TimerPool.php#L48-L53
devemio/php-readable-timer
src/TimerPool.php
TimerPool.build
public function build() { foreach ($this->timers as $marker => $timer) { $this->markers[$marker] = $timer->time(); } arsort($this->markers); return $this->markers; }
php
public function build() { foreach ($this->timers as $marker => $timer) { $this->markers[$marker] = $timer->time(); } arsort($this->markers); return $this->markers; }
[ "public", "function", "build", "(", ")", "{", "foreach", "(", "$", "this", "->", "timers", "as", "$", "marker", "=>", "$", "timer", ")", "{", "$", "this", "->", "markers", "[", "$", "marker", "]", "=", "$", "timer", "->", "time", "(", ")", ";", ...
Return sorted times. @return string[]
[ "Return", "sorted", "times", "." ]
train
https://github.com/devemio/php-readable-timer/blob/50916b630eda07999dc6676528afe59fb2105615/src/TimerPool.php#L60-L67
webforge-labs/psc-cms
lib/Psc/System/Console/DeployCommand.php
DeployCommand.configure
protected function configure() { $this->setName('project:deploy'); $this->addArgument('mode',self::OPTIONAL | self::IS_ARRAY, 'staging oder normal', array('normal')); $this->addOption('deploymentsDir',self::VALUE_REQUIRED); //$this->addArgument('class',self::REQUIRED); $this->addOption('without-test...
php
protected function configure() { $this->setName('project:deploy'); $this->addArgument('mode',self::OPTIONAL | self::IS_ARRAY, 'staging oder normal', array('normal')); $this->addOption('deploymentsDir',self::VALUE_REQUIRED); //$this->addArgument('class',self::REQUIRED); $this->addOption('without-test...
[ "protected", "function", "configure", "(", ")", "{", "$", "this", "->", "setName", "(", "'project:deploy'", ")", ";", "$", "this", "->", "addArgument", "(", "'mode'", ",", "self", "::", "OPTIONAL", "|", "self", "::", "IS_ARRAY", ",", "'staging oder normal'",...
/* /properties
[ "/", "*", "/", "properties" ]
train
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/System/Console/DeployCommand.php#L60-L69
aedart/laravel-helpers
src/Traits/Config/ConfigTrait.php
ConfigTrait.getConfig
public function getConfig(): ?Repository { if (!$this->hasConfig()) { $this->setConfig($this->getDefaultConfig()); } return $this->config; }
php
public function getConfig(): ?Repository { if (!$this->hasConfig()) { $this->setConfig($this->getDefaultConfig()); } return $this->config; }
[ "public", "function", "getConfig", "(", ")", ":", "?", "Repository", "{", "if", "(", "!", "$", "this", "->", "hasConfig", "(", ")", ")", "{", "$", "this", "->", "setConfig", "(", "$", "this", "->", "getDefaultConfig", "(", ")", ")", ";", "}", "retu...
Get config If no config has been set, this method will set and return a default config, if any such value is available @see getDefaultConfig() @return Repository|null config or null if none config has been set
[ "Get", "config" ]
train
https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Config/ConfigTrait.php#L53-L59
lmammino/e-foundation
src/Price/Model/PricedItemTrait.php
PricedItemTrait.calculateTotal
public function calculateTotal() { $this->calculateAdjustmentsTotal(); $this->total = ($this->quantity * $this->unitPrice) + $this->adjustmentsTotal; if ($this->total < 0) { $this->total = 0; } return $this; }
php
public function calculateTotal() { $this->calculateAdjustmentsTotal(); $this->total = ($this->quantity * $this->unitPrice) + $this->adjustmentsTotal; if ($this->total < 0) { $this->total = 0; } return $this; }
[ "public", "function", "calculateTotal", "(", ")", "{", "$", "this", "->", "calculateAdjustmentsTotal", "(", ")", ";", "$", "this", "->", "total", "=", "(", "$", "this", "->", "quantity", "*", "$", "this", "->", "unitPrice", ")", "+", "$", "this", "->",...
Calculates the total for the item @return $this
[ "Calculates", "the", "total", "for", "the", "item" ]
train
https://github.com/lmammino/e-foundation/blob/198b7047d93eb11c9bc0c7ddf0bfa8229d42807a/src/Price/Model/PricedItemTrait.php#L153-L164
lmammino/e-foundation
src/Price/Model/PricedItemTrait.php
PricedItemTrait.merge
public function merge(PricedItemInterface $item) { if ($this !== $item) { $this->quantity += $item->getQuantity(); } return $this; }
php
public function merge(PricedItemInterface $item) { if ($this !== $item) { $this->quantity += $item->getQuantity(); } return $this; }
[ "public", "function", "merge", "(", "PricedItemInterface", "$", "item", ")", "{", "if", "(", "$", "this", "!==", "$", "item", ")", "{", "$", "this", "->", "quantity", "+=", "$", "item", "->", "getQuantity", "(", ")", ";", "}", "return", "$", "this", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/lmammino/e-foundation/blob/198b7047d93eb11c9bc0c7ddf0bfa8229d42807a/src/Price/Model/PricedItemTrait.php#L177-L184
lmammino/e-foundation
src/Price/Model/PricedItemsContainerTrait.php
PricedItemsContainerTrait.setItems
public function setItems(Collection $items) { $this->itemsTotal = null; $this->total = null; foreach ($items as $item) { $this->addItem($item); } return $this; }
php
public function setItems(Collection $items) { $this->itemsTotal = null; $this->total = null; foreach ($items as $item) { $this->addItem($item); } return $this; }
[ "public", "function", "setItems", "(", "Collection", "$", "items", ")", "{", "$", "this", "->", "itemsTotal", "=", "null", ";", "$", "this", "->", "total", "=", "null", ";", "foreach", "(", "$", "items", "as", "$", "item", ")", "{", "$", "this", "-...
Set items @param Collection $items @return $this
[ "Set", "items" ]
train
https://github.com/lmammino/e-foundation/blob/198b7047d93eb11c9bc0c7ddf0bfa8229d42807a/src/Price/Model/PricedItemsContainerTrait.php#L92-L102
lmammino/e-foundation
src/Price/Model/PricedItemsContainerTrait.php
PricedItemsContainerTrait.addItem
public function addItem(PricedItemInterface $item) { if ($this->hasItem($item)) { return $this; } foreach ($this->items as $existingItem) { if ($item->equals($existingItem)) { $existingItem->merge($item, false); $this->itemsTotal = nu...
php
public function addItem(PricedItemInterface $item) { if ($this->hasItem($item)) { return $this; } foreach ($this->items as $existingItem) { if ($item->equals($existingItem)) { $existingItem->merge($item, false); $this->itemsTotal = nu...
[ "public", "function", "addItem", "(", "PricedItemInterface", "$", "item", ")", "{", "if", "(", "$", "this", "->", "hasItem", "(", "$", "item", ")", ")", "{", "return", "$", "this", ";", "}", "foreach", "(", "$", "this", "->", "items", "as", "$", "e...
Add an item @param PricedItemInterface $item @return $this
[ "Add", "an", "item" ]
train
https://github.com/lmammino/e-foundation/blob/198b7047d93eb11c9bc0c7ddf0bfa8229d42807a/src/Price/Model/PricedItemsContainerTrait.php#L121-L145
lmammino/e-foundation
src/Price/Model/PricedItemsContainerTrait.php
PricedItemsContainerTrait.removeItem
public function removeItem(PricedItemInterface $item) { if ($this->hasItem($item)) { $item->setContainer(null); $this->items->removeElement($item); $this->itemsTotal = null; $this->total = null; } return $this; }
php
public function removeItem(PricedItemInterface $item) { if ($this->hasItem($item)) { $item->setContainer(null); $this->items->removeElement($item); $this->itemsTotal = null; $this->total = null; } return $this; }
[ "public", "function", "removeItem", "(", "PricedItemInterface", "$", "item", ")", "{", "if", "(", "$", "this", "->", "hasItem", "(", "$", "item", ")", ")", "{", "$", "item", "->", "setContainer", "(", "null", ")", ";", "$", "this", "->", "items", "->...
Remove a given item @param PricedItemInterface $item @return $this
[ "Remove", "a", "given", "item" ]
train
https://github.com/lmammino/e-foundation/blob/198b7047d93eb11c9bc0c7ddf0bfa8229d42807a/src/Price/Model/PricedItemsContainerTrait.php#L154-L165
lmammino/e-foundation
src/Price/Model/PricedItemsContainerTrait.php
PricedItemsContainerTrait.calculateItemsTotal
public function calculateItemsTotal() { $itemsTotal = 0; foreach ($this->items as $item) { $itemsTotal += $item->getTotal(); } $this->itemsTotal = $itemsTotal; return $this; }
php
public function calculateItemsTotal() { $itemsTotal = 0; foreach ($this->items as $item) { $itemsTotal += $item->getTotal(); } $this->itemsTotal = $itemsTotal; return $this; }
[ "public", "function", "calculateItemsTotal", "(", ")", "{", "$", "itemsTotal", "=", "0", ";", "foreach", "(", "$", "this", "->", "items", "as", "$", "item", ")", "{", "$", "itemsTotal", "+=", "$", "item", "->", "getTotal", "(", ")", ";", "}", "$", ...
Calculate the total price for all the items @return $this
[ "Calculate", "the", "total", "price", "for", "all", "the", "items" ]
train
https://github.com/lmammino/e-foundation/blob/198b7047d93eb11c9bc0c7ddf0bfa8229d42807a/src/Price/Model/PricedItemsContainerTrait.php#L196-L207
lmammino/e-foundation
src/Price/Model/PricedItemsContainerTrait.php
PricedItemsContainerTrait.calculateTotal
public function calculateTotal() { $this->total = $this->getItemsTotal() + $this->getAdjustmentTotal(); if ($this->total < 0) { $this->total = 0; } return $this; }
php
public function calculateTotal() { $this->total = $this->getItemsTotal() + $this->getAdjustmentTotal(); if ($this->total < 0) { $this->total = 0; } return $this; }
[ "public", "function", "calculateTotal", "(", ")", "{", "$", "this", "->", "total", "=", "$", "this", "->", "getItemsTotal", "(", ")", "+", "$", "this", "->", "getAdjustmentTotal", "(", ")", ";", "if", "(", "$", "this", "->", "total", "<", "0", ")", ...
Calculate the total amount for the whole container @return $this
[ "Calculate", "the", "total", "amount", "for", "the", "whole", "container" ]
train
https://github.com/lmammino/e-foundation/blob/198b7047d93eb11c9bc0c7ddf0bfa8229d42807a/src/Price/Model/PricedItemsContainerTrait.php#L241-L250
vi-kon/laravel-auth
src/ViKon/Auth/Middleware/LoginRedirectorMiddleware.php
LoginRedirectorMiddleware.handle
public function handle(Request $request, Closure $next, $route) { $router = $this->container->make('router'); $currentRoute = $router->current(); $action = $currentRoute->getAction(); if (isset($action['role'])) { $action['roles'] = $action['role']; } ...
php
public function handle(Request $request, Closure $next, $route) { $router = $this->container->make('router'); $currentRoute = $router->current(); $action = $currentRoute->getAction(); if (isset($action['role'])) { $action['roles'] = $action['role']; } ...
[ "public", "function", "handle", "(", "Request", "$", "request", ",", "Closure", "$", "next", ",", "$", "route", ")", "{", "$", "router", "=", "$", "this", "->", "container", "->", "make", "(", "'router'", ")", ";", "$", "currentRoute", "=", "$", "rou...
Handle an incoming request. @param \Illuminate\Http\Request $request @param \Closure $next @param string $route route name @return \Illuminate\Http\RedirectResponse|mixed
[ "Handle", "an", "incoming", "request", "." ]
train
https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/Middleware/LoginRedirectorMiddleware.php#L44-L74
forxer/tao
src/Tao/Controller/Controller.php
Controller.redirectToRoute
protected function redirectToRoute($route, array $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH, $status = 302) { return $this->redirect($this->generateUrl($route, $parameters, $referenceType), $status); }
php
protected function redirectToRoute($route, array $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH, $status = 302) { return $this->redirect($this->generateUrl($route, $parameters, $referenceType), $status); }
[ "protected", "function", "redirectToRoute", "(", "$", "route", ",", "array", "$", "parameters", "=", "[", "]", ",", "$", "referenceType", "=", "UrlGeneratorInterface", "::", "ABSOLUTE_PATH", ",", "$", "status", "=", "302", ")", "{", "return", "$", "this", ...
Returns a RedirectResponse to the given route with the given parameters. @param string $route The name of the route @param array $parameters An array of parameters @param int $status The status code to use for the Response @return RedirectResponse
[ "Returns", "a", "RedirectResponse", "to", "the", "given", "route", "with", "the", "given", "parameters", "." ]
train
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Controller/Controller.php#L64-L67
forxer/tao
src/Tao/Controller/Controller.php
Controller.stream
public function stream($view, array $parameters = [], StreamedResponse $response = null) { $templating = $this->app['templating']; $callback = function () use($templating, $view, $parameters) { $templating->stream($view, $parameters); }; if (null === $response) { return new StreamedResponse($callback);...
php
public function stream($view, array $parameters = [], StreamedResponse $response = null) { $templating = $this->app['templating']; $callback = function () use($templating, $view, $parameters) { $templating->stream($view, $parameters); }; if (null === $response) { return new StreamedResponse($callback);...
[ "public", "function", "stream", "(", "$", "view", ",", "array", "$", "parameters", "=", "[", "]", ",", "StreamedResponse", "$", "response", "=", "null", ")", "{", "$", "templating", "=", "$", "this", "->", "app", "[", "'templating'", "]", ";", "$", "...
Streams a view. @param string $view The view name @param array $parameters An array of parameters to pass to the view @param StreamedResponse $response A response instance @return StreamedResponse A StreamedResponse instance
[ "Streams", "a", "view", "." ]
train
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Controller/Controller.php#L127-L142
forxer/tao
src/Tao/Controller/Controller.php
Controller.serve401
public function serve401() { $response = new Response(); $response->setStatusCode(Response::HTTP_UNAUTHORIZED); return $this->render('Errors/401', [], $response); }
php
public function serve401() { $response = new Response(); $response->setStatusCode(Response::HTTP_UNAUTHORIZED); return $this->render('Errors/401', [], $response); }
[ "public", "function", "serve401", "(", ")", "{", "$", "response", "=", "new", "Response", "(", ")", ";", "$", "response", "->", "setStatusCode", "(", "Response", "::", "HTTP_UNAUTHORIZED", ")", ";", "return", "$", "this", "->", "render", "(", "'Errors/401'...
Affichage page 401
[ "Affichage", "page", "401" ]
train
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Controller/Controller.php#L147-L153
forxer/tao
src/Tao/Controller/Controller.php
Controller.serve404
public function serve404() { $response = new Response(); $response->setStatusCode(Response::HTTP_NOT_FOUND); return $this->render('Errors/404', [], $response); }
php
public function serve404() { $response = new Response(); $response->setStatusCode(Response::HTTP_NOT_FOUND); return $this->render('Errors/404', [], $response); }
[ "public", "function", "serve404", "(", ")", "{", "$", "response", "=", "new", "Response", "(", ")", ";", "$", "response", "->", "setStatusCode", "(", "Response", "::", "HTTP_NOT_FOUND", ")", ";", "return", "$", "this", "->", "render", "(", "'Errors/404'", ...
Affichage page 404
[ "Affichage", "page", "404" ]
train
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Controller/Controller.php#L158-L164
forxer/tao
src/Tao/Controller/Controller.php
Controller.serve503
public function serve503() { $response = new Response(); $response->setStatusCode(Response::HTTP_SERVICE_UNAVAILABLE); $response->headers->set('Retry-After', 3600); return $this->render('Errors/503', [], $response); }
php
public function serve503() { $response = new Response(); $response->setStatusCode(Response::HTTP_SERVICE_UNAVAILABLE); $response->headers->set('Retry-After', 3600); return $this->render('Errors/503', [], $response); }
[ "public", "function", "serve503", "(", ")", "{", "$", "response", "=", "new", "Response", "(", ")", ";", "$", "response", "->", "setStatusCode", "(", "Response", "::", "HTTP_SERVICE_UNAVAILABLE", ")", ";", "$", "response", "->", "headers", "->", "set", "("...
Affichage page 503
[ "Affichage", "page", "503" ]
train
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Controller/Controller.php#L169-L176
forxer/tao
src/Tao/Controller/Controller.php
Controller.removeTrailingSlash
public function removeTrailingSlash() { $pathInfo = $this->app['request']->getPathInfo(); $requestUri = $this->app['request']->getRequestUri(); $url = str_replace($pathInfo, rtrim($pathInfo, ' /'), $requestUri); return $this->redirect($url, Response::HTTP_MOVED_PERMANENTLY); }
php
public function removeTrailingSlash() { $pathInfo = $this->app['request']->getPathInfo(); $requestUri = $this->app['request']->getRequestUri(); $url = str_replace($pathInfo, rtrim($pathInfo, ' /'), $requestUri); return $this->redirect($url, Response::HTTP_MOVED_PERMANENTLY); }
[ "public", "function", "removeTrailingSlash", "(", ")", "{", "$", "pathInfo", "=", "$", "this", "->", "app", "[", "'request'", "]", "->", "getPathInfo", "(", ")", ";", "$", "requestUri", "=", "$", "this", "->", "app", "[", "'request'", "]", "->", "getRe...
Remove trailing slash and redirect permanent @return \Symfony\Component\HttpFoundation\RedirectResponse
[ "Remove", "trailing", "slash", "and", "redirect", "permanent" ]
train
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Controller/Controller.php#L183-L191
dreamfactorysoftware/df-file
src/Models/WebDAVFileConfig.php
WebDAVFileConfig.prepareConfigSchemaField
protected static function prepareConfigSchemaField(array &$schema) { parent::prepareConfigSchemaField($schema); switch ($schema['name']) { case 'base_uri': $schema['description'] = 'WebDAV base uri. This should only be the host. No resource or prefixes. ' . ...
php
protected static function prepareConfigSchemaField(array &$schema) { parent::prepareConfigSchemaField($schema); switch ($schema['name']) { case 'base_uri': $schema['description'] = 'WebDAV base uri. This should only be the host. No resource or prefixes. ' . ...
[ "protected", "static", "function", "prepareConfigSchemaField", "(", "array", "&", "$", "schema", ")", "{", "parent", "::", "prepareConfigSchemaField", "(", "$", "schema", ")", ";", "switch", "(", "$", "schema", "[", "'name'", "]", ")", "{", "case", "'base_ur...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamfactorysoftware/df-file/blob/e78aaec3e1d6585b5e7fe9b7646af4b1180ecd66/src/Models/WebDAVFileConfig.php#L56-L95
ClanCats/Core
src/classes/CCView/Builder/CCFTemplate.php
CCView_Builder_CCFTemplate.repair_expression
public function repair_expression( $exp ) { $commands = explode( ' ', $exp ); // filter empty ones $commands = array_filter( $commands, function( $value ) { return !is_null( $value ); }); // bracket starting command if ( in_array( $commands[0], $this->bracket_starting_commands ) ) { // each ...
php
public function repair_expression( $exp ) { $commands = explode( ' ', $exp ); // filter empty ones $commands = array_filter( $commands, function( $value ) { return !is_null( $value ); }); // bracket starting command if ( in_array( $commands[0], $this->bracket_starting_commands ) ) { // each ...
[ "public", "function", "repair_expression", "(", "$", "exp", ")", "{", "$", "commands", "=", "explode", "(", "' '", ",", "$", "exp", ")", ";", "// filter empty ones", "$", "commands", "=", "array_filter", "(", "$", "commands", ",", "function", "(", "$", "...
Repair an expression
[ "Repair", "an", "expression" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCView/Builder/CCFTemplate.php#L102-L194
ClanCats/Core
src/classes/CCView/Builder/CCFTemplate.php
CCView_Builder_CCFTemplate.compile_phptag
private function compile_phptag( $view ) { // I hate this workaround $that = $this; return preg_replace_callback('/\{\%(.*?)\%\}/s', function( $match ) use( $that ) { $expression = trim( $match[1] ); // repair it $expression = $that->repair_expression( $expression ); return '<?php '.$expressio...
php
private function compile_phptag( $view ) { // I hate this workaround $that = $this; return preg_replace_callback('/\{\%(.*?)\%\}/s', function( $match ) use( $that ) { $expression = trim( $match[1] ); // repair it $expression = $that->repair_expression( $expression ); return '<?php '.$expressio...
[ "private", "function", "compile_phptag", "(", "$", "view", ")", "{", "// I hate this workaround", "$", "that", "=", "$", "this", ";", "return", "preg_replace_callback", "(", "'/\\{\\%(.*?)\\%\\}/s'", ",", "function", "(", "$", "match", ")", "use", "(", "$", "t...
Search and replace for shortcuts of the php tag @param string $view @return void
[ "Search", "and", "replace", "for", "shortcuts", "of", "the", "php", "tag" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCView/Builder/CCFTemplate.php#L223-L237
ClanCats/Core
src/classes/CCView/Builder/CCFTemplate.php
CCView_Builder_CCFTemplate.compile_arrays
private function compile_arrays( $view ) { $tokens = token_get_all( $view ); $tags = array( 0 => '' ); $tag_index = 0; $in_tag = false; // parse all php tags out of the view foreach ( $tokens as $token ) { if ( is_array( $token ) ) { if ( $token[0] === T_OPEN_TAG ) { $in_tag = tru...
php
private function compile_arrays( $view ) { $tokens = token_get_all( $view ); $tags = array( 0 => '' ); $tag_index = 0; $in_tag = false; // parse all php tags out of the view foreach ( $tokens as $token ) { if ( is_array( $token ) ) { if ( $token[0] === T_OPEN_TAG ) { $in_tag = tru...
[ "private", "function", "compile_arrays", "(", "$", "view", ")", "{", "$", "tokens", "=", "token_get_all", "(", "$", "view", ")", ";", "$", "tags", "=", "array", "(", "0", "=>", "''", ")", ";", "$", "tag_index", "=", "0", ";", "$", "in_tag", "=", ...
Search and replace vars with . array access @param string $view @return void
[ "Search", "and", "replace", "vars", "with", ".", "array", "access" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCView/Builder/CCFTemplate.php#L245-L342
anexia-it/anexia-laravel-encryption
src/DatabaseEncryption.php
DatabaseEncryption.performInsert
protected function performInsert(Builder $query) { $encryptedFields = static::getEncryptedFields(); if (count($encryptedFields) && !$this->getEncryptKey()) { throw new \RuntimeException("No encryption key specified"); } $originalAttributes = $this->attributes; for...
php
protected function performInsert(Builder $query) { $encryptedFields = static::getEncryptedFields(); if (count($encryptedFields) && !$this->getEncryptKey()) { throw new \RuntimeException("No encryption key specified"); } $originalAttributes = $this->attributes; for...
[ "protected", "function", "performInsert", "(", "Builder", "$", "query", ")", "{", "$", "encryptedFields", "=", "static", "::", "getEncryptedFields", "(", ")", ";", "if", "(", "count", "(", "$", "encryptedFields", ")", "&&", "!", "$", "this", "->", "getEncr...
Perform insert with encryption @param Builder $query @return bool
[ "Perform", "insert", "with", "encryption" ]
train
https://github.com/anexia-it/anexia-laravel-encryption/blob/b7c72d99916ebca2d2cf2dbab1d4c0f84e383081/src/DatabaseEncryption.php#L59-L80
anexia-it/anexia-laravel-encryption
src/DatabaseEncryption.php
DatabaseEncryption.newBaseQueryBuilder
protected function newBaseQueryBuilder() { $connection = $this->getConnection(); return new DatabaseEncryptionQueryBuilder( $connection, $connection->getQueryGrammar(), $connection->getPostProcessor() ); }
php
protected function newBaseQueryBuilder() { $connection = $this->getConnection(); return new DatabaseEncryptionQueryBuilder( $connection, $connection->getQueryGrammar(), $connection->getPostProcessor() ); }
[ "protected", "function", "newBaseQueryBuilder", "(", ")", "{", "$", "connection", "=", "$", "this", "->", "getConnection", "(", ")", ";", "return", "new", "DatabaseEncryptionQueryBuilder", "(", "$", "connection", ",", "$", "connection", "->", "getQueryGrammar", ...
Get a new query builder instance for the connection. Use the package's DatabaseEncryptionQueryBuilder. @return \Illuminate\Database\Query\Builder
[ "Get", "a", "new", "query", "builder", "instance", "for", "the", "connection", ".", "Use", "the", "package", "s", "DatabaseEncryptionQueryBuilder", "." ]
train
https://github.com/anexia-it/anexia-laravel-encryption/blob/b7c72d99916ebca2d2cf2dbab1d4c0f84e383081/src/DatabaseEncryption.php#L116-L123
anexia-it/anexia-laravel-encryption
src/DatabaseEncryption.php
DatabaseEncryption.getArrayableItems
protected function getArrayableItems(array $values) { $encryptedFields = static::getEncryptedFields(); if (count($this->getVisible()) > 0) { $visibles = $this->getVisible(); $intValues = array_intersect_key($values, array_flip($visibles)); foreach ($encryptedFie...
php
protected function getArrayableItems(array $values) { $encryptedFields = static::getEncryptedFields(); if (count($this->getVisible()) > 0) { $visibles = $this->getVisible(); $intValues = array_intersect_key($values, array_flip($visibles)); foreach ($encryptedFie...
[ "protected", "function", "getArrayableItems", "(", "array", "$", "values", ")", "{", "$", "encryptedFields", "=", "static", "::", "getEncryptedFields", "(", ")", ";", "if", "(", "count", "(", "$", "this", "->", "getVisible", "(", ")", ")", ">", "0", ")",...
Get an attribute array of all arrayable values. @param array $values @return array
[ "Get", "an", "attribute", "array", "of", "all", "arrayable", "values", "." ]
train
https://github.com/anexia-it/anexia-laravel-encryption/blob/b7c72d99916ebca2d2cf2dbab1d4c0f84e383081/src/DatabaseEncryption.php#L166-L198
christianblos/markdown2html
src/FilenameInfo.php
FilenameInfo.convertToLabel
private function convertToLabel($value) { $value = preg_replace('/(?<!-)-(?!-)/U', ' ', $value); $value = preg_replace('/(?<!-)--(?!-)/U', '-', $value); $value = preg_replace('/(?<!-)---(?!-)/U', ' - ', $value); return $value; }
php
private function convertToLabel($value) { $value = preg_replace('/(?<!-)-(?!-)/U', ' ', $value); $value = preg_replace('/(?<!-)--(?!-)/U', '-', $value); $value = preg_replace('/(?<!-)---(?!-)/U', ' - ', $value); return $value; }
[ "private", "function", "convertToLabel", "(", "$", "value", ")", "{", "$", "value", "=", "preg_replace", "(", "'/(?<!-)-(?!-)/U'", ",", "' '", ",", "$", "value", ")", ";", "$", "value", "=", "preg_replace", "(", "'/(?<!-)--(?!-)/U'", ",", "'-'", ",", "$", ...
@param string $value @return string
[ "@param", "string", "$value" ]
train
https://github.com/christianblos/markdown2html/blob/2ae1177d71fe313c802962dbb9226b5a90bbc65a/src/FilenameInfo.php#L65-L72
VincentChalnot/SidusAdminBundle
Entity/AdminEntityMatcher.php
AdminEntityMatcher.getAdminForEntity
public function getAdminForEntity($entity): Admin { $class = \get_class($entity); if (array_key_exists($class, $this->cache)) { return $this->cache[$class]; } foreach ($this->adminRegistry->getAdmins() as $admin) { if (is_a($entity, $admin->getEntity())) { ...
php
public function getAdminForEntity($entity): Admin { $class = \get_class($entity); if (array_key_exists($class, $this->cache)) { return $this->cache[$class]; } foreach ($this->adminRegistry->getAdmins() as $admin) { if (is_a($entity, $admin->getEntity())) { ...
[ "public", "function", "getAdminForEntity", "(", "$", "entity", ")", ":", "Admin", "{", "$", "class", "=", "\\", "get_class", "(", "$", "entity", ")", ";", "if", "(", "array_key_exists", "(", "$", "class", ",", "$", "this", "->", "cache", ")", ")", "{...
@param mixed $entity @throws \UnexpectedValueException @return Admin
[ "@param", "mixed", "$entity" ]
train
https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Entity/AdminEntityMatcher.php#L44-L61
ClanCats/Core
src/classes/CCOrbit.php
CCOrbit.installed_ships
public static function installed_ships() { $ships = static::$data->get( 'installed', array() ); foreach ( $ships as $key => $ship ) { $ships[$key] = CCROOT.$ship; } return $ships; }
php
public static function installed_ships() { $ships = static::$data->get( 'installed', array() ); foreach ( $ships as $key => $ship ) { $ships[$key] = CCROOT.$ship; } return $ships; }
[ "public", "static", "function", "installed_ships", "(", ")", "{", "$", "ships", "=", "static", "::", "$", "data", "->", "get", "(", "'installed'", ",", "array", "(", ")", ")", ";", "foreach", "(", "$", "ships", "as", "$", "key", "=>", "$", "ship", ...
return all installed ships
[ "return", "all", "installed", "ships" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCOrbit.php#L85-L95
ClanCats/Core
src/classes/CCOrbit.php
CCOrbit.install
public static function install( $path ) { // load ship at path $ship = CCOrbit_Ship::create( $path ); if ( static::$data->has( 'installed.'.$ship->name ) ) { throw new CCException( "CCOrbit::install - {$ship->name} ship already installed." ); } if ( $ship->install !== false ) { $ship->event( ...
php
public static function install( $path ) { // load ship at path $ship = CCOrbit_Ship::create( $path ); if ( static::$data->has( 'installed.'.$ship->name ) ) { throw new CCException( "CCOrbit::install - {$ship->name} ship already installed." ); } if ( $ship->install !== false ) { $ship->event( ...
[ "public", "static", "function", "install", "(", "$", "path", ")", "{", "// load ship at path", "$", "ship", "=", "CCOrbit_Ship", "::", "create", "(", "$", "path", ")", ";", "if", "(", "static", "::", "$", "data", "->", "has", "(", "'installed.'", ".", ...
install a ship string $path | the ship name / the folder. If the path is not absolute, ORBITPATH gets used
[ "install", "a", "ship" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCOrbit.php#L111-L129
ClanCats/Core
src/classes/CCOrbit.php
CCOrbit.uninstall
public static function uninstall( $path ) { // load ship at path $ship = CCOrbit_Ship::create( $path ); if ( !static::$data->has( 'installed.'.$ship->name ) ) { throw new CCException( "CCOrbit::uninstall - {$ship->name} ship is not installed." ); } if ( $ship->uninstall !== false ) { $ship->eve...
php
public static function uninstall( $path ) { // load ship at path $ship = CCOrbit_Ship::create( $path ); if ( !static::$data->has( 'installed.'.$ship->name ) ) { throw new CCException( "CCOrbit::uninstall - {$ship->name} ship is not installed." ); } if ( $ship->uninstall !== false ) { $ship->eve...
[ "public", "static", "function", "uninstall", "(", "$", "path", ")", "{", "// load ship at path", "$", "ship", "=", "CCOrbit_Ship", "::", "create", "(", "$", "path", ")", ";", "if", "(", "!", "static", "::", "$", "data", "->", "has", "(", "'installed.'", ...
install a ship string $path | the ship name / the folder. If the path is not absolute, ORBITPATH gets used
[ "install", "a", "ship" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCOrbit.php#L136-L153
ClanCats/Core
src/classes/CCOrbit.php
CCOrbit.enter
public static function enter( $path ) { if ( !is_array( $path ) ) { $path = array( $path ); } foreach( $path as $ship ) { // load ship at path $ship = CCOrbit_Ship::create( $ship ); if ( array_key_exists( $ship->name, static::$ships ) ) { throw new CCException( "CCOrbit::enter...
php
public static function enter( $path ) { if ( !is_array( $path ) ) { $path = array( $path ); } foreach( $path as $ship ) { // load ship at path $ship = CCOrbit_Ship::create( $ship ); if ( array_key_exists( $ship->name, static::$ships ) ) { throw new CCException( "CCOrbit::enter...
[ "public", "static", "function", "enter", "(", "$", "path", ")", "{", "if", "(", "!", "is_array", "(", "$", "path", ")", ")", "{", "$", "path", "=", "array", "(", "$", "path", ")", ";", "}", "foreach", "(", "$", "path", "as", "$", "ship", ")", ...
Add a ship this loads the ship loader file @param string $path @return bool
[ "Add", "a", "ship", "this", "loads", "the", "ship", "loader", "file" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCOrbit.php#L162-L188
seeruo/framework
src/Library/Pinyin.php
Pinyin.getpy
public static function getpy($s, $quanpin = true, $daxie = false) { $s = preg_replace("/\s/is", "_", $s); $s = preg_replace("/(|\~|\`|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\-|\+|\=|\{|\}|\[|\]|\||\\|\:|\;|\"|\'|\<|\,|\>|\.|\?|\/)/is", "", $s); $i = 0; $py = ''; // ...
php
public static function getpy($s, $quanpin = true, $daxie = false) { $s = preg_replace("/\s/is", "_", $s); $s = preg_replace("/(|\~|\`|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\-|\+|\=|\{|\}|\[|\]|\||\\|\:|\;|\"|\'|\<|\,|\>|\.|\?|\/)/is", "", $s); $i = 0; $py = ''; // ...
[ "public", "static", "function", "getpy", "(", "$", "s", ",", "$", "quanpin", "=", "true", ",", "$", "daxie", "=", "false", ")", "{", "$", "s", "=", "preg_replace", "(", "\"/\\s/is\"", ",", "\"_\"", ",", "$", "s", ")", ";", "$", "s", "=", "preg_re...
[getpy 汉字转拼音函数] @DateTime 2018-10-08 @param [type] $s [汉字字符串] @param boolean $quanpin [是否全拼] @param boolean $daxie [首字母是否大写] @return [string] [description]
[ "[", "getpy", "汉字转拼音函数", "]" ]
train
https://github.com/seeruo/framework/blob/689c6e95bc95fe2ae037e056d8228820dd08d7e9/src/Library/Pinyin.php#L530-L563
meccado/acl-admin-control-panel
src/Providers/AuthServiceProvider.php
AuthServiceProvider.boot
public function boot(GateContract $gate) { $this->registerPolicies($gate); if (\Schema::hasTable('permissions')) { // Dynamically register permissions with Laravel's Gate. foreach ($this->getPermissions() as $permission) { $gate->define($permission->name,...
php
public function boot(GateContract $gate) { $this->registerPolicies($gate); if (\Schema::hasTable('permissions')) { // Dynamically register permissions with Laravel's Gate. foreach ($this->getPermissions() as $permission) { $gate->define($permission->name,...
[ "public", "function", "boot", "(", "GateContract", "$", "gate", ")", "{", "$", "this", "->", "registerPolicies", "(", "$", "gate", ")", ";", "if", "(", "\\", "Schema", "::", "hasTable", "(", "'permissions'", ")", ")", "{", "// Dynamically register permission...
Register any application authentication / authorization services. @param \Illuminate\Contracts\Auth\Access\Gate $gate @return void
[ "Register", "any", "application", "authentication", "/", "authorization", "services", "." ]
train
https://github.com/meccado/acl-admin-control-panel/blob/50ac4c0dbf8bd49944ecad6a70708a70411b7378/src/Providers/AuthServiceProvider.php#L27-L39
xinix-technology/norm
src/Norm/Model.php
Model.setId
public function setId($givenId) { if (!isset($this->id)) { $this->id = $givenId; } return $this->id; }
php
public function setId($givenId) { if (!isset($this->id)) { $this->id = $givenId; } return $this->id; }
[ "public", "function", "setId", "(", "$", "givenId", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "id", ")", ")", "{", "$", "this", "->", "id", "=", "$", "givenId", ";", "}", "return", "$", "this", "->", "id", ";", "}" ]
Set id of model. @return int|string
[ "Set", "id", "of", "model", "." ]
train
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Model.php#L131-L137
xinix-technology/norm
src/Norm/Model.php
Model.get
public function get($key) { if ($key === '$id') { return $this->getId(); } $schema = $this->schema($key); if (isset($schema) and $schema->hasReader()) { return $schema->read($this); } return isset($this->attributes[$key]) ? $this->attributes[$...
php
public function get($key) { if ($key === '$id') { return $this->getId(); } $schema = $this->schema($key); if (isset($schema) and $schema->hasReader()) { return $schema->read($this); } return isset($this->attributes[$key]) ? $this->attributes[$...
[ "public", "function", "get", "(", "$", "key", ")", "{", "if", "(", "$", "key", "===", "'$id'", ")", "{", "return", "$", "this", "->", "getId", "(", ")", ";", "}", "$", "schema", "=", "$", "this", "->", "schema", "(", "$", "key", ")", ";", "if...
Get the attribute. @param string $key @return mixed
[ "Get", "the", "attribute", "." ]
train
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Model.php#L160-L171
xinix-technology/norm
src/Norm/Model.php
Model.dump
public function dump() { $attributes = array(); if ($this->id) { $attributes['$id'] = $this->id; } foreach ($this->attributes as $key => $value) { $schema = $this->schema($key); if (! empty($schema['transient'])) { continue; ...
php
public function dump() { $attributes = array(); if ($this->id) { $attributes['$id'] = $this->id; } foreach ($this->attributes as $key => $value) { $schema = $this->schema($key); if (! empty($schema['transient'])) { continue; ...
[ "public", "function", "dump", "(", ")", "{", "$", "attributes", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "id", ")", "{", "$", "attributes", "[", "'$id'", "]", "=", "$", "this", "->", "id", ";", "}", "foreach", "(", "$", "this"...
Dump attributes raw data. @method dump @return array
[ "Dump", "attributes", "raw", "data", "." ]
train
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Model.php#L180-L199
xinix-technology/norm
src/Norm/Model.php
Model.add
public function add($key, $value) { if (! isset($this->attributes[$key])) { $this->attributes[$key] = array(); } $this->attributes[$key][] = $value; return $this; }
php
public function add($key, $value) { if (! isset($this->attributes[$key])) { $this->attributes[$key] = array(); } $this->attributes[$key][] = $value; return $this; }
[ "public", "function", "add", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "attributes", "[", "$", "key", "]", ")", ")", "{", "$", "this", "->", "attributes", "[", "$", "key", "]", "=", "array", ...
Add an attributes data. @method add @param string $key @param mixed $value
[ "Add", "an", "attributes", "data", "." ]
train
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Model.php#L209-L218
xinix-technology/norm
src/Norm/Model.php
Model.set
public function set($key, $value = '') { if (is_array($key)) { foreach ($key as $k => $v) { if ($k !== '$id') { $this->set($k, $v); } } } elseif ($key === '$id') { throw new Exception('[Norm/Model] Restricting se...
php
public function set($key, $value = '') { if (is_array($key)) { foreach ($key as $k => $v) { if ($k !== '$id') { $this->set($k, $v); } } } elseif ($key === '$id') { throw new Exception('[Norm/Model] Restricting se...
[ "public", "function", "set", "(", "$", "key", ",", "$", "value", "=", "''", ")", "{", "if", "(", "is_array", "(", "$", "key", ")", ")", "{", "foreach", "(", "$", "key", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "$", "k", "!==", ...
Set attribute(s). @param string|array $key @param string $value Optional.
[ "Set", "attribute", "(", "s", ")", "." ]
train
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Model.php#L226-L241
xinix-technology/norm
src/Norm/Model.php
Model.clear
public function clear($key = null) { if (func_num_args() === 0) { $this->attributes = array(); } elseif ($key === '$id') { throw new Exception('[Norm/Model] Restricting clear for $id.'); } else { unset($this->attributes[$key]); } return $t...
php
public function clear($key = null) { if (func_num_args() === 0) { $this->attributes = array(); } elseif ($key === '$id') { throw new Exception('[Norm/Model] Restricting clear for $id.'); } else { unset($this->attributes[$key]); } return $t...
[ "public", "function", "clear", "(", "$", "key", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "0", ")", "{", "$", "this", "->", "attributes", "=", "array", "(", ")", ";", "}", "elseif", "(", "$", "key", "===", "'$id'", ")", ...
Clear attributes value. @method clear @param string $key @return \Norm\Model
[ "Clear", "attributes", "value", "." ]
train
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Model.php#L252-L263
xinix-technology/norm
src/Norm/Model.php
Model.sync
public function sync($attributes) { if (isset($attributes['$id'])) { $this->state = static::STATE_ATTACHED; $this->id = $attributes['$id']; } else { foreach ($this->schema() as $key => $field) { if ($field->has('default')) { $at...
php
public function sync($attributes) { if (isset($attributes['$id'])) { $this->state = static::STATE_ATTACHED; $this->id = $attributes['$id']; } else { foreach ($this->schema() as $key => $field) { if ($field->has('default')) { $at...
[ "public", "function", "sync", "(", "$", "attributes", ")", "{", "if", "(", "isset", "(", "$", "attributes", "[", "'$id'", "]", ")", ")", "{", "$", "this", "->", "state", "=", "static", "::", "STATE_ATTACHED", ";", "$", "this", "->", "id", "=", "$",...
Sync the existing attributes with new values. After update or insert, this method used to modify the existing attributes. @param array $attributes @return void
[ "Sync", "the", "existing", "attributes", "with", "new", "values", ".", "After", "update", "or", "insert", "this", "method", "used", "to", "modify", "the", "existing", "attributes", "." ]
train
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Model.php#L272-L289
xinix-technology/norm
src/Norm/Model.php
Model.prepare
public function prepare($key, $value, $schema = null) { if ($this->collection) { return $this->collection->prepare($key, $value, $schema); } else { return $value; } }
php
public function prepare($key, $value, $schema = null) { if ($this->collection) { return $this->collection->prepare($key, $value, $schema); } else { return $value; } }
[ "public", "function", "prepare", "(", "$", "key", ",", "$", "value", ",", "$", "schema", "=", "null", ")", "{", "if", "(", "$", "this", "->", "collection", ")", "{", "return", "$", "this", "->", "collection", "->", "prepare", "(", "$", "key", ",", ...
Prepare model to be sync'd. @method prepare @param string $key @param string $value @param mixed $schema @return [type]
[ "Prepare", "model", "to", "be", "sync", "d", "." ]
train
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Model.php#L302-L309
xinix-technology/norm
src/Norm/Model.php
Model.toArray
public function toArray($fetchType = Model::FETCH_ALL) { if ($fetchType === Model::FETCH_RAW) { return $this->attributes; } $attributes = array(); if (empty($this->attributes)) { $this->attributes = array(); } if ($fetchType === Model::FETCH...
php
public function toArray($fetchType = Model::FETCH_ALL) { if ($fetchType === Model::FETCH_RAW) { return $this->attributes; } $attributes = array(); if (empty($this->attributes)) { $this->attributes = array(); } if ($fetchType === Model::FETCH...
[ "public", "function", "toArray", "(", "$", "fetchType", "=", "Model", "::", "FETCH_ALL", ")", "{", "if", "(", "$", "fetchType", "===", "Model", "::", "FETCH_RAW", ")", "{", "return", "$", "this", "->", "attributes", ";", "}", "$", "attributes", "=", "a...
Get array structure of model @param mixed $fetchType @return array
[ "Get", "array", "structure", "of", "model" ]
train
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Model.php#L352-L384
xinix-technology/norm
src/Norm/Model.php
Model.jsonSerialize
public function jsonSerialize() { if (! Norm::options('include')) { return $this->toArray(); } $destination = array(); $source = $this->toArray(); $schema = $this->collection->schema(); foreach ($source as $key => $value) { if (isset($schem...
php
public function jsonSerialize() { if (! Norm::options('include')) { return $this->toArray(); } $destination = array(); $source = $this->toArray(); $schema = $this->collection->schema(); foreach ($source as $key => $value) { if (isset($schem...
[ "public", "function", "jsonSerialize", "(", ")", "{", "if", "(", "!", "Norm", "::", "options", "(", "'include'", ")", ")", "{", "return", "$", "this", "->", "toArray", "(", ")", ";", "}", "$", "destination", "=", "array", "(", ")", ";", "$", "sourc...
Implement the json serializer normalizing the data structures. @return array
[ "Implement", "the", "json", "serializer", "normalizing", "the", "data", "structures", "." ]
train
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Model.php#L448-L470
xinix-technology/norm
src/Norm/Model.php
Model.previous
public function previous($key = null) { if (is_null($key)) { return $this->oldAttributes; } return $this->oldAttributes[$key]; }
php
public function previous($key = null) { if (is_null($key)) { return $this->oldAttributes; } return $this->oldAttributes[$key]; }
[ "public", "function", "previous", "(", "$", "key", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "key", ")", ")", "{", "return", "$", "this", "->", "oldAttributes", ";", "}", "return", "$", "this", "->", "oldAttributes", "[", "$", "key", "...
Get original attributes @method previous @param string $key @return mixed
[ "Get", "original", "attributes" ]
train
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Model.php#L493-L500
xinix-technology/norm
src/Norm/Model.php
Model.schema
public function schema($key = null) { if (func_num_args() === 0) { return $this->collection->schema(); } else { return $this->collection->schema($key); } }
php
public function schema($key = null) { if (func_num_args() === 0) { return $this->collection->schema(); } else { return $this->collection->schema($key); } }
[ "public", "function", "schema", "(", "$", "key", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "0", ")", "{", "return", "$", "this", "->", "collection", "->", "schema", "(", ")", ";", "}", "else", "{", "return", "$", "this", ...
Get schema configuration. @method schema @param string $key @return mixed
[ "Get", "schema", "configuration", "." ]
train
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Model.php#L535-L542
xinix-technology/norm
src/Norm/Model.php
Model.schemaByIndex
public function schemaByIndex($index) { $schema = array(); foreach ($this->collection->schema() as $value) { $schema[] = $value; } return (empty($schema[$index])) ? null : $schema[$index]; }
php
public function schemaByIndex($index) { $schema = array(); foreach ($this->collection->schema() as $value) { $schema[] = $value; } return (empty($schema[$index])) ? null : $schema[$index]; }
[ "public", "function", "schemaByIndex", "(", "$", "index", ")", "{", "$", "schema", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "collection", "->", "schema", "(", ")", "as", "$", "value", ")", "{", "$", "schema", "[", "]", "=", ...
Get schema configuration by offset name. @method schemaByIndex @param string $index @return mixed
[ "Get", "schema", "configuration", "by", "offset", "name", "." ]
train
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Model.php#L553-L562
xinix-technology/norm
src/Norm/Model.php
Model.format
public function format($field = null, $format = null) { $numArgs = func_num_args(); if ($numArgs === 0) { $formatter = $this->collection->option('format'); if (is_null($formatter)) { $schema = $this->schemaByIndex(0); if (!is_null($schema)) {...
php
public function format($field = null, $format = null) { $numArgs = func_num_args(); if ($numArgs === 0) { $formatter = $this->collection->option('format'); if (is_null($formatter)) { $schema = $this->schemaByIndex(0); if (!is_null($schema)) {...
[ "public", "function", "format", "(", "$", "field", "=", "null", ",", "$", "format", "=", "null", ")", "{", "$", "numArgs", "=", "func_num_args", "(", ")", ";", "if", "(", "$", "numArgs", "===", "0", ")", "{", "$", "formatter", "=", "$", "this", "...
Format the model to HTML file. Bind it's attributes to view. @method format @param string $field @param string $format @return mixed
[ "Format", "the", "model", "to", "HTML", "file", ".", "Bind", "it", "s", "attributes", "to", "view", "." ]
train
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Model.php#L574-L615
anime-db/app-bundle
src/Command/ClearMediaTempCommand.php
ClearMediaTempCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $start = microtime(true); if (file_exists($dir = $this->getContainer()->getParameter('kernel.root_dir').'/../web/media/tmp/')) { $fs = new Filesystem(); $finder = new Finder(); $finder-...
php
protected function execute(InputInterface $input, OutputInterface $output) { $start = microtime(true); if (file_exists($dir = $this->getContainer()->getParameter('kernel.root_dir').'/../web/media/tmp/')) { $fs = new Filesystem(); $finder = new Finder(); $finder-...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "start", "=", "microtime", "(", "true", ")", ";", "if", "(", "file_exists", "(", "$", "dir", "=", "$", "this", "->", "getContai...
@param InputInterface $input @param OutputInterface $output @return bool
[ "@param", "InputInterface", "$input", "@param", "OutputInterface", "$output" ]
train
https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Command/ClearMediaTempCommand.php#L34-L50
phpmob/changmin
src/PhpMob/MediaBundle/Twig/ImagineExtension.php
ImagineExtension.filter
public function filter($path, $sizing, $inset = true, $default = null) { if ($path instanceof ImageInterface) { $path = $path->getPath(); } if (empty($path) && $default) { return $default; } if (empty($path)) { return $this->defaultImage;...
php
public function filter($path, $sizing, $inset = true, $default = null) { if ($path instanceof ImageInterface) { $path = $path->getPath(); } if (empty($path) && $default) { return $default; } if (empty($path)) { return $this->defaultImage;...
[ "public", "function", "filter", "(", "$", "path", ",", "$", "sizing", ",", "$", "inset", "=", "true", ",", "$", "default", "=", "null", ")", "{", "if", "(", "$", "path", "instanceof", "ImageInterface", ")", "{", "$", "path", "=", "$", "path", "->",...
@param string|ImageInterface $path @param $sizing @param bool $inset @param string $default = null @return string
[ "@param", "string|ImageInterface", "$path", "@param", "$sizing", "@param", "bool", "$inset", "@param", "string", "$default", "=", "null" ]
train
https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/MediaBundle/Twig/ImagineExtension.php#L64-L86
yuncms/framework
src/admin/widgets/Inspinia.php
Inspinia.endToolbar
public function endToolbar() { $this->_setBeginning(false); $toolbar = trim(ob_get_clean()); if (is_string($this->toolbar)) { $this->toolbar = [$this->toolbar]; } $this->toolbar[] = [ 'body' => $toolbar, 'options' => $this->_toolbarLastOpti...
php
public function endToolbar() { $this->_setBeginning(false); $toolbar = trim(ob_get_clean()); if (is_string($this->toolbar)) { $this->toolbar = [$this->toolbar]; } $this->toolbar[] = [ 'body' => $toolbar, 'options' => $this->_toolbarLastOpti...
[ "public", "function", "endToolbar", "(", ")", "{", "$", "this", "->", "_setBeginning", "(", "false", ")", ";", "$", "toolbar", "=", "trim", "(", "ob_get_clean", "(", ")", ")", ";", "if", "(", "is_string", "(", "$", "this", "->", "toolbar", ")", ")", ...
End toolbar @throws Exception
[ "End", "toolbar" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/widgets/Inspinia.php#L140-L152
yuncms/framework
src/admin/widgets/Inspinia.php
Inspinia.endBodyToolbar
public function endBodyToolbar() { $this->_setBeginning(false); $toolbar = trim(ob_get_clean()); if (is_string($this->bodyToolbar)) { $this->bodyToolbar = [$this->bodyToolbar]; } $this->bodyToolbar[] = [ 'body' => $toolbar, 'options' => $th...
php
public function endBodyToolbar() { $this->_setBeginning(false); $toolbar = trim(ob_get_clean()); if (is_string($this->bodyToolbar)) { $this->bodyToolbar = [$this->bodyToolbar]; } $this->bodyToolbar[] = [ 'body' => $toolbar, 'options' => $th...
[ "public", "function", "endBodyToolbar", "(", ")", "{", "$", "this", "->", "_setBeginning", "(", "false", ")", ";", "$", "toolbar", "=", "trim", "(", "ob_get_clean", "(", ")", ")", ";", "if", "(", "is_string", "(", "$", "this", "->", "bodyToolbar", ")",...
End Body Toolbar @throws Exception
[ "End", "Body", "Toolbar" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/widgets/Inspinia.php#L196-L208
yuncms/framework
src/admin/widgets/Inspinia.php
Inspinia.beginFooter
public function beginFooter($options = []) { $this->_setBeginning(true); $this->footerOptions = ArrayHelper::merge($this->footerOptions, $options); ob_start(); }
php
public function beginFooter($options = []) { $this->_setBeginning(true); $this->footerOptions = ArrayHelper::merge($this->footerOptions, $options); ob_start(); }
[ "public", "function", "beginFooter", "(", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "_setBeginning", "(", "true", ")", ";", "$", "this", "->", "footerOptions", "=", "ArrayHelper", "::", "merge", "(", "$", "this", "->", "footerOptions", ...
Begin Footer [[beginFooter]] your data [[endFooter]] @param array $options @throws Exception
[ "Begin", "Footer", "[[", "beginFooter", "]]", "your", "data", "[[", "endFooter", "]]" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/widgets/Inspinia.php#L218-L223
yuncms/framework
src/admin/widgets/Inspinia.php
Inspinia._getToolbar
private function _getToolbar() { if ($this->toolbar !== null) { Html::addCssClass($this->toolbarOptions, 'widget-toolbar'); $toolbars = is_string($this->toolbar) ? [$this->toolbar] : $this->toolbar; foreach ($toolbars as $toolbar) { if (is_array($toolbar))...
php
private function _getToolbar() { if ($this->toolbar !== null) { Html::addCssClass($this->toolbarOptions, 'widget-toolbar'); $toolbars = is_string($this->toolbar) ? [$this->toolbar] : $this->toolbar; foreach ($toolbars as $toolbar) { if (is_array($toolbar))...
[ "private", "function", "_getToolbar", "(", ")", "{", "if", "(", "$", "this", "->", "toolbar", "!==", "null", ")", "{", "Html", "::", "addCssClass", "(", "$", "this", "->", "toolbarOptions", ",", "'widget-toolbar'", ")", ";", "$", "toolbars", "=", "is_str...
Get toolbar
[ "Get", "toolbar" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/widgets/Inspinia.php#L238-L254
yuncms/framework
src/admin/widgets/Inspinia.php
Inspinia._getBodyToolbar
private function _getBodyToolbar() { if ($this->bodyToolbar !== null) { Html::addCssClass($this->bodyToolbarOptions, 'widget-body-toolbar'); $toolbars = is_string($this->bodyToolbar) ? [$this->bodyToolbar] : $this->bodyToolbar; foreach ($toolbars as $toolbar) { ...
php
private function _getBodyToolbar() { if ($this->bodyToolbar !== null) { Html::addCssClass($this->bodyToolbarOptions, 'widget-body-toolbar'); $toolbars = is_string($this->bodyToolbar) ? [$this->bodyToolbar] : $this->bodyToolbar; foreach ($toolbars as $toolbar) { ...
[ "private", "function", "_getBodyToolbar", "(", ")", "{", "if", "(", "$", "this", "->", "bodyToolbar", "!==", "null", ")", "{", "Html", "::", "addCssClass", "(", "$", "this", "->", "bodyToolbarOptions", ",", "'widget-body-toolbar'", ")", ";", "$", "toolbars",...
Get body toolbar
[ "Get", "body", "toolbar" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/widgets/Inspinia.php#L259-L275
yuncms/framework
src/admin/widgets/Inspinia.php
Inspinia._getFooter
private function _getFooter() { if ($this->footer !== null) { Html::addCssClass($this->footerOptions, 'ibox-footer'); $footers = is_string($this->footer) ? [$this->footer] : $this->footer; foreach ($footers as $footer) { if (is_array($footer)) { ...
php
private function _getFooter() { if ($this->footer !== null) { Html::addCssClass($this->footerOptions, 'ibox-footer'); $footers = is_string($this->footer) ? [$this->footer] : $this->footer; foreach ($footers as $footer) { if (is_array($footer)) { ...
[ "private", "function", "_getFooter", "(", ")", "{", "if", "(", "$", "this", "->", "footer", "!==", "null", ")", "{", "Html", "::", "addCssClass", "(", "$", "this", "->", "footerOptions", ",", "'ibox-footer'", ")", ";", "$", "footers", "=", "is_string", ...
Get footer
[ "Get", "footer" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/widgets/Inspinia.php#L280-L295
yuncms/framework
src/admin/widgets/Inspinia.php
Inspinia._setLoad
private function _setLoad() { if ($this->load !== null && !array_key_exists('data-widget-load', $this->options)) { $this->options['data-widget-load'] = Url::to($this->load); } }
php
private function _setLoad() { if ($this->load !== null && !array_key_exists('data-widget-load', $this->options)) { $this->options['data-widget-load'] = Url::to($this->load); } }
[ "private", "function", "_setLoad", "(", ")", "{", "if", "(", "$", "this", "->", "load", "!==", "null", "&&", "!", "array_key_exists", "(", "'data-widget-load'", ",", "$", "this", "->", "options", ")", ")", "{", "$", "this", "->", "options", "[", "'data...
Set load
[ "Set", "load" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/widgets/Inspinia.php#L310-L315
yuncms/framework
src/admin/widgets/Inspinia.php
Inspinia._setBeginning
private function _setBeginning($bool) { if (!is_bool($bool)) { throw new Exception('$bool in not boolean'); } if ($this->_beginning === $bool) { throw new Exception("Error begin or end."); } $this->_beginning = $bool; }
php
private function _setBeginning($bool) { if (!is_bool($bool)) { throw new Exception('$bool in not boolean'); } if ($this->_beginning === $bool) { throw new Exception("Error begin or end."); } $this->_beginning = $bool; }
[ "private", "function", "_setBeginning", "(", "$", "bool", ")", "{", "if", "(", "!", "is_bool", "(", "$", "bool", ")", ")", "{", "throw", "new", "Exception", "(", "'$bool in not boolean'", ")", ";", "}", "if", "(", "$", "this", "->", "_beginning", "==="...
设置开始 @param $bool @throws Exception
[ "设置开始" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/widgets/Inspinia.php#L338-L347
activecollab/configfile
src/ConfigFile.php
ConfigFile.fileWithConstantsToArray
private function fileWithConstantsToArray($file_path) { $result = []; $lines = file($file_path); if (is_array($lines)) { foreach ($lines as $line) { $line = trim(trim($line, '<?php')); if ($this->strStartsWith($line, 'const ')) { ...
php
private function fileWithConstantsToArray($file_path) { $result = []; $lines = file($file_path); if (is_array($lines)) { foreach ($lines as $line) { $line = trim(trim($line, '<?php')); if ($this->strStartsWith($line, 'const ')) { ...
[ "private", "function", "fileWithConstantsToArray", "(", "$", "file_path", ")", "{", "$", "result", "=", "[", "]", ";", "$", "lines", "=", "file", "(", "$", "file_path", ")", ";", "if", "(", "is_array", "(", "$", "lines", ")", ")", "{", "foreach", "("...
Get constants from the given PHP file (these constants need to be defined with const keyword) @param string $file_path @return array
[ "Get", "constants", "from", "the", "given", "PHP", "file", "(", "these", "constants", "need", "to", "be", "defined", "with", "const", "keyword", ")" ]
train
https://github.com/activecollab/configfile/blob/fe0ae7da3466f26e49e54b6dd3508c85421c0bdf/src/ConfigFile.php#L78-L105
activecollab/configfile
src/ConfigFile.php
ConfigFile.getFromConst
private function getFromConst($line) { $eq_pos = strpos($line, '='); $semicolon_pos = strrpos($line, ';'); $constant_name = trim(substr($line, 6, $eq_pos - 6)); $value = trim(substr($line, $eq_pos + 1, $semicolon_pos - $eq_pos - 1)); return [$constant_name, $this->getNative...
php
private function getFromConst($line) { $eq_pos = strpos($line, '='); $semicolon_pos = strrpos($line, ';'); $constant_name = trim(substr($line, 6, $eq_pos - 6)); $value = trim(substr($line, $eq_pos + 1, $semicolon_pos - $eq_pos - 1)); return [$constant_name, $this->getNative...
[ "private", "function", "getFromConst", "(", "$", "line", ")", "{", "$", "eq_pos", "=", "strpos", "(", "$", "line", ",", "'='", ")", ";", "$", "semicolon_pos", "=", "strrpos", "(", "$", "line", ",", "';'", ")", ";", "$", "constant_name", "=", "trim", ...
Return single option from const DB_XYZ defition line @param string $line @return string
[ "Return", "single", "option", "from", "const", "DB_XYZ", "defition", "line" ]
train
https://github.com/activecollab/configfile/blob/fe0ae7da3466f26e49e54b6dd3508c85421c0bdf/src/ConfigFile.php#L113-L122
activecollab/configfile
src/ConfigFile.php
ConfigFile.getFromDefine
function getFromDefine($line) { $line = "<?php $line"; // Trick the parser that we are in PHP file, instead of analyzing a single line $state = 0; $key = $value = ''; $tokens = token_get_all($line); $token = reset($tokens); while ($token) { if (is_array...
php
function getFromDefine($line) { $line = "<?php $line"; // Trick the parser that we are in PHP file, instead of analyzing a single line $state = 0; $key = $value = ''; $tokens = token_get_all($line); $token = reset($tokens); while ($token) { if (is_array...
[ "function", "getFromDefine", "(", "$", "line", ")", "{", "$", "line", "=", "\"<?php $line\"", ";", "// Trick the parser that we are in PHP file, instead of analyzing a single line", "$", "state", "=", "0", ";", "$", "key", "=", "$", "value", "=", "''", ";", "$", ...
Return single option from define('DB_XYZ', value) defition line Adopted from: http://stackoverflow.com/questions/645862/regex-to-parse-define-contents-possible @param string $line @return array
[ "Return", "single", "option", "from", "define", "(", "DB_XYZ", "value", ")", "defition", "line" ]
train
https://github.com/activecollab/configfile/blob/fe0ae7da3466f26e49e54b6dd3508c85421c0bdf/src/ConfigFile.php#L134-L181
activecollab/configfile
src/ConfigFile.php
ConfigFile.getOptionNameFromDefinition
public function getOptionNameFromDefinition($constant_name) { if ($this->strStartsWith($constant_name, "'") && $this->strEndsWith($constant_name, "'")) { return trim(trim($constant_name, "'")); // single quote } else { if ($this->strStartsWith($constant_name, '"') && $this->s...
php
public function getOptionNameFromDefinition($constant_name) { if ($this->strStartsWith($constant_name, "'") && $this->strEndsWith($constant_name, "'")) { return trim(trim($constant_name, "'")); // single quote } else { if ($this->strStartsWith($constant_name, '"') && $this->s...
[ "public", "function", "getOptionNameFromDefinition", "(", "$", "constant_name", ")", "{", "if", "(", "$", "this", "->", "strStartsWith", "(", "$", "constant_name", ",", "\"'\"", ")", "&&", "$", "this", "->", "strEndsWith", "(", "$", "constant_name", ",", "\"...
Return config option name from defintiion string @param string $constant_name @return string
[ "Return", "config", "option", "name", "from", "defintiion", "string" ]
train
https://github.com/activecollab/configfile/blob/fe0ae7da3466f26e49e54b6dd3508c85421c0bdf/src/ConfigFile.php#L189-L200
activecollab/configfile
src/ConfigFile.php
ConfigFile.getNativeValueFromDefinition
private function getNativeValueFromDefinition($value) { if ($this->strStartsWith($value, "'") && $this->strEndsWith($value, "'")) { $value = trim(trim($value, "'")); // single quote } else { if ($this->strStartsWith($value, '"') && $this->strEndsWith($value, '"')) { ...
php
private function getNativeValueFromDefinition($value) { if ($this->strStartsWith($value, "'") && $this->strEndsWith($value, "'")) { $value = trim(trim($value, "'")); // single quote } else { if ($this->strStartsWith($value, '"') && $this->strEndsWith($value, '"')) { ...
[ "private", "function", "getNativeValueFromDefinition", "(", "$", "value", ")", "{", "if", "(", "$", "this", "->", "strStartsWith", "(", "$", "value", ",", "\"'\"", ")", "&&", "$", "this", "->", "strEndsWith", "(", "$", "value", ",", "\"'\"", ")", ")", ...
Cast declared value to internal type @param string $value @return mixed
[ "Cast", "declared", "value", "to", "internal", "type" ]
train
https://github.com/activecollab/configfile/blob/fe0ae7da3466f26e49e54b6dd3508c85421c0bdf/src/ConfigFile.php#L208-L235
activecollab/configfile
src/ConfigFile.php
ConfigFile.isConstantToken
private function isConstantToken($token) { return $token == T_CONSTANT_ENCAPSED_STRING || $token == T_STRING || $token == T_LNUMBER || $token == T_DNUMBER; }
php
private function isConstantToken($token) { return $token == T_CONSTANT_ENCAPSED_STRING || $token == T_STRING || $token == T_LNUMBER || $token == T_DNUMBER; }
[ "private", "function", "isConstantToken", "(", "$", "token", ")", "{", "return", "$", "token", "==", "T_CONSTANT_ENCAPSED_STRING", "||", "$", "token", "==", "T_STRING", "||", "$", "token", "==", "T_LNUMBER", "||", "$", "token", "==", "T_DNUMBER", ";", "}" ]
Return true if $token is constant token @param string $token @return bool
[ "Return", "true", "if", "$token", "is", "constant", "token" ]
train
https://github.com/activecollab/configfile/blob/fe0ae7da3466f26e49e54b6dd3508c85421c0bdf/src/ConfigFile.php#L243-L246
activecollab/configfile
src/ConfigFile.php
ConfigFile.strStartsWith
private function strStartsWith($string, $niddle) { return mb_strtolower(substr($string, 0, mb_strlen($niddle))) == mb_strtolower($niddle); }
php
private function strStartsWith($string, $niddle) { return mb_strtolower(substr($string, 0, mb_strlen($niddle))) == mb_strtolower($niddle); }
[ "private", "function", "strStartsWith", "(", "$", "string", ",", "$", "niddle", ")", "{", "return", "mb_strtolower", "(", "substr", "(", "$", "string", ",", "0", ",", "mb_strlen", "(", "$", "niddle", ")", ")", ")", "==", "mb_strtolower", "(", "$", "nid...
Case insensitive string begins with @param string $string @param string $niddle @return boolean
[ "Case", "insensitive", "string", "begins", "with" ]
train
https://github.com/activecollab/configfile/blob/fe0ae7da3466f26e49e54b6dd3508c85421c0bdf/src/ConfigFile.php#L266-L269
activecollab/configfile
src/ConfigFile.php
ConfigFile.strEndsWith
private function strEndsWith($string, $niddle) { return mb_substr($string, mb_strlen($string) - mb_strlen($niddle), mb_strlen($niddle)) == $niddle; }
php
private function strEndsWith($string, $niddle) { return mb_substr($string, mb_strlen($string) - mb_strlen($niddle), mb_strlen($niddle)) == $niddle; }
[ "private", "function", "strEndsWith", "(", "$", "string", ",", "$", "niddle", ")", "{", "return", "mb_substr", "(", "$", "string", ",", "mb_strlen", "(", "$", "string", ")", "-", "mb_strlen", "(", "$", "niddle", ")", ",", "mb_strlen", "(", "$", "niddle...
Case insensitive string ends with @param string $string @param string $niddle @return boolean
[ "Case", "insensitive", "string", "ends", "with" ]
train
https://github.com/activecollab/configfile/blob/fe0ae7da3466f26e49e54b6dd3508c85421c0bdf/src/ConfigFile.php#L290-L293
2amigos/yiifoundation
helpers/Typo.php
Typo.vCard
public static function vCard($name, $address = '', $locality = '', $state = '', $zip = '', $email = '') { $items = array(); $items[] = \CHtml::tag('li', array('class' => 'fn'), $name); $items[] = \CHtml::tag('li', array('class' => 'street-address'), $address); $items[] = \CHtml::ta...
php
public static function vCard($name, $address = '', $locality = '', $state = '', $zip = '', $email = '') { $items = array(); $items[] = \CHtml::tag('li', array('class' => 'fn'), $name); $items[] = \CHtml::tag('li', array('class' => 'street-address'), $address); $items[] = \CHtml::ta...
[ "public", "static", "function", "vCard", "(", "$", "name", ",", "$", "address", "=", "''", ",", "$", "locality", "=", "''", ",", "$", "state", "=", "''", ",", "$", "zip", "=", "''", ",", "$", "email", "=", "''", ")", "{", "$", "items", "=", "...
Renders a handy microformat-friendly list for addresses @param string $name @param string $address @param string $locality @param string $state @param string $zip @param string $email @return string the generated vcard
[ "Renders", "a", "handy", "microformat", "-", "friendly", "list", "for", "addresses" ]
train
https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/Typo.php#L64-L77
2amigos/yiifoundation
helpers/Typo.php
Typo.inlineList
public static function inlineList($items, $htmlOptions = array()) { $listItems = array(); Html::addCssClass($htmlOptions, 'inline-list'); foreach ($items as $item) { $listItems[] = \CHtml::tag('li', $htmlOptions, $item); } if (!empty($listItems)) { re...
php
public static function inlineList($items, $htmlOptions = array()) { $listItems = array(); Html::addCssClass($htmlOptions, 'inline-list'); foreach ($items as $item) { $listItems[] = \CHtml::tag('li', $htmlOptions, $item); } if (!empty($listItems)) { re...
[ "public", "static", "function", "inlineList", "(", "$", "items", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "$", "listItems", "=", "array", "(", ")", ";", "Html", "::", "addCssClass", "(", "$", "htmlOptions", ",", "'inline-list'", ")", ...
Renders and inline list @param array $items the items to render @param array $htmlOptions the HTML attributes @return string the generated list
[ "Renders", "and", "inline", "list" ]
train
https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/Typo.php#L85-L96
2amigos/yiifoundation
helpers/Typo.php
Typo.label
public static function label($text, $htmlOptions = array()) { ArrayHelper::addValue('class', 'label', $htmlOptions); return \CHtml::tag('span', $htmlOptions, $text); }
php
public static function label($text, $htmlOptions = array()) { ArrayHelper::addValue('class', 'label', $htmlOptions); return \CHtml::tag('span', $htmlOptions, $text); }
[ "public", "static", "function", "label", "(", "$", "text", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "ArrayHelper", "::", "addValue", "(", "'class'", ",", "'label'", ",", "$", "htmlOptions", ")", ";", "return", "\\", "CHtml", "::", "ta...
Renders a Foundation label @param string $text the text to render within the label @param array $htmlOptions the HTML attributes @return string the generated label
[ "Renders", "a", "Foundation", "label" ]
train
https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/Typo.php#L104-L108
Chill-project/Main
Entity/PostalCode.php
PostalCode.setCountry
public function setCountry(\Chill\MainBundle\Entity\Country $country = null) { $this->country = $country; return $this; }
php
public function setCountry(\Chill\MainBundle\Entity\Country $country = null) { $this->country = $country; return $this; }
[ "public", "function", "setCountry", "(", "\\", "Chill", "\\", "MainBundle", "\\", "Entity", "\\", "Country", "$", "country", "=", "null", ")", "{", "$", "this", "->", "country", "=", "$", "country", ";", "return", "$", "this", ";", "}" ]
Set country @param \Chill\MainBundle\Entity\Country $country @return PostalCode
[ "Set", "country" ]
train
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Entity/PostalCode.php#L96-L101
TheBigBrainsCompany/TbbcRestUtilBundle
Error/Factory/FormErrorFactory.php
FormErrorFactory.createError
public function createError(\Exception $exception, ExceptionMappingInterface $mapping) { if (!$this->supportsException($exception)) { return null; } $errorMessage = $mapping->getErrorMessage(); if (empty($errorMessage)) { $errorMessage = $exception->getMessag...
php
public function createError(\Exception $exception, ExceptionMappingInterface $mapping) { if (!$this->supportsException($exception)) { return null; } $errorMessage = $mapping->getErrorMessage(); if (empty($errorMessage)) { $errorMessage = $exception->getMessag...
[ "public", "function", "createError", "(", "\\", "Exception", "$", "exception", ",", "ExceptionMappingInterface", "$", "mapping", ")", "{", "if", "(", "!", "$", "this", "->", "supportsException", "(", "$", "exception", ")", ")", "{", "return", "null", ";", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/TheBigBrainsCompany/TbbcRestUtilBundle/blob/48c0598a94a4f6b3883d349d8f134138e8bc6d7c/Error/Factory/FormErrorFactory.php#L33-L52
VincentChalnot/SidusAdminBundle
Request/ParamConverter/AdminEntityParamConverter.php
AdminEntityParamConverter.apply
public function apply(Request $request, ParamConverter $configuration): bool { if (!$request->attributes->has('_admin')) { throw new \UnexpectedValueException('Missing _admin request attribute'); } $admin = $request->attributes->get('_admin'); if (!$admin instanceof Admin...
php
public function apply(Request $request, ParamConverter $configuration): bool { if (!$request->attributes->has('_admin')) { throw new \UnexpectedValueException('Missing _admin request attribute'); } $admin = $request->attributes->get('_admin'); if (!$admin instanceof Admin...
[ "public", "function", "apply", "(", "Request", "$", "request", ",", "ParamConverter", "$", "configuration", ")", ":", "bool", "{", "if", "(", "!", "$", "request", "->", "attributes", "->", "has", "(", "'_admin'", ")", ")", "{", "throw", "new", "\\", "U...
{@inheritdoc}
[ "{" ]
train
https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Request/ParamConverter/AdminEntityParamConverter.php#L40-L67
yuncms/framework
src/user/models/AvatarForm.php
AvatarForm.save
public function save() { if ($this->validate()) { $user = $this->getUser(); if(AvatarHelper::save($user, $this->getOriginalImage())){ return true; } else { return false; } } return false; }
php
public function save() { if ($this->validate()) { $user = $this->getUser(); if(AvatarHelper::save($user, $this->getOriginalImage())){ return true; } else { return false; } } return false; }
[ "public", "function", "save", "(", ")", "{", "if", "(", "$", "this", "->", "validate", "(", ")", ")", "{", "$", "user", "=", "$", "this", "->", "getUser", "(", ")", ";", "if", "(", "AvatarHelper", "::", "save", "(", "$", "user", ",", "$", "this...
保存头像 @return boolean @throws \yii\base\ErrorException @throws \yii\base\Exception
[ "保存头像" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/models/AvatarForm.php#L79-L90
yuncms/framework
src/user/models/AvatarForm.php
AvatarForm.getOriginalImage
public function getOriginalImage() { if ($this->_originalImage == null) { $this->_originalImage = Yii::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . $this->getUser()->id . '_avatar.jpg'; } return $this->_originalImage; }
php
public function getOriginalImage() { if ($this->_originalImage == null) { $this->_originalImage = Yii::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . $this->getUser()->id . '_avatar.jpg'; } return $this->_originalImage; }
[ "public", "function", "getOriginalImage", "(", ")", "{", "if", "(", "$", "this", "->", "_originalImage", "==", "null", ")", "{", "$", "this", "->", "_originalImage", "=", "Yii", "::", "$", "app", "->", "getPath", "(", ")", "->", "getTempPath", "(", ")"...
获取原图路径 @return string @throws \yii\base\Exception
[ "获取原图路径" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/models/AvatarForm.php#L108-L114
yuncms/framework
src/user/models/AvatarForm.php
AvatarForm.afterValidate
public function afterValidate() { //保存原图 Image::crop($this->file->tempName, $this->width, $this->height, [$this->x, $this->y])->save($this->getOriginalImage(), ['quality' => 100]); parent::afterValidate(); }
php
public function afterValidate() { //保存原图 Image::crop($this->file->tempName, $this->width, $this->height, [$this->x, $this->y])->save($this->getOriginalImage(), ['quality' => 100]); parent::afterValidate(); }
[ "public", "function", "afterValidate", "(", ")", "{", "//保存原图", "Image", "::", "crop", "(", "$", "this", "->", "file", "->", "tempName", ",", "$", "this", "->", "width", ",", "$", "this", "->", "height", ",", "[", "$", "this", "->", "x", ",", "$", ...
验证后保存原图 @throws \yii\base\Exception
[ "验证后保存原图" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/models/AvatarForm.php#L130-L135
alanpich/slender
src/Core/Autoloader/PSR4ClassLoader.php
PSR4ClassLoader.addNamespace
public function addNamespace($prefix, $baseDir, $prepend = false) { // normalize namespace prefix $prefix = trim($prefix, '\\') . '\\'; // normalize the base directory with a trailing separator $baseDir = rtrim($baseDir, '/') . DIRECTORY_SEPARATOR; $baseDir = rtrim($baseDir,...
php
public function addNamespace($prefix, $baseDir, $prepend = false) { // normalize namespace prefix $prefix = trim($prefix, '\\') . '\\'; // normalize the base directory with a trailing separator $baseDir = rtrim($baseDir, '/') . DIRECTORY_SEPARATOR; $baseDir = rtrim($baseDir,...
[ "public", "function", "addNamespace", "(", "$", "prefix", ",", "$", "baseDir", ",", "$", "prepend", "=", "false", ")", "{", "// normalize namespace prefix", "$", "prefix", "=", "trim", "(", "$", "prefix", ",", "'\\\\'", ")", ".", "'\\\\'", ";", "// normali...
Adds a base directory for a namespace prefix. @param string $prefix The namespace prefix. @param string $baseDir A base directory for class files in the namespace. @param bool $prepend If true, prepend the base directory to the stack instead of appending it; this causes it to be searched first rather than last. ...
[ "Adds", "a", "base", "directory", "for", "a", "namespace", "prefix", "." ]
train
https://github.com/alanpich/slender/blob/247f5c08af20cda95b116eb5d9f6f623d61e8a8a/src/Core/Autoloader/PSR4ClassLoader.php#L110-L130
austinkregel/Warden
src/Warden/Http/Controllers/ApiController.php
ApiController.getAllModels
public function getAllModels($model_name, Request $request) { $this->model_name = substr($model_name, 0, -1); return $this->getSomeModels($request, $request, 500); }
php
public function getAllModels($model_name, Request $request) { $this->model_name = substr($model_name, 0, -1); return $this->getSomeModels($request, $request, 500); }
[ "public", "function", "getAllModels", "(", "$", "model_name", ",", "Request", "$", "request", ")", "{", "$", "this", "->", "model_name", "=", "substr", "(", "$", "model_name", ",", "0", ",", "-", "1", ")", ";", "return", "$", "this", "->", "getSomeMode...
@param $model_name @param Request $request @return \Illuminate\Http\JsonResponse
[ "@param", "$model_name", "@param", "Request", "$request" ]
train
https://github.com/austinkregel/Warden/blob/6f5a98bd79a488f0f300f4851061ac6f7d19f8a3/src/Warden/Http/Controllers/ApiController.php#L28-L33
austinkregel/Warden
src/Warden/Http/Controllers/ApiController.php
ApiController.getSomeModels
public function getSomeModels($model_name, Request $request, $paginate = 100) { $this->checkParams(func_get_args()); $model = $this->findModel($model_name); $status = $request->ajax() ? 202 : 200; return response()->json($model->paginate($paginate), $status); }
php
public function getSomeModels($model_name, Request $request, $paginate = 100) { $this->checkParams(func_get_args()); $model = $this->findModel($model_name); $status = $request->ajax() ? 202 : 200; return response()->json($model->paginate($paginate), $status); }
[ "public", "function", "getSomeModels", "(", "$", "model_name", ",", "Request", "$", "request", ",", "$", "paginate", "=", "100", ")", "{", "$", "this", "->", "checkParams", "(", "func_get_args", "(", ")", ")", ";", "$", "model", "=", "$", "this", "->",...
@param $model_name @param Request $request @param int $paginate @return \Illuminate\Http\JsonResponse
[ "@param", "$model_name", "@param", "Request", "$request", "@param", "int", "$paginate" ]
train
https://github.com/austinkregel/Warden/blob/6f5a98bd79a488f0f300f4851061ac6f7d19f8a3/src/Warden/Http/Controllers/ApiController.php#L42-L49
austinkregel/Warden
src/Warden/Http/Controllers/ApiController.php
ApiController.findModel
public function findModel($model_name, $id = null) { $model = config('kregel.warden.models.'.$model_name.'.model'); if (empty($id) | !is_numeric($id)) { return new $model(); } return $model::find($id); }
php
public function findModel($model_name, $id = null) { $model = config('kregel.warden.models.'.$model_name.'.model'); if (empty($id) | !is_numeric($id)) { return new $model(); } return $model::find($id); }
[ "public", "function", "findModel", "(", "$", "model_name", ",", "$", "id", "=", "null", ")", "{", "$", "model", "=", "config", "(", "'kregel.warden.models.'", ".", "$", "model_name", ".", "'.model'", ")", ";", "if", "(", "empty", "(", "$", "id", ")", ...
@param $model_name @param null $id @return Model
[ "@param", "$model_name", "@param", "null", "$id" ]
train
https://github.com/austinkregel/Warden/blob/6f5a98bd79a488f0f300f4851061ac6f7d19f8a3/src/Warden/Http/Controllers/ApiController.php#L57-L65
austinkregel/Warden
src/Warden/Http/Controllers/ApiController.php
ApiController.postModel
public function postModel($model_name, Request $request) { $this->checkParams(func_get_args()); $model = $this->findModel($model_name); if (empty($model)) { return $this->emptyModel($request); } // Need a way to validate the input for the model. If we then can not...
php
public function postModel($model_name, Request $request) { $this->checkParams(func_get_args()); $model = $this->findModel($model_name); if (empty($model)) { return $this->emptyModel($request); } // Need a way to validate the input for the model. If we then can not...
[ "public", "function", "postModel", "(", "$", "model_name", ",", "Request", "$", "request", ")", "{", "$", "this", "->", "checkParams", "(", "func_get_args", "(", ")", ")", ";", "$", "model", "=", "$", "this", "->", "findModel", "(", "$", "model_name", ...
@param $model_name @param Request $request @return \Illuminate\Http\JsonResponse
[ "@param", "$model_name", "@param", "Request", "$request" ]
train
https://github.com/austinkregel/Warden/blob/6f5a98bd79a488f0f300f4851061ac6f7d19f8a3/src/Warden/Http/Controllers/ApiController.php#L73-L112
austinkregel/Warden
src/Warden/Http/Controllers/ApiController.php
ApiController.modelHasBeenSaved
protected function modelHasBeenSaved($saved, $type, $request) { if (!$saved) { return response()->json(['message' => 'Failed to '.$type.' resource', 'code' => 422], 422); } $status = $request->ajax() ? 202 : 200; if ($request->ajax()) { return response()->json...
php
protected function modelHasBeenSaved($saved, $type, $request) { if (!$saved) { return response()->json(['message' => 'Failed to '.$type.' resource', 'code' => 422], 422); } $status = $request->ajax() ? 202 : 200; if ($request->ajax()) { return response()->json...
[ "protected", "function", "modelHasBeenSaved", "(", "$", "saved", ",", "$", "type", ",", "$", "request", ")", "{", "if", "(", "!", "$", "saved", ")", "{", "return", "response", "(", ")", "->", "json", "(", "[", "'message'", "=>", "'Failed to '", ".", ...
This method handles how submitted quests are handle, the main related methods for it are POST and. @param $saved @param $request @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
[ "This", "method", "handles", "how", "submitted", "quests", "are", "handle", "the", "main", "related", "methods", "for", "it", "are", "POST", "and", "." ]
train
https://github.com/austinkregel/Warden/blob/6f5a98bd79a488f0f300f4851061ac6f7d19f8a3/src/Warden/Http/Controllers/ApiController.php#L123-L139
austinkregel/Warden
src/Warden/Http/Controllers/ApiController.php
ApiController.putModel
public function putModel($model_name, $id, Request $request) { $this->checkParams(func_get_args()); $model = $this->findModel($model_name, $id); if (empty($model)) { return $this->emptyModel($request); } $input = collect(Warden::clearInput($request->all())); // Re...
php
public function putModel($model_name, $id, Request $request) { $this->checkParams(func_get_args()); $model = $this->findModel($model_name, $id); if (empty($model)) { return $this->emptyModel($request); } $input = collect(Warden::clearInput($request->all())); // Re...
[ "public", "function", "putModel", "(", "$", "model_name", ",", "$", "id", ",", "Request", "$", "request", ")", "{", "$", "this", "->", "checkParams", "(", "func_get_args", "(", ")", ")", ";", "$", "model", "=", "$", "this", "->", "findModel", "(", "$...
@param $model_name @param $id @param Request $request @return \Illuminate\Http\JsonResponse
[ "@param", "$model_name", "@param", "$id", "@param", "Request", "$request" ]
train
https://github.com/austinkregel/Warden/blob/6f5a98bd79a488f0f300f4851061ac6f7d19f8a3/src/Warden/Http/Controllers/ApiController.php#L158-L236
austinkregel/Warden
src/Warden/Http/Controllers/ApiController.php
ApiController.validatePut
public function validatePut($input, $model, $model_name) { return collect($input)->filter(function ($value, $key) use ($model, $input) { // Remove _token if (!isset($value) || $key === '_token') { return false; } //Remove values that are the s...
php
public function validatePut($input, $model, $model_name) { return collect($input)->filter(function ($value, $key) use ($model, $input) { // Remove _token if (!isset($value) || $key === '_token') { return false; } //Remove values that are the s...
[ "public", "function", "validatePut", "(", "$", "input", ",", "$", "model", ",", "$", "model_name", ")", "{", "return", "collect", "(", "$", "input", ")", "->", "filter", "(", "function", "(", "$", "value", ",", "$", "key", ")", "use", "(", "$", "mo...
This Checks for any values and the _token for csrf and removes it from any blank values and it also removes the _token from the input. If there is a password within the request it will compare it to the current hash. @param $input @param $model @return Collection
[ "This", "Checks", "for", "any", "values", "and", "the", "_token", "for", "csrf", "and", "removes", "it", "from", "any", "blank", "values", "and", "it", "also", "removes", "the", "_token", "from", "the", "input", ".", "If", "there", "is", "a", "password",...
train
https://github.com/austinkregel/Warden/blob/6f5a98bd79a488f0f300f4851061ac6f7d19f8a3/src/Warden/Http/Controllers/ApiController.php#L248-L284
austinkregel/Warden
src/Warden/Http/Controllers/ApiController.php
ApiController.deleteModel
public function deleteModel($model_name, $id, Request $request) { $this->checkParams(func_get_args()); $status = $request->ajax() ? 202 : 200; $model = $this->findModel($model_name, $id); if (empty($model->id)) { if ($model = $model::withTrashed()->whereId($id)->first())...
php
public function deleteModel($model_name, $id, Request $request) { $this->checkParams(func_get_args()); $status = $request->ajax() ? 202 : 200; $model = $this->findModel($model_name, $id); if (empty($model->id)) { if ($model = $model::withTrashed()->whereId($id)->first())...
[ "public", "function", "deleteModel", "(", "$", "model_name", ",", "$", "id", ",", "Request", "$", "request", ")", "{", "$", "this", "->", "checkParams", "(", "func_get_args", "(", ")", ")", ";", "$", "status", "=", "$", "request", "->", "ajax", "(", ...
@param $model_name @param $id @param Request $request @throws \Exception @return \Illuminate\Http\JsonResponse
[ "@param", "$model_name", "@param", "$id", "@param", "Request", "$request" ]
train
https://github.com/austinkregel/Warden/blob/6f5a98bd79a488f0f300f4851061ac6f7d19f8a3/src/Warden/Http/Controllers/ApiController.php#L295-L327
yuncms/framework
src/helpers/UploadHelper.php
UploadHelper.getMaxUploadSize
public static function getMaxUploadSize($maxSize = null) { $maxUpload = (int)(ini_get('upload_max_filesize')); $maxPost = (int)(ini_get('post_max_size')); $memoryLimit = (int)(ini_get('memory_limit')); $min = min($maxUpload, $maxPost, $memoryLimit); if ($maxSize) { ...
php
public static function getMaxUploadSize($maxSize = null) { $maxUpload = (int)(ini_get('upload_max_filesize')); $maxPost = (int)(ini_get('post_max_size')); $memoryLimit = (int)(ini_get('memory_limit')); $min = min($maxUpload, $maxPost, $memoryLimit); if ($maxSize) { ...
[ "public", "static", "function", "getMaxUploadSize", "(", "$", "maxSize", "=", "null", ")", "{", "$", "maxUpload", "=", "(", "int", ")", "(", "ini_get", "(", "'upload_max_filesize'", ")", ")", ";", "$", "maxPost", "=", "(", "int", ")", "(", "ini_get", "...
返回允许上传的最大大小单位 MB @param string $maxSize 最大上传大小MB @return int the max upload size in MB
[ "返回允许上传的最大大小单位", "MB" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/UploadHelper.php#L46-L57
yuncms/framework
src/helpers/UploadHelper.php
UploadHelper.getAcceptImageMimeTypes
public static function getAcceptImageMimeTypes() { $imageAllowFiles = Yii::$app->getSettings()->get('imageAllowFiles','attachment'); $extensions = explode(',', $imageAllowFiles); array_walk($extensions, function (&$value) { $value = 'image/' . $value; }); return $...
php
public static function getAcceptImageMimeTypes() { $imageAllowFiles = Yii::$app->getSettings()->get('imageAllowFiles','attachment'); $extensions = explode(',', $imageAllowFiles); array_walk($extensions, function (&$value) { $value = 'image/' . $value; }); return $...
[ "public", "static", "function", "getAcceptImageMimeTypes", "(", ")", "{", "$", "imageAllowFiles", "=", "Yii", "::", "$", "app", "->", "getSettings", "(", ")", "->", "get", "(", "'imageAllowFiles'", ",", "'attachment'", ")", ";", "$", "extensions", "=", "expl...
获取允许上传的图像 mimeTypes 列表 @return array ['image/jpg','image/png']
[ "获取允许上传的图像", "mimeTypes", "列表" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/UploadHelper.php#L93-L101
Chill-project/Main
Routing/MenuComposer.php
MenuComposer.getRoutesFor
public function getRoutesFor($menuId, array $parameters = array()) { $routes = array(); $routeCollection = $this->container->get('router')->getRouteCollection(); foreach ($routeCollection->all() as $routeKey => $route) { if ($route->hasOption('menus')) { if (arra...
php
public function getRoutesFor($menuId, array $parameters = array()) { $routes = array(); $routeCollection = $this->container->get('router')->getRouteCollection(); foreach ($routeCollection->all() as $routeKey => $route) { if ($route->hasOption('menus')) { if (arra...
[ "public", "function", "getRoutesFor", "(", "$", "menuId", ",", "array", "$", "parameters", "=", "array", "(", ")", ")", "{", "$", "routes", "=", "array", "(", ")", ";", "$", "routeCollection", "=", "$", "this", "->", "container", "->", "get", "(", "'...
Return an array of routes added to $menuId, The array is aimed to build route with MenuTwig @param string $menuId @param array $parameters see https://redmine.champs-libres.coop/issues/179 @return array
[ "Return", "an", "array", "of", "routes", "added", "to", "$menuId", "The", "array", "is", "aimed", "to", "build", "route", "with", "MenuTwig" ]
train
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Routing/MenuComposer.php#L61-L84
Chill-project/Main
Routing/MenuComposer.php
MenuComposer.resolveOrder
private function resolveOrder($routes, $order){ if (isset($routes[$order])) { return $this->resolveOrder($routes, $order + 1); } else { return $order; } }
php
private function resolveOrder($routes, $order){ if (isset($routes[$order])) { return $this->resolveOrder($routes, $order + 1); } else { return $order; } }
[ "private", "function", "resolveOrder", "(", "$", "routes", ",", "$", "order", ")", "{", "if", "(", "isset", "(", "$", "routes", "[", "$", "order", "]", ")", ")", "{", "return", "$", "this", "->", "resolveOrder", "(", "$", "routes", ",", "$", "order...
recursive function to resolve the order of a array of routes. If the order chosen in routing.yml is already in used, find the first next order available. @param array $routes the routes previously added @param int $order @return int
[ "recursive", "function", "to", "resolve", "the", "order", "of", "a", "array", "of", "routes", ".", "If", "the", "order", "chosen", "in", "routing", ".", "yml", "is", "already", "in", "used", "find", "the", "first", "next", "order", "available", "." ]
train
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Routing/MenuComposer.php#L95-L101
ondrakoupil/tools
src/Arrays.php
Arrays.arrayize
static function arrayize($value, $forceArrayFromObject = false) { if (is_array($value)) return $value; if (is_bool($value) or $value===null) return array(); if ($value instanceof \Traversable) { if ($forceArrayFromObject) { return iterator_to_array($value); } return $value; } if ($value instanceo...
php
static function arrayize($value, $forceArrayFromObject = false) { if (is_array($value)) return $value; if (is_bool($value) or $value===null) return array(); if ($value instanceof \Traversable) { if ($forceArrayFromObject) { return iterator_to_array($value); } return $value; } if ($value instanceo...
[ "static", "function", "arrayize", "(", "$", "value", ",", "$", "forceArrayFromObject", "=", "false", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "return", "$", "value", ";", "if", "(", "is_bool", "(", "$", "value", ")", "or", "$", ...
Zajistí, aby zadaný argument byl array. Převede booly nebo nully na array(), pole nechá být, ArrayAccess a Traversable také, vše ostatní převede na array(0=>$hodnota) @param mixed $value @param bool $forceArrayFromObject True = Traversable objekty také převádět na array @return array|\ArrayAccess|\Traversable
[ "Zajistí", "aby", "zadaný", "argument", "byl", "array", "." ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L17-L30
ondrakoupil/tools
src/Arrays.php
Arrays.transform
static function transform($input,$outputKeys,$outputValue) { $input=self::arrayize($input); $output=array(); foreach($input as $inputI=>$inputR) { if (is_array($outputValue)) { $novaPolozka=array(); foreach($outputValue as $ov) { if ($ov===false) { $novaPolozka["key"]=$inputI; } else { ...
php
static function transform($input,$outputKeys,$outputValue) { $input=self::arrayize($input); $output=array(); foreach($input as $inputI=>$inputR) { if (is_array($outputValue)) { $novaPolozka=array(); foreach($outputValue as $ov) { if ($ov===false) { $novaPolozka["key"]=$inputI; } else { ...
[ "static", "function", "transform", "(", "$", "input", ",", "$", "outputKeys", ",", "$", "outputValue", ")", "{", "$", "input", "=", "self", "::", "arrayize", "(", "$", "input", ")", ";", "$", "output", "=", "array", "(", ")", ";", "foreach", "(", "...
Transformace dvoj(či více)-rozměrných polí či Traversable objektů @param array $input Vstupní pole. @param mixed $outputKeys Jak mají být tvořeny indexy výstupního pole? <br />False = numericky indexovat od 0. <br />True = zachovat původní indexy. <br />Cokoliv jiného - použít takto pojmenovanou hodnotu z druhého rozmě...
[ "Transformace", "dvoj", "(", "či", "více", ")", "-", "rozměrných", "polí", "či", "Traversable", "objektů" ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L56-L99
ondrakoupil/tools
src/Arrays.php
Arrays.sortByExternalKeys
static function sortByExternalKeys($dataArray, $keysArray) { $returnArray = array(); foreach($keysArray as $k) { if (isset($dataArray[$k])) { $returnArray[$k] = $dataArray[$k]; } else { $returnArray[$k] = null; } } return $returnArray; }
php
static function sortByExternalKeys($dataArray, $keysArray) { $returnArray = array(); foreach($keysArray as $k) { if (isset($dataArray[$k])) { $returnArray[$k] = $dataArray[$k]; } else { $returnArray[$k] = null; } } return $returnArray; }
[ "static", "function", "sortByExternalKeys", "(", "$", "dataArray", ",", "$", "keysArray", ")", "{", "$", "returnArray", "=", "array", "(", ")", ";", "foreach", "(", "$", "keysArray", "as", "$", "k", ")", "{", "if", "(", "isset", "(", "$", "dataArray", ...
Seřadí prvky v jednom poli dle klíčů podle pořadí hodnot v jiném poli @param array $dataArray @param array $keysArray @return null
[ "Seřadí", "prvky", "v", "jednom", "poli", "dle", "klíčů", "podle", "pořadí", "hodnot", "v", "jiném", "poli" ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L107-L117
ondrakoupil/tools
src/Arrays.php
Arrays.valuePicker
static function valuePicker($array, $hodnota, $ignoredValues = null) { $vrat=array(); foreach($array as $a) { if ((is_array($a) or ($a instanceof \ArrayAccess)) and isset($a[$hodnota])) { $vrat[]=$a[$hodnota]; } elseif (is_object($a) and isset($a->$hodnota)) { $vrat[]=$a->$hodnota; } } $vrat=ar...
php
static function valuePicker($array, $hodnota, $ignoredValues = null) { $vrat=array(); foreach($array as $a) { if ((is_array($a) or ($a instanceof \ArrayAccess)) and isset($a[$hodnota])) { $vrat[]=$a[$hodnota]; } elseif (is_object($a) and isset($a->$hodnota)) { $vrat[]=$a->$hodnota; } } $vrat=ar...
[ "static", "function", "valuePicker", "(", "$", "array", ",", "$", "hodnota", ",", "$", "ignoredValues", "=", "null", ")", "{", "$", "vrat", "=", "array", "(", ")", ";", "foreach", "(", "$", "array", "as", "$", "a", ")", "{", "if", "(", "(", "is_a...
Vybere všechny možné hodnoty z dvourozměrného asociativního pole či Traversable objektu. Funkce iteruje po prvním rozměru pole $array a ve druhém rozměru hledá $hodnota. Ve druhém rozměru mohou být jak pole, tak objekty. Vrátí všechny různé nalezené hodnoty (bez duplikátů). @param array $array @param string $hodnota In...
[ "Vybere", "všechny", "možné", "hodnoty", "z", "dvourozměrného", "asociativního", "pole", "či", "Traversable", "objektu", ".", "Funkce", "iteruje", "po", "prvním", "rozměru", "pole", "$array", "a", "ve", "druhém", "rozměru", "hledá", "$hodnota", ".", "Ve", "druhé...
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L131-L151