Ejemplo n.º 1
0
 /**
  * Check if $this is equal to $b.
  *
  * @param Album $b
  * @return bool
  */
 public function equals(SpotifyItem $b)
 {
     if (!$b instanceof Album) {
         return false;
     }
     if ($b->getURI() != $this->getURI() || $b->getName() != $this->getName()) {
         return false;
     }
     if ($b->getArtist() != null && $this->getArtist() != null && !$this->getArtist()->equals($b->getArtist())) {
         return false;
     }
     $bTracks = $b->getTracks();
     if (count($this->tracks) != count($bTracks)) {
         return false;
     }
     if (count($this->tracks) > 0) {
         for ($i = 0; $i < count($this->tracks); $i++) {
             if (!$this->tracks[$i]->equals($bTracks[$i])) {
                 return false;
             }
         }
     }
     return true;
 }