File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77class Registry {
88
9- /**
10- * @var array
11- */
12- public $ counter = [];
13-
14- /**
15- * @var array
16- */
17- public $ created = [];
18-
199 /**
2010 * List of all callbacks
2111 *
2212 * @var array
2313 */
24- protected $ callbacks = array () ;
14+ protected $ callbacks = [] ;
2515
2616 /**
2717 * List of all connections
2818 *
2919 * @var array
3020 */
31- protected $ registry = array () ;
21+ protected $ registry = [] ;
3222
3323 /**
3424 * Set a new connection callback
@@ -38,15 +28,12 @@ class Registry {
3828 * @return $this
3929 * @throws Exception
4030 */
41- public function set (string $ name , callable $ callback ):Registry
31+ public function set (string $ name , callable $ callback ): self
4232 {
4333 if (\array_key_exists ($ name , $ this ->callbacks )) {
4434 throw new Exception ('Callback with the name " ' . $ name . '" already exists ' );
4535 }
4636
47- $ this ->counter [$ name ] = 0 ;
48- $ this ->created [$ name ] = 0 ;
49-
5037 $ this ->callbacks [$ name ] = $ callback ;
5138
5239 return $ this ;
@@ -67,13 +54,9 @@ public function get(string $name, $fresh = false)
6754 throw new Exception ('No callback named " ' . $ name . '" found when trying to create connection ' );
6855 }
6956
70- $ this ->created [$ name ]++;
71-
7257 $ this ->registry [$ name ] = $ this ->callbacks [$ name ]();
7358 }
7459
75- $ this ->counter [$ name ]++;
76-
7760 return $ this ->registry [$ name ];
7861 }
7962}
You can’t perform that action at this time.
0 commit comments