Completed
Push — master ( ffee62...1450e2 )
by Andrey
03:08
created

Description   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 5 5 2
A get() 8 8 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace humanity;
3
4 View Code Duplication
class Description {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
5
6
    private static $memory = [];
7
8
    public function add($title){
9
        if(!is_array($title)) $title = [$title];
10
        self::$memory = array_merge(self::$memory,$title);
11
        return $this;
12
    }
13
14
    public function get(){
15
        self::$memory = array_reverse(self::$memory);
16
        foreach(self::$memory as $key=>$value){
17
            $value = urldecode($value);
18
            self::$memory[$key] = $value;
19
        }
20
        return '<meta name="description" content="'.implode(' ',self::$memory).'">';
21
    }
22
23
}
24
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
25