Completed
Pull Request — master (#1257)
by
unknown
05:38
created

Sensei_Twentyfifteen::print_styles()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 78
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 78
rs 8.9019
cc 1
eloc 3
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * Class Sensei_Twentyfifteen
4
 *
5
 * Responsible for wrapping twenty fifteen theme Sensei content
6
 * with the correct markup
7
 *
8
 * @package Views
9
 * @subpackage Theme-Integration
10
 * @author Automattic
11
 *
12
 * @since 1.9.0
13
*/
14
Class Sensei_Twentyfifteen extends Sensei__S {
15
16
    /**
17
     * Output opening wrappers
18
     * @since 1.9.0
19
     */
20
    public function wrapper_start(){
21
22
        // call the parent starting wrappers
23
        parent::wrapper_start();
0 ignored issues
show
Unused Code introduced by
The call to the method Sensei__S::wrapper_start() 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...
24
25
    }
26
27
} // end class
28