public function testEquals() { $id1 = new Id(10); $id2 = new Id(20); $id3 = new Id(10); $this->assertTrue($id1->equals($id3)); $this->assertFalse($id1->equals($id2)); }
/** * This method is final on purpose isn't supposed to be override, instead add a exists() * * @param Id $id * * @return bool */ public final function existsInternal(Id $id) { return array_key_exists($id->get(), $this->items); }
/** * @param Id $id * * @return bool */ public function equals(Id $id) { return $this->get() === $id->get(); }