repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
jan-dolata/crude-crud
src/Engine/CrudeSetupTrait/Actions.php
Actions.setFileAction
private function setFileAction() { array_push($this->actions, 'file'); $this->addForm = array_diff($this->addForm, ['files']); $this->editForm = array_diff($this->addForm, ['files']); $this->setModelDefaults('files', []); $this->setColumnFormat('files', 'files'); r...
php
private function setFileAction() { array_push($this->actions, 'file'); $this->addForm = array_diff($this->addForm, ['files']); $this->editForm = array_diff($this->addForm, ['files']); $this->setModelDefaults('files', []); $this->setColumnFormat('files', 'files'); r...
[ "private", "function", "setFileAction", "(", ")", "{", "array_push", "(", "$", "this", "->", "actions", ",", "'file'", ")", ";", "$", "this", "->", "addForm", "=", "array_diff", "(", "$", "this", "->", "addForm", ",", "[", "'files'", "]", ")", ";", "...
Set 'file' action
[ "Set", "file", "action" ]
train
https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/CrudeSetupTrait/Actions.php#L64-L75
blast-project/CoreBundle
src/Admin/Traits/ListActions.php
ListActions.setListActions
public function setListActions(array $actions) { foreach ($actions as $key => $action) { $this->addListAction($key, $action); } return $this; }
php
public function setListActions(array $actions) { foreach ($actions as $key => $action) { $this->addListAction($key, $action); } return $this; }
[ "public", "function", "setListActions", "(", "array", "$", "actions", ")", "{", "foreach", "(", "$", "actions", "as", "$", "key", "=>", "$", "action", ")", "{", "$", "this", "->", "addListAction", "(", "$", "key", ",", "$", "action", ")", ";", "}", ...
setListActions(). @param $actions array @return self
[ "setListActions", "()", "." ]
train
https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Admin/Traits/ListActions.php#L47-L54
blast-project/CoreBundle
src/Admin/Traits/ListActions.php
ListActions.addListAction
public function addListAction($name, array $action) { foreach ([ 'label' => $name, 'params' => [], 'translation_domain' => '', 'action' => '', 'route' => '', ] as $field => $value) { if (empty($action[$field])) { ...
php
public function addListAction($name, array $action) { foreach ([ 'label' => $name, 'params' => [], 'translation_domain' => '', 'action' => '', 'route' => '', ] as $field => $value) { if (empty($action[$field])) { ...
[ "public", "function", "addListAction", "(", "$", "name", ",", "array", "$", "action", ")", "{", "foreach", "(", "[", "'label'", "=>", "$", "name", ",", "'params'", "=>", "[", "]", ",", "'translation_domain'", "=>", "''", ",", "'action'", "=>", "''", ",...
addListAction(). @param $name string|null @param $action array @return self
[ "addListAction", "()", "." ]
train
https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Admin/Traits/ListActions.php#L64-L85
blast-project/CoreBundle
src/Admin/Traits/ListActions.php
ListActions.configureRoutes
protected function configureRoutes(RouteCollection $collection) { $librinfo = $this->getConfigurationPool()->getContainer()->getParameter('blast'); foreach ($this->getCurrentComposition() as $class) { if (isset($librinfo[$class][ListMapper::class]['add']['_actions'])) { ...
php
protected function configureRoutes(RouteCollection $collection) { $librinfo = $this->getConfigurationPool()->getContainer()->getParameter('blast'); foreach ($this->getCurrentComposition() as $class) { if (isset($librinfo[$class][ListMapper::class]['add']['_actions'])) { ...
[ "protected", "function", "configureRoutes", "(", "RouteCollection", "$", "collection", ")", "{", "$", "librinfo", "=", "$", "this", "->", "getConfigurationPool", "(", ")", "->", "getContainer", "(", ")", "->", "getParameter", "(", "'blast'", ")", ";", "foreach...
Add routes for custom list actions overrides SonataAdmin/Admin::configureRoutes() so that it is called automatically by Admin::buildRoutes(). @param RouteCollection $collection
[ "Add", "routes", "for", "custom", "list", "actions", "overrides", "SonataAdmin", "/", "Admin", "::", "configureRoutes", "()", "so", "that", "it", "is", "called", "automatically", "by", "Admin", "::", "buildRoutes", "()", "." ]
train
https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Admin/Traits/ListActions.php#L93-L111
dreamcommerce/common-bundle
src/DreamCommerce/Component/Common/Doctrine/DBAL/Types/EnumType.php
EnumType.convertToDatabaseValue
public function convertToDatabaseValue($value, AbstractPlatform $platform) { if ($value === null) { return $value; } Assert::oneOf($value, $this->values); return $value; }
php
public function convertToDatabaseValue($value, AbstractPlatform $platform) { if ($value === null) { return $value; } Assert::oneOf($value, $this->values); return $value; }
[ "public", "function", "convertToDatabaseValue", "(", "$", "value", ",", "AbstractPlatform", "$", "platform", ")", "{", "if", "(", "$", "value", "===", "null", ")", "{", "return", "$", "value", ";", "}", "Assert", "::", "oneOf", "(", "$", "value", ",", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamcommerce/common-bundle/blob/adb0850e90e63c3997f10d1ce110bf13a84b63ab/src/DreamCommerce/Component/Common/Doctrine/DBAL/Types/EnumType.php#L44-L53
gdbots/pbjx-bundle-php
src/Controller/PbjxControllerTrait.php
PbjxControllerTrait.renderPbj
protected function renderPbj( Message $pbj, string $template = 'page', ?Response $response = null, string $format = 'html' ): Response { if (is_callable([$this, 'renderUsingDeviceView'])) { return $this->renderUsingDeviceView( $this->pbjTemplate($p...
php
protected function renderPbj( Message $pbj, string $template = 'page', ?Response $response = null, string $format = 'html' ): Response { if (is_callable([$this, 'renderUsingDeviceView'])) { return $this->renderUsingDeviceView( $this->pbjTemplate($p...
[ "protected", "function", "renderPbj", "(", "Message", "$", "pbj", ",", "string", "$", "template", "=", "'page'", ",", "?", "Response", "$", "response", "=", "null", ",", "string", "$", "format", "=", "'html'", ")", ":", "Response", "{", "if", "(", "is_...
Renders the provided message (pbj) using a template which is resolved by calling the "pbjTemplate" method in this trait. @param Message $pbj @param string $template @param Response $response @param string $format @return Response
[ "Renders", "the", "provided", "message", "(", "pbj", ")", "using", "a", "template", "which", "is", "resolved", "by", "calling", "the", "pbjTemplate", "method", "in", "this", "trait", "." ]
train
https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Controller/PbjxControllerTrait.php#L22-L35
gdbots/pbjx-bundle-php
src/Controller/PbjxControllerTrait.php
PbjxControllerTrait.pbjTemplate
protected function pbjTemplate(Message $pbj, string $template, string $format = 'html'): string { $curie = $pbj::schema()->getCurie(); $path = str_replace('-', '_', sprintf('%s_%s/%s/%s', $curie->getVendor(), $curie->getPackage(), $curie->getCategory() ?: '_', $curie->getMessage() ...
php
protected function pbjTemplate(Message $pbj, string $template, string $format = 'html'): string { $curie = $pbj::schema()->getCurie(); $path = str_replace('-', '_', sprintf('%s_%s/%s/%s', $curie->getVendor(), $curie->getPackage(), $curie->getCategory() ?: '_', $curie->getMessage() ...
[ "protected", "function", "pbjTemplate", "(", "Message", "$", "pbj", ",", "string", "$", "template", ",", "string", "$", "format", "=", "'html'", ")", ":", "string", "{", "$", "curie", "=", "$", "pbj", "::", "schema", "(", ")", "->", "getCurie", "(", ...
Returns a reference to a twig template based on the schema of the provided message (pbj schema). This allows for component style development for pbj messages. You are asking for a template that can render your message (e.g. Article) as a "card", "modal", "page", etc. This can be combined with "DeviceViewRendererTrait...
[ "Returns", "a", "reference", "to", "a", "twig", "template", "based", "on", "the", "schema", "of", "the", "provided", "message", "(", "pbj", "schema", ")", ".", "This", "allows", "for", "component", "style", "development", "for", "pbj", "messages", ".", "Yo...
train
https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Controller/PbjxControllerTrait.php#L56-L65
chriswoodford/foursquare-php
lib/TheTwelve/Foursquare/PhotosGateway.php
PhotosGateway.getPhoto
public function getPhoto($photoId) { $resource = '/photos/' . $photoId; $response = $this->makeApiRequest($resource); return $response->photo; }
php
public function getPhoto($photoId) { $resource = '/photos/' . $photoId; $response = $this->makeApiRequest($resource); return $response->photo; }
[ "public", "function", "getPhoto", "(", "$", "photoId", ")", "{", "$", "resource", "=", "'/photos/'", ".", "$", "photoId", ";", "$", "response", "=", "$", "this", "->", "makeApiRequest", "(", "$", "resource", ")", ";", "return", "$", "response", "->", "...
Check a user to a photo, and maybe to a event too. @param string $venueId @return object https://developer.foursquare.com/docs/responses/photo @see https://developer.foursquare.com/docs/photos/photos
[ "Check", "a", "user", "to", "a", "photo", "and", "maybe", "to", "a", "event", "too", "." ]
train
https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/PhotosGateway.php#L14-L21
chriswoodford/foursquare-php
lib/TheTwelve/Foursquare/PhotosGateway.php
PhotosGateway.addPhoto
public function addPhoto($options) { $resource = '/photos/add'; $response = $this->makeApiRequest($resource, $options, 'POST'); return $response->photo; }
php
public function addPhoto($options) { $resource = '/photos/add'; $response = $this->makeApiRequest($resource, $options, 'POST'); return $response->photo; }
[ "public", "function", "addPhoto", "(", "$", "options", ")", "{", "$", "resource", "=", "'/photos/add'", ";", "$", "response", "=", "$", "this", "->", "makeApiRequest", "(", "$", "resource", ",", "$", "options", ",", "'POST'", ")", ";", "return", "$", "...
Check a user to a venue, and maybe to a event too. @param string $venueId @return object https://developer.foursquare.com/docs/responses/photo @see https://developer.foursquare.com/docs/photos/add
[ "Check", "a", "user", "to", "a", "venue", "and", "maybe", "to", "a", "event", "too", "." ]
train
https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/PhotosGateway.php#L29-L36
crossjoin/Css
src/Crossjoin/Css/Format/Rule/SelectorAbstract.php
SelectorAbstract.checkValue
public function checkValue(&$value) { if (is_string($value)) { $value = Placeholder::replaceStringsAndComments($value); $value = Placeholder::removeCommentPlaceholders($value, true); $value = preg_replace('/[ ]+/', ' ', $value); $value = Placeholder::replaceSt...
php
public function checkValue(&$value) { if (is_string($value)) { $value = Placeholder::replaceStringsAndComments($value); $value = Placeholder::removeCommentPlaceholders($value, true); $value = preg_replace('/[ ]+/', ' ', $value); $value = Placeholder::replaceSt...
[ "public", "function", "checkValue", "(", "&", "$", "value", ")", "{", "if", "(", "is_string", "(", "$", "value", ")", ")", "{", "$", "value", "=", "Placeholder", "::", "replaceStringsAndComments", "(", "$", "value", ")", ";", "$", "value", "=", "Placeh...
Checks the selector value. @param $value @return bool
[ "Checks", "the", "selector", "value", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/SelectorAbstract.php#L53-L67
axelitus/php-base
src/Float.php
Float.compare
public static function compare($float1, $float2) { if (!static::is($float1) || !static::is($float2)) { throw new \InvalidArgumentException("The \$float1 and \$float2 parameters must be of type float."); } return ($float1 - $float2); }
php
public static function compare($float1, $float2) { if (!static::is($float1) || !static::is($float2)) { throw new \InvalidArgumentException("The \$float1 and \$float2 parameters must be of type float."); } return ($float1 - $float2); }
[ "public", "static", "function", "compare", "(", "$", "float1", ",", "$", "float2", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "float1", ")", "||", "!", "static", "::", "is", "(", "$", "float2", ")", ")", "{", "throw", "new", "\\", ...
Compares two float values. The returning value contains the actual value difference. @param float $float1 The left operand. @param float $float2 The right operand. @return float Returns <0 if $float1<$float2, =0 if $float1 == $float2, >0 if $float1>$float2 @throws \InvalidArgumentException
[ "Compares", "two", "float", "values", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Float.php#L143-L150
axelitus/php-base
src/Float.php
Float.random
public static function random($min = 0.0, $max = 1.0, $round = null, $seed = null) { if (!static::is($min) || !static::is($max)) { throw new \InvalidArgumentException("The \$min and \$max parameters must be of type float."); } if ($min > $max) { trigger_error("The \$...
php
public static function random($min = 0.0, $max = 1.0, $round = null, $seed = null) { if (!static::is($min) || !static::is($max)) { throw new \InvalidArgumentException("The \$min and \$max parameters must be of type float."); } if ($min > $max) { trigger_error("The \$...
[ "public", "static", "function", "random", "(", "$", "min", "=", "0.0", ",", "$", "max", "=", "1.0", ",", "$", "round", "=", "null", ",", "$", "seed", "=", "null", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "min", ")", "||", "!"...
Generates a random float number between min and max. The function will correct the min and max if inverted. @param float $min Lower bound (inclusive) @param float $max Upper bound (non-inclusive) @param null|int $round Decimal places to round the number to (or null for no rounding) @param null|int $seed Ra...
[ "Generates", "a", "random", "float", "number", "between", "min", "and", "max", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Float.php#L254-L279
axelitus/php-base
src/Float.php
Float.add
public static function add($float1, $float2) { if (!static::is($float1) || !static::is($float2)) { throw new \InvalidArgumentException("The \$float1 and \$float2 parameters must be of type float."); } return ($float1 + $float2); }
php
public static function add($float1, $float2) { if (!static::is($float1) || !static::is($float2)) { throw new \InvalidArgumentException("The \$float1 and \$float2 parameters must be of type float."); } return ($float1 + $float2); }
[ "public", "static", "function", "add", "(", "$", "float1", ",", "$", "float2", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "float1", ")", "||", "!", "static", "::", "is", "(", "$", "float2", ")", ")", "{", "throw", "new", "\\", "I...
Adds a number to another number. @param float $float1 The left operand. @param float $float2 The right operand. @return float The result of the operation. @throws \InvalidArgumentException
[ "Adds", "a", "number", "to", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Float.php#L310-L317
axelitus/php-base
src/Float.php
Float.sub
public static function sub($float1, $float2) { if (!static::is($float1) || !static::is($float2)) { throw new \InvalidArgumentException("The \$float1 and \$float2 parameters must be of type float."); } return ($float1 - $float2); }
php
public static function sub($float1, $float2) { if (!static::is($float1) || !static::is($float2)) { throw new \InvalidArgumentException("The \$float1 and \$float2 parameters must be of type float."); } return ($float1 - $float2); }
[ "public", "static", "function", "sub", "(", "$", "float1", ",", "$", "float2", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "float1", ")", "||", "!", "static", "::", "is", "(", "$", "float2", ")", ")", "{", "throw", "new", "\\", "I...
Subtracts a number from another number. @param float $float1 The left operand. @param float $float2 The right operand. @return float The result of the operation. @throws \InvalidArgumentException
[ "Subtracts", "a", "number", "from", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Float.php#L328-L335
axelitus/php-base
src/Float.php
Float.mul
public static function mul($float1, $float2) { if (!static::is($float1) || !static::is($float2)) { throw new \InvalidArgumentException("The \$float1 and \$float2 parameters must be of type float."); } return ($float1 * $float2); }
php
public static function mul($float1, $float2) { if (!static::is($float1) || !static::is($float2)) { throw new \InvalidArgumentException("The \$float1 and \$float2 parameters must be of type float."); } return ($float1 * $float2); }
[ "public", "static", "function", "mul", "(", "$", "float1", ",", "$", "float2", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "float1", ")", "||", "!", "static", "::", "is", "(", "$", "float2", ")", ")", "{", "throw", "new", "\\", "I...
Multiplies a number by another number. @param float $float1 The left operand. @param float $float2 The right operand. @return float The result of the operation. @throws \InvalidArgumentException
[ "Multiplies", "a", "number", "by", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Float.php#L346-L353
axelitus/php-base
src/Float.php
Float.div
public static function div($float1, $float2) { if (!static::is($float1) || !static::is($float2)) { throw new \InvalidArgumentException("The \$float1 and \$float2 parameters must be of type float."); } if ($float2 == 0) { throw new \InvalidArgumentException("Cannot di...
php
public static function div($float1, $float2) { if (!static::is($float1) || !static::is($float2)) { throw new \InvalidArgumentException("The \$float1 and \$float2 parameters must be of type float."); } if ($float2 == 0) { throw new \InvalidArgumentException("Cannot di...
[ "public", "static", "function", "div", "(", "$", "float1", ",", "$", "float2", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "float1", ")", "||", "!", "static", "::", "is", "(", "$", "float2", ")", ")", "{", "throw", "new", "\\", "I...
Divides a number by another number. @param float $float1 The left operand. @param float $float2 The right operand. @return float The result of the operation. @throws \InvalidArgumentException
[ "Divides", "a", "number", "by", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Float.php#L364-L375
ejsmont-artur/phpProxyBuilder
src/PhpProxyBuilder/Adapter/Cache/SimpleArrayCache.php
SimpleArrayCache.set
public function set($key, $value, $ttl = null) { $key = md5($key); // remove oldest item only if reached limit if ($this->maxSize) { if (count($this->items) >= $this->maxSize) { if (!isset($this->items[$key])) { array_shift($this->items); ...
php
public function set($key, $value, $ttl = null) { $key = md5($key); // remove oldest item only if reached limit if ($this->maxSize) { if (count($this->items) >= $this->maxSize) { if (!isset($this->items[$key])) { array_shift($this->items); ...
[ "public", "function", "set", "(", "$", "key", ",", "$", "value", ",", "$", "ttl", "=", "null", ")", "{", "$", "key", "=", "md5", "(", "$", "key", ")", ";", "// remove oldest item only if reached limit", "if", "(", "$", "this", "->", "maxSize", ")", "...
Save value in cache for up to optionl $ttl seconds @param string $key cache key @param mixed $value value to cache (will be serialised) @param int $ttl optional seconds to live or default value set by implementation @return void
[ "Save", "value", "in", "cache", "for", "up", "to", "optionl", "$ttl", "seconds" ]
train
https://github.com/ejsmont-artur/phpProxyBuilder/blob/ef7ec14e5d18eeba7a93e3617a0fdb5b146d6480/src/PhpProxyBuilder/Adapter/Cache/SimpleArrayCache.php#L68-L80
pageon/SlackWebhookMonolog
src/Slack/Attachment/Colour.php
Colour.setColour
private function setColour($colour) { if (!in_array($colour, $this->getDefaultColours()) && !preg_match( '_^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$_', $colour ) ) { throw new InvalidColourException( sprintf( ...
php
private function setColour($colour) { if (!in_array($colour, $this->getDefaultColours()) && !preg_match( '_^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$_', $colour ) ) { throw new InvalidColourException( sprintf( ...
[ "private", "function", "setColour", "(", "$", "colour", ")", "{", "if", "(", "!", "in_array", "(", "$", "colour", ",", "$", "this", "->", "getDefaultColours", "(", ")", ")", "&&", "!", "preg_match", "(", "'_^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$_'", ",", "$", ...
Set the colour if it is a valid colour. @param $colour
[ "Set", "the", "colour", "if", "it", "is", "a", "valid", "colour", "." ]
train
https://github.com/pageon/SlackWebhookMonolog/blob/6755060ddd6429620fd4c7decbb95f05463fc36b/src/Slack/Attachment/Colour.php#L40-L58
bfitech/zapcore
dev/RoutingDev.php
RoutingDev.request
public function request( string $request_uri=null, string $request_method='GET', array $args=[], array $cookie=[] ) { self::$core->deinit()->reset(); self::$core->config('home', '/'); $_SERVER['REQUEST_URI'] = $request_uri ? $request_uri : '/'; $_SERVER['REQUEST_METHOD'] = $request_method; $_COOKIE = ...
php
public function request( string $request_uri=null, string $request_method='GET', array $args=[], array $cookie=[] ) { self::$core->deinit()->reset(); self::$core->config('home', '/'); $_SERVER['REQUEST_URI'] = $request_uri ? $request_uri : '/'; $_SERVER['REQUEST_METHOD'] = $request_method; $_COOKIE = ...
[ "public", "function", "request", "(", "string", "$", "request_uri", "=", "null", ",", "string", "$", "request_method", "=", "'GET'", ",", "array", "$", "args", "=", "[", "]", ",", "array", "$", "cookie", "=", "[", "]", ")", "{", "self", "::", "$", ...
Fake request. Use this to simulate HTTP request. To set args to callback handler without relying on collected HTTP variables, use $args. @param string $request_uri Simulated request URI. @param string $request_method Simulated request method. @param array $args Simulated callback args. @param array $cookie Simulated ...
[ "Fake", "request", "." ]
train
https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/dev/RoutingDev.php#L45-L58
dengyongbin/loopeer-lib
src/Services/Baidu-Push-Server-SDK-Php-3.0.1/sdk.php
PushSDK.getMapping
private function getMapping(){ /** * restApi 方法映射. * * 每项描述一个method的 包含以下内容: * url: string 方法调用位置 * required: array<K,V> 必须的参数列表,K有参数名, V为验证条件 * optional: array<K,V> 可选的参数列表,K有参数名, V为验证条件 * before: string 指定一个预处理方法. 用于在发送http r...
php
private function getMapping(){ /** * restApi 方法映射. * * 每项描述一个method的 包含以下内容: * url: string 方法调用位置 * required: array<K,V> 必须的参数列表,K有参数名, V为验证条件 * optional: array<K,V> 可选的参数列表,K有参数名, V为验证条件 * before: string 指定一个预处理方法. 用于在发送http r...
[ "private", "function", "getMapping", "(", ")", "{", "/**\n * restApi 方法映射. \n * \n * 每项描述一个method的 包含以下内容:\n * url: string 方法调用位置\n * required: array<K,V> 必须的参数列表,K有参数名, V为验证条件\n * optional: array<K,V> 可选的参数列表,K有参数名, V为验证条件\n * ...
为兼容php 5.2及5.4,不支持将const写成array. 获得一个方法映射关系的array. @return multitype:multitype:string multitype:string multitype:string multitype: multitype:string multitype:string multitype: multitype:string multitype:string
[ "为兼容php", "5", ".", "2及5", ".", "4", "不支持将const写成array", "." ]
train
https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/Baidu-Push-Server-SDK-Php-3.0.1/sdk.php#L142-L354
dengyongbin/loopeer-lib
src/Services/Baidu-Push-Server-SDK-Php-3.0.1/sdk.php
PushSDK.verifyMessage
protected function verifyMessage(&$payload) { if (is_array($payload ['msg'])) { $payload ['msg'] = json_encode($payload ['msg']); } if (array_key_exists('send_time', $payload)) { if ($payload ['send_time'] < time() + 60) { $this -> onErro...
php
protected function verifyMessage(&$payload) { if (is_array($payload ['msg'])) { $payload ['msg'] = json_encode($payload ['msg']); } if (array_key_exists('send_time', $payload)) { if ($payload ['send_time'] < time() + 60) { $this -> onErro...
[ "protected", "function", "verifyMessage", "(", "&", "$", "payload", ")", "{", "if", "(", "is_array", "(", "$", "payload", "[", "'msg'", "]", ")", ")", "{", "$", "payload", "[", "'msg'", "]", "=", "json_encode", "(", "$", "payload", "[", "'msg'", "]",...
验证一个http请求参数中的msg内容是否正确 @param array &$payload @return boolean
[ "验证一个http请求参数中的msg内容是否正确" ]
train
https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/Baidu-Push-Server-SDK-Php-3.0.1/sdk.php#L503-L517
dengyongbin/loopeer-lib
src/Services/Baidu-Push-Server-SDK-Php-3.0.1/sdk.php
PushSDK.verifyGroup
protected function verifyGroup(&$payload){ // 消息格式如果错误不继续. if(!$this->verifyMessage($payload)){ // 错误信息应有verifyMessage中生成. return false; } // 没有type,认为是push/tags的简单调用方式, 需要将type置为1 $payload['type'] = array_key_exists('typ...
php
protected function verifyGroup(&$payload){ // 消息格式如果错误不继续. if(!$this->verifyMessage($payload)){ // 错误信息应有verifyMessage中生成. return false; } // 没有type,认为是push/tags的简单调用方式, 需要将type置为1 $payload['type'] = array_key_exists('typ...
[ "protected", "function", "verifyGroup", "(", "&", "$", "payload", ")", "{", "// 消息格式如果错误不继续.", "if", "(", "!", "$", "this", "->", "verifyMessage", "(", "$", "payload", ")", ")", "{", "// 错误信息应有verifyMessage中生成.", "return", "false", ";", "}", "// 没有type,认为是push...
验证一个组播API的http请求参数中的是否正确 @param array $payload @return boolean
[ "验证一个组播API的http请求参数中的是否正确" ]
train
https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/Baidu-Push-Server-SDK-Php-3.0.1/sdk.php#L523-L557
dengyongbin/loopeer-lib
src/Services/Baidu-Push-Server-SDK-Php-3.0.1/sdk.php
PushSDK.verifyChannelIds
protected function verifyChannelIds(&$payload){ if(array_key_exists('msg', $payload)){ // 消息格式如果错误不继续. if(!$this->verifyMessage($payload)){ // 错误信息应有verifyMessage中生成. return false; } } if(is_array($payload['cha...
php
protected function verifyChannelIds(&$payload){ if(array_key_exists('msg', $payload)){ // 消息格式如果错误不继续. if(!$this->verifyMessage($payload)){ // 错误信息应有verifyMessage中生成. return false; } } if(is_array($payload['cha...
[ "protected", "function", "verifyChannelIds", "(", "&", "$", "payload", ")", "{", "if", "(", "array_key_exists", "(", "'msg'", ",", "$", "payload", ")", ")", "{", "// 消息格式如果错误不继续.", "if", "(", "!", "$", "this", "->", "verifyMessage", "(", "$", "payload", ...
验证一个API请求中的channleIds是否正确 @param array $payload @return boolean
[ "验证一个API请求中的channleIds是否正确" ]
train
https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/Baidu-Push-Server-SDK-Php-3.0.1/sdk.php#L563-L578
dengyongbin/loopeer-lib
src/Services/Baidu-Push-Server-SDK-Php-3.0.1/sdk.php
PushSDK.verifyMsgIds
protected function verifyMsgIds(&$payload){ if(isset($payload['msg_id']) && is_array($payload['msg_id'])){ $payload['msg_id'] = json_encode($payload['msg_id']); } return true; }
php
protected function verifyMsgIds(&$payload){ if(isset($payload['msg_id']) && is_array($payload['msg_id'])){ $payload['msg_id'] = json_encode($payload['msg_id']); } return true; }
[ "protected", "function", "verifyMsgIds", "(", "&", "$", "payload", ")", "{", "if", "(", "isset", "(", "$", "payload", "[", "'msg_id'", "]", ")", "&&", "is_array", "(", "$", "payload", "[", "'msg_id'", "]", ")", ")", "{", "$", "payload", "[", "'msg_id...
验证一个API请求中的msgIds是否正确 @param array $payload @return boolean
[ "验证一个API请求中的msgIds是否正确" ]
train
https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/Baidu-Push-Server-SDK-Php-3.0.1/sdk.php#L584-L591
dengyongbin/loopeer-lib
src/Services/Baidu-Push-Server-SDK-Php-3.0.1/sdk.php
PushSDK.verifyRangeTypes
protected function verifyRangeTypes(&$payload){ if(isset($payload['query_type']) && is_array($payload['query_type'])){ $payload['query_type'] = json_encode($payload['query_type']); } return true; }
php
protected function verifyRangeTypes(&$payload){ if(isset($payload['query_type']) && is_array($payload['query_type'])){ $payload['query_type'] = json_encode($payload['query_type']); } return true; }
[ "protected", "function", "verifyRangeTypes", "(", "&", "$", "payload", ")", "{", "if", "(", "isset", "(", "$", "payload", "[", "'query_type'", "]", ")", "&&", "is_array", "(", "$", "payload", "[", "'query_type'", "]", ")", ")", "{", "$", "payload", "["...
验证一个API请求中的range_types是否正确 @param array $payload @return boolean
[ "验证一个API请求中的range_types是否正确" ]
train
https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/Baidu-Push-Server-SDK-Php-3.0.1/sdk.php#L597-L604
huasituo/hstcms
src/Libraries/Fields/Checkbox.php
Checkbox.insert_value
public function insert_value(Request $request, $filed, $postData = []) { $value = $request->get($field['fieldname']); $postData[$field['relatedtable']][$field['fieldname']] = implode(',', $value); return $postData; }
php
public function insert_value(Request $request, $filed, $postData = []) { $value = $request->get($field['fieldname']); $postData[$field['relatedtable']][$field['fieldname']] = implode(',', $value); return $postData; }
[ "public", "function", "insert_value", "(", "Request", "$", "request", ",", "$", "filed", ",", "$", "postData", "=", "[", "]", ")", "{", "$", "value", "=", "$", "request", "->", "get", "(", "$", "field", "[", "'fieldname'", "]", ")", ";", "$", "post...
处理输入数据,提供给入库
[ "处理输入数据,提供给入库" ]
train
https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/Fields/Checkbox.php#L101-L106
ftrrtf/FtrrtfRollbarBundle
DependencyInjection/FtrrtfRollbarExtension.php
FtrrtfRollbarExtension.prepareLogsDir
private function prepareLogsDir($logsDir) { if (!is_dir($logsDir)) { if (false === @mkdir($logsDir, 0777, true) && !is_dir($logsDir)) { throw new \RuntimeException(sprintf("Unable to create the logs directory (%s)\n", $logsDir)); } } elseif (!is_writable($logs...
php
private function prepareLogsDir($logsDir) { if (!is_dir($logsDir)) { if (false === @mkdir($logsDir, 0777, true) && !is_dir($logsDir)) { throw new \RuntimeException(sprintf("Unable to create the logs directory (%s)\n", $logsDir)); } } elseif (!is_writable($logs...
[ "private", "function", "prepareLogsDir", "(", "$", "logsDir", ")", "{", "if", "(", "!", "is_dir", "(", "$", "logsDir", ")", ")", "{", "if", "(", "false", "===", "@", "mkdir", "(", "$", "logsDir", ",", "0777", ",", "true", ")", "&&", "!", "is_dir", ...
Create logs dir if does not exist. @param $logsDir @throws \RuntimeException
[ "Create", "logs", "dir", "if", "does", "not", "exist", "." ]
train
https://github.com/ftrrtf/FtrrtfRollbarBundle/blob/64c75862b80a4a1ed9e98c0d217003e84df40dd7/DependencyInjection/FtrrtfRollbarExtension.php#L91-L100
movoin/one-swoole
src/Validation/Validator.php
Validator.getScenarios
public function getScenarios(): array { if ($this->scenario === null) { return $this->rules; } $rules = []; foreach ($this->rules as $rule) { if (! isset($rule['on']) && ! isset($rule['except'])) { $rules[] = $rule; } elseif (isse...
php
public function getScenarios(): array { if ($this->scenario === null) { return $this->rules; } $rules = []; foreach ($this->rules as $rule) { if (! isset($rule['on']) && ! isset($rule['except'])) { $rules[] = $rule; } elseif (isse...
[ "public", "function", "getScenarios", "(", ")", ":", "array", "{", "if", "(", "$", "this", "->", "scenario", "===", "null", ")", "{", "return", "$", "this", "->", "rules", ";", "}", "$", "rules", "=", "[", "]", ";", "foreach", "(", "$", "this", "...
获得当前场景校验规则 @return array
[ "获得当前场景校验规则" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Validation/Validator.php#L188-L209
movoin/one-swoole
src/Validation/Validator.php
Validator.validate
public function validate(array $attributes): bool { $rules = $this->getScenarios(); foreach ($rules as $rule) { $names = array_map('trim', explode(',', $rule[0])); array_walk($names, function ($name) use ($attributes, $rule) { $this->validateValue($attributes...
php
public function validate(array $attributes): bool { $rules = $this->getScenarios(); foreach ($rules as $rule) { $names = array_map('trim', explode(',', $rule[0])); array_walk($names, function ($name) use ($attributes, $rule) { $this->validateValue($attributes...
[ "public", "function", "validate", "(", "array", "$", "attributes", ")", ":", "bool", "{", "$", "rules", "=", "$", "this", "->", "getScenarios", "(", ")", ";", "foreach", "(", "$", "rules", "as", "$", "rule", ")", "{", "$", "names", "=", "array_map", ...
校验数据 @param array $attributes @return bool @throws \One\Validation\Exceptions\ValidationException
[ "校验数据" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Validation/Validator.php#L219-L234
movoin/one-swoole
src/Validation/Validator.php
Validator.validateValue
public function validateValue(array $attributes, string $name, array $rule): bool { // 删除开始的字段名 array_shift($rule); // 取出校验器识别 $validatorName = array_shift($rule); // 创建校验器 $validator = $this->createValidator($validatorName); return $validator($attributes, $n...
php
public function validateValue(array $attributes, string $name, array $rule): bool { // 删除开始的字段名 array_shift($rule); // 取出校验器识别 $validatorName = array_shift($rule); // 创建校验器 $validator = $this->createValidator($validatorName); return $validator($attributes, $n...
[ "public", "function", "validateValue", "(", "array", "$", "attributes", ",", "string", "$", "name", ",", "array", "$", "rule", ")", ":", "bool", "{", "// 删除开始的字段名", "array_shift", "(", "$", "rule", ")", ";", "// 取出校验器识别", "$", "validatorName", "=", "array_...
校验值(此方法忽略场景) @param array $attributes @param string $name @param array $rule @return bool @throws \One\Validation\Exceptions\ValidationException
[ "校验值(此方法忽略场景)" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Validation/Validator.php#L246-L256
movoin/one-swoole
src/Validation/Validator.php
Validator.hasValidator
public function hasValidator(string $name): bool { return isset($this->builtinValidators[$name]) || isset($this->customValidators[$name]) || isset($this->validators[$name]); }
php
public function hasValidator(string $name): bool { return isset($this->builtinValidators[$name]) || isset($this->customValidators[$name]) || isset($this->validators[$name]); }
[ "public", "function", "hasValidator", "(", "string", "$", "name", ")", ":", "bool", "{", "return", "isset", "(", "$", "this", "->", "builtinValidators", "[", "$", "name", "]", ")", "||", "isset", "(", "$", "this", "->", "customValidators", "[", "$", "n...
判断是否校验器 @param string $name @return bool
[ "判断是否校验器" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Validation/Validator.php#L265-L270
movoin/one-swoole
src/Validation/Validator.php
Validator.addValidator
public function addValidator(string $name, $validator) { if ($this->hasValidator($name)) { throw new ValidationException("Validator `{$name}` already exists"); } elseif (! $this->isCustomValidator($validator)) { throw new ValidationException( "`Validator` expe...
php
public function addValidator(string $name, $validator) { if ($this->hasValidator($name)) { throw new ValidationException("Validator `{$name}` already exists"); } elseif (! $this->isCustomValidator($validator)) { throw new ValidationException( "`Validator` expe...
[ "public", "function", "addValidator", "(", "string", "$", "name", ",", "$", "validator", ")", "{", "if", "(", "$", "this", "->", "hasValidator", "(", "$", "name", ")", ")", "{", "throw", "new", "ValidationException", "(", "\"Validator `{$name}` already exists\...
添加校验器 ``` // 自定义校验器 1 $validator->addValidator('unique', [$this, 'unique']); // 自定义校验器 2 $validator->addValidator('unique', '\\App\\Validators\\Unique'); // 自定义校验器 3 $validator->addValidator('unique', Unique::class); // 自定义校验器 4 $validator->addValidator('unique', function ($attributes, $name, $parameters) { // do s...
[ "添加校验器" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Validation/Validator.php#L297-L308
movoin/one-swoole
src/Validation/Validator.php
Validator.createValidator
public function createValidator(string $name): ValidatorInterface { if (isset($this->validators[$name])) { return $this->validators[$name]; } if (($validator = $this->getValidatorDefine($name)) !== false) { if (Assert::string($validator)) { if (Assert...
php
public function createValidator(string $name): ValidatorInterface { if (isset($this->validators[$name])) { return $this->validators[$name]; } if (($validator = $this->getValidatorDefine($name)) !== false) { if (Assert::string($validator)) { if (Assert...
[ "public", "function", "createValidator", "(", "string", "$", "name", ")", ":", "ValidatorInterface", "{", "if", "(", "isset", "(", "$", "this", "->", "validators", "[", "$", "name", "]", ")", ")", "{", "return", "$", "this", "->", "validators", "[", "$...
创建校验器实例 @param string $name @return \One\Validation\Contracts\Validator @throws \One\Validation\Exceptions\ValidationException
[ "创建校验器实例" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Validation/Validator.php#L318-L348
movoin/one-swoole
src/Validation/Validator.php
Validator.getValidatorDefine
protected function getValidatorDefine(string $name) { if (isset($this->builtinValidators[$name])) { return $this->builtinValidators[$name]; } if (isset($this->customValidators[$name])) { return $this->customValidators[$name]; } return false; }
php
protected function getValidatorDefine(string $name) { if (isset($this->builtinValidators[$name])) { return $this->builtinValidators[$name]; } if (isset($this->customValidators[$name])) { return $this->customValidators[$name]; } return false; }
[ "protected", "function", "getValidatorDefine", "(", "string", "$", "name", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "builtinValidators", "[", "$", "name", "]", ")", ")", "{", "return", "$", "this", "->", "builtinValidators", "[", "$", "name"...
获得校验器定义 @param string $name @return array|string|callable|false
[ "获得校验器定义" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Validation/Validator.php#L357-L368
movoin/one-swoole
src/Validation/Validator.php
Validator.matchScenario
private function matchScenario($scenarios): bool { if (Assert::stringNotEmpty($scenarios)) { $scenarios = explode(',', $scenarios); } $scenarios = array_map('trim', $scenarios); return Assert::oneOf($this->scenario, $scenarios); }
php
private function matchScenario($scenarios): bool { if (Assert::stringNotEmpty($scenarios)) { $scenarios = explode(',', $scenarios); } $scenarios = array_map('trim', $scenarios); return Assert::oneOf($this->scenario, $scenarios); }
[ "private", "function", "matchScenario", "(", "$", "scenarios", ")", ":", "bool", "{", "if", "(", "Assert", "::", "stringNotEmpty", "(", "$", "scenarios", ")", ")", "{", "$", "scenarios", "=", "explode", "(", "','", ",", "$", "scenarios", ")", ";", "}",...
匹配场景 @param string|array $scenarios @return bool
[ "匹配场景" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Validation/Validator.php#L390-L399
Codeception/Aerospike-module
src/Module/Aerospike.php
Aerospike._before
public function _before(TestInterface $test) { if ($this->config['reconnect']) { $this->connect(); } $this->removeInserted(); parent::_before($test); }
php
public function _before(TestInterface $test) { if ($this->config['reconnect']) { $this->connect(); } $this->removeInserted(); parent::_before($test); }
[ "public", "function", "_before", "(", "TestInterface", "$", "test", ")", "{", "if", "(", "$", "this", "->", "config", "[", "'reconnect'", "]", ")", "{", "$", "this", "->", "connect", "(", ")", ";", "}", "$", "this", "->", "removeInserted", "(", ")", ...
Code to run before each test @param TestInterface $test
[ "Code", "to", "run", "before", "each", "test" ]
train
https://github.com/Codeception/Aerospike-module/blob/bef55ed40280ad18700daf7c93b2e0fa8fe43628/src/Module/Aerospike.php#L86-L95
Codeception/Aerospike-module
src/Module/Aerospike.php
Aerospike._after
public function _after(TestInterface $test) { if ($this->config['reconnect']) { $this->disconnect(); } parent::_after($test); }
php
public function _after(TestInterface $test) { if ($this->config['reconnect']) { $this->disconnect(); } parent::_after($test); }
[ "public", "function", "_after", "(", "TestInterface", "$", "test", ")", "{", "if", "(", "$", "this", "->", "config", "[", "'reconnect'", "]", ")", "{", "$", "this", "->", "disconnect", "(", ")", ";", "}", "parent", "::", "_after", "(", "$", "test", ...
Code to run after each test @param TestInterface $test
[ "Code", "to", "run", "after", "each", "test" ]
train
https://github.com/Codeception/Aerospike-module/blob/bef55ed40280ad18700daf7c93b2e0fa8fe43628/src/Module/Aerospike.php#L102-L109
Codeception/Aerospike-module
src/Module/Aerospike.php
Aerospike.grabValueFromAerospike
public function grabValueFromAerospike($key) { $akey = $this->buildKey($key); $status = $this->aerospike->get($akey, $data); if ($status != \Aerospike::OK) { $this->fail( strtr( "[:errno:] Unable to grab ':key:' from the database: :error:", ...
php
public function grabValueFromAerospike($key) { $akey = $this->buildKey($key); $status = $this->aerospike->get($akey, $data); if ($status != \Aerospike::OK) { $this->fail( strtr( "[:errno:] Unable to grab ':key:' from the database: :error:", ...
[ "public", "function", "grabValueFromAerospike", "(", "$", "key", ")", "{", "$", "akey", "=", "$", "this", "->", "buildKey", "(", "$", "key", ")", ";", "$", "status", "=", "$", "this", "->", "aerospike", "->", "get", "(", "$", "akey", ",", "$", "dat...
Grabs value from Aerospike by key. Example: ```php <?php $users_count = $I->grabValueFromAerospike('users_count'); ?> ``` @param $key @return mixed
[ "Grabs", "value", "from", "Aerospike", "by", "key", "." ]
train
https://github.com/Codeception/Aerospike-module/blob/bef55ed40280ad18700daf7c93b2e0fa8fe43628/src/Module/Aerospike.php#L135-L156
Codeception/Aerospike-module
src/Module/Aerospike.php
Aerospike.seeInAerospike
public function seeInAerospike($key, $value = false) { $akey = $this->buildKey($key); $status = $this->aerospike->get($akey, $actual); if ($status != \Aerospike::OK) { $this->fail( strtr( "[:errno:] Unable to get ':key:' from the database: :er...
php
public function seeInAerospike($key, $value = false) { $akey = $this->buildKey($key); $status = $this->aerospike->get($akey, $actual); if ($status != \Aerospike::OK) { $this->fail( strtr( "[:errno:] Unable to get ':key:' from the database: :er...
[ "public", "function", "seeInAerospike", "(", "$", "key", ",", "$", "value", "=", "false", ")", "{", "$", "akey", "=", "$", "this", "->", "buildKey", "(", "$", "key", ")", ";", "$", "status", "=", "$", "this", "->", "aerospike", "->", "get", "(", ...
Checks item in Aerospike exists and the same as expected. Example: ```php <?php $I->seeInAerospike('key'); $I->seeInAerospike('key', 'value'); ?> @param $key @param mixed $value
[ "Checks", "item", "in", "Aerospike", "exists", "and", "the", "same", "as", "expected", "." ]
train
https://github.com/Codeception/Aerospike-module/blob/bef55ed40280ad18700daf7c93b2e0fa8fe43628/src/Module/Aerospike.php#L172-L192
Codeception/Aerospike-module
src/Module/Aerospike.php
Aerospike.dontSeeInAerospike
public function dontSeeInAerospike($key, $value = false) { $akey = $this->buildKey($key); if ($value === false) { $status = $this->aerospike->get($akey, $record); $this->assertSame(\Aerospike::ERR_RECORD_NOT_FOUND, $status); return; } $this->aero...
php
public function dontSeeInAerospike($key, $value = false) { $akey = $this->buildKey($key); if ($value === false) { $status = $this->aerospike->get($akey, $record); $this->assertSame(\Aerospike::ERR_RECORD_NOT_FOUND, $status); return; } $this->aero...
[ "public", "function", "dontSeeInAerospike", "(", "$", "key", ",", "$", "value", "=", "false", ")", "{", "$", "akey", "=", "$", "this", "->", "buildKey", "(", "$", "key", ")", ";", "if", "(", "$", "value", "===", "false", ")", "{", "$", "status", ...
Checks item in Aerospike does not exist or is the same as expected. Example: ```php <?php $I->dontSeeInAerospike('key'); $I->dontSeeInAerospike('key', 'value'); ?> @param string $key Key @param mixed $value Value
[ "Checks", "item", "in", "Aerospike", "does", "not", "exist", "or", "is", "the", "same", "as", "expected", "." ]
train
https://github.com/Codeception/Aerospike-module/blob/bef55ed40280ad18700daf7c93b2e0fa8fe43628/src/Module/Aerospike.php#L208-L226
Codeception/Aerospike-module
src/Module/Aerospike.php
Aerospike.haveInAerospike
public function haveInAerospike($key, $value, $ttl = 0) { $akey = $this->buildKey($key); $bins = ['value' => $value]; $status = $this->aerospike->put( $akey, $bins, $ttl, [\Aerospike::OPT_POLICY_KEY => \Aerospike::POLICY_KEY_SEND] ); ...
php
public function haveInAerospike($key, $value, $ttl = 0) { $akey = $this->buildKey($key); $bins = ['value' => $value]; $status = $this->aerospike->put( $akey, $bins, $ttl, [\Aerospike::OPT_POLICY_KEY => \Aerospike::POLICY_KEY_SEND] ); ...
[ "public", "function", "haveInAerospike", "(", "$", "key", ",", "$", "value", ",", "$", "ttl", "=", "0", ")", "{", "$", "akey", "=", "$", "this", "->", "buildKey", "(", "$", "key", ")", ";", "$", "bins", "=", "[", "'value'", "=>", "$", "value", ...
Inserts data into Aerospike database. This data will be erased after the test. ```php <?php $I->haveInAerospike('users', ['name' => 'miles', 'email' => 'miles@davis.com']); ?> ``` @param string $key Key @param mixed $value Value @param int $ttl The time-to-live in seconds for the record. [Optional] @return arr...
[ "Inserts", "data", "into", "Aerospike", "database", "." ]
train
https://github.com/Codeception/Aerospike-module/blob/bef55ed40280ad18700daf7c93b2e0fa8fe43628/src/Module/Aerospike.php#L245-L274
Codeception/Aerospike-module
src/Module/Aerospike.php
Aerospike.buildKey
protected function buildKey($key) { return $this->aerospike->initKey( $this->config['namespace'], $this->config['set'], $this->config['prefix'] . $key ); }
php
protected function buildKey($key) { return $this->aerospike->initKey( $this->config['namespace'], $this->config['set'], $this->config['prefix'] . $key ); }
[ "protected", "function", "buildKey", "(", "$", "key", ")", "{", "return", "$", "this", "->", "aerospike", "->", "initKey", "(", "$", "this", "->", "config", "[", "'namespace'", "]", ",", "$", "this", "->", "config", "[", "'set'", "]", ",", "$", "this...
Generates a unique key used for storing cache in Aerospike DB. @param string $key Cache key @return array
[ "Generates", "a", "unique", "key", "used", "for", "storing", "cache", "in", "Aerospike", "DB", "." ]
train
https://github.com/Codeception/Aerospike-module/blob/bef55ed40280ad18700daf7c93b2e0fa8fe43628/src/Module/Aerospike.php#L359-L366
blast-project/CoreBundle
src/Command/GenerateAdminCommand.php
GenerateAdminCommand.configure
public function configure() { $this ->setName('blast:generate:admin') ->setDescription('Generates an admin class based on the given model class') ->addArgument('model', InputArgument::REQUIRED, 'The fully qualified model class') ->addOption('bundle', 'b', Inpu...
php
public function configure() { $this ->setName('blast:generate:admin') ->setDescription('Generates an admin class based on the given model class') ->addArgument('model', InputArgument::REQUIRED, 'The fully qualified model class') ->addOption('bundle', 'b', Inpu...
[ "public", "function", "configure", "(", ")", "{", "$", "this", "->", "setName", "(", "'blast:generate:admin'", ")", "->", "setDescription", "(", "'Generates an admin class based on the given model class'", ")", "->", "addArgument", "(", "'model'", ",", "InputArgument", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Command/GenerateAdminCommand.php#L51-L64
blast-project/CoreBundle
src/Command/GenerateAdminCommand.php
GenerateAdminCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $modelClass = Validators::validateClass($input->getArgument('model')); $modelClassBasename = current(array_slice(explode('\\', $modelClass), -1)); $bundle = $this->getBundle($input->getOption('bundle') ?: $this->get...
php
protected function execute(InputInterface $input, OutputInterface $output) { $modelClass = Validators::validateClass($input->getArgument('model')); $modelClassBasename = current(array_slice(explode('\\', $modelClass), -1)); $bundle = $this->getBundle($input->getOption('bundle') ?: $this->get...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "modelClass", "=", "Validators", "::", "validateClass", "(", "$", "input", "->", "getArgument", "(", "'model'", ")", ")", ";", "$",...
{@inheritdoc}
[ "{" ]
train
https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Command/GenerateAdminCommand.php#L99-L173
blast-project/CoreBundle
src/Command/GenerateAdminCommand.php
GenerateAdminCommand.askAndValidate
private function askAndValidate(InputInterface $input, OutputInterface $output, $questionText, $default, $validator) { $questionHelper = $this->getQuestionHelper(); // NEXT_MAJOR: Remove this BC code for SensioGeneratorBundle 2.3/2.4 after dropping support for Symfony 2.3 if ($questionHelpe...
php
private function askAndValidate(InputInterface $input, OutputInterface $output, $questionText, $default, $validator) { $questionHelper = $this->getQuestionHelper(); // NEXT_MAJOR: Remove this BC code for SensioGeneratorBundle 2.3/2.4 after dropping support for Symfony 2.3 if ($questionHelpe...
[ "private", "function", "askAndValidate", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ",", "$", "questionText", ",", "$", "default", ",", "$", "validator", ")", "{", "$", "questionHelper", "=", "$", "this", "->", "getQuestionHelp...
@param InputInterface $input @param OutputInterface $output @param string $questionText @param mixed $default @param callable $validator @return mixed
[ "@param", "InputInterface", "$input", "@param", "OutputInterface", "$output", "@param", "string", "$questionText", "@param", "mixed", "$default", "@param", "callable", "$validator" ]
train
https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Command/GenerateAdminCommand.php#L302-L316
blast-project/CoreBundle
src/Command/GenerateAdminCommand.php
GenerateAdminCommand.askConfirmation
private function askConfirmation(InputInterface $input, OutputInterface $output, $questionText, $default, $separator) { $questionHelper = $this->getQuestionHelper(); // NEXT_MAJOR: Remove this BC code for SensioGeneratorBundle 2.3/2.4 after dropping support for Symfony 2.3 if ($questionHelp...
php
private function askConfirmation(InputInterface $input, OutputInterface $output, $questionText, $default, $separator) { $questionHelper = $this->getQuestionHelper(); // NEXT_MAJOR: Remove this BC code for SensioGeneratorBundle 2.3/2.4 after dropping support for Symfony 2.3 if ($questionHelp...
[ "private", "function", "askConfirmation", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ",", "$", "questionText", ",", "$", "default", ",", "$", "separator", ")", "{", "$", "questionHelper", "=", "$", "this", "->", "getQuestionHel...
@param InputInterface $input @param OutputInterface $output @param string $questionText @param string $default @param string $separator @return string
[ "@param", "InputInterface", "$input", "@param", "OutputInterface", "$output", "@param", "string", "$questionText", "@param", "string", "$default", "@param", "string", "$separator" ]
train
https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Command/GenerateAdminCommand.php#L327-L345
blast-project/CoreBundle
src/Command/GenerateAdminCommand.php
GenerateAdminCommand.getAdminServiceId
private function getAdminServiceId($bundleName, $adminClassBasename) { $prefix = substr($bundleName, -6) == 'Bundle' ? substr($bundleName, 0, -6) : $bundleName; $suffix = substr($adminClassBasename, -5) == 'Admin' ? substr($adminClassBasename, 0, -5) : $adminClassBasename; $suffix = str_repl...
php
private function getAdminServiceId($bundleName, $adminClassBasename) { $prefix = substr($bundleName, -6) == 'Bundle' ? substr($bundleName, 0, -6) : $bundleName; $suffix = substr($adminClassBasename, -5) == 'Admin' ? substr($adminClassBasename, 0, -5) : $adminClassBasename; $suffix = str_repl...
[ "private", "function", "getAdminServiceId", "(", "$", "bundleName", ",", "$", "adminClassBasename", ")", "{", "$", "prefix", "=", "substr", "(", "$", "bundleName", ",", "-", "6", ")", "==", "'Bundle'", "?", "substr", "(", "$", "bundleName", ",", "0", ","...
@param string $bundleName @param string $adminClassBasename @return string
[ "@param", "string", "$bundleName", "@param", "string", "$adminClassBasename" ]
train
https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Command/GenerateAdminCommand.php#L377-L388
rozdol/bi
src/Utils/Utils.php
Utils.escape
public function escape($array = []) { foreach ($array as $key => $value) { $array[$key]=htmlspecialchars($value, ENT_QUOTES|ENT_SUBSTITUTE|ENT_HTML5, 'UTF-8'); } return $array; }
php
public function escape($array = []) { foreach ($array as $key => $value) { $array[$key]=htmlspecialchars($value, ENT_QUOTES|ENT_SUBSTITUTE|ENT_HTML5, 'UTF-8'); } return $array; }
[ "public", "function", "escape", "(", "$", "array", "=", "[", "]", ")", "{", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "array", "[", "$", "key", "]", "=", "htmlspecialchars", "(", "$", "value", ",", "ENT_QU...
/
[ "/" ]
train
https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Utils/Utils.php#L297-L303
rozdol/bi
src/Utils/Utils.php
Utils.tablehead
public function tablehead($what='', $qry='', $order='', $addbutton='', $fields=[], $sort=[], $tips=[]) { $out.=" <table class='table table-bordered table-striped-tr table-morecondensed tooltip-demo table-notfull' id='sortableTable'> <thead class='c'> <tr...
php
public function tablehead($what='', $qry='', $order='', $addbutton='', $fields=[], $sort=[], $tips=[]) { $out.=" <table class='table table-bordered table-striped-tr table-morecondensed tooltip-demo table-notfull' id='sortableTable'> <thead class='c'> <tr...
[ "public", "function", "tablehead", "(", "$", "what", "=", "''", ",", "$", "qry", "=", "''", ",", "$", "order", "=", "''", ",", "$", "addbutton", "=", "''", ",", "$", "fields", "=", "[", "]", ",", "$", "sort", "=", "[", "]", ",", "$", "tips", ...
///==============To resove with HTML class=========\\\\\\\
[ "///", "==============", "To", "resove", "with", "HTML", "class", "=========", "\\\\\\\\\\\\\\" ]
train
https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Utils/Utils.php#L1848-L1880
rozdol/bi
src/Utils/Utils.php
Utils.file_permissions
public function file_permissions($file) { // fileperms returns a numeric value $numeric_perms = fileperms($file); // but we are used to seeing the octal value $octal_perms = sprintf('%o', $numeric_perms); return substr($octal_perms, -4); }
php
public function file_permissions($file) { // fileperms returns a numeric value $numeric_perms = fileperms($file); // but we are used to seeing the octal value $octal_perms = sprintf('%o', $numeric_perms); return substr($octal_perms, -4); }
[ "public", "function", "file_permissions", "(", "$", "file", ")", "{", "// fileperms returns a numeric value", "$", "numeric_perms", "=", "fileperms", "(", "$", "file", ")", ";", "// but we are used to seeing the octal value", "$", "octal_perms", "=", "sprintf", "(", "...
Returns the file permissions in octal format.
[ "Returns", "the", "file", "permissions", "in", "octal", "format", "." ]
train
https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Utils/Utils.php#L2057-L2064
rozdol/bi
src/Utils/Utils.php
Utils.file_contains_php
public function file_contains_php($file) { $contents = file_get_contents($file); $position = strpos($contents, '<?php'); return $position !== false; }
php
public function file_contains_php($file) { $contents = file_get_contents($file); $position = strpos($contents, '<?php'); return $position !== false; }
[ "public", "function", "file_contains_php", "(", "$", "file", ")", "{", "$", "contents", "=", "file_get_contents", "(", "$", "file", ")", ";", "$", "position", "=", "strpos", "(", "$", "contents", ",", "'<?php'", ")", ";", "return", "$", "position", "!=="...
Using fopen/fread might have better performance on large files.
[ "Using", "fopen", "/", "fread", "might", "have", "better", "performance", "on", "large", "files", "." ]
train
https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Utils/Utils.php#L2077-L2082
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Traits/ArbitrateTwoTypes.php
ArbitrateTwoTypes.arbitrate
protected function arbitrate(NumericTypeInterface $a, NumericTypeInterface $b) { $pairing = $this->getTypePairing($a, $b); if ($pairing == 'complex:complex') { return 'complex'; } if (strpos($pairing, 'complex') === 0) { return 'complex:numeric'; } ...
php
protected function arbitrate(NumericTypeInterface $a, NumericTypeInterface $b) { $pairing = $this->getTypePairing($a, $b); if ($pairing == 'complex:complex') { return 'complex'; } if (strpos($pairing, 'complex') === 0) { return 'complex:numeric'; } ...
[ "protected", "function", "arbitrate", "(", "NumericTypeInterface", "$", "a", ",", "NumericTypeInterface", "$", "b", ")", "{", "$", "pairing", "=", "$", "this", "->", "getTypePairing", "(", "$", "a", ",", "$", "b", ")", ";", "if", "(", "$", "pairing", "...
Arbitrate the return type from the operation @param NumericTypeInterface $a first type @param NumericTypeInterface $b second type @return string @noinspection PhpInconsistentReturnPointsInspection
[ "Arbitrate", "the", "return", "type", "from", "the", "operation" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Traits/ArbitrateTwoTypes.php#L29-L56
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Traits/ArbitrateTwoTypes.php
ArbitrateTwoTypes.getTypePairing
private function getTypePairing(NumericTypeInterface $a, NumericTypeInterface $b) { $search = [ 'Chippyash\Type\Number\Rational\\', 'Chippyash\Type\Number\Complex\\', 'Chippyash\Type\Number\\', 'Type' ]; $replace = ['', '', '', '']; $tA...
php
private function getTypePairing(NumericTypeInterface $a, NumericTypeInterface $b) { $search = [ 'Chippyash\Type\Number\Rational\\', 'Chippyash\Type\Number\Complex\\', 'Chippyash\Type\Number\\', 'Type' ]; $replace = ['', '', '', '']; $tA...
[ "private", "function", "getTypePairing", "(", "NumericTypeInterface", "$", "a", ",", "NumericTypeInterface", "$", "b", ")", "{", "$", "search", "=", "[", "'Chippyash\\Type\\Number\\Rational\\\\'", ",", "'Chippyash\\Type\\Number\\Complex\\\\'", ",", "'Chippyash\\Type\\Number...
Work out the type of the number pairs @param NumericTypeInterface $a first operand @param NumericTypeInterface $b second operand @return string
[ "Work", "out", "the", "type", "of", "the", "number", "pairs" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Traits/ArbitrateTwoTypes.php#L66-L79
harp-orm/query
src/Compiler/Insert.php
Insert.render
public static function render(Query\Insert $query) { return Compiler::withDb($query->getDb(), function () use ($query) { $table = $query->getTable(); $select = $query->getSelect(); return Compiler::expression(array( 'INSERT', $query->getT...
php
public static function render(Query\Insert $query) { return Compiler::withDb($query->getDb(), function () use ($query) { $table = $query->getTable(); $select = $query->getSelect(); return Compiler::expression(array( 'INSERT', $query->getT...
[ "public", "static", "function", "render", "(", "Query", "\\", "Insert", "$", "query", ")", "{", "return", "Compiler", "::", "withDb", "(", "$", "query", "->", "getDb", "(", ")", ",", "function", "(", ")", "use", "(", "$", "query", ")", "{", "$", "t...
Render a Insert object @param Query\Insert $query @return string
[ "Render", "a", "Insert", "object" ]
train
https://github.com/harp-orm/query/blob/98ce2468a0a31fe15ed3692bad32547bf6dbe41a/src/Compiler/Insert.php#L19-L36
FrenchFrogs/framework
src/Laravel/Database/Schema/Blueprint.php
Blueprint.binaryUuid
public function binaryUuid($column = 'id', $primary = true) { $column = $this->addColumn('binaryuuid', $column, ['length' => 16]); // gestion de la clé primaire if ($primary) { $column->primary(); } return $column; }
php
public function binaryUuid($column = 'id', $primary = true) { $column = $this->addColumn('binaryuuid', $column, ['length' => 16]); // gestion de la clé primaire if ($primary) { $column->primary(); } return $column; }
[ "public", "function", "binaryUuid", "(", "$", "column", "=", "'id'", ",", "$", "primary", "=", "true", ")", "{", "$", "column", "=", "$", "this", "->", "addColumn", "(", "'binaryuuid'", ",", "$", "column", ",", "[", "'length'", "=>", "16", "]", ")", ...
Ajoute une column de type binary UUID @param string $column @return \Illuminate\Support\Fluent
[ "Ajoute", "une", "column", "de", "type", "binary", "UUID" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Laravel/Database/Schema/Blueprint.php#L19-L29
FrenchFrogs/framework
src/Laravel/Database/Schema/Blueprint.php
Blueprint.stringId
public function stringId($column = 'id', $size = 32, $primary = true) { $column = $this->string($column, $size); // gestion de la clé primaire if ($primary) { $column->primary(); } return $column; }
php
public function stringId($column = 'id', $size = 32, $primary = true) { $column = $this->string($column, $size); // gestion de la clé primaire if ($primary) { $column->primary(); } return $column; }
[ "public", "function", "stringId", "(", "$", "column", "=", "'id'", ",", "$", "size", "=", "32", ",", "$", "primary", "=", "true", ")", "{", "$", "column", "=", "$", "this", "->", "string", "(", "$", "column", ",", "$", "size", ")", ";", "// gesti...
Ajoute une colonne id de type string @param string $column @param int $size @return mixed
[ "Ajoute", "une", "colonne", "id", "de", "type", "string" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Laravel/Database/Schema/Blueprint.php#L39-L49
seeren/http
src/Request/ServerRequest.php
ServerRequest.withUploadedFiles
public final function withUploadedFiles( array $uploadedFiles): ServerRequestInterface { foreach ($uploadedFiles as &$value) { if (!$value instanceof UploadedFileInterface) { throw new InvalidArgumentException( "Can't get instance: " ...
php
public final function withUploadedFiles( array $uploadedFiles): ServerRequestInterface { foreach ($uploadedFiles as &$value) { if (!$value instanceof UploadedFileInterface) { throw new InvalidArgumentException( "Can't get instance: " ...
[ "public", "final", "function", "withUploadedFiles", "(", "array", "$", "uploadedFiles", ")", ":", "ServerRequestInterface", "{", "foreach", "(", "$", "uploadedFiles", "as", "&", "$", "value", ")", "{", "if", "(", "!", "$", "value", "instanceof", "UploadedFileI...
{@inheritDoc} @see \Psr\Http\Message\ServerRequestInterface::withUploadedFiles()
[ "{" ]
train
https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Request/ServerRequest.php#L277-L288
seeren/http
src/Request/ServerRequest.php
ServerRequest.withParsedBody
public final function withParsedBody($data): ServerRequestInterface { if (null !== $data && !is_array($data) && !is_object($data)) { throw new InvalidArgumentException( "Can't get instance for parsed body: " . "must be null, array or object"); } retu...
php
public final function withParsedBody($data): ServerRequestInterface { if (null !== $data && !is_array($data) && !is_object($data)) { throw new InvalidArgumentException( "Can't get instance for parsed body: " . "must be null, array or object"); } retu...
[ "public", "final", "function", "withParsedBody", "(", "$", "data", ")", ":", "ServerRequestInterface", "{", "if", "(", "null", "!==", "$", "data", "&&", "!", "is_array", "(", "$", "data", ")", "&&", "!", "is_object", "(", "$", "data", ")", ")", "{", ...
{@inheritDoc} @see \Psr\Http\Message\ServerRequestInterface::withParsedBody()
[ "{" ]
train
https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Request/ServerRequest.php#L303-L311
seeren/http
src/Request/ServerRequest.php
ServerRequest.withAttribute
public final function withAttribute($name, $value): ServerRequestInterface { $attributes = $this->attributes; $attributes[$name] = $value; return $this->with("attributes", $attributes); }
php
public final function withAttribute($name, $value): ServerRequestInterface { $attributes = $this->attributes; $attributes[$name] = $value; return $this->with("attributes", $attributes); }
[ "public", "final", "function", "withAttribute", "(", "$", "name", ",", "$", "value", ")", ":", "ServerRequestInterface", "{", "$", "attributes", "=", "$", "this", "->", "attributes", ";", "$", "attributes", "[", "$", "name", "]", "=", "$", "value", ";", ...
{@inheritDoc} @see \Psr\Http\Message\ServerRequestInterface::withAttribute()
[ "{" ]
train
https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Request/ServerRequest.php#L337-L342
seeren/http
src/Request/ServerRequest.php
ServerRequest.withoutAttribute
public final function withoutAttribute($name): ServerRequestInterface { $attributes = $this->attributes; if (array_key_exists($name, $attributes)) { unset($attributes[$name]); } return $this->with("attributes", $attributes); }
php
public final function withoutAttribute($name): ServerRequestInterface { $attributes = $this->attributes; if (array_key_exists($name, $attributes)) { unset($attributes[$name]); } return $this->with("attributes", $attributes); }
[ "public", "final", "function", "withoutAttribute", "(", "$", "name", ")", ":", "ServerRequestInterface", "{", "$", "attributes", "=", "$", "this", "->", "attributes", ";", "if", "(", "array_key_exists", "(", "$", "name", ",", "$", "attributes", ")", ")", "...
{@inheritDoc} @see \Psr\Http\Message\ServerRequestInterface::withoutAttribute()
[ "{" ]
train
https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Request/ServerRequest.php#L348-L355
dengyongbin/loopeer-lib
src/Push/BPush.php
BPush.pushSingleMessage
public function pushSingleMessage($channelId, $description, $custom_content) { $msg = self::buildMessage($description, $custom_content); // 向目标设备发送一条消息 $rs = $this->sdk->pushMsgToSingleDevice($channelId, $msg, $this->opts); return $this->printResult($rs, $this->sdk); }
php
public function pushSingleMessage($channelId, $description, $custom_content) { $msg = self::buildMessage($description, $custom_content); // 向目标设备发送一条消息 $rs = $this->sdk->pushMsgToSingleDevice($channelId, $msg, $this->opts); return $this->printResult($rs, $this->sdk); }
[ "public", "function", "pushSingleMessage", "(", "$", "channelId", ",", "$", "description", ",", "$", "custom_content", ")", "{", "$", "msg", "=", "self", "::", "buildMessage", "(", "$", "description", ",", "$", "custom_content", ")", ";", "// 向目标设备发送一条消息", "...
推送单条消息给个人 @param $channelId @param $description @param $custom_content @return string
[ "推送单条消息给个人" ]
train
https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Push/BPush.php#L50-L55
dengyongbin/loopeer-lib
src/Push/BPush.php
BPush.pushBatchMessage
public function pushBatchMessage($accountIds, $description, $custom_content){ // 向一批设备发送一条消息 $message = self::buildMessage($description, $custom_content); $rs = $this->sdk->pushBatchUniMsg($accountIds, $message, $this->opts); return $this->printResult($rs); }
php
public function pushBatchMessage($accountIds, $description, $custom_content){ // 向一批设备发送一条消息 $message = self::buildMessage($description, $custom_content); $rs = $this->sdk->pushBatchUniMsg($accountIds, $message, $this->opts); return $this->printResult($rs); }
[ "public", "function", "pushBatchMessage", "(", "$", "accountIds", ",", "$", "description", ",", "$", "custom_content", ")", "{", "// 向一批设备发送一条消息", "$", "message", "=", "self", "::", "buildMessage", "(", "$", "description", ",", "$", "custom_content", ")", ";",...
批量推送消息 @param $accountIds @param $description @param $custom_content @return string
[ "批量推送消息" ]
train
https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Push/BPush.php#L64-L69
dengyongbin/loopeer-lib
src/Push/BPush.php
BPush.pushAllMessage
public function pushAllMessage($description, $custom_content) { $message = self::buildMessage($description, $custom_content); // 向一批设备发送一条消息 $rs = $this->sdk->pushMsgToAll($message, $this->opts); return $this->printResult($rs); }
php
public function pushAllMessage($description, $custom_content) { $message = self::buildMessage($description, $custom_content); // 向一批设备发送一条消息 $rs = $this->sdk->pushMsgToAll($message, $this->opts); return $this->printResult($rs); }
[ "public", "function", "pushAllMessage", "(", "$", "description", ",", "$", "custom_content", ")", "{", "$", "message", "=", "self", "::", "buildMessage", "(", "$", "description", ",", "$", "custom_content", ")", ";", "// 向一批设备发送一条消息", "$", "rs", "=", "$", ...
向所有设备推送消息 @param $description @param $custom_content @return string
[ "向所有设备推送消息" ]
train
https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Push/BPush.php#L77-L82
dengyongbin/loopeer-lib
src/Push/BPush.php
BPush.printResult
private function printResult($rs) { // 判断返回值,当发送失败时, $rs的结果为false, 可以通过getError来获得错误信息. $result = 'push success'; if($rs === false){ $result = 'push error code = ' . $this->sdk->getLastErrorCode() . ' error_msg = ' . $this->sdk->getLastErrorMsg(); } return $result; ...
php
private function printResult($rs) { // 判断返回值,当发送失败时, $rs的结果为false, 可以通过getError来获得错误信息. $result = 'push success'; if($rs === false){ $result = 'push error code = ' . $this->sdk->getLastErrorCode() . ' error_msg = ' . $this->sdk->getLastErrorMsg(); } return $result; ...
[ "private", "function", "printResult", "(", "$", "rs", ")", "{", "// 判断返回值,当发送失败时, $rs的结果为false, 可以通过getError来获得错误信息.", "$", "result", "=", "'push success'", ";", "if", "(", "$", "rs", "===", "false", ")", "{", "$", "result", "=", "'push error code = '", ".", "$"...
打印推送结果 @param $rs @return string
[ "打印推送结果" ]
train
https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Push/BPush.php#L108-L115
winzou/limonetik-php-api
src/Buzz/JsonResponse.php
JsonResponse.getContentJson
public function getContentJson() { $content = $this->getContent(); // Remove unwanted utf8 BOM if(substr($content, 0, 3) == pack('CCC', 239, 187, 191)) { $content = substr($content, 3); } $json = json_decode($content, true); if (null === $json) { ...
php
public function getContentJson() { $content = $this->getContent(); // Remove unwanted utf8 BOM if(substr($content, 0, 3) == pack('CCC', 239, 187, 191)) { $content = substr($content, 3); } $json = json_decode($content, true); if (null === $json) { ...
[ "public", "function", "getContentJson", "(", ")", "{", "$", "content", "=", "$", "this", "->", "getContent", "(", ")", ";", "// Remove unwanted utf8 BOM", "if", "(", "substr", "(", "$", "content", ",", "0", ",", "3", ")", "==", "pack", "(", "'CCC'", ",...
@throws LogicException @return array
[ "@throws", "LogicException" ]
train
https://github.com/winzou/limonetik-php-api/blob/4580dd455a446d2a78090ff932f65d6d54ab301c/src/Buzz/JsonResponse.php#L24-L39
dragosprotung/stc-core
src/Workout/Loader/GPX.php
GPX.load
public function load(string $filePath): Workout { $simpleXML = new \SimpleXMLElement($filePath); $author = null; if (isset($simpleXML->metadata->author->name)) { $author = new Author((string)$simpleXML->metadata->author->name); } $tracks = []; foreach ($...
php
public function load(string $filePath): Workout { $simpleXML = new \SimpleXMLElement($filePath); $author = null; if (isset($simpleXML->metadata->author->name)) { $author = new Author((string)$simpleXML->metadata->author->name); } $tracks = []; foreach ($...
[ "public", "function", "load", "(", "string", "$", "filePath", ")", ":", "Workout", "{", "$", "simpleXML", "=", "new", "\\", "SimpleXMLElement", "(", "$", "filePath", ")", ";", "$", "author", "=", "null", ";", "if", "(", "isset", "(", "$", "simpleXML", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Loader/GPX.php#L24-L62
dragosprotung/stc-core
src/Workout/Loader/GPX.php
GPX.parseExtensions
protected function parseExtensions(\SimpleXMLElement $extensions): array { $extensions = $extensions->asXML(); $return = array(); if (preg_match('/<gpxtpx:hr>(.*)<\/gpxtpx:hr>/', $extensions, $matches)) { $return[] = HR::fromValue($matches[1]); } return $return; ...
php
protected function parseExtensions(\SimpleXMLElement $extensions): array { $extensions = $extensions->asXML(); $return = array(); if (preg_match('/<gpxtpx:hr>(.*)<\/gpxtpx:hr>/', $extensions, $matches)) { $return[] = HR::fromValue($matches[1]); } return $return; ...
[ "protected", "function", "parseExtensions", "(", "\\", "SimpleXMLElement", "$", "extensions", ")", ":", "array", "{", "$", "extensions", "=", "$", "extensions", "->", "asXML", "(", ")", ";", "$", "return", "=", "array", "(", ")", ";", "if", "(", "preg_ma...
Parse and return an array of extensions from the XML. @param \SimpleXMLElement $extensions The extensions to parse. @return ExtensionInterface[]
[ "Parse", "and", "return", "an", "array", "of", "extensions", "from", "the", "XML", "." ]
train
https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Loader/GPX.php#L70-L79
fsi-open/datasource-bundle
DataSource/Extension/Symfony/Form/EventSubscriber/Events.php
Events.postBuildView
public function postBuildView(DataSourceEvent\ViewEventArgs $event) { $fieldViews = $event->getView()->getFields(); $positive = []; $negative = []; $neutral = []; $indexedViews = []; foreach ($fieldViews as $fieldView) { $field = $event->getDataSource()-...
php
public function postBuildView(DataSourceEvent\ViewEventArgs $event) { $fieldViews = $event->getView()->getFields(); $positive = []; $negative = []; $neutral = []; $indexedViews = []; foreach ($fieldViews as $fieldView) { $field = $event->getDataSource()-...
[ "public", "function", "postBuildView", "(", "DataSourceEvent", "\\", "ViewEventArgs", "$", "event", ")", "{", "$", "fieldViews", "=", "$", "event", "->", "getView", "(", ")", "->", "getFields", "(", ")", ";", "$", "positive", "=", "[", "]", ";", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/fsi-open/datasource-bundle/blob/06964672c838af9f4125065e3a90b2df4e8aa077/DataSource/Extension/Symfony/Form/EventSubscriber/Events.php#L34-L71
Elendev/ElendevRoxyFilemanBundle
FileSystem/LocalFileSystem.php
LocalFileSystem.getDirectoryTreeList
public function getDirectoryTreeList() { $finder = new Finder(); $finder->in($this->rootPath)->directories(); $directories = array(); $rootFinder = new Finder(); $rootFinder->in($this->rootPath)->depth(0); //Add root directory $directories[] = new Director...
php
public function getDirectoryTreeList() { $finder = new Finder(); $finder->in($this->rootPath)->directories(); $directories = array(); $rootFinder = new Finder(); $rootFinder->in($this->rootPath)->depth(0); //Add root directory $directories[] = new Director...
[ "public", "function", "getDirectoryTreeList", "(", ")", "{", "$", "finder", "=", "new", "Finder", "(", ")", ";", "$", "finder", "->", "in", "(", "$", "this", "->", "rootPath", ")", "->", "directories", "(", ")", ";", "$", "directories", "=", "array", ...
Return the directory tree in the form of a list @return DirectoryInterface[]
[ "Return", "the", "directory", "tree", "in", "the", "form", "of", "a", "list" ]
train
https://github.com/Elendev/ElendevRoxyFilemanBundle/blob/2173ce00e4f1d22960eec70b437a5908f4681dc1/FileSystem/LocalFileSystem.php#L52-L76
Elendev/ElendevRoxyFilemanBundle
FileSystem/LocalFileSystem.php
LocalFileSystem.getRealPath
private function getRealPath($path) { if(strpos($path, '../') !== false){ throw new AccessDeniedException('Path cannot contain "../" pattern'); } return str_replace($this->virtualRootPath, $this->rootPath, $path); }
php
private function getRealPath($path) { if(strpos($path, '../') !== false){ throw new AccessDeniedException('Path cannot contain "../" pattern'); } return str_replace($this->virtualRootPath, $this->rootPath, $path); }
[ "private", "function", "getRealPath", "(", "$", "path", ")", "{", "if", "(", "strpos", "(", "$", "path", ",", "'../'", ")", "!==", "false", ")", "{", "throw", "new", "AccessDeniedException", "(", "'Path cannot contain \"../\" pattern'", ")", ";", "}", "retur...
Return local path from remote query @param $path
[ "Return", "local", "path", "from", "remote", "query" ]
train
https://github.com/Elendev/ElendevRoxyFilemanBundle/blob/2173ce00e4f1d22960eec70b437a5908f4681dc1/FileSystem/LocalFileSystem.php#L415-L421
fuelphp/display
src/Providers/FuelServiceProvider.php
FuelServiceProvider.register
public function register() { $this->container->add('viewManagerInstance', function($ignoreException = true) { if ($app = $this->container->get('applicationInstance', [$ignoreException])) { return $app->getViewManager(); } }); $this->container->inflector('Fuel\Display\ViewManagerAware') ->invok...
php
public function register() { $this->container->add('viewManagerInstance', function($ignoreException = true) { if ($app = $this->container->get('applicationInstance', [$ignoreException])) { return $app->getViewManager(); } }); $this->container->inflector('Fuel\Display\ViewManagerAware') ->invok...
[ "public", "function", "register", "(", ")", "{", "$", "this", "->", "container", "->", "add", "(", "'viewManagerInstance'", ",", "function", "(", "$", "ignoreException", "=", "true", ")", "{", "if", "(", "$", "app", "=", "$", "this", "->", "container", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/fuelphp/display/blob/d9a3eddbf80f0fd81beb40d9f4507600ac6611a4/src/Providers/FuelServiceProvider.php#L38-L63
slaff/learnzf2-route-cache
Module.php
Module.routeSave
public function routeSave(MvcEvent $event) { $match = $event->getRouteMatch(); if(!$match) { return; } if($event->getParam('route-cached') || !$event->getParam('route-cacheable')) { return; } $path = $event->getRequest() ...
php
public function routeSave(MvcEvent $event) { $match = $event->getRouteMatch(); if(!$match) { return; } if($event->getParam('route-cached') || !$event->getParam('route-cacheable')) { return; } $path = $event->getRequest() ...
[ "public", "function", "routeSave", "(", "MvcEvent", "$", "event", ")", "{", "$", "match", "=", "$", "event", "->", "getRouteMatch", "(", ")", ";", "if", "(", "!", "$", "match", ")", "{", "return", ";", "}", "if", "(", "$", "event", "->", "getParam"...
Method that tries to save a route match into a cache system @param MvcEvent $event
[ "Method", "that", "tries", "to", "save", "a", "route", "match", "into", "a", "cache", "system" ]
train
https://github.com/slaff/learnzf2-route-cache/blob/dfbc0b604fca04a917d425bc6c1404aca36963ec/Module.php#L19-L43
slaff/learnzf2-route-cache
Module.php
Module.routeLoad
public function routeLoad(MvcEvent $event) { $request = $event->getRequest(); if(!( $request->getMethod() == \Zend\Http\Request::METHOD_GET && $request->getQuery()->count() == 0 )) { // We do not cache route match for requests that can produce ...
php
public function routeLoad(MvcEvent $event) { $request = $event->getRequest(); if(!( $request->getMethod() == \Zend\Http\Request::METHOD_GET && $request->getQuery()->count() == 0 )) { // We do not cache route match for requests that can produce ...
[ "public", "function", "routeLoad", "(", "MvcEvent", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "if", "(", "!", "(", "$", "request", "->", "getMethod", "(", ")", "==", "\\", "Zend", "\\", "Http", "\...
Method that tries to load cached routes and speed up the matching @param MvcEvent $event
[ "Method", "that", "tries", "to", "load", "cached", "routes", "and", "speed", "up", "the", "matching" ]
train
https://github.com/slaff/learnzf2-route-cache/blob/dfbc0b604fca04a917d425bc6c1404aca36963ec/Module.php#L49-L78
datasift/datasift-php
lib/DataSift/Pylon.php
DataSift_Pylon.find
public function find($id) { return new self($this->_user, self::get($this->_user, $id)); }
php
public function find($id) { return new self($this->_user, self::get($this->_user, $id)); }
[ "public", "function", "find", "(", "$", "id", ")", "{", "return", "new", "self", "(", "$", "this", "->", "_user", ",", "self", "::", "get", "(", "$", "this", "->", "_user", ",", "$", "id", ")", ")", ";", "}" ]
Class method to find a Subscription @param string $id @return DataSift_Pylon
[ "Class", "method", "to", "find", "a", "Subscription" ]
train
https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Pylon.php#L128-L131
datasift/datasift-php
lib/DataSift/Pylon.php
DataSift_Pylon.findAll
public function findAll( $page = 1, $per_page = 20, $order_by = self::ORDERBY_CREATED_AT, $order_dir = self::ORDERDIR_ASC ) { $results = self::getAll($this->_user, $page, $per_page, $order_by, $order_dir); if (isset($results['subscriptions'])) { // Cope with paginati...
php
public function findAll( $page = 1, $per_page = 20, $order_by = self::ORDERBY_CREATED_AT, $order_dir = self::ORDERDIR_ASC ) { $results = self::getAll($this->_user, $page, $per_page, $order_by, $order_dir); if (isset($results['subscriptions'])) { // Cope with paginati...
[ "public", "function", "findAll", "(", "$", "page", "=", "1", ",", "$", "per_page", "=", "20", ",", "$", "order_by", "=", "self", "::", "ORDERBY_CREATED_AT", ",", "$", "order_dir", "=", "self", "::", "ORDERDIR_ASC", ")", "{", "$", "results", "=", "self"...
Class method to find all Subscriptions @return DataSift_Pylon
[ "Class", "method", "to", "find", "all", "Subscriptions" ]
train
https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Pylon.php#L139-L158
datasift/datasift-php
lib/DataSift/Pylon.php
DataSift_Pylon.get
public static function get($user, $id = false) { $params = array(); if ($id) { $params['id'] = $id; } return $user->get('pylon/get', $params); }
php
public static function get($user, $id = false) { $params = array(); if ($id) { $params['id'] = $id; } return $user->get('pylon/get', $params); }
[ "public", "static", "function", "get", "(", "$", "user", ",", "$", "id", "=", "false", ")", "{", "$", "params", "=", "array", "(", ")", ";", "if", "(", "$", "id", ")", "{", "$", "params", "[", "'id'", "]", "=", "$", "id", ";", "}", "return", ...
Get an existing recordings. @param Datasift_User $user The Datasift user object @param string $id The id of the existing pylon @throws DataSift_Exception_InvalidData @return DataSift_Pylon
[ "Get", "an", "existing", "recordings", "." ]
train
https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Pylon.php#L170-L179
datasift/datasift-php
lib/DataSift/Pylon.php
DataSift_Pylon.getAll
public static function getAll( $user, $page = 1, $per_page = 20, $order_by = self::ORDERBY_CREATED_AT, $order_dir = self::ORDERDIR_ASC ) { if ($page < 1) { throw new DataSift_Exception_InvalidData("The specified page number is invalid"); } ...
php
public static function getAll( $user, $page = 1, $per_page = 20, $order_by = self::ORDERBY_CREATED_AT, $order_dir = self::ORDERDIR_ASC ) { if ($page < 1) { throw new DataSift_Exception_InvalidData("The specified page number is invalid"); } ...
[ "public", "static", "function", "getAll", "(", "$", "user", ",", "$", "page", "=", "1", ",", "$", "per_page", "=", "20", ",", "$", "order_by", "=", "self", "::", "ORDERBY_CREATED_AT", ",", "$", "order_dir", "=", "self", "::", "ORDERDIR_ASC", ")", "{", ...
List recordings @param Datasift_User $user The Datasift user object @param int page The page of recordings to return @param int per_page The number of recordings to display per page @param string order_by The field to order the results by @param string ord...
[ "List", "recordings" ]
train
https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Pylon.php#L194-L217
datasift/datasift-php
lib/DataSift/Pylon.php
DataSift_Pylon.load
private function load($data) { if (empty($data)) { throw new DataSift_Exception_InvalidData('No data found'); } //Assign the instance variables foreach ($data as $key => $value) { $this->{'_' . $key} = $value; } }
php
private function load($data) { if (empty($data)) { throw new DataSift_Exception_InvalidData('No data found'); } //Assign the instance variables foreach ($data as $key => $value) { $this->{'_' . $key} = $value; } }
[ "private", "function", "load", "(", "$", "data", ")", "{", "if", "(", "empty", "(", "$", "data", ")", ")", "{", "throw", "new", "DataSift_Exception_InvalidData", "(", "'No data found'", ")", ";", "}", "//Assign the instance variables", "foreach", "(", "$", "...
Loads an pylon object from the get data @param array $data An array containing the subscription data. @throws DataSift_Exception_InvalidData
[ "Loads", "an", "pylon", "object", "from", "the", "get", "data" ]
train
https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Pylon.php#L255-L265
datasift/datasift-php
lib/DataSift/Pylon.php
DataSift_Pylon.reload
public function reload() { if (strlen($this->_id) == 0) { throw new DataSift_Exception_InvalidData('Unable to reload pylon without an ID'); } $this->load(self::get($this->_user, $this->_id)); }
php
public function reload() { if (strlen($this->_id) == 0) { throw new DataSift_Exception_InvalidData('Unable to reload pylon without an ID'); } $this->load(self::get($this->_user, $this->_id)); }
[ "public", "function", "reload", "(", ")", "{", "if", "(", "strlen", "(", "$", "this", "->", "_id", ")", "==", "0", ")", "{", "throw", "new", "DataSift_Exception_InvalidData", "(", "'Unable to reload pylon without an ID'", ")", ";", "}", "$", "this", "->", ...
Updates the object with fresh results from get @throws DataSift_Exception_InvalidData
[ "Updates", "the", "object", "with", "fresh", "results", "from", "get" ]
train
https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Pylon.php#L272-L279
datasift/datasift-php
lib/DataSift/Pylon.php
DataSift_Pylon.compile
public function compile($csdl = false) { if ($csdl) { $this->_csdl = $csdl; } if (strlen($this->_csdl) == 0) { throw new DataSift_Exception_InvalidData('Cannot compile an empty definition.'); } $res = $this->_user->post('pylon/compile', array('csdl' ...
php
public function compile($csdl = false) { if ($csdl) { $this->_csdl = $csdl; } if (strlen($this->_csdl) == 0) { throw new DataSift_Exception_InvalidData('Cannot compile an empty definition.'); } $res = $this->_user->post('pylon/compile', array('csdl' ...
[ "public", "function", "compile", "(", "$", "csdl", "=", "false", ")", "{", "if", "(", "$", "csdl", ")", "{", "$", "this", "->", "_csdl", "=", "$", "csdl", ";", "}", "if", "(", "strlen", "(", "$", "this", "->", "_csdl", ")", "==", "0", ")", "{...
Compiles the CSDL of this object @param string $csdl If a CSDL string is passed to compile it will set the CSDL for the object @return array Response from the compile
[ "Compiles", "the", "CSDL", "of", "this", "object" ]
train
https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Pylon.php#L431-L446
datasift/datasift-php
lib/DataSift/Pylon.php
DataSift_Pylon.start
public function start($hash = false, $name = false) { if ($hash) { $this->_hash = $hash; } if ($name) { $this->_name = $name; } if (! empty($this->_id)) { $this->restart(); } else { $this->create(); } }
php
public function start($hash = false, $name = false) { if ($hash) { $this->_hash = $hash; } if ($name) { $this->_name = $name; } if (! empty($this->_id)) { $this->restart(); } else { $this->create(); } }
[ "public", "function", "start", "(", "$", "hash", "=", "false", ",", "$", "name", "=", "false", ")", "{", "if", "(", "$", "hash", ")", "{", "$", "this", "->", "_hash", "=", "$", "hash", ";", "}", "if", "(", "$", "name", ")", "{", "$", "this", ...
Creates a new recording or restarts an existing one if an ID is present @param string $hash If hash is provided it will be set @param string $name If name is provided it will be set
[ "Creates", "a", "new", "recording", "or", "restarts", "an", "existing", "one", "if", "an", "ID", "is", "present" ]
train
https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Pylon.php#L455-L470
datasift/datasift-php
lib/DataSift/Pylon.php
DataSift_Pylon.restart
public function restart($id = false) { if ($id) { $this->_id = $id; } $this->_user->put('pylon/start', array('id' => $this->_id)); }
php
public function restart($id = false) { if ($id) { $this->_id = $id; } $this->_user->put('pylon/start', array('id' => $this->_id)); }
[ "public", "function", "restart", "(", "$", "id", "=", "false", ")", "{", "if", "(", "$", "id", ")", "{", "$", "this", "->", "_id", "=", "$", "id", ";", "}", "$", "this", "->", "_user", "->", "put", "(", "'pylon/start'", ",", "array", "(", "'id'...
Restarts the pylon recording @param string $id If ID is provided it will be set
[ "Restarts", "the", "pylon", "recording" ]
train
https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Pylon.php#L505-L512
datasift/datasift-php
lib/DataSift/Pylon.php
DataSift_Pylon.stop
public function stop($id = false) { if ($id) { $this->_id = $id; } if (strlen($this->_id) == 0) { throw new DataSift_Exception_InvalidData('Unable to reload pylon without an ID'); } $this->_user->post('pylon/stop', array('id' => $this->_id)); }
php
public function stop($id = false) { if ($id) { $this->_id = $id; } if (strlen($this->_id) == 0) { throw new DataSift_Exception_InvalidData('Unable to reload pylon without an ID'); } $this->_user->post('pylon/stop', array('id' => $this->_id)); }
[ "public", "function", "stop", "(", "$", "id", "=", "false", ")", "{", "if", "(", "$", "id", ")", "{", "$", "this", "->", "_id", "=", "$", "id", ";", "}", "if", "(", "strlen", "(", "$", "this", "->", "_id", ")", "==", "0", ")", "{", "throw",...
Stops the pylon recording @param string $id If ID is provided it will be set
[ "Stops", "the", "pylon", "recording" ]
train
https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Pylon.php#L519-L529
datasift/datasift-php
lib/DataSift/Pylon.php
DataSift_Pylon.analyze
public function analyze($parameters, $filter = false, $start = false, $end = false, $id = false) { if ($id) { $this->_id = $id; } //If parameters is not an array try and decode it if (! is_array($parameters)) { $parameters = json_decode($parameters); ...
php
public function analyze($parameters, $filter = false, $start = false, $end = false, $id = false) { if ($id) { $this->_id = $id; } //If parameters is not an array try and decode it if (! is_array($parameters)) { $parameters = json_decode($parameters); ...
[ "public", "function", "analyze", "(", "$", "parameters", ",", "$", "filter", "=", "false", ",", "$", "start", "=", "false", ",", "$", "end", "=", "false", ",", "$", "id", "=", "false", ")", "{", "if", "(", "$", "id", ")", "{", "$", "this", "->"...
Analyze the recording @param array $parameters the parameter array to be used to analyze the data set @param string $filter additional CSDL filter @param int $start the start time of the pylon @param int $end the end time of the pylon @param string $id If id is provided it will be set @...
[ "Analyze", "the", "recording" ]
train
https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Pylon.php#L543-L576
datasift/datasift-php
lib/DataSift/Pylon.php
DataSift_Pylon.tags
public function tags($id = false) { if ($id) { $this->_id = $id; } if (strlen($this->_id) == 0) { throw new DataSift_Exception_InvalidData('Unable to get tags without an ID'); } return $this->_user->get('pylon/tags', array('id' => $this->_id)); }
php
public function tags($id = false) { if ($id) { $this->_id = $id; } if (strlen($this->_id) == 0) { throw new DataSift_Exception_InvalidData('Unable to get tags without an ID'); } return $this->_user->get('pylon/tags', array('id' => $this->_id)); }
[ "public", "function", "tags", "(", "$", "id", "=", "false", ")", "{", "if", "(", "$", "id", ")", "{", "$", "this", "->", "_id", "=", "$", "id", ";", "}", "if", "(", "strlen", "(", "$", "this", "->", "_id", ")", "==", "0", ")", "{", "throw",...
Analyze the tags in the data set @param string $id If ID is provided it will be set @return array Response from the tags endpoint
[ "Analyze", "the", "tags", "in", "the", "data", "set" ]
train
https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Pylon.php#L585-L595
datasift/datasift-php
lib/DataSift/Pylon.php
DataSift_Pylon.sample
public function sample($filter = false, $start = false, $end = false, $count = false, $id = false) { if ($id) { $this->_id = $id; } if (strlen($this->_id) == 0) { throw new DataSift_Exception_InvalidData('Unable to retrieve pylon sample without an ID'); } ...
php
public function sample($filter = false, $start = false, $end = false, $count = false, $id = false) { if ($id) { $this->_id = $id; } if (strlen($this->_id) == 0) { throw new DataSift_Exception_InvalidData('Unable to retrieve pylon sample without an ID'); } ...
[ "public", "function", "sample", "(", "$", "filter", "=", "false", ",", "$", "start", "=", "false", ",", "$", "end", "=", "false", ",", "$", "count", "=", "false", ",", "$", "id", "=", "false", ")", "{", "if", "(", "$", "id", ")", "{", "$", "t...
Returns a list of sample interactions (super-public) @param Datasift_User $user The Datasift user object @param string $id The id of the existing pylon @param string $filter additional CSDL filter @param int $start the start time of the pylon @param int $end the end time of ...
[ "Returns", "a", "list", "of", "sample", "interactions", "(", "super", "-", "public", ")" ]
train
https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Pylon.php#L611-L641
datasift/datasift-php
lib/DataSift/Pylon.php
DataSift_Pylon.update
public function update($id = false, $hash = false, $name = false) { if ($id) { $this->_id = $id; } if ($hash) { $this->_hash = $hash; } if ($name) { $this->_name = $name; } $params = array( 'id' => $this->_id, ...
php
public function update($id = false, $hash = false, $name = false) { if ($id) { $this->_id = $id; } if ($hash) { $this->_hash = $hash; } if ($name) { $this->_name = $name; } $params = array( 'id' => $this->_id, ...
[ "public", "function", "update", "(", "$", "id", "=", "false", ",", "$", "hash", "=", "false", ",", "$", "name", "=", "false", ")", "{", "if", "(", "$", "id", ")", "{", "$", "this", "->", "_id", "=", "$", "id", ";", "}", "if", "(", "$", "has...
Updates a recording with a new hash and or name @param string $id The id of the existing recording @param string $hash The new hash of the pylon recording @param string $name The new updated name of the recording @throws DataSift_Exception_InvalidData
[ "Updates", "a", "recording", "with", "a", "new", "hash", "and", "or", "name" ]
train
https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Pylon.php#L652-L672
fuzz-productions/laravel-api-data
src/Transformations/Serialization/ApiDataSerializer.php
ApiDataSerializer.paginator
public function paginator(PaginatorInterface $paginator) { $currentPage = (int) $paginator->getCurrentPage(); $lastPage = (int) $paginator->getLastPage(); $pagination = [ 'total' => (int) $paginator->getTotal(), 'count' => (int) $paginator->getCount(), 'per_page' => (int) $paginato...
php
public function paginator(PaginatorInterface $paginator) { $currentPage = (int) $paginator->getCurrentPage(); $lastPage = (int) $paginator->getLastPage(); $pagination = [ 'total' => (int) $paginator->getTotal(), 'count' => (int) $paginator->getCount(), 'per_page' => (int) $paginato...
[ "public", "function", "paginator", "(", "PaginatorInterface", "$", "paginator", ")", "{", "$", "currentPage", "=", "(", "int", ")", "$", "paginator", "->", "getCurrentPage", "(", ")", ";", "$", "lastPage", "=", "(", "int", ")", "$", "paginator", "->", "g...
Serialize the paginator. @param PaginatorInterface $paginator @return array
[ "Serialize", "the", "paginator", "." ]
train
https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Transformations/Serialization/ApiDataSerializer.php#L58-L87
fuzz-productions/laravel-api-data
src/Transformations/Serialization/ApiDataSerializer.php
ApiDataSerializer.applyRequestQueryParams
public function applyRequestQueryParams(AbstractPaginator $paginator) { // Pass in any additional query variables foreach ( array_except( Request::instance()->query->all(), [ self::PAGINATION_CURRENT_PAGE, self::PAGINATION_PER_PAGE ] ) as $key => $value ) { $paginator->addQuery($key, $...
php
public function applyRequestQueryParams(AbstractPaginator $paginator) { // Pass in any additional query variables foreach ( array_except( Request::instance()->query->all(), [ self::PAGINATION_CURRENT_PAGE, self::PAGINATION_PER_PAGE ] ) as $key => $value ) { $paginator->addQuery($key, $...
[ "public", "function", "applyRequestQueryParams", "(", "AbstractPaginator", "$", "paginator", ")", "{", "// Pass in any additional query variables", "foreach", "(", "array_except", "(", "Request", "::", "instance", "(", ")", "->", "query", "->", "all", "(", ")", ",",...
Find all the query parameters passed in the request and apply them to the paginator so we can build a useful URL. @param \Illuminate\Pagination\AbstractPaginator $paginator
[ "Find", "all", "the", "query", "parameters", "passed", "in", "the", "request", "and", "apply", "them", "to", "the", "paginator", "so", "we", "can", "build", "a", "useful", "URL", "." ]
train
https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Transformations/Serialization/ApiDataSerializer.php#L95-L110
yoanm/php-jsonrpc-http-server-openapi-doc-sdk
src/App/Normalizer/Component/ResponseDocNormalizer.php
ResponseDocNormalizer.normalize
public function normalize(MethodDoc $method, array $extraErrorDefinitionIdRefList = []) : array { $responseErrorShape = []; $errorArrayDoc = $this->getMethodErrorArrayDoc($method, $extraErrorDefinitionIdRefList); if (count($errorArrayDoc) > 0) { $responseErrorShape = [ ...
php
public function normalize(MethodDoc $method, array $extraErrorDefinitionIdRefList = []) : array { $responseErrorShape = []; $errorArrayDoc = $this->getMethodErrorArrayDoc($method, $extraErrorDefinitionIdRefList); if (count($errorArrayDoc) > 0) { $responseErrorShape = [ ...
[ "public", "function", "normalize", "(", "MethodDoc", "$", "method", ",", "array", "$", "extraErrorDefinitionIdRefList", "=", "[", "]", ")", ":", "array", "{", "$", "responseErrorShape", "=", "[", "]", ";", "$", "errorArrayDoc", "=", "$", "this", "->", "get...
@param MethodDoc $method @param array $extraErrorDefinitionIdRefList @return array
[ "@param", "MethodDoc", "$method", "@param", "array", "$extraErrorDefinitionIdRefList" ]
train
https://github.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/blob/52d6bb5d0671e0363bbf482c3c75fef97d7d1d5e/src/App/Normalizer/Component/ResponseDocNormalizer.php#L39-L59
yoanm/php-jsonrpc-http-server-openapi-doc-sdk
src/App/Normalizer/Component/ResponseDocNormalizer.php
ResponseDocNormalizer.getMethodErrorArrayDoc
protected function getMethodErrorArrayDoc(MethodDoc $method, array $extraErrorDefinitionIdRefList = []) : array { $self = $this; $errorDocList = array_merge( array_map( function ($errorRef) use ($self) { $errorDoc = new ErrorDoc('', 0, null, null, $er...
php
protected function getMethodErrorArrayDoc(MethodDoc $method, array $extraErrorDefinitionIdRefList = []) : array { $self = $this; $errorDocList = array_merge( array_map( function ($errorRef) use ($self) { $errorDoc = new ErrorDoc('', 0, null, null, $er...
[ "protected", "function", "getMethodErrorArrayDoc", "(", "MethodDoc", "$", "method", ",", "array", "$", "extraErrorDefinitionIdRefList", "=", "[", "]", ")", ":", "array", "{", "$", "self", "=", "$", "this", ";", "$", "errorDocList", "=", "array_merge", "(", "...
@param MethodDoc $method @param string[] $extraErrorDefinitionIdRefList @return array
[ "@param", "MethodDoc", "$method", "@param", "string", "[]", "$extraErrorDefinitionIdRefList" ]
train
https://github.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/blob/52d6bb5d0671e0363bbf482c3c75fef97d7d1d5e/src/App/Normalizer/Component/ResponseDocNormalizer.php#L90-L130
huasituo/hstcms
src/Console/Commands/HookCacheCommand.php
HookCacheCommand.handle
public function handle() { $p = $this->option('p'); $f = $this->option('f'); $t = $this->option('t'); $path = realpath(base_path()); $appPath = realpath(app_path()); if($p !== null && $p !=='all') { if($f == 'app') { $hooks = $this->f...
php
public function handle() { $p = $this->option('p'); $f = $this->option('f'); $t = $this->option('t'); $path = realpath(base_path()); $appPath = realpath(app_path()); if($p !== null && $p !=='all') { if($f == 'app') { $hooks = $this->f...
[ "public", "function", "handle", "(", ")", "{", "$", "p", "=", "$", "this", "->", "option", "(", "'p'", ")", ";", "$", "f", "=", "$", "this", "->", "option", "(", "'f'", ")", ";", "$", "t", "=", "$", "this", "->", "option", "(", "'t'", ")", ...
Execute the console command. @return mixed
[ "Execute", "the", "console", "command", "." ]
train
https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Console/Commands/HookCacheCommand.php#L62-L116
opis/storages
config/Database.php
Database.checkCache
protected function checkCache($name) { if (!isset($this->cache[$name])) { try { $config = $this->db ->from($this->table) ->where($this->columns['name'])->eq($name) ->select() ->fetchAssoc() ...
php
protected function checkCache($name) { if (!isset($this->cache[$name])) { try { $config = $this->db ->from($this->table) ->where($this->columns['name'])->eq($name) ->select() ->fetchAssoc() ...
[ "protected", "function", "checkCache", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "cache", "[", "$", "name", "]", ")", ")", "{", "try", "{", "$", "config", "=", "$", "this", "->", "db", "->", "from", "(", "$", ...
Check if an item was cached @param string $name @return boolean
[ "Check", "if", "an", "item", "was", "cached" ]
train
https://github.com/opis/storages/blob/548dd631239c7cd75c04d17878b677e646540fde/config/Database.php#L71-L92
opis/storages
config/Database.php
Database.updateRecord
protected function updateRecord($name) { try { return (bool) $this->db ->update($this->table) ->where($this->columns['name'])->eq($name) ->set(array( $this->columns['data'] => serialize($this->cache[$name]->toArr...
php
protected function updateRecord($name) { try { return (bool) $this->db ->update($this->table) ->where($this->columns['name'])->eq($name) ->set(array( $this->columns['data'] => serialize($this->cache[$name]->toArr...
[ "protected", "function", "updateRecord", "(", "$", "name", ")", "{", "try", "{", "return", "(", "bool", ")", "$", "this", "->", "db", "->", "update", "(", "$", "this", "->", "table", ")", "->", "where", "(", "$", "this", "->", "columns", "[", "'nam...
Update a record @param string $name @return boolean
[ "Update", "a", "record" ]
train
https://github.com/opis/storages/blob/548dd631239c7cd75c04d17878b677e646540fde/config/Database.php#L101-L113
opis/storages
config/Database.php
Database.insertRecord
protected function insertRecord($name) { try { return (bool) $this->db ->insert(array( $this->columns['name'] => $name, $this->columns['data'] => serialize($this->cache[$name]->toArray()), )) ...
php
protected function insertRecord($name) { try { return (bool) $this->db ->insert(array( $this->columns['name'] => $name, $this->columns['data'] => serialize($this->cache[$name]->toArray()), )) ...
[ "protected", "function", "insertRecord", "(", "$", "name", ")", "{", "try", "{", "return", "(", "bool", ")", "$", "this", "->", "db", "->", "insert", "(", "array", "(", "$", "this", "->", "columns", "[", "'name'", "]", "=>", "$", "name", ",", "$", ...
Insert a new record @param string $name @return boolean
[ "Insert", "a", "new", "record" ]
train
https://github.com/opis/storages/blob/548dd631239c7cd75c04d17878b677e646540fde/config/Database.php#L122-L134
opis/storages
config/Database.php
Database.deleteRecord
protected function deleteRecord($name) { try { return (bool) $this->db ->from($this->table) ->where($this->columns['name'])->eq($name) ->delete(); } catch (PDOException $e) { return false; } }
php
protected function deleteRecord($name) { try { return (bool) $this->db ->from($this->table) ->where($this->columns['name'])->eq($name) ->delete(); } catch (PDOException $e) { return false; } }
[ "protected", "function", "deleteRecord", "(", "$", "name", ")", "{", "try", "{", "return", "(", "bool", ")", "$", "this", "->", "db", "->", "from", "(", "$", "this", "->", "table", ")", "->", "where", "(", "$", "this", "->", "columns", "[", "'name'...
Delete a record @param string $name @return boolean
[ "Delete", "a", "record" ]
train
https://github.com/opis/storages/blob/548dd631239c7cd75c04d17878b677e646540fde/config/Database.php#L143-L153
opis/storages
config/Database.php
Database.write
public function write($name, $value) { $path = explode('.', $name); $key = array_shift($path); $exists = $this->checkCache($key); if ($path) { if (!$exists) { $this->cache[$key] = new ArrayHelper(); } $this->cache[$key]->set($path...
php
public function write($name, $value) { $path = explode('.', $name); $key = array_shift($path); $exists = $this->checkCache($key); if ($path) { if (!$exists) { $this->cache[$key] = new ArrayHelper(); } $this->cache[$key]->set($path...
[ "public", "function", "write", "(", "$", "name", ",", "$", "value", ")", "{", "$", "path", "=", "explode", "(", "'.'", ",", "$", "name", ")", ";", "$", "key", "=", "array_shift", "(", "$", "path", ")", ";", "$", "exists", "=", "$", "this", "->"...
Write config data @param string $name @param mixed $value @return boolean
[ "Write", "config", "data" ]
train
https://github.com/opis/storages/blob/548dd631239c7cd75c04d17878b677e646540fde/config/Database.php#L163-L180
opis/storages
config/Database.php
Database.read
public function read($name, $default = null) { $path = explode('.', $name); $key = array_shift($path); if ($this->checkCache($key)) { return $path ? $this->cache[$key]->get($path, $default) : $this->cache[$key]->toArray(); } return $default; }
php
public function read($name, $default = null) { $path = explode('.', $name); $key = array_shift($path); if ($this->checkCache($key)) { return $path ? $this->cache[$key]->get($path, $default) : $this->cache[$key]->toArray(); } return $default; }
[ "public", "function", "read", "(", "$", "name", ",", "$", "default", "=", "null", ")", "{", "$", "path", "=", "explode", "(", "'.'", ",", "$", "name", ")", ";", "$", "key", "=", "array_shift", "(", "$", "path", ")", ";", "if", "(", "$", "this",...
Read config data @param string $name @param mixed|null $default (optional) @return mixed
[ "Read", "config", "data" ]
train
https://github.com/opis/storages/blob/548dd631239c7cd75c04d17878b677e646540fde/config/Database.php#L190-L200
opis/storages
config/Database.php
Database.has
public function has($name) { $path = explode('.', $name); $key = array_shift($path); if ($this->checkCache($key)) { return $path ? $this->cache[$key]->has($path) : true; } return false; }
php
public function has($name) { $path = explode('.', $name); $key = array_shift($path); if ($this->checkCache($key)) { return $path ? $this->cache[$key]->has($path) : true; } return false; }
[ "public", "function", "has", "(", "$", "name", ")", "{", "$", "path", "=", "explode", "(", "'.'", ",", "$", "name", ")", ";", "$", "key", "=", "array_shift", "(", "$", "path", ")", ";", "if", "(", "$", "this", "->", "checkCache", "(", "$", "key...
Check if the config exists @param string $name @return boolean
[ "Check", "if", "the", "config", "exists" ]
train
https://github.com/opis/storages/blob/548dd631239c7cd75c04d17878b677e646540fde/config/Database.php#L209-L219
opis/storages
config/Database.php
Database.delete
public function delete($name) { $path = explode('.', $name); $key = array_shift($path); if ($path) { if ($this->checkCache($key) && $this->cache[$key]->delete($path)) { return $this->updateRecord($key); } return false; } u...
php
public function delete($name) { $path = explode('.', $name); $key = array_shift($path); if ($path) { if ($this->checkCache($key) && $this->cache[$key]->delete($path)) { return $this->updateRecord($key); } return false; } u...
[ "public", "function", "delete", "(", "$", "name", ")", "{", "$", "path", "=", "explode", "(", "'.'", ",", "$", "name", ")", ";", "$", "key", "=", "array_shift", "(", "$", "path", ")", ";", "if", "(", "$", "path", ")", "{", "if", "(", "$", "th...
Delete a config @param string $name @return boolean
[ "Delete", "a", "config" ]
train
https://github.com/opis/storages/blob/548dd631239c7cd75c04d17878b677e646540fde/config/Database.php#L228-L243