Completed
Push — master ( 5ba7f7...a2a0a6 )
by Beñat
8s
created

Assets::developmentAssets()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the WPFoundation library.
5
 *
6
 * Copyright (c) 2015-2016 LIN3S <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace fixtures\LIN3S\WPFoundation;
13
14
use LIN3S\WPFoundation\Configuration\Assets\Assets as BaseAssets;
15
16
/**
17
 * Dummy implementation of Assets class for fixture purposes.
18
 *
19
 * @author Beñat Espiña <[email protected]>
20
 */
21
class Assets extends BaseAssets
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function productionAssets()
27
    {
28
        $this->addScript('app');
29
        $this->addStylesheet('app');
0 ignored issues
show
Unused Code introduced by
The call to the method fixtures\LIN3S\WPFoundat...Assets::addStylesheet() seems un-needed as the method has no side-effects.

PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.

Let’s take a look at an example:

class User
{
    private $email;

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail($email)
    {
        $this->email = $email;
    }
}

If we look at the getEmail() method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:

$user = new User();
$user->getEmail(); // This line could safely be removed as it has no effect.

On the hand, if we look at the setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call:

$user = new User();
$user->setEmail('email@domain'); // This line has a side-effect (it changes an
                                 // instance variable).
Loading history...
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function developmentAssets()
36
    {
37
        $this->addScript('app');
38
        $this->addStylesheet('app');
0 ignored issues
show
Unused Code introduced by
The call to the method fixtures\LIN3S\WPFoundat...Assets::addStylesheet() seems un-needed as the method has no side-effects.

PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.

Let’s take a look at an example:

class User
{
    private $email;

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail($email)
    {
        $this->email = $email;
    }
}

If we look at the getEmail() method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:

$user = new User();
$user->getEmail(); // This line could safely be removed as it has no effect.

On the hand, if we look at the setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call:

$user = new User();
$user->setEmail('email@domain'); // This line has a side-effect (it changes an
                                 // instance variable).
Loading history...
39
    }
40
}
41