All Unit tests
Current file: C:\code\midiparser\src\Midi\Event\SmpteOffsetEvent.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 4 / 4
100.00%100.00%
100.00% 22 / 22
 
Midi\SmpteOffsetEvent
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 4 / 4
100.00%100.00%
100.00% 22 / 22
 public function __construct($frameRate, $hour, $min, $second, $frame, $subframe)
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 2 / 2
 public function getParamDescription()
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 7 / 7
 public static function getFrameRateDescription($frameRate)
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 11 / 11
 public function getSubtype()
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 1 / 1


       1                 : <?php                                                                                                              
       2                 :                                                                                                                    
       3                 :     /**                                                                                                            
       4                 :      * \Midi\Event\SmpteOffsetEvent                                                                                
       5                 :      *                                                                                                             
       6                 :      * @package    Midi                                                                                            
       7                 :      * @subpackage Event                                                                                           
       8                 :      * @copyright  © 2009 Tommy Montgomery <http://phpmidiparser.com/>                                             
       9                 :      * @since      1.0                                                                                             
      10                 :      */                                                                                                            
      11                 :                                                                                                                    
      12                 :     namespace Midi\Event;                                                                                          
      13                 :                                                                                                                    
      14                 :     /**                                                                                                            
      15                 :      * Class SmpteOffsetEvent                                                                                      
      16                 :      *                                                                                                             
      17                 :      * @package    Midi                                                                                            
      18                 :      * @subpackage Event                                                                                           
      19                 :      * @since      1.0                                                                                             
      20                 :      */                                                                                                            
      21               1 :     class SmpteOffsetEvent extends MetaEvent {                                                                     
      22                 :                                                                                                                    
      23                 :         /**                                                                                                        
      24                 :          * Constructor                                                                                             
      25                 :          *                                                                                                         
      26                 :          * @since 1.0                                                                                              
      27                 :          *                                                                                                         
      28                 :          * @param  int $frameRate Valid values: 0 (24fps), 1 (25fps), 2 (30fps drop frame), 3 (30fps)              
      29                 :          * @param  int $hour      Valid values: 0-23                                                               
      30                 :          * @param  int $min       Valid values: 0-59                                                               
      31                 :          * @param  int $second    Valid values: 0-59                                                               
      32                 :          * @param  int $frame     Valid values: 0-59                                                               
      33                 :          * @param  int $subframe  Valid values: 0-99                                                               
      34                 :          */                                                                                                        
      35                 :         public function __construct($frameRate, $hour, $min, $second, $frame, $subframe) {                         
      36               5 :             parent::__construct(array(($frameRate << 5) | $hour, $min, $second, $frame, $subframe));               
      37               5 :         }                                                                                                          
      38                 :                                                                                                                    
      39                 :         /**                                                                                                        
      40                 :          * @since 1.0                                                                                              
      41                 :          * @uses  getFrameRateDescription()                                                                        
      42                 :          *                                                                                                         
      43                 :          * @return string                                                                                          
      44                 :          */                                                                                                        
      45                 :         public function getParamDescription() {                                                                    
      46               1 :             $frameRate = self::getFrameRateDescription(($this->data[0] >> 5) & 0xFF);                              
      47               1 :             $hour      = $this->data[0] & 0x1F;                                                                    
      48               1 :             $minute    = $this->data[1];                                                                           
      49               1 :             $second    = $this->data[2];                                                                           
      50               1 :             $frame     = $this->data[3];                                                                           
      51               1 :             $subFrame  = $this->data[4];                                                                           
      52                 :                                                                                                                    
      53               1 :             return $hour . 'h ' . $minute . 'm ' . $second . 's ' . $frame . '.' . $subFrame . 'f @ ' . $frameRate;
      54                 :         }                                                                                                          
      55                 :                                                                                                                    
      56                 :         /**                                                                                                        
      57                 :          * Gets the user-friendly description of the different                                                     
      58                 :          * frame rate types                                                                                        
      59                 :          *                                                                                                         
      60                 :          * @since 1.0                                                                                              
      61                 :          *                                                                                                         
      62                 :          * @param  int $frameRate Valid values: 0-3                                                                
      63                 :          * @throws InvalidArgumentException                                                                        
      64                 :          * @return string                                                                                          
      65                 :          */                                                                                                        
      66                 :         public static function getFrameRateDescription($frameRate) {                                               
      67                 :             switch ($frameRate) {                                                                                  
      68               3 :                 case 0:                                                                                            
      69               1 :                     return '24fps';                                                                                
      70               3 :                 case 1:                                                                                            
      71               1 :                     return '25fps';                                                                                
      72               3 :                 case 2:                                                                                            
      73               1 :                     return '30fps (drop frame)';                                                                   
      74               3 :                 case 3:                                                                                            
      75               2 :                     return '30fps';                                                                                
      76               1 :                 default:                                                                                           
      77               1 :                     throw new \InvalidArgumentException('Invalid frame rate');                                     
      78               1 :             }                                                                                                      
      79                 :         }                                                                                                          
      80                 :                                                                                                                    
      81                 :         /**                                                                                                        
      82                 :          * @since 1.0                                                                                              
      83                 :          * @uses  MetaEventType::SMPTE_OFFSET                                                                      
      84                 :          *                                                                                                         
      85                 :          * @return int                                                                                             
      86                 :          */                                                                                                        
      87                 :         public function getSubtype() {                                                                             
      88               1 :             return MetaEventType::SMPTE_OFFSET;                                                                    
      89                 :         }                                                                                                          
      90                 :                                                                                                                    
      91                 :     }                                                                                                              
      92                 :                                                                                                                    

Generated by PHPUnit 3.4.1 and Xdebug 2.0.5 using PHP 5.3.0 at Sun Oct 25 23:35:09 PDT 2009.