Sensei_Twentyfifteen   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 103
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 103
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A wrapper_start() 0 9 1
B print_styles() 0 78 1
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
        // output inline styles
23
        $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...
24
25
        // call the parent starting wrappers
26
        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...
27
28
    }
29
30
31
    /**
32
     * Output the style for the
33
     * twenty fifteen theme integration.
34
     *
35
     * @since 1.9.0
36
     */
37
    private function print_styles(){?>
38
39
        <style>
40
            @media screen and (min-width: 59.6875em){
41
                #main article.lesson,
42
                #main article.course,
43
                #main #post-entries,
44
                .sensei-breadcrumb {
45
                    padding-top: 8.3333%;
46
                    margin: 0 8.3333%;
47
                    box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);
48
                    background-color: #fff;
49
                    padding: 1em 2em 2em;
50
                }
51
52
                #main .course-lessons .lesson {
53
                    margin: 0;
54
                }
55
56
                #main #post-entries {
57
                    padding: 1em 2em;
58
                    overflow: hidden;
59
                }
60
61
                #main article.lesson ol {
62
                    list-style-position: inside;
63
                }
64
65
                .sensei-course-filters {
66
                    margin: 0 8.3333%;
67
                    padding: 0;
68
                    box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);
69
                    background: white;
70
                    padding: 2%;
71
                }
72
73
                .sensei-ordering {
74
                    text-align: right;
75
                    float: right;
76
                    margin: 0 8.3333%;
77
                    padding: 2%;
78
                }
79
                .archive-header h1{
80
                    padding: 2%;
81
                    background: white;
82
                    margin: 2% 8.3333%;
83
                }
84
85
                nav.sensei-pagination, .post-type-archive .course-container li{
86
                    padding: 2% !important;
87
                    background: white !important;
88
                    margin: 2% 8.3333% !important;
89
                    width: 83.333% !important
90
                }
91
92
                nav.sensei-pagination{
93
                    text-align: center;
94
                }
95
96
                nav.sensei-pagination .page-numbers{
97
                    margin-bottom: 0;
98
                }
99
                nav.sensei-pagination li a,
100
                nav.sensei-pagination li span.current {
101
                    display: block;
102
                    border: 2px solid #ddd;
103
                    margin-right: 2px;
104
                    padding: 0.2em 0.5em;
105
                    background: #eee;
106
                }
107
108
                nav.sensei-pagination li span.current{
109
                    background: white;
110
                }
111
            }
112
        </style>
113
114
    <?php }
115
116
} // end class
117