src/Generator.php
public function validateClass($attribute, $params)
    {
        $class = $this->$attribute;
        try {
            if (class_exists($class)) {
                if (isset($params['extends'])) {
                    if (ltrim($class, '\\') !== ltrim($params['extends'], '\\') && !is_subclass_of($class, $params['extends'])) {
                        $this->addError($attribute, "'$class' must extend from {$params['extends']} or its child class.");
                    }
                }
            } else {
                $this->addError($attribute, "Class '$class' does not exist or has syntax error.");
            }
        } catch (\Exception $e) {
            $this->addError($attribute, "Class '$class' does not exist or has syntax error.");
        }
    }
public function validateClass($attribute, $params)
    {
        $class = $this->$attribute;
        try {
            if (class_exists($class)) {
                if (isset($params['extends'])) {
                    if (ltrim($class, '\\') !== ltrim($params['extends'], '\\') && !is_subclass_of($class, $params['extends'])) {
                        $this->addError($attribute, "'$class' must extend from {$params['extends']} or its child class.");
                    }
                }
            } else {
                $this->addError($attribute, "Class '$class' does not exist or has syntax error.");
            }
        } catch (\Exception $e) {
            $this->addError($attribute, "Class '$class' does not exist or has syntax error.");
        }
    }
public function validateClass ( $ attribute , $ params ) { $ class = $ this -> $ attribute ; try { if ( class_exists ( $ class ) ) { if ( isset ( $ params [ 'extends' ] ) ) { if ( ltrim ( $ class , '\\' ) !== ltrim ( $ params [ 'extends' ] , '\\' ) && ! is_subclass_of ( $ class , $ params [ 'extends' ] ) ) { $ this -> addError ( $ attribute , "'$class' must extend from {$params['extends']} or its child class." ) ; } } } else { $ this -> addError ( $ attribute , "Class '$class' does not exist or has syntax error." ) ; } } catch ( \ Exception $ e ) { $ this -> addError ( $ attribute , "Class '$class' does not exist or has syntax error." ) ; } }
An inline validator that checks if the attribute value refers to an existing class name.
If the `extends` option is specified, it will also check if the class is a child class
of the class represented by the `extends` option.
@param string $attribute the attribute being validated
@param array $params the validation options
An inline validator that checks if the attribute value refers to an existing class name . If the extends option is specified it will also check if the class is a child class of the class represented by the extends option .