GridColumnPluginManager   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A validatePlugin() 0 8 2
1
<?php
2
/**
3
 * @company MTE Telecom, Ltd.
4
 * @author Roman Malashin <[email protected]>
5
 */
6
7
namespace Nnx\DataGrid\Column;
8
9
use Zend\ServiceManager\AbstractPluginManager;
10
use Zend\ServiceManager\Exception;
11
12
/**
13
 * Class ColumnPluginManager
14
 * @package Nnx\DataGrid\Column
15
 */
16
class GridColumnPluginManager extends AbstractPluginManager
17
{
18
19
    /**
20
     * @var bool
21
     */
22
    protected $shareByDefault = false;
23
24
    /**
25
     * @var array
26
     */
27
    protected $aliases = [
28
        'text' => Text::class,
29
        'hidden' => Hidden::class,
30
        'link' => Link::class,
31
        'money' => Money::class,
32
        'radio' => Radio::class,
33
        'checkbox' => Checkbox::class,
34
        'action' => Action::class
35
    ];
36
37
    /**
38
     * @var array
39
     */
40
    protected $invokableClasses = [
41
42
    ];
43
44
    protected $factories = [
45
        Action::class => ActionFactory::class,
46
        Text::class => Factory::class,
47
        Hidden::class => Factory::class,
48
        Link::class => Factory::class,
49
        Radio::class => Factory::class,
50
        Checkbox::class => Factory::class,
51
        Money::class => Factory::class
52
    ];
53
54
    /**
55
     * Validate the plugin
56
     *
57
     * Checks that the filter loaded is either a valid callback or an instance
58
     * of FilterInterface.
59
     *
60
     * @param  mixed $plugin
61
     * @return void
62
     * @throws Exception\RuntimeException if invalid
63
     */
64
    public function validatePlugin($plugin)
65
    {
66
        if ($plugin instanceof ColumnInterface) {
67
            return;
68
        }
69
70
        throw new Exception\RuntimeException(sprintf('Column должен реализовывать %s', ColumnInterface::class));
71
    }
72
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
73