ToolbarItemLink   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A fetchItem() 0 7 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\Routing\Router;
19
20
/**
21
 * Class ToolbarItemLink
22
 *
23
 * @package Core\Toolbar
24
 */
25
class ToolbarItemLink 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, $url, $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
        $url = Router::url($url);
38
39
        return $this->_view->Html->link($title, $url, $options);
40
    }
41
}
42