Unverified Commit b379bd39 authored by Divine's avatar Divine Committed by GitHub

Merge pull request #1986 from divine/analysis-KZ0ZE3

[4.x] Apply fixes from StyleCI
parents 444e90df 56b874de
......@@ -11,7 +11,7 @@ use MongoDB\BSON\UTCDateTime;
class DatabaseTokenRepository extends BaseDatabaseTokenRepository
{
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function getPayload($email, $token)
{
......@@ -23,7 +23,7 @@ class DatabaseTokenRepository extends BaseDatabaseTokenRepository
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function tokenExpired($createdAt)
{
......@@ -33,7 +33,7 @@ class DatabaseTokenRepository extends BaseDatabaseTokenRepository
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function tokenRecentlyCreated($createdAt)
{
......
......@@ -7,7 +7,7 @@ use Illuminate\Auth\Passwords\PasswordBrokerManager as BasePasswordBrokerManager
class PasswordBrokerManager extends BasePasswordBrokerManager
{
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function createTokenRepository(array $config)
{
......
......@@ -29,7 +29,7 @@ class PasswordResetServiceProvider extends BasePasswordResetServiceProvider
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function registerPasswordBroker()
{
......
......@@ -65,7 +65,7 @@ class Collection
}
}
$queryString = $this->collection->getCollectionName() . '.' . $method . '(' . implode(',', $query) . ')';
$queryString = $this->collection->getCollectionName().'.'.$method.'('.implode(',', $query).')';
$this->connection->logQuery($queryString, [], $time);
}
......
......@@ -85,7 +85,7 @@ class Connection extends BaseConnection
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getSchemaBuilder()
{
......@@ -119,7 +119,7 @@ class Connection extends BaseConnection
}
/**
* Get the name of the default database based on db config or try to detect it from dsn
* 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
......@@ -131,7 +131,7 @@ class Connection extends BaseConnection
if (preg_match('/^mongodb(?:[+]srv)?:\\/\\/.+\\/([^?&]+)/s', $dsn, $matches)) {
$config['database'] = $matches[1];
} else {
throw new InvalidArgumentException("Database is not properly configured.");
throw new InvalidArgumentException('Database is not properly configured.');
}
}
......@@ -155,10 +155,10 @@ class Connection extends BaseConnection
}
// Check if the credentials are not already set in the options
if (!isset($options['username']) && !empty($config['username'])) {
if (! isset($options['username']) && ! empty($config['username'])) {
$options['username'] = $config['username'];
}
if (!isset($options['password']) && !empty($config['password'])) {
if (! isset($options['password']) && ! empty($config['password'])) {
$options['password'] = $config['password'];
}
......@@ -166,7 +166,7 @@ class Connection extends BaseConnection
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function disconnect()
{
......@@ -180,7 +180,7 @@ class Connection extends BaseConnection
*/
protected function hasDsnString(array $config)
{
return isset($config['dsn']) && !empty($config['dsn']);
return isset($config['dsn']) && ! empty($config['dsn']);
}
/**
......@@ -205,14 +205,15 @@ class Connection extends BaseConnection
foreach ($hosts as &$host) {
// Check if we need to add a port to the host
if (strpos($host, ':') === false && !empty($config['port'])) {
$host = $host . ':' . $config['port'];
if (strpos($host, ':') === false && ! empty($config['port'])) {
$host = $host.':'.$config['port'];
}
}
// Check if we want to authenticate against a specific database.
$auth_database = isset($config['options']) && !empty($config['options']['database']) ? $config['options']['database'] : null;
return 'mongodb://' . implode(',', $hosts) . ($auth_database ? '/' . $auth_database : '');
$auth_database = isset($config['options']) && ! empty($config['options']['database']) ? $config['options']['database'] : null;
return 'mongodb://'.implode(',', $hosts).($auth_database ? '/'.$auth_database : '');
}
/**
......@@ -228,7 +229,7 @@ class Connection extends BaseConnection
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getElapsedTime($start)
{
......@@ -236,7 +237,7 @@ class Connection extends BaseConnection
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getDriverName()
{
......@@ -244,7 +245,7 @@ class Connection extends BaseConnection
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function getDefaultPostProcessor()
{
......@@ -252,7 +253,7 @@ class Connection extends BaseConnection
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function getDefaultQueryGrammar()
{
......@@ -260,7 +261,7 @@ class Connection extends BaseConnection
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function getDefaultSchemaGrammar()
{
......
......@@ -31,7 +31,7 @@ class Builder extends EloquentBuilder
];
/**
* @inheritdoc
* {@inheritdoc}
*/
public function update(array $values, array $options = [])
{
......@@ -39,7 +39,7 @@ class Builder extends EloquentBuilder
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function insert(array $values)
{
......@@ -47,7 +47,7 @@ class Builder extends EloquentBuilder
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function insertGetId(array $values, $sequence = null)
{
......@@ -55,7 +55,7 @@ class Builder extends EloquentBuilder
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function delete()
{
......@@ -63,7 +63,7 @@ class Builder extends EloquentBuilder
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function increment($column, $amount = 1, array $extra = [])
{
......@@ -71,7 +71,7 @@ class Builder extends EloquentBuilder
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function decrement($column, $amount = 1, array $extra = [])
{
......@@ -79,7 +79,7 @@ class Builder extends EloquentBuilder
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function chunkById($count, callable $callback, $column = '_id', $alias = null)
{
......@@ -87,7 +87,7 @@ class Builder extends EloquentBuilder
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function raw($expression = null)
{
......@@ -116,13 +116,13 @@ class Builder extends EloquentBuilder
* Add the "updated at" column to an array of values.
* TODO Remove if https://github.com/laravel/framework/commit/6484744326531829341e1ff886cc9b628b20d73e
* wiil be reverted
* Issue in laravel frawework https://github.com/laravel/framework/issues/27791
* Issue in laravel frawework https://github.com/laravel/framework/issues/27791.
* @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;
}
......
......@@ -9,8 +9,8 @@ use Jenssegers\Mongodb\Relations\BelongsTo;
use Jenssegers\Mongodb\Relations\BelongsToMany;
use Jenssegers\Mongodb\Relations\HasMany;
use Jenssegers\Mongodb\Relations\HasOne;
use Jenssegers\Mongodb\Relations\MorphTo;
use Jenssegers\Mongodb\Relations\MorphMany;
use Jenssegers\Mongodb\Relations\MorphTo;
trait HybridRelations
{
......@@ -24,7 +24,7 @@ trait HybridRelations
public function hasOne($related, $foreignKey = null, $localKey = null)
{
// Check if it is a relation with an original model.
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
return parent::hasOne($related, $foreignKey, $localKey);
}
......@@ -49,13 +49,13 @@ trait HybridRelations
public function morphOne($related, $name, $type = null, $id = null, $localKey = null)
{
// Check if it is a relation with an original model.
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
return parent::morphOne($related, $name, $type, $id, $localKey);
}
$instance = new $related;
list($type, $id) = $this->getMorphs($name, $type, $id);
[$type, $id] = $this->getMorphs($name, $type, $id);
$localKey = $localKey ?: $this->getKeyName();
......@@ -72,7 +72,7 @@ trait HybridRelations
public function hasMany($related, $foreignKey = null, $localKey = null)
{
// Check if it is a relation with an original model.
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
return parent::hasMany($related, $foreignKey, $localKey);
}
......@@ -97,7 +97,7 @@ trait HybridRelations
public function morphMany($related, $name, $type = null, $id = null, $localKey = null)
{
// Check if it is a relation with an original model.
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
return parent::morphMany($related, $name, $type, $id, $localKey);
}
......@@ -106,7 +106,7 @@ trait HybridRelations
// Here we will gather up the morph type and ID for the relationship so that we
// can properly query the intermediate table of a relation. Finally, we will
// get the table and create the relationship instances for the developers.
list($type, $id) = $this->getMorphs($name, $type, $id);
[$type, $id] = $this->getMorphs($name, $type, $id);
$table = $instance->getTable();
......@@ -129,13 +129,13 @@ trait HybridRelations
// the calling method's name and use that as the relationship name as most
// of the time this will be what we desire to use for the relationships.
if ($relation === null) {
list($current, $caller) = debug_backtrace(false, 2);
[$current, $caller] = debug_backtrace(false, 2);
$relation = $caller['function'];
}
// Check if it is a relation with an original model.
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
return parent::belongsTo($related, $foreignKey, $otherKey, $relation);
}
......@@ -143,7 +143,7 @@ trait HybridRelations
// foreign key name by using the name of the relationship function, which
// when combined with an "_id" should conventionally match the columns.
if ($foreignKey === null) {
$foreignKey = Str::snake($relation) . '_id';
$foreignKey = Str::snake($relation).'_id';
}
$instance = new $related;
......@@ -172,12 +172,12 @@ trait HybridRelations
// since that is most likely the name of the polymorphic interface. We can
// use that to get both the class and foreign key that will be utilized.
if ($name === null) {
list($current, $caller) = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
[$current, $caller] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
$name = Str::snake($caller['function']);
}
list($type, $id) = $this->getMorphs($name, $type, $id);
[$type, $id] = $this->getMorphs($name, $type, $id);
// If the type value is null it is probably safe to assume we're eager loading
// the relationship. When that is the case we will pass in a dummy query as
......@@ -230,7 +230,7 @@ trait HybridRelations
}
// Check if it is a relation with an original model.
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
return parent::belongsToMany(
$related,
$collection,
......@@ -245,11 +245,11 @@ trait HybridRelations
// First, we'll need to determine the foreign key and "other key" for the
// relationship. Once we have determined the keys we'll make the query
// instances as well as the relationship instances we need for this.
$foreignKey = $foreignKey ?: $this->getForeignKey() . 's';
$foreignKey = $foreignKey ?: $this->getForeignKey().'s';
$instance = new $related;
$otherKey = $otherKey ?: $instance->getForeignKey() . 's';
$otherKey = $otherKey ?: $instance->getForeignKey().'s';
// If no table name was provided, we can guess it by concatenating the two
// models using underscores in alphabetical order. The two model names
......@@ -289,7 +289,7 @@ trait HybridRelations
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function newEloquentBuilder($query)
{
......
......@@ -52,7 +52,7 @@ abstract class Model extends BaseModel
{
// If we don't have a value for 'id', we will use the Mongo '_id' value.
// This allows us to work with models in a more sql-like way.
if (!$value && array_key_exists('_id', $this->attributes)) {
if (! $value && array_key_exists('_id', $this->attributes)) {
$value = $this->attributes['_id'];
}
......@@ -67,7 +67,7 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getQualifiedKeyName()
{
......@@ -75,7 +75,7 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function fromDateTime($value)
{
......@@ -85,7 +85,7 @@ abstract class Model extends BaseModel
}
// Let Eloquent convert the value to a DateTime instance.
if (!$value instanceof DateTime) {
if (! $value instanceof DateTime) {
$value = parent::asDateTime($value);
}
......@@ -93,7 +93,7 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function asDateTime($value)
{
......@@ -106,7 +106,7 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getDateFormat()
{
......@@ -114,7 +114,7 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function freshTimestamp()
{
......@@ -122,7 +122,7 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getTable()
{
......@@ -130,11 +130,11 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getAttribute($key)
{
if (!$key) {
if (! $key) {
return;
}
......@@ -147,7 +147,7 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function getAttributeFromArray($key)
{
......@@ -160,7 +160,7 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function setAttribute($key, $value)
{
......@@ -184,7 +184,7 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function attributesToArray()
{
......@@ -213,7 +213,7 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getCasts()
{
......@@ -221,11 +221,11 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function originalIsEquivalent($key, $current)
{
if (!array_key_exists($key, $this->original)) {
if (! array_key_exists($key, $this->original)) {
return false;
}
......@@ -274,7 +274,7 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function push()
{
......@@ -282,9 +282,9 @@ abstract class Model extends BaseModel
$unique = false;
if (count($parameters) === 3) {
list($column, $values, $unique) = $parameters;
[$column, $values, $unique] = $parameters;
} else {
list($column, $values) = $parameters;
[$column, $values] = $parameters;
}
// Do batch push by default.
......@@ -330,7 +330,7 @@ abstract class Model extends BaseModel
foreach ($values as $value) {
// Don't add duplicate values when we only want unique values.
if ($unique && (!is_array($current) || in_array($value, $current))) {
if ($unique && (! is_array($current) || in_array($value, $current))) {
continue;
}
......@@ -367,11 +367,11 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getForeignKey()
{
return Str::snake(class_basename($this)) . '_' . ltrim($this->primaryKey, '_');
return Str::snake(class_basename($this)).'_'.ltrim($this->primaryKey, '_');
}
/**
......@@ -393,7 +393,7 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function newEloquentBuilder($query)
{
......@@ -401,7 +401,7 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function newBaseQueryBuilder()
{
......@@ -411,7 +411,7 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function removeTableFromKey($key)
{
......@@ -433,13 +433,13 @@ abstract class Model extends BaseModel
if ($relation instanceof QueueableCollection) {
foreach ($relation->getQueueableRelations() as $collectionValue) {
$relations[] = $key . '.' . $collectionValue;
$relations[] = $key.'.'.$collectionValue;
}
}
if ($relation instanceof QueueableEntity) {
foreach ($relation->getQueueableRelations() as $entityKey => $entityValue) {
$relations[] = $key . '.' . $entityValue;
$relations[] = $key.'.'.$entityValue;
}
}
}
......@@ -463,7 +463,7 @@ abstract class Model extends BaseModel
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function __call($method, $parameters)
{
......
......@@ -7,7 +7,7 @@ trait SoftDeletes
use \Illuminate\Database\Eloquent\SoftDeletes;
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getQualifiedDeletedAtColumn()
{
......
......@@ -71,7 +71,7 @@ trait QueriesRelationships
}
/**
* Compare across databases
* Compare across databases.
* @param Relation $relation
* @param string $operator
* @param int $count
......@@ -91,7 +91,7 @@ trait QueriesRelationships
$not = in_array($operator, ['<', '<=', '!=']);
// If we are comparing to 0, we need an additional $not flip.
if ($count == 0) {
$not = !$not;
$not = ! $not;
}
$relations = $hasQuery->pluck($this->getHasCompareKey($relation));
......@@ -149,7 +149,7 @@ trait QueriesRelationships
}
/**
* Returns key we are constraining this parent model's query with
* Returns key we are constraining this parent model's query with.
* @param Relation $relation
* @return string
* @throws Exception
......@@ -164,10 +164,10 @@ trait QueriesRelationships
return $relation->getForeignKeyName();
}
if ($relation instanceof BelongsToMany && !$this->isAcrossConnections($relation)) {
if ($relation instanceof BelongsToMany && ! $this->isAcrossConnections($relation)) {
return $this->model->getKeyName();
}
throw new Exception(class_basename($relation) . ' is not supported for hybrid query constraints.');
throw new Exception(class_basename($relation).' is not supported for hybrid query constraints.');
}
}
......@@ -2,14 +2,14 @@
namespace Jenssegers\Mongodb;
use Illuminate\Support\Facades\DB;
use Illuminate\Queue\QueueServiceProvider;
use Illuminate\Support\Facades\DB;
use Jenssegers\Mongodb\Queue\Failed\MongoFailedJobProvider;
class MongodbQueueServiceProvider extends QueueServiceProvider
{
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function registerFailedJobServices()
{
......
......@@ -27,6 +27,7 @@ class MongodbServiceProvider extends ServiceProvider
$this->app->resolving('db', function ($db) {
$db->extend('mongodb', function ($config, $name) {
$config['name'] = $name;
return new Connection($config);
});
});
......
This diff is collapsed.
......@@ -34,6 +34,7 @@ class MongoFailedJobProvider extends DatabaseFailedJobProvider
$all = array_map(function ($job) {
$job['id'] = (string) $job['_id'];
return (object) $job;
}, $all);
......@@ -49,7 +50,7 @@ class MongoFailedJobProvider extends DatabaseFailedJobProvider
{
$job = $this->getTable()->find($id);
if (!$job) {
if (! $job) {
return;
}
......
......@@ -22,7 +22,7 @@ class MongoQueue extends DatabaseQueue
protected $connectionName;
/**
* @inheritdoc
* {@inheritdoc}
*/
public function __construct(Connection $database, $table, $default = 'default', $retryAfter = 60)
{
......@@ -31,7 +31,7 @@ class MongoQueue extends DatabaseQueue
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function pop($queue = null)
{
......@@ -125,7 +125,7 @@ class MongoQueue extends DatabaseQueue
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function deleteReserved($queue, $id)
{
......
......@@ -17,7 +17,7 @@ class BelongsTo extends \Illuminate\Database\Eloquent\Relations\BelongsTo
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function addConstraints()
{
......@@ -30,7 +30,7 @@ class BelongsTo extends \Illuminate\Database\Eloquent\Relations\BelongsTo
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function addEagerConstraints(array $models)
{
......@@ -43,7 +43,7 @@ class BelongsTo extends \Illuminate\Database\Eloquent\Relations\BelongsTo
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
{
......
......@@ -21,7 +21,7 @@ class BelongsToMany extends EloquentBelongsToMany
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
{
......@@ -29,7 +29,7 @@ class BelongsToMany extends EloquentBelongsToMany
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function hydratePivotRelation(array $models)
{
......@@ -47,7 +47,7 @@ class BelongsToMany extends EloquentBelongsToMany
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function shouldSelect(array $columns = ['*'])
{
......@@ -55,7 +55,7 @@ class BelongsToMany extends EloquentBelongsToMany
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function addConstraints()
{
......@@ -78,7 +78,7 @@ class BelongsToMany extends EloquentBelongsToMany
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function save(Model $model, array $joining = [], $touch = true)
{
......@@ -90,7 +90,7 @@ class BelongsToMany extends EloquentBelongsToMany
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function create(array $attributes = [], array $joining = [], $touch = true)
{
......@@ -107,7 +107,7 @@ class BelongsToMany extends EloquentBelongsToMany
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function sync($ids, $detaching = true)
{
......@@ -167,7 +167,7 @@ class BelongsToMany extends EloquentBelongsToMany
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function updateExistingPivot($id, array $attributes, $touch = true)
{
......@@ -175,7 +175,7 @@ class BelongsToMany extends EloquentBelongsToMany
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function attach($id, array $attributes = [], $touch = true)
{
......@@ -208,7 +208,7 @@ class BelongsToMany extends EloquentBelongsToMany
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function detach($ids = [], $touch = true)
{
......@@ -242,7 +242,7 @@ class BelongsToMany extends EloquentBelongsToMany
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function buildDictionary(Collection $results)
{
......@@ -263,7 +263,7 @@ class BelongsToMany extends EloquentBelongsToMany
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function newPivotQuery()
{
......@@ -289,7 +289,7 @@ class BelongsToMany extends EloquentBelongsToMany
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getQualifiedForeignPivotKeyName()
{
......@@ -297,7 +297,7 @@ class BelongsToMany extends EloquentBelongsToMany
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getQualifiedRelatedPivotKeyName()
{
......@@ -306,7 +306,7 @@ class BelongsToMany extends EloquentBelongsToMany
/**
* Format the sync list so that it is keyed by ID. (Legacy Support)
* The original function has been renamed to formatRecordsList since Laravel 5.3
* The original function has been renamed to formatRecordsList since Laravel 5.3.
* @param array $records
* @return array
* @deprecated
......@@ -315,11 +315,12 @@ class BelongsToMany extends EloquentBelongsToMany
{
$results = [];
foreach ($records as $id => $attributes) {
if (!is_array($attributes)) {
list($id, $attributes) = [$attributes, []];
if (! is_array($attributes)) {
[$id, $attributes] = [$attributes, []];
}
$results[$id] = $attributes;
}
return $results;
}
......
......@@ -36,7 +36,7 @@ class HasMany extends EloquentHasMany
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
{
......
......@@ -36,7 +36,7 @@ class HasOne extends EloquentHasOne
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
{
......
......@@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Relations\MorphTo as EloquentMorphTo;
class MorphTo extends EloquentMorphTo
{
/**
* @inheritdoc
* {@inheritdoc}
*/
public function addConstraints()
{
......@@ -21,7 +21,7 @@ class MorphTo extends EloquentMorphTo
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function getResultsByType($type)
{
......
......@@ -25,7 +25,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
protected $columns = [];
/**
* @inheritdoc
* {@inheritdoc}
*/
public function __construct(Connection $connection, $collection)
{
......@@ -35,7 +35,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function index($columns = null, $name = null, $algorithm = null, $options = [])
{
......@@ -63,7 +63,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function primary($columns = null, $name = null, $algorithm = null, $options = [])
{
......@@ -71,7 +71,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function dropIndex($indexOrColumns = null)
{
......@@ -93,6 +93,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
if ($this->hasIndex($indexOrColumns)) {
$this->dropIndex($indexOrColumns);
}
return $this;
}
......@@ -114,6 +115,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
return true;
}
}
return false;
}
......@@ -140,16 +142,17 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
$sorting = $value;
}
$transform[$column] = $column . "_" . $sorting;
$transform[$column] = $column.'_'.$sorting;
}
$indexOrColumns = implode('_', $transform);
}
return $indexOrColumns;
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function unique($columns = null, $name = null, $algorithm = null, $options = [])
{
......@@ -249,7 +252,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function drop()
{
......@@ -257,7 +260,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function addColumn($type, $name, array $parameters = [])
{
......
......@@ -8,7 +8,7 @@ use Jenssegers\Mongodb\Connection;
class Builder extends \Illuminate\Database\Schema\Builder
{
/**
* @inheritdoc
* {@inheritdoc}
*/
public function __construct(Connection $connection)
{
......@@ -16,7 +16,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function hasColumn($table, $column)
{
......@@ -24,7 +24,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function hasColumns($table, array $columns)
{
......@@ -50,7 +50,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function hasTable($collection)
{
......@@ -73,7 +73,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function table($collection, Closure $callback)
{
......@@ -81,7 +81,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function create($collection, Closure $callback = null, array $options = [])
{
......@@ -95,7 +95,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function dropIfExists($collection)
{
......@@ -107,7 +107,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function drop($collection)
{
......@@ -117,7 +117,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function dropAllTables()
{
......@@ -127,7 +127,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function createBlueprint($collection, Closure $callback = null)
{
......
......@@ -40,7 +40,7 @@ class DatabasePresenceVerifier extends \Illuminate\Validation\DatabasePresenceVe
public function getMultiCount($collection, $column, array $values, array $extra = [])
{
// Generates a regex like '/(a|b|c)/i' which can query multiple values
$regex = '/(' . implode('|', $values) . ')/i';
$regex = '/('.implode('|', $values).')/i';
$query = $this->table($collection)->where($column, 'regex', $regex);
......
......@@ -29,6 +29,7 @@ class AuthTest extends TestCase
{
if (Application::VERSION >= '5.2') {
$this->expectNotToPerformAssertions();
return;
}
......
<?php
declare(strict_types=1);
use Jenssegers\Mongodb\Collection;
......
<?php
declare(strict_types=1);
use Illuminate\Support\Facades\DB;
......@@ -97,7 +98,7 @@ class ConnectionTest extends TestCase
Config::set('database.connections.mongodb.options.database', 'custom');
$connection = DB::connection('mongodb');
$this->assertEquals('mongodb://' . $host . '/custom', (string) $connection->getMongoClient());
$this->assertEquals('mongodb://'.$host.'/custom', (string) $connection->getMongoClient());
}
public function testCustomHostAndPort()
......@@ -106,7 +107,7 @@ class ConnectionTest extends TestCase
Config::set('database.connections.mongodb.port', 27000);
$connection = DB::connection('mongodb');
$this->assertEquals("mongodb://db1:27000", (string) $connection->getMongoClient());
$this->assertEquals('mongodb://db1:27000', (string) $connection->getMongoClient());
}
public function testHostWithPorts()
......
<?php
declare(strict_types=1);
class DsnTest extends TestCase
......
<?php
declare(strict_types=1);
class GeospatialTest extends TestCase
......
<?php
declare(strict_types=1);
use Illuminate\Database\MySqlConnection;
......@@ -28,7 +29,7 @@ class HybridRelationsTest extends TestCase
$this->assertInstanceOf(MySqlConnection::class, $user->getConnection());
// Mysql User
$user->name = "John Doe";
$user->name = 'John Doe';
$user->save();
$this->assertIsInt($user->id);
......@@ -54,7 +55,7 @@ class HybridRelationsTest extends TestCase
// MongoDB User
$user = new User;
$user->name = "John Doe";
$user->name = 'John Doe';
$user->save();
// MongoDB has many
......@@ -88,7 +89,7 @@ class HybridRelationsTest extends TestCase
$this->assertInstanceOf(MySqlConnection::class, $otherUser->getConnection());
//MySql User
$user->name = "John Doe";
$user->name = 'John Doe';
$user->id = 2;
$user->save();
// Other user
......@@ -142,7 +143,7 @@ class HybridRelationsTest extends TestCase
$this->assertInstanceOf(MySqlConnection::class, $otherUser->getConnection());
//MySql User
$user->name = "John Doe";
$user->name = 'John Doe';
$user->id = 2;
$user->save();
// Other user
......
<?php
declare(strict_types=1);
use Carbon\Carbon;
......
<?php
declare(strict_types=1);
use Illuminate\Support\Facades\Date;
......@@ -545,22 +546,22 @@ class QueryBuilderTest extends TestCase
public function testDates()
{
DB::collection('users')->insert([
['name' => 'John Doe', 'birthday' => new UTCDateTime(Date::parse("1980-01-01 00:00:00")->format('Uv'))],
['name' => 'Jane Doe', 'birthday' => new UTCDateTime(Date::parse("1981-01-01 00:00:00")->format('Uv'))],
['name' => 'Robert Roe', 'birthday' => new UTCDateTime(Date::parse("1982-01-01 00:00:00")->format('Uv'))],
['name' => 'Mark Moe', 'birthday' => new UTCDateTime(Date::parse("1983-01-01 00:00:00")->format('Uv'))],
['name' => 'John Doe', 'birthday' => new UTCDateTime(Date::parse('1980-01-01 00:00:00')->format('Uv'))],
['name' => 'Jane Doe', 'birthday' => new UTCDateTime(Date::parse('1981-01-01 00:00:00')->format('Uv'))],
['name' => 'Robert Roe', 'birthday' => new UTCDateTime(Date::parse('1982-01-01 00:00:00')->format('Uv'))],
['name' => 'Mark Moe', 'birthday' => new UTCDateTime(Date::parse('1983-01-01 00:00:00')->format('Uv'))],
]);
$user = DB::collection('users')
->where('birthday', new UTCDateTime(Date::parse("1980-01-01 00:00:00")->format('Uv')))
->where('birthday', new UTCDateTime(Date::parse('1980-01-01 00:00:00')->format('Uv')))
->first();
$this->assertEquals('John Doe', $user['name']);
$user = DB::collection('users')->where('birthday', '=', new DateTime("1980-01-01 00:00:00"))->first();
$user = DB::collection('users')->where('birthday', '=', new DateTime('1980-01-01 00:00:00'))->first();
$this->assertEquals('John Doe', $user['name']);
$start = new UTCDateTime(1000 * strtotime("1981-01-01 00:00:00"));
$stop = new UTCDateTime(1000 * strtotime("1982-01-01 00:00:00"));
$start = new UTCDateTime(1000 * strtotime('1981-01-01 00:00:00'));
$stop = new UTCDateTime(1000 * strtotime('1982-01-01 00:00:00'));
$users = DB::collection('users')->whereBetween('birthday', [$start, $stop])->get();
$this->assertCount(2, $users);
......@@ -623,11 +624,11 @@ class QueryBuilderTest extends TestCase
$results = DB::collection('items')->where('tags', 'size', 4)->get();
$this->assertCount(1, $results);
$regex = new Regex(".*doe", "i");
$regex = new Regex('.*doe', 'i');
$results = DB::collection('users')->where('name', 'regex', $regex)->get();
$this->assertCount(2, $results);
$regex = new Regex(".*doe", "i");
$regex = new Regex('.*doe', 'i');
$results = DB::collection('users')->where('name', 'regexp', $regex)->get();
$this->assertCount(2, $results);
......
<?php
declare(strict_types=1);
class QueryTest extends TestCase
......
<?php
declare(strict_types=1);
use Carbon\Carbon;
......
<?php
declare(strict_types=1);
use Illuminate\Database\Eloquent\Collection;
......
<?php
declare(strict_types=1);
use Jenssegers\Mongodb\Schema\Blueprint;
......
<?php
declare(strict_types=1);
class SeederTest extends TestCase
......
<?php
declare(strict_types=1);
use Illuminate\Auth\Passwords\PasswordResetServiceProvider;
......
<?php
declare(strict_types=1);
class ValidationTest extends TestCase
......
......@@ -23,7 +23,7 @@ return [
'dsn_mongodb_db' => [
'driver' => 'mongodb',
'dsn' => "mongodb://$mongoHost:$mongoPort/" . env('MONGO_DATABASE', 'unittest'),
'dsn' => "mongodb://$mongoHost:$mongoPort/".env('MONGO_DATABASE', 'unittest'),
],
'mysql' => [
......
<?php
declare(strict_types=1);
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
......
<?php
declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
/**
* Class Book
* Class Book.
* @property string $title
* @property string $author
* @property array $chapters
......
<?php
declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
......
<?php
declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
......
<?php
declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\BelongsTo;
......@@ -6,7 +7,7 @@ use Jenssegers\Mongodb\Eloquent\Builder;
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
/**
* Class Item
* Class Item.
* @property \Carbon\Carbon $created_at
*/
class Item extends Eloquent
......
<?php
declare(strict_types=1);
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
......
<?php
declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\BelongsTo;
......@@ -28,7 +29,7 @@ class MysqlBook extends Eloquent
/** @var \Illuminate\Database\Schema\MySqlBuilder $schema */
$schema = Schema::connection('mysql');
if (!$schema->hasTable('books')) {
if (! $schema->hasTable('books')) {
Schema::connection('mysql')->create('books', function (Blueprint $table) {
$table->string('title');
$table->string('author_id')->nullable();
......
<?php
declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\BelongsTo;
......@@ -32,7 +33,7 @@ class MysqlRole extends Eloquent
/** @var \Illuminate\Database\Schema\MySqlBuilder $schema */
$schema = Schema::connection('mysql');
if (!$schema->hasTable('roles')) {
if (! $schema->hasTable('roles')) {
Schema::connection('mysql')->create('roles', function (Blueprint $table) {
$table->string('type');
$table->string('user_id');
......
<?php
declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\HasMany;
......@@ -38,7 +39,7 @@ class MysqlUser extends Eloquent
/** @var \Illuminate\Database\Schema\MySqlBuilder $schema */
$schema = Schema::connection('mysql');
if (!$schema->hasTable('users')) {
if (! $schema->hasTable('users')) {
Schema::connection('mysql')->create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
......
<?php
declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\MorphTo;
......
<?php
declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\BelongsTo;
......
<?php
declare(strict_types=1);
use Jenssegers\Mongodb\Eloquent\Builder;
......
<?php
declare(strict_types=1);
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
use Jenssegers\Mongodb\Eloquent\SoftDeletes;
/**
* Class Soft
* Class Soft.
* @property \Carbon\Carbon $deleted_at
*/
class Soft extends Eloquent
......
<?php
declare(strict_types=1);
use Illuminate\Auth\Authenticatable;
......@@ -10,7 +11,7 @@ use Jenssegers\Mongodb\Eloquent\HybridRelations;
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
/**
* Class User
* Class User.
* @property string $_id
* @property string $name
* @property string $title
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment