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

TextValue::getValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 1
cc 1
eloc 2
nc 1
nop 0
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