1 | <?php |
||
17 | class GraphBuilder |
||
18 | { |
||
19 | /** |
||
20 | * @var array |
||
21 | */ |
||
22 | private $eventLayout = array(); |
||
23 | |||
24 | /** |
||
25 | * @var array |
||
26 | */ |
||
27 | private $stateLayout = array(); |
||
28 | |||
29 | /** |
||
30 | * @var \SplObjectStorage |
||
31 | */ |
||
32 | private $layoutCallback; |
||
33 | |||
34 | /** |
||
35 | * @var Graph |
||
36 | */ |
||
37 | private $graph; |
||
38 | |||
39 | /** |
||
40 | * @var StringConverterInterface |
||
41 | */ |
||
42 | private $stringConverter; |
||
43 | |||
44 | /** |
||
45 | * @param Graph $graph |
||
46 | * @param StringConverterInterface $stringConverter |
||
47 | */ |
||
48 | 1 | public function __construct(Graph $graph, StringConverterInterface $stringConverter = null) |
|
49 | { |
||
50 | 1 | $this->layoutCallback = new \SplObjectStorage(); |
|
51 | 1 | $this->graph = $graph; |
|
52 | 1 | if ($stringConverter) { |
|
53 | 1 | $this->stringConverter = $stringConverter; |
|
54 | } else { |
||
55 | 1 | $this->stringConverter = new StringConverter(); |
|
56 | } |
||
57 | 1 | } |
|
58 | |||
59 | /** |
||
60 | * @link http://www.graphviz.org/doc/info/attrs.html |
||
61 | * |
||
62 | * @param string $flag |
||
63 | * @param scalar $value |
||
64 | * @param array $layout |
||
65 | */ |
||
66 | public function setEventLayout($flag, $value, array $layout) |
||
71 | |||
72 | /** |
||
73 | * @link http://www.graphviz.org/doc/info/attrs.html |
||
74 | * |
||
75 | * @param string $flag |
||
76 | * @param scalar $value |
||
77 | * @param array $layout |
||
78 | */ |
||
79 | public function setStateLayout($flag, $value, array $layout) |
||
80 | { |
||
81 | $value = (string) $value; |
||
82 | $this->stateLayout[$flag][$value] = $layout; |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * @param Callback $callback |
||
87 | */ |
||
88 | public function attachLayoutCallback(Callback $callback) |
||
92 | |||
93 | /** |
||
94 | * @param Callback $callback |
||
95 | */ |
||
96 | public function detachLayoutCallback(Callback $callback) |
||
100 | |||
101 | /** |
||
102 | * @param \ArrayAccess $flaggedObject |
||
103 | * @param array $layout |
||
104 | * |
||
105 | * @return array |
||
106 | */ |
||
107 | 1 | protected function getLayoutOptions(\ArrayAccess $flaggedObject, array $layout) |
|
127 | |||
128 | /** |
||
129 | * @param StateInterface $state |
||
130 | * |
||
131 | * @return \Fhaculty\Graph\Vertex |
||
132 | */ |
||
133 | 1 | public function createStatusVertex(StateInterface $state) |
|
134 | { |
||
135 | 1 | $stateName = $state->getName(); |
|
136 | 1 | $vertex = $this->graph->createVertex($stateName, true); |
|
137 | 1 | if ($state instanceof \ArrayAccess) { |
|
138 | 1 | $layout = $this->getLayoutOptions($state, $this->stateLayout); |
|
139 | 1 | if (method_exists($vertex, 'setLayout')) { |
|
140 | 1 | $vertex->setLayout($layout); |
|
|
|||
141 | 1 | } else { |
|
142 | foreach ($layout as $name => $value) { |
||
143 | $vertex->setAttribute('graphviz.' . $name, $value); |
||
144 | } |
||
145 | } |
||
146 | 1 | } |
|
147 | |||
148 | 1 | return $vertex; |
|
149 | } |
||
150 | |||
151 | /** |
||
152 | * @param EventInterface $event |
||
153 | * |
||
154 | * @return string |
||
155 | */ |
||
156 | protected function convertObserverToString(EventInterface $event) |
||
165 | |||
166 | /** |
||
167 | * @param TransitionInterface $transition |
||
168 | * |
||
169 | * @return string |
||
170 | */ |
||
171 | 1 | protected function getTransitionLabel(StateInterface $state, TransitionInterface $transition) |
|
192 | |||
193 | /** |
||
194 | * @param StateInterface $state |
||
195 | * @param TransitionInterface $transition |
||
196 | */ |
||
197 | 1 | protected function addTransition(StateInterface $state, TransitionInterface $transition) |
|
226 | |||
227 | /** |
||
228 | * @param StateInterface $state |
||
229 | */ |
||
230 | 1 | public function addState(StateInterface $state) |
|
238 | |||
239 | /** |
||
240 | * @param \Traversable $states |
||
241 | */ |
||
242 | 1 | public function addStates(\Traversable $states) |
|
248 | |||
249 | /** |
||
250 | * @param StateCollectionInterface $stateCollection |
||
251 | */ |
||
252 | 1 | public function addStateCollection(StateCollectionInterface $stateCollection) |
|
256 | |||
257 | /** |
||
258 | * @return \Fhaculty\Graph\Graph |
||
259 | */ |
||
260 | public function getGraph() |
||
264 | } |
||
265 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.