|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
namespace SRF\Graph; |
|
5
|
|
|
|
|
6
|
|
|
/** |
|
7
|
|
|
* Represents a set of Options for the Graph Printer |
|
8
|
|
|
* |
|
9
|
|
|
* |
|
10
|
|
|
* @license GNU GPL v2+ |
|
11
|
|
|
* @since 3.2 |
|
12
|
|
|
* |
|
13
|
|
|
* @author Sebastian Schmid (gesinn.it) |
|
14
|
|
|
* |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
class GraphOptions { |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @var string |
|
21
|
|
|
*/ |
|
22
|
|
|
private $graphName; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @var string |
|
26
|
|
|
*/ |
|
27
|
|
|
private $graphSize; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @var string |
|
31
|
|
|
*/ |
|
32
|
|
|
private $nodeShape; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var string |
|
36
|
|
|
*/ |
|
37
|
|
|
private $nodeLabel; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var string |
|
41
|
|
|
*/ |
|
42
|
|
|
private $rankDir; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @var int |
|
46
|
|
|
*/ |
|
47
|
|
|
private $wordWrapLimit; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @var string |
|
51
|
|
|
*/ |
|
52
|
|
|
private $parentRelation; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @var boolean |
|
56
|
|
|
*/ |
|
57
|
|
|
private $enableGraphLink; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @var boolean |
|
61
|
|
|
*/ |
|
62
|
|
|
private $showGraphLabel; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @var boolean |
|
66
|
|
|
*/ |
|
67
|
|
|
private $showGraphColor; |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @var boolean |
|
71
|
|
|
*/ |
|
72
|
|
|
private $showGraphLegend; |
|
73
|
|
|
|
|
74
|
|
|
public function __construct( $options ) { |
|
75
|
|
|
|
|
76
|
|
|
$this->graphName = trim( $options['graphname'] ); |
|
77
|
|
|
$this->graphSize = trim( $options['graphsize'] ); |
|
78
|
|
|
$this->nodeShape = trim( $options['nodeshape'] ); |
|
79
|
|
|
$this->nodeLabel = trim( $options['nodelabel'] ); |
|
80
|
|
|
$this->rankDir = strtoupper( trim( $options['arrowdirection'] ) ); |
|
81
|
|
|
$this->wordWrapLimit = trim( $options['wordwraplimit'] ); |
|
|
|
|
|
|
82
|
|
|
$this->parentRelation = strtolower( trim( $options['relation'] ) ) == 'parent'; |
|
|
|
|
|
|
83
|
|
|
$this->enableGraphLink = trim($options['graphlink']); |
|
|
|
|
|
|
84
|
|
|
$this->showGraphLabel = trim($options['graphlabel']); |
|
|
|
|
|
|
85
|
|
|
$this->showGraphColor = trim($options['graphcolor']); |
|
|
|
|
|
|
86
|
|
|
$this->showGraphLegend = trim( $options['graphlegend'] ); |
|
|
|
|
|
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @return string |
|
91
|
|
|
*/ |
|
92
|
|
|
public function getGraphName(): string { |
|
93
|
|
|
return $this->graphName; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @return string |
|
98
|
|
|
*/ |
|
99
|
|
|
public function getGraphSize(): string { |
|
100
|
|
|
return $this->graphSize; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* @return string |
|
105
|
|
|
*/ |
|
106
|
|
|
public function getNodeShape(): string { |
|
107
|
|
|
return $this->nodeShape; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* @return string |
|
112
|
|
|
*/ |
|
113
|
|
|
public function getNodeLabel(): string { |
|
114
|
|
|
return $this->nodeLabel; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* @return string |
|
119
|
|
|
*/ |
|
120
|
|
|
public function getRankDir(): string { |
|
121
|
|
|
return $this->rankDir; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* @return int |
|
126
|
|
|
*/ |
|
127
|
|
|
public function getWordWrapLimit(): int { |
|
128
|
|
|
return $this->wordWrapLimit; |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
/** |
|
132
|
|
|
* @return string |
|
133
|
|
|
*/ |
|
134
|
|
|
public function getParentRelation(): string { |
|
135
|
|
|
return $this->parentRelation; |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
/** |
|
139
|
|
|
* @return bool |
|
140
|
|
|
*/ |
|
141
|
|
|
public function isGraphLink(): bool { |
|
142
|
|
|
return $this->enableGraphLink; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* @return bool |
|
147
|
|
|
*/ |
|
148
|
|
|
public function isGraphLabel(): bool { |
|
149
|
|
|
return $this->showGraphLabel; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @return bool |
|
154
|
|
|
*/ |
|
155
|
|
|
public function isGraphColor(): bool { |
|
156
|
|
|
return $this->showGraphColor; |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* @return bool |
|
161
|
|
|
*/ |
|
162
|
|
|
public function isGraphLegend(): bool { |
|
163
|
|
|
return $this->showGraphLegend; |
|
164
|
|
|
} |
|
165
|
|
|
} |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.