Completed
Push — master ( ee3f46...2dd99c )
by Markus
03:13
created

Description   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 50%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 4
c 2
b 1
f 0
lcom 1
cbo 1
dl 46
loc 46
ccs 5
cts 10
cp 0.5
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A getEscapedValue() 4 4 1
A setValue() 6 6 1
A getValue() 4 4 1

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
3
/*
4
 * This file is part of the eluceo/iCal package.
5
 *
6
 * (c) Markus Poerschke <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Eluceo\iCal\Property\Event;
13
14
use Eluceo\iCal\Property\ValueInterface;
15
use Eluceo\iCal\Util\PropertyValueUtil;
16
17
/**
18
 * Class Description
19
 * Alows new line charectars to be in the description.
20
 */
21 View Code Duplication
class Description implements ValueInterface
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...
22
{
23
    /**
24
     * The value.
25
     *
26
     * @var string
27
     */
28
    protected $value;
29
30 3
    public function __construct($value)
31
    {
32 3
        $this->value = $value;
33 3
    }
34
35
    /**
36
     * Return the value of the Property as an escaped string.
37
     *
38
     * Escape values as per RFC 2445. See http://www.kanzaki.com/docs/ical/text.html
39
     *
40
     * @return string
41
     */
42 3
    public function getEscapedValue()
43
    {
44 3
        return PropertyValueUtil::escapeValue((string) $this->value);
45
    }
46
47
    /**
48
     * @param string $value
49
     *
50
     * @return $this
51
     */
52
    public function setValue($value)
53
    {
54
        $this->value = $value;
55
56
        return $this;
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function getValue()
63
    {
64
        return $this->value;
65
    }
66
}
67