Skip to content

Commit d06437e

Browse files
authored
refactor: rename show methods to get (#119)
1 parent 2abf024 commit d06437e

23 files changed

+75
-75
lines changed

src/API/AbstractAPI.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(ArkClient $client)
4141
*
4242
* @return array|null|bool
4343
*/
44-
protected function get(string $path, array $query = [])
44+
protected function requestGet(string $path, array $query = [])
4545
{
4646
$response = $this->client->getHttpClient()->get($this->buildUrl($path), [
4747
'query' => Arr::dot($query),
@@ -58,7 +58,7 @@ protected function get(string $path, array $query = [])
5858
*
5959
* @return array|null|bool
6060
*/
61-
protected function post(string $path, array $parameters = [])
61+
protected function requestPost(string $path, array $parameters = [])
6262
{
6363
$response = $this->client->getHttpClient()->post(
6464
$this->buildUrl($path),

src/API/ApiNodes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ class ApiNodes extends AbstractAPI
1515
*/
1616
public function all(array $query = []): ?array
1717
{
18-
return $this->get('api-nodes', $query);
18+
return $this->requestGet('api-nodes', $query);
1919
}
2020
}

src/API/Blockchain.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ class Blockchain extends AbstractAPI
1515
*/
1616
public function blockchain(): ?array
1717
{
18-
return $this->get('blockchain');
18+
return $this->requestGet('blockchain');
1919
}
2020
}

src/API/Blocks.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Blocks extends AbstractAPI
1515
*/
1616
public function all(array $query = []): ?array
1717
{
18-
return $this->get('blocks', $query);
18+
return $this->requestGet('blocks', $query);
1919
}
2020

2121
/**
@@ -25,9 +25,9 @@ public function all(array $query = []): ?array
2525
*
2626
* @return array
2727
*/
28-
public function show(string $id): ?array
28+
public function get(string $id): ?array
2929
{
30-
return $this->get("blocks/{$id}");
30+
return $this->requestGet("blocks/{$id}");
3131
}
3232

3333
/**
@@ -37,7 +37,7 @@ public function show(string $id): ?array
3737
*/
3838
public function first(): ?array
3939
{
40-
return $this->get('blocks/first');
40+
return $this->requestGet('blocks/first');
4141
}
4242

4343
/**
@@ -47,7 +47,7 @@ public function first(): ?array
4747
*/
4848
public function last(): ?array
4949
{
50-
return $this->get('blocks/last');
50+
return $this->requestGet('blocks/last');
5151
}
5252

5353
/**
@@ -60,6 +60,6 @@ public function last(): ?array
6060
*/
6161
public function transactions(string $id, array $query = []): ?array
6262
{
63-
return $this->get("blocks/{$id}/transactions", $query);
63+
return $this->requestGet("blocks/{$id}/transactions", $query);
6464
}
6565
}

src/API/Commits.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class Commits extends AbstractAPI
1313
*
1414
* @return array
1515
*/
16-
public function show(int $height): ?array
16+
public function get(int $height): ?array
1717
{
18-
return $this->get("commits/{$height}");
18+
return $this->requestGet("commits/{$height}");
1919
}
2020
}

src/API/Delegates.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Delegates extends AbstractAPI
1515
*/
1616
public function all(array $query = []): ?array
1717
{
18-
return $this->get('delegates', $query);
18+
return $this->requestGet('delegates', $query);
1919
}
2020

2121
/**
@@ -25,9 +25,9 @@ public function all(array $query = []): ?array
2525
*
2626
* @return array
2727
*/
28-
public function show(string $id): ?array
28+
public function get(string $id): ?array
2929
{
30-
return $this->get("delegates/{$id}");
30+
return $this->requestGet("delegates/{$id}");
3131
}
3232

3333
/**
@@ -40,7 +40,7 @@ public function show(string $id): ?array
4040
*/
4141
public function blocks(string $id, array $query = []): ?array
4242
{
43-
return $this->get("delegates/{$id}/blocks", $query);
43+
return $this->requestGet("delegates/{$id}/blocks", $query);
4444
}
4545

4646
/**
@@ -53,6 +53,6 @@ public function blocks(string $id, array $query = []): ?array
5353
*/
5454
public function voters(string $id, array $query = []): ?array
5555
{
56-
return $this->get("delegates/{$id}/voters", $query);
56+
return $this->requestGet("delegates/{$id}/voters", $query);
5757
}
5858
}

src/API/EVM.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ public function ethCall(array $payload): ?array
2626
'Content-Type' => 'application/json',
2727
];
2828

