From 6fe0bfc36dfdd3cbcda6b1f383b773be1b5b1eb3 Mon Sep 17 00:00:00 2001 From: Jay Potter Date: Sat, 25 Oct 2025 11:30:19 -0400 Subject: [PATCH] Add has() Method --- src/Potter/Aware/AbstractAware.php | 1 + src/Potter/Aware/AwareInterface.php | 1 + src/Potter/Aware/AwareTrait.php | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/src/Potter/Aware/AbstractAware.php b/src/Potter/Aware/AbstractAware.php index a4ba4b1..1bd71e9 100644 --- a/src/Potter/Aware/AbstractAware.php +++ b/src/Potter/Aware/AbstractAware.php @@ -7,4 +7,5 @@ namespace Potter\Aware; abstract class AbstractAware implements AwareInterface { abstract public function get(string $key): mixed; + abstract public function has(string $key): bool; } diff --git a/src/Potter/Aware/AwareInterface.php b/src/Potter/Aware/AwareInterface.php index 5536f31..6e16f57 100644 --- a/src/Potter/Aware/AwareInterface.php +++ b/src/Potter/Aware/AwareInterface.php @@ -7,4 +7,5 @@ namespace Potter\Aware; interface AwareInterface { public function get(string $key): mixed; + public function has(string $key): bool; } diff --git a/src/Potter/Aware/AwareTrait.php b/src/Potter/Aware/AwareTrait.php index 115fbb7..0ad5cad 100644 --- a/src/Potter/Aware/AwareTrait.php +++ b/src/Potter/Aware/AwareTrait.php @@ -12,4 +12,9 @@ trait AwareTrait { return $this->aware[$key]; } + + final public function has(string $key): bool + { + return array_key_exists($key, $array); + } }