1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the "php-ipfs" package. |
7
|
|
|
* |
8
|
|
|
* (c) Robert Schönthal <[email protected]> |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace IPFS\Api; |
15
|
|
|
|
16
|
|
|
use IPFS\Annotation\Api as Endpoint; |
17
|
|
|
use IPFS\Command\Command; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @author Robert Schönthal <[email protected]> |
21
|
|
|
* @autogenerated |
22
|
|
|
* @codeCoverageIgnore |
23
|
|
|
*/ |
24
|
|
View Code Duplication |
final class Stats implements Api |
|
|
|
|
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* Show some diagnostic information on the bitswap agent. |
28
|
|
|
* |
29
|
|
|
* @Endpoint(name="stats:bitswap") |
30
|
|
|
* |
31
|
|
|
* @return Command |
32
|
|
|
*/ |
33
|
|
|
public function bitswap(): Command |
34
|
|
|
{ |
35
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Print ipfs bandwidth information. |
40
|
|
|
* |
41
|
|
|
* @Endpoint(name="stats:bw") |
42
|
|
|
* |
43
|
|
|
* @param string $peer specify a peer to print bandwidth for |
44
|
|
|
* @param string $proto specify a protocol to print bandwidth for |
45
|
|
|
* @param bool $poll print bandwidth at an interval |
46
|
|
|
* @param string $interval time interval to wait between updating output, if ‘poll’ is true |
47
|
|
|
* |
48
|
|
|
* @return Command |
49
|
|
|
*/ |
50
|
|
|
public function bw(string $peer = null, string $proto = null, bool $poll = false, string $interval = null): Command |
51
|
|
|
{ |
52
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Get stats for the currently used repo. |
57
|
|
|
* |
58
|
|
|
* @Endpoint(name="stats:repo") |
59
|
|
|
* |
60
|
|
|
* @param bool $human output RepoSize in MiB |
61
|
|
|
* |
62
|
|
|
* @return Command |
63
|
|
|
*/ |
64
|
|
|
public function repo(bool $human = false): Command |
65
|
|
|
{ |
66
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.