ToolbarItemAction   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 1
cbo 4
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A fetchItem() 0 11 1
1
<?php
2
/**
3
 * CakeCMS Core
4
 *
5
 * This file is part of the of the simple cms based on CakePHP 3.
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * @package     Core
10
 * @license     MIT
11
 * @copyright   MIT License http://www.opensource.org/licenses/mit-license.php
12
 * @link        https://github.com/CakeCMS/Core".
13
 * @author      Sergey Kalistratov <[email protected]>
14
 */
15
16
namespace Core\Toolbar;
17
18
use Cake\Utility\Hash;
19
20
/**
21
 * Class ToolbarItemAction
22
 *
23
 * @package Core\Toolbar
24
 */
25
class ToolbarItemAction extends ToolbarItem
26
{
27
28
    /**
29
     * Fetch button id.
30
     *
31
     * @return string
32
     * @SuppressWarnings("unused")
33
     */
34
    public function fetchItem()
35
    {
36
        list ($source, $title, $action, $options) = func_get_args();
0 ignored issues
show
Unused Code introduced by
The assignment to $source is unused. Consider omitting it like so list($first,,$third).

This checks looks for assignemnts to variables using the list(...) function, where not all assigned variables are subsequently used.

Consider the following code example.

<?php

function returnThreeValues() {
    return array('a', 'b', 'c');
}

list($a, $b, $c) = returnThreeValues();

print $a . " - " . $c;

Only the variables $a and $c are used. There was no need to assign $b.

Instead, the list call could have been.

list($a,, $c) = returnThreeValues();
Loading history...
37
38
        return $this->_view->Form->button($title, Hash::merge([
39
            'icon'        => 'trash',
40
            'data-action' => $action,
41
            'button'      => 'red lighten-2',
42
            'class'       => 'jsProcessDelete',
43
        ], (array) $options));
44
    }
45
}
46