Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed May 30, 2021
1 parent b87797a commit 4705a64
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'binary_operator_spaces' => ['align_double_arrow' => false, 'align_equals' => false],
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true],
'no_empty_comment' => false,
'no_extra_consecutive_blank_lines' => false,
'not_operator_with_successor_space' => true,
'ordered_imports' => ['sortAlgorithm' => 'length'],
'phpdoc_align' => false,
'phpdoc_no_empty_return' => false,
'phpdoc_order' => true,
'php_unit_method_casing' => false,
'pre_increment' => false,
'single_trait_insert_per_statement' => false,
'yoda_style' => false,
Expand Down
2 changes: 1 addition & 1 deletion src/Base/BankAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function create(
string $code,
bool $organization
): Response {
$body = \compact('name', 'code', 'organization');
$body = compact('name', 'code', 'organization');
$body['id_no'] = $identification;
$body['acc_no'] = $accountNumber;

Expand Down
6 changes: 3 additions & 3 deletions src/Base/Bill.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public function create(
throw new InvalidArgumentException('Either $email or $mobile should be present');
}

$body = \array_merge(
\compact('email', 'mobile', 'name', 'amount', 'description'), $optional
$body = array_merge(
compact('email', 'mobile', 'name', 'amount', 'description'), $optional
);

$body['collection_id'] = $collectionId;
Expand All @@ -49,7 +49,7 @@ public function create(
? $paymentCompletion
: new PaymentCompletionUrl($paymentCompletion, $optional['redirect_url'] ?? null);

$body = \array_merge($body, $paymentCompletion->toArray());
$body = array_merge($body, $paymentCompletion->toArray());

return $this->stream('POST', 'bills', [], $body);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Base/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ abstract class Collection extends Request implements Contract
*/
public function create(string $title, array $optional = []): Response
{
$body = \array_merge(\compact('title'), $optional);
$body = array_merge(compact('title'), $optional);

return $this->stream('POST', 'collections', [], $body);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Base/Collection/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function update(string $collectionId, array $codes = []): Response
$payments = [];

foreach ($codes as $code) {
\array_push($payments, \compact('code'));
array_push($payments, compact('code'));
}

return $this->send('PUT', "collections/{$collectionId}/payment_methods", [], $payments);
Expand Down
2 changes: 1 addition & 1 deletion src/Base/OpenCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function create(
$amount,
array $optional = []
): Response {
$body = \array_merge(\compact('title', 'description', 'amount'), $optional);
$body = array_merge(compact('title', 'description', 'amount'), $optional);

return $this->stream('POST', 'open_collections', [], $body);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Four/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function create(
string $cvv,
string $expiry
): Response {
$body = \compact('name', 'email', 'cvv', 'expiry');
$body = compact('name', 'email', 'cvv', 'expiry');
$body['phone'] = $phoneNumber;
$body['card_number'] = $cardNumber;

Expand Down
2 changes: 1 addition & 1 deletion src/Four/Payout.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function create(
$total,
array $optional = []
): Response {
$body = \array_merge(\compact('name', 'description', 'total'), $optional);
$body = array_merge(compact('name', 'description', 'total'), $optional);
$body['mass_payment_instruction_collection_id'] = $collectionId;
$body['bank_code'] = $bankCode;
$body['bank_account_number'] = $bankAccountNumber;
Expand Down
6 changes: 3 additions & 3 deletions src/Signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ final public function create(array $data): string
$keys = [];

foreach ($this->attributes as $attribute) {
\array_push($keys, $attribute.($data[$attribute] ?? ''));
array_push($keys, $attribute.($data[$attribute] ?? ''));
}

return \hash_hmac('sha256', \implode('|', $keys), $this->key);
return hash_hmac('sha256', implode('|', $keys), $this->key);
}

/**
* Verify signature.
*/
final public function verify(array $data, string $hash): bool
{
return \hash_equals($this->create($data), $hash);
return hash_equals($this->create($data), $hash);
}
}
4 changes: 2 additions & 2 deletions src/Three/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ class Collection extends Request
public function create(string $title, array $optional = []): Response
{
$files = [];
$body = \array_merge(\compact('title'), $optional);
$body = array_merge(compact('title'), $optional);

if (isset($body['logo'])) {
$files['logo'] = \ltrim($body['logo'], '@');
$files['logo'] = ltrim($body['logo'], '@');
unset($body['logo']);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ protected function expectStreamRequest($method = 'GET', $uri = '/', array $heade
*/
protected function makeClient(Faker $faker = null): Client
{
if (is_null($faker)) {
if (\is_null($faker)) {
$faker = Faker::create();
}

$client = new Client($faker->http(), static::API_KEY, static::X_SIGNATURE);

if (! is_null($this->apiVersion)) {
if (! \is_null($this->apiVersion)) {
$client->useVersion($this->apiVersion);
}

Expand Down

0 comments on commit 4705a64

Please sign in to comment.