Source for file Media.php

Documentation is available at Media.php

  1. <?
  2.  
  3. /** Represents some kind of media and provides common information.
  4.  *
  5.  * @package    php-lastfm-api
  6.  * @author  Felix Bruns <felixbruns@web.de>
  7.  * @version    1.0
  8.  */
  9. class Media {
  10.     /** Name of this medium.
  11.      *
  12.      * @var string 
  13.      * @access    private
  14.      */
  15.     private $name;
  16.  
  17.     /** MusicBrainz ID of this medium.
  18.      *
  19.      * @var string 
  20.      * @access    private
  21.      */
  22.     private $mbid;
  23.  
  24.     /** Last.fm URL of this medium.
  25.      *
  26.      * @var string 
  27.      * @access    private
  28.      */
  29.     private $url;
  30.  
  31.     /** An array of images of this medium.
  32.      *
  33.      * @var array 
  34.      * @access    private
  35.      */
  36.     private $images;
  37.  
  38.     /** Number of listeners of this medium.
  39.      *
  40.      * @var integer 
  41.      * @access    private
  42.      */
  43.     private $listeners;
  44.  
  45.     /** Play count of this medium.
  46.      *
  47.      * @var integer 
  48.      * @access    private
  49.      */
  50.     private $playCount;
  51.  
  52.     /** Possible image sizes.
  53.      *
  54.      * @var integer 
  55.      * @access    public
  56.      */
  57.     const IMAGE_UNKNOWN    = -1;
  58.     const IMAGE_SMALL      =  0;
  59.     const IMAGE_MEDIUM     =  1;
  60.     const IMAGE_LARGE      =  2;
  61.     const IMAGE_HUGE       =  3;
  62.     const IMAGE_EXTRALARGE =  4;
  63.     const IMAGE_ORIGINAL   =  5;
  64.  
  65.     /** Create a media object.
  66.      *
  67.      * @param string    $name        Name for this medium.
  68.      * @param string    $mbid        MusicBrainz ID for this medium.
  69.      * @param string    $url        Last.fm URL for this medium.
  70.      * @param array        $images        An array of images of different sizes.
  71.      * @param integer    $listeners    Number of listeners for this medium.
  72.      * @param integer    $playCount    Play count of this medium.
  73.      *
  74.      * @access    public
  75.      */
  76.     public function __construct($name$mbid$urlarray $images$listeners,
  77.                                 $playCount){
  78.         $this->name      $name;
  79.         $this->mbid      $mbid;
  80.         $this->url       $url;
  81.         $this->images    $images;
  82.         $this->listeners $listeners;
  83.         $this->playCount $playCount;
  84.     }
  85.  
  86.     /** Returns the name of this medium.
  87. /** Returns the name of this medium.
  88.      *
  89.      * @return    string    The mediums name.
  90.      * @access    public
  91.      */
  92.     public function getName(){
  93.         return $this->name;
  94.     }
  95.  
  96.     /** Returns the MusicBrainz ID of this medium.
  97.      *
  98.      * @return    string    MusicBrainz ID.
  99.      * @access    public
  100.      */
  101.     public function getMbid(){
  102.         return $this->mbid;
  103.     }
  104.  
  105.     /** Returns the last.fm URL of this medium.
  106.      *
  107.      * @return    string    Last.fm URL.
  108.      * @access    public
  109.      */
  110.     public function getUrl(){
  111.         return $this->url;
  112.     }
  113.  
  114.     /** Returns an image URL of the specified size of this medium.
  115.      *
  116.      * @param    integer    $size    Image size constant.
  117.      * @return    string            An image URL.
  118.      * @access    public
  119.      */
  120.     public function getImage($size){
  121.         return $this->images[$size];
  122.     }
  123.  
  124.     /** Returns the number of listeners of this medium.
  125.      *
  126.      * @return    integer    Number of listeners.
  127.      * @access    public
  128.      */
  129.     public function getListeners(){
  130.         return $this->listeners;
  131.     }
  132.  
  133.     /** Returns the play count of this medium.
  134.      *
  135.      * @return    integer    Play count.
  136.      * @access    public
  137.      */
  138.     public function getPlayCount(){
  139.         return $this->playCount;
  140.     }
  141. }
  142.  
  143. ?>

Documentation generated on Mon, 22 Dec 2008 16:57:39 +0100 by phpDocumentor 1.4.1