Skip to content

Commit

Permalink
More CS-Fixer formatting, unrelated to the PR
Browse files Browse the repository at this point in the history
  • Loading branch information
RosemaryOrchard committed Aug 25, 2022
1 parent ce693a8 commit 79fad0e
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ public function getIdAttribute($value = null)
{
// 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'];
}

// Convert ObjectID to string.
if ($value instanceof ObjectID) {
return (string) $value;
return (string)$value;
} elseif ($value instanceof Binary) {
return (string) $value->getData();
return (string)$value->getData();
}

return $value;
Expand All @@ -90,7 +90,7 @@ public function fromDateTime($value)
}

// Let Eloquent convert the value to a DateTime instance.
if (! $value instanceof DateTimeInterface) {
if (!$value instanceof DateTimeInterface) {
$value = parent::asDateTime($value);
}

Expand Down Expand Up @@ -145,7 +145,7 @@ public function getTable()
*/
public function getAttribute($key)
{
if (! $key) {
if (!$key) {
return;
}

Expand Down Expand Up @@ -216,16 +216,16 @@ public function attributesToArray()
// nicely when your models are converted to JSON.
foreach ($attributes as $key => &$value) {
if ($value instanceof ObjectID) {
$value = (string) $value;
$value = (string)$value;
} elseif ($value instanceof Binary) {
$value = (string) $value->getData();
$value = (string)$value->getData();
}
}

// Convert dot-notation dates.
foreach ($this->getDates() as $key) {
if (Str::contains($key, '.') && Arr::has($attributes, $key)) {
Arr::set($attributes, $key, (string) $this->asDateTime(Arr::get($attributes, $key)));
Arr::set($attributes, $key, (string)$this->asDateTime(Arr::get($attributes, $key)));
}
}

Expand All @@ -245,7 +245,7 @@ public function getCasts()
*/
public function originalIsEquivalent($key)
{
if (! array_key_exists($key, $this->original)) {
if (!array_key_exists($key, $this->original)) {
return false;
}

Expand Down Expand Up @@ -273,7 +273,7 @@ public function originalIsEquivalent($key)
}

return is_numeric($attribute) && is_numeric($original)
&& strcmp((string) $attribute, (string) $original) === 0;
&& strcmp((string)$attribute, (string)$original) === 0;
}

/**
Expand Down Expand Up @@ -354,7 +354,7 @@ protected function pushAttributeValues($column, array $values, $unique = false)

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;
}

Expand Down Expand Up @@ -396,7 +396,7 @@ protected function pullAttributeValues($column, array $values)
*/
public function getForeignKey()
{
return Str::snake(class_basename($this)).'_'.ltrim($this->primaryKey, '_');
return Str::snake(class_basename($this)) . '_' . ltrim($this->primaryKey, '_');
}

/**
Expand Down Expand Up @@ -461,13 +461,13 @@ public function getQueueableRelations()

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;
}
}
}
Expand Down

0 comments on commit 79fad0e

Please sign in to comment.