コード例 #1
0
ファイル: Track.class.php プロジェクト: Gvasa/musicLib
 /**
  * Check if $this is equal to $b.
  *
  * @param Track $b
  * @return bool
  */
 public function equals(SpotifyItem $b)
 {
     if (!$b instanceof Track) {
         return false;
     }
     if ($this->getURI() != $b->getURI()) {
         return false;
     }
     if (!is_array($this->getArtist())) {
         if (!$this->getArtist()->equals($b->getArtist())) {
             return false;
         }
     } else {
         $bArtists = $b->getArtist();
         for ($i = 0; $i < count($this->artist); $i++) {
             if (!$this->artist[$i]->equals($bArtists[i])) {
                 return false;
             }
         }
     }
     if (!$this->getAlbum()->equals($b->getAlbum())) {
         return false;
     }
     return true;
 }
コード例 #2
0
 /**
  * Check if $this is equal to $b.
  *
  * @param Artist $b
  * @return bool
  */
 public function equals(SpotifyItem $b)
 {
     if (!$b instanceof Artist) {
         return false;
     }
     if ($b->getName() != $this->getName()) {
         return false;
     }
     if ($b->getURI() != $this->getURI()) {
         return false;
     }
     $bAlbums = $b->getAlbum();
     if (count($bAlbums) != count($this->albums)) {
         return false;
     }
     if (count($this->albums) > 0) {
         for ($i = 0; $i < count($this->albums); $i++) {
             if (!$this->albums[$i]->equals($bAlbums[$i])) {
                 return false;
             }
         }
     }
     return true;
 }
コード例 #3
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;
 }