forked from php-middleware/phpdebugbar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStandardDebugBarFactory.php
More file actions
34 lines (25 loc) · 857 Bytes
/
Copy pathStandardDebugBarFactory.php
File metadata and controls
34 lines (25 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
declare (strict_types=1);
namespace PhpMiddleware\PhpDebugBar;
use DebugBar\StandardDebugBar;
use Psr\Container\ContainerInterface;
final class StandardDebugBarFactory
{
public function __invoke(ContainerInterface $container): StandardDebugBar
{
$debugBar = new StandardDebugBar();
$config = $container->get(ConfigProvider::class);
$collectors = $config['phpmiddleware']['phpdebugbar']['collectors'];
foreach ($collectors as $collectorName) {
$collector = $container->get($collectorName);
$debugBar->addCollector($collector);
}
$storage = $config['phpmiddleware']['phpdebugbar']['storage'];
if (is_string($storage)) {
$debugBar->setStorage(
$container->get($storage)
);
}
return $debugBar;
}
}