Skip to content

Commit 577678e

Browse files
jenssegersStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent e481661 commit 577678e

File tree

8 files changed

+24
-24
lines changed

8 files changed

+24
-24
lines changed

src/Jenssegers/Mongodb/Collection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __call($method, $parameters)
5555
// Convert the query parameters to a json string.
5656
array_walk_recursive($parameters, function (&$item, $key) {
5757
if ($item instanceof ObjectID) {
58-
$item = (string)$item;
58+
$item = (string) $item;
5959
}
6060
});
6161

src/Jenssegers/Mongodb/Eloquent/Builder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ public function raw($expression = null)
160160
elseif ($results instanceof BSONDocument) {
161161
$results = $results->getArrayCopy();
162162

163-
return $this->model->newFromBuilder((array)$results);
163+
return $this->model->newFromBuilder((array) $results);
164164
} // The result is a single object.
165165
elseif (is_array($results) and array_key_exists('_id', $results)) {
166-
return $this->model->newFromBuilder((array)$results);
166+
return $this->model->newFromBuilder((array) $results);
167167
}
168168

169169
return $results;

src/Jenssegers/Mongodb/Eloquent/Model.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function getIdAttribute($value = null)
5252

5353
// Convert ObjectID to string.
5454
if ($value instanceof ObjectID) {
55-
return (string)$value;
55+
return (string) $value;
5656
}
5757

5858
return $value;
@@ -193,14 +193,14 @@ public function attributesToArray()
193193
// nicely when your models are converted to JSON.
194194
foreach ($attributes as $key => &$value) {
195195
if ($value instanceof ObjectID) {
196-
$value = (string)$value;
196+
$value = (string) $value;
197197
}
198198
}
199199

200200
// Convert dot-notation dates.
201201
foreach ($this->getDates() as $key) {
202202
if (str_contains($key, '.') and array_has($attributes, $key)) {
203-
array_set($attributes, $key, (string)$this->asDateTime(array_get($attributes, $key)));
203+
array_set($attributes, $key, (string) $this->asDateTime(array_get($attributes, $key)));
204204
}
205205
}
206206

