repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
php-lug/lug
src/Component/Resource/Domain/DomainManager.php
DomainManager.doCreate
protected function doCreate($object, $flush = true) { $this->manager->persist($object); if ($flush) { $this->flush($object); } }
php
protected function doCreate($object, $flush = true) { $this->manager->persist($object); if ($flush) { $this->flush($object); } }
[ "protected", "function", "doCreate", "(", "$", "object", ",", "$", "flush", "=", "true", ")", "{", "$", "this", "->", "manager", "->", "persist", "(", "$", "object", ")", ";", "if", "(", "$", "flush", ")", "{", "$", "this", "->", "flush", "(", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Resource/Domain/DomainManager.php#L63-L70
php-lug/lug
src/Component/Resource/Domain/DomainManager.php
DomainManager.doUpdate
protected function doUpdate($object, $flush = true) { if (!$this->manager->contains($object)) { $this->manager->persist($object); } if ($flush) { $this->flush($object); } }
php
protected function doUpdate($object, $flush = true) { if (!$this->manager->contains($object)) { $this->manager->persist($object); } if ($flush) { $this->flush($object); } }
[ "protected", "function", "doUpdate", "(", "$", "object", ",", "$", "flush", "=", "true", ")", "{", "if", "(", "!", "$", "this", "->", "manager", "->", "contains", "(", "$", "object", ")", ")", "{", "$", "this", "->", "manager", "->", "persist", "("...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Resource/Domain/DomainManager.php#L75-L84
php-lug/lug
src/Component/Resource/Domain/DomainManager.php
DomainManager.doDelete
protected function doDelete($object, $flush = true) { $this->manager->remove($object); if ($flush) { $this->flush($object); } }
php
protected function doDelete($object, $flush = true) { $this->manager->remove($object); if ($flush) { $this->flush($object); } }
[ "protected", "function", "doDelete", "(", "$", "object", ",", "$", "flush", "=", "true", ")", "{", "$", "this", "->", "manager", "->", "remove", "(", "$", "object", ")", ";", "if", "(", "$", "flush", ")", "{", "$", "this", "->", "flush", "(", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Resource/Domain/DomainManager.php#L89-L96
heidelpay/PhpDoc
src/phpDocumentor/Configuration/Merger.php
Merger.run
public function run($destination, $source, $default = null) { $result = null; if (is_object($destination) && is_object($source) && get_class($destination) == get_class($source)) { $result = $this->mergeObject($destination, $source); } elseif (is_array($source) && is_array($desti...
php
public function run($destination, $source, $default = null) { $result = null; if (is_object($destination) && is_object($source) && get_class($destination) == get_class($source)) { $result = $this->mergeObject($destination, $source); } elseif (is_array($source) && is_array($desti...
[ "public", "function", "run", "(", "$", "destination", ",", "$", "source", ",", "$", "default", "=", "null", ")", "{", "$", "result", "=", "null", ";", "if", "(", "is_object", "(", "$", "destination", ")", "&&", "is_object", "(", "$", "source", ")", ...
Merges the source on top of the destination and returns the result. @param mixed $destination The destination variable that will be overwritten with the data from the source. @param mixed $source The source variable that should be merged over the destination. @param mixed $default For normal variables; only r...
[ "Merges", "the", "source", "on", "top", "of", "the", "destination", "and", "returns", "the", "result", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Configuration/Merger.php#L48-L61
heidelpay/PhpDoc
src/phpDocumentor/Configuration/Merger.php
Merger.mergeObject
private function mergeObject($destinationObject, $sourceObject) { $reflectedDestination = new \ReflectionObject($destinationObject); $reflectedSource = new \ReflectionObject($sourceObject); $defaultPropertyValues = $reflectedDestination->getDefaultProperties(); foreach ($refl...
php
private function mergeObject($destinationObject, $sourceObject) { $reflectedDestination = new \ReflectionObject($destinationObject); $reflectedSource = new \ReflectionObject($sourceObject); $defaultPropertyValues = $reflectedDestination->getDefaultProperties(); foreach ($refl...
[ "private", "function", "mergeObject", "(", "$", "destinationObject", ",", "$", "sourceObject", ")", "{", "$", "reflectedDestination", "=", "new", "\\", "ReflectionObject", "(", "$", "destinationObject", ")", ";", "$", "reflectedSource", "=", "new", "\\", "Reflec...
Deep-merge the source object over the destination object and return the results. @param object $destinationObject @param object $sourceObject @return object
[ "Deep", "-", "merge", "the", "source", "object", "over", "the", "destination", "object", "and", "return", "the", "results", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Configuration/Merger.php#L71-L88
heidelpay/PhpDoc
src/phpDocumentor/Configuration/Merger.php
Merger.mergeArray
private function mergeArray($destinationArray, $sourceArray) { $result = array(); foreach ($destinationArray as $key => $destinationArrayItem) { if (is_int($key)) { $result[] = $destinationArrayItem; } else { $result[$key] = $destinationArrayIt...
php
private function mergeArray($destinationArray, $sourceArray) { $result = array(); foreach ($destinationArray as $key => $destinationArrayItem) { if (is_int($key)) { $result[] = $destinationArrayItem; } else { $result[$key] = $destinationArrayIt...
[ "private", "function", "mergeArray", "(", "$", "destinationArray", ",", "$", "sourceArray", ")", "{", "$", "result", "=", "array", "(", ")", ";", "foreach", "(", "$", "destinationArray", "as", "$", "key", "=>", "$", "destinationArrayItem", ")", "{", "if", ...
Deep-merges the source array over the destination array. @param array $destinationArray @param array $sourceArray @return array
[ "Deep", "-", "merges", "the", "source", "array", "over", "the", "destination", "array", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Configuration/Merger.php#L98-L118
heidelpay/PhpDoc
src/phpDocumentor/Configuration/Merger.php
Merger.mergeProperty
private function mergeProperty( $destinationObject, \ReflectionProperty $destinationProperty, $sourceObject, \ReflectionProperty $sourceProperty, array $defaultPropertyValues ) { // Allow the source and destination properties to be readable $sourceProperty->se...
php
private function mergeProperty( $destinationObject, \ReflectionProperty $destinationProperty, $sourceObject, \ReflectionProperty $sourceProperty, array $defaultPropertyValues ) { // Allow the source and destination properties to be readable $sourceProperty->se...
[ "private", "function", "mergeProperty", "(", "$", "destinationObject", ",", "\\", "ReflectionProperty", "$", "destinationProperty", ",", "$", "sourceObject", ",", "\\", "ReflectionProperty", "$", "sourceProperty", ",", "array", "$", "defaultPropertyValues", ")", "{", ...
Merges the two properties over eachother. @param object $destinationObject @param \ReflectionProperty $destinationProperty @param object $sourceObject @param \ReflectionProperty $sourceProperty @param mixed[] $defaultPropertyValues @return object
[ "Merges", "the", "two", "properties", "over", "eachother", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Configuration/Merger.php#L131-L171
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/parts/fileparts/stream_file.php
ezcMailStreamFile.generateBody
public function generateBody() { $contents = stream_get_contents( $this->stream ); return chunk_split( base64_encode( $contents ), 76, ezcMailTools::lineBreak() ); }
php
public function generateBody() { $contents = stream_get_contents( $this->stream ); return chunk_split( base64_encode( $contents ), 76, ezcMailTools::lineBreak() ); }
[ "public", "function", "generateBody", "(", ")", "{", "$", "contents", "=", "stream_get_contents", "(", "$", "this", "->", "stream", ")", ";", "return", "chunk_split", "(", "base64_encode", "(", "$", "contents", ")", ",", "76", ",", "ezcMailTools", "::", "l...
Returns the contents of the file with the correct encoding. The stream might become unusable after this if it doesn't support seek. @return string
[ "Returns", "the", "contents", "of", "the", "file", "with", "the", "correct", "encoding", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/parts/fileparts/stream_file.php#L123-L127
bobfridley/laravel-vonage
src/Authenticators/PasswordAuthenticator.php
PasswordAuthenticator.authenticate
public function authenticate(array $config) { if (!$this->client) { throw new InvalidArgumentException('The client instance was not given to the password authenticator.'); } if (!array_key_exists('username', $config) || !array_key_exists('password', $config)) { throw...
php
public function authenticate(array $config) { if (!$this->client) { throw new InvalidArgumentException('The client instance was not given to the password authenticator.'); } if (!array_key_exists('username', $config) || !array_key_exists('password', $config)) { throw...
[ "public", "function", "authenticate", "(", "array", "$", "config", ")", "{", "if", "(", "!", "$", "this", "->", "client", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'The client instance was not given to the password authenticator.'", ")", ";", "}", ...
Authenticate the client, and return it. @param string[] $config @throws \InvalidArgumentException @return \GuzzleHttp\Client
[ "Authenticate", "the", "client", "and", "return", "it", "." ]
train
https://github.com/bobfridley/laravel-vonage/blob/e422af44a449c3147878c317b865508b1afa50e6/src/Authenticators/PasswordAuthenticator.php#L32-L45
NuclearCMS/Hierarchy
src/Node.php
Node.boot
protected static function boot() { parent::boot(); static::addGlobalScope(new MailingScope); static::creating(function ($node) { if (empty($node->published_at)) { $node->published_at = Carbon::now(); } $node->fireNode...
php
protected static function boot() { parent::boot(); static::addGlobalScope(new MailingScope); static::creating(function ($node) { if (empty($node->published_at)) { $node->published_at = Carbon::now(); } $node->fireNode...
[ "protected", "static", "function", "boot", "(", ")", "{", "parent", "::", "boot", "(", ")", ";", "static", "::", "addGlobalScope", "(", "new", "MailingScope", ")", ";", "static", "::", "creating", "(", "function", "(", "$", "node", ")", "{", "if", "(",...
Boot model events
[ "Boot", "model", "events" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L184-L221
NuclearCMS/Hierarchy
src/Node.php
Node.propagateIdToSources
public function propagateIdToSources($save = true) { foreach ($this->translations as $source) { $source->setExtensionNodeId($this->getKey(), $save); } }
php
public function propagateIdToSources($save = true) { foreach ($this->translations as $source) { $source->setExtensionNodeId($this->getKey(), $save); } }
[ "public", "function", "propagateIdToSources", "(", "$", "save", "=", "true", ")", "{", "foreach", "(", "$", "this", "->", "translations", "as", "$", "source", ")", "{", "$", "source", "->", "setExtensionNodeId", "(", "$", "this", "->", "getKey", "(", ")"...
Propagates self id to sources The save parameter is to prevent saving sources prematurely @param bool $save
[ "Propagates", "self", "id", "to", "sources" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L239-L245
NuclearCMS/Hierarchy
src/Node.php
Node.validateCanHaveParentOfType
public function validateCanHaveParentOfType() { if (is_null($this->parent)) { return; } $allowedNodeTypes = json_decode($this->parent->getNodeType()->allowed_children); if (empty($allowedNodeTypes) || in_array($this->getNodeTypeKey(), $allowedNodeTypes)) ...
php
public function validateCanHaveParentOfType() { if (is_null($this->parent)) { return; } $allowedNodeTypes = json_decode($this->parent->getNodeType()->allowed_children); if (empty($allowedNodeTypes) || in_array($this->getNodeTypeKey(), $allowedNodeTypes)) ...
[ "public", "function", "validateCanHaveParentOfType", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "parent", ")", ")", "{", "return", ";", "}", "$", "allowedNodeTypes", "=", "json_decode", "(", "$", "this", "->", "parent", "->", "getNodeType...
Validates parent type
[ "Validates", "parent", "type" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L251-L266
NuclearCMS/Hierarchy
src/Node.php
Node.getNodeType
public function getNodeType() { $bag = hierarchy_bag('nodetype'); if ($this->relationLoaded('nodeType')) { $nodeType = $this->getRelation('nodeType'); } elseif ($nodeType = $bag->getNodeType($this->getNodeTypeKey())) { $this->setRelation('nodeType', $...
php
public function getNodeType() { $bag = hierarchy_bag('nodetype'); if ($this->relationLoaded('nodeType')) { $nodeType = $this->getRelation('nodeType'); } elseif ($nodeType = $bag->getNodeType($this->getNodeTypeKey())) { $this->setRelation('nodeType', $...
[ "public", "function", "getNodeType", "(", ")", "{", "$", "bag", "=", "hierarchy_bag", "(", "'nodetype'", ")", ";", "if", "(", "$", "this", "->", "relationLoaded", "(", "'nodeType'", ")", ")", "{", "$", "nodeType", "=", "$", "this", "->", "getRelation", ...
Getter for node type @return NodeType
[ "Getter", "for", "node", "type" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L295-L318
NuclearCMS/Hierarchy
src/Node.php
Node.getNodeTypeName
public function getNodeTypeName() { return $this->nodeTypeName ?: (is_null($this->getNodeType()) ? null : $this->getNodeType()->getName()); }
php
public function getNodeTypeName() { return $this->nodeTypeName ?: (is_null($this->getNodeType()) ? null : $this->getNodeType()->getName()); }
[ "public", "function", "getNodeTypeName", "(", ")", "{", "return", "$", "this", "->", "nodeTypeName", "?", ":", "(", "is_null", "(", "$", "this", "->", "getNodeType", "(", ")", ")", "?", "null", ":", "$", "this", "->", "getNodeType", "(", ")", "->", "...
Gets the node type name @return int $id
[ "Gets", "the", "node", "type", "name" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L335-L339
NuclearCMS/Hierarchy
src/Node.php
Node.setNodeTypeByKey
public function setNodeTypeByKey($id) { $nodeType = NodeType::findOrFail($id); $this->nodeType()->associate($nodeType); $this->mailing = $nodeType->isTypeMailing(); }
php
public function setNodeTypeByKey($id) { $nodeType = NodeType::findOrFail($id); $this->nodeType()->associate($nodeType); $this->mailing = $nodeType->isTypeMailing(); }
[ "public", "function", "setNodeTypeByKey", "(", "$", "id", ")", "{", "$", "nodeType", "=", "NodeType", "::", "findOrFail", "(", "$", "id", ")", ";", "$", "this", "->", "nodeType", "(", ")", "->", "associate", "(", "$", "nodeType", ")", ";", "$", "this...
Sets the node type by key and validates it @param int $id @return NodeType
[ "Sets", "the", "node", "type", "by", "key", "and", "validates", "it" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L367-L374
NuclearCMS/Hierarchy
src/Node.php
Node.isTranslationAttribute
public function isTranslationAttribute($key) { if ($this->isSpecialAttribute($key)) { return false; } // When there is no node type we exclude source attributes return $this->_isTranslationAttribute($key) || (is_null($this->getNodeTypeName()) ? false : $t...
php
public function isTranslationAttribute($key) { if ($this->isSpecialAttribute($key)) { return false; } // When there is no node type we exclude source attributes return $this->_isTranslationAttribute($key) || (is_null($this->getNodeTypeName()) ? false : $t...
[ "public", "function", "isTranslationAttribute", "(", "$", "key", ")", "{", "if", "(", "$", "this", "->", "isSpecialAttribute", "(", "$", "key", ")", ")", "{", "return", "false", ";", "}", "// When there is no node type we exclude source attributes", "return", "$",...
Checks if key is a translation attribute @param string $key @return bool
[ "Checks", "if", "key", "is", "a", "translation", "attribute" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L382-L392
NuclearCMS/Hierarchy
src/Node.php
Node.isSourceAttribute
protected function isSourceAttribute($key) { $modelName = source_model_name($this->getNodeTypeName(), true); return in_array($key, call_user_func([$modelName, 'getSourceFields'])); }
php
protected function isSourceAttribute($key) { $modelName = source_model_name($this->getNodeTypeName(), true); return in_array($key, call_user_func([$modelName, 'getSourceFields'])); }
[ "protected", "function", "isSourceAttribute", "(", "$", "key", ")", "{", "$", "modelName", "=", "source_model_name", "(", "$", "this", "->", "getNodeTypeName", "(", ")", ",", "true", ")", ";", "return", "in_array", "(", "$", "key", ",", "call_user_func", "...
Checks if a key is a node source attribute @param $key @return bool
[ "Checks", "if", "a", "key", "is", "a", "node", "source", "attribute" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L417-L422
NuclearCMS/Hierarchy
src/Node.php
Node.scopeWhereExtensionAttribute
public function scopeWhereExtensionAttribute(Builder $query, $type, $key, $value) { // We do this for querying, searching and sorting with source attributes $this->setNodeTypeName($type); return $query->whereHas('nodeSourceExtensions', function (Builder $query) use ($key, $value) { ...
php
public function scopeWhereExtensionAttribute(Builder $query, $type, $key, $value) { // We do this for querying, searching and sorting with source attributes $this->setNodeTypeName($type); return $query->whereHas('nodeSourceExtensions', function (Builder $query) use ($key, $value) { ...
[ "public", "function", "scopeWhereExtensionAttribute", "(", "Builder", "$", "query", ",", "$", "type", ",", "$", "key", ",", "$", "value", ")", "{", "// We do this for querying, searching and sorting with source attributes", "$", "this", "->", "setNodeTypeName", "(", "...
This scope filters results by checking the translation fields. @param \Illuminate\Database\Eloquent\Builder $query @param string $type @param string $key @param string $value @return \Illuminate\Database\Eloquent\Builder|static
[ "This", "scope", "filters", "results", "by", "checking", "the", "translation", "fields", "." ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L434-L443
NuclearCMS/Hierarchy
src/Node.php
Node.getNewTranslation
public function getNewTranslation($locale) { $nodeSource = NodeSource::newWithType( $locale, $this->getNodeTypeName() ); $this->translations->add($nodeSource); return $nodeSource; }
php
public function getNewTranslation($locale) { $nodeSource = NodeSource::newWithType( $locale, $this->getNodeTypeName() ); $this->translations->add($nodeSource); return $nodeSource; }
[ "public", "function", "getNewTranslation", "(", "$", "locale", ")", "{", "$", "nodeSource", "=", "NodeSource", "::", "newWithType", "(", "$", "locale", ",", "$", "this", "->", "getNodeTypeName", "(", ")", ")", ";", "$", "this", "->", "translations", "->", ...
Overloading default Translatable functionality for creating a new translation @param string $locale @return Model
[ "Overloading", "default", "Translatable", "functionality", "for", "creating", "a", "new", "translation" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L477-L487
NuclearCMS/Hierarchy
src/Node.php
Node.getTranslationAttribute
public function getTranslationAttribute($key, $locale = null, $fallback = true, $unmutated = false) { if ($this->isTranslationAttribute($key)) { $translation = $this->translate($locale); $attribute = ($translation) ? ($unmutated ? $translation->getUnmutatedAt...
php
public function getTranslationAttribute($key, $locale = null, $fallback = true, $unmutated = false) { if ($this->isTranslationAttribute($key)) { $translation = $this->translate($locale); $attribute = ($translation) ? ($unmutated ? $translation->getUnmutatedAt...
[ "public", "function", "getTranslationAttribute", "(", "$", "key", ",", "$", "locale", "=", "null", ",", "$", "fallback", "=", "true", ",", "$", "unmutated", "=", "false", ")", "{", "if", "(", "$", "this", "->", "isTranslationAttribute", "(", "$", "key", ...
Returns a translation attribute (optionally with fallback) @param string $key @param string $locale @param bool $fallback @param bool $unmutated @return string|null
[ "Returns", "a", "translation", "attribute", "(", "optionally", "with", "fallback", ")" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L499-L523
NuclearCMS/Hierarchy
src/Node.php
Node.translateOrFirst
public function translateOrFirst($locale = null) { $translation = $this->translate($locale, true); if ( ! $translation) { $translation = $this->translations->first(); } return $translation; }
php
public function translateOrFirst($locale = null) { $translation = $this->translate($locale, true); if ( ! $translation) { $translation = $this->translations->first(); } return $translation; }
[ "public", "function", "translateOrFirst", "(", "$", "locale", "=", "null", ")", "{", "$", "translation", "=", "$", "this", "->", "translate", "(", "$", "locale", ",", "true", ")", ";", "if", "(", "!", "$", "translation", ")", "{", "$", "translation", ...
Get source or fallback to first found translation @param string|null $locale @return NodeSource
[ "Get", "source", "or", "fallback", "to", "first", "found", "translation" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L531-L541
NuclearCMS/Hierarchy
src/Node.php
Node.determineSortableKey
protected function determineSortableKey($key) { // We need to allow source attributes here if (in_array($key, $this->sortableColumns) || $this->isTranslationAttribute($key)) { return $key; } return $this->getDefaultSortableKey(); }
php
protected function determineSortableKey($key) { // We need to allow source attributes here if (in_array($key, $this->sortableColumns) || $this->isTranslationAttribute($key)) { return $key; } return $this->getDefaultSortableKey(); }
[ "protected", "function", "determineSortableKey", "(", "$", "key", ")", "{", "// We need to allow source attributes here", "if", "(", "in_array", "(", "$", "key", ",", "$", "this", "->", "sortableColumns", ")", "||", "$", "this", "->", "isTranslationAttribute", "("...
Determines the sortable key from the map @param string $key @return string
[ "Determines", "the", "sortable", "key", "from", "the", "map" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L569-L578
NuclearCMS/Hierarchy
src/Node.php
Node.scopeSortedBySourceAttribute
public function scopeSortedBySourceAttribute(Builder $query, $attribute, $direction = 'ASC') { return $this->orderQueryBySourceAttribute($query, $attribute, $direction); }
php
public function scopeSortedBySourceAttribute(Builder $query, $attribute, $direction = 'ASC') { return $this->orderQueryBySourceAttribute($query, $attribute, $direction); }
[ "public", "function", "scopeSortedBySourceAttribute", "(", "Builder", "$", "query", ",", "$", "attribute", ",", "$", "direction", "=", "'ASC'", ")", "{", "return", "$", "this", "->", "orderQueryBySourceAttribute", "(", "$", "query", ",", "$", "attribute", ",",...
Sorts by source attribute @param Builder $query @param string $attribute @param string $direction @return Builder
[ "Sorts", "by", "source", "attribute" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L588-L591
NuclearCMS/Hierarchy
src/Node.php
Node.scopeWithName
public function scopeWithName(Builder $query, $name, $locale = null) { return $this->scopeWhereTranslation($query, 'node_name', $name, $locale); }
php
public function scopeWithName(Builder $query, $name, $locale = null) { return $this->scopeWhereTranslation($query, 'node_name', $name, $locale); }
[ "public", "function", "scopeWithName", "(", "Builder", "$", "query", ",", "$", "name", ",", "$", "locale", "=", "null", ")", "{", "return", "$", "this", "->", "scopeWhereTranslation", "(", "$", "query", ",", "'node_name'", ",", "$", "name", ",", "$", "...
Scope for selecting with name @param Builder $query @param string $name @param string|null $locale @return Builder
[ "Scope", "for", "selecting", "with", "name" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L621-L624
NuclearCMS/Hierarchy
src/Node.php
Node.scopeWithType
public function scopeWithType(Builder $query, $type) { // We do this for querying, searching and sorting with source attributes $this->setNodeTypeName($type); return $this->scopeWhereTranslation($query, 'source_type', $type, null); }
php
public function scopeWithType(Builder $query, $type) { // We do this for querying, searching and sorting with source attributes $this->setNodeTypeName($type); return $this->scopeWhereTranslation($query, 'source_type', $type, null); }
[ "public", "function", "scopeWithType", "(", "Builder", "$", "query", ",", "$", "type", ")", "{", "// We do this for querying, searching and sorting with source attributes", "$", "this", "->", "setNodeTypeName", "(", "$", "type", ")", ";", "return", "$", "this", "->"...
Scope for selecting with type @param Builder $query @param string $type @return Builder
[ "Scope", "for", "selecting", "with", "type" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L633-L639
NuclearCMS/Hierarchy
src/Node.php
Node.scopeFilteredByStatus
public function scopeFilteredByStatus(Builder $query, $status = null) { $status = is_null($status) ? request('f', 'all') : $status; if (in_array($status, ['published', 'withheld', 'draft', 'pending', 'archived', 'invisible', 'locked'])) { $query->{$status}(); } ...
php
public function scopeFilteredByStatus(Builder $query, $status = null) { $status = is_null($status) ? request('f', 'all') : $status; if (in_array($status, ['published', 'withheld', 'draft', 'pending', 'archived', 'invisible', 'locked'])) { $query->{$status}(); } ...
[ "public", "function", "scopeFilteredByStatus", "(", "Builder", "$", "query", ",", "$", "status", "=", "null", ")", "{", "$", "status", "=", "is_null", "(", "$", "status", ")", "?", "request", "(", "'f'", ",", "'all'", ")", ":", "$", "status", ";", "i...
Status filter scope @param Builder $query @param string $status @return Builder
[ "Status", "filter", "scope" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L648-L658
NuclearCMS/Hierarchy
src/Node.php
Node.scopePublished
public function scopePublished(Builder $query) { return $query->where(function ($query) { $query->where('status', '>=', Node::PUBLISHED) ->orWhere(function ($query) { $query->where('status', '>=', Node::PENDING) ...
php
public function scopePublished(Builder $query) { return $query->where(function ($query) { $query->where('status', '>=', Node::PUBLISHED) ->orWhere(function ($query) { $query->where('status', '>=', Node::PENDING) ...
[ "public", "function", "scopePublished", "(", "Builder", "$", "query", ")", "{", "return", "$", "query", "->", "where", "(", "function", "(", "$", "query", ")", "{", "$", "query", "->", "where", "(", "'status'", ",", "'>='", ",", "Node", "::", "PUBLISHE...
Published scope @param Builder $query @return Builder
[ "Published", "scope" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L667-L678
NuclearCMS/Hierarchy
src/Node.php
Node.scopeWithheld
public function scopeWithheld(Builder $query) { return $query->where(function ($query) { $query->where('status', '<=', Node::DRAFT) ->orWhere(function ($query) { $query->where('status', '<=', Node::PENDING) ->whe...
php
public function scopeWithheld(Builder $query) { return $query->where(function ($query) { $query->where('status', '<=', Node::DRAFT) ->orWhere(function ($query) { $query->where('status', '<=', Node::PENDING) ->whe...
[ "public", "function", "scopeWithheld", "(", "Builder", "$", "query", ")", "{", "return", "$", "query", "->", "where", "(", "function", "(", "$", "query", ")", "{", "$", "query", "->", "where", "(", "'status'", ",", "'<='", ",", "Node", "::", "DRAFT", ...
Withheld scope @param Builder $query @return Builder
[ "Withheld", "scope" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L686-L697
NuclearCMS/Hierarchy
src/Node.php
Node.scopePending
public function scopePending(Builder $query) { return $query->where('status', Node::PENDING) ->where('published_at', '>', Carbon::now()); }
php
public function scopePending(Builder $query) { return $query->where('status', Node::PENDING) ->where('published_at', '>', Carbon::now()); }
[ "public", "function", "scopePending", "(", "Builder", "$", "query", ")", "{", "return", "$", "query", "->", "where", "(", "'status'", ",", "Node", "::", "PENDING", ")", "->", "where", "(", "'published_at'", ",", "'>'", ",", "Carbon", "::", "now", "(", ...
Pending scope @param Builder $query @return Builder
[ "Pending", "scope" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L716-L720
NuclearCMS/Hierarchy
src/Node.php
Node.getOrderedChildren
public function getOrderedChildren($perPage = null) { $children = $this->children(); $this->determineChildrenSorting($children); return $this->determineChildrenPagination($perPage, $children); }
php
public function getOrderedChildren($perPage = null) { $children = $this->children(); $this->determineChildrenSorting($children); return $this->determineChildrenPagination($perPage, $children); }
[ "public", "function", "getOrderedChildren", "(", "$", "perPage", "=", "null", ")", "{", "$", "children", "=", "$", "this", "->", "children", "(", ")", ";", "$", "this", "->", "determineChildrenSorting", "(", "$", "children", ")", ";", "return", "$", "thi...
Get ordered children @param int|null $perPage @return Collection|LengthAwarePaginator
[ "Get", "ordered", "children" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L772-L779
NuclearCMS/Hierarchy
src/Node.php
Node.getPublishedOrderedChildren
public function getPublishedOrderedChildren($perPage = null) { $children = $this->children() ->published(); $this->determineChildrenSorting($children); return $this->determineChildrenPagination($perPage, $children); }
php
public function getPublishedOrderedChildren($perPage = null) { $children = $this->children() ->published(); $this->determineChildrenSorting($children); return $this->determineChildrenPagination($perPage, $children); }
[ "public", "function", "getPublishedOrderedChildren", "(", "$", "perPage", "=", "null", ")", "{", "$", "children", "=", "$", "this", "->", "children", "(", ")", "->", "published", "(", ")", ";", "$", "this", "->", "determineChildrenSorting", "(", "$", "chil...
Returns all published children with parameter ordered @param int|null $perPage @return Collection|LengthAwarePaginator
[ "Returns", "all", "published", "children", "with", "parameter", "ordered" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L787-L795
NuclearCMS/Hierarchy
src/Node.php
Node.determineChildrenSorting
public function determineChildrenSorting(HasMany $children) { if (in_array($this->children_order, $this->translatedAttributes)) { $children->sortedBySourceAttribute( $this->children_order, $this->children_order_direction ); } else ...
php
public function determineChildrenSorting(HasMany $children) { if (in_array($this->children_order, $this->translatedAttributes)) { $children->sortedBySourceAttribute( $this->children_order, $this->children_order_direction ); } else ...
[ "public", "function", "determineChildrenSorting", "(", "HasMany", "$", "children", ")", "{", "if", "(", "in_array", "(", "$", "this", "->", "children_order", ",", "$", "this", "->", "translatedAttributes", ")", ")", "{", "$", "children", "->", "sortedBySourceA...
Determines the children sorting @param HasMany $children
[ "Determines", "the", "children", "sorting" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L802-L816
NuclearCMS/Hierarchy
src/Node.php
Node.determineChildrenPagination
public function determineChildrenPagination($perPage, HasMany $children) { if ($perPage === false) { return $children; } return is_null($perPage) ? $children->get() : $children->paginate($perPage); }
php
public function determineChildrenPagination($perPage, HasMany $children) { if ($perPage === false) { return $children; } return is_null($perPage) ? $children->get() : $children->paginate($perPage); }
[ "public", "function", "determineChildrenPagination", "(", "$", "perPage", ",", "HasMany", "$", "children", ")", "{", "if", "(", "$", "perPage", "===", "false", ")", "{", "return", "$", "children", ";", "}", "return", "is_null", "(", "$", "perPage", ")", ...
Determines the pagination of children @param mixed $perPage @param HasMany $children @return mixed
[ "Determines", "the", "pagination", "of", "children" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L825-L835
NuclearCMS/Hierarchy
src/Node.php
Node.getPositionOrderedChildren
public function getPositionOrderedChildren($perPage = null) { $children = $this->children() ->defaultOrder(); return $this->determineChildrenPagination($perPage, $children); }
php
public function getPositionOrderedChildren($perPage = null) { $children = $this->children() ->defaultOrder(); return $this->determineChildrenPagination($perPage, $children); }
[ "public", "function", "getPositionOrderedChildren", "(", "$", "perPage", "=", "null", ")", "{", "$", "children", "=", "$", "this", "->", "children", "(", ")", "->", "defaultOrder", "(", ")", ";", "return", "$", "this", "->", "determineChildrenPagination", "(...
Returns all children ordered by position @param int|null $perPage @return Collection|LengthAwarePaginator
[ "Returns", "all", "children", "ordered", "by", "position" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L843-L849
NuclearCMS/Hierarchy
src/Node.php
Node.getPublishedPositionOrderedChildren
public function getPublishedPositionOrderedChildren($perPage = null) { $children = $this->children() ->published() ->defaultOrder(); return $this->determineChildrenPagination($perPage, $children); }
php
public function getPublishedPositionOrderedChildren($perPage = null) { $children = $this->children() ->published() ->defaultOrder(); return $this->determineChildrenPagination($perPage, $children); }
[ "public", "function", "getPublishedPositionOrderedChildren", "(", "$", "perPage", "=", "null", ")", "{", "$", "children", "=", "$", "this", "->", "children", "(", ")", "->", "published", "(", ")", "->", "defaultOrder", "(", ")", ";", "return", "$", "this",...
Returns all published children position ordered @param int|null $perPage @return Collection|LengthAwarePaginator
[ "Returns", "all", "published", "children", "position", "ordered" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L857-L864
NuclearCMS/Hierarchy
src/Node.php
Node.hasTranslatedChildren
public function hasTranslatedChildren($locale = null) { foreach ($this->getChildren() as $child) { if ($child->hasTranslation($locale)) { return true; } } return false; }
php
public function hasTranslatedChildren($locale = null) { foreach ($this->getChildren() as $child) { if ($child->hasTranslation($locale)) { return true; } } return false; }
[ "public", "function", "hasTranslatedChildren", "(", "$", "locale", "=", "null", ")", "{", "foreach", "(", "$", "this", "->", "getChildren", "(", ")", "as", "$", "child", ")", "{", "if", "(", "$", "child", "->", "hasTranslation", "(", "$", "locale", ")"...
Filters children by locale @param string $locale @return Collection
[ "Filters", "children", "by", "locale" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L872-L883
NuclearCMS/Hierarchy
src/Node.php
Node.deleteTranslation
public function deleteTranslation($locale) { if ($this->hasTranslation($locale)) { if ($deleted = $this->getTranslation($locale)->delete()) { $this->load('translations'); return true; } } return false; }
php
public function deleteTranslation($locale) { if ($this->hasTranslation($locale)) { if ($deleted = $this->getTranslation($locale)->delete()) { $this->load('translations'); return true; } } return false; }
[ "public", "function", "deleteTranslation", "(", "$", "locale", ")", "{", "if", "(", "$", "this", "->", "hasTranslation", "(", "$", "locale", ")", ")", "{", "if", "(", "$", "deleted", "=", "$", "this", "->", "getTranslation", "(", "$", "locale", ")", ...
Deletes a translation @param string $locale @return bool
[ "Deletes", "a", "translation" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L891-L904
NuclearCMS/Hierarchy
src/Node.php
Node.getLocaleForNodeName
public function getLocaleForNodeName($name) { foreach ($this->translations as $translation) { if ($translation->node_name === $name) { return $translation->locale; } } return null; }
php
public function getLocaleForNodeName($name) { foreach ($this->translations as $translation) { if ($translation->node_name === $name) { return $translation->locale; } } return null; }
[ "public", "function", "getLocaleForNodeName", "(", "$", "name", ")", "{", "foreach", "(", "$", "this", "->", "translations", "as", "$", "translation", ")", "{", "if", "(", "$", "translation", "->", "node_name", "===", "$", "name", ")", "{", "return", "$"...
Returns locale for name @param string $name @return string
[ "Returns", "locale", "for", "name" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L912-L923
NuclearCMS/Hierarchy
src/Node.php
Node.isPublished
public function isPublished() { return ($this->status >= Node::PUBLISHED) || ($this->status >= Node::PENDING && $this->published_at <= Carbon::now()); }
php
public function isPublished() { return ($this->status >= Node::PUBLISHED) || ($this->status >= Node::PENDING && $this->published_at <= Carbon::now()); }
[ "public", "function", "isPublished", "(", ")", "{", "return", "(", "$", "this", "->", "status", ">=", "Node", "::", "PUBLISHED", ")", "||", "(", "$", "this", "->", "status", ">=", "Node", "::", "PENDING", "&&", "$", "this", "->", "published_at", "<=", ...
Checks if the node is published @return bool
[ "Checks", "if", "the", "node", "is", "published" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L1034-L1038
NuclearCMS/Hierarchy
src/Node.php
Node.transformInto
public function transformInto($id) { $newType = NodeType::find($id); if (is_null($newType)) { throw new \RuntimeException('Node type does not exist'); } $sourceAttributes = $this->parseSourceAttributes(); $this->flushSources(); $this->transform...
php
public function transformInto($id) { $newType = NodeType::find($id); if (is_null($newType)) { throw new \RuntimeException('Node type does not exist'); } $sourceAttributes = $this->parseSourceAttributes(); $this->flushSources(); $this->transform...
[ "public", "function", "transformInto", "(", "$", "id", ")", "{", "$", "newType", "=", "NodeType", "::", "find", "(", "$", "id", ")", ";", "if", "(", "is_null", "(", "$", "newType", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Node ...
Transforms the node type with to given type @param int $id @throws \RuntimeException
[ "Transforms", "the", "node", "type", "with", "to", "given", "type" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L1086-L1106
NuclearCMS/Hierarchy
src/Node.php
Node.parseSourceAttributes
public function parseSourceAttributes() { $attributes = []; foreach ($this->translations as $translation) { $attributes[$translation->locale] = $translation->source->toArray(); } return $attributes; }
php
public function parseSourceAttributes() { $attributes = []; foreach ($this->translations as $translation) { $attributes[$translation->locale] = $translation->source->toArray(); } return $attributes; }
[ "public", "function", "parseSourceAttributes", "(", ")", "{", "$", "attributes", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "translations", "as", "$", "translation", ")", "{", "$", "attributes", "[", "$", "translation", "->", "locale", "]", "...
Parses source attributes @return array
[ "Parses", "source", "attributes" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L1113-L1123
NuclearCMS/Hierarchy
src/Node.php
Node.flushSources
protected function flushSources() { foreach ($this->translations as $translation) { $translation->source->delete(); $translation->flushTemporarySource(); unset($translation->relations['source']); } }
php
protected function flushSources() { foreach ($this->translations as $translation) { $translation->source->delete(); $translation->flushTemporarySource(); unset($translation->relations['source']); } }
[ "protected", "function", "flushSources", "(", ")", "{", "foreach", "(", "$", "this", "->", "translations", "as", "$", "translation", ")", "{", "$", "translation", "->", "source", "->", "delete", "(", ")", ";", "$", "translation", "->", "flushTemporarySource"...
Flushes the source attributes
[ "Flushes", "the", "source", "attributes" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L1128-L1137
NuclearCMS/Hierarchy
src/Node.php
Node.transformNodeType
protected function transformNodeType(NodeType $nodeType) { $this->setNodeTypeByKey($nodeType->getKey()); foreach ($this->translations as $translation) { $translation->source_type = $nodeType->getName(); } }
php
protected function transformNodeType(NodeType $nodeType) { $this->setNodeTypeByKey($nodeType->getKey()); foreach ($this->translations as $translation) { $translation->source_type = $nodeType->getName(); } }
[ "protected", "function", "transformNodeType", "(", "NodeType", "$", "nodeType", ")", "{", "$", "this", "->", "setNodeTypeByKey", "(", "$", "nodeType", "->", "getKey", "(", ")", ")", ";", "foreach", "(", "$", "this", "->", "translations", "as", "$", "transl...
Transforms the node type @param NodeType $nodeType
[ "Transforms", "the", "node", "type" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L1144-L1152
NuclearCMS/Hierarchy
src/Node.php
Node.remakeSources
protected function remakeSources(NodeType $nodeType) { foreach ($this->translations as $translation) { $source = $translation->getNewSourceModel($nodeType->getName()); $source->id = $translation->getKey(); $translation->relations['source'] = $source; } ...
php
protected function remakeSources(NodeType $nodeType) { foreach ($this->translations as $translation) { $source = $translation->getNewSourceModel($nodeType->getName()); $source->id = $translation->getKey(); $translation->relations['source'] = $source; } ...
[ "protected", "function", "remakeSources", "(", "NodeType", "$", "nodeType", ")", "{", "foreach", "(", "$", "this", "->", "translations", "as", "$", "translation", ")", "{", "$", "source", "=", "$", "translation", "->", "getNewSourceModel", "(", "$", "nodeTyp...
Remakes sources
[ "Remakes", "sources" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L1157-L1168
NuclearCMS/Hierarchy
src/Node.php
Node.scopeMostVisited
public function scopeMostVisited(Builder $query, $limit = null) { $query->select(\DB::raw('nodes.*, count(*) as `aggregate`')) ->join('node_site_view', 'nodes.id', '=', 'node_site_view.node_id') ->groupBy('nodes.id') ->orderBy('aggregate', 'desc'); if ($limit) ...
php
public function scopeMostVisited(Builder $query, $limit = null) { $query->select(\DB::raw('nodes.*, count(*) as `aggregate`')) ->join('node_site_view', 'nodes.id', '=', 'node_site_view.node_id') ->groupBy('nodes.id') ->orderBy('aggregate', 'desc'); if ($limit) ...
[ "public", "function", "scopeMostVisited", "(", "Builder", "$", "query", ",", "$", "limit", "=", "null", ")", "{", "$", "query", "->", "select", "(", "\\", "DB", "::", "raw", "(", "'nodes.*, count(*) as `aggregate`'", ")", ")", "->", "join", "(", "'node_sit...
Most visited scope @param Builder $query @param int|null $limit @return Builder
[ "Most", "visited", "scope" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L1177-L1190
NuclearCMS/Hierarchy
src/Node.php
Node.scopeRecentlyEdited
public function scopeRecentlyEdited(Builder $query, $limit = null) { $query->orderBy('updated_at', 'desc'); if ($limit) { $query->limit($limit); } return $query; }
php
public function scopeRecentlyEdited(Builder $query, $limit = null) { $query->orderBy('updated_at', 'desc'); if ($limit) { $query->limit($limit); } return $query; }
[ "public", "function", "scopeRecentlyEdited", "(", "Builder", "$", "query", ",", "$", "limit", "=", "null", ")", "{", "$", "query", "->", "orderBy", "(", "'updated_at'", ",", "'desc'", ")", ";", "if", "(", "$", "limit", ")", "{", "$", "query", "->", "...
Recently edited scope @param Builder $query @param int|null $limit @return Builder
[ "Recently", "edited", "scope" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L1222-L1232
NuclearCMS/Hierarchy
src/Node.php
Node.scopeRecentlyCreated
public function scopeRecentlyCreated(Builder $query, $limit = null) { $query->orderBy('created_at', 'desc'); if ($limit) { $query->limit($limit); } return $query; }
php
public function scopeRecentlyCreated(Builder $query, $limit = null) { $query->orderBy('created_at', 'desc'); if ($limit) { $query->limit($limit); } return $query; }
[ "public", "function", "scopeRecentlyCreated", "(", "Builder", "$", "query", ",", "$", "limit", "=", "null", ")", "{", "$", "query", "->", "orderBy", "(", "'created_at'", ",", "'desc'", ")", ";", "if", "(", "$", "limit", ")", "{", "$", "query", "->", ...
Recently created scope @param Builder $query @param int|null $limit @return Builder
[ "Recently", "created", "scope" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L1241-L1251
NuclearCMS/Hierarchy
src/Node.php
Node.getSiteURL
public function getSiteURL($locale = null) { $node = $this; $uri = ''; do { $uri = '/' . $node->getTranslationAttribute('node_name', $locale) . $uri; $node = is_null($node->parent_id) ? null : node_bag($node->parent_id, false); } while ( ! is_null($no...
php
public function getSiteURL($locale = null) { $node = $this; $uri = ''; do { $uri = '/' . $node->getTranslationAttribute('node_name', $locale) . $uri; $node = is_null($node->parent_id) ? null : node_bag($node->parent_id, false); } while ( ! is_null($no...
[ "public", "function", "getSiteURL", "(", "$", "locale", "=", "null", ")", "{", "$", "node", "=", "$", "this", ";", "$", "uri", "=", "''", ";", "do", "{", "$", "uri", "=", "'/'", ".", "$", "node", "->", "getTranslationAttribute", "(", "'node_name'", ...
Gets the full url for node @param string $locale @return string
[ "Gets", "the", "full", "url", "for", "node" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L1270-L1282
NuclearCMS/Hierarchy
src/Node.php
Node.getPreviewURL
public function getPreviewURL($locale = null) { $token = app()->make(TokenManager::class) ->makeNewToken('preview_nodes'); $url = $this->getSiteURL($locale); return $url . '?preview_nodes=' . $token; }
php
public function getPreviewURL($locale = null) { $token = app()->make(TokenManager::class) ->makeNewToken('preview_nodes'); $url = $this->getSiteURL($locale); return $url . '?preview_nodes=' . $token; }
[ "public", "function", "getPreviewURL", "(", "$", "locale", "=", "null", ")", "{", "$", "token", "=", "app", "(", ")", "->", "make", "(", "TokenManager", "::", "class", ")", "->", "makeNewToken", "(", "'preview_nodes'", ")", ";", "$", "url", "=", "$", ...
Returns the preview url @param string $locale @return string
[ "Returns", "the", "preview", "url" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L1290-L1298
NuclearCMS/Hierarchy
src/Node.php
Node.getDefaultEditUrl
public function getDefaultEditUrl($locale = null) { $parameters = [ $this->getKey(), $this->translateOrFirst($locale)->getKey() ]; if ($this->hidesChildren()) { if ($this->children_display_mode === 'tree') { $parameters...
php
public function getDefaultEditUrl($locale = null) { $parameters = [ $this->getKey(), $this->translateOrFirst($locale)->getKey() ]; if ($this->hidesChildren()) { if ($this->children_display_mode === 'tree') { $parameters...
[ "public", "function", "getDefaultEditUrl", "(", "$", "locale", "=", "null", ")", "{", "$", "parameters", "=", "[", "$", "this", "->", "getKey", "(", ")", ",", "$", "this", "->", "translateOrFirst", "(", "$", "locale", ")", "->", "getKey", "(", ")", "...
Determines the default edit link for node @param null|string $locale @return string
[ "Determines", "the", "default", "edit", "link", "for", "node" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L1306-L1326
NuclearCMS/Hierarchy
src/Node.php
Node.getSearchable
public function getSearchable() { // When there is no node type we exclude source attributes if (is_null($this->getNodeTypeName())) { return $this->searchable; } $modelName = source_model_name($this->getNodeTypeName(), true); return array_merge_recursive...
php
public function getSearchable() { // When there is no node type we exclude source attributes if (is_null($this->getNodeTypeName())) { return $this->searchable; } $modelName = source_model_name($this->getNodeTypeName(), true); return array_merge_recursive...
[ "public", "function", "getSearchable", "(", ")", "{", "// When there is no node type we exclude source attributes", "if", "(", "is_null", "(", "$", "this", "->", "getNodeTypeName", "(", ")", ")", ")", "{", "return", "$", "this", "->", "searchable", ";", "}", "$"...
It returns the searchable @return array
[ "It", "returns", "the", "searchable" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L1333-L1347
NuclearCMS/Hierarchy
src/Node.php
Node.getMetaImage
public function getMetaImage() { $metaImage = $this->getTranslationAttribute('meta_image'); if ($metaImage = get_nuclear_cover($metaImage)) { return $metaImage; } if ($coverImage = $this->getCoverImage()) { return $coverImage; } ...
php
public function getMetaImage() { $metaImage = $this->getTranslationAttribute('meta_image'); if ($metaImage = get_nuclear_cover($metaImage)) { return $metaImage; } if ($coverImage = $this->getCoverImage()) { return $coverImage; } ...
[ "public", "function", "getMetaImage", "(", ")", "{", "$", "metaImage", "=", "$", "this", "->", "getTranslationAttribute", "(", "'meta_image'", ")", ";", "if", "(", "$", "metaImage", "=", "get_nuclear_cover", "(", "$", "metaImage", ")", ")", "{", "return", ...
Meta image getter @return Image|null
[ "Meta", "image", "getter" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L1414-L1429
NuclearCMS/Hierarchy
src/Node.php
Node.getCoverImage
public function getCoverImage() { if ($this->coverImage) { return $this->coverImage; } $modelName = source_model_name($this->getNodeTypeName(), true); $mutatables = call_user_func([$modelName, 'getMutatables']); foreach ($mutatables as $mutatable => $ty...
php
public function getCoverImage() { if ($this->coverImage) { return $this->coverImage; } $modelName = source_model_name($this->getNodeTypeName(), true); $mutatables = call_user_func([$modelName, 'getMutatables']); foreach ($mutatables as $mutatable => $ty...
[ "public", "function", "getCoverImage", "(", ")", "{", "if", "(", "$", "this", "->", "coverImage", ")", "{", "return", "$", "this", "->", "coverImage", ";", "}", "$", "modelName", "=", "source_model_name", "(", "$", "this", "->", "getNodeTypeName", "(", "...
Gets the cover image @return Image|null
[ "Gets", "the", "cover", "image" ]
train
https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Node.php#L1436-L1471
Jimdo/jimphle-data-structure
src/Jimphle/DataStructure/Map.php
Map.setIn
public function setIn($keys, $value) { $lastKey = array_shift($keys); if (count($keys) > 0 && !isset($this->$lastKey->{$keys[0]})) { throw new \RuntimeException(sprintf("Key '%s->%s' does not exist.", $lastKey, $keys[0])); } if (count($keys) > 0 && $this->$lastKey instanc...
php
public function setIn($keys, $value) { $lastKey = array_shift($keys); if (count($keys) > 0 && !isset($this->$lastKey->{$keys[0]})) { throw new \RuntimeException(sprintf("Key '%s->%s' does not exist.", $lastKey, $keys[0])); } if (count($keys) > 0 && $this->$lastKey instanc...
[ "public", "function", "setIn", "(", "$", "keys", ",", "$", "value", ")", "{", "$", "lastKey", "=", "array_shift", "(", "$", "keys", ")", ";", "if", "(", "count", "(", "$", "keys", ")", ">", "0", "&&", "!", "isset", "(", "$", "this", "->", "$", ...
set a value in a nested map @param array $keys @param mixed $value @return Map
[ "set", "a", "value", "in", "a", "nested", "map" ]
train
https://github.com/Jimdo/jimphle-data-structure/blob/15f784e4af48520079f8639748ab68b074dbc005/src/Jimphle/DataStructure/Map.php#L74-L84
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Database/src/sqlabstraction/query_update.php
ezcQueryUpdate.update
public function update( $table ) { $table = $this->getIdentifier( $table ); $table = $this->getPrefixedTableNames($table); $this->table = $table; return $this; }
php
public function update( $table ) { $table = $this->getIdentifier( $table ); $table = $this->getPrefixedTableNames($table); $this->table = $table; return $this; }
[ "public", "function", "update", "(", "$", "table", ")", "{", "$", "table", "=", "$", "this", "->", "getIdentifier", "(", "$", "table", ")", ";", "$", "table", "=", "$", "this", "->", "getPrefixedTableNames", "(", "$", "table", ")", ";", "$", "this", ...
Opens the query and sets the target table to $table. update() returns a pointer to $this. @param string $table @return ezcQueryUpdate
[ "Opens", "the", "query", "and", "sets", "the", "target", "table", "to", "$table", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Database/src/sqlabstraction/query_update.php#L88-L94
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Database/src/sqlabstraction/query_update.php
ezcQueryUpdate.set
public function set( $column, $expression ) { $column = $this->getIdentifier( $column ); $expression = $this->getIdentifier( $expression ); $this->values[$column] = $expression; return $this; }
php
public function set( $column, $expression ) { $column = $this->getIdentifier( $column ); $expression = $this->getIdentifier( $expression ); $this->values[$column] = $expression; return $this; }
[ "public", "function", "set", "(", "$", "column", ",", "$", "expression", ")", "{", "$", "column", "=", "$", "this", "->", "getIdentifier", "(", "$", "column", ")", ";", "$", "expression", "=", "$", "this", "->", "getIdentifier", "(", "$", "expression",...
The update query will set the column $column to the value $expression. @param string $column @param string $expression @return ezcQueryUpdate
[ "The", "update", "query", "will", "set", "the", "column", "$column", "to", "the", "value", "$expression", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Database/src/sqlabstraction/query_update.php#L103-L109
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Database/src/sqlabstraction/query_update.php
ezcQueryUpdate.getQuery
public function getQuery() { if ( $this->table == null || empty( $this->values ) ) { $problem = $this->table == null ? 'table' : 'values'; throw new ezcQueryInvalidException( "UPDATE", "No " . $problem . " set." ); } $query = "UPDATE {$this->table} SET "; ...
php
public function getQuery() { if ( $this->table == null || empty( $this->values ) ) { $problem = $this->table == null ? 'table' : 'values'; throw new ezcQueryInvalidException( "UPDATE", "No " . $problem . " set." ); } $query = "UPDATE {$this->table} SET "; ...
[ "public", "function", "getQuery", "(", ")", "{", "if", "(", "$", "this", "->", "table", "==", "null", "||", "empty", "(", "$", "this", "->", "values", ")", ")", "{", "$", "problem", "=", "$", "this", "->", "table", "==", "null", "?", "'table'", "...
Returns the query string for this query object. @todo wrong exception @throws ezcQueryInvalidException if no table or no values have been set. @return string
[ "Returns", "the", "query", "string", "for", "this", "query", "object", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Database/src/sqlabstraction/query_update.php#L164-L195
maestroprog/saw-php
src/Standalone/Controller/WorkerBalance.php
WorkerBalance.work
public function work() { $workerNeed = self::WORKER_MIN * $this->workerMultiplier; $workerCount = count($this->workerPool); if ( ($workerCount < $workerNeed && $workerCount < $this->workerMaxCount) && !$this->running ) { // run new worker ...
php
public function work() { $workerNeed = self::WORKER_MIN * $this->workerMultiplier; $workerCount = count($this->workerPool); if ( ($workerCount < $workerNeed && $workerCount < $this->workerMaxCount) && !$this->running ) { // run new worker ...
[ "public", "function", "work", "(", ")", "{", "$", "workerNeed", "=", "self", "::", "WORKER_MIN", "*", "$", "this", "->", "workerMultiplier", ";", "$", "workerCount", "=", "count", "(", "$", "this", "->", "workerPool", ")", ";", "if", "(", "(", "$", "...
Предполагается, что этот метод будет запускать новые воркеры, когда это нужно. Воркеры запускаются по одному, после запуска контроллер ждёт новый воркер до 10 секунд.
[ "Предполагается", "что", "этот", "метод", "будет", "запускать", "новые", "воркеры", "когда", "это", "нужно", ".", "Воркеры", "запускаются", "по", "одному", "после", "запуска", "контроллер", "ждёт", "новый", "воркер", "до", "10", "секунд", "." ]
train
https://github.com/maestroprog/saw-php/blob/159215a4d7a951cca2a9c2eed3e1aa4f5b624cfb/src/Standalone/Controller/WorkerBalance.php#L85-L105
maestroprog/saw-php
src/Standalone/Controller/WorkerBalance.php
WorkerBalance.addWorker
public function addWorker(Worker $worker): bool { if (!$this->running) { return false; } $this->running = 0; $this->workerPool->add($worker); return true; }
php
public function addWorker(Worker $worker): bool { if (!$this->running) { return false; } $this->running = 0; $this->workerPool->add($worker); return true; }
[ "public", "function", "addWorker", "(", "Worker", "$", "worker", ")", ":", "bool", "{", "if", "(", "!", "$", "this", "->", "running", ")", "{", "return", "false", ";", "}", "$", "this", "->", "running", "=", "0", ";", "$", "this", "->", "workerPool...
Добавляет воркер в балансировщик, когда тот успешно стартует. @param Worker $worker @return bool
[ "Добавляет", "воркер", "в", "балансировщик", "когда", "тот", "успешно", "стартует", "." ]
train
https://github.com/maestroprog/saw-php/blob/159215a4d7a951cca2a9c2eed3e1aa4f5b624cfb/src/Standalone/Controller/WorkerBalance.php#L114-L123
maestroprog/saw-php
src/Standalone/Controller/WorkerBalance.php
WorkerBalance.removeWorker
public function removeWorker(Worker $worker) { $this->commander->runSync(new WorkerDelete($worker->getClient()), 5); $this->workerPool->remove($worker); // TODO // нужно запилить механизм перехвата невыполненных задач /*foreach ($this->tasks as $name => $workers) { ...
php
public function removeWorker(Worker $worker) { $this->commander->runSync(new WorkerDelete($worker->getClient()), 5); $this->workerPool->remove($worker); // TODO // нужно запилить механизм перехвата невыполненных задач /*foreach ($this->tasks as $name => $workers) { ...
[ "public", "function", "removeWorker", "(", "Worker", "$", "worker", ")", "{", "$", "this", "->", "commander", "->", "runSync", "(", "new", "WorkerDelete", "(", "$", "worker", "->", "getClient", "(", ")", ")", ",", "5", ")", ";", "$", "this", "->", "w...
Удаляет воркер из балансировщика. @param Worker $worker
[ "Удаляет", "воркер", "из", "балансировщика", "." ]
train
https://github.com/maestroprog/saw-php/blob/159215a4d7a951cca2a9c2eed3e1aa4f5b624cfb/src/Standalone/Controller/WorkerBalance.php#L130-L141
maestroprog/saw-php
src/Standalone/Controller/WorkerBalance.php
WorkerBalance.getLowLoadedWorker
public function getLowLoadedWorker(AbstractThread $thread): Worker { $selectedWorker = null; foreach ($this->workerPool as $worker) { /** * @var $worker Worker */ if ($worker->getState() === Worker::STOP || !$worker->isThreadKnow($thread)) { ...
php
public function getLowLoadedWorker(AbstractThread $thread): Worker { $selectedWorker = null; foreach ($this->workerPool as $worker) { /** * @var $worker Worker */ if ($worker->getState() === Worker::STOP || !$worker->isThreadKnow($thread)) { ...
[ "public", "function", "getLowLoadedWorker", "(", "AbstractThread", "$", "thread", ")", ":", "Worker", "{", "$", "selectedWorker", "=", "null", ";", "foreach", "(", "$", "this", "->", "workerPool", "as", "$", "worker", ")", "{", "/**\n * @var $worker ...
Получить одного из слабо нагруженных воркеров. @param AbstractThread $thread Поток для выполнения которого необходимо найти воркера. @return Worker @throws \RuntimeException
[ "Получить", "одного", "из", "слабо", "нагруженных", "воркеров", "." ]
train
https://github.com/maestroprog/saw-php/blob/159215a4d7a951cca2a9c2eed3e1aa4f5b624cfb/src/Standalone/Controller/WorkerBalance.php#L150-L174
oroinc/OroLayoutComponent
AliasCollection.php
AliasCollection.getId
public function getId($alias) { if (!isset($this->aliases[$alias])) { return null; } $id = $this->aliases[$alias]; while (isset($this->aliases[$id])) { $id = $this->aliases[$id]; } return $id; }
php
public function getId($alias) { if (!isset($this->aliases[$alias])) { return null; } $id = $this->aliases[$alias]; while (isset($this->aliases[$id])) { $id = $this->aliases[$id]; } return $id; }
[ "public", "function", "getId", "(", "$", "alias", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "aliases", "[", "$", "alias", "]", ")", ")", "{", "return", "null", ";", "}", "$", "id", "=", "$", "this", "->", "aliases", "[", "$", ...
Returns the identifier of the item which has the given alias @param string $alias The item alias @return string|null The item identifier or null if no one item has the given alias
[ "Returns", "the", "identifier", "of", "the", "item", "which", "has", "the", "given", "alias" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/AliasCollection.php#L50-L62
oroinc/OroLayoutComponent
AliasCollection.php
AliasCollection.add
public function add($alias, $id) { if (isset($this->aliases[$alias])) { if ($this->aliases[$alias] === $id) { // exactly the same alias for the specified item is already exists return $this; } throw new Exception\AliasAlreadyExistsExceptio...
php
public function add($alias, $id) { if (isset($this->aliases[$alias])) { if ($this->aliases[$alias] === $id) { // exactly the same alias for the specified item is already exists return $this; } throw new Exception\AliasAlreadyExistsExceptio...
[ "public", "function", "add", "(", "$", "alias", ",", "$", "id", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "aliases", "[", "$", "alias", "]", ")", ")", "{", "if", "(", "$", "this", "->", "aliases", "[", "$", "alias", "]", "===", "$...
Registers an alias for the specified identifier @param string $alias A string that can be used as an alias for the item id @param string $id The item identifier or already registered item alias @return self @throws Exception\AliasAlreadyExistsException if the alias is used for another item
[ "Registers", "an", "alias", "for", "the", "specified", "identifier" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/AliasCollection.php#L88-L113
oroinc/OroLayoutComponent
AliasCollection.php
AliasCollection.remove
public function remove($alias) { $id = $this->getId($alias); if ($id) { unset($this->aliases[$alias]); $aliases = &$this->ids[$id]; unset($aliases[array_search($alias, $aliases, true)]); if (!empty($aliases)) { $this->removeDependedAlia...
php
public function remove($alias) { $id = $this->getId($alias); if ($id) { unset($this->aliases[$alias]); $aliases = &$this->ids[$id]; unset($aliases[array_search($alias, $aliases, true)]); if (!empty($aliases)) { $this->removeDependedAlia...
[ "public", "function", "remove", "(", "$", "alias", ")", "{", "$", "id", "=", "$", "this", "->", "getId", "(", "$", "alias", ")", ";", "if", "(", "$", "id", ")", "{", "unset", "(", "$", "this", "->", "aliases", "[", "$", "alias", "]", ")", ";"...
Removes the alias @param string $alias The item alias @return self
[ "Removes", "the", "alias" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/AliasCollection.php#L122-L137
oroinc/OroLayoutComponent
AliasCollection.php
AliasCollection.removeById
public function removeById($id) { if (isset($this->ids[$id])) { foreach ($this->ids[$id] as $alias) { unset($this->aliases[$alias]); } unset($this->ids[$id]); } return $this; }
php
public function removeById($id) { if (isset($this->ids[$id])) { foreach ($this->ids[$id] as $alias) { unset($this->aliases[$alias]); } unset($this->ids[$id]); } return $this; }
[ "public", "function", "removeById", "(", "$", "id", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "ids", "[", "$", "id", "]", ")", ")", "{", "foreach", "(", "$", "this", "->", "ids", "[", "$", "id", "]", "as", "$", "alias", ")", "{", ...
Removes all aliases for the specified item @param string $id The identifier of item which aliases should be removed @return self
[ "Removes", "all", "aliases", "for", "the", "specified", "item" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/AliasCollection.php#L146-L156
oroinc/OroLayoutComponent
AliasCollection.php
AliasCollection.removeDependedAliases
protected function removeDependedAliases($alias, $id) { foreach ($this->ids[$id] as $otherAlias) { if (isset($this->aliases[$otherAlias]) && $this->aliases[$otherAlias] === $alias) { unset($this->aliases[$otherAlias]); $aliases = &$this->ids[$id]; ...
php
protected function removeDependedAliases($alias, $id) { foreach ($this->ids[$id] as $otherAlias) { if (isset($this->aliases[$otherAlias]) && $this->aliases[$otherAlias] === $alias) { unset($this->aliases[$otherAlias]); $aliases = &$this->ids[$id]; ...
[ "protected", "function", "removeDependedAliases", "(", "$", "alias", ",", "$", "id", ")", "{", "foreach", "(", "$", "this", "->", "ids", "[", "$", "id", "]", "as", "$", "otherAlias", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "aliases", ...
Removes all depended aliases For example if "alias3" is removed in alias chain like "alias1 -> alias2 -> alias3 -> id" than both "alias1" and "alias2" are removed as well @param string $alias @param string $id
[ "Removes", "all", "depended", "aliases", "For", "example", "if", "alias3", "is", "removed", "in", "alias", "chain", "like", "alias1", "-", ">", "alias2", "-", ">", "alias3", "-", ">", "id", "than", "both", "alias1", "and", "alias2", "are", "removed", "as...
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/AliasCollection.php#L185-L199
CupOfTea696/WordPress-Composer
src/Plugin.php
Plugin.activate
public function activate(Composer $composer, IOInterface $io) { $installer = new Installer($io, $composer, $this); $composer->getInstallationManager()->addInstaller($installer); $this->composer = $composer; $this->io = $io; include_once dirname(__FI...
php
public function activate(Composer $composer, IOInterface $io) { $installer = new Installer($io, $composer, $this); $composer->getInstallationManager()->addInstaller($installer); $this->composer = $composer; $this->io = $io; include_once dirname(__FI...
[ "public", "function", "activate", "(", "Composer", "$", "composer", ",", "IOInterface", "$", "io", ")", "{", "$", "installer", "=", "new", "Installer", "(", "$", "io", ",", "$", "composer", ",", "$", "this", ")", ";", "$", "composer", "->", "getInstall...
{@inheritdoc}
[ "{" ]
train
https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/Plugin.php#L75-L96
CupOfTea696/WordPress-Composer
src/Plugin.php
Plugin.getSubscribedEvents
public static function getSubscribedEvents() { $eventMap = []; $events = EventSubscriber::getSubscribedEvents(); foreach ($events as $event => $params) { if (is_string($params)) { $eventMap[$event] = 'forwardEventTo' . ucfirst($params); } else...
php
public static function getSubscribedEvents() { $eventMap = []; $events = EventSubscriber::getSubscribedEvents(); foreach ($events as $event => $params) { if (is_string($params)) { $eventMap[$event] = 'forwardEventTo' . ucfirst($params); } else...
[ "public", "static", "function", "getSubscribedEvents", "(", ")", "{", "$", "eventMap", "=", "[", "]", ";", "$", "events", "=", "EventSubscriber", "::", "getSubscribedEvents", "(", ")", ";", "foreach", "(", "$", "events", "as", "$", "event", "=>", "$", "p...
{@inheritdoc}
[ "{" ]
train
https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/Plugin.php#L101-L127
CupOfTea696/WordPress-Composer
src/Plugin.php
Plugin.getRootDirectory
public function getRootDirectory() { $config = $this->composer->getConfig(); return str_replace($config->get('vendor-dir', Config::RELATIVE_PATHS), '', $config->get('vendor-dir')); }
php
public function getRootDirectory() { $config = $this->composer->getConfig(); return str_replace($config->get('vendor-dir', Config::RELATIVE_PATHS), '', $config->get('vendor-dir')); }
[ "public", "function", "getRootDirectory", "(", ")", "{", "$", "config", "=", "$", "this", "->", "composer", "->", "getConfig", "(", ")", ";", "return", "str_replace", "(", "$", "config", "->", "get", "(", "'vendor-dir'", ",", "Config", "::", "RELATIVE_PATH...
Get the root directory. @return string
[ "Get", "the", "root", "directory", "." ]
train
https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/Plugin.php#L165-L170
CupOfTea696/WordPress-Composer
src/Plugin.php
Plugin.getPublicDirectory
public function getPublicDirectory() { if (isset($this->publicDirectory)) { return $this->publicDirectory; } $rootPkg = $this->composer->getPackage(); if ($rootPkg) { $extra = $rootPkg->getExtra(); if ($extra && ! emp...
php
public function getPublicDirectory() { if (isset($this->publicDirectory)) { return $this->publicDirectory; } $rootPkg = $this->composer->getPackage(); if ($rootPkg) { $extra = $rootPkg->getExtra(); if ($extra && ! emp...
[ "public", "function", "getPublicDirectory", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "publicDirectory", ")", ")", "{", "return", "$", "this", "->", "publicDirectory", ";", "}", "$", "rootPkg", "=", "$", "this", "->", "composer", "->", ...
Get the public directory. @return string
[ "Get", "the", "public", "directory", "." ]
train
https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/Plugin.php#L187-L238
CupOfTea696/WordPress-Composer
src/Plugin.php
Plugin.ask
protected function ask($question, $default = null) { $defaultComment = ''; if ($default !== null) { $defaultComment = ' [<comment>' . $default . '</comment>]'; } $question = preg_replace('/(?:(\?)\s*$|(\?)?\s+$)|(?<!\s|\?)$/', $defaultComment . '$1 ', $q...
php
protected function ask($question, $default = null) { $defaultComment = ''; if ($default !== null) { $defaultComment = ' [<comment>' . $default . '</comment>]'; } $question = preg_replace('/(?:(\?)\s*$|(\?)?\s+$)|(?<!\s|\?)$/', $defaultComment . '$1 ', $q...
[ "protected", "function", "ask", "(", "$", "question", ",", "$", "default", "=", "null", ")", "{", "$", "defaultComment", "=", "''", ";", "if", "(", "$", "default", "!==", "null", ")", "{", "$", "defaultComment", "=", "' [<comment>'", ".", "$", "default...
Add default value to IOInterface::ask question. @param string $question @param mixed $default = null @return mixed
[ "Add", "default", "value", "to", "IOInterface", "::", "ask", "question", "." ]
train
https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/Plugin.php#L247-L258
dreamfactorysoftware/df-cache
src/Services/BaseService.php
BaseService.handleGET
protected function handleGET() { $key = str_replace('/', '.', $this->resourcePath); if (empty($key)) { throw new BadRequestException('No key/resource provide. Please provide a cache key to retrieve.'); } $default = $this->request->getParameter('default'); if (fal...
php
protected function handleGET() { $key = str_replace('/', '.', $this->resourcePath); if (empty($key)) { throw new BadRequestException('No key/resource provide. Please provide a cache key to retrieve.'); } $default = $this->request->getParameter('default'); if (fal...
[ "protected", "function", "handleGET", "(", ")", "{", "$", "key", "=", "str_replace", "(", "'/'", ",", "'.'", ",", "$", "this", "->", "resourcePath", ")", ";", "if", "(", "empty", "(", "$", "key", ")", ")", "{", "throw", "new", "BadRequestException", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamfactorysoftware/df-cache/blob/6a2aa5dc2fc7963ce89fd7e8f3d51483d2499451/src/Services/BaseService.php#L52-L72
dreamfactorysoftware/df-cache
src/Services/BaseService.php
BaseService.handlePUT
protected function handlePUT() { $key = str_replace('/', '.', $this->resourcePath); $payload = $this->getPayloadData(); $this->ttl = $this->request->getParameter('ttl', $this->ttl); $forever = $this->request->getParameterAsBool('forever'); if (empty($payload)) { ...
php
protected function handlePUT() { $key = str_replace('/', '.', $this->resourcePath); $payload = $this->getPayloadData(); $this->ttl = $this->request->getParameter('ttl', $this->ttl); $forever = $this->request->getParameterAsBool('forever'); if (empty($payload)) { ...
[ "protected", "function", "handlePUT", "(", ")", "{", "$", "key", "=", "str_replace", "(", "'/'", ",", "'.'", ",", "$", "this", "->", "resourcePath", ")", ";", "$", "payload", "=", "$", "this", "->", "getPayloadData", "(", ")", ";", "$", "this", "->",...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamfactorysoftware/df-cache/blob/6a2aa5dc2fc7963ce89fd7e8f3d51483d2499451/src/Services/BaseService.php#L75-L109
dreamfactorysoftware/df-cache
src/Services/BaseService.php
BaseService.handlePOST
protected function handlePOST() { $key = str_replace('/', '.', $this->resourcePath); $payload = $this->getPayloadData(); if (!empty($key) && true === $this->store->has($key)) { throw new BadRequestException("Key '$key' already exists in cache. Use PUT to update existing key."); ...
php
protected function handlePOST() { $key = str_replace('/', '.', $this->resourcePath); $payload = $this->getPayloadData(); if (!empty($key) && true === $this->store->has($key)) { throw new BadRequestException("Key '$key' already exists in cache. Use PUT to update existing key."); ...
[ "protected", "function", "handlePOST", "(", ")", "{", "$", "key", "=", "str_replace", "(", "'/'", ",", "'.'", ",", "$", "this", "->", "resourcePath", ")", ";", "$", "payload", "=", "$", "this", "->", "getPayloadData", "(", ")", ";", "if", "(", "!", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamfactorysoftware/df-cache/blob/6a2aa5dc2fc7963ce89fd7e8f3d51483d2499451/src/Services/BaseService.php#L112-L140
dreamfactorysoftware/df-cache
src/Services/BaseService.php
BaseService.handleDELETE
protected function handleDELETE() { $key = str_replace('/', '.', $this->resourcePath); if (empty($key)) { throw new BadRequestException('No key/resource provide. Please provide a cache key to delete.'); } $result = $this->store->forget($key); return ['success' =...
php
protected function handleDELETE() { $key = str_replace('/', '.', $this->resourcePath); if (empty($key)) { throw new BadRequestException('No key/resource provide. Please provide a cache key to delete.'); } $result = $this->store->forget($key); return ['success' =...
[ "protected", "function", "handleDELETE", "(", ")", "{", "$", "key", "=", "str_replace", "(", "'/'", ",", "'.'", ",", "$", "this", "->", "resourcePath", ")", ";", "if", "(", "empty", "(", "$", "key", ")", ")", "{", "throw", "new", "BadRequestException",...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamfactorysoftware/df-cache/blob/6a2aa5dc2fc7963ce89fd7e8f3d51483d2499451/src/Services/BaseService.php#L143-L153
dreamfactorysoftware/df-cache
src/Services/BaseService.php
BaseService.getPayloadData
protected function getPayloadData($key = null, $default = null) { $content = $this->request->getContent(); $contentType = $this->request->getContentType(); switch ($contentType) { case 'txt': case 'text/plain': return $content; case 'json'...
php
protected function getPayloadData($key = null, $default = null) { $content = $this->request->getContent(); $contentType = $this->request->getContentType(); switch ($contentType) { case 'txt': case 'text/plain': return $content; case 'json'...
[ "protected", "function", "getPayloadData", "(", "$", "key", "=", "null", ",", "$", "default", "=", "null", ")", "{", "$", "content", "=", "$", "this", "->", "request", "->", "getContent", "(", ")", ";", "$", "contentType", "=", "$", "this", "->", "re...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamfactorysoftware/df-cache/blob/6a2aa5dc2fc7963ce89fd7e8f3d51483d2499451/src/Services/BaseService.php#L162-L185
dreamfactorysoftware/df-cache
src/Services/BaseService.php
BaseService.getApiDocPaths
protected function getApiDocPaths() { $capitalized = camelize($this->name); $base = [ '/' => [ 'post' => [ 'summary' => 'Create one or more keys in cache storage', 'description' => 'No keys will be created if any of t...
php
protected function getApiDocPaths() { $capitalized = camelize($this->name); $base = [ '/' => [ 'post' => [ 'summary' => 'Create one or more keys in cache storage', 'description' => 'No keys will be created if any of t...
[ "protected", "function", "getApiDocPaths", "(", ")", "{", "$", "capitalized", "=", "camelize", "(", "$", "this", "->", "name", ")", ";", "$", "base", "=", "[", "'/'", "=>", "[", "'post'", "=>", "[", "'summary'", "=>", "'Create one or more keys in cache stora...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamfactorysoftware/df-cache/blob/6a2aa5dc2fc7963ce89fd7e8f3d51483d2499451/src/Services/BaseService.php#L188-L378
mothership-ec/composer
src/Composer/Util/Filesystem.php
Filesystem.removeDirectoryPhp
public function removeDirectoryPhp($directory) { $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS); $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); foreach ($ri as $file) { if ($file->isDir()) { ...
php
public function removeDirectoryPhp($directory) { $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS); $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); foreach ($ri as $file) { if ($file->isDir()) { ...
[ "public", "function", "removeDirectoryPhp", "(", "$", "directory", ")", "{", "$", "it", "=", "new", "RecursiveDirectoryIterator", "(", "$", "directory", ",", "RecursiveDirectoryIterator", "::", "SKIP_DOTS", ")", ";", "$", "ri", "=", "new", "RecursiveIteratorIterat...
Recursively delete directory using PHP iterators. Uses a CHILD_FIRST RecursiveIteratorIterator to sort files before directories, creating a single non-recursive loop to delete files/directories in the correct order. @param string $directory @return bool
[ "Recursively", "delete", "directory", "using", "PHP", "iterators", "." ]
train
https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Util/Filesystem.php#L142-L156
php-lug/lug
src/Bundle/GridBundle/Form/Type/Batch/GridBatchTypeType.php
GridBatchTypeType.configureOptions
public function configureOptions(OptionsResolver $resolver) { $resolver ->setDefaults([ 'choices' => function (Options $options) { return array_combine( array_map(function (BatchInterface $batch) { return $ba...
php
public function configureOptions(OptionsResolver $resolver) { $resolver ->setDefaults([ 'choices' => function (Options $options) { return array_combine( array_map(function (BatchInterface $batch) { return $ba...
[ "public", "function", "configureOptions", "(", "OptionsResolver", "$", "resolver", ")", "{", "$", "resolver", "->", "setDefaults", "(", "[", "'choices'", "=>", "function", "(", "Options", "$", "options", ")", "{", "return", "array_combine", "(", "array_map", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/GridBundle/Form/Type/Batch/GridBatchTypeType.php#L30-L50
tttptd/laravel-responder
src/Traits/HandlesApiErrors.php
HandlesApiErrors.transformException
protected function transformException(Exception $exception) { if (Request::capture()->wantsJson()) { $this->transformAuthException($exception); $this->transformEloquentException($exception); $this->transformValidationException($exception); } }
php
protected function transformException(Exception $exception) { if (Request::capture()->wantsJson()) { $this->transformAuthException($exception); $this->transformEloquentException($exception); $this->transformValidationException($exception); } }
[ "protected", "function", "transformException", "(", "Exception", "$", "exception", ")", "{", "if", "(", "Request", "::", "capture", "(", ")", "->", "wantsJson", "(", ")", ")", "{", "$", "this", "->", "transformAuthException", "(", "$", "exception", ")", ";...
Transform a Laravel exception into an API exception. @param Exception $exception @return void
[ "Transform", "a", "Laravel", "exception", "into", "an", "API", "exception", "." ]
train
https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Traits/HandlesApiErrors.php#L36-L43
tttptd/laravel-responder
src/Traits/HandlesApiErrors.php
HandlesApiErrors.renderApiError
protected function renderApiError(ApiException $exception):JsonResponse { return app('responder.error') ->setError($exception->getErrorCode(), $exception->getMessage()) ->addData($exception->getData() ?: []) ->respond($exception->getStatusCode()); }
php
protected function renderApiError(ApiException $exception):JsonResponse { return app('responder.error') ->setError($exception->getErrorCode(), $exception->getMessage()) ->addData($exception->getData() ?: []) ->respond($exception->getStatusCode()); }
[ "protected", "function", "renderApiError", "(", "ApiException", "$", "exception", ")", ":", "JsonResponse", "{", "return", "app", "(", "'responder.error'", ")", "->", "setError", "(", "$", "exception", "->", "getErrorCode", "(", ")", ",", "$", "exception", "->...
Renders any API exception into a JSON error response. @param ApiException $exception @return JsonResponse
[ "Renders", "any", "API", "exception", "into", "a", "JSON", "error", "response", "." ]
train
https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Traits/HandlesApiErrors.php#L103-L109
thecodingmachine/mvc.splash-common
src/Mouf/Mvc/Splash/Utils/ExceptionUtils.php
ExceptionUtils.getHTMLBackTrace
private static function getHTMLBackTrace($backtrace) { $str = ''; foreach ($backtrace as $step) { if ($step['function'] != 'getHTMLBackTrace' && $step['function'] != 'handle_error') { $str .= '<tr><td style="border-bottom: 1px solid #EEEEEE">'; $str .= ((...
php
private static function getHTMLBackTrace($backtrace) { $str = ''; foreach ($backtrace as $step) { if ($step['function'] != 'getHTMLBackTrace' && $step['function'] != 'handle_error') { $str .= '<tr><td style="border-bottom: 1px solid #EEEEEE">'; $str .= ((...
[ "private", "static", "function", "getHTMLBackTrace", "(", "$", "backtrace", ")", "{", "$", "str", "=", "''", ";", "foreach", "(", "$", "backtrace", "as", "$", "step", ")", "{", "if", "(", "$", "step", "[", "'function'", "]", "!=", "'getHTMLBackTrace'", ...
Returns the Exception Backtrace as a nice HTML view. @param array $backtrace @return string
[ "Returns", "the", "Exception", "Backtrace", "as", "a", "nice", "HTML", "view", "." ]
train
https://github.com/thecodingmachine/mvc.splash-common/blob/eed0269ceda4d7d090a330a220490906a7aa60bd/src/Mouf/Mvc/Splash/Utils/ExceptionUtils.php#L14-L48
thecodingmachine/mvc.splash-common
src/Mouf/Mvc/Splash/Utils/ExceptionUtils.php
ExceptionUtils.getHtmlForException
public static function getHtmlForException(\Throwable $exception) { //global $sys_error_reporting_mail; //global $sys_error_messages; $msg = ''; $msg = '<table>'; $display_errors = ini_get('display_errors'); $color = '#FF0000'; $type = 'Uncaught '.get_class(...
php
public static function getHtmlForException(\Throwable $exception) { //global $sys_error_reporting_mail; //global $sys_error_messages; $msg = ''; $msg = '<table>'; $display_errors = ini_get('display_errors'); $color = '#FF0000'; $type = 'Uncaught '.get_class(...
[ "public", "static", "function", "getHtmlForException", "(", "\\", "Throwable", "$", "exception", ")", "{", "//global $sys_error_reporting_mail;", "//global $sys_error_messages;", "$", "msg", "=", "''", ";", "$", "msg", "=", "'<table>'", ";", "$", "display_errors", "...
Function called to display an exception if it occurs. It will make sure to purge anything in the buffer before calling the exception displayer. @param \Throwable $exception
[ "Function", "called", "to", "display", "an", "exception", "if", "it", "occurs", ".", "It", "will", "make", "sure", "to", "purge", "anything", "in", "the", "buffer", "before", "calling", "the", "exception", "displayer", "." ]
train
https://github.com/thecodingmachine/mvc.splash-common/blob/eed0269ceda4d7d090a330a220490906a7aa60bd/src/Mouf/Mvc/Splash/Utils/ExceptionUtils.php#L56-L84
thecodingmachine/mvc.splash-common
src/Mouf/Mvc/Splash/Utils/ExceptionUtils.php
ExceptionUtils.getPhpVariableAsText
private static function getPhpVariableAsText($var) { if (is_string($var)) { return('"'.str_replace(array("\x00", "\x0a", "\x0d", "\x1a", "\x09"), array('\0', '\n', '\r', '\Z', '\t'), $var).'"'); } elseif (is_int($var) || is_float($var)) { return($var); } elseif (is_bo...
php
private static function getPhpVariableAsText($var) { if (is_string($var)) { return('"'.str_replace(array("\x00", "\x0a", "\x0d", "\x1a", "\x09"), array('\0', '\n', '\r', '\Z', '\t'), $var).'"'); } elseif (is_int($var) || is_float($var)) { return($var); } elseif (is_bo...
[ "private", "static", "function", "getPhpVariableAsText", "(", "$", "var", ")", "{", "if", "(", "is_string", "(", "$", "var", ")", ")", "{", "return", "(", "'\"'", ".", "str_replace", "(", "array", "(", "\"\\x00\"", ",", "\"\\x0a\"", ",", "\"\\x0d\"", ","...
Used by the debug function to display a nice view of the parameters. @param mixed $var @return string
[ "Used", "by", "the", "debug", "function", "to", "display", "a", "nice", "view", "of", "the", "parameters", "." ]
train
https://github.com/thecodingmachine/mvc.splash-common/blob/eed0269ceda4d7d090a330a220490906a7aa60bd/src/Mouf/Mvc/Splash/Utils/ExceptionUtils.php#L152-L181
thecodingmachine/mvc.splash-common
src/Mouf/Mvc/Splash/Utils/ExceptionUtils.php
ExceptionUtils.getRelativePath
private static function getRelativePath($from, $to) { $from = explode('/', $from); $to = explode('/', $to); $relPath = $to; foreach ($from as $depth => $dir) { // find first non-matching dir if (isset($to[$depth]) && $dir === $to[$depth]) { //...
php
private static function getRelativePath($from, $to) { $from = explode('/', $from); $to = explode('/', $to); $relPath = $to; foreach ($from as $depth => $dir) { // find first non-matching dir if (isset($to[$depth]) && $dir === $to[$depth]) { //...
[ "private", "static", "function", "getRelativePath", "(", "$", "from", ",", "$", "to", ")", "{", "$", "from", "=", "explode", "(", "'/'", ",", "$", "from", ")", ";", "$", "to", "=", "explode", "(", "'/'", ",", "$", "to", ")", ";", "$", "relPath", ...
Returns a relative path based on 2 absolute paths. @param string $from @param string $to @return string
[ "Returns", "a", "relative", "path", "based", "on", "2", "absolute", "paths", "." ]
train
https://github.com/thecodingmachine/mvc.splash-common/blob/eed0269ceda4d7d090a330a220490906a7aa60bd/src/Mouf/Mvc/Splash/Utils/ExceptionUtils.php#L204-L230
tequila/mongodb-odm
src/DocumentManager.php
DocumentManager.getBulkWriteBuilder
public function getBulkWriteBuilder(string $documentClass): BulkWriteBuilder { $metadata = $this->metadataFactory->getClassMetadata($documentClass); return $this->bulkWriteBuilderFactory->getBulkWriteBuilder($this, $metadata->getCollectionName()); }
php
public function getBulkWriteBuilder(string $documentClass): BulkWriteBuilder { $metadata = $this->metadataFactory->getClassMetadata($documentClass); return $this->bulkWriteBuilderFactory->getBulkWriteBuilder($this, $metadata->getCollectionName()); }
[ "public", "function", "getBulkWriteBuilder", "(", "string", "$", "documentClass", ")", ":", "BulkWriteBuilder", "{", "$", "metadata", "=", "$", "this", "->", "metadataFactory", "->", "getClassMetadata", "(", "$", "documentClass", ")", ";", "return", "$", "this",...
@param string $documentClass @return BulkWriteBuilder
[ "@param", "string", "$documentClass" ]
train
https://github.com/tequila/mongodb-odm/blob/501d58529bbcb23ad7839680462f62d5c3466d23/src/DocumentManager.php#L86-L91
tequila/mongodb-odm
src/DocumentManager.php
DocumentManager.getCollection
public function getCollection($collectionName, array $options = []): Collection { $cacheKey = $collectionName.$this->getCollectionOptionsHash($options); if (!array_key_exists($cacheKey, $this->collectionsCache)) { $this->collectionsCache[$cacheKey] = $this->database->selectCollection( ...
php
public function getCollection($collectionName, array $options = []): Collection { $cacheKey = $collectionName.$this->getCollectionOptionsHash($options); if (!array_key_exists($cacheKey, $this->collectionsCache)) { $this->collectionsCache[$cacheKey] = $this->database->selectCollection( ...
[ "public", "function", "getCollection", "(", "$", "collectionName", ",", "array", "$", "options", "=", "[", "]", ")", ":", "Collection", "{", "$", "cacheKey", "=", "$", "collectionName", ".", "$", "this", "->", "getCollectionOptionsHash", "(", "$", "options",...
@param string $collectionName @param array $options @return Collection
[ "@param", "string", "$collectionName", "@param", "array", "$options" ]
train
https://github.com/tequila/mongodb-odm/blob/501d58529bbcb23ad7839680462f62d5c3466d23/src/DocumentManager.php#L99-L110
tequila/mongodb-odm
src/DocumentManager.php
DocumentManager.getCollectionByDocumentClass
public function getCollectionByDocumentClass($documentClass): Collection { $metadata = $this->metadataFactory->getClassMetadata($documentClass); return $this->getCollection($metadata->getCollectionName(), $metadata->getCollectionOptions()); }
php
public function getCollectionByDocumentClass($documentClass): Collection { $metadata = $this->metadataFactory->getClassMetadata($documentClass); return $this->getCollection($metadata->getCollectionName(), $metadata->getCollectionOptions()); }
[ "public", "function", "getCollectionByDocumentClass", "(", "$", "documentClass", ")", ":", "Collection", "{", "$", "metadata", "=", "$", "this", "->", "metadataFactory", "->", "getClassMetadata", "(", "$", "documentClass", ")", ";", "return", "$", "this", "->", ...
@param string $documentClass @return Collection
[ "@param", "string", "$documentClass" ]
train
https://github.com/tequila/mongodb-odm/blob/501d58529bbcb23ad7839680462f62d5c3466d23/src/DocumentManager.php#L117-L122
tequila/mongodb-odm
src/DocumentManager.php
DocumentManager.getRepository
public function getRepository(string $documentClass): Repository { $metadata = $this->getMetadata($documentClass); if ($metadata->isNested()) { throw new InvalidArgumentException( sprintf('Cannot get repository for nested document class "%s".', $documentClass) ...
php
public function getRepository(string $documentClass): Repository { $metadata = $this->getMetadata($documentClass); if ($metadata->isNested()) { throw new InvalidArgumentException( sprintf('Cannot get repository for nested document class "%s".', $documentClass) ...
[ "public", "function", "getRepository", "(", "string", "$", "documentClass", ")", ":", "Repository", "{", "$", "metadata", "=", "$", "this", "->", "getMetadata", "(", "$", "documentClass", ")", ";", "if", "(", "$", "metadata", "->", "isNested", "(", ")", ...
@param string $documentClass @return Repository
[ "@param", "string", "$documentClass" ]
train
https://github.com/tequila/mongodb-odm/blob/501d58529bbcb23ad7839680462f62d5c3466d23/src/DocumentManager.php#L149-L159
tequila/mongodb-odm
src/DocumentManager.php
DocumentManager.getCollectionOptionsHash
private function getCollectionOptionsHash(array $options) { ksort($options); $str = ''; foreach ($options as $option) { if (!$option instanceof Serializable) { // All valid Collection options are BSON serializable continue; } ...
php
private function getCollectionOptionsHash(array $options) { ksort($options); $str = ''; foreach ($options as $option) { if (!$option instanceof Serializable) { // All valid Collection options are BSON serializable continue; } ...
[ "private", "function", "getCollectionOptionsHash", "(", "array", "$", "options", ")", "{", "ksort", "(", "$", "options", ")", ";", "$", "str", "=", "''", ";", "foreach", "(", "$", "options", "as", "$", "option", ")", "{", "if", "(", "!", "$", "option...
@param array $options @return string
[ "@param", "array", "$options" ]
train
https://github.com/tequila/mongodb-odm/blob/501d58529bbcb23ad7839680462f62d5c3466d23/src/DocumentManager.php#L239-L252
tequila/mongodb-odm
src/DocumentManager.php
DocumentManager.getDocumentClass
private static function getDocumentClass(DocumentInterface $document): string { return $document instanceof ProxyInterface ? $document->getRealClass() : get_class($document); }
php
private static function getDocumentClass(DocumentInterface $document): string { return $document instanceof ProxyInterface ? $document->getRealClass() : get_class($document); }
[ "private", "static", "function", "getDocumentClass", "(", "DocumentInterface", "$", "document", ")", ":", "string", "{", "return", "$", "document", "instanceof", "ProxyInterface", "?", "$", "document", "->", "getRealClass", "(", ")", ":", "get_class", "(", "$", ...
@param DocumentInterface $document @return string
[ "@param", "DocumentInterface", "$document" ]
train
https://github.com/tequila/mongodb-odm/blob/501d58529bbcb23ad7839680462f62d5c3466d23/src/DocumentManager.php#L259-L262
comodojo/daemon
src/Comodojo/Daemon/Socket/SocketTransport.php
SocketTransport.performCall
public function performCall( LoggerInterface $logger, $data, $content_type, $encrypt = false ) { try { $logger->debug("Connecting to socket"); $this->connect(); $logger->debug("Sending RPC data"); $data = $this->can($data, ...
php
public function performCall( LoggerInterface $logger, $data, $content_type, $encrypt = false ) { try { $logger->debug("Connecting to socket"); $this->connect(); $logger->debug("Sending RPC data"); $data = $this->can($data, ...
[ "public", "function", "performCall", "(", "LoggerInterface", "$", "logger", ",", "$", "data", ",", "$", "content_type", ",", "$", "encrypt", "=", "false", ")", "{", "try", "{", "$", "logger", "->", "debug", "(", "\"Connecting to socket\"", ")", ";", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/comodojo/daemon/blob/361b0a3a91dc7720dd3bec448bb4ca47d0ef0292/src/Comodojo/Daemon/Socket/SocketTransport.php#L18-L65
rafalkot/yii2-settings
Settings.php
Settings.get
public function get($category, $key = null, $default = null) { $this->load($category); if ($key === null) { return isset($this->items[$category]) && !empty($this->items[$category]) ? $this->items[$category] : $default; } if (is_string($key)) { return isset($...
php
public function get($category, $key = null, $default = null) { $this->load($category); if ($key === null) { return isset($this->items[$category]) && !empty($this->items[$category]) ? $this->items[$category] : $default; } if (is_string($key)) { return isset($...
[ "public", "function", "get", "(", "$", "category", ",", "$", "key", "=", "null", ",", "$", "default", "=", "null", ")", "{", "$", "this", "->", "load", "(", "$", "category", ")", ";", "if", "(", "$", "key", "===", "null", ")", "{", "return", "i...
Returns settings. @param string $category Category name @param string|array $key Single or multiple keys in array @param mixed $default Default value when setting does not exist @return mixed Setting value @throws Exception
[ "Returns", "settings", "." ]
train
https://github.com/rafalkot/yii2-settings/blob/b601b58809322f617273093766dc28c08e74d566/Settings.php#L56-L77
rafalkot/yii2-settings
Settings.php
Settings.set
public function set($category, $key, $value = null) { if (is_string($key)) { $encodedVal = Json::encode($value); $this->get($category, $key, null); if (array_key_exists($key, $this->items[$category])) { $this->dbUpdate($category, $key, $encodedVal); ...
php
public function set($category, $key, $value = null) { if (is_string($key)) { $encodedVal = Json::encode($value); $this->get($category, $key, null); if (array_key_exists($key, $this->items[$category])) { $this->dbUpdate($category, $key, $encodedVal); ...
[ "public", "function", "set", "(", "$", "category", ",", "$", "key", ",", "$", "value", "=", "null", ")", "{", "if", "(", "is_string", "(", "$", "key", ")", ")", "{", "$", "encodedVal", "=", "Json", "::", "encode", "(", "$", "value", ")", ";", "...
Saves settings @param string $category Category name @param mixed $key Setting key or array of settings ie.: ['key' => value'', 'key2' => 'value2'] @param mixed $value Setting value @throws Exception
[ "Saves", "settings" ]
train
https://github.com/rafalkot/yii2-settings/blob/b601b58809322f617273093766dc28c08e74d566/Settings.php#L87-L107
rafalkot/yii2-settings
Settings.php
Settings.remove
public function remove($category, $key = null) { if ($key === null) { $this->dbDelete($category); if (isset($this->items[$category])) { unset($this->items[$category]); } } if (is_string($key)) { $this->dbDelete($category, $key...
php
public function remove($category, $key = null) { if ($key === null) { $this->dbDelete($category); if (isset($this->items[$category])) { unset($this->items[$category]); } } if (is_string($key)) { $this->dbDelete($category, $key...
[ "public", "function", "remove", "(", "$", "category", ",", "$", "key", "=", "null", ")", "{", "if", "(", "$", "key", "===", "null", ")", "{", "$", "this", "->", "dbDelete", "(", "$", "category", ")", ";", "if", "(", "isset", "(", "$", "this", "...
Removes settings @param string $category Category name @param array|string|null $key Setting key, keys array or null to delete all settings from category @throws Exception
[ "Removes", "settings" ]
train
https://github.com/rafalkot/yii2-settings/blob/b601b58809322f617273093766dc28c08e74d566/Settings.php#L116-L140
rafalkot/yii2-settings
Settings.php
Settings.load
public function load($categories) { if (is_string($categories)) { $categories = [$categories]; } foreach ($categories as $idx => $category) { if (isset($this->items[$category])) { unset($categories[$idx]); } else { $this->i...
php
public function load($categories) { if (is_string($categories)) { $categories = [$categories]; } foreach ($categories as $idx => $category) { if (isset($this->items[$category])) { unset($categories[$idx]); } else { $this->i...
[ "public", "function", "load", "(", "$", "categories", ")", "{", "if", "(", "is_string", "(", "$", "categories", ")", ")", "{", "$", "categories", "=", "[", "$", "categories", "]", ";", "}", "foreach", "(", "$", "categories", "as", "$", "idx", "=>", ...
Loads settings from category or multiple categories @param array|string $categories Category name
[ "Loads", "settings", "from", "category", "or", "multiple", "categories" ]
train
https://github.com/rafalkot/yii2-settings/blob/b601b58809322f617273093766dc28c08e74d566/Settings.php#L147-L176
rafalkot/yii2-settings
Settings.php
Settings.dbInsert
protected function dbInsert($category, $key, $value) { $created_by = \Yii::$app->user->getId(); $this->getDb()->createCommand(' INSERT INTO {{setting}} (`category`, `key`, `value`, `created_at`, `created_by`) VALUES (:category, :key, :value, NOW(), :created_by...
php
protected function dbInsert($category, $key, $value) { $created_by = \Yii::$app->user->getId(); $this->getDb()->createCommand(' INSERT INTO {{setting}} (`category`, `key`, `value`, `created_at`, `created_by`) VALUES (:category, :key, :value, NOW(), :created_by...
[ "protected", "function", "dbInsert", "(", "$", "category", ",", "$", "key", ",", "$", "value", ")", "{", "$", "created_by", "=", "\\", "Yii", "::", "$", "app", "->", "user", "->", "getId", "(", ")", ";", "$", "this", "->", "getDb", "(", ")", "->"...
Stores settings in database @param string $category Category name @param string $key Setting key @param string $value Setting value @throws \yii\db\Exception
[ "Stores", "settings", "in", "database" ]
train
https://github.com/rafalkot/yii2-settings/blob/b601b58809322f617273093766dc28c08e74d566/Settings.php#L194-L203
rafalkot/yii2-settings
Settings.php
Settings.dbUpdate
protected function dbUpdate($category, $key, $value) { $updated_by = \Yii::$app->user->getId(); $this->getDb()->createCommand(' UPDATE {{setting}} SET `value` = :value, `updated_at` = NOW(), `updated_by` = :updat...
php
protected function dbUpdate($category, $key, $value) { $updated_by = \Yii::$app->user->getId(); $this->getDb()->createCommand(' UPDATE {{setting}} SET `value` = :value, `updated_at` = NOW(), `updated_by` = :updat...
[ "protected", "function", "dbUpdate", "(", "$", "category", ",", "$", "key", ",", "$", "value", ")", "{", "$", "updated_by", "=", "\\", "Yii", "::", "$", "app", "->", "user", "->", "getId", "(", ")", ";", "$", "this", "->", "getDb", "(", ")", "->"...
Updates setting in database @param string $category Category name @param string $key Setting key @param string $value Setting value @throws \yii\db\Exception
[ "Updates", "setting", "in", "database" ]
train
https://github.com/rafalkot/yii2-settings/blob/b601b58809322f617273093766dc28c08e74d566/Settings.php#L213-L227
rafalkot/yii2-settings
Settings.php
Settings.dbDelete
protected function dbDelete($category, $key = null) { if ($key === null) { $this->getDb()->createCommand(' DELETE FROM {{setting}} WHERE `category` = :category ', compact('category'))->execute(); } ...
php
protected function dbDelete($category, $key = null) { if ($key === null) { $this->getDb()->createCommand(' DELETE FROM {{setting}} WHERE `category` = :category ', compact('category'))->execute(); } ...
[ "protected", "function", "dbDelete", "(", "$", "category", ",", "$", "key", "=", "null", ")", "{", "if", "(", "$", "key", "===", "null", ")", "{", "$", "this", "->", "getDb", "(", ")", "->", "createCommand", "(", "'\n DELETE FROM\n ...
Deletes setting from database @param string|array $category Category name(s) @param string|array|null $key Setting key(s) or null to delete all values from category @throws \yii\db\Exception
[ "Deletes", "setting", "from", "database" ]
train
https://github.com/rafalkot/yii2-settings/blob/b601b58809322f617273093766dc28c08e74d566/Settings.php#L236-L262
antaresproject/notifications
src/Repository/StackRepository.php
StackRepository.push
public function push($type, $name, $value) { $typeModel = NotificationTypes::where('name', $type)->first(); if (is_null($typeModel)) { return false; } $tId = $typeModel->id; $model = $this->makeModel()->getModel()->newInstance([ 'type_id' => $tId, ...
php
public function push($type, $name, $value) { $typeModel = NotificationTypes::where('name', $type)->first(); if (is_null($typeModel)) { return false; } $tId = $typeModel->id; $model = $this->makeModel()->getModel()->newInstance([ 'type_id' => $tId, ...
[ "public", "function", "push", "(", "$", "type", ",", "$", "name", ",", "$", "value", ")", "{", "$", "typeModel", "=", "NotificationTypes", "::", "where", "(", "'name'", ",", "$", "type", ")", "->", "first", "(", ")", ";", "if", "(", "is_null", "(",...
push notification to database @param String $type @param String $name @param array $value @return boolean
[ "push", "notification", "to", "database" ]
train
https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Repository/StackRepository.php#L58-L72