Skip to content

Commit e481661

Browse files
committed
Style fixes
1 parent 7a85d92 commit e481661

33 files changed

+236
-172
lines changed

src/Jenssegers/Mongodb/Auth/DatabaseTokenRepository.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php namespace Jenssegers\Mongodb\Auth;
1+
<?php
2+
3+
namespace Jenssegers\Mongodb\Auth;
24

35
use DateTime;
46
use DateTimeZone;

src/Jenssegers/Mongodb/Auth/PasswordResetServiceProvider.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php namespace Jenssegers\Mongodb\Auth;
1+
<?php
2+
3+
namespace Jenssegers\Mongodb\Auth;
24

35
use Illuminate\Auth\Passwords\PasswordResetServiceProvider as BasePasswordResetServiceProvider;
46

src/Jenssegers/Mongodb/Auth/User.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
<?php namespace Jenssegers\Mongodb\Auth;
1+
<?php
2+
3+
namespace Jenssegers\Mongodb\Auth;
24

35
use Illuminate\Auth\Authenticatable;
4-
use Jenssegers\Mongodb\Eloquent\Model as Model;
56
use Illuminate\Auth\Passwords\CanResetPassword;
6-
use Illuminate\Foundation\Auth\Access\Authorizable;
7-
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
87
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
8+
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
99
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
10+
use Illuminate\Foundation\Auth\Access\Authorizable;
11+
use Jenssegers\Mongodb\Eloquent\Model as Model;
1012

1113
class User extends Model implements
1214
AuthenticatableContract,

src/Jenssegers/Mongodb/Collection.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php namespace Jenssegers\Mongodb;
1+
<?php
2+
3+
namespace Jenssegers\Mongodb;
24

35
use Exception;
46
use MongoDB\BSON\ObjectID;
@@ -21,7 +23,7 @@ class Collection
2123
protected $collection;
2224

2325
/**
24-
* @param Connection $connection
26+
* @param Connection $connection
2527
* @param MongoCollection $collection
2628
*/
2729
public function __construct(Connection $connection, MongoCollection $collection)
@@ -34,7 +36,7 @@ public function __construct(Connection $connection, MongoCollection $collection)
3436
* Handle dynamic method calls.
3537
*
3638
* @param string $method
37-
* @param array $parameters
39+
* @param array $parameters
3840
* @return mixed
3941
*/
4042
public function __call($method, $parameters)
@@ -53,7 +55,7 @@ public function __call($method, $parameters)
5355
// Convert the query parameters to a json string.
5456
array_walk_recursive($parameters, function (&$item, $key) {
5557
if ($item instanceof ObjectID) {
56-
$item = (string) $item;
58+
$item = (string)$item;
5759
}
5860
});
5961

@@ -66,7 +68,7 @@ public function __call($method, $parameters)
6668
}
6769
}
6870

69-
$queryString = $this->collection->getCollectionName().'.'.$method.'('.implode(',', $query).')';
71+
$queryString = $this->collection->getCollectionName() . '.' . $method . '(' . implode(',', $query) . ')';
7072

7173
$this->connection->logQuery($queryString, [], $time);
7274
}

src/Jenssegers/Mongodb/Connection.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php namespace Jenssegers\Mongodb;
1+
<?php
2+
3+
namespace Jenssegers\Mongodb;
24

35
use Illuminate\Database\Connection as BaseConnection;
46
use MongoDB\Client;
@@ -114,8 +116,8 @@ public function getMongoClient()
114116
* Create a new MongoDB connection.
115117
*
116118
* @param string $dsn
117-
* @param array $config
118-
* @param array $options
119+
* @param array $config
120+
* @param array $options
119121
* @return \MongoDB\Client
120122
*/
121123
protected function createConnection($dsn, array $config, array $options)
@@ -128,10 +130,10 @@ protected function createConnection($dsn, array $config, array $options)
128130
}
129131

