Conditions | 5 |
Paths | 8 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 5.2 |
Changes | 4 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
40 | 3 | public function getCellWidth($value, Font $font) |
|
41 | { |
||
42 | 3 | $width = 0.07 * $font->getSize(); |
|
43 | 3 | foreach (preg_split('~~u', $value, -1, PREG_SPLIT_NO_EMPTY) as $character) { |
|
44 | 3 | if (isset($this->characterWidths[$character])) { |
|
45 | 3 | $width += $this->characterWidths[$character]; |
|
46 | 3 | } elseif (strlen($character)) { |
|
47 | $width += 0.06 * $font->getSize(); |
||
48 | } |
||
49 | 3 | } |
|
50 | |||
51 | 3 | return $font->isBold() ? $width * $this->characterWidths['bold'] : $width; |
|
52 | } |
||
53 | |||
64 |