Esempio n. 1
0
 /**
  * Tells whether two Enum objects are sameValueAs by comparing their values.
  *
  * @param Enum $enum
  *
  * @return bool
  */
 public function sameValueAs(ValueObjectInterface $enum)
 {
     if (false === Util::classEquals($this, $enum)) {
         return false;
     }
     return $this->toNative() === $enum->toNative();
 }
Esempio n. 2
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());
 }
Esempio n. 3
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());
 }
Esempio n. 4
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());
 }
Esempio n. 5
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());
 }
Esempio n. 6
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());
 }
Esempio n. 7
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();
 }
Esempio n. 8
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;
 }
Esempio n. 9
0
 public function testGetClassAsString()
 {
     $util = new Util();
     $this->assertEquals('EmbarkNow\\ValueObjects\\Util\\Util', Util::getClassAsString($util));
 }
Esempio n. 10
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());
 }
 /**
  * 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();
 }
Esempio n. 12
0
 /**
  * Tells whether two objects are both NullValue.
  *
  * @param ValueObjectInterface $null
  *
  * @return bool
  */
 public function sameValueAs(ValueObjectInterface $null)
 {
     return Util::classEquals($this, $null);
 }