Completed
Push — master ( 80c0ca...82d23b )
by Dwain
04:32
created

Sensei_Twentyfifteen::wrapper_start()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 9
rs 9.6667
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/**
3
 * Class Sensei_Twentyfifteen
4
 *
5
 * Responsible for wrapping twenty fifteen theme Sensei content
6
 * with the correct markup
7
 *
8
 * @since 1.9.0
9
*/
10
Class Sensei_Twentyfifteen extends Sensei__S {
11
12
    /**
13
     * Output opening wrappers
14
     * @since 1.9.0
15
     */
16
    public function wrapper_start(){
17
18
        // output inline styles
19
        $this->print_styles();
0 ignored issues
show
Unused Code introduced by
The call to the method Sensei_Twentyfifteen::print_styles() 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...
20
21
        // call the parent starting wrappers
22
        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...
23
24
    }
25
26
27
    /**
28
     * Output the style for the
29
     * twenty fifteen theme integration.
30
     *
31
     * @since 1.9.0
32
     */
33
    private function print_styles(){?>
34
35
        <style>
36
            @media screen and (min-width: 59.6875em){
37
                #main article.lesson,
38
                #main article.course,
39
                #main #post-entries,
40
                .sensei-breadcrumb {
41
                    padding-top: 8.3333%;
42
                    margin: 0 8.3333%;
43
                    box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);
44
                    background-color: #fff;
45
                    padding: 1em 2em 2em;
46
                }
47
48
                #main .course-lessons .lesson {
49
                    margin: 0;
50
                }
51
52
                #main #post-entries {
53
                    padding: 1em 2em;
54
                    overflow: hidden;
55
                }
56
57
                #main article.lesson ol {
58
                    list-style-position: inside;
59
                }
60
61
                .sensei-course-filters {
62
                    margin: 0 8.3333%;
63
                    padding: 0;
64
                    box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);
65
                    background: white;
66
                    padding: 2%;
67
                }
68
69
                .sensei-ordering {
70
                    text-align: right;
71
                    float: right;
72
                    margin: 0 8.3333%;
73
                    padding: 2%;
74
                }
75
                .archive-header h1{
76
                    padding: 2%;
77
                    background: white;
78
                    margin: 2% 8.3333%;
79
                }
80
81
                nav.sensei-pagination, .post-type-archive .course-container li{
82
                    padding: 2% !important;
83
                    background: white !important;
84
                    margin: 2% 8.3333% !important;
85
                    width: 83.333% !important
86
                }
87
88
                nav.sensei-pagination{
89
                    text-align: center;
90
                }
91
92
                nav.sensei-pagination .page-numbers{
93
                    margin-bottom: 0;
94
                }
95
                nav.sensei-pagination li a,
96
                nav.sensei-pagination li span.current {
97
                    display: block;
98
                    border: 2px solid #ddd;
99
                    margin-right: 2px;
100
                    padding: 0.2em 0.5em;
101
                    background: #eee;
102
                }
103
104
                nav.sensei-pagination li span.current{
105
                    background: white;
106
                }
107
            }
108
        </style>
109
110
    <?php }
111
112
} // end class
113