コード例 #1
0
 /**
  * Tells whether a spefic IValueHolder instance's value is considered equal to
  * the value of an other given IValueHolder.
  *
  * @param IValueHolder $other
  *
  * @return boolean
  */
 public function isEqualTo(IValueHolder $other)
 {
     $equal = true;
     $other_references = $other->getValue();
     $these_references = $this->getValue();
     if ($these_references->count() !== $other_references->count()) {
         return false;
     }
     foreach ($this->getValue() as $pos => $referenced_document) {
         if (!isset($other_references[$pos]) || !$referenced_document->isEqualTo($other_references[$pos])) {
             $equal = false;
         }
     }
     return $equal;
 }
コード例 #2
0
 /**
  * Tells whether a spefic IValueHolder instance's value is considered equal to
  * the value of an other given IValueHolder.
  *
  * @param IValueHolder $other
  *
  * @return boolean
  */
 public function isEqualTo(IValueHolder $other)
 {
     $lefthand_docs = $this->getValue();
     $righthand_docs = $other->getValue();
     $equal = true;
     if (count($lefthand_docs) !== count($righthand_docs)) {
         $equal = false;
     } else {
         foreach ($lefthand_docs as $index => $document) {
             if ($index !== $righthand_docs->indexOf($document)) {
                 $equal = false;
             }
         }
     }
     return $equal;
 }
コード例 #3
0
 /**
  * Tells whether a spefic IValueHolder instance's value is considered equal to
  * the value of an other given IValueHolder.
  *
  * @param IValueHolder $other
  *
  * @return boolean
  */
 public function isEqualTo(IValueHolder $other)
 {
     $lefthand_value = $this->getValue();
     $righthand_value = $other->getValue();
     $lefthand_count = 0;
     $righthand_count = 0;
     $are_equal = true;
     if (is_array($lefthand_value)) {
         $lefthand_count = count($lefthand_value);
     }
     if (is_array($righthand_value)) {
         $righthand_count = count($righthand_value);
     }
     if (0 < $lefthand_count && $lefthand_count === $righthand_count) {
         foreach ($lefthand_value as $idx => $text) {
             if ($righthand_value[$idx] !== $text) {
                 $are_equal = false;
             }
         }
     } elseif ($lefthand_count !== $righthand_count) {
         $are_equal = false;
     } else {
         foreach ($lefthand_value as $key => $values) {
             if (!isset($righthand_value[$key])) {
                 $are_equal = false;
                 break;
             }
             foreach ($values as $idx => $curValue) {
                 if (isset($righthand_value[$key][$idx]) !== $curValue) {
                     $are_equal = false;
                     break;
                 }
             }
         }
     }
     return $are_equal;
 }
コード例 #4
0
 /**
  * Tells whether a spefic IValueHolder instance's value is considered equal to
  * the value of an other given IValueHolder.
  *
  * @param IValueHolder $other
  *
  * @return boolean
  */
 public function isEqualTo(IValueHolder $other)
 {
     $lefthand_value = $this->getValue();
     $righthand_value = $other->getValue();
     $lefthand_count = 0;
     $righthand_count = 0;
     $are_equal = true;
     if (is_array($lefthand_value)) {
         $lefthand_count = count($lefthand_value);
     }
     if (is_array($righthand_value)) {
         $righthand_count = count($righthand_value);
     }
     if (0 < $lefthand_count && $lefthand_count === $righthand_count) {
         foreach ($lefthand_value as $key => $value) {
             if ($righthand_value[$key] !== $value) {
                 $are_equal = false;
             }
         }
     } else {
         $are_equal = false;
     }
     return $are_equal;
 }
コード例 #5
0
 /**
  * Tells whether a spefic IValueHolder instance's value is considered equal to
  * the value of an other given IValueHolder.
  *
  * @param IValueHolder $other
  *
  * @return boolean
  */
 public function isEqualTo(IValueHolder $other)
 {
     return $this->getValue() === $other->getValue();
 }
コード例 #6
0
 /**
  * Tells whether a spefic IValueHolder instance's value is considered equal to
  * the value of an other given IValueHolder.
  *
  * @param IValueHolder $other
  *
  * @return boolean
  */
 public function isEqualTo(IValueHolder $other)
 {
     $lefthand_value = $this->getValue();
     $righthand_value = $other->getValue();
     return $lefthand_value == $righthand_value;
 }