Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| DecimalLength | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
1 / 1 |
| renderLength | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
3 | |||
| 1 | <?php declare(strict_types=1); |
| 2 | /* |
| 3 | * This file is part of Aplus Framework Database Library. |
| 4 | * |
| 5 | * (c) Natan Felles <natanfelles@gmail.com> |
| 6 | * |
| 7 | * For the full copyright and license information, please view the LICENSE |
| 8 | * file that was distributed with this source code. |
| 9 | */ |
| 10 | namespace Framework\Database\Definition\Table\Columns\Traits; |
| 11 | |
| 12 | /** |
| 13 | * Trait DecimalLength. |
| 14 | * |
| 15 | * @package database |
| 16 | */ |
| 17 | trait DecimalLength |
| 18 | { |
| 19 | protected function renderLength() : ?string |
| 20 | { |
| 21 | if ( ! isset($this->length[0])) { |
| 22 | return null; |
| 23 | } |
| 24 | $maximum = $this->database->quote($this->length[0]); |
| 25 | if (isset($this->length[1])) { |
| 26 | $decimals = $this->database->quote($this->length[1]); |
| 27 | $maximum .= ",{$decimals}"; |
| 28 | } |
| 29 | return "({$maximum})"; |
| 30 | } |
| 31 | } |