Skip to content

Commit 0802362

Browse files
authored
Merge pull request #19 from J-Ben87/master
Allow retrieving all registered enums from registry
2 parents 2edaf33 + c7c8133 commit 0802362

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

Registry/EnumRegistry.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,12 @@ public function has($name)
4747
{
4848
return isset($this->enums[$name]);
4949
}
50+
51+
/**
52+
* @inheritDoc
53+
*/
54+
public function all()
55+
{
56+
return $this->enums;
57+
}
5058
}

Registry/EnumRegistryInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,9 @@ public function get($name);
3232
* @return bool
3333
*/
3434
public function has($name);
35+
36+
/**
37+
* @return EnumInterface[]
38+
*/
39+
public function all();
3540
}

Tests/Registry/EnumRegistryTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,6 @@ public function testAddNominal()
5656

5757
$this->assertSame($gender, $this->registry->get('gender'));
5858
$this->assertSame($type, $this->registry->get('state'));
59+
$this->assertSame(['gender' => $gender, 'state' => $type], $this->registry->all());
5960
}
6061
}

0 commit comments

Comments
 (0)