29-
return $this->withApi('evm')->post('api/', $body, $headers);
29+
return $this->withApi('evm')->requestPost('api/', $body, $headers);
3030
}
3131
}

src/API/Node.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Node extends AbstractAPI
1313
*/
1414
public function status(): ?array
1515
{
16-
return $this->get('node/status');
16+
return $this->requestGet('node/status');
1717
}
1818

1919
/**
@@ -23,7 +23,7 @@ public function status(): ?array
2323
*/
2424
public function syncing(): ?array
2525
{
26-
return $this->get('node/syncing');
26+
return $this->requestGet('node/syncing');
2727
}
2828

2929
/**
@@ -33,7 +33,7 @@ public function syncing(): ?array
3333
*/
3434
public function configuration(): ?array
3535
{
36-
return $this->get('node/configuration');
36+
return $this->requestGet('node/configuration');
3737
}
3838

3939
/**
@@ -43,7 +43,7 @@ public function configuration(): ?array
4343
*/
4444
public function crypto(): ?array
4545
{
46-
return $this->get('node/configuration/crypto');
46+
return $this->requestGet('node/configuration/crypto');
4747
}
4848

4949
/**
@@ -55,6 +55,6 @@ public function crypto(): ?array
5555
*/
5656
public function fees(?int $days = null): ?array
5757
{
58-
return $this->get('node/fees', ['days' => $days]);
58+
return $this->requestGet('node/fees', ['days' => $days]);
5959
}
6060
}

src/API/Peers.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Peers extends AbstractAPI
1515
*/
1616
public function all(array $query = []): ?array
1717
{
18-
return $this->get('peers', $query);
18+
return $this->requestGet('peers', $query);
1919
}
2020

2121
/**
@@ -25,8 +25,8 @@ public function all(array $query = []): ?array
2525
*
2626
* @return array
2727
*/
28-
public function show(string $ip): ?array
28+
public function get(string $ip): ?array
2929
{
30-
return $this->get("peers/{$ip}");
30+
return $this->requestGet("peers/{$ip}");
3131
}
3232
}

src/API/Receipts.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Receipts extends AbstractAPI
1717
*/
1818
public function all(array $query = []): ?array
1919
{
20-
return $this->get('receipts', $query);
20+
return $this->requestGet('receipts', $query);
2121
}
2222

