/** * @param Type $other * @return boolean */ public function sameAs(Type $other) { $calledClass = get_called_class(); if (!$other instanceof $calledClass) { return false; } $myProperties = $this->properties(); $otherProperties = $other->properties(); if ($this->description()->hasIdentifier()) { return $myProperties[$this->description()->identifierName()]->type()->sameAs($otherProperties[$this->description()->identifierName()]->type()); } $equalsBuilder = EqualsBuilder::create(); foreach ($this->properties() as $propertyName => $property) { $equalsBuilder->append($property->type()->sameAs($otherProperties[$propertyName]->type())); } return $equalsBuilder->equals(); }
/** * @param Type $other * @return bool */ public function sameAs(Type $other) { if (!$other instanceof DateTime) { return false; } return $this->toString() === $other->toString(); }
/** * @param Type $other * @return boolean */ public function sameAs(Type $other) { if (!$other instanceof AbstractCollection) { return false; } return $this->getInnerIterator() === $other->getInnerIterator(); }
/** * @param Type $other * @return bool */ public function sameAs(Type $other) { if (!$other instanceof SingleValue) { return false; } return $this->value() === $other->value(); }