Skip to content

Commit

Permalink
style patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Redjik committed Jul 20, 2015
1 parent 1373543 commit c965b7f
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 21 deletions.
4 changes: 2 additions & 2 deletions api/app/Exceptions/ValidationExceptionCollection.php
Expand Up @@ -43,9 +43,9 @@ public function getResponse()
{
$responses = [];
foreach ($this->exceptions as $exception) {
if (!is_null($exception)){
if (!is_null($exception)) {
$responses[] = $exception->getResponse();
}else{
} else {
$responses[] = null;
}
}
Expand Down
10 changes: 5 additions & 5 deletions api/app/Http/Controllers/ApiController.php
Expand Up @@ -109,7 +109,7 @@ public function putMany(Request $request)

$ids = $this->getIds($requestCollection, false);
$models = [];
if (!empty($ids)){
if (!empty($ids)) {
$models = $this->getRepository()->findMany($ids);
}

Expand Down Expand Up @@ -245,7 +245,7 @@ protected function getIds($entityCollection)
$errors = [];
$error = false;
foreach ($entityCollection as $requestEntity) {
if (isset($requestEntity[$this->getKeyName()]) && $requestEntity[$this->getKeyName()]){
if (isset($requestEntity[$this->getKeyName()]) && $requestEntity[$this->getKeyName()]) {
try {
$id = $requestEntity[$this->getKeyName()];
$this->validateId($id);
Expand All @@ -255,7 +255,7 @@ protected function getIds($entityCollection)
$error = true;
$errors[] = $e->getErrors();
}
}else{
} else {
$errors[] = null;
}
}
Expand All @@ -272,8 +272,8 @@ protected function getIds($entityCollection)
*/
protected function validateId($id)
{
$validation = $this->getValidationFactory()->make([$this->getKeyName()=>$id],[$this->getKeyName()=>'uuid']);
if ($validation->fails()){
$validation = $this->getValidationFactory()->make([$this->getKeyName()=>$id], [$this->getKeyName()=>'uuid']);
if ($validation->fails()) {
throw new ValidationException($validation->getMessageBag());
}
}
Expand Down
9 changes: 3 additions & 6 deletions api/app/Http/Responder/Responder.php
Expand Up @@ -8,7 +8,6 @@

namespace App\Http\Responder;


use Spira\Repository\Model\BaseModel;
use Spira\Responder\Responder\ApiResponder;

Expand All @@ -21,9 +20,8 @@ class Responder extends ApiResponder
*/
public function createdCollection($items, array $parameters = [])
{
foreach ($items as $item)
{
$item->setVisible(['']);
foreach ($items as $item) {
$item->setVisible(['']);
}

return parent::createdCollection($items, $parameters);
Expand All @@ -39,5 +37,4 @@ public function createdItem($item, array $parameters = [])
$item->setVisible(['']);
return parent::createdItem($item, $parameters);
}

}
}
2 changes: 1 addition & 1 deletion api/app/Http/Transformers/BaseTransformer.php
Expand Up @@ -37,7 +37,7 @@ public function getService()
*/
public function transformCollection($collection)
{
if ($collection instanceof Collection){
if ($collection instanceof Collection) {
$collection = $collection->all();
}

Expand Down
1 change: 0 additions & 1 deletion api/app/Http/Transformers/IlluminateModelTransformer.php
Expand Up @@ -138,5 +138,4 @@ protected function renameKeys(array $array)

return $newArray;
}

}
1 change: 0 additions & 1 deletion api/app/Models/SecondTestEntity.php
Expand Up @@ -15,5 +15,4 @@ class SecondTestEntity extends BaseModel
protected $primaryKey = 'entity_id';

public $timestamps = false;

}
1 change: 0 additions & 1 deletion api/app/Models/User.php
Expand Up @@ -95,5 +95,4 @@ public function getRememberTokenName()
{
// TODO: Implement getRememberTokenName() method.
}

}
1 change: 0 additions & 1 deletion api/src/Repository/Model/BaseModel.php
Expand Up @@ -48,7 +48,6 @@ class BaseModel extends Model
public function __set($key, $value)
{
if (method_exists($this, $key)) {

$value = $this->prepareValue($value);

if ($value !== false) {
Expand Down
6 changes: 3 additions & 3 deletions api/src/Responder/Responder/ApiResponder.php
Expand Up @@ -91,7 +91,7 @@ public function item($item, array $parameters = [])
*/
public function createdCollection($items, array $parameters = [])
{
return $this->collectionWithStatusCode($items,201);
return $this->collectionWithStatusCode($items, 201);
}

/**
Expand All @@ -104,7 +104,7 @@ public function createdCollection($items, array $parameters = [])
*/
public function createdItem($item, array $parameters = [])
{
return $this->itemWithStatusCode($item,201);
return $this->itemWithStatusCode($item, 201);
}

/**
Expand Down Expand Up @@ -172,6 +172,6 @@ protected function encode($data)
{
$debug = env('APP_DEBUG', false);
$prettyPrint = $debug?JSON_PRETTY_PRINT:0;
return json_encode($data,$prettyPrint);
return json_encode($data, $prettyPrint);
}
}

0 comments on commit c965b7f

Please sign in to comment.