1 | <?php |
||
22 | class MiddlewareBuilder |
||
23 | { |
||
24 | const COMMON_GROUP = 'common'; |
||
25 | |||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $middlewares = []; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $rooms = []; |
||
35 | |||
36 | /** |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $resolvedMiddlewares = []; |
||
40 | |||
41 | /** |
||
42 | * @var bool |
||
43 | */ |
||
44 | protected $built = false; |
||
45 | |||
46 | /** |
||
47 | * @param string $middleware |
||
48 | * @param string $group |
||
49 | * @return $this |
||
50 | */ |
||
51 | public function registerMiddleware(string $middleware, string $group = self::COMMON_GROUP) |
||
61 | |||
62 | /** |
||
63 | * @TODO Improve container |
||
64 | * @param GitterRoom $room |
||
65 | * @param array $groups |
||
66 | * @return $this |
||
67 | */ |
||
68 | public function registerRoom(GitterRoom $room, array $groups = []) |
||
77 | |||
78 | /** |
||
79 | * @param $name |
||
80 | * @return array |
||
81 | */ |
||
82 | protected function getGroup($name) |
||
88 | |||
89 | /** |
||
90 | * @return $this |
||
91 | */ |
||
92 | protected function build() |
||
115 | |||
116 | /** |
||
117 | * @param GitterRoom $room |
||
118 | * @return mixed |
||
119 | */ |
||
120 | protected function getExtensionByRoom(GitterRoom $room) |
||
133 | |||
134 | /** |
||
135 | * @param GitterRoom $room |
||
136 | * @param Message $message |
||
137 | * @return $this |
||
138 | */ |
||
139 | public function fire(GitterRoom $room, Message $message) |
||
148 | } |
||
149 |