1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Arcanedev\LaravelMetrics\Contracts; |
6
|
|
|
|
7
|
|
|
use Illuminate\Support\Collection; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Interface Manager |
11
|
|
|
* |
12
|
|
|
* @author ARCANEDEV <[email protected]> |
13
|
|
|
*/ |
14
|
|
|
interface Manager |
15
|
|
|
{ |
16
|
|
|
/* ----------------------------------------------------------------- |
17
|
|
|
| Getters & Setters |
18
|
|
|
| ----------------------------------------------------------------- |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Get the registered metrics. |
23
|
|
|
* |
24
|
|
|
* @return array |
25
|
|
|
*/ |
26
|
|
|
public function registered(): array; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Get the selected metrics. |
30
|
|
|
* |
31
|
|
|
* @return array |
32
|
|
|
*/ |
33
|
|
|
public function selected(): array; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Set the selected metrics. |
37
|
|
|
* |
38
|
|
|
* @param array $metrics |
39
|
|
|
* |
40
|
|
|
* @return $this |
41
|
|
|
*/ |
42
|
|
|
public function setSelected(array $metrics); |
43
|
|
|
|
44
|
|
|
/* ----------------------------------------------------------------- |
45
|
|
|
| Main Methods |
46
|
|
|
| ----------------------------------------------------------------- |
47
|
|
|
*/ |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Get a metric instance. |
51
|
|
|
* |
52
|
|
|
* @param string $metric |
53
|
|
|
* @param mixed|null $default |
54
|
|
|
* |
55
|
|
|
* @return \Arcanedev\LaravelMetrics\Metrics\Metric|mixed |
56
|
|
|
*/ |
57
|
|
|
public function get(string $metric, $default = null); |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Get/Make the given metric from the container. |
61
|
|
|
* |
62
|
|
|
* @param string $metric |
63
|
|
|
* |
64
|
|
|
* @return \Arcanedev\LaravelMetrics\Metrics\Metric|mixed |
65
|
|
|
*/ |
66
|
|
|
public function make(string $metric); |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Register the metrics into the container. |
70
|
|
|
* |
71
|
|
|
* @param array|string $metrics |
72
|
|
|
* |
73
|
|
|
* @return $this |
74
|
|
|
*/ |
75
|
|
|
public function register($metrics); |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Check if the metric exists. |
79
|
|
|
* |
80
|
|
|
* @param string $metric |
81
|
|
|
* |
82
|
|
|
* @return bool |
83
|
|
|
*/ |
84
|
|
|
public function has(string $metric): bool; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Check if the metric is registered. |
88
|
|
|
* |
89
|
|
|
* @param string $metric |
90
|
|
|
* |
91
|
|
|
* @return bool |
92
|
|
|
*/ |
93
|
|
|
public function isRegistered(string $metric): bool; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Check if the selected metrics is not empty |
97
|
|
|
* |
98
|
|
|
* @return bool |
99
|
|
|
*/ |
100
|
|
|
public function hasSelected(): bool; |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Make the selected metrics. |
104
|
|
|
* |
105
|
|
|
* @return \Illuminate\Support\Collection |
106
|
|
|
*/ |
107
|
|
|
public function makeSelected(): Collection; |
108
|
|
|
} |
109
|
|
|
|