Skip to content

Commit 04d5b6f

Browse files
committed
Move "exists" logic to builder
1 parent 29c02e8 commit 04d5b6f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/StaticEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static public function get($identifier)
5050
*/
5151
static public function exists($id)
5252
{
53-
return in_array($id, self::getBuilder()->getIds(), true);
53+
return self::getBuilder()->hasId($id);
5454
}
5555

5656
/**

src/StaticEntityBuilder.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ public function getAll()
8282
return $this->instances;
8383
}
8484

85+
/**
86+
* @param mixed $id
87+
*
88+
* @return bool
89+
*/
90+
public function hasId($id)
91+
{
92+
return in_array($id, $this->ids, true);
93+
}
94+
8595
/**
8696
* @throws \Exception
8797
*

0 commit comments

Comments
 (0)