repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
squareproton/Bond
src/Bond/Set.php
Set.add
public function add() { if( !$args = func_get_args() ) { return $this; } $intervals = array_map( array($this, 'addHelper'), $args ); $intervals[] = $this->intervals; $output = array(); // merge the lot $intervals...
php
public function add() { if( !$args = func_get_args() ) { return $this; } $intervals = array_map( array($this, 'addHelper'), $args ); $intervals[] = $this->intervals; $output = array(); // merge the lot $intervals...
[ "public", "function", "add", "(", ")", "{", "if", "(", "!", "$", "args", "=", "func_get_args", "(", ")", ")", "{", "return", "$", "this", ";", "}", "$", "intervals", "=", "array_map", "(", "array", "(", "$", "this", ",", "'addHelper'", ")", ",", ...
Variable number of argument of things we're likey to be able to make a set out of. @param See $this->addHelper() .. @return $this
[ "Variable", "number", "of", "argument", "of", "things", "we", "re", "likey", "to", "be", "able", "to", "make", "a", "set", "out", "of", "." ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Set.php#L73-L133
train
squareproton/Bond
src/Bond/Set.php
Set.contains
public function contains() { // build new set from passed arguments $reflection = new \ReflectionClass( get_called_class() ); $comparing = $reflection->newInstanceArgs( func_get_args() ); // we don't have a null but the set we're comparing against has it if( !$this->contain...
php
public function contains() { // build new set from passed arguments $reflection = new \ReflectionClass( get_called_class() ); $comparing = $reflection->newInstanceArgs( func_get_args() ); // we don't have a null but the set we're comparing against has it if( !$this->contain...
[ "public", "function", "contains", "(", ")", "{", "// build new set from passed arguments", "$", "reflection", "=", "new", "\\", "ReflectionClass", "(", "get_called_class", "(", ")", ")", ";", "$", "comparing", "=", "$", "reflection", "->", "newInstanceArgs", "(", ...
Is a set contained within another set @return <type>
[ "Is", "a", "set", "contained", "within", "another", "set" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Set.php#L262-L310
train
squareproton/Bond
src/Bond/Set.php
Set.invert
public function invert() { $this->containsNull = !$this->containsNull; if( $this->intervals === array( array(null, null) ) ) { $this->intervals = array(); return $this; } $output = array(); $working = array( null, null ); reset( $this->inte...
php
public function invert() { $this->containsNull = !$this->containsNull; if( $this->intervals === array( array(null, null) ) ) { $this->intervals = array(); return $this; } $output = array(); $working = array( null, null ); reset( $this->inte...
[ "public", "function", "invert", "(", ")", "{", "$", "this", "->", "containsNull", "=", "!", "$", "this", "->", "containsNull", ";", "if", "(", "$", "this", "->", "intervals", "===", "array", "(", "array", "(", "null", ",", "null", ")", ")", ")", "{...
Invert a set. @return $this;
[ "Invert", "a", "set", "." ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Set.php#L316-L360
train
squareproton/Bond
src/Bond/Set.php
Set.addHelper
protected function addHelper( $data ) { // array of values if( is_array( $data ) ) { $originalSize = count( $data ); $data = array_filter( $data, '\Bond\is_not_null' ); // have null if( $originalSize !== count( $data ) ) { $this->con...
php
protected function addHelper( $data ) { // array of values if( is_array( $data ) ) { $originalSize = count( $data ); $data = array_filter( $data, '\Bond\is_not_null' ); // have null if( $originalSize !== count( $data ) ) { $this->con...
[ "protected", "function", "addHelper", "(", "$", "data", ")", "{", "// array of values", "if", "(", "is_array", "(", "$", "data", ")", ")", "{", "$", "originalSize", "=", "count", "(", "$", "data", ")", ";", "$", "data", "=", "array_filter", "(", "$", ...
Convert something that looks like it's going to be a set castable into a array of intervals Not nessisarily sorted @param mixed $data @return array Intervals
[ "Convert", "something", "that", "looks", "like", "it", "s", "going", "to", "be", "a", "set", "castable", "into", "a", "array", "of", "intervals", "Not", "nessisarily", "sorted" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Set.php#L392-L432
train
squareproton/Bond
src/Bond/Set.php
Set.parseStringToIntervals
private function parseStringToIntervals( $string ) { if( !$length = mb_strlen( $string ) ) { return array(); } // The following isn't as bat shit crazy loco nutjob wtf loony as it looks. // People need to enter literal commas, dashes and backslashes and you can't easily...
php
private function parseStringToIntervals( $string ) { if( !$length = mb_strlen( $string ) ) { return array(); } // The following isn't as bat shit crazy loco nutjob wtf loony as it looks. // People need to enter literal commas, dashes and backslashes and you can't easily...
[ "private", "function", "parseStringToIntervals", "(", "$", "string", ")", "{", "if", "(", "!", "$", "length", "=", "mb_strlen", "(", "$", "string", ")", ")", "{", "return", "array", "(", ")", ";", "}", "// The following isn't as bat shit crazy loco nutjob wtf lo...
Parse the data into an array of unique values @param string $string String represensation of a set which we're going to parse into a valid, sorted array of intervals @return array
[ "Parse", "the", "data", "into", "an", "array", "of", "unique", "values" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Set.php#L516-L586
train
squareproton/Bond
src/Bond/Set.php
Set.sortIntervals
private final function sortIntervals( $a, $b ) { if( 0 !== $lowerCompare = $this->sort( $a[0], $b[0], self::NULL_IS_LOW ) ) { return $lowerCompare; } return -$this->sort( $a[1], $b[1], self::NULL_IS_HIGH ); }
php
private final function sortIntervals( $a, $b ) { if( 0 !== $lowerCompare = $this->sort( $a[0], $b[0], self::NULL_IS_LOW ) ) { return $lowerCompare; } return -$this->sort( $a[1], $b[1], self::NULL_IS_HIGH ); }
[ "private", "final", "function", "sortIntervals", "(", "$", "a", ",", "$", "b", ")", "{", "if", "(", "0", "!==", "$", "lowerCompare", "=", "$", "this", "->", "sort", "(", "$", "a", "[", "0", "]", ",", "$", "b", "[", "0", "]", ",", "self", "::"...
Sort two intervals @param array $a @param array $b @return -1,0,1
[ "Sort", "two", "intervals" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Set.php#L631-L637
train
squareproton/Bond
src/Bond/Set.php
Set.max
protected function max( $a, $b, $handleNull ) { return $this->sort( $a, $b, $handleNull ) > 0 ? $a : $b; }
php
protected function max( $a, $b, $handleNull ) { return $this->sort( $a, $b, $handleNull ) > 0 ? $a : $b; }
[ "protected", "function", "max", "(", "$", "a", ",", "$", "b", ",", "$", "handleNull", ")", "{", "return", "$", "this", "->", "sort", "(", "$", "a", ",", "$", "b", ",", "$", "handleNull", ")", ">", "0", "?", "$", "a", ":", "$", "b", ";", "}"...
Return the max of two things @param mixed $a @param mixed $b @param mixed $handleNull Is null treated as a high value or a low value. See, self::NULL_IS_HIGH @return mixed
[ "Return", "the", "max", "of", "two", "things" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Set.php#L665-L668
train
squareproton/Bond
src/Bond/Set.php
Set.min
protected function min( $a, $b, $handleNull ) { return $this->sort( $a, $b, $handleNull ) > 0 ? $b : $a; }
php
protected function min( $a, $b, $handleNull ) { return $this->sort( $a, $b, $handleNull ) > 0 ? $b : $a; }
[ "protected", "function", "min", "(", "$", "a", ",", "$", "b", ",", "$", "handleNull", ")", "{", "return", "$", "this", "->", "sort", "(", "$", "a", ",", "$", "b", ",", "$", "handleNull", ")", ">", "0", "?", "$", "b", ":", "$", "a", ";", "}"...
Return the min of two things. @param mixed $a @param mixed $b @param mixed $handleNull Is null treated as a high value or a low value. See, self::NULL_IS_HIGH @return mixed
[ "Return", "the", "min", "of", "two", "things", "." ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Set.php#L677-L680
train
squareproton/Bond
src/Bond/Set.php
Set.escape
public static function escape( $value, $escapeNull = true ) { if( $value === null ) { return $escapeNull ? self::ESCAPE_CHARACTER . self::NULL_CHARACTER : ''; } $value = str_replace( self::ESCAPE_CHARACTER, self::ESCAPE_CHARACTER . self::ESCAPE_CHARACTER, $value ); $val...
php
public static function escape( $value, $escapeNull = true ) { if( $value === null ) { return $escapeNull ? self::ESCAPE_CHARACTER . self::NULL_CHARACTER : ''; } $value = str_replace( self::ESCAPE_CHARACTER, self::ESCAPE_CHARACTER . self::ESCAPE_CHARACTER, $value ); $val...
[ "public", "static", "function", "escape", "(", "$", "value", ",", "$", "escapeNull", "=", "true", ")", "{", "if", "(", "$", "value", "===", "null", ")", "{", "return", "$", "escapeNull", "?", "self", "::", "ESCAPE_CHARACTER", ".", "self", "::", "NULL_C...
Escape a interval fragments @param scalar $value @return string
[ "Escape", "a", "interval", "fragments" ]
a04ad9dd1a35adeaec98237716c2a41ce02b4f1a
https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Set.php#L718-L731
train
TuumPHP/Router
src/ReverseRoute.php
ReverseRoute.prepare
public function prepare() { $this->preparedRoutes = true; foreach($this->routers as $router) { $this->prepareRoutes($router->routes); } }
php
public function prepare() { $this->preparedRoutes = true; foreach($this->routers as $router) { $this->prepareRoutes($router->routes); } }
[ "public", "function", "prepare", "(", ")", "{", "$", "this", "->", "preparedRoutes", "=", "true", ";", "foreach", "(", "$", "this", "->", "routers", "as", "$", "router", ")", "{", "$", "this", "->", "prepareRoutes", "(", "$", "router", "->", "routes", ...
prepares reverse routes from added routers.
[ "prepares", "reverse", "routes", "from", "added", "routers", "." ]
781e40b387fd1c7deb8175ccddd758a10e2cd0bd
https://github.com/TuumPHP/Router/blob/781e40b387fd1c7deb8175ccddd758a10e2cd0bd/src/ReverseRoute.php#L44-L50
train
congraphcms/core
Traits/MapperTrait.php
MapperTrait.maps
public static function maps(array $mappings, $key = 'default') { self::$mappings = array_merge_recursive(self::$mappings, [ $key => $mappings ]); }
php
public static function maps(array $mappings, $key = 'default') { self::$mappings = array_merge_recursive(self::$mappings, [ $key => $mappings ]); }
[ "public", "static", "function", "maps", "(", "array", "$", "mappings", ",", "$", "key", "=", "'default'", ")", "{", "self", "::", "$", "mappings", "=", "array_merge_recursive", "(", "self", "::", "$", "mappings", ",", "[", "$", "key", "=>", "$", "mappi...
Register mappings. @param array $mappings @return void
[ "Register", "mappings", "." ]
d017d3951b446fb2ac93b8fcee120549bb125b17
https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Traits/MapperTrait.php#L58-L61
train
congraphcms/core
Traits/MapperTrait.php
MapperTrait.getMappings
public static function getMappings($resource, $key = 'default') { $resourceName = $resource; if( is_object($resource) ) { $resourceName = get_class($resource); } $mappings = []; if( isset(self::$mappers[$key]) ) { $mappings = array_merge_recursive( $mappings, call_user_func(self::$mappers[$key], ...
php
public static function getMappings($resource, $key = 'default') { $resourceName = $resource; if( is_object($resource) ) { $resourceName = get_class($resource); } $mappings = []; if( isset(self::$mappers[$key]) ) { $mappings = array_merge_recursive( $mappings, call_user_func(self::$mappers[$key], ...
[ "public", "static", "function", "getMappings", "(", "$", "resource", ",", "$", "key", "=", "'default'", ")", "{", "$", "resourceName", "=", "$", "resource", ";", "if", "(", "is_object", "(", "$", "resource", ")", ")", "{", "$", "resourceName", "=", "ge...
Get mappings for the resource. @param mixed $command @return string
[ "Get", "mappings", "for", "the", "resource", "." ]
d017d3951b446fb2ac93b8fcee120549bb125b17
https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Traits/MapperTrait.php#L80-L101
train
congraphcms/core
Traits/MapperTrait.php
MapperTrait.resolveMapping
public function resolveMapping($resource, $parameters = [], $key = 'default', $method = null) { $resourceName = $resource; if( is_object($resource) ) { $resourceName = get_class($resource); } $mappings = $this->getMappings($resourceName, $key); if(empty($mappings)) { throw new Exception('No reso...
php
public function resolveMapping($resource, $parameters = [], $key = 'default', $method = null) { $resourceName = $resource; if( is_object($resource) ) { $resourceName = get_class($resource); } $mappings = $this->getMappings($resourceName, $key); if(empty($mappings)) { throw new Exception('No reso...
[ "public", "function", "resolveMapping", "(", "$", "resource", ",", "$", "parameters", "=", "[", "]", ",", "$", "key", "=", "'default'", ",", "$", "method", "=", "null", ")", "{", "$", "resourceName", "=", "$", "resource", ";", "if", "(", "is_object", ...
Resolve mapping end return result @param mixed $resource - mapping name to be resolved @param array $parameters - params for resolver @param string $key - mapping section @throws Exception @return mixed
[ "Resolve", "mapping", "end", "return", "result" ]
d017d3951b446fb2ac93b8fcee120549bb125b17
https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Traits/MapperTrait.php#L114-L138
train
congraphcms/core
Traits/MapperTrait.php
MapperTrait.runResolver
public function runResolver($resolver, $parameters = [], $method = null) { if (is_callable($resolver)) { return call_user_func_array($resolver, $parameters); } if(class_exists($resolver)) { $instance = $this->container->make($resolver, $parameters); if($instance ...
php
public function runResolver($resolver, $parameters = [], $method = null) { if (is_callable($resolver)) { return call_user_func_array($resolver, $parameters); } if(class_exists($resolver)) { $instance = $this->container->make($resolver, $parameters); if($instance ...
[ "public", "function", "runResolver", "(", "$", "resolver", ",", "$", "parameters", "=", "[", "]", ",", "$", "method", "=", "null", ")", "{", "if", "(", "is_callable", "(", "$", "resolver", ")", ")", "{", "return", "call_user_func_array", "(", "$", "res...
Handle and run the resolver @param mixed $resolver @param array $parameters - params for resolver @return mixed
[ "Handle", "and", "run", "the", "resolver" ]
d017d3951b446fb2ac93b8fcee120549bb125b17
https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Traits/MapperTrait.php#L148-L181
train
Soneritics/Buckaroo
Soneritics/Buckaroo/ServiceOperations/TransactionRequest.php
TransactionRequest.getPostFields
public function getPostFields() { $this->validate(); $mappedFields = $this->getMappedFields(); $this->paymentMethod->addAdditionalFields($mappedFields); return $mappedFields; }
php
public function getPostFields() { $this->validate(); $mappedFields = $this->getMappedFields(); $this->paymentMethod->addAdditionalFields($mappedFields); return $mappedFields; }
[ "public", "function", "getPostFields", "(", ")", "{", "$", "this", "->", "validate", "(", ")", ";", "$", "mappedFields", "=", "$", "this", "->", "getMappedFields", "(", ")", ";", "$", "this", "->", "paymentMethod", "->", "addAdditionalFields", "(", "$", ...
Get the post fields for the requests. @return array
[ "Get", "the", "post", "fields", "for", "the", "requests", "." ]
cb345dce9b96c996e47121d6145a7e314943c8f1
https://github.com/Soneritics/Buckaroo/blob/cb345dce9b96c996e47121d6145a7e314943c8f1/Soneritics/Buckaroo/ServiceOperations/TransactionRequest.php#L93-L99
train
RSQueue/RSQueue
src/RSQueue/RedisFactory.php
RedisFactory.createSimple
private function createSimple(): Redis { $redis = new Redis(); $redis->connect($this->config['host'], (int) $this->config['port']); $redis->setOption(Redis::OPT_READ_TIMEOUT, '-1'); if ($this->config['database']) { $redis->select($this->config['database']); } ...
php
private function createSimple(): Redis { $redis = new Redis(); $redis->connect($this->config['host'], (int) $this->config['port']); $redis->setOption(Redis::OPT_READ_TIMEOUT, '-1'); if ($this->config['database']) { $redis->select($this->config['database']); } ...
[ "private", "function", "createSimple", "(", ")", ":", "Redis", "{", "$", "redis", "=", "new", "Redis", "(", ")", ";", "$", "redis", "->", "connect", "(", "$", "this", "->", "config", "[", "'host'", "]", ",", "(", "int", ")", "$", "this", "->", "c...
Create single redis. @return Redis
[ "Create", "single", "redis", "." ]
1a8d72a2b025ed65684644febf9493d4f6ac9333
https://github.com/RSQueue/RSQueue/blob/1a8d72a2b025ed65684644febf9493d4f6ac9333/src/RSQueue/RedisFactory.php#L74-L84
train
zicht/tinymce-bundle
src/Zicht/Bundle/TinymceBundle/Twig/Extension/ZichtTinymceExtension.php
ZichtTinymceExtension.getAssetsUrl
protected function getAssetsUrl($inputUrl) { /** @var $assets \Symfony\Component\Templating\Helper\CoreAssetsHelper */ $assets = $this->getService('assets.packages'); $url = preg_replace('/^asset\[(.+)\]$/i', '$1', $inputUrl); if ($inputUrl !== $url) { return $assets->g...
php
protected function getAssetsUrl($inputUrl) { /** @var $assets \Symfony\Component\Templating\Helper\CoreAssetsHelper */ $assets = $this->getService('assets.packages'); $url = preg_replace('/^asset\[(.+)\]$/i', '$1', $inputUrl); if ($inputUrl !== $url) { return $assets->g...
[ "protected", "function", "getAssetsUrl", "(", "$", "inputUrl", ")", "{", "/** @var $assets \\Symfony\\Component\\Templating\\Helper\\CoreAssetsHelper */", "$", "assets", "=", "$", "this", "->", "getService", "(", "'assets.packages'", ")", ";", "$", "url", "=", "preg_rep...
Get url from config string @param string $inputUrl @return string
[ "Get", "url", "from", "config", "string" ]
43d2eb4eb3f7f0e4752fb496f4aada6f2d805c96
https://github.com/zicht/tinymce-bundle/blob/43d2eb4eb3f7f0e4752fb496f4aada6f2d805c96/src/Zicht/Bundle/TinymceBundle/Twig/Extension/ZichtTinymceExtension.php#L211-L223
train
Wedeto/DB
src/DAO.php
DAO.getSelector
public function getSelector($pkey, array $record) { if ($pkey !== null && !is_array($pkey)) throw new InvalidTypeException("Invalid primary key: " . WF::str($pkey)); // When no primary key is available, we match on all fields $is_primary_key = true; if ($pkey === null) ...
php
public function getSelector($pkey, array $record) { if ($pkey !== null && !is_array($pkey)) throw new InvalidTypeException("Invalid primary key: " . WF::str($pkey)); // When no primary key is available, we match on all fields $is_primary_key = true; if ($pkey === null) ...
[ "public", "function", "getSelector", "(", "$", "pkey", ",", "array", "$", "record", ")", "{", "if", "(", "$", "pkey", "!==", "null", "&&", "!", "is_array", "(", "$", "pkey", ")", ")", "throw", "new", "InvalidTypeException", "(", "\"Invalid primary key: \""...
Form a condition that matches the record using the values in the provided record. @param array $pkey The column names in the primary key @param array $record The record to match
[ "Form", "a", "condition", "that", "matches", "the", "record", "using", "the", "values", "in", "the", "provided", "record", "." ]
715f8f2e3ae6b53c511c40b620921cb9c87e6f62
https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/DAO.php#L131-L162
train
Wedeto/DB
src/DAO.php
DAO.save
public function save(Model $model) { $database = $model->getSourceDB(); $pkey = $model->getID(); if ($database === null || $database !== $this->db) $this->insert($model); else $this->update($model); return $this; }
php
public function save(Model $model) { $database = $model->getSourceDB(); $pkey = $model->getID(); if ($database === null || $database !== $this->db) $this->insert($model); else $this->update($model); return $this; }
[ "public", "function", "save", "(", "Model", "$", "model", ")", "{", "$", "database", "=", "$", "model", "->", "getSourceDB", "(", ")", ";", "$", "pkey", "=", "$", "model", "->", "getID", "(", ")", ";", "if", "(", "$", "database", "===", "null", "...
Save the current record to the database. @param Wedeto\DB\Model $model The model instance to save. If the model does not have a source database, it is inserted, otherwise an update is executed. @return Wedeto\DB\DAO Provides fluent interface
[ "Save", "the", "current", "record", "to", "the", "database", "." ]
715f8f2e3ae6b53c511c40b620921cb9c87e6f62
https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/DAO.php#L173-L184
train
Wedeto/DB
src/DAO.php
DAO.getByID
public function getByID($id) { $pkey = $this->getPrimaryKey(); if ($pkey === null) throw new DAOException("A primary key is required to select a record by ID"); // If there's a unary primary key, the value can be specified as a // single scalar, rather than an array ...
php
public function getByID($id) { $pkey = $this->getPrimaryKey(); if ($pkey === null) throw new DAOException("A primary key is required to select a record by ID"); // If there's a unary primary key, the value can be specified as a // single scalar, rather than an array ...
[ "public", "function", "getByID", "(", "$", "id", ")", "{", "$", "pkey", "=", "$", "this", "->", "getPrimaryKey", "(", ")", ";", "if", "(", "$", "pkey", "===", "null", ")", "throw", "new", "DAOException", "(", "\"A primary key is required to select a record b...
Load the record from the database @param mixed $id The record to load, indicating the primary key. The type should match the primary key: scalar for unary primary keys, associative array for combined primary keys.
[ "Load", "the", "record", "from", "the", "database" ]
715f8f2e3ae6b53c511c40b620921cb9c87e6f62
https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/DAO.php#L193-L214
train
Wedeto/DB
src/DAO.php
DAO.get
public function get(...$args) { $record = $this->fetchSingle($args); if (!$record) return null; $obj = new $this->model_class; $obj->assignRecord($record, $this->db); return $obj; }
php
public function get(...$args) { $record = $this->fetchSingle($args); if (!$record) return null; $obj = new $this->model_class; $obj->assignRecord($record, $this->db); return $obj; }
[ "public", "function", "get", "(", "...", "$", "args", ")", "{", "$", "record", "=", "$", "this", "->", "fetchSingle", "(", "$", "args", ")", ";", "if", "(", "!", "$", "record", ")", "return", "null", ";", "$", "obj", "=", "new", "$", "this", "-...
Retrieve a single record based on a provided query @param args The provided arguments for the select query. @return Model The fetch model @see Wedeto\DB\DAO::select
[ "Retrieve", "a", "single", "record", "based", "on", "a", "provided", "query" ]
715f8f2e3ae6b53c511c40b620921cb9c87e6f62
https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/DAO.php#L222-L230
train
Wedeto/DB
src/DAO.php
DAO.getAll
public function getAll(...$args) { $pkey = $this->getPrimaryKey(); if (count($pkey) === 1) { reset($pkey); $pkey_as_index = key($pkey); } else $pkey_as_index = false; $list = array(); $records = $this->fetchAll($args); ...
php
public function getAll(...$args) { $pkey = $this->getPrimaryKey(); if (count($pkey) === 1) { reset($pkey); $pkey_as_index = key($pkey); } else $pkey_as_index = false; $list = array(); $records = $this->fetchAll($args); ...
[ "public", "function", "getAll", "(", "...", "$", "args", ")", "{", "$", "pkey", "=", "$", "this", "->", "getPrimaryKey", "(", ")", ";", "if", "(", "count", "(", "$", "pkey", ")", "===", "1", ")", "{", "reset", "(", "$", "pkey", ")", ";", "$", ...
Retrieve a set of records, create object from them and return the resulting list. @param $args The provided arguments for the select query. @return array The retrieved DAO objects. If the primary key is a single field, the indices correspond to the primary key @see Wedeto\DB\DAO::select
[ "Retrieve", "a", "set", "of", "records", "create", "object", "from", "them", "and", "return", "the", "resulting", "list", "." ]
715f8f2e3ae6b53c511c40b620921cb9c87e6f62
https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/DAO.php#L238-L263
train
Wedeto/DB
src/DAO.php
DAO.fetchSingle
public function fetchSingle(...$args) { $args[] = QB::limit(1); $select = $this->select($args); return $select->fetch(); }
php
public function fetchSingle(...$args) { $args[] = QB::limit(1); $select = $this->select($args); return $select->fetch(); }
[ "public", "function", "fetchSingle", "(", "...", "$", "args", ")", "{", "$", "args", "[", "]", "=", "QB", "::", "limit", "(", "1", ")", ";", "$", "select", "=", "$", "this", "->", "select", "(", "$", "args", ")", ";", "return", "$", "select", "...
Execute a query, retrieve the first record and return it. @param $args The provided arguments for the select query. @return array The retrieved record @see Wedeto\DB\DAO::select
[ "Execute", "a", "query", "retrieve", "the", "first", "record", "and", "return", "it", "." ]
715f8f2e3ae6b53c511c40b620921cb9c87e6f62
https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/DAO.php#L272-L277
train
Wedeto/DB
src/DAO.php
DAO.select
public function select(...$args) { $args = WF::flatten_array($args); $select = new Query\Select; $select->add(new Query\SourceTableClause($this->tablename)); $cols = $this->getColumns(); foreach ($cols as $name => $def) $select->add(new Query\GetClause($name)); ...
php
public function select(...$args) { $args = WF::flatten_array($args); $select = new Query\Select; $select->add(new Query\SourceTableClause($this->tablename)); $cols = $this->getColumns(); foreach ($cols as $name => $def) $select->add(new Query\GetClause($name)); ...
[ "public", "function", "select", "(", "...", "$", "args", ")", "{", "$", "args", "=", "WF", "::", "flatten_array", "(", "$", "args", ")", ";", "$", "select", "=", "new", "Query", "\\", "Select", ";", "$", "select", "->", "add", "(", "new", "Query", ...
Select one or more records from the database. @param $args The provided arguments should contain query parts passed to the Select constructor. These can be objects such as: FieldName, JoinClause, WhereClause, OrderClause, LimitClause, OffsetClause. A Wedeto\DB\DB object can also be passed in to use as a Database. @ret...
[ "Select", "one", "or", "more", "records", "from", "the", "database", "." ]
715f8f2e3ae6b53c511c40b620921cb9c87e6f62
https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/DAO.php#L303-L317
train
Wedeto/DB
src/DAO.php
DAO.update
public function update($id, array $record = null) { $model = is_a($id, $this->model_class) ? $id : null; if (null !== $model) { if ($record !== null) throw new DAOException("You should not pass an array of updates when supplying a Model"); if ($id->ge...
php
public function update($id, array $record = null) { $model = is_a($id, $this->model_class) ? $id : null; if (null !== $model) { if ($record !== null) throw new DAOException("You should not pass an array of updates when supplying a Model"); if ($id->ge...
[ "public", "function", "update", "(", "$", "id", ",", "array", "$", "record", "=", "null", ")", "{", "$", "model", "=", "is_a", "(", "$", "id", ",", "$", "this", "->", "model_class", ")", "?", "$", "id", ":", "null", ";", "if", "(", "null", "!==...
Update records in the database. @param mixed $id The values for the primary key to select the record to update. You can also supply an instance of the accompanying Model class. @param array $record The record to update. Should contain key/value pairs where keys are fieldnames, values are the values to update them to. ...
[ "Update", "records", "in", "the", "database", "." ]
715f8f2e3ae6b53c511c40b620921cb9c87e6f62
https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/DAO.php#L331-L393
train
Wedeto/DB
src/DAO.php
DAO.delete
public function delete($where) { $is_model = is_a($where, $this->model_class); if (!$is_model && !is_a($where, Query\WhereClause::class)) throw new InvalidTypeException("Must provide a WhereClause or an instance of {$this->model_class} to delete"); $modelInstance = null; ...
php
public function delete($where) { $is_model = is_a($where, $this->model_class); if (!$is_model && !is_a($where, Query\WhereClause::class)) throw new InvalidTypeException("Must provide a WhereClause or an instance of {$this->model_class} to delete"); $modelInstance = null; ...
[ "public", "function", "delete", "(", "$", "where", ")", "{", "$", "is_model", "=", "is_a", "(", "$", "where", ",", "$", "this", "->", "model_class", ")", ";", "if", "(", "!", "$", "is_model", "&&", "!", "is_a", "(", "$", "where", ",", "Query", "\...
Delete records from the database. @param Wedeto\DB\Query\WhereClause Specifies which records to delete. You can use Wedeto\DB\Query\Builder to create it, or provide a string that will be interpreted as custom SQL. A third option is to provide an associative array where keys indicate field names and values their values...
[ "Delete", "records", "from", "the", "database", "." ]
715f8f2e3ae6b53c511c40b620921cb9c87e6f62
https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/DAO.php#L475-L500
train
JumpGateio/Core
src/JumpGate/Core/Services/Response.php
Response.route
public function route($name, $details = []) { $this->route = route($name, $details); $this->routeName = $name; return $this; }
php
public function route($name, $details = []) { $this->route = route($name, $details); $this->routeName = $name; return $this; }
[ "public", "function", "route", "(", "$", "name", ",", "$", "details", "=", "[", "]", ")", "{", "$", "this", "->", "route", "=", "route", "(", "$", "name", ",", "$", "details", ")", ";", "$", "this", "->", "routeName", "=", "$", "name", ";", "re...
Add a route to redirect the request to. @param string $name @param array $details @return $this
[ "Add", "a", "route", "to", "redirect", "the", "request", "to", "." ]
485b5cf03b3072267bffbee428b81e48d407d6b6
https://github.com/JumpGateio/Core/blob/485b5cf03b3072267bffbee428b81e48d407d6b6/src/JumpGate/Core/Services/Response.php#L71-L77
train
JumpGateio/Core
src/JumpGate/Core/Services/Response.php
Response.redirectIntended
public function redirectIntended() { // Make sure we have a route. if (is_null($this->route)) { throw new \Exception('No route has been provided. Please use route() to add one.'); } // If this response passed, show the success message. if ($this->success) { ...
php
public function redirectIntended() { // Make sure we have a route. if (is_null($this->route)) { throw new \Exception('No route has been provided. Please use route() to add one.'); } // If this response passed, show the success message. if ($this->success) { ...
[ "public", "function", "redirectIntended", "(", ")", "{", "// Make sure we have a route.", "if", "(", "is_null", "(", "$", "this", "->", "route", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'No route has been provided. Please use route() to add one.'", ")"...
Redirect the request to the intended route or the provided one. @return \Illuminate\Http\RedirectResponse @throws \Exception
[ "Redirect", "the", "request", "to", "the", "intended", "route", "or", "the", "provided", "one", "." ]
485b5cf03b3072267bffbee428b81e48d407d6b6
https://github.com/JumpGateio/Core/blob/485b5cf03b3072267bffbee428b81e48d407d6b6/src/JumpGate/Core/Services/Response.php#L109-L126
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/Persist.php
Persist.associateRelatedRecordsToNewRecord
public function associateRelatedRecordsToNewRecord($modelInstance, $associatedRecords, $relatedNamespace, $relatedModelClass) { // Check if there are any records to insert into the pivot table if (count($associatedRecords) > 0) { // What is the namespace.class of the related tabl...
php
public function associateRelatedRecordsToNewRecord($modelInstance, $associatedRecords, $relatedNamespace, $relatedModelClass) { // Check if there are any records to insert into the pivot table if (count($associatedRecords) > 0) { // What is the namespace.class of the related tabl...
[ "public", "function", "associateRelatedRecordsToNewRecord", "(", "$", "modelInstance", ",", "$", "associatedRecords", ",", "$", "relatedNamespace", ",", "$", "relatedModelClass", ")", "{", "// Check if there are any records to insert into the pivot table", "if", "(", "count",...
Associate each related record with the record just created @param object $modelInstance object just created @param array $associatedRecords array of id's associated with the record just created @param string $relatedNamespace Namespace of the associated model @param string $relatedModelClas...
[ "Associate", "each", "related", "record", "with", "the", "record", "just", "created" ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/Persist.php#L194-L225
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/Persist.php
Persist.associateRelatedRecordsToUpdatedRecord
public function associateRelatedRecordsToUpdatedRecord($modelInstance, $associatedRecords, $relatedModelClass) { // Check if there are any records to sync with the pivot table if (count($associatedRecords) > 0) { // There's probably a function for this, but for now: /...
php
public function associateRelatedRecordsToUpdatedRecord($modelInstance, $associatedRecords, $relatedModelClass) { // Check if there are any records to sync with the pivot table if (count($associatedRecords) > 0) { // There's probably a function for this, but for now: /...
[ "public", "function", "associateRelatedRecordsToUpdatedRecord", "(", "$", "modelInstance", ",", "$", "associatedRecords", ",", "$", "relatedModelClass", ")", "{", "// Check if there are any records to sync with the pivot table", "if", "(", "count", "(", "$", "associatedRecord...
Associate each related record with the record just updated. @param object $modelInstance object just updated @param array $associatedRecords array of id's associated with the record just updated @param string $relatedNamespace Namespace of the associated model @param string $relatedModelCla...
[ "Associate", "each", "related", "record", "with", "the", "record", "just", "updated", "." ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/Persist.php#L350-L373
train
AlexKovalevych/jira-api
src/Clients/IssueClient.php
IssueClient.get
public function get($idOrKey, array $fields = null) { $parameters = $fields ? sprintf( '?%s', $this->createUriParameters( ['fields' => implode(',', $fields)] ) ) : '' ; return $this->getR...
php
public function get($idOrKey, array $fields = null) { $parameters = $fields ? sprintf( '?%s', $this->createUriParameters( ['fields' => implode(',', $fields)] ) ) : '' ; return $this->getR...
[ "public", "function", "get", "(", "$", "idOrKey", ",", "array", "$", "fields", "=", "null", ")", "{", "$", "parameters", "=", "$", "fields", "?", "sprintf", "(", "'?%s'", ",", "$", "this", "->", "createUriParameters", "(", "[", "'fields'", "=>", "implo...
Returns issue by id or key. @link https://docs.atlassian.com/jira/REST/latest/#d2e1375 @param integer|string $idOrKey @param array $fields array of fields to be returns (return all by default) @return \GuzzleHttp\Message\Response
[ "Returns", "issue", "by", "id", "or", "key", "." ]
29f1ac3239f49d7e3ad658c1360c6ae582370a5d
https://github.com/AlexKovalevych/jira-api/blob/29f1ac3239f49d7e3ad658c1360c6ae582370a5d/src/Clients/IssueClient.php#L28-L41
train
AlexKovalevych/jira-api
src/Clients/IssueClient.php
IssueClient.delete
public function delete($idOrKey, $deleteSubtasks = false) { $parameters = sprintf('?deleteSubtasks=%s', $deleteSubtasks); return $this->deleteRequest(sprintf('issue/%s%s', $idOrKey, $parameters)); }
php
public function delete($idOrKey, $deleteSubtasks = false) { $parameters = sprintf('?deleteSubtasks=%s', $deleteSubtasks); return $this->deleteRequest(sprintf('issue/%s%s', $idOrKey, $parameters)); }
[ "public", "function", "delete", "(", "$", "idOrKey", ",", "$", "deleteSubtasks", "=", "false", ")", "{", "$", "parameters", "=", "sprintf", "(", "'?deleteSubtasks=%s'", ",", "$", "deleteSubtasks", ")", ";", "return", "$", "this", "->", "deleteRequest", "(", ...
Deletes an issue by id or key @link https://docs.atlassian.com/jira/REST/latest/#d2e1401 @param integer|string $idOrKey @param boolean $deleteSubtasks @return \GuzzleHttp\Message\Response
[ "Deletes", "an", "issue", "by", "id", "or", "key" ]
29f1ac3239f49d7e3ad658c1360c6ae582370a5d
https://github.com/AlexKovalevych/jira-api/blob/29f1ac3239f49d7e3ad658c1360c6ae582370a5d/src/Clients/IssueClient.php#L67-L72
train
AlexKovalevych/jira-api
src/Clients/IssueClient.php
IssueClient.createAttachment
public function createAttachment($idOrKey, $fileHandle) { if (gettype($fileHandle) != 'resource') { throw new \RuntimeException(sprintf('createAttachment() expects parameter 2 to be resource, %s given', gettype($fileHandle))); } return $this->postFile(sprintf('issue/%s/attachmen...
php
public function createAttachment($idOrKey, $fileHandle) { if (gettype($fileHandle) != 'resource') { throw new \RuntimeException(sprintf('createAttachment() expects parameter 2 to be resource, %s given', gettype($fileHandle))); } return $this->postFile(sprintf('issue/%s/attachmen...
[ "public", "function", "createAttachment", "(", "$", "idOrKey", ",", "$", "fileHandle", ")", "{", "if", "(", "gettype", "(", "$", "fileHandle", ")", "!=", "'resource'", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "sprintf", "(", "'createAttachmen...
Create issue attachment by its id or key @link https://docs.atlassian.com/jira/REST/latest/#d2e1228 @param integer|string $idOrKey @param array $data @return \GuzzleHttp\Message\Response
[ "Create", "issue", "attachment", "by", "its", "id", "or", "key" ]
29f1ac3239f49d7e3ad658c1360c6ae582370a5d
https://github.com/AlexKovalevych/jira-api/blob/29f1ac3239f49d7e3ad658c1360c6ae582370a5d/src/Clients/IssueClient.php#L99-L106
train
AlexKovalevych/jira-api
src/Clients/IssueClient.php
IssueClient.updateComment
public function updateComment($idOrKey, $commentId, array $data) { return $this->putRequest(sprintf('issue/%s/comment/%s', $idOrKey, $commentId), $data); }
php
public function updateComment($idOrKey, $commentId, array $data) { return $this->putRequest(sprintf('issue/%s/comment/%s', $idOrKey, $commentId), $data); }
[ "public", "function", "updateComment", "(", "$", "idOrKey", ",", "$", "commentId", ",", "array", "$", "data", ")", "{", "return", "$", "this", "->", "putRequest", "(", "sprintf", "(", "'issue/%s/comment/%s'", ",", "$", "idOrKey", ",", "$", "commentId", ")"...
Updates a comment by issue id or key, comment id with given data @link https://docs.atlassian.com/jira/REST/latest/#d2e1221 @param integer|string $idOrKey @param integer $commentId @param array $data @return \GuzzleHttp\Message\Response
[ "Updates", "a", "comment", "by", "issue", "id", "or", "key", "comment", "id", "with", "given", "data" ]
29f1ac3239f49d7e3ad658c1360c6ae582370a5d
https://github.com/AlexKovalevych/jira-api/blob/29f1ac3239f49d7e3ad658c1360c6ae582370a5d/src/Clients/IssueClient.php#L177-L180
train
AlexKovalevych/jira-api
src/Clients/IssueClient.php
IssueClient.createWorklog
public function createWorklog($idOrKey, array $data, $adjustEstimate = null, $newEstimate = null, $reduceBy = null) { $parameters = http_build_query( [ 'adjustEstimate' => $adjustEstimate, 'newEstimate' => $newEstimate, 'reduceBy' => $redu...
php
public function createWorklog($idOrKey, array $data, $adjustEstimate = null, $newEstimate = null, $reduceBy = null) { $parameters = http_build_query( [ 'adjustEstimate' => $adjustEstimate, 'newEstimate' => $newEstimate, 'reduceBy' => $redu...
[ "public", "function", "createWorklog", "(", "$", "idOrKey", ",", "array", "$", "data", ",", "$", "adjustEstimate", "=", "null", ",", "$", "newEstimate", "=", "null", ",", "$", "reduceBy", "=", "null", ")", "{", "$", "parameters", "=", "http_build_query", ...
Creates worklog for the issue by issue id or key @link https://docs.atlassian.com/jira/REST/latest/#d2e1788 @param integer|string $idOrKey @param array $data @param string $adjustEstimate ("new", "leave", "manual", "auto") @param string $newEstimate (required for "new" adjustEstimate)...
[ "Creates", "worklog", "for", "the", "issue", "by", "issue", "id", "or", "key" ]
29f1ac3239f49d7e3ad658c1360c6ae582370a5d
https://github.com/AlexKovalevych/jira-api/blob/29f1ac3239f49d7e3ad658c1360c6ae582370a5d/src/Clients/IssueClient.php#L224-L239
train
AlexKovalevych/jira-api
src/Clients/IssueClient.php
IssueClient.updateWorklog
public function updateWorklog($idOrKey, $worklogId, array $data, $adjustEstimate = null, $newEstimate = null) { $parameters = http_build_query( [ 'adjustEstimate' => $adjustEstimate, 'newEstimate' => $newEstimate, ] ); if ($paramete...
php
public function updateWorklog($idOrKey, $worklogId, array $data, $adjustEstimate = null, $newEstimate = null) { $parameters = http_build_query( [ 'adjustEstimate' => $adjustEstimate, 'newEstimate' => $newEstimate, ] ); if ($paramete...
[ "public", "function", "updateWorklog", "(", "$", "idOrKey", ",", "$", "worklogId", ",", "array", "$", "data", ",", "$", "adjustEstimate", "=", "null", ",", "$", "newEstimate", "=", "null", ")", "{", "$", "parameters", "=", "http_build_query", "(", "[", "...
Updates worklog for the issue by issue id or key and worklog id @link https://docs.atlassian.com/jira/REST/latest/#d2e1843 @param integer|string $idOrKey @param integer $worklogId @param array $data @param string $adjustEstimate @param string $newEstimate @return \GuzzleHttp\Mes...
[ "Updates", "worklog", "for", "the", "issue", "by", "issue", "id", "or", "key", "and", "worklog", "id" ]
29f1ac3239f49d7e3ad658c1360c6ae582370a5d
https://github.com/AlexKovalevych/jira-api/blob/29f1ac3239f49d7e3ad658c1360c6ae582370a5d/src/Clients/IssueClient.php#L269-L283
train
AlexKovalevych/jira-api
src/Clients/IssueClient.php
IssueClient.deleteWorklog
public function deleteWorklog($idOrKey, $worklogId, $adjustEstimate = null, $newEstimate = null, $increaseBy = null) { $parameters = http_build_query( [ 'adjustEstimate' => $adjustEstimate, 'newEstimate' => $newEstimate, 'increaseBy' => $inc...
php
public function deleteWorklog($idOrKey, $worklogId, $adjustEstimate = null, $newEstimate = null, $increaseBy = null) { $parameters = http_build_query( [ 'adjustEstimate' => $adjustEstimate, 'newEstimate' => $newEstimate, 'increaseBy' => $inc...
[ "public", "function", "deleteWorklog", "(", "$", "idOrKey", ",", "$", "worklogId", ",", "$", "adjustEstimate", "=", "null", ",", "$", "newEstimate", "=", "null", ",", "$", "increaseBy", "=", "null", ")", "{", "$", "parameters", "=", "http_build_query", "("...
Deletes worklog for the issue by issue id or key and worklog id @link https://docs.atlassian.com/jira/REST/latest/#d2e1878 @param integer|string $idOrKey @param integer $worklogId @param string $adjustEstimate @param string $newEstimate @param string $increaseBy @return \GuzzleHt...
[ "Deletes", "worklog", "for", "the", "issue", "by", "issue", "id", "or", "key", "and", "worklog", "id" ]
29f1ac3239f49d7e3ad658c1360c6ae582370a5d
https://github.com/AlexKovalevych/jira-api/blob/29f1ac3239f49d7e3ad658c1360c6ae582370a5d/src/Clients/IssueClient.php#L298-L313
train
congraphcms/core
Events/EventDispatcher.php
EventDispatcher.getListeners
public function getListeners($event) { $parentListeners = []; $wildcards = []; if( is_object($event) ) { $eventName = get_class($event); $parentListeners = $this->getParentListeners($event); } else { $eventName = $event; ...
php
public function getListeners($event) { $parentListeners = []; $wildcards = []; if( is_object($event) ) { $eventName = get_class($event); $parentListeners = $this->getParentListeners($event); } else { $eventName = $event; ...
[ "public", "function", "getListeners", "(", "$", "event", ")", "{", "$", "parentListeners", "=", "[", "]", ";", "$", "wildcards", "=", "[", "]", ";", "if", "(", "is_object", "(", "$", "event", ")", ")", "{", "$", "eventName", "=", "get_class", "(", ...
Get all of the listeners for a given event. @param mixed $event @return array
[ "Get", "all", "of", "the", "listeners", "for", "a", "given", "event", "." ]
d017d3951b446fb2ac93b8fcee120549bb125b17
https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Events/EventDispatcher.php#L130-L151
train
congraphcms/core
Events/EventDispatcher.php
EventDispatcher.getParentListeners
protected function getParentListeners($event) { $parentListeners = []; foreach ($this->listeners as $key => $listeners) { if ($event instanceof $key) { $parentListeners = array_merge($parentListeners, $listeners); } } retu...
php
protected function getParentListeners($event) { $parentListeners = []; foreach ($this->listeners as $key => $listeners) { if ($event instanceof $key) { $parentListeners = array_merge($parentListeners, $listeners); } } retu...
[ "protected", "function", "getParentListeners", "(", "$", "event", ")", "{", "$", "parentListeners", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "listeners", "as", "$", "key", "=>", "$", "listeners", ")", "{", "if", "(", "$", "event", "instan...
Get the parent class or interface listeners for the event. @param object $event @return array
[ "Get", "the", "parent", "class", "or", "interface", "listeners", "for", "the", "event", "." ]
d017d3951b446fb2ac93b8fcee120549bb125b17
https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Events/EventDispatcher.php#L159-L172
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/LockedFields.php
LockedFields.unlockMyRecords
public function unlockMyRecords($tableName) { $results = $this->lockedRecordsByUser($tableName, Auth::user()->id); foreach($results as $result) { $this->unpopulateLockFields($result->id); } }
php
public function unlockMyRecords($tableName) { $results = $this->lockedRecordsByUser($tableName, Auth::user()->id); foreach($results as $result) { $this->unpopulateLockFields($result->id); } }
[ "public", "function", "unlockMyRecords", "(", "$", "tableName", ")", "{", "$", "results", "=", "$", "this", "->", "lockedRecordsByUser", "(", "$", "tableName", ",", "Auth", "::", "user", "(", ")", "->", "id", ")", ";", "foreach", "(", "$", "results", "...
Unlock records belonging to the current user. @param string $tableName @return bool
[ "Unlock", "records", "belonging", "to", "the", "current", "user", "." ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/LockedFields.php#L52-L60
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/LockedFields.php
LockedFields.isLocked
public function isLocked($id) { $record = $this->model->findOrFail($id); if ($record->locked_by > 0) return true; return false; }
php
public function isLocked($id) { $record = $this->model->findOrFail($id); if ($record->locked_by > 0) return true; return false; }
[ "public", "function", "isLocked", "(", "$", "id", ")", "{", "$", "record", "=", "$", "this", "->", "model", "->", "findOrFail", "(", "$", "id", ")", ";", "if", "(", "$", "record", "->", "locked_by", ">", "0", ")", "return", "true", ";", "return", ...
Is the record locked? "Locked" is defined as the 'locked_by' field being populated; that is,> 0 @param int $id @return bool
[ "Is", "the", "record", "locked?", "Locked", "is", "defined", "as", "the", "locked_by", "field", "being", "populated", ";", "that", "is", ">", "0" ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/LockedFields.php#L83-L90
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/LockedFields.php
LockedFields.populateLockFields
public function populateLockFields($id) { // $this->getSave($data); --> creates new record ;-( // $this->getUpdate($data); --> integrity constraint violation: 1451 Cannot delete or // update a parent row: a foreign key constraint fails ;-( // use the m...
php
public function populateLockFields($id) { // $this->getSave($data); --> creates new record ;-( // $this->getUpdate($data); --> integrity constraint violation: 1451 Cannot delete or // update a parent row: a foreign key constraint fails ;-( // use the m...
[ "public", "function", "populateLockFields", "(", "$", "id", ")", "{", "// $this->getSave($data); --> creates new record ;-(", "// $this->getUpdate($data); --> integrity constraint violation: 1451 Cannot delete or", "// update a parent row: a foreign key constraint ...
Populate the locked_at and locked_by fields. By definition, this must be an UPDATE All that is needed is the ID @param int $id @return bool
[ "Populate", "the", "locked_at", "and", "locked_by", "fields", ".", "By", "definition", "this", "must", "be", "an", "UPDATE" ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/LockedFields.php#L102-L114
train
lasallecms/lasallecms-l5-lasallecmsapi-pkg
src/Repositories/Traits/LockedFields.php
LockedFields.unpopulateLockFields
public function unpopulateLockFields($id) { // $this->getSave($data); --> creates new record ;-( // $this->getUpdate($data); --> integrity constraint violation: 1451 Cannot delete or // update a parent row: a foreign key constraint fails ;-( // use the...
php
public function unpopulateLockFields($id) { // $this->getSave($data); --> creates new record ;-( // $this->getUpdate($data); --> integrity constraint violation: 1451 Cannot delete or // update a parent row: a foreign key constraint fails ;-( // use the...
[ "public", "function", "unpopulateLockFields", "(", "$", "id", ")", "{", "// $this->getSave($data); --> creates new record ;-(", "// $this->getUpdate($data); --> integrity constraint violation: 1451 Cannot delete or", "// update a parent row: a foreign key constrain...
Un-populate the locked_at and locked_by fields. By definition, this must be an UPDATE All that is needed is the ID @param int $id @return mixed(?)
[ "Un", "-", "populate", "the", "locked_at", "and", "locked_by", "fields", ".", "By", "definition", "this", "must", "be", "an", "UPDATE" ]
05083be19645d52be86d8ba4f322773db348a11d
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/Traits/LockedFields.php#L126-L139
train
PenoaksDev/Milky-Framework
src/Milky/Database/Eloquent/Nested/Move.php
Move.to
public static function to( $model, $target, $position ) { $instance = new static( $model, $target, $position ); return $instance->perform(); }
php
public static function to( $model, $target, $position ) { $instance = new static( $model, $target, $position ); return $instance->perform(); }
[ "public", "static", "function", "to", "(", "$", "model", ",", "$", "target", ",", "$", "position", ")", "{", "$", "instance", "=", "new", "static", "(", "$", "model", ",", "$", "target", ",", "$", "position", ")", ";", "return", "$", "instance", "-...
Easy static accessor for performing a move operation. @param NestedModel $model @param NestedModel|int $target @param string $position @return NestedModel
[ "Easy", "static", "accessor", "for", "performing", "a", "move", "operation", "." ]
8afd7156610a70371aa5b1df50b8a212bf7b142c
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/Move.php#L73-L78
train
PenoaksDev/Milky-Framework
src/Milky/Database/Eloquent/Nested/Move.php
Move.perform
public function perform() { $this->guardAgainstImpossibleMove(); if ( $this->fireMoveEvent( 'moving' ) === false ) return $this->model; if ( $this->hasChange() ) { $self = $this; $this->model->getConnection()->transaction( function () use ( $self ) { $self->updateStructure(); } ); $th...
php
public function perform() { $this->guardAgainstImpossibleMove(); if ( $this->fireMoveEvent( 'moving' ) === false ) return $this->model; if ( $this->hasChange() ) { $self = $this; $this->model->getConnection()->transaction( function () use ( $self ) { $self->updateStructure(); } ); $th...
[ "public", "function", "perform", "(", ")", "{", "$", "this", "->", "guardAgainstImpossibleMove", "(", ")", ";", "if", "(", "$", "this", "->", "fireMoveEvent", "(", "'moving'", ")", "===", "false", ")", "return", "$", "this", "->", "model", ";", "if", "...
Perform the move operation. @return NestedModel
[ "Perform", "the", "move", "operation", "." ]
8afd7156610a70371aa5b1df50b8a212bf7b142c
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/Move.php#L85-L111
train
PenoaksDev/Milky-Framework
src/Milky/Database/Eloquent/Nested/Move.php
Move.resolveNode
protected function resolveNode( $model ) { if ( $model instanceof NestedModel ) return $model->reload(); return $this->model->newNestedSetQuery()->find( $model ); }
php
protected function resolveNode( $model ) { if ( $model instanceof NestedModel ) return $model->reload(); return $this->model->newNestedSetQuery()->find( $model ); }
[ "protected", "function", "resolveNode", "(", "$", "model", ")", "{", "if", "(", "$", "model", "instanceof", "NestedModel", ")", "return", "$", "model", "->", "reload", "(", ")", ";", "return", "$", "this", "->", "model", "->", "newNestedSetQuery", "(", "...
Resolves suplied node. Basically returns the node unchanged if supplied parameter is an instance of NestedModel. Otherwise it will try to find the node in the database. @param NestedModel|int @return NestedModel
[ "Resolves", "suplied", "node", ".", "Basically", "returns", "the", "node", "unchanged", "if", "supplied", "parameter", "is", "an", "instance", "of", "NestedModel", ".", "Otherwise", "it", "will", "try", "to", "find", "the", "node", "in", "the", "database", "...
8afd7156610a70371aa5b1df50b8a212bf7b142c
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/Move.php#L176-L182
train
PenoaksDev/Milky-Framework
src/Milky/Database/Eloquent/Nested/Move.php
Move.guardAgainstImpossibleMove
protected function guardAgainstImpossibleMove() { if ( !$this->model->exists ) throw new MoveNotPossibleException( 'A new node cannot be moved.' ); if ( array_search( $this->position, ['child', 'left', 'right', 'root'] ) === false ) throw new MoveNotPossibleException( "Position should be one of ['child', 'l...
php
protected function guardAgainstImpossibleMove() { if ( !$this->model->exists ) throw new MoveNotPossibleException( 'A new node cannot be moved.' ); if ( array_search( $this->position, ['child', 'left', 'right', 'root'] ) === false ) throw new MoveNotPossibleException( "Position should be one of ['child', 'l...
[ "protected", "function", "guardAgainstImpossibleMove", "(", ")", "{", "if", "(", "!", "$", "this", "->", "model", "->", "exists", ")", "throw", "new", "MoveNotPossibleException", "(", "'A new node cannot be moved.'", ")", ";", "if", "(", "array_search", "(", "$"...
Check wether the current move is possible and if not, rais an exception. @return void
[ "Check", "wether", "the", "current", "move", "is", "possible", "and", "if", "not", "rais", "an", "exception", "." ]
8afd7156610a70371aa5b1df50b8a212bf7b142c
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/Move.php#L189-L216
train
PenoaksDev/Milky-Framework
src/Milky/Database/Eloquent/Nested/Move.php
Move.bound1
protected function bound1() { if ( !is_null( $this->_bound1 ) ) return $this->_bound1; switch ( $this->position ) { case 'child': $this->_bound1 = $this->target->getRight(); break; case 'left': $this->_bound1 = $this->target->getLeft(); break; case 'right': $this->_bound1 = $th...
php
protected function bound1() { if ( !is_null( $this->_bound1 ) ) return $this->_bound1; switch ( $this->position ) { case 'child': $this->_bound1 = $this->target->getRight(); break; case 'left': $this->_bound1 = $this->target->getLeft(); break; case 'right': $this->_bound1 = $th...
[ "protected", "function", "bound1", "(", ")", "{", "if", "(", "!", "is_null", "(", "$", "this", "->", "_bound1", ")", ")", "return", "$", "this", "->", "_bound1", ";", "switch", "(", "$", "this", "->", "position", ")", "{", "case", "'child'", ":", "...
Computes the boundary. @return int
[ "Computes", "the", "boundary", "." ]
8afd7156610a70371aa5b1df50b8a212bf7b142c
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/Move.php#L223-L250
train
PenoaksDev/Milky-Framework
src/Milky/Database/Eloquent/Nested/Move.php
Move.boundaries
protected function boundaries() { if ( !is_null( $this->_boundaries ) ) return $this->_boundaries; // we have defined the boundaries of two non-overlapping intervals, // so sorting puts both the intervals and their boundaries in order $this->_boundaries = [ $this->model->getLeft(), $this->model->getR...
php
protected function boundaries() { if ( !is_null( $this->_boundaries ) ) return $this->_boundaries; // we have defined the boundaries of two non-overlapping intervals, // so sorting puts both the intervals and their boundaries in order $this->_boundaries = [ $this->model->getLeft(), $this->model->getR...
[ "protected", "function", "boundaries", "(", ")", "{", "if", "(", "!", "is_null", "(", "$", "this", "->", "_boundaries", ")", ")", "return", "$", "this", "->", "_boundaries", ";", "// we have defined the boundaries of two non-overlapping intervals,", "// so sorting put...
Computes the boundaries array. @return array
[ "Computes", "the", "boundaries", "array", "." ]
8afd7156610a70371aa5b1df50b8a212bf7b142c
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/Move.php#L273-L289
train
PenoaksDev/Milky-Framework
src/Milky/Database/Eloquent/Nested/Move.php
Move.parentId
protected function parentId() { switch ( $this->position ) { case 'root': return null; case 'child': return $this->target->getKey(); default: return $this->target->getParentId(); } }
php
protected function parentId() { switch ( $this->position ) { case 'root': return null; case 'child': return $this->target->getKey(); default: return $this->target->getParentId(); } }
[ "protected", "function", "parentId", "(", ")", "{", "switch", "(", "$", "this", "->", "position", ")", "{", "case", "'root'", ":", "return", "null", ";", "case", "'child'", ":", "return", "$", "this", "->", "target", "->", "getKey", "(", ")", ";", "d...
Computes the new parent id for the node being moved. @return int
[ "Computes", "the", "new", "parent", "id", "for", "the", "node", "being", "moved", "." ]
8afd7156610a70371aa5b1df50b8a212bf7b142c
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/Move.php#L296-L309
train
PenoaksDev/Milky-Framework
src/Milky/Database/Eloquent/Nested/Move.php
Move.hasChange
protected function hasChange() { return !( $this->bound1() == $this->model->getRight() || $this->bound1() == $this->model->getLeft() ); }
php
protected function hasChange() { return !( $this->bound1() == $this->model->getRight() || $this->bound1() == $this->model->getLeft() ); }
[ "protected", "function", "hasChange", "(", ")", "{", "return", "!", "(", "$", "this", "->", "bound1", "(", ")", "==", "$", "this", "->", "model", "->", "getRight", "(", ")", "||", "$", "this", "->", "bound1", "(", ")", "==", "$", "this", "->", "m...
Check wether there should be changes in the downward tree structure. @return boolean
[ "Check", "wether", "there", "should", "be", "changes", "in", "the", "downward", "tree", "structure", "." ]
8afd7156610a70371aa5b1df50b8a212bf7b142c
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/Move.php#L316-L319
train
PenoaksDev/Milky-Framework
src/Milky/Database/Eloquent/Nested/Move.php
Move.fireMoveEvent
protected function fireMoveEvent( $event, $halt = true ) { // Basically the same as \Illuminate\Database\Eloquent\Model->fireModelEvent // but we relay the event into the node instance. $event = "eloquent.{$event}: " . get_class( $this->model ); $method = $halt ? 'until' : 'fire'; Hooks::trigger( $event, [...
php
protected function fireMoveEvent( $event, $halt = true ) { // Basically the same as \Illuminate\Database\Eloquent\Model->fireModelEvent // but we relay the event into the node instance. $event = "eloquent.{$event}: " . get_class( $this->model ); $method = $halt ? 'until' : 'fire'; Hooks::trigger( $event, [...
[ "protected", "function", "fireMoveEvent", "(", "$", "event", ",", "$", "halt", "=", "true", ")", "{", "// Basically the same as \\Illuminate\\Database\\Eloquent\\Model->fireModelEvent", "// but we relay the event into the node instance.", "$", "event", "=", "\"eloquent.{$event}: ...
Fire the given move event for the model. @param string $event @param bool $halt @return mixed
[ "Fire", "the", "given", "move", "event", "for", "the", "model", "." ]
8afd7156610a70371aa5b1df50b8a212bf7b142c
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/Move.php#L338-L347
train
PenoaksDev/Milky-Framework
src/Milky/Database/Eloquent/Nested/Move.php
Move.applyLockBetween
protected function applyLockBetween( $lft, $rgt ) { $this->model->newQuery()->where( $this->model->getLeftColumnName(), '>=', $lft )->where( $this->model->getRightColumnName(), '<=', $rgt )->select( $this->model->getKeyName() )->lockForUpdate()->get(); }
php
protected function applyLockBetween( $lft, $rgt ) { $this->model->newQuery()->where( $this->model->getLeftColumnName(), '>=', $lft )->where( $this->model->getRightColumnName(), '<=', $rgt )->select( $this->model->getKeyName() )->lockForUpdate()->get(); }
[ "protected", "function", "applyLockBetween", "(", "$", "lft", ",", "$", "rgt", ")", "{", "$", "this", "->", "model", "->", "newQuery", "(", ")", "->", "where", "(", "$", "this", "->", "model", "->", "getLeftColumnName", "(", ")", ",", "'>='", ",", "$...
Applies a lock to the rows between the supplied index boundaries. @param int $lft @param int $rgt @return void
[ "Applies", "a", "lock", "to", "the", "rows", "between", "the", "supplied", "index", "boundaries", "." ]
8afd7156610a70371aa5b1df50b8a212bf7b142c
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/Move.php#L374-L377
train
CampaignChain/security-authentication-client-oauth
EntityService/TokenService.php
TokenService.cleanUpUnassignedTokens
public function cleanUpUnassignedTokens(array $tokens) { $this->em->clear(); foreach ($tokens as $token) { $token = $this->em->merge($token); $this->em->remove($token); } $this->em->flush(); }
php
public function cleanUpUnassignedTokens(array $tokens) { $this->em->clear(); foreach ($tokens as $token) { $token = $this->em->merge($token); $this->em->remove($token); } $this->em->flush(); }
[ "public", "function", "cleanUpUnassignedTokens", "(", "array", "$", "tokens", ")", "{", "$", "this", "->", "em", "->", "clear", "(", ")", ";", "foreach", "(", "$", "tokens", "as", "$", "token", ")", "{", "$", "token", "=", "$", "this", "->", "em", ...
Removes the not assigned tokens. @param Token[] $tokens
[ "Removes", "the", "not", "assigned", "tokens", "." ]
06800ccd0ee6b5ca9f53b85146228467ff6a7529
https://github.com/CampaignChain/security-authentication-client-oauth/blob/06800ccd0ee6b5ca9f53b85146228467ff6a7529/EntityService/TokenService.php#L199-L208
train
danielgp/common-lib
source/DomBasicComponentsByDanielGP.php
DomBasicComponentsByDanielGP.setCleanUrl
protected function setCleanUrl($urlString) { $arrayToReplace = [ '&#038;' => '&amp;', '&' => '&amp;', '&amp;amp;' => '&amp;', ' ' => '%20', ]; $kys = array_keys($arrayToReplace); $vls = array_val...
php
protected function setCleanUrl($urlString) { $arrayToReplace = [ '&#038;' => '&amp;', '&' => '&amp;', '&amp;amp;' => '&amp;', ' ' => '%20', ]; $kys = array_keys($arrayToReplace); $vls = array_val...
[ "protected", "function", "setCleanUrl", "(", "$", "urlString", ")", "{", "$", "arrayToReplace", "=", "[", "'&#038;'", "=>", "'&amp;'", ",", "'&'", "=>", "'&amp;'", ",", "'&amp;amp;'", "=>", "'&amp;'", ",", "' '", "=>", "'%20'", ",", "]", ";", "$", "kys",...
Cleans a string for certain internal rules @param string $urlString @return string
[ "Cleans", "a", "string", "for", "certain", "internal", "rules" ]
627b99b4408414c7cd21a6c8016f6468dc9216b2
https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/DomBasicComponentsByDanielGP.php#L85-L96
train
danielgp/common-lib
source/DomBasicComponentsByDanielGP.php
DomBasicComponentsByDanielGP.setFeedbackModern
protected function setFeedbackModern($sType, $sTitle, $sMsg, $skipBr = false) { if ($sTitle == 'light') { return $sMsg; } $legend = $this->setStringIntoTag($sTitle, 'legend', ['style' => $this->setFeedbackStyle($sType)]); return implode('', [ ($skipBr ? '' : '...
php
protected function setFeedbackModern($sType, $sTitle, $sMsg, $skipBr = false) { if ($sTitle == 'light') { return $sMsg; } $legend = $this->setStringIntoTag($sTitle, 'legend', ['style' => $this->setFeedbackStyle($sType)]); return implode('', [ ($skipBr ? '' : '...
[ "protected", "function", "setFeedbackModern", "(", "$", "sType", ",", "$", "sTitle", ",", "$", "sMsg", ",", "$", "skipBr", "=", "false", ")", "{", "if", "(", "$", "sTitle", "==", "'light'", ")", "{", "return", "$", "sMsg", ";", "}", "$", "legend", ...
Builds a structured modern message @param string $sType @param string $sTitle @param string $sMsg @param boolean $skipBr
[ "Builds", "a", "structured", "modern", "message" ]
627b99b4408414c7cd21a6c8016f6468dc9216b2
https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/DomBasicComponentsByDanielGP.php#L123-L133
train
danielgp/common-lib
source/DomBasicComponentsByDanielGP.php
DomBasicComponentsByDanielGP.setHeaderNoCache
protected function setHeaderNoCache($contentType = 'application/json') { header("Content-Type: " . $contentType . "; charset=utf-8"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: po...
php
protected function setHeaderNoCache($contentType = 'application/json') { header("Content-Type: " . $contentType . "; charset=utf-8"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: po...
[ "protected", "function", "setHeaderNoCache", "(", "$", "contentType", "=", "'application/json'", ")", "{", "header", "(", "\"Content-Type: \"", ".", "$", "contentType", ".", "\"; charset=utf-8\"", ")", ";", "header", "(", "\"Last-Modified: \"", ".", "gmdate", "(", ...
Sets the no-cache header
[ "Sets", "the", "no", "-", "cache", "header" ]
627b99b4408414c7cd21a6c8016f6468dc9216b2
https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/DomBasicComponentsByDanielGP.php#L206-L213
train
danielgp/common-lib
source/DomBasicComponentsByDanielGP.php
DomBasicComponentsByDanielGP.setStringIntoShortTag
protected function setStringIntoShortTag($sTag, $features = null) { return '<' . $sTag . $this->buildAttributesForTag($features) . (isset($features['dont_close']) ? '' : '/') . '>'; }
php
protected function setStringIntoShortTag($sTag, $features = null) { return '<' . $sTag . $this->buildAttributesForTag($features) . (isset($features['dont_close']) ? '' : '/') . '>'; }
[ "protected", "function", "setStringIntoShortTag", "(", "$", "sTag", ",", "$", "features", "=", "null", ")", "{", "return", "'<'", ".", "$", "sTag", ".", "$", "this", "->", "buildAttributesForTag", "(", "$", "features", ")", ".", "(", "isset", "(", "$", ...
Puts a given string into a specific short tag @param string $sTag @param array $features @return string
[ "Puts", "a", "given", "string", "into", "a", "specific", "short", "tag" ]
627b99b4408414c7cd21a6c8016f6468dc9216b2
https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/DomBasicComponentsByDanielGP.php#L222-L226
train
danielgp/common-lib
source/DomBasicComponentsByDanielGP.php
DomBasicComponentsByDanielGP.setStringIntoTag
protected function setStringIntoTag($sString, $sTag, $features = null) { return '<' . $sTag . $this->buildAttributesForTag($features) . '>' . $sString . '</' . $sTag . '>'; }
php
protected function setStringIntoTag($sString, $sTag, $features = null) { return '<' . $sTag . $this->buildAttributesForTag($features) . '>' . $sString . '</' . $sTag . '>'; }
[ "protected", "function", "setStringIntoTag", "(", "$", "sString", ",", "$", "sTag", ",", "$", "features", "=", "null", ")", "{", "return", "'<'", ".", "$", "sTag", ".", "$", "this", "->", "buildAttributesForTag", "(", "$", "features", ")", ".", "'>'", ...
Puts a given string into a specific tag @param string $sString @param string $sTag @param array $features @return string
[ "Puts", "a", "given", "string", "into", "a", "specific", "tag" ]
627b99b4408414c7cd21a6c8016f6468dc9216b2
https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/DomBasicComponentsByDanielGP.php#L236-L239
train
SugiPHP/Filter
Filter.php
Filter.int
public function int($value, $min = false, $max = false, $default = false) { $options = array("options" => array()); if (isset($default)) { $options["options"]["default"] = $default; } if (is_numeric($min)) { $options["options"]["min_range"] = $min; } if (is_numeric($max)) { $options["options"]["ma...
php
public function int($value, $min = false, $max = false, $default = false) { $options = array("options" => array()); if (isset($default)) { $options["options"]["default"] = $default; } if (is_numeric($min)) { $options["options"]["min_range"] = $min; } if (is_numeric($max)) { $options["options"]["ma...
[ "public", "function", "int", "(", "$", "value", ",", "$", "min", "=", "false", ",", "$", "max", "=", "false", ",", "$", "default", "=", "false", ")", "{", "$", "options", "=", "array", "(", "\"options\"", "=>", "array", "(", ")", ")", ";", "if", ...
Validates integer value. @param mixed $value Integer or string @param integer $min @param integer $max @param mixed $default What to be returned if the filter fails @return mixed
[ "Validates", "integer", "value", "." ]
1fc455efc5e3405c4186c2c997aee81eeb1eb59c
https://github.com/SugiPHP/Filter/blob/1fc455efc5e3405c4186c2c997aee81eeb1eb59c/Filter.php#L35-L55
train
SugiPHP/Filter
Filter.php
Filter.str
public function str($value, $minLength = 0, $maxLength = false, $default = false) { $value = trim($value); if ((!empty($minLength) && (mb_strlen($value, $this->encoding) < $minLength)) || (!empty($maxLength) && (mb_strlen($value, $this->encoding) > $maxLength)) ) { return $default; } return (string) $...
php
public function str($value, $minLength = 0, $maxLength = false, $default = false) { $value = trim($value); if ((!empty($minLength) && (mb_strlen($value, $this->encoding) < $minLength)) || (!empty($maxLength) && (mb_strlen($value, $this->encoding) > $maxLength)) ) { return $default; } return (string) $...
[ "public", "function", "str", "(", "$", "value", ",", "$", "minLength", "=", "0", ",", "$", "maxLength", "=", "false", ",", "$", "default", "=", "false", ")", "{", "$", "value", "=", "trim", "(", "$", "value", ")", ";", "if", "(", "(", "!", "emp...
Validates string value. @param string $value @param integer $minLength @param mixed $maxLength @param mixed $default @return mixed
[ "Validates", "string", "value", "." ]
1fc455efc5e3405c4186c2c997aee81eeb1eb59c
https://github.com/SugiPHP/Filter/blob/1fc455efc5e3405c4186c2c997aee81eeb1eb59c/Filter.php#L67-L77
train
SugiPHP/Filter
Filter.php
Filter.plain
public function plain($value, $minLength = 0, $maxLength = false, $default = false) { $value = strip_tags($value); return $this->str($value, $minLength, $maxLength, $default); }
php
public function plain($value, $minLength = 0, $maxLength = false, $default = false) { $value = strip_tags($value); return $this->str($value, $minLength, $maxLength, $default); }
[ "public", "function", "plain", "(", "$", "value", ",", "$", "minLength", "=", "0", ",", "$", "maxLength", "=", "false", ",", "$", "default", "=", "false", ")", "{", "$", "value", "=", "strip_tags", "(", "$", "value", ")", ";", "return", "$", "this"...
Validates string and is removing tags from it. @param string $value @param integer $minLength @param mixed $maxLength @param mixed $default @return mixed
[ "Validates", "string", "and", "is", "removing", "tags", "from", "it", "." ]
1fc455efc5e3405c4186c2c997aee81eeb1eb59c
https://github.com/SugiPHP/Filter/blob/1fc455efc5e3405c4186c2c997aee81eeb1eb59c/Filter.php#L89-L94
train
SugiPHP/Filter
Filter.php
Filter.email
public function email($value, $default = false, $checkMxRecord = false) { if (!$value = filter_var($value, FILTER_VALIDATE_EMAIL)) { return $default; } $dom = explode("@", $value); $dom = array_pop($dom); if (!$this->url("http://$dom")) { return $default; } return (!$checkMxRecord || checkdnsrr($d...
php
public function email($value, $default = false, $checkMxRecord = false) { if (!$value = filter_var($value, FILTER_VALIDATE_EMAIL)) { return $default; } $dom = explode("@", $value); $dom = array_pop($dom); if (!$this->url("http://$dom")) { return $default; } return (!$checkMxRecord || checkdnsrr($d...
[ "public", "function", "email", "(", "$", "value", ",", "$", "default", "=", "false", ",", "$", "checkMxRecord", "=", "false", ")", "{", "if", "(", "!", "$", "value", "=", "filter_var", "(", "$", "value", ",", "FILTER_VALIDATE_EMAIL", ")", ")", "{", "...
Validates email. @param string $value @param mixed $default - default value to return on validation failure @param boolean $checkMxRecord - check existence of MX record. If check fails default value will be returned. @return mixed
[ "Validates", "email", "." ]
1fc455efc5e3405c4186c2c997aee81eeb1eb59c
https://github.com/SugiPHP/Filter/blob/1fc455efc5e3405c4186c2c997aee81eeb1eb59c/Filter.php#L132-L144
train
railken/lem
src/Attributes/TextAttribute.php
TextAttribute.setRequired
public function setRequired(bool $required): BaseAttribute { parent::setRequired($required); if ($this->getMinLength() === 0) { $this->setMinLength(1); } return $this; }
php
public function setRequired(bool $required): BaseAttribute { parent::setRequired($required); if ($this->getMinLength() === 0) { $this->setMinLength(1); } return $this; }
[ "public", "function", "setRequired", "(", "bool", "$", "required", ")", ":", "BaseAttribute", "{", "parent", "::", "setRequired", "(", "$", "required", ")", ";", "if", "(", "$", "this", "->", "getMinLength", "(", ")", "===", "0", ")", "{", "$", "this",...
Set Required. @param bool $required @return $this
[ "Set", "Required", "." ]
cff1efcd090a9504b2faf5594121885786dea67a
https://github.com/railken/lem/blob/cff1efcd090a9504b2faf5594121885786dea67a/src/Attributes/TextAttribute.php#L99-L108
train
fridge-project/dbal
src/Fridge/DBAL/Schema/ForeignKey.php
ForeignKey.setLocalColumnNames
public function setLocalColumnNames(array $localColumnNames) { $this->localColumnNames = array(); foreach ($localColumnNames as $localColumnName) { $this->addLocalColumnName($localColumnName); } }
php
public function setLocalColumnNames(array $localColumnNames) { $this->localColumnNames = array(); foreach ($localColumnNames as $localColumnName) { $this->addLocalColumnName($localColumnName); } }
[ "public", "function", "setLocalColumnNames", "(", "array", "$", "localColumnNames", ")", "{", "$", "this", "->", "localColumnNames", "=", "array", "(", ")", ";", "foreach", "(", "$", "localColumnNames", "as", "$", "localColumnName", ")", "{", "$", "this", "-...
Sets the local column names. @param array $localColumnNames The local column names.
[ "Sets", "the", "local", "column", "names", "." ]
d0b8c3551922d696836487aa0eb1bd74014edcd4
https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/ForeignKey.php#L96-L103
train
fridge-project/dbal
src/Fridge/DBAL/Schema/ForeignKey.php
ForeignKey.addLocalColumnName
public function addLocalColumnName($localColumnName) { if (!is_string($localColumnName) || (strlen($localColumnName) <= 0)) { throw SchemaException::invalidForeignKeyLocalColumnName($this->getName()); } $this->localColumnNames[] = $localColumnName; }
php
public function addLocalColumnName($localColumnName) { if (!is_string($localColumnName) || (strlen($localColumnName) <= 0)) { throw SchemaException::invalidForeignKeyLocalColumnName($this->getName()); } $this->localColumnNames[] = $localColumnName; }
[ "public", "function", "addLocalColumnName", "(", "$", "localColumnName", ")", "{", "if", "(", "!", "is_string", "(", "$", "localColumnName", ")", "||", "(", "strlen", "(", "$", "localColumnName", ")", "<=", "0", ")", ")", "{", "throw", "SchemaException", "...
Adds a local column name to the foreign key. @param string $localColumnName The local column name to add. @throws \Fridge\DBAL\Exception\SchemaException If the local column name is not a valid string.
[ "Adds", "a", "local", "column", "name", "to", "the", "foreign", "key", "." ]
d0b8c3551922d696836487aa0eb1bd74014edcd4
https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/ForeignKey.php#L112-L119
train
fridge-project/dbal
src/Fridge/DBAL/Schema/ForeignKey.php
ForeignKey.setForeignTableName
public function setForeignTableName($foreignTableName) { if (!is_string($foreignTableName) || (strlen($foreignTableName) <= 0)) { throw SchemaException::invalidForeignKeyForeignTableName($this->getName()); } $this->foreignTableName = $foreignTableName; }
php
public function setForeignTableName($foreignTableName) { if (!is_string($foreignTableName) || (strlen($foreignTableName) <= 0)) { throw SchemaException::invalidForeignKeyForeignTableName($this->getName()); } $this->foreignTableName = $foreignTableName; }
[ "public", "function", "setForeignTableName", "(", "$", "foreignTableName", ")", "{", "if", "(", "!", "is_string", "(", "$", "foreignTableName", ")", "||", "(", "strlen", "(", "$", "foreignTableName", ")", "<=", "0", ")", ")", "{", "throw", "SchemaException",...
Sets the foreign table name. @param string $foreignTableName The foreign table name. @throws \Fridge\DBAL\Exception\SchemaException If the foreign table name is not a valid string.
[ "Sets", "the", "foreign", "table", "name", "." ]
d0b8c3551922d696836487aa0eb1bd74014edcd4
https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/ForeignKey.php#L138-L145
train
fridge-project/dbal
src/Fridge/DBAL/Schema/ForeignKey.php
ForeignKey.addForeignColumnName
public function addForeignColumnName($foreignColumnName) { if (!is_string($foreignColumnName) || (strlen($foreignColumnName) <= 0)) { throw SchemaException::invalidForeignKeyForeignColumnName($this->getName()); } $this->foreignColumnNames[] = $foreignColumnName; }
php
public function addForeignColumnName($foreignColumnName) { if (!is_string($foreignColumnName) || (strlen($foreignColumnName) <= 0)) { throw SchemaException::invalidForeignKeyForeignColumnName($this->getName()); } $this->foreignColumnNames[] = $foreignColumnName; }
[ "public", "function", "addForeignColumnName", "(", "$", "foreignColumnName", ")", "{", "if", "(", "!", "is_string", "(", "$", "foreignColumnName", ")", "||", "(", "strlen", "(", "$", "foreignColumnName", ")", "<=", "0", ")", ")", "{", "throw", "SchemaExcepti...
Adds a foreign column name to the foreign key. @param string $foreignColumnName The foreign column name to add. @throws \Fridge\DBAL\Exception\SchemaException If the foreign column name is not a valid string.
[ "Adds", "a", "foreign", "column", "name", "to", "the", "foreign", "key", "." ]
d0b8c3551922d696836487aa0eb1bd74014edcd4
https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/ForeignKey.php#L176-L183
train
JoeBengalen/Config
src/AbstractConfig.php
AbstractConfig.setDotNotationKey
protected function setDotNotationKey($key, $value) { $splitKey = explode('.', $key); $root = &$this->data; // Look for the key, creating nested keys if needed while ($part = array_shift($splitKey)) { if (!isset($root[$part]) && count($splitKey)) { $roo...
php
protected function setDotNotationKey($key, $value) { $splitKey = explode('.', $key); $root = &$this->data; // Look for the key, creating nested keys if needed while ($part = array_shift($splitKey)) { if (!isset($root[$part]) && count($splitKey)) { $roo...
[ "protected", "function", "setDotNotationKey", "(", "$", "key", ",", "$", "value", ")", "{", "$", "splitKey", "=", "explode", "(", "'.'", ",", "$", "key", ")", ";", "$", "root", "=", "&", "$", "this", "->", "data", ";", "// Look for the key, creating nest...
Handle setting a configuration value with a dot notation key. @param string $key Dot notation key. @param mixed $value Configuration value.
[ "Handle", "setting", "a", "configuration", "value", "with", "a", "dot", "notation", "key", "." ]
1a13f3153374224aad52da4669bd69655f037546
https://github.com/JoeBengalen/Config/blob/1a13f3153374224aad52da4669bd69655f037546/src/AbstractConfig.php#L141-L154
train
Hnto/nuki
src/Drivers/PDO.php
PDO.compileAndSetName
private function compileAndSetName() { $name = \Nuki\Handlers\Core\Assist::classNameShort($this); $this->name = strtolower($name); }
php
private function compileAndSetName() { $name = \Nuki\Handlers\Core\Assist::classNameShort($this); $this->name = strtolower($name); }
[ "private", "function", "compileAndSetName", "(", ")", "{", "$", "name", "=", "\\", "Nuki", "\\", "Handlers", "\\", "Core", "\\", "Assist", "::", "classNameShort", "(", "$", "this", ")", ";", "$", "this", "->", "name", "=", "strtolower", "(", "$", "name...
Private function to compile and set the driver name
[ "Private", "function", "to", "compile", "and", "set", "the", "driver", "name" ]
c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c
https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Drivers/PDO.php#L70-L74
train
theopera/framework
src/App/Command/InstallCommand.php
InstallCommand.isAlreadyInstalled
private function isAlreadyInstalled() : bool { $public = new SplFileInfo(self::PROJECT_ROOT . '/public'); $src = new SplFileInfo(self::PROJECT_ROOT . '/src'); return $public->isDir() && $src->isDir(); }
php
private function isAlreadyInstalled() : bool { $public = new SplFileInfo(self::PROJECT_ROOT . '/public'); $src = new SplFileInfo(self::PROJECT_ROOT . '/src'); return $public->isDir() && $src->isDir(); }
[ "private", "function", "isAlreadyInstalled", "(", ")", ":", "bool", "{", "$", "public", "=", "new", "SplFileInfo", "(", "self", "::", "PROJECT_ROOT", ".", "'/public'", ")", ";", "$", "src", "=", "new", "SplFileInfo", "(", "self", "::", "PROJECT_ROOT", ".",...
Finds out if the framework has already been installed @return bool
[ "Finds", "out", "if", "the", "framework", "has", "already", "been", "installed" ]
fa6165d3891a310faa580c81dee49a63c150c711
https://github.com/theopera/framework/blob/fa6165d3891a310faa580c81dee49a63c150c711/src/App/Command/InstallCommand.php#L102-L108
train
theopera/framework
src/App/Command/InstallCommand.php
InstallCommand.modifyComposerFile
private function modifyComposerFile() { if (!is_writeable('composer.json')) { throw new Exception('Make sure a composer.json file exists and is writable'); } $json = file_get_contents('composer.json'); $composer = json_decode($json); if (!isset($composer->autolo...
php
private function modifyComposerFile() { if (!is_writeable('composer.json')) { throw new Exception('Make sure a composer.json file exists and is writable'); } $json = file_get_contents('composer.json'); $composer = json_decode($json); if (!isset($composer->autolo...
[ "private", "function", "modifyComposerFile", "(", ")", "{", "if", "(", "!", "is_writeable", "(", "'composer.json'", ")", ")", "{", "throw", "new", "Exception", "(", "'Make sure a composer.json file exists and is writable'", ")", ";", "}", "$", "json", "=", "file_g...
Modifies the composer file - Add the new project namespace to the autoload list
[ "Modifies", "the", "composer", "file", "-", "Add", "the", "new", "project", "namespace", "to", "the", "autoload", "list" ]
fa6165d3891a310faa580c81dee49a63c150c711
https://github.com/theopera/framework/blob/fa6165d3891a310faa580c81dee49a63c150c711/src/App/Command/InstallCommand.php#L183-L202
train
RocketPropelledTortoise/Core
src/Utilities/Format.php
Format.getReadableSize
public static function getReadableSize($bytes) { $unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; $exp = floor(log($bytes, 1024)) | 0; return round($bytes / (pow(1024, $exp)), 2) . " $unit[$exp]"; }
php
public static function getReadableSize($bytes) { $unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; $exp = floor(log($bytes, 1024)) | 0; return round($bytes / (pow(1024, $exp)), 2) . " $unit[$exp]"; }
[ "public", "static", "function", "getReadableSize", "(", "$", "bytes", ")", "{", "$", "unit", "=", "[", "'B'", ",", "'KB'", ",", "'MB'", ",", "'GB'", ",", "'TB'", ",", "'PB'", ",", "'EB'", ",", "'ZB'", ",", "'YB'", "]", ";", "$", "exp", "=", "floo...
Get file size with correct extension @param int $bytes @return string
[ "Get", "file", "size", "with", "correct", "extension" ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Utilities/Format.php#L19-L25
train
wb-crowdfusion/crowdfusion
system/core/classes/libraries/validation/AbstractValidator.php
AbstractValidator.validateFor
public function validateFor($context) { $this->errors = new Errors(); // create camelized method name $methodResolved = ActionUtils::parseMethod($context); // check method exists if(!method_exists($this, $methodResolved)) throw new Exception('Method ['.$methodR...
php
public function validateFor($context) { $this->errors = new Errors(); // create camelized method name $methodResolved = ActionUtils::parseMethod($context); // check method exists if(!method_exists($this, $methodResolved)) throw new Exception('Method ['.$methodR...
[ "public", "function", "validateFor", "(", "$", "context", ")", "{", "$", "this", "->", "errors", "=", "new", "Errors", "(", ")", ";", "// create camelized method name", "$", "methodResolved", "=", "ActionUtils", "::", "parseMethod", "(", "$", "context", ")", ...
This method is called to perform validation @param string $context A string representing the name of the context in which the validation occurs. For example: 'add', 'edit', 'delete', etc. @param mixed $arg, $arg, ... Using func_get_args() these arguments will be passed to the validator function invoked by this...
[ "This", "method", "is", "called", "to", "perform", "validation" ]
8cad7988f046a6fefbed07d026cb4ae6706c1217
https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/validation/AbstractValidator.php#L77-L101
train
nemundo/core
src/Type/Geo/GeoCoordinateAltitude.php
GeoCoordinateAltitude.fromGeoCoordinate
public function fromGeoCoordinate(GeoCoordinate $geoCoordinate = null) { if ($geoCoordinate !== null) { $this->latitude = $geoCoordinate->latitude; $this->longitude = $geoCoordinate->longitude; } return $this; }
php
public function fromGeoCoordinate(GeoCoordinate $geoCoordinate = null) { if ($geoCoordinate !== null) { $this->latitude = $geoCoordinate->latitude; $this->longitude = $geoCoordinate->longitude; } return $this; }
[ "public", "function", "fromGeoCoordinate", "(", "GeoCoordinate", "$", "geoCoordinate", "=", "null", ")", "{", "if", "(", "$", "geoCoordinate", "!==", "null", ")", "{", "$", "this", "->", "latitude", "=", "$", "geoCoordinate", "->", "latitude", ";", "$", "t...
= 0;
[ "=", "0", ";" ]
5ca14889fdfb9155b52fedb364b34502d14e21ed
https://github.com/nemundo/core/blob/5ca14889fdfb9155b52fedb364b34502d14e21ed/src/Type/Geo/GeoCoordinateAltitude.php#L15-L22
train
hiqdev/minii-helpers
src/BaseFileHelper.php
BaseFileHelper.getExtensionsByMimeType
public static function getExtensionsByMimeType($mimeType, $magicFile = null) { $mimeTypes = static::loadMimeTypes($magicFile); return array_keys($mimeTypes, mb_strtolower($mimeType, 'utf-8'), true); }
php
public static function getExtensionsByMimeType($mimeType, $magicFile = null) { $mimeTypes = static::loadMimeTypes($magicFile); return array_keys($mimeTypes, mb_strtolower($mimeType, 'utf-8'), true); }
[ "public", "static", "function", "getExtensionsByMimeType", "(", "$", "mimeType", ",", "$", "magicFile", "=", "null", ")", "{", "$", "mimeTypes", "=", "static", "::", "loadMimeTypes", "(", "$", "magicFile", ")", ";", "return", "array_keys", "(", "$", "mimeTyp...
Determines the extensions by given MIME type. This method will use a local map between extension names and MIME types. @param string $mimeType file MIME type. @param string $magicFile the path (or alias) of the file that contains all available MIME type information. If this is not set, the file specified by [[mimeMagic...
[ "Determines", "the", "extensions", "by", "given", "MIME", "type", ".", "This", "method", "will", "use", "a", "local", "map", "between", "extension", "names", "and", "MIME", "types", "." ]
001b7a56a6ebdc432c4683fe47c00a913f8e57d7
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseFileHelper.php#L188-L192
train
hiqdev/minii-helpers
src/BaseFileHelper.php
BaseFileHelper.matchBasename
private static function matchBasename($baseName, $pattern, $firstWildcard, $flags) { if ($firstWildcard === false) { if ($pattern === $baseName) { return true; } } elseif ($flags & self::PATTERN_ENDSWITH) { /* "*literal" matching against "foolitera...
php
private static function matchBasename($baseName, $pattern, $firstWildcard, $flags) { if ($firstWildcard === false) { if ($pattern === $baseName) { return true; } } elseif ($flags & self::PATTERN_ENDSWITH) { /* "*literal" matching against "foolitera...
[ "private", "static", "function", "matchBasename", "(", "$", "baseName", ",", "$", "pattern", ",", "$", "firstWildcard", ",", "$", "flags", ")", "{", "if", "(", "$", "firstWildcard", "===", "false", ")", "{", "if", "(", "$", "pattern", "===", "$", "base...
Performs a simple comparison of file or directory names. Based on match_basename() from dir.c of git 1.8.5.3 sources. @param string $baseName file or directory name to compare with the pattern @param string $pattern the pattern that $baseName will be compared against @param integer|boolean $firstWildcard location of ...
[ "Performs", "a", "simple", "comparison", "of", "file", "or", "directory", "names", "." ]
001b7a56a6ebdc432c4683fe47c00a913f8e57d7
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseFileHelper.php#L482-L502
train
hiqdev/minii-helpers
src/BaseFileHelper.php
BaseFileHelper.matchPathname
private static function matchPathname($path, $basePath, $pattern, $firstWildcard, $flags) { // match with FNM_PATHNAME; the pattern has base implicitly in front of it. if (isset($pattern[0]) && $pattern[0] == '/') { $pattern = StringHelper::byteSubstr($pattern, 1, StringHelper::byteLengt...
php
private static function matchPathname($path, $basePath, $pattern, $firstWildcard, $flags) { // match with FNM_PATHNAME; the pattern has base implicitly in front of it. if (isset($pattern[0]) && $pattern[0] == '/') { $pattern = StringHelper::byteSubstr($pattern, 1, StringHelper::byteLengt...
[ "private", "static", "function", "matchPathname", "(", "$", "path", ",", "$", "basePath", ",", "$", "pattern", ",", "$", "firstWildcard", ",", "$", "flags", ")", "{", "// match with FNM_PATHNAME; the pattern has base implicitly in front of it.", "if", "(", "isset", ...
Compares a path part against a pattern with optional wildcards. Based on match_pathname() from dir.c of git 1.8.5.3 sources. @param string $path full path to compare @param string $basePath base of path that will not be compared @param string $pattern the pattern that path part will be compared against @param integer...
[ "Compares", "a", "path", "part", "against", "a", "pattern", "with", "optional", "wildcards", "." ]
001b7a56a6ebdc432c4683fe47c00a913f8e57d7
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseFileHelper.php#L516-L556
train
rollerworks/search-core
Value/ValuesGroup.php
ValuesGroup.countValues
public function countValues(): int { $count = 0; foreach ($this->fields as $field) { $count += $field->count(); } return $count; }
php
public function countValues(): int { $count = 0; foreach ($this->fields as $field) { $count += $field->count(); } return $count; }
[ "public", "function", "countValues", "(", ")", ":", "int", "{", "$", "count", "=", "0", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "field", ")", "{", "$", "count", "+=", "$", "field", "->", "count", "(", ")", ";", "}", "return",...
Gets the total number of values in the fields list structure.
[ "Gets", "the", "total", "number", "of", "values", "in", "the", "fields", "list", "structure", "." ]
6b5671b8c4d6298906ded768261b0a59845140fb
https://github.com/rollerworks/search-core/blob/6b5671b8c4d6298906ded768261b0a59845140fb/Value/ValuesGroup.php#L152-L161
train
DoSomething/mb-toolbox
src/MB_Slack.php
MB_Slack.lookupChannelKey
private function lookupChannelKey($channelName) { if ($channelName == '#niche_monitoring') { $channelKey = $this->slackConfig['webhookURL_niche_monitoring']; } elseif ($channelName == '#after-school-internal') { $channelKey = $this->slackConfig['webhookURL_after-school-internal']; } else { ...
php
private function lookupChannelKey($channelName) { if ($channelName == '#niche_monitoring') { $channelKey = $this->slackConfig['webhookURL_niche_monitoring']; } elseif ($channelName == '#after-school-internal') { $channelKey = $this->slackConfig['webhookURL_after-school-internal']; } else { ...
[ "private", "function", "lookupChannelKey", "(", "$", "channelName", ")", "{", "if", "(", "$", "channelName", "==", "'#niche_monitoring'", ")", "{", "$", "channelKey", "=", "$", "this", "->", "slackConfig", "[", "'webhookURL_niche_monitoring'", "]", ";", "}", "...
Lookup channel key value based on channel name. @param string $channelName The name of the channel. @return string $channelKey A key value based on the channel name.
[ "Lookup", "channel", "key", "value", "based", "on", "channel", "name", "." ]
ceec5fc594bae137d1ab1f447344800343b62ac6
https://github.com/DoSomething/mb-toolbox/blob/ceec5fc594bae137d1ab1f447344800343b62ac6/src/MB_Slack.php#L59-L71
train
DoSomething/mb-toolbox
src/MB_Slack.php
MB_Slack.alert
public function alert($channelNames, $message, $tos = ['@dee']) { $to = implode(',', $tos); foreach ($channelNames as $channelName) { $channelKey = $this->lookupChannelKey($channelName); $slack = new Client($channelKey); $slack->to($to)->attach($message)->send(); $this->statHat->ezCou...
php
public function alert($channelNames, $message, $tos = ['@dee']) { $to = implode(',', $tos); foreach ($channelNames as $channelName) { $channelKey = $this->lookupChannelKey($channelName); $slack = new Client($channelKey); $slack->to($to)->attach($message)->send(); $this->statHat->ezCou...
[ "public", "function", "alert", "(", "$", "channelNames", ",", "$", "message", ",", "$", "tos", "=", "[", "'@dee'", "]", ")", "{", "$", "to", "=", "implode", "(", "','", ",", "$", "tos", ")", ";", "foreach", "(", "$", "channelNames", "as", "$", "c...
Send report to Slack. $param array $to Comma separated list of Slack channels ("#") and/or users ("@") to send message to. @param string $message List of message attachment options. https://github.com/maknz/slack#send-an-attachment-with-fields @param array $channelNames The name of the channel to send the message to.
[ "Send", "report", "to", "Slack", "." ]
ceec5fc594bae137d1ab1f447344800343b62ac6
https://github.com/DoSomething/mb-toolbox/blob/ceec5fc594bae137d1ab1f447344800343b62ac6/src/MB_Slack.php#L83-L93
train
Linkvalue-Interne/MajoraFrameworkExtraBundle
src/Majora/Bundle/FrameworkExtraBundle/Controller/RestApiControllerTrait.php
RestApiControllerTrait.createJsonResponse
protected function createJsonResponse($data = null, $scope = null, $status = 200) { if ($data !== null) { $data = is_string($data) ? $data : $this->container->get('serializer')->serialize( $data, 'json', empty($scope) ? array() : array('scope' ...
php
protected function createJsonResponse($data = null, $scope = null, $status = 200) { if ($data !== null) { $data = is_string($data) ? $data : $this->container->get('serializer')->serialize( $data, 'json', empty($scope) ? array() : array('scope' ...
[ "protected", "function", "createJsonResponse", "(", "$", "data", "=", "null", ",", "$", "scope", "=", "null", ",", "$", "status", "=", "200", ")", "{", "if", "(", "$", "data", "!==", "null", ")", "{", "$", "data", "=", "is_string", "(", "$", "data"...
Create a JsonResponse with given data, if object given, it will be serialize with registered serializer. @param mixed $data @param string $scope @param int $status @return Response
[ "Create", "a", "JsonResponse", "with", "given", "data", "if", "object", "given", "it", "will", "be", "serialize", "with", "registered", "serializer", "." ]
6f368380cfc39d27fafb0844e9a53b4d86d7c034
https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Bundle/FrameworkExtraBundle/Controller/RestApiControllerTrait.php#L34-L49
train
Linkvalue-Interne/MajoraFrameworkExtraBundle
src/Majora/Bundle/FrameworkExtraBundle/Controller/RestApiControllerTrait.php
RestApiControllerTrait.createJsonBadRequestResponse
protected function createJsonBadRequestResponse(array $errors = array()) { // try to extract proper validation errors foreach ($errors as $key => $error) { if (!$error instanceof FormError) { continue; } $errors['errors'][$key] = array( ...
php
protected function createJsonBadRequestResponse(array $errors = array()) { // try to extract proper validation errors foreach ($errors as $key => $error) { if (!$error instanceof FormError) { continue; } $errors['errors'][$key] = array( ...
[ "protected", "function", "createJsonBadRequestResponse", "(", "array", "$", "errors", "=", "array", "(", ")", ")", "{", "// try to extract proper validation errors", "foreach", "(", "$", "errors", "as", "$", "key", "=>", "$", "error", ")", "{", "if", "(", "!",...
create and returns a 400 Bad Request response. @param array $errors @return JsonResponse
[ "create", "and", "returns", "a", "400", "Bad", "Request", "response", "." ]
6f368380cfc39d27fafb0844e9a53b4d86d7c034
https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Bundle/FrameworkExtraBundle/Controller/RestApiControllerTrait.php#L71-L93
train
Linkvalue-Interne/MajoraFrameworkExtraBundle
src/Majora/Bundle/FrameworkExtraBundle/Controller/RestApiControllerTrait.php
RestApiControllerTrait.getRequestData
protected function getRequestData(Request $request, $inflection = 'camelize') { switch ($request->headers->get('content-type')) { case 'application/json': if (!($data = @json_decode($request->getContent(), true)) && ($error = json_last_error()) != JSON_ERROR_...
php
protected function getRequestData(Request $request, $inflection = 'camelize') { switch ($request->headers->get('content-type')) { case 'application/json': if (!($data = @json_decode($request->getContent(), true)) && ($error = json_last_error()) != JSON_ERROR_...
[ "protected", "function", "getRequestData", "(", "Request", "$", "request", ",", "$", "inflection", "=", "'camelize'", ")", "{", "switch", "(", "$", "request", "->", "headers", "->", "get", "(", "'content-type'", ")", ")", "{", "case", "'application/json'", "...
Retrieve given request data depending on its content type. @param Request $request @param string $inflection optional inflector to tuse on parameter keys @return array @throws HttpException if JSON content-type and invalid JSON data
[ "Retrieve", "given", "request", "data", "depending", "on", "its", "content", "type", "." ]
6f368380cfc39d27fafb0844e9a53b4d86d7c034
https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Bundle/FrameworkExtraBundle/Controller/RestApiControllerTrait.php#L105-L134
train
Linkvalue-Interne/MajoraFrameworkExtraBundle
src/Majora/Bundle/FrameworkExtraBundle/Controller/RestApiControllerTrait.php
RestApiControllerTrait.assertSubmitedFormIsValid
protected function assertSubmitedFormIsValid(Request $request, FormInterface $form) { $form->submit( $this->getRequestData($request), $request->getMethod() !== 'PATCH' ); if (!$valid = $form->isValid()) { throw new ValidationException( $fo...
php
protected function assertSubmitedFormIsValid(Request $request, FormInterface $form) { $form->submit( $this->getRequestData($request), $request->getMethod() !== 'PATCH' ); if (!$valid = $form->isValid()) { throw new ValidationException( $fo...
[ "protected", "function", "assertSubmitedFormIsValid", "(", "Request", "$", "request", ",", "FormInterface", "$", "form", ")", "{", "$", "form", "->", "submit", "(", "$", "this", "->", "getRequestData", "(", "$", "request", ")", ",", "$", "request", "->", "...
Custom method for form submission to handle http method bugs, and extra fields error options. @param Request $request @param FormInterface $form @throws HttpException if invalid json data @throws ValidationException if invalid form
[ "Custom", "method", "for", "form", "submission", "to", "handle", "http", "method", "bugs", "and", "extra", "fields", "error", "options", "." ]
6f368380cfc39d27fafb0844e9a53b4d86d7c034
https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Bundle/FrameworkExtraBundle/Controller/RestApiControllerTrait.php#L146-L159
train
Becklyn/Gluggi
src/Application/LayoutApplication.php
LayoutApplication.bootstrap
public function bootstrap ($webDir, array $config = []) { $baseDir = dirname($webDir); $this["gluggi.config"] = $this->resolveConfig($config); $this["gluggi.baseDir"] = $baseDir; $this->registerProviders(); $this->registerCoreTwigNamespace(); $this->registerModelsAnd...
php
public function bootstrap ($webDir, array $config = []) { $baseDir = dirname($webDir); $this["gluggi.config"] = $this->resolveConfig($config); $this["gluggi.baseDir"] = $baseDir; $this->registerProviders(); $this->registerCoreTwigNamespace(); $this->registerModelsAnd...
[ "public", "function", "bootstrap", "(", "$", "webDir", ",", "array", "$", "config", "=", "[", "]", ")", "{", "$", "baseDir", "=", "dirname", "(", "$", "webDir", ")", ";", "$", "this", "[", "\"gluggi.config\"", "]", "=", "$", "this", "->", "resolveCon...
Bootstraps the complete application @param string $webDir the path to the web dir @param array $config the config
[ "Bootstraps", "the", "complete", "application" ]
837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786
https://github.com/Becklyn/Gluggi/blob/837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786/src/Application/LayoutApplication.php#L31-L43
train
Becklyn/Gluggi
src/Application/LayoutApplication.php
LayoutApplication.registerProviders
private function registerProviders () { $this->register(new TwigServiceProvider()); $this->register(new UrlGeneratorServiceProvider()); $this->register(new ServiceControllerServiceProvider()); }
php
private function registerProviders () { $this->register(new TwigServiceProvider()); $this->register(new UrlGeneratorServiceProvider()); $this->register(new ServiceControllerServiceProvider()); }
[ "private", "function", "registerProviders", "(", ")", "{", "$", "this", "->", "register", "(", "new", "TwigServiceProvider", "(", ")", ")", ";", "$", "this", "->", "register", "(", "new", "UrlGeneratorServiceProvider", "(", ")", ")", ";", "$", "this", "->"...
Registers all used service providers
[ "Registers", "all", "used", "service", "providers" ]
837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786
https://github.com/Becklyn/Gluggi/blob/837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786/src/Application/LayoutApplication.php#L49-L54
train
Becklyn/Gluggi
src/Application/LayoutApplication.php
LayoutApplication.registerModelsAndTwigLayoutNamespaces
private function registerModelsAndTwigLayoutNamespaces ($baseDir) { $elementTypesModel = new ElementTypesModel($baseDir); // model $this["model.element_types"] = $elementTypesModel; $this["model.download"] = new DownloadModel($baseDir); // twig template namespaces ...
php
private function registerModelsAndTwigLayoutNamespaces ($baseDir) { $elementTypesModel = new ElementTypesModel($baseDir); // model $this["model.element_types"] = $elementTypesModel; $this["model.download"] = new DownloadModel($baseDir); // twig template namespaces ...
[ "private", "function", "registerModelsAndTwigLayoutNamespaces", "(", "$", "baseDir", ")", "{", "$", "elementTypesModel", "=", "new", "ElementTypesModel", "(", "$", "baseDir", ")", ";", "// model", "$", "this", "[", "\"model.element_types\"", "]", "=", "$", "elemen...
Registers all models and all twig layout namespaces @param string $baseDir
[ "Registers", "all", "models", "and", "all", "twig", "layout", "namespaces" ]
837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786
https://github.com/Becklyn/Gluggi/blob/837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786/src/Application/LayoutApplication.php#L71-L87
train
Becklyn/Gluggi
src/Application/LayoutApplication.php
LayoutApplication.registerTwigExtensions
private function registerTwigExtensions () { $this['twig'] = $this->share($this->extend('twig', function (Twig_Environment $twig, Application $app) { // add custom extension $twig->addExtension(new TwigExtension($app)); // add global g...
php
private function registerTwigExtensions () { $this['twig'] = $this->share($this->extend('twig', function (Twig_Environment $twig, Application $app) { // add custom extension $twig->addExtension(new TwigExtension($app)); // add global g...
[ "private", "function", "registerTwigExtensions", "(", ")", "{", "$", "this", "[", "'twig'", "]", "=", "$", "this", "->", "share", "(", "$", "this", "->", "extend", "(", "'twig'", ",", "function", "(", "Twig_Environment", "$", "twig", ",", "Application", ...
Registers all used twig extensions
[ "Registers", "all", "used", "twig", "extensions" ]
837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786
https://github.com/Becklyn/Gluggi/blob/837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786/src/Application/LayoutApplication.php#L106-L122
train
Becklyn/Gluggi
src/Application/LayoutApplication.php
LayoutApplication.defineCoreRouting
private function defineCoreRouting () { $this->get("/", "controller.core:indexAction")->bind("index"); $this->get("/all/{elementType}", "controller.core:elementsOverviewAction")->bind("elements_overview"); $this->get("/{elementType}/{key}", "controller.core:showElementAc...
php
private function defineCoreRouting () { $this->get("/", "controller.core:indexAction")->bind("index"); $this->get("/all/{elementType}", "controller.core:elementsOverviewAction")->bind("elements_overview"); $this->get("/{elementType}/{key}", "controller.core:showElementAc...
[ "private", "function", "defineCoreRouting", "(", ")", "{", "$", "this", "->", "get", "(", "\"/\"", ",", "\"controller.core:indexAction\"", ")", "->", "bind", "(", "\"index\"", ")", ";", "$", "this", "->", "get", "(", "\"/all/{elementType}\"", ",", "\"controlle...
Defines the routes of the core app
[ "Defines", "the", "routes", "of", "the", "core", "app" ]
837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786
https://github.com/Becklyn/Gluggi/blob/837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786/src/Application/LayoutApplication.php#L128-L133
train
sil-project/VarietyBundle
src/Entity/Species.php
Species.setGenus
public function setGenus(\Librinfo\VarietiesBundle\Entity\Genus $genus = null) { $this->genus = $genus; return $this; }
php
public function setGenus(\Librinfo\VarietiesBundle\Entity\Genus $genus = null) { $this->genus = $genus; return $this; }
[ "public", "function", "setGenus", "(", "\\", "Librinfo", "\\", "VarietiesBundle", "\\", "Entity", "\\", "Genus", "$", "genus", "=", "null", ")", "{", "$", "this", "->", "genus", "=", "$", "genus", ";", "return", "$", "this", ";", "}" ]
Set genus. @param \Librinfo\VarietiesBundle\Entity\Genus $genus @return Species
[ "Set", "genus", "." ]
e9508ce13a4bb277d10bdcd925fdb84bc01f453f
https://github.com/sil-project/VarietyBundle/blob/e9508ce13a4bb277d10bdcd925fdb84bc01f453f/src/Entity/Species.php#L373-L378
train
sil-project/VarietyBundle
src/Entity/Species.php
Species.addSubspecies
public function addSubspecies(\Librinfo\VarietiesBundle\Entity\Species $subspecies) { $subspecies->setParentSpecies($this); $this->subspecieses[] = $subspecies; return $this; }
php
public function addSubspecies(\Librinfo\VarietiesBundle\Entity\Species $subspecies) { $subspecies->setParentSpecies($this); $this->subspecieses[] = $subspecies; return $this; }
[ "public", "function", "addSubspecies", "(", "\\", "Librinfo", "\\", "VarietiesBundle", "\\", "Entity", "\\", "Species", "$", "subspecies", ")", "{", "$", "subspecies", "->", "setParentSpecies", "(", "$", "this", ")", ";", "$", "this", "->", "subspecieses", "...
Add subspecies. @param \Librinfo\VarietiesBundle\Entity\Species $subspecies @return Species
[ "Add", "subspecies", "." ]
e9508ce13a4bb277d10bdcd925fdb84bc01f453f
https://github.com/sil-project/VarietyBundle/blob/e9508ce13a4bb277d10bdcd925fdb84bc01f453f/src/Entity/Species.php#L434-L440
train
sil-project/VarietyBundle
src/Entity/Species.php
Species.removeSubspeciese
public function removeSubspeciese(\Librinfo\VarietiesBundle\Entity\Species $subspecies) { return $this->subspecieses->removeElement($subspecies); }
php
public function removeSubspeciese(\Librinfo\VarietiesBundle\Entity\Species $subspecies) { return $this->subspecieses->removeElement($subspecies); }
[ "public", "function", "removeSubspeciese", "(", "\\", "Librinfo", "\\", "VarietiesBundle", "\\", "Entity", "\\", "Species", "$", "subspecies", ")", "{", "return", "$", "this", "->", "subspecieses", "->", "removeElement", "(", "$", "subspecies", ")", ";", "}" ]
Remove subspecies. @param \Librinfo\VarietiesBundle\Entity\Species $subspecies @return bool tRUE if this collection contained the specified element, FALSE otherwise
[ "Remove", "subspecies", "." ]
e9508ce13a4bb277d10bdcd925fdb84bc01f453f
https://github.com/sil-project/VarietyBundle/blob/e9508ce13a4bb277d10bdcd925fdb84bc01f453f/src/Entity/Species.php#L449-L452
train
sil-project/VarietyBundle
src/Entity/Species.php
Species.setParentSpecies
public function setParentSpecies(\Librinfo\VarietiesBundle\Entity\Species $parentSpecies = null) { $this->parent_species = $parentSpecies; return $this; }
php
public function setParentSpecies(\Librinfo\VarietiesBundle\Entity\Species $parentSpecies = null) { $this->parent_species = $parentSpecies; return $this; }
[ "public", "function", "setParentSpecies", "(", "\\", "Librinfo", "\\", "VarietiesBundle", "\\", "Entity", "\\", "Species", "$", "parentSpecies", "=", "null", ")", "{", "$", "this", "->", "parent_species", "=", "$", "parentSpecies", ";", "return", "$", "this", ...
Set parentSpecies. @param \Librinfo\VarietiesBundle\Entity\Species $parentSpecies @return Species
[ "Set", "parentSpecies", "." ]
e9508ce13a4bb277d10bdcd925fdb84bc01f453f
https://github.com/sil-project/VarietyBundle/blob/e9508ce13a4bb277d10bdcd925fdb84bc01f453f/src/Entity/Species.php#L481-L486
train
MetaSyntactical/Io
src/MetaSyntactical/Io/Reader.php
Reader.setOffset
public function setOffset($offset) { $this->checkStreamAvailable(); fseek($this->fileDescriptor, $offset < 0 ? $this->getSize() + $offset : $offset); }
php
public function setOffset($offset) { $this->checkStreamAvailable(); fseek($this->fileDescriptor, $offset < 0 ? $this->getSize() + $offset : $offset); }
[ "public", "function", "setOffset", "(", "$", "offset", ")", "{", "$", "this", "->", "checkStreamAvailable", "(", ")", ";", "fseek", "(", "$", "this", "->", "fileDescriptor", ",", "$", "offset", "<", "0", "?", "$", "this", "->", "getSize", "(", ")", "...
Sets the point of operation, ie the cursor offset value. The offset may also be set to a negative value when it is interpreted as an offset from the end of the stream instead of the beginning. @param integer $offset The new point of operation. @return void @throws InvalidStreamException if an I/O error occurs
[ "Sets", "the", "point", "of", "operation", "ie", "the", "cursor", "offset", "value", ".", "The", "offset", "may", "also", "be", "set", "to", "a", "negative", "value", "when", "it", "is", "interpreted", "as", "an", "offset", "from", "the", "end", "of", ...
d9272c6cf7f3cf24cbd5e4069a6695b26ef0b50c
https://github.com/MetaSyntactical/Io/blob/d9272c6cf7f3cf24cbd5e4069a6695b26ef0b50c/src/MetaSyntactical/Io/Reader.php#L111-L115
train
MetaSyntactical/Io
src/MetaSyntactical/Io/Reader.php
Reader.readInt16LE
final public function readInt16LE() { if ($this->isBigEndian()) { return $this->fromInt16(strrev($this->read(2))); } else { return $this->fromInt16($this->read(2)); } }
php
final public function readInt16LE() { if ($this->isBigEndian()) { return $this->fromInt16(strrev($this->read(2))); } else { return $this->fromInt16($this->read(2)); } }
[ "final", "public", "function", "readInt16LE", "(", ")", "{", "if", "(", "$", "this", "->", "isBigEndian", "(", ")", ")", "{", "return", "$", "this", "->", "fromInt16", "(", "strrev", "(", "$", "this", "->", "read", "(", "2", ")", ")", ")", ";", "...
Reads 2 bytes from the stream and returns little-endian ordered binary data as signed 16-bit integer. @return integer @throws InvalidStreamException if an I/O error occurs
[ "Reads", "2", "bytes", "from", "the", "stream", "and", "returns", "little", "-", "endian", "ordered", "binary", "data", "as", "signed", "16", "-", "bit", "integer", "." ]
d9272c6cf7f3cf24cbd5e4069a6695b26ef0b50c
https://github.com/MetaSyntactical/Io/blob/d9272c6cf7f3cf24cbd5e4069a6695b26ef0b50c/src/MetaSyntactical/Io/Reader.php#L224-L231
train
MetaSyntactical/Io
src/MetaSyntactical/Io/Reader.php
Reader.readInt16BE
final public function readInt16BE() { if ($this->isLittleEndian()) { return $this->fromInt16(strrev($this->read(2))); } else { return $this->fromInt16($this->read(2)); } }
php
final public function readInt16BE() { if ($this->isLittleEndian()) { return $this->fromInt16(strrev($this->read(2))); } else { return $this->fromInt16($this->read(2)); } }
[ "final", "public", "function", "readInt16BE", "(", ")", "{", "if", "(", "$", "this", "->", "isLittleEndian", "(", ")", ")", "{", "return", "$", "this", "->", "fromInt16", "(", "strrev", "(", "$", "this", "->", "read", "(", "2", ")", ")", ")", ";", ...
Reads 2 bytes from the stream and returns big-endian ordered binary data as signed 16-bit integer. @return integer @throws InvalidStreamException if an I/O error occurs
[ "Reads", "2", "bytes", "from", "the", "stream", "and", "returns", "big", "-", "endian", "ordered", "binary", "data", "as", "signed", "16", "-", "bit", "integer", "." ]
d9272c6cf7f3cf24cbd5e4069a6695b26ef0b50c
https://github.com/MetaSyntactical/Io/blob/d9272c6cf7f3cf24cbd5e4069a6695b26ef0b50c/src/MetaSyntactical/Io/Reader.php#L240-L247
train
MetaSyntactical/Io
src/MetaSyntactical/Io/Reader.php
Reader.fromUInt16
private function fromUInt16($value, $order = 0) { list(, $int) = unpack( ($order == self::BIG_ENDIAN_ORDER ? 'n' : ($order == self::LITTLE_ENDIAN_ORDER ? 'v' : 'S')) . '*', $value ); return $int; }
php
private function fromUInt16($value, $order = 0) { list(, $int) = unpack( ($order == self::BIG_ENDIAN_ORDER ? 'n' : ($order == self::LITTLE_ENDIAN_ORDER ? 'v' : 'S')) . '*', $value ); return $int; }
[ "private", "function", "fromUInt16", "(", "$", "value", ",", "$", "order", "=", "0", ")", "{", "list", "(", ",", "$", "int", ")", "=", "unpack", "(", "(", "$", "order", "==", "self", "::", "BIG_ENDIAN_ORDER", "?", "'n'", ":", "(", "$", "order", "...
Returns machine endian ordered binary data as unsigned 16-bit integer. @param string $value The binary data string. @param integer $order The byte order of the binary data string. @return integer
[ "Returns", "machine", "endian", "ordered", "binary", "data", "as", "unsigned", "16", "-", "bit", "integer", "." ]
d9272c6cf7f3cf24cbd5e4069a6695b26ef0b50c
https://github.com/MetaSyntactical/Io/blob/d9272c6cf7f3cf24cbd5e4069a6695b26ef0b50c/src/MetaSyntactical/Io/Reader.php#L268-L275
train
MetaSyntactical/Io
src/MetaSyntactical/Io/Reader.php
Reader.fromInt24
private function fromInt24($value) { list(, $int) = unpack('l*', $this->isLittleEndian() ? ("\x00" . $value) : ($value . "\x00")); return $int; }
php
private function fromInt24($value) { list(, $int) = unpack('l*', $this->isLittleEndian() ? ("\x00" . $value) : ($value . "\x00")); return $int; }
[ "private", "function", "fromInt24", "(", "$", "value", ")", "{", "list", "(", ",", "$", "int", ")", "=", "unpack", "(", "'l*'", ",", "$", "this", "->", "isLittleEndian", "(", ")", "?", "(", "\"\\x00\"", ".", "$", "value", ")", ":", "(", "$", "val...
Returns machine endian ordered binary data as signed 24-bit integer. @param string $value The binary data string. @return integer
[ "Returns", "machine", "endian", "ordered", "binary", "data", "as", "signed", "24", "-", "bit", "integer", "." ]
d9272c6cf7f3cf24cbd5e4069a6695b26ef0b50c
https://github.com/MetaSyntactical/Io/blob/d9272c6cf7f3cf24cbd5e4069a6695b26ef0b50c/src/MetaSyntactical/Io/Reader.php#L319-L323
train
MetaSyntactical/Io
src/MetaSyntactical/Io/Reader.php
Reader.readInt24LE
final public function readInt24LE() { if ($this->isBigEndian()) { return $this->fromInt24(strrev($this->read(3))); } else { return $this->fromInt24($this->read(3)); } }
php
final public function readInt24LE() { if ($this->isBigEndian()) { return $this->fromInt24(strrev($this->read(3))); } else { return $this->fromInt24($this->read(3)); } }
[ "final", "public", "function", "readInt24LE", "(", ")", "{", "if", "(", "$", "this", "->", "isBigEndian", "(", ")", ")", "{", "return", "$", "this", "->", "fromInt24", "(", "strrev", "(", "$", "this", "->", "read", "(", "3", ")", ")", ")", ";", "...
Reads 3 bytes from the stream and returns little-endian ordered binary data as signed 24-bit integer. @return integer @throws InvalidStreamException if an I/O error occurs
[ "Reads", "3", "bytes", "from", "the", "stream", "and", "returns", "little", "-", "endian", "ordered", "binary", "data", "as", "signed", "24", "-", "bit", "integer", "." ]
d9272c6cf7f3cf24cbd5e4069a6695b26ef0b50c
https://github.com/MetaSyntactical/Io/blob/d9272c6cf7f3cf24cbd5e4069a6695b26ef0b50c/src/MetaSyntactical/Io/Reader.php#L332-L339
train