13
13
namespace Bazinga \GeocoderBundle \DataCollector ;
14
14
15
15
use Bazinga \GeocoderBundle \Plugin \ProfilingPlugin ;
16
+ use Geocoder \Collection ;
17
+ use Geocoder \Query \Query ;
16
18
use Symfony \Component \HttpFoundation \Request ;
17
19
use Symfony \Component \HttpFoundation \Response ;
18
20
use Symfony \Component \HttpKernel \DataCollector \DataCollector ;
@@ -34,7 +36,7 @@ public function __construct()
34
36
}
35
37
36
38
/**
37
- * {@inheritdoc}
39
+ * @return void
38
40
*/
39
41
public function reset ()
40
42
{
@@ -45,6 +47,8 @@ public function reset()
45
47
46
48
/**
47
49
* {@inheritdoc}
50
+ *
51
+ * @return void
48
52
*/
49
53
public function collect (Request $ request , Response $ response , \Throwable $ exception = null )
50
54
{
@@ -53,7 +57,6 @@ public function collect(Request $request, Response $response, \Throwable $except
53
57
return ;
54
58
}
55
59
56
- /** @var ProfilingPlugin[] $instances */
57
60
$ instances = $ this ->instances ;
58
61
59
62
foreach ($ instances as $ instance ) {
@@ -67,6 +70,8 @@ public function collect(Request $request, Response $response, \Throwable $except
67
70
68
71
/**
69
72
* Returns an array of collected requests.
73
+ *
74
+ * @phpstan-return array<int, array{query: Query, queryString: string, duration: float, providerName: string, result: mixed, resultCount: int}>
70
75
*/
71
76
public function getQueries (): array
72
77
{
@@ -86,18 +91,27 @@ public function getTotalDuration(): float
86
91
return $ time ;
87
92
}
88
93
94
+ /**
95
+ * @return string[]
96
+ */
89
97
public function getProviders (): array
90
98
{
91
99
return $ this ->data ['providers ' ];
92
100
}
93
101
102
+ /**
103
+ * @phpstan-return array<int, array{query: Query, queryString: string, duration: float, providerName: string, result: mixed, resultCount: int}>
104
+ */
94
105
public function getProviderQueries (string $ provider ): array
95
106
{
96
- return array_filter ($ this ->data ['queries ' ], function ($ data ) use ($ provider ) {
107
+ return array_filter ($ this ->data ['queries ' ], static function ($ data ) use ($ provider ) {
97
108
return $ data ['providerName ' ] === $ provider ;
98
109
});
99
110
}
100
111
112
+ /**
113
+ * @return void
114
+ */
101
115
public function addInstance (ProfilingPlugin $ instance )
102
116
{
103
117
$ this ->instances [] = $ instance ;
0 commit comments