Skip to content

Commit 2eae9d5

Browse files
committed
PAYH-4: refactor: rename lib
1 parent 0e34bcb commit 2eae9d5

File tree

15 files changed

+45
-65
lines changed

15 files changed

+45
-65
lines changed

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"name": "mariolucasdev/payhub",
2+
"name": "mariolucasdev/phpay",
33
"type": "library",
44
"autoload": {
55
"psr-4": {
6-
"Payhub\\": "src/"
6+
"PHPay\\": "src/"
77
}
88
},
99
"authors": [
@@ -27,4 +27,4 @@
2727
"scripts": {
2828
"test": "vendor/bin/pest"
2929
}
30-
}
30+
}

examples/asaas/clients.php

+12-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

3-
use Payhub\Payhub;
4-
use Payhub\Gateways\Asaas\AsaasGateway;
3+
use PHPay\PHPay;
4+
use PHPay\Gateways\Asaas\AsaasGateway;
55

66
require_once __DIR__ . '/../../vendor/autoload.php';
77
require_once __DIR__ . '/credentials.php';
@@ -12,22 +12,19 @@
1212
];
1313

1414
/**
15-
* initialize payhub
16-
*
17-
* @param array $credentials <token>
18-
* @param bool $sandbox
15+
* initialize phpay
1916
*
2017
* @return AsaasGateway
2118
*/
22-
$payhub = Payhub::asaas(TOKEN_ASAAS_SANDBOX);
19+
$phpay = PHPay::asaas(TOKEN_ASAAS_SANDBOX);
2320

2421
/**
2522
* store asaas cliente
2623
*
2724
* @param array $client <name, cpf_cnpj>
2825
* @return string cliente id asaas
2926
*/
30-
$payhub
27+
$phpay
3128
->client($client)
3229
->store();
3330

@@ -36,7 +33,7 @@
3633
*
3734
* @return array clients
3835
*/
39-
$response = $payhub
36+
$response = $phpay
4037
->client()
4138
->with(['cpfCnpj' => '09102295466',])
4239
->all();
@@ -49,7 +46,7 @@
4946
* @param array $client <cpf_cnpj>
5047
* @return array client
5148
*/
52-
$response = $payhub
49+
$response = $phpay
5350
->client()
5451
->with(['cpfCnpj' => '09102295466'])
5552
->get();
@@ -62,13 +59,14 @@
6259
* @param array $client <cpf_cnpj>
6360
* @return bool
6461
*/
65-
$payhub->client($client)
62+
$phpay
63+
->client($client)
6664
->delete();
6765

6866
/**
6967
* restore cliente no asaas
7068
*/
71-
$response = $payhub
69+
$response = $phpay
7270
->client()
7371
->restore('cus_000006376400');
7472

@@ -77,8 +75,8 @@
7775
/**
7876
* notifications cliente no asaas
7977
*/
80-
$response = $payhub
78+
$response = $phpay
8179
->client()
8280
->notifications('cus_000006376400');
8381

84-
print_r($response);
82+
// print_r($response);

src/Contracts/GatewayInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Payhub\Contracts;
3+
namespace PHPay\Contracts;
44

