diff --git a/src/Interface/MetadataInterface.php b/src/Interface/MetadataInterface.php index 5e097a4..d885301 100644 --- a/src/Interface/MetadataInterface.php +++ b/src/Interface/MetadataInterface.php @@ -30,6 +30,6 @@ interface MetadataInterface * * @return bool `true` if the key is set (regardless of what the value is), otherwise `false`. */ - public function has(string $key): bool; + public function isSet(string $key): bool; } diff --git a/src/Model/Metadata.php b/src/Model/Metadata.php index ada1869..709acfb 100644 --- a/src/Model/Metadata.php +++ b/src/Model/Metadata.php @@ -21,7 +21,7 @@ final class Metadata implements MetadataInterface public function get(string $key): mixed { - if (!$this->has($key)) { + if (!$this->isSet($key)) { throw new MissingKeyException($key); } @@ -35,7 +35,7 @@ final class Metadata implements MetadataInterface return $this; } - public function has(string $key): bool + public function isSet(string $key): bool { return array_key_exists($key, $this->metadata); } diff --git a/tests/Model/MetadataTest.php b/tests/Model/MetadataTest.php index f9a3b34..5c4b3b8 100644 --- a/tests/Model/MetadataTest.php +++ b/tests/Model/MetadataTest.php @@ -47,17 +47,17 @@ final class MetadataTest extends TestCase $this->assertSame($valueB, $result); } - public function testHasReturnsTrueWhenKeyIsSet(): void + public function testIsSetReturnsTrueWhenKeyIsSet(): void { $key = 'null'; $this->metadata->set($key, null); - $result = $this->metadata->has($key); + $result = $this->metadata->isSet($key); $this->assertTrue($result); } - public function testHasReturnsFalseWhenKeyIsNotSet(): void + public function testIsSetReturnsFalseWhenKeyIsNotSet(): void { - $result = $this->metadata->has('missing'); + $result = $this->metadata->isSet('missing'); $this->assertFalse($result); } }