From 702b8adcaa37cd95131d14cf452465782f890a03 Mon Sep 17 00:00:00 2001 From: Vinicius Reis Date: Sat, 16 Jan 2016 04:09:38 -0200 Subject: [PATCH] fix code style --- src/BaseRepository.php | 8 +++---- src/Fractal/FractalFactory.php | 39 +++++++++++++++++----------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/BaseRepository.php b/src/BaseRepository.php index 49d976a..1f482ad 100644 --- a/src/BaseRepository.php +++ b/src/BaseRepository.php @@ -31,9 +31,9 @@ protected function doQuery($query = null, $take = 15, $paginate = true) $query = $this->newQuery(); } - if (true == $paginate): + if (true == $paginate) { return $query->paginate($take); - endif; + } if ($take > 0 || false == $take) { $query->take($take); @@ -87,9 +87,9 @@ public function lists($column, $key = null) */ public function findByID($id, $fail = true) { - if ($fail): + if ($fail) { return $this->newQuery()->findOrFail($id); - endif; + } return $this->newQuery()->find($id); } diff --git a/src/Fractal/FractalFactory.php b/src/Fractal/FractalFactory.php index 4f1135c..f256cc7 100644 --- a/src/Fractal/FractalFactory.php +++ b/src/Fractal/FractalFactory.php @@ -43,8 +43,8 @@ class FractalFactory implements FractalFactoryContract /** * FractalFactory constructor. * - * @param Request $request - * @param Container $app + * @param Request $request + * @param Container $app * @param ResponseFactory $response */ public function __construct(Request $request, Container $app, ResponseFactory $response) @@ -65,7 +65,7 @@ protected function isPaged($collection) } /** - * @param ArrayAccess $collection + * @param ArrayAccess $collection * @param TransformerAbstract $transform * * @return FractalCollection @@ -76,7 +76,7 @@ protected function makeFractalCollection(ArrayAccess $collection, TransformerAbs } /** - * @param ArrayAccess $item + * @param ArrayAccess $item * @param TransformerAbstract $transform * * @return FractalItem @@ -91,34 +91,35 @@ protected function makeFractalItem(ArrayAccess $item, TransformerAbstract $trans */ protected function getFractalFactory() { - if (!$this->fractal): + if (!$this->fractal) { $this->fractal = new LeagueFractalFactory(); - $serializer = $this->app['config']->get('warehouse.fractal.serializer', null); + $serializer = $this->app['config']->get('warehouse.fractal.serializer', null); - if (!empty($serializer)) { - $this->fractal->setSerializer($this->app->make($serializer)); + if (!empty($serializer)) { + $this->fractal->setSerializer($this->app->make($serializer)); + } } - endif; return $this->fractal; } /** * @param ResourceAbstract $resource - * @param string $key - * @param string|null $value + * @param string $key + * @param string|null $value * * @return void */ protected function addFractalMeta(ResourceAbstract $resource, $key, $value = null) { - if (is_array($key)): - foreach ($key as $k => $v): + if (is_array($key)) { + foreach ($key as $k => $v) { $resource->setMetaValue($k, $v); - endforeach; else: + } + } else { $resource->setMetaValue($key, $value); - endif; + } } /** @@ -208,8 +209,8 @@ public function makeEmptyResponse(array $metas = []) } /** - * @param ArrayAccess $item - * @param array $meta + * @param ArrayAccess $item + * @param array $meta * @param TransformerAbstract $transformer * * @return \Illuminate\Http\JsonResponse @@ -230,8 +231,8 @@ public function makeItemResponse(ArrayAccess $item, array $meta = [], Transforme } /** - * @param ArrayAccess $collection - * @param array $meta + * @param ArrayAccess $collection + * @param array $meta * @param TransformerAbstract|null $transformer * * @return \Illuminate\Http\JsonResponse