first commit
This commit is contained in:
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# Arquivo de variáveis de ambiente
|
||||
.env
|
||||
# Pasta de Logs
|
||||
app/Storage/logs
|
||||
73
app/Common/Component/Auth/bootstrap.php
Normal file
73
app/Common/Component/Auth/bootstrap.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
namespace Workbloom\Component\Auth;
|
||||
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use AxiumPHP\Core\Router;
|
||||
|
||||
// Caminho do manifest.json
|
||||
$manifestPath = realpath(path: __DIR__ . "/manifest.json");
|
||||
|
||||
if (!$manifestPath || !file_exists(filename: $manifestPath)) {
|
||||
throw new Exception(message: "Arquivo 'manifest.json' não encontrado.");
|
||||
}
|
||||
|
||||
// Lê e decodifica
|
||||
$manifest = json_decode(json: file_get_contents(filename: $manifestPath), associative: true);
|
||||
|
||||
// Verifica estrutura
|
||||
if (!isset($manifest['apis']) || !is_array(value: $manifest['apis'])) {
|
||||
throw new Exception(message: "Estrutura de 'apis' inválida no manifest.");
|
||||
}
|
||||
|
||||
$now = (new DateTime())->format(format: 'Y-m-d');
|
||||
$newApis = [];
|
||||
$updated = false;
|
||||
|
||||
// Checa se tem versão esperando que começa hoje
|
||||
foreach ($manifest['apis'] as $api) {
|
||||
if ($api['status'] === 'planned' && $api['start_date'] === $now) {
|
||||
// Promote a nova
|
||||
$api['status'] = 'active';
|
||||
$newApis[] = $api;
|
||||
$updated = true;
|
||||
} elseif ($api['status'] === 'active' && $api['start_date'] !== $now) {
|
||||
// Ignora versão antiga ativa
|
||||
continue;
|
||||
} else {
|
||||
$newApis[] = $api;
|
||||
}
|
||||
}
|
||||
|
||||
// Atualiza manifest se tiver mudança
|
||||
if ($updated) {
|
||||
$manifest['apis'] = $newApis;
|
||||
file_put_contents(filename: $manifestPath, data: json_encode(value: $manifest, flags: JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
// Carrega a versão ativa
|
||||
$loaded = false;
|
||||
foreach ($manifest['apis'] as $api) {
|
||||
$startDate = new DateTime(datetime: $api['start_date']);
|
||||
if ($api['status'] === 'active' && $startDate <= new DateTime()) {
|
||||
$routeFile = COMPONENT_PATH . "/{$manifest['dirName']}/{$api['version']}/Routes/Routes.php";
|
||||
if (file_exists(filename: $routeFile)) {
|
||||
Router::group(
|
||||
prefix: "{$api['version']}/{$manifest['slug']}",
|
||||
callback: function() use ($routeFile) {
|
||||
require_once realpath(path: $routeFile);
|
||||
},
|
||||
middlewares: []
|
||||
);
|
||||
$loaded = true;
|
||||
break;
|
||||
} else {
|
||||
throw new Exception(message: "Arquivo de rotas não encontrado para a versão '{$api['version']}'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Verifica se carregou
|
||||
if (!$loaded) {
|
||||
throw new Exception(message: "Nenhuma versão ativa da API foi carregada.");
|
||||
}
|
||||
16
app/Common/Component/Auth/manifest.json
Normal file
16
app/Common/Component/Auth/manifest.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "Autenticação",
|
||||
"dirName": "Auth",
|
||||
"slug": "auth",
|
||||
"description": "Gerencia login, logout, sessão e permissões de acesso.",
|
||||
"uuid": "0199abc8-026a-75b0-9b25-0f9456a44c70",
|
||||
"version": "1.0",
|
||||
"dependencies": [],
|
||||
"apis": [
|
||||
{
|
||||
"version": "v0",
|
||||
"status": "active",
|
||||
"start_date": "2025-08-01"
|
||||
}
|
||||
]
|
||||
}
|
||||
51
app/Common/Component/Auth/v0/Controllers/AuthController.php
Normal file
51
app/Common/Component/Auth/v0/Controllers/AuthController.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
namespace Workbloom\Component\Auth\v0\Controllers;
|
||||
|
||||
use Workbloom\Helpers\DataSanitizer;
|
||||
use AxiumPHP\Helpers\RequestHelper;
|
||||
use Workbloom\Component\Auth\v0\Services\AuthService;
|
||||
|
||||
class AuthController {
|
||||
public function login() {
|
||||
// Recebe formulário de login
|
||||
$form = RequestHelper::getFilteredInput(form_type: INPUT_POST);
|
||||
|
||||
// Define campos obrigatórios
|
||||
$required_fields = [
|
||||
'login',
|
||||
'password'
|
||||
];
|
||||
|
||||
// Validação dos campos obrigatórios
|
||||
foreach ($required_fields as $field) {
|
||||
if (empty($form[$field])) {
|
||||
// Resposta JSON de erro
|
||||
RequestHelper::sendJsonResponse(
|
||||
response_code: 400,
|
||||
status: 'error',
|
||||
message: "O campo '{$field}' é obrigatório",
|
||||
output: []
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Chama o serviço de autenticação
|
||||
$loginService = (new AuthService())->login(
|
||||
credentials: [
|
||||
'login' => DataSanitizer::string(value: $form['login']),
|
||||
'password' => DataSanitizer::string(value: $form['password'])
|
||||
]
|
||||
);
|
||||
|
||||
// Resposta JSON
|
||||
RequestHelper::sendJsonResponse(
|
||||
response_code: 200,
|
||||
status: 'success',
|
||||
message: 'Login successful',
|
||||
output: [
|
||||
'data' => $form
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
177
app/Common/Component/Auth/v0/DTO/UsuarioDTO.php
Normal file
177
app/Common/Component/Auth/v0/DTO/UsuarioDTO.php
Normal file
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
namespace Workbloom\Component\Auth\v0\DTO;
|
||||
|
||||
class UsuarioDTO {
|
||||
private ?int $id = null;
|
||||
private ?string $uuid = null;
|
||||
private ?int $status_id = null;
|
||||
private ?int $is_root = 0;
|
||||
private ?string $nome_completo = null;
|
||||
private ?string $nome_usuario = null;
|
||||
private ?string $email = null;
|
||||
private ?string $senha_hash = null;
|
||||
private ?int $need_update_password = 1;
|
||||
private ?int $days_to_expire_password = 60;
|
||||
private ?string $last_password_update = null;
|
||||
private ?string $created_at = null;
|
||||
private ?string $updated_at = null;
|
||||
private ?string $deleted_at = null;
|
||||
|
||||
/**
|
||||
* Construtor do DTO.
|
||||
*
|
||||
* Permite inicializar os atributos do objeto a partir de um array associativo.
|
||||
*
|
||||
* @param array<string, mixed> $data Array associativo opcional para popular os atributos.
|
||||
*/
|
||||
public function __construct(array $data = []) {
|
||||
if (!empty($data)) {
|
||||
$this->fromArray(data: $data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Popula o DTO a partir de um array.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
* @return void
|
||||
*/
|
||||
public function fromArray(array $data): void {
|
||||
$this->id = $data['id'] ?? $this->id;
|
||||
$this->uuid = $data['uuid'] ?? $this->uuid;
|
||||
$this->status_id = $data['status_id'] ?? $this->status_id;
|
||||
$this->is_root = $data['is_root'] ?? $this->is_root;
|
||||
$this->nome_completo = $data['nome_completo'] ?? $this->nome_completo;
|
||||
$this->nome_usuario = $data['nome_usuario'] ?? $this->nome_usuario;
|
||||
$this->email = $data['email'] ?? $this->email;
|
||||
$this->senha_hash = $data['senha_hash'] ?? $this->senha_hash;
|
||||
$this->need_update_password = $data['need_update_password'] ?? $this->need_update_password;
|
||||
$this->days_to_expire_password = $data['days_to_expire_password'] ?? $this->days_to_expire_password;
|
||||
$this->last_password_update = $data['last_password_update'] ?? $this->last_password_update;
|
||||
$this->created_at = $data['created_at'] ?? $this->created_at;
|
||||
$this->updated_at = $data['updated_at'] ?? $this->updated_at;
|
||||
$this->deleted_at = $data['deleted_at'] ?? $this->deleted_at;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converte o DTO para um array associativo.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(): array {
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'uuid' => $this->uuid,
|
||||
'status_id' => $this->status_id,
|
||||
'is_root' => $this->is_root,
|
||||
'nome_completo' => $this->nome_completo,
|
||||
'nome_usuario' => $this->nome_usuario,
|
||||
'email' => $this->email,
|
||||
'senha_hash' => $this->senha_hash,
|
||||
'need_update_password' => $this->need_update_password,
|
||||
'days_to_expire_password' => $this->days_to_expire_password,
|
||||
'last_password_update' => $this->last_password_update,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
'deleted_at' => $this->deleted_at,
|
||||
];
|
||||
}
|
||||
|
||||
public function getId(): ?int {
|
||||
return $this->id;
|
||||
}
|
||||
public function setId(?int $id): void {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getUuid(): ?string {
|
||||
return $this->uuid;
|
||||
}
|
||||
public function setUuid(?string $uuid): void {
|
||||
$this->uuid = $uuid;
|
||||
}
|
||||
|
||||
public function getStatusId(): ?int {
|
||||
return $this->status_id;
|
||||
}
|
||||
public function setStatusId(?int $status_id): void {
|
||||
$this->status_id = $status_id;
|
||||
}
|
||||
|
||||
public function getIsRoot(): ?int {
|
||||
return $this->is_root;
|
||||
}
|
||||
public function setIsRoot(?int $is_root): void {
|
||||
$this->is_root = $is_root;
|
||||
}
|
||||
|
||||
public function getNomeCompleto(): ?string {
|
||||
return $this->nome_completo;
|
||||
}
|
||||
public function setNomeCompleto(?string $nome_completo): void {
|
||||
$this->nome_completo = $nome_completo;
|
||||
}
|
||||
|
||||
public function getNomeUsuario(): ?string {
|
||||
return $this->nome_usuario;
|
||||
}
|
||||
public function setNomeUsuario(?string $nome_usuario): void {
|
||||
$this->nome_usuario = $nome_usuario;
|
||||
}
|
||||
|
||||
public function getEmail(): ?string {
|
||||
return $this->email;
|
||||
}
|
||||
public function setEmail(?string $email): void {
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
public function getSenhaHash(): ?string {
|
||||
return $this->senha_hash;
|
||||
}
|
||||
public function setSenhaHash(?string $senha_hash): void {
|
||||
$this->senha_hash = $senha_hash;
|
||||
}
|
||||
|
||||
public function getNeedUpdatePassword(): ?int {
|
||||
return $this->need_update_password;
|
||||
}
|
||||
public function setNeedUpdatePassword(?int $need_update_password): void {
|
||||
$this->need_update_password = $need_update_password;
|
||||
}
|
||||
|
||||
public function getDaysToExpirePassword(): ?int {
|
||||
return $this->days_to_expire_password;
|
||||
}
|
||||
public function setDaysToExpirePassword(?int $days_to_expire_password): void {
|
||||
$this->days_to_expire_password = $days_to_expire_password;
|
||||
}
|
||||
|
||||
public function getLastPasswordUpdate(): ?string {
|
||||
return $this->last_password_update;
|
||||
}
|
||||
public function setLastPasswordUpdate(?string $last_password_update): void {
|
||||
$this->last_password_update = $last_password_update;
|
||||
}
|
||||
|
||||
public function getCreatedAt(): ?string {
|
||||
return $this->created_at;
|
||||
}
|
||||
public function setCreatedAt(?string $created_at): void {
|
||||
$this->created_at = $created_at;
|
||||
}
|
||||
|
||||
public function getUpdatedAt(): ?string {
|
||||
return $this->updated_at;
|
||||
}
|
||||
public function setUpdatedAt(?string $updated_at): void {
|
||||
$this->updated_at = $updated_at;
|
||||
}
|
||||
|
||||
public function getDeletedAt(): ?string {
|
||||
return $this->deleted_at;
|
||||
}
|
||||
public function setDeletedAt(?string $deleted_at): void {
|
||||
$this->deleted_at = $deleted_at;
|
||||
}
|
||||
}
|
||||
127
app/Common/Component/Auth/v0/DTO/UsuarioTokenDTO.php
Normal file
127
app/Common/Component/Auth/v0/DTO/UsuarioTokenDTO.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
namespace Workbloom\Component\Auth\v0\DTO;
|
||||
|
||||
class UsuarioTokenDTO {
|
||||
private ?int $id = null;
|
||||
private ?int $usuario_id = null;
|
||||
private ?string $usuario_ip = null;
|
||||
private ?string $usuario_user_agent = null;
|
||||
private ?string $token = null;
|
||||
private ?int $is_revoked = 0;
|
||||
private ?string $created_at = null;
|
||||
private ?string $revoked_at = null;
|
||||
private ?string $expires_at = null;
|
||||
|
||||
/**
|
||||
* Construtor do DTO.
|
||||
*
|
||||
* Permite inicializar os atributos do objeto a partir de um array associativo.
|
||||
*
|
||||
* @param array<string, mixed> $data Array associativo opcional para popular os atributos.
|
||||
*/
|
||||
public function __construct(array $data = []) {
|
||||
if (!empty($data)) {
|
||||
$this->fromArray(data: $data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Popula o DTO a partir de um array.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
* @return void
|
||||
*/
|
||||
public function fromArray(array $data): void {
|
||||
$this->id = $data['id'] ?? $this->id;
|
||||
$this->usuario_id = $data['usuario_id'] ?? $this->usuario_id;
|
||||
$this->usuario_ip = $data['usuario_ip'] ?? $this->usuario_ip;
|
||||
$this->usuario_user_agent = $data['usuario_user_agent'] ?? $this->usuario_user_agent;
|
||||
$this->token = $data['token'] ?? $this->token;
|
||||
$this->is_revoked = $data['is_revoked'] ?? $this->is_revoked;
|
||||
$this->created_at = $data['created_at'] ?? $this->created_at;
|
||||
$this->revoked_at = $data['revoked_at'] ?? $this->revoked_at;
|
||||
$this->expires_at = $data['expires_at'] ?? $this->expires_at;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converte o DTO para um array associativo.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(): array {
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'usuario_id' => $this->usuario_id,
|
||||
'usuario_ip' => $this->usuario_ip,
|
||||
'usuario_user_agent' => $this->usuario_user_agent,
|
||||
'token' => $this->token,
|
||||
'is_revoked' => $this->is_revoked,
|
||||
'created_at' => $this->created_at,
|
||||
'revoked_at' => $this->revoked_at,
|
||||
'expires_at' => $this->expires_at,
|
||||
];
|
||||
}
|
||||
|
||||
public function getId(): ?int {
|
||||
return $this->id;
|
||||
}
|
||||
public function setId(?int $id): void {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getUsuarioId(): ?int {
|
||||
return $this->usuario_id;
|
||||
}
|
||||
public function setUsuarioId(?int $usuario_id): void {
|
||||
$this->usuario_id = $usuario_id;
|
||||
}
|
||||
|
||||
public function getUsuarioIp(): ?string {
|
||||
return $this->usuario_ip;
|
||||
}
|
||||
public function setUsuarioIp(?string $usuario_ip): void {
|
||||
$this->usuario_ip = $usuario_ip;
|
||||
}
|
||||
|
||||
public function getUsuarioUserAgent(): ?string {
|
||||
return $this->usuario_user_agent;
|
||||
}
|
||||
public function setUsuarioUserAgent(?string $usuario_user_agent): void {
|
||||
$this->usuario_user_agent = $usuario_user_agent;
|
||||
}
|
||||
|
||||
public function getToken(): ?string {
|
||||
return $this->token;
|
||||
}
|
||||
public function setToken(?string $token): void {
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
public function getIsRevoked(): ?int {
|
||||
return $this->is_revoked;
|
||||
}
|
||||
public function setIsRevoked(?int $is_revoked): void {
|
||||
$this->is_revoked = $is_revoked;
|
||||
}
|
||||
|
||||
public function getCreatedAt(): ?string {
|
||||
return $this->created_at;
|
||||
}
|
||||
public function setCreatedAt(?string $created_at): void {
|
||||
$this->created_at = $created_at;
|
||||
}
|
||||
|
||||
public function getRevokedAt(): ?string {
|
||||
return $this->revoked_at;
|
||||
}
|
||||
public function setRevokedAt(?string $revoked_at): void {
|
||||
$this->revoked_at = $revoked_at;
|
||||
}
|
||||
|
||||
public function getExpiresAt(): ?string {
|
||||
return $this->expires_at;
|
||||
}
|
||||
public function setExpiresAt(?string $expires_at): void {
|
||||
$this->expires_at = $expires_at;
|
||||
}
|
||||
}
|
||||
510
app/Common/Component/Auth/v0/Models/UsuarioModel.php
Normal file
510
app/Common/Component/Auth/v0/Models/UsuarioModel.php
Normal file
@@ -0,0 +1,510 @@
|
||||
<?php
|
||||
namespace Workbloom\Component\Auth\v0\Models;
|
||||
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use Workbloom\Services\DB;
|
||||
use Workbloom\Component\Auth\v0\DTO\UsuarioDTO;
|
||||
use Workbloom\Component\Auth\v0\DTO\UsuarioTokenDTO;
|
||||
|
||||
class UsuarioModel {
|
||||
protected string $usuarioTable = 'usuario';
|
||||
protected string $usuarioTokenTable = 'usuario_token';
|
||||
|
||||
/**
|
||||
* Armazena um novo usuário no banco de dados.
|
||||
*
|
||||
* Este método insere os dados de um novo usuário na tabela `{$this->usuarioTable}`, incluindo informações de segurança como hash de senha, status e configurações de expiração de senha. A operação é protegida por um bloco `try-catch` para garantir o tratamento de erros.
|
||||
*
|
||||
* #### Fluxo de Operação:
|
||||
* 1. **Execução da Query:** Prepara e executa a instrução `INSERT` com todos os campos preenchidos a partir do `UsuarioDTO`.
|
||||
* 2. **Confirmação e Retorno de Sucesso:** Se a inserção for bem-sucedida, retorna um array com **`status` 'success'**, código **201 Created** e os dados do usuário criado (ID e UUID).
|
||||
*
|
||||
* #### Tratamento de Erros:
|
||||
* - Qualquer `Exception` capturada durante o processo retorna um array com **`status` 'error'**, código **500 Internal Server Error** (ou o código da exceção) e a mensagem detalhada de erro.
|
||||
*
|
||||
* @param UsuarioDTO $usuarioDTO O objeto DTO contendo os dados do usuário a ser criado.
|
||||
* @return array Um array associativo contendo o status da operação, um código de resposta HTTP e os dados do usuário criado.
|
||||
*/
|
||||
public function storeUsuario(UsuarioDTO $usuarioDTO): array {
|
||||
try {
|
||||
$sql =
|
||||
"INSERT INTO {$this->usuarioTable} (
|
||||
uuid,
|
||||
status_id,
|
||||
is_root,
|
||||
nome_completo,
|
||||
nome_usuario,
|
||||
email,
|
||||
senha_hash,
|
||||
need_update_password,
|
||||
days_to_expire_password,
|
||||
last_password_update,
|
||||
created_at,
|
||||
updated_at,
|
||||
deleted_at
|
||||
) VALUES (
|
||||
:uuid,
|
||||
:status_id,
|
||||
:is_root,
|
||||
:nome_completo,
|
||||
:nome_usuario,
|
||||
:email,
|
||||
:senha_hash,
|
||||
:need_update_password,
|
||||
:days_to_expire_password,
|
||||
:last_password_update,
|
||||
:created_at,
|
||||
:updated_at,
|
||||
:deleted_at
|
||||
)";
|
||||
|
||||
$params = [
|
||||
":uuid"=> $usuarioDTO->getUuid(),
|
||||
":status_id"=> $usuarioDTO->getStatusId(),
|
||||
":is_root"=> $usuarioDTO->getIsRoot(),
|
||||
":nome_completo"=> $usuarioDTO->getNomeCompleto(),
|
||||
":nome_usuario"=> $usuarioDTO->getNomeUsuario(),
|
||||
":email"=> $usuarioDTO->getEmail(),
|
||||
":senha_hash"=> $usuarioDTO->getSenhaHash(),
|
||||
":need_update_password"=> $usuarioDTO->getNeedUpdatePassword(),
|
||||
":days_to_expire_password"=> $usuarioDTO->getDaysToExpirePassword(),
|
||||
":last_password_update"=> $usuarioDTO->getLastPasswordUpdate(),
|
||||
":created_at"=> $usuarioDTO->getCreatedAt(),
|
||||
":updated_at"=> $usuarioDTO->getUpdatedAt(),
|
||||
":deleted_at"=> $usuarioDTO->getDeletedAt(),
|
||||
];
|
||||
|
||||
// Executa a query
|
||||
DB::execute(sql: $sql, params: $params);
|
||||
|
||||
return [
|
||||
'response_code' => 201,
|
||||
'status' => 'success',
|
||||
'message' => 'Usuário criado com sucesso',
|
||||
'output' => [
|
||||
'data' => [
|
||||
'id' => DB::lastInsertId(),
|
||||
'uuid' => $usuarioDTO->getUuid()
|
||||
]
|
||||
]
|
||||
];
|
||||
} catch (Exception $e) {
|
||||
return [
|
||||
'response_code' => $e->getCode() ?? 500,
|
||||
'status' => 'error',
|
||||
'message' => $e->getMessage() ?? 'Internal Server Error'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Atualiza um usuário existente no banco de dados.
|
||||
*
|
||||
* Este método modifica os dados de um usuário na tabela `{$this->usuarioTable}` com base no **UUID** fornecido no objeto `UsuarioDTO`. Ele atualiza informações de segurança e perfil, como hash de senha, status, permissão de root, nome e configurações de expiração de senha. A operação utiliza um bloco `try-catch` para garantir o tratamento de erros.
|
||||
*
|
||||
* #### Fluxo de Operação:
|
||||
* 1. **Execução da Query:** Prepara e executa a instrução `UPDATE` com todos os campos preenchidos a partir do `UsuarioDTO`, modificando o registro correspondente ao UUID.
|
||||
* 2. **Confirmação e Retorno de Sucesso:** Se a atualização for bem-sucedida, retorna um array com **`status` 'success'**, código **200 OK** e uma mensagem de êxito.
|
||||
*
|
||||
* #### Tratamento de Erros:
|
||||
* - Qualquer `Exception` capturada durante o processo retorna um array com **`status` 'error'**, o código de erro da exceção (ou `500` como fallback) e a mensagem detalhada de erro.
|
||||
*
|
||||
* @param UsuarioDTO $usuarioDTO O objeto DTO contendo os dados atualizados do usuário, incluindo o UUID para identificação.
|
||||
* @return array Um array associativo contendo o status da operação, um código de resposta HTTP e uma mensagem.
|
||||
*/
|
||||
public function updateUsuario(UsuarioDTO $usuarioDTO): array {
|
||||
try {
|
||||
$sql =
|
||||
"UPDATE {$this->usuarioTable} SET
|
||||
status_id = :status_id,
|
||||
is_root = :is_root,
|
||||
nome_completo = :nome_completo,
|
||||
nome_usuario = :nome_usuario,
|
||||
email = :email,
|
||||
senha_hash = :senha_hash,
|
||||
need_update_password = :need_update_password,
|
||||
days_to_expire_password = :days_to_expire_password,
|
||||
last_password_update = :last_password_update,
|
||||
updated_at = :updated_at
|
||||
WHERE uuid = :uuid";
|
||||
|
||||
$params = [
|
||||
":status_id" => $usuarioDTO->getStatusId(),
|
||||
":is_root" => $usuarioDTO->getIsRoot(),
|
||||
":nome_completo" => $usuarioDTO->getNomeCompleto(),
|
||||
":nome_usuario" => $usuarioDTO->getNomeUsuario(),
|
||||
":email" => $usuarioDTO->getEmail(),
|
||||
":senha_hash" => $usuarioDTO->getSenhaHash(),
|
||||
":need_update_password" => $usuarioDTO->getNeedUpdatePassword(),
|
||||
":days_to_expire_password" => $usuarioDTO->getDaysToExpirePassword(),
|
||||
":last_password_update" => $usuarioDTO->getLastPasswordUpdate(),
|
||||
":updated_at" => $usuarioDTO->getUpdatedAt(),
|
||||
":uuid" => $usuarioDTO->getUuid(),
|
||||
];
|
||||
|
||||
// Executa a query
|
||||
DB::execute(sql: $sql, params: $params);
|
||||
|
||||
return [
|
||||
'response_code' => 200,
|
||||
'status' => 'success',
|
||||
'message' => 'Usuário atualizado com sucesso',
|
||||
];
|
||||
} catch(Exception $e) {
|
||||
return [
|
||||
'response_code' => $e->getCode() ?? 500,
|
||||
'status' => 'error',
|
||||
'message' => $e->getMessage() ?? 'Internal Server Error'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Realiza a exclusão lógica de um usuário no banco de dados.
|
||||
*
|
||||
* Este método atualiza a coluna `deleted_at` do registro do usuário na tabela `{$this->usuarioTable}` com o timestamp fornecido no objeto `UsuarioDTO`. Isso garante uma **exclusão lógica**, mantendo o registro para fins de auditoria, mas marcando-o como inativo.
|
||||
*
|
||||
* #### Fluxo de Operação:
|
||||
* 1. **Execução da Query:** Prepara e executa a instrução `UPDATE` que define a data de exclusão para o registro correspondente ao UUID do usuário.
|
||||
* 2. **Retorno de Sucesso:** Se a atualização for bem-sucedida, retorna um array com **`status` 'success'**, código **200 OK** e uma mensagem de êxito.
|
||||
*
|
||||
* #### Tratamento de Erros:
|
||||
* - Qualquer `Exception` capturada durante o processo retorna um array com **`status` 'error'**, o código de erro da exceção (ou `500` como fallback) e a mensagem detalhada da exceção.
|
||||
*
|
||||
* @param UsuarioDTO $usuarioDTO O objeto DTO contendo o UUID do usuário a ser excluído e o timestamp a ser definido em `deleted_at`.
|
||||
* @return array Um array associativo contendo o status da operação, um código de resposta HTTP e uma mensagem.
|
||||
*/
|
||||
public function deleteUsuario(UsuarioDTO $usuarioDTO): array {
|
||||
try {
|
||||
$sql =
|
||||
"UPDATE {$this->usuarioTable} SET
|
||||
deleted_at = :deleted_at
|
||||
WHERE uuid = :uuid";
|
||||
|
||||
$params = [
|
||||
":deleted_at" => $usuarioDTO->getDeletedAt(),
|
||||
":uuid" => $usuarioDTO->getUuid(),
|
||||
];
|
||||
|
||||
// Executa a query
|
||||
DB::execute(sql: $sql, params: $params);
|
||||
|
||||
return [
|
||||
'response_code' => 200,
|
||||
'status' => 'success',
|
||||
'message' => 'Usuário excluído com sucesso',
|
||||
];
|
||||
} catch(Exception $e) {
|
||||
return [
|
||||
'response_code' => $e->getCode() ?? 500,
|
||||
'status' => 'error',
|
||||
'message' => $e->getMessage() ?? 'Internal Server Error'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Busca um único usuário no banco de dados por um identificador específico.
|
||||
*
|
||||
* Este método recupera todos os detalhes de um usuário da tabela `{$this->usuarioTable}`. A busca é flexível e permite usar qualquer coluna como identificador (`$identifier`) e o valor correspondente.
|
||||
*
|
||||
* #### Fluxo de Operação:
|
||||
* 1. **Construção da Query Dinâmica:** O método monta e executa uma consulta `SELECT` que usa o `$identifier` de forma dinâmica na cláusula `WHERE` e um parâmetro nomeado seguro (`:value`) para o valor.
|
||||
* 2. **Execução da Consulta:** A consulta usa `DB::fetchOne`, indicando que apenas um registro é esperado.
|
||||
* 3. **Verificação de Resultados:**
|
||||
* * Se o usuário for encontrado, retorna um array com **`status` 'success'**, código **200 OK** e os dados do usuário na chave `output`.
|
||||
* * Se o usuário **não for encontrado** (`empty($result)`), retorna um array com **`status` 'error'** e código **404 Not Found**, com uma mensagem indicando que o usuário não foi encontrado.
|
||||
*
|
||||
* #### Tratamento de Erros:
|
||||
* - Qualquer `Exception` capturada durante o processo retorna um array com **`status` 'error'**, o código de erro da exceção (ou `500` como fallback) e uma mensagem detalhada de erro.
|
||||
*
|
||||
* @param string $identifier A coluna da tabela a ser usada como critério de busca (ex: 'uuid', 'email', 'nome_usuario').
|
||||
* @param mixed $value O valor correspondente ao identificador que está sendo buscado.
|
||||
* @return array Um array associativo contendo o status da operação, um código de resposta HTTP e os dados do usuário, se encontrado.
|
||||
*/
|
||||
public function findUsuarioByIdentifier(string $identifier, mixed $value): array {
|
||||
try {
|
||||
$sql =
|
||||
"SELECT
|
||||
id,
|
||||
uuid,
|
||||
status_id,
|
||||
is_root,
|
||||
nome_completo,
|
||||
nome_usuario,
|
||||
email,
|
||||
senha_hash,
|
||||
need_update_password,
|
||||
days_to_expire_password,
|
||||
last_password_update,
|
||||
created_at,
|
||||
updated_at,
|
||||
deleted_at
|
||||
FROM {$this->usuarioTable}
|
||||
WHERE {$identifier} = :value";
|
||||
|
||||
$params = [
|
||||
":value" => $value,
|
||||
];
|
||||
|
||||
$result = DB::fetchOne(sql: $sql, params: $params);
|
||||
if(empty($result)) {
|
||||
return [
|
||||
'response_code' => 404,
|
||||
'status' => 'error',
|
||||
'message' => 'Usuário não encontrado',
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'response_code' => 200,
|
||||
'status' => 'success',
|
||||
'message' => 'Usuário encontrado com sucesso',
|
||||
'output' => [
|
||||
'data' => $result
|
||||
]
|
||||
];
|
||||
} catch(Exception $e) {
|
||||
return [
|
||||
'response_code' => $e->getCode() ?? 500,
|
||||
'status' => 'error',
|
||||
'message' => $e->getMessage() ?? 'Internal Server Error'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Busca um único usuário no banco de dados usando seu e-mail ou nome de usuário como critério de login.
|
||||
*
|
||||
* Este método é utilizado para o processo de autenticação, tentando encontrar um usuário na tabela `{$this->usuarioTable}` por meio de uma correspondência na coluna `nome_usuario` ou `email`.
|
||||
*
|
||||
* #### Fluxo de Operação:
|
||||
* 1. **Execução da Query:** Monta e executa uma consulta `SELECT` que usa o valor `$login` para tentar encontrar um registro no campo `email` ou `nome_usuario`.
|
||||
* 2. **Verificação de Resultados:**
|
||||
* * Se o usuário for encontrado, retorna um array com **`status` 'success'**, código **200 OK** e os dados do usuário na chave `output`.
|
||||
* * Se o usuário **não for encontrado** (`empty($result)`), retorna um array com **`status` 'error'** e código **404 Not Found**, com uma mensagem indicando que o usuário não foi encontrado.
|
||||
*
|
||||
* #### Tratamento de Erros:
|
||||
* - Qualquer `Exception` capturada durante o processo retorna um array com **`status` 'error'**, o código de erro da exceção (ou `500` como fallback) e uma mensagem detalhada de erro.
|
||||
*
|
||||
* @param string $login O valor do e-mail ou nome de usuário a ser pesquisado.
|
||||
* @return array Um array associativo contendo o status da operação, um código de resposta HTTP e os dados do usuário, se encontrado.
|
||||
*/
|
||||
public function findUsuarioByLogin(string $login): array {
|
||||
try {
|
||||
$sql =
|
||||
"SELECT
|
||||
id,
|
||||
uuid,
|
||||
status_id,
|
||||
is_root,
|
||||
nome_completo,
|
||||
nome_usuario,
|
||||
email,
|
||||
senha_hash,
|
||||
need_update_password,
|
||||
days_to_expire_password,
|
||||
last_password_update,
|
||||
created_at,
|
||||
updated_at,
|
||||
deleted_at
|
||||
FROM {$this->usuarioTable}
|
||||
WHERE (nome_usuario = :value OR email = :value)";
|
||||
|
||||
$params = [
|
||||
":value" => $login,
|
||||
];
|
||||
|
||||
$result = DB::fetchOne(sql: $sql, params: $params);
|
||||
if(empty($result)) {
|
||||
return [
|
||||
'response_code' => 404,
|
||||
'status' => 'error',
|
||||
'message' => 'Usuário não encontrado',
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'response_code' => 200,
|
||||
'status' => 'success',
|
||||
'message' => 'Usuário encontrado com sucesso',
|
||||
'output' => [
|
||||
'data' => $result
|
||||
]
|
||||
];
|
||||
} catch(Exception $e) {
|
||||
return [
|
||||
'response_code' => $e->getCode() ?? 500,
|
||||
'status' => 'error',
|
||||
'message' => $e->getMessage() ?? 'Internal Server Error'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Armazena um novo token de autenticação de usuário no banco de dados.
|
||||
*
|
||||
* Este método é responsável por registrar o token na tabela `{$this->usuarioTokenTable}`, associando-o ao usuário, IP, User Agent e definindo seu status de revogação e tempo de expiração.
|
||||
*
|
||||
* #### Fluxo de Operação:
|
||||
* 1. **Execução da Query:** Prepara e executa a instrução `INSERT` para inserir o registro do token com todos os detalhes fornecidos pelo `UsuarioTokenDTO`.
|
||||
* 2. **Confirmação e Retorno de Sucesso:** Se a inserção for bem-sucedida, retorna um array com **`status` 'success'**, código **201 Created** e os dados do token (ID gerado e o token).
|
||||
*
|
||||
* #### Tratamento de Erros:
|
||||
* - Qualquer `Exception` capturada durante o processo retorna um array com **`status` 'error'**, o código de erro da exceção (ou `500` como fallback) e a mensagem detalhada de erro.
|
||||
*
|
||||
* @param UsuarioTokenDTO $usuarioTokenDTO O objeto DTO contendo os dados do token a ser armazenado.
|
||||
* @return array Um array associativo contendo o status da operação, um código de resposta HTTP e os dados do token.
|
||||
*/
|
||||
public function storeUsuarioToken(UsuarioTokenDTO $usuarioTokenDTO): array {
|
||||
try {
|
||||
$sql =
|
||||
"INSERT INTO {$this->usuarioTokenTable} (
|
||||
usuario_id,
|
||||
usuario_ip,
|
||||
usuario_user_agent,
|
||||
token,
|
||||
is_revoked,
|
||||
created_at,
|
||||
expires_at
|
||||
) VALUES (
|
||||
:usuario_id,
|
||||
:usuario_ip,
|
||||
:usuario_user_agent,
|
||||
:token,
|
||||
:is_revoked,
|
||||
:created_at,
|
||||
:expires_at
|
||||
)";
|
||||
|
||||
$params = [
|
||||
":usuario_id"=> $usuarioTokenDTO->getUsuarioId(),
|
||||
":usuario_ip"=> $usuarioTokenDTO->getUsuarioIp(),
|
||||
":usuario_user_agent"=> $usuarioTokenDTO->getUsuarioUserAgent(),
|
||||
":token"=> $usuarioTokenDTO->getToken(),
|
||||
":is_revoked"=> $usuarioTokenDTO->getIsRevoked(),
|
||||
":created_at"=> $usuarioTokenDTO->getCreatedAt(),
|
||||
":expires_at"=> $usuarioTokenDTO->getExpiresAt(),
|
||||
];
|
||||
|
||||
// Executa a query
|
||||
DB::execute(sql: $sql, params: $params);
|
||||
|
||||
return [
|
||||
'response_code' => 201,
|
||||
'status' => 'success',
|
||||
'message' => 'Token de usuário criado com sucesso',
|
||||
'output' => [
|
||||
'data' => [
|
||||
'id' => DB::lastInsertId(),
|
||||
'token' => $usuarioTokenDTO->getToken()
|
||||
]
|
||||
]
|
||||
];
|
||||
} catch (Exception $e) {
|
||||
return [
|
||||
'response_code' => $e->getCode() ?? 500,
|
||||
'status' => 'error',
|
||||
'message' => $e->getMessage() ?? 'Internal Server Error'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Atualiza o status de revogação de um token de usuário no banco de dados.
|
||||
*
|
||||
* Este método modifica o registro de um token na tabela `{$this->usuarioTokenTable}`, alterando o status de revogação (`is_revoked`) e o timestamp de revogação (`revoked_at`), com base na string do token fornecida no DTO.
|
||||
*
|
||||
* #### Fluxo de Operação:
|
||||
* 1. **Execução da Query:** Prepara e executa a instrução `UPDATE` para modificar o status de revogação do token.
|
||||
* 2. **Retorno de Sucesso:** Se a atualização for bem-sucedida, retorna um array com **`status` 'success'**, código **200 OK** e uma mensagem de êxito.
|
||||
*
|
||||
* #### Tratamento de Erros:
|
||||
* - Qualquer `Exception` capturada durante o processo retorna um array com **`status` 'error'**, o código de erro da exceção (ou `500` como fallback) e a mensagem detalhada de erro.
|
||||
*
|
||||
* @param UsuarioTokenDTO $usuarioTokenDTO O objeto DTO contendo o token a ser atualizado, o novo status de revogação (`is_revoked`) e a data de revogação (`revoked_at`).
|
||||
* @return array Um array associativo contendo o status da operação, um código de resposta HTTP e uma mensagem.
|
||||
*/
|
||||
public function updateUsuarioToken(UsuarioTokenDTO $usuarioTokenDTO): array {
|
||||
try {
|
||||
$sql =
|
||||
"UPDATE {$this->usuarioTokenTable} SET
|
||||
is_revoked = :is_revoked,
|
||||
revoked_at = :revoked_at
|
||||
WHERE token = :token";
|
||||
|
||||
$params = [
|
||||
":is_revoked"=> $usuarioTokenDTO->getIsRevoked(),
|
||||
":revoked_at"=> $usuarioTokenDTO->getRevokedAt(),
|
||||
":token"=> $usuarioTokenDTO->getToken(),
|
||||
];
|
||||
|
||||
// Executa a query
|
||||
DB::execute(sql: $sql, params: $params);
|
||||
|
||||
return [
|
||||
'response_code' => 200,
|
||||
'status' => 'success',
|
||||
'message' => 'Token de usuário atualizado com sucesso',
|
||||
];
|
||||
} catch(Exception $e) {
|
||||
return [
|
||||
'response_code' => $e->getCode() ?? 500,
|
||||
'status' => 'error',
|
||||
'message' => $e->getMessage() ?? 'Internal Server Error'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Revoga (invalida) todos os tokens de autenticação ativos de um usuário no banco de dados, buscando o usuário pelo UUID.
|
||||
*
|
||||
* Este método executa uma exclusão lógica em todos os tokens não revogados (`is_revoked = 0`) associados ao ID interno de um usuário, que é determinado pelo `usuario_uuid` fornecido.
|
||||
*
|
||||
* #### Atenção à Sintaxe SQL (PostgreSQL/SQL Server):
|
||||
* A sintaxe `UPDATE ... FROM` é comum em PostgreSQL ou SQL Server e está sendo usada para realizar um JOIN implícito na instrução UPDATE, o que não é sintaxe padrão do MySQL. Assumindo que o ambiente de banco de dados suporte essa sintaxe (ou que o código seja adaptado para o SGBD correto).
|
||||
*
|
||||
* #### Fluxo de Operação:
|
||||
* 1. **Execução da Query:** Prepara e executa a instrução `UPDATE` para definir `is_revoked = 1` e `revoked_at` para o timestamp atual para todos os tokens ativos do usuário.
|
||||
* 2. **Confirmação e Retorno de Sucesso:** Se a atualização for bem-sucedida, retorna um array com **`status` 'success'**, código **200 OK** e uma mensagem de êxito.
|
||||
*
|
||||
* #### Tratamento de Erros:
|
||||
* - Qualquer `Exception` capturada durante o processo retorna um array com **`status` 'error'**, o código de erro da exceção (ou `500` como fallback) e uma mensagem detalhada de erro.
|
||||
*
|
||||
* @param string $usuario_uuid O UUID do usuário para o qual os tokens serão revogados.
|
||||
* @return array Um array associativo contendo o status da operação ("success" ou "error"), um código de resposta HTTP e uma mensagem.
|
||||
*/
|
||||
public function revolkOldUsuarioTokens(string $usuario_uuid): array {
|
||||
try {
|
||||
$sql =
|
||||
"UPDATE {$this->usuarioTokenTable} AS ut SET
|
||||
is_revoked = 1,
|
||||
revoked_at = :revoked_at
|
||||
FROM {$this->usuarioTable} AS u
|
||||
WHERE ut.usuario_id = u.id
|
||||
AND u.uuid = :usuario_uuid
|
||||
AND ut.is_revoked = 0";
|
||||
|
||||
$params = [
|
||||
":revoked_at"=> (new DateTime())->format(format: 'Y-m-d H:i:s'),
|
||||
":usuario_uuid"=> $usuario_uuid
|
||||
];
|
||||
|
||||
// Executa a query
|
||||
DB::execute(sql: $sql, params: $params);
|
||||
|
||||
return [
|
||||
'response_code' => 200,
|
||||
'status' => 'success',
|
||||
'message' => 'Tokens antigos revogados com sucesso',
|
||||
];
|
||||
} catch(Exception $e) {
|
||||
return [
|
||||
'response_code' => $e->getCode() ?? 500,
|
||||
'status' => 'error',
|
||||
'message' => $e->getMessage() ?? 'Internal Server Error'
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
9
app/Common/Component/Auth/v0/Routes/AuthRoutes.php
Normal file
9
app/Common/Component/Auth/v0/Routes/AuthRoutes.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
use AxiumPHP\Core\Router;
|
||||
use Workbloom\Component\Auth\v0\Controllers\AuthController;
|
||||
|
||||
// Rota de login
|
||||
Router::POST(
|
||||
uri: '/login',
|
||||
handler: [AuthController::class, 'login']
|
||||
);
|
||||
3
app/Common/Component/Auth/v0/Routes/Routes.php
Normal file
3
app/Common/Component/Auth/v0/Routes/Routes.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
// Importa rotas de autenticação
|
||||
require_once __DIR__ . '/AuthRoutes.php';
|
||||
8
app/Common/Component/Auth/v0/Services/AuthService.php
Normal file
8
app/Common/Component/Auth/v0/Services/AuthService.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace Workbloom\Component\Auth\v0\Services;
|
||||
|
||||
class AuthService {
|
||||
public function login(array $credentials) {
|
||||
return ['data' => $credentials];
|
||||
}
|
||||
}
|
||||
42
app/Common/Config/Config.php
Normal file
42
app/Common/Config/Config.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
namespace Workbloom\Config;
|
||||
|
||||
use Dotenv\Dotenv;
|
||||
|
||||
class Config {
|
||||
private $config = [];
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Método construtor
|
||||
*/
|
||||
public function __construct() {
|
||||
// Carrega apenas para $_ENV, não para $_SERVER
|
||||
$dotEnv = Dotenv::createUnsafeImmutable(
|
||||
paths: realpath(path: __DIR__ . "/../../../"),
|
||||
names: '.env'
|
||||
);
|
||||
$dotEnv->safeLoad(); // não dá erro se .env não existir
|
||||
|
||||
// Carrega as configurações
|
||||
$this->config = require_once realpath(path: __DIR__ . "/Consts.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna a instância única da classe
|
||||
*/
|
||||
public static function getInstance() {
|
||||
if (self::$instance === null) {
|
||||
self::$instance = new Config();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna uma configuração
|
||||
*/
|
||||
public function get(string $key) {
|
||||
return $this->config[$key] ?? null;
|
||||
}
|
||||
}
|
||||
21
app/Common/Config/Consts.php
Normal file
21
app/Common/Config/Consts.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
return [
|
||||
'SYSTEM_URL' => (string) getenv(name: 'SYSTEM_URL'),
|
||||
'SYSTEM_VERSION' => (string) getenv(name: 'SYSTEM_VERSION'),
|
||||
'SYSTEM_TIMEZONE' => (string) getenv(name: 'SYSTEM_TIMEZONE'),
|
||||
'SYSTEM_ENVIRONMENT_ID' => (int) getenv(name: 'SYSTEM_ENVIRONMENT_ID'),
|
||||
'SYSTEM_FRONTEND_URL' => (string) getenv(name: 'SYSTEM_FRONTEND_URL'),
|
||||
|
||||
'JWT_ALGO' => getenv(name: 'JWT_ALGO'),
|
||||
'JWT_ISSUER' => getenv(name: 'JWT_ISSUER'),
|
||||
'JWT_SECRET' => getenv(name: 'JWT_SECRET'),
|
||||
'JWT_EXPIRATION' => (int) getenv(name: 'JWT_EXPIRATION'),
|
||||
|
||||
'DEFAULT_DATABASE_HOST' => getenv(name: 'DEFAULT_DATABASE_HOST'),
|
||||
'DEFAULT_DATABASE_PORT' => getenv(name: 'DEFAULT_DATABASE_PORT'),
|
||||
'DEFAULT_DATABASE_DRIVER' => getenv(name: 'DEFAULT_DATABASE_DRIVER'),
|
||||
'DEFAULT_DATABASE_SCHEMA' => getenv(name: 'DEFAULT_DATABASE_SCHEMA'),
|
||||
'DEFAULT_DATABASE_CHARSET' => getenv(name: 'DEFAULT_DATABASE_CHARSET'),
|
||||
'DEFAULT_DATABASE_USERNAME' => getenv(name: 'DEFAULT_DATABASE_USERNAME'),
|
||||
'DEFAULT_DATABASE_PASSWORD' => getenv(name: 'DEFAULT_DATABASE_PASSWORD'),
|
||||
];
|
||||
69
app/Common/Helpers/DataSanitizer.php
Normal file
69
app/Common/Helpers/DataSanitizer.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace Workbloom\Helpers;
|
||||
|
||||
use DateTime;
|
||||
|
||||
class DataSanitizer {
|
||||
public static function string(mixed $value): string|null {
|
||||
if($value === null) {
|
||||
return null;
|
||||
}
|
||||
return trim(string: strip_tags(string: $value));
|
||||
}
|
||||
|
||||
public static function int(mixed $value): int {
|
||||
return filter_var(value: $value, filter: FILTER_VALIDATE_INT) ?? 0;
|
||||
}
|
||||
|
||||
public static function float(mixed $value): float {
|
||||
return filter_var(value: $value, filter: FILTER_VALIDATE_FLOAT) ?? 0.0;
|
||||
}
|
||||
|
||||
public static function email(string $value): string {
|
||||
$value = trim(string: strtolower(string: $value));
|
||||
return filter_var(value: $value, filter: FILTER_VALIDATE_EMAIL) ?: '';
|
||||
}
|
||||
|
||||
public static function phone(string $value): string {
|
||||
// remove tudo que não for número
|
||||
return preg_replace(pattern: '/\D+/', replacement: '', subject: $value) ?? '';
|
||||
}
|
||||
|
||||
public static function document(string $value): string {
|
||||
// CPF, CNPJ, RG etc. só números
|
||||
return preg_replace(pattern: '/\D+/', replacement: '', subject: $value) ?? '';
|
||||
}
|
||||
|
||||
public static function date(string $value, string $format = 'Y-m-d'): string {
|
||||
$value = trim(string: $value);
|
||||
|
||||
if ($value === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
$date = DateTime::createFromFormat(format: "!{$format}", datetime: $value);
|
||||
|
||||
if (!$date) {
|
||||
// tenta converter qualquer formato válido
|
||||
$date = date_create(datetime: $value);
|
||||
}
|
||||
|
||||
return $date ? $date->format(format: $format) : '';
|
||||
}
|
||||
|
||||
public static function datetime(string $value, string $format = 'Y-m-d H:i:s'): string {
|
||||
$value = trim(string: $value);
|
||||
|
||||
if ($value === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
$date = DateTime::createFromFormat(format: "!{$format}", datetime: $value);
|
||||
|
||||
if (!$date) {
|
||||
$date = date_create(datetime: $value);
|
||||
}
|
||||
|
||||
return $date ? $date->format(format: $format) : '';
|
||||
}
|
||||
}
|
||||
222
app/Common/Helpers/DataValidator.php
Normal file
222
app/Common/Helpers/DataValidator.php
Normal file
@@ -0,0 +1,222 @@
|
||||
<?php
|
||||
namespace Workbloom\Helpers;
|
||||
|
||||
class DataValidator {
|
||||
private array $inputs;
|
||||
private array $errors = [];
|
||||
|
||||
public function __construct(array $inputs) {
|
||||
$this->inputs = $inputs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Valida um campo usando uma regra específica.
|
||||
*/
|
||||
public function validate(string $field, callable|string $rule, string $message = '', array $additionalParams = []): static {
|
||||
$value = $this->inputs[$field] ?? null;
|
||||
|
||||
// Se for string, monta callable usando a própria classe
|
||||
if (is_string(value: $rule) && method_exists(object_or_class: self::class, method: $rule)) {
|
||||
$rule = [self::class, $rule];
|
||||
}
|
||||
|
||||
$params = array_merge([$value], $additionalParams);
|
||||
|
||||
$result = call_user_func_array(callback: $rule, args: $params);
|
||||
|
||||
// Caso seja validação de senha (retorna array)
|
||||
if (is_array(value: $result) && isset($result['valid'])) {
|
||||
if (!$result['valid']) {
|
||||
$this->errors[$field] = [
|
||||
'status' => 'is_invalid',
|
||||
'message' => $result['errors']
|
||||
];
|
||||
}
|
||||
}
|
||||
// Para outras validações booleanas
|
||||
elseif ($result === false) {
|
||||
$this->errors[$field] = [
|
||||
'status' => 'is_invalid',
|
||||
'message' => $message
|
||||
];
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getErrors(): array {
|
||||
return $this->errors;
|
||||
}
|
||||
|
||||
public function passes(): bool {
|
||||
return empty($this->errors);
|
||||
}
|
||||
|
||||
// ---------- Regras comuns ----------
|
||||
|
||||
public static function validateEmail(string $value): bool {
|
||||
return (bool) filter_var(value: $value, filter: FILTER_VALIDATE_EMAIL);
|
||||
}
|
||||
|
||||
public static function validatePhone(string $value, int $minLength = 10, int $maxLength = 13): bool {
|
||||
$digits = preg_replace(pattern: '/\D+/', replacement: '', subject: $value);
|
||||
$len = strlen(string: $digits);
|
||||
return $len >= $minLength && $len <= $maxLength;
|
||||
}
|
||||
|
||||
public static function validateCpf(string $value): bool {
|
||||
$cpf = preg_replace(pattern: '/\D+/', replacement: '', subject: $value);
|
||||
|
||||
if (strlen(string: $cpf) !== 11 || preg_match(pattern: '/(\d)\1{10}/', subject: $cpf)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for ($t = 9; $t < 11; $t++) {
|
||||
$d = 0;
|
||||
for ($c = 0; $c < $t; $c++) {
|
||||
$d += $cpf[$c] * (($t + 1) - $c);
|
||||
}
|
||||
$d = ((10 * $d) % 11) % 10;
|
||||
if ($cpf[$c] != $d) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function validateCnpj(string $value): bool {
|
||||
// Remove qualquer máscara (pontos, barras, hífens)
|
||||
$cleanedValue = preg_replace(pattern: '/[.\-\/]/', replacement: '', subject: $value);
|
||||
|
||||
// O CNPJ sem máscara deve ter 14 caracteres (12 alfanuméricos + 2 dígitos)
|
||||
if (strlen(string: $cleanedValue) !== 14) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$cnpjBase = strtoupper(string: substr(string: $cleanedValue, offset: 0, length: 12)); // Os 12 caracteres alfanuméricos
|
||||
$dvRecebidos = substr(string: $cleanedValue, offset: 12, length: 2); // Os 2 dígitos verificadores
|
||||
|
||||
// Verifica se os dois últimos caracteres são realmente dígitos
|
||||
if (!ctype_digit(text: $dvRecebidos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mapeamento de Valor para cálculo do DV (do documento) [cite: 19]
|
||||
$mapaValores = [
|
||||
'0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9,
|
||||
'A' => 17, 'B' => 18, 'C' => 19, 'D' => 20, 'E' => 21, 'F' => 22, 'G' => 23, 'H' => 24, 'I' => 25,
|
||||
'J' => 26, 'K' => 27, 'L' => 28, 'M' => 29, 'N' => 30, 'O' => 31, 'P' => 32, 'Q' => 33, 'R' => 34,
|
||||
'S' => 35, 'T' => 36, 'U' => 37, 'V' => 38, 'W' => 39, 'X' => 40, 'Y' => 41, 'Z' => 42
|
||||
];
|
||||
|
||||
// Array de pesos de 2 a 9 (repetidos da direita para a esquerda, recomeçando depois do 8º caracter) [cite: 26, 27]
|
||||
// O documento usa [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2] para o 1º DV no exemplo de 12 caracteres [cite: 27]
|
||||
$pesos1Dv = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];
|
||||
|
||||
// Para o 2º DV, são 13 caracteres (os 12 de base + o 1º DV), e a contagem de pesos recomeça (2 a 9)
|
||||
// O documento usa [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2] para 13 caracteres no exemplo [cite: 40]
|
||||
$pesos2Dv = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];
|
||||
|
||||
$cnpjParaCalculo = $cnpjBase;
|
||||
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
$soma = 0;
|
||||
$pesos = ($i === 0) ? $pesos1Dv : $pesos2Dv;
|
||||
$tamanho = strlen(string: $cnpjParaCalculo);
|
||||
|
||||
// O documento usa os pesos na ordem da esquerda para a direita no cálculo [cite: 27, 40]
|
||||
for ($j = 0; $j < $tamanho; $j++) {
|
||||
$caractere = $cnpjParaCalculo[$j];
|
||||
$valor = $mapaValores[$caractere] ?? null;
|
||||
|
||||
// Se o caractere não for um dos mapeados (ex: um caractere especial ou minúsculo que não foi maiusculizado)
|
||||
if ($valor === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$peso = $pesos[$j];
|
||||
$soma += $valor * $peso;
|
||||
}
|
||||
|
||||
// Obter o resto da divisão do somatório por 11 [cite: 31]
|
||||
$resto = $soma % 11;
|
||||
|
||||
// Se o resto da divisão for igual a 1 ou 0, o primeiro dígito será igual a 0 (zero)[cite: 32].
|
||||
// Senão, o primeiro dígito será igual ao resultado de 11 - resto[cite: 33].
|
||||
$digitoCalculado = ($resto < 2) ? 0 : 11 - $resto;
|
||||
|
||||
$dvRecebido = (int) $dvRecebidos[$i];
|
||||
|
||||
if ($dvRecebido !== $digitoCalculado) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Para o cálculo do segundo DV, acrescentar o primeiro DV (calculado) ao final do CNPJ base [cite: 38]
|
||||
if ($i === 0) {
|
||||
$cnpjParaCalculo .= $digitoCalculado;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function notEmpty(mixed $value): bool {
|
||||
if (is_array(value: $value)) {
|
||||
return !empty(array_filter(array: $value, callback: fn($v) => $v !== null && $v !== ''));
|
||||
}
|
||||
return !empty(trim(string: (string) $value));
|
||||
}
|
||||
|
||||
public static function validatePassword(string $password, array $rules = []): array {
|
||||
$errors = [];
|
||||
|
||||
$minLength = $rules['minLength'] ?? 8;
|
||||
$maxLength = $rules['maxLength'] ?? 64;
|
||||
$requireUpper = $rules['upper'] ?? true;
|
||||
$requireLower = $rules['lower'] ?? true;
|
||||
$requireDigit = $rules['digit'] ?? true;
|
||||
$requireSymbol = $rules['symbol'] ?? true;
|
||||
|
||||
if (strlen(string: $password) < $minLength) {
|
||||
$errors[] = "Senha deve ter no mínimo {$minLength} caracteres.";
|
||||
}
|
||||
|
||||
if (strlen(string: $password) > $maxLength) {
|
||||
$errors[] = "Senha deve ter no máximo {$maxLength} caracteres.";
|
||||
}
|
||||
|
||||
if ($requireUpper && !preg_match(pattern: '/[A-Z]/', subject: $password)) {
|
||||
$errors[] = "Senha deve conter pelo menos uma letra maiúscula.";
|
||||
}
|
||||
|
||||
if ($requireLower && !preg_match(pattern: '/[a-z]/', subject: $password)) {
|
||||
$errors[] = "Senha deve conter pelo menos uma letra minúscula.";
|
||||
}
|
||||
|
||||
if ($requireDigit && !preg_match(pattern: '/\d/', subject: $password)) {
|
||||
$errors[] = "Senha deve conter pelo menos um número.";
|
||||
}
|
||||
|
||||
if ($requireSymbol && !preg_match(pattern: '/[\W_]/', subject: $password)) {
|
||||
$errors[] = "Senha deve conter pelo menos um símbolo.";
|
||||
}
|
||||
|
||||
return [
|
||||
'valid' => empty($errors),
|
||||
'errors' => $errors
|
||||
];
|
||||
}
|
||||
|
||||
public static function validateList(mixed $value, array $validOptions): bool {
|
||||
if (is_array(value: $value)) {
|
||||
foreach ($value as $item) {
|
||||
if (!in_array(needle: $item, haystack: $validOptions, strict: true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return in_array(needle: $value, haystack: $validOptions, strict: true);
|
||||
}
|
||||
}
|
||||
8
app/Common/Services/DB.php
Normal file
8
app/Common/Services/DB.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace Workbloom\Services;
|
||||
|
||||
use AxiumPHP\Core\Database;
|
||||
|
||||
class DB extends Database {
|
||||
|
||||
}
|
||||
0
app/Storage/blank_file
Normal file
0
app/Storage/blank_file
Normal file
44
composer.json
Normal file
44
composer.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "cybercore/workbloom",
|
||||
"description": "Sistema de gestão de DP e RH",
|
||||
"type": "project",
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"firebase/php-jwt": "v6.11.1",
|
||||
"vlucas/phpdotenv": "v5.6.2",
|
||||
"symfony/var-dumper": "^v6.4.26",
|
||||
"claudecio/axiumphp": "dev-dev-update-initializing",
|
||||
"ext-json": "*"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/claudecio/axiumphp"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Workbloom\\": "app/Common",
|
||||
"WorkbloomComponent\\": "app/Common/Component",
|
||||
"WorkbloomModule\\": "app/Module"
|
||||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^10.5.58",
|
||||
"squizlabs/php_codesniffer": "^3.13.4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "phpunit",
|
||||
"cs": "phpcs --standard=PSR12 src/"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Claudecio Martins",
|
||||
"email": "contato@claudecio.is-a.dev",
|
||||
"role": "Developer"
|
||||
}
|
||||
]
|
||||
}
|
||||
2503
composer.lock
generated
Normal file
2503
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
0
database/blank_file
Normal file
0
database/blank_file
Normal file
23
database/v0/actions/000_delete.sql
Normal file
23
database/v0/actions/000_delete.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
-- Dados de Usuário
|
||||
DROP TABLE IF EXISTS public.usuario_status CASCADE;
|
||||
DROP TABLE IF EXISTS public.usuario CASCADE;
|
||||
|
||||
-- Dados de Empresa
|
||||
DROP TABLE IF EXISTS public.empresa_tipo_pessoa CASCADE;
|
||||
DROP TABLE IF EXISTS public.empresa_regime_tributario CASCADE;
|
||||
DROP TABLE IF EXISTS public.empresa_tamanho CASCADE;
|
||||
DROP TABLE IF EXISTS public.empresa_faturamento_ultimo_ano CASCADE;
|
||||
DROP TABLE IF EXISTS public.empresa_tipo_unidade CASCADE;
|
||||
DROP TABLE IF EXISTS public.empresa CASCADE;
|
||||
DROP TABLE IF EXISTS public.empresa_inscricao_estadual_substituicao_tributaria CASCADE;
|
||||
DROP TABLE IF EXISTS public.empresa_certificado_digital_status CASCADE;
|
||||
DROP TABLE IF EXISTS public.empresa_certificado_digital CASCADE;
|
||||
|
||||
-- RBAC
|
||||
DROP TABLE IF EXISTS public.modulo_status CASCADE;
|
||||
DROP TABLE IF EXISTS public.modulo CASCADE;
|
||||
DROP TABLE IF EXISTS public.modulo_acao CASCADE;
|
||||
DROP TABLE IF EXISTS public.modulo_papel CASCADE;
|
||||
DROP TABLE IF EXISTS public.modulo_papel_permissao CASCADE;
|
||||
DROP TABLE IF EXISTS public.usuario_empresa_modulo CASCADE;
|
||||
DROP TABLE IF EXISTS public.usuario_permissao_override CASCADE;
|
||||
7
database/v0/migrations/000_initializing.sql
Normal file
7
database/v0/migrations/000_initializing.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
-- Exclui schemas existentes
|
||||
DROP SCHEMA IF EXISTS esocial CASCADE;
|
||||
DROP SCHEMA IF EXISTS public CASCADE;
|
||||
|
||||
-- Cria Schemas
|
||||
CREATE SCHEMA IF NOT EXISTS esocial;
|
||||
CREATE SCHEMA IF NOT EXISTS public;
|
||||
180
database/v0/migrations/001_esocial.tabelas.sql
Normal file
180
database/v0/migrations/001_esocial.tabelas.sql
Normal file
@@ -0,0 +1,180 @@
|
||||
-- ===============================================================================================================
|
||||
-- Tabela 01 - Categoria de Trabalhadores
|
||||
-- ===============================================================================================================
|
||||
CREATE TABLE IF NOT EXISTS esocial.tab_01 (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
descricao TEXT NOT NULL,
|
||||
data_inicio DATE NOT NULL,
|
||||
data_fim DATE DEFAULT NULL
|
||||
);
|
||||
|
||||
INSERT INTO esocial.tab_01 (id, descricao, data_inicio, data_fim) VALUES
|
||||
(101, 'Empregado - Geral, inclusive o empregado público da administração direta ou indireta contratado pela CLT', '2014-01-01', NULL),
|
||||
(102, 'Empregado - Trabalhador rural por pequeno prazo da Lei 11.718/2008', '2014-01-01', NULL),
|
||||
(103, 'Empregado - Aprendiz', '2014-01-01', NULL),
|
||||
(104, 'Empregado - Doméstico', '2014-01-01', NULL),
|
||||
(105, 'Empregado - Contrato a termo firmado nos termos da Lei 9.601/1998', '2014-01-01', NULL),
|
||||
(106, 'Trabalhador temporário - Contrato nos termos da Lei 6.019/1974', '2014-01-01', NULL),
|
||||
(107, 'Empregado - Contrato de trabalho Verde e Amarelo - sem acordo para antecipação mensal da multa rescisória do FGTS', '2020-01-01', '2022-12-31'),
|
||||
(108, 'Empregado - Contrato de trabalho Verde e Amarelo - com acordo para antecipação mensal da multa rescisória do FGTS', '2020-01-01', '2022-12-31'),
|
||||
(111, 'Empregado - Contrato de trabalho intermitente', '2014-01-01', NULL),
|
||||
(201, 'Trabalhador avulso portuário', '2014-01-01', NULL),
|
||||
(202, 'Trabalhador avulso não portuário', '2014-01-01', NULL),
|
||||
(301, 'Servidor público titular de cargo efetivo, magistrado, ministro de Tribunal de Contas, conselheiro de Tribunal de Contas e membro do Ministério Público', '2014-01-01', NULL),
|
||||
(302, 'Servidor público ocupante de cargo exclusivo em comissão', '2014-01-01', NULL),
|
||||
(303, 'Exercente de mandato eletivo', '2014-01-01', NULL),
|
||||
(304, 'Servidor público exercente de mandato eletivo, inclusive com exercício de cargo em comissão', '2014-01-01', NULL),
|
||||
(305, 'Servidor público indicado para conselho ou órgão deliberativo, na condição de representante do governo, órgão ou entidade da administração pública', '2014-01-01', NULL),
|
||||
(306, 'Servidor público contratado por tempo determinado, sujeito a regime administrativo especial definido em lei própria', '2014-01-01', NULL),
|
||||
(307, 'Militar dos Estados e Distrito Federal', '2014-01-01', NULL),
|
||||
(308, 'Conscrito', '2014-01-01', '2023-04-25'),
|
||||
(309, 'Agente público - Outros', '2014-01-01', NULL),
|
||||
(310, 'Servidor público eventual', '2014-01-01', NULL),
|
||||
(311, 'Ministros, juízes, procuradores, promotores ou oficiais de justiça à disposição da Justiça Eleitoral', '2014-01-01', NULL),
|
||||
(312, 'Auxiliar local', '2014-01-01', NULL),
|
||||
(313, 'Servidor público exercente de atividade de instrutoria, curso ou concurso, convocado para pareceres técnicos, depoimentos ou aditância no exterior.', '2014-01-01', NULL),
|
||||
(314, 'Militar das Forças Armadas', '2014-01-01', NULL),
|
||||
(401, 'Dirigente sindical - Informação prestada pelo sindicato', '2014-01-01', NULL),
|
||||
(410, 'Trabalhador cedido/exercício em outro órgão/juiz auxiliar - Informação prestada pelo cessionário/destino', '2014-01-01', NULL),
|
||||
(501, 'Dirigente sindical - Segurado especial', '2014-01-01', NULL),
|
||||
(701, 'Contribuinte individual - Autônomo em geral, exceto se enquadrado em uma das demais categorias de contribuinte individual', '2014-01-01', NULL),
|
||||
(711, 'Contribuinte individual - Transportador autônomo de passageiros', '2014-01-01', NULL),
|
||||
(712, 'Contribuinte individual - Transportador autônomo de carga', '2014-01-01', NULL),
|
||||
(721, 'Contribuinte individual - Diretor não empregado, com FGTS', '2014-01-01', NULL),
|
||||
(722, 'Contribuinte individual - Diretor não empregado, sem FGTS', '2014-01-01', NULL),
|
||||
(723, 'Contribuinte individual - Empresário, sócio e membro de conselho de administração ou fiscal', '2014-01-01', NULL),
|
||||
(731, 'Contribuinte individual - Cooperado que presta serviços por intermédio de cooperativa de trabalho', '2014-01-01', NULL),
|
||||
(734, 'Contribuinte individual - Transportador cooperado que presta serviços por intermédio de cooperativa de trabalho', '2014-01-01', NULL),
|
||||
(738, 'Contribuinte individual - Cooperado filiado a cooperativa de produção', '2014-01-01', NULL),
|
||||
(741, 'Contribuinte individual - Microempreendedor individual', '2014-01-01', NULL),
|
||||
(751, 'Contribuinte individual - Magistrado classista temporário da Justiça do Trabalho ou da Justiça Eleitoral que seja aposentado de qualquer regime previdenciário', '2014-01-01', NULL),
|
||||
(761, 'Contribuinte individual - Associado eleito para direção de cooperativa, associação ou entidade de classe de qualquer natureza ou finalidade, bem como o síndico ou administrador eleito para exercer atividade de direção condominial, desde que recebam remuneração', '2014-01-01', NULL),
|
||||
(771, 'Contribuinte individual - Membro de conselho tutelar, nos termos da Lei 8.069/1990', '2014-01-01', NULL),
|
||||
(781, 'Ministro de confissão religiosa ou membro de vida consagrada, de congregação ou de ordem religiosa', '2014-01-01', NULL),
|
||||
(901, 'Estagiário', '2014-01-01', NULL),
|
||||
(902, 'Médico residente, residente em área profissional de saúde ou médico em curso de formação', '2014-01-01', NULL),
|
||||
(903, 'Bolsista', '2014-01-01', NULL),
|
||||
(904, 'Participante de curso de formação, como etapa de concurso público, sem vínculo de emprego/estatutário', '2014-01-01', NULL),
|
||||
(906, 'Beneficiário do Programa Nacional de Prestação de Serviço Civil Voluntário', '2022-01-28', NULL);
|
||||
|
||||
SELECT setval(pg_get_serial_sequence('esocial.tab_01','id'), (SELECT MAX(id) FROM esocial.tab_01));
|
||||
|
||||
-- ===============================================================================================================
|
||||
-- Tabela 02 - Financiamento da Aposentadoria Especial e Redução do Tempo de Contribuição
|
||||
-- ===============================================================================================================
|
||||
CREATE TABLE IF NOT EXISTS esocial.tab_02 (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
descricao TEXT NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO esocial.tab_02 (id, descricao) VALUES
|
||||
(1, 'Não ensejador de aposentadoria especial'),
|
||||
(2, 'Ensejador de aposentadoria especial - FAE15_12% (15 anos de contribuição e alíquota de 12%)'),
|
||||
(3, 'Ensejador de aposentadoria especial - FAE20_09% (20 anos de contribuição e alíquota de 9%)'),
|
||||
(4, 'Ensejador de aposentadoria especial - FAE25_06% (25 anos de contribuição e alíquota de 6%)');
|
||||
|
||||
SELECT setval(pg_get_serial_sequence('esocial.tab_02','id'), (SELECT MAX(id) FROM esocial.tab_02));
|
||||
|
||||
-- ===============================================================================================================
|
||||
-- Tabela 03 - Natureza das Rubricas da Folha de Pagamento
|
||||
-- ===============================================================================================================
|
||||
CREATE TABLE IF NOT EXISTS esocial.tab_03 (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
nome VARCHAR(255) NOT NULL,
|
||||
descricao TEXT DEFAULT NULL,
|
||||
data_inicio DATE NOT NULL,
|
||||
data_fim DATE DEFAULT NULL,
|
||||
incide_cp SMALLINT DEFAULT 0
|
||||
);
|
||||
|
||||
-- ===============================================================================================================
|
||||
-- Tabela 04 - Códigos e Alíquotas de FPAS / Terceiros
|
||||
-- ===============================================================================================================
|
||||
CREATE TABLE IF NOT EXISTS esocial.tab_04_fpas (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
codigo VARCHAR(10) UNIQUE NOT NULL,
|
||||
descricao TEXT NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS esocial.tab_04_grupo (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
fpas_id BIGINT NOT NULL REFERENCES esocial.tab_04_fpas(id) ON DELETE CASCADE,
|
||||
nome VARCHAR(100) NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS esocial.tab_04_item (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
grupo_id BIGINT NOT NULL REFERENCES esocial.tab_04_grupo(id) ON DELETE CASCADE,
|
||||
base_calculo VARCHAR(255) DEFAULT NULL,
|
||||
descricao VARCHAR(255) NOT NULL,
|
||||
codigo_terceiro VARCHAR(10) NOT NULL,
|
||||
aliquota DECIMAL(6,2) NOT NULL,
|
||||
is_total BOOLEAN DEFAULT FALSE,
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- FPAS principal
|
||||
INSERT INTO esocial.tab_04_fpas (id, codigo, descricao) VALUES
|
||||
(1, '507', 'Terceiros - Incidência sobre folha de salários'),
|
||||
(2, '508', 'Terceiros - Outros FPAS Exemplo'); -- adicione outros FPAS se necessário
|
||||
|
||||
-- Grupos dentro do FPAS 507
|
||||
INSERT INTO esocial.tab_04_grupo (id, fpas_id, nome) VALUES
|
||||
(1, 1, 'Contribuição Patronal Previdenciária'),
|
||||
(2, 1, 'Segurados em Condições Especiais'),
|
||||
(3, 1, 'Contribuição Terceiros');
|
||||
|
||||
-- Itens do grupo 1 - Contribuição Patronal Previdenciária
|
||||
INSERT INTO esocial.tab_04_item (id, grupo_id, base_calculo, descricao, codigo_terceiro, aliquota, is_total) VALUES
|
||||
(1, 1, 'Salário de Contribuição', 'INSS Patronal', '100', 20.00, FALSE),
|
||||
(2, 1, 'Salário de Contribuição', 'INSS Patronal – RAT', '101', 1.00, FALSE),
|
||||
(3, 1, 'Salário de Contribuição', 'INSS Patronal – Terceiros', '102', 5.80, FALSE),
|
||||
(4, 1, 'Salário de Contribuição', 'INSS Patronal – Total', '999', 26.80, TRUE);
|
||||
|
||||
-- Itens do grupo 2 - Segurados em Condições Especiais
|
||||
INSERT INTO esocial.tab_04_item (id, grupo_id, base_calculo, descricao, codigo_terceiro, aliquota, is_total) VALUES
|
||||
(5, 2, 'Salário de Contribuição', 'INSS Especial - Aposentadoria Especial 15 anos', '200', 12.00, FALSE),
|
||||
(6, 2, 'Salário de Contribuição', 'INSS Especial - Aposentadoria Especial 20 anos', '201', 9.00, FALSE),
|
||||
(7, 2, 'Salário de Contribuição', 'INSS Especial - Aposentadoria Especial 25 anos', '202', 6.00, FALSE);
|
||||
|
||||
-- Itens do grupo 3 - Contribuição Terceiros
|
||||
INSERT INTO esocial.tab_04_item (id, grupo_id, base_calculo, descricao, codigo_terceiro, aliquota, is_total) VALUES
|
||||
(8, 3, 'Salário de Contribuição', 'SESI', '300', 1.50, FALSE),
|
||||
(9, 3, 'Salário de Contribuição', 'SENAI', '301', 1.00, FALSE),
|
||||
(10, 3, 'Salário de Contribuição', 'SESC', '302', 0.50, FALSE),
|
||||
(11, 3, 'Salário de Contribuição', 'TOTAL TERCEIROS', '999', 3.00, TRUE);
|
||||
|
||||
-- Tabelas do FPAS / Terceiros
|
||||
SELECT setval(pg_get_serial_sequence('esocial.tab_04_fpas','id'), (SELECT MAX(id) FROM esocial.tab_04_fpas));
|
||||
SELECT setval(pg_get_serial_sequence('esocial.tab_04_grupo','id'), (SELECT MAX(id) FROM esocial.tab_04_grupo));
|
||||
SELECT setval(pg_get_serial_sequence('esocial.tab_04_item','id'), (SELECT MAX(id) FROM esocial.tab_04_item));
|
||||
|
||||
-- Índices para otimização de consultas
|
||||
CREATE INDEX IF NOT EXISTS idx_tab_04_fpas_codigo ON esocial.tab_04_fpas (codigo);
|
||||
CREATE INDEX IF NOT EXISTS idx_tab_04_grupo_fpas_id ON esocial.tab_04_grupo (fpas_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_tab_04_item_grupo_id ON esocial.tab_04_item (grupo_id);
|
||||
|
||||
-- ===============================================================================================================
|
||||
-- Tabela 05 - Tipos de Inscrição
|
||||
-- ===============================================================================================================
|
||||
CREATE TABLE IF NOT EXISTS esocial.tab_05 (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
descricao VARCHAR(255) NOT NULL
|
||||
);
|
||||
|
||||
-- Inserindo os dados
|
||||
INSERT INTO esocial.tab_05 (id, descricao) VALUES
|
||||
(1, 'CNPJ (Cadastro Nacional da Pessoa Jurídica)'),
|
||||
(2, 'CPF (Cadastro de Pessoas Físicas)'),
|
||||
(3, 'CAEPF (Cadastro de Atividade Econômica de Pessoa Física)'),
|
||||
(4, 'CNO (Cadastro Nacional de Obra)'),
|
||||
(5, 'CGC (Cadastro Geral de Contribuintes)'),
|
||||
(6, 'CEI (Cadastro Específico do INSS)');
|
||||
|
||||
-- Atualizando a sequência depois do insert
|
||||
SELECT setval(pg_get_serial_sequence('esocial.tab_05','id'), (SELECT MAX(id) FROM esocial.tab_05));
|
||||
105
database/v0/migrations/002_public.empresa.sql
Normal file
105
database/v0/migrations/002_public.empresa.sql
Normal file
@@ -0,0 +1,105 @@
|
||||
-- ===============================================================================================================
|
||||
-- Status da Empresa
|
||||
-- ===============================================================================================================
|
||||
CREATE TABLE IF NOT EXISTS public.empresa_status (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
descricao VARCHAR(255) NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO public.empresa_status (id, descricao) VALUES
|
||||
(1, 'Ativa'),
|
||||
(2, 'Inativa'),
|
||||
(3, 'Pendente'),
|
||||
(4, 'Suspensa');
|
||||
|
||||
SELECT setval(pg_get_serial_sequence('public.empresa_status','id'), (SELECT MAX(id) FROM public.empresa_status));
|
||||
|
||||
-- ===============================================================================================================
|
||||
-- Empresa Tipo Unidade
|
||||
-- ===============================================================================================================
|
||||
CREATE TABLE IF NOT EXISTS public.empresa_tipo_unidade (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
descricao VARCHAR(255) NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO public.empresa_tipo_unidade (id, descricao) VALUES
|
||||
(1, 'Matriz'),
|
||||
(2, 'Filial');
|
||||
|
||||
SELECT setval(pg_get_serial_sequence('public.empresa_tipo_unidade','id'), (SELECT MAX(id) FROM public.empresa_tipo_unidade));
|
||||
|
||||
-- ===============================================================================================================
|
||||
-- Empresa
|
||||
-- ===============================================================================================================
|
||||
CREATE TABLE IF NOT EXISTS public.empresa (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
uuid UUID NOT NULL UNIQUE,
|
||||
status_id BIGINT NOT NULL DEFAULT 1 REFERENCES public.empresa_status(id) ON UPDATE CASCADE ON DELETE RESTRICT,
|
||||
|
||||
-- Dados da Empresa
|
||||
tipo_unidade_id BIGINT NOT NULL DEFAULT 1 REFERENCES public.empresa_tipo_unidade(id) ON UPDATE CASCADE ON DELETE RESTRICT,
|
||||
razao_social VARCHAR(255) NOT NULL,
|
||||
nome_fantasia VARCHAR(255) DEFAULT NULL,
|
||||
inscricao_tipo_id BIGINT DEFAULT 1 NOT NULL REFERENCES esocial.tab_05(id) ON UPDATE CASCADE ON DELETE RESTRICT,
|
||||
document_inscricao VARCHAR(20) NOT NULL UNIQUE,
|
||||
inscricao_raiz VARCHAR(20) NOT NULL,
|
||||
|
||||
-- Endereço
|
||||
endereco_codigo_ibge BIGINT DEFAULT NULL,
|
||||
endereco_cep VARCHAR(10) DEFAULT NULL,
|
||||
endereco_logradouro VARCHAR(255) DEFAULT NULL,
|
||||
endereco_numero VARCHAR(20) DEFAULT NULL,
|
||||
endereco_complemento VARCHAR(255) DEFAULT NULL,
|
||||
endereco_bairro VARCHAR(100) DEFAULT NULL,
|
||||
endereco_cidade VARCHAR(100) DEFAULT NULL,
|
||||
endereco_estado VARCHAR(2) DEFAULT NULL,
|
||||
|
||||
-- Contato
|
||||
contato_email VARCHAR(255) DEFAULT NULL,
|
||||
contato_celular VARCHAR(20) DEFAULT NULL,
|
||||
contato_telefone VARCHAR(20) DEFAULT NULL,
|
||||
responsavel_nome VARCHAR(255) DEFAULT NULL,
|
||||
responsavel_cargo VARCHAR(100) DEFAULT NULL,
|
||||
responsavel_email VARCHAR(255) DEFAULT NULL,
|
||||
responsavel_telefone VARCHAR(20) DEFAULT NULL,
|
||||
responsavel_document_cpf CHAR(11) DEFAULT NULL,
|
||||
|
||||
-- Metadados
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT NULL,
|
||||
deleted_at TIMESTAMP DEFAULT NULL
|
||||
);
|
||||
|
||||
-- ===============================================================================================================
|
||||
-- Empresa Certificado Digital
|
||||
-- ===============================================================================================================
|
||||
CREATE TABLE IF NOT EXISTS public.empresa_certificado_digital (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
uuid UUID NOT NULL UNIQUE,
|
||||
|
||||
-- Dados do Certificado Digital
|
||||
tipo_certificado CHAR(2) NOT NULL DEFAULT 'A1',
|
||||
distinguished_name VARCHAR(255) NOT NULL,
|
||||
categoria_certificado VARCHAR(100) NOT NULL DEFAULT 'e-CNPJ',
|
||||
issued_in TIMESTAMP NOT NULL,
|
||||
expires_in TIMESTAMP NOT NULL,
|
||||
file_path TEXT DEFAULT NULL,
|
||||
file_hash CHAR(64) DEFAULT NULL,
|
||||
senha_hash TEXT DEFAULT NULL,
|
||||
pin_hash TEXT DEFAULT NULL,
|
||||
numero_serie VARCHAR(100) NOT NULL UNIQUE,
|
||||
|
||||
-- Metadados
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT NULL,
|
||||
deleted_at TIMESTAMP DEFAULT NULL
|
||||
);
|
||||
|
||||
-- ===============================================================================================================
|
||||
-- Empresa Certificado
|
||||
-- ===============================================================================================================
|
||||
CREATE TABLE IF NOT EXISTS public.empresa_has_certificado_digital (
|
||||
empresa_id BIGINT NOT NULL REFERENCES public.empresa(id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
certificado_digital_id BIGINT NOT NULL REFERENCES public.empresa_certificado_digital(id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
PRIMARY KEY (empresa_id, certificado_digital_id)
|
||||
);
|
||||
64
database/v0/migrations/003_usuario.sql
Normal file
64
database/v0/migrations/003_usuario.sql
Normal file
@@ -0,0 +1,64 @@
|
||||
-- ===============================================================
|
||||
-- Status do Usuário
|
||||
-- ===============================================================
|
||||
CREATE TABLE IF NOT EXISTS public.usuario_status (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
descricao VARCHAR(100) NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO public.usuario_status (id, descricao) VALUES
|
||||
(1, 'Ativo'),
|
||||
(2, 'Inativo'),
|
||||
(3, 'Pendente'),
|
||||
(4, 'Suspenso');
|
||||
|
||||
SELECT setval(pg_get_serial_sequence('public.usuario_status','id'), (SELECT MAX(id) FROM public.usuario_status));
|
||||
|
||||
-- ===============================================================
|
||||
-- Usuário
|
||||
-- ===============================================================
|
||||
CREATE TABLE IF NOT EXISTS public.usuario (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
uuid UUID NOT NULL UNIQUE,
|
||||
status_id BIGINT NOT NULL DEFAULT 1 REFERENCES public.usuario_status(id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
is_root SMALLINT NOT NULL DEFAULT 0,
|
||||
nome_completo VARCHAR(255) NOT NULL,
|
||||
nome_usuario VARCHAR(50) NOT NULL UNIQUE,
|
||||
email VARCHAR(255) NOT NULL UNIQUE,
|
||||
senha_hash VARCHAR(255) NOT NULL,
|
||||
need_update_password SMALLINT NOT NULL DEFAULT 1,
|
||||
days_to_expire_password BIGINT NOT NULL DEFAULT 60,
|
||||
last_password_update TIMESTAMP DEFAULT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT NULL,
|
||||
deleted_at TIMESTAMP DEFAULT NULL
|
||||
);
|
||||
|
||||
INSERT INTO public.usuario (id, uuid, status_id, is_root, nome_completo, nome_usuario, email, senha_hash, need_update_password, days_to_expire_password, last_password_update) VALUES
|
||||
(1, '0199f8dd-3a65-7c11-bdf2-ba3294f4c28e', 1, 1, 'Claudecio Martins', 'cjunior', 'contato@claudecio.is-a.dev', '$argon2id$v=19$m=65536,t=4,p=1$cFFXL3VVREREM1R5Szg1Nw$K6u1cUbTCeTMDHT3iP93uRtMfc5PXX6NpC1C2I5peHc', -1, -1, NULL);
|
||||
|
||||
SELECT setval(pg_get_serial_sequence('public.usuario','id'), (SELECT MAX(id) FROM public.usuario));
|
||||
|
||||
-- ===============================================================
|
||||
-- Token Acesso Usuário
|
||||
-- ===============================================================
|
||||
CREATE TABLE IF NOT EXISTS public.usuario_token (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
usuario_id BIGINT NOT NULL REFERENCES public.usuario(id) ON UPDATE CASCADE ON DELETE RESTRICT,
|
||||
usuario_ip VARCHAR(45) NOT NULL,
|
||||
usuario_user_agent TEXT NOT NULL,
|
||||
token TEXT NOT NULL UNIQUE,
|
||||
is_revoked SMALLINT NOT NULL DEFAULT 0,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
expires_at TIMESTAMP NOT NULL,
|
||||
revoked_at TIMESTAMP DEFAULT NULL
|
||||
);
|
||||
|
||||
-- ===============================================================
|
||||
-- Relacionamento USUARIO <-> EMPRESA Para quais empresas o usuario tem acesso
|
||||
-- ===============================================================
|
||||
CREATE TABLE IF NOT EXISTS public.usuario_empresa (
|
||||
empresa_id BIGINT NOT NULL REFERENCES public.empresa(id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
usuario_id BIGINT NOT NULL REFERENCES public.usuario(id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
PRIMARY KEY (empresa_id, usuario_id)
|
||||
);
|
||||
10
public/.htaccess
Executable file
10
public/.htaccess
Executable file
@@ -0,0 +1,10 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
|
||||
# Se não for arquivo nem pasta, manda tudo pro index.php
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
||||
54
public/index.php
Executable file
54
public/index.php
Executable file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
// Importa autoload do Composer
|
||||
require_once realpath(path: __DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
use AxiumPHP\AxiumPHP;
|
||||
use Workbloom\Config\Config;
|
||||
|
||||
// ============================
|
||||
// Configurações globais
|
||||
// ============================
|
||||
$Config = Config::getInstance();
|
||||
|
||||
// ============================
|
||||
// Inicializa AxiumPHP com configs
|
||||
// ============================
|
||||
$axiumPHP = new AxiumPHP(config: [
|
||||
'errors' => [
|
||||
'display_errors' => 1,
|
||||
'display_startup_errors' => 1,
|
||||
'log_errors' => 1,
|
||||
'error_log' => realpath(path: __DIR__ . '/../app/Storage/Logs/php-error.log'),
|
||||
'error_reporting' => E_ALL
|
||||
],
|
||||
'constants' => [
|
||||
'ROUTER_MODE' => 'JSON', // JSON
|
||||
'APP_SYS_MODE' => 'DEV', // DEV | PROD
|
||||
'ROOT_SYSTEM_PATH' => realpath(path: __DIR__ . "/.."),
|
||||
'INI_SYSTEM_PATH' => realpath(path: __DIR__ . "/../app"),
|
||||
'MODULE_PATH' => realpath(path: __DIR__ . "/../app/Module"),
|
||||
'STORAGE_FOLDER_PATH' => realpath(path: __DIR__ . "/../app/Storage"),
|
||||
'COMPONENT_PATH' => realpath(path: __DIR__ . "/../app/Common/Component"),
|
||||
'ROUTER_ALLOWED_ORIGINS' => [
|
||||
'*'
|
||||
]
|
||||
],
|
||||
'system' => [
|
||||
'enable_session' => true,
|
||||
'default_timezone' => 'America/Fortaleza',
|
||||
],
|
||||
'logger' => [
|
||||
'driver' => 'FILE',
|
||||
'logDir' => realpath(path: __DIR__ . '/../app/Storage/Logs')
|
||||
]
|
||||
]);
|
||||
|
||||
// ============================
|
||||
// Carrega componentes
|
||||
// ============================
|
||||
require COMPONENT_PATH . "/Auth/bootstrap.php";
|
||||
|
||||
// ============================
|
||||
// Dispara o roteador
|
||||
// ============================
|
||||
$axiumPHP->routerDispatch();
|
||||
0
storage/blank_file
Normal file
0
storage/blank_file
Normal file
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user