repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
Kris-Kuiper/sFire-Framework
src/MVC/View.php
View.escapeCss
public function escapeCss($string, $encoding = 'utf-8') { $current = Escape :: getEncoding(); Escape :: setEncoding($encoding); $result = Escape :: css($string); Escape :: setEncoding($current); return $result; }
php
public function escapeCss($string, $encoding = 'utf-8') { $current = Escape :: getEncoding(); Escape :: setEncoding($encoding); $result = Escape :: css($string); Escape :: setEncoding($current); return $result; }
[ "public", "function", "escapeCss", "(", "$", "string", ",", "$", "encoding", "=", "'utf-8'", ")", "{", "$", "current", "=", "Escape", "::", "getEncoding", "(", ")", ";", "Escape", "::", "setEncoding", "(", "$", "encoding", ")", ";", "$", "result", "=",...
Escape a string for the CSS context. @param string $string @return string
[ "Escape", "a", "string", "for", "the", "CSS", "context", "." ]
deefe1d9d2b40e7326381e8dcd4f01f9aa61885c
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/MVC/View.php#L147-L155
train
Kris-Kuiper/sFire-Framework
src/MVC/View.php
View.partial
protected function partial($file) { $viewmodel = new ViewModel($file); $viewmodel -> assign($this -> viewmodel -> getVariables()); ViewContainer :: output($viewmodel); }
php
protected function partial($file) { $viewmodel = new ViewModel($file); $viewmodel -> assign($this -> viewmodel -> getVariables()); ViewContainer :: output($viewmodel); }
[ "protected", "function", "partial", "(", "$", "file", ")", "{", "$", "viewmodel", "=", "new", "ViewModel", "(", "$", "file", ")", ";", "$", "viewmodel", "->", "assign", "(", "$", "this", "->", "viewmodel", "->", "getVariables", "(", ")", ")", ";", "V...
Calls the parse function @param string $template @return
[ "Calls", "the", "parse", "function" ]
deefe1d9d2b40e7326381e8dcd4f01f9aa61885c
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/MVC/View.php#L198-L204
train
Kris-Kuiper/sFire-Framework
src/MVC/View.php
View.form
protected function form($type, $name = null, $value = null) { $form = new Form(); return $form -> {$type}($name, $value); }
php
protected function form($type, $name = null, $value = null) { $form = new Form(); return $form -> {$type}($name, $value); }
[ "protected", "function", "form", "(", "$", "type", ",", "$", "name", "=", "null", ",", "$", "value", "=", "null", ")", "{", "$", "form", "=", "new", "Form", "(", ")", ";", "return", "$", "form", "->", "{", "$", "type", "}", "(", "$", "name", ...
Calls the url function of the sFire\Routing\Router @param string $identifier @return string
[ "Calls", "the", "url", "function", "of", "the", "sFire", "\\", "Routing", "\\", "Router" ]
deefe1d9d2b40e7326381e8dcd4f01f9aa61885c
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/MVC/View.php#L222-L226
train
Kris-Kuiper/sFire-Framework
src/MVC/View.php
View.translate
protected function translate($key, $params = null, $language = null) { return Translation :: translate($key, $params, $language, $this -> getViewmodel()); }
php
protected function translate($key, $params = null, $language = null) { return Translation :: translate($key, $params, $language, $this -> getViewmodel()); }
[ "protected", "function", "translate", "(", "$", "key", ",", "$", "params", "=", "null", ",", "$", "language", "=", "null", ")", "{", "return", "Translation", "::", "translate", "(", "$", "key", ",", "$", "params", ",", "$", "language", ",", "$", "thi...
Calls the translate function of the sFire\Translation\Translate @param string $key @return string
[ "Calls", "the", "translate", "function", "of", "the", "sFire", "\\", "Translation", "\\", "Translate" ]
deefe1d9d2b40e7326381e8dcd4f01f9aa61885c
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/MVC/View.php#L234-L236
train
Kris-Kuiper/sFire-Framework
src/MVC/View.php
View.template
protected function template($action, $params = null) { if(false === is_string($action)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($action)), E_USER_ERROR); } if(null !== $params && false === is_array($params)) { return...
php
protected function template($action, $params = null) { if(false === is_string($action)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($action)), E_USER_ERROR); } if(null !== $params && false === is_array($params)) { return...
[ "protected", "function", "template", "(", "$", "action", ",", "$", "params", "=", "null", ")", "{", "if", "(", "false", "===", "is_string", "(", "$", "action", ")", ")", "{", "return", "trigger_error", "(", "sprintf", "(", "'Argument 1 passed to %s() must be...
Execute user defined template function @param string $action @param array $params @return mixed
[ "Execute", "user", "defined", "template", "function" ]
deefe1d9d2b40e7326381e8dcd4f01f9aa61885c
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/MVC/View.php#L245-L262
train
Wedeto/Auth
src/ACL/Entity.php
Entity.getPolicy
public function getPolicy(Role $role, string $action) { $rules = $this->getRules(); $pref_policy = $this->getACL()->getPreferredPolicy(); $inherit = true; $ancestor_distance = null; $ancestor_policy = null; foreach ($rules as $rule) { // NOINHERIT...
php
public function getPolicy(Role $role, string $action) { $rules = $this->getRules(); $pref_policy = $this->getACL()->getPreferredPolicy(); $inherit = true; $ancestor_distance = null; $ancestor_policy = null; foreach ($rules as $rule) { // NOINHERIT...
[ "public", "function", "getPolicy", "(", "Role", "$", "role", ",", "string", "$", "action", ")", "{", "$", "rules", "=", "$", "this", "->", "getRules", "(", ")", ";", "$", "pref_policy", "=", "$", "this", "->", "getACL", "(", ")", "->", "getPreferredP...
Find the policy to the Role performing the action on this Entity. @param $role Role The Role wanting to perform an action @param $action string The action Role wishes to perform @return integer The policy, either Rule::ALLOW or Rule::DENY.
[ "Find", "the", "policy", "to", "the", "Role", "performing", "the", "action", "on", "this", "Entity", "." ]
d53777d860a9e67154b84b425e29da5d4dcd28e0
https://github.com/Wedeto/Auth/blob/d53777d860a9e67154b84b425e29da5d4dcd28e0/src/ACL/Entity.php#L99-L173
train
Linkvalue-Interne/MobileNotif
src/Client/ApnsClient.php
ApnsClient.setUp
public function setUp(array $params) { if (empty($params['endpoint'])) { throw new \RuntimeException('Parameter "endpoint" cannot be empty.'); } if (empty($params['ssl_pem_path'])) { throw new \RuntimeException('Parameter "ssl_pem_path" cannot be empty.'); } ...
php
public function setUp(array $params) { if (empty($params['endpoint'])) { throw new \RuntimeException('Parameter "endpoint" cannot be empty.'); } if (empty($params['ssl_pem_path'])) { throw new \RuntimeException('Parameter "ssl_pem_path" cannot be empty.'); } ...
[ "public", "function", "setUp", "(", "array", "$", "params", ")", "{", "if", "(", "empty", "(", "$", "params", "[", "'endpoint'", "]", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Parameter \"endpoint\" cannot be empty.'", ")", ";", "}", ...
Set up parameters. @param array $params @throws \RuntimeException
[ "Set", "up", "parameters", "." ]
e6e4c4219f3bbb0aee32e90e5fdfc8c6a7ed53f6
https://github.com/Linkvalue-Interne/MobileNotif/blob/e6e4c4219f3bbb0aee32e90e5fdfc8c6a7ed53f6/src/Client/ApnsClient.php#L49-L64
train
Linkvalue-Interne/MobileNotif
src/Client/ApnsClient.php
ApnsClient.getStreamSocketClient
private function getStreamSocketClient() { $stream_socket_client = stream_socket_client( $this->params['endpoint'], $errno, $errstr, 30, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $this->getStreamContext() ); if ...
php
private function getStreamSocketClient() { $stream_socket_client = stream_socket_client( $this->params['endpoint'], $errno, $errstr, 30, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $this->getStreamContext() ); if ...
[ "private", "function", "getStreamSocketClient", "(", ")", "{", "$", "stream_socket_client", "=", "stream_socket_client", "(", "$", "this", "->", "params", "[", "'endpoint'", "]", ",", "$", "errno", ",", "$", "errstr", ",", "30", ",", "STREAM_CLIENT_CONNECT", "...
Get the Stream socket client. Connect to the APNS server and open a client socket to it. @return resource Socket to the APNS server. @throws PushException if connection to APNS server failed.
[ "Get", "the", "Stream", "socket", "client", "." ]
e6e4c4219f3bbb0aee32e90e5fdfc8c6a7ed53f6
https://github.com/Linkvalue-Interne/MobileNotif/blob/e6e4c4219f3bbb0aee32e90e5fdfc8c6a7ed53f6/src/Client/ApnsClient.php#L110-L126
train
Linkvalue-Interne/MobileNotif
src/Client/ApnsClient.php
ApnsClient.getStreamContext
private function getStreamContext() { $context = array( 'ssl' => array( 'local_cert' => $this->params['ssl_pem_path'], ), ); // Handle Certificate Bundle passphrase if (!empty($this->params['ssl_passphrase'])) { $context['ssl']['pa...
php
private function getStreamContext() { $context = array( 'ssl' => array( 'local_cert' => $this->params['ssl_pem_path'], ), ); // Handle Certificate Bundle passphrase if (!empty($this->params['ssl_passphrase'])) { $context['ssl']['pa...
[ "private", "function", "getStreamContext", "(", ")", "{", "$", "context", "=", "array", "(", "'ssl'", "=>", "array", "(", "'local_cert'", "=>", "$", "this", "->", "params", "[", "'ssl_pem_path'", "]", ",", ")", ",", ")", ";", "// Handle Certificate Bundle pa...
Get secured stream context from SSL certificate. @return resource
[ "Get", "secured", "stream", "context", "from", "SSL", "certificate", "." ]
e6e4c4219f3bbb0aee32e90e5fdfc8c6a7ed53f6
https://github.com/Linkvalue-Interne/MobileNotif/blob/e6e4c4219f3bbb0aee32e90e5fdfc8c6a7ed53f6/src/Client/ApnsClient.php#L133-L147
train
wb-crowdfusion/crowdfusion
system/core/classes/mvc/filters/FormFilterer.php
FormFilterer.hiddenFormFields
public function hiddenFormFields() { $fields = $this->getParameter('fields'); if (empty($fields)) return ''; $html_array = ArrayUtils::htmlArrayFlatten($fields); foreach ($html_array as $name => $value) { $name = htmlentities($name, ENT_QUOTES); ...
php
public function hiddenFormFields() { $fields = $this->getParameter('fields'); if (empty($fields)) return ''; $html_array = ArrayUtils::htmlArrayFlatten($fields); foreach ($html_array as $name => $value) { $name = htmlentities($name, ENT_QUOTES); ...
[ "public", "function", "hiddenFormFields", "(", ")", "{", "$", "fields", "=", "$", "this", "->", "getParameter", "(", "'fields'", ")", ";", "if", "(", "empty", "(", "$", "fields", ")", ")", "return", "''", ";", "$", "html_array", "=", "ArrayUtils", "::"...
Returns all the fields passed into 'fields' as hidden fields to submit Expected Param: fields array A PHP array that needs to be converted to hidden fields @return string
[ "Returns", "all", "the", "fields", "passed", "into", "fields", "as", "hidden", "fields", "to", "submit" ]
8cad7988f046a6fefbed07d026cb4ae6706c1217
https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/FormFilterer.php#L42-L59
train
Hnto/nuki
src/Handlers/Http/Input/Request.php
Request.protocol
public function protocol($version = false) : string { if ($version === false) { $protocol = 'http'; if ($this->server()->get('HTTPS')) { $protocol = 'https'; } return $protocol; } return $this->server()->get('SERVER_PROTOCOL'); }
php
public function protocol($version = false) : string { if ($version === false) { $protocol = 'http'; if ($this->server()->get('HTTPS')) { $protocol = 'https'; } return $protocol; } return $this->server()->get('SERVER_PROTOCOL'); }
[ "public", "function", "protocol", "(", "$", "version", "=", "false", ")", ":", "string", "{", "if", "(", "$", "version", "===", "false", ")", "{", "$", "protocol", "=", "'http'", ";", "if", "(", "$", "this", "->", "server", "(", ")", "->", "get", ...
Get used server protocal @param bool $version @return string
[ "Get", "used", "server", "protocal" ]
c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c
https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Http/Input/Request.php#L186-L197
train
Hnto/nuki
src/Handlers/Http/Input/Request.php
Request.incoming
public function incoming(Application $app) { $route = $app->getService('router') ->findHttpRoute($this); /** Route is a callback execution */ if (!empty($route->offsetGet('action'))) { //Route is a callback execution $app::getContainer()->offsetSet( ...
php
public function incoming(Application $app) { $route = $app->getService('router') ->findHttpRoute($this); /** Route is a callback execution */ if (!empty($route->offsetGet('action'))) { //Route is a callback execution $app::getContainer()->offsetSet( ...
[ "public", "function", "incoming", "(", "Application", "$", "app", ")", "{", "$", "route", "=", "$", "app", "->", "getService", "(", "'router'", ")", "->", "findHttpRoute", "(", "$", "this", ")", ";", "/** Route is a callback execution */", "if", "(", "!", ...
Initialize incoming request Determine if route contains callback or service execution - set callback - set active unit - set active service - set active process - register service @param Application $app @return void @throws Base
[ "Initialize", "incoming", "request", "Determine", "if", "route", "contains", "callback", "or", "service", "execution" ]
c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c
https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Http/Input/Request.php#L325-L369
train
Hnto/nuki
src/Handlers/Http/Input/Request.php
Request.buildProcess
private function buildProcess(string $process, string $fullServiceName) { $methods = array_flip(get_class_methods($fullServiceName)); if (!array_key_exists(($process), $methods)) { throw new \Nuki\Exceptions\Base('No available process is found for the provided service'); } retur...
php
private function buildProcess(string $process, string $fullServiceName) { $methods = array_flip(get_class_methods($fullServiceName)); if (!array_key_exists(($process), $methods)) { throw new \Nuki\Exceptions\Base('No available process is found for the provided service'); } retur...
[ "private", "function", "buildProcess", "(", "string", "$", "process", ",", "string", "$", "fullServiceName", ")", "{", "$", "methods", "=", "array_flip", "(", "get_class_methods", "(", "$", "fullServiceName", ")", ")", ";", "if", "(", "!", "array_key_exists", ...
Build process name @param string $process @param string $fullServiceName @return string @throws \Nuki\Exceptions\Base
[ "Build", "process", "name" ]
c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c
https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Http/Input/Request.php#L379-L388
train
modulusphp/utility
Events.php
Events.triggerGroup
public function triggerGroup(?array $events = [], ?array $args = null) { foreach($events as $callback) { if (is_callable($callback)) { call_user_func_array($callback, isset($args) ? $args : []); } else if (is_string($callback)) { $call = new $callback; call_user_func_arra...
php
public function triggerGroup(?array $events = [], ?array $args = null) { foreach($events as $callback) { if (is_callable($callback)) { call_user_func_array($callback, isset($args) ? $args : []); } else if (is_string($callback)) { $call = new $callback; call_user_func_arra...
[ "public", "function", "triggerGroup", "(", "?", "array", "$", "events", "=", "[", "]", ",", "?", "array", "$", "args", "=", "null", ")", "{", "foreach", "(", "$", "events", "as", "$", "callback", ")", "{", "if", "(", "is_callable", "(", "$", "callb...
Trigger a grouped event @param mixed ?array @param mixed ?array @return void
[ "Trigger", "a", "grouped", "event" ]
c1e127539b13d3ec8381e41c64b881e0701807f5
https://github.com/modulusphp/utility/blob/c1e127539b13d3ec8381e41c64b881e0701807f5/Events.php#L69-L80
train
gplcart/cli
controllers/commands/City.php
City.cmdGetCity
public function cmdGetCity() { $result = $this->getListCity(); $this->outputFormat($result); $this->outputFormatTableCity($result); $this->output(); }
php
public function cmdGetCity() { $result = $this->getListCity(); $this->outputFormat($result); $this->outputFormatTableCity($result); $this->output(); }
[ "public", "function", "cmdGetCity", "(", ")", "{", "$", "result", "=", "$", "this", "->", "getListCity", "(", ")", ";", "$", "this", "->", "outputFormat", "(", "$", "result", ")", ";", "$", "this", "->", "outputFormatTableCity", "(", "$", "result", ")"...
Callback for "city-get" command
[ "Callback", "for", "city", "-", "get", "command" ]
e57dba53e291a225b4bff0c0d9b23d685dd1c125
https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/City.php#L40-L46
train
gplcart/cli
controllers/commands/City.php
City.cmdDeleteCity
public function cmdDeleteCity() { $id = $this->getParam(0); if (empty($id)) { $this->errorAndExit($this->text('Invalid argument')); } $options = null; if ($this->getParam('state')) { $options = array('state_id' => $id); } else if ($this->get...
php
public function cmdDeleteCity() { $id = $this->getParam(0); if (empty($id)) { $this->errorAndExit($this->text('Invalid argument')); } $options = null; if ($this->getParam('state')) { $options = array('state_id' => $id); } else if ($this->get...
[ "public", "function", "cmdDeleteCity", "(", ")", "{", "$", "id", "=", "$", "this", "->", "getParam", "(", "0", ")", ";", "if", "(", "empty", "(", "$", "id", ")", ")", "{", "$", "this", "->", "errorAndExit", "(", "$", "this", "->", "text", "(", ...
Callback for "city-delete" command
[ "Callback", "for", "city", "-", "delete", "command" ]
e57dba53e291a225b4bff0c0d9b23d685dd1c125
https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/City.php#L51-L85
train
gplcart/cli
controllers/commands/City.php
City.cmdUpdateCity
public function cmdUpdateCity() { $params = $this->getParam(); if (empty($params[0]) || count($params) < 2) { $this->errorAndExit($this->text('Invalid command')); } if (!is_numeric($params[0])) { $this->errorAndExit($this->text('Invalid argument')); ...
php
public function cmdUpdateCity() { $params = $this->getParam(); if (empty($params[0]) || count($params) < 2) { $this->errorAndExit($this->text('Invalid command')); } if (!is_numeric($params[0])) { $this->errorAndExit($this->text('Invalid argument')); ...
[ "public", "function", "cmdUpdateCity", "(", ")", "{", "$", "params", "=", "$", "this", "->", "getParam", "(", ")", ";", "if", "(", "empty", "(", "$", "params", "[", "0", "]", ")", "||", "count", "(", "$", "params", ")", "<", "2", ")", "{", "$",...
Callback for "city-update" command
[ "Callback", "for", "city", "-", "update", "command" ]
e57dba53e291a225b4bff0c0d9b23d685dd1c125
https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/City.php#L104-L122
train
gplcart/cli
controllers/commands/City.php
City.getListCity
protected function getListCity() { $id = $this->getParam(0); if (!isset($id)) { return $this->city->getList(array('limit' => $this->getLimit())); } if ($this->getParam('state')) { return $this->city->getList(array('state_id' => $id, 'limit' => $this->getLimi...
php
protected function getListCity() { $id = $this->getParam(0); if (!isset($id)) { return $this->city->getList(array('limit' => $this->getLimit())); } if ($this->getParam('state')) { return $this->city->getList(array('state_id' => $id, 'limit' => $this->getLimi...
[ "protected", "function", "getListCity", "(", ")", "{", "$", "id", "=", "$", "this", "->", "getParam", "(", "0", ")", ";", "if", "(", "!", "isset", "(", "$", "id", ")", ")", "{", "return", "$", "this", "->", "city", "->", "getList", "(", "array", ...
Returns an array of cities @return array
[ "Returns", "an", "array", "of", "cities" ]
e57dba53e291a225b4bff0c0d9b23d685dd1c125
https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/City.php#L128-L155
train
gplcart/cli
controllers/commands/City.php
City.addCity
protected function addCity() { if (!$this->isError()) { $id = $this->city->add($this->getSubmitted()); if (empty($id)) { $this->errorAndExit($this->text('Unexpected result')); } $this->line($id); } }
php
protected function addCity() { if (!$this->isError()) { $id = $this->city->add($this->getSubmitted()); if (empty($id)) { $this->errorAndExit($this->text('Unexpected result')); } $this->line($id); } }
[ "protected", "function", "addCity", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isError", "(", ")", ")", "{", "$", "id", "=", "$", "this", "->", "city", "->", "add", "(", "$", "this", "->", "getSubmitted", "(", ")", ")", ";", "if", "(", ...
Add a new city
[ "Add", "a", "new", "city" ]
e57dba53e291a225b4bff0c0d9b23d685dd1c125
https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/City.php#L191-L200
train
gplcart/cli
controllers/commands/City.php
City.submitAddCity
protected function submitAddCity() { $this->setSubmitted(null, $this->getParam()); $this->validateComponent('city'); $this->addCity(); }
php
protected function submitAddCity() { $this->setSubmitted(null, $this->getParam()); $this->validateComponent('city'); $this->addCity(); }
[ "protected", "function", "submitAddCity", "(", ")", "{", "$", "this", "->", "setSubmitted", "(", "null", ",", "$", "this", "->", "getParam", "(", ")", ")", ";", "$", "this", "->", "validateComponent", "(", "'city'", ")", ";", "$", "this", "->", "addCit...
Add a new city at once
[ "Add", "a", "new", "city", "at", "once" ]
e57dba53e291a225b4bff0c0d9b23d685dd1c125
https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/City.php#L216-L221
train
gplcart/cli
controllers/commands/City.php
City.wizardAddCity
protected function wizardAddCity() { $this->validatePrompt('name', $this->text('Name'), 'city'); $this->validatePrompt('state_id', $this->text('Country state'), 'city'); $this->validatePrompt('country', $this->text('Country'), 'city'); $this->validatePrompt('zone_id', $this->text('Zo...
php
protected function wizardAddCity() { $this->validatePrompt('name', $this->text('Name'), 'city'); $this->validatePrompt('state_id', $this->text('Country state'), 'city'); $this->validatePrompt('country', $this->text('Country'), 'city'); $this->validatePrompt('zone_id', $this->text('Zo...
[ "protected", "function", "wizardAddCity", "(", ")", "{", "$", "this", "->", "validatePrompt", "(", "'name'", ",", "$", "this", "->", "text", "(", "'Name'", ")", ",", "'city'", ")", ";", "$", "this", "->", "validatePrompt", "(", "'state_id'", ",", "$", ...
Add a new city step by step
[ "Add", "a", "new", "city", "step", "by", "step" ]
e57dba53e291a225b4bff0c0d9b23d685dd1c125
https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/City.php#L226-L236
train
covex-nn/JooS_Stream
src/JooS/Stream/Wrapper/FS.php
Wrapper_FS.commit
public static function commit($protocol) { if (isset(self::$_partitions[$protocol])) { $partition = self::$_partitions[$protocol]; /* @var $partition Wrapper_FS_Partition */ $partition->commit(); $result = true; } else { $result = false; } return $result; }
php
public static function commit($protocol) { if (isset(self::$_partitions[$protocol])) { $partition = self::$_partitions[$protocol]; /* @var $partition Wrapper_FS_Partition */ $partition->commit(); $result = true; } else { $result = false; } return $result; }
[ "public", "static", "function", "commit", "(", "$", "protocol", ")", "{", "if", "(", "isset", "(", "self", "::", "$", "_partitions", "[", "$", "protocol", "]", ")", ")", "{", "$", "partition", "=", "self", "::", "$", "_partitions", "[", "$", "protoco...
Commit all changes to real FS @param string $protocol Protocol name @return boolean
[ "Commit", "all", "changes", "to", "real", "FS" ]
e9841b804190a9f624b9e44caa0af7a18f3816d1
https://github.com/covex-nn/JooS_Stream/blob/e9841b804190a9f624b9e44caa0af7a18f3816d1/src/JooS/Stream/Wrapper/FS.php#L355-L368
train
covex-nn/JooS_Stream
src/JooS/Stream/Wrapper/FS.php
Wrapper_FS.getPartition
protected static function getPartition($url) { $urlParts = explode("://", $url); $protocol = array_shift($urlParts); return self::$_partitions[$protocol]; }
php
protected static function getPartition($url) { $urlParts = explode("://", $url); $protocol = array_shift($urlParts); return self::$_partitions[$protocol]; }
[ "protected", "static", "function", "getPartition", "(", "$", "url", ")", "{", "$", "urlParts", "=", "explode", "(", "\"://\"", ",", "$", "url", ")", ";", "$", "protocol", "=", "array_shift", "(", "$", "urlParts", ")", ";", "return", "self", "::", "$", ...
Return partition by file url @param string $url Url @return Wrapper_FS_Partition
[ "Return", "partition", "by", "file", "url" ]
e9841b804190a9f624b9e44caa0af7a18f3816d1
https://github.com/covex-nn/JooS_Stream/blob/e9841b804190a9f624b9e44caa0af7a18f3816d1/src/JooS/Stream/Wrapper/FS.php#L391-L397
train
covex-nn/JooS_Stream
src/JooS/Stream/Wrapper/FS.php
Wrapper_FS.getRelativePath
public static function getRelativePath($url) { $urlParts = explode("://", $url); array_shift($urlParts); $urlPath = implode("://", $urlParts); return Entity::fixPath($urlPath); }
php
public static function getRelativePath($url) { $urlParts = explode("://", $url); array_shift($urlParts); $urlPath = implode("://", $urlParts); return Entity::fixPath($urlPath); }
[ "public", "static", "function", "getRelativePath", "(", "$", "url", ")", "{", "$", "urlParts", "=", "explode", "(", "\"://\"", ",", "$", "url", ")", ";", "array_shift", "(", "$", "urlParts", ")", ";", "$", "urlPath", "=", "implode", "(", "\"://\"", ","...
Return urlPath of url @param string $url Url @return string
[ "Return", "urlPath", "of", "url" ]
e9841b804190a9f624b9e44caa0af7a18f3816d1
https://github.com/covex-nn/JooS_Stream/blob/e9841b804190a9f624b9e44caa0af7a18f3816d1/src/JooS/Stream/Wrapper/FS.php#L406-L413
train
ScaraMVC/Framework
src/Scara/Http/Model.php
Model.create
public function create($options = []) { $capsule = $this->_database->getCapsule(); if (empty($options) || !is_array($options)) { throw new \Exception('Create options must not be empty and must be an instance of an array!'); } // filter out options not given in fillable a...
php
public function create($options = []) { $capsule = $this->_database->getCapsule(); if (empty($options) || !is_array($options)) { throw new \Exception('Create options must not be empty and must be an instance of an array!'); } // filter out options not given in fillable a...
[ "public", "function", "create", "(", "$", "options", "=", "[", "]", ")", "{", "$", "capsule", "=", "$", "this", "->", "_database", "->", "getCapsule", "(", ")", ";", "if", "(", "empty", "(", "$", "options", ")", "||", "!", "is_array", "(", "$", "...
Creates a new table row. @return bool
[ "Creates", "a", "new", "table", "row", "." ]
199b08b45fadf5dae14ac4732af03b36e15bbef2
https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/Model.php#L79-L97
train
ScaraMVC/Framework
src/Scara/Http/Model.php
Model.find
public function find($id) { $capsule = $this->_database->getCapsule(); $this->_model = $capsule->table($this->table)->where('id', '=', $id); return $this->_model->first(); }
php
public function find($id) { $capsule = $this->_database->getCapsule(); $this->_model = $capsule->table($this->table)->where('id', '=', $id); return $this->_model->first(); }
[ "public", "function", "find", "(", "$", "id", ")", "{", "$", "capsule", "=", "$", "this", "->", "_database", "->", "getCapsule", "(", ")", ";", "$", "this", "->", "_model", "=", "$", "capsule", "->", "table", "(", "$", "this", "->", "table", ")", ...
Finds an item by it's id. @param int $id @return stdClass
[ "Finds", "an", "item", "by", "it", "s", "id", "." ]
199b08b45fadf5dae14ac4732af03b36e15bbef2
https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/Model.php#L120-L127
train
ScaraMVC/Framework
src/Scara/Http/Model.php
Model.where
public function where($column, $operator, $value) { $capsule = $this->_database->getCapsule(); if (empty($column)) { throw new \Exception('You must provide the column to look up!'); } if (empty($operator)) { throw new \Exception('You must provide an operator!...
php
public function where($column, $operator, $value) { $capsule = $this->_database->getCapsule(); if (empty($column)) { throw new \Exception('You must provide the column to look up!'); } if (empty($operator)) { throw new \Exception('You must provide an operator!...
[ "public", "function", "where", "(", "$", "column", ",", "$", "operator", ",", "$", "value", ")", "{", "$", "capsule", "=", "$", "this", "->", "_database", "->", "getCapsule", "(", ")", ";", "if", "(", "empty", "(", "$", "column", ")", ")", "{", "...
Searches for something in the database. @param string $column - The column to search @param string $operator - The operator for searching with @param string $value - The value you're looking for @return \Illuminate\Database\Query\Builder
[ "Searches", "for", "something", "in", "the", "database", "." ]
199b08b45fadf5dae14ac4732af03b36e15bbef2
https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/Model.php#L138-L155
train
ScaraMVC/Framework
src/Scara/Http/Model.php
Model.count
public function count() { if (is_array($this->_model)) { return count($this->_model); } else { return $this->_model->count(); } }
php
public function count() { if (is_array($this->_model)) { return count($this->_model); } else { return $this->_model->count(); } }
[ "public", "function", "count", "(", ")", "{", "if", "(", "is_array", "(", "$", "this", "->", "_model", ")", ")", "{", "return", "count", "(", "$", "this", "->", "_model", ")", ";", "}", "else", "{", "return", "$", "this", "->", "_model", "->", "c...
Gets the number of results. @return int
[ "Gets", "the", "number", "of", "results", "." ]
199b08b45fadf5dae14ac4732af03b36e15bbef2
https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/Model.php#L162-L169
train
ScaraMVC/Framework
src/Scara/Http/Model.php
Model.all
public function all($order = 'ASC') { $capsule = $this->_database->getCapsule(); $this->_model = $capsule->table($this->table)->orderBy('id', $order)->get(); return $this->_model; }
php
public function all($order = 'ASC') { $capsule = $this->_database->getCapsule(); $this->_model = $capsule->table($this->table)->orderBy('id', $order)->get(); return $this->_model; }
[ "public", "function", "all", "(", "$", "order", "=", "'ASC'", ")", "{", "$", "capsule", "=", "$", "this", "->", "_database", "->", "getCapsule", "(", ")", ";", "$", "this", "->", "_model", "=", "$", "capsule", "->", "table", "(", "$", "this", "->",...
Gets all results from the database. @param string $order - The order of the results @return \Illuminate\Database\Query\Builder
[ "Gets", "all", "results", "from", "the", "database", "." ]
199b08b45fadf5dae14ac4732af03b36e15bbef2
https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/Model.php#L178-L185
train
ScaraMVC/Framework
src/Scara/Http/Model.php
Model.select
public function select($capsule = null, $limit = null, $offset = null, $columns = []) { if (is_null($capsule)) { $capsule = $this->_database->getCapsule()->table($this->table); } if (empty($columns)) { $columns = '*'; } else { $cstring = ''; ...
php
public function select($capsule = null, $limit = null, $offset = null, $columns = []) { if (is_null($capsule)) { $capsule = $this->_database->getCapsule()->table($this->table); } if (empty($columns)) { $columns = '*'; } else { $cstring = ''; ...
[ "public", "function", "select", "(", "$", "capsule", "=", "null", ",", "$", "limit", "=", "null", ",", "$", "offset", "=", "null", ",", "$", "columns", "=", "[", "]", ")", "{", "if", "(", "is_null", "(", "$", "capsule", ")", ")", "{", "$", "cap...
Selects from the database table via custom SQL command. @param \Illuminate\Database\Query\Builder $capsule - Capsule instance @param int $limit - Selection limit @param int $offset - Selection offset @param array $columns - C...
[ "Selects", "from", "the", "database", "table", "via", "custom", "SQL", "command", "." ]
199b08b45fadf5dae14ac4732af03b36e15bbef2
https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/Model.php#L197-L222
train
ScaraMVC/Framework
src/Scara/Http/Model.php
Model.paginate
public function paginate($limit) { $capsule = $this->_database->getCapsule(); $this->_model = $capsule->table($this->table); $paginator = new Pagination(); $paginator->setLimit($limit)->setModel($this, $this->_model); return $paginator->paginate(); }
php
public function paginate($limit) { $capsule = $this->_database->getCapsule(); $this->_model = $capsule->table($this->table); $paginator = new Pagination(); $paginator->setLimit($limit)->setModel($this, $this->_model); return $paginator->paginate(); }
[ "public", "function", "paginate", "(", "$", "limit", ")", "{", "$", "capsule", "=", "$", "this", "->", "_database", "->", "getCapsule", "(", ")", ";", "$", "this", "->", "_model", "=", "$", "capsule", "->", "table", "(", "$", "this", "->", "table", ...
Does like all, but creates pagination for results. @param int $limit - The number of results to limit by @return \Scara\Pagination\Pagination
[ "Does", "like", "all", "but", "creates", "pagination", "for", "results", "." ]
199b08b45fadf5dae14ac4732af03b36e15bbef2
https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/Model.php#L231-L239
train
ScaraMVC/Framework
src/Scara/Http/Model.php
Model.save
public function save($options) { $gcc = get_called_class(); $class = $gcc::init(); $cap = $this->_database->getCapsule(); $params = (array) $options; $this->filter($params); return $cap->table($this->table)->update($params); }
php
public function save($options) { $gcc = get_called_class(); $class = $gcc::init(); $cap = $this->_database->getCapsule(); $params = (array) $options; $this->filter($params); return $cap->table($this->table)->update($params); }
[ "public", "function", "save", "(", "$", "options", ")", "{", "$", "gcc", "=", "get_called_class", "(", ")", ";", "$", "class", "=", "$", "gcc", "::", "init", "(", ")", ";", "$", "cap", "=", "$", "this", "->", "_database", "->", "getCapsule", "(", ...
Saves changes to a model. @param mixed $options @return bool
[ "Saves", "changes", "to", "a", "model", "." ]
199b08b45fadf5dae14ac4732af03b36e15bbef2
https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/Model.php#L248-L257
train
ScaraMVC/Framework
src/Scara/Http/Model.php
Model.filter
private function filter(&$options) { foreach ($options as $key => $value) { if (!in_array($key, $this->fillable)) { unset($options[$key]); } } }
php
private function filter(&$options) { foreach ($options as $key => $value) { if (!in_array($key, $this->fillable)) { unset($options[$key]); } } }
[ "private", "function", "filter", "(", "&", "$", "options", ")", "{", "foreach", "(", "$", "options", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "!", "in_array", "(", "$", "key", ",", "$", "this", "->", "fillable", ")", ")", "{", ...
Filters out options that are not included in a model's fillable array. @param array &$options - Options array reference @return void
[ "Filters", "out", "options", "that", "are", "not", "included", "in", "a", "model", "s", "fillable", "array", "." ]
199b08b45fadf5dae14ac4732af03b36e15bbef2
https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/Model.php#L278-L285
train
DreadLabs/VantomasWebsite
src/Disqus/Resource.php
Resource.parseResourceSignature
protected function parseResourceSignature() { list($topic, $actionAndFormat) = explode('/', $this->signature); list($action, $format) = explode('.', $actionAndFormat); $this->topic = ucfirst($topic); $this->action = ucfirst($action); $this->format = $format; }
php
protected function parseResourceSignature() { list($topic, $actionAndFormat) = explode('/', $this->signature); list($action, $format) = explode('.', $actionAndFormat); $this->topic = ucfirst($topic); $this->action = ucfirst($action); $this->format = $format; }
[ "protected", "function", "parseResourceSignature", "(", ")", "{", "list", "(", "$", "topic", ",", "$", "actionAndFormat", ")", "=", "explode", "(", "'/'", ",", "$", "this", "->", "signature", ")", ";", "list", "(", "$", "action", ",", "$", "format", ")...
parses a resource signature The format must be something like foo/bar.json @return void
[ "parses", "a", "resource", "signature" ]
7f85f2b45bdf5ed9fa9d320c805c416bf99cd668
https://github.com/DreadLabs/VantomasWebsite/blob/7f85f2b45bdf5ed9fa9d320c805c416bf99cd668/src/Disqus/Resource.php#L106-L114
train
DreadLabs/VantomasWebsite
src/Disqus/Resource.php
Resource.initializeConcreteResource
protected function initializeConcreteResource() { $this->concreteResource = $this->resourceResolver->resolve($this->topic, $this->action); }
php
protected function initializeConcreteResource() { $this->concreteResource = $this->resourceResolver->resolve($this->topic, $this->action); }
[ "protected", "function", "initializeConcreteResource", "(", ")", "{", "$", "this", "->", "concreteResource", "=", "$", "this", "->", "resourceResolver", "->", "resolve", "(", "$", "this", "->", "topic", ",", "$", "this", "->", "action", ")", ";", "}" ]
initializes a concrete resource implementation @return void
[ "initializes", "a", "concrete", "resource", "implementation" ]
7f85f2b45bdf5ed9fa9d320c805c416bf99cd668
https://github.com/DreadLabs/VantomasWebsite/blob/7f85f2b45bdf5ed9fa9d320c805c416bf99cd668/src/Disqus/Resource.php#L121-L124
train
EXSyst/IO
StringSourceState.php
StringSourceState.restore
public function restore() { $this->offsetRef = $this->offset; $this->lineRef = $this->line; $this->rowRef = $this->row; }
php
public function restore() { $this->offsetRef = $this->offset; $this->lineRef = $this->line; $this->rowRef = $this->row; }
[ "public", "function", "restore", "(", ")", "{", "$", "this", "->", "offsetRef", "=", "$", "this", "->", "offset", ";", "$", "this", "->", "lineRef", "=", "$", "this", "->", "line", ";", "$", "this", "->", "rowRef", "=", "$", "this", "->", "row", ...
Restores the source to which this state belongs to this state.
[ "Restores", "the", "source", "to", "which", "this", "state", "belongs", "to", "this", "state", "." ]
4c30ba79b09d2cc41d0a7cd340255a87cac54326
https://github.com/EXSyst/IO/blob/4c30ba79b09d2cc41d0a7cd340255a87cac54326/StringSourceState.php#L48-L53
train
Facebook-Anonymous-Publisher/wordfilter
src/Replace/Chinese.php
Chinese.replace
public static function replace(array $words, $replacement, $text) { $self = new self; $length = $self->wordsLength($words); $blocks = array_unique($length); $min = end($blocks); $chars = $self->splitText($text); $index = $self->index($chars); $pinyins = ...
php
public static function replace(array $words, $replacement, $text) { $self = new self; $length = $self->wordsLength($words); $blocks = array_unique($length); $min = end($blocks); $chars = $self->splitText($text); $index = $self->index($chars); $pinyins = ...
[ "public", "static", "function", "replace", "(", "array", "$", "words", ",", "$", "replacement", ",", "$", "text", ")", "{", "$", "self", "=", "new", "self", ";", "$", "length", "=", "$", "self", "->", "wordsLength", "(", "$", "words", ")", ";", "$"...
Replace words with replacements in a text. @param array $words @param string $replacement @param string $text @return string
[ "Replace", "words", "with", "replacements", "in", "a", "text", "." ]
0a2ce766a509650ac622eeaa809391ebf304885e
https://github.com/Facebook-Anonymous-Publisher/wordfilter/blob/0a2ce766a509650ac622eeaa809391ebf304885e/src/Replace/Chinese.php#L46-L85
train
Facebook-Anonymous-Publisher/wordfilter
src/Replace/Chinese.php
Chinese.wordsLength
protected function wordsLength(array $words) { $length = []; foreach ($words as $word) { $pinyin = $this->pinyin->sentence($word); $length[md5($pinyin)] = ($pinyin === $word) ? 1 : mb_strlen($word); } arsort($length); ...
php
protected function wordsLength(array $words) { $length = []; foreach ($words as $word) { $pinyin = $this->pinyin->sentence($word); $length[md5($pinyin)] = ($pinyin === $word) ? 1 : mb_strlen($word); } arsort($length); ...
[ "protected", "function", "wordsLength", "(", "array", "$", "words", ")", "{", "$", "length", "=", "[", "]", ";", "foreach", "(", "$", "words", "as", "$", "word", ")", "{", "$", "pinyin", "=", "$", "this", "->", "pinyin", "->", "sentence", "(", "$",...
Get echo word length and use md5 as key. @param array $words @return array
[ "Get", "echo", "word", "length", "and", "use", "md5", "as", "key", "." ]
0a2ce766a509650ac622eeaa809391ebf304885e
https://github.com/Facebook-Anonymous-Publisher/wordfilter/blob/0a2ce766a509650ac622eeaa809391ebf304885e/src/Replace/Chinese.php#L94-L109
train
Facebook-Anonymous-Publisher/wordfilter
src/Replace/Chinese.php
Chinese.splitText
protected function splitText($text) { $punctuations = preg_quote(implode('', $this->punctuations), '/'); $text = preg_replace('/([^\p{Han}\s'.$punctuations.']+)/u', "\t\t\t$1\t\t", $text); $array = []; foreach (preg_split('/\t\t/u', $text, -1, PREG_SPLIT_NO_EMPTY) as $item) { ...
php
protected function splitText($text) { $punctuations = preg_quote(implode('', $this->punctuations), '/'); $text = preg_replace('/([^\p{Han}\s'.$punctuations.']+)/u', "\t\t\t$1\t\t", $text); $array = []; foreach (preg_split('/\t\t/u', $text, -1, PREG_SPLIT_NO_EMPTY) as $item) { ...
[ "protected", "function", "splitText", "(", "$", "text", ")", "{", "$", "punctuations", "=", "preg_quote", "(", "implode", "(", "''", ",", "$", "this", "->", "punctuations", ")", ",", "'/'", ")", ";", "$", "text", "=", "preg_replace", "(", "'/([^\\p{Han}\...
Spilt text to array. @param string $text @return array
[ "Spilt", "text", "to", "array", "." ]
0a2ce766a509650ac622eeaa809391ebf304885e
https://github.com/Facebook-Anonymous-Publisher/wordfilter/blob/0a2ce766a509650ac622eeaa809391ebf304885e/src/Replace/Chinese.php#L118-L133
train
Facebook-Anonymous-Publisher/wordfilter
src/Replace/Chinese.php
Chinese.index
protected function index(array $chars) { $index = []; foreach ($chars as $key => $char) { if (preg_match('/[\p{Han}\w]+/u', $char)) { $index[] = $key; } } return $index; }
php
protected function index(array $chars) { $index = []; foreach ($chars as $key => $char) { if (preg_match('/[\p{Han}\w]+/u', $char)) { $index[] = $key; } } return $index; }
[ "protected", "function", "index", "(", "array", "$", "chars", ")", "{", "$", "index", "=", "[", "]", ";", "foreach", "(", "$", "chars", "as", "$", "key", "=>", "$", "char", ")", "{", "if", "(", "preg_match", "(", "'/[\\p{Han}\\w]+/u'", ",", "$", "c...
Build words index. @param array $chars @return array
[ "Build", "words", "index", "." ]
0a2ce766a509650ac622eeaa809391ebf304885e
https://github.com/Facebook-Anonymous-Publisher/wordfilter/blob/0a2ce766a509650ac622eeaa809391ebf304885e/src/Replace/Chinese.php#L160-L171
train
ekyna/Table
Http/ParametersHelper.php
ParametersHelper.setData
public function setData(array $data = []) { $this->default = empty($data); $this->data = array_replace([ static::VISIBLE_COLUMNS => [], static::MAX_PER_PAGE => null, static::CONFIG => null, static::PAGE_NUM => null, stat...
php
public function setData(array $data = []) { $this->default = empty($data); $this->data = array_replace([ static::VISIBLE_COLUMNS => [], static::MAX_PER_PAGE => null, static::CONFIG => null, static::PAGE_NUM => null, stat...
[ "public", "function", "setData", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "this", "->", "default", "=", "empty", "(", "$", "data", ")", ";", "$", "this", "->", "data", "=", "array_replace", "(", "[", "static", "::", "VISIBLE_COLUMNS",...
Sets the data. @param array $data
[ "Sets", "the", "data", "." ]
6f06e8fd8a3248d52f3a91f10508471344db311a
https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Http/ParametersHelper.php#L74-L94
train
ekyna/Table
Http/ParametersHelper.php
ParametersHelper.getSortHref
public function getSortHref(ColumnInterface $column) { $parameter = $this->getSortName(); $dir = ($column->getSortDirection() === ColumnSort::ASC ? ColumnSort::DESC : ColumnSort::ASC); return '?' . $parameter . '[by]=' . $column->getName() . '&' . $parameter . '[dir]=' . $dir; }
php
public function getSortHref(ColumnInterface $column) { $parameter = $this->getSortName(); $dir = ($column->getSortDirection() === ColumnSort::ASC ? ColumnSort::DESC : ColumnSort::ASC); return '?' . $parameter . '[by]=' . $column->getName() . '&' . $parameter . '[dir]=' . $dir; }
[ "public", "function", "getSortHref", "(", "ColumnInterface", "$", "column", ")", "{", "$", "parameter", "=", "$", "this", "->", "getSortName", "(", ")", ";", "$", "dir", "=", "(", "$", "column", "->", "getSortDirection", "(", ")", "===", "ColumnSort", ":...
Returns the sort column href. @param ColumnInterface $column @return string
[ "Returns", "the", "sort", "column", "href", "." ]
6f06e8fd8a3248d52f3a91f10508471344db311a
https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Http/ParametersHelper.php#L213-L219
train
ekyna/Table
Http/ParametersHelper.php
ParametersHelper.getIdentifiersName
public function getIdentifiersName() { $name = $this->tableName . '[' . static::IDENTIFIERS . ']'; if ($this->selectionMode == Config::SELECTION_MULTIPLE) { $name .= '[]'; } return $name; }
php
public function getIdentifiersName() { $name = $this->tableName . '[' . static::IDENTIFIERS . ']'; if ($this->selectionMode == Config::SELECTION_MULTIPLE) { $name .= '[]'; } return $name; }
[ "public", "function", "getIdentifiersName", "(", ")", "{", "$", "name", "=", "$", "this", "->", "tableName", ".", "'['", ".", "static", "::", "IDENTIFIERS", ".", "']'", ";", "if", "(", "$", "this", "->", "selectionMode", "==", "Config", "::", "SELECTION_...
Returns the identifiers parameter name. @return string
[ "Returns", "the", "identifiers", "parameter", "name", "." ]
6f06e8fd8a3248d52f3a91f10508471344db311a
https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Http/ParametersHelper.php#L290-L299
train
ekyna/Table
Http/ParametersHelper.php
ParametersHelper.getProfileValue
private function getProfileValue($name) { if (isset($this->data[static::PROFILE][$name])) { return $this->data[static::PROFILE][$name]; } return null; }
php
private function getProfileValue($name) { if (isset($this->data[static::PROFILE][$name])) { return $this->data[static::PROFILE][$name]; } return null; }
[ "private", "function", "getProfileValue", "(", "$", "name", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "data", "[", "static", "::", "PROFILE", "]", "[", "$", "name", "]", ")", ")", "{", "return", "$", "this", "->", "data", "[", "static",...
Returns the profile parameter value. @param string $name The profile parameter name @return string|null
[ "Returns", "the", "profile", "parameter", "value", "." ]
6f06e8fd8a3248d52f3a91f10508471344db311a
https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Http/ParametersHelper.php#L551-L558
train
locomotivemtl/charcoal-config
src/Charcoal/Config/AbstractConfig.php
AbstractConfig.offsetExists
public function offsetExists($key) { if (is_numeric($key)) { throw new InvalidArgumentException( 'Entity array access only supports non-numeric keys' ); } if ($this->separator && strstr($key, $this->separator)) { return $this->hasWithSepar...
php
public function offsetExists($key) { if (is_numeric($key)) { throw new InvalidArgumentException( 'Entity array access only supports non-numeric keys' ); } if ($this->separator && strstr($key, $this->separator)) { return $this->hasWithSepar...
[ "public", "function", "offsetExists", "(", "$", "key", ")", "{", "if", "(", "is_numeric", "(", "$", "key", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Entity array access only supports non-numeric keys'", ")", ";", "}", "if", "(", "$", "t...
Determines if this store contains the specified key and if its value is not NULL. Routine: - If the data key is {@see SeparatorAwareTrait::$separator nested}, the data-tree is traversed until the endpoint is found, if any; - If the data key does NOT exist on the store, a lookup is performed on each delegate store unti...
[ "Determines", "if", "this", "store", "contains", "the", "specified", "key", "and", "if", "its", "value", "is", "not", "NULL", "." ]
722b34955360c287dea8fffb3b5491866ce5f6cb
https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/AbstractConfig.php#L135-L164
train
locomotivemtl/charcoal-config
src/Charcoal/Config/AbstractConfig.php
AbstractConfig.offsetReplace
public function offsetReplace($key, $value) { if (is_numeric($key)) { throw new InvalidArgumentException( 'Entity array access only supports non-numeric keys' ); } $key = $this->camelize($key); /** @internal Edge Case: "_" → "" */ if ...
php
public function offsetReplace($key, $value) { if (is_numeric($key)) { throw new InvalidArgumentException( 'Entity array access only supports non-numeric keys' ); } $key = $this->camelize($key); /** @internal Edge Case: "_" → "" */ if ...
[ "public", "function", "offsetReplace", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "is_numeric", "(", "$", "key", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Entity array access only supports non-numeric keys'", ")", ";", "}", ...
Replaces the value from the specified key. Routine: - When the value in the Config and the new value are both arrays, the method will replace their respective value recursively. - Then or otherwise, the new value is {@see self::offsetSet() assigned} to the Config. @uses self::offsetSet() @uses array_replace_recur...
[ "Replaces", "the", "value", "from", "the", "specified", "key", "." ]
722b34955360c287dea8fffb3b5491866ce5f6cb
https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/AbstractConfig.php#L271-L294
train
locomotivemtl/charcoal-config
src/Charcoal/Config/AbstractConfig.php
AbstractConfig.addFile
public function addFile($path) { $config = $this->loadFile($path); if (is_array($config)) { $this->merge($config); } return $this; }
php
public function addFile($path) { $config = $this->loadFile($path); if (is_array($config)) { $this->merge($config); } return $this; }
[ "public", "function", "addFile", "(", "$", "path", ")", "{", "$", "config", "=", "$", "this", "->", "loadFile", "(", "$", "path", ")", ";", "if", "(", "is_array", "(", "$", "config", ")", ")", "{", "$", "this", "->", "merge", "(", "$", "config", ...
Adds a configuration file to the configset. Natively supported file formats: INI, JSON, PHP. @uses FileAwareTrait::loadFile() @param string $path The file to load and add. @return self
[ "Adds", "a", "configuration", "file", "to", "the", "configset", "." ]
722b34955360c287dea8fffb3b5491866ce5f6cb
https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/AbstractConfig.php#L305-L312
train
stellaqua/Waltz.Stagehand
src/Waltz/Stagehand/ClassUtility/CommentObject/PhpDocCommentObject.php
PhpDocCommentObject.ltrim
public static function ltrim ( $docComment ) { $regexp = array( '|^[\s\t]*(/\*\*)|um' => '\\1', '|^[\s\t]*([ ]\*/)|um' => '\\1', '|^[\s\t]*([ ]\*[ ]*)|um' => '\\1', ); $patterns = array_keys($regexp); ...
php
public static function ltrim ( $docComment ) { $regexp = array( '|^[\s\t]*(/\*\*)|um' => '\\1', '|^[\s\t]*([ ]\*/)|um' => '\\1', '|^[\s\t]*([ ]\*[ ]*)|um' => '\\1', ); $patterns = array_keys($regexp); ...
[ "public", "static", "function", "ltrim", "(", "$", "docComment", ")", "{", "$", "regexp", "=", "array", "(", "'|^[\\s\\t]*(/\\*\\*)|um'", "=>", "'\\\\1'", ",", "'|^[\\s\\t]*([ ]\\*/)|um'", "=>", "'\\\\1'", ",", "'|^[\\s\\t]*([ ]\\*[ ]*)|um'", "=>", "'\\\\1'", ",", ...
Trim spaces and tabs on the left @param string $docComment @return string Trimmed DocComment
[ "Trim", "spaces", "and", "tabs", "on", "the", "left" ]
01df286751f5b9a5c90c47138dca3709e5bc383b
https://github.com/stellaqua/Waltz.Stagehand/blob/01df286751f5b9a5c90c47138dca3709e5bc383b/src/Waltz/Stagehand/ClassUtility/CommentObject/PhpDocCommentObject.php#L44-L55
train
benjamindulau/AnoDataGrid
src/Ano/DataGrid/Twig/Extension/DataGridExtension.php
DataGridExtension.renderColumnBody
public function renderColumnBody(ColumnView $view, array $variables = array()) { return $this->render($view, 'column_' . $view->get('type'), $variables); }
php
public function renderColumnBody(ColumnView $view, array $variables = array()) { return $this->render($view, 'column_' . $view->get('type'), $variables); }
[ "public", "function", "renderColumnBody", "(", "ColumnView", "$", "view", ",", "array", "$", "variables", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "render", "(", "$", "view", ",", "'column_'", ".", "$", "view", "->", "get", "(", ...
Renders column body. @param ColumnView $view The view to render @param array $variables An array of variables @return string The html markup
[ "Renders", "column", "body", "." ]
69b31803929b04e9d6e807bb2213b9b3477d0367
https://github.com/benjamindulau/AnoDataGrid/blob/69b31803929b04e9d6e807bb2213b9b3477d0367/src/Ano/DataGrid/Twig/Extension/DataGridExtension.php#L96-L99
train
benjamindulau/AnoDataGrid
src/Ano/DataGrid/Twig/Extension/DataGridExtension.php
DataGridExtension.getBlocks
protected function getBlocks(DataGridView $view) { if (!$this->blocks->contains($view)) { $templates = $this->resources; if (isset($this->themes[$view])) { $templates = array_merge($templates, $this->themes[$view]); } $blocks = array(); ...
php
protected function getBlocks(DataGridView $view) { if (!$this->blocks->contains($view)) { $templates = $this->resources; if (isset($this->themes[$view])) { $templates = array_merge($templates, $this->themes[$view]); } $blocks = array(); ...
[ "protected", "function", "getBlocks", "(", "DataGridView", "$", "view", ")", "{", "if", "(", "!", "$", "this", "->", "blocks", "->", "contains", "(", "$", "view", ")", ")", "{", "$", "templates", "=", "$", "this", "->", "resources", ";", "if", "(", ...
Returns the blocks used to render the view. Templates are looked for in the resources in the following order: * resources from the themes (and its parents) * resources from the themes of parent views (up to the root view) * default resources @param DataGridView $view The view @return array An array of Twig_TemplateI...
[ "Returns", "the", "blocks", "used", "to", "render", "the", "view", "." ]
69b31803929b04e9d6e807bb2213b9b3477d0367
https://github.com/benjamindulau/AnoDataGrid/blob/69b31803929b04e9d6e807bb2213b9b3477d0367/src/Ano/DataGrid/Twig/Extension/DataGridExtension.php#L220-L249
train
Subscribo/omnipay-subscribo-shared
src/Shared/CreditCard.php
CreditCard.getShippingContactDifferences
public function getShippingContactDifferences($mode = self::MODE_FILTER_EMPTY_WHEN_STRING_VALUES) { $difference = []; foreach ($this->getContactParameterNames() as $parameterName) { $billingGetter = 'getBilling'.ucfirst($parameterName); $shippingGetter = 'getShipping'...
php
public function getShippingContactDifferences($mode = self::MODE_FILTER_EMPTY_WHEN_STRING_VALUES) { $difference = []; foreach ($this->getContactParameterNames() as $parameterName) { $billingGetter = 'getBilling'.ucfirst($parameterName); $shippingGetter = 'getShipping'...
[ "public", "function", "getShippingContactDifferences", "(", "$", "mode", "=", "self", "::", "MODE_FILTER_EMPTY_WHEN_STRING_VALUES", ")", "{", "$", "difference", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getContactParameterNames", "(", ")", "as", "$...
Returns those shipping contact parameters which are different for shipping and billing Keys are camel cased parameter names without shipping prefix, values are shipping contact parameter values @param string $mode Filtering mode (if any): By default this methods filters out values, which are empty when converted to st...
[ "Returns", "those", "shipping", "contact", "parameters", "which", "are", "different", "for", "shipping", "and", "billing", "Keys", "are", "camel", "cased", "parameter", "names", "without", "shipping", "prefix", "values", "are", "shipping", "contact", "parameter", ...
aa9fa115ef8324b50fe5c91d3593d5632f53b669
https://github.com/Subscribo/omnipay-subscribo-shared/blob/aa9fa115ef8324b50fe5c91d3593d5632f53b669/src/Shared/CreditCard.php#L42-L64
train
squareproton/Bond
lib/underscore.php
__.chain
public function chain($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); $__ = (isset($this) && isset($this->_chained) && $this->_chained) ? $this : __($item); $__->_chained = true; return $__; }
php
public function chain($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); $__ = (isset($this) && isset($this->_chained) && $this->_chained) ? $this : __($item); $__->_chained = true; return $__; }
[ "public", "function", "chain", "(", "$", "item", "=", "null", ")", "{", "list", "(", "$", "item", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "$", "__", "=", "(", "isset", "(", "$", "this", ")", "&&"...
Are we in a chain?
[ "Are", "we", "in", "a", "chain?" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L24-L30
train
squareproton/Bond
lib/underscore.php
__.each
public function each($collection=null, $iterator=null) { list($collection, $iterator) = self::_wrapArgs(func_get_args(), 2); if(is_null($collection)) return self::_wrap(null); $collection = (array) self::_collection($collection); if(count($collection) === 0) return self::_wrap(null); ...
php
public function each($collection=null, $iterator=null) { list($collection, $iterator) = self::_wrapArgs(func_get_args(), 2); if(is_null($collection)) return self::_wrap(null); $collection = (array) self::_collection($collection); if(count($collection) === 0) return self::_wrap(null); ...
[ "public", "function", "each", "(", "$", "collection", "=", "null", ",", "$", "iterator", "=", "null", ")", "{", "list", "(", "$", "collection", ",", "$", "iterator", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "2", ")", ...
Invoke the iterator on each item in the collection
[ "Invoke", "the", "iterator", "on", "each", "item", "in", "the", "collection" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L40-L52
train
squareproton/Bond
lib/underscore.php
__.invoke
public function invoke($collection=null, $function_name=null, $arguments=null) { $args = self::_wrapArgs(func_get_args(), 2); $__ = new self; list($collection, $function_name) = $__->first($args, 2); $arguments = $__->rest(func_get_args(), 2); // If passed an array or string, return an array ...
php
public function invoke($collection=null, $function_name=null, $arguments=null) { $args = self::_wrapArgs(func_get_args(), 2); $__ = new self; list($collection, $function_name) = $__->first($args, 2); $arguments = $__->rest(func_get_args(), 2); // If passed an array or string, return an array ...
[ "public", "function", "invoke", "(", "$", "collection", "=", "null", ",", "$", "function_name", "=", "null", ",", "$", "arguments", "=", "null", ")", "{", "$", "args", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "2", ")", ";"...
Invoke the named function over each item in the collection, optionally passing arguments to the function
[ "Invoke", "the", "named", "function", "over", "each", "item", "in", "the", "collection", "optionally", "passing", "arguments", "to", "the", "function" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L137-L150
train
squareproton/Bond
lib/underscore.php
__.size
public function size($collection=null) { list($collection) = self::_wrapArgs(func_get_args(), 1); $collection = self::_collection($collection); return self::_wrap(count((array) $collection)); }
php
public function size($collection=null) { list($collection) = self::_wrapArgs(func_get_args(), 1); $collection = self::_collection($collection); return self::_wrap(count((array) $collection)); }
[ "public", "function", "size", "(", "$", "collection", "=", "null", ")", "{", "list", "(", "$", "collection", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "$", "collection", "=", "self", "::", "_collection", ...
How many items are in this collection?
[ "How", "many", "items", "are", "in", "this", "collection?" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L232-L238
train
squareproton/Bond
lib/underscore.php
__.initial
public function initial($collection=null, $n=null) { list($collection, $n) = self::_wrapArgs(func_get_args(), 2); $collection = (array) self::_collection($collection); if(is_null($n)) $n = 1; $first_index = count($collection) - $n; $__ = new self; return self::_wrap($__->first($collect...
php
public function initial($collection=null, $n=null) { list($collection, $n) = self::_wrapArgs(func_get_args(), 2); $collection = (array) self::_collection($collection); if(is_null($n)) $n = 1; $first_index = count($collection) - $n; $__ = new self; return self::_wrap($__->first($collect...
[ "public", "function", "initial", "(", "$", "collection", "=", "null", ",", "$", "n", "=", "null", ")", "{", "list", "(", "$", "collection", ",", "$", "n", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "2", ")", ";", "$...
Return everything but the last array element. Passing n excludes the last n elements.
[ "Return", "everything", "but", "the", "last", "array", "element", ".", "Passing", "n", "excludes", "the", "last", "n", "elements", "." ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L268-L277
train
squareproton/Bond
lib/underscore.php
__.compact
public function compact($collection=null) { list($collection) = self::_wrapArgs(func_get_args(), 1); $collection = self::_collection($collection); $__ = new self; return self::_wrap($__->select($collection, function($val) { return (bool) $val; })); }
php
public function compact($collection=null) { list($collection) = self::_wrapArgs(func_get_args(), 1); $collection = self::_collection($collection); $__ = new self; return self::_wrap($__->select($collection, function($val) { return (bool) $val; })); }
[ "public", "function", "compact", "(", "$", "collection", "=", "null", ")", "{", "list", "(", "$", "collection", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "$", "collection", "=", "self", "::", "_collection"...
Return a copy of the array with falsy values removed
[ "Return", "a", "copy", "of", "the", "array", "with", "falsy", "values", "removed" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L297-L306
train
squareproton/Bond
lib/underscore.php
__.flatten
public function flatten($collection=null, $shallow=null) { list($collection, $shallow) = self::_wrapArgs(func_get_args(), 2); $collection = self::_collection($collection); $return = array(); if(count($collection) > 0) { foreach($collection as $item) { if(is_array($item)) { ...
php
public function flatten($collection=null, $shallow=null) { list($collection, $shallow) = self::_wrapArgs(func_get_args(), 2); $collection = self::_collection($collection); $return = array(); if(count($collection) > 0) { foreach($collection as $item) { if(is_array($item)) { ...
[ "public", "function", "flatten", "(", "$", "collection", "=", "null", ",", "$", "shallow", "=", "null", ")", "{", "list", "(", "$", "collection", ",", "$", "shallow", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "2", ")",...
Flattens a multidimensional array
[ "Flattens", "a", "multidimensional", "array" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L310-L326
train
squareproton/Bond
lib/underscore.php
__.without
public function without($collection=null, $val=null) { $args = self::_wrapArgs(func_get_args(), 1); $collection = $args[0]; $collection = self::_collection($collection); $num_args = count($args); if($num_args === 1) return self::_wrap($collection); if(count($collection) === 0) return self::...
php
public function without($collection=null, $val=null) { $args = self::_wrapArgs(func_get_args(), 1); $collection = $args[0]; $collection = self::_collection($collection); $num_args = count($args); if($num_args === 1) return self::_wrap($collection); if(count($collection) === 0) return self::...
[ "public", "function", "without", "(", "$", "collection", "=", "null", ",", "$", "val", "=", "null", ")", "{", "$", "args", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "$", "collection", "=", "$", "args", "[",...
Returns a copy of the array with all instances of val removed
[ "Returns", "a", "copy", "of", "the", "array", "with", "all", "instances", "of", "val", "removed" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L330-L350
train
squareproton/Bond
lib/underscore.php
__.intersection
public function intersection($array=null) { $arrays = self::_wrapArgs(func_get_args(), 1); if(count($arrays) === 1) return self::_wrap($array); $__ = new self; $return = $__->first($arrays); foreach($__->rest($arrays) as $next) { if(!$__->isArray($next)) $next = str_split((string) $n...
php
public function intersection($array=null) { $arrays = self::_wrapArgs(func_get_args(), 1); if(count($arrays) === 1) return self::_wrap($array); $__ = new self; $return = $__->first($arrays); foreach($__->rest($arrays) as $next) { if(!$__->isArray($next)) $next = str_split((string) $n...
[ "public", "function", "intersection", "(", "$", "array", "=", "null", ")", "{", "$", "arrays", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "if", "(", "count", "(", "$", "arrays", ")", "===", "1", ")", "return...
Returns an array containing the intersection of all the arrays
[ "Returns", "an", "array", "containing", "the", "intersection", "of", "all", "the", "arrays" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L378-L392
train
squareproton/Bond
lib/underscore.php
__.union
public function union($array=null) { $arrays = self::_wrapArgs(func_get_args(), 1); if(count($arrays) === 1) return self::_wrap($array); $__ = new self; return self::_wrap($__->flatten(array_values(array_unique(call_user_func_array('array_merge', $arrays))))); }
php
public function union($array=null) { $arrays = self::_wrapArgs(func_get_args(), 1); if(count($arrays) === 1) return self::_wrap($array); $__ = new self; return self::_wrap($__->flatten(array_values(array_unique(call_user_func_array('array_merge', $arrays))))); }
[ "public", "function", "union", "(", "$", "array", "=", "null", ")", "{", "$", "arrays", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "if", "(", "count", "(", "$", "arrays", ")", "===", "1", ")", "return", "s...
Merge together multiple arrays
[ "Merge", "together", "multiple", "arrays" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L396-L403
train
squareproton/Bond
lib/underscore.php
__.difference
public function difference($array_one=null, $array_two=null) { $arrays = self::_wrapArgs(func_get_args(), 1); return self::_wrap(array_values(call_user_func_array('array_diff', $arrays))); }
php
public function difference($array_one=null, $array_two=null) { $arrays = self::_wrapArgs(func_get_args(), 1); return self::_wrap(array_values(call_user_func_array('array_diff', $arrays))); }
[ "public", "function", "difference", "(", "$", "array_one", "=", "null", ",", "$", "array_two", "=", "null", ")", "{", "$", "arrays", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "return", "self", "::", "_wrap", ...
Get the difference between two arrays
[ "Get", "the", "difference", "between", "two", "arrays" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L407-L411
train
squareproton/Bond
lib/underscore.php
__.indexOf
public function indexOf($collection=null, $item=null) { list($collection, $item) = self::_wrapArgs(func_get_args(), 2); $collection = self::_collection($collection); $key = array_search($item, $collection, true); return self::_wrap((is_bool($key)) ? -1 : $key); }
php
public function indexOf($collection=null, $item=null) { list($collection, $item) = self::_wrapArgs(func_get_args(), 2); $collection = self::_collection($collection); $key = array_search($item, $collection, true); return self::_wrap((is_bool($key)) ? -1 : $key); }
[ "public", "function", "indexOf", "(", "$", "collection", "=", "null", ",", "$", "item", "=", "null", ")", "{", "list", "(", "$", "collection", ",", "$", "item", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "2", ")", ";"...
Get the index of the first match
[ "Get", "the", "index", "of", "the", "first", "match" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L415-L422
train
squareproton/Bond
lib/underscore.php
__.lastIndexOf
public function lastIndexOf($collection=null, $item=null) { list($collection, $item) = self::_wrapArgs(func_get_args(), 2); $collection = self::_collection($collection); krsort($collection); $__ = new self; return self::_wrap($__->indexOf($collection, $item)); }
php
public function lastIndexOf($collection=null, $item=null) { list($collection, $item) = self::_wrapArgs(func_get_args(), 2); $collection = self::_collection($collection); krsort($collection); $__ = new self; return self::_wrap($__->indexOf($collection, $item)); }
[ "public", "function", "lastIndexOf", "(", "$", "collection", "=", "null", ",", "$", "item", "=", "null", ")", "{", "list", "(", "$", "collection", ",", "$", "item", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "2", ")", ...
Get the index of the last match
[ "Get", "the", "index", "of", "the", "last", "match" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L426-L434
train
squareproton/Bond
lib/underscore.php
__.max
public function max($collection=null, $iterator=null) { list($collection, $iterator) = self::_wrapArgs(func_get_args(), 2); if(is_null($iterator)) return self::_wrap(max($collection)); $results = array(); foreach($collection as $k=>$item) { $results[$k] = $iterator($item); } arso...
php
public function max($collection=null, $iterator=null) { list($collection, $iterator) = self::_wrapArgs(func_get_args(), 2); if(is_null($iterator)) return self::_wrap(max($collection)); $results = array(); foreach($collection as $k=>$item) { $results[$k] = $iterator($item); } arso...
[ "public", "function", "max", "(", "$", "collection", "=", "null", ",", "$", "iterator", "=", "null", ")", "{", "list", "(", "$", "collection", ",", "$", "iterator", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "2", ")", ...
Get the max value in the collection
[ "Get", "the", "max", "value", "in", "the", "collection" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L493-L506
train
squareproton/Bond
lib/underscore.php
__.sortedIndex
public function sortedIndex($collection=null, $value=null, $iterator=null) { list($collection, $value, $iterator) = self::_wrapArgs(func_get_args(), 3); $collection = (array) self::_collection($collection); $__ = new self; $calculated_value = (!is_null($iterator)) ? $iterator($value) : $value;...
php
public function sortedIndex($collection=null, $value=null, $iterator=null) { list($collection, $value, $iterator) = self::_wrapArgs(func_get_args(), 3); $collection = (array) self::_collection($collection); $__ = new self; $calculated_value = (!is_null($iterator)) ? $iterator($value) : $value;...
[ "public", "function", "sortedIndex", "(", "$", "collection", "=", "null", ",", "$", "value", "=", "null", ",", "$", "iterator", "=", "null", ")", "{", "list", "(", "$", "collection", ",", "$", "value", ",", "$", "iterator", ")", "=", "self", "::", ...
Returns the index at which the value should be inserted into the sorted collection
[ "Returns", "the", "index", "at", "which", "the", "value", "should", "be", "inserted", "into", "the", "sorted", "collection" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L558-L577
train
squareproton/Bond
lib/underscore.php
__.shuffle
public function shuffle($collection=null) { list($collection) = self::_wrapArgs(func_get_args(), 1); $collection = (array) self::_collection($collection); shuffle($collection); return self::_wrap($collection); }
php
public function shuffle($collection=null) { list($collection) = self::_wrapArgs(func_get_args(), 1); $collection = (array) self::_collection($collection); shuffle($collection); return self::_wrap($collection); }
[ "public", "function", "shuffle", "(", "$", "collection", "=", "null", ")", "{", "list", "(", "$", "collection", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "$", "collection", "=", "(", "array", ")", "self"...
Shuffle the array
[ "Shuffle", "the", "array" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L580-L587
train
squareproton/Bond
lib/underscore.php
__.keys
public function keys($collection=null) { list($collection) = self::_wrapArgs(func_get_args(), 1); if(!is_object($collection) && !is_array($collection)) throw new Exception('Invalid object'); return self::_wrap(array_keys((array) $collection)); }
php
public function keys($collection=null) { list($collection) = self::_wrapArgs(func_get_args(), 1); if(!is_object($collection) && !is_array($collection)) throw new Exception('Invalid object'); return self::_wrap(array_keys((array) $collection)); }
[ "public", "function", "keys", "(", "$", "collection", "=", "null", ")", "{", "list", "(", "$", "collection", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "if", "(", "!", "is_object", "(", "$", "collection",...
Get the collection's keys
[ "Get", "the", "collection", "s", "keys" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L597-L603
train
squareproton/Bond
lib/underscore.php
__.values
public function values($collection=null) { list($collection) = self::_wrapArgs(func_get_args(), 1); return self::_wrap(array_values((array) $collection)); }
php
public function values($collection=null) { list($collection) = self::_wrapArgs(func_get_args(), 1); return self::_wrap(array_values((array) $collection)); }
[ "public", "function", "values", "(", "$", "collection", "=", "null", ")", "{", "list", "(", "$", "collection", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "return", "self", "::", "_wrap", "(", "array_values"...
Get the collection's values
[ "Get", "the", "collection", "s", "values" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L607-L611
train
squareproton/Bond
lib/underscore.php
__.extend
public function extend($object=null) { $args = self::_wrapArgs(func_get_args(), 1); $num_args = func_num_args(); if($num_args === 1) return $object; $is_object = is_object($object); $array = (array) $object; $__ = new self; $extensions = $__->rest(func_get_args()); foreach($ext...
php
public function extend($object=null) { $args = self::_wrapArgs(func_get_args(), 1); $num_args = func_num_args(); if($num_args === 1) return $object; $is_object = is_object($object); $array = (array) $object; $__ = new self; $extensions = $__->rest(func_get_args()); foreach($ext...
[ "public", "function", "extend", "(", "$", "object", "=", "null", ")", "{", "$", "args", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "$", "num_args", "=", "func_num_args", "(", ")", ";", "if", "(", "$", "num_a...
Copy all properties from the source objects into the destination object
[ "Copy", "all", "properties", "from", "the", "source", "objects", "into", "the", "destination", "object" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L615-L630
train
squareproton/Bond
lib/underscore.php
__.defaults
public function defaults($object=null) { $args = self::_wrapArgs(func_get_args(), 1); list($object) = $args; $num_args = count($args); if($num_args === 1) return $object; $is_object = is_object($object); $array = (array) $object; $__ = new self; $extensions = $__->rest($args); ...
php
public function defaults($object=null) { $args = self::_wrapArgs(func_get_args(), 1); list($object) = $args; $num_args = count($args); if($num_args === 1) return $object; $is_object = is_object($object); $array = (array) $object; $__ = new self; $extensions = $__->rest($args); ...
[ "public", "function", "defaults", "(", "$", "object", "=", "null", ")", "{", "$", "args", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "list", "(", "$", "object", ")", "=", "$", "args", ";", "$", "num_args", ...
Returns the object with any missing values filled in using the defaults.
[ "Returns", "the", "object", "with", "any", "missing", "values", "filled", "in", "using", "the", "defaults", "." ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L634-L650
train
squareproton/Bond
lib/underscore.php
__.clon
public function clon(&$object=null) { list($object) = self::_wrapArgs(func_get_args(), 1); $clone = null; if(is_array($object)) $clone = (array) clone (object) $object; elseif(!is_object($object)) $clone = $object; elseif(!$clone) $clone = clone $object; // shallow copy object if(i...
php
public function clon(&$object=null) { list($object) = self::_wrapArgs(func_get_args(), 1); $clone = null; if(is_array($object)) $clone = (array) clone (object) $object; elseif(!is_object($object)) $clone = $object; elseif(!$clone) $clone = clone $object; // shallow copy object if(i...
[ "public", "function", "clon", "(", "&", "$", "object", "=", "null", ")", "{", "list", "(", "$", "object", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "$", "clone", "=", "null", ";", "if", "(", "is_arra...
Returns a shallow copy of the object
[ "Returns", "a", "shallow", "copy", "of", "the", "object" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L664-L686
train
squareproton/Bond
lib/underscore.php
__.tap
public function tap($object=null, $interceptor=null) { list($object, $interceptor) = self::_wrapArgs(func_get_args(), 2); $interceptor($object); return self::_wrap($object); }
php
public function tap($object=null, $interceptor=null) { list($object, $interceptor) = self::_wrapArgs(func_get_args(), 2); $interceptor($object); return self::_wrap($object); }
[ "public", "function", "tap", "(", "$", "object", "=", "null", ",", "$", "interceptor", "=", "null", ")", "{", "list", "(", "$", "object", ",", "$", "interceptor", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "2", ")", "...
Invokes the interceptor on the object, then returns the object
[ "Invokes", "the", "interceptor", "on", "the", "object", "then", "returns", "the", "object" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L690-L695
train
squareproton/Bond
lib/underscore.php
__.has
public function has($collection=null, $key=null) { list($collection, $key) = self::_wrapArgs(func_get_args(), 2); $collection = (array) self::_collection($collection); return self::_wrap(array_key_exists($key, $collection)); }
php
public function has($collection=null, $key=null) { list($collection, $key) = self::_wrapArgs(func_get_args(), 2); $collection = (array) self::_collection($collection); return self::_wrap(array_key_exists($key, $collection)); }
[ "public", "function", "has", "(", "$", "collection", "=", "null", ",", "$", "key", "=", "null", ")", "{", "list", "(", "$", "collection", ",", "$", "key", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "2", ")", ";", "$...
Does the given key exist?
[ "Does", "the", "given", "key", "exist?" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L699-L705
train
squareproton/Bond
lib/underscore.php
__.isEqual
public function isEqual($a=null, $b=null) { list($a, $b) = self::_wrapArgs(func_get_args(), 2); if(isset($this) && isset($this->_chained) && $this->_chained) $a =& $this; if($a === $b) return self::_wrap(true); if(gettype($a) !== gettype($b)) return self::_wrap(false); if(is_callable($a) !...
php
public function isEqual($a=null, $b=null) { list($a, $b) = self::_wrapArgs(func_get_args(), 2); if(isset($this) && isset($this->_chained) && $this->_chained) $a =& $this; if($a === $b) return self::_wrap(true); if(gettype($a) !== gettype($b)) return self::_wrap(false); if(is_callable($a) !...
[ "public", "function", "isEqual", "(", "$", "a", "=", "null", ",", "$", "b", "=", "null", ")", "{", "list", "(", "$", "a", ",", "$", "b", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "2", ")", ";", "if", "(", "isse...
Are these items equal?
[ "Are", "these", "items", "equal?" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L709-L738
train
squareproton/Bond
lib/underscore.php
__.isEmpty
public function isEmpty($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); return self::_wrap(is_array($item) || is_object($item)) ? !((bool) count((array) $item)) : (!(bool) $item); }
php
public function isEmpty($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); return self::_wrap(is_array($item) || is_object($item)) ? !((bool) count((array) $item)) : (!(bool) $item); }
[ "public", "function", "isEmpty", "(", "$", "item", "=", "null", ")", "{", "list", "(", "$", "item", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "return", "self", "::", "_wrap", "(", "is_array", "(", "$",...
Is this item empty?
[ "Is", "this", "item", "empty?" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L742-L746
train
squareproton/Bond
lib/underscore.php
__.isObject
public function isObject($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); return self::_wrap(is_object($item)); }
php
public function isObject($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); return self::_wrap(is_object($item)); }
[ "public", "function", "isObject", "(", "$", "item", "=", "null", ")", "{", "list", "(", "$", "item", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "return", "self", "::", "_wrap", "(", "is_object", "(", "$...
Is this item an object?
[ "Is", "this", "item", "an", "object?" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L750-L753
train
squareproton/Bond
lib/underscore.php
__.isArray
public function isArray($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); return self::_wrap(is_array($item)); }
php
public function isArray($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); return self::_wrap(is_array($item)); }
[ "public", "function", "isArray", "(", "$", "item", "=", "null", ")", "{", "list", "(", "$", "item", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "return", "self", "::", "_wrap", "(", "is_array", "(", "$",...
Is this item an array?
[ "Is", "this", "item", "an", "array?" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L757-L760
train
squareproton/Bond
lib/underscore.php
__.isString
public function isString($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); return self::_wrap(is_string($item)); }
php
public function isString($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); return self::_wrap(is_string($item)); }
[ "public", "function", "isString", "(", "$", "item", "=", "null", ")", "{", "list", "(", "$", "item", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "return", "self", "::", "_wrap", "(", "is_string", "(", "$...
Is this item a string?
[ "Is", "this", "item", "a", "string?" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L764-L767
train
squareproton/Bond
lib/underscore.php
__.isNumber
public function isNumber($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); return self::_wrap((is_int($item) || is_float($item)) && !is_nan($item) && !is_infinite($item)); }
php
public function isNumber($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); return self::_wrap((is_int($item) || is_float($item)) && !is_nan($item) && !is_infinite($item)); }
[ "public", "function", "isNumber", "(", "$", "item", "=", "null", ")", "{", "list", "(", "$", "item", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "return", "self", "::", "_wrap", "(", "(", "is_int", "(", ...
Is this item a number?
[ "Is", "this", "item", "a", "number?" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L771-L774
train
squareproton/Bond
lib/underscore.php
__.isBoolean
public function isBoolean($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); return self::_wrap(is_bool($item)); }
php
public function isBoolean($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); return self::_wrap(is_bool($item)); }
[ "public", "function", "isBoolean", "(", "$", "item", "=", "null", ")", "{", "list", "(", "$", "item", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "return", "self", "::", "_wrap", "(", "is_bool", "(", "$"...
Is this item a bool?
[ "Is", "this", "item", "a", "bool?" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L778-L781
train
squareproton/Bond
lib/underscore.php
__.isDate
public function isDate($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); return self::_wrap(is_object($item) && get_class($item) === 'DateTime'); }
php
public function isDate($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); return self::_wrap(is_object($item) && get_class($item) === 'DateTime'); }
[ "public", "function", "isDate", "(", "$", "item", "=", "null", ")", "{", "list", "(", "$", "item", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "return", "self", "::", "_wrap", "(", "is_object", "(", "$",...
Is this item an instance of DateTime?
[ "Is", "this", "item", "an", "instance", "of", "DateTime?" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L792-L795
train
squareproton/Bond
lib/underscore.php
__.isNaN
public function isNaN($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); return self::_wrap(is_nan($item)); }
php
public function isNaN($item=null) { list($item) = self::_wrapArgs(func_get_args(), 1); return self::_wrap(is_nan($item)); }
[ "public", "function", "isNaN", "(", "$", "item", "=", "null", ")", "{", "list", "(", "$", "item", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "return", "self", "::", "_wrap", "(", "is_nan", "(", "$", "...
Is this item a NaN value?
[ "Is", "this", "item", "a", "NaN", "value?" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L799-L802
train
squareproton/Bond
lib/underscore.php
__.identity
public function identity() { $args = self::_wrapArgs(func_get_args(), 1); if(is_array($args)) return self::_wrap($args[0]); return self::_wrap(function($x) { return $x; }); }
php
public function identity() { $args = self::_wrapArgs(func_get_args(), 1); if(is_array($args)) return self::_wrap($args[0]); return self::_wrap(function($x) { return $x; }); }
[ "public", "function", "identity", "(", ")", "{", "$", "args", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "if", "(", "is_array", "(", "$", "args", ")", ")", "return", "self", "::", "_wrap", "(", "$", "args", ...
Returns the same value passed as the argument
[ "Returns", "the", "same", "value", "passed", "as", "the", "argument" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L806-L814
train
squareproton/Bond
lib/underscore.php
__.times
public function times($n=null, $iterator=null) { list($n, $iterator) = self::_wrapArgs(func_get_args(), 2); if(is_null($n)) $n = 0; for($i=0; $i<$n; $i++) $iterator($i); return self::_wrap(null); }
php
public function times($n=null, $iterator=null) { list($n, $iterator) = self::_wrapArgs(func_get_args(), 2); if(is_null($n)) $n = 0; for($i=0; $i<$n; $i++) $iterator($i); return self::_wrap(null); }
[ "public", "function", "times", "(", "$", "n", "=", "null", ",", "$", "iterator", "=", "null", ")", "{", "list", "(", "$", "n", ",", "$", "iterator", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "2", ")", ";", "if", ...
Invokes the iterator n times
[ "Invokes", "the", "iterator", "n", "times" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L830-L836
train
squareproton/Bond
lib/underscore.php
__.templateSettings
public function templateSettings($settings=null) { $_template_settings =& self::getInstance()->_template_settings; if(is_null($settings)) { $_template_settings = array( 'evaluate' => self::TEMPLATE_DEFAULT_EVALUATE, 'interpolate' => self::TEMPLATE_DEFAULT_INTERPOLATE, 'esca...
php
public function templateSettings($settings=null) { $_template_settings =& self::getInstance()->_template_settings; if(is_null($settings)) { $_template_settings = array( 'evaluate' => self::TEMPLATE_DEFAULT_EVALUATE, 'interpolate' => self::TEMPLATE_DEFAULT_INTERPOLATE, 'esca...
[ "public", "function", "templateSettings", "(", "$", "settings", "=", "null", ")", "{", "$", "_template_settings", "=", "&", "self", "::", "getInstance", "(", ")", "->", "_template_settings", ";", "if", "(", "is_null", "(", "$", "settings", ")", ")", "{", ...
Set template settings
[ "Set", "template", "settings" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L882-L900
train
squareproton/Bond
lib/underscore.php
__.template
public function template($code=null, $context=null) { list($code, $context) = self::_wrapArgs(func_get_args(), 2); $class_name = __CLASS__; $return = self::_wrap(function($context=null) use ($code, $class_name) { $ts = $class_name::getInstance()->_template_settings; // Wrap escaped,...
php
public function template($code=null, $context=null) { list($code, $context) = self::_wrapArgs(func_get_args(), 2); $class_name = __CLASS__; $return = self::_wrap(function($context=null) use ($code, $class_name) { $ts = $class_name::getInstance()->_template_settings; // Wrap escaped,...
[ "public", "function", "template", "(", "$", "code", "=", "null", ",", "$", "context", "=", "null", ")", "{", "list", "(", "$", "code", ",", "$", "context", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "2", ")", ";", "...
Compile templates into functions that can be evaluated for rendering
[ "Compile", "templates", "into", "functions", "that", "can", "be", "evaluated", "for", "rendering" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L904-L947
train
squareproton/Bond
lib/underscore.php
__.wrap
public function wrap($function=null, $wrapper=null) { list($function, $wrapper) = self::_wrapArgs(func_get_args(), 2); return self::_wrap(function() use ($wrapper, $function) { $args = array_merge(array($function), func_get_args()); return call_user_func_array($wrapper, $args); }); }
php
public function wrap($function=null, $wrapper=null) { list($function, $wrapper) = self::_wrapArgs(func_get_args(), 2); return self::_wrap(function() use ($wrapper, $function) { $args = array_merge(array($function), func_get_args()); return call_user_func_array($wrapper, $args); }); }
[ "public", "function", "wrap", "(", "$", "function", "=", "null", ",", "$", "wrapper", "=", "null", ")", "{", "list", "(", "$", "function", ",", "$", "wrapper", ")", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "2", ")", ";",...
Wraps the function inside the wrapper function, passing it as the first argument
[ "Wraps", "the", "function", "inside", "the", "wrapper", "function", "passing", "it", "as", "the", "first", "argument" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L1033-L1040
train
squareproton/Bond
lib/underscore.php
__.compose
public function compose() { $functions = self::_wrapArgs(func_get_args(), 1); return self::_wrap(function() use ($functions) { $args = func_get_args(); foreach($functions as $function) { $args[0] = call_user_func_array($function, $args); } return $args[0]; }); }
php
public function compose() { $functions = self::_wrapArgs(func_get_args(), 1); return self::_wrap(function() use ($functions) { $args = func_get_args(); foreach($functions as $function) { $args[0] = call_user_func_array($function, $args); } return $args[0]; }); }
[ "public", "function", "compose", "(", ")", "{", "$", "functions", "=", "self", "::", "_wrapArgs", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "return", "self", "::", "_wrap", "(", "function", "(", ")", "use", "(", "$", "functions", ")", "{", ...
Returns the composition of the functions
[ "Returns", "the", "composition", "of", "the", "functions" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L1044-L1054
train
squareproton/Bond
lib/underscore.php
__._wrap
private function _wrap($val) { if(isset($this) && isset($this->_chained) && $this->_chained) { $this->_wrapped = $val; return $this; } return $val; }
php
private function _wrap($val) { if(isset($this) && isset($this->_chained) && $this->_chained) { $this->_wrapped = $val; return $this; } return $val; }
[ "private", "function", "_wrap", "(", "$", "val", ")", "{", "if", "(", "isset", "(", "$", "this", ")", "&&", "isset", "(", "$", "this", "->", "_chained", ")", "&&", "$", "this", "->", "_chained", ")", "{", "$", "this", "->", "_wrapped", "=", "$", ...
Value passed from one chained method to the next
[ "Value", "passed", "from", "one", "chained", "method", "to", "the", "next" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L1089-L1095
train
squareproton/Bond
lib/underscore.php
__._wrapArgs
private function _wrapArgs($caller_args, $num_args=null) { $num_args = (is_null($num_args)) ? count($caller_args) - 1 : $num_args; $filled_args = array(); if(isset($this) && isset($this->_wrapped)) { $filled_args[] =& $this->_wrapped; } if(count($caller_args) > 0) { foreach($caller_...
php
private function _wrapArgs($caller_args, $num_args=null) { $num_args = (is_null($num_args)) ? count($caller_args) - 1 : $num_args; $filled_args = array(); if(isset($this) && isset($this->_wrapped)) { $filled_args[] =& $this->_wrapped; } if(count($caller_args) > 0) { foreach($caller_...
[ "private", "function", "_wrapArgs", "(", "$", "caller_args", ",", "$", "num_args", "=", "null", ")", "{", "$", "num_args", "=", "(", "is_null", "(", "$", "num_args", ")", ")", "?", "count", "(", "$", "caller_args", ")", "-", "1", ":", "$", "num_args"...
because this function understands both OO-style and functional calls
[ "because", "this", "function", "understands", "both", "OO", "-", "style", "and", "functional", "calls" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L1100-L1114
train
squareproton/Bond
lib/underscore.php
__._collection
private function _collection($collection) { return (!is_array($collection) && !is_object($collection)) ? str_split((string) $collection) : $collection; }
php
private function _collection($collection) { return (!is_array($collection) && !is_object($collection)) ? str_split((string) $collection) : $collection; }
[ "private", "function", "_collection", "(", "$", "collection", ")", "{", "return", "(", "!", "is_array", "(", "$", "collection", ")", "&&", "!", "is_object", "(", "$", "collection", ")", ")", "?", "str_split", "(", "(", "string", ")", "$", "collection", ...
Get a collection in a way that supports strings
[ "Get", "a", "collection", "in", "a", "way", "that", "supports", "strings" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/lib/underscore.php#L1118-L1120
train
jabernardo/console.php
src/Console/Input.php
Input.hasFlag
public function hasFlag($flag) { if (!is_string($flag)) { throw new \Console\Exception\InvalidArgument('Parameter must be string.'); } return in_array($flag, $this->_flags); }
php
public function hasFlag($flag) { if (!is_string($flag)) { throw new \Console\Exception\InvalidArgument('Parameter must be string.'); } return in_array($flag, $this->_flags); }
[ "public", "function", "hasFlag", "(", "$", "flag", ")", "{", "if", "(", "!", "is_string", "(", "$", "flag", ")", ")", "{", "throw", "new", "\\", "Console", "\\", "Exception", "\\", "InvalidArgument", "(", "'Parameter must be string.'", ")", ";", "}", "re...
Check if flag exists @access public @param string $flag Flag to be checked @return boolean True / False @throws \Console\Exception\InvalidArgument Parameter must be string
[ "Check", "if", "flag", "exists" ]
a526458f4d1a525d0ccff62cd9cfcfbc5526bc9c
https://github.com/jabernardo/console.php/blob/a526458f4d1a525d0ccff62cd9cfcfbc5526bc9c/src/Console/Input.php#L110-L116
train
jabernardo/console.php
src/Console/Input.php
Input.hasOption
public function hasOption($option) { if (!is_string($option)) { throw new \Console\Exception\InvalidArgument('Parameter must be string.'); } return isset($this->_options[$option]); }
php
public function hasOption($option) { if (!is_string($option)) { throw new \Console\Exception\InvalidArgument('Parameter must be string.'); } return isset($this->_options[$option]); }
[ "public", "function", "hasOption", "(", "$", "option", ")", "{", "if", "(", "!", "is_string", "(", "$", "option", ")", ")", "{", "throw", "new", "\\", "Console", "\\", "Exception", "\\", "InvalidArgument", "(", "'Parameter must be string.'", ")", ";", "}",...
Check if option exists @access public @param string $option Option name @return boolean True / False @throws \Console\Exception\InvalidArgument Parameter must be string
[ "Check", "if", "option", "exists" ]
a526458f4d1a525d0ccff62cd9cfcfbc5526bc9c
https://github.com/jabernardo/console.php/blob/a526458f4d1a525d0ccff62cd9cfcfbc5526bc9c/src/Console/Input.php#L126-L132
train
jabernardo/console.php
src/Console/Input.php
Input.hasOptions
public function hasOptions(array $options) { $all = true; foreach ($options as $option) { if (!isset($this->_options[$option])) { $all = false; } } return $all; }
php
public function hasOptions(array $options) { $all = true; foreach ($options as $option) { if (!isset($this->_options[$option])) { $all = false; } } return $all; }
[ "public", "function", "hasOptions", "(", "array", "$", "options", ")", "{", "$", "all", "=", "true", ";", "foreach", "(", "$", "options", "as", "$", "option", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_options", "[", "$", "option"...
Check if multiple options are given in the command-line arguments @access public @param array $options Options to be check @return boolean True / False
[ "Check", "if", "multiple", "options", "are", "given", "in", "the", "command", "-", "line", "arguments" ]
a526458f4d1a525d0ccff62cd9cfcfbc5526bc9c
https://github.com/jabernardo/console.php/blob/a526458f4d1a525d0ccff62cd9cfcfbc5526bc9c/src/Console/Input.php#L141-L151
train
jabernardo/console.php
src/Console/Input.php
Input.getOption
public function getOption($option) { return isset($this->_options[$option]) ? $this->_options[$option] : null; }
php
public function getOption($option) { return isset($this->_options[$option]) ? $this->_options[$option] : null; }
[ "public", "function", "getOption", "(", "$", "option", ")", "{", "return", "isset", "(", "$", "this", "->", "_options", "[", "$", "option", "]", ")", "?", "$", "this", "->", "_options", "[", "$", "option", "]", ":", "null", ";", "}" ]
Get option value @access public @param string $option Option name @return mixed
[ "Get", "option", "value" ]
a526458f4d1a525d0ccff62cd9cfcfbc5526bc9c
https://github.com/jabernardo/console.php/blob/a526458f4d1a525d0ccff62cd9cfcfbc5526bc9c/src/Console/Input.php#L160-L164
train
makinacorpus/drupal-apubsub
src/Notification/AbstractNotificationFormatter.php
AbstractNotificationFormatter.getUserAccountName
protected function getUserAccountName(NotificationInterface $notification, $keyInData = 'uid') { $names = []; $count = 0; if (isset($notification[$keyInData])) { $uidList = $notification[$keyInData]; $count = count($uidList); if (!is_array($uidList)...
php
protected function getUserAccountName(NotificationInterface $notification, $keyInData = 'uid') { $names = []; $count = 0; if (isset($notification[$keyInData])) { $uidList = $notification[$keyInData]; $count = count($uidList); if (!is_array($uidList)...
[ "protected", "function", "getUserAccountName", "(", "NotificationInterface", "$", "notification", ",", "$", "keyInData", "=", "'uid'", ")", "{", "$", "names", "=", "[", "]", ";", "$", "count", "=", "0", ";", "if", "(", "isset", "(", "$", "notification", ...
Return user account name for given uid @param NotificationInterface $notification @param string $keyInData Key in notification data in which to search for user names @return string
[ "Return", "user", "account", "name", "for", "given", "uid" ]
534fbecf67c880996ae02210c0bfdb3e0d3699b6
https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Notification/AbstractNotificationFormatter.php#L90-L114
train
makinacorpus/drupal-apubsub
src/Notification/AbstractNotificationFormatter.php
AbstractNotificationFormatter.getTitleString
protected function getTitleString($titles, $count) { $limit = $this->getLimit(); $okCount = count($titles); $missing = $count - $okCount; $andCount = max([0, $okCount - $limit]) + $missing; if (!$okCount) { list($singular, $plural) = $this->getTypeLa...
php
protected function getTitleString($titles, $count) { $limit = $this->getLimit(); $okCount = count($titles); $missing = $count - $okCount; $andCount = max([0, $okCount - $limit]) + $missing; if (!$okCount) { list($singular, $plural) = $this->getTypeLa...
[ "protected", "function", "getTitleString", "(", "$", "titles", ",", "$", "count", ")", "{", "$", "limit", "=", "$", "this", "->", "getLimit", "(", ")", ";", "$", "okCount", "=", "count", "(", "$", "titles", ")", ";", "$", "missing", "=", "$", "coun...
Get title string @param string $titles @param int $count @return string
[ "Get", "title", "string" ]
534fbecf67c880996ae02210c0bfdb3e0d3699b6
https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Notification/AbstractNotificationFormatter.php#L135-L164
train
wb-crowdfusion/crowdfusion
system/core/classes/libraries/validation/Errors.php
Errors.addFieldError
public function addFieldError($failureCode, $fieldResolved, $fieldType, $fieldTitle, $value, $defaultErrorMessage) { $this->errors[] = new FieldValidationError($failureCode, $fieldResolved, $fieldType, $fieldTitle, $value, $defaultErrorMessage); return $this; }
php
public function addFieldError($failureCode, $fieldResolved, $fieldType, $fieldTitle, $value, $defaultErrorMessage) { $this->errors[] = new FieldValidationError($failureCode, $fieldResolved, $fieldType, $fieldTitle, $value, $defaultErrorMessage); return $this; }
[ "public", "function", "addFieldError", "(", "$", "failureCode", ",", "$", "fieldResolved", ",", "$", "fieldType", ",", "$", "fieldTitle", ",", "$", "value", ",", "$", "defaultErrorMessage", ")", "{", "$", "this", "->", "errors", "[", "]", "=", "new", "Fi...
Adds an error that is associated with a form field. @param string $failureCode The code or slug that identifies this error's failure cause @param string $fieldResolved The machine-readable error code that uniquely identifies the error @param string $fieldType Can be 'field', 'meta', or 'tag' to...
[ "Adds", "an", "error", "that", "is", "associated", "with", "a", "form", "field", "." ]
8cad7988f046a6fefbed07d026cb4ae6706c1217
https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/validation/Errors.php#L93-L97
train
wb-crowdfusion/crowdfusion
system/core/classes/libraries/validation/Errors.php
Errors.addErrors
public function addErrors(array $errors) { foreach ($errors as $error) { if (!$error instanceof ValidationError) throw new Exception('Error was not instance of ValidationError: '.$error); if (!in_array($error, $this->errors)) $this->errors[] = $error; ...
php
public function addErrors(array $errors) { foreach ($errors as $error) { if (!$error instanceof ValidationError) throw new Exception('Error was not instance of ValidationError: '.$error); if (!in_array($error, $this->errors)) $this->errors[] = $error; ...
[ "public", "function", "addErrors", "(", "array", "$", "errors", ")", "{", "foreach", "(", "$", "errors", "as", "$", "error", ")", "{", "if", "(", "!", "$", "error", "instanceof", "ValidationError", ")", "throw", "new", "Exception", "(", "'Error was not ins...
Adds more than one error to the collection of errors @param array $errors Each object in the array must be of type ValidationError @return this
[ "Adds", "more", "than", "one", "error", "to", "the", "collection", "of", "errors" ]
8cad7988f046a6fefbed07d026cb4ae6706c1217
https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/validation/Errors.php#L119-L129
train