Completed
Pull Request — master (#41)
by Lars
01:31
created

KeepOriginalValuePrinter::pStmts()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Spatie\Php7to5\PhpParser;
4
5
use PhpParser\Node;
6
use PhpParser\PrettyPrinter\Standard;
7
8
class KeepOriginalValuePrinter extends Standard
9
{
10
    /**
11
     * Pretty prints an array of nodes (statements) and indents them optionally.
12
     *
13
     * @param Node[] $nodes Array of nodes
14
     * @param bool $indent Whether to indent the printed nodes
15
     *
16
     * @return string Pretty printed statements
17
     */
18
    protected function pStmts(array $nodes, bool $indent = true) : string
19
    {
20
        return parent::pStmts($nodes, $indent);
21
    }
22
23
    protected function pScalar_String(Node\Scalar\String_ $node)
24
    {
25
        $str = $node->getAttribute('originalValue');
26
27
        $str = str_replace(
28
            ['"_+*-7-to-5-*+_', '_+*-7-to-5-*+_"', '_+*-7-to-5-*+_'],
29
            ['"', '"', ''],
30
            $str
31
        );
32
33
        return $str;
34
    }
35
}
36