From becce6b7520912257c3d72697a3aefec9923a467 Mon Sep 17 00:00:00 2001 From: Sean Molenaar Date: Thu, 29 Nov 2018 20:59:46 +0100 Subject: Define an official codestyle and adhere to it. --- lib/Controller/EntityApiSerializer.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'lib/Controller/EntityApiSerializer.php') diff --git a/lib/Controller/EntityApiSerializer.php b/lib/Controller/EntityApiSerializer.php index f624eb84c..78a9b1031 100644 --- a/lib/Controller/EntityApiSerializer.php +++ b/lib/Controller/EntityApiSerializer.php @@ -13,13 +13,12 @@ namespace OCA\News\Controller; use \OCA\News\Db\IAPI; - class EntityApiSerializer { private $level; - public function __construct($level) + public function __construct($level) { $this->level = $level; } @@ -35,16 +34,16 @@ class EntityApiSerializer * * Response * @return array|mixed */ - public function serialize($data) + public function serialize($data) { - if($data instanceof IAPI) { + if ($data instanceof IAPI) { return [$this->level => [$data->toAPI()]]; } - if(is_array($data) && array_key_exists($this->level, $data)) { + if (is_array($data) && array_key_exists($this->level, $data)) { $data[$this->level] = $this->convert($data[$this->level]); - } elseif(is_array($data)) { + } elseif (is_array($data)) { $data = [$this->level => $this->convert($data)]; } @@ -52,12 +51,12 @@ class EntityApiSerializer } - private function convert($entities) + private function convert($entities) { $converted = []; - foreach($entities as $entity) { - if($entity instanceof IAPI) { + foreach ($entities as $entity) { + if ($entity instanceof IAPI) { $converted[] = $entity->toAPI(); // break if it contains anything else than entities @@ -68,5 +67,4 @@ class EntityApiSerializer return $converted; } - -} \ No newline at end of file +} -- cgit v1.2.3