Compare commits
4 Commits
5fa1832928
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| b5850e4fc3 | |||
| 6f05915e06 | |||
| 865f50ad9b | |||
| e91a72117a |
@@ -3,7 +3,9 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.4",
|
"php": "^8.4",
|
||||||
"potter/cloneable": "dev-main"
|
"potter/cloneable": "dev-main",
|
||||||
|
"potter/throwable": "dev-main",
|
||||||
|
"psr/container": "^2.0@dev"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ declare(strict_types=1);
|
|||||||
namespace Potter\Aware;
|
namespace Potter\Aware;
|
||||||
|
|
||||||
use \Potter\Cloneable\CloneableInterface;
|
use \Potter\Cloneable\CloneableInterface;
|
||||||
|
use \Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
interface AwareInterface extends CloneableInterface
|
interface AwareInterface extends CloneableInterface, ContainerInterface
|
||||||
{
|
{
|
||||||
public function get(string $key): mixed;
|
public function get(string $key): mixed;
|
||||||
public function has(string $key): bool;
|
public function has(string $key): bool;
|
||||||
|
|||||||
@@ -14,8 +14,11 @@ trait AwareTrait
|
|||||||
|
|
||||||
final public function get(string $key): mixed
|
final public function get(string $key): mixed
|
||||||
{
|
{
|
||||||
|
if ($this->has($key)) {
|
||||||
return $this->aware[$key];
|
return $this->aware[$key];
|
||||||
}
|
}
|
||||||
|
throw new NotFoundException;
|
||||||
|
}
|
||||||
|
|
||||||
final public function has(string $key): bool
|
final public function has(string $key): bool
|
||||||
{
|
{
|
||||||
|
|||||||
13
src/Potter/Aware/NotFoundException.php
Normal file
13
src/Potter/Aware/NotFoundException.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Potter\Aware;
|
||||||
|
|
||||||
|
use \Psr\Container\NotFoundExceptionInterface;
|
||||||
|
use \Potter\Throwable\Throwable;
|
||||||
|
|
||||||
|
final class NotFoundException extends Throwable implements NotFoundExceptionInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user