Skip to content

Commit

Permalink
fix: imrprove php-doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
divine committed Feb 9, 2022
1 parent 42c1ff2 commit 40846ab
Show file tree
Hide file tree
Showing 30 changed files with 168 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Auth/PasswordResetServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class PasswordResetServiceProvider extends BasePasswordResetServiceProvider
{
/**
* Register the token repository implementation.
*
* @return void
*/
protected function registerTokenRepository()
Expand Down
5 changes: 4 additions & 1 deletion src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ class Collection
{
/**
* The connection instance.
*
* @var Connection
*/
protected $connection;

/**
* The MongoCollection instance..
* The MongoCollection instance.
*
* @var MongoCollection
*/
protected $collection;
Expand All @@ -32,6 +34,7 @@ public function __construct(Connection $connection, MongoCollection $collection)

/**
* Handle dynamic method calls.
*
* @param string $method
* @param array $parameters
* @return mixed
Expand Down
16 changes: 16 additions & 0 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,21 @@ class Connection extends BaseConnection
{
/**
* The MongoDB database handler.
*
* @var \MongoDB\Database
*/
protected $db;

/**
* The MongoDB connection handler.
*
* @var \MongoDB\Client
*/
protected $connection;

/**
* Create a new database connection instance.
*
* @param array $config
*/
public function __construct(array $config)
Expand Down Expand Up @@ -53,6 +56,7 @@ public function __construct(array $config)

/**
* Begin a fluent query against a database collection.
*
* @param string $collection
* @return Query\Builder
*/
Expand All @@ -65,6 +69,7 @@ public function collection($collection)

/**
* Begin a fluent query against a database collection.
*
* @param string $table
* @param string|null $as
* @return Query\Builder
Expand All @@ -76,6 +81,7 @@ public function table($table, $as = null)

/**
* Get a MongoDB collection.
*
* @param string $name
* @return Collection
*/
Expand All @@ -94,6 +100,7 @@ public function getSchemaBuilder()

/**
* Get the MongoDB database object.
*
* @return \MongoDB\Database
*/
public function getMongoDB()
Expand All @@ -103,6 +110,7 @@ public function getMongoDB()

/**
* return MongoDB object.
*
* @return \MongoDB\Client
*/
public function getMongoClient()
Expand All @@ -120,6 +128,7 @@ public function getDatabaseName()

/**
* Get the name of the default database based on db config or try to detect it from dsn.
*
* @param string $dsn
* @param array $config
* @return string
Expand All @@ -140,6 +149,7 @@ protected function getDefaultDatabaseName($dsn, $config)

/**
* Create a new MongoDB connection.
*
* @param string $dsn
* @param array $config
* @param array $options
Expand Down Expand Up @@ -175,6 +185,7 @@ public function disconnect()

/**
* Determine if the given configuration array has a dsn string.
*
* @param array $config
* @return bool
*/
Expand All @@ -185,6 +196,7 @@ protected function hasDsnString(array $config)

/**
* Get the DSN string form configuration.
*
* @param array $config
* @return string
*/
Expand All @@ -195,6 +207,7 @@ protected function getDsnString(array $config)

/**
* Get the DSN string for a host / port configuration.
*
* @param array $config
* @return string
*/
Expand All @@ -218,6 +231,7 @@ protected function getHostDsn(array $config)

/**
* Create a DSN string from a configuration.
*
* @param array $config
* @return string
*/
Expand Down Expand Up @@ -270,6 +284,7 @@ protected function getDefaultSchemaGrammar()

/**
* Set database.
*
* @param \MongoDB\Database $db
*/
public function setDatabase(\MongoDB\Database $db)
Expand All @@ -279,6 +294,7 @@ public function setDatabase(\MongoDB\Database $db)

/**
* Dynamically pass methods to the connection.
*
* @param string $method
* @param array $parameters
* @return mixed
Expand Down
1 change: 1 addition & 0 deletions src/Eloquent/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Builder extends EloquentBuilder

/**
* The methods that should be returned from query builder.
*
* @var array
*/
protected $passthru = [
Expand Down
2 changes: 2 additions & 0 deletions src/Eloquent/EmbedsRelations.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ trait EmbedsRelations
{
/**
* Define an embedded one-to-many relationship.
*
* @param string $related
* @param string $localKey
* @param string $foreignKey
Expand Down Expand Up @@ -44,6 +45,7 @@ protected function embedsMany($related, $localKey = null, $foreignKey = null, $r

/**
* Define an embedded one-to-many relationship.
*
* @param string $related
* @param string $localKey
* @param string $foreignKey
Expand Down
8 changes: 8 additions & 0 deletions src/Eloquent/HybridRelations.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ trait HybridRelations
{
/**
* Define a one-to-one relationship.
*
* @param string $related
* @param string $foreignKey
* @param string $localKey
Expand All @@ -39,6 +40,7 @@ public function hasOne($related, $foreignKey = null, $localKey = null)

/**
* Define a polymorphic one-to-one relationship.
*
* @param string $related
* @param string $name
* @param string $type
Expand All @@ -64,6 +66,7 @@ public function morphOne($related, $name, $type = null, $id = null, $localKey =

/**
* Define a one-to-many relationship.
*
* @param string $related
* @param string $foreignKey
* @param string $localKey
Expand All @@ -87,6 +90,7 @@ public function hasMany($related, $foreignKey = null, $localKey = null)

/**
* Define a polymorphic one-to-many relationship.
*
* @param string $related
* @param string $name
* @param string $type
Expand Down Expand Up @@ -117,6 +121,7 @@ public function morphMany($related, $name, $type = null, $id = null, $localKey =

/**
* Define an inverse one-to-one or many relationship.
*
* @param string $related
* @param string $foreignKey
* @param string $otherKey
Expand Down Expand Up @@ -160,6 +165,7 @@ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relat

/**
* Define a polymorphic, inverse one-to-one or many relationship.
*
* @param string $name
* @param string $type
* @param string $id
Expand Down Expand Up @@ -204,6 +210,7 @@ public function morphTo($name = null, $type = null, $id = null, $ownerKey = null

/**
* Define a many-to-many relationship.
*
* @param string $related
* @param string $collection
* @param string $foreignKey
Expand Down Expand Up @@ -277,6 +284,7 @@ public function belongsToMany(

/**
* Get the relationship name of the belongs to many.
*
* @return string
*/
protected function guessBelongsToManyRelation()
Expand Down
14 changes: 14 additions & 0 deletions src/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,35 @@ abstract class Model extends BaseModel

/**
* The collection associated with the model.
*
* @var string
*/
protected $collection;

/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = '_id';

/**
* The primary key type.
*
* @var string
*/
protected $keyType = 'string';

/**
* The parent relation instance.
*
* @var Relation
*/
protected $parentRelation;

/**
* Custom accessor for the model's id.
*
* @param mixed $value
* @return mixed
*/
Expand Down Expand Up @@ -269,6 +274,7 @@ public function originalIsEquivalent($key)

/**
* Remove one or more fields.
*
* @param mixed $columns
* @return int
*/
Expand Down Expand Up @@ -314,6 +320,7 @@ public function push()

/**
* Remove one or more values from an array.
*
* @param string $column
* @param mixed $values
* @return mixed
Expand All @@ -332,6 +339,7 @@ public function pull($column, $values)

/**
* Append one or more values to the underlying attribute value and sync with original.
*
* @param string $column
* @param array $values
* @param bool $unique
Expand All @@ -356,6 +364,7 @@ protected function pushAttributeValues($column, array $values, $unique = false)

/**
* Remove one or more values to the underlying attribute value and sync with original.
*
* @param string $column
* @param array $values
*/
Expand Down Expand Up @@ -388,6 +397,7 @@ public function getForeignKey()

/**
* Set the parent relation.
*
* @param \Illuminate\Database\Eloquent\Relations\Relation $relation
*/
public function setParentRelation(Relation $relation)
Expand All @@ -397,6 +407,7 @@ public function setParentRelation(Relation $relation)

/**
* Get the parent relation.
*
* @return \Illuminate\Database\Eloquent\Relations\Relation
*/
public function getParentRelation()
Expand Down Expand Up @@ -432,6 +443,7 @@ protected function removeTableFromKey($key)

/**
* Get the queueable relationships for the entity.
*
* @return array
*/
public function getQueueableRelations()
Expand Down Expand Up @@ -461,6 +473,7 @@ public function getQueueableRelations()

/**
* Get loaded relations for the instance without parent.
*
* @return array
*/
protected function getRelationsWithoutParent()
Expand All @@ -477,6 +490,7 @@ protected function getRelationsWithoutParent()
/**
* Checks if column exists on a table. As this is a document model, just return true. This also
* prevents calls to non-existent function Grammar::compileColumnListing().
*
* @param string $key
* @return bool
*/
Expand Down
4 changes: 4 additions & 0 deletions src/Helpers/QueriesRelationships.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ trait QueriesRelationships
{
/**
* Add a relationship count / exists condition to the query.
*
* @param Relation|string $relation
* @param string $operator
* @param int $count
* @param string $boolean
* @param Closure|null $callback
* @return Builder|static
* @throws Exception
*/
public function has($relation, $operator = '>=', $count = 1, $boolean = 'and', Closure $callback = null)
{
Expand Down Expand Up @@ -72,6 +74,7 @@ protected function isAcrossConnections(Relation $relation)

/**
* Compare across databases.
*
* @param Relation $relation
* @param string $operator
* @param int $count
Expand Down Expand Up @@ -150,6 +153,7 @@ protected function getConstrainedRelatedIds($relations, $operator, $count)

/**
* Returns key we are constraining this parent model's query with.
*
* @param Relation $relation
* @return string
* @throws Exception
Expand Down
Loading

0 comments on commit 40846ab

Please sign in to comment.