Skip to content

Commit

Permalink
Add Orchestra\Support\Traits\ValidationTrait::getValidationSchemasNam…
Browse files Browse the repository at this point in the history
…e()`.

Signed-off-by: crynobone <[email protected]>
  • Loading branch information
crynobone committed May 26, 2014
1 parent 03dd639 commit e4ff546
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/Support/Traits/ValidationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ trait ValidationTrait
*/
public function onValidationScenario($scenario, array $parameters = [])
{
$on = 'on'.ucfirst($scenario);
$extend = 'extend'.ucfirst($scenario);
list($on, $extend) = $this->getValidationSchemasName($scenario);

$this->validationScenarios = [
'on' => method_exists($this, $on) ? $on : null,
Expand Down Expand Up @@ -182,4 +181,18 @@ public function getValidationRules()
{
return [];
}

/**
* Get validation schemas name.
*
* @param string $scenario
* @return array
*/
protected function getValidationSchemasName($scenario)
{
$on = 'on'.ucfirst($scenario);
$extend = 'extend'.ucfirst($scenario);

return [$on, $extend];
}
}

0 comments on commit e4ff546

Please sign in to comment.