Skip to content

Commit 01ceb89

Browse files
committed
Removed counters
1 parent 2cd2d31 commit 01ceb89

1 file changed

Lines changed: 3 additions & 20 deletions

File tree

src/Registry/Registry.php

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,19 @@
66

77
class 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
}

0 commit comments

Comments
 (0)