Passed
Push — master ( 0524f3...409314 )
by Edward
05:43
created

PrettyPrinter::pExpr_Array()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 7
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 10
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Remorhaz\UniLex\Console;
6
7
use PhpParser\Node\Expr;
8
use PhpParser\PrettyPrinter\Standard;
9
10
final class PrettyPrinter extends Standard
11
{
12
13
    protected function pExpr_Array(Expr\Array_ $node)
14
    {
15
        $syntax = $node->getAttribute(
16
            'kind',
17
            $this->options['shortArraySyntax'] ? Expr\Array_::KIND_SHORT : Expr\Array_::KIND_LONG
18
        );
19
        if ($syntax === Expr\Array_::KIND_SHORT) {
20
            return '[' . $this->pCommaSeparatedMultiline($node->items, true) . $this->nl . ']';
21
        } else {
22
            return 'array(' . $this->pCommaSeparatedMultiline($node->items, true) . $this->nl . ')';
23
        }
24
    }
25
}
26