PrettyPrinter::pExpr_Array()   A
last analyzed

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
    protected function pExpr_Array(Expr\Array_ $node)
13
    {
14
        $syntax = $node->getAttribute(
15
            'kind',
16
            $this->options['shortArraySyntax'] ? Expr\Array_::KIND_SHORT : Expr\Array_::KIND_LONG
17
        );
18
        if ($syntax === Expr\Array_::KIND_SHORT) {
19
            return '[' . $this->pCommaSeparatedMultiline($node->items, true) . $this->nl . ']';
20
        } else {
21
            return 'array(' . $this->pCommaSeparatedMultiline($node->items, true) . $this->nl . ')';
22
        }
23
    }
24
}
25