Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
awurth committed Aug 8, 2017
1 parent 04363b9 commit b47c78a
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions ValidatorExtension.php
Expand Up @@ -13,18 +13,18 @@
class ValidatorExtension extends Twig_Extension
{
/**
* Validator service.
* Array of names for Twig functions.
*
* @var Validator
* @var array
*/
private $validator;
protected $functionsNames;

/**
* Array of names for Twig functions.
* Validator service.
*
* @var array
* @var Validator
*/
private $functionsNames;
protected $validator;

/**
* Constructor.
Expand All @@ -44,14 +44,6 @@ public function __construct(Validator $validator, $functionsNames = [])
$this->functionsNames['val'] = !empty($functionsNames['val']) ? $functionsNames['val'] : 'val';
}

/**
* {@inheritdoc}
*/
public function getName()
{
return 'validator';
}

/**
* {@inheritdoc}
*/
Expand All @@ -67,6 +59,14 @@ public function getFunctions()
];
}

/**
* {@inheritdoc}
*/
public function getName()
{
return 'validator';
}

/**
* Gets the first validation error of a parameter.
*
Expand Down Expand Up @@ -104,6 +104,18 @@ public function getRuleError($param, $rule)
return $this->validator->getParamRuleError($param, $rule);
}

/**
* Gets the value of a parameter in validated data.
*
* @param string $param
*
* @return string
*/
public function getValue($param)
{
return $this->validator->getValue($param);
}

/**
* Tells if there are validation errors for a parameter.
*
Expand All @@ -125,16 +137,4 @@ public function hasErrors()
{
return !$this->validator->isValid();
}

/**
* Gets the value of a parameter in validated data.
*
* @param string $param
*
* @return string
*/
public function getValue($param)
{
return $this->validator->getValue($param);
}
}

0 comments on commit b47c78a

Please sign in to comment.