GridButtonPluginManager   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 50
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 Ushkov Nikolai <[email protected]>
5
 * Date: 18.04.16
6
 * Time: 18:00
7
 */
8
9
namespace Nnx\DataGrid\Button;
10
11
use Zend\ServiceManager\AbstractPluginManager;
12
use Zend\ServiceManager\Exception;
13
14
/**
15
 * Class GridButtonPluginManager
16
 * @package Nnx\DataGrid\Button
17
 */
18
class GridButtonPluginManager extends AbstractPluginManager
19
{
20
    /**
21
     * @var bool
22
     */
23
    protected $shareByDefault = false;
24
25
    /**
26
     * @var array
27
     */
28
    protected $aliases = [
29
        'simple' => Simple::class,
30
        'expandall' => ExpandAll::class,
31
        'collapseall' => CollapseAll::class,
32
        'showhidecolumns' => ShowHideColumns::class,
33
    ];
34
35
    /**
36
     * @var array
37
     */
38
    protected $invokableClasses = [
39
40
    ];
41
42
    protected $factories = [
43
        Simple::class => Factory::class,
44
        ExpandAll::class => Factory::class,
45
        CollapseAll::class => Factory::class,
46
        ShowHideColumns::class => Factory::class,
47
    ];
48
49
    /**
50
     * Validate the plugin
51
     *
52
     * Checks that the filter loaded is either a valid callback or an instance
53
     * of FilterInterface.
54
     *
55
     * @param  mixed $plugin
56
     * @return void
57
     * @throws Exception\RuntimeException if invalid
58
     */
59
    public function validatePlugin($plugin)
60
    {
61
        if ($plugin instanceof ButtonInterface) {
62
            return;
63
        }
64
65
        throw new Exception\RuntimeException(sprintf('Button должен реализовывать %s', ButtonInterface::class));
66
    }
67
}
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...
68