1 | <?php |
||
18 | class ProfilePlugin implements Plugin |
||
19 | { |
||
20 | use Plugin\VersionBridgePlugin; |
||
21 | |||
22 | /** |
||
23 | * @var Plugin |
||
24 | */ |
||
25 | private $plugin; |
||
26 | |||
27 | /** |
||
28 | * @var Collector |
||
29 | */ |
||
30 | private $collector; |
||
31 | |||
32 | /** |
||
33 | * @var Formatter |
||
34 | */ |
||
35 | private $formatter; |
||
36 | |||
37 | /** |
||
38 | * @param Plugin $plugin |
||
39 | * @param Collector $collector |
||
40 | 12 | * @param Formatter $formatter |
|
41 | */ |
||
42 | 12 | public function __construct(Plugin $plugin, Collector $collector, Formatter $formatter) |
|
48 | |||
49 | protected function doHandleRequest(RequestInterface $request, callable $next, callable $first) |
||
88 | |||
89 | /** |
||
90 | * @param RequestInterface $request |
||
91 | * @param Profile $profile |
||
92 | * @param Exception $exception |
||
93 | * @param Stack $stack |
||
94 | */ |
||
95 | private function onException( |
||
105 | 2 | ||
106 | /** |
||
107 | * @param RequestInterface $request |
||
108 | * @param Profile $profile |
||
109 | */ |
||
110 | private function onOutgoingRequest(RequestInterface $request, Profile $profile) |
||
114 | 7 | ||
115 | /** |
||
116 | * @param ResponseInterface $response |
||
117 | * @param Profile $profile |
||
118 | * @param RequestInterface $request |
||
119 | * @param Stack $stack |
||
120 | */ |
||
121 | private function onOutgoingResponse(ResponseInterface $response, Profile $profile, RequestInterface $request, Stack $stack = null) |
||
126 | 6 | ||
127 | /** |
||
128 | * Collect request information when not already done by the HTTP client. This happens when using the CachePlugin |
||
129 | * and the cache is hit without re-validation. |
||
130 | * |
||
131 | * @param RequestInterface $request |
||
132 | * @param Stack|null $stack |
||
133 | */ |
||
134 | private function collectRequestInformation(RequestInterface $request, Stack $stack = null) |
||
155 | } |
||
156 |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: