Ejemplo n.º 1
0
 /**
  * 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());
 }
Ejemplo n.º 2
0
 /**
  * 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();
 }
Ejemplo n.º 3
0
 /**
  * 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();
 }
Ejemplo n.º 4
0
 /**
  * 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());
 }
Ejemplo n.º 5
0
 /**
  * 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());
 }
Ejemplo n.º 6
0
 public function sameValueAs(ValueObjectInterface $complex)
 {
     if (false === Util::classEquals($this, $complex)) {
         return false;
     }
     return $this->getReal()->sameValueAs($complex->getReal()) && $this->getIm()->sameValueAs($complex->getIm());
 }
Ejemplo n.º 7
0
 /**
  * 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());
 }
Ejemplo n.º 8
0
 /**
  * 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());
 }
Ejemplo n.º 9
0
 /**
  * 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());
 }
Ejemplo n.º 10
0
 /**
  * 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();
 }
Ejemplo n.º 11
0
 /**
  * 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());
 }
Ejemplo n.º 12
0
 /**
  * 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());
 }
Ejemplo n.º 13
0
 /**
  *  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());
 }
Ejemplo n.º 14
0
 /**
  * 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());
 }
Ejemplo n.º 15
0
 /**
  * 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;
 }
Ejemplo n.º 16
0
 /**
  * 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());
 }
Ejemplo n.º 17
0
 /**
  * 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();
 }
Ejemplo n.º 18
0
 /**
  * Tells whether two objects are both NullValue
  * @param  ValueObjectInterface $null
  * @return bool
  */
 public function sameValueAs(ValueObjectInterface $null)
 {
     return Util::classEquals($this, $null);
 }
Ejemplo n.º 19
0
 /**
  * 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();
 }
Ejemplo n.º 20
0
 public function testGetClassAsString()
 {
     $util = new Util();
     $this->assertEquals('ValueObjects\\Util\\Util', Util::getClassAsString($util));
 }