LogViewerModule   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 15 1
A publish() 0 8 1
1
<?php
2
3
namespace Spiral;
4
5
use Spiral\Core\DirectoriesInterface;
6
use Spiral\LogViewer\Config;
7
use Spiral\Modules\ModuleInterface;
8
use Spiral\Modules\PublisherInterface;
9
use Spiral\Modules\RegistratorInterface;
10
11
/**
12
 * Spiral Framework.
13
 *
14
 * @license   MIT
15
 * @author    Valentin V (vvval)
16
 */
17
class LogViewerModule implements ModuleInterface
18
{
19
    /**
20
     * @param RegistratorInterface $registrator
21
     */
22
    public function register(RegistratorInterface $registrator)
23
    {
24
        //Register view namespace
25
        $registrator->configure('views', 'namespaces', 'spiral/log-viewer', [
26
            "'log-viewer' => [",
27
            "   directory('libraries') . 'spiral/log-viewer/source/views/',",
28
            "   /*{{namespaces.log-viewer}}*/",
29
            "],"
30
        ]);
31
32
        //Register controller in navigation config
33
        $registrator->configure('modules/vault', 'controllers', 'spiral/log-viewer', [
34
            "'logs' => \\Spiral\\LogViewer\\Controllers\\LogViewerController::class,",
35
        ]);
36
    }
37
38
    /**
39
     * @param PublisherInterface   $publisher
40
     * @param DirectoriesInterface $directories
41
     */
42
    public function publish(PublisherInterface $publisher, DirectoriesInterface $directories)
43
    {
44
        $publisher->publish(
45
            __DIR__ . '/config/viewer.php',
46
            $directories->directory('config') . Config::CONFIG . '.php',
47
            PublisherInterface::FOLLOW
48
        );
49
    }
50
}