protected function validate($key, $value)
    {
        $default = $this->get($key);

        if (is_array($default)) {
            $validator = new Validators\ArrayValidator($key, $value);
        } elseif (is_int($default)) {
            $validator = new Validators\IntegerValidator($key, $value);
        } elseif (is_bool($default)) {
            $validator = new Validators\BooleanValidator($key, $value);
        } elseif (class_exists($default)) {
            $validator = new Validators\ClassValidator($key, $value);
        } else {
            $validator = new Validators\StringOrNullValidator($key, $value);
        }

        return $validator->validate();
    }
protected function validate($key, $value)
    {
        $default = $this->get($key);

        if (is_array($default)) {
            $validator = new Validators\ArrayValidator($key, $value);
        } elseif (is_int($default)) {
            $validator = new Validators\IntegerValidator($key, $value);
        } elseif (is_bool($default)) {
            $validator = new Validators\BooleanValidator($key, $value);
        } elseif (class_exists($default)) {
            $validator = new Validators\ClassValidator($key, $value);
        } else {
            $validator = new Validators\StringOrNullValidator($key, $value);
        }

        return $validator->validate();
    }
protected function validate ( $ key , $ value ) { $ default = $ this -> get ( $ key ) ; if ( is_array ( $ default ) ) { $ validator = new Validators \ ArrayValidator ( $ key , $ value ) ; } elseif ( is_int ( $ default ) ) { $ validator = new Validators \ IntegerValidator ( $ key , $ value ) ; } elseif ( is_bool ( $ default ) ) { $ validator = new Validators \ BooleanValidator ( $ key , $ value ) ; } elseif ( class_exists ( $ default ) ) { $ validator = new Validators \ ClassValidator ( $ key , $ value ) ; } else { $ validator = new Validators \ StringOrNullValidator ( $ key , $ value ) ; } return $ validator -> validate ( ) ; }
Validates the new configuration option against its
default value to ensure it's the correct type.

If an invalid type is given, an exception is thrown.

@param string $key
@param mixed  $value

@return bool

@throws ConfigurationException When an option value given is an invalid type.
Validates the new configuration option against its default value to ensure it s the correct type .