From 7b44dd68a3a5a80395243bff26101a96addbb291 Mon Sep 17 00:00:00 2001 From: Zak Henry Date: Fri, 4 Sep 2015 00:44:43 -0400 Subject: [PATCH] Applied fixes from StyleCI --- api/app/Services/ModelFactoryInstance.php | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/api/app/Services/ModelFactoryInstance.php b/api/app/Services/ModelFactoryInstance.php index 0cbd52ad..84229c69 100644 --- a/api/app/Services/ModelFactoryInstance.php +++ b/api/app/Services/ModelFactoryInstance.php @@ -169,7 +169,6 @@ public function setCollection(Collection $collection) */ private function built() { - $entities = $this->getPredefinedOrMocks(); $this->setEntityType(); @@ -221,7 +220,7 @@ private function modifyEntity(BaseModel $entity) $entity->setHidden($newHidden); } - if($this->customizations){ + if ($this->customizations) { foreach ($this->customizations as $key => $value) { $entity->{$key} = $value; } @@ -265,7 +264,6 @@ public function modified() */ public function transformed() { - $entity = $this->modified(); if (!$this->transformer) { @@ -356,7 +354,7 @@ public function create(array $attributes = []) */ private function getModelMock($count = 1) { - if (is_null($this->factoryInstance)){ + if (is_null($this->factoryInstance)) { throw new \LogicException("No factory class passed to model factory, cannot generate a mock"); } @@ -373,17 +371,14 @@ private function getModelMock($count = 1) private function getPredefinedOrMocks() { if ($this->entityCount > 1) { - $collection = new Collection(); if ($this->predefinedEntities) { - if ($this->predefinedEntities instanceof Collection) { $collection = $collection->merge($this->predefinedEntities->random($this->entityCount)); - }else{ + } else { $collection->push($this->predefinedEntities); } - } if ($collection->count() < $this->entityCount) { @@ -391,21 +386,16 @@ private function getPredefinedOrMocks() } return $collection; - } else { - - if ($this->predefinedEntities){ - + if ($this->predefinedEntities) { if ($this->predefinedEntities instanceof Collection) { return $this->predefinedEntities->random(); - }else{ + } else { return $this->predefinedEntities; } - } return $this->getModelMock(); - } } }