Skip to content
This repository was archived by the owner on Jul 8, 2023. It is now read-only.

Commit 7705311

Browse files
committed
Fixing namespacing issues. Relates to #13.
1 parent 075664d commit 7705311

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/Eloquent/Enumeration/Enumeration.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace Eloquent\Enumeration;
1313

14-
use Exception;
15-
1614
/**
1715
* Base class for C++ style enumerations.
1816
*/

src/Eloquent/Enumeration/Multiton.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111

1212
namespace Eloquent\Enumeration;
1313

14+
use Eloquent\Enumeration\Exception\ExtendsConcreteException;
15+
use Eloquent\Enumeration\Exception\UndefinedInstanceException;
16+
use Exception;
17+
1418
/**
1519
* Base class for Java style enumerations.
1620
*/
@@ -38,7 +42,7 @@ public static final function multitonInstances()
3842
* @param string $key The string key associated with the member instance.
3943
*
4044
* @return Multiton The member instance associated with the given string key.
41-
* @throws Exception\UndefinedInstanceException If no associated instance is found.
45+
* @throws UndefinedInstanceException If no associated instance is found.
4246
*/
4347
public static final function instanceByKey($key)
4448
{
@@ -57,7 +61,7 @@ public static final function instanceByKey($key)
5761
* @param mixed $value The value to match.
5862
*
5963
* @return Multiton The first member instance for which $instance->{$property}() === $value.
60-
* @throws Exception\UndefinedInstanceException If no associated instance is found.
64+
* @throws UndefinedInstanceException If no associated instance is found.
6165
*/
6266
public static final function instanceBy($property, $value) {
6367
foreach (static::multitonInstances() as $instance) {
@@ -75,7 +79,7 @@ public static final function instanceBy($property, $value) {
7579
* @param callback $predicate The predicate applies to the multiton instance to find a match.
7680
*
7781
* @return Multiton The first member instance for which $predicate($instance) evaluates to boolean true.
78-
* @throws Exception\UndefinedInstanceException If no associated instance is found.
82+
* @throws UndefinedInstanceException If no associated instance is found.
7983
*/
8084
public static final function instanceByPredicate($predicate) {
8185
foreach (static::multitonInstances() as $instance) {
@@ -94,7 +98,7 @@ public static final function instanceByPredicate($predicate) {
9498
* @param array $arguments Ignored.
9599
*
96100
* @return Multiton The member instance associated with the given string key.
97-
* @throws Exception\UndefinedInstanceException If no associated instance is found.
101+
* @throws UndefinedInstanceException If no associated instance is found.
98102
*/
99103
public static final function __callStatic($key, array $arguments)
100104
{
@@ -142,15 +146,15 @@ protected static function initializeMultiton() {}
142146
* @param mixed $value
143147
* @param Exception|null $previous
144148
*
145-
* @return Exception\UndefinedInstanceExceptionInterface
149+
* @return UndefinedInstanceExceptionInterface
146150
*/
147151
protected static function createUndefinedInstanceException(
148152
$className,
149153
$property,
150154
$value,
151155
Exception $previous = null
152156
) {
153-
return new Exception\UndefinedInstanceException($className, $property, $value, $previous);
157+
return new UndefinedInstanceException($className, $property, $value, $previous);
154158
}
155159

156160
/**
@@ -163,7 +167,7 @@ protected static function createUndefinedInstanceException(
163167
*
164168
* @param string $key The string key to associate with this member instance.
165169
*
166-
* @throws Exception\ExtendsConcreteException If the constructed instance has an invalid inheritance hierarchy.
170+
* @throws ExtendsConcreteException If the constructed instance has an invalid inheritance hierarchy.
167171
*/
168172
protected function __construct($key)
169173
{
@@ -180,14 +184,14 @@ protected function __construct($key)
180184
* also handle registration of the instance.
181185
*
182186
* @param Multiton $instance The instance to register.
183-
* @throws Exception\ExtendsConcreteException If the supplied instance has an invalid inheritance hierarchy.
187+
* @throws ExtendsConcreteException If the supplied instance has an invalid inheritance hierarchy.
184188
*/
185189
private static function registerMultiton(self $instance)
186190
{
187191
$reflector = new \ReflectionObject($instance);
188192
$parentClass = $reflector->getParentClass();
189193
if (!$parentClass->isAbstract()) {
190-
throw new Exception\ExtendsConcreteException(
194+
throw new ExtendsConcreteException(
191195
get_class($instance)
192196
, $parentClass->getName()
193197
);

0 commit comments

Comments
 (0)