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
dazzle-php/throwable
src/Throwable/Throwable.php
Throwable.getThrowableStack
public static function getThrowableStack($ex, &$data = [], $offset = 0) { $data = static::getThrowableData($ex, $offset); if (($current = $ex->getPrevious()) !== null) { static::getThrowableStack($current, $data['prev'], count(static::getTraceElements($ex))); } return $data; }
php
public static function getThrowableStack($ex, &$data = [], $offset = 0) { $data = static::getThrowableData($ex, $offset); if (($current = $ex->getPrevious()) !== null) { static::getThrowableStack($current, $data['prev'], count(static::getTraceElements($ex))); } return $data; }
[ "public", "static", "function", "getThrowableStack", "(", "$", "ex", ",", "&", "$", "data", "=", "[", "]", ",", "$", "offset", "=", "0", ")", "{", "$", "data", "=", "static", "::", "getThrowableData", "(", "$", "ex", ",", "$", "offset", ")", ";", ...
Return throwable stack in recursive array format. @param \Error|\Exception $ex @param string[] &$data @param int $offset @return mixed
[ "Return", "throwable", "stack", "in", "recursive", "array", "format", "." ]
daeec7b8857763765db686412886831704720bd0
https://github.com/dazzle-php/throwable/blob/daeec7b8857763765db686412886831704720bd0/src/Throwable/Throwable.php#L41-L51
train
dazzle-php/throwable
src/Throwable/Throwable.php
Throwable.getThrowableData
public static function getThrowableData($ex, $offset = 0) { return [ 'message' => $ex->getMessage(), 'class' => get_class($ex), 'file' => $ex->getFile(), 'line' => $ex->getLine(), 'code' => $ex->getCode(), 'trace' => static::getTraceElements($ex, $offset), 'isError' => $ex instanceof \Error, 'prev' => null ]; }
php
public static function getThrowableData($ex, $offset = 0) { return [ 'message' => $ex->getMessage(), 'class' => get_class($ex), 'file' => $ex->getFile(), 'line' => $ex->getLine(), 'code' => $ex->getCode(), 'trace' => static::getTraceElements($ex, $offset), 'isError' => $ex instanceof \Error, 'prev' => null ]; }
[ "public", "static", "function", "getThrowableData", "(", "$", "ex", ",", "$", "offset", "=", "0", ")", "{", "return", "[", "'message'", "=>", "$", "ex", "->", "getMessage", "(", ")", ",", "'class'", "=>", "get_class", "(", "$", "ex", ")", ",", "'file...
Return throwable data in array format. @param \Error|\Exception $ex @param int $offset @return string[]
[ "Return", "throwable", "data", "in", "array", "format", "." ]
daeec7b8857763765db686412886831704720bd0
https://github.com/dazzle-php/throwable/blob/daeec7b8857763765db686412886831704720bd0/src/Throwable/Throwable.php#L60-L72
train
ansas/php-component
src/Util/Html.php
Html.stripTags
public static function stripTags($html, $allowable = []) { if (!is_array($allowable)) { $allowable = preg_split("/, */", $allowable, -1, PREG_SPLIT_NO_EMPTY); } if ($allowable) { return strip_tags($html, '<' . implode('><', $allowable) . '>'); } return strip_tags($html); }
php
public static function stripTags($html, $allowable = []) { if (!is_array($allowable)) { $allowable = preg_split("/, */", $allowable, -1, PREG_SPLIT_NO_EMPTY); } if ($allowable) { return strip_tags($html, '<' . implode('><', $allowable) . '>'); } return strip_tags($html); }
[ "public", "static", "function", "stripTags", "(", "$", "html", ",", "$", "allowable", "=", "[", "]", ")", "{", "if", "(", "!", "is_array", "(", "$", "allowable", ")", ")", "{", "$", "allowable", "=", "preg_split", "(", "\"/, */\"", ",", "$", "allowab...
Remove tags. @param string $html @param string|array $allowable [optional] Tags to keep. @return string
[ "Remove", "tags", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Util/Html.php#L103-L114
train
paulbunyannet/wordpress-artisan
src/Commands/Wordpress/SecretKey/Create.php
Create.handle
public function handle() { /** @var string $path path to the env file */ $path = $this->getFilePath(); if (!file_exists($path)) { file_put_contents($path, ""); } /** @var string $content current content in the env file */ $content = file_get_contents($path); foreach ($this->generateKeys() as $key) { /** try and match the value in the env file by regex, if not * found then append the key to the bottom of the * file */ preg_match($key['regex'], $content, $matches); if ($matches) { $content = preg_replace($key['regex'], $key['value'], $content); } else { $content .= $key['value'] . PHP_EOL; } } /** apply changes */ file_put_contents($path, $content); $this->info('Wordpress keys regenerated'); }
php
public function handle() { /** @var string $path path to the env file */ $path = $this->getFilePath(); if (!file_exists($path)) { file_put_contents($path, ""); } /** @var string $content current content in the env file */ $content = file_get_contents($path); foreach ($this->generateKeys() as $key) { /** try and match the value in the env file by regex, if not * found then append the key to the bottom of the * file */ preg_match($key['regex'], $content, $matches); if ($matches) { $content = preg_replace($key['regex'], $key['value'], $content); } else { $content .= $key['value'] . PHP_EOL; } } /** apply changes */ file_put_contents($path, $content); $this->info('Wordpress keys regenerated'); }
[ "public", "function", "handle", "(", ")", "{", "/** @var string $path path to the env file */", "$", "path", "=", "$", "this", "->", "getFilePath", "(", ")", ";", "if", "(", "!", "file_exists", "(", "$", "path", ")", ")", "{", "file_put_contents", "(", "$", ...
Handle generating the Wordpress auth keys
[ "Handle", "generating", "the", "Wordpress", "auth", "keys" ]
05518f8aa5d0f31090d0c2a891e4f4d0239a65bc
https://github.com/paulbunyannet/wordpress-artisan/blob/05518f8aa5d0f31090d0c2a891e4f4d0239a65bc/src/Commands/Wordpress/SecretKey/Create.php#L66-L92
train
paulbunyannet/wordpress-artisan
src/Commands/Wordpress/SecretKey/Create.php
Create.generateKeys
private function generateKeys() { $content = []; for ($i = 0; $i < count($this->keys); $i++) { $holder = []; $value = !$this->option($this->keys[$i]) || $this->option($this->keys[$i]) === 'generate' ? str_random(64) : $this->option($this->keys[$i]); $holder['regex'] = str_replace_first($this->findRegExPlaceholder, $this->keys[$i], $this->findRegEx); $holder['value'] = $this->keys[$i] . '="' . $value . '"'; array_push($content, $holder); } return $content; }
php
private function generateKeys() { $content = []; for ($i = 0; $i < count($this->keys); $i++) { $holder = []; $value = !$this->option($this->keys[$i]) || $this->option($this->keys[$i]) === 'generate' ? str_random(64) : $this->option($this->keys[$i]); $holder['regex'] = str_replace_first($this->findRegExPlaceholder, $this->keys[$i], $this->findRegEx); $holder['value'] = $this->keys[$i] . '="' . $value . '"'; array_push($content, $holder); } return $content; }
[ "private", "function", "generateKeys", "(", ")", "{", "$", "content", "=", "[", "]", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "count", "(", "$", "this", "->", "keys", ")", ";", "$", "i", "++", ")", "{", "$", "holder", "=", "...
Generate regex used for replacing the key value in the env file and the value that should be used in place @return array
[ "Generate", "regex", "used", "for", "replacing", "the", "key", "value", "in", "the", "env", "file", "and", "the", "value", "that", "should", "be", "used", "in", "place" ]
05518f8aa5d0f31090d0c2a891e4f4d0239a65bc
https://github.com/paulbunyannet/wordpress-artisan/blob/05518f8aa5d0f31090d0c2a891e4f4d0239a65bc/src/Commands/Wordpress/SecretKey/Create.php#L109-L121
train
mrclay/UserlandSession
src/UserlandSession/Util/Php53Adapter.php
Php53Adapter.setSaveHandler
public static function setSaveHandler(\SessionHandlerInterface $handler) { return session_set_save_handler( array($handler, 'open'), array($handler, 'close'), array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc') ); }
php
public static function setSaveHandler(\SessionHandlerInterface $handler) { return session_set_save_handler( array($handler, 'open'), array($handler, 'close'), array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc') ); }
[ "public", "static", "function", "setSaveHandler", "(", "\\", "SessionHandlerInterface", "$", "handler", ")", "{", "return", "session_set_save_handler", "(", "array", "(", "$", "handler", ",", "'open'", ")", ",", "array", "(", "$", "handler", ",", "'close'", ")...
Use a SessionHandlerInterface object as a native session handler @param \SessionHandlerInterface $handler @return bool
[ "Use", "a", "SessionHandlerInterface", "object", "as", "a", "native", "session", "handler" ]
deabb1b487294efbd0bcb79ca83e6dab56036e45
https://github.com/mrclay/UserlandSession/blob/deabb1b487294efbd0bcb79ca83e6dab56036e45/src/UserlandSession/Util/Php53Adapter.php#L17-L27
train
laravie/predis-async
src/Monitor/Consumer.php
Consumer.parsePayload
protected function parsePayload($payload) { $database = 0; $client = null; $pregCallback = function ($matches) use (&$database, &$client) { if (2 === $count = \count($matches)) { // Redis <= 2.4 $database = (int) $matches[1]; } if (4 === $count) { // Redis >= 2.6 $database = (int) $matches[2]; $client = $matches[3]; } return ' '; }; $event = \preg_replace_callback('/ \(db (\d+)\) | \[(\d+) (.*?)\] /', $pregCallback, $payload, 1); @list($timestamp, $command, $arguments) = \explode(' ', $event, 3); return (object) [ 'timestamp' => (float) $timestamp, 'database' => $database, 'client' => $client, 'command' => \substr($command, 1, -1), 'arguments' => $arguments, ]; }
php
protected function parsePayload($payload) { $database = 0; $client = null; $pregCallback = function ($matches) use (&$database, &$client) { if (2 === $count = \count($matches)) { // Redis <= 2.4 $database = (int) $matches[1]; } if (4 === $count) { // Redis >= 2.6 $database = (int) $matches[2]; $client = $matches[3]; } return ' '; }; $event = \preg_replace_callback('/ \(db (\d+)\) | \[(\d+) (.*?)\] /', $pregCallback, $payload, 1); @list($timestamp, $command, $arguments) = \explode(' ', $event, 3); return (object) [ 'timestamp' => (float) $timestamp, 'database' => $database, 'client' => $client, 'command' => \substr($command, 1, -1), 'arguments' => $arguments, ]; }
[ "protected", "function", "parsePayload", "(", "$", "payload", ")", "{", "$", "database", "=", "0", ";", "$", "client", "=", "null", ";", "$", "pregCallback", "=", "function", "(", "$", "matches", ")", "use", "(", "&", "$", "database", ",", "&", "$", ...
Parses the response string returned by the server into an object. @param string $payload Payload string. @return object
[ "Parses", "the", "response", "string", "returned", "by", "the", "server", "into", "an", "object", "." ]
dd98b10e752b1ed339c9c6e798b33c8810ecda2a
https://github.com/laravie/predis-async/blob/dd98b10e752b1ed339c9c6e798b33c8810ecda2a/src/Monitor/Consumer.php#L43-L73
train
Celarius/spin-framework
src/Core/RouteGroup.php
RouteGroup.addRoute
public function addRoute(array $methods, string $path, string $handler) { $this->routeCollector->addRoute( $methods, $this->getPrefix().$path, $handler ); return $this; }
php
public function addRoute(array $methods, string $path, string $handler) { $this->routeCollector->addRoute( $methods, $this->getPrefix().$path, $handler ); return $this; }
[ "public", "function", "addRoute", "(", "array", "$", "methods", ",", "string", "$", "path", ",", "string", "$", "handler", ")", "{", "$", "this", "->", "routeCollector", "->", "addRoute", "(", "$", "methods", ",", "$", "this", "->", "getPrefix", "(", "...
Add a new route in the route collector @param array $methods The methods @param string $path [description] @param string $handler [description] @return self
[ "Add", "a", "new", "route", "in", "the", "route", "collector" ]
2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0
https://github.com/Celarius/spin-framework/blob/2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0/src/Core/RouteGroup.php#L98-L107
train
Celarius/spin-framework
src/Factories/ContainerFactory.php
ContainerFactory.createContainer
public function createContainer() { # Create the container $container = new Container; # If we have auto-wire option on ... if (($this->options['autowire'] ?? false)) { # Add reflection delegate, so auto-wiring is possible $container->delegate( new ReflectionContainer ); } \logger()->debug('Created PSR-11 Container (The Leauge Container)'); return $container; }
php
public function createContainer() { # Create the container $container = new Container; # If we have auto-wire option on ... if (($this->options['autowire'] ?? false)) { # Add reflection delegate, so auto-wiring is possible $container->delegate( new ReflectionContainer ); } \logger()->debug('Created PSR-11 Container (The Leauge Container)'); return $container; }
[ "public", "function", "createContainer", "(", ")", "{", "# Create the container", "$", "container", "=", "new", "Container", ";", "# If we have auto-wire option on ...", "if", "(", "(", "$", "this", "->", "options", "[", "'autowire'", "]", "??", "false", ")", ")...
Create a new container @return \Psr\Container\ContainerInterface
[ "Create", "a", "new", "container" ]
2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0
https://github.com/Celarius/spin-framework/blob/2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0/src/Factories/ContainerFactory.php#L30-L44
train
honeybee/trellis
src/Runtime/Entity/Transform/Transformation.php
Transformation.apply
public function apply(EntityInterface $entity, SpecificationInterface $specification) { $attribute_name = $specification->getOption('attribute', $specification->getName()); $entity_value = $entity->getValue($attribute_name); return $entity_value; }
php
public function apply(EntityInterface $entity, SpecificationInterface $specification) { $attribute_name = $specification->getOption('attribute', $specification->getName()); $entity_value = $entity->getValue($attribute_name); return $entity_value; }
[ "public", "function", "apply", "(", "EntityInterface", "$", "entity", ",", "SpecificationInterface", "$", "specification", ")", "{", "$", "attribute_name", "=", "$", "specification", "->", "getOption", "(", "'attribute'", ",", "$", "specification", "->", "getName"...
Transform the entity value, which is described by the given attributespec, to it's output representation. @param EntityInterface $entity @param SpecificationInterface $specification @return mixed
[ "Transform", "the", "entity", "value", "which", "is", "described", "by", "the", "given", "attributespec", "to", "it", "s", "output", "representation", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/Entity/Transform/Transformation.php#L19-L25
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/LocalRecords/Model/RecordQueryBuilder.php
RecordQueryBuilder.getMapRecords
public function getMapRecords($mapUid, $nbLaps, $sort, $nbRecords) { $query = new RecordQuery(); $query->filterByMapuid($mapUid); $query->filterByNblaps($nbLaps); $query->orderByScore($sort); $query->limit($nbRecords); $result = $query->find(); $result->populateRelation('Player'); RecordTableMap::clearInstancePool(); return $result->getData(); }
php
public function getMapRecords($mapUid, $nbLaps, $sort, $nbRecords) { $query = new RecordQuery(); $query->filterByMapuid($mapUid); $query->filterByNblaps($nbLaps); $query->orderByScore($sort); $query->limit($nbRecords); $result = $query->find(); $result->populateRelation('Player'); RecordTableMap::clearInstancePool(); return $result->getData(); }
[ "public", "function", "getMapRecords", "(", "$", "mapUid", ",", "$", "nbLaps", ",", "$", "sort", ",", "$", "nbRecords", ")", "{", "$", "query", "=", "new", "RecordQuery", "(", ")", ";", "$", "query", "->", "filterByMapuid", "(", "$", "mapUid", ")", "...
Get records on a certain map. @param $mapUid @param $nbLaps @param $sort @param $nbRecords @return Record[]|\Propel\Runtime\Collection\ObjectCollection
[ "Get", "records", "on", "a", "certain", "map", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/LocalRecords/Model/RecordQueryBuilder.php#L26-L39
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/LocalRecords/Model/RecordQueryBuilder.php
RecordQueryBuilder.getPlayerMapRecords
public function getPlayerMapRecords($mapUid, $nbLaps, $logins) { $query = new RecordQuery(); $query->filterByMapuid($mapUid); $query->filterByNblaps($nbLaps); $query->filterByPlayerLogins($logins); $result = $query->find(); $result->populateRelation('Player'); RecordTableMap::clearInstancePool(); return $result->getData(); }
php
public function getPlayerMapRecords($mapUid, $nbLaps, $logins) { $query = new RecordQuery(); $query->filterByMapuid($mapUid); $query->filterByNblaps($nbLaps); $query->filterByPlayerLogins($logins); $result = $query->find(); $result->populateRelation('Player'); RecordTableMap::clearInstancePool(); return $result->getData(); }
[ "public", "function", "getPlayerMapRecords", "(", "$", "mapUid", ",", "$", "nbLaps", ",", "$", "logins", ")", "{", "$", "query", "=", "new", "RecordQuery", "(", ")", ";", "$", "query", "->", "filterByMapuid", "(", "$", "mapUid", ")", ";", "$", "query",...
Get a players record on a certain map. @param $mapUid @param $nbLaps @param $logins @return Record[]|\Propel\Runtime\Collection\ObjectCollection
[ "Get", "a", "players", "record", "on", "a", "certain", "map", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/LocalRecords/Model/RecordQueryBuilder.php#L50-L62
train
anklimsk/cakephp-theme
Vendor/PhpUnoconv/monolog/monolog/src/Monolog/Handler/SocketHandler.php
SocketHandler.closeSocket
public function closeSocket() { if (is_resource($this->resource)) { fclose($this->resource); $this->resource = null; } }
php
public function closeSocket() { if (is_resource($this->resource)) { fclose($this->resource); $this->resource = null; } }
[ "public", "function", "closeSocket", "(", ")", "{", "if", "(", "is_resource", "(", "$", "this", "->", "resource", ")", ")", "{", "fclose", "(", "$", "this", "->", "resource", ")", ";", "$", "this", "->", "resource", "=", "null", ";", "}", "}" ]
Close socket, if open
[ "Close", "socket", "if", "open" ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Vendor/PhpUnoconv/monolog/monolog/src/Monolog/Handler/SocketHandler.php#L75-L81
train
honeybee/trellis
src/CodeGen/Parser/Schema/Document.php
Document.handleErrors
public function handleErrors($msg_prefix = '', $msg_suffix = '', $user_error_handling = false) { if (libxml_get_last_error() !== false) { $errors = libxml_get_errors(); libxml_clear_errors(); libxml_use_internal_errors($user_error_handling); throw new DOMException( $msg_prefix . $this->getErrorMessage($errors) . $msg_suffix ); } libxml_use_internal_errors($user_error_handling); }
php
public function handleErrors($msg_prefix = '', $msg_suffix = '', $user_error_handling = false) { if (libxml_get_last_error() !== false) { $errors = libxml_get_errors(); libxml_clear_errors(); libxml_use_internal_errors($user_error_handling); throw new DOMException( $msg_prefix . $this->getErrorMessage($errors) . $msg_suffix ); } libxml_use_internal_errors($user_error_handling); }
[ "public", "function", "handleErrors", "(", "$", "msg_prefix", "=", "''", ",", "$", "msg_suffix", "=", "''", ",", "$", "user_error_handling", "=", "false", ")", "{", "if", "(", "libxml_get_last_error", "(", ")", "!==", "false", ")", "{", "$", "errors", "=...
Checks for internal libxml errors and throws them in form of a single DOMException. If no errors occured, then nothing happens. @param string $msg_prefix Is prepended to the libxml error message. @param string $msg_suffix Is appended to the libxml error message. @param bool $user_error_handling Allows to enable or disable internal libxml error handling. @throws DOMException
[ "Checks", "for", "internal", "libxml", "errors", "and", "throws", "them", "in", "form", "of", "a", "single", "DOMException", ".", "If", "no", "errors", "occured", "then", "nothing", "happens", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/CodeGen/Parser/Schema/Document.php#L92-L107
train
honeybee/trellis
src/CodeGen/Parser/Schema/Document.php
Document.getErrorMessage
protected function getErrorMessage(array $errors) { $error_message = ''; foreach ($errors as $error) { $error_message .= $this->parseError($error) . PHP_EOL . PHP_EOL; } return $error_message; }
php
protected function getErrorMessage(array $errors) { $error_message = ''; foreach ($errors as $error) { $error_message .= $this->parseError($error) . PHP_EOL . PHP_EOL; } return $error_message; }
[ "protected", "function", "getErrorMessage", "(", "array", "$", "errors", ")", "{", "$", "error_message", "=", "''", ";", "foreach", "(", "$", "errors", "as", "$", "error", ")", "{", "$", "error_message", ".=", "$", "this", "->", "parseError", "(", "$", ...
Converts a given list of libxml errors into an error report. @param array $errors @return string
[ "Converts", "a", "given", "list", "of", "libxml", "errors", "into", "an", "error", "report", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/CodeGen/Parser/Schema/Document.php#L116-L124
train
honeybee/trellis
src/CodeGen/Parser/Schema/Document.php
Document.parseError
protected function parseError(LibXMLError $error) { $prefix_map = [ LIBXML_ERR_WARNING => '[warning]', LIBXML_ERR_FATAL => '[fatal]', LIBXML_ERR_ERROR => '[error]' ]; $prefix = isset($prefix_map[$error->level]) ? $prefix_map[$error->level] : $prefix_map[LIBXML_ERR_ERROR]; $msg_parts = []; $msg_parts[] = sprintf('%s %s: %s', $prefix, $error->level, trim($error->message)); $msg_parts[] = sprintf('Line: %d', $error->line); $msg_parts[] = sprintf('Column: %d', $error->column); if ($error->file) { $msg_parts[] = sprintf('File: %s', $error->file); } return implode(PHP_EOL, $msg_parts); }
php
protected function parseError(LibXMLError $error) { $prefix_map = [ LIBXML_ERR_WARNING => '[warning]', LIBXML_ERR_FATAL => '[fatal]', LIBXML_ERR_ERROR => '[error]' ]; $prefix = isset($prefix_map[$error->level]) ? $prefix_map[$error->level] : $prefix_map[LIBXML_ERR_ERROR]; $msg_parts = []; $msg_parts[] = sprintf('%s %s: %s', $prefix, $error->level, trim($error->message)); $msg_parts[] = sprintf('Line: %d', $error->line); $msg_parts[] = sprintf('Column: %d', $error->column); if ($error->file) { $msg_parts[] = sprintf('File: %s', $error->file); } return implode(PHP_EOL, $msg_parts); }
[ "protected", "function", "parseError", "(", "LibXMLError", "$", "error", ")", "{", "$", "prefix_map", "=", "[", "LIBXML_ERR_WARNING", "=>", "'[warning]'", ",", "LIBXML_ERR_FATAL", "=>", "'[fatal]'", ",", "LIBXML_ERR_ERROR", "=>", "'[error]'", "]", ";", "$", "pre...
Converts a given libxml error into an error message. @param LibXMLError $error @return string
[ "Converts", "a", "given", "libxml", "error", "into", "an", "error", "message", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/CodeGen/Parser/Schema/Document.php#L133-L151
train
mridang/pearify
src/Pearify/Utils/TokenUtils.php
TokenUtils.positionForSequence
public static function positionForSequence(array $sequence, $tokens, $startFrom = null) { $seqIterator = (new ArrayObject($sequence))->getIterator(); $tokenIterator = (new ArrayObject($tokens))->getIterator(); if ($startFrom != null) { $tokenIterator->seek($startFrom); } while ($tokenIterator->valid()) { $seqIterator->rewind(); $keys = array(); list($allowedTokens, $timesAllowed) = $seqIterator->current(); self::seekToNextType($tokenIterator, $allowedTokens); while ($tokenIterator->valid()) { if (!$seqIterator->valid()) { $first = array_shift($keys); $last = array_pop($keys); return array($first, $last); } list($allowedTokens, $timesAllowed) = $seqIterator->current(); if ($timesAllowed == '*') { while ($tokenIterator->valid() && self::isTokenType($tokenIterator->current(), $allowedTokens)) { $keys[] = $tokenIterator->key(); $tokenIterator->next(); } } else { for ($i = 0; $i < $timesAllowed; $i++) { if (self::isTokenType($tokenIterator->current(), $allowedTokens)) { $keys[] = $tokenIterator->key(); $tokenIterator->next(); } else { continue 3; } } } $seqIterator->next(); } } }
php
public static function positionForSequence(array $sequence, $tokens, $startFrom = null) { $seqIterator = (new ArrayObject($sequence))->getIterator(); $tokenIterator = (new ArrayObject($tokens))->getIterator(); if ($startFrom != null) { $tokenIterator->seek($startFrom); } while ($tokenIterator->valid()) { $seqIterator->rewind(); $keys = array(); list($allowedTokens, $timesAllowed) = $seqIterator->current(); self::seekToNextType($tokenIterator, $allowedTokens); while ($tokenIterator->valid()) { if (!$seqIterator->valid()) { $first = array_shift($keys); $last = array_pop($keys); return array($first, $last); } list($allowedTokens, $timesAllowed) = $seqIterator->current(); if ($timesAllowed == '*') { while ($tokenIterator->valid() && self::isTokenType($tokenIterator->current(), $allowedTokens)) { $keys[] = $tokenIterator->key(); $tokenIterator->next(); } } else { for ($i = 0; $i < $timesAllowed; $i++) { if (self::isTokenType($tokenIterator->current(), $allowedTokens)) { $keys[] = $tokenIterator->key(); $tokenIterator->next(); } else { continue 3; } } } $seqIterator->next(); } } }
[ "public", "static", "function", "positionForSequence", "(", "array", "$", "sequence", ",", "$", "tokens", ",", "$", "startFrom", "=", "null", ")", "{", "$", "seqIterator", "=", "(", "new", "ArrayObject", "(", "$", "sequence", ")", ")", "->", "getIterator",...
Utility method to find a sequence of tokens matching the specified tokenisation pattern. @param array $sequence the tokenisation sequence pattern to match @param array $tokens the array of tokens to match as returned by token_get_all @param int $startFrom an optional starting index from which to begin searching @return array the start and end position of the tokenisation sequence pattern
[ "Utility", "method", "to", "find", "a", "sequence", "of", "tokens", "matching", "the", "specified", "tokenisation", "pattern", "." ]
7bc0710beb4165164e07f88b456de47cad8b3002
https://github.com/mridang/pearify/blob/7bc0710beb4165164e07f88b456de47cad8b3002/src/Pearify/Utils/TokenUtils.php#L47-L87
train
mridang/pearify
src/Pearify/Utils/TokenUtils.php
TokenUtils.seekToNextType
private static function seekToNextType(ArrayIterator $tokenIterator, $type) { while ($tokenIterator->valid()) { if (self::isTokenType($tokenIterator->current(), $type)) { return; } $tokenIterator->next(); } }
php
private static function seekToNextType(ArrayIterator $tokenIterator, $type) { while ($tokenIterator->valid()) { if (self::isTokenType($tokenIterator->current(), $type)) { return; } $tokenIterator->next(); } }
[ "private", "static", "function", "seekToNextType", "(", "ArrayIterator", "$", "tokenIterator", ",", "$", "type", ")", "{", "while", "(", "$", "tokenIterator", "->", "valid", "(", ")", ")", "{", "if", "(", "self", "::", "isTokenType", "(", "$", "tokenIterat...
Seeks ahead using the iterator until the next token matching the type @param ArrayIterator $tokenIterator the token iterator to seek @param array $type the type of the token seek to
[ "Seeks", "ahead", "using", "the", "iterator", "until", "the", "next", "token", "matching", "the", "type" ]
7bc0710beb4165164e07f88b456de47cad8b3002
https://github.com/mridang/pearify/blob/7bc0710beb4165164e07f88b456de47cad8b3002/src/Pearify/Utils/TokenUtils.php#L142-L150
train
mridang/pearify
src/Pearify/Utils/TokenUtils.php
TokenUtils.isTokenType
public static function isTokenType($token, $types) { if (!is_array($types)) { $types = array($types); } return is_array($token) ? in_array($token[0], $types) : in_array($token, $types); }
php
public static function isTokenType($token, $types) { if (!is_array($types)) { $types = array($types); } return is_array($token) ? in_array($token[0], $types) : in_array($token, $types); }
[ "public", "static", "function", "isTokenType", "(", "$", "token", ",", "$", "types", ")", "{", "if", "(", "!", "is_array", "(", "$", "types", ")", ")", "{", "$", "types", "=", "array", "(", "$", "types", ")", ";", "}", "return", "is_array", "(", ...
Checks whether a given token is any one of the specified token types @param array $token the token to check @param array|int $types the array of types @return bool true if the token matches one the types
[ "Checks", "whether", "a", "given", "token", "is", "any", "one", "of", "the", "specified", "token", "types" ]
7bc0710beb4165164e07f88b456de47cad8b3002
https://github.com/mridang/pearify/blob/7bc0710beb4165164e07f88b456de47cad8b3002/src/Pearify/Utils/TokenUtils.php#L159-L165
train
ansas/php-component
src/Component/Locale/Locales.php
Locales.addLocale
public function addLocale($locale) { // Get sanitized locale $locale = Locale::sanitizeLocale($locale); if (!isset($this->available[$locale])) { $locale = new Locale($locale); $this->available[$locale->getLocale()] = $locale; } return $this; }
php
public function addLocale($locale) { // Get sanitized locale $locale = Locale::sanitizeLocale($locale); if (!isset($this->available[$locale])) { $locale = new Locale($locale); $this->available[$locale->getLocale()] = $locale; } return $this; }
[ "public", "function", "addLocale", "(", "$", "locale", ")", "{", "// Get sanitized locale", "$", "locale", "=", "Locale", "::", "sanitizeLocale", "(", "$", "locale", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "available", "[", "$", "local...
Add locale to available locales. @param string|Locale $locale @return $this
[ "Add", "locale", "to", "available", "locales", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Locale/Locales.php#L54-L66
train
ansas/php-component
src/Component/Locale/Locales.php
Locales.findByCountry
public function findByCountry($country) { $country = Text::toUpper($country); foreach ($this->getAvailable() as $locale) { if ($country == $locale->getCountry(Text::UPPER)) { return $locale; } } return null; }
php
public function findByCountry($country) { $country = Text::toUpper($country); foreach ($this->getAvailable() as $locale) { if ($country == $locale->getCountry(Text::UPPER)) { return $locale; } } return null; }
[ "public", "function", "findByCountry", "(", "$", "country", ")", "{", "$", "country", "=", "Text", "::", "toUpper", "(", "$", "country", ")", ";", "foreach", "(", "$", "this", "->", "getAvailable", "(", ")", "as", "$", "locale", ")", "{", "if", "(", ...
Get locale with specified country. @param $country @return Locale|null
[ "Get", "locale", "with", "specified", "country", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Locale/Locales.php#L125-L135
train
ansas/php-component
src/Component/Locale/Locales.php
Locales.findByLanguage
public function findByLanguage($language) { $language = Text::toLower($language); foreach ($this->getAvailable() as $locale) { if ($language == $locale->getLanguage(Text::LOWER)) { return $locale; } } return null; }
php
public function findByLanguage($language) { $language = Text::toLower($language); foreach ($this->getAvailable() as $locale) { if ($language == $locale->getLanguage(Text::LOWER)) { return $locale; } } return null; }
[ "public", "function", "findByLanguage", "(", "$", "language", ")", "{", "$", "language", "=", "Text", "::", "toLower", "(", "$", "language", ")", ";", "foreach", "(", "$", "this", "->", "getAvailable", "(", ")", "as", "$", "locale", ")", "{", "if", "...
Get locale with specified language. @param $language @return Locale|null
[ "Get", "locale", "with", "specified", "language", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Locale/Locales.php#L145-L155
train
ansas/php-component
src/Component/Locale/Locales.php
Locales.findByLocale
public function findByLocale($locale) { // Get sanitized locale $locale = Locale::sanitizeLocale($locale); return isset($this->available[$locale]) ? $this->available[$locale] : null; }
php
public function findByLocale($locale) { // Get sanitized locale $locale = Locale::sanitizeLocale($locale); return isset($this->available[$locale]) ? $this->available[$locale] : null; }
[ "public", "function", "findByLocale", "(", "$", "locale", ")", "{", "// Get sanitized locale", "$", "locale", "=", "Locale", "::", "sanitizeLocale", "(", "$", "locale", ")", ";", "return", "isset", "(", "$", "this", "->", "available", "[", "$", "locale", "...
Get locale with specified name. @param string|Locale $locale @return Locale|null
[ "Get", "locale", "with", "specified", "name", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Locale/Locales.php#L164-L170
train
ansas/php-component
src/Component/Locale/Locales.php
Locales.setActive
public function setActive($locale) { $active = $this->findByLocale($locale); if (!$active) { throw new Exception(sprintf("Locale '%s' not in list.", $locale)); } // Mark as current locale $this->active = $active; // Set as global default for other classes \Locale::setDefault($active->getLocale()); return $this; }
php
public function setActive($locale) { $active = $this->findByLocale($locale); if (!$active) { throw new Exception(sprintf("Locale '%s' not in list.", $locale)); } // Mark as current locale $this->active = $active; // Set as global default for other classes \Locale::setDefault($active->getLocale()); return $this; }
[ "public", "function", "setActive", "(", "$", "locale", ")", "{", "$", "active", "=", "$", "this", "->", "findByLocale", "(", "$", "locale", ")", ";", "if", "(", "!", "$", "active", ")", "{", "throw", "new", "Exception", "(", "sprintf", "(", "\"Locale...
Set the current active locale incl. localization parameters. @param string|Locale $locale @return $this @throws Exception
[ "Set", "the", "current", "active", "locale", "incl", ".", "localization", "parameters", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Locale/Locales.php#L200-L215
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Modules/Login.php
Login.CreateNewUser
protected function CreateNewUser() { if (!$this->_login->getCanRegister()) { $this->FormLogin(); return; } $myWords = $this->WordCollection(); $this->defaultXmlnukeDocument->setPageTitle($myWords->Value("CREATEUSERTITLE")); $this->_login->setAction(ModuleActionLogin::NEWUSER); $this->_login->setNextAction(ModuleActionLogin::NEWUSERCONFIRM); $this->_login->setPassword(""); $this->_login->setCanRegister(false); // Hide buttons $this->_login->setCanRetrievePassword(false); // Hide buttons return; }
php
protected function CreateNewUser() { if (!$this->_login->getCanRegister()) { $this->FormLogin(); return; } $myWords = $this->WordCollection(); $this->defaultXmlnukeDocument->setPageTitle($myWords->Value("CREATEUSERTITLE")); $this->_login->setAction(ModuleActionLogin::NEWUSER); $this->_login->setNextAction(ModuleActionLogin::NEWUSERCONFIRM); $this->_login->setPassword(""); $this->_login->setCanRegister(false); // Hide buttons $this->_login->setCanRetrievePassword(false); // Hide buttons return; }
[ "protected", "function", "CreateNewUser", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_login", "->", "getCanRegister", "(", ")", ")", "{", "$", "this", "->", "FormLogin", "(", ")", ";", "return", ";", "}", "$", "myWords", "=", "$", "this", "...
Create New User
[ "Create", "New", "User" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Modules/Login.php#L376-L393
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Modules/Login.php
Login.CreateNewUserConfirm
protected function CreateNewUserConfirm() { if (!$this->_login->getCanRegister()) { $this->FormLogin(); return; } $myWords = $this->WordCollection(); $container = new XmlnukeUIAlert($this->_context, UIAlert::BoxAlert); $container->setAutoHide(5000); $this->_blockCenter->addXmlnukeObject($container); if (($this->_login->getName() == "") || ($this->_login->getEmail() == "") || ($this->_login->getUsername() == "") || !Util::isValidEmail($this->_login->getEmail())) { $container->addXmlnukeObject(new XmlnukeText($myWords->Value("INCOMPLETEDATA"), true)); $this->CreateNewUser(); } elseif (!XmlInputImageValidate::validateText($this->_context)) { $container->addXmlnukeObject(new XmlnukeText($myWords->Value("OBJECTIMAGEINVALID"), true)); $this->CreateNewUser(); } else { $newpassword = $this->getRandomPassword(); if (!$this->_users->addUser( $this->_login->getName(), $this->_login->getUsername(), $this->_login->getEmail(), $newpassword ) ) { $container->addXmlnukeObject(new XmlnukeText($myWords->Value("CREATEUSERFAIL"), true)); $this->CreateNewUser(); } else { $this->sendWelcomeMessage($myWords, $this->_context->get("name"), $this->_context->get("newloguser"), $this->_context->get("email"), $newpassword ); $this->_users->Save(); $container->addXmlnukeObject(new XmlnukeText($myWords->Value("CREATEUSEROK"), true)); $container->setUIAlertType(UIAlert::BoxInfo); $this->FormLogin($block); } } }
php
protected function CreateNewUserConfirm() { if (!$this->_login->getCanRegister()) { $this->FormLogin(); return; } $myWords = $this->WordCollection(); $container = new XmlnukeUIAlert($this->_context, UIAlert::BoxAlert); $container->setAutoHide(5000); $this->_blockCenter->addXmlnukeObject($container); if (($this->_login->getName() == "") || ($this->_login->getEmail() == "") || ($this->_login->getUsername() == "") || !Util::isValidEmail($this->_login->getEmail())) { $container->addXmlnukeObject(new XmlnukeText($myWords->Value("INCOMPLETEDATA"), true)); $this->CreateNewUser(); } elseif (!XmlInputImageValidate::validateText($this->_context)) { $container->addXmlnukeObject(new XmlnukeText($myWords->Value("OBJECTIMAGEINVALID"), true)); $this->CreateNewUser(); } else { $newpassword = $this->getRandomPassword(); if (!$this->_users->addUser( $this->_login->getName(), $this->_login->getUsername(), $this->_login->getEmail(), $newpassword ) ) { $container->addXmlnukeObject(new XmlnukeText($myWords->Value("CREATEUSERFAIL"), true)); $this->CreateNewUser(); } else { $this->sendWelcomeMessage($myWords, $this->_context->get("name"), $this->_context->get("newloguser"), $this->_context->get("email"), $newpassword ); $this->_users->Save(); $container->addXmlnukeObject(new XmlnukeText($myWords->Value("CREATEUSEROK"), true)); $container->setUIAlertType(UIAlert::BoxInfo); $this->FormLogin($block); } } }
[ "protected", "function", "CreateNewUserConfirm", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_login", "->", "getCanRegister", "(", ")", ")", "{", "$", "this", "->", "FormLogin", "(", ")", ";", "return", ";", "}", "$", "myWords", "=", "$", "thi...
Confirm New user
[ "Confirm", "New", "user" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Modules/Login.php#L399-L439
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Modules/Login.php
Login.getRandomPassword
public function getRandomPassword() { //Random rand = new Random(); //int type, number; $password = ""; for($i=0; $i<7; $i++) { $type = rand(0,21) % 3; $number = rand(0,25); if ($type == 1) { $password = $password . chr(48 + ($number%10)); } else { if ($type == 2) { $password = $password . chr(65 + $number); } else { $password = $password . chr(97 + $number); } } } return $password; }
php
public function getRandomPassword() { //Random rand = new Random(); //int type, number; $password = ""; for($i=0; $i<7; $i++) { $type = rand(0,21) % 3; $number = rand(0,25); if ($type == 1) { $password = $password . chr(48 + ($number%10)); } else { if ($type == 2) { $password = $password . chr(65 + $number); } else { $password = $password . chr(97 + $number); } } } return $password; }
[ "public", "function", "getRandomPassword", "(", ")", "{", "//Random rand = new Random();", "//int type, number;", "$", "password", "=", "\"\"", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "7", ";", "$", "i", "++", ")", "{", "$", "type", "=...
Make a random password @return string
[ "Make", "a", "random", "password" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Modules/Login.php#L469-L497
train
JBZoo/Html
src/ListAbstract.php
ListAbstract.input
public function input($name, $value = '', $id = '', $class = '', array $attrs = array()) { return '<input id="' . $id . '" class="' . $class . '" type="' . $this->_type . '" name="' . $name . '" value="' . $value . '" ' . $this->buildAttrs($attrs) . '/>'; }
php
public function input($name, $value = '', $id = '', $class = '', array $attrs = array()) { return '<input id="' . $id . '" class="' . $class . '" type="' . $this->_type . '" name="' . $name . '" value="' . $value . '" ' . $this->buildAttrs($attrs) . '/>'; }
[ "public", "function", "input", "(", "$", "name", ",", "$", "value", "=", "''", ",", "$", "id", "=", "''", ",", "$", "class", "=", "''", ",", "array", "$", "attrs", "=", "array", "(", ")", ")", "{", "return", "'<input id=\"'", ".", "$", "id", "....
Create input. @param string $name @param string $value @param string $id @param string $class @param array $attrs @return string
[ "Create", "input", "." ]
bd61d49a78199f425a2ed3270621e47dff4a014e
https://github.com/JBZoo/Html/blob/bd61d49a78199f425a2ed3270621e47dff4a014e/src/ListAbstract.php#L57-L61
train
JBZoo/Html
src/ListAbstract.php
ListAbstract.label
public function label($id, $valAlias, $content = '') { $class = implode(' ', array( $this->_jbSrt($this->_type . '-lbl'), $this->_jbSrt('label-' . $valAlias), )); return '<label for="' . $id . '" class="' . $class . '">' . $content . '</label>'; }
php
public function label($id, $valAlias, $content = '') { $class = implode(' ', array( $this->_jbSrt($this->_type . '-lbl'), $this->_jbSrt('label-' . $valAlias), )); return '<label for="' . $id . '" class="' . $class . '">' . $content . '</label>'; }
[ "public", "function", "label", "(", "$", "id", ",", "$", "valAlias", ",", "$", "content", "=", "''", ")", "{", "$", "class", "=", "implode", "(", "' '", ",", "array", "(", "$", "this", "->", "_jbSrt", "(", "$", "this", "->", "_type", ".", "'-lbl'...
Create label tag. @param string $id @param string $valAlias @param string $content @return string
[ "Create", "label", "tag", "." ]
bd61d49a78199f425a2ed3270621e47dff4a014e
https://github.com/JBZoo/Html/blob/bd61d49a78199f425a2ed3270621e47dff4a014e/src/ListAbstract.php#L71-L79
train
JBZoo/Html
src/ListAbstract.php
ListAbstract._checkedOptions
protected function _checkedOptions($value, $selected, array $attrs) { $attrs['checked'] = false; if (is_array($selected)) { foreach ($selected as $val) { if ($value == $val) { $attrs['checked'] = 'checked'; break; } } } else { if ($value == $selected) { $attrs['checked'] = 'checked'; } } return $attrs; }
php
protected function _checkedOptions($value, $selected, array $attrs) { $attrs['checked'] = false; if (is_array($selected)) { foreach ($selected as $val) { if ($value == $val) { $attrs['checked'] = 'checked'; break; } } } else { if ($value == $selected) { $attrs['checked'] = 'checked'; } } return $attrs; }
[ "protected", "function", "_checkedOptions", "(", "$", "value", ",", "$", "selected", ",", "array", "$", "attrs", ")", "{", "$", "attrs", "[", "'checked'", "]", "=", "false", ";", "if", "(", "is_array", "(", "$", "selected", ")", ")", "{", "foreach", ...
Checked options. @param string $value @param string|array $selected @param array $attrs @return array
[ "Checked", "options", "." ]
bd61d49a78199f425a2ed3270621e47dff4a014e
https://github.com/JBZoo/Html/blob/bd61d49a78199f425a2ed3270621e47dff4a014e/src/ListAbstract.php#L117-L134
train
JBZoo/Html
src/ListAbstract.php
ListAbstract._elementTpl
protected function _elementTpl($name, $value = '', $id = '', $text = '', array $attrs = array()) { $alias = Str::slug($value, true); $inpClass = $this->_jbSrt('val-' . $alias); $input = $this->input($name, $value, $id, $inpClass, $attrs); if ($this->_tpl === 'default') { return $input . $this->label($id, $alias, $text); } elseif ($this->_tpl === 'wrap') { return $this->label($id, $alias, $input . ' ' . $text); } if (is_callable($this->_tpl)) { return call_user_func($this->_tpl, $this, $name, $value, $id, $text, $attrs); } return null; }
php
protected function _elementTpl($name, $value = '', $id = '', $text = '', array $attrs = array()) { $alias = Str::slug($value, true); $inpClass = $this->_jbSrt('val-' . $alias); $input = $this->input($name, $value, $id, $inpClass, $attrs); if ($this->_tpl === 'default') { return $input . $this->label($id, $alias, $text); } elseif ($this->_tpl === 'wrap') { return $this->label($id, $alias, $input . ' ' . $text); } if (is_callable($this->_tpl)) { return call_user_func($this->_tpl, $this, $name, $value, $id, $text, $attrs); } return null; }
[ "protected", "function", "_elementTpl", "(", "$", "name", ",", "$", "value", "=", "''", ",", "$", "id", "=", "''", ",", "$", "text", "=", "''", ",", "array", "$", "attrs", "=", "array", "(", ")", ")", "{", "$", "alias", "=", "Str", "::", "slug"...
Single element template output. @param string $name @param string $value @param string $id @param string $text @param array $attrs @return mixed|null|string
[ "Single", "element", "template", "output", "." ]
bd61d49a78199f425a2ed3270621e47dff4a014e
https://github.com/JBZoo/Html/blob/bd61d49a78199f425a2ed3270621e47dff4a014e/src/ListAbstract.php#L146-L163
train
JBZoo/Html
src/ListAbstract.php
ListAbstract._setTpl
protected function _setTpl($tpl) { $this->_tpl = $tpl; if ($tpl === true) { $this->_tpl = self::TPL_WRAP; } if ($tpl === false) { $this->_tpl = self::TPL_DEFAULT; } }
php
protected function _setTpl($tpl) { $this->_tpl = $tpl; if ($tpl === true) { $this->_tpl = self::TPL_WRAP; } if ($tpl === false) { $this->_tpl = self::TPL_DEFAULT; } }
[ "protected", "function", "_setTpl", "(", "$", "tpl", ")", "{", "$", "this", "->", "_tpl", "=", "$", "tpl", ";", "if", "(", "$", "tpl", "===", "true", ")", "{", "$", "this", "->", "_tpl", "=", "self", "::", "TPL_WRAP", ";", "}", "if", "(", "$", ...
Setup template. @param string $tpl @return void
[ "Setup", "template", "." ]
bd61d49a78199f425a2ed3270621e47dff4a014e
https://github.com/JBZoo/Html/blob/bd61d49a78199f425a2ed3270621e47dff4a014e/src/ListAbstract.php#L171-L182
train
rokka-io/rokka-client-php-cli
src/Command/BaseRokkaCliCommand.php
BaseRokkaCliCommand.verifyStackExists
public function verifyStackExists($stackName, $organization, OutputInterface $output, Image $client = null) { if (!$client) { $client = $this->clientProvider->getImageClient($organization); } if (!$stackName || !$this->rokkaHelper->stackExists($client, $stackName, $organization)) { $output->writeln( $this->formatterHelper->formatBlock([ 'Error!', 'Stack "'.$stackName.'" does not exist on "'.$organization.'" organization!', ], 'error', true) ); return false; } return true; }
php
public function verifyStackExists($stackName, $organization, OutputInterface $output, Image $client = null) { if (!$client) { $client = $this->clientProvider->getImageClient($organization); } if (!$stackName || !$this->rokkaHelper->stackExists($client, $stackName, $organization)) { $output->writeln( $this->formatterHelper->formatBlock([ 'Error!', 'Stack "'.$stackName.'" does not exist on "'.$organization.'" organization!', ], 'error', true) ); return false; } return true; }
[ "public", "function", "verifyStackExists", "(", "$", "stackName", ",", "$", "organization", ",", "OutputInterface", "$", "output", ",", "Image", "$", "client", "=", "null", ")", "{", "if", "(", "!", "$", "client", ")", "{", "$", "client", "=", "$", "th...
Ensures that the given Stack exists for the input Organization. @param $stackName @param $organization @param OutputInterface $output @param Image $client @return bool
[ "Ensures", "that", "the", "given", "Stack", "exists", "for", "the", "input", "Organization", "." ]
ef22af122af65579a8607a0df976a9ce5248dbbb
https://github.com/rokka-io/rokka-client-php-cli/blob/ef22af122af65579a8607a0df976a9ce5248dbbb/src/Command/BaseRokkaCliCommand.php#L66-L84
train
rokka-io/rokka-client-php-cli
src/Command/BaseRokkaCliCommand.php
BaseRokkaCliCommand.resolveOrganizationName
public function resolveOrganizationName($organizationName, OutputInterface $output) { if (!$organizationName) { $organizationName = $this->rokkaHelper->getDefaultOrganizationName(); } if (!$this->rokkaHelper->validateOrganizationName($organizationName)) { $output->writeln($this->formatterHelper->formatBlock([ 'Error!', 'The organization name "'.$organizationName.'" is not valid!', ], 'error', true)); return false; } $client = $this->clientProvider->getUserClient(); if ($this->rokkaHelper->organizationExists($client, $organizationName)) { return $organizationName; } $output->writeln($this->formatterHelper->formatBlock([ 'Error!', 'The organization "'.$organizationName.'" does not exists!', ], 'error', true)); return false; }
php
public function resolveOrganizationName($organizationName, OutputInterface $output) { if (!$organizationName) { $organizationName = $this->rokkaHelper->getDefaultOrganizationName(); } if (!$this->rokkaHelper->validateOrganizationName($organizationName)) { $output->writeln($this->formatterHelper->formatBlock([ 'Error!', 'The organization name "'.$organizationName.'" is not valid!', ], 'error', true)); return false; } $client = $this->clientProvider->getUserClient(); if ($this->rokkaHelper->organizationExists($client, $organizationName)) { return $organizationName; } $output->writeln($this->formatterHelper->formatBlock([ 'Error!', 'The organization "'.$organizationName.'" does not exists!', ], 'error', true)); return false; }
[ "public", "function", "resolveOrganizationName", "(", "$", "organizationName", ",", "OutputInterface", "$", "output", ")", "{", "if", "(", "!", "$", "organizationName", ")", "{", "$", "organizationName", "=", "$", "this", "->", "rokkaHelper", "->", "getDefaultOr...
Get a valid organization name. If an organization name is provided, make sure it is valid and actually exists in the API. Otherwise return the default organization name. @param string $organizationName The organization name or an empty value if none is specified @param OutputInterface $output Console to write information for the user @return string|bool the organization name to use or false if the provided name is not valid
[ "Get", "a", "valid", "organization", "name", "." ]
ef22af122af65579a8607a0df976a9ce5248dbbb
https://github.com/rokka-io/rokka-client-php-cli/blob/ef22af122af65579a8607a0df976a9ce5248dbbb/src/Command/BaseRokkaCliCommand.php#L97-L123
train
rokka-io/rokka-client-php-cli
src/Command/BaseRokkaCliCommand.php
BaseRokkaCliCommand.verifySourceImageExists
public function verifySourceImageExists($hash, $organizationName, OutputInterface $output, Image $client) { if (!$this->rokkaHelper->validateImageHash($hash)) { $output->writeln($this->formatterHelper->formatBlock([ 'Error!', 'The Image HASH "'.$hash.'" is not valid!', ], 'error', true)); return false; } if ($this->rokkaHelper->imageExists($client, $hash, $organizationName)) { return true; } $output->writeln($this->formatterHelper->formatBlock([ 'Error!', 'The SourceImage "'.$hash.'" has not been found in Organization "'.$organizationName.'"', ], 'error', true)); return false; }
php
public function verifySourceImageExists($hash, $organizationName, OutputInterface $output, Image $client) { if (!$this->rokkaHelper->validateImageHash($hash)) { $output->writeln($this->formatterHelper->formatBlock([ 'Error!', 'The Image HASH "'.$hash.'" is not valid!', ], 'error', true)); return false; } if ($this->rokkaHelper->imageExists($client, $hash, $organizationName)) { return true; } $output->writeln($this->formatterHelper->formatBlock([ 'Error!', 'The SourceImage "'.$hash.'" has not been found in Organization "'.$organizationName.'"', ], 'error', true)); return false; }
[ "public", "function", "verifySourceImageExists", "(", "$", "hash", ",", "$", "organizationName", ",", "OutputInterface", "$", "output", ",", "Image", "$", "client", ")", "{", "if", "(", "!", "$", "this", "->", "rokkaHelper", "->", "validateImageHash", "(", "...
Verify that the given Source image exists, output the error message if needed. @param string $hash @param string $organizationName @param OutputInterface $output @param Image $client @return bool
[ "Verify", "that", "the", "given", "Source", "image", "exists", "output", "the", "error", "message", "if", "needed", "." ]
ef22af122af65579a8607a0df976a9ce5248dbbb
https://github.com/rokka-io/rokka-client-php-cli/blob/ef22af122af65579a8607a0df976a9ce5248dbbb/src/Command/BaseRokkaCliCommand.php#L135-L156
train
hostnet/form-handler-component
src/FormHandler/HandlerBuilder.php
HandlerBuilder.build
public function build(FormFactoryInterface $form_factory, $data = null) { $options = is_callable($this->options) ? call_user_func($this->options, $data) : $this->options; if (null !== $this->name) { $form = $form_factory->createNamed($this->name, $this->type, $data, $options); } else { $form = $form_factory->create($this->type, $data, $options); } return new FormSubmitProcessor($form, $this->on_success, $this->on_failure, $this->form_submit_processor); }
php
public function build(FormFactoryInterface $form_factory, $data = null) { $options = is_callable($this->options) ? call_user_func($this->options, $data) : $this->options; if (null !== $this->name) { $form = $form_factory->createNamed($this->name, $this->type, $data, $options); } else { $form = $form_factory->create($this->type, $data, $options); } return new FormSubmitProcessor($form, $this->on_success, $this->on_failure, $this->form_submit_processor); }
[ "public", "function", "build", "(", "FormFactoryInterface", "$", "form_factory", ",", "$", "data", "=", "null", ")", "{", "$", "options", "=", "is_callable", "(", "$", "this", "->", "options", ")", "?", "call_user_func", "(", "$", "this", "->", "options", ...
Create a handler which is able to process the request. @param FormFactoryInterface $form_factory @param mixed $data @return FormSubmitProcessor
[ "Create", "a", "handler", "which", "is", "able", "to", "process", "the", "request", "." ]
87cbc8444ec20a0c66bc8e05e79a102fb7cf4b0d
https://github.com/hostnet/form-handler-component/blob/87cbc8444ec20a0c66bc8e05e79a102fb7cf4b0d/src/FormHandler/HandlerBuilder.php#L107-L118
train
anklimsk/cakephp-theme
Controller/Component/FilterComponent.php
FilterComponent.getFilterConditions
public function getFilterConditions($plugin = null) { $filterData = null; $filterCond = null; if ($this->_controller->request->is('get')) { $filterData = $this->_controller->request->query('data.FilterData'); $filterCond = $this->_controller->request->query('data.FilterCond'); } elseif ($this->_controller->request->is('post')) { $filterData = $this->_controller->request->data('FilterData'); $filterCond = $this->_controller->request->data('FilterCond'); } $conditions = $this->_modelFilter->buildConditions($filterData, $filterCond, $plugin); return $conditions; }
php
public function getFilterConditions($plugin = null) { $filterData = null; $filterCond = null; if ($this->_controller->request->is('get')) { $filterData = $this->_controller->request->query('data.FilterData'); $filterCond = $this->_controller->request->query('data.FilterCond'); } elseif ($this->_controller->request->is('post')) { $filterData = $this->_controller->request->data('FilterData'); $filterCond = $this->_controller->request->data('FilterCond'); } $conditions = $this->_modelFilter->buildConditions($filterData, $filterCond, $plugin); return $conditions; }
[ "public", "function", "getFilterConditions", "(", "$", "plugin", "=", "null", ")", "{", "$", "filterData", "=", "null", ";", "$", "filterCond", "=", "null", ";", "if", "(", "$", "this", "->", "_controller", "->", "request", "->", "is", "(", "'get'", ")...
Return database query condition from filter data @param string $plugin Name of plugin for target model of filter. @return array Return database query condition from filter data.
[ "Return", "database", "query", "condition", "from", "filter", "data" ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Controller/Component/FilterComponent.php#L69-L82
train
anklimsk/cakephp-theme
Controller/Component/FilterComponent.php
FilterComponent.getGroupAction
public function getGroupAction($groupActions = null) { if (!$this->_controller->request->is('post')) { return false; } $action = $this->_controller->request->data('FilterGroup.action'); if (empty($action) || (!empty($groupActions) && !is_array($groupActions))) { return false; } if (empty($groupActions)) { return $action; } elseif (in_array($action, $groupActions)) { return $action; } else { return false; } }
php
public function getGroupAction($groupActions = null) { if (!$this->_controller->request->is('post')) { return false; } $action = $this->_controller->request->data('FilterGroup.action'); if (empty($action) || (!empty($groupActions) && !is_array($groupActions))) { return false; } if (empty($groupActions)) { return $action; } elseif (in_array($action, $groupActions)) { return $action; } else { return false; } }
[ "public", "function", "getGroupAction", "(", "$", "groupActions", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "_controller", "->", "request", "->", "is", "(", "'post'", ")", ")", "{", "return", "false", ";", "}", "$", "action", "=", "$"...
Return group action from filter data @param array $groupActions List of allowed group actions @return string|bool Return string name of group action, or False otherwise.
[ "Return", "group", "action", "from", "filter", "data" ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Controller/Component/FilterComponent.php#L91-L108
train
anklimsk/cakephp-theme
Controller/Component/FilterComponent.php
FilterComponent.getExtendPaginationOptions
public function getExtendPaginationOptions($options = null) { if (empty($options) || !is_array($options)) { $options = []; } if (!property_exists($this->_controller, 'Paginator')) { throw new InternalErrorException(__d('view_extension', 'Paginator component is not loaded')); } $paginatorOptions = $this->_controller->Paginator->mergeOptions(null); $page = (int)Hash::get($paginatorOptions, 'page'); if (!$this->_controller->RequestHandler->prefers('prt') || ($page > 1)) { return $options; } $options['limit'] = CAKE_THEME_PRINT_DATA_LIMIT; $options['maxLimit'] = CAKE_THEME_PRINT_DATA_LIMIT; return $options; }
php
public function getExtendPaginationOptions($options = null) { if (empty($options) || !is_array($options)) { $options = []; } if (!property_exists($this->_controller, 'Paginator')) { throw new InternalErrorException(__d('view_extension', 'Paginator component is not loaded')); } $paginatorOptions = $this->_controller->Paginator->mergeOptions(null); $page = (int)Hash::get($paginatorOptions, 'page'); if (!$this->_controller->RequestHandler->prefers('prt') || ($page > 1)) { return $options; } $options['limit'] = CAKE_THEME_PRINT_DATA_LIMIT; $options['maxLimit'] = CAKE_THEME_PRINT_DATA_LIMIT; return $options; }
[ "public", "function", "getExtendPaginationOptions", "(", "$", "options", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "options", ")", "||", "!", "is_array", "(", "$", "options", ")", ")", "{", "$", "options", "=", "[", "]", ";", "}", "if", ...
Return pagination options for print preview request If request is print preview and page number equal 1 - set new limits for pagination. @param array $options Options for pagination component @throws InternalErrorException if Paginator component is not loaded. @return array Return pagination options.
[ "Return", "pagination", "options", "for", "print", "preview", "request", "If", "request", "is", "print", "preview", "and", "page", "number", "equal", "1", "-", "set", "new", "limits", "for", "pagination", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Controller/Component/FilterComponent.php#L120-L139
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Model/Gui/Window.php
Window.setBusy
public function setBusy($bool = true) { $this->busyCounter = 0; $this->isBusy = (bool)$bool; if ($bool) { $text = "Please wait..."; if (is_string($bool)) { $text = (string)$bool; } $lbl = Label::create(); $lbl->setText($text)->setTextColor("fff")->setTextSize(6) ->setSize(90, 12)->setAlign("center", "center") ->setPosition($this->busyFrame->getWidth() / 2, -($this->busyFrame->getHeight() / 2)); $this->busyFrame->addChild($lbl); $quad = Quad::create(); $quad->setStyles("Bgs1", "BgDialogBlur"); $quad->setBackgroundColor("f00")->setSize($this->busyFrame->getWidth(), $this->busyFrame->getHeight()); $this->busyFrame->addChild($quad); } else { $this->busyFrame->removeAllChildren(); } }
php
public function setBusy($bool = true) { $this->busyCounter = 0; $this->isBusy = (bool)$bool; if ($bool) { $text = "Please wait..."; if (is_string($bool)) { $text = (string)$bool; } $lbl = Label::create(); $lbl->setText($text)->setTextColor("fff")->setTextSize(6) ->setSize(90, 12)->setAlign("center", "center") ->setPosition($this->busyFrame->getWidth() / 2, -($this->busyFrame->getHeight() / 2)); $this->busyFrame->addChild($lbl); $quad = Quad::create(); $quad->setStyles("Bgs1", "BgDialogBlur"); $quad->setBackgroundColor("f00")->setSize($this->busyFrame->getWidth(), $this->busyFrame->getHeight()); $this->busyFrame->addChild($quad); } else { $this->busyFrame->removeAllChildren(); } }
[ "public", "function", "setBusy", "(", "$", "bool", "=", "true", ")", "{", "$", "this", "->", "busyCounter", "=", "0", ";", "$", "this", "->", "isBusy", "=", "(", "bool", ")", "$", "bool", ";", "if", "(", "$", "bool", ")", "{", "$", "text", "=",...
Set the window to busy state, the window will dim and status message is displayed @param bool $bool sets busy status of the window @return void
[ "Set", "the", "window", "to", "busy", "state", "the", "window", "will", "dim", "and", "status", "message", "is", "displayed" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Model/Gui/Window.php#L77-L99
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Model/Gui/ManiaScriptFactory.php
ManiaScriptFactory.createScript
public function createScript($params) { $className = $this->className; $filePath = $this->fileLocator->locate('@'.$this->relativePath); return new $className($filePath, $params); }
php
public function createScript($params) { $className = $this->className; $filePath = $this->fileLocator->locate('@'.$this->relativePath); return new $className($filePath, $params); }
[ "public", "function", "createScript", "(", "$", "params", ")", "{", "$", "className", "=", "$", "this", "->", "className", ";", "$", "filePath", "=", "$", "this", "->", "fileLocator", "->", "locate", "(", "'@'", ".", "$", "this", "->", "relativePath", ...
Create an instance of script @param $params @return ManiaScript
[ "Create", "an", "instance", "of", "script" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Model/Gui/ManiaScriptFactory.php#L49-L56
train
netgen-layouts/layouts-sylius
bundle/EventListener/Shop/ProductIndexListener.php
ProductIndexListener.onProductIndex
public function onProductIndex(ResourceControllerEvent $event): void { $currentRequest = $this->requestStack->getCurrentRequest(); if (!$currentRequest instanceof Request) { return; } // Only sane way to extract the reference to the taxon if (!$currentRequest->attributes->has('slug')) { return; } $taxon = $this->taxonRepository->findOneBySlug( $currentRequest->attributes->get('slug'), $this->localeContext->getLocaleCode() ); if (!$taxon instanceof TaxonInterface) { return; } $currentRequest->attributes->set('nglayouts_sylius_taxon', $taxon); // We set context here instead in a ContextProvider, since sylius.taxon.show // event happens too late, after onKernelRequest event has already been executed $this->context->set('sylius_taxon_id', (int) $taxon->getId()); }
php
public function onProductIndex(ResourceControllerEvent $event): void { $currentRequest = $this->requestStack->getCurrentRequest(); if (!$currentRequest instanceof Request) { return; } // Only sane way to extract the reference to the taxon if (!$currentRequest->attributes->has('slug')) { return; } $taxon = $this->taxonRepository->findOneBySlug( $currentRequest->attributes->get('slug'), $this->localeContext->getLocaleCode() ); if (!$taxon instanceof TaxonInterface) { return; } $currentRequest->attributes->set('nglayouts_sylius_taxon', $taxon); // We set context here instead in a ContextProvider, since sylius.taxon.show // event happens too late, after onKernelRequest event has already been executed $this->context->set('sylius_taxon_id', (int) $taxon->getId()); }
[ "public", "function", "onProductIndex", "(", "ResourceControllerEvent", "$", "event", ")", ":", "void", "{", "$", "currentRequest", "=", "$", "this", "->", "requestStack", "->", "getCurrentRequest", "(", ")", ";", "if", "(", "!", "$", "currentRequest", "instan...
Sets the currently displayed taxon to the request, to be able to match with layout resolver.
[ "Sets", "the", "currently", "displayed", "taxon", "to", "the", "request", "to", "be", "able", "to", "match", "with", "layout", "resolver", "." ]
a261f1b312cc7e18ac48e2c5ff19775672f60947
https://github.com/netgen-layouts/layouts-sylius/blob/a261f1b312cc7e18ac48e2c5ff19775672f60947/bundle/EventListener/Shop/ProductIndexListener.php#L59-L84
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/GameCurrencyBundle/Model/GameCurrencyQueryBuilder.php
GameCurrencyQueryBuilder.save
public function save(Gamecurrency $gamecurrency) { // First clear references. entry has no references that needs saving. $gamecurrency->clearAllReferences(false); // Save and free memory. $gamecurrency->save(); GamecurrencyTableMap::clearInstancePool(); }
php
public function save(Gamecurrency $gamecurrency) { // First clear references. entry has no references that needs saving. $gamecurrency->clearAllReferences(false); // Save and free memory. $gamecurrency->save(); GamecurrencyTableMap::clearInstancePool(); }
[ "public", "function", "save", "(", "Gamecurrency", "$", "gamecurrency", ")", "{", "// First clear references. entry has no references that needs saving.", "$", "gamecurrency", "->", "clearAllReferences", "(", "false", ")", ";", "// Save and free memory.", "$", "gamecurrency",...
Save individual currency entry @param Gamecurrency $gamecurrency @throws PropelException
[ "Save", "individual", "currency", "entry" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/GameCurrencyBundle/Model/GameCurrencyQueryBuilder.php#L52-L60
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/GameShootmania/DataProviders/PlayerDataProvider.php
PlayerDataProvider.onPlayerHit
public function onPlayerHit($params) { $this->dispatch(__FUNCTION__, [ $params['shooter'], $params['victim'], $params['weapon'], $params['damage'], $params['points'], $params['distance'], Position::fromArray($params['shooterposition']), Position::fromArray($params['victimposition']), ]); }
php
public function onPlayerHit($params) { $this->dispatch(__FUNCTION__, [ $params['shooter'], $params['victim'], $params['weapon'], $params['damage'], $params['points'], $params['distance'], Position::fromArray($params['shooterposition']), Position::fromArray($params['victimposition']), ]); }
[ "public", "function", "onPlayerHit", "(", "$", "params", ")", "{", "$", "this", "->", "dispatch", "(", "__FUNCTION__", ",", "[", "$", "params", "[", "'shooter'", "]", ",", "$", "params", "[", "'victim'", "]", ",", "$", "params", "[", "'weapon'", "]", ...
Callback sent when a player is hit. @param $params
[ "Callback", "sent", "when", "a", "player", "is", "hit", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/GameShootmania/DataProviders/PlayerDataProvider.php#L22-L34
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/GameShootmania/DataProviders/PlayerDataProvider.php
PlayerDataProvider.onArmorEmpty
public function onArmorEmpty($params) { $this->dispatch(__FUNCTION__, [ $params['shooter'], $params['victim'], $params['weapon'], $params['distance'], Position::fromArray($params['shooterposition']), Position::fromArray($params['victimposition']), ]); }
php
public function onArmorEmpty($params) { $this->dispatch(__FUNCTION__, [ $params['shooter'], $params['victim'], $params['weapon'], $params['distance'], Position::fromArray($params['shooterposition']), Position::fromArray($params['victimposition']), ]); }
[ "public", "function", "onArmorEmpty", "(", "$", "params", ")", "{", "$", "this", "->", "dispatch", "(", "__FUNCTION__", ",", "[", "$", "params", "[", "'shooter'", "]", ",", "$", "params", "[", "'victim'", "]", ",", "$", "params", "[", "'weapon'", "]", ...
Callback sent when a player is eliminated. @param $params
[ "Callback", "sent", "when", "a", "player", "is", "eliminated", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/GameShootmania/DataProviders/PlayerDataProvider.php#L41-L51
train
TheBnl/event-tickets
code/extensions/TicketPayment.php
TicketPayment.onAuthorized
public function onAuthorized(ServiceResponse $response) { if ($response->getPayment()->Gateway === 'Manual') { if (($reservation = Reservation::get()->byID($this->owner->ReservationID)) && $reservation->exists()) { $reservation->complete(); } } }
php
public function onAuthorized(ServiceResponse $response) { if ($response->getPayment()->Gateway === 'Manual') { if (($reservation = Reservation::get()->byID($this->owner->ReservationID)) && $reservation->exists()) { $reservation->complete(); } } }
[ "public", "function", "onAuthorized", "(", "ServiceResponse", "$", "response", ")", "{", "if", "(", "$", "response", "->", "getPayment", "(", ")", "->", "Gateway", "===", "'Manual'", ")", "{", "if", "(", "(", "$", "reservation", "=", "Reservation", "::", ...
Fix issue manual gateway doesn't call onCaptured hook @param ServiceResponse $response
[ "Fix", "issue", "manual", "gateway", "doesn", "t", "call", "onCaptured", "hook" ]
d18db4146a141795fd50689057130a6fd41ac397
https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/extensions/TicketPayment.php#L27-L34
train
TheBnl/event-tickets
code/extensions/TicketPayment.php
TicketPayment.onCaptured
public function onCaptured(ServiceResponse $response) { /** @var Reservation $reservation */ if (($reservation = Reservation::get()->byID($this->owner->ReservationID)) && $reservation->exists()) { $reservation->complete(); } }
php
public function onCaptured(ServiceResponse $response) { /** @var Reservation $reservation */ if (($reservation = Reservation::get()->byID($this->owner->ReservationID)) && $reservation->exists()) { $reservation->complete(); } }
[ "public", "function", "onCaptured", "(", "ServiceResponse", "$", "response", ")", "{", "/** @var Reservation $reservation */", "if", "(", "(", "$", "reservation", "=", "Reservation", "::", "get", "(", ")", "->", "byID", "(", "$", "this", "->", "owner", "->", ...
Complete the order on a successful transaction @param ServiceResponse $response @throws \ValidationException
[ "Complete", "the", "order", "on", "a", "successful", "transaction" ]
d18db4146a141795fd50689057130a6fd41ac397
https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/extensions/TicketPayment.php#L43-L49
train
JBZoo/Html
src/Html.php
Html._
public static function _($render, $ns = __NAMESPACE__) { $html = self::getInstance(); $render = Str::low($render); $alias = $ns . '\\' . $render; if (!isset($html[$alias])) { $html[$alias] = self::_register($render, $ns); } return $html[$alias]; }
php
public static function _($render, $ns = __NAMESPACE__) { $html = self::getInstance(); $render = Str::low($render); $alias = $ns . '\\' . $render; if (!isset($html[$alias])) { $html[$alias] = self::_register($render, $ns); } return $html[$alias]; }
[ "public", "static", "function", "_", "(", "$", "render", ",", "$", "ns", "=", "__NAMESPACE__", ")", "{", "$", "html", "=", "self", "::", "getInstance", "(", ")", ";", "$", "render", "=", "Str", "::", "low", "(", "$", "render", ")", ";", "$", "ali...
Get and register render. @param string $render @param string $ns @return mixed
[ "Get", "and", "register", "render", "." ]
bd61d49a78199f425a2ed3270621e47dff4a014e
https://github.com/JBZoo/Html/blob/bd61d49a78199f425a2ed3270621e47dff4a014e/src/Html.php#L67-L78
train
JBZoo/Html
src/Html.php
Html._register
private static function _register($render, $ns) { return function () use ($render, $ns) { $render = Str::clean($render); $render = implode('\\', array( $ns, Html::RENDER_DIR, ucfirst($render) )); return new $render(); }; }
php
private static function _register($render, $ns) { return function () use ($render, $ns) { $render = Str::clean($render); $render = implode('\\', array( $ns, Html::RENDER_DIR, ucfirst($render) )); return new $render(); }; }
[ "private", "static", "function", "_register", "(", "$", "render", ",", "$", "ns", ")", "{", "return", "function", "(", ")", "use", "(", "$", "render", ",", "$", "ns", ")", "{", "$", "render", "=", "Str", "::", "clean", "(", "$", "render", ")", ";...
Pimple callback register render. @param $render @param string $ns @return \Closure
[ "Pimple", "callback", "register", "render", "." ]
bd61d49a78199f425a2ed3270621e47dff4a014e
https://github.com/JBZoo/Html/blob/bd61d49a78199f425a2ed3270621e47dff4a014e/src/Html.php#L87-L99
train
BenGorUser/UserBundle
src/BenGorUser/UserBundle/DependencyInjection/Compiler/Application/Command/SignUpUserCommandBuilder.php
SignUpUserCommandBuilder.invitationHandlerArguments
private function invitationHandlerArguments($user) { return [ $this->container->getDefinition( 'bengor.user.infrastructure.persistence.' . $user . '_repository' ), $this->container->getDefinition( 'bengor.user.infrastructure.security.symfony.' . $user . '_password_encoder' ), ]; }
php
private function invitationHandlerArguments($user) { return [ $this->container->getDefinition( 'bengor.user.infrastructure.persistence.' . $user . '_repository' ), $this->container->getDefinition( 'bengor.user.infrastructure.security.symfony.' . $user . '_password_encoder' ), ]; }
[ "private", "function", "invitationHandlerArguments", "(", "$", "user", ")", "{", "return", "[", "$", "this", "->", "container", "->", "getDefinition", "(", "'bengor.user.infrastructure.persistence.'", ".", "$", "user", ".", "'_repository'", ")", ",", "$", "this", ...
Gets the invitation type handlers arguments to inject in the constructor. @param string $user The user name @return array
[ "Gets", "the", "invitation", "type", "handlers", "arguments", "to", "inject", "in", "the", "constructor", "." ]
a6d0173496c269a6c80e1319d42eaed4b3bbbd4a
https://github.com/BenGorUser/UserBundle/blob/a6d0173496c269a6c80e1319d42eaed4b3bbbd4a/src/BenGorUser/UserBundle/DependencyInjection/Compiler/Application/Command/SignUpUserCommandBuilder.php#L132-L142
train
BenGorUser/UserBundle
src/BenGorUser/UserBundle/DependencyInjection/Compiler/Application/Command/SignUpUserCommandBuilder.php
SignUpUserCommandBuilder.withConfirmationSpecification
private function withConfirmationSpecification($user) { (new EnableUserCommandBuilder($this->container, $this->persistence))->build($user); return [ 'command' => WithConfirmationSignUpUserCommand::class, 'handler' => WithConfirmationSignUpUserHandler::class, 'handlerArguments' => $this->handlerArguments($user), ]; }
php
private function withConfirmationSpecification($user) { (new EnableUserCommandBuilder($this->container, $this->persistence))->build($user); return [ 'command' => WithConfirmationSignUpUserCommand::class, 'handler' => WithConfirmationSignUpUserHandler::class, 'handlerArguments' => $this->handlerArguments($user), ]; }
[ "private", "function", "withConfirmationSpecification", "(", "$", "user", ")", "{", "(", "new", "EnableUserCommandBuilder", "(", "$", "this", "->", "container", ",", "$", "this", "->", "persistence", ")", ")", "->", "build", "(", "$", "user", ")", ";", "re...
Gets the "with confirmation" specification. @param string $user The user name @return array
[ "Gets", "the", "with", "confirmation", "specification", "." ]
a6d0173496c269a6c80e1319d42eaed4b3bbbd4a
https://github.com/BenGorUser/UserBundle/blob/a6d0173496c269a6c80e1319d42eaed4b3bbbd4a/src/BenGorUser/UserBundle/DependencyInjection/Compiler/Application/Command/SignUpUserCommandBuilder.php#L167-L176
train
BenGorUser/UserBundle
src/BenGorUser/UserBundle/DependencyInjection/Compiler/Application/Command/SignUpUserCommandBuilder.php
SignUpUserCommandBuilder.byInvitationSpecification
private function byInvitationSpecification($user) { (new InviteUserCommandBuilder($this->container, $this->persistence))->build($user); (new ResendInvitationUserCommandBuilder($this->container, $this->persistence))->build($user); return [ 'command' => ByInvitationSignUpUserCommand::class, 'handler' => ByInvitationSignUpUserHandler::class, 'handlerArguments' => $this->invitationHandlerArguments($user), ]; }
php
private function byInvitationSpecification($user) { (new InviteUserCommandBuilder($this->container, $this->persistence))->build($user); (new ResendInvitationUserCommandBuilder($this->container, $this->persistence))->build($user); return [ 'command' => ByInvitationSignUpUserCommand::class, 'handler' => ByInvitationSignUpUserHandler::class, 'handlerArguments' => $this->invitationHandlerArguments($user), ]; }
[ "private", "function", "byInvitationSpecification", "(", "$", "user", ")", "{", "(", "new", "InviteUserCommandBuilder", "(", "$", "this", "->", "container", ",", "$", "this", "->", "persistence", ")", ")", "->", "build", "(", "$", "user", ")", ";", "(", ...
Gets the "by invitation" specification. @param string $user The user name @return array
[ "Gets", "the", "by", "invitation", "specification", "." ]
a6d0173496c269a6c80e1319d42eaed4b3bbbd4a
https://github.com/BenGorUser/UserBundle/blob/a6d0173496c269a6c80e1319d42eaed4b3bbbd4a/src/BenGorUser/UserBundle/DependencyInjection/Compiler/Application/Command/SignUpUserCommandBuilder.php#L185-L195
train
anklimsk/cakephp-theme
Vendor/PhpUnoconv/monolog/monolog/src/Monolog/Logger.php
Logger.pushProcessor
public function pushProcessor($callback) { if (!is_callable($callback)) { throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, true).' given'); } array_unshift($this->processors, $callback); return $this; }
php
public function pushProcessor($callback) { if (!is_callable($callback)) { throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, true).' given'); } array_unshift($this->processors, $callback); return $this; }
[ "public", "function", "pushProcessor", "(", "$", "callback", ")", "{", "if", "(", "!", "is_callable", "(", "$", "callback", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Processors must be valid callables (callback or object with an __invoke me...
Adds a processor on to the stack. @param callable $callback @return $this
[ "Adds", "a", "processor", "on", "to", "the", "stack", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Vendor/PhpUnoconv/monolog/monolog/src/Monolog/Logger.php#L228-L236
train
ansas/php-component
src/Slim/Handler/ErrorHandler.php
ErrorHandler.logError
protected function logError(Throwable $e) { if ($this->settings['displayErrorDetails']) { return; } if (!$this->logger) { return; } static $errorsLogged = []; // Get hash of Throwable object $errorObjectHash = spl_object_hash($e); // check: only log if we haven't logged this exact error before if (!isset($errorsLogged[$errorObjectHash])) { // Log $this->logger->error(get_class($e), ['exception' => $e]); // Save information that we have logged this error $errorsLogged[$errorObjectHash] = true; } }
php
protected function logError(Throwable $e) { if ($this->settings['displayErrorDetails']) { return; } if (!$this->logger) { return; } static $errorsLogged = []; // Get hash of Throwable object $errorObjectHash = spl_object_hash($e); // check: only log if we haven't logged this exact error before if (!isset($errorsLogged[$errorObjectHash])) { // Log $this->logger->error(get_class($e), ['exception' => $e]); // Save information that we have logged this error $errorsLogged[$errorObjectHash] = true; } }
[ "protected", "function", "logError", "(", "Throwable", "$", "e", ")", "{", "if", "(", "$", "this", "->", "settings", "[", "'displayErrorDetails'", "]", ")", "{", "return", ";", "}", "if", "(", "!", "$", "this", "->", "logger", ")", "{", "return", ";"...
Write to the error log if displayErrorDetails is false. @param Throwable $e
[ "Write", "to", "the", "error", "log", "if", "displayErrorDetails", "is", "false", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Slim/Handler/ErrorHandler.php#L71-L94
train
Malwarebytes/Altamira
src/Altamira/Chart.php
Chart.setTitle
public function setTitle( $title ) { $this->title = $title; $this->jsWriter->setOption( 'title', $title ); return $this; }
php
public function setTitle( $title ) { $this->title = $title; $this->jsWriter->setOption( 'title', $title ); return $this; }
[ "public", "function", "setTitle", "(", "$", "title", ")", "{", "$", "this", "->", "title", "=", "$", "title", ";", "$", "this", "->", "jsWriter", "->", "setOption", "(", "'title'", ",", "$", "title", ")", ";", "return", "$", "this", ";", "}" ]
Sets a text title for the chart, for rendering @param string $title @return \Altamira\Chart provides fluent interface
[ "Sets", "a", "text", "title", "for", "the", "chart", "for", "rendering" ]
38e320f68070d7a0b6902c6c3f904995d4a8cdfc
https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/Chart.php#L96-L102
train
Malwarebytes/Altamira
src/Altamira/Chart.php
Chart.setAxisOptions
public function setAxisOptions( $axis, $name, $value ) { $this->jsWriter->setAxisOptions( $axis, $name, $value ); return $this; }
php
public function setAxisOptions( $axis, $name, $value ) { $this->jsWriter->setAxisOptions( $axis, $name, $value ); return $this; }
[ "public", "function", "setAxisOptions", "(", "$", "axis", ",", "$", "name", ",", "$", "value", ")", "{", "$", "this", "->", "jsWriter", "->", "setAxisOptions", "(", "$", "axis", ",", "$", "name", ",", "$", "value", ")", ";", "return", "$", "this", ...
Generic interface to any kind of axis option @param string $axis @param string $name @param mixed $value @return \Altamira\Chart provides fluent interface
[ "Generic", "interface", "to", "any", "kind", "of", "axis", "option" ]
38e320f68070d7a0b6902c6c3f904995d4a8cdfc
https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/Chart.php#L186-L191
train
Malwarebytes/Altamira
src/Altamira/Chart.php
Chart.setAxisLabel
public function setAxisLabel( $axis, $label ) { if ( in_array( $axis, array( 'x', 'y', 'z' ) ) ) { $originalAxisOptions = $this->jsWriter->getOption( 'axes', array() ); $desiredAxisOptions = array( "{$axis}axis" => array( 'label' => $label ) ); $this->jsWriter->setOption( 'axes', array_merge_recursive( $originalAxisOptions, $desiredAxisOptions ) ); } return $this; }
php
public function setAxisLabel( $axis, $label ) { if ( in_array( $axis, array( 'x', 'y', 'z' ) ) ) { $originalAxisOptions = $this->jsWriter->getOption( 'axes', array() ); $desiredAxisOptions = array( "{$axis}axis" => array( 'label' => $label ) ); $this->jsWriter->setOption( 'axes', array_merge_recursive( $originalAxisOptions, $desiredAxisOptions ) ); } return $this; }
[ "public", "function", "setAxisLabel", "(", "$", "axis", ",", "$", "label", ")", "{", "if", "(", "in_array", "(", "$", "axis", ",", "array", "(", "'x'", ",", "'y'", ",", "'z'", ")", ")", ")", "{", "$", "originalAxisOptions", "=", "$", "this", "->", ...
Sets the label on this chart for a given axis @param string $axis x, y, z @param string $label the label @return \Altamira\Chart provides fluent interface
[ "Sets", "the", "label", "on", "this", "chart", "for", "a", "given", "axis" ]
38e320f68070d7a0b6902c6c3f904995d4a8cdfc
https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/Chart.php#L210-L219
train
Malwarebytes/Altamira
src/Altamira/Chart.php
Chart.setType
public function setType( $type, $seriesTitle = null ) { $this->jsWriter->setType( $type, $seriesTitle ); return $this; }
php
public function setType( $type, $seriesTitle = null ) { $this->jsWriter->setType( $type, $seriesTitle ); return $this; }
[ "public", "function", "setType", "(", "$", "type", ",", "$", "seriesTitle", "=", "null", ")", "{", "$", "this", "->", "jsWriter", "->", "setType", "(", "$", "type", ",", "$", "seriesTitle", ")", ";", "return", "$", "this", ";", "}" ]
Sets chart's type in the JS writer for default or for a given series. @param string $type @param string $seriesTitle @return \Altamira\Chart provides fluent interface
[ "Sets", "chart", "s", "type", "in", "the", "JS", "writer", "for", "default", "or", "for", "a", "given", "series", "." ]
38e320f68070d7a0b6902c6c3f904995d4a8cdfc
https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/Chart.php#L227-L232
train
Malwarebytes/Altamira
src/Altamira/Chart.php
Chart.setTypeOption
public function setTypeOption( $name, $option, $seriesTitle = null) { $this->jsWriter->setTypeOption( $name, $option, $seriesTitle ); return $this; }
php
public function setTypeOption( $name, $option, $seriesTitle = null) { $this->jsWriter->setTypeOption( $name, $option, $seriesTitle ); return $this; }
[ "public", "function", "setTypeOption", "(", "$", "name", ",", "$", "option", ",", "$", "seriesTitle", "=", "null", ")", "{", "$", "this", "->", "jsWriter", "->", "setTypeOption", "(", "$", "name", ",", "$", "option", ",", "$", "seriesTitle", ")", ";", ...
Sets an option for type-based rendering within this chart by default or for a series @param string $name the option name @param string $option the option value @param string $seriesTitle @return \Altamira\Chart provides fluent interface
[ "Sets", "an", "option", "for", "type", "-", "based", "rendering", "within", "this", "chart", "by", "default", "or", "for", "a", "series" ]
38e320f68070d7a0b6902c6c3f904995d4a8cdfc
https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/Chart.php#L241-L246
train
Malwarebytes/Altamira
src/Altamira/Chart.php
Chart.createSeries
public function createSeries( $data, $title = null, $type = null ) { return new Series( $data, $title, $this->jsWriter ); }
php
public function createSeries( $data, $title = null, $type = null ) { return new Series( $data, $title, $this->jsWriter ); }
[ "public", "function", "createSeries", "(", "$", "data", ",", "$", "title", "=", "null", ",", "$", "type", "=", "null", ")", "{", "return", "new", "Series", "(", "$", "data", ",", "$", "title", ",", "$", "this", "->", "jsWriter", ")", ";", "}" ]
Instantiates a series based on the data provided @param array $data array must consist of ChartDatumAbstract instances @param string|null $title @param string|null $type @return \Altamira\Series
[ "Instantiates", "a", "series", "based", "on", "the", "data", "provided" ]
38e320f68070d7a0b6902c6c3f904995d4a8cdfc
https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/Chart.php#L289-L292
train
Malwarebytes/Altamira
src/Altamira/Chart.php
Chart.addSeries
public function addSeries( $seriesOrArray ) { if (! is_array( $seriesOrArray ) ) { $seriesOrArray = array( $seriesOrArray ); } if ( is_array( $seriesOrArray ) ) { foreach ( $seriesOrArray as $series ) { if (! $series instanceof Series ) { throw new \UnexpectedValueException( '\Altamira\Chart::addSeries expects a single series or an array of series instances' ); } $this->addSingleSeries( $series ); } } return $this; }
php
public function addSeries( $seriesOrArray ) { if (! is_array( $seriesOrArray ) ) { $seriesOrArray = array( $seriesOrArray ); } if ( is_array( $seriesOrArray ) ) { foreach ( $seriesOrArray as $series ) { if (! $series instanceof Series ) { throw new \UnexpectedValueException( '\Altamira\Chart::addSeries expects a single series or an array of series instances' ); } $this->addSingleSeries( $series ); } } return $this; }
[ "public", "function", "addSeries", "(", "$", "seriesOrArray", ")", "{", "if", "(", "!", "is_array", "(", "$", "seriesOrArray", ")", ")", "{", "$", "seriesOrArray", "=", "array", "(", "$", "seriesOrArray", ")", ";", "}", "if", "(", "is_array", "(", "$",...
Lets you add one or more series using the same method call @param \Altamira\Series|array $seriesOrArray @throws \UnexpectedValueException @return \Altamira\Chart provides fluent interface
[ "Lets", "you", "add", "one", "or", "more", "series", "using", "the", "same", "method", "call" ]
38e320f68070d7a0b6902c6c3f904995d4a8cdfc
https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/Chart.php#L327-L344
train
Malwarebytes/Altamira
src/Altamira/Chart.php
Chart.getDiv
public function getDiv($width = 500, $height = 400) { $styleOptions = array('width' => $width.'px', 'height' => $height.'px' ); return ChartRenderer::render( $this, $styleOptions ); }
php
public function getDiv($width = 500, $height = 400) { $styleOptions = array('width' => $width.'px', 'height' => $height.'px' ); return ChartRenderer::render( $this, $styleOptions ); }
[ "public", "function", "getDiv", "(", "$", "width", "=", "500", ",", "$", "height", "=", "400", ")", "{", "$", "styleOptions", "=", "array", "(", "'width'", "=>", "$", "width", ".", "'px'", ",", "'height'", "=>", "$", "height", ".", "'px'", ")", ";"...
Wrapper responsible for rendering the div for a given chart. @param int $width @param int $height @return string
[ "Wrapper", "responsible", "for", "rendering", "the", "div", "for", "a", "given", "chart", "." ]
38e320f68070d7a0b6902c6c3f904995d4a8cdfc
https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/Chart.php#L364-L371
train
sebastianfeldmann/ftp
src/Client.php
Client.isDir
public function isDir(string $name) { $current = $this->pwd(); try { $this->chDir($name); $this->chDir($current); return true; } catch (\Exception $e) { // do nothing } return false; }
php
public function isDir(string $name) { $current = $this->pwd(); try { $this->chDir($name); $this->chDir($current); return true; } catch (\Exception $e) { // do nothing } return false; }
[ "public", "function", "isDir", "(", "string", "$", "name", ")", "{", "$", "current", "=", "$", "this", "->", "pwd", "(", ")", ";", "try", "{", "$", "this", "->", "chDir", "(", "$", "name", ")", ";", "$", "this", "->", "chDir", "(", "$", "curren...
Determine if file is a directory. @param string $name @return bool
[ "Determine", "if", "file", "is", "a", "directory", "." ]
b75e590f248abd6707b86b5df70daad71e7ab6bc
https://github.com/sebastianfeldmann/ftp/blob/b75e590f248abd6707b86b5df70daad71e7ab6bc/src/Client.php#L108-L119
train
sebastianfeldmann/ftp
src/Client.php
Client.ls
public function ls(string $path = '') : array { return version_compare(PHP_VERSION, '7.2.0', '>=') ? $this->ls72($path) : $this->lsLegacy($path); }
php
public function ls(string $path = '') : array { return version_compare(PHP_VERSION, '7.2.0', '>=') ? $this->ls72($path) : $this->lsLegacy($path); }
[ "public", "function", "ls", "(", "string", "$", "path", "=", "''", ")", ":", "array", "{", "return", "version_compare", "(", "PHP_VERSION", ",", "'7.2.0'", ",", "'>='", ")", "?", "$", "this", "->", "ls72", "(", "$", "path", ")", ":", "$", "this", "...
Return list of all files in directory. @param string $path @return \SebastianFeldmann\Ftp\File[] @throws \Exception
[ "Return", "list", "of", "all", "files", "in", "directory", "." ]
b75e590f248abd6707b86b5df70daad71e7ab6bc
https://github.com/sebastianfeldmann/ftp/blob/b75e590f248abd6707b86b5df70daad71e7ab6bc/src/Client.php#L138-L144
train
sebastianfeldmann/ftp
src/Client.php
Client.ls72
private function ls72(string $path) : array { $list = []; foreach ($this->mlsd($path) as $fileInfo) { $list[] = new File($fileInfo); } return $list; }
php
private function ls72(string $path) : array { $list = []; foreach ($this->mlsd($path) as $fileInfo) { $list[] = new File($fileInfo); } return $list; }
[ "private", "function", "ls72", "(", "string", "$", "path", ")", ":", "array", "{", "$", "list", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "mlsd", "(", "$", "path", ")", "as", "$", "fileInfo", ")", "{", "$", "list", "[", "]", "=", ...
Return list of all files in directory for php 7.2.0 and higher. @param string $path @return \SebastianFeldmann\Ftp\File[] @throws \Exception
[ "Return", "list", "of", "all", "files", "in", "directory", "for", "php", "7", ".", "2", ".", "0", "and", "higher", "." ]
b75e590f248abd6707b86b5df70daad71e7ab6bc
https://github.com/sebastianfeldmann/ftp/blob/b75e590f248abd6707b86b5df70daad71e7ab6bc/src/Client.php#L153-L160
train
sebastianfeldmann/ftp
src/Client.php
Client.lsLegacy
private function lsLegacy(string $path) : array { $list = []; foreach ($this->nlist($path) as $name) { $type = $this->isDir($name) ? 'dir' : 'file'; $size = $this->size($name); $mtime = $this->mdtm($name); if ($mtime == -1) { throw new RuntimeException('FTP server doesnt support \'ftp_mdtm\''); } $list[] = new File(['name' => $name, 'modify' => $mtime, 'type' => $type, 'size' => $size]); } return $list; }
php
private function lsLegacy(string $path) : array { $list = []; foreach ($this->nlist($path) as $name) { $type = $this->isDir($name) ? 'dir' : 'file'; $size = $this->size($name); $mtime = $this->mdtm($name); if ($mtime == -1) { throw new RuntimeException('FTP server doesnt support \'ftp_mdtm\''); } $list[] = new File(['name' => $name, 'modify' => $mtime, 'type' => $type, 'size' => $size]); } return $list; }
[ "private", "function", "lsLegacy", "(", "string", "$", "path", ")", ":", "array", "{", "$", "list", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "nlist", "(", "$", "path", ")", "as", "$", "name", ")", "{", "$", "type", "=", "$", "this...
Return list of all files in directory for php version below 7.2.0. @param string $path @return \SebastianFeldmann\Ftp\File[] @throws \Exception
[ "Return", "list", "of", "all", "files", "in", "directory", "for", "php", "version", "below", "7", ".", "2", ".", "0", "." ]
b75e590f248abd6707b86b5df70daad71e7ab6bc
https://github.com/sebastianfeldmann/ftp/blob/b75e590f248abd6707b86b5df70daad71e7ab6bc/src/Client.php#L169-L184
train
sebastianfeldmann/ftp
src/Client.php
Client.lsDirs
public function lsDirs(string $path = '') : array { return array_filter( $this->ls($path), function(File $file) { return $file->isDir(); } ); }
php
public function lsDirs(string $path = '') : array { return array_filter( $this->ls($path), function(File $file) { return $file->isDir(); } ); }
[ "public", "function", "lsDirs", "(", "string", "$", "path", "=", "''", ")", ":", "array", "{", "return", "array_filter", "(", "$", "this", "->", "ls", "(", "$", "path", ")", ",", "function", "(", "File", "$", "file", ")", "{", "return", "$", "file"...
Return list of directories in given path. @param string $path @return array @throws \Exception
[ "Return", "list", "of", "directories", "in", "given", "path", "." ]
b75e590f248abd6707b86b5df70daad71e7ab6bc
https://github.com/sebastianfeldmann/ftp/blob/b75e590f248abd6707b86b5df70daad71e7ab6bc/src/Client.php#L193-L201
train
sebastianfeldmann/ftp
src/Client.php
Client.lsFiles
public function lsFiles(string $path = '') : array { return array_filter( $this->ls($path), function(File $file) { return $file->isFile(); } ); }
php
public function lsFiles(string $path = '') : array { return array_filter( $this->ls($path), function(File $file) { return $file->isFile(); } ); }
[ "public", "function", "lsFiles", "(", "string", "$", "path", "=", "''", ")", ":", "array", "{", "return", "array_filter", "(", "$", "this", "->", "ls", "(", "$", "path", ")", ",", "function", "(", "File", "$", "file", ")", "{", "return", "$", "file...
Return list of files in given path. @param string $path @return array @throws \Exception
[ "Return", "list", "of", "files", "in", "given", "path", "." ]
b75e590f248abd6707b86b5df70daad71e7ab6bc
https://github.com/sebastianfeldmann/ftp/blob/b75e590f248abd6707b86b5df70daad71e7ab6bc/src/Client.php#L210-L218
train
sebastianfeldmann/ftp
src/Client.php
Client.uploadFile
public function uploadFile(string $file, string $path, string $name) { // to store the file we have to make sure the directory exists foreach ($this->extractDirectories($path) as $dir) { // if change to directory fails // create the dir and change into it afterwards try { $this->chDir($dir); } catch (\Exception $e) { $this->mkDir($dir); $this->chDir($dir); } } if (!$this->put($name, $file, FTP_BINARY)) { $error = error_get_last(); $message = $error['message']; throw new RuntimeException(sprintf('error uploading file: %s - %s', $file, $message)); } }
php
public function uploadFile(string $file, string $path, string $name) { // to store the file we have to make sure the directory exists foreach ($this->extractDirectories($path) as $dir) { // if change to directory fails // create the dir and change into it afterwards try { $this->chDir($dir); } catch (\Exception $e) { $this->mkDir($dir); $this->chDir($dir); } } if (!$this->put($name, $file, FTP_BINARY)) { $error = error_get_last(); $message = $error['message']; throw new RuntimeException(sprintf('error uploading file: %s - %s', $file, $message)); } }
[ "public", "function", "uploadFile", "(", "string", "$", "file", ",", "string", "$", "path", ",", "string", "$", "name", ")", "{", "// to store the file we have to make sure the directory exists", "foreach", "(", "$", "this", "->", "extractDirectories", "(", "$", "...
Upload local file to ftp server. @param string $file Path to local file that should be uploaded. @param string $path Path to store the file under. @param string $name Filename on the ftp server. @return void
[ "Upload", "local", "file", "to", "ftp", "server", "." ]
b75e590f248abd6707b86b5df70daad71e7ab6bc
https://github.com/sebastianfeldmann/ftp/blob/b75e590f248abd6707b86b5df70daad71e7ab6bc/src/Client.php#L228-L246
train
sebastianfeldmann/ftp
src/Client.php
Client.setup
private function setup(string $url) { $parts = \parse_url($url); $this->host = $parts['host'] ?? ''; $this->port = $parts['port'] ?? 21; $this->user = $parts['user'] ?? ''; $this->password = $parts['pass'] ?? ''; }
php
private function setup(string $url) { $parts = \parse_url($url); $this->host = $parts['host'] ?? ''; $this->port = $parts['port'] ?? 21; $this->user = $parts['user'] ?? ''; $this->password = $parts['pass'] ?? ''; }
[ "private", "function", "setup", "(", "string", "$", "url", ")", "{", "$", "parts", "=", "\\", "parse_url", "(", "$", "url", ")", ";", "$", "this", "->", "host", "=", "$", "parts", "[", "'host'", "]", "??", "''", ";", "$", "this", "->", "port", ...
Setup local member variables by parsing the ftp url. @param string $url
[ "Setup", "local", "member", "variables", "by", "parsing", "the", "ftp", "url", "." ]
b75e590f248abd6707b86b5df70daad71e7ab6bc
https://github.com/sebastianfeldmann/ftp/blob/b75e590f248abd6707b86b5df70daad71e7ab6bc/src/Client.php#L253-L260
train
sebastianfeldmann/ftp
src/Client.php
Client.login
private function login() { if (empty($this->host)) { throw new RuntimeException('no host to connect to'); } $old = error_reporting(0); $link = $this->isSecure ? ftp_ssl_connect($this->host, $this->port) : ftp_connect($this->host, $this->port); if (!$link) { error_reporting($old); throw new RuntimeException(sprintf('unable to connect to ftp server %s', $this->host)); } $this->connection = $link; if (!ftp_login($this->connection, $this->user, $this->password)) { error_reporting($old); throw new RuntimeException( sprintf('authentication failed for %s@%s', $this->user, $this->host) ); } // set passive mode if needed $this->pasv($this->passive); error_reporting($old); }
php
private function login() { if (empty($this->host)) { throw new RuntimeException('no host to connect to'); } $old = error_reporting(0); $link = $this->isSecure ? ftp_ssl_connect($this->host, $this->port) : ftp_connect($this->host, $this->port); if (!$link) { error_reporting($old); throw new RuntimeException(sprintf('unable to connect to ftp server %s', $this->host)); } $this->connection = $link; if (!ftp_login($this->connection, $this->user, $this->password)) { error_reporting($old); throw new RuntimeException( sprintf('authentication failed for %s@%s', $this->user, $this->host) ); } // set passive mode if needed $this->pasv($this->passive); error_reporting($old); }
[ "private", "function", "login", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "host", ")", ")", "{", "throw", "new", "RuntimeException", "(", "'no host to connect to'", ")", ";", "}", "$", "old", "=", "error_reporting", "(", "0", ")", ";",...
Setup ftp connection @throws \RuntimeException
[ "Setup", "ftp", "connection" ]
b75e590f248abd6707b86b5df70daad71e7ab6bc
https://github.com/sebastianfeldmann/ftp/blob/b75e590f248abd6707b86b5df70daad71e7ab6bc/src/Client.php#L267-L293
train
sebastianfeldmann/ftp
src/Client.php
Client.extractDirectories
private function extractDirectories(string $path) : array { $remoteDirs = []; if (!empty($path)) { $remoteDirs = explode('/', $path); // fix empty first array element for absolute path if (substr($path, 0, 1) === '/') { $remoteDirs[0] = '/'; } $remoteDirs = array_filter($remoteDirs); } return $remoteDirs; }
php
private function extractDirectories(string $path) : array { $remoteDirs = []; if (!empty($path)) { $remoteDirs = explode('/', $path); // fix empty first array element for absolute path if (substr($path, 0, 1) === '/') { $remoteDirs[0] = '/'; } $remoteDirs = array_filter($remoteDirs); } return $remoteDirs; }
[ "private", "function", "extractDirectories", "(", "string", "$", "path", ")", ":", "array", "{", "$", "remoteDirs", "=", "[", "]", ";", "if", "(", "!", "empty", "(", "$", "path", ")", ")", "{", "$", "remoteDirs", "=", "explode", "(", "'/'", ",", "$...
Return list of remote directories to travers. @param string $path @return array
[ "Return", "list", "of", "remote", "directories", "to", "travers", "." ]
b75e590f248abd6707b86b5df70daad71e7ab6bc
https://github.com/sebastianfeldmann/ftp/blob/b75e590f248abd6707b86b5df70daad71e7ab6bc/src/Client.php#L301-L313
train
k-gun/oppa
src/Batch/Batch.php
Batch.getResultId
public final function getResultId(int $i): ?int { return ($result = $this->getResult($i)) ? $result->getId() : null; }
php
public final function getResultId(int $i): ?int { return ($result = $this->getResult($i)) ? $result->getId() : null; }
[ "public", "final", "function", "getResultId", "(", "int", "$", "i", ")", ":", "?", "int", "{", "return", "(", "$", "result", "=", "$", "this", "->", "getResult", "(", "$", "i", ")", ")", "?", "$", "result", "->", "getId", "(", ")", ":", "null", ...
Get result id. @param int $i @return ?int
[ "Get", "result", "id", "." ]
3a20b5cc85cb3899c41737678798ec3de73a3836
https://github.com/k-gun/oppa/blob/3a20b5cc85cb3899c41737678798ec3de73a3836/src/Batch/Batch.php#L97-L100
train
k-gun/oppa
src/Batch/Batch.php
Batch.getResultsIds
public final function getResultsIds(bool $merge = true): array { $return = []; if (!empty($this->results)) { if ($merge) { foreach ($this->results as $result) { $return = array_merge($return, $result->getIds()); } } else { foreach ($this->results as $result) { $return[] = $result->getIds(); } } } return $return; }
php
public final function getResultsIds(bool $merge = true): array { $return = []; if (!empty($this->results)) { if ($merge) { foreach ($this->results as $result) { $return = array_merge($return, $result->getIds()); } } else { foreach ($this->results as $result) { $return[] = $result->getIds(); } } } return $return; }
[ "public", "final", "function", "getResultsIds", "(", "bool", "$", "merge", "=", "true", ")", ":", "array", "{", "$", "return", "=", "[", "]", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "results", ")", ")", "{", "if", "(", "$", "merge",...
Get results ids. @param bool $merge @return array
[ "Get", "results", "ids", "." ]
3a20b5cc85cb3899c41737678798ec3de73a3836
https://github.com/k-gun/oppa/blob/3a20b5cc85cb3899c41737678798ec3de73a3836/src/Batch/Batch.php#L126-L142
train
k-gun/oppa
src/Batch/Batch.php
Batch.doQuery
public final function doQuery(string $query, array $queryParams = null): BatchInterface { return $this->queue($query, $queryParams)->do(); }
php
public final function doQuery(string $query, array $queryParams = null): BatchInterface { return $this->queue($query, $queryParams)->do(); }
[ "public", "final", "function", "doQuery", "(", "string", "$", "query", ",", "array", "$", "queryParams", "=", "null", ")", ":", "BatchInterface", "{", "return", "$", "this", "->", "queue", "(", "$", "query", ",", "$", "queryParams", ")", "->", "do", "(...
Do query. @param string $query @param array|null $queryParams @return Oppa\Batch\BatchInterface
[ "Do", "query", "." ]
3a20b5cc85cb3899c41737678798ec3de73a3836
https://github.com/k-gun/oppa/blob/3a20b5cc85cb3899c41737678798ec3de73a3836/src/Batch/Batch.php#L231-L234
train
stanislav-web/PhalconSonar
src/Sonar/Applications/Sonar.php
Sonar.onOpen
public function onOpen(ConnectionInterface $conn) { // store the new connection $this->clients->attach($conn); echo Messenger::open($this->getIpAddress($conn)); // start profiler if(defined('SONAR_VERBOSE') === true) { Profiler::start(); } }
php
public function onOpen(ConnectionInterface $conn) { // store the new connection $this->clients->attach($conn); echo Messenger::open($this->getIpAddress($conn)); // start profiler if(defined('SONAR_VERBOSE') === true) { Profiler::start(); } }
[ "public", "function", "onOpen", "(", "ConnectionInterface", "$", "conn", ")", "{", "// store the new connection", "$", "this", "->", "clients", "->", "attach", "(", "$", "conn", ")", ";", "echo", "Messenger", "::", "open", "(", "$", "this", "->", "getIpAddre...
Open task event @param ConnectionInterface $conn
[ "Open", "task", "event" ]
4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa
https://github.com/stanislav-web/PhalconSonar/blob/4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa/src/Sonar/Applications/Sonar.php#L92-L103
train
stanislav-web/PhalconSonar
src/Sonar/Applications/Sonar.php
Sonar.onMessage
public function onMessage(ConnectionInterface $conn, $request) { if(is_array($request = json_decode($request, true)) === false) { throw new AppServiceException('The server received an invalid data format'); } if(isset($request['page']) === false) { throw new AppServiceException('There is no current page data'); } $this->queueService->push($request, function() use ($request, $conn) { // process only what is necessary for the subsequent construction of stats return [ 'ip' => $this->getIpAddress($conn), 'hash' => md5($this->getIpAddress($conn).$this->getUserAgent($conn)), 'open' => time() ]; }); // send back if(defined('SONAR_VERBOSE') === true) { echo Messenger::message(json_encode($request)); $conn->send(json_encode($request)); } }
php
public function onMessage(ConnectionInterface $conn, $request) { if(is_array($request = json_decode($request, true)) === false) { throw new AppServiceException('The server received an invalid data format'); } if(isset($request['page']) === false) { throw new AppServiceException('There is no current page data'); } $this->queueService->push($request, function() use ($request, $conn) { // process only what is necessary for the subsequent construction of stats return [ 'ip' => $this->getIpAddress($conn), 'hash' => md5($this->getIpAddress($conn).$this->getUserAgent($conn)), 'open' => time() ]; }); // send back if(defined('SONAR_VERBOSE') === true) { echo Messenger::message(json_encode($request)); $conn->send(json_encode($request)); } }
[ "public", "function", "onMessage", "(", "ConnectionInterface", "$", "conn", ",", "$", "request", ")", "{", "if", "(", "is_array", "(", "$", "request", "=", "json_decode", "(", "$", "request", ",", "true", ")", ")", "===", "false", ")", "{", "throw", "n...
Push to task event @param ConnectionInterface $conn @param ConnectionInterface $request @throws \Sonar\Exceptions\AppServiceException
[ "Push", "to", "task", "event" ]
4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa
https://github.com/stanislav-web/PhalconSonar/blob/4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa/src/Sonar/Applications/Sonar.php#L112-L136
train
stanislav-web/PhalconSonar
src/Sonar/Applications/Sonar.php
Sonar.onClose
public function onClose(ConnectionInterface $conn) { // The connection is closed, remove it, as we can no longer send it messages $this->clients->detach($conn); // pulled data from queues $data = $this->queueService->pull([ // identity for open queue message 'hash' => md5($this->getIpAddress($conn).$this->getUserAgent($conn)), ], function($response) use ($conn) { return array_merge($response, [ 'ua' => $this->getUserAgent($conn), 'language' => $this->getLanguage($conn), 'location' => $this->getLocation($conn), 'close' => time() ]); }); // save data to storage $this->storageService->add($data); echo Messenger::close($this->getIpAddress($conn)); // end profiler if(defined('SONAR_VERBOSE') === true) { Profiler::finish(); Profiler::getProfilingData(); } }
php
public function onClose(ConnectionInterface $conn) { // The connection is closed, remove it, as we can no longer send it messages $this->clients->detach($conn); // pulled data from queues $data = $this->queueService->pull([ // identity for open queue message 'hash' => md5($this->getIpAddress($conn).$this->getUserAgent($conn)), ], function($response) use ($conn) { return array_merge($response, [ 'ua' => $this->getUserAgent($conn), 'language' => $this->getLanguage($conn), 'location' => $this->getLocation($conn), 'close' => time() ]); }); // save data to storage $this->storageService->add($data); echo Messenger::close($this->getIpAddress($conn)); // end profiler if(defined('SONAR_VERBOSE') === true) { Profiler::finish(); Profiler::getProfilingData(); } }
[ "public", "function", "onClose", "(", "ConnectionInterface", "$", "conn", ")", "{", "// The connection is closed, remove it, as we can no longer send it messages", "$", "this", "->", "clients", "->", "detach", "(", "$", "conn", ")", ";", "// pulled data from queues", "$",...
Close conversation event @param ConnectionInterface $conn
[ "Close", "conversation", "event" ]
4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa
https://github.com/stanislav-web/PhalconSonar/blob/4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa/src/Sonar/Applications/Sonar.php#L143-L172
train
stanislav-web/PhalconSonar
src/Sonar/Applications/Sonar.php
Sonar.onError
public function onError(ConnectionInterface $conn, \Exception $e) { try { throw new \Exception($e->getMessage()); } catch(\Exception $e) { throw new SocketServiceException(Messenger::error($e->getMessage())); } finally { $conn->close(); } }
php
public function onError(ConnectionInterface $conn, \Exception $e) { try { throw new \Exception($e->getMessage()); } catch(\Exception $e) { throw new SocketServiceException(Messenger::error($e->getMessage())); } finally { $conn->close(); } }
[ "public", "function", "onError", "(", "ConnectionInterface", "$", "conn", ",", "\\", "Exception", "$", "e", ")", "{", "try", "{", "throw", "new", "\\", "Exception", "(", "$", "e", "->", "getMessage", "(", ")", ")", ";", "}", "catch", "(", "\\", "Exce...
Error event emitter @param ConnectionInterface $conn @param \Exception $e @throws \Sonar\Exceptions\AppServiceException
[ "Error", "event", "emitter" ]
4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa
https://github.com/stanislav-web/PhalconSonar/blob/4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa/src/Sonar/Applications/Sonar.php#L181-L192
train
stanislav-web/PhalconSonar
src/Sonar/Applications/Sonar.php
Sonar.getLocation
private function getLocation(ConnectionInterface $conn) { if($conn->WebSocket instanceof \StdClass) { if(($cache = $this->cacheService) != null) { $ip = $this->getIpAddress($conn); // load geo location from cache if($cache->getStorage()->exists($ip) === true) { $location = $cache->getStorage()->get($ip); } // add to cache geo location $cache->getStorage()->save($ip, $this->geoService->location($ip)); } else { try { $location = $this->geoService->location($this->getIpAddress($conn)); } catch(GeoServiceException $e) { throw new AppServiceException($e->getMessage()); } } return $location; } throw new AppServiceException('Location not defined'); }
php
private function getLocation(ConnectionInterface $conn) { if($conn->WebSocket instanceof \StdClass) { if(($cache = $this->cacheService) != null) { $ip = $this->getIpAddress($conn); // load geo location from cache if($cache->getStorage()->exists($ip) === true) { $location = $cache->getStorage()->get($ip); } // add to cache geo location $cache->getStorage()->save($ip, $this->geoService->location($ip)); } else { try { $location = $this->geoService->location($this->getIpAddress($conn)); } catch(GeoServiceException $e) { throw new AppServiceException($e->getMessage()); } } return $location; } throw new AppServiceException('Location not defined'); }
[ "private", "function", "getLocation", "(", "ConnectionInterface", "$", "conn", ")", "{", "if", "(", "$", "conn", "->", "WebSocket", "instanceof", "\\", "StdClass", ")", "{", "if", "(", "(", "$", "cache", "=", "$", "this", "->", "cacheService", ")", "!=",...
Get user location @param ConnectionInterface $conn @throws \Sonar\Exceptions\AppServiceException @return string
[ "Get", "user", "location" ]
4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa
https://github.com/stanislav-web/PhalconSonar/blob/4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa/src/Sonar/Applications/Sonar.php#L254-L281
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/Accounting/Repositories/VoucherType/EloquentVoucherType.php
EloquentVoucherType.byId
public function byId($id, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } return $this->VoucherType->on($databaseConnectionName)->find($id); }
php
public function byId($id, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } return $this->VoucherType->on($databaseConnectionName)->find($id); }
[ "public", "function", "byId", "(", "$", "id", ",", "$", "databaseConnectionName", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "databaseConnectionName", ")", ")", "{", "$", "databaseConnectionName", "=", "$", "this", "->", "databaseConnectionName", "...
Get a ... by ID @param int $id @return Mgallegos\DecimaAccounting\Accounting\VoucherType
[ "Get", "a", "...", "by", "ID" ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Repositories/VoucherType/EloquentVoucherType.php#L60-L68
train
anklimsk/cakephp-theme
Lib/Error/ExceptionRendererCakeTheme.php
ExceptionRendererCakeTheme._outputMessageSafe
protected function _outputMessageSafe($template) { $this->controller->layoutPath = null; $this->controller->subDir = null; $this->controller->viewPath = 'Errors'; $this->controller->layout = 'CakeTheme.error'; $this->controller->helpers = array('Form', 'Html', 'Session'); if (!empty($template)) { $template = 'CakeTheme.' . $template; } $view = new View($this->controller); $this->controller->response->body($view->render($template, 'CakeTheme.error')); $this->controller->response->type('html'); $this->controller->response->send(); }
php
protected function _outputMessageSafe($template) { $this->controller->layoutPath = null; $this->controller->subDir = null; $this->controller->viewPath = 'Errors'; $this->controller->layout = 'CakeTheme.error'; $this->controller->helpers = array('Form', 'Html', 'Session'); if (!empty($template)) { $template = 'CakeTheme.' . $template; } $view = new View($this->controller); $this->controller->response->body($view->render($template, 'CakeTheme.error')); $this->controller->response->type('html'); $this->controller->response->send(); }
[ "protected", "function", "_outputMessageSafe", "(", "$", "template", ")", "{", "$", "this", "->", "controller", "->", "layoutPath", "=", "null", ";", "$", "this", "->", "controller", "->", "subDir", "=", "null", ";", "$", "this", "->", "controller", "->", ...
A safer way to render error messages, replaces all helpers, with basics and doesn't call component methods. Set layout to `CakeTheme.error`. @param string $template The template to render @return void
[ "A", "safer", "way", "to", "render", "error", "messages", "replaces", "all", "helpers", "with", "basics", "and", "doesn", "t", "call", "component", "methods", ".", "Set", "layout", "to", "CakeTheme", ".", "error", "." ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Lib/Error/ExceptionRendererCakeTheme.php#L62-L76
train
JBZoo/Html
src/Render/Image.php
Image.render
public function render($src, $class = '', $id = '', array $attrs = array()) { $attrs['class'] = false; $attrs = array_merge(array('fullUrl' => true), $attrs); $attrs['id'] = $id; $attrs = $this->_normalizeClassAttr($attrs, $this->_jbSrt('image')); if ($class !== '') { $attrs = $this->_normalizeClassAttr($attrs, $class); } $attrs['class'] = Str::clean($attrs['class']); $isFull = $attrs['fullUrl']; unset($attrs['fullUrl']); $src = FS::clean($src, '/'); $attrs['src'] = ($isFull) ? Url::root() . '/' . $src : $src; return '<img ' . $this->buildAttrs($attrs) . ' />'; }
php
public function render($src, $class = '', $id = '', array $attrs = array()) { $attrs['class'] = false; $attrs = array_merge(array('fullUrl' => true), $attrs); $attrs['id'] = $id; $attrs = $this->_normalizeClassAttr($attrs, $this->_jbSrt('image')); if ($class !== '') { $attrs = $this->_normalizeClassAttr($attrs, $class); } $attrs['class'] = Str::clean($attrs['class']); $isFull = $attrs['fullUrl']; unset($attrs['fullUrl']); $src = FS::clean($src, '/'); $attrs['src'] = ($isFull) ? Url::root() . '/' . $src : $src; return '<img ' . $this->buildAttrs($attrs) . ' />'; }
[ "public", "function", "render", "(", "$", "src", ",", "$", "class", "=", "''", ",", "$", "id", "=", "''", ",", "array", "$", "attrs", "=", "array", "(", ")", ")", "{", "$", "attrs", "[", "'class'", "]", "=", "false", ";", "$", "attrs", "=", "...
Create img tag. @param string $src @param string|array $class @param string $id @param array $attrs @return string
[ "Create", "img", "tag", "." ]
bd61d49a78199f425a2ed3270621e47dff4a014e
https://github.com/JBZoo/Html/blob/bd61d49a78199f425a2ed3270621e47dff4a014e/src/Render/Image.php#L39-L61
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php
GridBuilder.setManialink
public function setManialink(ManialinkInterface $manialink) { $this->manialink = $manialink; $this->actionFirstPage = $this->actionFactory ->createManialinkAction($manialink, array($this, 'goToFirstPage'), [], true); $this->actionPreviousPage = $this->actionFactory ->createManialinkAction($manialink, array($this, 'goToPreviousPage'), [], true); $this->actionNextPage = $this->actionFactory ->createManialinkAction($manialink, array($this, 'goToNextPage'), [], true); $this->actionLastPage = $this->actionFactory ->createManialinkAction($manialink, array($this, 'goToLastPage'), [], true); $this->actionGotoPage = $this->actionFactory ->createManialinkAction($manialink, array($this, 'goToPage'), [], true); return $this; }
php
public function setManialink(ManialinkInterface $manialink) { $this->manialink = $manialink; $this->actionFirstPage = $this->actionFactory ->createManialinkAction($manialink, array($this, 'goToFirstPage'), [], true); $this->actionPreviousPage = $this->actionFactory ->createManialinkAction($manialink, array($this, 'goToPreviousPage'), [], true); $this->actionNextPage = $this->actionFactory ->createManialinkAction($manialink, array($this, 'goToNextPage'), [], true); $this->actionLastPage = $this->actionFactory ->createManialinkAction($manialink, array($this, 'goToLastPage'), [], true); $this->actionGotoPage = $this->actionFactory ->createManialinkAction($manialink, array($this, 'goToPage'), [], true); return $this; }
[ "public", "function", "setManialink", "(", "ManialinkInterface", "$", "manialink", ")", "{", "$", "this", "->", "manialink", "=", "$", "manialink", ";", "$", "this", "->", "actionFirstPage", "=", "$", "this", "->", "actionFactory", "->", "createManialinkAction",...
Set the manialink the content is generated for. @param ManialinkInterface $manialink @return $this
[ "Set", "the", "manialink", "the", "content", "is", "generated", "for", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php#L134-L150
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php
GridBuilder.addActionColumn
public function addActionColumn($key, $name, $widthCoefficient, $callback, $renderer) { $this->columns[] = new ActionColumn($key, $name, $widthCoefficient, $callback, $renderer); return $this; }
php
public function addActionColumn($key, $name, $widthCoefficient, $callback, $renderer) { $this->columns[] = new ActionColumn($key, $name, $widthCoefficient, $callback, $renderer); return $this; }
[ "public", "function", "addActionColumn", "(", "$", "key", ",", "$", "name", ",", "$", "widthCoefficient", ",", "$", "callback", ",", "$", "renderer", ")", "{", "$", "this", "->", "columns", "[", "]", "=", "new", "ActionColumn", "(", "$", "key", ",", ...
Add an action into a column. @param string $key @param string $name @param integer $widthCoefficient @param callable $callback @param Renderable $renderer @return $this
[ "Add", "an", "action", "into", "a", "column", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php#L220-L225
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php
GridBuilder.goToFirstPage
public function goToFirstPage(ManialinkInterface $manialink, $login = null, $entries = []) { $this->updateDataCollection($entries); $this->changePage(1); }
php
public function goToFirstPage(ManialinkInterface $manialink, $login = null, $entries = []) { $this->updateDataCollection($entries); $this->changePage(1); }
[ "public", "function", "goToFirstPage", "(", "ManialinkInterface", "$", "manialink", ",", "$", "login", "=", "null", ",", "$", "entries", "=", "[", "]", ")", "{", "$", "this", "->", "updateDataCollection", "(", "$", "entries", ")", ";", "$", "this", "->",...
Action callback to go to the first page. @param ManialinkInterface $manialink @param null $login @param array $entries
[ "Action", "callback", "to", "go", "to", "the", "first", "page", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php#L368-L372
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php
GridBuilder.goToPreviousPage
public function goToPreviousPage(ManialinkInterface $manialink, $login = null, $entries = []) { $this->updateDataCollection($entries); if ($this->currentPage - 1 >= 1) { $this->changePage($this->currentPage - 1); } }
php
public function goToPreviousPage(ManialinkInterface $manialink, $login = null, $entries = []) { $this->updateDataCollection($entries); if ($this->currentPage - 1 >= 1) { $this->changePage($this->currentPage - 1); } }
[ "public", "function", "goToPreviousPage", "(", "ManialinkInterface", "$", "manialink", ",", "$", "login", "=", "null", ",", "$", "entries", "=", "[", "]", ")", "{", "$", "this", "->", "updateDataCollection", "(", "$", "entries", ")", ";", "if", "(", "$",...
Action callback to go to the previous page. @param ManialinkInterface $manialink @param null $login @param array $entries
[ "Action", "callback", "to", "go", "to", "the", "previous", "page", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php#L380-L386
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php
GridBuilder.goToNextPage
public function goToNextPage(ManialinkInterface $manialink, $login = null, $entries = []) { $this->updateDataCollection($entries); if ($this->currentPage + 1 <= $this->dataCollection->getLastPageNumber()) { $this->changePage($this->currentPage + 1); } }
php
public function goToNextPage(ManialinkInterface $manialink, $login = null, $entries = []) { $this->updateDataCollection($entries); if ($this->currentPage + 1 <= $this->dataCollection->getLastPageNumber()) { $this->changePage($this->currentPage + 1); } }
[ "public", "function", "goToNextPage", "(", "ManialinkInterface", "$", "manialink", ",", "$", "login", "=", "null", ",", "$", "entries", "=", "[", "]", ")", "{", "$", "this", "->", "updateDataCollection", "(", "$", "entries", ")", ";", "if", "(", "$", "...
Action callback to go to the next page. @param ManialinkInterface $manialink @param null $login @param array $entries
[ "Action", "callback", "to", "go", "to", "the", "next", "page", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php#L394-L400
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php
GridBuilder.goToLastPage
public function goToLastPage(ManialinkInterface $manialink, $login = null, $entries = []) { $this->updateDataCollection($entries); $this->changePage($this->dataCollection->getLastPageNumber()); }
php
public function goToLastPage(ManialinkInterface $manialink, $login = null, $entries = []) { $this->updateDataCollection($entries); $this->changePage($this->dataCollection->getLastPageNumber()); }
[ "public", "function", "goToLastPage", "(", "ManialinkInterface", "$", "manialink", ",", "$", "login", "=", "null", ",", "$", "entries", "=", "[", "]", ")", "{", "$", "this", "->", "updateDataCollection", "(", "$", "entries", ")", ";", "$", "this", "->", ...
Action callback to go to the last page. @param ManialinkInterface $manialink @param null $login @param array $entries
[ "Action", "callback", "to", "go", "to", "the", "last", "page", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php#L428-L432
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php
GridBuilder.updateDataCollection
public function updateDataCollection($entries) { $process = false; $data = []; $start = ($this->currentPage - 1) * $this->dataCollection->getPageSize(); foreach ($entries as $key => $value) { if (substr($key, 0, 6) == "entry_") { $array = explode("_", str_replace("entry_", "", $key)); setType($value, $array[1]); $data[$array[0]] = $value; $process = true; } } if ($process) { $lines = $this->dataCollection->getData($this->currentPage); $counter = 0; foreach ($lines as $i => $lineData) { $newData = $lineData; foreach ($this->columns as $columnData) { if ($columnData instanceof InputColumn) { $newData[$columnData->getKey()] = $data[$counter]; } } $this->dataCollection->setDataByIndex($start + $counter, $newData); $counter++; } } }
php
public function updateDataCollection($entries) { $process = false; $data = []; $start = ($this->currentPage - 1) * $this->dataCollection->getPageSize(); foreach ($entries as $key => $value) { if (substr($key, 0, 6) == "entry_") { $array = explode("_", str_replace("entry_", "", $key)); setType($value, $array[1]); $data[$array[0]] = $value; $process = true; } } if ($process) { $lines = $this->dataCollection->getData($this->currentPage); $counter = 0; foreach ($lines as $i => $lineData) { $newData = $lineData; foreach ($this->columns as $columnData) { if ($columnData instanceof InputColumn) { $newData[$columnData->getKey()] = $data[$counter]; } } $this->dataCollection->setDataByIndex($start + $counter, $newData); $counter++; } } }
[ "public", "function", "updateDataCollection", "(", "$", "entries", ")", "{", "$", "process", "=", "false", ";", "$", "data", "=", "[", "]", ";", "$", "start", "=", "(", "$", "this", "->", "currentPage", "-", "1", ")", "*", "$", "this", "->", "dataC...
Updates dataCollection from entries. @param $entries
[ "Updates", "dataCollection", "from", "entries", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php#L438-L465
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php
GridBuilder.changePage
protected function changePage($page) { $this->currentPage = $page; $this->manialinkFactory->update($this->manialink->getUserGroup()); }
php
protected function changePage($page) { $this->currentPage = $page; $this->manialinkFactory->update($this->manialink->getUserGroup()); }
[ "protected", "function", "changePage", "(", "$", "page", ")", "{", "$", "this", "->", "currentPage", "=", "$", "page", ";", "$", "this", "->", "manialinkFactory", "->", "update", "(", "$", "this", "->", "manialink", "->", "getUserGroup", "(", ")", ")", ...
Handle page change & refresh user window. @param integer $page
[ "Handle", "page", "change", "&", "refresh", "user", "window", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php#L481-L485
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php
GridBuilder.destroy
public function destroy() { $this->manialink = null; $this->manialinkFactory = null; $this->dataCollection = null; // There is cyclic dependency between actions and model, remove it so that memory can be freed immediately. $this->actionFirstPage = null; $this->actionGotoPage = null; $this->actionLastPage = null; $this->actionNextPage = null; $this->temporaryActions = []; $this->temporaryEntries = []; }
php
public function destroy() { $this->manialink = null; $this->manialinkFactory = null; $this->dataCollection = null; // There is cyclic dependency between actions and model, remove it so that memory can be freed immediately. $this->actionFirstPage = null; $this->actionGotoPage = null; $this->actionLastPage = null; $this->actionNextPage = null; $this->temporaryActions = []; $this->temporaryEntries = []; }
[ "public", "function", "destroy", "(", ")", "{", "$", "this", "->", "manialink", "=", "null", ";", "$", "this", "->", "manialinkFactory", "=", "null", ";", "$", "this", "->", "dataCollection", "=", "null", ";", "// There is cyclic dependency between actions and m...
Prepare object so that it's destroyed easier. Generally GC will do this automatically, we are trying to help it so that it happens faster. @return mixed
[ "Prepare", "object", "so", "that", "it", "s", "destroyed", "easier", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Model/Gui/Grid/GridBuilder.php#L526-L539
train
GlobalTradingTechnologies/ad-poller
src/PollerCollection.php
PollerCollection.addPoller
public function addPoller(Poller $poller) { $name = $poller->getName(); if (array_key_exists($name, $this->pollers)) { throw new InvalidArgumentException("Poller named '$name' already exists"); } $this->pollers[$name] = $poller; }
php
public function addPoller(Poller $poller) { $name = $poller->getName(); if (array_key_exists($name, $this->pollers)) { throw new InvalidArgumentException("Poller named '$name' already exists"); } $this->pollers[$name] = $poller; }
[ "public", "function", "addPoller", "(", "Poller", "$", "poller", ")", "{", "$", "name", "=", "$", "poller", "->", "getName", "(", ")", ";", "if", "(", "array_key_exists", "(", "$", "name", ",", "$", "this", "->", "pollers", ")", ")", "{", "throw", ...
Add poller to collection @param Poller $poller @throws InvalidArgumentException in case when poller with the same name already exists
[ "Add", "poller", "to", "collection" ]
c90073b13a6963970e70af67c6439dfe8c48739e
https://github.com/GlobalTradingTechnologies/ad-poller/blob/c90073b13a6963970e70af67c6439dfe8c48739e/src/PollerCollection.php#L40-L48
train
GlobalTradingTechnologies/ad-poller
src/PollerCollection.php
PollerCollection.getPoller
public function getPoller($name) { if (!array_key_exists($name, $this->pollers)) { throw new InvalidArgumentException("Poller named '$name' does not exist"); } return $this->pollers[$name]; }
php
public function getPoller($name) { if (!array_key_exists($name, $this->pollers)) { throw new InvalidArgumentException("Poller named '$name' does not exist"); } return $this->pollers[$name]; }
[ "public", "function", "getPoller", "(", "$", "name", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "name", ",", "$", "this", "->", "pollers", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "\"Poller named '$name' does not exist\"", "...
Returns poller by name @param $name @return Poller @throws InvalidArgumentException in case of absence
[ "Returns", "poller", "by", "name" ]
c90073b13a6963970e70af67c6439dfe8c48739e
https://github.com/GlobalTradingTechnologies/ad-poller/blob/c90073b13a6963970e70af67c6439dfe8c48739e/src/PollerCollection.php#L59-L66
train
byrokrat/autogiro
src/Writer/TreeBuilder.php
TreeBuilder.reset
public function reset(): void { $this->opening = new Record( 'Opening', new Obj(0, $this->date, 'Date'), new Text(0, 'AUTOGIRO'), new Text(0, str_pad('', 44)), new Number(0, $this->bgcNr, 'PayeeBgcNumber'), $this->payeeBgNode, new Text(0, ' ') ); $this->mandates = []; $this->payments = []; $this->amendments = []; }
php
public function reset(): void { $this->opening = new Record( 'Opening', new Obj(0, $this->date, 'Date'), new Text(0, 'AUTOGIRO'), new Text(0, str_pad('', 44)), new Number(0, $this->bgcNr, 'PayeeBgcNumber'), $this->payeeBgNode, new Text(0, ' ') ); $this->mandates = []; $this->payments = []; $this->amendments = []; }
[ "public", "function", "reset", "(", ")", ":", "void", "{", "$", "this", "->", "opening", "=", "new", "Record", "(", "'Opening'", ",", "new", "Obj", "(", "0", ",", "$", "this", "->", "date", ",", "'Date'", ")", ",", "new", "Text", "(", "0", ",", ...
Reset builder to initial state
[ "Reset", "builder", "to", "initial", "state" ]
7035467af18e991c0c130d83294b0779aa3e1583
https://github.com/byrokrat/autogiro/blob/7035467af18e991c0c130d83294b0779aa3e1583/src/Writer/TreeBuilder.php#L103-L117
train
byrokrat/autogiro
src/Writer/TreeBuilder.php
TreeBuilder.addCreateMandateRequest
public function addCreateMandateRequest(string $payerNr, AccountNumber $account, IdInterface $id): void { $this->mandates[] = new Record( 'CreateMandateRequest', $this->payeeBgNode, new Number(0, $payerNr, 'PayerNumber'), new Obj(0, $account, 'Account'), new Obj(0, $id, 'StateId'), new Text(0, str_pad('', 24)) ); }
php
public function addCreateMandateRequest(string $payerNr, AccountNumber $account, IdInterface $id): void { $this->mandates[] = new Record( 'CreateMandateRequest', $this->payeeBgNode, new Number(0, $payerNr, 'PayerNumber'), new Obj(0, $account, 'Account'), new Obj(0, $id, 'StateId'), new Text(0, str_pad('', 24)) ); }
[ "public", "function", "addCreateMandateRequest", "(", "string", "$", "payerNr", ",", "AccountNumber", "$", "account", ",", "IdInterface", "$", "id", ")", ":", "void", "{", "$", "this", "->", "mandates", "[", "]", "=", "new", "Record", "(", "'CreateMandateReq...
Add a new mandate request to tree
[ "Add", "a", "new", "mandate", "request", "to", "tree" ]
7035467af18e991c0c130d83294b0779aa3e1583
https://github.com/byrokrat/autogiro/blob/7035467af18e991c0c130d83294b0779aa3e1583/src/Writer/TreeBuilder.php#L122-L132
train
byrokrat/autogiro
src/Writer/TreeBuilder.php
TreeBuilder.addDeleteMandateRequest
public function addDeleteMandateRequest(string $payerNr): void { $this->mandates[] = new Record( 'DeleteMandateRequest', $this->payeeBgNode, new Number(0, $payerNr, 'PayerNumber'), new Text(0, str_pad('', 52)) ); }
php
public function addDeleteMandateRequest(string $payerNr): void { $this->mandates[] = new Record( 'DeleteMandateRequest', $this->payeeBgNode, new Number(0, $payerNr, 'PayerNumber'), new Text(0, str_pad('', 52)) ); }
[ "public", "function", "addDeleteMandateRequest", "(", "string", "$", "payerNr", ")", ":", "void", "{", "$", "this", "->", "mandates", "[", "]", "=", "new", "Record", "(", "'DeleteMandateRequest'", ",", "$", "this", "->", "payeeBgNode", ",", "new", "Number", ...
Add a delete mandate request to tree
[ "Add", "a", "delete", "mandate", "request", "to", "tree" ]
7035467af18e991c0c130d83294b0779aa3e1583
https://github.com/byrokrat/autogiro/blob/7035467af18e991c0c130d83294b0779aa3e1583/src/Writer/TreeBuilder.php#L137-L145
train
byrokrat/autogiro
src/Writer/TreeBuilder.php
TreeBuilder.addUpdateMandateRequest
public function addUpdateMandateRequest(string $payerNr, string $newPayerNr): void { $this->mandates[] = new Record( 'UpdateMandateRequest', $this->payeeBgNode, new Number(0, $payerNr, 'PayerNumber'), $this->payeeBgNode, new Number(0, $newPayerNr, 'PayerNumber'), new Text(0, str_pad('', 26)) ); }
php
public function addUpdateMandateRequest(string $payerNr, string $newPayerNr): void { $this->mandates[] = new Record( 'UpdateMandateRequest', $this->payeeBgNode, new Number(0, $payerNr, 'PayerNumber'), $this->payeeBgNode, new Number(0, $newPayerNr, 'PayerNumber'), new Text(0, str_pad('', 26)) ); }
[ "public", "function", "addUpdateMandateRequest", "(", "string", "$", "payerNr", ",", "string", "$", "newPayerNr", ")", ":", "void", "{", "$", "this", "->", "mandates", "[", "]", "=", "new", "Record", "(", "'UpdateMandateRequest'", ",", "$", "this", "->", "...
Add an update mandate request to tree
[ "Add", "an", "update", "mandate", "request", "to", "tree" ]
7035467af18e991c0c130d83294b0779aa3e1583
https://github.com/byrokrat/autogiro/blob/7035467af18e991c0c130d83294b0779aa3e1583/src/Writer/TreeBuilder.php#L178-L188
train
byrokrat/autogiro
src/Writer/TreeBuilder.php
TreeBuilder.addOutgoingPaymentRequest
public function addOutgoingPaymentRequest( string $payerNr, SEK $amount, \DateTimeInterface $date, string $ref, string $interval, int $repetitions ): void { $this->addPaymentRequest( 'OutgoingPaymentRequest', $payerNr, $amount, $date, $ref, $interval, $repetitions ); }
php
public function addOutgoingPaymentRequest( string $payerNr, SEK $amount, \DateTimeInterface $date, string $ref, string $interval, int $repetitions ): void { $this->addPaymentRequest( 'OutgoingPaymentRequest', $payerNr, $amount, $date, $ref, $interval, $repetitions ); }
[ "public", "function", "addOutgoingPaymentRequest", "(", "string", "$", "payerNr", ",", "SEK", "$", "amount", ",", "\\", "DateTimeInterface", "$", "date", ",", "string", "$", "ref", ",", "string", "$", "interval", ",", "int", "$", "repetitions", ")", ":", "...
Add an outgoing payment request to tree
[ "Add", "an", "outgoing", "payment", "request", "to", "tree" ]
7035467af18e991c0c130d83294b0779aa3e1583
https://github.com/byrokrat/autogiro/blob/7035467af18e991c0c130d83294b0779aa3e1583/src/Writer/TreeBuilder.php#L215-L232
train
byrokrat/autogiro
src/Writer/TreeBuilder.php
TreeBuilder.addImmediateIncomingPaymentRequest
public function addImmediateIncomingPaymentRequest(string $payerNr, SEK $amount, string $ref): void { $this->addImmediatePaymentRequest('IncomingPaymentRequest', $payerNr, $amount, $ref); }
php
public function addImmediateIncomingPaymentRequest(string $payerNr, SEK $amount, string $ref): void { $this->addImmediatePaymentRequest('IncomingPaymentRequest', $payerNr, $amount, $ref); }
[ "public", "function", "addImmediateIncomingPaymentRequest", "(", "string", "$", "payerNr", ",", "SEK", "$", "amount", ",", "string", "$", "ref", ")", ":", "void", "{", "$", "this", "->", "addImmediatePaymentRequest", "(", "'IncomingPaymentRequest'", ",", "$", "p...
Add an incoming payment at next possible bank date request to tree
[ "Add", "an", "incoming", "payment", "at", "next", "possible", "bank", "date", "request", "to", "tree" ]
7035467af18e991c0c130d83294b0779aa3e1583
https://github.com/byrokrat/autogiro/blob/7035467af18e991c0c130d83294b0779aa3e1583/src/Writer/TreeBuilder.php#L237-L240
train