Completed
Push — master ( a9a9e9...4ad1fe )
by Basil
07:47
created

TextValue   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A truncate() 0 6 1
A getValue() 0 4 1
1
<?php
2
3
namespace luya\web\jsonld;
4
5
use luya\helpers\StringHelper;
6
use luya\helpers\Html;
7
8
/**
9
 * Text Value.
10
 *
11
 * The text value provides option to auto shorten content.
12
 *
13
 * @author Basil Suter <[email protected]>
14
 * @since 1.0.3
15
 */
16
class TextValue extends BaseValue
17
{
18
    private $_text;
19
    
20
    /**
21
     * Provide date data.
22
     *
23
     * @param string|integer $date
0 ignored issues
show
Bug introduced by
There is no parameter named $date. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
24
     */
25
    public function __construct($text)
26
    {
27
        $this->_text = $text;
28
    }
29
    
30
    /**
31
     * Truncate the string for a given lenth.
32
     *
33
     * @param integer $length
34
     */
35
    public function truncate($length)
36
    {
37
        $this->_text = StringHelper::truncate($this->_text, $length);
38
        
39
        return $this;
40
    }
41
    
42
    /**
43
     * @inheritDoc
44
     */
45
    public function getValue()
46
    {
47
        return Html::encode($this->_text);
48
    }
49
}
50