Exemplo n.º 1
0
 public function compare(Type $other)
 {
     $cmp = parent::compare($other);
     if ($cmp !== 0) {
         return $cmp;
     }
     $cmp = $this->getValueType()->compare($other->getValueType());
     if ($cmp !== 0) {
         return $cmp;
     }
     return $this->getKeyType()->compare($other->getKeyType());
 }
Exemplo n.º 2
0
 public function compare(Type $other)
 {
     $cmp = parent::compare($other);
     if ($cmp !== 0) {
         return $cmp;
     }
     for ($i = 0;; $i++) {
         if (count($this->alternatives) <= $i && count($other->alternatives) <= $i) {
             return 0;
         }
         if (count($this->alternatives) <= $i) {
             return -1;
         }
         if (count($other->alternatives) <= $i) {
             return 1;
         }
         $cmp = $this->alternatives[$i]->compare($other->alternatives[$i]);
         if ($cmp !== 0) {
             return $cmp;
         }
     }
 }
Exemplo n.º 3
0
 public function compare(Type $other)
 {
     $cmp = parent::compare($other);
     return $cmp !== 0 ? $cmp : strcasecmp($this->getClass(), $other->getClass());
 }