Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
vinicius73 committed Jan 16, 2016
1 parent 9157d33 commit 702b8ad
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
8 changes: 4 additions & 4 deletions src/BaseRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down
39 changes: 20 additions & 19 deletions src/Fractal/FractalFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -65,7 +65,7 @@ protected function isPaged($collection)
}

/**
* @param ArrayAccess $collection
* @param ArrayAccess $collection
* @param TransformerAbstract $transform
*
* @return FractalCollection
Expand All @@ -76,7 +76,7 @@ protected function makeFractalCollection(ArrayAccess $collection, TransformerAbs
}

/**
* @param ArrayAccess $item
* @param ArrayAccess $item
* @param TransformerAbstract $transform
*
* @return FractalItem
Expand All @@ -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;
}
}

/**
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 702b8ad

Please sign in to comment.