StrLimit::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Boduch\Grid\Decorators;
4
5
use Boduch\Grid\Cell;
6
7
class StrLimit extends Decorator
8
{
9
    /**
10
     * @var int
11
     */
12
    protected $limit;
13
14
    /**
15
     * @param int $limit
16
     */
17
    public function __construct($limit = 100)
18
    {
19
        $this->limit = $limit;
20
    }
21
22
    /**
23
     * @param Cell $cell
24
     * @return void
25
     */
26
    public function decorate(Cell $cell)
27
    {
28
        $cell->setValue(str_limit($cell->getUnescapedValue(), $this->limit));
29
    }
30
}
31