55
interface GatewayInterface
66
{

src/Exceptions/AsaasExceptions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Payhub\Exceptions;
3+
namespace PHPay\Exceptions;
44

55
use Exception;
66

src/Gateways/Asaas/AsaasGateway.php

+7-24
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22

3-
namespace Payhub\Gateways\Asaas;
3+
namespace PHPay\Gateways\Asaas;
44

55
use Illuminate\Support\Facades\Http;
6-
use Payhub\Contracts\GatewayInterface;
7-
use Payhub\Exceptions\AsaasExceptions;
8-
use Payhub\Gateways\Asaas\Enums\{BillingType, ClientMethods};
9-
use Payhub\Gateways\Asaas\Requests\AsaasPixRequest;
10-
use Payhub\Gateways\Asaas\Resources\{Auth, Client};
11-
use Payhub\Gateways\Gateway;
6+
use PHPay\Contracts\GatewayInterface;
7+
use PHPay\Exceptions\AsaasExceptions;
8+
use PHPay\Gateways\Asaas\Enums\{BillingType, ClientMethods};
9+
use PHPay\Gateways\Asaas\Requests\AsaasPixRequest;
10+
use PHPay\Gateways\Asaas\Resources\{Auth, Client};
11+
use PHPay\Gateways\Gateway;
1212

1313
class AsaasGateway extends Gateway implements GatewayInterface
1414
{
@@ -43,23 +43,6 @@ public function client(array $client = []): Client
4343
{
4444
return new Client($client, $this);
4545
}
46-
// {
47-
// if (! ClientMethods::tryFrom($method)) {
48-
// return (new AsaasExceptions())('Method not found');
49-
// }
50-
51-
// if (! method_exists(Client::class, $method)) {
52-
// return (new AsaasExceptions())('Method not found');
53-
// }
54-
55-
// try {
56-
// $this->customerId = (new Client())::$method($client);
57-
// } catch (\Exception $e) {
58-
// return (new AsaasExceptions())($e->getMessage());
59-
// }
60-
61-
// return $this;
62-
// }
6346

6447
/**
6548
* generate pix

src/Gateways/Asaas/Enums/BillingType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Payhub\Gateways\Asaas\Enums;
3+
namespace PHPay\Gateways\Asaas\Enums;
44

55
enum BillingType: string
66
{

src/Gateways/Asaas/Enums/ClientMethods.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Payhub\Gateways\Asaas\Enums;
3+
namespace PHPay\Gateways\Asaas\Enums;
44

55
enum ClientMethods: string
66
{

src/Gateways/Asaas/Requests/AsaasClientRequest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Payhub\Gateways\Asaas\Requests;
3+
namespace PHPay\Gateways\Asaas\Requests;
44

55
use stdClass;
66

src/Gateways/Asaas/Requests/AsaasPixRequest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Payhub\Gateways\Asaas\Requests;
3+
namespace PHPay\Gateways\Asaas\Requests;
44

55
use stdClass;
66

src/Gateways/Asaas/Resources/Auth.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

3-
namespace Payhub\Gateways\Asaas\Resources;
3+
namespace PHPay\Gateways\Asaas\Resources;
44

55
use Illuminate\Support\Facades\Http;
6-
use Payhub\Exceptions\AsaasExceptions;
6+
use PHPay\Exceptions\AsaasExceptions;
77

88
final class Auth
99
{

src/Gateways/Asaas/Resources/Client.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22

3-
namespace Payhub\Gateways\Asaas\Resources;
3+
namespace PHPay\Gateways\Asaas\Resources;
44

55
use Illuminate\Support\Facades\Http;
6-
use Payhub\Exceptions\AsaasExceptions;
7-
use Payhub\Gateways\Asaas\Requests\AsaasClientRequest;
8-
use Payhub\Gateways\Asaas\Resources\Interfaces\ClientInterface;
9-
use Payhub\Gateways\Gateway;
6+
use PHPay\Exceptions\AsaasExceptions;
7+
use PHPay\Gateways\Asaas\Requests\AsaasClientRequest;
8+
use PHPay\Gateways\Asaas\Resources\Interfaces\ClientInterface;
9+
use PHPay\Gateways\Gateway;
1010

1111
final class Client implements ClientInterface
1212
{

src/Gateways/Asaas/Resources/Interfaces/ClientInterface.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
namespace Payhub\Gateways\Asaas\Resources\Interfaces;
3+
namespace PHPay\Gateways\Asaas\Resources\Interfaces;
44

5-
use Payhub\Exceptions\AsaasExceptions;
5+
use PHPay\Exceptions\AsaasExceptions;
66

77
interface ClientInterface
88
{

src/Gateways/Gateway.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Payhub\Gateways;
3+
namespace PHPay\Gateways;
44

55
abstract class Gateway
66
{

src/Payhub.php renamed to src/PHPay.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
<?php
22

3-
namespace Payhub;
3+
namespace PHPay;
44

55
use Dotenv\Dotenv;
6-
use Exception;
76
use Illuminate\Container\Container;
87
use Illuminate\Http\Client\Factory;
98
use Illuminate\Support\Facades\Facade;
109
use Illuminate\Support\Facades\Http;
11-
use Payhub\Gateways\Asaas\AsaasGateway;
12-
use Payhub\Gateways\Gateway;
10+
use PHPay\Gateways\Asaas\AsaasGateway;
11+
use PHPay\Gateways\Gateway;
1312

14-
class Payhub
13+
class PHPay
1514
{
1615
/**
1716
* @var Gateway

tests/Feature/PayhubTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

3-
use Payhub\Payhub;
3+
use PHPay\PHPay;
44

55
test('instance payhub class', function () {
6-
$payhub = new Payhub('token');
6+
$payhub = new PHPay('token');
77

88
expect($payhub)
9-
->toBeInstanceOf(Payhub::class);
9+
->toBeInstanceOf(PHPay::class);
1010
});

0 commit comments

Comments
 (0)