src/Jenssegers/Mongodb/Helpers/QueriesRelationships.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ protected function getHasCompareKey($relation)
137137
protected function getConstrainedRelatedIds($relations, $operator, $count)
138138
{
139139
$relationCount = array_count_values(array_map(function ($id) {
140-
return (string)$id; // Convert Back ObjectIds to Strings
140+
return (string) $id; // Convert Back ObjectIds to Strings
141141
}, is_array($relations) ? $relations : $relations->flatten()->toArray()));
142142
// Remove unwanted related objects based on the operator and count.
143143
$relationCount = array_filter($relationCount, function ($counted) use ($count, $operator) {

src/Jenssegers/Mongodb/Query/Builder.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ public function aggregate($function, $columns = [])
444444
$this->bindings['select'] = $previousSelectBindings;
445445

446446
if (isset($results[0])) {
447-
$result = (array)$results[0];
447+
$result = (array) $results[0];
448448

449449
return $result['aggregate'];
450450
}
@@ -537,7 +537,7 @@ public function insert(array $values)
537537
// Batch insert
538538
$result = $this->collection->insertMany($values);
539539

540-
return (1 == (int)$result->isAcknowledged());
540+
return (1 == (int) $result->isAcknowledged());
541541
}
542542

543543
/**
@@ -547,7 +547,7 @@ public function insertGetId(array $values, $sequence = null)
547547
{
548548
$result = $this->collection->insertOne($values);
549549

550-
if (1 == (int)$result->isAcknowledged()) {
550+
if (1 == (int) $result->isAcknowledged()) {
551551
if (is_null($sequence)) {
552552
$sequence = '_id';
553553
}
@@ -609,7 +609,7 @@ public function pluck($column, $key = null)
609609
// Convert ObjectID's to strings
610610
if ($key == '_id') {
611611
$results = $results->map(function ($item) {
612-
$item['_id'] = (string)$item['_id'];
612+
$item['_id'] = (string) $item['_id'];
613613
return $item;
614614
});
615615
}
@@ -632,7 +632,7 @@ public function delete($id = null)
632632

633633
$wheres = $this->compileWheres();
634634
$result = $this->collection->DeleteMany($wheres);
635-
if (1 == (int)$result->isAcknowledged()) {
635+
if (1 == (int) $result->isAcknowledged()) {
636636
return $result->getDeletedCount();
637637
}
638638

@@ -658,7 +658,7 @@ public function truncate()
658658
{
659659
$result = $this->collection->drop();
660660

661-
return (1 == (int)$result->ok);
661+
return (1 == (int) $result->ok);
662662
}
663663

664664
/**
@@ -789,7 +789,7 @@ protected function performUpdate($query, array $options = [])
789789

790790
$wheres = $this->compileWheres();
791791
$result = $this->collection->UpdateMany($wheres, $query, $options);
792-
if (1 == (int)$result->isAcknowledged()) {
792+
if (1 == (int) $result->isAcknowledged()) {
793793
return $result->getModifiedCount() ? $result->getModifiedCount() : $result->getUpsertedCount();
794794
}
795795

src/Jenssegers/Mongodb/Queue/Failed/MongoFailedJobProvider.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function all()
3333
$all = $this->getTable()->orderBy('_id', 'desc')->get()->all();
3434

3535
$all = array_map(function ($job) {
36-
$job['id'] = (string)$job['_id'];
36+
$job['id'] = (string) $job['_id'];
3737
return $job;
3838
}, $all);
3939

@@ -50,7 +50,7 @@ public function find($id)
5050
{
5151
$job = $this->getTable()->find($id);
5252

53-
$job['id'] = (string)$job['_id'];
53+
$job['id'] = (string) $job['_id'];
5454

5555
return $job;
5656
}

src/Jenssegers/Mongodb/Relations/BelongsToMany.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ public function sync($ids, $detaching = true)
146146
if ($detaching and count($detach) > 0) {
147147
$this->detach($detach);
148148

149-
$changes['detached'] = (array)array_map(function ($v) {
150-
return is_numeric($v) ? (int)$v : (string)$v;
149+
$changes['detached'] = (array) array_map(function ($v) {
150+
return is_numeric($v) ? (int) $v : (string) $v;
151151
}, $detach);
152152
}
153153

@@ -192,14 +192,14 @@ public function attach($id, array $attributes = [], $touch = true)
192192

193193
$query = $this->newRelatedQuery();
194194

195-
$query->whereIn($this->related->getKeyName(), (array)$id);
195+
$query->whereIn($this->related->getKeyName(), (array) $id);
196196

197197
// Attach the new parent id to the related model.
198198
$query->push($this->foreignKey, $this->parent->getKey(), true);
199199
}
200200

201201
// Attach the new ids to the parent model.
202-
$this->parent->push($this->getRelatedKey(), (array)$id, true);
202+
$this->parent->push($this->getRelatedKey(), (array) $id, true);
203203

204204
if ($touch) {
205205
$this->touchIfTouching();
@@ -212,15 +212,15 @@ public function attach($id, array $attributes = [], $touch = true)
212212
public function detach($ids = [], $touch = true)
213213
{
214214
if ($ids instanceof Model) {
215-
$ids = (array)$ids->getKey();
215+
$ids = (array) $ids->getKey();
216216
}
217217

218218
$query = $this->newRelatedQuery();
219219

220220
// If associated IDs were passed to the method we will only delete those
221221
// associations, otherwise all of the association ties will be broken.
222222
// We'll return the numbers of affected rows when we do the deletes.
223-
$ids = (array)$ids;
223+
$ids = (array) $ids;
224224

225225
// Detach all ids from the parent model.
226226
$this->parent->pull($this->getRelatedKey(), $ids);

src/Jenssegers/Mongodb/Relations/EmbedsOneOrMany.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ protected function getEmbedded()
210210
$attributes = $this->parent->getAttributes();
211211

212212
// Get embedded models form parent attributes.
213-
$embedded = isset($attributes[$this->localKey]) ? (array)$attributes[$this->localKey] : null;
213+
$embedded = isset($attributes[$this->localKey]) ? (array) $attributes[$this->localKey] : null;
214214

215215
return $embedded;
216216
}
@@ -280,7 +280,7 @@ protected function toModel($attributes = [])
280280
return;
281281
}
282282

283-
$model = $this->related->newFromBuilder((array)$attributes);
283+
$model = $this->related->newFromBuilder((array) $attributes);
284284

285285
$model->setParentRelation($this);
286286

0 commit comments

Comments
 (0)