public function setContext($context = null)
    {
        if ($context === null) {
            return $this;
        }
        if (is_array($context)) {
            $context = new ArrayWrapper($context);
        }
        if (! is_object($context) || ! $context instanceof WrapperInterface) {
            throw new \InvalidArgumentException(
                'Validator context must be either an array or an instance
                of Sirius\Validator\DataWrapper\WrapperInterface'
            );
        }
        $this->context = $context;

        return $this;
    }
public function setContext($context = null)
    {
        if ($context === null) {
            return $this;
        }
        if (is_array($context)) {
            $context = new ArrayWrapper($context);
        }
        if (! is_object($context) || ! $context instanceof WrapperInterface) {
            throw new \InvalidArgumentException(
                'Validator context must be either an array or an instance
                of Sirius\Validator\DataWrapper\WrapperInterface'
            );
        }
        $this->context = $context;

        return $this;
    }
public function setContext ( $ context = null ) { if ( $ context === null ) { return $ this ; } if ( is_array ( $ context ) ) { $ context = new ArrayWrapper ( $ context ) ; } if ( ! is_object ( $ context ) || ! $ context instanceof WrapperInterface ) { throw new \ InvalidArgumentException ( 'Validator context must be either an array or an instance
                of Sirius\Validator\DataWrapper\WrapperInterface' ) ; } $ this -> context = $ context ; return $ this ; }
The context of the validator can be used when the validator depends on other values
that are not known at the moment the validator is constructed
For example, when you need to validate an email field matches another email field,
to confirm the email address

@param array|object $context

@throws \InvalidArgumentException
@return \Sirius\Validation\Rule\AbstractRule
The context of the validator can be used when the validator depends on other values that are not known at the moment the validator is constructed For example when you need to validate an email field matches another email field to confirm the email address