public function addValidator(Validator $validator) : Component
    {
        $hash = spl_object_hash($validator);
        $this->validators[$hash] = $validator;

        return $this;
    }
public function addValidator(Validator $validator) : Component
    {
        $hash = spl_object_hash($validator);
        $this->validators[$hash] = $validator;

        return $this;
    }
public function addValidator ( Validator $ validator ) : Component { $ hash = spl_object_hash ( $ validator ) ; $ this -> validators [ $ hash ] = $ validator ; return $ this ; }
Adds a validator.

Adding twice the same instance of a validator has no effect.

@param Validator $validator

@return static
Adds a validator .