Skip to content

Commit

Permalink
Merge pull request #267 from analogueorm/analysis-8mGOrp
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
RemiCollin authored May 29, 2018
2 parents 9806b45 + ccc862e commit e524849
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/System/Proxies/CollectionProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -840,13 +840,14 @@ public function pop()
*/
public function prepend($value, $key = null)
{
if(! $this->relationshipLoaded) {
if (!$this->relationshipLoaded) {
$key
? $this->prependedItems[$key] = $value
: $this->prependedItems[] = $value;

return $this;
}

return parent::prepend($value, $key);
}

Expand All @@ -855,8 +856,9 @@ public function prepend($value, $key = null)
*/
public function push($value)
{
if(! $this->relationshipLoaded) {
if (!$this->relationshipLoaded) {
$this->pushedItems[] = $value;

return $this;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/cases/CollectionProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function pushed_items_are_stored_if_relationship_is_loaded_after_push()
$this->assertCount(1, $user->groups->getAddedItems());
$user->groups->initializeProxy();
$this->assertTrue($user->groups->isProxyInitialized());

mapper(User::class)->store($user);
$this->assertDatabaseHas('groups', [
'name' => 'added-test',
Expand Down Expand Up @@ -185,7 +185,7 @@ public function we_can_remove_from_a_collection_proxy_without_loading_it()
protected function createRelatedSet($relatedCount = 1)
{
$userId = $this->insertUser();
for ($x = 0; $x <= $relatedCount - 1 ; $x++) {
for ($x = 0; $x <= $relatedCount - 1; $x++) {
$groupId = $this->rawInsert('groups', [
'id' => $this->randId(),
'name' => $this->faker()->sentence,
Expand Down

0 comments on commit e524849

Please sign in to comment.