BootTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
eloc 7
c 0
b 0
f 0
dl 0
loc 16
ccs 0
cts 5
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 9 1
1
<?php
2
3
namespace App\Traits;
4
5
use App\Facades\Log;
6
use PDO;
7
use Psr\Container\ContainerInterface;
8
use Ronanchilvers\Foundation\Facade\Facade;
9
use Ronanchilvers\Orm\Orm;
10
11
/**
12
 * Trait providing methods for booting the application
13
 *
14
 * @author Ronan Chilvers <[email protected]>
15
 */
16
trait BootTrait
17
{
18
    /**
19
     * Boot the framework
20
     *
21
     * @author Ronan Chilvers <[email protected]>
22
     */
23
    protected function boot(ContainerInterface $container)
24
    {
25
        // Configure facades
26
        Facade::setContainer($container);
27
        Orm::setConnection($container->get(PDO::class));
28
        Orm::getEmitter()->on('query.init', function($sql, $params) {
29
            Log::debug('Query init', [
30
                'sql'    => $sql,
31
                'params' => $params,
32
            ]);
33
        });
34
    }
35
}
36