PyStringNode   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 73
ccs 12
cts 14
cp 0.8571
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getNodeType() 0 4 1
A getStrings() 0 4 1
A getRaw() 0 4 1
A __toString() 0 4 1
A getLine() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Behat Gherkin.
5
 * (c) Konstantin Kudryashov <[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 Behat\Gherkin\Node;
12
13
/**
14
 * Represents Gherkin PyString argument.
15
 *
16
 * @author Konstantin Kudryashov <[email protected]>
17
 */
18
class PyStringNode implements ArgumentInterface
19
{
20
    /**
21
     * @var array
22
     */
23
    private $strings = array();
24
    /**
25
     * @var integer
26
     */
27
    private $line;
28
29
    /**
30
     * Initializes PyString.
31
     *
32
     * @param array   $strings String in form of [$stringLine]
33
     * @param integer $line    Line number where string been started
34
     */
35 14
    public function __construct(array $strings, $line)
36
    {
37 14
        $this->strings = $strings;
38 14
        $this->line = $line;
39 14
    }
40
41
    /**
42
     * Returns node type.
43
     *
44
     * @return string
45
     */
46
    public function getNodeType()
47
    {
48
        return 'PyString';
49
    }
50
51
    /**
52
     * Returns entire PyString lines set.
53
     *
54
     * @return array
55
     */
56 2
    public function getStrings()
57
    {
58 2
        return $this->strings;
59
    }
60
61
    /**
62
     * Returns raw string.
63
     *
64
     * @return string
65
     */
66 3
    public function getRaw()
67
    {
68 3
        return implode("\n", $this->strings);
69
    }
70
71
    /**
72
     * Converts PyString into string.
73
     *
74
     * @return string
75
     */
76 1
    public function __toString()
77
    {
78 1
        return $this->getRaw();
79
    }
80
81
    /**
82
     * Returns line number at which PyString was started.
83
     *
84
     * @return integer
85
     */
86 1
    public function getLine()
87
    {
88 1
        return $this->line;
89
    }
90
}
91