1: <?php
2:
3: namespace Deimos\Flow;
4:
5: class FlowForeach
6: {
7:
8: /**
9: * @var array
10: */
11: protected $state = [];
12:
13: /**
14: * @param string $name
15: * @param array $storage
16: */
17: public function register($name, array $storage)
18: {
19: $this->state[$name] = new ForeachState($storage);
20: }
21:
22: /**
23: * @param string $name
24: *
25: * @return ForeachState
26: */
27: public function __get($name)
28: {
29: return $this->state[$name];
30: }
31:
32: /**
33: * @param string $name
34: * @param array $arguments
35: *
36: * @return mixed
37: */
38: public function __call($name, array $arguments)
39: {
40: return call_user_func_array($this->state[$name], $arguments);
41: }
42:
43: /**
44: * @param string $name
45: * @param mixed $value
46: */
47: public function __set($name, $value)
48: {
49: $this->register($name, $value);
50: }
51:
52: /**
53: * @param string $name
54: *
55: * @return bool
56: */
57: public function __isset($name)
58: {
59: return isset($this->state[$name]);
60: }
61:
62: }