YamlStringNode::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 10
cc 1
nc 1
nop 2
crap 2
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Behat\Gherkin;
12
13
use Behat\Gherkin\Node\PyStringNode;
14
use Symfony\Component\Yaml\Yaml;
15
16
/**
17
 * Represents Gherkin PyString argument with YAML support
18
 */
19
class YamlStringNode extends PyStringNode
20
{
21
    /**
22
     * @var []
0 ignored issues
show
Documentation Bug introduced by
The doc comment [] at position 0 could not be parsed: Unknown type name '[' at position 0 in [].
Loading history...
23
     */
24
    protected $array;
25
26
    /**
27
     * Initializes PyString.
28
     *
29
     * @param array   $strings String in form of [$stringLine]
30
     * @param integer $line    Line number where string been started
31
     */
32
    public function __construct(array $strings, $line)
33
    {
34
        parent::__construct($strings, $line);
35
36
        $this->array = Yaml::parse($this->getRaw());
37
    }
38
39
    /**
40
     * @return mixed
41
     */
42
    public function toArray()
43
    {
44
        return $this->array;
45
    }
46
47
    /**
48
     * @param mixed $array
49
     */
50
    public function setArray($array): void
51
    {
52
        $this->array = $array;
53
    }
54
}
55