public function testClassEquals() { $util1 = new Util(); $util2 = new Util(); $this->assertTrue(Util::classEquals($util1, $util2)); $this->assertFalse(Util::classEquals($util1, $this)); }
/** * Tells whether two DateTime are equal by comparing their values * * @param ValueObjectInterface $date_time * @return bool */ public function sameValueAs(ValueObjectInterface $date_time) { if (false === Util::classEquals($this, $date_time)) { return false; } return $this->getDate()->sameValueAs($date_time->getDate()) && $this->getTime()->sameValueAs($date_time->getTime()); }
/** * Tells whether two Date are equal by comparing their values * * @param ValueObjectInterface $date * @return bool */ public function sameValueAs(ValueObjectInterface $date) { if (false === Util::classEquals($this, $date)) { return false; } return $this->getYear()->sameValueAs($date->getYear()) && $this->getMonth()->sameValueAs($date->getMonth()) && $this->getDay()->sameValueAs($date->getDay()); }
/** * Tells whether two Integer are equal by comparing their values * * @param ValueObjectInterface $integer * @return bool */ public function sameValueAs(ValueObjectInterface $integer) { if (false === Util::classEquals($this, $integer)) { return false; } return $this->toNative() === $integer->toNative(); }
/** * Tells whether two string literals are equal by comparing their values * * @param ValueObjectInterface $stringLiteral * @return bool */ public function sameValueAs(ValueObjectInterface $stringLiteral) { if (false === Util::classEquals($this, $stringLiteral)) { return false; } return $this->toNative() === $stringLiteral->toNative(); }
/** * Tells whether two Time are equal by comparing their values * * @param ValueObjectInterface $time * @return bool */ public function sameValueAs(ValueObjectInterface $time) { if (false === Util::classEquals($this, $time)) { return false; } return $this->getHour()->sameValueAs($time->getHour()) && $this->getMinute()->sameValueAs($time->getMinute()) && $this->getSecond()->sameValueAs($time->getSecond()); }
/** * Tells whether tow Coordinate objects are equal * * @param ValueObjectInterface $coordinate * @return bool */ public function sameValueAs(ValueObjectInterface $coordinate) { if (false === Util::classEquals($this, $coordinate)) { return false; } return $this->getLatitude()->sameValueAs($coordinate->getLatitude()) && $this->getLongitude()->sameValueAs($coordinate->getLongitude()) && $this->getEllipsoid()->sameValueAs($coordinate->getEllipsoid()); }
public function sameValueAs(ValueObjectInterface $complex) { if (false === Util::classEquals($this, $complex)) { return false; } return $this->getReal()->sameValueAs($complex->getReal()) && $this->getIm()->sameValueAs($complex->getIm()); }
/** * Tells whether two Country are equal * * @param ValueObjectInterface $country * @return bool */ public function sameValueAs(ValueObjectInterface $country) { if (false === Util::classEquals($this, $country)) { return false; } return $this->getCode()->sameValueAs($country->getCode()); }
/** * Tells whether two Street objects are equal * @param ValueObjectInterface $street * @return bool */ public function sameValueAs(ValueObjectInterface $street) { if (false === Util::classEquals($this, $street)) { return false; } return $this->getName()->sameValueAs($street->getName()) && $this->getNumber()->sameValueAs($street->getNumber()) && $this->getElements()->sameValueAs($street->getElements()); }
/** * Tells whether two Url are sameValueAs by comparing their components * * @param ValueObjectInterface $url * @return bool */ public function sameValueAs(ValueObjectInterface $url) { if (false === Util::classEquals($this, $url)) { return false; } return $this->getScheme()->sameValueAs($url->getScheme()) && $this->getUser()->sameValueAs($url->getUser()) && $this->getPassword()->sameValueAs($url->getPassword()) && $this->getDomain()->sameValueAs($url->getDomain()) && $this->getPath()->sameValueAs($url->getPath()) && $this->getPort()->sameValueAs($url->getPort()) && $this->getQueryString()->sameValueAs($url->getQueryString()) && $this->getFragmentIdentifier()->sameValueAs($url->getFragmentIdentifier()); }
/** * Tells whether two KeyValuePair are equal * * @param ValueObjectInterface $keyValuePair * @return bool */ public function sameValueAs(ValueObjectInterface $keyValuePair) { if (false === Util::classEquals($this, $keyValuePair)) { return false; } return $this->getKey()->sameValueAs($keyValuePair->getKey()) && $this->getValue()->sameValueAs($keyValuePair->getValue()); }
/** * Tells whether two Currency are equal by comparing their names * * @param ValueObjectInterface $currency * @return bool */ public function sameValueAs(ValueObjectInterface $currency) { if (false === Util::classEquals($this, $currency)) { return false; } return $this->getCode()->toNative() == $currency->getCode()->toNative(); }
/** * Tells whether two DateTimeZone are equal by comparing their names * * @param ValueObjectInterface $timezone * @return bool */ public function sameValueAs(ValueObjectInterface $timezone) { if (false === Util::classEquals($this, $timezone)) { return false; } return $this->getName()->sameValueAs($timezone->getName()); }
/** * Tells whether two Currency are equal by comparing their amount and currency * * @param ValueObjectInterface $money * @return bool */ public function sameValueAs(ValueObjectInterface $money) { if (false === Util::classEquals($this, $money)) { return false; } return $this->getAmount()->sameValueAs($money->getAmount()) && $this->getCurrency()->sameValueAs($money->getCurrency()); }
/** * Tells whether two Collection are equal by comparing their size and items (item order matters) * * @param ValueObjectInterface $collection * @return bool */ public function sameValueAs(ValueObjectInterface $collection) { if (false === Util::classEquals($this, $collection) || false === $this->count()->sameValueAs($collection->count())) { return false; } $arrayCollection = $collection->toArray(); foreach ($this->items as $index => $item) { if (!isset($arrayCollection[$index]) || false === $item->sameValueAs($arrayCollection[$index])) { return false; } } return true; }
/** * Tells whether two names are equal by comparing their values * * @param ValueObjectInterface $name * @return bool */ public function sameValueAs(ValueObjectInterface $name) { if (false === Util::classEquals($this, $name)) { return false; } return $this->getFullName() == $name->getFullName(); }
/** * Tells whether two objects are both NullValue * @param ValueObjectInterface $null * @return bool */ public function sameValueAs(ValueObjectInterface $null) { return Util::classEquals($this, $null); }
/** * Tells whether two Address are equal * * @param ValueObjectInterface $address * @return bool */ public function sameValueAs(ValueObjectInterface $address) { if (false === Util::classEquals($this, $address)) { return false; } return $this->getName()->sameValueAs($address->getName()) && $this->getStreet()->sameValueAs($address->getStreet()) && $this->getDistrict()->sameValueAs($address->getDistrict()) && $this->getCity()->sameValueAs($address->getCity()) && $this->getRegion()->sameValueAs($address->getRegion()) && $this->getPostalCode()->sameValueAs($address->getPostalCode()) && $this->getCountry()->sameValueAs($address->getCountry()); }
/** * Tells whether two DateTimeWithTimeZone represents the same timestamp * * @param ValueObjectInterface $dateTimeWithTimeZone * * @return bool */ public function sameTimestampAs(ValueObjectInterface $dateTimeWithTimeZone) { if (false === Util::classEquals($this, $dateTimeWithTimeZone)) { return false; } return $this->toNativeDateTime() == $dateTimeWithTimeZone->toNativeDateTime(); }