StrLimit   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A decorate() 0 4 1
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