Completed
Pull Request — master (#27)
by Hari
09:21
created

PuliTableStyle::borderless()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 13
ccs 0
cts 11
cp 0
rs 9.4286
cc 2
eloc 8
nc 2
nop 0
crap 6
1
<?php
2
3
/*
4
 * This file is part of the puli/cli package.
5
 *
6
 * (c) Bernhard Schussek <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Puli\Cli\Style;
13
14
use Webmozart\Console\Api\Formatter\Style;
15
use Webmozart\Console\UI\Style\BorderStyle;
16
use Webmozart\Console\UI\Style\TableStyle;
17
18
/**
19
 * Contains the default table styles of Puli.
20
 *
21
 * @since  1.0
22
 *
23
 * @author Bernhard Schussek <[email protected]>
24
 */
25
class PuliTableStyle extends TableStyle
26
{
27
    /**
28
     * @var TableStyle
29
     */
30
    private static $borderless;
31
32
    /**
33
     * A borderless style.
34
     *
35
     * @return TableStyle The style.
36
     */
37
    public static function borderless()
38
    {
39
        if (!self::$borderless) {
40
            $borderStyle = BorderStyle::none();
41
            $borderStyle->setLineVCChar('  ');
42
43
            self::$borderless = new static();
44
            self::$borderless->setBorderStyle($borderStyle);
45
            self::$borderless->setHeaderCellStyle(Style::noTag()->bold());
46
        }
47
48
        return clone self::$borderless;
49
    }
50
}
51