forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgtOptionalSections.php
85 lines (63 loc) · 1.63 KB
/
gtOptionalSections.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
class gtOptionalSections {
private $optSections = array(
'skipif' => false,
'ini' => false,
'clean' => false,
'done' => false,
);
private $skipifKey = '';
private $skipifExt = '';
public function setOptions($commandLineOptions) {
if($commandLineOptions->hasOption('s')) {
$options = explode(':', $commandLineOptions->getOption('s'));
foreach($options as $option) {
if(array_key_exists($option, $this->optSections )) {
$this->optSections[$option] = true;
} else {
throw new gtUnknownSectionException('Unrecognised optional section');
}
}
if($commandLineOptions->hasOption('k')) {
$this->skipifKey = $commandLineOptions->getOption('k');
}
if($commandLineOptions->hasOption('x')) {
$this->skipifExt = $commandLineOptions->getOption('x');
}
}
}
public function getOptions() {
return $this->optSections;
}
public function getSkipifKey() {
return $this->skipifKey;
}
public function getSkipifExt() {
return $this->skipifExt;
}
public function hasSkipif() {
return $this->optSections['skipif'];
}
public function hasSkipifKey() {
if($this->skipifKey != '') {
return true;
}
return false;
}
public function hasSkipifExt() {
if($this->skipifExt != '') {
return true;
}
return false;
}
public function hasIni() {
return $this->optSections['ini'];
}
public function hasClean() {
return $this->optSections['clean'];
}
public function hasDone() {
return $this->optSections['done'];
}
}
?>