Completed
Push — master ( 88bd1f...97f8b7 )
by Alfred
08:29 queued 06:50
created

BaseGherkinToDusk::getFilesystem()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
4
namespace GD;
5
6
use Behat\Gherkin\Parser;
7
use Illuminate\Filesystem\Filesystem;
8
9
class BaseGherkinToDusk
10
{
11
12
    protected $features_folder = '/tests/features/';
13
14
    protected $source_path = null;
15
16
    protected $context = "domain";
17
18
    protected $path_to_feature = null;
19
20
21
22
    /**
23
     * Conventions
24
     * file should be in tests/features for now
25
     * @var null
26
     */
27
    protected $file_name = null;
28
29
    protected $file_name_and_path = null;
30
31
    protected $destination_folder_root = null;
32
33
    /**
34
     * @var Filesystem
35
     */
36
    protected $filesystem;
37
38
    /**
39
     * @var Parser
40
     */
41
    protected $parser;
42
43 18
    public function __construct(Filesystem $filesystem, Parser $parser = null)
44
    {
45 18
        $this->filesystem = $filesystem;
46 18
        $this->parser = $parser;
47 18
    }
48
49
50
    public function getFileName()
51
    {
52
        return $this->file_name;
53
    }
54
55
    public function setFileName($file_name)
56
    {
57
        $this->file_name = $file_name;
58
        return $this;
59
    }
60
61
    /**
62
     * @return Filesystem
63
     */
64 6
    public function getFilesystem()
65
    {
66 6
        return $this->filesystem;
67
    }
68
69
    /**
70
     * @param null $filesystem
71
     * @return $this
72
     */
73
    public function setFilesystem($filesystem = null)
74
    {
75
        $this->filesystem = $filesystem;
76
        return $this;
77
    }
78
79
    /**
80
     * @return null
81
     */
82
    public function getFileNameAndPath()
83
    {
84
        if ($this->file_name_and_path == null) {
85
            $this->setFileNameAndPath();
86
        }
87
        return $this->file_name_and_path;
88
    }
89
90
    /**
91
     * @param null $file_name_and_path
92
     */
93
    public function setFileNameAndPath($file_name_and_path = null)
94
    {
95
        if (!$file_name_and_path) {
96
            $file_name_and_path =
97
                $this->getSourcePath() . $this->features_folder . $this->getFileName();
98
        }
99
100
        $this->file_name_and_path = $file_name_and_path;
101
102
        return $this;
103
    }
104
105
106
107
    /**
108
     * @return null
109
     */
110 18
    public function getSourcePath()
111
    {
112 18
        if ($this->source_path == null) {
113 18
            $this->setSourcePath();
114 12
        }
115 18
        return $this->source_path;
116
    }
117
118
    /**
119
     * @param null $source_path
120
     */
121 18
    public function setSourcePath($source_path = null)
122
    {
123 18
        if (!$source_path) {
124 18
            $source_path = getcwd() . '/tests/features/';
125 12
        }
126
127 18
        $this->source_path = $source_path;
128 18
    }
129
130
    /**
131
     * @return null
132
     */
133
    public function getDestinationFolderRoot()
134
    {
135
        return $this->destination_folder_root;
136
    }
137
138
    /**
139
     * @param null $destination_folder_root
140
     */
141
    public function setDestinationFolderRoot($destination_folder_root = null)
142
    {
143
        if (!$destination_folder_root) {
144
            $destination_folder_root = getcwd() . '/tests/';
145
        }
146
147
        $this->destination_folder_root = $destination_folder_root;
148
    }
149
150
    /**
151
     * @return string
152
     */
153
    public function getContext()
154
    {
155
        return $this->context;
156
    }
157
158
    /**
159
     * @param string $context
160
     * @return $this
161
     */
162
    public function setContext($context)
163
    {
164
        $this->context = $context;
165
        return $this;
166
    }
167
168
    /**
169
     * @return null
170
     */
171 6
    public function getPathToFeature()
172
    {
173 6
        return $this->path_to_feature;
174
    }
175
176
    /**
177
     * @param null $path_to_feature
178
     * @return $this
179
     */
180 6
    public function setPathToFeature($path_to_feature)
181
    {
182 6
        $this->path_to_feature = $path_to_feature;
183 6
        return $this;
184
    }
185
}
186