Completed
Push — master ( 4f9424...a2bcf9 )
by Cheren
02:01
created

ToolbarItemDelete::fetchItem()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 11
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
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
/**
19
 * Class ToolbarItemDelete
20
 *
21
 * @package Core\Toolbar
22
 */
23
class ToolbarItemDelete extends ToolbarItem
24
{
25
26
    /**
27
     * Fetch button id.
28
     *
29
     * @return string
30
     * @SuppressWarnings("unused")
31
     */
32
    public function fetchItem()
33
    {
34
        list ($source, $title, $action) = 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...
35
36
        return $this->_view->Form->button($title, [
37
            'button' => 'red lighten-2',
38
            'icon'   => 'trash',
39
            'class'  => 'jsProcessDelete',
40
            'data-action' => $action,
41
        ]);
42
    }
43
}
44