diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 5ce73e2..0000000 --- a/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -vendor/* -composer.lock -*.key -*.pub -index.php -tests.php diff --git a/README.md b/README.md deleted file mode 100644 index 04aa0a8..0000000 --- a/README.md +++ /dev/null @@ -1,290 +0,0 @@ -## KORE PHP LIB ## - - -## Índice - -- [Classe: `PIX`](#classe-pix) -- [Função: `pixCobrancaDinamicoImediataSemValor`](#função-pixcobrancadinamicoimediatasemvalor) -- [Função: `pixCobrancaDinamicoImediataComValor`](#função-pixcobrancadinamicoimediatacomvalor) -- [Função: `pixCobrancaDinamicoImediataSaqueComValor`](#função-pixcobrancadinamicoimediatasaquecomvalor) -- [Função: `pixCobrancaDinamicoImediataSaqueSemValor`](#função-pixcobrancadinamicoimediatasaquesemvalor) -- [Função: `pixCobrancaDinamicoImediataTrocoComValor`](#função-pixcobrancadinamicoimediatatrococomvalor) -- [Função: `pixCobrancaDinamicoImediataTrocoSemValor`](#função-pixcobrancadinamicoimediatatrocosemvalor) -- [Função: `pixCobrancaEstatico`](#função-pixcobrancaestatico) - -### Classe: `PIX` - -**Descrição:** -Classe padrão para consumo das funções de PIX do Kore, utilizado para gerar cobranças, transferir valores e etc. - -**Como Usar** -```php -$class = new \Kontrl\PhpKore\Pix($priv, $drone, $environment); -``` - -**Parâmetros:** - -| Nome | Tipo | Obrigatório | Descrição | -|----------------|--------|-------------|--------------------------------------------------------------------------| -| `$priv` | string | Sim | Chave privada para assinatura da requisição | -| `$drone` | string | Sim | ID do drone gerado e fornecido pela Kontrl | -| `$environment` | string | Não | Ambiente a ser utilizado - Aceito: **PROD** ou **DEV** - Padrão: **DEV** | - - - -### Função: `pixCobrancaDinamicoImediataSemValor` - -**Descrição:** -Gera uma cobrança PIX dinâmica e imediata sem valor predefinido, ou com valor sugerido. O usuário pagador poderá alterar o valor na hora do pagamento. - -**Como usar:** -```php -$class = new \Kontrl\PhpKore\Pix($priv, $drone, 'DEV'); -$class->pixCobrancaDinamicoImediataSemValor($dados); -``` - -**Parâmetros:** - -| Nome | Tipo | Obrigatório | Padrão | Descrição | -|----------|-------|-------------|--------|-----------------------------------------------------------------| -| `$dados` | array | Sim | — | Um array com os dados a serem enviados para geração da cobrança | - -**Dados:** - -| Chave | Tipo | Obrigatório | Descrição | Exemplo | -|----------------------|--------|-------------------------------------------|--------------------------------|-------------------------| -| `expiracao` | int | Sim | Tempo de expiração em segundos | `3600` | -| `devedor.documento` | string | Não | Documento do pagador | `"09432312054"` | -| `devedor.nome` | string | Não, somente se o documento for informado | Nome do pagador | `"Fulano da Silva"` | -| `valor` | int | Não | Valor sugerido | `10000` (R$100,00) | -| `chave` | string | Sim | Chave Pix de destino | `"12345678911"` | -| `txid` | string | Sim | Identificador da transação | `"098765432111"` | -| `solicitacaoPagador` | string | Não | Mensagem opcional ao pagador | `"Mensagem ao usuário"` | - -**Retorno:** -Tipo: `array` - -**Notas adicionais:** -- Lança `Exception` se algum dado obrigatório do array estiver vazio ou inválido. - - -### Função: `pixCobrancaDinamicoImediataComValor` - -**Descrição:** -Gera uma cobrança PIX dinâmica e imediata com valor predefinido, o usuário pagador não poderá alterar o valor ao efetuar o pagamento. - -**Como usar:** -```php -$class = new \Kontrl\PhpKore\Pix($priv, $drone, 'DEV'); -$class->pixCobrancaDinamicoImediataComValor($dados); -``` - -**Parâmetros:** - -| Nome | Tipo | Obrigatório | Padrão | Descrição | -|----------|-------|-------------|--------|-----------------------------------------------------------------| -| `$dados` | array | Sim | — | Um array com os dados a serem enviados para geração da cobrança | - -**Dados:** - -| Chave | Tipo | Obrigatório | Descrição | Exemplo | -|----------------------|--------|-------------------------------------------|--------------------------------|-------------------------| -| `expiracao` | int | Sim | Tempo de expiração em segundos | `3600` | -| `devedor.documento` | string | Não | Documento do pagador | `"09432312054"` | -| `devedor.nome` | string | Não, somente se o documento for informado | Nome do pagador | `"Fulano da Silva"` | -| `valor` | int | Sim | Valor sugerido | `10000` (R$100,00) | -| `chave` | string | Sim | Chave Pix de destino | `"12345678911"` | -| `txid` | string | Sim | Identificador da transação | `"098765432111"` | -| `solicitacaoPagador` | string | Não | Mensagem opcional ao pagador | `"Mensagem ao usuário"` | - -**Retorno:** -Tipo: `array` - -**Notas adicionais:** -- Lança `Exception` se algum dado obrigatório do array estiver vazio ou inválido. - - -### Função: `pixCobrancaDinamicoImediataSaqueComValor` - -**Descrição:** -Gera uma cobrança PIX dinâmica e imediata para SAQUE com valor predefinido, o usuário pagador não poderá alterar o valor ao efetuar o pagamento. - -**Como usar:** -```php -$class = new \Kontrl\PhpKore\Pix($priv, $drone, 'DEV'); -$class->pixCobrancaDinamicoImediatoSaqueComValor($dados); -``` - -**Parâmetros:** - -| Nome | Tipo | Obrigatório | Padrão | Descrição | -|----------|-------|-------------|--------|-----------------------------------------------------------------| -| `$dados` | array | Sim | — | Um array com os dados a serem enviados para geração da cobrança | - -**Dados:** - -| Chave | Tipo | Obrigatório | Descrição | Exemplo | -|----------------------|--------|-------------------------------------------|--------------------------------------------------------------------------------------------------------------|-------------------------| -| `expiracao` | int | Sim | Tempo de expiração em segundos | `3600` | -| `devedor.documento` | string | Não | Documento do pagador | `"09432312054"` | -| `devedor.nome` | string | Não, somente se o documento for informado | Nome do pagador | `"Fulano da Silva"` | -| `valor` | int | Sim | Valor do saque | `10000` (R$100,00) | -| `chave` | string | Sim | Chave Pix de destino | `"12345678911"` | -| `txid` | string | Sim | Identificador da transação | `"098765432111"` | -| `solicitacaoPagador` | string | Não | Mensagem opcional ao pagador | `"Mensagem ao usuário"` | -| `ispb` | string | Sim | ISPB da instituição do prestador de serviço do saque | `"33233"` | -| `modalidadeAgente` | string | Sim | Indica a modalidade do agente a qual se dará a facilitação do serviço. DEVE SER: "agtot", "agtec" ou "agpss" | `"agtot"` | - -**Retorno:** -Tipo: `array` - -**Notas adicionais:** -- Lança `Exception` se algum dado obrigatório do array estiver vazio ou inválido. - - -### Função: `pixCobrancaDinamicoImediataSaqueSemValor` - -**Descrição:** -Gera uma cobrança PIX dinâmica e imediata para SAQUE sem valor predefinido, o usuário pagador poderá alterar o valor ao efetuar o pagamento. - -**Como usar:** -```php -$class = new \Kontrl\PhpKore\Pix($priv, $drone, 'DEV'); -$class->pixCobrancaDinamicoImediatoSaqueSemValor($dados); -``` - -**Parâmetros:** - -| Nome | Tipo | Obrigatório | Padrão | Descrição | -|----------|-------|-------------|--------|-----------------------------------------------------------------| -| `$dados` | array | Sim | — | Um array com os dados a serem enviados para geração da cobrança | - -**Dados:** - -| Chave | Tipo | Obrigatório | Descrição | Exemplo | -|----------------------|--------|-------------------------------------------|--------------------------------------------------------------------------------------------------------------|-------------------------| -| `expiracao` | int | Sim | Tempo de expiração em segundos | `3600` | -| `devedor.documento` | string | Não | Documento do pagador | `"09432312054"` | -| `devedor.nome` | string | Não, somente se o documento for informado | Nome do pagador | `"Fulano da Silva"` | -| `valor` | int | Não | Valor sugerido | `10000` (R$100,00) | -| `chave` | string | Sim | Chave Pix de destino | `"12345678911"` | -| `txid` | string | Sim | Identificador da transação | `"098765432111"` | -| `solicitacaoPagador` | string | Não | Mensagem opcional ao pagador | `"Mensagem ao usuário"` | -| `ispb` | string | Sim | ISPB da instituição do prestador de serviço do saque | `"33233"` | -| `modalidadeAgente` | string | Sim | Indica a modalidade do agente a qual se dará a facilitação do serviço. DEVE SER: "agtot", "agtec" ou "agpss" | `"agtot"` | - -**Retorno:** -Tipo: `array` - -**Notas adicionais:** -- Lança `Exception` se algum dado obrigatório do array estiver vazio ou inválido. - - - -### Função: `pixCobrancaDinamicoImediataTrocoComValor` - -**Descrição:** -Gera uma cobrança PIX dinâmica e imediata para TROCO com valor predefinido, o usuário pagador não poderá alterar o valor ao efetuar o pagamento. - -**Como usar:** -```php -$class = new \Kontrl\PhpKore\Pix($priv, $drone, 'DEV'); -$class->pixCobrancaDinamicoImediatoTrocoComValor($dados); -``` - -**Parâmetros:** - -| Nome | Tipo | Obrigatório | Padrão | Descrição | -|----------|-------|-------------|--------|-----------------------------------------------------------------| -| `$dados` | array | Sim | — | Um array com os dados a serem enviados para geração da cobrança | - -**Dados:** - -| Chave | Tipo | Obrigatório | Descrição | Exemplo | -|----------------------|--------|-------------------------------------------|-----------------------------------------------------------------------------------------------------|-------------------------| -| `expiracao` | int | Sim | Tempo de expiração em segundos | `3600` | -| `devedor.documento` | string | Não | Documento do pagador | `"09432312054"` | -| `devedor.nome` | string | Não, somente se o documento for informado | Nome do pagador | `"Fulano da Silva"` | -| `valor` | int | Sim | Valor do troco | `10000` (R$100,00) | -| `chave` | string | Sim | Chave Pix de destino | `"12345678911"` | -| `txid` | string | Sim | Identificador da transação | `"098765432111"` | -| `solicitacaoPagador` | string | Não | Mensagem opcional ao pagador | `"Mensagem ao usuário"` | -| `ispb` | string | Sim | ISPB da instituição do prestador de serviço do troco | `"33233"` | -| `modalidadeAgente` | string | Sim | Indica a modalidade do agente a qual se dará a facilitação do serviço. DEVE SER: "agtot" ou "agtec" | `"agtot"` | - -**Retorno:** -Tipo: `array` - -**Notas adicionais:** -- Lança `Exception` se algum dado obrigatório do array estiver vazio ou inválido. - - -### Função: `pixCobrancaDinamicoImediataTrocoSemValor` - -**Descrição:** -Gera uma cobrança PIX dinâmica e imediata para TROCO sem valor predefinido, o usuário pagador poderá alterar o valor ao efetuar o pagamento. - -**Como usar:** -```php -$class = new \Kontrl\PhpKore\Pix($priv, $drone, 'DEV'); -$class->pixCobrancaDinamicoImediatoTrocoSemValor($dados); -``` - -**Parâmetros:** - -| Nome | Tipo | Obrigatório | Padrão | Descrição | -|----------|-------|-------------|--------|-----------------------------------------------------------------| -| `$dados` | array | Sim | — | Um array com os dados a serem enviados para geração da cobrança | - -**Dados:** - -| Chave | Tipo | Obrigatório | Descrição | Exemplo | -|----------------------|--------|-------------------------------------------|-----------------------------------------------------------------------------------------------------|-------------------------| -| `expiracao` | int | Sim | Tempo de expiração em segundos | `3600` | -| `devedor.documento` | string | Não | Documento do pagador | `"09432312054"` | -| `devedor.nome` | string | Não, somente se o documento for informado | Nome do pagador | `"Fulano da Silva"` | -| `valor` | int | Não | Valor sugerido | `10000` (R$100,00) | -| `chave` | string | Sim | Chave Pix de destino | `"12345678911"` | -| `txid` | string | Sim | Identificador da transação | `"098765432111"` | -| `solicitacaoPagador` | string | Não | Mensagem opcional ao pagador | `"Mensagem ao usuário"` | -| `ispb` | string | Sim | ISPB da instituição do prestador de serviço do troco | `"33233"` | -| `modalidadeAgente` | string | Sim | Indica a modalidade do agente a qual se dará a facilitação do serviço. DEVE SER: "agtot" ou "agtec" | `"agtot"` | - -**Retorno:** -Tipo: `array` - -**Notas adicionais:** -- Lança `Exception` se algum dado obrigatório do array estiver vazio ou inválido. - - -### Função: `pixCobrancaEstatico` - -**Descrição:** -Gera uma cobrança PIX estática com ou sem valor predefinido. - -**Como usar:** -```php -$class = new \Kontrl\PhpKore\Pix($priv, $drone, 'DEV'); -$class->pixCobrancaEstatico($dados); -``` - -**Parâmetros:** - -| Nome | Tipo | Obrigatório | Padrão | Descrição | -|----------|-------|-------------|--------|-----------------------------------------------------------------| -| `$dados` | array | Sim | — | Um array com os dados a serem enviados para geração da cobrança | - -**Dados:** - -| Chave | Tipo | Obrigatório | Descrição | Exemplo | -|----------------------|--------|-------------------------------------------|--------------------------------|-------------------------| -| `valor` | int | Não | Valor sugerido | `10000` (R$100,00) | -| `chave` | string | Sim | Chave Pix de destino | `"12345678911"` | -| `txid` | string | Sim | Identificador da transação | `"098765432111"` | -| `solicitacaoPagador` | string | Não | Mensagem opcional ao pagador | `"Mensagem ao usuário"` | - -**Retorno:** -Tipo: `array` - -**Notas adicionais:** -- Lança `Exception` se algum dado obrigatório do array estiver vazio ou inválido. diff --git a/composer.json b/composer.json index e4787ba..e0023a0 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,5 @@ "email": "me@bacarin.dev" } ], - "require": { - "phpseclib/phpseclib": "~3.0" - } + "require": {} } diff --git a/src/Kore.php b/src/Kore.php index 0842515..6c8b403 100644 --- a/src/Kore.php +++ b/src/Kore.php @@ -2,31 +2,27 @@ namespace Kontrl\PhpKore; -use phpseclib3\Crypt\PublicKeyLoader; - class Kore { - public $url = 'https://stage.kore.kontrl.tech'; - public $privateKey; - public $drone; - public function __construct($privateKey, $drone, $environment = 'DEV') { - $this->privateKey = $privateKey; - $this->drone = $drone; - if ($environment == 'PROD'){ - $this->url = 'https://kore.kontrl.tech'; - } + private $url = 'https://httpbin.org'; + private $token; + + public function __construct(){ + $this->token = $this->auth(); } - public function signBody($body, $password = false) - { - $privateKey = PublicKeyLoader::loadPrivateKey(base64_decode($this->privateKey), $password); - $sig = $privateKey->sign(json_encode($body)); - return base64_encode($sig); + public function auth(){ + return ''; + } + + public function testRequest(){ + return [ + 'get' => curlRequest($this->url.'/get', 'GET')['status'], + 'post' => curlRequest($this->url.'/post', 'POST', [], [], ['test' => 'test'])['status'], + 'patch' => curlRequest($this->url.'/patch', 'PATCH', [], [], ['test' => 'test'])['status'], + 'put' => curlRequest($this->url.'/put', 'PUT', [], [], ['test' => 'test'])['status'], + 'delete' => curlRequest($this->url.'/delete', 'DELETE')['status'] + ]; } - public function verifySignature($signature, $message, $key) - { - $publicKey = PublicKeyLoader::loadPublicKey($key); - return $publicKey->verify(json_encode($message), $signature); - } } diff --git a/src/Pix.php b/src/Pix.php deleted file mode 100644 index 8e9a0d2..0000000 --- a/src/Pix.php +++ /dev/null @@ -1,281 +0,0 @@ - [ - 'expiracao' => $payload['expiracao'] ?? 86400, - ], - 'valor' => [ - 'original' => $payload['valor'], - 'modalidadeAlteracao' => 0, - ], - 'chave' => $payload['chave'], - 'txid' => $payload['txid'], - 'solicitacaoPagador' => $payload['solicitacaoPagador'] ?? null - ]; - - if (isset($payload['devedor'])) { - if (strlen($payload['devedor']['documento']) > 11) { - $korePayload['devedor']['cnpj'] = $payload['devedor']['documento']; - } else { - $korePayload['devedor']['cpf'] = $payload['devedor']['documento']; - } - $korePayload['devedor']['nome'] = $payload['devedor']; - } - - return curlRequest( - $this->url . '/post', - 'POST', - [], - [ - 'x-kore-drone-uid: drone:' . $this->drone, - 'x-kore-drone-sign: ' . $this->signBody($korePayload) - ], - $payload - ); - } - - public function pixCobrancaDinamicoImediataSemValor($payload) - { - pixCobrancaImediataSemValorRules($payload); - $korePayload = [ - 'calendario' => [ - 'expiracao' => $payload['expiracao'] ?? 86400, - ], - 'valor' => [ - 'original' => $payload['valor'] ?? 0, - 'modalidadeAlteracao' => 1, - ], - 'chave' => $payload['chave'], - 'txid' => $payload['txid'], - 'solicitacaoPagador' => $payload['solicitacaoPagador'] ?? null - ]; - - if (isset($payload['devedor'])) { - if (strlen($payload['devedor']['documento']) > 11) { - $korePayload['devedor']['cnpj'] = $payload['devedor']['documento']; - } else { - $korePayload['devedor']['cpf'] = $payload['devedor']['documento']; - } - $korePayload['devedor']['nome'] = $payload['devedor']; - } - - return curlRequest( - $this->url . '/post', - 'POST', - [], - [ - 'x-kore-drone-uid: drone:' . $this->drone, - 'x-kore-drone-sign: ' . $this->signBody($korePayload) - ], - $payload - ); - } - - - public function pixCobrancaDinamicoImediatoSaqueSemValor($payload) - { - pixCobrancaImediataSaqueSemValorRules($payload); - $korePayload = [ - 'calendario' => [ - 'expiracao' => $payload['expiracao'] ?? 86400, - ], - 'valor' => [ - 'original' => 0, - 'retirada' => [ - 'saque' => [ - 'valor' => $payload['valor'] ?? 0, - 'modalidadeAlteracao' => 1, - 'prestadorDoServicoDeSaque' => $payload['ispb'], - 'modalidadeAgente' => $payload['modalidadeAgente'] - ] - ] - ], - 'chave' => $payload['chave'], - 'txid' => $payload['txid'], - 'solicitacaoPagador' => $payload['solicitacaoPagador'] ?? null - ]; - - if (isset($payload['devedor'])) { - if (strlen($payload['devedor']['documento']) > 11) { - $korePayload['devedor']['cnpj'] = $payload['devedor']['documento']; - } else { - $korePayload['devedor']['cpf'] = $payload['devedor']['documento']; - } - $korePayload['devedor']['nome'] = $payload['devedor']; - } - - return curlRequest( - $this->url . '/post', - 'POST', - [], - [ - 'x-kore-drone-uid: drone:' . $this->drone, - 'x-kore-drone-sign: ' . $this->signBody($korePayload) - ], - $payload - ); - } - - public function pixCobrancaDinamicoImediatoSaqueComValor($payload) - { - pixCobrancaImediataSaqueComValorRules($payload); - $korePayload = [ - 'calendario' => [ - 'expiracao' => $payload['expiracao'] ?? 86400, - ], - 'valor' => [ - 'original' => 0, - 'retirada' => [ - 'saque' => [ - 'valor' => $payload['valor'], - 'modalidadeAlteracao' => 0, - 'prestadorDoServicoDeSaque' => $payload['ispb'], - 'modalidadeAgente' => $payload['modalidadeAgente'] - ] - ] - ], - 'chave' => $payload['chave'], - 'txid' => $payload['txid'], - 'solicitacaoPagador' => $payload['solicitacaoPagador'] ?? null - ]; - - if (isset($payload['devedor'])) { - if (strlen($payload['devedor']['documento']) > 11) { - $korePayload['devedor']['cnpj'] = $payload['devedor']['documento']; - } else { - $korePayload['devedor']['cpf'] = $payload['devedor']['documento']; - } - $korePayload['devedor']['nome'] = $payload['devedor']; - } - - return curlRequest( - $this->url . '/post', - 'POST', - [], - [ - 'x-kore-drone-uid: drone:' . $this->drone, - 'x-kore-drone-sign: ' . $this->signBody($korePayload) - ], - $payload - ); - } - - public function pixCobrancaDinamicoImediatoTrocoSemValor($payload) - { - pixCobrancaImediataTrocoSemValorRules($payload); - $korePayload = [ - 'calendario' => [ - 'expiracao' => $payload['expiracao'] ?? 86400, - ], - 'valor' => [ - 'original' => 0, - 'retirada' => [ - 'troco' => [ - 'valor' => $payload['valor'] ?? 0, - 'modalidadeAlteracao' => 1, - 'prestadorDoServicoDeSaque' => $payload['ispb'], - 'modalidadeAgente' => $payload['modalidadeAgente'] - ] - ] - ], - 'chave' => $payload['chave'], - 'txid' => $payload['txid'], - 'solicitacaoPagador' => $payload['solicitacaoPagador'] ?? null - ]; - - if (isset($payload['devedor'])) { - if (strlen($payload['devedor']['documento']) > 11) { - $korePayload['devedor']['cnpj'] = $payload['devedor']['documento']; - } else { - $korePayload['devedor']['cpf'] = $payload['devedor']['documento']; - } - $korePayload['devedor']['nome'] = $payload['devedor']; - } - - return curlRequest( - $this->url . '/post', - 'POST', - [], - [ - 'x-kore-drone-uid: drone:' . $this->drone, - 'x-kore-drone-sign: ' . $this->signBody($korePayload) - ], - $payload - ); - } - public function pixCobrancaDinamicoImediatoTrocoComValor($payload) - { - pixCobrancaImediataTrocoComValorRules($payload); - $korePayload = [ - 'calendario' => [ - 'expiracao' => $payload['expiracao'] ?? 86400, - ], - 'valor' => [ - 'original' => 0, - 'retirada' => [ - 'troco' => [ - 'valor' => $payload['valor'], - 'modalidadeAlteracao' => 0, - 'prestadorDoServicoDeSaque' => $payload['ispb'], - 'modalidadeAgente' => $payload['modalidadeAgente'] - ] - ] - ], - 'chave' => $payload['chave'], - 'txid' => $payload['txid'], - 'solicitacaoPagador' => $payload['solicitacaoPagador'] ?? null - ]; - - if (isset($payload['devedor'])) { - if (strlen($payload['devedor']['documento']) > 11) { - $korePayload['devedor']['cnpj'] = $payload['devedor']['documento']; - } else { - $korePayload['devedor']['cpf'] = $payload['devedor']['documento']; - } - $korePayload['devedor']['nome'] = $payload['devedor']; - } - - return curlRequest( - $this->url . '/post', - 'POST', - [], - [ - 'x-kore-drone-uid: drone:' . $this->drone, - 'x-kore-drone-sign: ' . $this->signBody($korePayload) - ], - $payload - ); - } - - - public function pixCobrancaEstatico($payload) - { - pixCobrancaEstaticoRules($payload); - $korePayload = [ - 'valor' => $payload['valor'] ?? 0, - 'chave' => $payload['chave'], - 'txid' => $payload['txid'] ?? null, - 'solicitacaoPagador' => $payload['solicitacaoPagador'] ?? null - ]; - - return curlRequest( - $this->url . '/post', - 'POST', - [], - [ - 'x-kore-drone-uid: drone:' . $this->drone, - 'x-kore-drone-sign: ' . $this->signBody($korePayload) - ], - $payload - ); - } -} diff --git a/src/helpers.php b/src/helpers.php index fb783cb..75b0cf6 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -2,18 +2,18 @@ if (!function_exists('curlRequest')) { function curlRequest( - $url, - $method = 'GET', - $queryParams = [], - $headers = [], - $body = null + string $url, + string $method = 'GET', + array $queryParams = [], + array $headers = [], + array|string|null $body = null ): array { $curl = curl_init(); if (!empty($queryParams)) { $url .= (strpos($url, '?') === false ? '?' : '&') . http_build_query($queryParams); } - + $options = [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, @@ -29,7 +29,7 @@ if (!function_exists('curlRequest')) { } $options[CURLOPT_POSTFIELDS] = $body; } - + if (!empty($headers)) { $options[CURLOPT_HTTPHEADER] = $headers; } diff --git a/src/rules.php b/src/rules.php deleted file mode 100644 index ca217b4..0000000 --- a/src/rules.php +++ /dev/null @@ -1,154 +0,0 @@ - 'sometimes|integer', - 'devedor' => 'sometimes|array', - 'devedor.documento' => 'sometimes|string|min:11|max:18', - 'devedor.nome' => 'sometimes|required_with:devedor.documento|string|max:100', - 'valor' => 'required|integer|min:1', - 'chave' => 'required|string', - 'txid' => 'required|string|max:100', - 'solicitacaoPagador' => 'string|max:140' - ]; - $validate = validate($data, $rules); - if (!$validate['valid']) { - throw new Exception(json_encode(array_slice($validate['errors'], 0, 1)), 500); - } else { - return true; - } -} - -function pixCobrancaImediataSemValorRules(array $data) -{ - $rules = [ - 'expiracao' => 'sometimes|integer', - 'devedor' => 'sometimes|array', - 'devedor.documento' => 'sometimes|string|min:11|max:18', - 'devedor.nome' => 'sometimes|required_with:devedor.documento|string|max:100', - 'valor' => 'sometimes|integer', - 'chave' => 'required|string', - 'txid' => 'required|string|max:100', - 'solicitacaoPagador' => 'string|max:140' - ]; - - $validate = validate($data, $rules); - if (!$validate['valid']) { - throw new Exception(json_encode(array_slice($validate['errors'], 0, 1)), 500); - } else { - return true; - } -} - -function pixCobrancaImediataSaqueSemValorRules(array $data) -{ - $rules = [ - 'expiracao' => 'sometimes|integer', - 'devedor' => 'sometimes|array', - 'devedor.documento' => 'sometimes|string|min:11|max:18', - 'devedor.nome' => 'sometimes|required_with:devedor.documento|string|max:100', - 'valor' => 'sometimes|integer', - 'chave' => 'required|string', - 'txid' => 'required|string|max:100', - 'solicitacaoPagador' => 'string|max:140', - 'ispb' => 'required|string', - 'modalidadeAgente' => 'required|string|in:agtec,agtot,agpss' - ]; - - $validate = validate($data, $rules); - if (!$validate['valid']) { - throw new Exception(json_encode(array_slice($validate['errors'], 0, 1)), 500); - } else { - return true; - } -} - -function pixCobrancaImediataSaqueComValorRules(array $data) -{ - $rules = [ - 'expiracao' => 'sometimes|integer', - 'devedor' => 'sometimes|array', - 'devedor.documento' => 'sometimes|string|min:11|max:18', - 'devedor.nome' => 'sometimes|required_with:devedor.documento|string|max:100', - 'valor' => 'required|integer', - 'chave' => 'required|string', - 'txid' => 'required|string|max:100', - 'solicitacaoPagador' => 'string|max:140', - 'ispb' => 'required|string', - 'modalidadeAgente' => 'required|string|in:agtec,agtot,agpss' - ]; - - $validate = validate($data, $rules); - if (!$validate['valid']) { - throw new Exception(json_encode(array_slice($validate['errors'], 0, 1)), 500); - } else { - return true; - } -} - -function pixCobrancaImediataTrocoSemValorRules(array $data) -{ - $rules = [ - 'expiracao' => 'sometimes|integer', - 'devedor' => 'sometimes|array', - 'devedor.documento' => 'sometimes|string|min:11|max:18', - 'devedor.nome' => 'sometimes|required_with:devedor.documento|string|max:100', - 'valor' => 'sometimes|integer', - 'chave' => 'required|string', - 'txid' => 'required|string|max:100', - 'solicitacaoPagador' => 'string|max:140', - 'ispb' => 'required|string', - 'modalidadeAgente' => 'required|string|in:agtec,agtot' - ]; - - $validate = validate($data, $rules); - if (!$validate['valid']) { - throw new Exception(json_encode(array_slice($validate['errors'], 0, 1)), 500); - } else { - return true; - } -} - -function pixCobrancaImediataTrocoComValorRules(array $data) -{ - $rules = [ - 'expiracao' => 'sometimes|integer', - 'devedor' => 'sometimes|array', - 'devedor.documento' => 'sometimes|string|min:11|max:18', - 'devedor.nome' => 'sometimes|required_with:devedor.documento|string|max:100', - 'valor' => 'sometimes|integer', - 'chave' => 'required|string', - 'txid' => 'required|string|max:100', - 'solicitacaoPagador' => 'string|max:140', - 'ispb' => 'required|string', - 'modalidadeAgente' => 'required|string|in:agtec,agtot' - ]; - - $validate = validate($data, $rules); - if (!$validate['valid']) { - throw new Exception(json_encode(array_slice($validate['errors'], 0, 1)), 500); - } else { - return true; - } -} - - -function pixCobrancaEstaticoRules(array $data) -{ - $rules = [ - 'valor' => 'sometimes|integer', - 'chave' => 'required|string', - 'txid' => 'sometimes|string|max:100', - 'solicitacaoPagador' => 'sometimes|string|max:140', - ]; - - $validate = validate($data, $rules); - if (!$validate['valid']) { - throw new Exception(json_encode(array_slice($validate['errors'], 0, 1)), 500); - } else { - return true; - } -} diff --git a/src/validator.php b/src/validator.php deleted file mode 100644 index 42033d8..0000000 --- a/src/validator.php +++ /dev/null @@ -1,176 +0,0 @@ - $ruleString) { - $value = getDataValue($data, $field); - $ruleList = explode('|', $ruleString); - - $hasSometimes = in_array('sometimes', $ruleList, true); - if ($hasSometimes && !fieldExistsInData($data, $field)) { - continue; - } - - foreach ($ruleList as $ruleItem) { - if ($ruleItem === 'sometimes') { - continue; // already handled - } - - $param = null; - if (strpos($ruleItem, ':') !== false) { - $exploded = explode(':', $ruleItem, 2); - $rule = $exploded[0]; - $param = isset($exploded[1]) ? $exploded[1] : null; - } else { - $rule = $ruleItem; - } - - $validator = 'validate_' . $rule; - - if (function_exists($validator)) { - $result = $validator($field, $value, $param, $data); - - if ($result !== true) { - $errors[$field][] = $result; - } - } else { - $errors[$field][] = "Rule '$rule' is not supported."; - } - } - } - - return ['valid' => !empty($errors) ? false : true, 'errors' => $errors]; -} - -function validate_array($field, $value, $param = null, $data = []) -{ - if (!is_array($value)) { - return "The field '$field' must be an array."; - } - return true; -} - -function validate_in($field, $value, $param, $data = []) -{ - if ($param === null) { - return "The rule 'in' requires a list of accepted values."; - } - - $accepted = explode(',', $param); - - if (!in_array((string) $value, $accepted, true)) { - return "The field '$field' must be one of: " . implode(', ', $accepted) . "."; - } - - return true; -} - - -function validate_integer($field, $value, $param = null, $data = []) -{ - if (!is_int($value)) { - return "The field '$field' must be an integer."; - } - return true; -} - -function validate_max($field, $value, $param, $data = []) -{ - if (is_string($value) && strlen($value) > $param) { - return "The field '$field' must have at most $param characters."; - } - if (is_integer($value) && $value > $param) { - return "The value of '$field' must be at most $param."; - } - return true; -} - -function validate_min($field, $value, $param, $data = []) -{ - if (is_string($value) && strlen($value) < $param) { - return "The field '$field' must have at least $param characters."; - } - if (is_numeric($value) && $value < $param) { - return "The value of '$field' must be at least $param."; - } - return true; -} - -function validate_prohibited_with($field, $value, $param, $data = []) -{ - $otherFields = explode(',', $param); - - foreach ($otherFields as $other) { - $other = trim($other); - if (!empty($data[$other])) { - if (!empty($value)) { - return "The field '$field' is not allowed when '$other' is present."; - } - } - } - - return true; -} - -function validate_required($field, $value, $param = null, $data = []) -{ - if ($value === null || $value === '') { - return "The field '$field' is required."; - } - return true; -} - -function validate_required_with($field, $value, $param, $data = []) -{ - $relatedFields = explode(',', $param); - - foreach ($relatedFields as $related) { - $related = trim($related); - - if (isset($data[$related]) && $data[$related] !== '') { - if ($value === null || $value === '') { - return "The field '$field' is required when '$related' is present."; - } - } - } - - return true; -} - -function validate_string($field, $value, $param = null, $data = []) -{ - if (!is_string($value)) { - return "The field '$field' must be a string."; - } - return true; -} diff --git a/vendor/autoload.php b/vendor/autoload.php new file mode 100644 index 0000000..5e6a330 --- /dev/null +++ b/vendor/autoload.php @@ -0,0 +1,22 @@ + + * Jordi Boggiano + * + * 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 + * @author Jordi Boggiano + * @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> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var list + */ + 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>> + */ + private $prefixesPsr0 = array(); + /** + * @var list + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var array + */ + private $missingClasses = array(); + + /** @var string|null */ + private $apcuPrefix; + + /** + * @var array + */ + private static $registeredLoaders = array(); + + /** + * @param string|null $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); + } + + /** + * @return array> + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return list + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return list + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return array Array of classname => path + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $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 $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 $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 $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 $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 + */ + 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); + } +} diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE new file mode 100644 index 0000000..f27399a --- /dev/null +++ b/vendor/composer/LICENSE @@ -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. + diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..0fb0a2c --- /dev/null +++ b/vendor/composer/autoload_classmap.php @@ -0,0 +1,10 @@ + $vendorDir . '/composer/InstalledVersions.php', +); diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php new file mode 100644 index 0000000..de51552 --- /dev/null +++ b/vendor/composer/autoload_files.php @@ -0,0 +1,10 @@ + $baseDir . '/src/helpers.php', +); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php new file mode 100644 index 0000000..15a2ff3 --- /dev/null +++ b/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ + array($baseDir . '/src'), +); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php new file mode 100644 index 0000000..f4faf00 --- /dev/null +++ b/vendor/composer/autoload_real.php @@ -0,0 +1,48 @@ +register(true); + + $filesToLoad = \Composer\Autoload\ComposerStaticInit60f22886a6c2e74ff0ac05bdf2882e7a::$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; + } +} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php new file mode 100644 index 0000000..9160470 --- /dev/null +++ b/vendor/composer/autoload_static.php @@ -0,0 +1,40 @@ + __DIR__ . '/../..' . '/src/helpers.php', + ); + + public static $prefixLengthsPsr4 = array ( + 'K' => + array ( + 'Kontrl\\PhpKore\\' => 15, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Kontrl\\PhpKore\\' => + array ( + 0 => __DIR__ . '/../..' . '/src', + ), + ); + + public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit60f22886a6c2e74ff0ac05bdf2882e7a::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit60f22886a6c2e74ff0ac05bdf2882e7a::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit60f22886a6c2e74ff0ac05bdf2882e7a::$classMap; + + }, null, ClassLoader::class); + } +}