first commit
This commit is contained in:
22
vendor/autoload.php
vendored
Normal file
22
vendor/autoload.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
if (PHP_VERSION_ID < 50600) {
|
||||
if (!headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
||||
if (!ini_get('display_errors')) {
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||
fwrite(STDERR, $err);
|
||||
} elseif (!headers_sent()) {
|
||||
echo $err;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException($err);
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit8166d455774ce82597f7c8b1884b0ce8::getLoader();
|
||||
119
vendor/bin/php-parse
vendored
Executable file
119
vendor/bin/php-parse
vendored
Executable file
@@ -0,0 +1,119 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Proxy PHP file generated by Composer
|
||||
*
|
||||
* This file includes the referenced bin path (../nikic/php-parser/bin/php-parse)
|
||||
* using a stream wrapper to prevent the shebang from being output on PHP<8
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
$GLOBALS['_composer_bin_dir'] = __DIR__;
|
||||
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
if (!class_exists('Composer\BinProxyWrapper')) {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BinProxyWrapper
|
||||
{
|
||||
private $handle;
|
||||
private $position;
|
||||
private $realpath;
|
||||
|
||||
public function stream_open($path, $mode, $options, &$opened_path)
|
||||
{
|
||||
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
|
||||
$opened_path = substr($path, 17);
|
||||
$this->realpath = realpath($opened_path) ?: $opened_path;
|
||||
$opened_path = $this->realpath;
|
||||
$this->handle = fopen($this->realpath, $mode);
|
||||
$this->position = 0;
|
||||
|
||||
return (bool) $this->handle;
|
||||
}
|
||||
|
||||
public function stream_read($count)
|
||||
{
|
||||
$data = fread($this->handle, $count);
|
||||
|
||||
if ($this->position === 0) {
|
||||
$data = preg_replace('{^#!.*\r?\n}', '', $data);
|
||||
}
|
||||
|
||||
$this->position += strlen($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function stream_cast($castAs)
|
||||
{
|
||||
return $this->handle;
|
||||
}
|
||||
|
||||
public function stream_close()
|
||||
{
|
||||
fclose($this->handle);
|
||||
}
|
||||
|
||||
public function stream_lock($operation)
|
||||
{
|
||||
return $operation ? flock($this->handle, $operation) : true;
|
||||
}
|
||||
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = ftell($this->handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function stream_eof()
|
||||
{
|
||||
return feof($this->handle);
|
||||
}
|
||||
|
||||
public function stream_stat()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function stream_set_option($option, $arg1, $arg2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function url_stat($path, $flags)
|
||||
{
|
||||
$path = substr($path, 17);
|
||||
if (file_exists($path)) {
|
||||
return stat($path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|
||||
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
|
||||
) {
|
||||
return include("phpvfscomposer://" . __DIR__ . '/..'.'/nikic/php-parser/bin/php-parse');
|
||||
}
|
||||
}
|
||||
|
||||
return include __DIR__ . '/..'.'/nikic/php-parser/bin/php-parse';
|
||||
119
vendor/bin/phpcbf
vendored
Executable file
119
vendor/bin/phpcbf
vendored
Executable file
@@ -0,0 +1,119 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Proxy PHP file generated by Composer
|
||||
*
|
||||
* This file includes the referenced bin path (../squizlabs/php_codesniffer/bin/phpcbf)
|
||||
* using a stream wrapper to prevent the shebang from being output on PHP<8
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
$GLOBALS['_composer_bin_dir'] = __DIR__;
|
||||
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
if (!class_exists('Composer\BinProxyWrapper')) {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BinProxyWrapper
|
||||
{
|
||||
private $handle;
|
||||
private $position;
|
||||
private $realpath;
|
||||
|
||||
public function stream_open($path, $mode, $options, &$opened_path)
|
||||
{
|
||||
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
|
||||
$opened_path = substr($path, 17);
|
||||
$this->realpath = realpath($opened_path) ?: $opened_path;
|
||||
$opened_path = $this->realpath;
|
||||
$this->handle = fopen($this->realpath, $mode);
|
||||
$this->position = 0;
|
||||
|
||||
return (bool) $this->handle;
|
||||
}
|
||||
|
||||
public function stream_read($count)
|
||||
{
|
||||
$data = fread($this->handle, $count);
|
||||
|
||||
if ($this->position === 0) {
|
||||
$data = preg_replace('{^#!.*\r?\n}', '', $data);
|
||||
}
|
||||
|
||||
$this->position += strlen($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function stream_cast($castAs)
|
||||
{
|
||||
return $this->handle;
|
||||
}
|
||||
|
||||
public function stream_close()
|
||||
{
|
||||
fclose($this->handle);
|
||||
}
|
||||
|
||||
public function stream_lock($operation)
|
||||
{
|
||||
return $operation ? flock($this->handle, $operation) : true;
|
||||
}
|
||||
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = ftell($this->handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function stream_eof()
|
||||
{
|
||||
return feof($this->handle);
|
||||
}
|
||||
|
||||
public function stream_stat()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function stream_set_option($option, $arg1, $arg2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function url_stat($path, $flags)
|
||||
{
|
||||
$path = substr($path, 17);
|
||||
if (file_exists($path)) {
|
||||
return stat($path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|
||||
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
|
||||
) {
|
||||
return include("phpvfscomposer://" . __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcbf');
|
||||
}
|
||||
}
|
||||
|
||||
return include __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcbf';
|
||||
119
vendor/bin/phpcs
vendored
Executable file
119
vendor/bin/phpcs
vendored
Executable file
@@ -0,0 +1,119 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Proxy PHP file generated by Composer
|
||||
*
|
||||
* This file includes the referenced bin path (../squizlabs/php_codesniffer/bin/phpcs)
|
||||
* using a stream wrapper to prevent the shebang from being output on PHP<8
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
$GLOBALS['_composer_bin_dir'] = __DIR__;
|
||||
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
if (!class_exists('Composer\BinProxyWrapper')) {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BinProxyWrapper
|
||||
{
|
||||
private $handle;
|
||||
private $position;
|
||||
private $realpath;
|
||||
|
||||
public function stream_open($path, $mode, $options, &$opened_path)
|
||||
{
|
||||
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
|
||||
$opened_path = substr($path, 17);
|
||||
$this->realpath = realpath($opened_path) ?: $opened_path;
|
||||
$opened_path = $this->realpath;
|
||||
$this->handle = fopen($this->realpath, $mode);
|
||||
$this->position = 0;
|
||||
|
||||
return (bool) $this->handle;
|
||||
}
|
||||
|
||||
public function stream_read($count)
|
||||
{
|
||||
$data = fread($this->handle, $count);
|
||||
|
||||
if ($this->position === 0) {
|
||||
$data = preg_replace('{^#!.*\r?\n}', '', $data);
|
||||
}
|
||||
|
||||
$this->position += strlen($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function stream_cast($castAs)
|
||||
{
|
||||
return $this->handle;
|
||||
}
|
||||
|
||||
public function stream_close()
|
||||
{
|
||||
fclose($this->handle);
|
||||
}
|
||||
|
||||
public function stream_lock($operation)
|
||||
{
|
||||
return $operation ? flock($this->handle, $operation) : true;
|
||||
}
|
||||
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = ftell($this->handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function stream_eof()
|
||||
{
|
||||
return feof($this->handle);
|
||||
}
|
||||
|
||||
public function stream_stat()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function stream_set_option($option, $arg1, $arg2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function url_stat($path, $flags)
|
||||
{
|
||||
$path = substr($path, 17);
|
||||
if (file_exists($path)) {
|
||||
return stat($path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|
||||
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
|
||||
) {
|
||||
return include("phpvfscomposer://" . __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcs');
|
||||
}
|
||||
}
|
||||
|
||||
return include __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcs';
|
||||
122
vendor/bin/phpunit
vendored
Executable file
122
vendor/bin/phpunit
vendored
Executable file
@@ -0,0 +1,122 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Proxy PHP file generated by Composer
|
||||
*
|
||||
* This file includes the referenced bin path (../phpunit/phpunit/phpunit)
|
||||
* using a stream wrapper to prevent the shebang from being output on PHP<8
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
$GLOBALS['_composer_bin_dir'] = __DIR__;
|
||||
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
|
||||
$GLOBALS['__PHPUNIT_ISOLATION_EXCLUDE_LIST'] = $GLOBALS['__PHPUNIT_ISOLATION_BLACKLIST'] = array(realpath(__DIR__ . '/..'.'/phpunit/phpunit/phpunit'));
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
if (!class_exists('Composer\BinProxyWrapper')) {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BinProxyWrapper
|
||||
{
|
||||
private $handle;
|
||||
private $position;
|
||||
private $realpath;
|
||||
|
||||
public function stream_open($path, $mode, $options, &$opened_path)
|
||||
{
|
||||
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
|
||||
$opened_path = substr($path, 17);
|
||||
$this->realpath = realpath($opened_path) ?: $opened_path;
|
||||
$opened_path = 'phpvfscomposer://'.$this->realpath;
|
||||
$this->handle = fopen($this->realpath, $mode);
|
||||
$this->position = 0;
|
||||
|
||||
return (bool) $this->handle;
|
||||
}
|
||||
|
||||
public function stream_read($count)
|
||||
{
|
||||
$data = fread($this->handle, $count);
|
||||
|
||||
if ($this->position === 0) {
|
||||
$data = preg_replace('{^#!.*\r?\n}', '', $data);
|
||||
}
|
||||
$data = str_replace('__DIR__', var_export(dirname($this->realpath), true), $data);
|
||||
$data = str_replace('__FILE__', var_export($this->realpath, true), $data);
|
||||
|
||||
$this->position += strlen($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function stream_cast($castAs)
|
||||
{
|
||||
return $this->handle;
|
||||
}
|
||||
|
||||
public function stream_close()
|
||||
{
|
||||
fclose($this->handle);
|
||||
}
|
||||
|
||||
public function stream_lock($operation)
|
||||
{
|
||||
return $operation ? flock($this->handle, $operation) : true;
|
||||
}
|
||||
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = ftell($this->handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function stream_eof()
|
||||
{
|
||||
return feof($this->handle);
|
||||
}
|
||||
|
||||
public function stream_stat()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function stream_set_option($option, $arg1, $arg2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function url_stat($path, $flags)
|
||||
{
|
||||
$path = substr($path, 17);
|
||||
if (file_exists($path)) {
|
||||
return stat($path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|
||||
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
|
||||
) {
|
||||
return include("phpvfscomposer://" . __DIR__ . '/..'.'/phpunit/phpunit/phpunit');
|
||||
}
|
||||
}
|
||||
|
||||
return include __DIR__ . '/..'.'/phpunit/phpunit/phpunit';
|
||||
119
vendor/bin/var-dump-server
vendored
Executable file
119
vendor/bin/var-dump-server
vendored
Executable file
@@ -0,0 +1,119 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Proxy PHP file generated by Composer
|
||||
*
|
||||
* This file includes the referenced bin path (../symfony/var-dumper/Resources/bin/var-dump-server)
|
||||
* using a stream wrapper to prevent the shebang from being output on PHP<8
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
$GLOBALS['_composer_bin_dir'] = __DIR__;
|
||||
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
if (!class_exists('Composer\BinProxyWrapper')) {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BinProxyWrapper
|
||||
{
|
||||
private $handle;
|
||||
private $position;
|
||||
private $realpath;
|
||||
|
||||
public function stream_open($path, $mode, $options, &$opened_path)
|
||||
{
|
||||
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
|
||||
$opened_path = substr($path, 17);
|
||||
$this->realpath = realpath($opened_path) ?: $opened_path;
|
||||
$opened_path = $this->realpath;
|
||||
$this->handle = fopen($this->realpath, $mode);
|
||||
$this->position = 0;
|
||||
|
||||
return (bool) $this->handle;
|
||||
}
|
||||
|
||||
public function stream_read($count)
|
||||
{
|
||||
$data = fread($this->handle, $count);
|
||||
|
||||
if ($this->position === 0) {
|
||||
$data = preg_replace('{^#!.*\r?\n}', '', $data);
|
||||
}
|
||||
|
||||
$this->position += strlen($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function stream_cast($castAs)
|
||||
{
|
||||
return $this->handle;
|
||||
}
|
||||
|
||||
public function stream_close()
|
||||
{
|
||||
fclose($this->handle);
|
||||
}
|
||||
|
||||
public function stream_lock($operation)
|
||||
{
|
||||
return $operation ? flock($this->handle, $operation) : true;
|
||||
}
|
||||
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = ftell($this->handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function stream_eof()
|
||||
{
|
||||
return feof($this->handle);
|
||||
}
|
||||
|
||||
public function stream_stat()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function stream_set_option($option, $arg1, $arg2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function url_stat($path, $flags)
|
||||
{
|
||||
$path = substr($path, 17);
|
||||
if (file_exists($path)) {
|
||||
return stat($path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|
||||
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
|
||||
) {
|
||||
return include("phpvfscomposer://" . __DIR__ . '/..'.'/symfony/var-dumper/Resources/bin/var-dump-server');
|
||||
}
|
||||
}
|
||||
|
||||
return include __DIR__ . '/..'.'/symfony/var-dumper/Resources/bin/var-dump-server';
|
||||
14
vendor/claudecio/axiumphp/.env.example
vendored
Executable file
14
vendor/claudecio/axiumphp/.env.example
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
SYSTEM_VERSION = 1.0
|
||||
SYSTEM_TIMEZONE = 'America/Fortaleza'
|
||||
SYSTEM_URL = 'https://system.localhost'
|
||||
SYSTEM_FRONTEND_URL = 'https://app.system.localhost'
|
||||
# 1 = Production, 2 = Development
|
||||
SYSTEM_ENVIRONMENT_ID = 2
|
||||
|
||||
DEFAULT_DATABASE_HOST = 127.0.0.1
|
||||
DEFAULT_DATABASE_PORT = 3306
|
||||
DEFAULT_DATABASE_DRIVER = mysql
|
||||
DEFAULT_DATABASE_SCHEMA = schema
|
||||
DEFAULT_DATABASE_CHARSET = utf8mb4
|
||||
DEFAULT_DATABASE_USERNAME = username
|
||||
DEFAULT_DATABASE_PASSWORD = password
|
||||
15
vendor/claudecio/axiumphp/composer.json
vendored
Executable file
15
vendor/claudecio/axiumphp/composer.json
vendored
Executable file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "claudecio/axiumphp",
|
||||
"description": "Meu framework PHP para sistemas MVC modulares.",
|
||||
"type": "library",
|
||||
"license": "MIT",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"AxiumPHP\\": "src/"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"vlucas/phpdotenv": "v5.6.2"
|
||||
}
|
||||
}
|
||||
482
vendor/claudecio/axiumphp/composer.lock
generated
vendored
Executable file
482
vendor/claudecio/axiumphp/composer.lock
generated
vendored
Executable file
@@ -0,0 +1,482 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "6d450325e9b77ca38da0bcec5503c990",
|
||||
"packages": [
|
||||
{
|
||||
"name": "graham-campbell/result-type",
|
||||
"version": "v1.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/GrahamCampbell/Result-Type.git",
|
||||
"reference": "3ba905c11371512af9d9bdd27d99b782216b6945"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945",
|
||||
"reference": "3ba905c11371512af9d9bdd27d99b782216b6945",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"phpoption/phpoption": "^1.9.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"GrahamCampbell\\ResultType\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Graham Campbell",
|
||||
"email": "hello@gjcampbell.co.uk",
|
||||
"homepage": "https://github.com/GrahamCampbell"
|
||||
}
|
||||
],
|
||||
"description": "An Implementation Of The Result Type",
|
||||
"keywords": [
|
||||
"Graham Campbell",
|
||||
"GrahamCampbell",
|
||||
"Result Type",
|
||||
"Result-Type",
|
||||
"result"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/GrahamCampbell/Result-Type/issues",
|
||||
"source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/GrahamCampbell",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-07-20T21:45:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpoption/phpoption",
|
||||
"version": "1.9.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/schmittjoh/php-option.git",
|
||||
"reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/schmittjoh/php-option/zipball/e3fac8b24f56113f7cb96af14958c0dd16330f54",
|
||||
"reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2.5 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"bamarni/composer-bin-plugin": "^1.8.2",
|
||||
"phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"bamarni-bin": {
|
||||
"bin-links": true,
|
||||
"forward-command": false
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-master": "1.9-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PhpOption\\": "src/PhpOption/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache-2.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Johannes M. Schmitt",
|
||||
"email": "schmittjoh@gmail.com",
|
||||
"homepage": "https://github.com/schmittjoh"
|
||||
},
|
||||
{
|
||||
"name": "Graham Campbell",
|
||||
"email": "hello@gjcampbell.co.uk",
|
||||
"homepage": "https://github.com/GrahamCampbell"
|
||||
}
|
||||
],
|
||||
"description": "Option Type for PHP",
|
||||
"keywords": [
|
||||
"language",
|
||||
"option",
|
||||
"php",
|
||||
"type"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/schmittjoh/php-option/issues",
|
||||
"source": "https://github.com/schmittjoh/php-option/tree/1.9.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/GrahamCampbell",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-07-20T21:41:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.32.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638",
|
||||
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"provide": {
|
||||
"ext-ctype": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-ctype": "For best performance"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Ctype\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Gert de Pagter",
|
||||
"email": "BackEndTea@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for ctype functions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"ctype",
|
||||
"polyfill",
|
||||
"portable"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.32.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.32.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493",
|
||||
"reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-iconv": "*",
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"provide": {
|
||||
"ext-mbstring": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mbstring": "For best performance"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Mbstring\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for the Mbstring extension",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"mbstring",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-12-23T08:48:59+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php80",
|
||||
"version": "v1.32.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php80.git",
|
||||
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
|
||||
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php80\\": ""
|
||||
},
|
||||
"classmap": [
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ion Bazan",
|
||||
"email": "ion.bazan@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php80/tree/v1.32.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-01-02T08:10:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "vlucas/phpdotenv",
|
||||
"version": "v5.6.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vlucas/phpdotenv.git",
|
||||
"reference": "24ac4c74f91ee2c193fa1aaa5c249cb0822809af"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/24ac4c74f91ee2c193fa1aaa5c249cb0822809af",
|
||||
"reference": "24ac4c74f91ee2c193fa1aaa5c249cb0822809af",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-pcre": "*",
|
||||
"graham-campbell/result-type": "^1.1.3",
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"phpoption/phpoption": "^1.9.3",
|
||||
"symfony/polyfill-ctype": "^1.24",
|
||||
"symfony/polyfill-mbstring": "^1.24",
|
||||
"symfony/polyfill-php80": "^1.24"
|
||||
},
|
||||
"require-dev": {
|
||||
"bamarni/composer-bin-plugin": "^1.8.2",
|
||||
"ext-filter": "*",
|
||||
"phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-filter": "Required to use the boolean validator."
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"bamarni-bin": {
|
||||
"bin-links": true,
|
||||
"forward-command": false
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-master": "5.6-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Dotenv\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Graham Campbell",
|
||||
"email": "hello@gjcampbell.co.uk",
|
||||
"homepage": "https://github.com/GrahamCampbell"
|
||||
},
|
||||
{
|
||||
"name": "Vance Lucas",
|
||||
"email": "vance@vancelucas.com",
|
||||
"homepage": "https://github.com/vlucas"
|
||||
}
|
||||
],
|
||||
"description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
|
||||
"keywords": [
|
||||
"dotenv",
|
||||
"env",
|
||||
"environment"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/vlucas/phpdotenv/issues",
|
||||
"source": "https://github.com/vlucas/phpdotenv/tree/v5.6.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/GrahamCampbell",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-04-30T23:37:27+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": {},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"platform-dev": {},
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
152
vendor/claudecio/axiumphp/guide.md
vendored
Executable file
152
vendor/claudecio/axiumphp/guide.md
vendored
Executable file
@@ -0,0 +1,152 @@
|
||||
# AxiumPHP - Guia de Primeiro Uso
|
||||
|
||||
O **AxiumPHP** é um micro-framework PHP modular no padrão MVC, ideal para criar sistemas organizados e escaláveis sem depender de frameworks pesados.
|
||||
Ele já vem pronto para trabalhar com módulos independentes, carregamento automático de rotas, tratamento global de erros e suporte a APIs (JSON) ou páginas HTML.
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Instalação e Configuração
|
||||
|
||||
### 1. Clonar o repositório
|
||||
```bash
|
||||
git clone https://github.com/claudecio/AxiumPHP.git
|
||||
```
|
||||
|
||||
### 2. Instalar as dependências via Composer
|
||||
```bash
|
||||
composer install
|
||||
```
|
||||
|
||||
### 3. Configurar o ambiente
|
||||
Copie o arquivo `.env.example` para `.env`:
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
Depois, ajuste as variáveis conforme seu ambiente (conexão com banco, fuso horário, URL do frontend, etc.).
|
||||
|
||||
### 4. Configurar o servidor
|
||||
**Usando PHP embutido:**
|
||||
```bash
|
||||
php -S localhost:8000 -t public
|
||||
```
|
||||
|
||||
**Usando Apache:**
|
||||
Aponte o `DocumentRoot` para a pasta `public/`.
|
||||
|
||||
---
|
||||
|
||||
## 📂 Estrutura do Projeto
|
||||
```
|
||||
app/
|
||||
├── Common/ # Serviços e controladores compartilhados
|
||||
├── Module/ # Módulos independentes (Controllers, Models, Views, Routes, bootstrap.php)
|
||||
└── Core/ # Núcleo do framework
|
||||
public/ # Arquivos públicos (index.php, assets)
|
||||
vendor/ # Dependências do Composer
|
||||
.env # Configurações do ambiente
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📌 Entendendo o index.php
|
||||
O arquivo `public/index.php` é o ponto de entrada da aplicação.
|
||||
Nele, além do autoload do Composer, algumas constantes precisam ser definidas:
|
||||
|
||||
- **ROUTER_MODE** → define o modo de resposta do roteador (`JSON` para APIs, `VIEW` para views).
|
||||
- **APP_SYS_MODE** → define o modo de sistema, PROD para produção ou DEV para desenvolvimento.
|
||||
- **ROUTER_ALLOWED_ORIGINS** → array onde é definido os dominios permitidos para usar o CORS.
|
||||
- **INI_SYSTEM_PATH** → caminho absoluto para a pasta `app` do projeto.
|
||||
- **MODULE_PATH** → caminho absoluto para a pasta `Module`, onde ficam os módulos do sistema.
|
||||
- **STORAGE_FOLDER_PATH** → caminho absoluto para a pasta `Storage`, utilizada para arquivos e logs.
|
||||
|
||||
**Exemplo:**
|
||||
```php
|
||||
const ROUTER_MODE = 'JSON';
|
||||
const APP_SYS_MODE = 'DEV' # PROD = Production // DEV = Development
|
||||
// Case Router Mode in JSON
|
||||
const ROUTER_ALLOWED_ORIGINS = [
|
||||
'*',
|
||||
'http://app.localhost:8000',
|
||||
];
|
||||
define('INI_SYSTEM_PATH', realpath(__DIR__ . "/../app"));
|
||||
define('MODULE_PATH', realpath(__DIR__ . "/../app/Module"));
|
||||
define('STORAGE_FOLDER_PATH', realpath(__DIR__ . "/../app/Storage"));
|
||||
```
|
||||
|
||||
Além disso, o `index.php`:
|
||||
- Carrega configurações globais (`Config`);
|
||||
- Inicializa o `LoggerService`;
|
||||
- Ativa o `ErrorHandler`;
|
||||
- Define o fuso horário (`SYSTEM_TIMEZONE` do `.env`);
|
||||
- Inicia sessão, se necessário;
|
||||
- Configura CORS;
|
||||
- Carrega os módulos iniciais.
|
||||
|
||||
---
|
||||
|
||||
## 🛠 Criando e Registrando um Módulo
|
||||
|
||||
### 1. Criar a pasta do módulo
|
||||
```bash
|
||||
mkdir -p app/Module/Hello
|
||||
```
|
||||
|
||||
### 2. Criar o Controller
|
||||
Arquivo: `app/Module/Hello/Controllers/HelloController.php`
|
||||
```php
|
||||
<?php
|
||||
namespace App\Module\Hello\Controllers;
|
||||
|
||||
class HelloController {
|
||||
public function index() {
|
||||
echo "Hello, AxiumPHP!";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Criar a rota
|
||||
Arquivo: `app/Module/Hello/Routes/web.php`
|
||||
```php
|
||||
<?php
|
||||
use AxiumPHP\Core\Router;
|
||||
use App\Module\Hello\Controllers\HelloController;
|
||||
|
||||
Router::GET('/hello', [HelloController::class, 'index']);
|
||||
Router::PUT('/hello/{id}', [HelloController::class, 'update']);
|
||||
Router::POST('/createHello', [HelloController::class, 'create']);
|
||||
Router::DELETE('/hello/{id}', [HelloController::class, 'delete']);
|
||||
```
|
||||
|
||||
### 4. Criar o bootstrap do módulo
|
||||
Arquivo: `app/Module/Hello/bootstrap.php`
|
||||
```php
|
||||
<?php
|
||||
require_once __DIR__ . '/Routes/web.php';
|
||||
```
|
||||
|
||||
### 5. Registrar o módulo no index.php
|
||||
```php
|
||||
<?php
|
||||
require_once realpath(__DIR__ . "/../app/Module/Hello/bootstrap.php");
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 💡 Dicas Importantes
|
||||
|
||||
**LoggerService** → configure antes do `ErrorHandler`:
|
||||
```php
|
||||
LoggerService::init(
|
||||
driver: LoggerService::DRIVER_FILE,
|
||||
logDir: 'logs'
|
||||
);
|
||||
```
|
||||
|
||||
**CORS** → já configurado no `index.php` usando `SYSTEM_FRONTEND_URL` do `.env`.
|
||||
**ROUTER_MODE** → altere para `VIEW` se quiser trabalhar com renderização de views.
|
||||
**ErrorHandler** → use o `SYSTEM_ENVIRONMENT_ID` do `.env` para decidir se exibe ou oculta erros em produção.
|
||||
|
||||
---
|
||||
|
||||
## 📜 Licença
|
||||
Este projeto está licenciado sob a **MIT License**.
|
||||
10
vendor/claudecio/axiumphp/readme.md
vendored
Executable file
10
vendor/claudecio/axiumphp/readme.md
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
# AxiumPHP
|
||||
|
||||
AxiumPHP é um framework simples e modular para aplicações PHP.
|
||||
|
||||
## Instalação
|
||||
|
||||
Com o Composer:
|
||||
|
||||
```bash
|
||||
composer require claudecio/axiumphp
|
||||
166
vendor/claudecio/axiumphp/src/AxiumPHP.php
vendored
Executable file
166
vendor/claudecio/axiumphp/src/AxiumPHP.php
vendored
Executable file
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
namespace AxiumPHP;
|
||||
|
||||
use AxiumPHP\Core\Router;
|
||||
use AxiumPHP\Core\LoggerService;
|
||||
|
||||
class AxiumPHP {
|
||||
private array $config;
|
||||
|
||||
public function __construct(array $config = []) {
|
||||
$this->config = $config;
|
||||
|
||||
$this->setupErrors();
|
||||
$this->setupSession();
|
||||
$this->setupTimezone();
|
||||
$this->setupConstants();
|
||||
$this->setupLogger();
|
||||
$this->setupErrorHandlers();
|
||||
|
||||
// Inicia o router
|
||||
new Router();
|
||||
}
|
||||
|
||||
/**
|
||||
* Configura erros
|
||||
*/
|
||||
private function setupErrors(): void {
|
||||
$errors = $this->config['errors'];
|
||||
|
||||
if(!empty($errors)) {
|
||||
ini_set(option: 'display_errors', value: $errors['display_errors']);
|
||||
ini_set(option: 'display_startup_errors', value: $errors['display_startup_errors']);
|
||||
ini_set(option: 'log_errors', value: $errors['log_errors']);
|
||||
ini_set(option: 'error_log', value: $errors['error_log']);
|
||||
error_reporting(error_level: $errors['error_reporting']);
|
||||
}
|
||||
}
|
||||
|
||||
private function setupConstants() {
|
||||
$constants = $this->config['constants'];
|
||||
|
||||
if(!empty($constants)) {
|
||||
foreach ($constants as $name => $value) {
|
||||
if (!defined(constant_name: $name)) {
|
||||
define(constant_name: $name, value: $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configura timezone
|
||||
*/
|
||||
private function setupTimezone(): void {
|
||||
$timezone = $this->config['system']['default_timezone'];
|
||||
if(!empty($timezone)) {
|
||||
date_default_timezone_set(timezoneId: $timezone);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configura sessão
|
||||
*/
|
||||
private function setupSession(): void {
|
||||
$startSession = $this->config['system']['enable_session'];
|
||||
|
||||
if (($startSession === true) && session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configura logger
|
||||
*/
|
||||
private function setupLogger(): void {
|
||||
$logConfig = $this->config['logger'];
|
||||
|
||||
if(!empty($logConfig)) {
|
||||
LoggerService::init(
|
||||
driver: $logConfig['driver'],
|
||||
logDir: $logConfig['logDir']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configura handlers de erro para modo JSON
|
||||
*/
|
||||
private function setupErrorHandlers(): void {
|
||||
// Só ativa se modo JSON
|
||||
if (defined(constant_name: 'ROUTER_MODE') && ROUTER_MODE === 'JSON') {
|
||||
|
||||
// Captura warnings / notices
|
||||
set_error_handler(callback: function ($errno, $errstr, $errfile, $errline) {
|
||||
$this->jsonErrorResponse(
|
||||
message: "Erro PHP: {$errstr}",
|
||||
code: $errno,
|
||||
extra: [
|
||||
'file' => $errfile,
|
||||
'line' => $errline
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Captura exceptions não tratadas
|
||||
set_exception_handler(callback: function ($exception) {
|
||||
$this->jsonErrorResponse(
|
||||
message: $exception->getMessage(),
|
||||
code: $exception->getCode(),
|
||||
extra: [
|
||||
'file' => $exception->getFile(),
|
||||
'line' => $exception->getLine(),
|
||||
'trace' => $exception->getTrace()
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Captura fatal errors (shutdown)
|
||||
register_shutdown_function(callback: function () {
|
||||
$error = error_get_last();
|
||||
if ($error !== null) {
|
||||
$this->jsonErrorResponse(
|
||||
message: $error['message'],
|
||||
code: $error['type'],
|
||||
extra: [
|
||||
'file' => $error['file'],
|
||||
'line' => $error['line']
|
||||
]
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna resposta JSON de erro e encerra execução
|
||||
*/
|
||||
private function jsonErrorResponse(string $message, int $code = 500, array $extra = []): void {
|
||||
// Evita headers duplicados
|
||||
if (!headers_sent()) {
|
||||
http_response_code(response_code: 500);
|
||||
header(header: 'Content-Type: application/json; charset=utf-8');
|
||||
}
|
||||
|
||||
echo json_encode(
|
||||
value: [
|
||||
'status' => 'error',
|
||||
'message' => $message,
|
||||
'code' => $code,
|
||||
'extra' => $extra,
|
||||
],
|
||||
flags: JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT
|
||||
);
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispara roteador
|
||||
*/
|
||||
public function routerDispatch() {
|
||||
if (php_sapi_name() !== 'cli') {
|
||||
Router::dispatch();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
vendor/claudecio/axiumphp/src/Core/Database.php
vendored
Executable file
120
vendor/claudecio/axiumphp/src/Core/Database.php
vendored
Executable file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
namespace AxiumPHP\Core;
|
||||
|
||||
use PDO;
|
||||
use Dotenv\Dotenv;
|
||||
use RuntimeException;
|
||||
use AxiumPHP\Core\Database\Drivers\MySQL;
|
||||
use AxiumPHP\Core\Database\Drivers\Postgres;
|
||||
|
||||
class Database {
|
||||
private static array $connections = [];
|
||||
private static bool $envLoaded = false;
|
||||
|
||||
private static function loadEnv(): void {
|
||||
if (!self::$envLoaded) {
|
||||
if (file_exists(filename: ROOT_SYSTEM_PATH . '/.env')) {
|
||||
$dotenv = Dotenv::createImmutable(paths: ROOT_SYSTEM_PATH);
|
||||
$dotenv->load();
|
||||
}
|
||||
self::$envLoaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna conexão por nome + schema
|
||||
*/
|
||||
public static function getConnection(string $connectionName = 'DEFAULT', ?string $schema = null): mixed {
|
||||
self::loadEnv();
|
||||
$connectionName = strtoupper(string: $connectionName);
|
||||
$key = $connectionName . ($schema ? "_$schema" : '');
|
||||
|
||||
if (!isset(self::$connections[$key])) {
|
||||
$driver = $_ENV["{$connectionName}_DATABASE_DRIVER"];
|
||||
|
||||
switch (strtolower(string: $driver)) {
|
||||
case 'mysql':
|
||||
$conn = new MySQL(envName: $connectionName);
|
||||
break;
|
||||
case 'pgsql':
|
||||
$conn = new Postgres(envName: $connectionName, schema: $schema);
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException(message: "Driver desconhecido: {$driver}");
|
||||
}
|
||||
|
||||
self::$connections[$key] = $conn;
|
||||
}
|
||||
|
||||
return self::$connections[$key];
|
||||
}
|
||||
|
||||
public static function disconnect(string $connectionName = 'DEFAULT', ?string $schema = null): void {
|
||||
$connectionName = strtoupper(string: $connectionName);
|
||||
$key = $connectionName . ($schema ? "_$schema" : '');
|
||||
self::$connections[$key] = null;
|
||||
}
|
||||
|
||||
/** Métodos auxiliares (execute, fetchAll, fetchOne, etc.) */
|
||||
public static function execute(string $sql, array $params = [], string $connectionName = 'DEFAULT', ?string $schema = null): bool {
|
||||
$conn = self::getConnection(connectionName: $connectionName, schema: $schema);
|
||||
if (method_exists(object_or_class: $conn, method: 'execute')) {
|
||||
return $conn->execute($sql, $params);
|
||||
}
|
||||
throw new RuntimeException(message: "O driver '{$connectionName}' não suporta execute()");
|
||||
}
|
||||
|
||||
public static function fetchAll(string $sql, array $params = [], string $connectionName = 'DEFAULT', ?string $schema = null): array {
|
||||
$conn = self::getConnection(connectionName: $connectionName, schema: $schema);
|
||||
if (method_exists(object_or_class: $conn, method: 'fetchAll')) {
|
||||
return $conn->fetchAll($sql, $params);
|
||||
}
|
||||
throw new RuntimeException("O driver '{$connectionName}' não suporta fetchAll()");
|
||||
}
|
||||
|
||||
public static function fetchOne(string $sql, array $params = [], string $connectionName = 'DEFAULT', ?string $schema = null): ?array {
|
||||
$conn = self::getConnection(connectionName: $connectionName, schema: $schema);
|
||||
if (method_exists(object_or_class: $conn, method: 'fetchOne')) {
|
||||
return $conn->fetchOne($sql, $params);
|
||||
}
|
||||
throw new RuntimeException(message: "O driver '{$connectionName}' não suporta fetchOne()");
|
||||
}
|
||||
|
||||
// Transações
|
||||
public static function beginTransaction(string $connectionName = 'DEFAULT', ?string $schema = null): void {
|
||||
$conn = self::getConnection(connectionName: $connectionName, schema: $schema);
|
||||
if (method_exists(object_or_class: $conn, method: 'beginTransaction')) $conn->beginTransaction();
|
||||
}
|
||||
|
||||
public static function commit(string $connectionName = 'DEFAULT', ?string $schema = null): void {
|
||||
$conn = self::getConnection(connectionName: $connectionName, schema: $schema);
|
||||
|
||||
if ($conn instanceof PDO && $conn->inTransaction()) {
|
||||
$conn->commit();
|
||||
} elseif (method_exists(object_or_class: $conn, method: 'getPDO')) {
|
||||
$pdo = $conn->getPDO();
|
||||
if ($pdo instanceof PDO && $pdo->inTransaction()) {
|
||||
$pdo->commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function rollback(string $connectionName = 'DEFAULT', ?string $schema = null): void {
|
||||
$conn = self::getConnection(connectionName: $connectionName, schema: $schema);
|
||||
|
||||
if ($conn instanceof PDO && $conn->inTransaction()) {
|
||||
$conn->rollback();
|
||||
} elseif (method_exists(object_or_class: $conn, method: 'getPDO')) {
|
||||
$pdo = $conn->getPDO();
|
||||
if ($pdo instanceof PDO && $pdo->inTransaction()) {
|
||||
$pdo->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function lastInsertId(string $connectionName = 'DEFAULT', ?string $schema = null): string {
|
||||
$conn = self::getConnection(connectionName: $connectionName, schema: $schema);
|
||||
if (method_exists(object_or_class: $conn, method: 'getPDO')) return $conn->getPDO()->lastInsertId();
|
||||
throw new RuntimeException(message: "O driver '{$connectionName}' não suporta lastInsertId()");
|
||||
}
|
||||
}
|
||||
32
vendor/claudecio/axiumphp/src/Core/Database/Drivers/MySQL.php
vendored
Executable file
32
vendor/claudecio/axiumphp/src/Core/Database/Drivers/MySQL.php
vendored
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace AxiumPHP\Core\Database\Drivers;
|
||||
|
||||
use PDO;
|
||||
use PDOException;
|
||||
use RuntimeException;
|
||||
|
||||
class MySQL extends PDOAbstract {
|
||||
protected function connect(string $envName): void {
|
||||
$host = $_ENV["{$envName}_DATABASE_HOST"];
|
||||
$port = $_ENV["{$envName}_DATABASE_PORT"] ?? 3306;
|
||||
$dbname = $_ENV["{$envName}_DATABASE_NAME"];
|
||||
$user = $_ENV["{$envName}_DATABASE_USERNAME"];
|
||||
$password = $_ENV["{$envName}_DATABASE_PASSWORD"];
|
||||
$charset = $_ENV["{$envName}_DATABASE_CHARSET"] ?? 'utf8mb4';
|
||||
|
||||
try {
|
||||
$this->connection = new PDO(
|
||||
dsn: "mysql:host={$host};port={$port};dbname={$dbname};charset={$charset}",
|
||||
username: $user,
|
||||
password: $password,
|
||||
options: [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
PDO::ATTR_PERSISTENT => true,
|
||||
]
|
||||
);
|
||||
} catch (PDOException $e) {
|
||||
throw new RuntimeException(message: "Erro ao conectar no MySQL: {$e->getMessage()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
55
vendor/claudecio/axiumphp/src/Core/Database/Drivers/PDOAbstract.php
vendored
Executable file
55
vendor/claudecio/axiumphp/src/Core/Database/Drivers/PDOAbstract.php
vendored
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
namespace AxiumPHP\Core\Database\Drivers;
|
||||
|
||||
use PDO;
|
||||
use RuntimeException;
|
||||
|
||||
abstract class PDOAbstract {
|
||||
protected PDO $connection;
|
||||
|
||||
public function __construct(string $envName) {
|
||||
$this->connect(envName: $envName);
|
||||
}
|
||||
|
||||
abstract protected function connect(string $envName): void;
|
||||
|
||||
public function execute(string $sql, array $params = []): bool {
|
||||
$stmt = $this->connection->prepare(query: $sql);
|
||||
return $stmt->execute(params: $params);
|
||||
}
|
||||
|
||||
public function fetchAll(string $sql, array $params = []): array {
|
||||
$stmt = $this->connection->prepare(query: $sql);
|
||||
$stmt->execute(params: $params);
|
||||
return $stmt->fetchAll(mode: PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
public function fetchOne(string $sql, array $params = []): ?array {
|
||||
$stmt = $this->connection->prepare(query: $sql);
|
||||
$stmt->execute(params: $params);
|
||||
$result = $stmt->fetch(mode: PDO::FETCH_ASSOC);
|
||||
return $result ?: null;
|
||||
}
|
||||
|
||||
public function beginTransaction(): void {
|
||||
if (!$this->connection->inTransaction()) {
|
||||
$this->connection->beginTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
public function commit(): void {
|
||||
if ($this->connection->inTransaction()) {
|
||||
$this->connection->commit();
|
||||
}
|
||||
}
|
||||
|
||||
public function rollback(): void {
|
||||
if ($this->connection->inTransaction()) {
|
||||
$this->connection->rollBack();
|
||||
}
|
||||
}
|
||||
|
||||
public function getPDO(): PDO {
|
||||
return $this->connection;
|
||||
}
|
||||
}
|
||||
55
vendor/claudecio/axiumphp/src/Core/Database/Drivers/Postgres.php
vendored
Executable file
55
vendor/claudecio/axiumphp/src/Core/Database/Drivers/Postgres.php
vendored
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
namespace AxiumPHP\Core\Database\Drivers;
|
||||
|
||||
use PDO;
|
||||
use PDOException;
|
||||
use RuntimeException;
|
||||
|
||||
class Postgres extends PDOAbstract {
|
||||
|
||||
public function __construct(string $envName, ?string $schema = null) {
|
||||
$this->connect(envName: $envName, schema: $schema);
|
||||
}
|
||||
|
||||
protected function connect(string $envName, ?string $schema = null): void {
|
||||
$host = $_ENV["{$envName}_DATABASE_HOST"];
|
||||
$port = $_ENV["{$envName}_DATABASE_PORT"] ?? 5432;
|
||||
$dbname = $_ENV["{$envName}_DATABASE_NAME"];
|
||||
$user = $_ENV["{$envName}_DATABASE_USERNAME"];
|
||||
$pass = $_ENV["{$envName}_DATABASE_PASSWORD"];
|
||||
$schema = $schema ?? ($_ENV["{$envName}_DATABASE_SCHEMA"] ?? 'public');
|
||||
$systemTimeZone = $_ENV["SYSTEM_TIMEZONE"] ?? 'UTC';
|
||||
$sslMode = $_ENV["{$envName}_DATABASE_SSLMODE"] ?? 'disable'; // disable, require, verify-ca, verify-full
|
||||
|
||||
$dsn = "pgsql:host={$host};port={$port};dbname={$dbname};sslmode={$sslMode}";
|
||||
|
||||
try {
|
||||
$this->connection = new PDO(
|
||||
dsn: $dsn,
|
||||
username: $user,
|
||||
password: $pass,
|
||||
options: [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
PDO::ATTR_PERSISTENT => false
|
||||
]
|
||||
);
|
||||
|
||||
// Define o fuso horário da sessão
|
||||
$this->connection->exec(statement: "SET TIME ZONE '{$systemTimeZone}'");
|
||||
|
||||
// Define o schema padrão
|
||||
$this->connection->exec(statement: "SET search_path TO {$schema}, public");
|
||||
|
||||
} catch (PDOException $e) {
|
||||
throw new RuntimeException(
|
||||
message: "Erro ao conectar no PostgreSQL: {$e->getMessage()}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Método auxiliar para alterar schema dinamicamente
|
||||
public function setSchema(string $schema): void {
|
||||
$this->connection->exec(statement: "SET search_path TO {$schema}, public");
|
||||
}
|
||||
}
|
||||
118
vendor/claudecio/axiumphp/src/Core/LoggerService.php
vendored
Executable file
118
vendor/claudecio/axiumphp/src/Core/LoggerService.php
vendored
Executable file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
namespace AxiumPHP\Core;
|
||||
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use AxiumPHP\Core\Database;
|
||||
|
||||
class LoggerService {
|
||||
public const DRIVER_FILE = 'FILE';
|
||||
public const DRIVER_DATABASE = 'DATABASE';
|
||||
|
||||
private static string $logDir;
|
||||
private static bool $initialized = false;
|
||||
private static string $driver = self::DRIVER_FILE;
|
||||
private static string $connectionName = 'DEFAULT'; // conexão do Database
|
||||
|
||||
/**
|
||||
* Inicializa o Logger
|
||||
*/
|
||||
public static function init(string $driver = self::DRIVER_FILE,?string $logDir = null,string $dbConnectionName = 'DEFAULT'): void {
|
||||
self::$driver = strtoupper(string: $driver);
|
||||
self::$connectionName = $dbConnectionName;
|
||||
|
||||
if (!defined(constant_name: 'STORAGE_FOLDER_PATH')) {
|
||||
throw new Exception(message: "Constante 'STORAGE_FOLDER_PATH' não foi definida.");
|
||||
}
|
||||
|
||||
self::$logDir = $logDir ?? STORAGE_FOLDER_PATH . '/logs';
|
||||
|
||||
if (self::$driver === self::DRIVER_DATABASE) {
|
||||
// Garante que a conexão exista
|
||||
Database::getConnection(connectionName: self::$connectionName);
|
||||
}
|
||||
|
||||
if (self::$driver === self::DRIVER_FILE && !is_dir(filename: self::$logDir)) {
|
||||
if (!mkdir(directory: self::$logDir, permissions: 0775, recursive: true) && !is_dir(filename: self::$logDir)) {
|
||||
throw new Exception(message: "Não foi possível criar o diretório de logs: " . self::$logDir);
|
||||
}
|
||||
}
|
||||
|
||||
self::$initialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log genérico
|
||||
*/
|
||||
public static function log(string $message, string $level = 'INFO', array $context = []): void {
|
||||
if (!self::$initialized) {
|
||||
throw new Exception(message: "LoggerService não foi inicializado. Chame LoggerService::init() antes.");
|
||||
}
|
||||
|
||||
switch (self::$driver) {
|
||||
case self::DRIVER_FILE:
|
||||
self::logToFile(message: $message, level: $level);
|
||||
break;
|
||||
case self::DRIVER_DATABASE:
|
||||
self::logToDatabase(message: $message, level: $level, context: $context);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Métodos auxiliares por nível
|
||||
public static function info(string $message, array $context = []): void {
|
||||
self::log(message: $message, level: 'INFO', context: $context);
|
||||
}
|
||||
|
||||
public static function warning(string $message, array $context = []): void {
|
||||
self::log(message: $message, level: 'WARNING', context: $context);
|
||||
}
|
||||
|
||||
public static function error(string $message, array $context = []): void {
|
||||
self::log(message: $message, level: 'ERROR', context: $context);
|
||||
}
|
||||
|
||||
public static function debug(string $message, array $context = []): void {
|
||||
self::log(message: $message, level: 'DEBUG', context: $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log para arquivo
|
||||
*/
|
||||
private static function logToFile(string $message, string $level): void {
|
||||
$date = (new DateTime())->format(format: 'Y-m-d');
|
||||
$now = (new DateTime())->format(format: 'Y-m-d H:i:s');
|
||||
$filename = self::$logDir . "/app-{$date}.log";
|
||||
$logMessage = "[$now][$level] $message" . PHP_EOL;
|
||||
file_put_contents(filename: $filename, data: $logMessage, flags: FILE_APPEND);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log para database usando o Database multi-driver
|
||||
*/
|
||||
private static function logToDatabase(string $message, string $level, array $context = []): void {
|
||||
$sql =
|
||||
"INSERT INTO logs (
|
||||
level,
|
||||
message,
|
||||
context,
|
||||
created_at
|
||||
) VALUES (
|
||||
:level,
|
||||
:message,
|
||||
:context,
|
||||
:created_at
|
||||
)";
|
||||
|
||||
Database::execute(
|
||||
sql: $sql,
|
||||
params: [
|
||||
'level' => $level,
|
||||
'message' => $message,
|
||||
'context' => json_encode(value: $context),
|
||||
'created_at' => (new DateTime())->format(format: 'Y-m-d H:i:s')
|
||||
],
|
||||
connectionName: self::$connectionName
|
||||
);
|
||||
}
|
||||
}
|
||||
267
vendor/claudecio/axiumphp/src/Core/Module/Loader.php
vendored
Executable file
267
vendor/claudecio/axiumphp/src/Core/Module/Loader.php
vendored
Executable file
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
namespace AxiumPHP\Core\Module;
|
||||
|
||||
use Exception;
|
||||
|
||||
class Loader {
|
||||
private $configFilePath;
|
||||
private $configData;
|
||||
private $startedModules = [];
|
||||
private static array $loadedShortcuts = [];
|
||||
private static array $loadedModules = [];
|
||||
private array $requiredConstants = [
|
||||
'MODULE_PATH',
|
||||
];
|
||||
private $modulePath = MODULE_PATH;
|
||||
private $iniSystemPath = INI_SYSTEM_PATH;
|
||||
|
||||
/**
|
||||
* Construtor da classe.
|
||||
*
|
||||
* Inicializa o objeto com o caminho do arquivo de configuração e carrega as configurações.
|
||||
*
|
||||
* @param string $configFileName O caminho do arquivo de configuração (opcional).
|
||||
*/
|
||||
public function __construct(?string $configFileName = "system-ini.json") {
|
||||
$this->configFilePath = "{$this->iniSystemPath}/{$configFileName}";
|
||||
$this->loadConfig();
|
||||
// Verificar as constantes no momento da criação da instância
|
||||
$this->checkRequiredConstants();
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica se todas as constantes necessárias estão definidas.
|
||||
*
|
||||
* @throws Exception Se alguma constante necessária não estiver definida.
|
||||
*/
|
||||
private function checkRequiredConstants(): void {
|
||||
foreach ($this->requiredConstants as $constant) {
|
||||
if (!defined(constant_name: $constant)) {
|
||||
throw new Exception(message: "Constante '{$constant}' não definida.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Carrega as configurações do arquivo JSON.
|
||||
*
|
||||
* Este método lê o conteúdo do arquivo de configuração especificado em
|
||||
* `$this->configFilePath`, decodifica-o de JSON e armazena os dados
|
||||
* no atributo `$this->configData`.
|
||||
*
|
||||
* @throws Exception Se o arquivo de configuração não for encontrado.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function loadConfig():void {
|
||||
$configPath = $this->configFilePath;
|
||||
|
||||
// Verifica se o arquivo de configuração existe
|
||||
if (file_exists(filename: $configPath)) {
|
||||
$jsonContent = file_get_contents(filename: $configPath);
|
||||
$this->configData = json_decode(json: $jsonContent, associative: true);
|
||||
} else {
|
||||
throw new Exception(message: "Arquivo de inicialização não encontrado: {$configPath}");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Carrega os módulos do núcleo do sistema definidos na configuração.
|
||||
*
|
||||
* Este método carrega os módulos listados na seção "Core" do arquivo
|
||||
* de configuração, utilizando o método `startModule`.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loadCoreModules():void {
|
||||
$this->startModule(modules: $this->configData["Modules"]["Core"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Carrega e inicializa todos os módulos ativos da aplicação, conforme
|
||||
* definido na configuração.
|
||||
*
|
||||
* Este método acessa a propriedade `$configData`, especificamente a seção
|
||||
* ["Modules"]["active"], que se espera ser um array contendo os
|
||||
* identificadores (nomes ou objetos) dos módulos que devem ser carregados
|
||||
* e inicializados. Em seguida, chama o método `startModule`, passando este
|
||||
* array de módulos ativos para iniciar o processo de carregamento e
|
||||
* inicialização de cada um deles.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @see startModule()
|
||||
* @property array $configData Propriedade da classe que contém os dados de
|
||||
* configuração da aplicação. Espera-se que possua uma chave "Modules" com
|
||||
* uma sub-chave "active" contendo um array de módulos.
|
||||
*/
|
||||
public function loadActiveModules():void {
|
||||
$this->startModule(modules: $this->configData["Modules"]["Active"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Carrega e inicializa um único módulo da aplicação.
|
||||
*
|
||||
* Este método recebe um identificador de módulo (que pode ser uma string
|
||||
* com o nome do módulo ou um objeto representando o módulo) e o passa para
|
||||
* o método `startModule` para iniciar o processo de carregamento e
|
||||
* inicialização desse módulo específico.
|
||||
*
|
||||
* @param mixed $module O identificador do módulo a ser carregado. Pode ser
|
||||
* uma string contendo o nome do módulo ou um objeto de módulo já instanciado.
|
||||
* O tipo exato depende da implementação do sistema de módulos.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @see startModule()
|
||||
*/
|
||||
public function loadModule(mixed $module) {
|
||||
$this->startModule(modules: [$module]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna os atalhos carregados para um slug de módulo específico.
|
||||
*
|
||||
* Este método estático permite acessar atalhos que foram previamente carregados
|
||||
* e armazenados na propriedade estática `self::$loadedShortcuts`. Ele espera
|
||||
* o slug (identificador amigável) de um módulo como entrada e retorna o array
|
||||
* de atalhos associado a ele.
|
||||
*
|
||||
* @param string $moduleSlug O slug do módulo para o qual os atalhos devem ser retornados.
|
||||
* @return array|null Um array contendo os atalhos para o módulo especificado, ou `null`
|
||||
* se nenhum atalho tiver sido carregado para aquele slug.
|
||||
*/
|
||||
public static function getShortcuts(string $moduleSlug): ?array {
|
||||
if(isset(self::$loadedShortcuts[$moduleSlug]['shortcuts'])) {
|
||||
return self::$loadedShortcuts[$moduleSlug]['shortcuts'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna os slugs dos módulos que foram carregados.
|
||||
*
|
||||
* Este método estático fornece acesso à lista de identificadores (slugs)
|
||||
* de todos os módulos que foram previamente carregados e armazenados na
|
||||
* propriedade estática `self::$loadedModules`. É útil para verificar
|
||||
* quais módulos estão ativos ou disponíveis no contexto atual da aplicação.
|
||||
*
|
||||
* @return array|null Um array contendo os slugs dos módulos carregados, ou `null`
|
||||
* se nenhum módulo tiver sido carregado ou se a propriedade estiver vazia.
|
||||
*/
|
||||
public static function getSlugLoadedModules(): ?array {
|
||||
return self::$loadedModules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Busca o nome real de uma subpasta dentro de um diretório base,
|
||||
* ignorando a diferença entre maiúsculas e minúsculas.
|
||||
*
|
||||
* Este método privado recebe um `$basePath` (o diretório onde procurar)
|
||||
* e um `$targetName` (o nome da pasta desejada). Primeiro, verifica se o
|
||||
* `$basePath` é um diretório válido. Se não for, retorna null. Em seguida,
|
||||
* lê todos os arquivos e pastas dentro do `$basePath`. Para cada entrada,
|
||||
* compara o nome da entrada com o `$targetName` de forma case-insensitive.
|
||||
* Se encontrar uma entrada que corresponda ao `$targetName` (ignorando o case)
|
||||
* e que seja um diretório, retorna o nome da entrada com o seu case real.
|
||||
* Se após verificar todas as entradas nenhuma pasta correspondente for
|
||||
* encontrada, retorna null.
|
||||
*
|
||||
* @param string $basePath O caminho para o diretório base onde a subpasta será procurada.
|
||||
* @param string $targetName O nome da subpasta a ser encontrada (a comparação é case-insensitive).
|
||||
* @return string|null O nome real da pasta (com o case correto) se encontrada, ou null caso contrário.
|
||||
*/
|
||||
private function getRealFolderName(string $basePath, string $targetName): ?string {
|
||||
if (!is_dir(filename: $basePath)) return null;
|
||||
|
||||
$entries = scandir(directory: $basePath);
|
||||
foreach ($entries as $entry) {
|
||||
if (strcasecmp(string1: $entry, string2: $targetName) === 0 && is_dir(filename: "{$basePath}/{$entry}")) {
|
||||
return $entry; // Nome com o case real
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inicia os módulos especificados.
|
||||
*
|
||||
* Este método itera sobre a lista de módulos fornecida, carrega seus manifestos,
|
||||
* verifica a compatibilidade da versão, carrega as dependências e inclui o
|
||||
* arquivo de bootstrap do módulo.
|
||||
*
|
||||
* @param array $modules Um array de strings representando os módulos a serem iniciados.
|
||||
* Cada string deve estar no formato "nome_do_modulo@versao".
|
||||
*
|
||||
* @throws Exception Se o manifesto do módulo não for encontrado, se houver um erro ao decodificar
|
||||
* o manifesto, se a versão do módulo for incompatível ou se o bootstrap
|
||||
* do módulo não for encontrado.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function startModule(array $modules): void {
|
||||
foreach ($modules as $module) {
|
||||
// Identifica o módulo requisitado e sua versão
|
||||
[$moduleName, $version] = explode(separator: '@', string: $module);
|
||||
|
||||
// Pega o nome real da pasta do módulo
|
||||
$realModuleFolder = $this->getRealFolderName(basePath: $this->modulePath, targetName: $moduleName);
|
||||
if (!$realModuleFolder) {
|
||||
throw new Exception(message: "Pasta do módulo '{$moduleName}' não encontrada.");
|
||||
}
|
||||
|
||||
// Caminho do manifesto usando o nome real
|
||||
$manifestPath = "{$this->modulePath}/{$realModuleFolder}/manifest.json";
|
||||
if (!file_exists(filename: $manifestPath)) {
|
||||
throw new Exception(message: "Manifesto do módulo '{$moduleName}' não encontrado.");
|
||||
}
|
||||
|
||||
$moduleManifest = json_decode(json: file_get_contents(filename: $manifestPath), associative: true);
|
||||
if (!$moduleManifest) {
|
||||
throw new Exception(message: "Erro ao decodificar o manifesto do módulo '{$moduleName}'.");
|
||||
}
|
||||
|
||||
// Evita carregar o mesmo módulo mais de uma vez
|
||||
if (in_array(needle: $moduleManifest["uuid"], haystack: $this->startedModules)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Verifica se a versão é compatível
|
||||
if ($moduleManifest['version'] !== $version) {
|
||||
throw new Exception(message: "Versão do módulo '{$moduleName}' é incompatível. Versão requerida: {$version}. Versão instalada: {$moduleManifest['version']}");
|
||||
}
|
||||
|
||||
// Inicia Bootstrap do Módulo
|
||||
$bootstrapModuleFile = "{$this->modulePath}/{$realModuleFolder}/bootstrap.php";
|
||||
if (file_exists(filename: $bootstrapModuleFile)) {
|
||||
require_once $bootstrapModuleFile;
|
||||
}
|
||||
|
||||
// Procura a pasta Routes com o case correto
|
||||
$realRoutesFolder = $this->getRealFolderName(basePath: "{$this->modulePath}/{$realModuleFolder}", targetName: 'Routes');
|
||||
if ($realRoutesFolder) {
|
||||
// Procura arquivo com atalhos de rotas
|
||||
$shortcutsFile = "{$this->modulePath}/{$realModuleFolder}/{$realRoutesFolder}/shortcuts.json";
|
||||
if (file_exists(filename: $shortcutsFile)) {
|
||||
$shortcuts = json_decode(
|
||||
json: file_get_contents(filename: $shortcutsFile),
|
||||
associative: true
|
||||
);
|
||||
|
||||
self::$loadedShortcuts[$moduleManifest["slug"]] = $shortcuts;
|
||||
}
|
||||
}
|
||||
|
||||
// Marca como carregado
|
||||
$this->startedModules[] = $moduleManifest["uuid"];
|
||||
self::$loadedModules[] = $moduleManifest["slug"];
|
||||
|
||||
// Carrega dependências, se existirem
|
||||
if (!empty($moduleManifest['dependencies'])) {
|
||||
$this->startModule(modules: $moduleManifest['dependencies']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
672
vendor/claudecio/axiumphp/src/Core/Router.php
vendored
Executable file
672
vendor/claudecio/axiumphp/src/Core/Router.php
vendored
Executable file
@@ -0,0 +1,672 @@
|
||||
<?php
|
||||
namespace AxiumPHP\Core;
|
||||
|
||||
use Exception;
|
||||
|
||||
class Router {
|
||||
private static $routes = [];
|
||||
private static $params = [];
|
||||
private static $ROUTER_MODE = null;
|
||||
private static $APP_SYS_MODE = null;
|
||||
private static $ROUTER_ALLOWED_ORIGINS = ['*'];
|
||||
private static $currentGroupPrefix = '';
|
||||
private static $currentGroupMiddlewares = [];
|
||||
private static array $requiredConstants = [
|
||||
'ROUTER_MODE',
|
||||
'APP_SYS_MODE'
|
||||
];
|
||||
private static array $allowedHttpRequests = [
|
||||
'GET',
|
||||
'POST',
|
||||
'PUT',
|
||||
'PATCH',
|
||||
'DELETE',
|
||||
'OPTIONS'
|
||||
];
|
||||
|
||||
/**
|
||||
* Construtor que vai garantir que as constantes necessárias estejam definidas antes de
|
||||
* instanciar a view.
|
||||
*/
|
||||
public function __construct() {
|
||||
// Verificar as constantes no momento da criação da instância
|
||||
self::checkRequiredConstant();
|
||||
|
||||
// Define constante
|
||||
self::$ROUTER_MODE = strtoupper(string: ROUTER_MODE);
|
||||
self::$APP_SYS_MODE = strtoupper(string: APP_SYS_MODE);
|
||||
|
||||
// Se o modo de roteamento for JSON, define as origens permitidas
|
||||
if(self::$ROUTER_MODE === 'JSON') {
|
||||
self::$ROUTER_ALLOWED_ORIGINS = ROUTER_ALLOWED_ORIGINS;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna o modo de roteamento atual.
|
||||
*
|
||||
* Este método estático simplesmente retorna o valor da propriedade estática `self::$ROUTER_MODE`.
|
||||
* Ele é usado para obter o modo de operação do roteador, que pode indicar se está
|
||||
* em modo de desenvolvimento, produção ou outro modo configurado.
|
||||
*
|
||||
* @return string O modo de roteamento como uma string.
|
||||
*/
|
||||
public static function getMode(): string {
|
||||
return (string) self::$ROUTER_MODE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica se todas as constantes necessárias estão definidas.
|
||||
*
|
||||
* @throws Exception Se alguma constante necessária não estiver definida.
|
||||
*/
|
||||
private static function checkRequiredConstant(): void {
|
||||
foreach (self::$requiredConstants as $constant) {
|
||||
if (!defined(constant_name: $constant)) {
|
||||
http_response_code(response_code: 500);
|
||||
header(header: "Content-Type: application/json; charset=utf-8");
|
||||
echo json_encode(value: [
|
||||
"status" => 'error',
|
||||
"message" => "Constante '{$constant}' não definida.",
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adiciona uma rota com método GET à lista de rotas da aplicação.
|
||||
*
|
||||
* Este método é um atalho para adicionar rotas com o método HTTP GET. Ele
|
||||
* chama o método `addRoute` internamente, passando os parâmetros
|
||||
* fornecidos e o método 'GET'.
|
||||
*
|
||||
* @param string $uri O caminho da rota (ex: '/usuarios', '/produtos').
|
||||
* @param array $handler Um array contendo o nome do controlador e o nome da ação
|
||||
* que devem ser executados quando a rota for
|
||||
* corresponder (ex: ['UsuarioController', 'index']).
|
||||
* @param array $middlewares Um array opcional contendo os nomes dos middlewares que
|
||||
* devem ser executados antes do handler da rota.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function GET(string $uri, array $handler, array $middlewares = []): void {
|
||||
self::addRoute(method: "GET", uri: $uri, handler: $handler, middlewares: $middlewares);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adiciona uma rota com método POST à lista de rotas da aplicação.
|
||||
*
|
||||
* Este método é um atalho para adicionar rotas com o método HTTP POST. Ele
|
||||
* chama o método `addRoute` internamente, passando os parâmetros
|
||||
* fornecidos e o método 'POST'.
|
||||
*
|
||||
* @param string $uri O caminho da rota (ex: '/usuarios', '/produtos').
|
||||
* @param array $handler Um array contendo o nome do controlador e o nome da ação
|
||||
* que devem ser executados quando a rota for
|
||||
* corresponder (ex: ['UsuarioController', 'salvar']).
|
||||
* @param array $middlewares Um array opcional contendo os nomes dos middlewares que
|
||||
* devem ser executados antes do handler da rota.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function POST(string $uri, array $handler, array $middlewares = []): void {
|
||||
self::addRoute(method: "POST", uri: $uri, handler: $handler, middlewares: $middlewares);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adiciona uma rota com método PUT à lista de rotas da aplicação.
|
||||
*
|
||||
* Este método é um atalho para adicionar rotas com o método HTTP PUT. Ele
|
||||
* chama o método `addRoute` internamente, passando os parâmetros
|
||||
* fornecidos e o método 'PUT'.
|
||||
*
|
||||
* @param string $uri O caminho da rota (ex: '/usuarios', '/produtos').
|
||||
* @param array $handler Um array contendo o nome do controlador e o nome da ação
|
||||
* que devem ser executados quando a rota for
|
||||
* corresponder (ex: ['UsuarioController', 'salvar']).
|
||||
* @param array $middlewares Um array opcional contendo os nomes dos middlewares que
|
||||
* devem ser executados antes do handler da rota.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function PUT(string $uri, array $handler, array $middlewares = []): void {
|
||||
self::addRoute(method: "PUT", uri: $uri, handler: $handler, middlewares: $middlewares);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adiciona uma nova rota que responde a requisições PATCH.
|
||||
*
|
||||
* Este é um método estático de conveniência que simplifica o registro de rotas
|
||||
* para o método HTTP PATCH. Ele delega a tarefa principal para o método
|
||||
* privado `addRoute`, passando o método HTTP, a URI, a função de manipulação
|
||||
* (`handler`) e quaisquer middlewares associados.
|
||||
*
|
||||
* @param string $uri A URI da rota (ex: '/api/resource/{id}').
|
||||
* @param array $handler Um array de dois elementos que define o manipulador da rota: o nome da classe do controlador e o nome do método a ser executado.
|
||||
* @param array $middlewares Um array opcional de middlewares a serem executados antes do manipulador da rota.
|
||||
* @return void
|
||||
*/
|
||||
public static function PATCH(string $uri, array $handler, array $middlewares = []): void {
|
||||
self::addRoute(method: "PATCH", uri: $uri, handler: $handler, middlewares: $middlewares);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adiciona uma rota com método DELETE à lista de rotas da aplicação.
|
||||
*
|
||||
* Este método é um atalho para adicionar rotas com o método HTTP DELETE. Ele
|
||||
* chama o método `addRoute` internamente, passando os parâmetros
|
||||
* fornecidos e o método 'DELETE'.
|
||||
*
|
||||
* @param string $uri O caminho da rota (ex: '/usuarios', '/produtos').
|
||||
* @param array $handler Um array contendo o nome do controlador e o nome da ação
|
||||
* que devem ser executados quando a rota for
|
||||
* corresponder (ex: ['UsuarioController', 'salvar']).
|
||||
* @param array $middlewares Um array opcional contendo os nomes dos middlewares que
|
||||
* devem ser executados antes do handler da rota.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function DELETE(string $uri, array $handler, array $middlewares = []): void {
|
||||
self::addRoute(method: "DELETE", uri: $uri, handler: $handler, middlewares: $middlewares);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adiciona uma rota à lista de rotas da aplicação.
|
||||
*
|
||||
* Este método estático armazena informações sobre uma rota (método HTTP,
|
||||
* caminho, controlador, ação e middlewares) em um array interno `$routes`
|
||||
* para posterior processamento pelo roteador.
|
||||
*
|
||||
* @param string $method O método HTTP da rota (ex: 'GET', 'POST', 'PUT', 'DELETE').
|
||||
* @param string $uri O caminho da rota (ex: '/usuarios', '/produtos/:id').
|
||||
* @param array $handler Um array contendo o nome do controlador e o nome da ação
|
||||
* que devem ser executados quando a rota for
|
||||
* corresponder (ex: ['UsuarioController', 'index']).
|
||||
* @param array $middlewares Um array opcional contendo os nomes dos middlewares que
|
||||
* devem ser executados antes do handler da rota.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function addRoute(string $method, string $uri, array $handler, array $middlewares = []): void {
|
||||
self::$routes[] = [
|
||||
'method' => strtoupper(string: $method),
|
||||
'path' => '/' . trim(string: self::$currentGroupPrefix . '/' . trim(string: $uri, characters: '/'), characters: '/'),
|
||||
'controller' => $handler[0],
|
||||
'action' => $handler[1],
|
||||
'middlewares' => array_merge(self::$currentGroupMiddlewares, $middlewares)
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica se um caminho de rota corresponde a um caminho de requisição.
|
||||
*
|
||||
* Este método estático compara um caminho de rota definido (ex: '/usuarios/:id')
|
||||
* com um caminho de requisição (ex: '/usuarios/123'). Ele suporta parâmetros
|
||||
* de rota definidos entre chaves (ex: ':id', ':nome'). Os parâmetros
|
||||
* correspondentes do caminho de requisição são armazenados no array estático
|
||||
* `$params` da classe.
|
||||
*
|
||||
* @param string $routePath O caminho da rota a ser comparado.
|
||||
* @param string $requestPath O caminho da requisição a ser comparado.
|
||||
*
|
||||
* @return bool True se o caminho da requisição corresponder ao caminho da
|
||||
* rota, false caso contrário.
|
||||
*/
|
||||
private static function matchPath($routePath, $requestPath): bool {
|
||||
// Limpa os parâmetros antes de capturar novos
|
||||
self::$params = []; // Certifica que a cada nova tentativa, a lista de parâmetros começa vazia
|
||||
|
||||
$routeParts = explode(separator: '/', string: trim(string: $routePath, characters: '/'));
|
||||
$requestParts = explode(separator: '/', string: trim(string: $requestPath, characters: '/'));
|
||||
|
||||
if (count(value: $routeParts) !== count(value: $requestParts)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($routeParts as $i => $part) {
|
||||
if (preg_match(pattern: '/^{\w+}$/', subject: $part)) {
|
||||
self::$params[] = $requestParts[$i];
|
||||
} elseif ($part !== $requestParts[$i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Agrupa rotas sob um prefixo e middlewares.
|
||||
*
|
||||
* Este método estático permite agrupar rotas que compartilham um prefixo de
|
||||
* caminho e/ou middlewares. O prefixo e os middlewares definidos dentro do
|
||||
* grupo serão aplicados a todas as rotas definidas dentro da função de
|
||||
* callback.
|
||||
*
|
||||
* @param string $prefix O prefixo a ser adicionado aos caminhos das rotas
|
||||
* dentro do grupo (ex: '/admin', '/api/v1').
|
||||
* @param callable $callback Uma função anônima (callback) que define as rotas
|
||||
* que pertencem a este grupo.
|
||||
* @param array $middlewares Um array opcional contendo os middlewares que devem
|
||||
* ser aplicados a todas as rotas dentro do
|
||||
* grupo.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function group(string $prefix, callable $callback, array $middlewares = []): void {
|
||||
$previousPrefix = self::$currentGroupPrefix ?? '';
|
||||
$previousMiddlewares = self::$currentGroupMiddlewares ?? [];
|
||||
|
||||
self::$currentGroupPrefix = $previousPrefix . $prefix;
|
||||
self::$currentGroupMiddlewares = array_merge($previousMiddlewares, $middlewares);
|
||||
|
||||
call_user_func(callback: $callback);
|
||||
|
||||
self::$currentGroupPrefix = $previousPrefix;
|
||||
self::$currentGroupMiddlewares = $previousMiddlewares;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extrai os dados do corpo da requisição HTTP.
|
||||
*
|
||||
* Este método estático é responsável por analisar e retornar os dados enviados
|
||||
* no corpo de uma requisição HTTP, especialmente para métodos como `PUT` e `DELETE`,
|
||||
* onde os dados não são automaticamente populados em superglobais como `$_POST` ou `$_GET`.
|
||||
*
|
||||
* O fluxo de extração é o seguinte:
|
||||
* 1. **Lê o Corpo da Requisição:** `file_get_contents('php://input')` lê o conteúdo bruto do corpo da requisição HTTP.
|
||||
* 2. **Processamento Condicional:**
|
||||
* * **Para métodos `PUT` ou `DELETE`:**
|
||||
* * Verifica se o corpo da requisição (`$inputData`) não está vazio.
|
||||
* * **Verifica o `Content-Type`:**
|
||||
* * Se o `Content-Type` for `application/json`, tenta decodificar o corpo da requisição como JSON.
|
||||
* * Se houver um erro na decodificação JSON, ele define o código de status HTTP para 500,
|
||||
* envia uma resposta JSON com uma mensagem de erro e encerra a execução.
|
||||
* * Se o `Content-Type` não for `application/json` (ou não estiver definido), tenta analisar o corpo da requisição
|
||||
* como uma string de query URL (`parse_str`), o que é comum para `application/x-www-form-urlencoded`
|
||||
* em requisições `PUT`/`DELETE`.
|
||||
* * **Para outros métodos (e.g., `POST`, `GET`):** O método não tenta extrair dados do `php://input`.
|
||||
* Nesses casos, presume-se que os dados já estariam disponíveis em `$_POST`, `$_GET`, etc.
|
||||
* 3. **Limpeza Final:** Remove a chave `_method` dos dados, se presente. Essa chave é frequentemente
|
||||
* usada em formulários HTML para simular métodos `PUT` ou `DELETE` através de um campo oculto.
|
||||
*
|
||||
* @param string $method O método HTTP da requisição (e.g., 'GET', 'POST', 'PUT', 'DELETE').
|
||||
* @return array Um array associativo contendo os dados extraídos do corpo da requisição.
|
||||
* Em caso de erro de decodificação JSON, a execução é encerrada com uma resposta de erro HTTP.
|
||||
*/
|
||||
private static function extractRequestData(string $method): array {
|
||||
$inputData = file_get_contents(filename: 'php://input');
|
||||
$data = [];
|
||||
|
||||
// Só processa se for PUT ou DELETE e tiver dados no corpo
|
||||
if (in_array(needle: $method, haystack: ['PUT', 'DELETE', 'PATCH']) && !empty($inputData)) {
|
||||
$contentType = $_SERVER['CONTENT_TYPE'] ?? '';
|
||||
|
||||
// Se for JSON
|
||||
if (str_contains(haystack: $contentType, needle: 'application/json')) {
|
||||
$data = json_decode(json: $inputData, associative: true);
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
http_response_code(response_code: 500);
|
||||
header(header: "Content-Type: application/json; charset=utf-8");
|
||||
$json_error = json_last_error_msg();
|
||||
|
||||
echo json_encode(value: [
|
||||
"status" => 'error',
|
||||
"message" => "Erro ao decodificar JSON: {$json_error}"
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
// Se for outro tipo (ex: x-www-form-urlencoded)
|
||||
else {
|
||||
parse_str(string: $inputData, result: $data);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove o _method se tiver
|
||||
if(isset($data['_method'])) {
|
||||
unset($data['_method']);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executa os middlewares.
|
||||
*
|
||||
* Este método estático itera sobre um array de middlewares e executa cada um
|
||||
* deles. Os middlewares podem ser especificados como 'Classe::metodo' ou
|
||||
* 'Classe::metodo:argumento1:argumento2' para passar argumentos para o
|
||||
* método do middleware. Se um middleware retornar `false`, a execução é
|
||||
* interrompida e a função retorna `false`.
|
||||
*
|
||||
* @param array $middlewares Um array contendo os middlewares a serem executados.
|
||||
*
|
||||
* @return bool True se todos os middlewares forem executados com sucesso,
|
||||
* false se algum middleware falhar.
|
||||
* @throws Exception Se o formato do middleware for inválido ou se o método
|
||||
* do middleware não existir.
|
||||
*/
|
||||
public static function runMiddlewares(array $middlewares): bool {
|
||||
foreach ($middlewares as $middleware) {
|
||||
try {
|
||||
// valida formato
|
||||
if (!is_array(value: $middleware) || count(value: $middleware) < 2) {
|
||||
http_response_code(response_code: 500);
|
||||
header(header: 'Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode(value: [
|
||||
"status" => 'error',
|
||||
"message" => "Formato inválido do middleware. Esperado: [Classe::class, 'método', ...args]"
|
||||
]);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Classe
|
||||
$class = $middleware[0];
|
||||
array_shift(array: $middleware);
|
||||
|
||||
// Método
|
||||
$method = $middleware[0];
|
||||
array_shift(array: $middleware);
|
||||
|
||||
// Argumentos
|
||||
$args = $middleware;
|
||||
|
||||
// Valida se a classe existe
|
||||
if (!class_exists(class: $class)) {
|
||||
http_response_code(response_code: 500);
|
||||
header(header: 'Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode(value: [
|
||||
"status" => 'error',
|
||||
"message" => "Classe de middleware '{$class}' não encontrada."
|
||||
]);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Valida se o método existe
|
||||
if (!method_exists(object_or_class: $class, method: $method)) {
|
||||
http_response_code(response_code: 500);
|
||||
header(header: 'Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode(value: [
|
||||
"status" => 'error',
|
||||
"message" => "Método '{$method}' não existe na classe '{$class}'."
|
||||
]);
|
||||
return false;
|
||||
}
|
||||
|
||||
// instancia (suporta métodos de instância)
|
||||
$instance = new $class();
|
||||
|
||||
// executa middleware
|
||||
$result = call_user_func_array(callback: [$instance, $method], args: $args);
|
||||
|
||||
// bloqueou a requisição
|
||||
if ($result === false) {
|
||||
http_response_code(response_code: 403);
|
||||
header(header: 'Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode(value: [
|
||||
"status" => 'error',
|
||||
"message" => "{$class}::{$method} bloqueou a requisição.",
|
||||
]);
|
||||
return false;
|
||||
}
|
||||
|
||||
// retorno array de erro
|
||||
if (is_array(value: $result)) {
|
||||
$status = $result['status'] ?? 'error';
|
||||
if ($status !== 'success') {
|
||||
http_response_code(response_code: $result['response_code'] ?? 403);
|
||||
header(header: 'Content-Type: application/json; charset=utf-8');
|
||||
|
||||
$response = [
|
||||
"response_code" => $result['response_code'] ?? 403,
|
||||
"status" => $status,
|
||||
"message" => $result['message'] ?? 'Erro no middleware'
|
||||
];
|
||||
|
||||
if (isset($result['output'])) {
|
||||
$response['output'] = $result['output'];
|
||||
}
|
||||
|
||||
echo json_encode(value: $response);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
http_response_code(response_code: 500);
|
||||
header(header: 'Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode(value: [
|
||||
"status" => 'error',
|
||||
"message" => $e->getMessage()
|
||||
]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true; // passou por todos os middlewares
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica se uma rota corresponde à requisição.
|
||||
*
|
||||
* Este método verifica se o método HTTP e o caminho da requisição correspondem
|
||||
* aos da rota fornecida.
|
||||
*
|
||||
* @param string $method O método HTTP da requisição.
|
||||
* @param string $uri O caminho da requisição.
|
||||
* @param array $route Um array associativo contendo os dados da rota.
|
||||
*
|
||||
* @return bool Retorna true se a rota corresponder, false caso contrário.
|
||||
*/
|
||||
private static function matchRoute(string $method, string $uri, array $route) {
|
||||
// Verifica se o método HTTP da rota corresponde ao da requisição
|
||||
if ($route['method'] !== $method) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Verifica se o caminho da requisição corresponde ao caminho da rota
|
||||
return self::matchPath(routePath: $route['path'], requestPath: $uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepara os parâmetros para um método de requisição.
|
||||
*
|
||||
* Este método combina os parâmetros da rota, os parâmetros GET e, para
|
||||
* requisições PUT ou DELETE, os parâmetros fornecidos, retornando um
|
||||
* array de parâmetros preparados.
|
||||
*
|
||||
* @param string $method O método HTTP da requisição (GET, POST, PUT, DELETE).
|
||||
* @param array|null $params Um array opcional de parâmetros adicionais.
|
||||
*
|
||||
* @return array Um array contendo os parâmetros preparados.
|
||||
*/
|
||||
private static function prepareMethodParameters(string $method, ?array $params = []): array {
|
||||
// Guarda os parâmetros atuais (da rota)
|
||||
$atuallParams = self::$params;
|
||||
|
||||
// Adiciona os dados de PUT/DELETE/PATCH como um array no final
|
||||
if (in_array(needle: $method, haystack: ['PUT', 'DELETE', 'PATCH'])) {
|
||||
self::$params = array_merge($atuallParams, $params);
|
||||
}
|
||||
|
||||
// Normaliza os parâmetros para um array sequencial
|
||||
$preparedParams = array_values(array: self::$params);
|
||||
|
||||
return $preparedParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Despacha a requisição para o controlador e ação correspondentes.
|
||||
*
|
||||
* Este método estático analisa a requisição (método HTTP e caminho), encontra
|
||||
* a rota correspondente na lista de rotas definidas, executa os middlewares
|
||||
* da rota (se houver), instancia o controlador e chama a ação (método)
|
||||
* especificada na rota, passando os parâmetros da requisição (parâmetros da
|
||||
* rota, parâmetros GET e dados de PUT/DELETE). Se nenhuma rota
|
||||
* corresponder, um erro 404 é enviado.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function dispatch(): void {
|
||||
// Verificar as constantes necessárias antes de processar a requisição
|
||||
self::checkRequiredConstant();
|
||||
|
||||
$method = $_SERVER['REQUEST_METHOD'];
|
||||
$uri = parse_url(url: $_SERVER['REQUEST_URI'], component: PHP_URL_PATH);
|
||||
$uri = trim(string: rtrim(string: $uri, characters: '/'), characters: '/');
|
||||
|
||||
// Suporte ao _method em POST para PUT/DELETE/PATCH
|
||||
if ($method === 'POST' && isset($_POST['_method'])) {
|
||||
$method = strtoupper(string: $_POST['_method']);
|
||||
}
|
||||
|
||||
// Verifica se o método HTTP é permitido
|
||||
if(!in_array(needle: $method, haystack: self::$allowedHttpRequests)) {
|
||||
http_response_code(response_code: 405);
|
||||
header(header: 'Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode(value: [
|
||||
"status" => 'error',
|
||||
"message" => "Método HTTP '{$method}' não permitido."
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// =============================
|
||||
// HEADERS CORS PARA TODOS OS MÉTODOS
|
||||
// =============================
|
||||
if (self::$ROUTER_MODE === 'JSON') {
|
||||
$origin = $_SERVER['HTTP_ORIGIN'] ?? '*';
|
||||
|
||||
if (in_array(needle: '*', haystack: self::$ROUTER_ALLOWED_ORIGINS)) {
|
||||
header(header: "Access-Control-Allow-Origin: *");
|
||||
} elseif (in_array(needle: $origin, haystack: self::$ROUTER_ALLOWED_ORIGINS)) {
|
||||
header(header: "Access-Control-Allow-Origin: $origin");
|
||||
} else {
|
||||
if (self::$APP_SYS_MODE === 'DEV') {
|
||||
header(header: "Access-Control-Allow-Origin: $origin");
|
||||
} else {
|
||||
http_response_code(response_code: 403);
|
||||
header(header: 'Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode(value: [
|
||||
"status" => 'error',
|
||||
"message" => "Origem '{$origin}' não permitida pelo CORS."
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
header(header: 'Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS');
|
||||
header(header: 'Access-Control-Allow-Headers: Content-Type, Authorization');
|
||||
}
|
||||
|
||||
// =============================
|
||||
// TRATAMENTO DO PRE-FLIGHT (OPTIONS)
|
||||
// =============================
|
||||
if ($method === 'OPTIONS') {
|
||||
http_response_code(response_code: 204); // No Content
|
||||
exit;
|
||||
}
|
||||
|
||||
// =============================
|
||||
// EXTRAI DADOS DE PUT, DELETE, PATCH
|
||||
// =============================
|
||||
$requestData = match($method) {
|
||||
'GET' => null,
|
||||
'POST' => null,
|
||||
default => self::extractRequestData(method: $method)
|
||||
};
|
||||
|
||||
// =============================
|
||||
// LOOP PARA PROCESSAR ROTAS
|
||||
// =============================
|
||||
foreach (self::$routes as $route) {
|
||||
if (self::matchRoute(method: $method, uri: $uri, route: $route)) {
|
||||
// Executa middlewares
|
||||
if (!empty($route['middlewares']) && !self::runMiddlewares(middlewares: $route['middlewares'])) {
|
||||
return; // Middleware bloqueou
|
||||
}
|
||||
|
||||
$controller = new $route['controller']();
|
||||
$action = $route['action'];
|
||||
$params = self::prepareMethodParameters(method: $method, params: [$requestData]);
|
||||
|
||||
switch (self::$ROUTER_MODE) {
|
||||
case 'VIEW':
|
||||
if (method_exists(object_or_class: $controller, method: $action)) {
|
||||
http_response_code(response_code: 200);
|
||||
call_user_func_array(callback: [$controller, $action], args: $params);
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'JSON':
|
||||
if (method_exists(object_or_class: $controller, method: $action)) {
|
||||
http_response_code(response_code: 200);
|
||||
header(header: 'Content-Type: application/json; charset=utf-8');
|
||||
call_user_func_array(callback: [$controller, $action], args: $params);
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =============================
|
||||
// ROTA NÃO ENCONTRADA
|
||||
// =============================
|
||||
self::pageNotFound();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Exibe a página de erro 404 (Página não encontrada).
|
||||
*
|
||||
* Este método estático define o código de resposta HTTP como 404 e renderiza
|
||||
* a view "/Errors/404" para exibir a página de erro. Após a renderização,
|
||||
* o script é encerrado.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function pageNotFound(): void {
|
||||
switch (self::$ROUTER_MODE) {
|
||||
case 'VIEW':
|
||||
// Notifica erro em caso constante não definida
|
||||
if(!defined(constant_name: 'ERROR_404_VIEW_PATH')) {
|
||||
http_response_code(response_code: 500);
|
||||
header(header: 'Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode( value: [
|
||||
"status" => 'error',
|
||||
"message" => "Constante 'ERROR_404_VIEW_PATH' não foi definida.",
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Caso o arquivo da constante não exista, notifica erro
|
||||
if(!file_exists(filename: ERROR_404_VIEW_PATH)) {
|
||||
http_response_code(response_code: 500);
|
||||
header(header: 'Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode( value: [
|
||||
"status" => 'error',
|
||||
"message" => "Arquivo da constante 'ERROR_404_VIEW_PATH' não foi encontrado.",
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
http_response_code(response_code: 404);
|
||||
require_once ERROR_404_VIEW_PATH;
|
||||
break;
|
||||
|
||||
case 'JSON':
|
||||
http_response_code(response_code: 404);
|
||||
header(header: 'Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode( value: [
|
||||
"status" => 'error',
|
||||
"message" => "Página não encontrada.",
|
||||
]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
140
vendor/claudecio/axiumphp/src/Core/View.php
vendored
Executable file
140
vendor/claudecio/axiumphp/src/Core/View.php
vendored
Executable file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
namespace AxiumPHP\Core;
|
||||
|
||||
use Exception;
|
||||
|
||||
class View {
|
||||
private array $requiredConstants = [
|
||||
'VIEW_PATH',
|
||||
];
|
||||
|
||||
/**
|
||||
* Construtor que vai garantir que as constantes necessárias estejam definidas antes de
|
||||
* instanciar a view.
|
||||
*/
|
||||
public function __construct() {
|
||||
// Verificar as constantes no momento da criação da instância
|
||||
$this->checkRequiredConstants();
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica se todas as constantes necessárias estão definidas.
|
||||
*
|
||||
* @throws Exception Se alguma constante necessária não estiver definida.
|
||||
*/
|
||||
private function checkRequiredConstants(): void {
|
||||
foreach ($this->requiredConstants as $constant) {
|
||||
if (!defined(constant_name: $constant)) {
|
||||
throw new Exception(message: "Constante '{$constant}' não definida.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Busca o nome real de uma subpasta dentro de um diretório base,
|
||||
* ignorando a diferença entre maiúsculas e minúsculas.
|
||||
*
|
||||
* Este método privado recebe um `$basePath` (o diretório onde procurar)
|
||||
* e um `$targetName` (o nome da pasta desejada). Primeiro, verifica se o
|
||||
* `$basePath` é um diretório válido. Se não for, retorna null. Em seguida,
|
||||
* lê todos os arquivos e pastas dentro do `$basePath`. Para cada entrada,
|
||||
* compara o nome da entrada com o `$targetName` de forma case-insensitive.
|
||||
* Se encontrar uma entrada que corresponda ao `$targetName` (ignorando o case)
|
||||
* e que seja um diretório, retorna o nome da entrada com o seu case real.
|
||||
* Se após verificar todas as entradas nenhuma pasta correspondente for
|
||||
* encontrada, retorna null.
|
||||
*
|
||||
* @param string $basePath O caminho para o diretório base onde a subpasta será procurada.
|
||||
* @param string $targetName O nome da subpasta a ser encontrada (a comparação é case-insensitive).
|
||||
* @return string|null O nome real da pasta (com o case correto) se encontrada, ou null caso contrário.
|
||||
*/
|
||||
private static function getRealFolderName(string $basePath, string $targetName): ?string {
|
||||
if (!is_dir(filename: $basePath)) return null;
|
||||
|
||||
$entries = scandir(directory: $basePath);
|
||||
foreach ($entries as $entry) {
|
||||
if (strcasecmp(string1: $entry, string2: $targetName) === 0 && is_dir(filename: $basePath . '/' . $entry)) {
|
||||
return $entry; // Nome com o case real
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renderiza uma view dentro de um layout, com suporte a módulos.
|
||||
*
|
||||
* Este método estático inclui o arquivo de view especificado, permitindo a
|
||||
* passagem de dados para a view através do array `$data`. As variáveis
|
||||
* do array `$data` são extraídas para uso dentro da view usando `extract()`.
|
||||
* O método também permite especificar um layout e um módulo para a view.
|
||||
*
|
||||
* @param string $view O caminho para o arquivo de view, relativo ao diretório
|
||||
* `views` ou `modules/{$module}/views` (ex:
|
||||
* 'usuarios/listar', 'index').
|
||||
* @param array $data Um array associativo contendo os dados a serem passados
|
||||
* para a view. As chaves do array se tornarão variáveis
|
||||
* disponíveis dentro da view.
|
||||
* @param string $layout O caminho para o arquivo de layout, relativo ao
|
||||
* diretório `views` (ex: 'layouts/main').
|
||||
* @param string $module O nome do módulo ao qual a view pertence (opcional).
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function render(string $view, array $data = [], ?string $layout = null, ?string $module = null): void {
|
||||
$viewPath = VIEW_PATH . "/{$view}.php";
|
||||
|
||||
// Se for módulo, resolve o nome da pasta do módulo e da pasta Views
|
||||
if ($module) {
|
||||
$realModule = self::getRealFolderName(basePath: MODULE_PATH, targetName: $module);
|
||||
if (!$realModule) {
|
||||
http_response_code(response_code: 404);
|
||||
die("Módulo '{$module}' não encontrado.");
|
||||
}
|
||||
|
||||
$realViews = self::getRealFolderName(basePath: MODULE_PATH . "/{$realModule}", targetName: 'Views');
|
||||
if (!$realViews) {
|
||||
http_response_code(response_code: 404);
|
||||
die("Pasta 'Views' do módulo '{$module}' não encontrada.");
|
||||
}
|
||||
|
||||
$moduleViewPath = MODULE_PATH . "/{$realModule}/{$realViews}/{$view}.php";
|
||||
if (file_exists(filename: $moduleViewPath)) {
|
||||
$viewPath = $moduleViewPath;
|
||||
}
|
||||
}
|
||||
|
||||
if (!file_exists(filename: $viewPath)) {
|
||||
http_response_code(response_code: 404);
|
||||
die("View '{$view}' não encontrada.");
|
||||
}
|
||||
|
||||
if (!empty($data)) {
|
||||
extract($data, EXTR_SKIP);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
require_once $viewPath;
|
||||
$content = ob_get_clean();
|
||||
|
||||
if ($layout) {
|
||||
if ($module) {
|
||||
// Mesmo esquema pra layout dentro de módulo
|
||||
$realModule = self::getRealFolderName(basePath: MODULE_PATH, targetName: $module);
|
||||
$realViews = self::getRealFolderName(basePath: MODULE_PATH . "/{$realModule}", targetName: 'Views');
|
||||
$layoutPath = MODULE_PATH . "/{$realModule}/{$realViews}/{$layout}.php";
|
||||
} else {
|
||||
$layoutPath = VIEW_PATH . "/{$layout}.php";
|
||||
}
|
||||
|
||||
if (file_exists(filename: $layoutPath)) {
|
||||
require_once $layoutPath;
|
||||
} else {
|
||||
http_response_code(response_code: 404);
|
||||
die("Layout '{$layout}' não encontrado.");
|
||||
}
|
||||
} else {
|
||||
echo $content;
|
||||
}
|
||||
}
|
||||
}
|
||||
108
vendor/claudecio/axiumphp/src/Helpers/NavigationHelper.php
vendored
Executable file
108
vendor/claudecio/axiumphp/src/Helpers/NavigationHelper.php
vendored
Executable file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
namespace AxiumPHP\Helpers;
|
||||
|
||||
class NavigationHelper {
|
||||
private static $max_stack;
|
||||
|
||||
/**
|
||||
* Construtor da classe que define a profundidade máxima da pilha.
|
||||
*
|
||||
* Este método inicializa a classe e configura a propriedade estática `self::$max_stack`
|
||||
* com o valor fornecido por `$max_stack`. Essa propriedade provavelmente
|
||||
* controla o número máximo de itens ou operações que podem ser armazenados em uma pilha.
|
||||
* O valor padrão é 5.
|
||||
*
|
||||
* @param int $max_stack O número máximo de itens permitidos na pilha. O valor padrão é 5.
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(int $max_stack = 5) {
|
||||
self::$max_stack = $max_stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rastreia a navegação do usuário, mantendo um histórico das páginas visitadas
|
||||
* na sessão.
|
||||
*
|
||||
* Este método estático obtém a URI atual da requisição. Se a URI corresponder
|
||||
* a um padrão de API ou chamada AJAX, a função retorna imediatamente sem
|
||||
* registrar a navegação.
|
||||
*
|
||||
* Se a variável de sessão 'navigation_stack' não existir, ela é inicializada
|
||||
* como um array vazio.
|
||||
*
|
||||
* Para evitar duplicatas, verifica se a URI atual é diferente da última URI
|
||||
* registrada na pilha de navegação. Se for diferente, e se a pilha atingir
|
||||
* um tamanho máximo definido por `self::$max_stack`, a URI mais antiga é removida
|
||||
* do início da pilha. A URI atual é então adicionada ao final da pilha.
|
||||
*
|
||||
* A URI atual também é armazenada na variável de sessão 'current_page', e a
|
||||
* página anterior (obtida através do método `self::getPreviousPage()`) é
|
||||
* armazenada em 'previous_page'.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @see self::getPreviousPage()
|
||||
*/
|
||||
public static function trackNavigation(): void {
|
||||
$currentUri = $_SERVER['REQUEST_URI'] ?? '/';
|
||||
|
||||
// Ignora chamadas para API ou AJAX
|
||||
if (preg_match(pattern: '/\/api\/|\/ajax\//i', subject: $currentUri)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($_SESSION['navigation_stack'])) {
|
||||
$_SESSION['navigation_stack'] = [];
|
||||
}
|
||||
|
||||
// Evita duplicar a última página
|
||||
$last = end($_SESSION['navigation_stack']);
|
||||
if ($last !== $currentUri) {
|
||||
if (count(value: $_SESSION['navigation_stack']) >= self::$max_stack) {
|
||||
array_shift($_SESSION['navigation_stack']);
|
||||
}
|
||||
|
||||
$_SESSION['navigation_stack'][] = $currentUri;
|
||||
}
|
||||
|
||||
$_SESSION['current_page'] = $currentUri;
|
||||
$_SESSION['previous_page'] = self::getPreviousPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Extrai a string de query da URI da requisição.
|
||||
*
|
||||
* Este método estático obtém a URI completa da requisição do servidor (`$_SERVER['REQUEST_URI']`) e a divide em duas partes usando o caractere `?` como separador. A primeira parte é a URI base, e a segunda é a string de query (os parâmetros da URL).
|
||||
*
|
||||
* @return string|null A string de query completa (por exemplo, "param1=value1¶m2=value2"), ou `null` se a URI não contiver uma string de query.
|
||||
*/
|
||||
public static function extractQueryString(): ?string {
|
||||
$parts = explode(separator: '?', string: $_SERVER['REQUEST_URI'], limit: 2); // limite 2 garante que só divide em duas partes
|
||||
$request = $parts[1] ?? null; // se não existir, define null
|
||||
|
||||
return ($request !== null && $request !== '') ? "?{$request}" : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtém a URI da página anterior visitada pelo usuário, com base na pilha
|
||||
* de navegação armazenada na sessão.
|
||||
*
|
||||
* Este método estático acessa a variável de sessão 'navigation_stack'. Se a
|
||||
* pilha contiver mais de uma URI, retorna a penúltima URI da pilha, que
|
||||
* representa a página visitada imediatamente antes da atual.
|
||||
*
|
||||
* Se a pilha contiver apenas uma ou nenhuma URI, significa que não há uma
|
||||
* página anterior no histórico de navegação da sessão, e o método retorna null.
|
||||
*
|
||||
* @return string|null A URI da página anterior, ou null se não houver uma.
|
||||
*/
|
||||
public static function getPreviousPage(): ?string {
|
||||
$stack = $_SESSION['navigation_stack'] ?? [];
|
||||
|
||||
if (count(value: $stack) > 1) {
|
||||
return $stack[count(value: $stack) - 2];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
270
vendor/claudecio/axiumphp/src/Helpers/RequestHelper.php
vendored
Executable file
270
vendor/claudecio/axiumphp/src/Helpers/RequestHelper.php
vendored
Executable file
@@ -0,0 +1,270 @@
|
||||
<?php
|
||||
namespace AxiumPHP\Helpers;
|
||||
|
||||
class RequestHelper {
|
||||
|
||||
/**
|
||||
* Retorna os dados de entrada (GET, POST, COOKIE ou SERVER) filtrados.
|
||||
*
|
||||
* Permite passar filtros personalizados por campo. Se nenhum filtro for passado,
|
||||
* usa o filtro padrão (`FILTER_DEFAULT`).
|
||||
*
|
||||
* @param int $form_type Tipo de entrada (INPUT_GET, INPUT_POST, INPUT_COOKIE ou INPUT_SERVER).
|
||||
* @param array|null $filters Filtros personalizados no formato aceito por filter_input_array().
|
||||
* @return array Retorna um array associativo com os dados filtrados, ou array vazio se nenhum dado for encontrado.
|
||||
*/
|
||||
public static function getFilteredInput(int $form_type = INPUT_GET, ?array $filters = null): array {
|
||||
switch ($form_type) {
|
||||
case INPUT_GET:
|
||||
$form = $filters !== null ? filter_input_array(type: INPUT_GET, options: $filters) : filter_input_array(type: INPUT_GET);
|
||||
break;
|
||||
case INPUT_POST:
|
||||
$inputData = file_get_contents(filename: 'php://input');
|
||||
$data = [];
|
||||
|
||||
$contentType = $_SERVER['CONTENT_TYPE'] ?? '';
|
||||
|
||||
if (strpos(haystack: $contentType, needle: 'application/json') !== false) {
|
||||
$data = json_decode(json: $inputData, associative: true);
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
http_response_code(response_code: 500);
|
||||
header(header: "Content-Type: application/json; charset=utf-8");
|
||||
echo json_encode(value: [
|
||||
"success" => false,
|
||||
"message" => "Erro ao decodificar JSON: " . json_last_error_msg()
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
if(isset($data['_method'])) {
|
||||
unset($data['_method']);
|
||||
}
|
||||
$form = $data;
|
||||
} else {
|
||||
$form = $filters !== null ? filter_input_array(type: INPUT_POST, options: $filters) : filter_input_array(type: INPUT_POST);
|
||||
}
|
||||
break;
|
||||
case INPUT_COOKIE:
|
||||
$form = $filters !== null ? filter_input_array(type: INPUT_COOKIE, options: $filters) : filter_input_array(type: INPUT_COOKIE);
|
||||
break;
|
||||
case INPUT_SERVER:
|
||||
$form = $filters !== null ? filter_input_array(type: INPUT_SERVER, options: $filters) : filter_input_array(type: INPUT_SERVER);
|
||||
break;
|
||||
default:
|
||||
$form = $filters !== null ? filter_input_array(type: INPUT_GET, options: $filters) : filter_input_array(type: INPUT_GET);
|
||||
break;
|
||||
}
|
||||
|
||||
return $form && is_array(value: $form) ? $form : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Envia uma resposta JSON padronizada e encerra a execução do script.
|
||||
*
|
||||
* Este método estático é um utilitário para endpoints de API, garantindo que as respostas
|
||||
* enviadas ao cliente sigam um formato consistente. Ele define o código de resposta HTTP,
|
||||
* o cabeçalho `Content-Type` e um corpo JSON estruturado.
|
||||
*
|
||||
* O corpo da resposta inclui sempre um `status` e uma `message`. Opcionalmente, pode
|
||||
* incluir um array de `data`. A validação interna garante que os parâmetros sejam
|
||||
* consistentes e que a execução seja interrompida após o envio da resposta.
|
||||
*
|
||||
* #### Validações e Comportamento:
|
||||
* - O parâmetro `status` é restrito a 'success', 'error' ou 'fail'. Se um valor inválido for passado,
|
||||
* ele será padronizado para 'error'.
|
||||
* - Se o parâmetro `message` estiver vazio, o código de resposta é alterado para `422` (Entidade
|
||||
* Não Processável), e uma mensagem de erro padrão é definida.
|
||||
* - O código de resposta HTTP é definido com `http_response_code()`.
|
||||
* - O cabeçalho `Content-Type` é configurado para `application/json; charset=utf-8`.
|
||||
* - O array de resposta é codificado para JSON e impresso.
|
||||
* - A execução do script é finalizada com `exit`.
|
||||
*
|
||||
* @param int $response_code O código de status HTTP da resposta (padrão: 200).
|
||||
* @param string $status O status da operação ('success', 'error' ou 'fail'). Padrão: 'success'.
|
||||
* @param string $message Uma mensagem descritiva da resposta. Este campo é obrigatório e será validado.
|
||||
* @param array $data Um array associativo opcional com os dados a serem retornados. Padrão: `[]`.
|
||||
* @return void Este método não tem retorno, pois ele finaliza a execução do script.
|
||||
*/
|
||||
public static function sendJsonResponse(int $response_code = 200, string $status = 'success', string $message = '', array $output = []): void {
|
||||
// Garante que o status seja válido
|
||||
if (!in_array(needle: $status, haystack: ['success', 'error', 'fail'])) {
|
||||
$status = 'error';
|
||||
}
|
||||
|
||||
// Se não tiver mensagem, é erro de uso do método
|
||||
if (empty($message)) {
|
||||
$response_code = 422;
|
||||
$status = 'error';
|
||||
$message = "Mensagem obrigatória não informada.";
|
||||
}
|
||||
|
||||
$responseArray = [
|
||||
'response_code' => $response_code,
|
||||
'status' => $status,
|
||||
'message' => $message
|
||||
];
|
||||
|
||||
if (isset($output['data']) && !empty($output['data'])) {
|
||||
$responseArray['data'] = $output['data'];
|
||||
}
|
||||
|
||||
if (isset($output['errors']) && !empty($output['errors'])) {
|
||||
$responseArray['errors'] = $output['errors'];
|
||||
}
|
||||
|
||||
http_response_code(response_code: $response_code);
|
||||
header(header: 'Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode(value: $responseArray);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calcula o valor de OFFSET para consultas de paginação SQL.
|
||||
*
|
||||
* Este método estático recebe o número da página desejada (`$page`) e o
|
||||
* número de itens por página (`$limit`). Ele calcula o valor de OFFSET
|
||||
* que deve ser usado em uma consulta SQL para buscar os registros corretos
|
||||
* para a página especificada. O OFFSET é calculado como `($page - 1) * $limit`.
|
||||
* A função `max(0, ...)` garante que o OFFSET nunca seja negativo, o que
|
||||
* pode acontecer se um valor de página menor que 1 for passado.
|
||||
*
|
||||
* @param int $page O número da página para a qual se deseja calcular o OFFSET (a primeira página é 1).
|
||||
* @param int $limit O número de itens a serem exibidos por página.
|
||||
* @return int O valor de OFFSET a ser utilizado na cláusula LIMIT de uma consulta SQL.
|
||||
*/
|
||||
public static function getOffset(int $page, int $limit): int {
|
||||
return max(0, ($page - 1) * $limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepara e formata os resultados de uma consulta paginada.
|
||||
*
|
||||
* Este método estático organiza os dados de uma resposta de banco de dados,
|
||||
* juntamente com informações de paginação, em um formato padronizado.
|
||||
* Ele é útil para enviar dados para a camada de visualização (frontend)
|
||||
* de forma consistente.
|
||||
*
|
||||
* @param mixed $atuallPage O número da página atual. Pode ser um `int` ou `string`.
|
||||
* @param array $dbResponse Um array contendo os resultados da consulta ao banco de dados para a página atual.
|
||||
* @param string $totalResults O número total de resultados encontrados pela consulta, antes da aplicação do limite de paginação. Deve ser uma `string` (será convertido para `float`).
|
||||
* @param mixed $limit O limite de resultados por página. Pode ser um `int` ou `string` (padrão é "10").
|
||||
* @return array Um array associativo contendo:
|
||||
* - `atuallPage`: A página atual.
|
||||
* - `response`: Os dados da resposta do banco de dados para a página.
|
||||
* - `totalResults`: O total de resultados, convertido para `float`.
|
||||
* - `limit`: O limite de resultados por página.
|
||||
*/
|
||||
public static function preparePaginationResult(mixed $atuallPage, array $dbResponse, string $totalResults, mixed $limit = "10"): array {
|
||||
return [
|
||||
'atuallPage' => $atuallPage,
|
||||
'response' => $dbResponse,
|
||||
'totalResults' => floatval(value: $totalResults),
|
||||
'limit' => $limit
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gera HTML para um componente de paginação.
|
||||
*
|
||||
* Este método estático recebe a página atual, o total de registros e um limite
|
||||
* de registros por página para gerar uma navegação de paginação em HTML,
|
||||
* utilizando classes do Bootstrap para estilização.
|
||||
*
|
||||
* Primeiro, calcula o número total de páginas. Em seguida, constrói a query
|
||||
* string da URL atual, removendo os parâmetros 'page' e 'url' para evitar
|
||||
* duplicações nos links de paginação.
|
||||
*
|
||||
* Limita o número máximo de botões de página exibidos e calcula o início e
|
||||
* o fim da janela de botões a serem mostrados, ajustando essa janela para
|
||||
* garantir que o número máximo de botões seja exibido, dentro dos limites
|
||||
* do total de páginas.
|
||||
*
|
||||
* Se o total de registros for maior que o limite por página, o HTML da
|
||||
* paginação é gerado, incluindo botões "Anterior" (desabilitado na primeira
|
||||
* página), os números das páginas dentro da janela calculada (com a página
|
||||
* atual marcada como ativa) e um botão "Próximo" (desabilitado na última
|
||||
* página). Se o total de registros não for maior que o limite, uma string
|
||||
* vazia é retornada.
|
||||
*
|
||||
* @param int $current_page O número da página atualmente visualizada.
|
||||
* @param int $total_rows O número total de registros disponíveis.
|
||||
* @param int $limit O número máximo de registros a serem exibidos por página (padrão: 20).
|
||||
*
|
||||
* @return string O HTML da navegação de paginação, estilizado com classes do Bootstrap,
|
||||
* ou uma string vazia se não houver necessidade de paginação.
|
||||
*/
|
||||
public static function generatePaginationHtml(int $current_page, int $total_rows, int $limit = 20): string {
|
||||
$current_page ??= 1;
|
||||
$total_rows ??= 0;
|
||||
|
||||
// Calcula o total de páginas
|
||||
$total_paginas = ceil(num: $total_rows / $limit);
|
||||
|
||||
// Construir a query string com os parâmetros atuais, exceto 'page'
|
||||
$query_params = $_GET;
|
||||
unset($query_params['page']); // Remove 'page' para evitar duplicação
|
||||
unset($query_params['url']); // Remove 'url' para evitar duplicação
|
||||
$query_string = http_build_query(data: $query_params);
|
||||
|
||||
// Limitar a quantidade máxima de botões a serem exibidos
|
||||
$max_botoes = 10;
|
||||
$inicio = max(1, $current_page - intval(value: $max_botoes / 2));
|
||||
$fim = min($total_paginas, $inicio + $max_botoes - 1);
|
||||
|
||||
// Ajustar a janela de exibição se atingir o limite inferior ou superior
|
||||
if ($fim - $inicio + 1 < $max_botoes) {
|
||||
$inicio = max(1, $fim - $max_botoes + 1);
|
||||
}
|
||||
|
||||
// Validação das paginações
|
||||
if($total_rows > $limit){
|
||||
// Inicia a criação do HTML da paginação
|
||||
$html = "<nav aria-label='Page navigation'>";
|
||||
$html .= "<ul class='pagination justify-content-center'>";
|
||||
|
||||
// Botão Anterior (desabilitado na primeira página)
|
||||
if ($current_page > 1) {
|
||||
$anterior = $current_page - 1;
|
||||
$html .= "<li class='page-item'>";
|
||||
$html .= "<a class='page-link' href='?{$query_string}&page={$anterior}'>Anterior</a>";
|
||||
$html .= "</li>";
|
||||
} else {
|
||||
$html .= "<li class='page-item disabled'>";
|
||||
$html .= "<a class='page-link'>Anterior</a>";
|
||||
$html .= "</li>";
|
||||
}
|
||||
|
||||
// Geração dos links de cada página dentro da janela definida
|
||||
for ($i = $inicio; $i <= $fim; $i++) {
|
||||
if ($i == $current_page) {
|
||||
$html .= "<li class='page-item active'>";
|
||||
$html .= "<a class='page-link' href='?{$query_string}&page={$i}'>{$i}</a>";
|
||||
$html .= "</li>";
|
||||
} else {
|
||||
$html .= '<li class="page-item">';
|
||||
$html .= "<a class='page-link' href='?{$query_string}&page={$i}'>{$i}</a>";
|
||||
$html .= "</li>";
|
||||
}
|
||||
}
|
||||
|
||||
// Botão Próximo (desabilitado na última página)
|
||||
if ($current_page < $total_paginas) {
|
||||
$proxima = $current_page + 1;
|
||||
$html .= "<li class='page-item'>";
|
||||
$html .= "<a class='page-link' href='?{$query_string}&page={$proxima}'>Próximo</a>";
|
||||
$html .= "</li>";
|
||||
} else {
|
||||
$html .= "<li class='page-item disabled'>";
|
||||
$html .= "<a class='page-link'>Próximo</a>";
|
||||
$html .= "</li>";
|
||||
}
|
||||
|
||||
$html .= "</ul>";
|
||||
$html .= "</nav>";
|
||||
} else {
|
||||
$html = "";
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
22
vendor/claudecio/axiumphp/vendor/autoload.php
vendored
Executable file
22
vendor/claudecio/axiumphp/vendor/autoload.php
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
if (PHP_VERSION_ID < 50600) {
|
||||
if (!headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
||||
if (!ini_get('display_errors')) {
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||
fwrite(STDERR, $err);
|
||||
} elseif (!headers_sent()) {
|
||||
echo $err;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException($err);
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit6c176ae0681796ba87da0d8bfe73b645::getLoader();
|
||||
579
vendor/claudecio/axiumphp/vendor/composer/ClassLoader.php
vendored
Executable file
579
vendor/claudecio/axiumphp/vendor/composer/ClassLoader.php
vendored
Executable file
@@ -0,0 +1,579 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
/**
|
||||
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||
*
|
||||
* $loader = new \Composer\Autoload\ClassLoader();
|
||||
*
|
||||
* // register classes with namespaces
|
||||
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||
* $loader->add('Symfony', __DIR__.'/framework');
|
||||
*
|
||||
* // activate the autoloader
|
||||
* $loader->register();
|
||||
*
|
||||
* // to enable searching the include path (eg. for PEAR packages)
|
||||
* $loader->setUseIncludePath(true);
|
||||
*
|
||||
* In this example, if you try to use a class in the Symfony\Component
|
||||
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||
* the autoloader will first look for the class under the component/
|
||||
* directory, and it will then fallback to the framework/ directory if not
|
||||
* found before giving up.
|
||||
*
|
||||
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @see https://www.php-fig.org/psr/psr-0/
|
||||
* @see https://www.php-fig.org/psr/psr-4/
|
||||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
/** @var \Closure(string):void */
|
||||
private static $includeFile;
|
||||
|
||||
/** @var string|null */
|
||||
private $vendorDir;
|
||||
|
||||
// PSR-4
|
||||
/**
|
||||
* @var array<string, array<string, int>>
|
||||
*/
|
||||
private $prefixLengthsPsr4 = array();
|
||||
/**
|
||||
* @var array<string, list<string>>
|
||||
*/
|
||||
private $prefixDirsPsr4 = array();
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
private $fallbackDirsPsr4 = array();
|
||||
|
||||
// PSR-0
|
||||
/**
|
||||
* List of PSR-0 prefixes
|
||||
*
|
||||
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
|
||||
*
|
||||
* @var array<string, array<string, list<string>>>
|
||||
*/
|
||||
private $prefixesPsr0 = array();
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
private $fallbackDirsPsr0 = array();
|
||||
|
||||
/** @var bool */
|
||||
private $useIncludePath = false;
|
||||
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private $classMap = array();
|
||||
|
||||
/** @var bool */
|
||||
private $classMapAuthoritative = false;
|
||||
|
||||
/**
|
||||
* @var array<string, bool>
|
||||
*/
|
||||
private $missingClasses = array();
|
||||
|
||||
/** @var string|null */
|
||||
private $apcuPrefix;
|
||||
|
||||
/**
|
||||
* @var array<string, self>
|
||||
*/
|
||||
private static $registeredLoaders = array();
|
||||
|
||||
/**
|
||||
* @param string|null $vendorDir
|
||||
*/
|
||||
public function __construct($vendorDir = null)
|
||||
{
|
||||
$this->vendorDir = $vendorDir;
|
||||
self::initializeIncludeClosure();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, list<string>>
|
||||
*/
|
||||
public function getPrefixes()
|
||||
{
|
||||
if (!empty($this->prefixesPsr0)) {
|
||||
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, list<string>>
|
||||
*/
|
||||
public function getPrefixesPsr4()
|
||||
{
|
||||
return $this->prefixDirsPsr4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
public function getFallbackDirs()
|
||||
{
|
||||
return $this->fallbackDirsPsr0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
public function getFallbackDirsPsr4()
|
||||
{
|
||||
return $this->fallbackDirsPsr4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string> Array of classname => path
|
||||
*/
|
||||
public function getClassMap()
|
||||
{
|
||||
return $this->classMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $classMap Class to filename map
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addClassMap(array $classMap)
|
||||
{
|
||||
if ($this->classMap) {
|
||||
$this->classMap = array_merge($this->classMap, $classMap);
|
||||
} else {
|
||||
$this->classMap = $classMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix, either
|
||||
* appending or prepending to the ones previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param list<string>|string $paths The PSR-0 root directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add($prefix, $paths, $prepend = false)
|
||||
{
|
||||
$paths = (array) $paths;
|
||||
if (!$prefix) {
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$paths,
|
||||
$this->fallbackDirsPsr0
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$this->fallbackDirsPsr0,
|
||||
$paths
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$first = $prefix[0];
|
||||
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||
$this->prefixesPsr0[$first][$prefix] = $paths;
|
||||
|
||||
return;
|
||||
}
|
||||
if ($prepend) {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$paths,
|
||||
$this->prefixesPsr0[$first][$prefix]
|
||||
);
|
||||
} else {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$this->prefixesPsr0[$first][$prefix],
|
||||
$paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace, either
|
||||
* appending or prepending to the ones previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param list<string>|string $paths The PSR-4 base directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
$paths = (array) $paths;
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$paths,
|
||||
$this->fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$this->fallbackDirsPsr4,
|
||||
$paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||
// Register directories for a new namespace.
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$paths,
|
||||
$this->prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$this->prefixDirsPsr4[$prefix],
|
||||
$paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix,
|
||||
* replacing any others previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param list<string>|string $paths The PSR-0 base directories
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr0 = (array) $paths;
|
||||
} else {
|
||||
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace,
|
||||
* replacing any others previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param list<string>|string $paths The PSR-4 base directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPsr4($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr4 = (array) $paths;
|
||||
} else {
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns on searching the include path for class files.
|
||||
*
|
||||
* @param bool $useIncludePath
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUseIncludePath($useIncludePath)
|
||||
{
|
||||
$this->useIncludePath = $useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to check if the autoloader uses the include path to check
|
||||
* for classes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseIncludePath()
|
||||
{
|
||||
return $this->useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns off searching the prefix and fallback directories for classes
|
||||
* that have not been registered with the class map.
|
||||
*
|
||||
* @param bool $classMapAuthoritative
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||
{
|
||||
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should class lookup fail if not found in the current class map?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isClassMapAuthoritative()
|
||||
{
|
||||
return $this->classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||
*
|
||||
* @param string|null $apcuPrefix
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setApcuPrefix($apcuPrefix)
|
||||
{
|
||||
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getApcuPrefix()
|
||||
{
|
||||
return $this->apcuPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance as an autoloader.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register($prepend = false)
|
||||
{
|
||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||
|
||||
if (null === $this->vendorDir) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($prepend) {
|
||||
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
||||
} else {
|
||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||
self::$registeredLoaders[$this->vendorDir] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this instance as an autoloader.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister(array($this, 'loadClass'));
|
||||
|
||||
if (null !== $this->vendorDir) {
|
||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
* @return true|null True if loaded, null otherwise
|
||||
*/
|
||||
public function loadClass($class)
|
||||
{
|
||||
if ($file = $this->findFile($class)) {
|
||||
$includeFile = self::$includeFile;
|
||||
$includeFile($file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the path to the file where the class is defined.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
*
|
||||
* @return string|false The path if found, false otherwise
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
// class map lookup
|
||||
if (isset($this->classMap[$class])) {
|
||||
return $this->classMap[$class];
|
||||
}
|
||||
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||
return false;
|
||||
}
|
||||
if (null !== $this->apcuPrefix) {
|
||||
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||
if ($hit) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
$file = $this->findFileWithExtension($class, '.php');
|
||||
|
||||
// Search for Hack files if we are running on HHVM
|
||||
if (false === $file && defined('HHVM_VERSION')) {
|
||||
$file = $this->findFileWithExtension($class, '.hh');
|
||||
}
|
||||
|
||||
if (null !== $this->apcuPrefix) {
|
||||
apcu_add($this->apcuPrefix.$class, $file);
|
||||
}
|
||||
|
||||
if (false === $file) {
|
||||
// Remember that this class does not exist.
|
||||
$this->missingClasses[$class] = true;
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currently registered loaders keyed by their corresponding vendor directories.
|
||||
*
|
||||
* @return array<string, self>
|
||||
*/
|
||||
public static function getRegisteredLoaders()
|
||||
{
|
||||
return self::$registeredLoaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $class
|
||||
* @param string $ext
|
||||
* @return string|false
|
||||
*/
|
||||
private function findFileWithExtension($class, $ext)
|
||||
{
|
||||
// PSR-4 lookup
|
||||
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||
|
||||
$first = $class[0];
|
||||
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||
$subPath = $class;
|
||||
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
||||
$subPath = substr($subPath, 0, $lastPos);
|
||||
$search = $subPath . '\\';
|
||||
if (isset($this->prefixDirsPsr4[$search])) {
|
||||
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
||||
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
||||
if (file_exists($file = $dir . $pathEnd)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-4 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 lookup
|
||||
if (false !== $pos = strrpos($class, '\\')) {
|
||||
// namespaced class name
|
||||
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||
} else {
|
||||
// PEAR-like class name
|
||||
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||
}
|
||||
|
||||
if (isset($this->prefixesPsr0[$first])) {
|
||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 include paths.
|
||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private static function initializeIncludeClosure()
|
||||
{
|
||||
if (self::$includeFile !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope isolated include.
|
||||
*
|
||||
* Prevents access to $this/self from included files.
|
||||
*
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
self::$includeFile = \Closure::bind(static function($file) {
|
||||
include $file;
|
||||
}, null, null);
|
||||
}
|
||||
}
|
||||
396
vendor/claudecio/axiumphp/vendor/composer/InstalledVersions.php
vendored
Executable file
396
vendor/claudecio/axiumphp/vendor/composer/InstalledVersions.php
vendored
Executable file
@@ -0,0 +1,396 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
/**
|
||||
* This class is copied in every Composer installed project and available to all
|
||||
*
|
||||
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
||||
*
|
||||
* To require its presence, you can require `composer-runtime-api ^2.0`
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class InstalledVersions
|
||||
{
|
||||
/**
|
||||
* @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
|
||||
* @internal
|
||||
*/
|
||||
private static $selfDir = null;
|
||||
|
||||
/**
|
||||
* @var mixed[]|null
|
||||
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
|
||||
*/
|
||||
private static $installed;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private static $installedIsLocalDir;
|
||||
|
||||
/**
|
||||
* @var bool|null
|
||||
*/
|
||||
private static $canGetVendors;
|
||||
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
private static $installedByVendor = array();
|
||||
|
||||
/**
|
||||
* Returns a list of all package names which are present, either by being installed, replaced or provided
|
||||
*
|
||||
* @return string[]
|
||||
* @psalm-return list<string>
|
||||
*/
|
||||
public static function getInstalledPackages()
|
||||
{
|
||||
$packages = array();
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
$packages[] = array_keys($installed['versions']);
|
||||
}
|
||||
|
||||
if (1 === \count($packages)) {
|
||||
return $packages[0];
|
||||
}
|
||||
|
||||
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all package names with a specific type e.g. 'library'
|
||||
*
|
||||
* @param string $type
|
||||
* @return string[]
|
||||
* @psalm-return list<string>
|
||||
*/
|
||||
public static function getInstalledPackagesByType($type)
|
||||
{
|
||||
$packagesByType = array();
|
||||
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
foreach ($installed['versions'] as $name => $package) {
|
||||
if (isset($package['type']) && $package['type'] === $type) {
|
||||
$packagesByType[] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $packagesByType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given package is installed
|
||||
*
|
||||
* This also returns true if the package name is provided or replaced by another package
|
||||
*
|
||||
* @param string $packageName
|
||||
* @param bool $includeDevRequirements
|
||||
* @return bool
|
||||
*/
|
||||
public static function isInstalled($packageName, $includeDevRequirements = true)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (isset($installed['versions'][$packageName])) {
|
||||
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given package satisfies a version constraint
|
||||
*
|
||||
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
|
||||
*
|
||||
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
|
||||
*
|
||||
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
|
||||
* @param string $packageName
|
||||
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
|
||||
* @return bool
|
||||
*/
|
||||
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
||||
{
|
||||
$constraint = $parser->parseConstraints((string) $constraint);
|
||||
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
||||
|
||||
return $provided->matches($constraint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a version constraint representing all the range(s) which are installed for a given package
|
||||
*
|
||||
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
|
||||
* whether a given version of a package is installed, and not just whether it exists
|
||||
*
|
||||
* @param string $packageName
|
||||
* @return string Version constraint usable with composer/semver
|
||||
*/
|
||||
public static function getVersionRanges($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ranges = array();
|
||||
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
||||
}
|
||||
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
||||
}
|
||||
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
||||
}
|
||||
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
||||
}
|
||||
|
||||
return implode(' || ', $ranges);
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||
*/
|
||||
public static function getVersion($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['version'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['version'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||
*/
|
||||
public static function getPrettyVersion($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['pretty_version'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
|
||||
*/
|
||||
public static function getReference($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['reference'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['reference'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
|
||||
*/
|
||||
public static function getInstallPath($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
|
||||
*/
|
||||
public static function getRootPackage()
|
||||
{
|
||||
$installed = self::getInstalled();
|
||||
|
||||
return $installed[0]['root'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the raw installed.php data for custom implementations
|
||||
*
|
||||
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
||||
* @return array[]
|
||||
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
|
||||
*/
|
||||
public static function getRawData()
|
||||
{
|
||||
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
|
||||
|
||||
if (null === self::$installed) {
|
||||
// only require the installed.php file if this file is loaded from its dumped location,
|
||||
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||
self::$installed = include __DIR__ . '/installed.php';
|
||||
} else {
|
||||
self::$installed = array();
|
||||
}
|
||||
}
|
||||
|
||||
return self::$installed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
||||
*
|
||||
* @return array[]
|
||||
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
public static function getAllRawData()
|
||||
{
|
||||
return self::getInstalled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Lets you reload the static array from another file
|
||||
*
|
||||
* This is only useful for complex integrations in which a project needs to use
|
||||
* this class but then also needs to execute another project's autoloader in process,
|
||||
* and wants to ensure both projects have access to their version of installed.php.
|
||||
*
|
||||
* A typical case would be PHPUnit, where it would need to make sure it reads all
|
||||
* the data it needs from this class, then call reload() with
|
||||
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
|
||||
* the project in which it runs can then also use this class safely, without
|
||||
* interference between PHPUnit's dependencies and the project's dependencies.
|
||||
*
|
||||
* @param array[] $data A vendor/composer/installed.php data set
|
||||
* @return void
|
||||
*
|
||||
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
|
||||
*/
|
||||
public static function reload($data)
|
||||
{
|
||||
self::$installed = $data;
|
||||
self::$installedByVendor = array();
|
||||
|
||||
// when using reload, we disable the duplicate protection to ensure that self::$installed data is
|
||||
// always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
|
||||
// so we have to assume it does not, and that may result in duplicate data being returned when listing
|
||||
// all installed packages for example
|
||||
self::$installedIsLocalDir = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private static function getSelfDir()
|
||||
{
|
||||
if (self::$selfDir === null) {
|
||||
self::$selfDir = strtr(__DIR__, '\\', '/');
|
||||
}
|
||||
|
||||
return self::$selfDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
private static function getInstalled()
|
||||
{
|
||||
if (null === self::$canGetVendors) {
|
||||
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
||||
}
|
||||
|
||||
$installed = array();
|
||||
$copiedLocalDir = false;
|
||||
|
||||
if (self::$canGetVendors) {
|
||||
$selfDir = self::getSelfDir();
|
||||
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
||||
$vendorDir = strtr($vendorDir, '\\', '/');
|
||||
if (isset(self::$installedByVendor[$vendorDir])) {
|
||||
$installed[] = self::$installedByVendor[$vendorDir];
|
||||
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
||||
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
||||
$required = require $vendorDir.'/composer/installed.php';
|
||||
self::$installedByVendor[$vendorDir] = $required;
|
||||
$installed[] = $required;
|
||||
if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
|
||||
self::$installed = $required;
|
||||
self::$installedIsLocalDir = true;
|
||||
}
|
||||
}
|
||||
if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
|
||||
$copiedLocalDir = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (null === self::$installed) {
|
||||
// only require the installed.php file if this file is loaded from its dumped location,
|
||||
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
||||
$required = require __DIR__ . '/installed.php';
|
||||
self::$installed = $required;
|
||||
} else {
|
||||
self::$installed = array();
|
||||
}
|
||||
}
|
||||
|
||||
if (self::$installed !== array() && !$copiedLocalDir) {
|
||||
$installed[] = self::$installed;
|
||||
}
|
||||
|
||||
return $installed;
|
||||
}
|
||||
}
|
||||
21
vendor/claudecio/axiumphp/vendor/composer/LICENSE
vendored
Executable file
21
vendor/claudecio/axiumphp/vendor/composer/LICENSE
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
|
||||
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
15
vendor/claudecio/axiumphp/vendor/composer/autoload_classmap.php
vendored
Executable file
15
vendor/claudecio/axiumphp/vendor/composer/autoload_classmap.php
vendored
Executable file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
|
||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||
'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
|
||||
'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
|
||||
'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
|
||||
'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
|
||||
);
|
||||
12
vendor/claudecio/axiumphp/vendor/composer/autoload_files.php
vendored
Executable file
12
vendor/claudecio/axiumphp/vendor/composer/autoload_files.php
vendored
Executable file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
// autoload_files.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
|
||||
);
|
||||
9
vendor/claudecio/axiumphp/vendor/composer/autoload_namespaces.php
vendored
Executable file
9
vendor/claudecio/axiumphp/vendor/composer/autoload_namespaces.php
vendored
Executable file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
||||
16
vendor/claudecio/axiumphp/vendor/composer/autoload_psr4.php
vendored
Executable file
16
vendor/claudecio/axiumphp/vendor/composer/autoload_psr4.php
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
|
||||
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
|
||||
'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
|
||||
'PhpOption\\' => array($vendorDir . '/phpoption/phpoption/src/PhpOption'),
|
||||
'GrahamCampbell\\ResultType\\' => array($vendorDir . '/graham-campbell/result-type/src'),
|
||||
'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'),
|
||||
'AxiumPHP\\' => array($baseDir . '/src'),
|
||||
);
|
||||
50
vendor/claudecio/axiumphp/vendor/composer/autoload_real.php
vendored
Executable file
50
vendor/claudecio/axiumphp/vendor/composer/autoload_real.php
vendored
Executable file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit6c176ae0681796ba87da0d8bfe73b645
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Composer\Autoload\ClassLoader
|
||||
*/
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit6c176ae0681796ba87da0d8bfe73b645', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit6c176ae0681796ba87da0d8bfe73b645', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit6c176ae0681796ba87da0d8bfe73b645::getInitializer($loader));
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit6c176ae0681796ba87da0d8bfe73b645::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
||||
require $file;
|
||||
}
|
||||
}, null, null);
|
||||
foreach ($filesToLoad as $fileIdentifier => $file) {
|
||||
$requireFile($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
89
vendor/claudecio/axiumphp/vendor/composer/autoload_static.php
vendored
Executable file
89
vendor/claudecio/axiumphp/vendor/composer/autoload_static.php
vendored
Executable file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit6c176ae0681796ba87da0d8bfe73b645
|
||||
{
|
||||
public static $files = array (
|
||||
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
);
|
||||
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'S' =>
|
||||
array (
|
||||
'Symfony\\Polyfill\\Php80\\' => 23,
|
||||
'Symfony\\Polyfill\\Mbstring\\' => 26,
|
||||
'Symfony\\Polyfill\\Ctype\\' => 23,
|
||||
),
|
||||
'P' =>
|
||||
array (
|
||||
'PhpOption\\' => 10,
|
||||
),
|
||||
'G' =>
|
||||
array (
|
||||
'GrahamCampbell\\ResultType\\' => 26,
|
||||
),
|
||||
'D' =>
|
||||
array (
|
||||
'Dotenv\\' => 7,
|
||||
),
|
||||
'A' =>
|
||||
array (
|
||||
'AxiumPHP\\' => 9,
|
||||
),
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'Symfony\\Polyfill\\Php80\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/polyfill-php80',
|
||||
),
|
||||
'Symfony\\Polyfill\\Mbstring\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
|
||||
),
|
||||
'Symfony\\Polyfill\\Ctype\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
|
||||
),
|
||||
'PhpOption\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/phpoption/phpoption/src/PhpOption',
|
||||
),
|
||||
'GrahamCampbell\\ResultType\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/graham-campbell/result-type/src',
|
||||
),
|
||||
'Dotenv\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/vlucas/phpdotenv/src',
|
||||
),
|
||||
'AxiumPHP\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/src',
|
||||
),
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
|
||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||
'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
|
||||
'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
|
||||
'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
|
||||
'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit6c176ae0681796ba87da0d8bfe73b645::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit6c176ae0681796ba87da0d8bfe73b645::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit6c176ae0681796ba87da0d8bfe73b645::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
||||
485
vendor/claudecio/axiumphp/vendor/composer/installed.json
vendored
Executable file
485
vendor/claudecio/axiumphp/vendor/composer/installed.json
vendored
Executable file
@@ -0,0 +1,485 @@
|
||||
{
|
||||
"packages": [
|
||||
{
|
||||
"name": "graham-campbell/result-type",
|
||||
"version": "v1.1.3",
|
||||
"version_normalized": "1.1.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/GrahamCampbell/Result-Type.git",
|
||||
"reference": "3ba905c11371512af9d9bdd27d99b782216b6945"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945",
|
||||
"reference": "3ba905c11371512af9d9bdd27d99b782216b6945",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"phpoption/phpoption": "^1.9.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28"
|
||||
},
|
||||
"time": "2024-07-20T21:45:45+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"GrahamCampbell\\ResultType\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Graham Campbell",
|
||||
"email": "hello@gjcampbell.co.uk",
|
||||
"homepage": "https://github.com/GrahamCampbell"
|
||||
}
|
||||
],
|
||||
"description": "An Implementation Of The Result Type",
|
||||
"keywords": [
|
||||
"Graham Campbell",
|
||||
"GrahamCampbell",
|
||||
"Result Type",
|
||||
"Result-Type",
|
||||
"result"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/GrahamCampbell/Result-Type/issues",
|
||||
"source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/GrahamCampbell",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../graham-campbell/result-type"
|
||||
},
|
||||
{
|
||||
"name": "phpoption/phpoption",
|
||||
"version": "1.9.3",
|
||||
"version_normalized": "1.9.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/schmittjoh/php-option.git",
|
||||
"reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/schmittjoh/php-option/zipball/e3fac8b24f56113f7cb96af14958c0dd16330f54",
|
||||
"reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2.5 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"bamarni/composer-bin-plugin": "^1.8.2",
|
||||
"phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28"
|
||||
},
|
||||
"time": "2024-07-20T21:41:07+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"bamarni-bin": {
|
||||
"bin-links": true,
|
||||
"forward-command": false
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-master": "1.9-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PhpOption\\": "src/PhpOption/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache-2.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Johannes M. Schmitt",
|
||||
"email": "schmittjoh@gmail.com",
|
||||
"homepage": "https://github.com/schmittjoh"
|
||||
},
|
||||
{
|
||||
"name": "Graham Campbell",
|
||||
"email": "hello@gjcampbell.co.uk",
|
||||
"homepage": "https://github.com/GrahamCampbell"
|
||||
}
|
||||
],
|
||||
"description": "Option Type for PHP",
|
||||
"keywords": [
|
||||
"language",
|
||||
"option",
|
||||
"php",
|
||||
"type"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/schmittjoh/php-option/issues",
|
||||
"source": "https://github.com/schmittjoh/php-option/tree/1.9.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/GrahamCampbell",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../phpoption/phpoption"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.32.0",
|
||||
"version_normalized": "1.32.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638",
|
||||
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"provide": {
|
||||
"ext-ctype": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-ctype": "For best performance"
|
||||
},
|
||||
"time": "2024-09-09T11:45:10+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Ctype\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Gert de Pagter",
|
||||
"email": "BackEndTea@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for ctype functions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"ctype",
|
||||
"polyfill",
|
||||
"portable"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.32.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../symfony/polyfill-ctype"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.32.0",
|
||||
"version_normalized": "1.32.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493",
|
||||
"reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-iconv": "*",
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"provide": {
|
||||
"ext-mbstring": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mbstring": "For best performance"
|
||||
},
|
||||
"time": "2024-12-23T08:48:59+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Mbstring\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for the Mbstring extension",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"mbstring",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../symfony/polyfill-mbstring"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php80",
|
||||
"version": "v1.32.0",
|
||||
"version_normalized": "1.32.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php80.git",
|
||||
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
|
||||
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"time": "2025-01-02T08:10:11+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php80\\": ""
|
||||
},
|
||||
"classmap": [
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ion Bazan",
|
||||
"email": "ion.bazan@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php80/tree/v1.32.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../symfony/polyfill-php80"
|
||||
},
|
||||
{
|
||||
"name": "vlucas/phpdotenv",
|
||||
"version": "v5.6.2",
|
||||
"version_normalized": "5.6.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vlucas/phpdotenv.git",
|
||||
"reference": "24ac4c74f91ee2c193fa1aaa5c249cb0822809af"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/24ac4c74f91ee2c193fa1aaa5c249cb0822809af",
|
||||
"reference": "24ac4c74f91ee2c193fa1aaa5c249cb0822809af",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-pcre": "*",
|
||||
"graham-campbell/result-type": "^1.1.3",
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"phpoption/phpoption": "^1.9.3",
|
||||
"symfony/polyfill-ctype": "^1.24",
|
||||
"symfony/polyfill-mbstring": "^1.24",
|
||||
"symfony/polyfill-php80": "^1.24"
|
||||
},
|
||||
"require-dev": {
|
||||
"bamarni/composer-bin-plugin": "^1.8.2",
|
||||
"ext-filter": "*",
|
||||
"phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-filter": "Required to use the boolean validator."
|
||||
},
|
||||
"time": "2025-04-30T23:37:27+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"bamarni-bin": {
|
||||
"bin-links": true,
|
||||
"forward-command": false
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-master": "5.6-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Dotenv\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Graham Campbell",
|
||||
"email": "hello@gjcampbell.co.uk",
|
||||
"homepage": "https://github.com/GrahamCampbell"
|
||||
},
|
||||
{
|
||||
"name": "Vance Lucas",
|
||||
"email": "vance@vancelucas.com",
|
||||
"homepage": "https://github.com/vlucas"
|
||||
}
|
||||
],
|
||||
"description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
|
||||
"keywords": [
|
||||
"dotenv",
|
||||
"env",
|
||||
"environment"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/vlucas/phpdotenv/issues",
|
||||
"source": "https://github.com/vlucas/phpdotenv/tree/v5.6.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/GrahamCampbell",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../vlucas/phpdotenv"
|
||||
}
|
||||
],
|
||||
"dev": true,
|
||||
"dev-package-names": []
|
||||
}
|
||||
77
vendor/claudecio/axiumphp/vendor/composer/installed.php
vendored
Executable file
77
vendor/claudecio/axiumphp/vendor/composer/installed.php
vendored
Executable file
@@ -0,0 +1,77 @@
|
||||
<?php return array(
|
||||
'root' => array(
|
||||
'name' => 'claudecio/axiumphp',
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => 'bff4a2e22b0ca200aee4d6a2c7619bcfdee139dc',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'dev' => true,
|
||||
),
|
||||
'versions' => array(
|
||||
'claudecio/axiumphp' => array(
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => 'bff4a2e22b0ca200aee4d6a2c7619bcfdee139dc',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'graham-campbell/result-type' => array(
|
||||
'pretty_version' => 'v1.1.3',
|
||||
'version' => '1.1.3.0',
|
||||
'reference' => '3ba905c11371512af9d9bdd27d99b782216b6945',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../graham-campbell/result-type',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'phpoption/phpoption' => array(
|
||||
'pretty_version' => '1.9.3',
|
||||
'version' => '1.9.3.0',
|
||||
'reference' => 'e3fac8b24f56113f7cb96af14958c0dd16330f54',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phpoption/phpoption',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/polyfill-ctype' => array(
|
||||
'pretty_version' => 'v1.32.0',
|
||||
'version' => '1.32.0.0',
|
||||
'reference' => 'a3cc8b044a6ea513310cbd48ef7333b384945638',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/polyfill-mbstring' => array(
|
||||
'pretty_version' => 'v1.32.0',
|
||||
'version' => '1.32.0.0',
|
||||
'reference' => '6d857f4d76bd4b343eac26d6b539585d2bc56493',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/polyfill-php80' => array(
|
||||
'pretty_version' => 'v1.32.0',
|
||||
'version' => '1.32.0.0',
|
||||
'reference' => '0cc9dd0f17f61d8131e7df6b84bd344899fe2608',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/polyfill-php80',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'vlucas/phpdotenv' => array(
|
||||
'pretty_version' => 'v5.6.2',
|
||||
'version' => '5.6.2.0',
|
||||
'reference' => '24ac4c74f91ee2c193fa1aaa5c249cb0822809af',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../vlucas/phpdotenv',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
),
|
||||
);
|
||||
26
vendor/claudecio/axiumphp/vendor/composer/platform_check.php
vendored
Executable file
26
vendor/claudecio/axiumphp/vendor/composer/platform_check.php
vendored
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
// platform_check.php @generated by Composer
|
||||
|
||||
$issues = array();
|
||||
|
||||
if (!(PHP_VERSION_ID >= 80100)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 8.1.0". You are running ' . PHP_VERSION . '.';
|
||||
}
|
||||
|
||||
if ($issues) {
|
||||
if (!headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
if (!ini_get('display_errors')) {
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
||||
} elseif (!headers_sent()) {
|
||||
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
||||
}
|
||||
}
|
||||
trigger_error(
|
||||
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
||||
21
vendor/claudecio/axiumphp/vendor/graham-campbell/result-type/LICENSE
vendored
Executable file
21
vendor/claudecio/axiumphp/vendor/graham-campbell/result-type/LICENSE
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2020-2024 Graham Campbell <hello@gjcampbell.co.uk>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
33
vendor/claudecio/axiumphp/vendor/graham-campbell/result-type/composer.json
vendored
Executable file
33
vendor/claudecio/axiumphp/vendor/graham-campbell/result-type/composer.json
vendored
Executable file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "graham-campbell/result-type",
|
||||
"description": "An Implementation Of The Result Type",
|
||||
"keywords": ["result", "result-type", "Result", "Result Type", "Result-Type", "Graham Campbell", "GrahamCampbell"],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Graham Campbell",
|
||||
"email": "hello@gjcampbell.co.uk",
|
||||
"homepage": "https://github.com/GrahamCampbell"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"phpoption/phpoption": "^1.9.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"GrahamCampbell\\ResultType\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"GrahamCampbell\\Tests\\ResultType\\": "tests/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"preferred-install": "dist"
|
||||
}
|
||||
}
|
||||
121
vendor/claudecio/axiumphp/vendor/graham-campbell/result-type/src/Error.php
vendored
Executable file
121
vendor/claudecio/axiumphp/vendor/graham-campbell/result-type/src/Error.php
vendored
Executable file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of Result Type.
|
||||
*
|
||||
* (c) Graham Campbell <hello@gjcampbell.co.uk>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace GrahamCampbell\ResultType;
|
||||
|
||||
use PhpOption\None;
|
||||
use PhpOption\Some;
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @template E
|
||||
*
|
||||
* @extends \GrahamCampbell\ResultType\Result<T,E>
|
||||
*/
|
||||
final class Error extends Result
|
||||
{
|
||||
/**
|
||||
* @var E
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* Internal constructor for an error value.
|
||||
*
|
||||
* @param E $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __construct($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new error value.
|
||||
*
|
||||
* @template F
|
||||
*
|
||||
* @param F $value
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<T,F>
|
||||
*/
|
||||
public static function create($value)
|
||||
{
|
||||
return new self($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the success option value.
|
||||
*
|
||||
* @return \PhpOption\Option<T>
|
||||
*/
|
||||
public function success()
|
||||
{
|
||||
return None::create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Map over the success value.
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param callable(T):S $f
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<S,E>
|
||||
*/
|
||||
public function map(callable $f)
|
||||
{
|
||||
return self::create($this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flat map over the success value.
|
||||
*
|
||||
* @template S
|
||||
* @template F
|
||||
*
|
||||
* @param callable(T):\GrahamCampbell\ResultType\Result<S,F> $f
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<S,F>
|
||||
*/
|
||||
public function flatMap(callable $f)
|
||||
{
|
||||
/** @var \GrahamCampbell\ResultType\Result<S,F> */
|
||||
return self::create($this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the error option value.
|
||||
*
|
||||
* @return \PhpOption\Option<E>
|
||||
*/
|
||||
public function error()
|
||||
{
|
||||
return Some::create($this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map over the error value.
|
||||
*
|
||||
* @template F
|
||||
*
|
||||
* @param callable(E):F $f
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<T,F>
|
||||
*/
|
||||
public function mapError(callable $f)
|
||||
{
|
||||
return self::create($f($this->value));
|
||||
}
|
||||
}
|
||||
69
vendor/claudecio/axiumphp/vendor/graham-campbell/result-type/src/Result.php
vendored
Executable file
69
vendor/claudecio/axiumphp/vendor/graham-campbell/result-type/src/Result.php
vendored
Executable file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of Result Type.
|
||||
*
|
||||
* (c) Graham Campbell <hello@gjcampbell.co.uk>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace GrahamCampbell\ResultType;
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @template E
|
||||
*/
|
||||
abstract class Result
|
||||
{
|
||||
/**
|
||||
* Get the success option value.
|
||||
*
|
||||
* @return \PhpOption\Option<T>
|
||||
*/
|
||||
abstract public function success();
|
||||
|
||||
/**
|
||||
* Map over the success value.
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param callable(T):S $f
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<S,E>
|
||||
*/
|
||||
abstract public function map(callable $f);
|
||||
|
||||
/**
|
||||
* Flat map over the success value.
|
||||
*
|
||||
* @template S
|
||||
* @template F
|
||||
*
|
||||
* @param callable(T):\GrahamCampbell\ResultType\Result<S,F> $f
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<S,F>
|
||||
*/
|
||||
abstract public function flatMap(callable $f);
|
||||
|
||||
/**
|
||||
* Get the error option value.
|
||||
*
|
||||
* @return \PhpOption\Option<E>
|
||||
*/
|
||||
abstract public function error();
|
||||
|
||||
/**
|
||||
* Map over the error value.
|
||||
*
|
||||
* @template F
|
||||
*
|
||||
* @param callable(E):F $f
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<T,F>
|
||||
*/
|
||||
abstract public function mapError(callable $f);
|
||||
}
|
||||
120
vendor/claudecio/axiumphp/vendor/graham-campbell/result-type/src/Success.php
vendored
Executable file
120
vendor/claudecio/axiumphp/vendor/graham-campbell/result-type/src/Success.php
vendored
Executable file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of Result Type.
|
||||
*
|
||||
* (c) Graham Campbell <hello@gjcampbell.co.uk>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace GrahamCampbell\ResultType;
|
||||
|
||||
use PhpOption\None;
|
||||
use PhpOption\Some;
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @template E
|
||||
*
|
||||
* @extends \GrahamCampbell\ResultType\Result<T,E>
|
||||
*/
|
||||
final class Success extends Result
|
||||
{
|
||||
/**
|
||||
* @var T
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* Internal constructor for a success value.
|
||||
*
|
||||
* @param T $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __construct($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new error value.
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param S $value
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<S,E>
|
||||
*/
|
||||
public static function create($value)
|
||||
{
|
||||
return new self($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the success option value.
|
||||
*
|
||||
* @return \PhpOption\Option<T>
|
||||
*/
|
||||
public function success()
|
||||
{
|
||||
return Some::create($this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map over the success value.
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param callable(T):S $f
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<S,E>
|
||||
*/
|
||||
public function map(callable $f)
|
||||
{
|
||||
return self::create($f($this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Flat map over the success value.
|
||||
*
|
||||
* @template S
|
||||
* @template F
|
||||
*
|
||||
* @param callable(T):\GrahamCampbell\ResultType\Result<S,F> $f
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<S,F>
|
||||
*/
|
||||
public function flatMap(callable $f)
|
||||
{
|
||||
return $f($this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the error option value.
|
||||
*
|
||||
* @return \PhpOption\Option<E>
|
||||
*/
|
||||
public function error()
|
||||
{
|
||||
return None::create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Map over the error value.
|
||||
*
|
||||
* @template F
|
||||
*
|
||||
* @param callable(E):F $f
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<T,F>
|
||||
*/
|
||||
public function mapError(callable $f)
|
||||
{
|
||||
return self::create($this->value);
|
||||
}
|
||||
}
|
||||
201
vendor/claudecio/axiumphp/vendor/phpoption/phpoption/LICENSE
vendored
Executable file
201
vendor/claudecio/axiumphp/vendor/phpoption/phpoption/LICENSE
vendored
Executable file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
50
vendor/claudecio/axiumphp/vendor/phpoption/phpoption/composer.json
vendored
Executable file
50
vendor/claudecio/axiumphp/vendor/phpoption/phpoption/composer.json
vendored
Executable file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "phpoption/phpoption",
|
||||
"description": "Option Type for PHP",
|
||||
"keywords": ["php", "option", "language", "type"],
|
||||
"license": "Apache-2.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Johannes M. Schmitt",
|
||||
"email": "schmittjoh@gmail.com",
|
||||
"homepage": "https://github.com/schmittjoh"
|
||||
},
|
||||
{
|
||||
"name": "Graham Campbell",
|
||||
"email": "hello@gjcampbell.co.uk",
|
||||
"homepage": "https://github.com/GrahamCampbell"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.2.5 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"bamarni/composer-bin-plugin": "^1.8.2",
|
||||
"phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PhpOption\\": "src/PhpOption/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"PhpOption\\Tests\\": "tests/PhpOption/Tests/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"bamarni/composer-bin-plugin": true
|
||||
},
|
||||
"preferred-install": "dist"
|
||||
},
|
||||
"extra": {
|
||||
"bamarni-bin": {
|
||||
"bin-links": true,
|
||||
"forward-command": false
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-master": "1.9-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
175
vendor/claudecio/axiumphp/vendor/phpoption/phpoption/src/PhpOption/LazyOption.php
vendored
Executable file
175
vendor/claudecio/axiumphp/vendor/phpoption/phpoption/src/PhpOption/LazyOption.php
vendored
Executable file
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Johannes M. Schmitt <schmittjoh@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace PhpOption;
|
||||
|
||||
use Traversable;
|
||||
|
||||
/**
|
||||
* @template T
|
||||
*
|
||||
* @extends Option<T>
|
||||
*/
|
||||
final class LazyOption extends Option
|
||||
{
|
||||
/** @var callable(mixed...):(Option<T>) */
|
||||
private $callback;
|
||||
|
||||
/** @var array<int, mixed> */
|
||||
private $arguments;
|
||||
|
||||
/** @var Option<T>|null */
|
||||
private $option;
|
||||
|
||||
/**
|
||||
* @template S
|
||||
* @param callable(mixed...):(Option<S>) $callback
|
||||
* @param array<int, mixed> $arguments
|
||||
*
|
||||
* @return LazyOption<S>
|
||||
*/
|
||||
public static function create($callback, array $arguments = []): self
|
||||
{
|
||||
return new self($callback, $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param callable(mixed...):(Option<T>) $callback
|
||||
* @param array<int, mixed> $arguments
|
||||
*/
|
||||
public function __construct($callback, array $arguments = [])
|
||||
{
|
||||
if (!is_callable($callback)) {
|
||||
throw new \InvalidArgumentException('Invalid callback given');
|
||||
}
|
||||
|
||||
$this->callback = $callback;
|
||||
$this->arguments = $arguments;
|
||||
}
|
||||
|
||||
public function isDefined(): bool
|
||||
{
|
||||
return $this->option()->isDefined();
|
||||
}
|
||||
|
||||
public function isEmpty(): bool
|
||||
{
|
||||
return $this->option()->isEmpty();
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
return $this->option()->get();
|
||||
}
|
||||
|
||||
public function getOrElse($default)
|
||||
{
|
||||
return $this->option()->getOrElse($default);
|
||||
}
|
||||
|
||||
public function getOrCall($callable)
|
||||
{
|
||||
return $this->option()->getOrCall($callable);
|
||||
}
|
||||
|
||||
public function getOrThrow(\Exception $ex)
|
||||
{
|
||||
return $this->option()->getOrThrow($ex);
|
||||
}
|
||||
|
||||
public function orElse(Option $else)
|
||||
{
|
||||
return $this->option()->orElse($else);
|
||||
}
|
||||
|
||||
public function ifDefined($callable)
|
||||
{
|
||||
$this->option()->forAll($callable);
|
||||
}
|
||||
|
||||
public function forAll($callable)
|
||||
{
|
||||
return $this->option()->forAll($callable);
|
||||
}
|
||||
|
||||
public function map($callable)
|
||||
{
|
||||
return $this->option()->map($callable);
|
||||
}
|
||||
|
||||
public function flatMap($callable)
|
||||
{
|
||||
return $this->option()->flatMap($callable);
|
||||
}
|
||||
|
||||
public function filter($callable)
|
||||
{
|
||||
return $this->option()->filter($callable);
|
||||
}
|
||||
|
||||
public function filterNot($callable)
|
||||
{
|
||||
return $this->option()->filterNot($callable);
|
||||
}
|
||||
|
||||
public function select($value)
|
||||
{
|
||||
return $this->option()->select($value);
|
||||
}
|
||||
|
||||
public function reject($value)
|
||||
{
|
||||
return $this->option()->reject($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Traversable<T>
|
||||
*/
|
||||
public function getIterator(): Traversable
|
||||
{
|
||||
return $this->option()->getIterator();
|
||||
}
|
||||
|
||||
public function foldLeft($initialValue, $callable)
|
||||
{
|
||||
return $this->option()->foldLeft($initialValue, $callable);
|
||||
}
|
||||
|
||||
public function foldRight($initialValue, $callable)
|
||||
{
|
||||
return $this->option()->foldRight($initialValue, $callable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Option<T>
|
||||
*/
|
||||
private function option(): Option
|
||||
{
|
||||
if (null === $this->option) {
|
||||
/** @var mixed */
|
||||
$option = call_user_func_array($this->callback, $this->arguments);
|
||||
if ($option instanceof Option) {
|
||||
$this->option = $option;
|
||||
} else {
|
||||
throw new \RuntimeException(sprintf('Expected instance of %s', Option::class));
|
||||
}
|
||||
}
|
||||
|
||||
return $this->option;
|
||||
}
|
||||
}
|
||||
136
vendor/claudecio/axiumphp/vendor/phpoption/phpoption/src/PhpOption/None.php
vendored
Executable file
136
vendor/claudecio/axiumphp/vendor/phpoption/phpoption/src/PhpOption/None.php
vendored
Executable file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Johannes M. Schmitt <schmittjoh@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace PhpOption;
|
||||
|
||||
use EmptyIterator;
|
||||
|
||||
/**
|
||||
* @extends Option<mixed>
|
||||
*/
|
||||
final class None extends Option
|
||||
{
|
||||
/** @var None|null */
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* @return None
|
||||
*/
|
||||
public static function create(): self
|
||||
{
|
||||
if (null === self::$instance) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
throw new \RuntimeException('None has no value.');
|
||||
}
|
||||
|
||||
public function getOrCall($callable)
|
||||
{
|
||||
return $callable();
|
||||
}
|
||||
|
||||
public function getOrElse($default)
|
||||
{
|
||||
return $default;
|
||||
}
|
||||
|
||||
public function getOrThrow(\Exception $ex)
|
||||
{
|
||||
throw $ex;
|
||||
}
|
||||
|
||||
public function isEmpty(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isDefined(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function orElse(Option $else)
|
||||
{
|
||||
return $else;
|
||||
}
|
||||
|
||||
public function ifDefined($callable)
|
||||
{
|
||||
// Just do nothing in that case.
|
||||
}
|
||||
|
||||
public function forAll($callable)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function map($callable)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function flatMap($callable)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function filter($callable)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function filterNot($callable)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function select($value)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function reject($value)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIterator(): EmptyIterator
|
||||
{
|
||||
return new EmptyIterator();
|
||||
}
|
||||
|
||||
public function foldLeft($initialValue, $callable)
|
||||
{
|
||||
return $initialValue;
|
||||
}
|
||||
|
||||
public function foldRight($initialValue, $callable)
|
||||
{
|
||||
return $initialValue;
|
||||
}
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
434
vendor/claudecio/axiumphp/vendor/phpoption/phpoption/src/PhpOption/Option.php
vendored
Executable file
434
vendor/claudecio/axiumphp/vendor/phpoption/phpoption/src/PhpOption/Option.php
vendored
Executable file
@@ -0,0 +1,434 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Johannes M. Schmitt <schmittjoh@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace PhpOption;
|
||||
|
||||
use ArrayAccess;
|
||||
use IteratorAggregate;
|
||||
|
||||
/**
|
||||
* @template T
|
||||
*
|
||||
* @implements IteratorAggregate<T>
|
||||
*/
|
||||
abstract class Option implements IteratorAggregate
|
||||
{
|
||||
/**
|
||||
* Creates an option given a return value.
|
||||
*
|
||||
* This is intended for consuming existing APIs and allows you to easily
|
||||
* convert them to an option. By default, we treat ``null`` as the None
|
||||
* case, and everything else as Some.
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param S $value The actual return value.
|
||||
* @param S $noneValue The value which should be considered "None"; null by
|
||||
* default.
|
||||
*
|
||||
* @return Option<S>
|
||||
*/
|
||||
public static function fromValue($value, $noneValue = null)
|
||||
{
|
||||
if ($value === $noneValue) {
|
||||
return None::create();
|
||||
}
|
||||
|
||||
return new Some($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an option from an array's value.
|
||||
*
|
||||
* If the key does not exist in the array, the array is not actually an
|
||||
* array, or the array's value at the given key is null, None is returned.
|
||||
* Otherwise, Some is returned wrapping the value at the given key.
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param array<string|int,S>|ArrayAccess<string|int,S>|null $array A potential array or \ArrayAccess value.
|
||||
* @param string|int|null $key The key to check.
|
||||
*
|
||||
* @return Option<S>
|
||||
*/
|
||||
public static function fromArraysValue($array, $key)
|
||||
{
|
||||
if ($key === null || !(is_array($array) || $array instanceof ArrayAccess) || !isset($array[$key])) {
|
||||
return None::create();
|
||||
}
|
||||
|
||||
return new Some($array[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a lazy-option with the given callback.
|
||||
*
|
||||
* This is also a helper constructor for lazy-consuming existing APIs where
|
||||
* the return value is not yet an option. By default, we treat ``null`` as
|
||||
* None case, and everything else as Some.
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param callable $callback The callback to evaluate.
|
||||
* @param array $arguments The arguments for the callback.
|
||||
* @param S $noneValue The value which should be considered "None";
|
||||
* null by default.
|
||||
*
|
||||
* @return LazyOption<S>
|
||||
*/
|
||||
public static function fromReturn($callback, array $arguments = [], $noneValue = null)
|
||||
{
|
||||
return new LazyOption(static function () use ($callback, $arguments, $noneValue) {
|
||||
/** @var mixed */
|
||||
$return = call_user_func_array($callback, $arguments);
|
||||
|
||||
if ($return === $noneValue) {
|
||||
return None::create();
|
||||
}
|
||||
|
||||
return new Some($return);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Option factory, which creates new option based on passed value.
|
||||
*
|
||||
* If value is already an option, it simply returns. If value is callable,
|
||||
* LazyOption with passed callback created and returned. If Option
|
||||
* returned from callback, it returns directly. On other case value passed
|
||||
* to Option::fromValue() method.
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param Option<S>|callable|S $value
|
||||
* @param S $noneValue Used when $value is mixed or
|
||||
* callable, for None-check.
|
||||
*
|
||||
* @return Option<S>|LazyOption<S>
|
||||
*/
|
||||
public static function ensure($value, $noneValue = null)
|
||||
{
|
||||
if ($value instanceof self) {
|
||||
return $value;
|
||||
} elseif (is_callable($value)) {
|
||||
return new LazyOption(static function () use ($value, $noneValue) {
|
||||
/** @var mixed */
|
||||
$return = $value();
|
||||
|
||||
if ($return instanceof self) {
|
||||
return $return;
|
||||
} else {
|
||||
return self::fromValue($return, $noneValue);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return self::fromValue($value, $noneValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lift a function so that it accepts Option as parameters.
|
||||
*
|
||||
* We return a new closure that wraps the original callback. If any of the
|
||||
* parameters passed to the lifted function is empty, the function will
|
||||
* return a value of None. Otherwise, we will pass all parameters to the
|
||||
* original callback and return the value inside a new Option, unless an
|
||||
* Option is returned from the function, in which case, we use that.
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param mixed $noneValue
|
||||
*
|
||||
* @return callable
|
||||
*/
|
||||
public static function lift($callback, $noneValue = null)
|
||||
{
|
||||
return static function () use ($callback, $noneValue) {
|
||||
/** @var array<int, mixed> */
|
||||
$args = func_get_args();
|
||||
|
||||
$reduced_args = array_reduce(
|
||||
$args,
|
||||
/** @param bool $status */
|
||||
static function ($status, self $o) {
|
||||
return $o->isEmpty() ? true : $status;
|
||||
},
|
||||
false
|
||||
);
|
||||
// if at least one parameter is empty, return None
|
||||
if ($reduced_args) {
|
||||
return None::create();
|
||||
}
|
||||
|
||||
$args = array_map(
|
||||
/** @return T */
|
||||
static function (self $o) {
|
||||
// it is safe to do so because the fold above checked
|
||||
// that all arguments are of type Some
|
||||
/** @var T */
|
||||
return $o->get();
|
||||
},
|
||||
$args
|
||||
);
|
||||
|
||||
return self::ensure(call_user_func_array($callback, $args), $noneValue);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value if available, or throws an exception otherwise.
|
||||
*
|
||||
* @throws \RuntimeException If value is not available.
|
||||
*
|
||||
* @return T
|
||||
*/
|
||||
abstract public function get();
|
||||
|
||||
/**
|
||||
* Returns the value if available, or the default value if not.
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param S $default
|
||||
*
|
||||
* @return T|S
|
||||
*/
|
||||
abstract public function getOrElse($default);
|
||||
|
||||
/**
|
||||
* Returns the value if available, or the results of the callable.
|
||||
*
|
||||
* This is preferable over ``getOrElse`` if the computation of the default
|
||||
* value is expensive.
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param callable():S $callable
|
||||
*
|
||||
* @return T|S
|
||||
*/
|
||||
abstract public function getOrCall($callable);
|
||||
|
||||
/**
|
||||
* Returns the value if available, or throws the passed exception.
|
||||
*
|
||||
* @param \Exception $ex
|
||||
*
|
||||
* @return T
|
||||
*/
|
||||
abstract public function getOrThrow(\Exception $ex);
|
||||
|
||||
/**
|
||||
* Returns true if no value is available, false otherwise.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function isEmpty();
|
||||
|
||||
/**
|
||||
* Returns true if a value is available, false otherwise.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function isDefined();
|
||||
|
||||
/**
|
||||
* Returns this option if non-empty, or the passed option otherwise.
|
||||
*
|
||||
* This can be used to try multiple alternatives, and is especially useful
|
||||
* with lazy evaluating options:
|
||||
*
|
||||
* ```php
|
||||
* $repo->findSomething()
|
||||
* ->orElse(new LazyOption(array($repo, 'findSomethingElse')))
|
||||
* ->orElse(new LazyOption(array($repo, 'createSomething')));
|
||||
* ```
|
||||
*
|
||||
* @param Option<T> $else
|
||||
*
|
||||
* @return Option<T>
|
||||
*/
|
||||
abstract public function orElse(self $else);
|
||||
|
||||
/**
|
||||
* This is similar to map() below except that the return value has no meaning;
|
||||
* the passed callable is simply executed if the option is non-empty, and
|
||||
* ignored if the option is empty.
|
||||
*
|
||||
* In all cases, the return value of the callable is discarded.
|
||||
*
|
||||
* ```php
|
||||
* $comment->getMaybeFile()->ifDefined(function($file) {
|
||||
* // Do something with $file here.
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* If you're looking for something like ``ifEmpty``, you can use ``getOrCall``
|
||||
* and ``getOrElse`` in these cases.
|
||||
*
|
||||
* @deprecated Use forAll() instead.
|
||||
*
|
||||
* @param callable(T):mixed $callable
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
abstract public function ifDefined($callable);
|
||||
|
||||
/**
|
||||
* This is similar to map() except that the return value of the callable has no meaning.
|
||||
*
|
||||
* The passed callable is simply executed if the option is non-empty, and ignored if the
|
||||
* option is empty. This method is preferred for callables with side-effects, while map()
|
||||
* is intended for callables without side-effects.
|
||||
*
|
||||
* @param callable(T):mixed $callable
|
||||
*
|
||||
* @return Option<T>
|
||||
*/
|
||||
abstract public function forAll($callable);
|
||||
|
||||
/**
|
||||
* Applies the callable to the value of the option if it is non-empty,
|
||||
* and returns the return value of the callable wrapped in Some().
|
||||
*
|
||||
* If the option is empty, then the callable is not applied.
|
||||
*
|
||||
* ```php
|
||||
* (new Some("foo"))->map('strtoupper')->get(); // "FOO"
|
||||
* ```
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param callable(T):S $callable
|
||||
*
|
||||
* @return Option<S>
|
||||
*/
|
||||
abstract public function map($callable);
|
||||
|
||||
/**
|
||||
* Applies the callable to the value of the option if it is non-empty, and
|
||||
* returns the return value of the callable directly.
|
||||
*
|
||||
* In contrast to ``map``, the return value of the callable is expected to
|
||||
* be an Option itself; it is not automatically wrapped in Some().
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param callable(T):Option<S> $callable must return an Option
|
||||
*
|
||||
* @return Option<S>
|
||||
*/
|
||||
abstract public function flatMap($callable);
|
||||
|
||||
/**
|
||||
* If the option is empty, it is returned immediately without applying the callable.
|
||||
*
|
||||
* If the option is non-empty, the callable is applied, and if it returns true,
|
||||
* the option itself is returned; otherwise, None is returned.
|
||||
*
|
||||
* @param callable(T):bool $callable
|
||||
*
|
||||
* @return Option<T>
|
||||
*/
|
||||
abstract public function filter($callable);
|
||||
|
||||
/**
|
||||
* If the option is empty, it is returned immediately without applying the callable.
|
||||
*
|
||||
* If the option is non-empty, the callable is applied, and if it returns false,
|
||||
* the option itself is returned; otherwise, None is returned.
|
||||
*
|
||||
* @param callable(T):bool $callable
|
||||
*
|
||||
* @return Option<T>
|
||||
*/
|
||||
abstract public function filterNot($callable);
|
||||
|
||||
/**
|
||||
* If the option is empty, it is returned immediately.
|
||||
*
|
||||
* If the option is non-empty, and its value does not equal the passed value
|
||||
* (via a shallow comparison ===), then None is returned. Otherwise, the
|
||||
* Option is returned.
|
||||
*
|
||||
* In other words, this will filter all but the passed value.
|
||||
*
|
||||
* @param T $value
|
||||
*
|
||||
* @return Option<T>
|
||||
*/
|
||||
abstract public function select($value);
|
||||
|
||||
/**
|
||||
* If the option is empty, it is returned immediately.
|
||||
*
|
||||
* If the option is non-empty, and its value does equal the passed value (via
|
||||
* a shallow comparison ===), then None is returned; otherwise, the Option is
|
||||
* returned.
|
||||
*
|
||||
* In other words, this will let all values through except the passed value.
|
||||
*
|
||||
* @param T $value
|
||||
*
|
||||
* @return Option<T>
|
||||
*/
|
||||
abstract public function reject($value);
|
||||
|
||||
/**
|
||||
* Binary operator for the initial value and the option's value.
|
||||
*
|
||||
* If empty, the initial value is returned. If non-empty, the callable
|
||||
* receives the initial value and the option's value as arguments.
|
||||
*
|
||||
* ```php
|
||||
*
|
||||
* $some = new Some(5);
|
||||
* $none = None::create();
|
||||
* $result = $some->foldLeft(1, function($a, $b) { return $a + $b; }); // int(6)
|
||||
* $result = $none->foldLeft(1, function($a, $b) { return $a + $b; }); // int(1)
|
||||
*
|
||||
* // This can be used instead of something like the following:
|
||||
* $option = Option::fromValue($integerOrNull);
|
||||
* $result = 1;
|
||||
* if ( ! $option->isEmpty()) {
|
||||
* $result += $option->get();
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param S $initialValue
|
||||
* @param callable(S, T):S $callable
|
||||
*
|
||||
* @return S
|
||||
*/
|
||||
abstract public function foldLeft($initialValue, $callable);
|
||||
|
||||
/**
|
||||
* foldLeft() but with reversed arguments for the callable.
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param S $initialValue
|
||||
* @param callable(T, S):S $callable
|
||||
*
|
||||
* @return S
|
||||
*/
|
||||
abstract public function foldRight($initialValue, $callable);
|
||||
}
|
||||
169
vendor/claudecio/axiumphp/vendor/phpoption/phpoption/src/PhpOption/Some.php
vendored
Executable file
169
vendor/claudecio/axiumphp/vendor/phpoption/phpoption/src/PhpOption/Some.php
vendored
Executable file
@@ -0,0 +1,169 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Johannes M. Schmitt <schmittjoh@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace PhpOption;
|
||||
|
||||
use ArrayIterator;
|
||||
|
||||
/**
|
||||
* @template T
|
||||
*
|
||||
* @extends Option<T>
|
||||
*/
|
||||
final class Some extends Option
|
||||
{
|
||||
/** @var T */
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* @param T $value
|
||||
*/
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @template U
|
||||
*
|
||||
* @param U $value
|
||||
*
|
||||
* @return Some<U>
|
||||
*/
|
||||
public static function create($value): self
|
||||
{
|
||||
return new self($value);
|
||||
}
|
||||
|
||||
public function isDefined(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isEmpty(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function getOrElse($default)
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function getOrCall($callable)
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function getOrThrow(\Exception $ex)
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function orElse(Option $else)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function ifDefined($callable)
|
||||
{
|
||||
$this->forAll($callable);
|
||||
}
|
||||
|
||||
public function forAll($callable)
|
||||
{
|
||||
$callable($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function map($callable)
|
||||
{
|
||||
return new self($callable($this->value));
|
||||
}
|
||||
|
||||
public function flatMap($callable)
|
||||
{
|
||||
/** @var mixed */
|
||||
$rs = $callable($this->value);
|
||||
if (!$rs instanceof Option) {
|
||||
throw new \RuntimeException('Callables passed to flatMap() must return an Option. Maybe you should use map() instead?');
|
||||
}
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
public function filter($callable)
|
||||
{
|
||||
if (true === $callable($this->value)) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
return None::create();
|
||||
}
|
||||
|
||||
public function filterNot($callable)
|
||||
{
|
||||
if (false === $callable($this->value)) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
return None::create();
|
||||
}
|
||||
|
||||
public function select($value)
|
||||
{
|
||||
if ($this->value === $value) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
return None::create();
|
||||
}
|
||||
|
||||
public function reject($value)
|
||||
{
|
||||
if ($this->value === $value) {
|
||||
return None::create();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ArrayIterator<int, T>
|
||||
*/
|
||||
public function getIterator(): ArrayIterator
|
||||
{
|
||||
return new ArrayIterator([$this->value]);
|
||||
}
|
||||
|
||||
public function foldLeft($initialValue, $callable)
|
||||
{
|
||||
return $callable($initialValue, $this->value);
|
||||
}
|
||||
|
||||
public function foldRight($initialValue, $callable)
|
||||
{
|
||||
return $callable($this->value, $initialValue);
|
||||
}
|
||||
}
|
||||
232
vendor/claudecio/axiumphp/vendor/symfony/polyfill-ctype/Ctype.php
vendored
Executable file
232
vendor/claudecio/axiumphp/vendor/symfony/polyfill-ctype/Ctype.php
vendored
Executable file
@@ -0,0 +1,232 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Polyfill\Ctype;
|
||||
|
||||
/**
|
||||
* Ctype implementation through regex.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @author Gert de Pagter <BackEndTea@gmail.com>
|
||||
*/
|
||||
final class Ctype
|
||||
{
|
||||
/**
|
||||
* Returns TRUE if every character in text is either a letter or a digit, FALSE otherwise.
|
||||
*
|
||||
* @see https://php.net/ctype-alnum
|
||||
*
|
||||
* @param mixed $text
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function ctype_alnum($text)
|
||||
{
|
||||
$text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
|
||||
|
||||
return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns TRUE if every character in text is a letter, FALSE otherwise.
|
||||
*
|
||||
* @see https://php.net/ctype-alpha
|
||||
*
|
||||
* @param mixed $text
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function ctype_alpha($text)
|
||||
{
|
||||
$text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
|
||||
|
||||
return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns TRUE if every character in text is a control character from the current locale, FALSE otherwise.
|
||||
*
|
||||
* @see https://php.net/ctype-cntrl
|
||||
*
|
||||
* @param mixed $text
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function ctype_cntrl($text)
|
||||
{
|
||||
$text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
|
||||
|
||||
return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns TRUE if every character in the string text is a decimal digit, FALSE otherwise.
|
||||
*
|
||||
* @see https://php.net/ctype-digit
|
||||
*
|
||||
* @param mixed $text
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function ctype_digit($text)
|
||||
{
|
||||
$text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
|
||||
|
||||
return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns TRUE if every character in text is printable and actually creates visible output (no white space), FALSE otherwise.
|
||||
*
|
||||
* @see https://php.net/ctype-graph
|
||||
*
|
||||
* @param mixed $text
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function ctype_graph($text)
|
||||
{
|
||||
$text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
|
||||
|
||||
return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns TRUE if every character in text is a lowercase letter.
|
||||
*
|
||||
* @see https://php.net/ctype-lower
|
||||
*
|
||||
* @param mixed $text
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function ctype_lower($text)
|
||||
{
|
||||
$text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
|
||||
|
||||
return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns TRUE if every character in text will actually create output (including blanks). Returns FALSE if text contains control characters or characters that do not have any output or control function at all.
|
||||
*
|
||||
* @see https://php.net/ctype-print
|
||||
*
|
||||
* @param mixed $text
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function ctype_print($text)
|
||||
{
|
||||
$text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
|
||||
|
||||
return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns TRUE if every character in text is printable, but neither letter, digit or blank, FALSE otherwise.
|
||||
*
|
||||
* @see https://php.net/ctype-punct
|
||||
*
|
||||
* @param mixed $text
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function ctype_punct($text)
|
||||
{
|
||||
$text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
|
||||
|
||||
return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns TRUE if every character in text creates some sort of white space, FALSE otherwise. Besides the blank character this also includes tab, vertical tab, line feed, carriage return and form feed characters.
|
||||
*
|
||||
* @see https://php.net/ctype-space
|
||||
*
|
||||
* @param mixed $text
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function ctype_space($text)
|
||||
{
|
||||
$text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
|
||||
|
||||
return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns TRUE if every character in text is an uppercase letter.
|
||||
*
|
||||
* @see https://php.net/ctype-upper
|
||||
*
|
||||
* @param mixed $text
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function ctype_upper($text)
|
||||
{
|
||||
$text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
|
||||
|
||||
return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns TRUE if every character in text is a hexadecimal 'digit', that is a decimal digit or a character from [A-Fa-f] , FALSE otherwise.
|
||||
*
|
||||
* @see https://php.net/ctype-xdigit
|
||||
*
|
||||
* @param mixed $text
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function ctype_xdigit($text)
|
||||
{
|
||||
$text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
|
||||
|
||||
return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts integers to their char versions according to normal ctype behaviour, if needed.
|
||||
*
|
||||
* If an integer between -128 and 255 inclusive is provided,
|
||||
* it is interpreted as the ASCII value of a single character
|
||||
* (negative values have 256 added in order to allow characters in the Extended ASCII range).
|
||||
* Any other integer is interpreted as a string containing the decimal digits of the integer.
|
||||
*
|
||||
* @param mixed $int
|
||||
* @param string $function
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private static function convert_int_to_char_for_ctype($int, $function)
|
||||
{
|
||||
if (!\is_int($int)) {
|
||||
return $int;
|
||||
}
|
||||
|
||||
if ($int < -128 || $int > 255) {
|
||||
return (string) $int;
|
||||
}
|
||||
|
||||
if (\PHP_VERSION_ID >= 80100) {
|
||||
@trigger_error($function.'(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
if ($int < 0) {
|
||||
$int += 256;
|
||||
}
|
||||
|
||||
return \chr($int);
|
||||
}
|
||||
}
|
||||
19
vendor/claudecio/axiumphp/vendor/symfony/polyfill-ctype/LICENSE
vendored
Executable file
19
vendor/claudecio/axiumphp/vendor/symfony/polyfill-ctype/LICENSE
vendored
Executable file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2018-present Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
12
vendor/claudecio/axiumphp/vendor/symfony/polyfill-ctype/README.md
vendored
Executable file
12
vendor/claudecio/axiumphp/vendor/symfony/polyfill-ctype/README.md
vendored
Executable file
@@ -0,0 +1,12 @@
|
||||
Symfony Polyfill / Ctype
|
||||
========================
|
||||
|
||||
This component provides `ctype_*` functions to users who run php versions without the ctype extension.
|
||||
|
||||
More information can be found in the
|
||||
[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md).
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
This library is released under the [MIT license](LICENSE).
|
||||
50
vendor/claudecio/axiumphp/vendor/symfony/polyfill-ctype/bootstrap.php
vendored
Executable file
50
vendor/claudecio/axiumphp/vendor/symfony/polyfill-ctype/bootstrap.php
vendored
Executable file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Symfony\Polyfill\Ctype as p;
|
||||
|
||||
if (\PHP_VERSION_ID >= 80000) {
|
||||
return require __DIR__.'/bootstrap80.php';
|
||||
}
|
||||
|
||||
if (!function_exists('ctype_alnum')) {
|
||||
function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
|
||||
}
|
||||
if (!function_exists('ctype_alpha')) {
|
||||
function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
|
||||
}
|
||||
if (!function_exists('ctype_cntrl')) {
|
||||
function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
|
||||
}
|
||||
if (!function_exists('ctype_digit')) {
|
||||
function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
|
||||
}
|
||||
if (!function_exists('ctype_graph')) {
|
||||
function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
|
||||
}
|
||||
if (!function_exists('ctype_lower')) {
|
||||
function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
|
||||
}
|
||||
if (!function_exists('ctype_print')) {
|
||||
function ctype_print($text) { return p\Ctype::ctype_print($text); }
|
||||
}
|
||||
if (!function_exists('ctype_punct')) {
|
||||
function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
|
||||
}
|
||||
if (!function_exists('ctype_space')) {
|
||||
function ctype_space($text) { return p\Ctype::ctype_space($text); }
|
||||
}
|
||||
if (!function_exists('ctype_upper')) {
|
||||
function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
|
||||
}
|
||||
if (!function_exists('ctype_xdigit')) {
|
||||
function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
|
||||
}
|
||||
46
vendor/claudecio/axiumphp/vendor/symfony/polyfill-ctype/bootstrap80.php
vendored
Executable file
46
vendor/claudecio/axiumphp/vendor/symfony/polyfill-ctype/bootstrap80.php
vendored
Executable file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Symfony\Polyfill\Ctype as p;
|
||||
|
||||
if (!function_exists('ctype_alnum')) {
|
||||
function ctype_alnum(mixed $text): bool { return p\Ctype::ctype_alnum($text); }
|
||||
}
|
||||
if (!function_exists('ctype_alpha')) {
|
||||
function ctype_alpha(mixed $text): bool { return p\Ctype::ctype_alpha($text); }
|
||||
}
|
||||
if (!function_exists('ctype_cntrl')) {
|
||||
function ctype_cntrl(mixed $text): bool { return p\Ctype::ctype_cntrl($text); }
|
||||
}
|
||||
if (!function_exists('ctype_digit')) {
|
||||
function ctype_digit(mixed $text): bool { return p\Ctype::ctype_digit($text); }
|
||||
}
|
||||
if (!function_exists('ctype_graph')) {
|
||||
function ctype_graph(mixed $text): bool { return p\Ctype::ctype_graph($text); }
|
||||
}
|
||||
if (!function_exists('ctype_lower')) {
|
||||
function ctype_lower(mixed $text): bool { return p\Ctype::ctype_lower($text); }
|
||||
}
|
||||
if (!function_exists('ctype_print')) {
|
||||
function ctype_print(mixed $text): bool { return p\Ctype::ctype_print($text); }
|
||||
}
|
||||
if (!function_exists('ctype_punct')) {
|
||||
function ctype_punct(mixed $text): bool { return p\Ctype::ctype_punct($text); }
|
||||
}
|
||||
if (!function_exists('ctype_space')) {
|
||||
function ctype_space(mixed $text): bool { return p\Ctype::ctype_space($text); }
|
||||
}
|
||||
if (!function_exists('ctype_upper')) {
|
||||
function ctype_upper(mixed $text): bool { return p\Ctype::ctype_upper($text); }
|
||||
}
|
||||
if (!function_exists('ctype_xdigit')) {
|
||||
function ctype_xdigit(mixed $text): bool { return p\Ctype::ctype_xdigit($text); }
|
||||
}
|
||||
38
vendor/claudecio/axiumphp/vendor/symfony/polyfill-ctype/composer.json
vendored
Executable file
38
vendor/claudecio/axiumphp/vendor/symfony/polyfill-ctype/composer.json
vendored
Executable file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"type": "library",
|
||||
"description": "Symfony polyfill for ctype functions",
|
||||
"keywords": ["polyfill", "compatibility", "portable", "ctype"],
|
||||
"homepage": "https://symfony.com",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Gert de Pagter",
|
||||
"email": "BackEndTea@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"provide": {
|
||||
"ext-ctype": "*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Symfony\\Polyfill\\Ctype\\": "" },
|
||||
"files": [ "bootstrap.php" ]
|
||||
},
|
||||
"suggest": {
|
||||
"ext-ctype": "For best performance"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
}
|
||||
}
|
||||
19
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/LICENSE
vendored
Executable file
19
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/LICENSE
vendored
Executable file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2015-present Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
1045
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/Mbstring.php
vendored
Executable file
1045
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/Mbstring.php
vendored
Executable file
File diff suppressed because it is too large
Load Diff
13
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/README.md
vendored
Executable file
13
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/README.md
vendored
Executable file
@@ -0,0 +1,13 @@
|
||||
Symfony Polyfill / Mbstring
|
||||
===========================
|
||||
|
||||
This component provides a partial, native PHP implementation for the
|
||||
[Mbstring](https://php.net/mbstring) extension.
|
||||
|
||||
More information can be found in the
|
||||
[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md).
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
This library is released under the [MIT license](LICENSE).
|
||||
119
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php
vendored
Executable file
119
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php
vendored
Executable file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'İ' => 'i̇',
|
||||
'µ' => 'μ',
|
||||
'ſ' => 's',
|
||||
'ͅ' => 'ι',
|
||||
'ς' => 'σ',
|
||||
'ϐ' => 'β',
|
||||
'ϑ' => 'θ',
|
||||
'ϕ' => 'φ',
|
||||
'ϖ' => 'π',
|
||||
'ϰ' => 'κ',
|
||||
'ϱ' => 'ρ',
|
||||
'ϵ' => 'ε',
|
||||
'ẛ' => 'ṡ',
|
||||
'ι' => 'ι',
|
||||
'ß' => 'ss',
|
||||
'ʼn' => 'ʼn',
|
||||
'ǰ' => 'ǰ',
|
||||
'ΐ' => 'ΐ',
|
||||
'ΰ' => 'ΰ',
|
||||
'և' => 'եւ',
|
||||
'ẖ' => 'ẖ',
|
||||
'ẗ' => 'ẗ',
|
||||
'ẘ' => 'ẘ',
|
||||
'ẙ' => 'ẙ',
|
||||
'ẚ' => 'aʾ',
|
||||
'ẞ' => 'ss',
|
||||
'ὐ' => 'ὐ',
|
||||
'ὒ' => 'ὒ',
|
||||
'ὔ' => 'ὔ',
|
||||
'ὖ' => 'ὖ',
|
||||
'ᾀ' => 'ἀι',
|
||||
'ᾁ' => 'ἁι',
|
||||
'ᾂ' => 'ἂι',
|
||||
'ᾃ' => 'ἃι',
|
||||
'ᾄ' => 'ἄι',
|
||||
'ᾅ' => 'ἅι',
|
||||
'ᾆ' => 'ἆι',
|
||||
'ᾇ' => 'ἇι',
|
||||
'ᾈ' => 'ἀι',
|
||||
'ᾉ' => 'ἁι',
|
||||
'ᾊ' => 'ἂι',
|
||||
'ᾋ' => 'ἃι',
|
||||
'ᾌ' => 'ἄι',
|
||||
'ᾍ' => 'ἅι',
|
||||
'ᾎ' => 'ἆι',
|
||||
'ᾏ' => 'ἇι',
|
||||
'ᾐ' => 'ἠι',
|
||||
'ᾑ' => 'ἡι',
|
||||
'ᾒ' => 'ἢι',
|
||||
'ᾓ' => 'ἣι',
|
||||
'ᾔ' => 'ἤι',
|
||||
'ᾕ' => 'ἥι',
|
||||
'ᾖ' => 'ἦι',
|
||||
'ᾗ' => 'ἧι',
|
||||
'ᾘ' => 'ἠι',
|
||||
'ᾙ' => 'ἡι',
|
||||
'ᾚ' => 'ἢι',
|
||||
'ᾛ' => 'ἣι',
|
||||
'ᾜ' => 'ἤι',
|
||||
'ᾝ' => 'ἥι',
|
||||
'ᾞ' => 'ἦι',
|
||||
'ᾟ' => 'ἧι',
|
||||
'ᾠ' => 'ὠι',
|
||||
'ᾡ' => 'ὡι',
|
||||
'ᾢ' => 'ὢι',
|
||||
'ᾣ' => 'ὣι',
|
||||
'ᾤ' => 'ὤι',
|
||||
'ᾥ' => 'ὥι',
|
||||
'ᾦ' => 'ὦι',
|
||||
'ᾧ' => 'ὧι',
|
||||
'ᾨ' => 'ὠι',
|
||||
'ᾩ' => 'ὡι',
|
||||
'ᾪ' => 'ὢι',
|
||||
'ᾫ' => 'ὣι',
|
||||
'ᾬ' => 'ὤι',
|
||||
'ᾭ' => 'ὥι',
|
||||
'ᾮ' => 'ὦι',
|
||||
'ᾯ' => 'ὧι',
|
||||
'ᾲ' => 'ὰι',
|
||||
'ᾳ' => 'αι',
|
||||
'ᾴ' => 'άι',
|
||||
'ᾶ' => 'ᾶ',
|
||||
'ᾷ' => 'ᾶι',
|
||||
'ᾼ' => 'αι',
|
||||
'ῂ' => 'ὴι',
|
||||
'ῃ' => 'ηι',
|
||||
'ῄ' => 'ήι',
|
||||
'ῆ' => 'ῆ',
|
||||
'ῇ' => 'ῆι',
|
||||
'ῌ' => 'ηι',
|
||||
'ῒ' => 'ῒ',
|
||||
'ῖ' => 'ῖ',
|
||||
'ῗ' => 'ῗ',
|
||||
'ῢ' => 'ῢ',
|
||||
'ῤ' => 'ῤ',
|
||||
'ῦ' => 'ῦ',
|
||||
'ῧ' => 'ῧ',
|
||||
'ῲ' => 'ὼι',
|
||||
'ῳ' => 'ωι',
|
||||
'ῴ' => 'ώι',
|
||||
'ῶ' => 'ῶ',
|
||||
'ῷ' => 'ῶι',
|
||||
'ῼ' => 'ωι',
|
||||
'ff' => 'ff',
|
||||
'fi' => 'fi',
|
||||
'fl' => 'fl',
|
||||
'ffi' => 'ffi',
|
||||
'ffl' => 'ffl',
|
||||
'ſt' => 'st',
|
||||
'st' => 'st',
|
||||
'ﬓ' => 'մն',
|
||||
'ﬔ' => 'մե',
|
||||
'ﬕ' => 'մի',
|
||||
'ﬖ' => 'վն',
|
||||
'ﬗ' => 'մխ',
|
||||
];
|
||||
1397
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php
vendored
Executable file
1397
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php
vendored
Executable file
File diff suppressed because it is too large
Load Diff
5
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php
vendored
Executable file
5
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php
vendored
Executable file
File diff suppressed because one or more lines are too long
1489
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php
vendored
Executable file
1489
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php
vendored
Executable file
File diff suppressed because it is too large
Load Diff
172
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/bootstrap.php
vendored
Executable file
172
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/bootstrap.php
vendored
Executable file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Symfony\Polyfill\Mbstring as p;
|
||||
|
||||
if (\PHP_VERSION_ID >= 80000) {
|
||||
return require __DIR__.'/bootstrap80.php';
|
||||
}
|
||||
|
||||
if (!function_exists('mb_convert_encoding')) {
|
||||
function mb_convert_encoding($string, $to_encoding, $from_encoding = null) { return p\Mbstring::mb_convert_encoding($string, $to_encoding, $from_encoding); }
|
||||
}
|
||||
if (!function_exists('mb_decode_mimeheader')) {
|
||||
function mb_decode_mimeheader($string) { return p\Mbstring::mb_decode_mimeheader($string); }
|
||||
}
|
||||
if (!function_exists('mb_encode_mimeheader')) {
|
||||
function mb_encode_mimeheader($string, $charset = null, $transfer_encoding = null, $newline = "\r\n", $indent = 0) { return p\Mbstring::mb_encode_mimeheader($string, $charset, $transfer_encoding, $newline, $indent); }
|
||||
}
|
||||
if (!function_exists('mb_decode_numericentity')) {
|
||||
function mb_decode_numericentity($string, $map, $encoding = null) { return p\Mbstring::mb_decode_numericentity($string, $map, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_encode_numericentity')) {
|
||||
function mb_encode_numericentity($string, $map, $encoding = null, $hex = false) { return p\Mbstring::mb_encode_numericentity($string, $map, $encoding, $hex); }
|
||||
}
|
||||
if (!function_exists('mb_convert_case')) {
|
||||
function mb_convert_case($string, $mode, $encoding = null) { return p\Mbstring::mb_convert_case($string, $mode, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_internal_encoding')) {
|
||||
function mb_internal_encoding($encoding = null) { return p\Mbstring::mb_internal_encoding($encoding); }
|
||||
}
|
||||
if (!function_exists('mb_language')) {
|
||||
function mb_language($language = null) { return p\Mbstring::mb_language($language); }
|
||||
}
|
||||
if (!function_exists('mb_list_encodings')) {
|
||||
function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
|
||||
}
|
||||
if (!function_exists('mb_encoding_aliases')) {
|
||||
function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
|
||||
}
|
||||
if (!function_exists('mb_check_encoding')) {
|
||||
function mb_check_encoding($value = null, $encoding = null) { return p\Mbstring::mb_check_encoding($value, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_detect_encoding')) {
|
||||
function mb_detect_encoding($string, $encodings = null, $strict = false) { return p\Mbstring::mb_detect_encoding($string, $encodings, $strict); }
|
||||
}
|
||||
if (!function_exists('mb_detect_order')) {
|
||||
function mb_detect_order($encoding = null) { return p\Mbstring::mb_detect_order($encoding); }
|
||||
}
|
||||
if (!function_exists('mb_parse_str')) {
|
||||
function mb_parse_str($string, &$result = []) { parse_str($string, $result); return (bool) $result; }
|
||||
}
|
||||
if (!function_exists('mb_strlen')) {
|
||||
function mb_strlen($string, $encoding = null) { return p\Mbstring::mb_strlen($string, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strpos')) {
|
||||
function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strpos($haystack, $needle, $offset, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strtolower')) {
|
||||
function mb_strtolower($string, $encoding = null) { return p\Mbstring::mb_strtolower($string, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strtoupper')) {
|
||||
function mb_strtoupper($string, $encoding = null) { return p\Mbstring::mb_strtoupper($string, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_substitute_character')) {
|
||||
function mb_substitute_character($substitute_character = null) { return p\Mbstring::mb_substitute_character($substitute_character); }
|
||||
}
|
||||
if (!function_exists('mb_substr')) {
|
||||
function mb_substr($string, $start, $length = 2147483647, $encoding = null) { return p\Mbstring::mb_substr($string, $start, $length, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_stripos')) {
|
||||
function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_stripos($haystack, $needle, $offset, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_stristr')) {
|
||||
function mb_stristr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_stristr($haystack, $needle, $before_needle, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strrchr')) {
|
||||
function mb_strrchr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrchr($haystack, $needle, $before_needle, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strrichr')) {
|
||||
function mb_strrichr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrichr($haystack, $needle, $before_needle, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strripos')) {
|
||||
function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strripos($haystack, $needle, $offset, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strrpos')) {
|
||||
function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strrpos($haystack, $needle, $offset, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strstr')) {
|
||||
function mb_strstr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strstr($haystack, $needle, $before_needle, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_get_info')) {
|
||||
function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
|
||||
}
|
||||
if (!function_exists('mb_http_output')) {
|
||||
function mb_http_output($encoding = null) { return p\Mbstring::mb_http_output($encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strwidth')) {
|
||||
function mb_strwidth($string, $encoding = null) { return p\Mbstring::mb_strwidth($string, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_substr_count')) {
|
||||
function mb_substr_count($haystack, $needle, $encoding = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_output_handler')) {
|
||||
function mb_output_handler($string, $status) { return p\Mbstring::mb_output_handler($string, $status); }
|
||||
}
|
||||
if (!function_exists('mb_http_input')) {
|
||||
function mb_http_input($type = null) { return p\Mbstring::mb_http_input($type); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_convert_variables')) {
|
||||
function mb_convert_variables($to_encoding, $from_encoding, &...$vars) { return p\Mbstring::mb_convert_variables($to_encoding, $from_encoding, ...$vars); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_ord')) {
|
||||
function mb_ord($string, $encoding = null) { return p\Mbstring::mb_ord($string, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_chr')) {
|
||||
function mb_chr($codepoint, $encoding = null) { return p\Mbstring::mb_chr($codepoint, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_scrub')) {
|
||||
function mb_scrub($string, $encoding = null) { $encoding = null === $encoding ? mb_internal_encoding() : $encoding; return mb_convert_encoding($string, $encoding, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_str_split')) {
|
||||
function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $length, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_str_pad')) {
|
||||
function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_ucfirst')) {
|
||||
function mb_ucfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_ucfirst($string, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_lcfirst')) {
|
||||
function mb_lcfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_lcfirst($string, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_trim')) {
|
||||
function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_trim($string, $characters, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_ltrim')) {
|
||||
function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_ltrim($string, $characters, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_rtrim')) {
|
||||
function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_rtrim($string, $characters, $encoding); }
|
||||
}
|
||||
|
||||
|
||||
if (extension_loaded('mbstring')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!defined('MB_CASE_UPPER')) {
|
||||
define('MB_CASE_UPPER', 0);
|
||||
}
|
||||
if (!defined('MB_CASE_LOWER')) {
|
||||
define('MB_CASE_LOWER', 1);
|
||||
}
|
||||
if (!defined('MB_CASE_TITLE')) {
|
||||
define('MB_CASE_TITLE', 2);
|
||||
}
|
||||
167
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/bootstrap80.php
vendored
Executable file
167
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/bootstrap80.php
vendored
Executable file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Symfony\Polyfill\Mbstring as p;
|
||||
|
||||
if (!function_exists('mb_convert_encoding')) {
|
||||
function mb_convert_encoding(array|string|null $string, ?string $to_encoding, array|string|null $from_encoding = null): array|string|false { return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); }
|
||||
}
|
||||
if (!function_exists('mb_decode_mimeheader')) {
|
||||
function mb_decode_mimeheader(?string $string): string { return p\Mbstring::mb_decode_mimeheader((string) $string); }
|
||||
}
|
||||
if (!function_exists('mb_encode_mimeheader')) {
|
||||
function mb_encode_mimeheader(?string $string, ?string $charset = null, ?string $transfer_encoding = null, ?string $newline = "\r\n", ?int $indent = 0): string { return p\Mbstring::mb_encode_mimeheader((string) $string, $charset, $transfer_encoding, (string) $newline, (int) $indent); }
|
||||
}
|
||||
if (!function_exists('mb_decode_numericentity')) {
|
||||
function mb_decode_numericentity(?string $string, array $map, ?string $encoding = null): string { return p\Mbstring::mb_decode_numericentity((string) $string, $map, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_encode_numericentity')) {
|
||||
function mb_encode_numericentity(?string $string, array $map, ?string $encoding = null, ?bool $hex = false): string { return p\Mbstring::mb_encode_numericentity((string) $string, $map, $encoding, (bool) $hex); }
|
||||
}
|
||||
if (!function_exists('mb_convert_case')) {
|
||||
function mb_convert_case(?string $string, ?int $mode, ?string $encoding = null): string { return p\Mbstring::mb_convert_case((string) $string, (int) $mode, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_internal_encoding')) {
|
||||
function mb_internal_encoding(?string $encoding = null): string|bool { return p\Mbstring::mb_internal_encoding($encoding); }
|
||||
}
|
||||
if (!function_exists('mb_language')) {
|
||||
function mb_language(?string $language = null): string|bool { return p\Mbstring::mb_language($language); }
|
||||
}
|
||||
if (!function_exists('mb_list_encodings')) {
|
||||
function mb_list_encodings(): array { return p\Mbstring::mb_list_encodings(); }
|
||||
}
|
||||
if (!function_exists('mb_encoding_aliases')) {
|
||||
function mb_encoding_aliases(?string $encoding): array { return p\Mbstring::mb_encoding_aliases((string) $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_check_encoding')) {
|
||||
function mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_detect_encoding')) {
|
||||
function mb_detect_encoding(?string $string, array|string|null $encodings = null, ?bool $strict = false): string|false { return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); }
|
||||
}
|
||||
if (!function_exists('mb_detect_order')) {
|
||||
function mb_detect_order(array|string|null $encoding = null): array|bool { return p\Mbstring::mb_detect_order($encoding); }
|
||||
}
|
||||
if (!function_exists('mb_parse_str')) {
|
||||
function mb_parse_str(?string $string, &$result = []): bool { parse_str((string) $string, $result); return (bool) $result; }
|
||||
}
|
||||
if (!function_exists('mb_strlen')) {
|
||||
function mb_strlen(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strlen((string) $string, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strpos')) {
|
||||
function mb_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strtolower')) {
|
||||
function mb_strtolower(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtolower((string) $string, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strtoupper')) {
|
||||
function mb_strtoupper(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtoupper((string) $string, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_substitute_character')) {
|
||||
function mb_substitute_character(string|int|null $substitute_character = null): string|int|bool { return p\Mbstring::mb_substitute_character($substitute_character); }
|
||||
}
|
||||
if (!function_exists('mb_substr')) {
|
||||
function mb_substr(?string $string, ?int $start, ?int $length = null, ?string $encoding = null): string { return p\Mbstring::mb_substr((string) $string, (int) $start, $length, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_stripos')) {
|
||||
function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_stristr')) {
|
||||
function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strrchr')) {
|
||||
function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strrichr')) {
|
||||
function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strripos')) {
|
||||
function mb_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strrpos')) {
|
||||
function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strstr')) {
|
||||
function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_get_info')) {
|
||||
function mb_get_info(?string $type = 'all'): array|string|int|false|null { return p\Mbstring::mb_get_info((string) $type); }
|
||||
}
|
||||
if (!function_exists('mb_http_output')) {
|
||||
function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); }
|
||||
}
|
||||
if (!function_exists('mb_strwidth')) {
|
||||
function mb_strwidth(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strwidth((string) $string, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_substr_count')) {
|
||||
function mb_substr_count(?string $haystack, ?string $needle, ?string $encoding = null): int { return p\Mbstring::mb_substr_count((string) $haystack, (string) $needle, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_output_handler')) {
|
||||
function mb_output_handler(?string $string, ?int $status): string { return p\Mbstring::mb_output_handler((string) $string, (int) $status); }
|
||||
}
|
||||
if (!function_exists('mb_http_input')) {
|
||||
function mb_http_input(?string $type = null): array|string|false { return p\Mbstring::mb_http_input($type); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_convert_variables')) {
|
||||
function mb_convert_variables(?string $to_encoding, array|string|null $from_encoding, mixed &$var, mixed &...$vars): string|false { return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_ord')) {
|
||||
function mb_ord(?string $string, ?string $encoding = null): int|false { return p\Mbstring::mb_ord((string) $string, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_chr')) {
|
||||
function mb_chr(?int $codepoint, ?string $encoding = null): string|false { return p\Mbstring::mb_chr((int) $codepoint, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_scrub')) {
|
||||
function mb_scrub(?string $string, ?string $encoding = null): string { $encoding ??= mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); }
|
||||
}
|
||||
if (!function_exists('mb_str_split')) {
|
||||
function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = null): array { return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_str_pad')) {
|
||||
function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_ucfirst')) {
|
||||
function mb_ucfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_ucfirst($string, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_lcfirst')) {
|
||||
function mb_lcfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_lcfirst($string, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_trim')) {
|
||||
function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_trim($string, $characters, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_ltrim')) {
|
||||
function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_ltrim($string, $characters, $encoding); }
|
||||
}
|
||||
|
||||
if (!function_exists('mb_rtrim')) {
|
||||
function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_rtrim($string, $characters, $encoding); }
|
||||
}
|
||||
|
||||
if (extension_loaded('mbstring')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!defined('MB_CASE_UPPER')) {
|
||||
define('MB_CASE_UPPER', 0);
|
||||
}
|
||||
if (!defined('MB_CASE_LOWER')) {
|
||||
define('MB_CASE_LOWER', 1);
|
||||
}
|
||||
if (!defined('MB_CASE_TITLE')) {
|
||||
define('MB_CASE_TITLE', 2);
|
||||
}
|
||||
39
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/composer.json
vendored
Executable file
39
vendor/claudecio/axiumphp/vendor/symfony/polyfill-mbstring/composer.json
vendored
Executable file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"type": "library",
|
||||
"description": "Symfony polyfill for the Mbstring extension",
|
||||
"keywords": ["polyfill", "shim", "compatibility", "portable", "mbstring"],
|
||||
"homepage": "https://symfony.com",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.2",
|
||||
"ext-iconv": "*"
|
||||
},
|
||||
"provide": {
|
||||
"ext-mbstring": "*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Symfony\\Polyfill\\Mbstring\\": "" },
|
||||
"files": [ "bootstrap.php" ]
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mbstring": "For best performance"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
}
|
||||
}
|
||||
19
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/LICENSE
vendored
Executable file
19
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/LICENSE
vendored
Executable file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2020-present Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
115
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/Php80.php
vendored
Executable file
115
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/Php80.php
vendored
Executable file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Polyfill\Php80;
|
||||
|
||||
/**
|
||||
* @author Ion Bazan <ion.bazan@gmail.com>
|
||||
* @author Nico Oelgart <nicoswd@gmail.com>
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
final class Php80
|
||||
{
|
||||
public static function fdiv(float $dividend, float $divisor): float
|
||||
{
|
||||
return @($dividend / $divisor);
|
||||
}
|
||||
|
||||
public static function get_debug_type($value): string
|
||||
{
|
||||
switch (true) {
|
||||
case null === $value: return 'null';
|
||||
case \is_bool($value): return 'bool';
|
||||
case \is_string($value): return 'string';
|
||||
case \is_array($value): return 'array';
|
||||
case \is_int($value): return 'int';
|
||||
case \is_float($value): return 'float';
|
||||
case \is_object($value): break;
|
||||
case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
|
||||
default:
|
||||
if (null === $type = @get_resource_type($value)) {
|
||||
return 'unknown';
|
||||
}
|
||||
|
||||
if ('Unknown' === $type) {
|
||||
$type = 'closed';
|
||||
}
|
||||
|
||||
return "resource ($type)";
|
||||
}
|
||||
|
||||
$class = \get_class($value);
|
||||
|
||||
if (false === strpos($class, '@')) {
|
||||
return $class;
|
||||
}
|
||||
|
||||
return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous';
|
||||
}
|
||||
|
||||
public static function get_resource_id($res): int
|
||||
{
|
||||
if (!\is_resource($res) && null === @get_resource_type($res)) {
|
||||
throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res)));
|
||||
}
|
||||
|
||||
return (int) $res;
|
||||
}
|
||||
|
||||
public static function preg_last_error_msg(): string
|
||||
{
|
||||
switch (preg_last_error()) {
|
||||
case \PREG_INTERNAL_ERROR:
|
||||
return 'Internal error';
|
||||
case \PREG_BAD_UTF8_ERROR:
|
||||
return 'Malformed UTF-8 characters, possibly incorrectly encoded';
|
||||
case \PREG_BAD_UTF8_OFFSET_ERROR:
|
||||
return 'The offset did not correspond to the beginning of a valid UTF-8 code point';
|
||||
case \PREG_BACKTRACK_LIMIT_ERROR:
|
||||
return 'Backtrack limit exhausted';
|
||||
case \PREG_RECURSION_LIMIT_ERROR:
|
||||
return 'Recursion limit exhausted';
|
||||
case \PREG_JIT_STACKLIMIT_ERROR:
|
||||
return 'JIT stack limit exhausted';
|
||||
case \PREG_NO_ERROR:
|
||||
return 'No error';
|
||||
default:
|
||||
return 'Unknown error';
|
||||
}
|
||||
}
|
||||
|
||||
public static function str_contains(string $haystack, string $needle): bool
|
||||
{
|
||||
return '' === $needle || false !== strpos($haystack, $needle);
|
||||
}
|
||||
|
||||
public static function str_starts_with(string $haystack, string $needle): bool
|
||||
{
|
||||
return 0 === strncmp($haystack, $needle, \strlen($needle));
|
||||
}
|
||||
|
||||
public static function str_ends_with(string $haystack, string $needle): bool
|
||||
{
|
||||
if ('' === $needle || $needle === $haystack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ('' === $haystack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$needleLength = \strlen($needle);
|
||||
|
||||
return $needleLength <= \strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength);
|
||||
}
|
||||
}
|
||||
106
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/PhpToken.php
vendored
Executable file
106
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/PhpToken.php
vendored
Executable file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Polyfill\Php80;
|
||||
|
||||
/**
|
||||
* @author Fedonyuk Anton <info@ensostudio.ru>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class PhpToken implements \Stringable
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $text;
|
||||
|
||||
/**
|
||||
* @var -1|positive-int
|
||||
*/
|
||||
public $line;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $pos;
|
||||
|
||||
/**
|
||||
* @param -1|positive-int $line
|
||||
*/
|
||||
public function __construct(int $id, string $text, int $line = -1, int $position = -1)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->text = $text;
|
||||
$this->line = $line;
|
||||
$this->pos = $position;
|
||||
}
|
||||
|
||||
public function getTokenName(): ?string
|
||||
{
|
||||
if ('UNKNOWN' === $name = token_name($this->id)) {
|
||||
$name = \strlen($this->text) > 1 || \ord($this->text) < 32 ? null : $this->text;
|
||||
}
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|string|array $kind
|
||||
*/
|
||||
public function is($kind): bool
|
||||
{
|
||||
foreach ((array) $kind as $value) {
|
||||
if (\in_array($value, [$this->id, $this->text], true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isIgnorable(): bool
|
||||
{
|
||||
return \in_array($this->id, [\T_WHITESPACE, \T_COMMENT, \T_DOC_COMMENT, \T_OPEN_TAG], true);
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return (string) $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<static>
|
||||
*/
|
||||
public static function tokenize(string $code, int $flags = 0): array
|
||||
{
|
||||
$line = 1;
|
||||
$position = 0;
|
||||
$tokens = token_get_all($code, $flags);
|
||||
foreach ($tokens as $index => $token) {
|
||||
if (\is_string($token)) {
|
||||
$id = \ord($token);
|
||||
$text = $token;
|
||||
} else {
|
||||
[$id, $text, $line] = $token;
|
||||
}
|
||||
$tokens[$index] = new static($id, $text, $line, $position);
|
||||
$position += \strlen($text);
|
||||
}
|
||||
|
||||
return $tokens;
|
||||
}
|
||||
}
|
||||
25
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/README.md
vendored
Executable file
25
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/README.md
vendored
Executable file
@@ -0,0 +1,25 @@
|
||||
Symfony Polyfill / Php80
|
||||
========================
|
||||
|
||||
This component provides features added to PHP 8.0 core:
|
||||
|
||||
- [`Stringable`](https://php.net/stringable) interface
|
||||
- [`fdiv`](https://php.net/fdiv)
|
||||
- [`ValueError`](https://php.net/valueerror) class
|
||||
- [`UnhandledMatchError`](https://php.net/unhandledmatcherror) class
|
||||
- `FILTER_VALIDATE_BOOL` constant
|
||||
- [`get_debug_type`](https://php.net/get_debug_type)
|
||||
- [`PhpToken`](https://php.net/phptoken) class
|
||||
- [`preg_last_error_msg`](https://php.net/preg_last_error_msg)
|
||||
- [`str_contains`](https://php.net/str_contains)
|
||||
- [`str_starts_with`](https://php.net/str_starts_with)
|
||||
- [`str_ends_with`](https://php.net/str_ends_with)
|
||||
- [`get_resource_id`](https://php.net/get_resource_id)
|
||||
|
||||
More information can be found in the
|
||||
[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md).
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
This library is released under the [MIT license](LICENSE).
|
||||
31
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php
vendored
Executable file
31
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php
vendored
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class Attribute
|
||||
{
|
||||
public const TARGET_CLASS = 1;
|
||||
public const TARGET_FUNCTION = 2;
|
||||
public const TARGET_METHOD = 4;
|
||||
public const TARGET_PROPERTY = 8;
|
||||
public const TARGET_CLASS_CONSTANT = 16;
|
||||
public const TARGET_PARAMETER = 32;
|
||||
public const TARGET_ALL = 63;
|
||||
public const IS_REPEATABLE = 64;
|
||||
|
||||
/** @var int */
|
||||
public $flags;
|
||||
|
||||
public function __construct(int $flags = self::TARGET_ALL)
|
||||
{
|
||||
$this->flags = $flags;
|
||||
}
|
||||
}
|
||||
16
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php
vendored
Executable file
16
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
if (\PHP_VERSION_ID < 80000 && extension_loaded('tokenizer')) {
|
||||
class PhpToken extends Symfony\Polyfill\Php80\PhpToken
|
||||
{
|
||||
}
|
||||
}
|
||||
20
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php
vendored
Executable file
20
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php
vendored
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
if (\PHP_VERSION_ID < 80000) {
|
||||
interface Stringable
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString();
|
||||
}
|
||||
}
|
||||
16
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php
vendored
Executable file
16
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
if (\PHP_VERSION_ID < 80000) {
|
||||
class UnhandledMatchError extends Error
|
||||
{
|
||||
}
|
||||
}
|
||||
16
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php
vendored
Executable file
16
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
if (\PHP_VERSION_ID < 80000) {
|
||||
class ValueError extends Error
|
||||
{
|
||||
}
|
||||
}
|
||||
42
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/bootstrap.php
vendored
Executable file
42
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/bootstrap.php
vendored
Executable file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Symfony\Polyfill\Php80 as p;
|
||||
|
||||
if (\PHP_VERSION_ID >= 80000) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!defined('FILTER_VALIDATE_BOOL') && defined('FILTER_VALIDATE_BOOLEAN')) {
|
||||
define('FILTER_VALIDATE_BOOL', \FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
if (!function_exists('fdiv')) {
|
||||
function fdiv(float $num1, float $num2): float { return p\Php80::fdiv($num1, $num2); }
|
||||
}
|
||||
if (!function_exists('preg_last_error_msg')) {
|
||||
function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); }
|
||||
}
|
||||
if (!function_exists('str_contains')) {
|
||||
function str_contains(?string $haystack, ?string $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); }
|
||||
}
|
||||
if (!function_exists('str_starts_with')) {
|
||||
function str_starts_with(?string $haystack, ?string $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); }
|
||||
}
|
||||
if (!function_exists('str_ends_with')) {
|
||||
function str_ends_with(?string $haystack, ?string $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); }
|
||||
}
|
||||
if (!function_exists('get_debug_type')) {
|
||||
function get_debug_type($value): string { return p\Php80::get_debug_type($value); }
|
||||
}
|
||||
if (!function_exists('get_resource_id')) {
|
||||
function get_resource_id($resource): int { return p\Php80::get_resource_id($resource); }
|
||||
}
|
||||
37
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/composer.json
vendored
Executable file
37
vendor/claudecio/axiumphp/vendor/symfony/polyfill-php80/composer.json
vendored
Executable file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "symfony/polyfill-php80",
|
||||
"type": "library",
|
||||
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
|
||||
"keywords": ["polyfill", "shim", "compatibility", "portable"],
|
||||
"homepage": "https://symfony.com",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ion Bazan",
|
||||
"email": "ion.bazan@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Symfony\\Polyfill\\Php80\\": "" },
|
||||
"files": [ "bootstrap.php" ],
|
||||
"classmap": [ "Resources/stubs" ]
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
}
|
||||
}
|
||||
30
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/LICENSE
vendored
Executable file
30
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/LICENSE
vendored
Executable file
@@ -0,0 +1,30 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2014, Graham Campbell.
|
||||
Copyright (c) 2013, Vance Lucas.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
60
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/composer.json
vendored
Executable file
60
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/composer.json
vendored
Executable file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "vlucas/phpdotenv",
|
||||
"description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
|
||||
"keywords": ["env", "dotenv", "environment"],
|
||||
"license": "BSD-3-Clause",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Graham Campbell",
|
||||
"email": "hello@gjcampbell.co.uk",
|
||||
"homepage": "https://github.com/GrahamCampbell"
|
||||
},
|
||||
{
|
||||
"name": "Vance Lucas",
|
||||
"email": "vance@vancelucas.com",
|
||||
"homepage": "https://github.com/vlucas"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"ext-pcre": "*",
|
||||
"graham-campbell/result-type": "^1.1.3",
|
||||
"phpoption/phpoption": "^1.9.3",
|
||||
"symfony/polyfill-ctype": "^1.24",
|
||||
"symfony/polyfill-mbstring": "^1.24",
|
||||
"symfony/polyfill-php80": "^1.24"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-filter": "*",
|
||||
"bamarni/composer-bin-plugin": "^1.8.2",
|
||||
"phpunit/phpunit":"^8.5.34 || ^9.6.13 || ^10.4.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Dotenv\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Dotenv\\Tests\\": "tests/Dotenv/"
|
||||
}
|
||||
},
|
||||
"suggest": {
|
||||
"ext-filter": "Required to use the boolean validator."
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"bamarni/composer-bin-plugin": true
|
||||
},
|
||||
"preferred-install": "dist"
|
||||
},
|
||||
"extra": {
|
||||
"bamarni-bin": {
|
||||
"bin-links": true,
|
||||
"forward-command": false
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-master": "5.6-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
267
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Dotenv.php
vendored
Executable file
267
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Dotenv.php
vendored
Executable file
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv;
|
||||
|
||||
use Dotenv\Exception\InvalidPathException;
|
||||
use Dotenv\Loader\Loader;
|
||||
use Dotenv\Loader\LoaderInterface;
|
||||
use Dotenv\Parser\Parser;
|
||||
use Dotenv\Parser\ParserInterface;
|
||||
use Dotenv\Repository\Adapter\ArrayAdapter;
|
||||
use Dotenv\Repository\Adapter\PutenvAdapter;
|
||||
use Dotenv\Repository\RepositoryBuilder;
|
||||
use Dotenv\Repository\RepositoryInterface;
|
||||
use Dotenv\Store\StoreBuilder;
|
||||
use Dotenv\Store\StoreInterface;
|
||||
use Dotenv\Store\StringStore;
|
||||
|
||||
class Dotenv
|
||||
{
|
||||
/**
|
||||
* The store instance.
|
||||
*
|
||||
* @var \Dotenv\Store\StoreInterface
|
||||
*/
|
||||
private $store;
|
||||
|
||||
/**
|
||||
* The parser instance.
|
||||
*
|
||||
* @var \Dotenv\Parser\ParserInterface
|
||||
*/
|
||||
private $parser;
|
||||
|
||||
/**
|
||||
* The loader instance.
|
||||
*
|
||||
* @var \Dotenv\Loader\LoaderInterface
|
||||
*/
|
||||
private $loader;
|
||||
|
||||
/**
|
||||
* The repository instance.
|
||||
*
|
||||
* @var \Dotenv\Repository\RepositoryInterface
|
||||
*/
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* Create a new dotenv instance.
|
||||
*
|
||||
* @param \Dotenv\Store\StoreInterface $store
|
||||
* @param \Dotenv\Parser\ParserInterface $parser
|
||||
* @param \Dotenv\Loader\LoaderInterface $loader
|
||||
* @param \Dotenv\Repository\RepositoryInterface $repository
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
StoreInterface $store,
|
||||
ParserInterface $parser,
|
||||
LoaderInterface $loader,
|
||||
RepositoryInterface $repository
|
||||
) {
|
||||
$this->store = $store;
|
||||
$this->parser = $parser;
|
||||
$this->loader = $loader;
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new dotenv instance.
|
||||
*
|
||||
* @param \Dotenv\Repository\RepositoryInterface $repository
|
||||
* @param string|string[] $paths
|
||||
* @param string|string[]|null $names
|
||||
* @param bool $shortCircuit
|
||||
* @param string|null $fileEncoding
|
||||
*
|
||||
* @return \Dotenv\Dotenv
|
||||
*/
|
||||
public static function create(RepositoryInterface $repository, $paths, $names = null, bool $shortCircuit = true, ?string $fileEncoding = null)
|
||||
{
|
||||
$builder = $names === null ? StoreBuilder::createWithDefaultName() : StoreBuilder::createWithNoNames();
|
||||
|
||||
foreach ((array) $paths as $path) {
|
||||
$builder = $builder->addPath($path);
|
||||
}
|
||||
|
||||
foreach ((array) $names as $name) {
|
||||
$builder = $builder->addName($name);
|
||||
}
|
||||
|
||||
if ($shortCircuit) {
|
||||
$builder = $builder->shortCircuit();
|
||||
}
|
||||
|
||||
return new self($builder->fileEncoding($fileEncoding)->make(), new Parser(), new Loader(), $repository);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new mutable dotenv instance with default repository.
|
||||
*
|
||||
* @param string|string[] $paths
|
||||
* @param string|string[]|null $names
|
||||
* @param bool $shortCircuit
|
||||
* @param string|null $fileEncoding
|
||||
*
|
||||
* @return \Dotenv\Dotenv
|
||||
*/
|
||||
public static function createMutable($paths, $names = null, bool $shortCircuit = true, ?string $fileEncoding = null)
|
||||
{
|
||||
$repository = RepositoryBuilder::createWithDefaultAdapters()->make();
|
||||
|
||||
return self::create($repository, $paths, $names, $shortCircuit, $fileEncoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new mutable dotenv instance with default repository with the putenv adapter.
|
||||
*
|
||||
* @param string|string[] $paths
|
||||
* @param string|string[]|null $names
|
||||
* @param bool $shortCircuit
|
||||
* @param string|null $fileEncoding
|
||||
*
|
||||
* @return \Dotenv\Dotenv
|
||||
*/
|
||||
public static function createUnsafeMutable($paths, $names = null, bool $shortCircuit = true, ?string $fileEncoding = null)
|
||||
{
|
||||
$repository = RepositoryBuilder::createWithDefaultAdapters()
|
||||
->addAdapter(PutenvAdapter::class)
|
||||
->make();
|
||||
|
||||
return self::create($repository, $paths, $names, $shortCircuit, $fileEncoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new immutable dotenv instance with default repository.
|
||||
*
|
||||
* @param string|string[] $paths
|
||||
* @param string|string[]|null $names
|
||||
* @param bool $shortCircuit
|
||||
* @param string|null $fileEncoding
|
||||
*
|
||||
* @return \Dotenv\Dotenv
|
||||
*/
|
||||
public static function createImmutable($paths, $names = null, bool $shortCircuit = true, ?string $fileEncoding = null)
|
||||
{
|
||||
$repository = RepositoryBuilder::createWithDefaultAdapters()->immutable()->make();
|
||||
|
||||
return self::create($repository, $paths, $names, $shortCircuit, $fileEncoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new immutable dotenv instance with default repository with the putenv adapter.
|
||||
*
|
||||
* @param string|string[] $paths
|
||||
* @param string|string[]|null $names
|
||||
* @param bool $shortCircuit
|
||||
* @param string|null $fileEncoding
|
||||
*
|
||||
* @return \Dotenv\Dotenv
|
||||
*/
|
||||
public static function createUnsafeImmutable($paths, $names = null, bool $shortCircuit = true, ?string $fileEncoding = null)
|
||||
{
|
||||
$repository = RepositoryBuilder::createWithDefaultAdapters()
|
||||
->addAdapter(PutenvAdapter::class)
|
||||
->immutable()
|
||||
->make();
|
||||
|
||||
return self::create($repository, $paths, $names, $shortCircuit, $fileEncoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new dotenv instance with an array backed repository.
|
||||
*
|
||||
* @param string|string[] $paths
|
||||
* @param string|string[]|null $names
|
||||
* @param bool $shortCircuit
|
||||
* @param string|null $fileEncoding
|
||||
*
|
||||
* @return \Dotenv\Dotenv
|
||||
*/
|
||||
public static function createArrayBacked($paths, $names = null, bool $shortCircuit = true, ?string $fileEncoding = null)
|
||||
{
|
||||
$repository = RepositoryBuilder::createWithNoAdapters()->addAdapter(ArrayAdapter::class)->make();
|
||||
|
||||
return self::create($repository, $paths, $names, $shortCircuit, $fileEncoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given content and resolve nested variables.
|
||||
*
|
||||
* This method behaves just like load(), only without mutating your actual
|
||||
* environment. We do this by using an array backed repository.
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @throws \Dotenv\Exception\InvalidFileException
|
||||
*
|
||||
* @return array<string, string|null>
|
||||
*/
|
||||
public static function parse(string $content)
|
||||
{
|
||||
$repository = RepositoryBuilder::createWithNoAdapters()->addAdapter(ArrayAdapter::class)->make();
|
||||
|
||||
$phpdotenv = new self(new StringStore($content), new Parser(), new Loader(), $repository);
|
||||
|
||||
return $phpdotenv->load();
|
||||
}
|
||||
|
||||
/**
|
||||
* Read and load environment file(s).
|
||||
*
|
||||
* @throws \Dotenv\Exception\InvalidPathException|\Dotenv\Exception\InvalidEncodingException|\Dotenv\Exception\InvalidFileException
|
||||
*
|
||||
* @return array<string, string|null>
|
||||
*/
|
||||
public function load()
|
||||
{
|
||||
$entries = $this->parser->parse($this->store->read());
|
||||
|
||||
return $this->loader->load($this->repository, $entries);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read and load environment file(s), silently failing if no files can be read.
|
||||
*
|
||||
* @throws \Dotenv\Exception\InvalidEncodingException|\Dotenv\Exception\InvalidFileException
|
||||
*
|
||||
* @return array<string, string|null>
|
||||
*/
|
||||
public function safeLoad()
|
||||
{
|
||||
try {
|
||||
return $this->load();
|
||||
} catch (InvalidPathException $e) {
|
||||
// suppressing exception
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Required ensures that the specified variables exist, and returns a new validator object.
|
||||
*
|
||||
* @param string|string[] $variables
|
||||
*
|
||||
* @return \Dotenv\Validator
|
||||
*/
|
||||
public function required($variables)
|
||||
{
|
||||
return (new Validator($this->repository, (array) $variables))->required();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new validator object that won't check if the specified variables exist.
|
||||
*
|
||||
* @param string|string[] $variables
|
||||
*
|
||||
* @return \Dotenv\Validator
|
||||
*/
|
||||
public function ifPresent($variables)
|
||||
{
|
||||
return new Validator($this->repository, (array) $variables);
|
||||
}
|
||||
}
|
||||
12
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Exception/ExceptionInterface.php
vendored
Executable file
12
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Exception/ExceptionInterface.php
vendored
Executable file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Exception;
|
||||
|
||||
use Throwable;
|
||||
|
||||
interface ExceptionInterface extends Throwable
|
||||
{
|
||||
//
|
||||
}
|
||||
12
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Exception/InvalidEncodingException.php
vendored
Executable file
12
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Exception/InvalidEncodingException.php
vendored
Executable file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Exception;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
final class InvalidEncodingException extends InvalidArgumentException implements ExceptionInterface
|
||||
{
|
||||
//
|
||||
}
|
||||
12
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Exception/InvalidFileException.php
vendored
Executable file
12
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Exception/InvalidFileException.php
vendored
Executable file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Exception;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
final class InvalidFileException extends InvalidArgumentException implements ExceptionInterface
|
||||
{
|
||||
//
|
||||
}
|
||||
12
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Exception/InvalidPathException.php
vendored
Executable file
12
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Exception/InvalidPathException.php
vendored
Executable file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Exception;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
final class InvalidPathException extends InvalidArgumentException implements ExceptionInterface
|
||||
{
|
||||
//
|
||||
}
|
||||
12
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Exception/ValidationException.php
vendored
Executable file
12
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Exception/ValidationException.php
vendored
Executable file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
final class ValidationException extends RuntimeException implements ExceptionInterface
|
||||
{
|
||||
//
|
||||
}
|
||||
48
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Loader/Loader.php
vendored
Executable file
48
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Loader/Loader.php
vendored
Executable file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Loader;
|
||||
|
||||
use Dotenv\Parser\Entry;
|
||||
use Dotenv\Parser\Value;
|
||||
use Dotenv\Repository\RepositoryInterface;
|
||||
|
||||
final class Loader implements LoaderInterface
|
||||
{
|
||||
/**
|
||||
* Load the given entries into the repository.
|
||||
*
|
||||
* We'll substitute any nested variables, and send each variable to the
|
||||
* repository, with the effect of actually mutating the environment.
|
||||
*
|
||||
* @param \Dotenv\Repository\RepositoryInterface $repository
|
||||
* @param \Dotenv\Parser\Entry[] $entries
|
||||
*
|
||||
* @return array<string, string|null>
|
||||
*/
|
||||
public function load(RepositoryInterface $repository, array $entries)
|
||||
{
|
||||
/** @var array<string, string|null> */
|
||||
return \array_reduce($entries, static function (array $vars, Entry $entry) use ($repository) {
|
||||
$name = $entry->getName();
|
||||
|
||||
$value = $entry->getValue()->map(static function (Value $value) use ($repository) {
|
||||
return Resolver::resolve($repository, $value);
|
||||
});
|
||||
|
||||
if ($value->isDefined()) {
|
||||
$inner = $value->get();
|
||||
if ($repository->set($name, $inner)) {
|
||||
return \array_merge($vars, [$name => $inner]);
|
||||
}
|
||||
} else {
|
||||
if ($repository->clear($name)) {
|
||||
return \array_merge($vars, [$name => null]);
|
||||
}
|
||||
}
|
||||
|
||||
return $vars;
|
||||
}, []);
|
||||
}
|
||||
}
|
||||
20
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Loader/LoaderInterface.php
vendored
Executable file
20
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Loader/LoaderInterface.php
vendored
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Loader;
|
||||
|
||||
use Dotenv\Repository\RepositoryInterface;
|
||||
|
||||
interface LoaderInterface
|
||||
{
|
||||
/**
|
||||
* Load the given entries into the repository.
|
||||
*
|
||||
* @param \Dotenv\Repository\RepositoryInterface $repository
|
||||
* @param \Dotenv\Parser\Entry[] $entries
|
||||
*
|
||||
* @return array<string, string|null>
|
||||
*/
|
||||
public function load(RepositoryInterface $repository, array $entries);
|
||||
}
|
||||
65
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Loader/Resolver.php
vendored
Executable file
65
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Loader/Resolver.php
vendored
Executable file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Loader;
|
||||
|
||||
use Dotenv\Parser\Value;
|
||||
use Dotenv\Repository\RepositoryInterface;
|
||||
use Dotenv\Util\Regex;
|
||||
use Dotenv\Util\Str;
|
||||
use PhpOption\Option;
|
||||
|
||||
final class Resolver
|
||||
{
|
||||
/**
|
||||
* This class is a singleton.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the nested variables in the given value.
|
||||
*
|
||||
* Replaces ${varname} patterns in the allowed positions in the variable
|
||||
* value by an existing environment variable.
|
||||
*
|
||||
* @param \Dotenv\Repository\RepositoryInterface $repository
|
||||
* @param \Dotenv\Parser\Value $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function resolve(RepositoryInterface $repository, Value $value)
|
||||
{
|
||||
return \array_reduce($value->getVars(), static function (string $s, int $i) use ($repository) {
|
||||
return Str::substr($s, 0, $i).self::resolveVariable($repository, Str::substr($s, $i));
|
||||
}, $value->getChars());
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a single nested variable.
|
||||
*
|
||||
* @param \Dotenv\Repository\RepositoryInterface $repository
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function resolveVariable(RepositoryInterface $repository, string $str)
|
||||
{
|
||||
return Regex::replaceCallback(
|
||||
'/\A\${([a-zA-Z0-9_.]+)}/',
|
||||
static function (array $matches) use ($repository) {
|
||||
/** @var string */
|
||||
return Option::fromValue($repository->get($matches[1]))->getOrElse($matches[0]);
|
||||
},
|
||||
$str,
|
||||
1
|
||||
)->success()->getOrElse($str);
|
||||
}
|
||||
}
|
||||
59
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Parser/Entry.php
vendored
Executable file
59
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Parser/Entry.php
vendored
Executable file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Parser;
|
||||
|
||||
use PhpOption\Option;
|
||||
|
||||
final class Entry
|
||||
{
|
||||
/**
|
||||
* The entry name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* The entry value.
|
||||
*
|
||||
* @var \Dotenv\Parser\Value|null
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* Create a new entry instance.
|
||||
*
|
||||
* @param string $name
|
||||
* @param \Dotenv\Parser\Value|null $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(string $name, ?Value $value = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the entry name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the entry value.
|
||||
*
|
||||
* @return \PhpOption\Option<\Dotenv\Parser\Value>
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
/** @var \PhpOption\Option<\Dotenv\Parser\Value> */
|
||||
return Option::fromValue($this->value);
|
||||
}
|
||||
}
|
||||
300
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Parser/EntryParser.php
vendored
Executable file
300
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Parser/EntryParser.php
vendored
Executable file
@@ -0,0 +1,300 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Parser;
|
||||
|
||||
use Dotenv\Util\Regex;
|
||||
use Dotenv\Util\Str;
|
||||
use GrahamCampbell\ResultType\Error;
|
||||
use GrahamCampbell\ResultType\Result;
|
||||
use GrahamCampbell\ResultType\Success;
|
||||
|
||||
final class EntryParser
|
||||
{
|
||||
private const INITIAL_STATE = 0;
|
||||
private const UNQUOTED_STATE = 1;
|
||||
private const SINGLE_QUOTED_STATE = 2;
|
||||
private const DOUBLE_QUOTED_STATE = 3;
|
||||
private const ESCAPE_SEQUENCE_STATE = 4;
|
||||
private const WHITESPACE_STATE = 5;
|
||||
private const COMMENT_STATE = 6;
|
||||
private const REJECT_STATES = [self::SINGLE_QUOTED_STATE, self::DOUBLE_QUOTED_STATE, self::ESCAPE_SEQUENCE_STATE];
|
||||
|
||||
/**
|
||||
* This class is a singleton.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a raw entry into a proper entry.
|
||||
*
|
||||
* That is, turn a raw environment variable entry into a name and possibly
|
||||
* a value. We wrap the answer in a result type.
|
||||
*
|
||||
* @param string $entry
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Entry, string>
|
||||
*/
|
||||
public static function parse(string $entry)
|
||||
{
|
||||
return self::splitStringIntoParts($entry)->flatMap(static function (array $parts) {
|
||||
[$name, $value] = $parts;
|
||||
|
||||
return self::parseName($name)->flatMap(static function (string $name) use ($value) {
|
||||
/** @var Result<Value|null, string> */
|
||||
$parsedValue = $value === null ? Success::create(null) : self::parseValue($value);
|
||||
|
||||
return $parsedValue->map(static function (?Value $value) use ($name) {
|
||||
return new Entry($name, $value);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Split the compound string into parts.
|
||||
*
|
||||
* @param string $line
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<array{string, string|null},string>
|
||||
*/
|
||||
private static function splitStringIntoParts(string $line)
|
||||
{
|
||||
/** @var array{string, string|null} */
|
||||
$result = Str::pos($line, '=')->map(static function () use ($line) {
|
||||
return \array_map('trim', \explode('=', $line, 2));
|
||||
})->getOrElse([$line, null]);
|
||||
|
||||
if ($result[0] === '') {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, string|null},string> */
|
||||
return Error::create(self::getErrorMessage('an unexpected equals', $line));
|
||||
}
|
||||
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, string|null},string> */
|
||||
return Success::create($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given variable name.
|
||||
*
|
||||
* That is, strip the optional quotes and leading "export" from the
|
||||
* variable name. We wrap the answer in a result type.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<string, string>
|
||||
*/
|
||||
private static function parseName(string $name)
|
||||
{
|
||||
if (Str::len($name) > 8 && Str::substr($name, 0, 6) === 'export' && \ctype_space(Str::substr($name, 6, 1))) {
|
||||
$name = \ltrim(Str::substr($name, 6));
|
||||
}
|
||||
|
||||
if (self::isQuotedName($name)) {
|
||||
$name = Str::substr($name, 1, -1);
|
||||
}
|
||||
|
||||
if (!self::isValidName($name)) {
|
||||
/** @var \GrahamCampbell\ResultType\Result<string, string> */
|
||||
return Error::create(self::getErrorMessage('an invalid name', $name));
|
||||
}
|
||||
|
||||
/** @var \GrahamCampbell\ResultType\Result<string, string> */
|
||||
return Success::create($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the given variable name quoted?
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function isQuotedName(string $name)
|
||||
{
|
||||
if (Str::len($name) < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$first = Str::substr($name, 0, 1);
|
||||
$last = Str::substr($name, -1, 1);
|
||||
|
||||
return ($first === '"' && $last === '"') || ($first === '\'' && $last === '\'');
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the given variable name valid?
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function isValidName(string $name)
|
||||
{
|
||||
return Regex::matches('~(*UTF8)\A[\p{Ll}\p{Lu}\p{M}\p{N}_.]+\z~', $name)->success()->getOrElse(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given variable value.
|
||||
*
|
||||
* This has the effect of stripping quotes and comments, dealing with
|
||||
* special characters, and locating nested variables, but not resolving
|
||||
* them. Formally, we run a finite state automaton with an output tape: a
|
||||
* transducer. We wrap the answer in a result type.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value, string>
|
||||
*/
|
||||
private static function parseValue(string $value)
|
||||
{
|
||||
if (\trim($value) === '') {
|
||||
/** @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value, string> */
|
||||
return Success::create(Value::blank());
|
||||
}
|
||||
|
||||
return \array_reduce(\iterator_to_array(Lexer::lex($value)), static function (Result $data, string $token) {
|
||||
return $data->flatMap(static function (array $data) use ($token) {
|
||||
return self::processToken($data[1], $token)->map(static function (array $val) use ($data) {
|
||||
return [$data[0]->append($val[0], $val[1]), $val[2]];
|
||||
});
|
||||
});
|
||||
}, Success::create([Value::blank(), self::INITIAL_STATE]))->flatMap(static function (array $result) {
|
||||
/** @psalm-suppress DocblockTypeContradiction */
|
||||
if (in_array($result[1], self::REJECT_STATES, true)) {
|
||||
/** @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value, string> */
|
||||
return Error::create('a missing closing quote');
|
||||
}
|
||||
|
||||
/** @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value, string> */
|
||||
return Success::create($result[0]);
|
||||
})->mapError(static function (string $err) use ($value) {
|
||||
return self::getErrorMessage($err, $value);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the given token.
|
||||
*
|
||||
* @param int $state
|
||||
* @param string $token
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<array{string, bool, int}, string>
|
||||
*/
|
||||
private static function processToken(int $state, string $token)
|
||||
{
|
||||
switch ($state) {
|
||||
case self::INITIAL_STATE:
|
||||
if ($token === '\'') {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create(['', false, self::SINGLE_QUOTED_STATE]);
|
||||
} elseif ($token === '"') {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create(['', false, self::DOUBLE_QUOTED_STATE]);
|
||||
} elseif ($token === '#') {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create(['', false, self::COMMENT_STATE]);
|
||||
} elseif ($token === '$') {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create([$token, true, self::UNQUOTED_STATE]);
|
||||
} else {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create([$token, false, self::UNQUOTED_STATE]);
|
||||
}
|
||||
case self::UNQUOTED_STATE:
|
||||
if ($token === '#') {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create(['', false, self::COMMENT_STATE]);
|
||||
} elseif (\ctype_space($token)) {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create(['', false, self::WHITESPACE_STATE]);
|
||||
} elseif ($token === '$') {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create([$token, true, self::UNQUOTED_STATE]);
|
||||
} else {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create([$token, false, self::UNQUOTED_STATE]);
|
||||
}
|
||||
case self::SINGLE_QUOTED_STATE:
|
||||
if ($token === '\'') {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create(['', false, self::WHITESPACE_STATE]);
|
||||
} else {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create([$token, false, self::SINGLE_QUOTED_STATE]);
|
||||
}
|
||||
case self::DOUBLE_QUOTED_STATE:
|
||||
if ($token === '"') {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create(['', false, self::WHITESPACE_STATE]);
|
||||
} elseif ($token === '\\') {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create(['', false, self::ESCAPE_SEQUENCE_STATE]);
|
||||
} elseif ($token === '$') {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create([$token, true, self::DOUBLE_QUOTED_STATE]);
|
||||
} else {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create([$token, false, self::DOUBLE_QUOTED_STATE]);
|
||||
}
|
||||
case self::ESCAPE_SEQUENCE_STATE:
|
||||
if ($token === '"' || $token === '\\') {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create([$token, false, self::DOUBLE_QUOTED_STATE]);
|
||||
} elseif ($token === '$') {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create([$token, false, self::DOUBLE_QUOTED_STATE]);
|
||||
} else {
|
||||
$first = Str::substr($token, 0, 1);
|
||||
if (\in_array($first, ['f', 'n', 'r', 't', 'v'], true)) {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create([\stripcslashes('\\'.$first).Str::substr($token, 1), false, self::DOUBLE_QUOTED_STATE]);
|
||||
} else {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Error::create('an unexpected escape sequence');
|
||||
}
|
||||
}
|
||||
case self::WHITESPACE_STATE:
|
||||
if ($token === '#') {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create(['', false, self::COMMENT_STATE]);
|
||||
} elseif (!\ctype_space($token)) {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Error::create('unexpected whitespace');
|
||||
} else {
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create(['', false, self::WHITESPACE_STATE]);
|
||||
}
|
||||
case self::COMMENT_STATE:
|
||||
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
||||
return Success::create(['', false, self::COMMENT_STATE]);
|
||||
default:
|
||||
throw new \Error('Parser entered invalid state.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a friendly error message.
|
||||
*
|
||||
* @param string $cause
|
||||
* @param string $subject
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function getErrorMessage(string $cause, string $subject)
|
||||
{
|
||||
return \sprintf(
|
||||
'Encountered %s at [%s].',
|
||||
$cause,
|
||||
\strtok($subject, "\n")
|
||||
);
|
||||
}
|
||||
}
|
||||
58
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Parser/Lexer.php
vendored
Executable file
58
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Parser/Lexer.php
vendored
Executable file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Parser;
|
||||
|
||||
final class Lexer
|
||||
{
|
||||
/**
|
||||
* The regex for each type of token.
|
||||
*/
|
||||
private const PATTERNS = [
|
||||
'[\r\n]{1,1000}', '[^\S\r\n]{1,1000}', '\\\\', '\'', '"', '\\#', '\\$', '([^(\s\\\\\'"\\#\\$)]|\\(|\\)){1,1000}',
|
||||
];
|
||||
|
||||
/**
|
||||
* This class is a singleton.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert content into a token stream.
|
||||
*
|
||||
* Multibyte string processing is not needed here, and nether is error
|
||||
* handling, for performance reasons.
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @return \Generator<string>
|
||||
*/
|
||||
public static function lex(string $content)
|
||||
{
|
||||
static $regex;
|
||||
|
||||
if ($regex === null) {
|
||||
$regex = '(('.\implode(')|(', self::PATTERNS).'))A';
|
||||
}
|
||||
|
||||
$offset = 0;
|
||||
|
||||
while (isset($content[$offset])) {
|
||||
if (!\preg_match($regex, $content, $matches, 0, $offset)) {
|
||||
throw new \Error(\sprintf('Lexer encountered unexpected character [%s].', $content[$offset]));
|
||||
}
|
||||
|
||||
$offset += \strlen($matches[0]);
|
||||
|
||||
yield $matches[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
127
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Parser/Lines.php
vendored
Executable file
127
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Parser/Lines.php
vendored
Executable file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Parser;
|
||||
|
||||
use Dotenv\Util\Regex;
|
||||
use Dotenv\Util\Str;
|
||||
|
||||
final class Lines
|
||||
{
|
||||
/**
|
||||
* This class is a singleton.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the array of lines of environment variables.
|
||||
*
|
||||
* This will produce an array of raw entries, one per variable.
|
||||
*
|
||||
* @param string[] $lines
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public static function process(array $lines)
|
||||
{
|
||||
$output = [];
|
||||
$multiline = false;
|
||||
$multilineBuffer = [];
|
||||
|
||||
foreach ($lines as $line) {
|
||||
[$multiline, $line, $multilineBuffer] = self::multilineProcess($multiline, $line, $multilineBuffer);
|
||||
|
||||
if (!$multiline && !self::isCommentOrWhitespace($line)) {
|
||||
$output[] = $line;
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to make all multiline variable process.
|
||||
*
|
||||
* @param bool $multiline
|
||||
* @param string $line
|
||||
* @param string[] $buffer
|
||||
*
|
||||
* @return array{bool,string, string[]}
|
||||
*/
|
||||
private static function multilineProcess(bool $multiline, string $line, array $buffer)
|
||||
{
|
||||
$startsOnCurrentLine = $multiline ? false : self::looksLikeMultilineStart($line);
|
||||
|
||||
// check if $line can be multiline variable
|
||||
if ($startsOnCurrentLine) {
|
||||
$multiline = true;
|
||||
}
|
||||
|
||||
if ($multiline) {
|
||||
\array_push($buffer, $line);
|
||||
|
||||
if (self::looksLikeMultilineStop($line, $startsOnCurrentLine)) {
|
||||
$multiline = false;
|
||||
$line = \implode("\n", $buffer);
|
||||
$buffer = [];
|
||||
}
|
||||
}
|
||||
|
||||
return [$multiline, $line, $buffer];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given line can be the start of a multiline variable.
|
||||
*
|
||||
* @param string $line
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function looksLikeMultilineStart(string $line)
|
||||
{
|
||||
return Str::pos($line, '="')->map(static function () use ($line) {
|
||||
return self::looksLikeMultilineStop($line, true) === false;
|
||||
})->getOrElse(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given line can be the start of a multiline variable.
|
||||
*
|
||||
* @param string $line
|
||||
* @param bool $started
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function looksLikeMultilineStop(string $line, bool $started)
|
||||
{
|
||||
if ($line === '"') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return Regex::occurrences('/(?=([^\\\\]"))/', \str_replace('\\\\', '', $line))->map(static function (int $count) use ($started) {
|
||||
return $started ? $count > 1 : $count >= 1;
|
||||
})->success()->getOrElse(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the line in the file is a comment or whitespace.
|
||||
*
|
||||
* @param string $line
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function isCommentOrWhitespace(string $line)
|
||||
{
|
||||
$line = \trim($line);
|
||||
|
||||
return $line === '' || (isset($line[0]) && $line[0] === '#');
|
||||
}
|
||||
}
|
||||
53
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Parser/Parser.php
vendored
Executable file
53
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Parser/Parser.php
vendored
Executable file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Parser;
|
||||
|
||||
use Dotenv\Exception\InvalidFileException;
|
||||
use Dotenv\Util\Regex;
|
||||
use GrahamCampbell\ResultType\Result;
|
||||
use GrahamCampbell\ResultType\Success;
|
||||
|
||||
final class Parser implements ParserInterface
|
||||
{
|
||||
/**
|
||||
* Parse content into an entry array.
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @throws \Dotenv\Exception\InvalidFileException
|
||||
*
|
||||
* @return \Dotenv\Parser\Entry[]
|
||||
*/
|
||||
public function parse(string $content)
|
||||
{
|
||||
return Regex::split("/(\r\n|\n|\r)/", $content)->mapError(static function () {
|
||||
return 'Could not split into separate lines.';
|
||||
})->flatMap(static function (array $lines) {
|
||||
return self::process(Lines::process($lines));
|
||||
})->mapError(static function (string $error) {
|
||||
throw new InvalidFileException(\sprintf('Failed to parse dotenv file. %s', $error));
|
||||
})->success()->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the raw entries into proper entries.
|
||||
*
|
||||
* @param string[] $entries
|
||||
*
|
||||
* @return \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Entry[], string>
|
||||
*/
|
||||
private static function process(array $entries)
|
||||
{
|
||||
/** @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Entry[], string> */
|
||||
return \array_reduce($entries, static function (Result $result, string $raw) {
|
||||
return $result->flatMap(static function (array $entries) use ($raw) {
|
||||
return EntryParser::parse($raw)->map(static function (Entry $entry) use ($entries) {
|
||||
/** @var \Dotenv\Parser\Entry[] */
|
||||
return \array_merge($entries, [$entry]);
|
||||
});
|
||||
});
|
||||
}, Success::create([]));
|
||||
}
|
||||
}
|
||||
19
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Parser/ParserInterface.php
vendored
Executable file
19
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Parser/ParserInterface.php
vendored
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Parser;
|
||||
|
||||
interface ParserInterface
|
||||
{
|
||||
/**
|
||||
* Parse content into an entry array.
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @throws \Dotenv\Exception\InvalidFileException
|
||||
*
|
||||
* @return \Dotenv\Parser\Entry[]
|
||||
*/
|
||||
public function parse(string $content);
|
||||
}
|
||||
88
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Parser/Value.php
vendored
Executable file
88
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Parser/Value.php
vendored
Executable file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Parser;
|
||||
|
||||
use Dotenv\Util\Str;
|
||||
|
||||
final class Value
|
||||
{
|
||||
/**
|
||||
* The string representation of the parsed value.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $chars;
|
||||
|
||||
/**
|
||||
* The locations of the variables in the value.
|
||||
*
|
||||
* @var int[]
|
||||
*/
|
||||
private $vars;
|
||||
|
||||
/**
|
||||
* Internal constructor for a value.
|
||||
*
|
||||
* @param string $chars
|
||||
* @param int[] $vars
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __construct(string $chars, array $vars)
|
||||
{
|
||||
$this->chars = $chars;
|
||||
$this->vars = $vars;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an empty value instance.
|
||||
*
|
||||
* @return \Dotenv\Parser\Value
|
||||
*/
|
||||
public static function blank()
|
||||
{
|
||||
return new self('', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new value instance, appending the characters.
|
||||
*
|
||||
* @param string $chars
|
||||
* @param bool $var
|
||||
*
|
||||
* @return \Dotenv\Parser\Value
|
||||
*/
|
||||
public function append(string $chars, bool $var)
|
||||
{
|
||||
return new self(
|
||||
$this->chars.$chars,
|
||||
$var ? \array_merge($this->vars, [Str::len($this->chars)]) : $this->vars
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the string representation of the parsed value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getChars()
|
||||
{
|
||||
return $this->chars;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the locations of the variables in the value.
|
||||
*
|
||||
* @return int[]
|
||||
*/
|
||||
public function getVars()
|
||||
{
|
||||
$vars = $this->vars;
|
||||
|
||||
\rsort($vars);
|
||||
|
||||
return $vars;
|
||||
}
|
||||
}
|
||||
15
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/AdapterInterface.php
vendored
Executable file
15
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/AdapterInterface.php
vendored
Executable file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
interface AdapterInterface extends ReaderInterface, WriterInterface
|
||||
{
|
||||
/**
|
||||
* Create a new instance of the adapter, if it is available.
|
||||
*
|
||||
* @return \PhpOption\Option<\Dotenv\Repository\Adapter\AdapterInterface>
|
||||
*/
|
||||
public static function create();
|
||||
}
|
||||
89
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/ApacheAdapter.php
vendored
Executable file
89
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/ApacheAdapter.php
vendored
Executable file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
use PhpOption\None;
|
||||
use PhpOption\Option;
|
||||
use PhpOption\Some;
|
||||
|
||||
final class ApacheAdapter implements AdapterInterface
|
||||
{
|
||||
/**
|
||||
* Create a new apache adapter instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance of the adapter, if it is available.
|
||||
*
|
||||
* @return \PhpOption\Option<\Dotenv\Repository\Adapter\AdapterInterface>
|
||||
*/
|
||||
public static function create()
|
||||
{
|
||||
if (self::isSupported()) {
|
||||
/** @var \PhpOption\Option<AdapterInterface> */
|
||||
return Some::create(new self());
|
||||
}
|
||||
|
||||
return None::create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the adapter is supported.
|
||||
*
|
||||
* This happens if PHP is running as an Apache module.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function isSupported()
|
||||
{
|
||||
return \function_exists('apache_getenv') && \function_exists('apache_setenv');
|
||||
}
|
||||
|
||||
/**
|
||||
* Read an environment variable, if it exists.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return \PhpOption\Option<string>
|
||||
*/
|
||||
public function read(string $name)
|
||||
{
|
||||
/** @var \PhpOption\Option<string> */
|
||||
return Option::fromValue(apache_getenv($name))->filter(static function ($value) {
|
||||
return \is_string($value) && $value !== '';
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Write to an environment variable, if possible.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
* @param string $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function write(string $name, string $value)
|
||||
{
|
||||
return apache_setenv($name, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an environment variable, if possible.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function delete(string $name)
|
||||
{
|
||||
return apache_setenv($name, '');
|
||||
}
|
||||
}
|
||||
80
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/ArrayAdapter.php
vendored
Executable file
80
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/ArrayAdapter.php
vendored
Executable file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
use PhpOption\Option;
|
||||
use PhpOption\Some;
|
||||
|
||||
final class ArrayAdapter implements AdapterInterface
|
||||
{
|
||||
/**
|
||||
* The variables and their values.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private $variables;
|
||||
|
||||
/**
|
||||
* Create a new array adapter instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
$this->variables = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance of the adapter, if it is available.
|
||||
*
|
||||
* @return \PhpOption\Option<\Dotenv\Repository\Adapter\AdapterInterface>
|
||||
*/
|
||||
public static function create()
|
||||
{
|
||||
/** @var \PhpOption\Option<AdapterInterface> */
|
||||
return Some::create(new self());
|
||||
}
|
||||
|
||||
/**
|
||||
* Read an environment variable, if it exists.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return \PhpOption\Option<string>
|
||||
*/
|
||||
public function read(string $name)
|
||||
{
|
||||
return Option::fromArraysValue($this->variables, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write to an environment variable, if possible.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
* @param string $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function write(string $name, string $value)
|
||||
{
|
||||
$this->variables[$name] = $value;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an environment variable, if possible.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function delete(string $name)
|
||||
{
|
||||
unset($this->variables[$name]);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
89
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/EnvConstAdapter.php
vendored
Executable file
89
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/EnvConstAdapter.php
vendored
Executable file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
use PhpOption\Option;
|
||||
use PhpOption\Some;
|
||||
|
||||
final class EnvConstAdapter implements AdapterInterface
|
||||
{
|
||||
/**
|
||||
* Create a new env const adapter instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance of the adapter, if it is available.
|
||||
*
|
||||
* @return \PhpOption\Option<\Dotenv\Repository\Adapter\AdapterInterface>
|
||||
*/
|
||||
public static function create()
|
||||
{
|
||||
/** @var \PhpOption\Option<AdapterInterface> */
|
||||
return Some::create(new self());
|
||||
}
|
||||
|
||||
/**
|
||||
* Read an environment variable, if it exists.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return \PhpOption\Option<string>
|
||||
*/
|
||||
public function read(string $name)
|
||||
{
|
||||
/** @var \PhpOption\Option<string> */
|
||||
return Option::fromArraysValue($_ENV, $name)
|
||||
->filter(static function ($value) {
|
||||
return \is_scalar($value);
|
||||
})
|
||||
->map(static function ($value) {
|
||||
if ($value === false) {
|
||||
return 'false';
|
||||
}
|
||||
|
||||
if ($value === true) {
|
||||
return 'true';
|
||||
}
|
||||
|
||||
/** @psalm-suppress PossiblyInvalidCast */
|
||||
return (string) $value;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Write to an environment variable, if possible.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
* @param string $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function write(string $name, string $value)
|
||||
{
|
||||
$_ENV[$name] = $value;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an environment variable, if possible.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function delete(string $name)
|
||||
{
|
||||
unset($_ENV[$name]);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
85
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/GuardedWriter.php
vendored
Executable file
85
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/GuardedWriter.php
vendored
Executable file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
final class GuardedWriter implements WriterInterface
|
||||
{
|
||||
/**
|
||||
* The inner writer to use.
|
||||
*
|
||||
* @var \Dotenv\Repository\Adapter\WriterInterface
|
||||
*/
|
||||
private $writer;
|
||||
|
||||
/**
|
||||
* The variable name allow list.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $allowList;
|
||||
|
||||
/**
|
||||
* Create a new guarded writer instance.
|
||||
*
|
||||
* @param \Dotenv\Repository\Adapter\WriterInterface $writer
|
||||
* @param string[] $allowList
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(WriterInterface $writer, array $allowList)
|
||||
{
|
||||
$this->writer = $writer;
|
||||
$this->allowList = $allowList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write to an environment variable, if possible.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
* @param string $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function write(string $name, string $value)
|
||||
{
|
||||
// Don't set non-allowed variables
|
||||
if (!$this->isAllowed($name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the value on the inner writer
|
||||
return $this->writer->write($name, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an environment variable, if possible.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function delete(string $name)
|
||||
{
|
||||
// Don't clear non-allowed variables
|
||||
if (!$this->isAllowed($name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the value on the inner writer
|
||||
return $this->writer->delete($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given variable is allowed.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isAllowed(string $name)
|
||||
{
|
||||
return \in_array($name, $this->allowList, true);
|
||||
}
|
||||
}
|
||||
110
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/ImmutableWriter.php
vendored
Executable file
110
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/ImmutableWriter.php
vendored
Executable file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
final class ImmutableWriter implements WriterInterface
|
||||
{
|
||||
/**
|
||||
* The inner writer to use.
|
||||
*
|
||||
* @var \Dotenv\Repository\Adapter\WriterInterface
|
||||
*/
|
||||
private $writer;
|
||||
|
||||
/**
|
||||
* The inner reader to use.
|
||||
*
|
||||
* @var \Dotenv\Repository\Adapter\ReaderInterface
|
||||
*/
|
||||
private $reader;
|
||||
|
||||
/**
|
||||
* The record of loaded variables.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private $loaded;
|
||||
|
||||
/**
|
||||
* Create a new immutable writer instance.
|
||||
*
|
||||
* @param \Dotenv\Repository\Adapter\WriterInterface $writer
|
||||
* @param \Dotenv\Repository\Adapter\ReaderInterface $reader
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(WriterInterface $writer, ReaderInterface $reader)
|
||||
{
|
||||
$this->writer = $writer;
|
||||
$this->reader = $reader;
|
||||
$this->loaded = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Write to an environment variable, if possible.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
* @param string $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function write(string $name, string $value)
|
||||
{
|
||||
// Don't overwrite existing environment variables
|
||||
// Ruby's dotenv does this with `ENV[key] ||= value`
|
||||
if ($this->isExternallyDefined($name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the value on the inner writer
|
||||
if (!$this->writer->write($name, $value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Record that we have loaded the variable
|
||||
$this->loaded[$name] = '';
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an environment variable, if possible.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function delete(string $name)
|
||||
{
|
||||
// Don't clear existing environment variables
|
||||
if ($this->isExternallyDefined($name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the value on the inner writer
|
||||
if (!$this->writer->delete($name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Leave the variable as fair game
|
||||
unset($this->loaded[$name]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given variable is externally defined.
|
||||
*
|
||||
* That is, is it an "existing" variable.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isExternallyDefined(string $name)
|
||||
{
|
||||
return $this->reader->read($name)->isDefined() && !isset($this->loaded[$name]);
|
||||
}
|
||||
}
|
||||
48
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/MultiReader.php
vendored
Executable file
48
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/MultiReader.php
vendored
Executable file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
use PhpOption\None;
|
||||
|
||||
final class MultiReader implements ReaderInterface
|
||||
{
|
||||
/**
|
||||
* The set of readers to use.
|
||||
*
|
||||
* @var \Dotenv\Repository\Adapter\ReaderInterface[]
|
||||
*/
|
||||
private $readers;
|
||||
|
||||
/**
|
||||
* Create a new multi-reader instance.
|
||||
*
|
||||
* @param \Dotenv\Repository\Adapter\ReaderInterface[] $readers
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $readers)
|
||||
{
|
||||
$this->readers = $readers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read an environment variable, if it exists.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return \PhpOption\Option<string>
|
||||
*/
|
||||
public function read(string $name)
|
||||
{
|
||||
foreach ($this->readers as $reader) {
|
||||
$result = $reader->read($name);
|
||||
if ($result->isDefined()) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
return None::create();
|
||||
}
|
||||
}
|
||||
64
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/MultiWriter.php
vendored
Executable file
64
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/MultiWriter.php
vendored
Executable file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
final class MultiWriter implements WriterInterface
|
||||
{
|
||||
/**
|
||||
* The set of writers to use.
|
||||
*
|
||||
* @var \Dotenv\Repository\Adapter\WriterInterface[]
|
||||
*/
|
||||
private $writers;
|
||||
|
||||
/**
|
||||
* Create a new multi-writer instance.
|
||||
*
|
||||
* @param \Dotenv\Repository\Adapter\WriterInterface[] $writers
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $writers)
|
||||
{
|
||||
$this->writers = $writers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write to an environment variable, if possible.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
* @param string $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function write(string $name, string $value)
|
||||
{
|
||||
foreach ($this->writers as $writers) {
|
||||
if (!$writers->write($name, $value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an environment variable, if possible.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function delete(string $name)
|
||||
{
|
||||
foreach ($this->writers as $writers) {
|
||||
if (!$writers->delete($name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
91
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/PutenvAdapter.php
vendored
Executable file
91
vendor/claudecio/axiumphp/vendor/vlucas/phpdotenv/src/Repository/Adapter/PutenvAdapter.php
vendored
Executable file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
use PhpOption\None;
|
||||
use PhpOption\Option;
|
||||
use PhpOption\Some;
|
||||
|
||||
final class PutenvAdapter implements AdapterInterface
|
||||
{
|
||||
/**
|
||||
* Create a new putenv adapter instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance of the adapter, if it is available.
|
||||
*
|
||||
* @return \PhpOption\Option<\Dotenv\Repository\Adapter\AdapterInterface>
|
||||
*/
|
||||
public static function create()
|
||||
{
|
||||
if (self::isSupported()) {
|
||||
/** @var \PhpOption\Option<AdapterInterface> */
|
||||
return Some::create(new self());
|
||||
}
|
||||
|
||||
return None::create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the adapter is supported.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function isSupported()
|
||||
{
|
||||
return \function_exists('getenv') && \function_exists('putenv');
|
||||
}
|
||||
|
||||
/**
|
||||
* Read an environment variable, if it exists.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return \PhpOption\Option<string>
|
||||
*/
|
||||
public function read(string $name)
|
||||
{
|
||||
/** @var \PhpOption\Option<string> */
|
||||
return Option::fromValue(\getenv($name), false)->filter(static function ($value) {
|
||||
return \is_string($value);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Write to an environment variable, if possible.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
* @param string $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function write(string $name, string $value)
|
||||
{
|
||||
\putenv("$name=$value");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an environment variable, if possible.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function delete(string $name)
|
||||
{
|
||||
\putenv($name);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user