id
int32
0
241k
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
236,800
Thuata/FrameworkBundle
Repository/Registry/MongoDBRegistry.php
MongoDBRegistry.hydrateEntity
private function hydrateEntity($document) { $class = $this->entityClass; $reflectionClass = new \ReflectionClass(AbstractDocument::class); $entity = new $class(); if (!($entity instanceof AbstractDocument)) { throw new \Exception(sprintf('"%s" is not a subclass of "%s"', $this->entityClass, AbstractDocument::class)); } $documentProperty = $reflectionClass->getProperty('document'); $documentProperty->setAccessible(true); $documentProperty->setValue($entity, $document); return $entity; }
php
private function hydrateEntity($document) { $class = $this->entityClass; $reflectionClass = new \ReflectionClass(AbstractDocument::class); $entity = new $class(); if (!($entity instanceof AbstractDocument)) { throw new \Exception(sprintf('"%s" is not a subclass of "%s"', $this->entityClass, AbstractDocument::class)); } $documentProperty = $reflectionClass->getProperty('document'); $documentProperty->setAccessible(true); $documentProperty->setValue($entity, $document); return $entity; }
[ "private", "function", "hydrateEntity", "(", "$", "document", ")", "{", "$", "class", "=", "$", "this", "->", "entityClass", ";", "$", "reflectionClass", "=", "new", "\\", "ReflectionClass", "(", "AbstractDocument", "::", "class", ")", ";", "$", "entity", ...
Hydrates a document entity with a mongo document @param mixed $document @return AbstractDocument @throws \Exception
[ "Hydrates", "a", "document", "entity", "with", "a", "mongo", "document" ]
78c38a5103256d829d7f7574b4e15c9087d0cfd9
https://github.com/Thuata/FrameworkBundle/blob/78c38a5103256d829d7f7574b4e15c9087d0cfd9/Repository/Registry/MongoDBRegistry.php#L184-L199
236,801
jnjxp/html
src/Helper/Breadcrumb.php
Breadcrumb.buildItem
protected function buildItem($position, array $item) { $position +=1; list($title, $aAttr, $liAttr) = $item; $base = $this->baseAttr; $esc = $this->escaper->attr; $meta = $base['meta']; $meta['content'] = $position; $liAttr = $esc(array_merge_recursive($liAttr, $base['li'])); $aAttr = $esc(array_merge_recursive($aAttr, $base['a'])); $spanAttr = $esc($base['span']); $title = "<span $spanAttr>$title</span>"; $anchor = "<a $aAttr>$title</a>"; $meta = $this->void('meta', $meta); $this->html .= $this->indent(2, "<li {$liAttr}>"); $this->html .= $this->indent(3, $anchor); $this->html .= $this->indent(3, $meta); $this->html .= $this->indent(2, '</li>'); }
php
protected function buildItem($position, array $item) { $position +=1; list($title, $aAttr, $liAttr) = $item; $base = $this->baseAttr; $esc = $this->escaper->attr; $meta = $base['meta']; $meta['content'] = $position; $liAttr = $esc(array_merge_recursive($liAttr, $base['li'])); $aAttr = $esc(array_merge_recursive($aAttr, $base['a'])); $spanAttr = $esc($base['span']); $title = "<span $spanAttr>$title</span>"; $anchor = "<a $aAttr>$title</a>"; $meta = $this->void('meta', $meta); $this->html .= $this->indent(2, "<li {$liAttr}>"); $this->html .= $this->indent(3, $anchor); $this->html .= $this->indent(3, $meta); $this->html .= $this->indent(2, '</li>'); }
[ "protected", "function", "buildItem", "(", "$", "position", ",", "array", "$", "item", ")", "{", "$", "position", "+=", "1", ";", "list", "(", "$", "title", ",", "$", "aAttr", ",", "$", "liAttr", ")", "=", "$", "item", ";", "$", "base", "=", "$",...
build an item @param int $position numeric position @param array $item array representation of item @return void @access protected
[ "build", "an", "item" ]
a38f130c19ab0a60ea52bc1d2560a68d2048d292
https://github.com/jnjxp/html/blob/a38f130c19ab0a60ea52bc1d2560a68d2048d292/src/Helper/Breadcrumb.php#L176-L201
236,802
jnjxp/html
src/Helper/Breadcrumb.php
Breadcrumb.buildActive
protected function buildActive(array $active) { $active[2] = array_merge_recursive( $active[2], ['class' => 'active'] ); $this->buildItem(count($this->stack), $active); }
php
protected function buildActive(array $active) { $active[2] = array_merge_recursive( $active[2], ['class' => 'active'] ); $this->buildItem(count($this->stack), $active); }
[ "protected", "function", "buildActive", "(", "array", "$", "active", ")", "{", "$", "active", "[", "2", "]", "=", "array_merge_recursive", "(", "$", "active", "[", "2", "]", ",", "[", "'class'", "=>", "'active'", "]", ")", ";", "$", "this", "->", "bu...
build the active item @param array $active array representation of item @return void @access protected
[ "build", "the", "active", "item" ]
a38f130c19ab0a60ea52bc1d2560a68d2048d292
https://github.com/jnjxp/html/blob/a38f130c19ab0a60ea52bc1d2560a68d2048d292/src/Helper/Breadcrumb.php#L212-L219
236,803
jnjxp/html
src/Helper/Breadcrumb.php
Breadcrumb.item
public function item($title, $uri = '#', $liAttr = []) { $this->stack[] = [ $this->escaper->html($title), ['href' => $uri], $liAttr, ]; return $this; }
php
public function item($title, $uri = '#', $liAttr = []) { $this->stack[] = [ $this->escaper->html($title), ['href' => $uri], $liAttr, ]; return $this; }
[ "public", "function", "item", "(", "$", "title", ",", "$", "uri", "=", "'#'", ",", "$", "liAttr", "=", "[", "]", ")", "{", "$", "this", "->", "stack", "[", "]", "=", "[", "$", "this", "->", "escaper", "->", "html", "(", "$", "title", ")", ","...
add an item @param string $title text for item @param string $uri uri for item @param array $liAttr attributes for li element @return Breadcrumb @access public
[ "add", "an", "item" ]
a38f130c19ab0a60ea52bc1d2560a68d2048d292
https://github.com/jnjxp/html/blob/a38f130c19ab0a60ea52bc1d2560a68d2048d292/src/Helper/Breadcrumb.php#L233-L241
236,804
jnjxp/html
src/Helper/Breadcrumb.php
Breadcrumb.rawItem
public function rawItem($title, $uri = '#', $liAttr = []) { $this->stack[] = [$title, ['href' => $uri], $liAttr]; return $this; }
php
public function rawItem($title, $uri = '#', $liAttr = []) { $this->stack[] = [$title, ['href' => $uri], $liAttr]; return $this; }
[ "public", "function", "rawItem", "(", "$", "title", ",", "$", "uri", "=", "'#'", ",", "$", "liAttr", "=", "[", "]", ")", "{", "$", "this", "->", "stack", "[", "]", "=", "[", "$", "title", ",", "[", "'href'", "=>", "$", "uri", "]", ",", "$", ...
add a raw item @param string $title title of item @param string $uri uri of item @param mixed $liAttr attributes for li element @return Breadcrumb @access public
[ "add", "a", "raw", "item" ]
a38f130c19ab0a60ea52bc1d2560a68d2048d292
https://github.com/jnjxp/html/blob/a38f130c19ab0a60ea52bc1d2560a68d2048d292/src/Helper/Breadcrumb.php#L254-L258
236,805
jnjxp/html
src/Helper/Breadcrumb.php
Breadcrumb.items
public function items(array $items) { foreach ($items as $uri => $title) { list($title, $uri, $liAttr) = $this->fixData($uri, $title); $this->item($title, $uri, $liAttr); } return $this; }
php
public function items(array $items) { foreach ($items as $uri => $title) { list($title, $uri, $liAttr) = $this->fixData($uri, $title); $this->item($title, $uri, $liAttr); } return $this; }
[ "public", "function", "items", "(", "array", "$", "items", ")", "{", "foreach", "(", "$", "items", "as", "$", "uri", "=>", "$", "title", ")", "{", "list", "(", "$", "title", ",", "$", "uri", ",", "$", "liAttr", ")", "=", "$", "this", "->", "fix...
add an array of items @param array $items array of items @return Breadcrumb @access public
[ "add", "an", "array", "of", "items" ]
a38f130c19ab0a60ea52bc1d2560a68d2048d292
https://github.com/jnjxp/html/blob/a38f130c19ab0a60ea52bc1d2560a68d2048d292/src/Helper/Breadcrumb.php#L269-L276
236,806
jnjxp/html
src/Helper/Breadcrumb.php
Breadcrumb.rawItems
public function rawItems(array $items) { foreach ($items as $uri => $title) { list($title, $uri, $liAttr) = $this->fixData($uri, $title); $this->rawItem($title, $uri, $liAttr); } return $this; }
php
public function rawItems(array $items) { foreach ($items as $uri => $title) { list($title, $uri, $liAttr) = $this->fixData($uri, $title); $this->rawItem($title, $uri, $liAttr); } return $this; }
[ "public", "function", "rawItems", "(", "array", "$", "items", ")", "{", "foreach", "(", "$", "items", "as", "$", "uri", "=>", "$", "title", ")", "{", "list", "(", "$", "title", ",", "$", "uri", ",", "$", "liAttr", ")", "=", "$", "this", "->", "...
add an array of raw items @param array $items array of raw items to add @return Breadcrumb @access public
[ "add", "an", "array", "of", "raw", "items" ]
a38f130c19ab0a60ea52bc1d2560a68d2048d292
https://github.com/jnjxp/html/blob/a38f130c19ab0a60ea52bc1d2560a68d2048d292/src/Helper/Breadcrumb.php#L287-L294
236,807
jnjxp/html
src/Helper/Breadcrumb.php
Breadcrumb.fixData
protected function fixData($uri, $title) { $liAttr = []; if (is_int($uri)) { $uri = '#'; } if (is_array($title)) { $liAttr = $title; $title = array_shift($liAttr); } return [$title, $uri, $liAttr]; }
php
protected function fixData($uri, $title) { $liAttr = []; if (is_int($uri)) { $uri = '#'; } if (is_array($title)) { $liAttr = $title; $title = array_shift($liAttr); } return [$title, $uri, $liAttr]; }
[ "protected", "function", "fixData", "(", "$", "uri", ",", "$", "title", ")", "{", "$", "liAttr", "=", "[", "]", ";", "if", "(", "is_int", "(", "$", "uri", ")", ")", "{", "$", "uri", "=", "'#'", ";", "}", "if", "(", "is_array", "(", "$", "titl...
fixes item data @param mixed $uri uri of item or numeric key @param mixed $title title of item or array of title and li attrs @return array @access protected
[ "fixes", "item", "data" ]
a38f130c19ab0a60ea52bc1d2560a68d2048d292
https://github.com/jnjxp/html/blob/a38f130c19ab0a60ea52bc1d2560a68d2048d292/src/Helper/Breadcrumb.php#L306-L317
236,808
jabernardo/saddle
src/Saddle/Container.php
Container.raw
public function raw($key) { if (!is_string($key)) { throw new \Calf\Exception\InvalidArgument('Key must be string.'); } if (!isset($this->_keys[$key])) { throw new \Calf\Exception\Runtime('Key doesn\'t exists: ' . $key); } return $this->_values[$key]; }
php
public function raw($key) { if (!is_string($key)) { throw new \Calf\Exception\InvalidArgument('Key must be string.'); } if (!isset($this->_keys[$key])) { throw new \Calf\Exception\Runtime('Key doesn\'t exists: ' . $key); } return $this->_values[$key]; }
[ "public", "function", "raw", "(", "$", "key", ")", "{", "if", "(", "!", "is_string", "(", "$", "key", ")", ")", "{", "throw", "new", "\\", "Calf", "\\", "Exception", "\\", "InvalidArgument", "(", "'Key must be string.'", ")", ";", "}", "if", "(", "!"...
Get raw value @access public @return void @throws \Calf\Exception\InvalidArgument Key must be string @throws \Calf\Exception\Runtime Key doesn't exists
[ "Get", "raw", "value" ]
07dbccda2491904940afd7b9ffd6cfd8fe4dcec1
https://github.com/jabernardo/saddle/blob/07dbccda2491904940afd7b9ffd6cfd8fe4dcec1/src/Saddle/Container.php#L148-L158
236,809
kiler129/CherryHttp
src/Http/Response/AutogeneratedResponseTrait.php
AutogeneratedResponseTrait.generateAutomaticResponseContent
public function generateAutomaticResponseContent($code, $reasonPhrase, $title = null, $description = null) { if ($title === null) { $title = $code . ' ' . $reasonPhrase; } return sprintf($this->template, $title, $code, $reasonPhrase, $description); }
php
public function generateAutomaticResponseContent($code, $reasonPhrase, $title = null, $description = null) { if ($title === null) { $title = $code . ' ' . $reasonPhrase; } return sprintf($this->template, $title, $code, $reasonPhrase, $description); }
[ "public", "function", "generateAutomaticResponseContent", "(", "$", "code", ",", "$", "reasonPhrase", ",", "$", "title", "=", "null", ",", "$", "description", "=", "null", ")", "{", "if", "(", "$", "title", "===", "null", ")", "{", "$", "title", "=", "...
Generates response with built-in template. @param int|string $code Response code which will be presented to the user. @param string $reasonPhrase Response code reason phrase displayed under the code. @param string|null $title HTML <title> tag contents. If null it will be generated from code & reason phrase. @param string|null $description Additional description/explanation of situation. @return string HTML content
[ "Generates", "response", "with", "built", "-", "in", "template", "." ]
05927f26183cbd6fd5ccb0853befecdea279308d
https://github.com/kiler129/CherryHttp/blob/05927f26183cbd6fd5ccb0853befecdea279308d/src/Http/Response/AutogeneratedResponseTrait.php#L31-L38
236,810
rybakdigital/fapi
Component/Routing/Route/Route.php
Route.addMethod
public function addMethod($method) { // Capitalise method $method = strtoupper($method); if (!in_array($method, self::$availableMethods)) { throw new InvalidArgumentException(sprintf('Invalid method for route with path "%s". Method must be one of: ' . implode(', ', self::$availableMethods) . '. Got "%s" instead.', $this->getPath(), $method)); } if (!in_array($method, $this->methods)) { $this->methods[] = $method; } // Add HEAD method if GET has been allowed for this Route if ($method == 'GET') { $this->addMethod('HEAD'); } return $this; }
php
public function addMethod($method) { // Capitalise method $method = strtoupper($method); if (!in_array($method, self::$availableMethods)) { throw new InvalidArgumentException(sprintf('Invalid method for route with path "%s". Method must be one of: ' . implode(', ', self::$availableMethods) . '. Got "%s" instead.', $this->getPath(), $method)); } if (!in_array($method, $this->methods)) { $this->methods[] = $method; } // Add HEAD method if GET has been allowed for this Route if ($method == 'GET') { $this->addMethod('HEAD'); } return $this; }
[ "public", "function", "addMethod", "(", "$", "method", ")", "{", "// Capitalise method", "$", "method", "=", "strtoupper", "(", "$", "method", ")", ";", "if", "(", "!", "in_array", "(", "$", "method", ",", "self", "::", "$", "availableMethods", ")", ")",...
Adds method to array of methods accepted by Route @param string $method Name of HTTP method to add @return Route @throws InvalidArgumentException
[ "Adds", "method", "to", "array", "of", "methods", "accepted", "by", "Route" ]
739dfa0fc0b17ab8e8ac8f8e86484f7e62b21027
https://github.com/rybakdigital/fapi/blob/739dfa0fc0b17ab8e8ac8f8e86484f7e62b21027/Component/Routing/Route/Route.php#L127-L146
236,811
ipalaus/redisqueue
src/Ipalaus/RedisQueue/Repository.php
Repository.getAll
public function getAll() { $collection = new Collection; $keys = $this->database->keys($this->namespace.':*'); foreach ($keys as $key) { list($namespace, $name) = explode(':', $key); if ( ! $collection->has($name)) { $collection->put($name, $this->get($name)); } } return $collection; }
php
public function getAll() { $collection = new Collection; $keys = $this->database->keys($this->namespace.':*'); foreach ($keys as $key) { list($namespace, $name) = explode(':', $key); if ( ! $collection->has($name)) { $collection->put($name, $this->get($name)); } } return $collection; }
[ "public", "function", "getAll", "(", ")", "{", "$", "collection", "=", "new", "Collection", ";", "$", "keys", "=", "$", "this", "->", "database", "->", "keys", "(", "$", "this", "->", "namespace", ".", "':*'", ")", ";", "foreach", "(", "$", "keys", ...
Fetch all the queues inside the 'queues' namespace with the delayed and reserved. @return \Illuminate\Support\Collection
[ "Fetch", "all", "the", "queues", "inside", "the", "queues", "namespace", "with", "the", "delayed", "and", "reserved", "." ]
0a6c675e9918122263adfb4e0f6207bb3c5fd1f6
https://github.com/ipalaus/redisqueue/blob/0a6c675e9918122263adfb4e0f6207bb3c5fd1f6/src/Ipalaus/RedisQueue/Repository.php#L41-L58
236,812
ipalaus/redisqueue
src/Ipalaus/RedisQueue/Repository.php
Repository.get
public function get($name) { $namespaced = $this->namespace.':'.$name; $queued = $this->length($namespaced, 'list'); $delayed = $this->length($namespaced.':delayed', 'zset'); $reserved = $this->length($namespaced.':reserved', 'zset'); return array('queued' => $queued, 'delayed' => $delayed, 'reserved' => $reserved); }
php
public function get($name) { $namespaced = $this->namespace.':'.$name; $queued = $this->length($namespaced, 'list'); $delayed = $this->length($namespaced.':delayed', 'zset'); $reserved = $this->length($namespaced.':reserved', 'zset'); return array('queued' => $queued, 'delayed' => $delayed, 'reserved' => $reserved); }
[ "public", "function", "get", "(", "$", "name", ")", "{", "$", "namespaced", "=", "$", "this", "->", "namespace", ".", "':'", ".", "$", "name", ";", "$", "queued", "=", "$", "this", "->", "length", "(", "$", "namespaced", ",", "'list'", ")", ";", ...
Get the items that a concrete queue contain. @param string $name @return array
[ "Get", "the", "items", "that", "a", "concrete", "queue", "contain", "." ]
0a6c675e9918122263adfb4e0f6207bb3c5fd1f6
https://github.com/ipalaus/redisqueue/blob/0a6c675e9918122263adfb4e0f6207bb3c5fd1f6/src/Ipalaus/RedisQueue/Repository.php#L66-L75
236,813
ipalaus/redisqueue
src/Ipalaus/RedisQueue/Repository.php
Repository.getItems
public function getItems($name, $type) { $namespaced = $this->namespace.':'.$name; $key = ($type === 'queued') ? $namespaced : $namespaced.':'.$type; if ( ! $this->exists($key)) throw new QueueNotFoundException($key); $type = $this->type($key); $length = $this->length($key, $type); $method = 'get'.ucwords($type).'Items'; $items = $this->{$method}($key, $length); return Collection::make($items); }
php
public function getItems($name, $type) { $namespaced = $this->namespace.':'.$name; $key = ($type === 'queued') ? $namespaced : $namespaced.':'.$type; if ( ! $this->exists($key)) throw new QueueNotFoundException($key); $type = $this->type($key); $length = $this->length($key, $type); $method = 'get'.ucwords($type).'Items'; $items = $this->{$method}($key, $length); return Collection::make($items); }
[ "public", "function", "getItems", "(", "$", "name", ",", "$", "type", ")", "{", "$", "namespaced", "=", "$", "this", "->", "namespace", ".", "':'", ".", "$", "name", ";", "$", "key", "=", "(", "$", "type", "===", "'queued'", ")", "?", "$", "names...
Retruns a list of items for a given key. @param string $name @param string $type @return \Illuminate\Support\Collection
[ "Retruns", "a", "list", "of", "items", "for", "a", "given", "key", "." ]
0a6c675e9918122263adfb4e0f6207bb3c5fd1f6
https://github.com/ipalaus/redisqueue/blob/0a6c675e9918122263adfb4e0f6207bb3c5fd1f6/src/Ipalaus/RedisQueue/Repository.php#L84-L99
236,814
ipalaus/redisqueue
src/Ipalaus/RedisQueue/Repository.php
Repository.getListItems
protected function getListItems($key, $total, $offset = 0) { $items = array(); for ($i = $offset; $i < $total; $i++) { $items[$i] = $this->database->lindex($key, $i); } return $items; }
php
protected function getListItems($key, $total, $offset = 0) { $items = array(); for ($i = $offset; $i < $total; $i++) { $items[$i] = $this->database->lindex($key, $i); } return $items; }
[ "protected", "function", "getListItems", "(", "$", "key", ",", "$", "total", ",", "$", "offset", "=", "0", ")", "{", "$", "items", "=", "array", "(", ")", ";", "for", "(", "$", "i", "=", "$", "offset", ";", "$", "i", "<", "$", "total", ";", "...
Returns a list of items inside a list. @param string $key @param integer $total @param integer $offset @return array
[ "Returns", "a", "list", "of", "items", "inside", "a", "list", "." ]
0a6c675e9918122263adfb4e0f6207bb3c5fd1f6
https://github.com/ipalaus/redisqueue/blob/0a6c675e9918122263adfb4e0f6207bb3c5fd1f6/src/Ipalaus/RedisQueue/Repository.php#L109-L118
236,815
ipalaus/redisqueue
src/Ipalaus/RedisQueue/Repository.php
Repository.type
public function type($key) { if (Str::endsWith($key, ':queued')) { $key = str_replace(':queued', '', $key); } return $this->database->type($key); }
php
public function type($key) { if (Str::endsWith($key, ':queued')) { $key = str_replace(':queued', '', $key); } return $this->database->type($key); }
[ "public", "function", "type", "(", "$", "key", ")", "{", "if", "(", "Str", "::", "endsWith", "(", "$", "key", ",", "':queued'", ")", ")", "{", "$", "key", "=", "str_replace", "(", "':queued'", ",", "''", ",", "$", "key", ")", ";", "}", "return", ...
Returns the type of a Redis key. @param string $key @return string
[ "Returns", "the", "type", "of", "a", "Redis", "key", "." ]
0a6c675e9918122263adfb4e0f6207bb3c5fd1f6
https://github.com/ipalaus/redisqueue/blob/0a6c675e9918122263adfb4e0f6207bb3c5fd1f6/src/Ipalaus/RedisQueue/Repository.php#L149-L156
236,816
ipalaus/redisqueue
src/Ipalaus/RedisQueue/Repository.php
Repository.length
public function length($key, $type = null) { if (is_null($type)) $type = $this->type($key); switch ($type) { case 'list': return $this->database->llen($key); case 'zset': return $this->database->zcard($key); default: throw new UnexpectedValueException("List type '{$type}' not supported."); } }
php
public function length($key, $type = null) { if (is_null($type)) $type = $this->type($key); switch ($type) { case 'list': return $this->database->llen($key); case 'zset': return $this->database->zcard($key); default: throw new UnexpectedValueException("List type '{$type}' not supported."); } }
[ "public", "function", "length", "(", "$", "key", ",", "$", "type", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "type", ")", ")", "$", "type", "=", "$", "this", "->", "type", "(", "$", "key", ")", ";", "switch", "(", "$", "type", ")...
Return the length of a given list or set. @param string $key @param string $type @return integer|\UnexpectedValueException
[ "Return", "the", "length", "of", "a", "given", "list", "or", "set", "." ]
0a6c675e9918122263adfb4e0f6207bb3c5fd1f6
https://github.com/ipalaus/redisqueue/blob/0a6c675e9918122263adfb4e0f6207bb3c5fd1f6/src/Ipalaus/RedisQueue/Repository.php#L165-L180
236,817
ipalaus/redisqueue
src/Ipalaus/RedisQueue/Repository.php
Repository.remove
public function remove($key, $value, $type = null) { if (is_null($type)) $type = $this->type($key); switch ($type) { case 'list': $key = str_replace(':queued', '', $key); $random = Str::quickRandom(64); $this->database->lset($key, $value, $random); return $this->database->lrem($key, 1, $random); case 'zset': return $this->database->zrem($key, $value); default: throw new UnexpectedValueException("Unable to delete {$value} from {$key}. List type {$type} not supported."); } }
php
public function remove($key, $value, $type = null) { if (is_null($type)) $type = $this->type($key); switch ($type) { case 'list': $key = str_replace(':queued', '', $key); $random = Str::quickRandom(64); $this->database->lset($key, $value, $random); return $this->database->lrem($key, 1, $random); case 'zset': return $this->database->zrem($key, $value); default: throw new UnexpectedValueException("Unable to delete {$value} from {$key}. List type {$type} not supported."); } }
[ "public", "function", "remove", "(", "$", "key", ",", "$", "value", ",", "$", "type", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "type", ")", ")", "$", "type", "=", "$", "this", "->", "type", "(", "$", "key", ")", ";", "switch", "...
Remove an item with a given key, index or value. @param string $key @param string $value @param string $type @return bool
[ "Remove", "an", "item", "with", "a", "given", "key", "index", "or", "value", "." ]
0a6c675e9918122263adfb4e0f6207bb3c5fd1f6
https://github.com/ipalaus/redisqueue/blob/0a6c675e9918122263adfb4e0f6207bb3c5fd1f6/src/Ipalaus/RedisQueue/Repository.php#L190-L210
236,818
dzegarra/jsonrpcsmd
src/Greplab/Jsonrpcsmd/Smd/Service.php
Service.read
static public function read(Smd $smd, $classname) { $reflectedclass = new \ReflectionClass($classname); return self::isValid($smd, $reflectedclass) ? new Service($smd, $reflectedclass) : false; }
php
static public function read(Smd $smd, $classname) { $reflectedclass = new \ReflectionClass($classname); return self::isValid($smd, $reflectedclass) ? new Service($smd, $reflectedclass) : false; }
[ "static", "public", "function", "read", "(", "Smd", "$", "smd", ",", "$", "classname", ")", "{", "$", "reflectedclass", "=", "new", "\\", "ReflectionClass", "(", "$", "classname", ")", ";", "return", "self", "::", "isValid", "(", "$", "smd", ",", "$", ...
Read the content of one class and return the result of the analysis. Return FALSE if the cass found is not a valid service. @param Smd $smd @param string $classname @return Service
[ "Read", "the", "content", "of", "one", "class", "and", "return", "the", "result", "of", "the", "analysis", ".", "Return", "FALSE", "if", "the", "cass", "found", "is", "not", "a", "valid", "service", "." ]
2f423b575d34d9ef2370495b89b9efd96f0cd30b
https://github.com/dzegarra/jsonrpcsmd/blob/2f423b575d34d9ef2370495b89b9efd96f0cd30b/src/Greplab/Jsonrpcsmd/Smd/Service.php#L50-L54
236,819
dzegarra/jsonrpcsmd
src/Greplab/Jsonrpcsmd/Smd/Service.php
Service.isValid
static protected function isValid(Smd $smd, \ReflectionClass $reflectedclass) { $validator = $smd->getServiceValidator(); if ($validator && is_callable($validator)) { if ( call_user_func_array($validator, [$reflectedclass]) === false ) { return false; } } return true; }
php
static protected function isValid(Smd $smd, \ReflectionClass $reflectedclass) { $validator = $smd->getServiceValidator(); if ($validator && is_callable($validator)) { if ( call_user_func_array($validator, [$reflectedclass]) === false ) { return false; } } return true; }
[ "static", "protected", "function", "isValid", "(", "Smd", "$", "smd", ",", "\\", "ReflectionClass", "$", "reflectedclass", ")", "{", "$", "validator", "=", "$", "smd", "->", "getServiceValidator", "(", ")", ";", "if", "(", "$", "validator", "&&", "is_calla...
Validate a class using the custom validation closure. @param Smd $smd @param \ReflectionClass $reflectedclass @return bool
[ "Validate", "a", "class", "using", "the", "custom", "validation", "closure", "." ]
2f423b575d34d9ef2370495b89b9efd96f0cd30b
https://github.com/dzegarra/jsonrpcsmd/blob/2f423b575d34d9ef2370495b89b9efd96f0cd30b/src/Greplab/Jsonrpcsmd/Smd/Service.php#L63-L72
236,820
dzegarra/jsonrpcsmd
src/Greplab/Jsonrpcsmd/Smd/Service.php
Service.toArrayPlain
protected function toArrayPlain() { $classname = $this->resolveClassname(); $methods = array(); foreach ($this->getMethods() as $method) { $method_fullname = $classname . '.' . $method->getName(); $methods[$method_fullname] = $method->toArray(); } return $methods; }
php
protected function toArrayPlain() { $classname = $this->resolveClassname(); $methods = array(); foreach ($this->getMethods() as $method) { $method_fullname = $classname . '.' . $method->getName(); $methods[$method_fullname] = $method->toArray(); } return $methods; }
[ "protected", "function", "toArrayPlain", "(", ")", "{", "$", "classname", "=", "$", "this", "->", "resolveClassname", "(", ")", ";", "$", "methods", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getMethods", "(", ")", "as", "$", "m...
Return a plain representation of the class methods. @return array
[ "Return", "a", "plain", "representation", "of", "the", "class", "methods", "." ]
2f423b575d34d9ef2370495b89b9efd96f0cd30b
https://github.com/dzegarra/jsonrpcsmd/blob/2f423b575d34d9ef2370495b89b9efd96f0cd30b/src/Greplab/Jsonrpcsmd/Smd/Service.php#L146-L155
236,821
dzegarra/jsonrpcsmd
src/Greplab/Jsonrpcsmd/Smd/Service.php
Service.buildLevel
protected function buildLevel($classname) { $parts = explode('.', $classname); $lastLevel = &$this->methods; foreach ($parts as $part) { $lastLevel[$part] = array(); $lastLevel = &$lastLevel[$part]; } return $lastLevel; }
php
protected function buildLevel($classname) { $parts = explode('.', $classname); $lastLevel = &$this->methods; foreach ($parts as $part) { $lastLevel[$part] = array(); $lastLevel = &$lastLevel[$part]; } return $lastLevel; }
[ "protected", "function", "buildLevel", "(", "$", "classname", ")", "{", "$", "parts", "=", "explode", "(", "'.'", ",", "$", "classname", ")", ";", "$", "lastLevel", "=", "&", "$", "this", "->", "methods", ";", "foreach", "(", "$", "parts", "as", "$",...
This method is still in development. @todo implement the method toArrayTree() @param string $classname @return string
[ "This", "method", "is", "still", "in", "development", "." ]
2f423b575d34d9ef2370495b89b9efd96f0cd30b
https://github.com/dzegarra/jsonrpcsmd/blob/2f423b575d34d9ef2370495b89b9efd96f0cd30b/src/Greplab/Jsonrpcsmd/Smd/Service.php#L164-L175
236,822
dzegarra/jsonrpcsmd
src/Greplab/Jsonrpcsmd/Smd/Service.php
Service.toArrayTree
protected function toArrayTree() { $classname = $this->getDottedClassname(); $lastLevel = $this->buildLevel($classname); foreach ($this->getMethods() as $method) { $lastLevel[$method->getName()] = $method->toArray(); } return $this->methods; }
php
protected function toArrayTree() { $classname = $this->getDottedClassname(); $lastLevel = $this->buildLevel($classname); foreach ($this->getMethods() as $method) { $lastLevel[$method->getName()] = $method->toArray(); } return $this->methods; }
[ "protected", "function", "toArrayTree", "(", ")", "{", "$", "classname", "=", "$", "this", "->", "getDottedClassname", "(", ")", ";", "$", "lastLevel", "=", "$", "this", "->", "buildLevel", "(", "$", "classname", ")", ";", "foreach", "(", "$", "this", ...
Return a tree representation of the methods of the reflected class. @todo This method is still in development. @return array
[ "Return", "a", "tree", "representation", "of", "the", "methods", "of", "the", "reflected", "class", "." ]
2f423b575d34d9ef2370495b89b9efd96f0cd30b
https://github.com/dzegarra/jsonrpcsmd/blob/2f423b575d34d9ef2370495b89b9efd96f0cd30b/src/Greplab/Jsonrpcsmd/Smd/Service.php#L183-L193
236,823
dzegarra/jsonrpcsmd
src/Greplab/Jsonrpcsmd/Smd/Service.php
Service.toArray
public function toArray() { $fn = 'toArray' . ucfirst($this->presentation); if (!method_exists($this, $fn)) { throw new \Exception('There is no method ' . $fn . '.'); } return $this->$fn(); }
php
public function toArray() { $fn = 'toArray' . ucfirst($this->presentation); if (!method_exists($this, $fn)) { throw new \Exception('There is no method ' . $fn . '.'); } return $this->$fn(); }
[ "public", "function", "toArray", "(", ")", "{", "$", "fn", "=", "'toArray'", ".", "ucfirst", "(", "$", "this", "->", "presentation", ")", ";", "if", "(", "!", "method_exists", "(", "$", "this", ",", "$", "fn", ")", ")", "{", "throw", "new", "\\", ...
Build and return the class representation as an array. @return array @throws \Exception If the current representation mode cannot be used
[ "Build", "and", "return", "the", "class", "representation", "as", "an", "array", "." ]
2f423b575d34d9ef2370495b89b9efd96f0cd30b
https://github.com/dzegarra/jsonrpcsmd/blob/2f423b575d34d9ef2370495b89b9efd96f0cd30b/src/Greplab/Jsonrpcsmd/Smd/Service.php#L201-L208
236,824
phossa2/libs
src/Phossa2/Logger/Handler/StreamHandler.php
StreamHandler.openStream
protected function openStream(/*# string */ $path) { if (is_string($path)) { if (false !== strpos($path, '://')) { $path = 'file://' . $path; } return fopen($path, 'a'); } return $path; }
php
protected function openStream(/*# string */ $path) { if (is_string($path)) { if (false !== strpos($path, '://')) { $path = 'file://' . $path; } return fopen($path, 'a'); } return $path; }
[ "protected", "function", "openStream", "(", "/*# string */", "$", "path", ")", "{", "if", "(", "is_string", "(", "$", "path", ")", ")", "{", "if", "(", "false", "!==", "strpos", "(", "$", "path", ",", "'://'", ")", ")", "{", "$", "path", "=", "'fil...
Open stream for writing @param string|resource $path @return resource|false @access protected
[ "Open", "stream", "for", "writing" ]
921e485c8cc29067f279da2cdd06f47a9bddd115
https://github.com/phossa2/libs/blob/921e485c8cc29067f279da2cdd06f47a9bddd115/src/Phossa2/Logger/Handler/StreamHandler.php#L91-L100
236,825
cityware/city-components
src/File.php
File.prepare
public static function prepare($data, $forceWindows = false) { $lineBreak = "\n"; if (DS === '\\' || $forceWindows === true) { $lineBreak = "\r\n"; } return strtr($data, array("\r\n" => $lineBreak, "\n" => $lineBreak, "\r" => $lineBreak)); }
php
public static function prepare($data, $forceWindows = false) { $lineBreak = "\n"; if (DS === '\\' || $forceWindows === true) { $lineBreak = "\r\n"; } return strtr($data, array("\r\n" => $lineBreak, "\n" => $lineBreak, "\r" => $lineBreak)); }
[ "public", "static", "function", "prepare", "(", "$", "data", ",", "$", "forceWindows", "=", "false", ")", "{", "$", "lineBreak", "=", "\"\\n\"", ";", "if", "(", "DS", "===", "'\\\\'", "||", "$", "forceWindows", "===", "true", ")", "{", "$", "lineBreak"...
Prepares a ASCII string for writing. Converts line endings to the correct terminator for the current platform. If Windows, "\r\n" will be used, all other platforms will use "\n" @param string $data Data to prepare for writing. @param boolean $forceWindows @return string The with converted line endings.
[ "Prepares", "a", "ASCII", "string", "for", "writing", ".", "Converts", "line", "endings", "to", "the", "correct", "terminator", "for", "the", "current", "platform", ".", "If", "Windows", "\\", "r", "\\", "n", "will", "be", "used", "all", "other", "platform...
103211a4896f7e9ecdccec2ee9bf26239d52faa0
https://github.com/cityware/city-components/blob/103211a4896f7e9ecdccec2ee9bf26239d52faa0/src/File.php#L202-L210
236,826
cityware/city-components
src/File.php
File.mime
public function mime() { if (!$this->exists()) { return false; } if (function_exists('finfo_open')) { $finfo = finfo_open(FILEINFO_MIME); $finfo = finfo_file($finfo, $this->pwd()); if (!$finfo) { return false; } list($type) = explode(';', $finfo); return $type; } if (function_exists('mime_content_type')) { return mime_content_type($this->pwd()); } return false; }
php
public function mime() { if (!$this->exists()) { return false; } if (function_exists('finfo_open')) { $finfo = finfo_open(FILEINFO_MIME); $finfo = finfo_file($finfo, $this->pwd()); if (!$finfo) { return false; } list($type) = explode(';', $finfo); return $type; } if (function_exists('mime_content_type')) { return mime_content_type($this->pwd()); } return false; }
[ "public", "function", "mime", "(", ")", "{", "if", "(", "!", "$", "this", "->", "exists", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "function_exists", "(", "'finfo_open'", ")", ")", "{", "$", "finfo", "=", "finfo_open", "(", "FILE...
Get the mime type of the file. Uses the finfo extension if its available, otherwise falls back to mime_content_type @return false|string The mimetype of the file, or false if reading fails.
[ "Get", "the", "mime", "type", "of", "the", "file", ".", "Uses", "the", "finfo", "extension", "if", "its", "available", "otherwise", "falls", "back", "to", "mime_content_type" ]
103211a4896f7e9ecdccec2ee9bf26239d52faa0
https://github.com/cityware/city-components/blob/103211a4896f7e9ecdccec2ee9bf26239d52faa0/src/File.php#L562-L582
236,827
Flowpack/Flowpack.SingleSignOn.DemoInstance
Classes/Flowpack/SingleSignOn/DemoInstance/Command/DemoCommandController.php
DemoCommandController.setupCommand
public function setupCommand() { $serverPublicKeyString = Files::getFileContents('resource://Flowpack.SingleSignOn.DemoInstance/Private/Fixtures/DemoServer.pub', FILE_TEXT); if ($serverPublicKeyString === FALSE) { $this->outputLine('Could not open resource://Flowpack.SingleSignOn.DemoInstance/Private/Fixtures/DemoServer.pub, exiting.'); $this->quit(1); } $serverPublicKeyFingerprint = $this->rsaWalletService->registerPublicKeyFromString($serverPublicKeyString); $this->outputLine('Registered sso demo server public key'); $clientPrivateKeyString = Files::getFileContents('resource://Flowpack.SingleSignOn.DemoInstance/Private/Fixtures/DemoClient.key', FILE_TEXT); if ($clientPrivateKeyString === FALSE) { $this->outputLine('Could not open resource://Flowpack.SingleSignOn.DemoInstance/Private/Fixtures/DemoClient.key, exiting.'); $this->quit(2); } $clientPublicKeyFingerprint = $this->rsaWalletService->registerKeyPairFromPrivateKeyString($clientPrivateKeyString); $this->outputLine('Registered demo client key pair'); $globalSettings = $this->yamlSource->load(FLOW_PATH_CONFIGURATION . '/Settings'); $globalSettings['Flowpack']['SingleSignOn']['Client']['client']['publicKeyFingerprint'] = $clientPublicKeyFingerprint; $globalSettings['Flowpack']['SingleSignOn']['Client']['server']['DemoServer']['publicKeyFingerprint'] = $serverPublicKeyFingerprint; $this->yamlSource->save(FLOW_PATH_CONFIGURATION . '/Settings', $globalSettings); $this->outputLine('Updated settings'); }
php
public function setupCommand() { $serverPublicKeyString = Files::getFileContents('resource://Flowpack.SingleSignOn.DemoInstance/Private/Fixtures/DemoServer.pub', FILE_TEXT); if ($serverPublicKeyString === FALSE) { $this->outputLine('Could not open resource://Flowpack.SingleSignOn.DemoInstance/Private/Fixtures/DemoServer.pub, exiting.'); $this->quit(1); } $serverPublicKeyFingerprint = $this->rsaWalletService->registerPublicKeyFromString($serverPublicKeyString); $this->outputLine('Registered sso demo server public key'); $clientPrivateKeyString = Files::getFileContents('resource://Flowpack.SingleSignOn.DemoInstance/Private/Fixtures/DemoClient.key', FILE_TEXT); if ($clientPrivateKeyString === FALSE) { $this->outputLine('Could not open resource://Flowpack.SingleSignOn.DemoInstance/Private/Fixtures/DemoClient.key, exiting.'); $this->quit(2); } $clientPublicKeyFingerprint = $this->rsaWalletService->registerKeyPairFromPrivateKeyString($clientPrivateKeyString); $this->outputLine('Registered demo client key pair'); $globalSettings = $this->yamlSource->load(FLOW_PATH_CONFIGURATION . '/Settings'); $globalSettings['Flowpack']['SingleSignOn']['Client']['client']['publicKeyFingerprint'] = $clientPublicKeyFingerprint; $globalSettings['Flowpack']['SingleSignOn']['Client']['server']['DemoServer']['publicKeyFingerprint'] = $serverPublicKeyFingerprint; $this->yamlSource->save(FLOW_PATH_CONFIGURATION . '/Settings', $globalSettings); $this->outputLine('Updated settings'); }
[ "public", "function", "setupCommand", "(", ")", "{", "$", "serverPublicKeyString", "=", "Files", "::", "getFileContents", "(", "'resource://Flowpack.SingleSignOn.DemoInstance/Private/Fixtures/DemoServer.pub'", ",", "FILE_TEXT", ")", ";", "if", "(", "$", "serverPublicKeyStri...
Set up the SSO demo instance This commands sets a up a single sign-on demo instance with some initial fixture data. It overwrites existing data in the database. ONLY FOR DEMO PURPOSES - DO NOT USE IN PRODUCTION!
[ "Set", "up", "the", "SSO", "demo", "instance" ]
a3de8fef092cec34e2577832576e32b37ca507c5
https://github.com/Flowpack/Flowpack.SingleSignOn.DemoInstance/blob/a3de8fef092cec34e2577832576e32b37ca507c5/Classes/Flowpack/SingleSignOn/DemoInstance/Command/DemoCommandController.php#L39-L63
236,828
dronemill/eventsocket-client-php
src/Client.php
Client.recv
public function recv() { // receive a message from the socket $message = $this->ws->receive(); // is the message is empty? if (empty($message)) { return; } // decode the message (json_decode + error checking) $message = $this->decodeMessage($message); // injest and route the message $this->injest($message); }
php
public function recv() { // receive a message from the socket $message = $this->ws->receive(); // is the message is empty? if (empty($message)) { return; } // decode the message (json_decode + error checking) $message = $this->decodeMessage($message); // injest and route the message $this->injest($message); }
[ "public", "function", "recv", "(", ")", "{", "// receive a message from the socket", "$", "message", "=", "$", "this", "->", "ws", "->", "receive", "(", ")", ";", "// is the message is empty?", "if", "(", "empty", "(", "$", "message", ")", ")", "{", "return"...
Receive a message from the socket @return void
[ "Receive", "a", "message", "from", "the", "socket" ]
3e10af53e732432f7974eea5168e8b34817defc1
https://github.com/dronemill/eventsocket-client-php/blob/3e10af53e732432f7974eea5168e8b34817defc1/src/Client.php#L118-L134
236,829
dronemill/eventsocket-client-php
src/Client.php
Client.suscribe
public function suscribe($events, Closure $handler) { if (is_string($events)) $events = [$events]; // store the handler for each of the events it represents foreach ($events as $event) { // check that we have a place to store the handler if (! array_key_exists($event, $this->handlers[static::MESSAGE_TYPE_STANDARD])) { $this->handlers[static::MESSAGE_TYPE_STANDARD][$event] = []; } $this->handlers[static::MESSAGE_TYPE_STANDARD][$event][] = $handler; } // create a new bare message, and store the events $m = $this->bareMessage(static::MESSAGE_TYPE_SUSCRIBE); $m->Payload['Events'] = $events; // finally, send the message $this->send($m); }
php
public function suscribe($events, Closure $handler) { if (is_string($events)) $events = [$events]; // store the handler for each of the events it represents foreach ($events as $event) { // check that we have a place to store the handler if (! array_key_exists($event, $this->handlers[static::MESSAGE_TYPE_STANDARD])) { $this->handlers[static::MESSAGE_TYPE_STANDARD][$event] = []; } $this->handlers[static::MESSAGE_TYPE_STANDARD][$event][] = $handler; } // create a new bare message, and store the events $m = $this->bareMessage(static::MESSAGE_TYPE_SUSCRIBE); $m->Payload['Events'] = $events; // finally, send the message $this->send($m); }
[ "public", "function", "suscribe", "(", "$", "events", ",", "Closure", "$", "handler", ")", "{", "if", "(", "is_string", "(", "$", "events", ")", ")", "$", "events", "=", "[", "$", "events", "]", ";", "// store the handler for each of the events it represents",...
Suscribe to a given event @param string|[] $event the event to suscribe to @param Closure $handler the event handler to be called upon receiving of the event @return void
[ "Suscribe", "to", "a", "given", "event" ]
3e10af53e732432f7974eea5168e8b34817defc1
https://github.com/dronemill/eventsocket-client-php/blob/3e10af53e732432f7974eea5168e8b34817defc1/src/Client.php#L144-L166
236,830
dronemill/eventsocket-client-php
src/Client.php
Client.reply
public function reply($requestId, $replyClientId, Array $payload) { $m = $this->bareMessage(static::MESSAGE_TYPE_REPLY); $m->ReplyClientId = $replyClientId; $m->RequestId = $requestId; $m->Payload = $payload; $this->send($m); }
php
public function reply($requestId, $replyClientId, Array $payload) { $m = $this->bareMessage(static::MESSAGE_TYPE_REPLY); $m->ReplyClientId = $replyClientId; $m->RequestId = $requestId; $m->Payload = $payload; $this->send($m); }
[ "public", "function", "reply", "(", "$", "requestId", ",", "$", "replyClientId", ",", "Array", "$", "payload", ")", "{", "$", "m", "=", "$", "this", "->", "bareMessage", "(", "static", "::", "MESSAGE_TYPE_REPLY", ")", ";", "$", "m", "->", "ReplyClientId"...
Reply to a given request @param $string $requestId the id of the request to reply to @param $string $replyClientId the client to reply to @param Array $payload the payload to send @return void
[ "Reply", "to", "a", "given", "request" ]
3e10af53e732432f7974eea5168e8b34817defc1
https://github.com/dronemill/eventsocket-client-php/blob/3e10af53e732432f7974eea5168e8b34817defc1/src/Client.php#L176-L184
236,831
dronemill/eventsocket-client-php
src/Client.php
Client.request
public function request($requestClientId, Array $payload, Closure $handler) { // generate a new requestId $requestId = $this->uuid(); // store the handler $this->handlers[static::MESSAGE_TYPE_REPLY][$requestId] = $handler; $m = $this->bareMessage(static::MESSAGE_TYPE_REQUEST); $m->RequestClientId = $requestClientId; $m->RequestId = $requestId; $m->Payload = $payload; $this->send($m); }
php
public function request($requestClientId, Array $payload, Closure $handler) { // generate a new requestId $requestId = $this->uuid(); // store the handler $this->handlers[static::MESSAGE_TYPE_REPLY][$requestId] = $handler; $m = $this->bareMessage(static::MESSAGE_TYPE_REQUEST); $m->RequestClientId = $requestClientId; $m->RequestId = $requestId; $m->Payload = $payload; $this->send($m); }
[ "public", "function", "request", "(", "$", "requestClientId", ",", "Array", "$", "payload", ",", "Closure", "$", "handler", ")", "{", "// generate a new requestId", "$", "requestId", "=", "$", "this", "->", "uuid", "(", ")", ";", "// store the handler", "$", ...
Make a request to a client @param string $requestClientId the client to send the request to @param Array $payload the payload to send to the client @param Closure $handler the reply handler @return void
[ "Make", "a", "request", "to", "a", "client" ]
3e10af53e732432f7974eea5168e8b34817defc1
https://github.com/dronemill/eventsocket-client-php/blob/3e10af53e732432f7974eea5168e8b34817defc1/src/Client.php#L194-L208
236,832
dronemill/eventsocket-client-php
src/Client.php
Client.emit
public function emit($event, Array $payload) { $m = $this->bareMessage(static::MESSAGE_TYPE_STANDARD); $m->Event = $event; $m->Payload = $payload; $this->send($m); }
php
public function emit($event, Array $payload) { $m = $this->bareMessage(static::MESSAGE_TYPE_STANDARD); $m->Event = $event; $m->Payload = $payload; $this->send($m); }
[ "public", "function", "emit", "(", "$", "event", ",", "Array", "$", "payload", ")", "{", "$", "m", "=", "$", "this", "->", "bareMessage", "(", "static", "::", "MESSAGE_TYPE_STANDARD", ")", ";", "$", "m", "->", "Event", "=", "$", "event", ";", "$", ...
Emit a given event @param string $event the event to event to @param Array $payload the payload to send @return void
[ "Emit", "a", "given", "event" ]
3e10af53e732432f7974eea5168e8b34817defc1
https://github.com/dronemill/eventsocket-client-php/blob/3e10af53e732432f7974eea5168e8b34817defc1/src/Client.php#L217-L224
236,833
dronemill/eventsocket-client-php
src/Client.php
Client.serverRequest
protected function serverRequest($path, $context) { if (strpos($path, '/') === 0) { $path = substr($path, 1); } $url = sprintf('http://%s/%s', $this->serverUrl, $path); $context = stream_context_create($context); $result = @file_get_contents($url, false, $context); if ($result === false) { throw new ClientException('Failed connecting to ' . $url); } if (($result = json_decode($result)) === false) { throw new ClientException("Failed decoding json response from server"); } if (empty($result)) { throw new ClientException("Did not receive a valid client instance"); } return $result; }
php
protected function serverRequest($path, $context) { if (strpos($path, '/') === 0) { $path = substr($path, 1); } $url = sprintf('http://%s/%s', $this->serverUrl, $path); $context = stream_context_create($context); $result = @file_get_contents($url, false, $context); if ($result === false) { throw new ClientException('Failed connecting to ' . $url); } if (($result = json_decode($result)) === false) { throw new ClientException("Failed decoding json response from server"); } if (empty($result)) { throw new ClientException("Did not receive a valid client instance"); } return $result; }
[ "protected", "function", "serverRequest", "(", "$", "path", ",", "$", "context", ")", "{", "if", "(", "strpos", "(", "$", "path", ",", "'/'", ")", "===", "0", ")", "{", "$", "path", "=", "substr", "(", "$", "path", ",", "1", ")", ";", "}", "$",...
Execute a request against the server @param string $path the server path @param array $context contextual array for stream_context_create @return stdClass the decoded json body
[ "Execute", "a", "request", "against", "the", "server" ]
3e10af53e732432f7974eea5168e8b34817defc1
https://github.com/dronemill/eventsocket-client-php/blob/3e10af53e732432f7974eea5168e8b34817defc1/src/Client.php#L286-L314
236,834
dronemill/eventsocket-client-php
src/Client.php
Client.connectWs
protected function connectWs() { $wsUrl = sprintf('ws://%s/v1/clients/%s/ws', $this->serverUrl, $this->getId()); $this->ws = new WebsocketClient($wsUrl, ['timeout' => 30]); $this->ws->setTimeout(30); }
php
protected function connectWs() { $wsUrl = sprintf('ws://%s/v1/clients/%s/ws', $this->serverUrl, $this->getId()); $this->ws = new WebsocketClient($wsUrl, ['timeout' => 30]); $this->ws->setTimeout(30); }
[ "protected", "function", "connectWs", "(", ")", "{", "$", "wsUrl", "=", "sprintf", "(", "'ws://%s/v1/clients/%s/ws'", ",", "$", "this", "->", "serverUrl", ",", "$", "this", "->", "getId", "(", ")", ")", ";", "$", "this", "->", "ws", "=", "new", "Websoc...
Open the websocket connection to the eventsocket server @return void
[ "Open", "the", "websocket", "connection", "to", "the", "eventsocket", "server" ]
3e10af53e732432f7974eea5168e8b34817defc1
https://github.com/dronemill/eventsocket-client-php/blob/3e10af53e732432f7974eea5168e8b34817defc1/src/Client.php#L321-L327
236,835
dronemill/eventsocket-client-php
src/Client.php
Client.bareMessage
protected function bareMessage($type) { $m = [ 'MessageType' => $type, 'Event' => null, 'RequestId' => null, 'ReplyClientId' => null, 'RequestClientId' => null, 'Payload' => [], 'Error' => null, ]; return (object) $m; }
php
protected function bareMessage($type) { $m = [ 'MessageType' => $type, 'Event' => null, 'RequestId' => null, 'ReplyClientId' => null, 'RequestClientId' => null, 'Payload' => [], 'Error' => null, ]; return (object) $m; }
[ "protected", "function", "bareMessage", "(", "$", "type", ")", "{", "$", "m", "=", "[", "'MessageType'", "=>", "$", "type", ",", "'Event'", "=>", "null", ",", "'RequestId'", "=>", "null", ",", "'ReplyClientId'", "=>", "null", ",", "'RequestClientId'", "=>"...
Instantiate a new message @param int $type the message tyoe @return stdClass the new instance
[ "Instantiate", "a", "new", "message" ]
3e10af53e732432f7974eea5168e8b34817defc1
https://github.com/dronemill/eventsocket-client-php/blob/3e10af53e732432f7974eea5168e8b34817defc1/src/Client.php#L367-L380
236,836
dronemill/eventsocket-client-php
src/Client.php
Client.send
protected function send($message) { $message = $this->encodeMessage($message); $this->ws->send($message); }
php
protected function send($message) { $message = $this->encodeMessage($message); $this->ws->send($message); }
[ "protected", "function", "send", "(", "$", "message", ")", "{", "$", "message", "=", "$", "this", "->", "encodeMessage", "(", "$", "message", ")", ";", "$", "this", "->", "ws", "->", "send", "(", "$", "message", ")", ";", "}" ]
Send a Message @param string $message the message to send @return void
[ "Send", "a", "Message" ]
3e10af53e732432f7974eea5168e8b34817defc1
https://github.com/dronemill/eventsocket-client-php/blob/3e10af53e732432f7974eea5168e8b34817defc1/src/Client.php#L388-L392
236,837
dronemill/eventsocket-client-php
src/Client.php
Client.injest
protected function injest($message) { switch($message->MessageType) { case static::MESSAGE_TYPE_BROADCAST: $this->handleBroadcast($message); break; case static::MESSAGE_TYPE_STANDARD: $this->handleStandard($message); break; case static::MESSAGE_TYPE_REQUEST: $this->handleRequest($message); break; case static::MESSAGE_TYPE_REPLY: $this->handleReply($message); break; default: throw new ClientException('Unknown MessageType: ' . var_export($message->MessageType, true)); } }
php
protected function injest($message) { switch($message->MessageType) { case static::MESSAGE_TYPE_BROADCAST: $this->handleBroadcast($message); break; case static::MESSAGE_TYPE_STANDARD: $this->handleStandard($message); break; case static::MESSAGE_TYPE_REQUEST: $this->handleRequest($message); break; case static::MESSAGE_TYPE_REPLY: $this->handleReply($message); break; default: throw new ClientException('Unknown MessageType: ' . var_export($message->MessageType, true)); } }
[ "protected", "function", "injest", "(", "$", "message", ")", "{", "switch", "(", "$", "message", "->", "MessageType", ")", "{", "case", "static", "::", "MESSAGE_TYPE_BROADCAST", ":", "$", "this", "->", "handleBroadcast", "(", "$", "message", ")", ";", "bre...
Injest, and route an incomming message @param stdClass $message the incomming message @return void
[ "Injest", "and", "route", "an", "incomming", "message" ]
3e10af53e732432f7974eea5168e8b34817defc1
https://github.com/dronemill/eventsocket-client-php/blob/3e10af53e732432f7974eea5168e8b34817defc1/src/Client.php#L400-L419
236,838
dronemill/eventsocket-client-php
src/Client.php
Client.handleReply
protected function handleReply($message) { // if we dont have a handler for this request, then something is wrong if (!array_key_exists($message->RequestId, $this->handlers[static::MESSAGE_TYPE_REPLY])) { throw new ClientException("Request handler not found"); } // handle the event $this->handlers[static::MESSAGE_TYPE_REPLY][$message->RequestId]($message); // cleanup the handler, as it is no longer needed unset($this->handlers[static::MESSAGE_TYPE_REPLY][$message->RequestId]); }
php
protected function handleReply($message) { // if we dont have a handler for this request, then something is wrong if (!array_key_exists($message->RequestId, $this->handlers[static::MESSAGE_TYPE_REPLY])) { throw new ClientException("Request handler not found"); } // handle the event $this->handlers[static::MESSAGE_TYPE_REPLY][$message->RequestId]($message); // cleanup the handler, as it is no longer needed unset($this->handlers[static::MESSAGE_TYPE_REPLY][$message->RequestId]); }
[ "protected", "function", "handleReply", "(", "$", "message", ")", "{", "// if we dont have a handler for this request, then something is wrong", "if", "(", "!", "array_key_exists", "(", "$", "message", "->", "RequestId", ",", "$", "this", "->", "handlers", "[", "stati...
Handle an incomming reply @param stdClass $message the request message @return void
[ "Handle", "an", "incomming", "reply" ]
3e10af53e732432f7974eea5168e8b34817defc1
https://github.com/dronemill/eventsocket-client-php/blob/3e10af53e732432f7974eea5168e8b34817defc1/src/Client.php#L478-L491
236,839
lasallecrm/lasallecrm-l5-lasallecrmapi-pkg
src/Repositories/BaseRepository.php
BaseRepository.getFirstWorkEmail
public function getFirstWorkEmail($id) { $people = $this->model->findOrfail($id); // The first email that is type "work" foreach ($people->email as $email) { if ($email->email_type_id == 3) { return $email->title; } } return "there is no email address"; }
php
public function getFirstWorkEmail($id) { $people = $this->model->findOrfail($id); // The first email that is type "work" foreach ($people->email as $email) { if ($email->email_type_id == 3) { return $email->title; } } return "there is no email address"; }
[ "public", "function", "getFirstWorkEmail", "(", "$", "id", ")", "{", "$", "people", "=", "$", "this", "->", "model", "->", "findOrfail", "(", "$", "id", ")", ";", "// The first email that is type \"work\"", "foreach", "(", "$", "people", "->", "email", "as",...
Get the first work email found for a specific People ID @param int $id PeopleID @return text
[ "Get", "the", "first", "work", "email", "found", "for", "a", "specific", "People", "ID" ]
6ef0eb3a9158fd2bc31b0aa570d94eddb96e10cb
https://github.com/lasallecrm/lasallecrm-l5-lasallecrmapi-pkg/blob/6ef0eb3a9158fd2bc31b0aa570d94eddb96e10cb/src/Repositories/BaseRepository.php#L118-L131
236,840
lasallecrm/lasallecrm-l5-lasallecrmapi-pkg
src/Repositories/BaseRepository.php
BaseRepository.getFirstWorkTelephone
public function getFirstWorkTelephone($id) { $people = $this->model->findOrfail($id); // The first telephone number that is they type "work" foreach ($people->telephone as $telephone) { if ($telephone->telephone_type_id == 1) { return $telephone->title; } } return "there is no telephone number"; }
php
public function getFirstWorkTelephone($id) { $people = $this->model->findOrfail($id); // The first telephone number that is they type "work" foreach ($people->telephone as $telephone) { if ($telephone->telephone_type_id == 1) { return $telephone->title; } } return "there is no telephone number"; }
[ "public", "function", "getFirstWorkTelephone", "(", "$", "id", ")", "{", "$", "people", "=", "$", "this", "->", "model", "->", "findOrfail", "(", "$", "id", ")", ";", "// The first telephone number that is they type \"work\"", "foreach", "(", "$", "people", "->"...
Get the first work telephone number found for a specific People ID @param int $id PeopleID @return text
[ "Get", "the", "first", "work", "telephone", "number", "found", "for", "a", "specific", "People", "ID" ]
6ef0eb3a9158fd2bc31b0aa570d94eddb96e10cb
https://github.com/lasallecrm/lasallecrm-l5-lasallecrmapi-pkg/blob/6ef0eb3a9158fd2bc31b0aa570d94eddb96e10cb/src/Repositories/BaseRepository.php#L140-L153
236,841
xinc-develop/xinc-core
src/Engine/Base.php
Base.setupBuildProperties
protected function setupBuildProperties(BuildInterface $build) { $project = $build->getProject(); $build->setProperty('project.name', $project->getName()); $build->setProperty('build.number', $build->getNumber()); $build->setProperty('build.label', $build->getLabel()); }
php
protected function setupBuildProperties(BuildInterface $build) { $project = $build->getProject(); $build->setProperty('project.name', $project->getName()); $build->setProperty('build.number', $build->getNumber()); $build->setProperty('build.label', $build->getLabel()); }
[ "protected", "function", "setupBuildProperties", "(", "BuildInterface", "$", "build", ")", "{", "$", "project", "=", "$", "build", "->", "getProject", "(", ")", ";", "$", "build", "->", "setProperty", "(", "'project.name'", ",", "$", "project", "->", "getNam...
copies some basic informations to the build object. @param Xinc::Core::Build::BuildInterface
[ "copies", "some", "basic", "informations", "to", "the", "build", "object", "." ]
4bb69a6afe19e1186950a3122cbfe0989823e0d6
https://github.com/xinc-develop/xinc-core/blob/4bb69a6afe19e1186950a3122cbfe0989823e0d6/src/Engine/Base.php#L81-L87
236,842
xinc-develop/xinc-core
src/Engine/Base.php
Base.validateTask
protected function validateTask($taskObject) { try { if (!$taskObject->validate($msg)) { $this->log->warn("Task {$taskObject->getName()} is invalid.". ($msg ? "\nError message: $msg" : '') ); return false; } return true; } catch (MalformedConfigException $e) { $this->log->error("Error in task {$taskObject->getName()} configuration: ". $e->getMessage() ); return false; } }
php
protected function validateTask($taskObject) { try { if (!$taskObject->validate($msg)) { $this->log->warn("Task {$taskObject->getName()} is invalid.". ($msg ? "\nError message: $msg" : '') ); return false; } return true; } catch (MalformedConfigException $e) { $this->log->error("Error in task {$taskObject->getName()} configuration: ". $e->getMessage() ); return false; } }
[ "protected", "function", "validateTask", "(", "$", "taskObject", ")", "{", "try", "{", "if", "(", "!", "$", "taskObject", "->", "validate", "(", "$", "msg", ")", ")", "{", "$", "this", "->", "log", "->", "warn", "(", "\"Task {$taskObject->getName()} is inv...
Calls the validate method of a task.
[ "Calls", "the", "validate", "method", "of", "a", "task", "." ]
4bb69a6afe19e1186950a3122cbfe0989823e0d6
https://github.com/xinc-develop/xinc-core/blob/4bb69a6afe19e1186950a3122cbfe0989823e0d6/src/Engine/Base.php#L138-L157
236,843
aedart/model
src/Traits/Strings/NicknameTrait.php
NickNameTrait.getNickName
public function getNickName() : ?string { if ( ! $this->hasNickName()) { $this->setNickName($this->getDefaultNickName()); } return $this->nickName; }
php
public function getNickName() : ?string { if ( ! $this->hasNickName()) { $this->setNickName($this->getDefaultNickName()); } return $this->nickName; }
[ "public", "function", "getNickName", "(", ")", ":", "?", "string", "{", "if", "(", "!", "$", "this", "->", "hasNickName", "(", ")", ")", "{", "$", "this", "->", "setNickName", "(", "$", "this", "->", "getDefaultNickName", "(", ")", ")", ";", "}", "...
Get nick name If no "nick name" value has been set, this method will set and return a default "nick name" value, if any such value is available @see getDefaultNickName() @return string|null nick name or null if no nick name has been set
[ "Get", "nick", "name" ]
9a562c1c53a276d01ace0ab71f5305458bea542f
https://github.com/aedart/model/blob/9a562c1c53a276d01ace0ab71f5305458bea542f/src/Traits/Strings/NicknameTrait.php#L48-L54
236,844
Archi-Strasbourg/archi-wiki
includes/framework/frameworkClasses/ongletObject.class.php
OngletObject.init
function init($idBuilder="0", $tabOnglets=array()) { $this->ongletsArray=$tabOnglets; $this->typeOngletsArray=array(); $this->optionsOngletParType = array(); $this->idOngletBuilder=$idBuilder; $this->largeurTotale=680; $this->largeurEtiquette=150; $this->numOngletSelected=0; $this->champHiddenCourant=""; $this->isContours = true; $this->isAncreOnglet = true; $this->isSpaceInLibelle = true; $this->styleContenu = ""; }
php
function init($idBuilder="0", $tabOnglets=array()) { $this->ongletsArray=$tabOnglets; $this->typeOngletsArray=array(); $this->optionsOngletParType = array(); $this->idOngletBuilder=$idBuilder; $this->largeurTotale=680; $this->largeurEtiquette=150; $this->numOngletSelected=0; $this->champHiddenCourant=""; $this->isContours = true; $this->isAncreOnglet = true; $this->isSpaceInLibelle = true; $this->styleContenu = ""; }
[ "function", "init", "(", "$", "idBuilder", "=", "\"0\"", ",", "$", "tabOnglets", "=", "array", "(", ")", ")", "{", "$", "this", "->", "ongletsArray", "=", "$", "tabOnglets", ";", "$", "this", "->", "typeOngletsArray", "=", "array", "(", ")", ";", "$"...
Pour PHP 4 @param string $idBuilder ? @param array $tabOnglets ? @return void
[ "Pour", "PHP", "4" ]
b9fb39f43a78409890a7de96426c1f6c49d5c323
https://github.com/Archi-Strasbourg/archi-wiki/blob/b9fb39f43a78409890a7de96426c1f6c49d5c323/includes/framework/frameworkClasses/ongletObject.class.php#L81-L95
236,845
Archi-Strasbourg/archi-wiki
includes/framework/frameworkClasses/ongletObject.class.php
OngletObject.addContent
function addContent( $ongletName="default", $content="", $isSelected=false, $type="default", $optionsParType="" ) { $this->ongletsArray[$ongletName]=$content; $this->typeOngletsArray[$ongletName]=$type; $this->optionsOngletParType[$ongletName]=$optionsParType; $this->listeOngletJSNameArray[]=$this->convertIntituleOnglet($ongletName). (count($this->ongletsArray)-1).$this->idOngletBuilder; if ($isSelected && count($this->ongletsArray)>0) { $this->numOngletSelected=count($this->ongletsArray)-1; } }
php
function addContent( $ongletName="default", $content="", $isSelected=false, $type="default", $optionsParType="" ) { $this->ongletsArray[$ongletName]=$content; $this->typeOngletsArray[$ongletName]=$type; $this->optionsOngletParType[$ongletName]=$optionsParType; $this->listeOngletJSNameArray[]=$this->convertIntituleOnglet($ongletName). (count($this->ongletsArray)-1).$this->idOngletBuilder; if ($isSelected && count($this->ongletsArray)>0) { $this->numOngletSelected=count($this->ongletsArray)-1; } }
[ "function", "addContent", "(", "$", "ongletName", "=", "\"default\"", ",", "$", "content", "=", "\"\"", ",", "$", "isSelected", "=", "false", ",", "$", "type", "=", "\"default\"", ",", "$", "optionsParType", "=", "\"\"", ")", "{", "$", "this", "->", "o...
Ajoute du contenu @param string $ongletName Nom de l'onglet @param string $content Contenu @param bool $isSelected L'onglet est-il sélectionné ? @param string $type Type @param string $optionsParType ? @return void
[ "Ajoute", "du", "contenu" ]
b9fb39f43a78409890a7de96426c1f6c49d5c323
https://github.com/Archi-Strasbourg/archi-wiki/blob/b9fb39f43a78409890a7de96426c1f6c49d5c323/includes/framework/frameworkClasses/ongletObject.class.php#L108-L121
236,846
Archi-Strasbourg/archi-wiki
includes/framework/frameworkClasses/ongletObject.class.php
OngletObject.getHTMLNoDiv
function getHTMLNoDiv() { $html=""; if ($this->getCountOnglets()>0) { /* * Assignation des styles en dur : a changer à terme, * les styles sont les memes que pour le site en ligne * => a ajouter dans la feuille de style * */ if (isset($this->stylesOnglets) && $this->stylesOnglets!='') { $html=$this->stylesOnglets; } $html.="<table width='".$this->largeurTotale. "' cellspacing=0 cellpadding=0 border=0><tr><td>"; $html.="<a name='onglet'></a>"; $html.="<table cellspacing=0 cellpadding=0 border=0><tr>"; // construction du tableau contenant les intitules $i=0; foreach ($this->ongletsArray as $fieldName => $fieldValue) { $className='OngletOff'; if ($i==$this->numOngletSelected) { $className='OngletOn'; } $html.="<td height='25' width='".$this->largeurEtiquette. "' class='".$className. "' style='border-left:1px solid #000000;'>&nbsp;&nbsp;&nbsp;"; /* * Lien le champs hiddenCourant est un champs cache du formulaire * permettant de stocker l'onglet actif courant * */ /*if ($this->champHiddenCourant<>"") { $html.="document.getElementById('".$this->champHiddenCourant."'). * value='".$i."';"; } */ $html.=$fieldName."&nbsp;&nbsp;&nbsp;</td><td width='4' ". "style='border-bottom:1px solid #000000;'>&nbsp</td>"; $i++; } $styleContenu = ""; if (isset($this->styleContenu)) { $styleContenu = $this->styleContenu; } $html.="<td width='". ( $this->largeurTotale - ($i * ($this->largeurEtiquette+4))). "' style='border-bottom:1px solid #000000;'>&nbsp;</td>"; $html.="</tr></table></td></tr><tr><td ". "style='border-left:1px solid #000000;border-right:1px solid #000000;". "border-bottom:1px solid #000000;padding:5px;".$styleContenu."'>"; // construction des contenus $i=0; foreach ($this->ongletsArray as $fieldName => $fieldValue) { if ($i==$this->numOngletSelected) { // cas ou il n'y a pas de photo dans la liste $html.=$fieldValue; } $i++; } $html.="</td></tr></table>"; } return $html; }
php
function getHTMLNoDiv() { $html=""; if ($this->getCountOnglets()>0) { /* * Assignation des styles en dur : a changer à terme, * les styles sont les memes que pour le site en ligne * => a ajouter dans la feuille de style * */ if (isset($this->stylesOnglets) && $this->stylesOnglets!='') { $html=$this->stylesOnglets; } $html.="<table width='".$this->largeurTotale. "' cellspacing=0 cellpadding=0 border=0><tr><td>"; $html.="<a name='onglet'></a>"; $html.="<table cellspacing=0 cellpadding=0 border=0><tr>"; // construction du tableau contenant les intitules $i=0; foreach ($this->ongletsArray as $fieldName => $fieldValue) { $className='OngletOff'; if ($i==$this->numOngletSelected) { $className='OngletOn'; } $html.="<td height='25' width='".$this->largeurEtiquette. "' class='".$className. "' style='border-left:1px solid #000000;'>&nbsp;&nbsp;&nbsp;"; /* * Lien le champs hiddenCourant est un champs cache du formulaire * permettant de stocker l'onglet actif courant * */ /*if ($this->champHiddenCourant<>"") { $html.="document.getElementById('".$this->champHiddenCourant."'). * value='".$i."';"; } */ $html.=$fieldName."&nbsp;&nbsp;&nbsp;</td><td width='4' ". "style='border-bottom:1px solid #000000;'>&nbsp</td>"; $i++; } $styleContenu = ""; if (isset($this->styleContenu)) { $styleContenu = $this->styleContenu; } $html.="<td width='". ( $this->largeurTotale - ($i * ($this->largeurEtiquette+4))). "' style='border-bottom:1px solid #000000;'>&nbsp;</td>"; $html.="</tr></table></td></tr><tr><td ". "style='border-left:1px solid #000000;border-right:1px solid #000000;". "border-bottom:1px solid #000000;padding:5px;".$styleContenu."'>"; // construction des contenus $i=0; foreach ($this->ongletsArray as $fieldName => $fieldValue) { if ($i==$this->numOngletSelected) { // cas ou il n'y a pas de photo dans la liste $html.=$fieldValue; } $i++; } $html.="</td></tr></table>"; } return $html; }
[ "function", "getHTMLNoDiv", "(", ")", "{", "$", "html", "=", "\"\"", ";", "if", "(", "$", "this", "->", "getCountOnglets", "(", ")", ">", "0", ")", "{", "/*\n * Assignation des styles en dur : a changer à terme,\n * les styles sont les memes que po...
Si on affiche les onglets avec cette fonction, c'est un fonctionnement different, le contenu n'est pas dans les divs, et les liens sur les onglets sont des url initialisation : init(0) addContent("onglet1", "texte onglet1", true) Ddans le contenu de l'onglet selectionné on ne va mettre que le code de l'onglet addContent("onglet2", "<a href='onglet2'>onglet2</a>", false) Dans l'onglet qui n'est pas selectionné, on met un lien vers la page contenant le code html de l'onglet @return string HTML
[ "Si", "on", "affiche", "les", "onglets", "avec", "cette", "fonction", "c", "est", "un", "fonctionnement", "different", "le", "contenu", "n", "est", "pas", "dans", "les", "divs", "et", "les", "liens", "sur", "les", "onglets", "sont", "des", "url" ]
b9fb39f43a78409890a7de96426c1f6c49d5c323
https://github.com/Archi-Strasbourg/archi-wiki/blob/b9fb39f43a78409890a7de96426c1f6c49d5c323/includes/framework/frameworkClasses/ongletObject.class.php#L213-L284
236,847
jetwaves/edit-array-in-file
src/EditArrayInFileEditor.php
Editor.find
public function find($keyword, $comp = null, $type = self::FIND_TYPE_KEY_ONLY){ $this->_targetLineNumber = null; $items = $this->getTargetLines(); foreach ($items as $lineNumber => $line){ $line = trim(trim($line),','); $arr = explode('=>', $line); foreach ($arr as $idx => $item){ $arr[$idx] = trim($item); } $key = $arr[0]; if(count($arr)>1){ $val = $arr[1]; } else{ $val = $arr[0]; } $key = str_replace("'","", $key); $val = str_replace("'","", $val); // echo ' '.__method__.'() line:'.__line__.' $key = '.print_r($key, true).PHP_EOL; // echo ' '.__method__.'() line:'.__line__.' $val = '.print_r($val, true).PHP_EOL; $ret = null; switch ($type){ case self::FIND_TYPE_ALL: if($key == $keyword || $val == $comp ){ $this->_targetLineNumber = $lineNumber; return $val; } break; case self::FIND_TYPE_KEY_ONLY: if($key == $keyword){ $this->_targetLineNumber = $lineNumber; return $val; } break; case self::FIND_TYPE_VALUE_ONLY: if($val == $keyword){ $this->_targetLineNumber = $lineNumber; return $val; } break; } } return null; }
php
public function find($keyword, $comp = null, $type = self::FIND_TYPE_KEY_ONLY){ $this->_targetLineNumber = null; $items = $this->getTargetLines(); foreach ($items as $lineNumber => $line){ $line = trim(trim($line),','); $arr = explode('=>', $line); foreach ($arr as $idx => $item){ $arr[$idx] = trim($item); } $key = $arr[0]; if(count($arr)>1){ $val = $arr[1]; } else{ $val = $arr[0]; } $key = str_replace("'","", $key); $val = str_replace("'","", $val); // echo ' '.__method__.'() line:'.__line__.' $key = '.print_r($key, true).PHP_EOL; // echo ' '.__method__.'() line:'.__line__.' $val = '.print_r($val, true).PHP_EOL; $ret = null; switch ($type){ case self::FIND_TYPE_ALL: if($key == $keyword || $val == $comp ){ $this->_targetLineNumber = $lineNumber; return $val; } break; case self::FIND_TYPE_KEY_ONLY: if($key == $keyword){ $this->_targetLineNumber = $lineNumber; return $val; } break; case self::FIND_TYPE_VALUE_ONLY: if($val == $keyword){ $this->_targetLineNumber = $lineNumber; return $val; } break; } } return null; }
[ "public", "function", "find", "(", "$", "keyword", ",", "$", "comp", "=", "null", ",", "$", "type", "=", "self", "::", "FIND_TYPE_KEY_ONLY", ")", "{", "$", "this", "->", "_targetLineNumber", "=", "null", ";", "$", "items", "=", "$", "this", "->", "ge...
if the target array contains a key or value
[ "if", "the", "target", "array", "contains", "a", "key", "or", "value" ]
37bd60a7559c3c83e5d2f1fb080571b8cd0319dc
https://github.com/jetwaves/edit-array-in-file/blob/37bd60a7559c3c83e5d2f1fb080571b8cd0319dc/src/EditArrayInFileEditor.php#L139-L182
236,848
jetwaves/edit-array-in-file
src/EditArrayInFileEditor.php
Editor.save
public function save(){ $this->_contentArray = array_merge($this->_codesBeforeEditArea, $this->_editArea, $this->_codesAfterEditArea); return $this; }
php
public function save(){ $this->_contentArray = array_merge($this->_codesBeforeEditArea, $this->_editArea, $this->_codesAfterEditArea); return $this; }
[ "public", "function", "save", "(", ")", "{", "$", "this", "->", "_contentArray", "=", "array_merge", "(", "$", "this", "->", "_codesBeforeEditArea", ",", "$", "this", "->", "_editArea", ",", "$", "this", "->", "_codesAfterEditArea", ")", ";", "return", "$"...
reconstruct the complete file in the memory
[ "reconstruct", "the", "complete", "file", "in", "the", "memory" ]
37bd60a7559c3c83e5d2f1fb080571b8cd0319dc
https://github.com/jetwaves/edit-array-in-file/blob/37bd60a7559c3c83e5d2f1fb080571b8cd0319dc/src/EditArrayInFileEditor.php#L301-L304
236,849
webriq/core
module/Tag/src/Grid/Tag/Form/View/Helper/FormTagList.php
FormTagList.getName
protected static function getName( ElementInterface $element ) { $name = $element->getName(); if ( $name === null || $name === '' ) { throw new Exception\DomainException( sprintf( '%s requires that the element has an assigned name; none discovered', __METHOD__ ) ); } return $name . '[]'; }
php
protected static function getName( ElementInterface $element ) { $name = $element->getName(); if ( $name === null || $name === '' ) { throw new Exception\DomainException( sprintf( '%s requires that the element has an assigned name; none discovered', __METHOD__ ) ); } return $name . '[]'; }
[ "protected", "static", "function", "getName", "(", "ElementInterface", "$", "element", ")", "{", "$", "name", "=", "$", "element", "->", "getName", "(", ")", ";", "if", "(", "$", "name", "===", "null", "||", "$", "name", "===", "''", ")", "{", "throw...
Get element name @param ElementInterface $element @throws Exception\DomainException @return string
[ "Get", "element", "name" ]
cfeb6e8a4732561c2215ec94e736c07f9b8bc990
https://github.com/webriq/core/blob/cfeb6e8a4732561c2215ec94e736c07f9b8bc990/module/Tag/src/Grid/Tag/Form/View/Helper/FormTagList.php#L106-L119
236,850
laradic/service-provider
src/Plugins/Commands.php
Commands.startCommandsPlugin
protected function startCommandsPlugin($app) { $this->onRegister('commands', function ($app) { /** @var \Illuminate\Foundation\Application $app */ // Commands if ($app->runningInConsole()) { foreach ($this->findCommands as $path) { $dir = path_get_directory((new ReflectionClass(get_called_class()))->getFileName()); $classes = $this->findCommandsIn(path_join($dir, $path), $this->findCommandsRecursive); $this->commands = array_merge($this->commands, $classes); } if (is_array($this->commands) && count($this->commands) > 0) { $commands = []; foreach ($this->commands as $k => $v) { if (is_string($k)) { $app[ $this->commandPrefix.$k ] = $app->share(function ($app) use ($k, $v) { return $app->build($v); }); $commands[] = $this->commandPrefix.$k; } else { $commands[] = $v; } } $this->commands($commands); } } }); }
php
protected function startCommandsPlugin($app) { $this->onRegister('commands', function ($app) { /** @var \Illuminate\Foundation\Application $app */ // Commands if ($app->runningInConsole()) { foreach ($this->findCommands as $path) { $dir = path_get_directory((new ReflectionClass(get_called_class()))->getFileName()); $classes = $this->findCommandsIn(path_join($dir, $path), $this->findCommandsRecursive); $this->commands = array_merge($this->commands, $classes); } if (is_array($this->commands) && count($this->commands) > 0) { $commands = []; foreach ($this->commands as $k => $v) { if (is_string($k)) { $app[ $this->commandPrefix.$k ] = $app->share(function ($app) use ($k, $v) { return $app->build($v); }); $commands[] = $this->commandPrefix.$k; } else { $commands[] = $v; } } $this->commands($commands); } } }); }
[ "protected", "function", "startCommandsPlugin", "(", "$", "app", ")", "{", "$", "this", "->", "onRegister", "(", "'commands'", ",", "function", "(", "$", "app", ")", "{", "/** @var \\Illuminate\\Foundation\\Application $app */", "// Commands", "if", "(", "$", "app...
startCommandsPlugin method. @param \Illuminate\Foundation\Application $app
[ "startCommandsPlugin", "method", "." ]
b1428d566b97b3662b405c64ff0cad8a89102033
https://github.com/laradic/service-provider/blob/b1428d566b97b3662b405c64ff0cad8a89102033/src/Plugins/Commands.php#L76-L105
236,851
laradic/service-provider
src/Plugins/Commands.php
Commands.findCommandsIn
protected function findCommandsIn($path, $recursive = false) { $classes = []; foreach ($this->findCommandsFiles($path) as $filePath) { //$class = $classFinder->findClass($filePath); $class = Util::getClassNameFromFile($filePath); if ($class !== null) { $namespace = Util::getNamespaceFromFile($filePath); if ($namespace !== null) { $class = "$namespace\\$class"; } $class = Str::removeLeft($class, '\\'); $parents = class_parents($class); if ($this->findCommandsExtending !== null && in_array($this->findCommandsExtending, $parents, true) === false) { continue; } $ref = new \ReflectionClass($class); if ($ref->isAbstract()) { continue; } $classes[] = Str::removeLeft($class, '\\'); } } return $classes; }
php
protected function findCommandsIn($path, $recursive = false) { $classes = []; foreach ($this->findCommandsFiles($path) as $filePath) { //$class = $classFinder->findClass($filePath); $class = Util::getClassNameFromFile($filePath); if ($class !== null) { $namespace = Util::getNamespaceFromFile($filePath); if ($namespace !== null) { $class = "$namespace\\$class"; } $class = Str::removeLeft($class, '\\'); $parents = class_parents($class); if ($this->findCommandsExtending !== null && in_array($this->findCommandsExtending, $parents, true) === false) { continue; } $ref = new \ReflectionClass($class); if ($ref->isAbstract()) { continue; } $classes[] = Str::removeLeft($class, '\\'); } } return $classes; }
[ "protected", "function", "findCommandsIn", "(", "$", "path", ",", "$", "recursive", "=", "false", ")", "{", "$", "classes", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "findCommandsFiles", "(", "$", "path", ")", "as", "$", "filePath", ")", ...
findCommandsIn method. @param $path @param bool $recursive @return array
[ "findCommandsIn", "method", "." ]
b1428d566b97b3662b405c64ff0cad8a89102033
https://github.com/laradic/service-provider/blob/b1428d566b97b3662b405c64ff0cad8a89102033/src/Plugins/Commands.php#L115-L143
236,852
rexxars/joindin-client
library/JoindIn/Client.php
Client.getEventTalks
public function getEventTalks($eventId, array $options = array()) { $talks = $this->runCommand( 'event.talks.get', array('eventId' => $eventId), $options ); return $this->assignIdsFromUri($talks); }
php
public function getEventTalks($eventId, array $options = array()) { $talks = $this->runCommand( 'event.talks.get', array('eventId' => $eventId), $options ); return $this->assignIdsFromUri($talks); }
[ "public", "function", "getEventTalks", "(", "$", "eventId", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "talks", "=", "$", "this", "->", "runCommand", "(", "'event.talks.get'", ",", "array", "(", "'eventId'", "=>", "$", "eventId"...
Get an array of talks for a given event @param array $options Options for this command, see client.json @return array Array of talks
[ "Get", "an", "array", "of", "talks", "for", "a", "given", "event" ]
7508830f787125218e80b93d39d8a1e54d290130
https://github.com/rexxars/joindin-client/blob/7508830f787125218e80b93d39d8a1e54d290130/library/JoindIn/Client.php#L89-L97
236,853
rexxars/joindin-client
library/JoindIn/Client.php
Client.factory
public static function factory($config = array()) { $defaults = array( 'base_url' => self::API_URL, 'version' => 'v2.1', 'command.params' => array( 'command.on_complete' => function($command) { $response = $command->getResult(); // We don't need the meta blocks unset($response['meta']); // If we're down to a single element (events, talks etc) // return only this element if (count($response) == 1) { $command->setResult(reset($response)); } } ) ); $required = array( 'base_url', 'version', ); $config = Collection::fromConfig($config, $defaults, $required); $client = new self($config->get('base_url'), $config); // Attach a service description to the client $description = ServiceDescription::factory(__DIR__ . '/client.json'); $client->setDescription($description); return $client; }
php
public static function factory($config = array()) { $defaults = array( 'base_url' => self::API_URL, 'version' => 'v2.1', 'command.params' => array( 'command.on_complete' => function($command) { $response = $command->getResult(); // We don't need the meta blocks unset($response['meta']); // If we're down to a single element (events, talks etc) // return only this element if (count($response) == 1) { $command->setResult(reset($response)); } } ) ); $required = array( 'base_url', 'version', ); $config = Collection::fromConfig($config, $defaults, $required); $client = new self($config->get('base_url'), $config); // Attach a service description to the client $description = ServiceDescription::factory(__DIR__ . '/client.json'); $client->setDescription($description); return $client; }
[ "public", "static", "function", "factory", "(", "$", "config", "=", "array", "(", ")", ")", "{", "$", "defaults", "=", "array", "(", "'base_url'", "=>", "self", "::", "API_URL", ",", "'version'", "=>", "'v2.1'", ",", "'command.params'", "=>", "array", "(...
Factory method to create a new client. @param array|Collection $config Configuration data @return Client
[ "Factory", "method", "to", "create", "a", "new", "client", "." ]
7508830f787125218e80b93d39d8a1e54d290130
https://github.com/rexxars/joindin-client/blob/7508830f787125218e80b93d39d8a1e54d290130/library/JoindIn/Client.php#L185-L219
236,854
rexxars/joindin-client
library/JoindIn/Client.php
Client.runCommand
protected function runCommand($command, array $defaultOptions = array(), array $options = array()) { $command = $this->getCommand($command, array_merge( $defaultOptions, $options )); $command->execute(); return $command->getResult(); }
php
protected function runCommand($command, array $defaultOptions = array(), array $options = array()) { $command = $this->getCommand($command, array_merge( $defaultOptions, $options )); $command->execute(); return $command->getResult(); }
[ "protected", "function", "runCommand", "(", "$", "command", ",", "array", "$", "defaultOptions", "=", "array", "(", ")", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "command", "=", "$", "this", "->", "getCommand", "(", "$", "...
Run a command by the given name, merging default and passed options @param string $command Name of command to run @param array $defaultOptions Default options for this command @param array $options User-specified options to merge @return mixed
[ "Run", "a", "command", "by", "the", "given", "name", "merging", "default", "and", "passed", "options" ]
7508830f787125218e80b93d39d8a1e54d290130
https://github.com/rexxars/joindin-client/blob/7508830f787125218e80b93d39d8a1e54d290130/library/JoindIn/Client.php#L229-L237
236,855
rexxars/joindin-client
library/JoindIn/Client.php
Client.assignIdsFromUri
protected function assignIdsFromUri($entries) { foreach ($entries as &$entry) { $entry['id'] = (int) preg_replace('#.*?(\d+)$#', '$1', $entry['uri']); } return $entries; }
php
protected function assignIdsFromUri($entries) { foreach ($entries as &$entry) { $entry['id'] = (int) preg_replace('#.*?(\d+)$#', '$1', $entry['uri']); } return $entries; }
[ "protected", "function", "assignIdsFromUri", "(", "$", "entries", ")", "{", "foreach", "(", "$", "entries", "as", "&", "$", "entry", ")", "{", "$", "entry", "[", "'id'", "]", "=", "(", "int", ")", "preg_replace", "(", "'#.*?(\\d+)$#'", ",", "'$1'", ","...
Loops through a set of entries, assigning them IDs based on the item URI @param array $entries Entries to assign IDs for @return array
[ "Loops", "through", "a", "set", "of", "entries", "assigning", "them", "IDs", "based", "on", "the", "item", "URI" ]
7508830f787125218e80b93d39d8a1e54d290130
https://github.com/rexxars/joindin-client/blob/7508830f787125218e80b93d39d8a1e54d290130/library/JoindIn/Client.php#L245-L251
236,856
vdeapps/phpcore-helper
src/Helper.php
Helper.camelCase
public static function camelCase($str, $firstChar = 'lcfirst') { $str = str_replace(['-', '_', '.'], ' ', $str); $str = mb_convert_case($str, MB_CASE_TITLE); $str = str_replace(' ', '', $str); //ucwords('ghjkiol|ghjklo', "|"); if (!function_exists($firstChar)) { $firstChar = 'lcfirst'; } $str = call_user_func($firstChar, $str); return $str; }
php
public static function camelCase($str, $firstChar = 'lcfirst') { $str = str_replace(['-', '_', '.'], ' ', $str); $str = mb_convert_case($str, MB_CASE_TITLE); $str = str_replace(' ', '', $str); //ucwords('ghjkiol|ghjklo', "|"); if (!function_exists($firstChar)) { $firstChar = 'lcfirst'; } $str = call_user_func($firstChar, $str); return $str; }
[ "public", "static", "function", "camelCase", "(", "$", "str", ",", "$", "firstChar", "=", "'lcfirst'", ")", "{", "$", "str", "=", "str_replace", "(", "[", "'-'", ",", "'_'", ",", "'.'", "]", ",", "' '", ",", "$", "str", ")", ";", "$", "str", "=",...
Retourne une chaine en camelCase avec lcfirst|ucfirst @param string $str @param string $firstChar lcfirst|ucfirst default(lcfirst) @return string
[ "Retourne", "une", "chaine", "en", "camelCase", "avec", "lcfirst|ucfirst" ]
838d671b8455b9fce43579d59086903647c4f408
https://github.com/vdeapps/phpcore-helper/blob/838d671b8455b9fce43579d59086903647c4f408/src/Helper.php#L110-L122
236,857
vdeapps/phpcore-helper
src/Helper.php
Helper.base64Encode
public static function base64Encode($str, $stripEgal = true) { $str64 = base64_encode($str); if ($stripEgal) { return rtrim(strtr($str64, '+/', '-_'), '='); } return $str64; }
php
public static function base64Encode($str, $stripEgal = true) { $str64 = base64_encode($str); if ($stripEgal) { return rtrim(strtr($str64, '+/', '-_'), '='); } return $str64; }
[ "public", "static", "function", "base64Encode", "(", "$", "str", ",", "$", "stripEgal", "=", "true", ")", "{", "$", "str64", "=", "base64_encode", "(", "$", "str", ")", ";", "if", "(", "$", "stripEgal", ")", "{", "return", "rtrim", "(", "strtr", "(",...
base64_decode sans les == de fin @param $str @param bool $stripEgal @return string
[ "base64_decode", "sans", "les", "==", "de", "fin" ]
838d671b8455b9fce43579d59086903647c4f408
https://github.com/vdeapps/phpcore-helper/blob/838d671b8455b9fce43579d59086903647c4f408/src/Helper.php#L132-L140
236,858
synapsestudios/synapse-base
src/Synapse/Application/UrlGeneratorAwareTrait.php
UrlGeneratorAwareTrait.path
public function path($route, $parameters = array()) { return $this->urlGenerator->generate($route, $parameters, UrlGeneratorInterface::ABSOLUTE_PATH); }
php
public function path($route, $parameters = array()) { return $this->urlGenerator->generate($route, $parameters, UrlGeneratorInterface::ABSOLUTE_PATH); }
[ "public", "function", "path", "(", "$", "route", ",", "$", "parameters", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "urlGenerator", "->", "generate", "(", "$", "route", ",", "$", "parameters", ",", "UrlGeneratorInterface", "::", "ABSO...
Generate a path from the given parameters @param string $route The name of the route @param mixed $parameters An array of parameters @return string The generated path
[ "Generate", "a", "path", "from", "the", "given", "parameters" ]
60c830550491742a077ab063f924e2f0b63825da
https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/Application/UrlGeneratorAwareTrait.php#L31-L34
236,859
synapsestudios/synapse-base
src/Synapse/Application/UrlGeneratorAwareTrait.php
UrlGeneratorAwareTrait.url
public function url($route, $parameters = array()) { return $this->urlGenerator->generate($route, $parameters, UrlGeneratorInterface::ABSOLUTE_URL); }
php
public function url($route, $parameters = array()) { return $this->urlGenerator->generate($route, $parameters, UrlGeneratorInterface::ABSOLUTE_URL); }
[ "public", "function", "url", "(", "$", "route", ",", "$", "parameters", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "urlGenerator", "->", "generate", "(", "$", "route", ",", "$", "parameters", ",", "UrlGeneratorInterface", "::", "ABSOL...
Generate an absolute URL from the given parameters @param string $route The name of the route @param mixed $parameters An array of parameters @return string The generated URL
[ "Generate", "an", "absolute", "URL", "from", "the", "given", "parameters" ]
60c830550491742a077ab063f924e2f0b63825da
https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/Application/UrlGeneratorAwareTrait.php#L44-L47
236,860
GustavSoftware/Utils
src/InvalidArgumentException.php
InvalidArgumentException.invalidArgument
public static function invalidArgument( string $class, string $method, string $arg, \Exception $previous = null ): self { return new self( "invalid value of argument \"{$arg}\" in {$class}::{$method}", self::INVALID_ARGUMENT, $previous ); }
php
public static function invalidArgument( string $class, string $method, string $arg, \Exception $previous = null ): self { return new self( "invalid value of argument \"{$arg}\" in {$class}::{$method}", self::INVALID_ARGUMENT, $previous ); }
[ "public", "static", "function", "invalidArgument", "(", "string", "$", "class", ",", "string", "$", "method", ",", "string", "$", "arg", ",", "\\", "Exception", "$", "previous", "=", "null", ")", ":", "self", "{", "return", "new", "self", "(", "\"invalid...
Creates an exception if an invalid argument was given in a method call. @param string $class The containing class @param string $method The method's name @param string $arg The argument's name @param \Exception|null $previous Previous exception @return \Gustav\Utils\InvalidArgumentException The exception
[ "Creates", "an", "exception", "if", "an", "invalid", "argument", "was", "given", "in", "a", "method", "call", "." ]
370131e9baf3477863123ca31972cbbfaaf2f39b
https://github.com/GustavSoftware/Utils/blob/370131e9baf3477863123ca31972cbbfaaf2f39b/src/InvalidArgumentException.php#L53-L64
236,861
tux-rampage/rampage-php
library/rampage/core/view/helpers/RequireJsHelper.php
RequireJsHelper.setBaseUrl
public function setBaseUrl($url, $replace = true) { if ($replace || !$this->baseUrl) { $this->baseUrl = $url; } return $this; }
php
public function setBaseUrl($url, $replace = true) { if ($replace || !$this->baseUrl) { $this->baseUrl = $url; } return $this; }
[ "public", "function", "setBaseUrl", "(", "$", "url", ",", "$", "replace", "=", "true", ")", "{", "if", "(", "$", "replace", "||", "!", "$", "this", "->", "baseUrl", ")", "{", "$", "this", "->", "baseUrl", "=", "$", "url", ";", "}", "return", "$",...
Set the base URL @see http://requirejs.org/docs/api.html#config-baseUrl @param string $url @param bool $replace Replace the base url if it was already set. @return self
[ "Set", "the", "base", "URL" ]
1c679b04a6d477e2f8fdb86135e1d9f0c128b1cf
https://github.com/tux-rampage/rampage-php/blob/1c679b04a6d477e2f8fdb86135e1d9f0c128b1cf/library/rampage/core/view/helpers/RequireJsHelper.php#L95-L102
236,862
tux-rampage/rampage-php
library/rampage/core/view/helpers/RequireJsHelper.php
RequireJsHelper.addModule
public function addModule($name, $location, $replace = false) { if ($name == '') { throw new exception\InvalidArgumentException('The require.js module name must not be empty'); } if ($replace || !isset($this->modules[$name])) { $this->modules[$name] = (string)$location; } return $this; }
php
public function addModule($name, $location, $replace = false) { if ($name == '') { throw new exception\InvalidArgumentException('The require.js module name must not be empty'); } if ($replace || !isset($this->modules[$name])) { $this->modules[$name] = (string)$location; } return $this; }
[ "public", "function", "addModule", "(", "$", "name", ",", "$", "location", ",", "$", "replace", "=", "false", ")", "{", "if", "(", "$", "name", "==", "''", ")", "{", "throw", "new", "exception", "\\", "InvalidArgumentException", "(", "'The require.js modul...
Define a require.js module location @see http://requirejs.org/docs/api.html#config-paths @param string $name @param string $location @param bool $replace Replace the module definition if it already exists
[ "Define", "a", "require", ".", "js", "module", "location" ]
1c679b04a6d477e2f8fdb86135e1d9f0c128b1cf
https://github.com/tux-rampage/rampage-php/blob/1c679b04a6d477e2f8fdb86135e1d9f0c128b1cf/library/rampage/core/view/helpers/RequireJsHelper.php#L124-L135
236,863
tux-rampage/rampage-php
library/rampage/core/view/helpers/RequireJsHelper.php
RequireJsHelper.addPackage
public function addPackage($name, $location = null, $main = null) { $name = (string)$name; if ($name == '') { throw new exception\InvalidArgumentException('The require.js package name must not be empty'); } if (!$location && !$main) { $this->packages[$name] = $name; return $this; } $this->packages[$name] = [ 'name' => $name, ]; if ($location) { $this->packages[$name]['location'] = (string)$location; } if ($main) { $this->packages[$name]['main'] = (string)$main; } return $this; }
php
public function addPackage($name, $location = null, $main = null) { $name = (string)$name; if ($name == '') { throw new exception\InvalidArgumentException('The require.js package name must not be empty'); } if (!$location && !$main) { $this->packages[$name] = $name; return $this; } $this->packages[$name] = [ 'name' => $name, ]; if ($location) { $this->packages[$name]['location'] = (string)$location; } if ($main) { $this->packages[$name]['main'] = (string)$main; } return $this; }
[ "public", "function", "addPackage", "(", "$", "name", ",", "$", "location", "=", "null", ",", "$", "main", "=", "null", ")", "{", "$", "name", "=", "(", "string", ")", "$", "name", ";", "if", "(", "$", "name", "==", "''", ")", "{", "throw", "ne...
Add a package definition. If the package is already defined it will be replaced. @see http://requirejs.org/docs/api.html#packages @param string $name @param string $location @param string $main
[ "Add", "a", "package", "definition", "." ]
1c679b04a6d477e2f8fdb86135e1d9f0c128b1cf
https://github.com/tux-rampage/rampage-php/blob/1c679b04a6d477e2f8fdb86135e1d9f0c128b1cf/library/rampage/core/view/helpers/RequireJsHelper.php#L147-L173
236,864
tux-rampage/rampage-php
library/rampage/core/view/helpers/RequireJsHelper.php
RequireJsHelper.addBundle
public function addBundle($name, array $deps) { if ($name == '') { throw new exception\InvalidArgumentException('The require.js bundle name must not be empty'); } $this->bundles[$name] = []; $this->addToBundle($name, $deps); return $this; }
php
public function addBundle($name, array $deps) { if ($name == '') { throw new exception\InvalidArgumentException('The require.js bundle name must not be empty'); } $this->bundles[$name] = []; $this->addToBundle($name, $deps); return $this; }
[ "public", "function", "addBundle", "(", "$", "name", ",", "array", "$", "deps", ")", "{", "if", "(", "$", "name", "==", "''", ")", "{", "throw", "new", "exception", "\\", "InvalidArgumentException", "(", "'The require.js bundle name must not be empty'", ")", "...
Add a new bundle definition. If the bundle is already defined, it will be replaced. @see http://requirejs.org/docs/api.html#config-bundles @param string $name @param array $deps @return self
[ "Add", "a", "new", "bundle", "definition", "." ]
1c679b04a6d477e2f8fdb86135e1d9f0c128b1cf
https://github.com/tux-rampage/rampage-php/blob/1c679b04a6d477e2f8fdb86135e1d9f0c128b1cf/library/rampage/core/view/helpers/RequireJsHelper.php#L185-L195
236,865
tux-rampage/rampage-php
library/rampage/core/view/helpers/RequireJsHelper.php
RequireJsHelper.addToBundle
public function addToBundle($name, $deps) { if ($name == '') { throw new exception\InvalidArgumentException('The require.js bundle name must not be empty'); } if (!is_array($deps) && !($deps instanceof \Traversable)) { $deps = [ $deps ]; } if (!isset($this->bundles[$name])) { $this->bundles[$name] = []; } foreach ($deps as $item) { $item = (string)$item; if ($item != '') { $this->bundles[$name][] = $item; } } return $this; }
php
public function addToBundle($name, $deps) { if ($name == '') { throw new exception\InvalidArgumentException('The require.js bundle name must not be empty'); } if (!is_array($deps) && !($deps instanceof \Traversable)) { $deps = [ $deps ]; } if (!isset($this->bundles[$name])) { $this->bundles[$name] = []; } foreach ($deps as $item) { $item = (string)$item; if ($item != '') { $this->bundles[$name][] = $item; } } return $this; }
[ "public", "function", "addToBundle", "(", "$", "name", ",", "$", "deps", ")", "{", "if", "(", "$", "name", "==", "''", ")", "{", "throw", "new", "exception", "\\", "InvalidArgumentException", "(", "'The require.js bundle name must not be empty'", ")", ";", "}"...
Adde dependencies to an existing bundle @see http://requirejs.org/docs/api.html#config-bundles @param string $name @param array|string $deps @return self
[ "Adde", "dependencies", "to", "an", "existing", "bundle" ]
1c679b04a6d477e2f8fdb86135e1d9f0c128b1cf
https://github.com/tux-rampage/rampage-php/blob/1c679b04a6d477e2f8fdb86135e1d9f0c128b1cf/library/rampage/core/view/helpers/RequireJsHelper.php#L205-L228
236,866
tailored-tunes/mongo-connection-facade
src/TailoredTunes/MongoConnectionFacade/MongoDbConnection.php
MongoDbConnection.connectionString
public function connectionString() { if (empty($this->username) || empty($this->password)) { return sprintf( "mongodb://%s:%d/%s", $this->host, $this->port, $this->db ); } return sprintf( "mongodb://%s:%s@%s:%d/%s", $this->username, $this->password, $this->host, $this->port, $this->db ); }
php
public function connectionString() { if (empty($this->username) || empty($this->password)) { return sprintf( "mongodb://%s:%d/%s", $this->host, $this->port, $this->db ); } return sprintf( "mongodb://%s:%s@%s:%d/%s", $this->username, $this->password, $this->host, $this->port, $this->db ); }
[ "public", "function", "connectionString", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "username", ")", "||", "empty", "(", "$", "this", "->", "password", ")", ")", "{", "return", "sprintf", "(", "\"mongodb://%s:%d/%s\"", ",", "$", "this", ...
Forms the connection String @return String
[ "Forms", "the", "connection", "String" ]
ac81908f6db22ff8de4ffb974e841fa0a466b10a
https://github.com/tailored-tunes/mongo-connection-facade/blob/ac81908f6db22ff8de4ffb974e841fa0a466b10a/src/TailoredTunes/MongoConnectionFacade/MongoDbConnection.php#L66-L84
236,867
jerel/quick-cache
core/Quick/Cache/Driver/Apc.php
Apc._key
private function _key($identifier) { extract($identifier); $arg_string = ""; return md5(serialize($class . $method . implode('~', $args))); }
php
private function _key($identifier) { extract($identifier); $arg_string = ""; return md5(serialize($class . $method . implode('~', $args))); }
[ "private", "function", "_key", "(", "$", "identifier", ")", "{", "extract", "(", "$", "identifier", ")", ";", "$", "arg_string", "=", "\"\"", ";", "return", "md5", "(", "serialize", "(", "$", "class", ".", "$", "method", ".", "implode", "(", "'~'", "...
Creates a key for cached class methods @param array $identifier class|method|args @return string
[ "Creates", "a", "key", "for", "cached", "class", "methods" ]
e5963482c5f90fe866d4e87545cb7eab5cc65c43
https://github.com/jerel/quick-cache/blob/e5963482c5f90fe866d4e87545cb7eab5cc65c43/core/Quick/Cache/Driver/Apc.php#L91-L95
236,868
JaredClemence/binn
src/builders/NumericBuilder.php
NumericBuilder.isNegative
public function isNegative( $binaryString ){ $firstBit = $binaryString[0]; $negativeFlag = $firstBit & "\x80"; $isNegative = ord($negativeFlag) == 128; return $isNegative; }
php
public function isNegative( $binaryString ){ $firstBit = $binaryString[0]; $negativeFlag = $firstBit & "\x80"; $isNegative = ord($negativeFlag) == 128; return $isNegative; }
[ "public", "function", "isNegative", "(", "$", "binaryString", ")", "{", "$", "firstBit", "=", "$", "binaryString", "[", "0", "]", ";", "$", "negativeFlag", "=", "$", "firstBit", "&", "\"\\x80\"", ";", "$", "isNegative", "=", "ord", "(", "$", "negativeFla...
Public for testing purposes @param type $binaryString @return type
[ "Public", "for", "testing", "purposes" ]
838591e7a92c0f257c09a1df141d80737a20f7d9
https://github.com/JaredClemence/binn/blob/838591e7a92c0f257c09a1df141d80737a20f7d9/src/builders/NumericBuilder.php#L41-L46
236,869
JaredClemence/binn
src/builders/NumericBuilder.php
NumericBuilder.addOneToBytePreserveCarry
public function addOneToBytePreserveCarry($currentByte, &$carry) { for( $i = 0; $i < 8; $i++ ){ $bitMaskValue = pow( 2, $i ); $mask = chr( $bitMaskValue ); $filteredBit = $currentByte & $mask; if( $carry == 1 && ord( $filteredBit ) == 0 ){ $currentByte |= $mask; $carry = 0; }else if($carry == 1 && ord( $filteredBit ) >= 1){ $flipMask = ~$mask; $currentByte &= $flipMask; //carry bit remains unchanged } } return $currentByte; }
php
public function addOneToBytePreserveCarry($currentByte, &$carry) { for( $i = 0; $i < 8; $i++ ){ $bitMaskValue = pow( 2, $i ); $mask = chr( $bitMaskValue ); $filteredBit = $currentByte & $mask; if( $carry == 1 && ord( $filteredBit ) == 0 ){ $currentByte |= $mask; $carry = 0; }else if($carry == 1 && ord( $filteredBit ) >= 1){ $flipMask = ~$mask; $currentByte &= $flipMask; //carry bit remains unchanged } } return $currentByte; }
[ "public", "function", "addOneToBytePreserveCarry", "(", "$", "currentByte", ",", "&", "$", "carry", ")", "{", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "8", ";", "$", "i", "++", ")", "{", "$", "bitMaskValue", "=", "pow", "(", "2", ",", ...
We add one by inserting the 1 into the first carry bit. This is public for testing only. @param type $currentByte @param type $carry
[ "We", "add", "one", "by", "inserting", "the", "1", "into", "the", "first", "carry", "bit", "." ]
838591e7a92c0f257c09a1df141d80737a20f7d9
https://github.com/JaredClemence/binn/blob/838591e7a92c0f257c09a1df141d80737a20f7d9/src/builders/NumericBuilder.php#L99-L114
236,870
brad-jones/import
src/Importer.php
Importer.import
public static function import() { if (count(func_get_args()) >= 2 && func_get_arg(1) !== null) { extract(func_get_arg(1)); } if (count(func_get_args()) < 3 || func_get_arg(2) === true) { $exports = require func_get_arg(0); } else { $exports = include func_get_arg(0); } return $exports; }
php
public static function import() { if (count(func_get_args()) >= 2 && func_get_arg(1) !== null) { extract(func_get_arg(1)); } if (count(func_get_args()) < 3 || func_get_arg(2) === true) { $exports = require func_get_arg(0); } else { $exports = include func_get_arg(0); } return $exports; }
[ "public", "static", "function", "import", "(", ")", "{", "if", "(", "count", "(", "func_get_args", "(", ")", ")", ">=", "2", "&&", "func_get_arg", "(", "1", ")", "!==", "null", ")", "{", "extract", "(", "func_get_arg", "(", "1", ")", ")", ";", "}",...
Includes a file with an empty variable scope. @param string $file The path to the file to import. @param array|null $scope A custom scope to give to the file. @param boolean $require Whether to use require() or include(). @return mixed Anything the file returns.
[ "Includes", "a", "file", "with", "an", "empty", "variable", "scope", "." ]
45918c9a2f59fff094582deef7c4bb0fd782985d
https://github.com/brad-jones/import/blob/45918c9a2f59fff094582deef7c4bb0fd782985d/src/Importer.php#L13-L30
236,871
MINISTRYGmbH/morrow-core
src/Views/Serpent.php
Serpent.init
public function init($namespace) { // extract template path from class namespace $namespace = trim($namespace, '\\'); $namespace_array = explode('\\', $namespace); $this->template_path = implode('/', array_slice($namespace_array, 1, 2)); $this->template_path .= '/templates/'; // get template name from template router $this->template = call_user_func(Factory::load('Config')->get('router.template'), $namespace); // pass the page variables to the template $this->setContent('page', Factory::load('Page')->get(), true); // cerate template compile path fron namespace array $module_name = implode('/', array_slice($namespace_array, 2, 1)); $this->compile_path = STORAGE_PATH .'serpent_templates_compiled/' . $module_name . '/'; }
php
public function init($namespace) { // extract template path from class namespace $namespace = trim($namespace, '\\'); $namespace_array = explode('\\', $namespace); $this->template_path = implode('/', array_slice($namespace_array, 1, 2)); $this->template_path .= '/templates/'; // get template name from template router $this->template = call_user_func(Factory::load('Config')->get('router.template'), $namespace); // pass the page variables to the template $this->setContent('page', Factory::load('Page')->get(), true); // cerate template compile path fron namespace array $module_name = implode('/', array_slice($namespace_array, 2, 1)); $this->compile_path = STORAGE_PATH .'serpent_templates_compiled/' . $module_name . '/'; }
[ "public", "function", "init", "(", "$", "namespace", ")", "{", "// extract template path from class namespace", "$", "namespace", "=", "trim", "(", "$", "namespace", ",", "'\\\\'", ")", ";", "$", "namespace_array", "=", "explode", "(", "'\\\\'", ",", "$", "nam...
The view handler could extend this method to set some parameters. @param string $namespace The MVC controller class with namespace that inits this instance.
[ "The", "view", "handler", "could", "extend", "this", "method", "to", "set", "some", "parameters", "." ]
bdc916eedb14b65b06dbc88efbd2b7779f4a9a9e
https://github.com/MINISTRYGmbH/morrow-core/blob/bdc916eedb14b65b06dbc88efbd2b7779f4a9a9e/src/Views/Serpent.php#L91-L107
236,872
gossi/trixionary
src/model/Map/SkillVersionTableMap.php
SkillVersionTableMap.doDelete
public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SkillVersionTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; } elseif ($values instanceof \gossi\trixionary\model\SkillVersion) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); } else { // it's a primary key, or an array of pks $criteria = new Criteria(SkillVersionTableMap::DATABASE_NAME); // primary key is composite; we therefore, expect // the primary key passed to be an array of pkey values if (count($values) == count($values, COUNT_RECURSIVE)) { // array is not multi-dimensional $values = array($values); } foreach ($values as $value) { $criterion = $criteria->getNewCriterion(SkillVersionTableMap::COL_ID, $value[0]); $criterion->addAnd($criteria->getNewCriterion(SkillVersionTableMap::COL_VERSION, $value[1])); $criteria->addOr($criterion); } } $query = SkillVersionQuery::create()->mergeWith($criteria); if ($values instanceof Criteria) { SkillVersionTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { SkillVersionTableMap::removeInstanceFromPool($singleval); } } return $query->delete($con); }
php
public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SkillVersionTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; } elseif ($values instanceof \gossi\trixionary\model\SkillVersion) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); } else { // it's a primary key, or an array of pks $criteria = new Criteria(SkillVersionTableMap::DATABASE_NAME); // primary key is composite; we therefore, expect // the primary key passed to be an array of pkey values if (count($values) == count($values, COUNT_RECURSIVE)) { // array is not multi-dimensional $values = array($values); } foreach ($values as $value) { $criterion = $criteria->getNewCriterion(SkillVersionTableMap::COL_ID, $value[0]); $criterion->addAnd($criteria->getNewCriterion(SkillVersionTableMap::COL_VERSION, $value[1])); $criteria->addOr($criterion); } } $query = SkillVersionQuery::create()->mergeWith($criteria); if ($values instanceof Criteria) { SkillVersionTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { SkillVersionTableMap::removeInstanceFromPool($singleval); } } return $query->delete($con); }
[ "public", "static", "function", "doDelete", "(", "$", "values", ",", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "if", "(", "null", "===", "$", "con", ")", "{", "$", "con", "=", "Propel", "::", "getServiceContainer", "(", ")", "->", "getW...
Performs a DELETE on the database, given a SkillVersion or Criteria object OR a primary key value. @param mixed $values Criteria or SkillVersion object or primary key or array of primary keys which is used to create the DELETE statement @param ConnectionInterface $con the connection to use @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows if supported by native driver or if emulated using Propel. @throws PropelException Any exceptions caught during processing will be rethrown wrapped into a PropelException.
[ "Performs", "a", "DELETE", "on", "the", "database", "given", "a", "SkillVersion", "or", "Criteria", "object", "OR", "a", "primary", "key", "value", "." ]
221a6c5322473d7d7f8e322958a3ee46d87da150
https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Map/SkillVersionTableMap.php#L685-L723
236,873
gossi/trixionary
src/model/Map/SkillVersionTableMap.php
SkillVersionTableMap.doInsert
public static function doInsert($criteria, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SkillVersionTableMap::DATABASE_NAME); } if ($criteria instanceof Criteria) { $criteria = clone $criteria; // rename for clarity } else { $criteria = $criteria->buildCriteria(); // build Criteria from SkillVersion object } // Set the correct dbName $query = SkillVersionQuery::create()->mergeWith($criteria); // use transaction because $criteria could contain info // for more than one table (I guess, conceivably) return $con->transaction(function () use ($con, $query) { return $query->doInsert($con); }); }
php
public static function doInsert($criteria, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SkillVersionTableMap::DATABASE_NAME); } if ($criteria instanceof Criteria) { $criteria = clone $criteria; // rename for clarity } else { $criteria = $criteria->buildCriteria(); // build Criteria from SkillVersion object } // Set the correct dbName $query = SkillVersionQuery::create()->mergeWith($criteria); // use transaction because $criteria could contain info // for more than one table (I guess, conceivably) return $con->transaction(function () use ($con, $query) { return $query->doInsert($con); }); }
[ "public", "static", "function", "doInsert", "(", "$", "criteria", ",", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "if", "(", "null", "===", "$", "con", ")", "{", "$", "con", "=", "Propel", "::", "getServiceContainer", "(", ")", "->", "ge...
Performs an INSERT on the database, given a SkillVersion or Criteria object. @param mixed $criteria Criteria or SkillVersion object containing data that is used to create the INSERT statement. @param ConnectionInterface $con the ConnectionInterface connection to use @return mixed The new primary key. @throws PropelException Any exceptions caught during processing will be rethrown wrapped into a PropelException.
[ "Performs", "an", "INSERT", "on", "the", "database", "given", "a", "SkillVersion", "or", "Criteria", "object", "." ]
221a6c5322473d7d7f8e322958a3ee46d87da150
https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Map/SkillVersionTableMap.php#L745-L766
236,874
tekkla/core-html
Core/Html/Controls/Editbox/Editbox.php
Editbox.addAction
public function addAction(Action $action): Editbox { switch ($action->getType()) { case Action::SAVE: $this->actions[0] = $action; break; case Action::CANCEL: $this->actions[1] = $action; break; case Action::CONTEXT: default: if (empty($this->actions[2])) { $this->actions[2] = []; } $this->actions[2][] = $action; break; } return $this; }
php
public function addAction(Action $action): Editbox { switch ($action->getType()) { case Action::SAVE: $this->actions[0] = $action; break; case Action::CANCEL: $this->actions[1] = $action; break; case Action::CONTEXT: default: if (empty($this->actions[2])) { $this->actions[2] = []; } $this->actions[2][] = $action; break; } return $this; }
[ "public", "function", "addAction", "(", "Action", "$", "action", ")", ":", "Editbox", "{", "switch", "(", "$", "action", "->", "getType", "(", ")", ")", "{", "case", "Action", "::", "SAVE", ":", "$", "this", "->", "actions", "[", "0", "]", "=", "$"...
Adds an action link to actions list @param Action $action @return Editbox
[ "Adds", "an", "action", "link", "to", "actions", "list" ]
00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3
https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/Controls/Editbox/Editbox.php#L167-L192
236,875
tekkla/core-html
Core/Html/Controls/Editbox/Editbox.php
Editbox.&
public function &createAction(string $type, string $text, string $href = '', bool $ajax = false, string $confirm = ''): Action { $action = new Action(); $action->setType($type); $action->setText($text); if (!empty($href)) { $action->setHref($href); } $action->setAjax($ajax); if (!empty($confirm)) { $action->setConfirm('confirm'); } $this->addAction($action); return $action; }
php
public function &createAction(string $type, string $text, string $href = '', bool $ajax = false, string $confirm = ''): Action { $action = new Action(); $action->setType($type); $action->setText($text); if (!empty($href)) { $action->setHref($href); } $action->setAjax($ajax); if (!empty($confirm)) { $action->setConfirm('confirm'); } $this->addAction($action); return $action; }
[ "public", "function", "&", "createAction", "(", "string", "$", "type", ",", "string", "$", "text", ",", "string", "$", "href", "=", "''", ",", "bool", "$", "ajax", "=", "false", ",", "string", "$", "confirm", "=", "''", ")", ":", "Action", "{", "$"...
Creates an action object, adds it to the actionslist and returns a reference to it @param string $type @param string $text @param string $href @param string $ajax @param string $confirm @return Action
[ "Creates", "an", "action", "object", "adds", "it", "to", "the", "actionslist", "and", "returns", "a", "reference", "to", "it" ]
00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3
https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/Controls/Editbox/Editbox.php#L205-L225
236,876
tekkla/core-html
Core/Html/Controls/Editbox/Editbox.php
Editbox.generateActions
public function generateActions(array $actions): Editbox { foreach ($actions as $action) { $action_object = new Action(); if (empty($action['type'])) { $action['type'] = 'context'; } $action_object->setType($action['type']); if (! empty($action['text'])) { $action_object->setText($action['text']); } if (! empty($action['href'])) { $action_object->setHref($action['href']); } if (isset($action['ajax'])) { $action_object->setAjax($action['ajax']); } if (! empty($action['icon'])) { $action_object->setIcon($action['icon']); } if (! empty($action['confirm'])) { $action_object->setConfirm($action['confirm']); } $this->addAction($action_object); } return $this; }
php
public function generateActions(array $actions): Editbox { foreach ($actions as $action) { $action_object = new Action(); if (empty($action['type'])) { $action['type'] = 'context'; } $action_object->setType($action['type']); if (! empty($action['text'])) { $action_object->setText($action['text']); } if (! empty($action['href'])) { $action_object->setHref($action['href']); } if (isset($action['ajax'])) { $action_object->setAjax($action['ajax']); } if (! empty($action['icon'])) { $action_object->setIcon($action['icon']); } if (! empty($action['confirm'])) { $action_object->setConfirm($action['confirm']); } $this->addAction($action_object); } return $this; }
[ "public", "function", "generateActions", "(", "array", "$", "actions", ")", ":", "Editbox", "{", "foreach", "(", "$", "actions", "as", "$", "action", ")", "{", "$", "action_object", "=", "new", "Action", "(", ")", ";", "if", "(", "empty", "(", "$", "...
Generate actions from an array of action definitions @param array $actions @return Editbox
[ "Generate", "actions", "from", "an", "array", "of", "action", "definitions" ]
00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3
https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/Controls/Editbox/Editbox.php#L234-L270
236,877
GrupaZero/core
src/Gzero/Core/Query/QueryBuilder.php
QueryBuilder.getFilter
public function getFilter(string $fieldName): ?Condition { [$name, $filters] = $this->getArrayAndKeyName($fieldName, 'filters'); return array_first($filters, function ($filter) use ($name) { return $filter->getName() === $name; }); }
php
public function getFilter(string $fieldName): ?Condition { [$name, $filters] = $this->getArrayAndKeyName($fieldName, 'filters'); return array_first($filters, function ($filter) use ($name) { return $filter->getName() === $name; }); }
[ "public", "function", "getFilter", "(", "string", "$", "fieldName", ")", ":", "?", "Condition", "{", "[", "$", "name", ",", "$", "filters", "]", "=", "$", "this", "->", "getArrayAndKeyName", "(", "$", "fieldName", ",", "'filters'", ")", ";", "return", ...
It returns single filter by field name @param string $fieldName Condition field name @throws InvalidArgumentException @return Condition
[ "It", "returns", "single", "filter", "by", "field", "name" ]
093e515234fa0385b259ba4d8bc7832174a44eab
https://github.com/GrupaZero/core/blob/093e515234fa0385b259ba4d8bc7832174a44eab/src/Gzero/Core/Query/QueryBuilder.php#L48-L55
236,878
GrupaZero/core
src/Gzero/Core/Query/QueryBuilder.php
QueryBuilder.getSort
public function getSort($sortName): ?OrderBy { [$name, $sorts] = $this->getArrayAndKeyName($sortName, 'sorts'); return array_first($sorts, function ($sort) use ($name) { return $sort->getName() === $name; }); }
php
public function getSort($sortName): ?OrderBy { [$name, $sorts] = $this->getArrayAndKeyName($sortName, 'sorts'); return array_first($sorts, function ($sort) use ($name) { return $sort->getName() === $name; }); }
[ "public", "function", "getSort", "(", "$", "sortName", ")", ":", "?", "OrderBy", "{", "[", "$", "name", ",", "$", "sorts", "]", "=", "$", "this", "->", "getArrayAndKeyName", "(", "$", "sortName", ",", "'sorts'", ")", ";", "return", "array_first", "(", ...
It returns single sort by field name @param string $sortName Sort field name @throws InvalidArgumentException @return OrderBy
[ "It", "returns", "single", "sort", "by", "field", "name" ]
093e515234fa0385b259ba4d8bc7832174a44eab
https://github.com/GrupaZero/core/blob/093e515234fa0385b259ba4d8bc7832174a44eab/src/Gzero/Core/Query/QueryBuilder.php#L90-L97
236,879
GrupaZero/core
src/Gzero/Core/Query/QueryBuilder.php
QueryBuilder.where
public function where(string $key, string $operation, $value) { if (str_contains($key, '.')) { $fullPath = explode('.', $key); $relationPath = implode('.', array_slice($fullPath, 0, -1)); $relationKey = last($fullPath); $result = array_get($this->relations, $relationPath, ['filters' => [], 'sorts' => []]); $result['filters'][] = new Condition($relationKey, $operation, $value); array_set($this->relations, $relationPath, $result); } else { $this->filters[] = new Condition($key, $operation, $value); } return $this; }
php
public function where(string $key, string $operation, $value) { if (str_contains($key, '.')) { $fullPath = explode('.', $key); $relationPath = implode('.', array_slice($fullPath, 0, -1)); $relationKey = last($fullPath); $result = array_get($this->relations, $relationPath, ['filters' => [], 'sorts' => []]); $result['filters'][] = new Condition($relationKey, $operation, $value); array_set($this->relations, $relationPath, $result); } else { $this->filters[] = new Condition($key, $operation, $value); } return $this; }
[ "public", "function", "where", "(", "string", "$", "key", ",", "string", "$", "operation", ",", "$", "value", ")", "{", "if", "(", "str_contains", "(", "$", "key", ",", "'.'", ")", ")", "{", "$", "fullPath", "=", "explode", "(", "'.'", ",", "$", ...
It adds where condition @param string $key Column name @param string $operation Operation @param mixed $value Value @return $this
[ "It", "adds", "where", "condition" ]
093e515234fa0385b259ba4d8bc7832174a44eab
https://github.com/GrupaZero/core/blob/093e515234fa0385b259ba4d8bc7832174a44eab/src/Gzero/Core/Query/QueryBuilder.php#L200-L213
236,880
GrupaZero/core
src/Gzero/Core/Query/QueryBuilder.php
QueryBuilder.orderBy
public function orderBy(string $key, string $direction) { if (str_contains($key, '.')) { $fullPath = explode('.', $key); $relationPath = implode('.', array_slice($fullPath, 0, -1)); $relationKey = last($fullPath); $result = array_get($this->relations, $relationPath, ['filters' => [], 'sorts' => []]); $result['sorts'][] = new OrderBy($relationKey, $direction); array_set($this->relations, $relationPath, $result); } else { $this->sorts[] = new OrderBy($key, $direction); } return $this; }
php
public function orderBy(string $key, string $direction) { if (str_contains($key, '.')) { $fullPath = explode('.', $key); $relationPath = implode('.', array_slice($fullPath, 0, -1)); $relationKey = last($fullPath); $result = array_get($this->relations, $relationPath, ['filters' => [], 'sorts' => []]); $result['sorts'][] = new OrderBy($relationKey, $direction); array_set($this->relations, $relationPath, $result); } else { $this->sorts[] = new OrderBy($key, $direction); } return $this; }
[ "public", "function", "orderBy", "(", "string", "$", "key", ",", "string", "$", "direction", ")", "{", "if", "(", "str_contains", "(", "$", "key", ",", "'.'", ")", ")", "{", "$", "fullPath", "=", "explode", "(", "'.'", ",", "$", "key", ")", ";", ...
It adds order by @param string $key Column name @param string $direction Direction @return $this
[ "It", "adds", "order", "by" ]
093e515234fa0385b259ba4d8bc7832174a44eab
https://github.com/GrupaZero/core/blob/093e515234fa0385b259ba4d8bc7832174a44eab/src/Gzero/Core/Query/QueryBuilder.php#L223-L236
236,881
GrupaZero/core
src/Gzero/Core/Query/QueryBuilder.php
QueryBuilder.applyFilters
public function applyFilters(Builder $query, string $alias = null) { foreach ($this->getFilters() as $filter) { $filter->apply($query, $alias); } }
php
public function applyFilters(Builder $query, string $alias = null) { foreach ($this->getFilters() as $filter) { $filter->apply($query, $alias); } }
[ "public", "function", "applyFilters", "(", "Builder", "$", "query", ",", "string", "$", "alias", "=", "null", ")", "{", "foreach", "(", "$", "this", "->", "getFilters", "(", ")", "as", "$", "filter", ")", "{", "$", "filter", "->", "apply", "(", "$", ...
Applies filter to Eloquent Query builder @param Builder $query Eloquent query builder @param string|null $alias SQL alias @return void
[ "Applies", "filter", "to", "Eloquent", "Query", "builder" ]
093e515234fa0385b259ba4d8bc7832174a44eab
https://github.com/GrupaZero/core/blob/093e515234fa0385b259ba4d8bc7832174a44eab/src/Gzero/Core/Query/QueryBuilder.php#L282-L287
236,882
GrupaZero/core
src/Gzero/Core/Query/QueryBuilder.php
QueryBuilder.applyRelationFilters
public function applyRelationFilters(string $relationName, string $alias, Builder $query) { foreach ($this->getRelationFilters($relationName) as $filter) { $filter->apply($query, $alias); } }
php
public function applyRelationFilters(string $relationName, string $alias, Builder $query) { foreach ($this->getRelationFilters($relationName) as $filter) { $filter->apply($query, $alias); } }
[ "public", "function", "applyRelationFilters", "(", "string", "$", "relationName", ",", "string", "$", "alias", ",", "Builder", "$", "query", ")", "{", "foreach", "(", "$", "this", "->", "getRelationFilters", "(", "$", "relationName", ")", "as", "$", "filter"...
Applies filters Eloquent Query builder for relation @param string $relationName Relation name @param string $alias SQL alias @param Builder $query Eloquent query builder @return void
[ "Applies", "filters", "Eloquent", "Query", "builder", "for", "relation" ]
093e515234fa0385b259ba4d8bc7832174a44eab
https://github.com/GrupaZero/core/blob/093e515234fa0385b259ba4d8bc7832174a44eab/src/Gzero/Core/Query/QueryBuilder.php#L298-L303
236,883
GrupaZero/core
src/Gzero/Core/Query/QueryBuilder.php
QueryBuilder.applySorts
public function applySorts(Builder $query, string $alias = null) { foreach ($this->getSorts() as $sort) { $sort->apply($query, $alias); } }
php
public function applySorts(Builder $query, string $alias = null) { foreach ($this->getSorts() as $sort) { $sort->apply($query, $alias); } }
[ "public", "function", "applySorts", "(", "Builder", "$", "query", ",", "string", "$", "alias", "=", "null", ")", "{", "foreach", "(", "$", "this", "->", "getSorts", "(", ")", "as", "$", "sort", ")", "{", "$", "sort", "->", "apply", "(", "$", "query...
Applies sorts Eloquent Query builder @param Builder $query Eloquent query builder @param string|null $alias SQL alias @return void
[ "Applies", "sorts", "Eloquent", "Query", "builder" ]
093e515234fa0385b259ba4d8bc7832174a44eab
https://github.com/GrupaZero/core/blob/093e515234fa0385b259ba4d8bc7832174a44eab/src/Gzero/Core/Query/QueryBuilder.php#L313-L318
236,884
GrupaZero/core
src/Gzero/Core/Query/QueryBuilder.php
QueryBuilder.applyRelationSorts
public function applyRelationSorts(string $relationName, string $alias, Builder $query) { foreach ($this->getRelationSorts($relationName) as $sorts) { $sorts->apply($query, $alias); } }
php
public function applyRelationSorts(string $relationName, string $alias, Builder $query) { foreach ($this->getRelationSorts($relationName) as $sorts) { $sorts->apply($query, $alias); } }
[ "public", "function", "applyRelationSorts", "(", "string", "$", "relationName", ",", "string", "$", "alias", ",", "Builder", "$", "query", ")", "{", "foreach", "(", "$", "this", "->", "getRelationSorts", "(", "$", "relationName", ")", "as", "$", "sorts", "...
Applies sorts Eloquent Query builder for relation @param string $relationName Relation name @param string $alias SQL alias @param Builder $query Eloquent query builder @return void
[ "Applies", "sorts", "Eloquent", "Query", "builder", "for", "relation" ]
093e515234fa0385b259ba4d8bc7832174a44eab
https://github.com/GrupaZero/core/blob/093e515234fa0385b259ba4d8bc7832174a44eab/src/Gzero/Core/Query/QueryBuilder.php#L329-L334
236,885
GrupaZero/core
src/Gzero/Core/Query/QueryBuilder.php
QueryBuilder.getArrayAndKeyName
protected function getArrayAndKeyName(string $fieldName, string $key): array { if (!in_array($key, ['filters', 'sorts'], true)) { throw new InvalidArgumentException('Key must be one of [filters, sorts]'); } if (str_contains($fieldName, '.')) { $path = explode('.', $fieldName); $name = array_pop($path); $relationPath = implode('.', $path); $array = array_get($this->relations, "$relationPath.$key", []); } else { $name = $fieldName; $array = ($key === 'filters') ? $this->filters : $this->sorts; } return [$name, $array]; }
php
protected function getArrayAndKeyName(string $fieldName, string $key): array { if (!in_array($key, ['filters', 'sorts'], true)) { throw new InvalidArgumentException('Key must be one of [filters, sorts]'); } if (str_contains($fieldName, '.')) { $path = explode('.', $fieldName); $name = array_pop($path); $relationPath = implode('.', $path); $array = array_get($this->relations, "$relationPath.$key", []); } else { $name = $fieldName; $array = ($key === 'filters') ? $this->filters : $this->sorts; } return [$name, $array]; }
[ "protected", "function", "getArrayAndKeyName", "(", "string", "$", "fieldName", ",", "string", "$", "key", ")", ":", "array", "{", "if", "(", "!", "in_array", "(", "$", "key", ",", "[", "'filters'", ",", "'sorts'", "]", ",", "true", ")", ")", "{", "t...
Helper function to figure out which array to use @param string $fieldName Field name @param string $key filters or sorts @throws InvalidArgumentException @return array
[ "Helper", "function", "to", "figure", "out", "which", "array", "to", "use" ]
093e515234fa0385b259ba4d8bc7832174a44eab
https://github.com/GrupaZero/core/blob/093e515234fa0385b259ba4d8bc7832174a44eab/src/Gzero/Core/Query/QueryBuilder.php#L346-L361
236,886
tokenly/platform-admin
src/Console/Kernel/PlatformAdminConsoleApplication.php
PlatformAdminConsoleApplication.getResolvedArtisanCommand
public function getResolvedArtisanCommand(InputInterface $input = null) { $name = $this->getCommandName($input); try { $command = $this->find($name); } catch (Exception $e) { EventLog::logError('command.notFound', $e, ['name' => $name]); return null; } return $command; }
php
public function getResolvedArtisanCommand(InputInterface $input = null) { $name = $this->getCommandName($input); try { $command = $this->find($name); } catch (Exception $e) { EventLog::logError('command.notFound', $e, ['name' => $name]); return null; } return $command; }
[ "public", "function", "getResolvedArtisanCommand", "(", "InputInterface", "$", "input", "=", "null", ")", "{", "$", "name", "=", "$", "this", "->", "getCommandName", "(", "$", "input", ")", ";", "try", "{", "$", "command", "=", "$", "this", "->", "find",...
resolve the artisan command
[ "resolve", "the", "artisan", "command" ]
0b2f5d57552d493026df94edaa250b475407d588
https://github.com/tokenly/platform-admin/blob/0b2f5d57552d493026df94edaa250b475407d588/src/Console/Kernel/PlatformAdminConsoleApplication.php#L15-L24
236,887
tasoftch/config
src/Config.php
Config.toArray
public function toArray($recursive = true) { $array = []; $data = $this->data; /** @var self $value */ foreach ($data as $key => $value) { if ($recursive && $value instanceof self) { $array[$key] = $value->toArray(); } else { $array[$key] = $value; } } return $array; }
php
public function toArray($recursive = true) { $array = []; $data = $this->data; /** @var self $value */ foreach ($data as $key => $value) { if ($recursive && $value instanceof self) { $array[$key] = $value->toArray(); } else { $array[$key] = $value; } } return $array; }
[ "public", "function", "toArray", "(", "$", "recursive", "=", "true", ")", "{", "$", "array", "=", "[", "]", ";", "$", "data", "=", "$", "this", "->", "data", ";", "/** @var self $value */", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", ...
Converts the instance to an array @param bool $recursive Converts containing configurations recursive as well. @return array
[ "Converts", "the", "instance", "to", "an", "array" ]
4937668bd7d56150edf3a77de5d529db6f6a4a80
https://github.com/tasoftch/config/blob/4937668bd7d56150edf3a77de5d529db6f6a4a80/src/Config.php#L157-L172
236,888
tasoftch/config
src/Config.php
Config._convertedValue
private function _convertedValue($value, $key, $prefix) { if($this->getTransformsToConfig()) { if(is_iterable($value)) $value = new static($value, $prefix ? "$prefix.$key" : $key, true); } return $value; }
php
private function _convertedValue($value, $key, $prefix) { if($this->getTransformsToConfig()) { if(is_iterable($value)) $value = new static($value, $prefix ? "$prefix.$key" : $key, true); } return $value; }
[ "private", "function", "_convertedValue", "(", "$", "value", ",", "$", "key", ",", "$", "prefix", ")", "{", "if", "(", "$", "this", "->", "getTransformsToConfig", "(", ")", ")", "{", "if", "(", "is_iterable", "(", "$", "value", ")", ")", "$", "value"...
Internal method to convert any value to a new configuration object if required. @internal @param $value @param $key @param $prefix @return Config
[ "Internal", "method", "to", "convert", "any", "value", "to", "a", "new", "configuration", "object", "if", "required", "." ]
4937668bd7d56150edf3a77de5d529db6f6a4a80
https://github.com/tasoftch/config/blob/4937668bd7d56150edf3a77de5d529db6f6a4a80/src/Config.php#L320-L326
236,889
zicht/goggle
src/Zicht/ConfigTool/Writer/Factory.php
Factory.createWriter
public static function createWriter($type) { switch ($type) { case self::JSON: return new Impl\Json(); case self::YAML: return new Impl\Yaml(); case self::INI: return new Impl\Ini(); case self::COLUMNS: return new Impl\Columns(); case self::TABLE: return new Impl\ConsoleTable(); case self::MARKDOWN: return new Impl\MarkdownTable(); case self::DUMP: return new Impl\Dump(); } throw new UnknownWriterTypeException("Sorry, writer type {$type} is not something I do"); }
php
public static function createWriter($type) { switch ($type) { case self::JSON: return new Impl\Json(); case self::YAML: return new Impl\Yaml(); case self::INI: return new Impl\Ini(); case self::COLUMNS: return new Impl\Columns(); case self::TABLE: return new Impl\ConsoleTable(); case self::MARKDOWN: return new Impl\MarkdownTable(); case self::DUMP: return new Impl\Dump(); } throw new UnknownWriterTypeException("Sorry, writer type {$type} is not something I do"); }
[ "public", "static", "function", "createWriter", "(", "$", "type", ")", "{", "switch", "(", "$", "type", ")", "{", "case", "self", "::", "JSON", ":", "return", "new", "Impl", "\\", "Json", "(", ")", ";", "case", "self", "::", "YAML", ":", "return", ...
Create a writer for the specified type. @param string $type @return WriterInterface
[ "Create", "a", "writer", "for", "the", "specified", "type", "." ]
f3b42bda9d3821ef2d387aef1091cba8afe2cff2
https://github.com/zicht/goggle/blob/f3b42bda9d3821ef2d387aef1091cba8afe2cff2/src/Zicht/ConfigTool/Writer/Factory.php#L40-L60
236,890
zicht/goggle
src/Zicht/ConfigTool/Writer/Factory.php
Factory.supportedTypes
public static function supportedTypes() { return [ self::YAML, self::JSON, self::INI, self::COLUMNS, self::TABLE, self::MARKDOWN, self::DUMP ]; }
php
public static function supportedTypes() { return [ self::YAML, self::JSON, self::INI, self::COLUMNS, self::TABLE, self::MARKDOWN, self::DUMP ]; }
[ "public", "static", "function", "supportedTypes", "(", ")", "{", "return", "[", "self", "::", "YAML", ",", "self", "::", "JSON", ",", "self", "::", "INI", ",", "self", "::", "COLUMNS", ",", "self", "::", "TABLE", ",", "self", "::", "MARKDOWN", ",", "...
Returns an array of supported output formats @return array
[ "Returns", "an", "array", "of", "supported", "output", "formats" ]
f3b42bda9d3821ef2d387aef1091cba8afe2cff2
https://github.com/zicht/goggle/blob/f3b42bda9d3821ef2d387aef1091cba8afe2cff2/src/Zicht/ConfigTool/Writer/Factory.php#L67-L78
236,891
remote-office/libx
src/External/SimplePay/Account/IncassoAccount.php
IncassoAccount.setHolder
public function setHolder($holder) { if(!is_string($holder) || strlen(trim($holder)) == 0) throw new InvalidArgumentException(__METHOD__ . '; Invalid holder, must be a non empty string'); $this->holder = $holder; }
php
public function setHolder($holder) { if(!is_string($holder) || strlen(trim($holder)) == 0) throw new InvalidArgumentException(__METHOD__ . '; Invalid holder, must be a non empty string'); $this->holder = $holder; }
[ "public", "function", "setHolder", "(", "$", "holder", ")", "{", "if", "(", "!", "is_string", "(", "$", "holder", ")", "||", "strlen", "(", "trim", "(", "$", "holder", ")", ")", "==", "0", ")", "throw", "new", "InvalidArgumentException", "(", "__METHOD...
Set the holder of this IncassoAccount @param string $holder @return void
[ "Set", "the", "holder", "of", "this", "IncassoAccount" ]
8baeaae99a6110e7c588bc0388df89a0dc0768b5
https://github.com/remote-office/libx/blob/8baeaae99a6110e7c588bc0388df89a0dc0768b5/src/External/SimplePay/Account/IncassoAccount.php#L53-L59
236,892
remote-office/libx
src/External/SimplePay/Account/IncassoAccount.php
IncassoAccount.setNumber
public function setNumber($number) { if(!is_string($number) || strlen(trim($number)) == 0) throw new InvalidArgumentException(__METHOD__ . '; Invalid number, must be a non empty string'); $this->number = $number; }
php
public function setNumber($number) { if(!is_string($number) || strlen(trim($number)) == 0) throw new InvalidArgumentException(__METHOD__ . '; Invalid number, must be a non empty string'); $this->number = $number; }
[ "public", "function", "setNumber", "(", "$", "number", ")", "{", "if", "(", "!", "is_string", "(", "$", "number", ")", "||", "strlen", "(", "trim", "(", "$", "number", ")", ")", "==", "0", ")", "throw", "new", "InvalidArgumentException", "(", "__METHOD...
Set the number of this IncassoAccount @param string $number @return void
[ "Set", "the", "number", "of", "this", "IncassoAccount" ]
8baeaae99a6110e7c588bc0388df89a0dc0768b5
https://github.com/remote-office/libx/blob/8baeaae99a6110e7c588bc0388df89a0dc0768b5/src/External/SimplePay/Account/IncassoAccount.php#L78-L84
236,893
remote-office/libx
src/External/SimplePay/Account/IncassoAccount.php
IncassoAccount.setCity
public function setCity($city) { if(!is_string($city) || strlen(trim($city)) == 0) throw new InvalidArgumentException(__METHOD__ . '; Invalid city, must be a non empty string'); $this->city = $city; }
php
public function setCity($city) { if(!is_string($city) || strlen(trim($city)) == 0) throw new InvalidArgumentException(__METHOD__ . '; Invalid city, must be a non empty string'); $this->city = $city; }
[ "public", "function", "setCity", "(", "$", "city", ")", "{", "if", "(", "!", "is_string", "(", "$", "city", ")", "||", "strlen", "(", "trim", "(", "$", "city", ")", ")", "==", "0", ")", "throw", "new", "InvalidArgumentException", "(", "__METHOD__", "...
Set the city of this IncassoAccount @param string $city @return void
[ "Set", "the", "city", "of", "this", "IncassoAccount" ]
8baeaae99a6110e7c588bc0388df89a0dc0768b5
https://github.com/remote-office/libx/blob/8baeaae99a6110e7c588bc0388df89a0dc0768b5/src/External/SimplePay/Account/IncassoAccount.php#L103-L109
236,894
harmony-project/modular-routing
source/ModularRouter.php
ModularRouter.getRouteCollectionForType
public function getRouteCollectionForType($type) { if (isset($this->collections[$type])) { return $this->collections[$type]; } if (!$this->metadataFactory->hasMetadataFor($type)) { throw new ResourceNotFoundException(sprintf('No metadata found for module type "%s".', $type)); } $metadata = $this->metadataFactory->getMetadataFor($type); $routes = $metadata->getRoutes(); // Add modular prefix to the collection $this->provider->addModularPrefix($routes); // Add route prefix to the collection $routes->addPrefix( $this->routePrefix['path'], $this->routePrefix['defaults'], $this->routePrefix['requirements'] ); return $this->collections[$type] = $routes; }
php
public function getRouteCollectionForType($type) { if (isset($this->collections[$type])) { return $this->collections[$type]; } if (!$this->metadataFactory->hasMetadataFor($type)) { throw new ResourceNotFoundException(sprintf('No metadata found for module type "%s".', $type)); } $metadata = $this->metadataFactory->getMetadataFor($type); $routes = $metadata->getRoutes(); // Add modular prefix to the collection $this->provider->addModularPrefix($routes); // Add route prefix to the collection $routes->addPrefix( $this->routePrefix['path'], $this->routePrefix['defaults'], $this->routePrefix['requirements'] ); return $this->collections[$type] = $routes; }
[ "public", "function", "getRouteCollectionForType", "(", "$", "type", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "collections", "[", "$", "type", "]", ")", ")", "{", "return", "$", "this", "->", "collections", "[", "$", "type", "]", ";", "}...
Returns the route collection for a module type. @param string $type @return RouteCollection
[ "Returns", "the", "route", "collection", "for", "a", "module", "type", "." ]
399bb427678ddc17c67295c738b96faea485e2d8
https://github.com/harmony-project/modular-routing/blob/399bb427678ddc17c67295c738b96faea485e2d8/source/ModularRouter.php#L278-L302
236,895
harmony-project/modular-routing
source/ModularRouter.php
ModularRouter.getGeneratorForModule
public function getGeneratorForModule(ModuleInterface $module) { $type = $module->getModularType(); $collection = $this->getRouteCollectionForType($type); if (array_key_exists($type, $this->generators)) { return $this->generators[$type]; } if (null === $this->options['cache_dir']) { return $this->generators[$type] = new $this->options['generator_class']($collection, $this->context, $this->logger); } $cacheClass = sprintf('%s_UrlGenerator', $type); $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'] . '/' . $cacheClass .'.php', function (ConfigCacheInterface $cache) use ($cacheClass, $collection) { /** @var GeneratorDumperInterface $dumper */ $dumper = new $this->options['generator_dumper_class']($collection); $options = [ 'class' => $cacheClass, 'base_class' => $this->options['generator_base_class'], ]; $cache->write($dumper->dump($options), $collection->getResources()); } ); require_once $cache->getPath(); return $this->generators[$type] = new $cacheClass($this->context, $this->logger); }
php
public function getGeneratorForModule(ModuleInterface $module) { $type = $module->getModularType(); $collection = $this->getRouteCollectionForType($type); if (array_key_exists($type, $this->generators)) { return $this->generators[$type]; } if (null === $this->options['cache_dir']) { return $this->generators[$type] = new $this->options['generator_class']($collection, $this->context, $this->logger); } $cacheClass = sprintf('%s_UrlGenerator', $type); $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'] . '/' . $cacheClass .'.php', function (ConfigCacheInterface $cache) use ($cacheClass, $collection) { /** @var GeneratorDumperInterface $dumper */ $dumper = new $this->options['generator_dumper_class']($collection); $options = [ 'class' => $cacheClass, 'base_class' => $this->options['generator_base_class'], ]; $cache->write($dumper->dump($options), $collection->getResources()); } ); require_once $cache->getPath(); return $this->generators[$type] = new $cacheClass($this->context, $this->logger); }
[ "public", "function", "getGeneratorForModule", "(", "ModuleInterface", "$", "module", ")", "{", "$", "type", "=", "$", "module", "->", "getModularType", "(", ")", ";", "$", "collection", "=", "$", "this", "->", "getRouteCollectionForType", "(", "$", "type", ...
Returns a generator for a module. @param ModuleInterface $module @return UrlGeneratorInterface
[ "Returns", "a", "generator", "for", "a", "module", "." ]
399bb427678ddc17c67295c738b96faea485e2d8
https://github.com/harmony-project/modular-routing/blob/399bb427678ddc17c67295c738b96faea485e2d8/source/ModularRouter.php#L327-L359
236,896
harmony-project/modular-routing
source/ModularRouter.php
ModularRouter.getModuleByRequest
public function getModuleByRequest(Request $request) { $parameters = $this->getInitialMatcher()->matchRequest($request); // Since a matcher throws an exception on failure, this will only be reached // if the match was successful. return $this->provider->loadModuleByRequest($request, $parameters); }
php
public function getModuleByRequest(Request $request) { $parameters = $this->getInitialMatcher()->matchRequest($request); // Since a matcher throws an exception on failure, this will only be reached // if the match was successful. return $this->provider->loadModuleByRequest($request, $parameters); }
[ "public", "function", "getModuleByRequest", "(", "Request", "$", "request", ")", "{", "$", "parameters", "=", "$", "this", "->", "getInitialMatcher", "(", ")", "->", "matchRequest", "(", "$", "request", ")", ";", "// Since a matcher throws an exception on failure, t...
Returns a module by matching the request. @param Request $request The request to match @return ModuleInterface @throws ResourceNotFoundException If no matching resource or module could be found @throws MethodNotAllowedException If a matching resource was found but the request method is not allowed
[ "Returns", "a", "module", "by", "matching", "the", "request", "." ]
399bb427678ddc17c67295c738b96faea485e2d8
https://github.com/harmony-project/modular-routing/blob/399bb427678ddc17c67295c738b96faea485e2d8/source/ModularRouter.php#L411-L419
236,897
harmony-project/modular-routing
source/ModularRouter.php
ModularRouter.getInitialMatcher
public function getInitialMatcher() { if (null !== $this->initialMatcher) { return $this->initialMatcher; } $route = sprintf('%s/{_modular_path}', $this->routePrefix['path']); $collection = new RouteCollection; $collection->add('modular', new Route( $route, $this->routePrefix['defaults'], array_merge( $this->routePrefix['requirements'], ['_modular_path' => '.+'] ) )); return $this->initialMatcher = new UrlMatcher($collection, $this->context); }
php
public function getInitialMatcher() { if (null !== $this->initialMatcher) { return $this->initialMatcher; } $route = sprintf('%s/{_modular_path}', $this->routePrefix['path']); $collection = new RouteCollection; $collection->add('modular', new Route( $route, $this->routePrefix['defaults'], array_merge( $this->routePrefix['requirements'], ['_modular_path' => '.+'] ) )); return $this->initialMatcher = new UrlMatcher($collection, $this->context); }
[ "public", "function", "getInitialMatcher", "(", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "initialMatcher", ")", "{", "return", "$", "this", "->", "initialMatcher", ";", "}", "$", "route", "=", "sprintf", "(", "'%s/{_modular_path}'", ",", "$",...
Returns a matcher that matches a Request to the route prefix. @return UrlMatcher
[ "Returns", "a", "matcher", "that", "matches", "a", "Request", "to", "the", "route", "prefix", "." ]
399bb427678ddc17c67295c738b96faea485e2d8
https://github.com/harmony-project/modular-routing/blob/399bb427678ddc17c67295c738b96faea485e2d8/source/ModularRouter.php#L426-L445
236,898
calgamo/logger
src/Logger/FileLogger.php
FileLogger.getLogFileName
private function getLogFileName() : string { $file_name = $this->file_name; if ($this->filename_processor){ $file_name = $this->filename_processor->process($file_name); } $file_name = self::escapeFileName($file_name); return $file_name; }
php
private function getLogFileName() : string { $file_name = $this->file_name; if ($this->filename_processor){ $file_name = $this->filename_processor->process($file_name); } $file_name = self::escapeFileName($file_name); return $file_name; }
[ "private", "function", "getLogFileName", "(", ")", ":", "string", "{", "$", "file_name", "=", "$", "this", "->", "file_name", ";", "if", "(", "$", "this", "->", "filename_processor", ")", "{", "$", "file_name", "=", "$", "this", "->", "filename_processor",...
Get log file name @return string
[ "Get", "log", "file", "name" ]
58aab9ddfe3f383337c61cad1f4742ce5afb9591
https://github.com/calgamo/logger/blob/58aab9ddfe3f383337c61cad1f4742ce5afb9591/src/Logger/FileLogger.php#L173-L181
236,899
Rockbeat-Sky/framework
src/core/Router.php
Router._initialize
protected function _initialize(){ // Fetch the complete URI string $this->uri->_fetch_uri_string(); // Do we need to remove the URL suffix? $this->uri->_remove_url_suffix(); // Compile the segments into an array $this->uri->_explode_segments(); // Set Segments $this->segments = $this->uri->segments; // Parse any custom routing that may exist $this->_parseRoutes(); // Re-index the segment array so that it starts with 1 rather than 0 $this->uri->_reindex_segments(); }
php
protected function _initialize(){ // Fetch the complete URI string $this->uri->_fetch_uri_string(); // Do we need to remove the URL suffix? $this->uri->_remove_url_suffix(); // Compile the segments into an array $this->uri->_explode_segments(); // Set Segments $this->segments = $this->uri->segments; // Parse any custom routing that may exist $this->_parseRoutes(); // Re-index the segment array so that it starts with 1 rather than 0 $this->uri->_reindex_segments(); }
[ "protected", "function", "_initialize", "(", ")", "{", "// Fetch the complete URI string", "$", "this", "->", "uri", "->", "_fetch_uri_string", "(", ")", ";", "// Do we need to remove the URL suffix?", "$", "this", "->", "uri", "->", "_remove_url_suffix", "(", ")", ...
Set the route mapping This function determines what should be served based on the URI request, as well as any "routes" that have been set in the routing config file. @access private @return void
[ "Set", "the", "route", "mapping" ]
e8ffd04f2fdc27a62b185b342f32bf58899ceda4
https://github.com/Rockbeat-Sky/framework/blob/e8ffd04f2fdc27a62b185b342f32bf58899ceda4/src/core/Router.php#L100-L121