Example #1
0
 /**
  * @param CM_Comparable $other
  * @return boolean
  */
 public function equals(CM_Comparable $other = null)
 {
     if (empty($other)) {
         return false;
     }
     /** @var CM_File_Filesystem $other */
     if (!$this->getAdapter()->equals($other->getAdapter())) {
         return false;
     }
     /** @var CM_File_Filesystem[] $bothSecondaryList */
     $bothSecondaryList = array_merge($this->getSecondaryList(), $other->getSecondaryList());
     foreach ($bothSecondaryList as $secondary) {
         foreach (array($this->getSecondaryList(), $other->getSecondaryList()) as $secondaryList) {
             $secondaryFound = Functional\first($secondaryList, function (CM_File_Filesystem $secondaryCompare) use($secondary) {
                 return $secondaryCompare->equals($secondary);
             });
             if (!$secondaryFound) {
                 return false;
             }
         }
     }
     return true;
 }