创建当前模型的验证器
@return array
@throws Exception
@throws \ReflectionException
426951
public function createValidators()
    {
        $validators = [];
        foreach ($this->rules() as $rule) {
            if (isset($rule[0], $rule[1])) {
                $validators[] = ValidatorFactory::create($rule[1], $this, $rule[0], array_slice($rule, 2));
            } else {
                throw new Exception(str_cover('"{class}"指定了无效验证规则，规则必须指定验证器名和需要验证属性', [
                    '{class}' => get_class($this),
                ]), 101400102);
            }
        }
        return $validators;
    }
979206
public static function getList()
    {
        $calledClass = get_called_class();
        if (!isset(static::$list[$calledClass])) {
            $refClass = new \ReflectionClass($calledClass);
            $labels   = static::getLabels();
            foreach ($refClass->getConstants() as $constName => $constValue) {
                if (isset($labels[$constValue])) {
                    $label = $labels[$constValue];
                } else {
                    $label = lcfirst(strtolower($constName));
                }
                static::$list[$calledClass][$constValue] = $label;
            }
        }
        return static::$list[$calledClass];
    }
1141560
public function getConstants()
    {
        $constants = parent::getConstants();
        $returnConstants = array();
        foreach ($constants as $key => $value) {
            $returnConstants[$key] = new ReflectionConstant($this->getName(), $key);
        }

        return $returnConstants;
    }
828241
public static function toList()
    {
        $class = static::class;
        if (!array_key_exists($class, self::$cache)) {
            $reflection = new \ReflectionClass($class);
            self::$cache[$class] = $reflection->getConstants();
        }

        return self::$cache[$class];
    }
553481
public function toArray() {
        $exception = [
            'type'  => static::class,
            'error' => $this->getMessage(),
            'code'  => $this->getCode(),
            'line'  => $this->getLine(),
            'file'  => $this->getFile(),
            'trace' => $this->getTrace(),
            'inner' => null
        ];

        $prev  = $this->getPrevious();
        $inner = &$exception['inner'];
        while ($prev !== null) {

            if ($prev instanceof JitesoftException) {
                // If inner is a jitesoftexception, we can fetch the inner exception
                // as an array, and due to the fact that there is only one inner exception,
                // it will take care of the nesting in its own toArray method.
                $inner = $prev->toArray();
                break;
            }

            $inner = [
                'type'  => get_class($prev),
                'error' => $prev->getMessage(),
                'code'  => $prev->getCode(),
                'line'  => $prev->getLine(),
                'file'  => $prev->getFile(),
                'trace' => $prev->getTrace(),
                'inner' => ($prev->getPrevious() !== null ? [] : null)
            ];

            $inner = &$inner['inner'];
            $prev  = $prev->getPrevious();
        }

        return $exception;
    }
821959
public function all()
    {
        if ($this->exception !== null) {
            throw $this->exception;
        }

        return $this->fetch(true, $this->fetchAssoc);
    }
891563
public static function toArray()
    {
        $class = get_called_class();
        if (!array_key_exists($class, self::$cache)) {
            $reflection          = new \ReflectionClass($class);
            self::$cache[$class] = $reflection->getConstants();
        }

        return self::$cache[$class];
    }
1316591
public function getParameters()
    {
        if (null === $this->parameters) {
            $this->parameters = array();
            foreach ($this->reflection->getParameters() as $reflectionParameter) {
                $this->parameters[$reflectionParameter->getName()] = new CallbackParameter($reflectionParameter);
            }
        }

        return $this->parameters;
    }
303215
public function getAll()
    {
        if (null === $this->all) {
            $this->all = Reflection::getConstants($this);
        }

        return $this->all;
    }
68779
public function toArray() : array
    {
        $result = [];

        if (!empty($this->id)) {
            $result['id'] = $this->id;
        }

        if (!empty($this->link)) {
            $result['links']['about'] = $this->link;
        }

        if (!empty($this->status)) {
            $result['status'] = "{$this->status}";
        }

        if (!empty($this->code)) {
            $result['code'] = "{$this->code}";
        }

        if (!empty($this->title)) {
            $result['title'] = $this->title;
        }

        if (!empty($this->detail)) {
            $result['detail'] = $this->detail;
        }

        if (!empty($this->source)) {
            $result['source'] = $this->source->map(function ($item) {
                return $item;
            });
        }

        if (!empty($this->meta)) {
            $result['meta'] = $this->meta;
        }

        if (!empty($this->exception)) {
            $e = $this->exception;
            if ($e instanceof ExtendedLoggingInformation) {
                $result['exception'] = $e->context();
            } else {
                $result['exception'] = [
                    'exception' => get_class($e),
                    'message' => $e->getMessage(),
                    'stacktrace' => $e->getTrace(),
                ];
            }
        }

        return $result;
    }
