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
alcaeus/mongo-php-adapter
lib/Mongo/MongoCursor.php
MongoCursor.hasNext
public function hasNext() { if (! $this->startedIterating) { $this->ensureIterator(); $this->startedIterating = true; $this->storeIteratorState(); $this->cursorNeedsAdvancing = false; } elseif ($this->cursorNeedsAdvancing) { $this->ensureIt...
php
public function hasNext() { if (! $this->startedIterating) { $this->ensureIterator(); $this->startedIterating = true; $this->storeIteratorState(); $this->cursorNeedsAdvancing = false; } elseif ($this->cursorNeedsAdvancing) { $this->ensureIt...
[ "public", "function", "hasNext", "(", ")", "{", "if", "(", "!", "$", "this", "->", "startedIterating", ")", "{", "$", "this", "->", "ensureIterator", "(", ")", ";", "$", "this", "->", "startedIterating", "=", "true", ";", "$", "this", "->", "storeItera...
Checks if there are any more elements in this cursor @link http://www.php.net/manual/en/mongocursor.hasnext.php @throws MongoConnectionException @throws MongoCursorTimeoutException @return bool Returns true if there is another element
[ "Checks", "if", "there", "are", "any", "more", "elements", "in", "this", "cursor" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCursor.php#L242-L255
alcaeus/mongo-php-adapter
lib/Mongo/MongoDate.php
MongoDate.toBSONType
public function toBSONType() { $milliSeconds = ($this->sec * 1000) + ($this->truncateMicroSeconds($this->usec) / 1000); return new UTCDateTime($milliSeconds); }
php
public function toBSONType() { $milliSeconds = ($this->sec * 1000) + ($this->truncateMicroSeconds($this->usec) / 1000); return new UTCDateTime($milliSeconds); }
[ "public", "function", "toBSONType", "(", ")", "{", "$", "milliSeconds", "=", "(", "$", "this", "->", "sec", "*", "1000", ")", "+", "(", "$", "this", "->", "truncateMicroSeconds", "(", "$", "this", "->", "usec", ")", "/", "1000", ")", ";", "return", ...
Converts this MongoDate to the new BSON UTCDateTime type @return UTCDateTime @internal This method is not part of the ext-mongo API
[ "Converts", "this", "MongoDate", "to", "the", "new", "BSON", "UTCDateTime", "type" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoDate.php#L76-L81
alcaeus/mongo-php-adapter
lib/Mongo/MongoDate.php
MongoDate.toDateTime
public function toDateTime() { $datetime = new \DateTime(); $datetime->setTimestamp($this->sec); $microSeconds = $this->truncateMicroSeconds($this->usec); if ($microSeconds > 0) { $datetime = \DateTime::createFromFormat('Y-m-d H:i:s.u', $datetime->format('Y-m-d H:i:s') ....
php
public function toDateTime() { $datetime = new \DateTime(); $datetime->setTimestamp($this->sec); $microSeconds = $this->truncateMicroSeconds($this->usec); if ($microSeconds > 0) { $datetime = \DateTime::createFromFormat('Y-m-d H:i:s.u', $datetime->format('Y-m-d H:i:s') ....
[ "public", "function", "toDateTime", "(", ")", "{", "$", "datetime", "=", "new", "\\", "DateTime", "(", ")", ";", "$", "datetime", "->", "setTimestamp", "(", "$", "this", "->", "sec", ")", ";", "$", "microSeconds", "=", "$", "this", "->", "truncateMicro...
Returns a DateTime object representing this date @link http://php.net/manual/en/mongodate.todatetime.php @return DateTime
[ "Returns", "a", "DateTime", "object", "representing", "this", "date" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoDate.php#L88-L101
alcaeus/mongo-php-adapter
lib/Mongo/MongoGridFSCursor.php
MongoGridFSCursor.current
public function current() { $file = parent::current(); return ($file !== null) ? new MongoGridFSFile($this->gridfs, $file) : null; }
php
public function current() { $file = parent::current(); return ($file !== null) ? new MongoGridFSFile($this->gridfs, $file) : null; }
[ "public", "function", "current", "(", ")", "{", "$", "file", "=", "parent", "::", "current", "(", ")", ";", "return", "(", "$", "file", "!==", "null", ")", "?", "new", "MongoGridFSFile", "(", "$", "this", "->", "gridfs", ",", "$", "file", ")", ":",...
Returns the current file @link http://php.net/manual/en/mongogridfscursor.current.php @return MongoGridFSFile The current file
[ "Returns", "the", "current", "file" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoGridFSCursor.php#L56-L60
alcaeus/mongo-php-adapter
lib/Mongo/MongoGridFSCursor.php
MongoGridFSCursor.key
public function key() { $file = $this->current(); return ($file !== null) ? (string) $file->file['_id'] : null; }
php
public function key() { $file = $this->current(); return ($file !== null) ? (string) $file->file['_id'] : null; }
[ "public", "function", "key", "(", ")", "{", "$", "file", "=", "$", "this", "->", "current", "(", ")", ";", "return", "(", "$", "file", "!==", "null", ")", "?", "(", "string", ")", "$", "file", "->", "file", "[", "'_id'", "]", ":", "null", ";", ...
Returns the current result's filename @link http://php.net/manual/en/mongogridfscursor.key.php @return string The current results filename
[ "Returns", "the", "current", "result", "s", "filename" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoGridFSCursor.php#L68-L72
alcaeus/mongo-php-adapter
lib/Mongo/MongoWriteBatch.php
MongoWriteBatch.add
public function add($item) { if (is_object($item)) { $item = (array) $item; } $this->validate($item); $this->addItem($item); return true; }
php
public function add($item) { if (is_object($item)) { $item = (array) $item; } $this->validate($item); $this->addItem($item); return true; }
[ "public", "function", "add", "(", "$", "item", ")", "{", "if", "(", "is_object", "(", "$", "item", ")", ")", "{", "$", "item", "=", "(", "array", ")", "$", "item", ";", "}", "$", "this", "->", "validate", "(", "$", "item", ")", ";", "$", "thi...
Adds a write operation to a batch @see http://php.net/manual/en/mongowritebatch.add.php @param array|object $item @return boolean
[ "Adds", "a", "write", "operation", "to", "a", "batch" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoWriteBatch.php#L83-L93
alcaeus/mongo-php-adapter
lib/Mongo/MongoWriteBatch.php
MongoWriteBatch.execute
final public function execute(array $writeOptions = []) { $writeOptions += $this->writeOptions; if (! count($this->items)) { return ['ok' => true]; } if (isset($writeOptions['j'])) { trigger_error('j parameter is not supported', E_USER_WARNING); } ...
php
final public function execute(array $writeOptions = []) { $writeOptions += $this->writeOptions; if (! count($this->items)) { return ['ok' => true]; } if (isset($writeOptions['j'])) { trigger_error('j parameter is not supported', E_USER_WARNING); } ...
[ "final", "public", "function", "execute", "(", "array", "$", "writeOptions", "=", "[", "]", ")", "{", "$", "writeOptions", "+=", "$", "this", "->", "writeOptions", ";", "if", "(", "!", "count", "(", "$", "this", "->", "items", ")", ")", "{", "return"...
Executes a batch of write operations @see http://php.net/manual/en/mongowritebatch.execute.php @param array $writeOptions @return array
[ "Executes", "a", "batch", "of", "write", "operations" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoWriteBatch.php#L102-L206
alcaeus/mongo-php-adapter
lib/Mongo/MongoDB.php
MongoDB.getCollectionInfo
public function getCollectionInfo(array $options = []) { $includeSystemCollections = false; // The includeSystemCollections option is no longer supported in the command if (isset($options['includeSystemCollections'])) { $includeSystemCollections = $options['includeSystemCollectio...
php
public function getCollectionInfo(array $options = []) { $includeSystemCollections = false; // The includeSystemCollections option is no longer supported in the command if (isset($options['includeSystemCollections'])) { $includeSystemCollections = $options['includeSystemCollectio...
[ "public", "function", "getCollectionInfo", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "includeSystemCollections", "=", "false", ";", "// The includeSystemCollections option is no longer supported in the command", "if", "(", "isset", "(", "$", "options",...
Returns information about collections in this database @link http://www.php.net/manual/en/mongodb.getcollectioninfo.php @param array $options An array of options for listing the collections. @return array
[ "Returns", "information", "about", "collections", "in", "this", "database" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoDB.php#L130-L169
alcaeus/mongo-php-adapter
lib/Mongo/MongoDB.php
MongoDB.getCollectionNames
public function getCollectionNames(array $options = []) { $includeSystemCollections = false; // The includeSystemCollections option is no longer supported in the command if (isset($options['includeSystemCollections'])) { $includeSystemCollections = $options['includeSystemCollecti...
php
public function getCollectionNames(array $options = []) { $includeSystemCollections = false; // The includeSystemCollections option is no longer supported in the command if (isset($options['includeSystemCollections'])) { $includeSystemCollections = $options['includeSystemCollecti...
[ "public", "function", "getCollectionNames", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "includeSystemCollections", "=", "false", ";", "// The includeSystemCollections option is no longer supported in the command", "if", "(", "isset", "(", "$", "options"...
Get all collections from this database @link http://www.php.net/manual/en/mongodb.getcollectionnames.php @param array $options An array of options for listing the collections. @return array Returns the names of the all the collections in the database as an array
[ "Get", "all", "collections", "from", "this", "database" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoDB.php#L178-L203
alcaeus/mongo-php-adapter
lib/Mongo/MongoDB.php
MongoDB.setProfilingLevel
public function setProfilingLevel($level) { $result = $this->command(['profile' => $level]); return ($result['ok'] && isset($result['was'])) ? $result['was'] : 0; }
php
public function setProfilingLevel($level) { $result = $this->command(['profile' => $level]); return ($result['ok'] && isset($result['was'])) ? $result['was'] : 0; }
[ "public", "function", "setProfilingLevel", "(", "$", "level", ")", "{", "$", "result", "=", "$", "this", "->", "command", "(", "[", "'profile'", "=>", "$", "level", "]", ")", ";", "return", "(", "$", "result", "[", "'ok'", "]", "&&", "isset", "(", ...
Sets this database's profiling level @link http://www.php.net/manual/en/mongodb.setprofilinglevel.php @param int $level Profiling level. @return int Returns the previous profiling level.
[ "Sets", "this", "database", "s", "profiling", "level" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoDB.php#L246-L251
alcaeus/mongo-php-adapter
lib/Mongo/MongoDB.php
MongoDB.repair
public function repair($preserve_cloned_files = false, $backup_original_files = false) { $command = [ 'repairDatabase' => 1, 'preserveClonedFilesOnFailure' => $preserve_cloned_files, 'backupOriginalFiles' => $backup_original_files, ]; return $this->comman...
php
public function repair($preserve_cloned_files = false, $backup_original_files = false) { $command = [ 'repairDatabase' => 1, 'preserveClonedFilesOnFailure' => $preserve_cloned_files, 'backupOriginalFiles' => $backup_original_files, ]; return $this->comman...
[ "public", "function", "repair", "(", "$", "preserve_cloned_files", "=", "false", ",", "$", "backup_original_files", "=", "false", ")", "{", "$", "command", "=", "[", "'repairDatabase'", "=>", "1", ",", "'preserveClonedFilesOnFailure'", "=>", "$", "preserve_cloned_...
Repairs and compacts this database @link http://www.php.net/manual/en/mongodb.repair.php @param bool $preserve_cloned_files [optional] <p>If cloned files should be kept if the repair fails.</p> @param bool $backup_original_files [optional] <p>If original files should be backed up.</p> @return array <p>Returns db respo...
[ "Repairs", "and", "compacts", "this", "database" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoDB.php#L272-L281
alcaeus/mongo-php-adapter
lib/Mongo/MongoDB.php
MongoDB.createCollection
public function createCollection($name, $options = []) { try { if (isset($options['capped'])) { $options['capped'] = (bool) $options['capped']; } $this->db->createCollection($name, $options); } catch (\MongoDB\Driver\Exception\Exception $e) { ...
php
public function createCollection($name, $options = []) { try { if (isset($options['capped'])) { $options['capped'] = (bool) $options['capped']; } $this->db->createCollection($name, $options); } catch (\MongoDB\Driver\Exception\Exception $e) { ...
[ "public", "function", "createCollection", "(", "$", "name", ",", "$", "options", "=", "[", "]", ")", "{", "try", "{", "if", "(", "isset", "(", "$", "options", "[", "'capped'", "]", ")", ")", "{", "$", "options", "[", "'capped'", "]", "=", "(", "b...
Creates a collection @link http://www.php.net/manual/en/mongodb.createcollection.php @param string $name The name of the collection. @param array $options @return MongoCollection Returns a collection object representing the new collection.
[ "Creates", "a", "collection" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoDB.php#L304-L317
alcaeus/mongo-php-adapter
lib/Mongo/MongoDB.php
MongoDB.dropCollection
public function dropCollection($coll) { if ($coll instanceof MongoCollection) { $coll = $coll->getName(); } return TypeConverter::toLegacy($this->db->dropCollection((string) $coll)); }
php
public function dropCollection($coll) { if ($coll instanceof MongoCollection) { $coll = $coll->getName(); } return TypeConverter::toLegacy($this->db->dropCollection((string) $coll)); }
[ "public", "function", "dropCollection", "(", "$", "coll", ")", "{", "if", "(", "$", "coll", "instanceof", "MongoCollection", ")", "{", "$", "coll", "=", "$", "coll", "->", "getName", "(", ")", ";", "}", "return", "TypeConverter", "::", "toLegacy", "(", ...
Drops a collection @link http://www.php.net/manual/en/mongodb.dropcollection.php @param MongoCollection|string $coll MongoCollection or name of collection to drop. @return array Returns the database response. @deprecated Use MongoCollection::drop() instead.
[ "Drops", "a", "collection" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoDB.php#L328-L335
alcaeus/mongo-php-adapter
lib/Mongo/MongoDB.php
MongoDB.createDBRef
public function createDBRef($collection, $document_or_id) { if ($document_or_id instanceof \MongoId) { $id = $document_or_id; } elseif (is_object($document_or_id)) { if (! isset($document_or_id->_id)) { $id = $document_or_id; } else { ...
php
public function createDBRef($collection, $document_or_id) { if ($document_or_id instanceof \MongoId) { $id = $document_or_id; } elseif (is_object($document_or_id)) { if (! isset($document_or_id->_id)) { $id = $document_or_id; } else { ...
[ "public", "function", "createDBRef", "(", "$", "collection", ",", "$", "document_or_id", ")", "{", "if", "(", "$", "document_or_id", "instanceof", "\\", "MongoId", ")", "{", "$", "id", "=", "$", "document_or_id", ";", "}", "elseif", "(", "is_object", "(", ...
Creates a database reference @link http://www.php.net/manual/en/mongodb.createdbref.php @param string $collection The collection to which the database reference will point. @param mixed $document_or_id @return array Returns a database reference array.
[ "Creates", "a", "database", "reference" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoDB.php#L357-L378
alcaeus/mongo-php-adapter
lib/Mongo/MongoDB.php
MongoDB.getDBRef
public function getDBRef(array $ref) { $db = (isset($ref['$db']) && $ref['$db'] !== $this->name) ? $this->connection->selectDB($ref['$db']) : $this; return MongoDBRef::get($db, $ref); }
php
public function getDBRef(array $ref) { $db = (isset($ref['$db']) && $ref['$db'] !== $this->name) ? $this->connection->selectDB($ref['$db']) : $this; return MongoDBRef::get($db, $ref); }
[ "public", "function", "getDBRef", "(", "array", "$", "ref", ")", "{", "$", "db", "=", "(", "isset", "(", "$", "ref", "[", "'$db'", "]", ")", "&&", "$", "ref", "[", "'$db'", "]", "!==", "$", "this", "->", "name", ")", "?", "$", "this", "->", "...
Fetches the document pointed to by a database reference @link http://www.php.net/manual/en/mongodb.getdbref.php @param array $ref A database reference. @return array Returns the document pointed to by the reference.
[ "Fetches", "the", "document", "pointed", "to", "by", "a", "database", "reference" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoDB.php#L388-L392
alcaeus/mongo-php-adapter
lib/Mongo/MongoDB.php
MongoDB.command
public function command(array $data, $options = [], &$hash = null) { try { $cursor = new \MongoCommandCursor($this->connection, $this->name, $data); $cursor->setReadPreference($this->getReadPreference()); return iterator_to_array($cursor)[0]; } catch (\MongoDB\Dr...
php
public function command(array $data, $options = [], &$hash = null) { try { $cursor = new \MongoCommandCursor($this->connection, $this->name, $data); $cursor->setReadPreference($this->getReadPreference()); return iterator_to_array($cursor)[0]; } catch (\MongoDB\Dr...
[ "public", "function", "command", "(", "array", "$", "data", ",", "$", "options", "=", "[", "]", ",", "&", "$", "hash", "=", "null", ")", "{", "try", "{", "$", "cursor", "=", "new", "\\", "MongoCommandCursor", "(", "$", "this", "->", "connection", "...
Execute a database command @link http://www.php.net/manual/en/mongodb.command.php @param array $data The query to send. @param array $options @return array Returns database response.
[ "Execute", "a", "database", "command" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoDB.php#L415-L425
alcaeus/mongo-php-adapter
lib/Mongo/MongoDB.php
MongoDB.setReadPreference
public function setReadPreference($readPreference, $tags = null) { $result = $this->setReadPreferenceFromParameters($readPreference, $tags); $this->createDatabaseObject(); return $result; }
php
public function setReadPreference($readPreference, $tags = null) { $result = $this->setReadPreferenceFromParameters($readPreference, $tags); $this->createDatabaseObject(); return $result; }
[ "public", "function", "setReadPreference", "(", "$", "readPreference", ",", "$", "tags", "=", "null", ")", "{", "$", "result", "=", "$", "this", "->", "setReadPreferenceFromParameters", "(", "$", "readPreference", ",", "$", "tags", ")", ";", "$", "this", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoDB.php#L489-L495
alcaeus/mongo-php-adapter
lib/Mongo/MongoDB.php
MongoDB.setWriteConcern
public function setWriteConcern($wstring, $wtimeout = 0) { $result = $this->setWriteConcernFromParameters($wstring, $wtimeout); $this->createDatabaseObject(); return $result; }
php
public function setWriteConcern($wstring, $wtimeout = 0) { $result = $this->setWriteConcernFromParameters($wstring, $wtimeout); $this->createDatabaseObject(); return $result; }
[ "public", "function", "setWriteConcern", "(", "$", "wstring", ",", "$", "wtimeout", "=", "0", ")", "{", "$", "result", "=", "$", "this", "->", "setWriteConcernFromParameters", "(", "$", "wstring", ",", "$", "wtimeout", ")", ";", "$", "this", "->", "creat...
{@inheritdoc}
[ "{" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoDB.php#L500-L506
alcaeus/mongo-php-adapter
lib/Alcaeus/MongoDbAdapter/TypeConverter.php
TypeConverter.fromLegacy
public static function fromLegacy($value) { switch (true) { case $value instanceof TypeInterface: return $value->toBSONType(); case $value instanceof BSON\Type: return $value; case is_array($value): case is_object($value): ...
php
public static function fromLegacy($value) { switch (true) { case $value instanceof TypeInterface: return $value->toBSONType(); case $value instanceof BSON\Type: return $value; case is_array($value): case is_object($value): ...
[ "public", "static", "function", "fromLegacy", "(", "$", "value", ")", "{", "switch", "(", "true", ")", "{", "case", "$", "value", "instanceof", "TypeInterface", ":", "return", "$", "value", "->", "toBSONType", "(", ")", ";", "case", "$", "value", "instan...
Converts a legacy type to the new BSON type This method handles type conversion from ext-mongo to ext-mongodb: - For all types (MongoId, MongoDate, etc.) it returns the correct BSON object instance - For arrays and objects it iterates over properties and converts each item individually - For other types it returns the...
[ "Converts", "a", "legacy", "type", "to", "the", "new", "BSON", "type" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Alcaeus/MongoDbAdapter/TypeConverter.php#L39-L58
alcaeus/mongo-php-adapter
lib/Alcaeus/MongoDbAdapter/TypeConverter.php
TypeConverter.toLegacy
public static function toLegacy($value) { switch (true) { case $value instanceof BSON\Type: return self::convertBSONObjectToLegacy($value); case is_array($value): case is_object($value): $result = []; foreach ($value as $ke...
php
public static function toLegacy($value) { switch (true) { case $value instanceof BSON\Type: return self::convertBSONObjectToLegacy($value); case is_array($value): case is_object($value): $result = []; foreach ($value as $ke...
[ "public", "static", "function", "toLegacy", "(", "$", "value", ")", "{", "switch", "(", "true", ")", "{", "case", "$", "value", "instanceof", "BSON", "\\", "Type", ":", "return", "self", "::", "convertBSONObjectToLegacy", "(", "$", "value", ")", ";", "ca...
Converts a BSON type to the legacy types This method handles type conversion from ext-mongodb to ext-mongo: - For all instances of BSON\Type it returns an object of the corresponding legacy type (MongoId, MongoDate, etc.) - For arrays and objects it iterates over properties and converts each item individually - For ot...
[ "Converts", "a", "BSON", "type", "to", "the", "legacy", "types" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Alcaeus/MongoDbAdapter/TypeConverter.php#L73-L90
alcaeus/mongo-php-adapter
lib/Alcaeus/MongoDbAdapter/TypeConverter.php
TypeConverter.convertProjection
public static function convertProjection($fields) { if (! is_array($fields) || $fields === []) { return null; } if (! TypeConverter::isNumericArray($fields)) { $projection = TypeConverter::fromLegacy($fields); } else { $projection = array_fill_key...
php
public static function convertProjection($fields) { if (! is_array($fields) || $fields === []) { return null; } if (! TypeConverter::isNumericArray($fields)) { $projection = TypeConverter::fromLegacy($fields); } else { $projection = array_fill_key...
[ "public", "static", "function", "convertProjection", "(", "$", "fields", ")", "{", "if", "(", "!", "is_array", "(", "$", "fields", ")", "||", "$", "fields", "===", "[", "]", ")", "{", "return", "null", ";", "}", "if", "(", "!", "TypeConverter", "::",...
Converts a projection used in find queries. This method handles conversion from the legacy syntax (e.g. ['x', 'y', 'z']) to the new syntax (e.g. ['x' => true, 'y' => true, 'z' => true]). While this was never documented, the legacy driver applied the same conversion. @param array $fields @return array|null @throws \M...
[ "Converts", "a", "projection", "used", "in", "find", "queries", "." ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Alcaeus/MongoDbAdapter/TypeConverter.php#L104-L126
alcaeus/mongo-php-adapter
lib/Alcaeus/MongoDbAdapter/TypeConverter.php
TypeConverter.convertBSONObjectToLegacy
private static function convertBSONObjectToLegacy(BSON\Type $value) { switch (true) { case $value instanceof BSON\ObjectID: return new \MongoId($value); case $value instanceof BSON\Binary: return new \MongoBinData($value); case $value insta...
php
private static function convertBSONObjectToLegacy(BSON\Type $value) { switch (true) { case $value instanceof BSON\ObjectID: return new \MongoId($value); case $value instanceof BSON\Binary: return new \MongoBinData($value); case $value insta...
[ "private", "static", "function", "convertBSONObjectToLegacy", "(", "BSON", "\\", "Type", "$", "value", ")", "{", "switch", "(", "true", ")", "{", "case", "$", "value", "instanceof", "BSON", "\\", "ObjectID", ":", "return", "new", "\\", "MongoId", "(", "$",...
Converter method to convert a BSON object to its legacy type @param BSON\Type $value @return mixed
[ "Converter", "method", "to", "convert", "a", "BSON", "object", "to", "its", "legacy", "type" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Alcaeus/MongoDbAdapter/TypeConverter.php#L157-L185
alcaeus/mongo-php-adapter
lib/Mongo/MongoClient.php
MongoClient.getHosts
public function getHosts() { $this->forceConnect(); $results = []; try { $servers = $this->manager->getServers(); } catch (\MongoDB\Driver\Exception\Exception $e) { throw ExceptionConverter::toLegacy($e); } foreach ($servers as $server) { ...
php
public function getHosts() { $this->forceConnect(); $results = []; try { $servers = $this->manager->getServers(); } catch (\MongoDB\Driver\Exception\Exception $e) { throw ExceptionConverter::toLegacy($e); } foreach ($servers as $server) { ...
[ "public", "function", "getHosts", "(", ")", "{", "$", "this", "->", "forceConnect", "(", ")", ";", "$", "results", "=", "[", "]", ";", "try", "{", "$", "servers", "=", "$", "this", "->", "manager", "->", "getServers", "(", ")", ";", "}", "catch", ...
Get hosts This method is only useful with a connection to a replica set. It returns the status of all of the hosts in the set. Without a replica set, it will just return an array with one element containing the host that you are connected to. @return array
[ "Get", "hosts" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoClient.php#L195-L233
alcaeus/mongo-php-adapter
lib/Mongo/MongoClient.php
MongoClient.listDBs
public function listDBs() { try { $databaseInfoIterator = $this->client->listDatabases(); } catch (\MongoDB\Driver\Exception\Exception $e) { throw ExceptionConverter::toLegacy($e); } $databases = [ 'databases' => [], 'totalSize' => 0, ...
php
public function listDBs() { try { $databaseInfoIterator = $this->client->listDatabases(); } catch (\MongoDB\Driver\Exception\Exception $e) { throw ExceptionConverter::toLegacy($e); } $databases = [ 'databases' => [], 'totalSize' => 0, ...
[ "public", "function", "listDBs", "(", ")", "{", "try", "{", "$", "databaseInfoIterator", "=", "$", "this", "->", "client", "->", "listDatabases", "(", ")", ";", "}", "catch", "(", "\\", "MongoDB", "\\", "Driver", "\\", "Exception", "\\", "Exception", "$"...
Lists all of the databases available @link http://php.net/manual/en/mongoclient.listdbs.php @return array Returns an associative array containing three fields. The first field is databases, which in turn contains an array. Each element of the array is an associative array corresponding to a database, giving the databa...
[ "Lists", "all", "of", "the", "databases", "available" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoClient.php#L254-L278
alcaeus/mongo-php-adapter
lib/Mongo/MongoClient.php
MongoClient.forceConnect
private function forceConnect() { try { $command = new \MongoDB\Driver\Command(['ping' => 1]); $this->manager->executeCommand('db', $command); } catch (\MongoDB\Driver\Exception\Exception $e) { throw ExceptionConverter::toLegacy($e); } }
php
private function forceConnect() { try { $command = new \MongoDB\Driver\Command(['ping' => 1]); $this->manager->executeCommand('db', $command); } catch (\MongoDB\Driver\Exception\Exception $e) { throw ExceptionConverter::toLegacy($e); } }
[ "private", "function", "forceConnect", "(", ")", "{", "try", "{", "$", "command", "=", "new", "\\", "MongoDB", "\\", "Driver", "\\", "Command", "(", "[", "'ping'", "=>", "1", "]", ")", ";", "$", "this", "->", "manager", "->", "executeCommand", "(", "...
Forces a connection by executing the ping command
[ "Forces", "a", "connection", "by", "executing", "the", "ping", "command" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoClient.php#L337-L345
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.aggregate
public function aggregate(array $pipeline, array $op = []) { if (! TypeConverter::isNumericArray($pipeline)) { $operators = func_get_args(); $pipeline = []; $options = []; $i = 0; foreach ($operators as $operator) { $i++; ...
php
public function aggregate(array $pipeline, array $op = []) { if (! TypeConverter::isNumericArray($pipeline)) { $operators = func_get_args(); $pipeline = []; $options = []; $i = 0; foreach ($operators as $operator) { $i++; ...
[ "public", "function", "aggregate", "(", "array", "$", "pipeline", ",", "array", "$", "op", "=", "[", "]", ")", "{", "if", "(", "!", "TypeConverter", "::", "isNumericArray", "(", "$", "pipeline", ")", ")", "{", "$", "operators", "=", "func_get_args", "(...
Perform an aggregation using the aggregation framework @link http://www.php.net/manual/en/mongocollection.aggregate.php @param array $pipeline @param array $op @return array
[ "Perform", "an", "aggregation", "using", "the", "aggregation", "framework" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L131-L175
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.aggregateCursor
public function aggregateCursor(array $pipeline, array $options = []) { // Build command manually, can't use mongo-php-library here $command = [ 'aggregate' => $this->name, 'pipeline' => $pipeline ]; // Convert cursor option if (! isset($options['curs...
php
public function aggregateCursor(array $pipeline, array $options = []) { // Build command manually, can't use mongo-php-library here $command = [ 'aggregate' => $this->name, 'pipeline' => $pipeline ]; // Convert cursor option if (! isset($options['curs...
[ "public", "function", "aggregateCursor", "(", "array", "$", "pipeline", ",", "array", "$", "options", "=", "[", "]", ")", "{", "// Build command manually, can't use mongo-php-library here", "$", "command", "=", "[", "'aggregate'", "=>", "$", "this", "->", "name", ...
Execute an aggregation pipeline command and retrieve results through a cursor @link http://php.net/manual/en/mongocollection.aggregatecursor.php @param array $pipeline @param array $options @return MongoCommandCursor
[ "Execute", "an", "aggregation", "pipeline", "command", "and", "retrieve", "results", "through", "a", "cursor" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L185-L204
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.setReadPreference
public function setReadPreference($readPreference, $tags = null) { $result = $this->setReadPreferenceFromParameters($readPreference, $tags); $this->createCollectionObject(); return $result; }
php
public function setReadPreference($readPreference, $tags = null) { $result = $this->setReadPreferenceFromParameters($readPreference, $tags); $this->createCollectionObject(); return $result; }
[ "public", "function", "setReadPreference", "(", "$", "readPreference", ",", "$", "tags", "=", "null", ")", "{", "$", "result", "=", "$", "this", "->", "setReadPreferenceFromParameters", "(", "$", "readPreference", ",", "$", "tags", ")", ";", "$", "this", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L220-L226
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.setWriteConcern
public function setWriteConcern($wstring, $wtimeout = 0) { $result = $this->setWriteConcernFromParameters($wstring, $wtimeout); $this->createCollectionObject(); return $result; }
php
public function setWriteConcern($wstring, $wtimeout = 0) { $result = $this->setWriteConcernFromParameters($wstring, $wtimeout); $this->createCollectionObject(); return $result; }
[ "public", "function", "setWriteConcern", "(", "$", "wstring", ",", "$", "wtimeout", "=", "0", ")", "{", "$", "result", "=", "$", "this", "->", "setWriteConcernFromParameters", "(", "$", "wstring", ",", "$", "wtimeout", ")", ";", "$", "this", "->", "creat...
{@inheritdoc}
[ "{" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L231-L237
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.validate
public function validate($scan_data = false) { $command = [ 'validate' => $this->name, 'full' => $scan_data, ]; return $this->db->command($command); }
php
public function validate($scan_data = false) { $command = [ 'validate' => $this->name, 'full' => $scan_data, ]; return $this->db->command($command); }
[ "public", "function", "validate", "(", "$", "scan_data", "=", "false", ")", "{", "$", "command", "=", "[", "'validate'", "=>", "$", "this", "->", "name", ",", "'full'", "=>", "$", "scan_data", ",", "]", ";", "return", "$", "this", "->", "db", "->", ...
Validates this collection @link http://www.php.net/manual/en/mongocollection.validate.php @param bool $scan_data Only validate indices, not the base collection. @return array Returns the database's evaluation of this object.
[ "Validates", "this", "collection" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L257-L265
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.insert
public function insert(&$a, array $options = []) { if (! $this->ensureDocumentHasMongoId($a)) { trigger_error(sprintf('%s(): expects parameter %d to be an array or object, %s given', __METHOD__, 1, gettype($a)), E_USER_WARNING); return; } $this->mustBeArrayOrObject($...
php
public function insert(&$a, array $options = []) { if (! $this->ensureDocumentHasMongoId($a)) { trigger_error(sprintf('%s(): expects parameter %d to be an array or object, %s given', __METHOD__, 1, gettype($a)), E_USER_WARNING); return; } $this->mustBeArrayOrObject($...
[ "public", "function", "insert", "(", "&", "$", "a", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "$", "this", "->", "ensureDocumentHasMongoId", "(", "$", "a", ")", ")", "{", "trigger_error", "(", "sprintf", "(", "'%s(): expe...
Inserts an array into the collection @link http://www.php.net/manual/en/mongocollection.insert.php @param array|object $a @param array $options @throws MongoException if the inserted document is empty or if it contains zero-length keys. Attempting to insert an object with protected and private properties will cause a ...
[ "Inserts", "an", "array", "into", "the", "collection" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L278-L306
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.batchInsert
public function batchInsert(array &$a, array $options = []) { if (empty($a)) { throw new \MongoException('No write ops were included in the batch'); } $continueOnError = isset($options['continueOnError']) && $options['continueOnError']; foreach ($a as $key => $item) { ...
php
public function batchInsert(array &$a, array $options = []) { if (empty($a)) { throw new \MongoException('No write ops were included in the batch'); } $continueOnError = isset($options['continueOnError']) && $options['continueOnError']; foreach ($a as $key => $item) { ...
[ "public", "function", "batchInsert", "(", "array", "&", "$", "a", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "empty", "(", "$", "a", ")", ")", "{", "throw", "new", "\\", "MongoException", "(", "'No write ops were included in the ba...
Inserts multiple documents into this collection @link http://www.php.net/manual/en/mongocollection.batchinsert.php @param array $a An array of arrays. @param array $options Options for the inserts. @throws MongoCursorException @return mixed If "safe" is set, returns an associative array with the status of the inserts ...
[ "Inserts", "multiple", "documents", "into", "this", "collection" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L317-L363
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.update
public function update($criteria, $newobj, array $options = []) { $this->mustBeArrayOrObject($criteria); $this->mustBeArrayOrObject($newobj); $this->checkKeys((array) $newobj); $multiple = isset($options['multiple']) ? $options['multiple'] : false; $isReplace = ! \MongoDB\i...
php
public function update($criteria, $newobj, array $options = []) { $this->mustBeArrayOrObject($criteria); $this->mustBeArrayOrObject($newobj); $this->checkKeys((array) $newobj); $multiple = isset($options['multiple']) ? $options['multiple'] : false; $isReplace = ! \MongoDB\i...
[ "public", "function", "update", "(", "$", "criteria", ",", "$", "newobj", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "mustBeArrayOrObject", "(", "$", "criteria", ")", ";", "$", "this", "->", "mustBeArrayOrObject", "(", "$...
Update records based on a given criteria @link http://www.php.net/manual/en/mongocollection.update.php @param array|object $criteria Description of the objects to update. @param array|object $newobj The object with which to update the matching records. @param array $options @return bool|array @throws MongoException @t...
[ "Update", "records", "based", "on", "a", "given", "criteria" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L376-L417
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.remove
public function remove(array $criteria = [], array $options = []) { $multiple = isset($options['justOne']) ? !$options['justOne'] : true; $method = $multiple ? 'deleteMany' : 'deleteOne'; try { /** @var \MongoDB\DeleteResult $result */ $result = $this->collection->$m...
php
public function remove(array $criteria = [], array $options = []) { $multiple = isset($options['justOne']) ? !$options['justOne'] : true; $method = $multiple ? 'deleteMany' : 'deleteOne'; try { /** @var \MongoDB\DeleteResult $result */ $result = $this->collection->$m...
[ "public", "function", "remove", "(", "array", "$", "criteria", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "multiple", "=", "isset", "(", "$", "options", "[", "'justOne'", "]", ")", "?", "!", "$", "options", "[", "'...
Remove records from this collection @link http://www.php.net/manual/en/mongocollection.remove.php @param array $criteria Query criteria for the documents to delete. @param array $options An array of options for the remove operation. @throws MongoCursorException @throws MongoCursorTimeoutException @return bool|array Re...
[ "Remove", "records", "from", "this", "collection" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L430-L455
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.distinct
public function distinct($key, array $query = []) { try { return array_map([TypeConverter::class, 'toLegacy'], $this->collection->distinct($key, TypeConverter::fromLegacy($query))); } catch (\MongoDB\Driver\Exception\Exception $e) { return false; } }
php
public function distinct($key, array $query = []) { try { return array_map([TypeConverter::class, 'toLegacy'], $this->collection->distinct($key, TypeConverter::fromLegacy($query))); } catch (\MongoDB\Driver\Exception\Exception $e) { return false; } }
[ "public", "function", "distinct", "(", "$", "key", ",", "array", "$", "query", "=", "[", "]", ")", "{", "try", "{", "return", "array_map", "(", "[", "TypeConverter", "::", "class", ",", "'toLegacy'", "]", ",", "$", "this", "->", "collection", "->", "...
Retrieve a list of distinct values for the given key across a collection @link http://www.php.net/manual/ru/mongocollection.distinct.php @param string $key The key to use. @param array $query An optional query parameters @return array|bool Returns an array of distinct values, or FALSE on failure
[ "Retrieve", "a", "list", "of", "distinct", "values", "for", "the", "given", "key", "across", "a", "collection" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L481-L488
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.findAndModify
public function findAndModify(array $query, array $update = null, array $fields = null, array $options = []) { $query = TypeConverter::fromLegacy($query); try { if (isset($options['remove'])) { unset($options['remove']); $document = $this->collection->find...
php
public function findAndModify(array $query, array $update = null, array $fields = null, array $options = []) { $query = TypeConverter::fromLegacy($query); try { if (isset($options['remove'])) { unset($options['remove']); $document = $this->collection->find...
[ "public", "function", "findAndModify", "(", "array", "$", "query", ",", "array", "$", "update", "=", "null", ",", "array", "$", "fields", "=", "null", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "query", "=", "TypeConverter", "::", "f...
Update a document and return it @link http://www.php.net/manual/ru/mongocollection.findandmodify.php @param array $query The query criteria to search for. @param array $update The update criteria. @param array $fields Optionally only return these fields. @param array $options An array of options to apply, such as remo...
[ "Update", "a", "document", "and", "return", "it" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L500-L540
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.findOne
public function findOne($query = [], array $fields = [], array $options = []) { // Can't typehint for array since MongoGridFS extends and accepts strings if (! is_array($query)) { trigger_error(sprintf('MongoCollection::findOne(): expects parameter 1 to be an array or object, %s given', ...
php
public function findOne($query = [], array $fields = [], array $options = []) { // Can't typehint for array since MongoGridFS extends and accepts strings if (! is_array($query)) { trigger_error(sprintf('MongoCollection::findOne(): expects parameter 1 to be an array or object, %s given', ...
[ "public", "function", "findOne", "(", "$", "query", "=", "[", "]", ",", "array", "$", "fields", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ")", "{", "// Can't typehint for array since MongoGridFS extends and accepts strings", "if", "(", "!", ...
Querys this collection, returning a single element @link http://www.php.net/manual/en/mongocollection.findone.php @param array $query The fields for which to search. @param array $fields Fields of the results to return. @param array $options @return array|null
[ "Querys", "this", "collection", "returning", "a", "single", "element" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L551-L571
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.createIndex
public function createIndex($keys, array $options = []) { if (is_string($keys)) { if (empty($keys)) { throw new MongoException('empty string passed as key field'); } $keys = [$keys => 1]; } if (is_object($keys)) { $keys = (arra...
php
public function createIndex($keys, array $options = []) { if (is_string($keys)) { if (empty($keys)) { throw new MongoException('empty string passed as key field'); } $keys = [$keys => 1]; } if (is_object($keys)) { $keys = (arra...
[ "public", "function", "createIndex", "(", "$", "keys", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "is_string", "(", "$", "keys", ")", ")", "{", "if", "(", "empty", "(", "$", "keys", ")", ")", "{", "throw", "new", "MongoExce...
Creates an index on the given field(s), or does nothing if the index already exists @link http://www.php.net/manual/en/mongocollection.createindex.php @param array $keys Field or fields to use as index. @param array $options [optional] This parameter is an associative array of the form array("optionname" => <boolean>,...
[ "Creates", "an", "index", "on", "the", "given", "field", "(", "s", ")", "or", "does", "nothing", "if", "the", "index", "already", "exists" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L581-L646
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.deleteIndex
public function deleteIndex($keys) { if (is_string($keys)) { $indexName = $keys; if (! preg_match('#_-?1$#', $indexName)) { $indexName .= '_1'; } } elseif (is_array($keys)) { $indexName = \MongoDB\generate_index_name($keys); } e...
php
public function deleteIndex($keys) { if (is_string($keys)) { $indexName = $keys; if (! preg_match('#_-?1$#', $indexName)) { $indexName .= '_1'; } } elseif (is_array($keys)) { $indexName = \MongoDB\generate_index_name($keys); } e...
[ "public", "function", "deleteIndex", "(", "$", "keys", ")", "{", "if", "(", "is_string", "(", "$", "keys", ")", ")", "{", "$", "indexName", "=", "$", "keys", ";", "if", "(", "!", "preg_match", "(", "'#_-?1$#'", ",", "$", "indexName", ")", ")", "{",...
Deletes an index from this collection @link http://www.php.net/manual/en/mongocollection.deleteindex.php @param string|array $keys Field or fields from which to delete the index. @return array Returns the database response.
[ "Deletes", "an", "index", "from", "this", "collection" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L669-L687
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.deleteIndexes
public function deleteIndexes() { try { return TypeConverter::toLegacy($this->collection->dropIndexes()); } catch (\MongoDB\Driver\Exception\Exception $e) { return ExceptionConverter::toResultArray($e); } }
php
public function deleteIndexes() { try { return TypeConverter::toLegacy($this->collection->dropIndexes()); } catch (\MongoDB\Driver\Exception\Exception $e) { return ExceptionConverter::toResultArray($e); } }
[ "public", "function", "deleteIndexes", "(", ")", "{", "try", "{", "return", "TypeConverter", "::", "toLegacy", "(", "$", "this", "->", "collection", "->", "dropIndexes", "(", ")", ")", ";", "}", "catch", "(", "\\", "MongoDB", "\\", "Driver", "\\", "Excep...
Delete all indexes for this collection @link http://www.php.net/manual/en/mongocollection.deleteindexes.php @return array Returns the database response.
[ "Delete", "all", "indexes", "for", "this", "collection" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L695-L702
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.getIndexInfo
public function getIndexInfo() { $convertIndex = function (\MongoDB\Model\IndexInfo $indexInfo) { $infos = [ 'v' => $indexInfo->getVersion(), 'key' => $indexInfo->getKey(), 'name' => $indexInfo->getName(), 'ns' => $indexInfo->getNam...
php
public function getIndexInfo() { $convertIndex = function (\MongoDB\Model\IndexInfo $indexInfo) { $infos = [ 'v' => $indexInfo->getVersion(), 'key' => $indexInfo->getKey(), 'name' => $indexInfo->getName(), 'ns' => $indexInfo->getNam...
[ "public", "function", "getIndexInfo", "(", ")", "{", "$", "convertIndex", "=", "function", "(", "\\", "MongoDB", "\\", "Model", "\\", "IndexInfo", "$", "indexInfo", ")", "{", "$", "infos", "=", "[", "'v'", "=>", "$", "indexInfo", "->", "getVersion", "(",...
Returns an array of index names for this collection @link http://www.php.net/manual/en/mongocollection.getindexinfo.php @return array Returns a list of index names.
[ "Returns", "an", "array", "of", "index", "names", "for", "this", "collection" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L710-L747
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.count
public function count($query = [], $options = []) { try { // Handle legacy mode - limit and skip as second and third parameters, respectively if (! is_array($options)) { $limit = $options; $options = []; if ($limit !== null) { ...
php
public function count($query = [], $options = []) { try { // Handle legacy mode - limit and skip as second and third parameters, respectively if (! is_array($options)) { $limit = $options; $options = []; if ($limit !== null) { ...
[ "public", "function", "count", "(", "$", "query", "=", "[", "]", ",", "$", "options", "=", "[", "]", ")", "{", "try", "{", "// Handle legacy mode - limit and skip as second and third parameters, respectively", "if", "(", "!", "is_array", "(", "$", "options", ")"...
Counts the number of documents in this collection @link http://www.php.net/manual/en/mongocollection.count.php @param array|stdClass $query @param array $options @return int Returns the number of documents matching the query.
[ "Counts", "the", "number", "of", "documents", "in", "this", "collection" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L757-L778
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.save
public function save(&$a, array $options = []) { $id = $this->ensureDocumentHasMongoId($a); $document = (array) $a; $options['upsert'] = true; try { /** @var \MongoDB\UpdateResult $result */ $result = $this->collection->replaceOne( TypeConve...
php
public function save(&$a, array $options = []) { $id = $this->ensureDocumentHasMongoId($a); $document = (array) $a; $options['upsert'] = true; try { /** @var \MongoDB\UpdateResult $result */ $result = $this->collection->replaceOne( TypeConve...
[ "public", "function", "save", "(", "&", "$", "a", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "id", "=", "$", "this", "->", "ensureDocumentHasMongoId", "(", "$", "a", ")", ";", "$", "document", "=", "(", "array", ")", "$", "a", ...
Saves an object to this collection @link http://www.php.net/manual/en/mongocollection.save.php @param array|object $a Array to save. If an object is used, it may not have protected or private properties. @param array $options Options for the save. @throws MongoException if the inserted document is empty or if it conta...
[ "Saves", "an", "object", "to", "this", "collection" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L792-L828
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.createDBRef
public function createDBRef($document_or_id) { if ($document_or_id instanceof \MongoId) { $id = $document_or_id; } elseif (is_object($document_or_id)) { if (! isset($document_or_id->_id)) { return null; } $id = $document_or_id->_id; ...
php
public function createDBRef($document_or_id) { if ($document_or_id instanceof \MongoId) { $id = $document_or_id; } elseif (is_object($document_or_id)) { if (! isset($document_or_id->_id)) { return null; } $id = $document_or_id->_id; ...
[ "public", "function", "createDBRef", "(", "$", "document_or_id", ")", "{", "if", "(", "$", "document_or_id", "instanceof", "\\", "MongoId", ")", "{", "$", "id", "=", "$", "document_or_id", ";", "}", "elseif", "(", "is_object", "(", "$", "document_or_id", "...
Creates a database reference @link http://www.php.net/manual/en/mongocollection.createdbref.php @param array|object $document_or_id Object to which to create a reference. @return array Returns a database reference array.
[ "Creates", "a", "database", "reference" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L837-L858
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.group
public function group($keys, array $initial, $reduce, array $condition = []) { if (is_string($reduce)) { $reduce = new MongoCode($reduce); } $command = [ 'group' => [ 'ns' => $this->name, '$reduce' => (string) $reduce, ...
php
public function group($keys, array $initial, $reduce, array $condition = []) { if (is_string($reduce)) { $reduce = new MongoCode($reduce); } $command = [ 'group' => [ 'ns' => $this->name, '$reduce' => (string) $reduce, ...
[ "public", "function", "group", "(", "$", "keys", ",", "array", "$", "initial", ",", "$", "reduce", ",", "array", "$", "condition", "=", "[", "]", ")", "{", "if", "(", "is_string", "(", "$", "reduce", ")", ")", "{", "$", "reduce", "=", "new", "Mon...
Performs an operation similar to SQL's GROUP BY command @link http://www.php.net/manual/en/mongocollection.group.php @param mixed $keys Fields to group by. If an array or non-code object is passed, it will be the key used to group results. @param array $initial Initial value of the aggregation counter object. @param M...
[ "Performs", "an", "operation", "similar", "to", "SQL", "s", "GROUP", "BY", "command" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L882-L913
alcaeus/mongo-php-adapter
lib/Mongo/MongoCollection.php
MongoCollection.convertWriteConcernOptions
private function convertWriteConcernOptions(array $options) { if (isset($options['safe'])) { $options['w'] = ($options['safe']) ? 1 : 0; } if (isset($options['wtimeout']) && !isset($options['wTimeoutMS'])) { $options['wTimeoutMS'] = $options['wtimeout']; } ...
php
private function convertWriteConcernOptions(array $options) { if (isset($options['safe'])) { $options['w'] = ($options['safe']) ? 1 : 0; } if (isset($options['wtimeout']) && !isset($options['wTimeoutMS'])) { $options['wTimeoutMS'] = $options['wtimeout']; } ...
[ "private", "function", "convertWriteConcernOptions", "(", "array", "$", "options", ")", "{", "if", "(", "isset", "(", "$", "options", "[", "'safe'", "]", ")", ")", "{", "$", "options", "[", "'w'", "]", "=", "(", "$", "options", "[", "'safe'", "]", ")...
Converts legacy write concern options to a WriteConcern object @param array $options @return array
[ "Converts", "legacy", "write", "concern", "options", "to", "a", "WriteConcern", "object" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCollection.php#L955-L981
alcaeus/mongo-php-adapter
lib/Mongo/MongoGridFS.php
MongoGridFS.delete
public function delete($id) { $this->createChunksIndex(); $this->chunks->remove(['files_id' => $id], ['justOne' => false]); return parent::remove(['_id' => $id]); }
php
public function delete($id) { $this->createChunksIndex(); $this->chunks->remove(['files_id' => $id], ['justOne' => false]); return parent::remove(['_id' => $id]); }
[ "public", "function", "delete", "(", "$", "id", ")", "{", "$", "this", "->", "createChunksIndex", "(", ")", ";", "$", "this", "->", "chunks", "->", "remove", "(", "[", "'files_id'", "=>", "$", "id", "]", ",", "[", "'justOne'", "=>", "false", "]", "...
Delete a file from the database @link http://php.net/manual/en/mongogridfs.delete.php @param mixed $id _id of the file to remove @return boolean Returns true if the remove was successfully sent to the database.
[ "Delete", "a", "file", "from", "the", "database" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoGridFS.php#L89-L95
alcaeus/mongo-php-adapter
lib/Mongo/MongoGridFS.php
MongoGridFS.findOne
public function findOne($query = [], array $fields = [], array $options = []) { if (! is_array($query)) { $query = ['filename' => (string) $query]; } $items = iterator_to_array($this->find($query, $fields)->limit(1)); return count($items) ? current($items) : null; }
php
public function findOne($query = [], array $fields = [], array $options = []) { if (! is_array($query)) { $query = ['filename' => (string) $query]; } $items = iterator_to_array($this->find($query, $fields)->limit(1)); return count($items) ? current($items) : null; }
[ "public", "function", "findOne", "(", "$", "query", "=", "[", "]", ",", "array", "$", "fields", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "is_array", "(", "$", "query", ")", ")", "{", "$", "query", ...
Returns a single file matching the criteria @link http://www.php.net/manual/en/mongogridfs.findone.php @param mixed $query The fields for which to search or a filename to search for. @param array $fields Fields of the results to return. @param array $options Options for the find command @return MongoGridFSFile|null
[ "Returns", "a", "single", "file", "matching", "the", "criteria" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoGridFS.php#L132-L140
alcaeus/mongo-php-adapter
lib/Mongo/MongoGridFS.php
MongoGridFS.remove
public function remove(array $criteria = [], array $options = []) { $this->createChunksIndex(); $matchingFiles = parent::find($criteria, ['_id' => 1]); $ids = []; foreach ($matchingFiles as $file) { $ids[] = $file['_id']; } $this->chunks->remove(['files_i...
php
public function remove(array $criteria = [], array $options = []) { $this->createChunksIndex(); $matchingFiles = parent::find($criteria, ['_id' => 1]); $ids = []; foreach ($matchingFiles as $file) { $ids[] = $file['_id']; } $this->chunks->remove(['files_i...
[ "public", "function", "remove", "(", "array", "$", "criteria", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "createChunksIndex", "(", ")", ";", "$", "matchingFiles", "=", "parent", "::", "find", "(", "$", ...
Removes files from the collections @link http://www.php.net/manual/en/mongogridfs.remove.php @param array $criteria Description of records to remove. @param array $options Options for remove. @throws MongoCursorException @return boolean
[ "Removes", "files", "from", "the", "collections" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoGridFS.php#L177-L188
alcaeus/mongo-php-adapter
lib/Mongo/MongoGridFS.php
MongoGridFS.storeBytes
public function storeBytes($bytes, array $extra = [], array $options = []) { $this->createChunksIndex(); $record = $extra + [ 'length' => mb_strlen($bytes, '8bit'), 'md5' => md5($bytes), ]; try { $file = $this->insertFile($record, $options); ...
php
public function storeBytes($bytes, array $extra = [], array $options = []) { $this->createChunksIndex(); $record = $extra + [ 'length' => mb_strlen($bytes, '8bit'), 'md5' => md5($bytes), ]; try { $file = $this->insertFile($record, $options); ...
[ "public", "function", "storeBytes", "(", "$", "bytes", ",", "array", "$", "extra", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "createChunksIndex", "(", ")", ";", "$", "record", "=", "$", "extra", "+", ...
Chunkifies and stores bytes in the database @link http://php.net/manual/en/mongogridfs.storebytes.php @param string $bytes A string of bytes to store @param array $extra Other metadata to add to the file saved @param array $options Options for the store. "safe": Check that this store succeeded @return mixed The _id of ...
[ "Chunkifies", "and", "stores", "bytes", "in", "the", "database" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoGridFS.php#L198-L221
alcaeus/mongo-php-adapter
lib/Mongo/MongoGridFS.php
MongoGridFS.storeFile
public function storeFile($filename, array $extra = [], array $options = []) { $this->createChunksIndex(); $record = $extra; if (is_string($filename)) { $record += [ 'md5' => md5_file($filename), 'length' => filesize($filename), 'f...
php
public function storeFile($filename, array $extra = [], array $options = []) { $this->createChunksIndex(); $record = $extra; if (is_string($filename)) { $record += [ 'md5' => md5_file($filename), 'length' => filesize($filename), 'f...
[ "public", "function", "storeFile", "(", "$", "filename", ",", "array", "$", "extra", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "createChunksIndex", "(", ")", ";", "$", "record", "=", "$", "extra", ";",...
Stores a file in the database @link http://php.net/manual/en/mongogridfs.storefile.php @param string $filename The name of the file @param array $extra Other metadata to add to the file saved @param array $options Options for the store. "safe": Check that this store succeeded @return mixed Returns the _id of the saved...
[ "Stores", "a", "file", "in", "the", "database" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoGridFS.php#L234-L297
alcaeus/mongo-php-adapter
lib/Mongo/MongoGridFS.php
MongoGridFS.storeUpload
public function storeUpload($name, array $metadata = []) { if (! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) { throw new MongoGridFSException("Could not find uploaded file $name"); } if (! isset($_FILES[$name]['tmp_name'])) { throw new MongoGri...
php
public function storeUpload($name, array $metadata = []) { if (! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) { throw new MongoGridFSException("Could not find uploaded file $name"); } if (! isset($_FILES[$name]['tmp_name'])) { throw new MongoGri...
[ "public", "function", "storeUpload", "(", "$", "name", ",", "array", "$", "metadata", "=", "[", "]", ")", "{", "if", "(", "!", "isset", "(", "$", "_FILES", "[", "$", "name", "]", ")", "||", "$", "_FILES", "[", "$", "name", "]", "[", "'error'", ...
Saves an uploaded file directly from a POST to the database @link http://www.php.net/manual/en/mongogridfs.storeupload.php @param string $name The name attribute of the uploaded file, from <input type="file" name="something"/>. @param array $metadata An array of extra fields for the uploaded file. @return mixed Return...
[ "Saves", "an", "uploaded", "file", "directly", "from", "a", "POST", "to", "the", "database" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoGridFS.php#L308-L332
alcaeus/mongo-php-adapter
lib/Mongo/MongoGridFS.php
MongoGridFS.insertChunk
private function insertChunk($fileId, $data, $chunkNumber) { $chunk = [ 'files_id' => $fileId, 'n' => $chunkNumber, 'data' => new MongoBinData($data), ]; $result = $this->chunks->insert($chunk); if (! $this->isOKResult($result)) { thr...
php
private function insertChunk($fileId, $data, $chunkNumber) { $chunk = [ 'files_id' => $fileId, 'n' => $chunkNumber, 'data' => new MongoBinData($data), ]; $result = $this->chunks->insert($chunk); if (! $this->isOKResult($result)) { thr...
[ "private", "function", "insertChunk", "(", "$", "fileId", ",", "$", "data", ",", "$", "chunkNumber", ")", "{", "$", "chunk", "=", "[", "'files_id'", "=>", "$", "fileId", ",", "'n'", "=>", "$", "chunkNumber", ",", "'data'", "=>", "new", "MongoBinData", ...
Inserts a single chunk into the database @param mixed $fileId @param string $data @param int $chunkNumber @return array|bool
[ "Inserts", "a", "single", "chunk", "into", "the", "database" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoGridFS.php#L353-L368
alcaeus/mongo-php-adapter
lib/Mongo/MongoGridFS.php
MongoGridFS.insertChunksFromBytes
private function insertChunksFromBytes($bytes, $record) { $chunkSize = $record['chunkSize']; $fileId = $record['_id']; $i = 0; $chunks = str_split($bytes, $chunkSize); foreach ($chunks as $chunk) { $this->insertChunk($fileId, $chunk, $i++); } }
php
private function insertChunksFromBytes($bytes, $record) { $chunkSize = $record['chunkSize']; $fileId = $record['_id']; $i = 0; $chunks = str_split($bytes, $chunkSize); foreach ($chunks as $chunk) { $this->insertChunk($fileId, $chunk, $i++); } }
[ "private", "function", "insertChunksFromBytes", "(", "$", "bytes", ",", "$", "record", ")", "{", "$", "chunkSize", "=", "$", "record", "[", "'chunkSize'", "]", ";", "$", "fileId", "=", "$", "record", "[", "'_id'", "]", ";", "$", "i", "=", "0", ";", ...
Splits a string into chunks and writes them to the database @param string $bytes @param array $record
[ "Splits", "a", "string", "into", "chunks", "and", "writes", "them", "to", "the", "database" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoGridFS.php#L376-L386
alcaeus/mongo-php-adapter
lib/Mongo/MongoGridFS.php
MongoGridFS.insertChunksFromFile
private function insertChunksFromFile($handle, $record, &$md5) { $written = 0; $offset = 0; $i = 0; $fileId = $record['_id']; $chunkSize = $record['chunkSize']; $hash = hash_init('md5'); rewind($handle); while (! feof($handle)) { $data =...
php
private function insertChunksFromFile($handle, $record, &$md5) { $written = 0; $offset = 0; $i = 0; $fileId = $record['_id']; $chunkSize = $record['chunkSize']; $hash = hash_init('md5'); rewind($handle); while (! feof($handle)) { $data =...
[ "private", "function", "insertChunksFromFile", "(", "$", "handle", ",", "$", "record", ",", "&", "$", "md5", ")", "{", "$", "written", "=", "0", ";", "$", "offset", "=", "0", ";", "$", "i", "=", "0", ";", "$", "fileId", "=", "$", "record", "[", ...
Reads chunks from a file and writes them to the database @param resource $handle @param array $record @param string $md5 @return int Returns the number of bytes written to the database
[ "Reads", "chunks", "from", "a", "file", "and", "writes", "them", "to", "the", "database" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoGridFS.php#L396-L419
alcaeus/mongo-php-adapter
lib/Mongo/MongoGridFS.php
MongoGridFS.insertFile
private function insertFile($record, array $options = []) { $record += [ '_id' => new MongoId(), 'uploadDate' => new MongoDate(), 'chunkSize' => $this->defaultChunkSize, ]; $result = $this->insert($record, $options); if (! $this->isOKResult($resu...
php
private function insertFile($record, array $options = []) { $record += [ '_id' => new MongoId(), 'uploadDate' => new MongoDate(), 'chunkSize' => $this->defaultChunkSize, ]; $result = $this->insert($record, $options); if (! $this->isOKResult($resu...
[ "private", "function", "insertFile", "(", "$", "record", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "record", "+=", "[", "'_id'", "=>", "new", "MongoId", "(", ")", ",", "'uploadDate'", "=>", "new", "MongoDate", "(", ")", ",", "'chunk...
Writes a file record to the database @param $record @param array $options @return array
[ "Writes", "a", "file", "record", "to", "the", "database" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoGridFS.php#L428-L443
alcaeus/mongo-php-adapter
lib/Alcaeus/MongoDbAdapter/ExceptionConverter.php
ExceptionConverter.toLegacy
public static function toLegacy(Exception\Exception $e, $fallbackClass = 'MongoException') { $message = $e->getMessage(); $code = $e->getCode(); switch (get_class($e)) { case Exception\AuthenticationException::class: case Exception\ConnectionException::class: ...
php
public static function toLegacy(Exception\Exception $e, $fallbackClass = 'MongoException') { $message = $e->getMessage(); $code = $e->getCode(); switch (get_class($e)) { case Exception\AuthenticationException::class: case Exception\ConnectionException::class: ...
[ "public", "static", "function", "toLegacy", "(", "Exception", "\\", "Exception", "$", "e", ",", "$", "fallbackClass", "=", "'MongoException'", ")", "{", "$", "message", "=", "$", "e", "->", "getMessage", "(", ")", ";", "$", "code", "=", "$", "e", "->",...
@param Exception\Exception $e @param string $fallbackClass @return \MongoException
[ "@param", "Exception", "\\", "Exception", "$e", "@param", "string", "$fallbackClass" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Alcaeus/MongoDbAdapter/ExceptionConverter.php#L33-L87
alcaeus/mongo-php-adapter
lib/Mongo/MongoDBRef.php
MongoDBRef.create
public static function create($collection, $id, $database = null) { $ref = [ static::$refKey => $collection, static::$idKey => $id ]; if ($database !== null) { $ref['$db'] = $database; } return $ref; }
php
public static function create($collection, $id, $database = null) { $ref = [ static::$refKey => $collection, static::$idKey => $id ]; if ($database !== null) { $ref['$db'] = $database; } return $ref; }
[ "public", "static", "function", "create", "(", "$", "collection", ",", "$", "id", ",", "$", "database", "=", "null", ")", "{", "$", "ref", "=", "[", "static", "::", "$", "refKey", "=>", "$", "collection", ",", "static", "::", "$", "idKey", "=>", "$...
If no database is given, the current database is used. @link http://php.net/manual/en/mongodbref.create.php @static @param string $collection Collection name (without the database name) @param mixed $id The _id field of the object to which to link @param string $database Database name @return array Returns the referen...
[ "If", "no", "database", "is", "given", "the", "current", "database", "is", "used", "." ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoDBRef.php#L44-L56
alcaeus/mongo-php-adapter
lib/Mongo/MongoDBRef.php
MongoDBRef.isRef
public static function isRef($ref) { $check = (array) $ref; return array_key_exists(static::$refKey, $check) && array_key_exists(static::$idKey, $check); }
php
public static function isRef($ref) { $check = (array) $ref; return array_key_exists(static::$refKey, $check) && array_key_exists(static::$idKey, $check); }
[ "public", "static", "function", "isRef", "(", "$", "ref", ")", "{", "$", "check", "=", "(", "array", ")", "$", "ref", ";", "return", "array_key_exists", "(", "static", "::", "$", "refKey", ",", "$", "check", ")", "&&", "array_key_exists", "(", "static"...
This not actually follow the reference, so it does not determine if it is broken or not. It merely checks that $ref is in valid database reference format (in that it is an object or array with $ref and $id fields). @link http://php.net/manual/en/mongodbref.isref.php @static @param mixed $ref Array or object to check @...
[ "This", "not", "actually", "follow", "the", "reference", "so", "it", "does", "not", "determine", "if", "it", "is", "broken", "or", "not", ".", "It", "merely", "checks", "that", "$ref", "is", "in", "valid", "database", "reference", "format", "(", "in", "t...
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoDBRef.php#L67-L72
alcaeus/mongo-php-adapter
lib/Mongo/MongoDBRef.php
MongoDBRef.get
public static function get($db, $ref) { if (! static::isRef($ref)) { return null; } return $db->selectCollection($ref[static::$refKey])->findOne(['_id' => $ref[static::$idKey]]); }
php
public static function get($db, $ref) { if (! static::isRef($ref)) { return null; } return $db->selectCollection($ref[static::$refKey])->findOne(['_id' => $ref[static::$idKey]]); }
[ "public", "static", "function", "get", "(", "$", "db", ",", "$", "ref", ")", "{", "if", "(", "!", "static", "::", "isRef", "(", "$", "ref", ")", ")", "{", "return", "null", ";", "}", "return", "$", "db", "->", "selectCollection", "(", "$", "ref",...
Fetches the object pointed to by a reference @link http://php.net/manual/en/mongodbref.get.php @static @param MongoDB $db Database to use @param array $ref Reference to fetch @return array|null Returns the document to which the reference refers or null if the document does not exist (the reference is broken)
[ "Fetches", "the", "object", "pointed", "to", "by", "a", "reference" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoDBRef.php#L82-L89
alcaeus/mongo-php-adapter
lib/Alcaeus/MongoDbAdapter/AbstractCursor.php
AbstractCursor.next
public function next() { if (! $this->startedIterating) { $this->ensureIterator(); $this->startedIterating = true; } else { if ($this->cursorNeedsAdvancing) { $this->ensureIterator()->next(); } $this->cursorNeedsAdvancing =...
php
public function next() { if (! $this->startedIterating) { $this->ensureIterator(); $this->startedIterating = true; } else { if ($this->cursorNeedsAdvancing) { $this->ensureIterator()->next(); } $this->cursorNeedsAdvancing =...
[ "public", "function", "next", "(", ")", "{", "if", "(", "!", "$", "this", "->", "startedIterating", ")", "{", "$", "this", "->", "ensureIterator", "(", ")", ";", "$", "this", "->", "startedIterating", "=", "true", ";", "}", "else", "{", "if", "(", ...
Advances the cursor to the next result, and returns that result @link http://www.php.net/manual/en/mongocursor.next.php @throws \MongoConnectionException @throws \MongoCursorTimeoutException @return array Returns the next object
[ "Advances", "the", "cursor", "to", "the", "next", "result", "and", "returns", "that", "result" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Alcaeus/MongoDbAdapter/AbstractCursor.php#L161-L176
alcaeus/mongo-php-adapter
lib/Alcaeus/MongoDbAdapter/AbstractCursor.php
AbstractCursor.rewind
public function rewind() { // We can recreate the cursor to allow it to be rewound $this->reset(); $this->startedIterating = true; $this->position = 0; $this->ensureIterator()->rewind(); $this->storeIteratorState(); }
php
public function rewind() { // We can recreate the cursor to allow it to be rewound $this->reset(); $this->startedIterating = true; $this->position = 0; $this->ensureIterator()->rewind(); $this->storeIteratorState(); }
[ "public", "function", "rewind", "(", ")", "{", "// We can recreate the cursor to allow it to be rewound", "$", "this", "->", "reset", "(", ")", ";", "$", "this", "->", "startedIterating", "=", "true", ";", "$", "this", "->", "position", "=", "0", ";", "$", "...
Returns the cursor to the beginning of the result set @throws \MongoConnectionException @throws \MongoCursorTimeoutException @return void
[ "Returns", "the", "cursor", "to", "the", "beginning", "of", "the", "result", "set" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Alcaeus/MongoDbAdapter/AbstractCursor.php#L184-L192
alcaeus/mongo-php-adapter
lib/Alcaeus/MongoDbAdapter/AbstractCursor.php
AbstractCursor.getOptions
protected function getOptions($optionNames = null) { $options = []; if ($optionNames === null) { $optionNames = $this->optionNames; } foreach ($optionNames as $option) { $converter = 'convert' . ucfirst($option); $value = method_exists($this, $co...
php
protected function getOptions($optionNames = null) { $options = []; if ($optionNames === null) { $optionNames = $this->optionNames; } foreach ($optionNames as $option) { $converter = 'convert' . ucfirst($option); $value = method_exists($this, $co...
[ "protected", "function", "getOptions", "(", "$", "optionNames", "=", "null", ")", "{", "$", "options", "=", "[", "]", ";", "if", "(", "$", "optionNames", "===", "null", ")", "{", "$", "optionNames", "=", "$", "this", "->", "optionNames", ";", "}", "f...
Applies all options set on the cursor, overwriting any options that have already been set @param array $optionNames Array of option names to be applied (will be read from properties) @return array
[ "Applies", "all", "options", "set", "on", "the", "cursor", "overwriting", "any", "options", "that", "have", "already", "been", "set" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Alcaeus/MongoDbAdapter/AbstractCursor.php#L267-L287
alcaeus/mongo-php-adapter
lib/Alcaeus/MongoDbAdapter/AbstractCursor.php
AbstractCursor.reset
protected function reset() { $this->startedIterating = false; $this->cursorNeedsAdvancing = true; $this->cursor = null; $this->iterator = null; $this->storeIteratorState(); }
php
protected function reset() { $this->startedIterating = false; $this->cursorNeedsAdvancing = true; $this->cursor = null; $this->iterator = null; $this->storeIteratorState(); }
[ "protected", "function", "reset", "(", ")", "{", "$", "this", "->", "startedIterating", "=", "false", ";", "$", "this", "->", "cursorNeedsAdvancing", "=", "true", ";", "$", "this", "->", "cursor", "=", "null", ";", "$", "this", "->", "iterator", "=", "...
Clears the cursor This is generic but implemented as protected since it's only exposed in MongoCursor
[ "Clears", "the", "cursor" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Alcaeus/MongoDbAdapter/AbstractCursor.php#L381-L388
alcaeus/mongo-php-adapter
lib/Alcaeus/MongoDbAdapter/AbstractCursor.php
AbstractCursor.storeIteratorState
protected function storeIteratorState() { if (! $this->startedIterating) { $this->current = null; $this->key = null; $this->valid = false; return null; } $this->current = $this->ensureIterator()->current(); $this->key = $this->ensureIt...
php
protected function storeIteratorState() { if (! $this->startedIterating) { $this->current = null; $this->key = null; $this->valid = false; return null; } $this->current = $this->ensureIterator()->current(); $this->key = $this->ensureIt...
[ "protected", "function", "storeIteratorState", "(", ")", "{", "if", "(", "!", "$", "this", "->", "startedIterating", ")", "{", "$", "this", "->", "current", "=", "null", ";", "$", "this", "->", "key", "=", "null", ";", "$", "this", "->", "valid", "="...
Stores the current cursor element. This is necessary because hasNext() might advance the iterator but we still need to be able to return the current object.
[ "Stores", "the", "current", "cursor", "element", "." ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Alcaeus/MongoDbAdapter/AbstractCursor.php#L404-L422
alcaeus/mongo-php-adapter
lib/Mongo/MongoId.php
MongoId.isValid
public static function isValid($value) { if ($value instanceof ObjectID || $value instanceof MongoId) { return true; } elseif (! is_string($value)) { return false; } return (bool) preg_match('#^[a-f0-9]{24}$#i', $value); }
php
public static function isValid($value) { if ($value instanceof ObjectID || $value instanceof MongoId) { return true; } elseif (! is_string($value)) { return false; } return (bool) preg_match('#^[a-f0-9]{24}$#i', $value); }
[ "public", "static", "function", "isValid", "(", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "ObjectID", "||", "$", "value", "instanceof", "MongoId", ")", "{", "return", "true", ";", "}", "elseif", "(", "!", "is_string", "(", "$", "va...
Check if a value is a valid ObjectId @link http://php.net/manual/en/mongoid.isvalid.php @param mixed $value The value to check for validity. @return bool
[ "Check", "if", "a", "value", "is", "a", "valid", "ObjectId" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoId.php#L51-L60
alcaeus/mongo-php-adapter
lib/Mongo/MongoId.php
MongoId.getPID
public function getPID() { $id = (string) $this->objectID; // PID is stored as little-endian, flip it around $pid = substr($id, 16, 2) . substr($id, 14, 2); return hexdec($pid); }
php
public function getPID() { $id = (string) $this->objectID; // PID is stored as little-endian, flip it around $pid = substr($id, 16, 2) . substr($id, 14, 2); return hexdec($pid); }
[ "public", "function", "getPID", "(", ")", "{", "$", "id", "=", "(", "string", ")", "$", "this", "->", "objectID", ";", "// PID is stored as little-endian, flip it around", "$", "pid", "=", "substr", "(", "$", "id", ",", "16", ",", "2", ")", ".", "substr"...
(PECL mongo &gt;= 1.0.11) Gets the process ID @link http://php.net/manual/en/mongoid.getpid.php @return int Returns the PID of the MongoId.
[ "(", "PECL", "mongo", "&gt", ";", "=", "1", ".", "0", ".", "11", ")", "Gets", "the", "process", "ID" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoId.php#L161-L168
noahbuscher/macaw
Macaw.php
Macaw.__callstatic
public static function __callstatic($method, $params) { if ($method == 'map') { $maps = array_map('strtoupper', $params[0]); $uri = strpos($params[1], '/') === 0 ? $params[1] : '/' . $params[1]; $callback = $params[2]; } else { $maps = null; $uri = strpos($params[0], '/'...
php
public static function __callstatic($method, $params) { if ($method == 'map') { $maps = array_map('strtoupper', $params[0]); $uri = strpos($params[1], '/') === 0 ? $params[1] : '/' . $params[1]; $callback = $params[2]; } else { $maps = null; $uri = strpos($params[0], '/'...
[ "public", "static", "function", "__callstatic", "(", "$", "method", ",", "$", "params", ")", "{", "if", "(", "$", "method", "==", "'map'", ")", "{", "$", "maps", "=", "array_map", "(", "'strtoupper'", ",", "$", "params", "[", "0", "]", ")", ";", "$...
Defines a route w/ callback and method
[ "Defines", "a", "route", "w", "/", "callback", "and", "method" ]
train
https://github.com/noahbuscher/macaw/blob/ade32370a3d09f1fa498de254411d1b6b7be1877/Macaw.php#L29-L45
laravel/envoy
src/RemoteProcessor.php
RemoteProcessor.getProcess
protected function getProcess($host, Task $task) { $target = $this->getConfiguredServer($host) ?: $host; $env = $this->getEnvironment($host); if (in_array($target, ['local', 'localhost', '127.0.0.1'])) { $process = new Process($task->script, null, $env); } // H...
php
protected function getProcess($host, Task $task) { $target = $this->getConfiguredServer($host) ?: $host; $env = $this->getEnvironment($host); if (in_array($target, ['local', 'localhost', '127.0.0.1'])) { $process = new Process($task->script, null, $env); } // H...
[ "protected", "function", "getProcess", "(", "$", "host", ",", "Task", "$", "task", ")", "{", "$", "target", "=", "$", "this", "->", "getConfiguredServer", "(", "$", "host", ")", "?", ":", "$", "host", ";", "$", "env", "=", "$", "this", "->", "getEn...
Run the given script on the given host. @param string $host @param \Laravel\Envoy\Task $task @return array
[ "Run", "the", "given", "script", "on", "the", "given", "host", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/RemoteProcessor.php#L26-L68
laravel/envoy
src/RemoteProcessor.php
RemoteProcessor.gatherExitCodes
protected function gatherExitCodes(array $processes) { $code = 0; foreach ($processes as $process) { $code = $code + $process->getExitCode(); } return $code; }
php
protected function gatherExitCodes(array $processes) { $code = 0; foreach ($processes as $process) { $code = $code + $process->getExitCode(); } return $code; }
[ "protected", "function", "gatherExitCodes", "(", "array", "$", "processes", ")", "{", "$", "code", "=", "0", ";", "foreach", "(", "$", "processes", "as", "$", "process", ")", "{", "$", "code", "=", "$", "code", "+", "$", "process", "->", "getExitCode",...
Gather the cumulative exit code for the processes. @param array $processes @return int
[ "Gather", "the", "cumulative", "exit", "code", "for", "the", "processes", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/RemoteProcessor.php#L89-L98
laravel/envoy
src/Console/SshCommand.php
SshCommand.fire
protected function fire() { $host = $this->getServer($container = $this->loadTaskContainer()); passthru('ssh '.($this->getConfiguredServer($host) ?: $host)); }
php
protected function fire() { $host = $this->getServer($container = $this->loadTaskContainer()); passthru('ssh '.($this->getConfiguredServer($host) ?: $host)); }
[ "protected", "function", "fire", "(", ")", "{", "$", "host", "=", "$", "this", "->", "getServer", "(", "$", "container", "=", "$", "this", "->", "loadTaskContainer", "(", ")", ")", ";", "passthru", "(", "'ssh '", ".", "(", "$", "this", "->", "getConf...
Execute the command. @return void
[ "Execute", "the", "command", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/SshCommand.php#L34-L39
laravel/envoy
src/Console/SshCommand.php
SshCommand.getServer
protected function getServer(TaskContainer $container) { if ($this->argument('name')) { return $container->getServer($this->argument('name')); } elseif ($container->hasOneServer()) { return $container->getFirstServer(); } else { throw new \InvalidArgumentE...
php
protected function getServer(TaskContainer $container) { if ($this->argument('name')) { return $container->getServer($this->argument('name')); } elseif ($container->hasOneServer()) { return $container->getFirstServer(); } else { throw new \InvalidArgumentE...
[ "protected", "function", "getServer", "(", "TaskContainer", "$", "container", ")", "{", "if", "(", "$", "this", "->", "argument", "(", "'name'", ")", ")", "{", "return", "$", "container", "->", "getServer", "(", "$", "this", "->", "argument", "(", "'name...
Get the server from the task container. @param \Laravel\Envoy\TaskContainer $container @throws \InvalidArgumentException @return string
[ "Get", "the", "server", "from", "the", "task", "container", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/SshCommand.php#L48-L57
laravel/envoy
src/ParallelSSH.php
ParallelSSH.run
public function run(Task $task, Closure $callback = null) { $processes = []; $callback = $callback ?: function () { }; // Here we will gather all the process instances by host. We will build them in // an array so we can easily loop through them then start them up. We'll ke...
php
public function run(Task $task, Closure $callback = null) { $processes = []; $callback = $callback ?: function () { }; // Here we will gather all the process instances by host. We will build them in // an array so we can easily loop through them then start them up. We'll ke...
[ "public", "function", "run", "(", "Task", "$", "task", ",", "Closure", "$", "callback", "=", "null", ")", "{", "$", "processes", "=", "[", "]", ";", "$", "callback", "=", "$", "callback", "?", ":", "function", "(", ")", "{", "}", ";", "// Here we w...
Run the given task over SSH. @param \Laravel\Envoy\Task $task @param \Closure|null $callback @return int
[ "Run", "the", "given", "task", "over", "SSH", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/ParallelSSH.php#L19-L50
laravel/envoy
src/ParallelSSH.php
ParallelSSH.gatherOutput
protected function gatherOutput(array $processes, Closure $callback) { foreach ($processes as $host => $process) { $methods = [ Process::OUT => 'getIncrementalOutput', Process::ERR => 'getIncrementalErrorOutput', ]; foreach ($methods as $t...
php
protected function gatherOutput(array $processes, Closure $callback) { foreach ($processes as $host => $process) { $methods = [ Process::OUT => 'getIncrementalOutput', Process::ERR => 'getIncrementalErrorOutput', ]; foreach ($methods as $t...
[ "protected", "function", "gatherOutput", "(", "array", "$", "processes", ",", "Closure", "$", "callback", ")", "{", "foreach", "(", "$", "processes", "as", "$", "host", "=>", "$", "process", ")", "{", "$", "methods", "=", "[", "Process", "::", "OUT", "...
Gather the output from all of the processes. @param array $processes @param \Closure $callback @return void
[ "Gather", "the", "output", "from", "all", "of", "the", "processes", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/ParallelSSH.php#L89-L105
laravel/envoy
src/Console/InitCommand.php
InitCommand.fire
protected function fire() { if (file_exists(getcwd().'/Envoy.blade.php')) { $this->output->writeln('<error>Envoy file already exists!</error>'); return; } file_put_contents(getcwd().'/Envoy.blade.php', "@servers(['web' => '".$this->input->getArgument('host')."']) @...
php
protected function fire() { if (file_exists(getcwd().'/Envoy.blade.php')) { $this->output->writeln('<error>Envoy file already exists!</error>'); return; } file_put_contents(getcwd().'/Envoy.blade.php', "@servers(['web' => '".$this->input->getArgument('host')."']) @...
[ "protected", "function", "fire", "(", ")", "{", "if", "(", "file_exists", "(", "getcwd", "(", ")", ".", "'/Envoy.blade.php'", ")", ")", "{", "$", "this", "->", "output", "->", "writeln", "(", "'<error>Envoy file already exists!</error>'", ")", ";", "return", ...
Execute the command. @return void
[ "Execute", "the", "command", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/InitCommand.php#L30-L47
laravel/envoy
src/SSHConfigFile.php
SSHConfigFile.parseString
public static function parseString($string) { $groups = []; $index = 0; $matchSection = false; foreach (explode(PHP_EOL, $string) as $line) { $line = trim($line); if ('' == $line || starts_with($line, '#')) { continue; } ...
php
public static function parseString($string) { $groups = []; $index = 0; $matchSection = false; foreach (explode(PHP_EOL, $string) as $line) { $line = trim($line); if ('' == $line || starts_with($line, '#')) { continue; } ...
[ "public", "static", "function", "parseString", "(", "$", "string", ")", "{", "$", "groups", "=", "[", "]", ";", "$", "index", "=", "0", ";", "$", "matchSection", "=", "false", ";", "foreach", "(", "explode", "(", "PHP_EOL", ",", "$", "string", ")", ...
Parse the given configuration string. @param string $string @return \Laravel\Envoy\SSHConfigFile
[ "Parse", "the", "given", "configuration", "string", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/SSHConfigFile.php#L44-L96
laravel/envoy
src/SSHConfigFile.php
SSHConfigFile.findConfiguredHost
public function findConfiguredHost($host) { list($user, $host) = $this->parseHost($host); foreach ($this->groups as $group) { if ((isset($group['host']) && $group['host'] == $host) || (isset($group['hostname']) && $group['hostname'] == $host)) { if (! emp...
php
public function findConfiguredHost($host) { list($user, $host) = $this->parseHost($host); foreach ($this->groups as $group) { if ((isset($group['host']) && $group['host'] == $host) || (isset($group['hostname']) && $group['hostname'] == $host)) { if (! emp...
[ "public", "function", "findConfiguredHost", "(", "$", "host", ")", "{", "list", "(", "$", "user", ",", "$", "host", ")", "=", "$", "this", "->", "parseHost", "(", "$", "host", ")", ";", "foreach", "(", "$", "this", "->", "groups", "as", "$", "group...
Get the configured SSH host by name or IP. @param string $host @return string|null
[ "Get", "the", "configured", "SSH", "host", "by", "name", "or", "IP", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/SSHConfigFile.php#L104-L126
laravel/envoy
src/Console/TasksCommand.php
TasksCommand.fire
protected function fire() { $container = $this->loadTaskContainer(); $this->listTasks($container); $this->output->writeln(''); $this->listMacros($container); }
php
protected function fire() { $container = $this->loadTaskContainer(); $this->listTasks($container); $this->output->writeln(''); $this->listMacros($container); }
[ "protected", "function", "fire", "(", ")", "{", "$", "container", "=", "$", "this", "->", "loadTaskContainer", "(", ")", ";", "$", "this", "->", "listTasks", "(", "$", "container", ")", ";", "$", "this", "->", "output", "->", "writeln", "(", "''", ")...
Execute the command. @return void
[ "Execute", "the", "command", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/TasksCommand.php#L28-L37
laravel/envoy
src/Console/TasksCommand.php
TasksCommand.listTasks
protected function listTasks($container) { $this->output->writeln('<comment>Available tasks:</comment>'); foreach (array_keys($container->getTasks()) as $task) { $this->output->writeln(" <info>{$task}</info>"); } }
php
protected function listTasks($container) { $this->output->writeln('<comment>Available tasks:</comment>'); foreach (array_keys($container->getTasks()) as $task) { $this->output->writeln(" <info>{$task}</info>"); } }
[ "protected", "function", "listTasks", "(", "$", "container", ")", "{", "$", "this", "->", "output", "->", "writeln", "(", "'<comment>Available tasks:</comment>'", ")", ";", "foreach", "(", "array_keys", "(", "$", "container", "->", "getTasks", "(", ")", ")", ...
List the tasks from the container. @param \Laravel\Envoy\TaskContainer $container @return void
[ "List", "the", "tasks", "from", "the", "container", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/TasksCommand.php#L45-L52
laravel/envoy
src/Console/TasksCommand.php
TasksCommand.listMacros
protected function listMacros($container) { $this->output->writeln('<comment>Available stories:</comment>'); foreach (array_keys($container->getMacros()) as $macro) { $this->output->writeln(" <info>{$macro}</info>"); } }
php
protected function listMacros($container) { $this->output->writeln('<comment>Available stories:</comment>'); foreach (array_keys($container->getMacros()) as $macro) { $this->output->writeln(" <info>{$macro}</info>"); } }
[ "protected", "function", "listMacros", "(", "$", "container", ")", "{", "$", "this", "->", "output", "->", "writeln", "(", "'<comment>Available stories:</comment>'", ")", ";", "foreach", "(", "array_keys", "(", "$", "container", "->", "getMacros", "(", ")", ")...
List the macros from the container. @param \Laravel\Envoy\TaskContainer $container @return void
[ "List", "the", "macros", "from", "the", "container", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/TasksCommand.php#L60-L67
laravel/envoy
src/Console/TasksCommand.php
TasksCommand.loadTaskContainer
protected function loadTaskContainer() { if (! file_exists($envoyFile = getcwd().'/Envoy.blade.php')) { echo "Envoy.blade.php not found.\n"; exit(1); } with($container = new TaskContainer)->load($envoyFile, new Compiler); return $container; }
php
protected function loadTaskContainer() { if (! file_exists($envoyFile = getcwd().'/Envoy.blade.php')) { echo "Envoy.blade.php not found.\n"; exit(1); } with($container = new TaskContainer)->load($envoyFile, new Compiler); return $container; }
[ "protected", "function", "loadTaskContainer", "(", ")", "{", "if", "(", "!", "file_exists", "(", "$", "envoyFile", "=", "getcwd", "(", ")", ".", "'/Envoy.blade.php'", ")", ")", "{", "echo", "\"Envoy.blade.php not found.\\n\"", ";", "exit", "(", "1", ")", ";"...
Load the task container instance with the Envoy file. @return \Laravel\Envoy\TaskContainer
[ "Load", "the", "task", "container", "instance", "with", "the", "Envoy", "file", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/TasksCommand.php#L74-L85
laravel/envoy
src/SSH.php
SSH.run
public function run(Task $task, Closure $callback = null) { $processes = []; $callback = $callback ?: function () { }; // Here we will gather all the process instances by host. We will build them in // an array so we can easily loop through them then start them up. We'll ke...
php
public function run(Task $task, Closure $callback = null) { $processes = []; $callback = $callback ?: function () { }; // Here we will gather all the process instances by host. We will build them in // an array so we can easily loop through them then start them up. We'll ke...
[ "public", "function", "run", "(", "Task", "$", "task", ",", "Closure", "$", "callback", "=", "null", ")", "{", "$", "processes", "=", "[", "]", ";", "$", "callback", "=", "$", "callback", "?", ":", "function", "(", ")", "{", "}", ";", "// Here we w...
Run the given task over SSH. @param \Laravel\Envoy\Task $task @param \Closure|null $callback @return int
[ "Run", "the", "given", "task", "over", "SSH", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/SSH.php#L18-L44
laravel/envoy
src/Compiler.php
Compiler.compile
public function compile($value, $serversOnly = false) { $compilers = $serversOnly ? $this->serverCompilers : $this->compilers; $value = $this->initializeVariables($value); foreach ($compilers as $compiler) { $value = $this->{"compile{$compiler}"}($value); } ret...
php
public function compile($value, $serversOnly = false) { $compilers = $serversOnly ? $this->serverCompilers : $this->compilers; $value = $this->initializeVariables($value); foreach ($compilers as $compiler) { $value = $this->{"compile{$compiler}"}($value); } ret...
[ "public", "function", "compile", "(", "$", "value", ",", "$", "serversOnly", "=", "false", ")", "{", "$", "compilers", "=", "$", "serversOnly", "?", "$", "this", "->", "serverCompilers", ":", "$", "this", "->", "compilers", ";", "$", "value", "=", "$",...
Compile the given Envoy template contents. @param string $value @param bool $serversOnly @return string
[ "Compile", "the", "given", "Envoy", "template", "contents", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Compiler.php#L63-L74
laravel/envoy
src/Compiler.php
Compiler.compileMacroStart
protected function compileMacroStart($value) { $pattern = $this->createMatcher('macro'); $value = preg_replace($pattern, '$1<?php $__container->startMacro$2; ?>', $value); $pattern = $this->createMatcher('story'); return preg_replace($pattern, '$1<?php $__container->startMacro$2; ...
php
protected function compileMacroStart($value) { $pattern = $this->createMatcher('macro'); $value = preg_replace($pattern, '$1<?php $__container->startMacro$2; ?>', $value); $pattern = $this->createMatcher('story'); return preg_replace($pattern, '$1<?php $__container->startMacro$2; ...
[ "protected", "function", "compileMacroStart", "(", "$", "value", ")", "{", "$", "pattern", "=", "$", "this", "->", "createMatcher", "(", "'macro'", ")", ";", "$", "value", "=", "preg_replace", "(", "$", "pattern", ",", "'$1<?php $__container->startMacro$2; ?>'",...
Compile Envoy macro start statements into valid PHP. @param string $value @return string
[ "Compile", "Envoy", "macro", "start", "statements", "into", "valid", "PHP", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Compiler.php#L279-L288
laravel/envoy
src/Compiler.php
Compiler.compileMacroStop
protected function compileMacroStop($value) { $pattern = $this->createPlainMatcher('endmacro'); $value = preg_replace($pattern, '$1<?php $__container->endMacro(); ?>$2', $value); $pattern = $this->createPlainMatcher('endstory'); return preg_replace($pattern, '$1<?php $__container-...
php
protected function compileMacroStop($value) { $pattern = $this->createPlainMatcher('endmacro'); $value = preg_replace($pattern, '$1<?php $__container->endMacro(); ?>$2', $value); $pattern = $this->createPlainMatcher('endstory'); return preg_replace($pattern, '$1<?php $__container-...
[ "protected", "function", "compileMacroStop", "(", "$", "value", ")", "{", "$", "pattern", "=", "$", "this", "->", "createPlainMatcher", "(", "'endmacro'", ")", ";", "$", "value", "=", "preg_replace", "(", "$", "pattern", ",", "'$1<?php $__container->endMacro(); ...
Compile Envoy macro stop statements into valid PHP. @param string $value @return string
[ "Compile", "Envoy", "macro", "stop", "statements", "into", "valid", "PHP", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Compiler.php#L296-L305
laravel/envoy
src/Compiler.php
Compiler.initializeVariables
private function initializeVariables($value) { preg_match_all('/\$([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)/', $value, $matches); foreach (array_unique($matches[0]) as $variable) { $value = "<?php $variable = isset($variable) ? $variable : null; ?>\n".$value; } return ...
php
private function initializeVariables($value) { preg_match_all('/\$([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)/', $value, $matches); foreach (array_unique($matches[0]) as $variable) { $value = "<?php $variable = isset($variable) ? $variable : null; ?>\n".$value; } return ...
[ "private", "function", "initializeVariables", "(", "$", "value", ")", "{", "preg_match_all", "(", "'/\\$([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)/'", ",", "$", "value", ",", "$", "matches", ")", ";", "foreach", "(", "array_unique", "(", "$", "matches", "[", "...
Initialize the variables included in the Envoy template. @param string $value @return string
[ "Initialize", "the", "variables", "included", "in", "the", "Envoy", "template", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Compiler.php#L437-L446
laravel/envoy
src/TaskContainer.php
TaskContainer.load
public function load($__path, Compiler $__compiler, array $__data = [], $__serversOnly = false) { $__dir = realpath(dirname($__path)); // First we will compiled the "Blade" Envoy file into plain PHP that we'll include // into the current scope so it can register tasks in this task container...
php
public function load($__path, Compiler $__compiler, array $__data = [], $__serversOnly = false) { $__dir = realpath(dirname($__path)); // First we will compiled the "Blade" Envoy file into plain PHP that we'll include // into the current scope so it can register tasks in this task container...
[ "public", "function", "load", "(", "$", "__path", ",", "Compiler", "$", "__compiler", ",", "array", "$", "__data", "=", "[", "]", ",", "$", "__serversOnly", "=", "false", ")", "{", "$", "__dir", "=", "realpath", "(", "dirname", "(", "$", "__path", ")...
Load the Envoy file into the container. @param string $__path @param \Laravel\Envoy\Compiler $__compiler @param array $__data @param bool $__serversOnly @return void
[ "Load", "the", "Envoy", "file", "into", "the", "container", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/TaskContainer.php#L111-L136
laravel/envoy
src/TaskContainer.php
TaskContainer.writeCompiledEnvoyFile
protected function writeCompiledEnvoyFile($compiler, $path, $serversOnly) { file_put_contents( $envoyPath = getcwd().'/Envoy'.md5_file($path).'.php', $compiler->compile(file_get_contents($path), $serversOnly) ); return $envoyPath; }
php
protected function writeCompiledEnvoyFile($compiler, $path, $serversOnly) { file_put_contents( $envoyPath = getcwd().'/Envoy'.md5_file($path).'.php', $compiler->compile(file_get_contents($path), $serversOnly) ); return $envoyPath; }
[ "protected", "function", "writeCompiledEnvoyFile", "(", "$", "compiler", ",", "$", "path", ",", "$", "serversOnly", ")", "{", "file_put_contents", "(", "$", "envoyPath", "=", "getcwd", "(", ")", ".", "'/Envoy'", ".", "md5_file", "(", "$", "path", ")", ".",...
Write the compiled Envoy file to disk. @param \Laravel\Envoy\Compiler $compiler @param string $path @param bool $serversOnly @return string
[ "Write", "the", "compiled", "Envoy", "file", "to", "disk", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/TaskContainer.php#L146-L154
laravel/envoy
src/TaskContainer.php
TaskContainer.replaceSubTasks
protected function replaceSubTasks() { foreach ($this->tasks as $name => &$script) { $callback = function ($m) { return $m[1].$this->tasks[$m[2]]; }; $script = $this->trimSpaces( preg_replace_callback("/(\s*)@run\('(.*)'\)/", $callback, $s...
php
protected function replaceSubTasks() { foreach ($this->tasks as $name => &$script) { $callback = function ($m) { return $m[1].$this->tasks[$m[2]]; }; $script = $this->trimSpaces( preg_replace_callback("/(\s*)@run\('(.*)'\)/", $callback, $s...
[ "protected", "function", "replaceSubTasks", "(", ")", "{", "foreach", "(", "$", "this", "->", "tasks", "as", "$", "name", "=>", "&", "$", "script", ")", "{", "$", "callback", "=", "function", "(", "$", "m", ")", "{", "return", "$", "m", "[", "1", ...
Replace all of the sub tasks and trim leading spaces. @return void
[ "Replace", "all", "of", "the", "sub", "tasks", "and", "trim", "leading", "spaces", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/TaskContainer.php#L161-L172
laravel/envoy
src/TaskContainer.php
TaskContainer.getServer
public function getServer($server) { if (! array_key_exists($server, $this->servers)) { throw new \Exception('Server ['.$server.'] is not defined.'); } return Arr::get($this->servers, $server); }
php
public function getServer($server) { if (! array_key_exists($server, $this->servers)) { throw new \Exception('Server ['.$server.'] is not defined.'); } return Arr::get($this->servers, $server); }
[ "public", "function", "getServer", "(", "$", "server", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "server", ",", "$", "this", "->", "servers", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'Server ['", ".", "$", "server", ".", ...
Get the IP address for a server. @param string $server @throws \Exception @return string|null
[ "Get", "the", "IP", "address", "for", "a", "server", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/TaskContainer.php#L192-L199
laravel/envoy
src/TaskContainer.php
TaskContainer.import
public function import($file, array $data = []) { $data = Arr::except($data, [ '__path', '__dir', '__compiler', '__data', '__serversOnly', '__envoyPath', '__container', 'this', ]); if (($path = $this->resolveImportPath($file)) === false) { throw new Inval...
php
public function import($file, array $data = []) { $data = Arr::except($data, [ '__path', '__dir', '__compiler', '__data', '__serversOnly', '__envoyPath', '__container', 'this', ]); if (($path = $this->resolveImportPath($file)) === false) { throw new Inval...
[ "public", "function", "import", "(", "$", "file", ",", "array", "$", "data", "=", "[", "]", ")", "{", "$", "data", "=", "Arr", "::", "except", "(", "$", "data", ",", "[", "'__path'", ",", "'__dir'", ",", "'__compiler'", ",", "'__data'", ",", "'__se...
Import the given file into the container. @param string $file @param array $data @return void
[ "Import", "the", "given", "file", "into", "the", "container", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/TaskContainer.php#L228-L240
laravel/envoy
src/TaskContainer.php
TaskContainer.resolveImportPath
protected function resolveImportPath($file) { if (($path = realpath($file)) !== false) { return $path; } elseif (($path = realpath($file.'.blade.php')) !== false) { return $path; } elseif (($path = realpath(getcwd().'/vendor/'.$file.'/Envoy.blade.php')) !== false) { ...
php
protected function resolveImportPath($file) { if (($path = realpath($file)) !== false) { return $path; } elseif (($path = realpath($file.'.blade.php')) !== false) { return $path; } elseif (($path = realpath(getcwd().'/vendor/'.$file.'/Envoy.blade.php')) !== false) { ...
[ "protected", "function", "resolveImportPath", "(", "$", "file", ")", "{", "if", "(", "(", "$", "path", "=", "realpath", "(", "$", "file", ")", ")", "!==", "false", ")", "{", "return", "$", "path", ";", "}", "elseif", "(", "(", "$", "path", "=", "...
Resolve the import path for the given file. @param string $file @return string|bool
[ "Resolve", "the", "import", "path", "for", "the", "given", "file", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/TaskContainer.php#L248-L261
laravel/envoy
src/TaskContainer.php
TaskContainer.getTask
public function getTask($task, array $macroOptions = []) { $script = Arr::get($this->tasks, $task, ''); if ($script == '') { throw new \Exception(sprintf('Task "%s" is not defined.', $task)); } $options = array_merge($this->getTaskOptions($task), $macroOptions); ...
php
public function getTask($task, array $macroOptions = []) { $script = Arr::get($this->tasks, $task, ''); if ($script == '') { throw new \Exception(sprintf('Task "%s" is not defined.', $task)); } $options = array_merge($this->getTaskOptions($task), $macroOptions); ...
[ "public", "function", "getTask", "(", "$", "task", ",", "array", "$", "macroOptions", "=", "[", "]", ")", "{", "$", "script", "=", "Arr", "::", "get", "(", "$", "this", "->", "tasks", ",", "$", "task", ",", "''", ")", ";", "if", "(", "$", "scri...
Get a Task instance by the given name. @param string $task @param array $macroOptions @throws \Exception @return \Laravel\Envoy\Task
[ "Get", "a", "Task", "instance", "by", "the", "given", "name", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/TaskContainer.php#L325-L340
laravel/envoy
src/TaskContainer.php
TaskContainer.getServers
protected function getServers(array $options) { if (! array_key_exists('on', $options)) { $options['on'] = []; } return Arr::flatten(array_map(function ($name) { return $this->getServer($name); }, (array) $options['on'])); }
php
protected function getServers(array $options) { if (! array_key_exists('on', $options)) { $options['on'] = []; } return Arr::flatten(array_map(function ($name) { return $this->getServer($name); }, (array) $options['on'])); }
[ "protected", "function", "getServers", "(", "array", "$", "options", ")", "{", "if", "(", "!", "array_key_exists", "(", "'on'", ",", "$", "options", ")", ")", "{", "$", "options", "[", "'on'", "]", "=", "[", "]", ";", "}", "return", "Arr", "::", "f...
Get the IP addresses of the servers specified on the options. @param array $options @return array
[ "Get", "the", "IP", "addresses", "of", "the", "servers", "specified", "on", "the", "options", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/TaskContainer.php#L359-L368
laravel/envoy
src/TaskContainer.php
TaskContainer.startMacro
public function startMacro($macro, array $options = []) { ob_start() && $this->macroStack[] = $macro; $this->macroOptions[$macro] = $options; }
php
public function startMacro($macro, array $options = []) { ob_start() && $this->macroStack[] = $macro; $this->macroOptions[$macro] = $options; }
[ "public", "function", "startMacro", "(", "$", "macro", ",", "array", "$", "options", "=", "[", "]", ")", "{", "ob_start", "(", ")", "&&", "$", "this", "->", "macroStack", "[", "]", "=", "$", "macro", ";", "$", "this", "->", "macroOptions", "[", "$"...
Begin defining a macro. @param string $macro @param array $options @return void
[ "Begin", "defining", "a", "macro", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/TaskContainer.php#L377-L382
laravel/envoy
src/TaskContainer.php
TaskContainer.endMacro
public function endMacro() { $macro = explode(PHP_EOL, $this->trimSpaces(trim(ob_get_clean()))); $this->macros[array_pop($this->macroStack)] = $macro; }
php
public function endMacro() { $macro = explode(PHP_EOL, $this->trimSpaces(trim(ob_get_clean()))); $this->macros[array_pop($this->macroStack)] = $macro; }
[ "public", "function", "endMacro", "(", ")", "{", "$", "macro", "=", "explode", "(", "PHP_EOL", ",", "$", "this", "->", "trimSpaces", "(", "trim", "(", "ob_get_clean", "(", ")", ")", ")", ")", ";", "$", "this", "->", "macros", "[", "array_pop", "(", ...
Stop defining a macro. @return void
[ "Stop", "defining", "a", "macro", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/TaskContainer.php#L389-L394
laravel/envoy
src/TaskContainer.php
TaskContainer.startTask
public function startTask($task, array $options = []) { ob_start() && $this->taskStack[] = $task; $this->taskOptions[$task] = $this->mergeDefaultOptions($options); }
php
public function startTask($task, array $options = []) { ob_start() && $this->taskStack[] = $task; $this->taskOptions[$task] = $this->mergeDefaultOptions($options); }
[ "public", "function", "startTask", "(", "$", "task", ",", "array", "$", "options", "=", "[", "]", ")", "{", "ob_start", "(", ")", "&&", "$", "this", "->", "taskStack", "[", "]", "=", "$", "task", ";", "$", "this", "->", "taskOptions", "[", "$", "...
Begin defining a task. @param string $task @param array $options @return void
[ "Begin", "defining", "a", "task", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/TaskContainer.php#L403-L408
laravel/envoy
src/TaskContainer.php
TaskContainer.endTask
public function endTask() { $name = array_pop($this->taskStack); $contents = trim(ob_get_clean()); if (isset($this->tasks[$name])) { $this->tasks[$name] = str_replace('@parent', $this->tasks[$name], $contents); } else { $this->tasks[$name] = $contents; ...
php
public function endTask() { $name = array_pop($this->taskStack); $contents = trim(ob_get_clean()); if (isset($this->tasks[$name])) { $this->tasks[$name] = str_replace('@parent', $this->tasks[$name], $contents); } else { $this->tasks[$name] = $contents; ...
[ "public", "function", "endTask", "(", ")", "{", "$", "name", "=", "array_pop", "(", "$", "this", "->", "taskStack", ")", ";", "$", "contents", "=", "trim", "(", "ob_get_clean", "(", ")", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "tasks"...
Stop defining a task. @return void
[ "Stop", "defining", "a", "task", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/TaskContainer.php#L426-L437
laravel/envoy
src/Console/Command.php
Command.confirmTaskWithUser
public function confirmTaskWithUser($task, $question) { $question = $question === true ? 'Are you sure you want to run the ['.$task.'] task?' : (string) $question; $question = '<comment>'.$question.' [y/N]:</comment> '; $question = new ConfirmationQuestion($question, false); retur...
php
public function confirmTaskWithUser($task, $question) { $question = $question === true ? 'Are you sure you want to run the ['.$task.'] task?' : (string) $question; $question = '<comment>'.$question.' [y/N]:</comment> '; $question = new ConfirmationQuestion($question, false); retur...
[ "public", "function", "confirmTaskWithUser", "(", "$", "task", ",", "$", "question", ")", "{", "$", "question", "=", "$", "question", "===", "true", "?", "'Are you sure you want to run the ['", ".", "$", "task", ".", "'] task?'", ":", "(", "string", ")", "$"...
Confirm the operation with the user. @param string $task @param string $question @return bool
[ "Confirm", "the", "operation", "with", "the", "user", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/Command.php#L71-L80
laravel/envoy
src/Console/Command.php
Command.secret
public function secret($question) { $question = '<comment>'.$question.'</comment> '; $question = new Question($question); $question->setHidden(true); $question->setHiddenFallback(false); return $this->getHelperSet()->get('question')->ask($this->input, $this->output, $questi...
php
public function secret($question) { $question = '<comment>'.$question.'</comment> '; $question = new Question($question); $question->setHidden(true); $question->setHiddenFallback(false); return $this->getHelperSet()->get('question')->ask($this->input, $this->output, $questi...
[ "public", "function", "secret", "(", "$", "question", ")", "{", "$", "question", "=", "'<comment>'", ".", "$", "question", ".", "'</comment> '", ";", "$", "question", "=", "new", "Question", "(", "$", "question", ")", ";", "$", "question", "->", "setHidd...
Ask the user the given secret question. @param string $question @return string
[ "Ask", "the", "user", "the", "given", "secret", "question", "." ]
train
https://github.com/laravel/envoy/blob/dcded7c66be7a30c4f9e40e7b071c3c7449a9c99/src/Console/Command.php#L88-L97