| Server IP : 89.108.64.180 / Your IP : 216.73.217.92 Web Server : Apache/2.4.41 (Ubuntu) System : Linux 89-108-64-180.cloudvps.regruhosting.ru 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-root ( 1010) PHP Version : 8.0.30 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/poseidon-gagra.ru/wp-content/plugins/awebooking/inc/Support/ |
Upload File : |
<?php
namespace AweBooking\Support;
use Illuminate\Support\Arr;
/**
* Original from Illuminate\Support\Optional.
*
* @link https://github.com/illuminate/support/blob/master/Optional.php
*/
class Optional implements \ArrayAccess {
/**
* The underlying object.
*
* @var mixed
*/
protected $value;
/**
* Create a new optional instance.
*
* @param mixed $value The object.
* @return void
*/
public function __construct( $value ) {
$this->value = $value;
}
/**
* Dynamically check a property exists on the underlying object.
*
* @param string $name The property key name.
* @return bool
*/
public function __isset( $name ) {
if ( is_object( $this->value ) ) {
return isset( $this->value->{$name} );
}
if ( is_array( $this->value ) || $this->value instanceof \ArrayObject ) {
return isset( $this->value[ $name ] );
}
return false;
}
/**
* Dynamically access a property on the underlying object.
*
* @param string $key The getter key name.
* @return mixed
*/
public function __get( $key ) {
if ( is_object( $this->value ) ) {
return isset( $this->value->{$key} ) ? $this->value->{$key} : null;
}
}
/**
* Dynamically pass a method to the underlying object.
*
* @param string $method Method name.
* @param array $parameters Call method parameters.
*
* @return mixed
*/
public function __call( $method, $parameters ) {
if ( is_object( $this->value ) ) {
return $this->value->{$method}( ...$parameters );
}
}
/**
* Determine if an item exists at an offset.
*
* @param mixed $key The offset key.
* @return bool
*/
public function offsetExists( $key ) {
return Arr::accessible( $this->value ) && Arr::exists( $this->value, $key );
}
/**
* Get an item at a given offset.
*
* @param mixed $key The offset key.
* @return mixed
*/
public function offsetGet( $key ) {
return Arr::get( $this->value, $key );
}
/**
* Set the item at a given offset.
*
* @param mixed $key The offset key.
* @param mixed $value The offset value.
* @return void
*/
public function offsetSet( $key, $value ) {
if ( Arr::accessible( $this->value ) ) {
$this->value[ $key ] = $value;
}
}
/**
* Unset the item at a given offset.
*
* @param string $key The offset key.
* @return void
*/
public function offsetUnset( $key ) {
if ( Arr::accessible( $this->value ) ) {
unset( $this->value[ $key ] );
}
}
}