2323
/**
@@ -27,9 +27,9 @@ public function all(array $query = []): ?array
2727
*
2828
* @return array
2929
*/
30-
public function show(string $txHash): ?array
30+
public function get(string $txHash): ?array
3131
{
32-
$result = $this->get('receipts', ['txHash' => $txHash])['data'];
32+
$result = $this->requestGet('receipts', ['txHash' => $txHash])['data'];
3333

3434
if (empty($result)) {
3535
throw new Exception(sprintf('No receipt found for transaction %s', $txHash));

src/API/Rounds.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Rounds extends AbstractAPI
1515
*/
1616
public function all(array $query = []): ?array
1717
{
18-
return $this->get('rounds', $query);
18+
return $this->requestGet('rounds', $query);
1919
}
2020

2121
/**
@@ -25,9 +25,9 @@ public function all(array $query = []): ?array
2525
*
2626
* @return array
2727
*/
28-
public function show(int $round_id): ?array
28+
public function get(int $round_id): ?array
2929
{
30-
return $this->get("rounds/{$round_id}");
30+
return $this->requestGet("rounds/{$round_id}");
3131
}
3232

3333
/**
@@ -39,6 +39,6 @@ public function show(int $round_id): ?array
3939
*/
4040
public function delegates(int $round_id): ?array
4141
{
42-
return $this->get("rounds/{$round_id}/delegates");
42+
return $this->requestGet("rounds/{$round_id}/delegates");
4343
}
4444
}

src/API/Transactions.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Transactions extends AbstractAPI
1515
*/
1616
public function all(array $query = []): ?array
1717
{
18-
return $this->get('transactions', $query);
18+
return $this->requestGet('transactions', $query);
1919
}
2020

2121
/**
@@ -27,7 +27,7 @@ public function all(array $query = []): ?array
2727
*/
2828
public function create(array $transactions): ?array
2929
{
30-
return $this->withApi('transactions')->post('transactions', compact('transactions'));
30+
return $this->withApi('transactions')->requestPost('transactions', compact('transactions'));
3131
}
3232

3333
/**
@@ -37,9 +37,9 @@ public function create(array $transactions): ?array
3737
*
3838
* @return array
3939
*/
40-
public function show(string $id): ?array
40+
public function get(string $id): ?array
4141
{
42-
return $this->get("transactions/{$id}");
42+
return $this->requestGet("transactions/{$id}");
4343
}
4444

4545
/**
@@ -49,7 +49,7 @@ public function show(string $id): ?array
4949
*/
5050
public function allUnconfirmed(): ?array
5151
{
52-
return $this->withApi('transactions')->get('transactions/unconfirmed');
52+
return $this->withApi('transactions')->requestGet('transactions/unconfirmed');
5353
}
5454

5555
/**
@@ -59,9 +59,9 @@ public function allUnconfirmed(): ?array
5959
*
6060
* @return array
6161
*/
62-
public function showUnconfirmed(string $id): ?array
62+
public function getUnconfirmed(string $id): ?array
6363
{
64-
return $this->withApi('transactions')->get("transactions/unconfirmed/{$id}");
64+
return $this->withApi('transactions')->requestGet("transactions/unconfirmed/{$id}");
6565
}
6666

6767
/**
@@ -71,7 +71,7 @@ public function showUnconfirmed(string $id): ?array
7171
*/
7272
public function types(): ?array
7373
{
74-
return $this->get('transactions/types');
74+
return $this->requestGet('transactions/types');
7575
}
7676

7777
/**
@@ -81,7 +81,7 @@ public function types(): ?array
8181
*/
8282
public function fees(): ?array
8383
{
84-
return $this->get('transactions/fees');
84+
return $this->requestGet('transactions/fees');
8585
}
8686

8787
/**
@@ -91,7 +91,7 @@ public function fees(): ?array
9191
*/
9292
public function schemas(): ?array
9393
{
94-
return $this->get('transactions/schemas');
94+
return $this->requestGet('transactions/schemas');
9595
}
9696

9797
/**
@@ -101,6 +101,6 @@ public function schemas(): ?array
101101
*/
102102
public function configuration(): ?array
103103
{
104-
return $this->withApi('transactions')->get('configuration');
104+
return $this->withApi('transactions')->requestGet('configuration');
105105
}
106106
}

src/API/Votes.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Votes extends AbstractAPI
1515
*/
1616
public function all(array $query = []): ?array
1717
{
18-
return $this->get('votes', $query);
18+
return $this->requestGet('votes', $query);
1919
}
2020

2121
/**
@@ -25,8 +25,8 @@ public function all(array $query = []): ?array
2525
*
2626
* @return array
2727
*/
28-
public function show(string $id): ?array
28+
public function get(string $id): ?array
2929
{
30-
return $this->get("votes/{$id}");
30+
return $this->requestGet("votes/{$id}");
3131
}
3232
}

0 commit comments

Comments
 (0)