-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from young-steveo/separate-resolver
Separate resolver into Codex library.
- Loading branch information
Showing
50 changed files
with
534 additions
and
435 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Arcanum\Codex; | ||
|
||
use Psr\Container\ContainerInterface; | ||
|
||
interface ClassResolver | ||
{ | ||
/** | ||
* Resolve a class. | ||
* | ||
* @template T of object | ||
* @param class-string<T>|(callable(ContainerInterface): T) $className | ||
* @return T | ||
* @throws Error\UnknownClass | ||
* @throws Error\UnresolvableClass | ||
* @throws Error\UnresolvablePrimitive | ||
* @throws Error\UnresolvableUnionType | ||
*/ | ||
public function resolve(string|callable $className, bool $isDependency = false): object; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Arcanum\Codex\Event; | ||
|
||
final class ClassRequested extends \Arcanum\Echo\Event implements CodexEvent | ||
{ | ||
/** | ||
* @param class-string $class | ||
*/ | ||
public function __construct(private string $class) | ||
{ | ||
} | ||
|
||
/** | ||
* Get the class name. | ||
* | ||
* @return class-string | ||
*/ | ||
public function className(): string | ||
{ | ||
return $this->class; | ||
} | ||
|
||
/** | ||
* Get the class. | ||
* | ||
* Will return null if the class is not yet resolved. | ||
*/ | ||
public function class(): object|null | ||
{ | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Arcanum\Codex\Event; | ||
|
||
final class ClassResolved extends \Arcanum\Echo\Event implements CodexEvent | ||
{ | ||
/** | ||
* @param object $class | ||
*/ | ||
public function __construct(private object $class) | ||
{ | ||
} | ||
|
||
/** | ||
* Get the class name. | ||
* | ||
* @return class-string | ||
*/ | ||
public function className(): string | ||
{ | ||
return get_class($this->class); | ||
} | ||
|
||
/** | ||
* Get the class. | ||
* | ||
* Will return null if the class is not yet resolved. | ||
*/ | ||
public function class(): object|null | ||
{ | ||
return $this->class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Arcanum\Codex\Event; | ||
|
||
interface CodexEvent | ||
{ | ||
/** | ||
* Get the class name. | ||
* | ||
* @return class-string | ||
*/ | ||
public function className(): string; | ||
|
||
/** | ||
* Get the class. | ||
* | ||
* Will return null if the class is not yet resolved. | ||
*/ | ||
public function class(): object|null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Arcanum\Codex; | ||
|
||
/** | ||
* If Arcanum\Codex\EventDispatcher is resolved by Codex, | ||
* it will retain a reference to it and dispatch events to it. | ||
*/ | ||
interface EventDispatcher extends \Psr\EventDispatcher\EventDispatcherInterface | ||
{ | ||
} |
Oops, something went wrong.