1044836
public function toArray(): array
    {
        $result = \iterator_to_array($this);
        $className = BeanFactory::getObjectClass($this);
        // 支持注解配置隐藏为null的关联属性
        foreach(ModelRelationManager::getRelationFieldNames($this) as $name)
        {
            if(array_key_exists($name, $result) && null === $result[$name])
            {
                $autoSelect = AnnotationManager::getPropertyAnnotations($className, $name, AutoSelect::class)[0] ?? null;
                if($autoSelect && !$autoSelect->alwaysShow)
                {
                    unset($result[$name]);
                }
            }
        }
        // 禁止序列化支持
        $serializables = ModelManager::getSerializables($this);
        $serializableSets = AnnotationManager::getPropertiesAnnotations($className, Serializable::class);
        foreach($result as $propertyName => $value)
        {
            if(isset($serializableSets[$propertyName]))
            {
                // 单独属性上的 @Serializable 注解
                if(!$serializableSets[$propertyName][0]->allow)
                {
                    unset($result[$propertyName]);
                }
            }
            else if($serializables)
            {
                if(in_array($propertyName, $serializables->fields))
                {
                    // 在黑名单中的字段剔除
                    if('deny' === $serializables->mode)
                    {
                        unset($result[$propertyName]);
                    }
                }
                else
                {
                    // 不在白名单中的字段剔除
                    if('allow' === $serializables->mode)
                    {
                        unset($result[$propertyName]);
                    }
                }
            }
        }
        return $result;
    }
572156
public function getConfig(): array
    {
        $ref = new \ReflectionClass(get_class($this));
        $properties = $ref->getProperties();
        $config = [];

        //set default values
        foreach ($properties as $property) {
            $value = $property->getValue($this);
            if (null !== $value) {
                $config[Inflector::tableize($property->getName())] = $property->getValue($this);
            }
        }

        return $config;
    }
907800
public function toArray()
    {
        $array = [];

        if (!empty($this->getWhenInsert())) {
            $array['whenInsert'] = $this->getWhenInsert()->toArray();
        }

        if (!empty($this->getWhenUpdate())) {
            $array['whenUpdate'] = $this->getWhenUpdate()->toArray();
        }

        if (!empty($this->getWhenDelete())) {
            $array['whenDelete'] = $this->getWhenDelete()->toArray();
        }

        return $array;
    }
188642
public function getParameters()
    {
        $this->parameters = array();
        $ar = parent::getParameters();
        foreach ((array) $ar as $i => $parameter) {
            $parameter->type = '';
            try {
                $ref = $parameter->getClass();
                if ($ref) {
                    $parameter->type = $ref->getName();
                }
            } catch (Exception $e) {
            }
            if ($parameter->type == '') {
                if ($parameter->isArray()) {
                    $parameter->type = 'array';
                } elseif ($parameter->isCallable()) {
                    $parameter->type = 'function';
                } elseif (isset($this->params) && isset($this->params[$i])) {
                    $parameter->type = $this->params[$i]->type;
                } else {
                    $parameter->type = 'mixed';
                }
            }
            $this->parameters[$parameter->name] = $parameter;
        }
        if (isset($this->externalParams)) {
            foreach ($this->externalParams as $param) {
                $this->parameters[$param->name] = $param;
            }
        }

        return $this->parameters;
    }
684480
private function getClassMethods(): array
    {
        if (null !== $this->reflectionMethods) {
            return $this->reflectionMethods;
        }

        $this->reflectionMethods = [];

        $class = $this->reflectionClass;

        do {
            $this->reflectionMethods = \array_merge(
                $this->reflectionMethods,
                $class->getMethods()
            );
        } while ($class = $class->getParentClass());

        return $this->reflectionMethods;
    }
26581
public function getDataArray()
    {
        $arr = array(
            '@context' => $this->context,
            '@type' => $this->type,
        );

        foreach($this->properties as $name => $property) {
            if ($property instanceof Interfaces\IElement) {
                $arr[$name] = $property->getDataArray();
            } else {
                $arr[$name] = $property;
            }
        }
        return $arr;
    }
1368348
public function getGetters(): array
    {
        if (null !== $this->getters) {
            return $this->getters;
        }
        $skip = [
            'getEntityFqn'          => true,
            'getDoctrineStaticMeta' => true,
            'isValid'               => true,
            'getValidator'          => true,
        ];

        $this->getters   = [];
        $reflectionClass = $this->getReflectionClass();
        foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
            $methodName = $method->getName();
            if (isset($skip[$methodName])) {
                continue;
            }
            if (\ts\stringStartsWith($methodName, 'get')) {
                $this->getters[] = $methodName;
                continue;
            }
            if (\ts\stringStartsWith($methodName, 'is')) {
                $this->getters[] = $methodName;
                continue;
            }
            if (\ts\stringStartsWith($methodName, 'has')) {
                $this->getters[] = $methodName;
                continue;
            }
        }

        return $this->getters;
    }