Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
AnourValar committed Sep 7, 2019
1 parent a16ab89 commit 6051c37
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 139 deletions.
4 changes: 2 additions & 2 deletions src/Console/Commands/ModelMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ class ModelMakeCommand extends \Illuminate\Foundation\Console\ModelMakeCommand
* @var string
*/
protected $name = 'make:model-validation';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Create a new Eloquent model class [eloquent-validation]';

/**
* {@inheritDoc}
* @see \Illuminate\Foundation\Console\ModelMakeCommand::getStub()
Expand Down
14 changes: 7 additions & 7 deletions src/Exceptions/ValidationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ValidationException extends \Illuminate\Validation\ValidationException
* @var int
*/
public $status = 400;

/**
* @param mixed $errors
* @param mixed $response
Expand All @@ -20,7 +20,7 @@ class ValidationException extends \Illuminate\Validation\ValidationException
public function __construct($errors, $response = null, $errorBag = 'default', $prefix = null)
{
$prefix = $this->canonizePrefix($prefix);

if ($errors instanceof \Illuminate\Validation\Validator) {
if (is_null($prefix)) {
$validator = $errors;
Expand All @@ -36,15 +36,15 @@ public function __construct($errors, $response = null, $errorBag = 'default', $p
if (is_scalar($errors)) {
$errors = ['error' => $errors];
}

$validator = \Validator::make([], []);
foreach ($errors as $key => $items) {
foreach ((array)$items as $item) {
$validator->errors()->add($prefix.$key, $item);
}
}
}

parent::__construct($validator, $response, $errorBag);
}

Expand All @@ -57,19 +57,19 @@ protected function canonizePrefix($prefix)
if (! is_iterable($prefix)) {
return $prefix;
}

foreach ($prefix as $key => $item) {
if (!is_scalar($item) || !mb_strlen($item)) {
unset($prefix[$key]);
}
}

if ($prefix) {
$prefix = implode('.', $prefix) . '.';
} else {
$prefix = null;
}

return $prefix;
}
}
Loading

0 comments on commit 6051c37

Please sign in to comment.