Skip to content

Commit

Permalink
🚨 Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jenssegers committed Sep 8, 2019
1 parent cf45ec6 commit cc00aff
Show file tree
Hide file tree
Showing 43 changed files with 570 additions and 604 deletions.
6 changes: 5 additions & 1 deletion src/Jenssegers/Mongodb/Auth/DatabaseTokenRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ class DatabaseTokenRepository extends BaseDatabaseTokenRepository
*/
protected function getPayload($email, $token)
{
return ['email' => $email, 'token' => $this->hasher->make($token), 'created_at' => new UTCDateTime(time() * 1000)];
return [
'email' => $email,
'token' => $this->hasher->make($token),
'created_at' => new UTCDateTime(time() * 1000),
];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class PasswordResetServiceProvider extends BasePasswordResetServiceProvider
{
/**
* Register the token repository implementation.
*
* @return void
*/
protected function registerTokenRepository()
Expand Down
7 changes: 2 additions & 5 deletions src/Jenssegers/Mongodb/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ class Collection
{
/**
* The connection instance.
*
* @var Connection
*/
protected $connection;

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

/**
* Handle dynamic method calls.
*
* @param string $method
* @param array $parameters
* @param string $method
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
Expand Down
44 changes: 15 additions & 29 deletions src/Jenssegers/Mongodb/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,19 @@ 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
* @param array $config
*/
public function __construct(array $config)
{
Expand All @@ -52,8 +49,7 @@ public function __construct(array $config)

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

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

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

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

/**
* return MongoDB object.
*
* @return \MongoDB\Client
*/
public function getMongoClient()
Expand All @@ -124,10 +116,9 @@ public function getDatabaseName()

/**
* Create a new MongoDB connection.
*
* @param string $dsn
* @param array $config
* @param array $options
* @param string $dsn
* @param array $config
* @param array $options
* @return \MongoDB\Client
*/
protected function createConnection($dsn, array $config, array $options)
Expand Down Expand Up @@ -160,19 +151,17 @@ public function disconnect()

/**
* Determine if the given configuration array has a dsn string.
*
* @param array $config
* @param array $config
* @return bool
*/
protected function hasDsnString(array $config)
{
return isset($config['dsn']) && ! empty($config['dsn']);
return isset($config['dsn']) && !empty($config['dsn']);
}

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

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

/**
* Create a DSN string from a configuration.
*
* @param array $config
* @param array $config
* @return string
*/
protected function getDsn(array $config)
Expand Down Expand Up @@ -259,9 +246,8 @@ protected function getDefaultSchemaGrammar()

/**
* Dynamically pass methods to the connection.
*
* @param string $method
* @param array $parameters
* @param string $method
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
Expand Down
6 changes: 2 additions & 4 deletions src/Jenssegers/Mongodb/Eloquent/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class Builder extends EloquentBuilder

/**
* The methods that should be returned from query builder.
*
* @var array
*/
protected $passthru = [
Expand Down Expand Up @@ -182,13 +181,12 @@ public function raw($expression = null)
* TODO Remove if https://github.com/laravel/framework/commit/6484744326531829341e1ff886cc9b628b20d73e
* wiil be reverted
* Issue in laravel frawework https://github.com/laravel/framework/issues/27791
*
* @param array $values
* @param array $values
* @return array
*/
protected function addUpdatedAtColumn(array $values)
{
if (! $this->model->usesTimestamps() || $this->model->getUpdatedAtColumn() === null) {
if (!$this->model->usesTimestamps() || $this->model->getUpdatedAtColumn() === null) {
return $values;
}

Expand Down
18 changes: 8 additions & 10 deletions src/Jenssegers/Mongodb/Eloquent/EmbedsRelations.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ trait EmbedsRelations
{
/**
* Define an embedded one-to-many relationship.
*
* @param string $related
* @param string $localKey
* @param string $foreignKey
* @param string $relation
* @param string $related
* @param string $localKey
* @param string $foreignKey
* @param string $relation
* @return \Jenssegers\Mongodb\Relations\EmbedsMany
*/
protected function embedsMany($related, $localKey = null, $foreignKey = null, $relation = null)
Expand Down Expand Up @@ -45,11 +44,10 @@ 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
* @param string $relation
* @param string $related
* @param string $localKey
* @param string $foreignKey
* @param string $relation
* @return \Jenssegers\Mongodb\Relations\EmbedsOne
*/
protected function embedsOne($related, $localKey = null, $foreignKey = null, $relation = null)
Expand Down
70 changes: 31 additions & 39 deletions src/Jenssegers/Mongodb/Eloquent/HybridRelations.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ trait HybridRelations
{
/**
* Define a one-to-one relationship.
*
* @param string $related
* @param string $foreignKey
* @param string $localKey
* @param string $related
* @param string $foreignKey
* @param string $localKey
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function hasOne($related, $foreignKey = null, $localKey = null)
Expand All @@ -40,12 +39,11 @@ public function hasOne($related, $foreignKey = null, $localKey = null)

/**
* Define a polymorphic one-to-one relationship.
*
* @param string $related
* @param string $name
* @param string $type
* @param string $id
* @param string $localKey
* @param string $related
* @param string $name
* @param string $type
* @param string $id
* @param string $localKey
* @return \Illuminate\Database\Eloquent\Relations\MorphOne
*/
public function morphOne($related, $name, $type = null, $id = null, $localKey = null)
Expand All @@ -66,10 +64,9 @@ 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
* @param string $related
* @param string $foreignKey
* @param string $localKey
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function hasMany($related, $foreignKey = null, $localKey = null)
Expand All @@ -90,12 +87,11 @@ public function hasMany($related, $foreignKey = null, $localKey = null)

/**
* Define a polymorphic one-to-many relationship.
*
* @param string $related
* @param string $name
* @param string $type
* @param string $id
* @param string $localKey
* @param string $related
* @param string $name
* @param string $type
* @param string $id
* @param string $localKey
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/
public function morphMany($related, $name, $type = null, $id = null, $localKey = null)
Expand All @@ -121,11 +117,10 @@ 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
* @param string $relation
* @param string $related
* @param string $foreignKey
* @param string $otherKey
* @param string $relation
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function belongsTo($related, $foreignKey = null, $otherKey = null, $relation = null)
Expand Down Expand Up @@ -165,11 +160,10 @@ 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
* @param string $ownerKey
* @param string $name
* @param string $type
* @param string $id
* @param string $ownerKey
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
*/
public function morphTo($name = null, $type = null, $id = null, $ownerKey = null)
Expand Down Expand Up @@ -208,14 +202,13 @@ 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
* @param string $otherKey
* @param string $parentKey
* @param string $relatedKey
* @param string $relation
* @param string $related
* @param string $collection
* @param string $foreignKey
* @param string $otherKey
* @param string $parentKey
* @param string $relatedKey
* @param string $relation
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function belongsToMany(
Expand Down Expand Up @@ -282,7 +275,6 @@ public function belongsToMany(

/**
* Get the relationship name of the belongs to many.
*
* @return string
*/
protected function guessBelongsToManyRelation()
Expand Down
Loading

0 comments on commit cc00aff

Please sign in to comment.