src/File/Validation/AbstractRule.php
final public function applyRule($parameterName, $value, $itemType = false)
    {
        $test = $this->testConditions($parameterName, $value, $itemType);
        if (!empty($test)) {
            $message = $this->exceptionMessageOnTestFailure($parameterName, $value, $itemType);
            $this->getMethod()
                ->addChild($this->validationRuleComment($value))
                ->addChild(sprintf('if (%s) {', $test))
                ->addChild($this->getMethod()->getIndentedString(sprintf('throw new \InvalidArgumentException(%s, __LINE__);', $message), 1))
                ->addChild('}');
            unset($message);
            Rules::ruleHasBeenAppliedToAttribute($this, $value, $this->getAttribute());
        }
        unset($test);
    }
final public function applyRule($parameterName, $value, $itemType = false)
    {
        $test = $this->testConditions($parameterName, $value, $itemType);
        if (!empty($test)) {
            $message = $this->exceptionMessageOnTestFailure($parameterName, $value, $itemType);
            $this->getMethod()
                ->addChild($this->validationRuleComment($value))
                ->addChild(sprintf('if (%s) {', $test))
                ->addChild($this->getMethod()->getIndentedString(sprintf('throw new \InvalidArgumentException(%s, __LINE__);', $message), 1))
                ->addChild('}');
            unset($message);
            Rules::ruleHasBeenAppliedToAttribute($this, $value, $this->getAttribute());
        }
        unset($test);
    }
final public function applyRule ( $ parameterName , $ value , $ itemType = false ) { $ test = $ this -> testConditions ( $ parameterName , $ value , $ itemType ) ; if ( ! empty ( $ test ) ) { $ message = $ this -> exceptionMessageOnTestFailure ( $ parameterName , $ value , $ itemType ) ; $ this -> getMethod ( ) -> addChild ( $ this -> validationRuleComment ( $ value ) ) -> addChild ( sprintf ( 'if (%s) {' , $ test ) ) -> addChild ( $ this -> getMethod ( ) -> getIndentedString ( sprintf ( 'throw new \InvalidArgumentException(%s, __LINE__);' , $ message ) , 1 ) ) -> addChild ( '}' ) ; unset ( $ message ) ; Rules :: ruleHasBeenAppliedToAttribute ( $ this , $ value , $ this -> getAttribute ( ) ) ; } unset ( $ test ) ; }
This method has to add the validation rule to the method's body
@param string $parameterName
@param string|string[] $value
@param bool $itemType
@return AbstractRule
This method has to add the validation rule to the method s body