130132
// Check if the credentials are not already set in the options
131-
if (! isset($options['username']) && ! empty($config['username'])) {
133+
if (!isset($options['username']) && !empty($config['username'])) {
132134
$options['username'] = $config['username'];
133135
}
134-
if (! isset($options['password']) && ! empty($config['password'])) {
136+
if (!isset($options['password']) && !empty($config['password'])) {
135137
$options['password'] = $config['password'];
136138
}
137139

@@ -155,7 +157,7 @@ public function disconnect()
155157
protected function getDsn(array $config)
156158
{
157159
// Check if the user passed a complete dsn to the configuration.
158-
if (! empty($config['dsn'])) {
160+
if (!empty($config['dsn'])) {
159161
return $config['dsn'];
160162
}
161163

@@ -164,15 +166,15 @@ protected function getDsn(array $config)
164166

165167
foreach ($hosts as &$host) {
166168
// Check if we need to add a port to the host
167-
if (strpos($host, ':') === false && ! empty($config['port'])) {
168-
$host = $host.':'.$config['port'];
169+
if (strpos($host, ':') === false && !empty($config['port'])) {
170+
$host = $host . ':' . $config['port'];
169171
}
170172
}
171173

172174
// Check if we want to authenticate against a specific database.
173-
$auth_database = isset($config['options']) && ! empty($config['options']['database']) ? $config['options']['database'] : null;
175+
$auth_database = isset($config['options']) && !empty($config['options']['database']) ? $config['options']['database'] : null;
174176

175-
return 'mongodb://'.implode(',', $hosts).($auth_database ? '/'.$auth_database : '');
177+
return 'mongodb://' . implode(',', $hosts) . ($auth_database ? '/' . $auth_database : '');
176178
}
177179

178180
/**
@@ -219,7 +221,7 @@ protected function getDefaultSchemaGrammar()
219221
* Dynamically pass methods to the connection.
220222
*
221223
* @param string $method
222-
* @param array $parameters
224+
* @param array $parameters
223225
* @return mixed
224226
*/
225227
public function __call($method, $parameters)

src/Jenssegers/Mongodb/Eloquent/Builder.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php namespace Jenssegers\Mongodb\Eloquent;
1+
<?php
2+
3+
namespace Jenssegers\Mongodb\Eloquent;
24

35
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
46
use Jenssegers\Mongodb\Helpers\QueriesRelationships;
@@ -8,6 +10,7 @@
810
class Builder extends EloquentBuilder
911
{
1012
use QueriesRelationships;
13+
1114
/**
1215
* The methods that should be returned from query builder.
1316
*
@@ -157,10 +160,10 @@ public function raw($expression = null)
157160
elseif ($results instanceof BSONDocument) {
158161
$results = $results->getArrayCopy();
159162

160-
return $this->model->newFromBuilder((array) $results);
163+
return $this->model->newFromBuilder((array)$results);
161164
} // The result is a single object.
162165
elseif (is_array($results) and array_key_exists('_id', $results)) {
163-
return $this->model->newFromBuilder((array) $results);
166+
return $this->model->newFromBuilder((array)$results);
164167
}
165168

166169
return $results;

src/Jenssegers/Mongodb/Eloquent/EmbedsRelations.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php namespace Jenssegers\Mongodb\Eloquent;
1+
<?php
2+
3+
namespace Jenssegers\Mongodb\Eloquent;
24

35
use Jenssegers\Mongodb\Relations\EmbedsMany;
46
use Jenssegers\Mongodb\Relations\EmbedsOne;

src/Jenssegers/Mongodb/Eloquent/HybridRelations.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php namespace Jenssegers\Mongodb\Eloquent;
1+
<?php
2+
3+
namespace Jenssegers\Mongodb\Eloquent;
24

35
use Illuminate\Database\Eloquent\Relations\MorphMany;
46
use Illuminate\Database\Eloquent\Relations\MorphOne;
@@ -23,7 +25,7 @@ trait HybridRelations
2325
public function hasOne($related, $foreignKey = null, $localKey = null)
2426
{
2527
// Check if it is a relation with an original model.
26-
if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
28+
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
2729
return parent::hasOne($related, $foreignKey, $localKey);
2830
}
2931

@@ -49,7 +51,7 @@ public function hasOne($related, $foreignKey = null, $localKey = null)
4951
public function morphOne($related, $name, $type = null, $id = null, $localKey = null)
5052
{
5153
// Check if it is a relation with an original model.
52-
if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
54+
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
5355
return parent::morphOne($related, $name, $type, $id, $localKey);
5456
}
5557

@@ -73,7 +75,7 @@ public function morphOne($related, $name, $type = null, $id = null, $localKey =
7375
public function hasMany($related, $foreignKey = null, $localKey = null)
7476
{
7577
// Check if it is a relation with an original model.
76-
if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
78+
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
7779
return parent::hasMany($related, $foreignKey, $localKey);
7880
}
7981

@@ -99,7 +101,7 @@ public function hasMany($related, $foreignKey = null, $localKey = null)
99101
public function morphMany($related, $name, $type = null, $id = null, $localKey = null)
100102
{
101103
// Check if it is a relation with an original model.
102-
if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
104+
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
103105
return parent::morphMany($related, $name, $type, $id, $localKey);
104106
}
105107

@@ -138,15 +140,15 @@ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relat
138140
}
139141

140142
// Check if it is a relation with an original model.
141-
if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
143+
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
142144
return parent::belongsTo($related, $foreignKey, $otherKey, $relation);
143145
}
144146

145147
// If no foreign key was supplied, we can use a backtrace to guess the proper
146148
// foreign key name by using the name of the relationship function, which
147149
// when combined with an "_id" should conventionally match the columns.
148150
if (is_null($foreignKey)) {
149-
$foreignKey = Str::snake($relation).'_id';
151+
$foreignKey = Str::snake($relation) . '_id';
150152
}
151153

152154
$instance = new $related;
@@ -225,18 +227,18 @@ public function belongsToMany($related, $collection = null, $foreignKey = null,
225227
}
226228

227229
// Check if it is a relation with an original model.
228-
if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
230+
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
229231
return parent::belongsToMany($related, $collection, $foreignKey, $otherKey, $relation);
230232
}
231233

232234
// First, we'll need to determine the foreign key and "other key" for the
233235
// relationship. Once we have determined the keys we'll make the query
234236
// instances as well as the relationship instances we need for this.
235-
$foreignKey = $foreignKey ?: $this->getForeignKey().'s';
237+
$foreignKey = $foreignKey ?: $this->getForeignKey() . 's';
236238

237239
$instance = new $related;
238240

239-
$otherKey = $otherKey ?: $instance->getForeignKey().'s';
241+
$otherKey = $otherKey ?: $instance->getForeignKey() . 's';
240242

241243
// If no table name was provided, we can guess it by concatenating the two
242244
// models using underscores in alphabetical order. The two model names

0 commit comments

Comments
 (0)