Add has() Method
This commit is contained in:
@@ -7,4 +7,5 @@ namespace Potter\Aware;
|
|||||||
abstract class AbstractAware implements AwareInterface
|
abstract class AbstractAware implements AwareInterface
|
||||||
{
|
{
|
||||||
abstract public function get(string $key): mixed;
|
abstract public function get(string $key): mixed;
|
||||||
|
abstract public function has(string $key): bool;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ namespace Potter\Aware;
|
|||||||
interface AwareInterface
|
interface AwareInterface
|
||||||
{
|
{
|
||||||
public function get(string $key): mixed;
|
public function get(string $key): mixed;
|
||||||
|
public function has(string $key): bool;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,9 @@ trait AwareTrait
|
|||||||
{
|
{
|
||||||
return $this->aware[$key];
|
return $this->aware[$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final public function has(string $key): bool
|
||||||
|
{
|
||||||
|
return array_key_exists($key, $array);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user