Completed
Pull Request — master (#35)
by Saif Eddin
02:55 queued 38s
created

ArrayItemPrinter::convert()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 5.3197

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 4
cts 11
cp 0.3636
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 9
nc 4
nop 1
crap 5.3197
1
<?php
2
3
namespace PhpToZephir\Converter\Printer\Expr;
4
5
use PhpParser\Node\Expr;
6
use PhpToZephir\Converter\SimplePrinter;
7
8
class ArrayItemPrinter extends SimplePrinter
9
{
10
    /**
11
     * @return string
12
     */
13 1
    public static function getType()
14
    {
15 1
        return 'pExpr_ArrayItem';
16
    }
17
18
    /**
19
     * @param Expr\ArrayItem $node
20
     *
21
     * @return string
22
     */
23 29
    public function convert(Expr\ArrayItem $node)
24
    {
25 29
        if ($node->byRef) {
26
            $this->logger->logIncompatibility(
27
                'reference',
28
                'Reference not supported',
29
                $node,
30
                $this->dispatcher->getMetadata()->getClass()
31
            );
32
        }
33
34 29
        return (null !== $node->key ? $this->dispatcher->p($node->key).' : ' : '')
35 29
             .$this->dispatcher->p($node->value);
36
    }
37
}
38