Dwoo - Unit Tests Report
Current file: /dwoo/lib/Dwoo/Block/Plugin.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
100.00%100.00%
100.00% 1 / 1
80.00%80.00%
80.00% 4 / 5
83.33%83.33%
83.33% 5 / 6
 
Dwoo_Block_Plugin
100.00%100.00%
100.00% 1 / 1
80.00%80.00%
80.00% 4 / 5
83.33%83.33%
83.33% 5 / 6
 public function buffer($input)
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 2 / 2
 public function end()
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 1 / 1
 public function process()
0.00%0.00%
0.00% 0 / 1
0.00%0.00%
0.00% 0 / 1
 public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type)
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 1 / 1
 public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content)
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 1 / 1



       1                 : <?php                                                                                                                                                                                        
       2                 :                                                                                                                                                                                              
       3                 : /**                                                                                                                                                                                          
       4                 :  * base class for block plugins                                                                                                                                                              
       5                 :  *                                                                                                                                                                                           
       6                 :  * you have to implement the <em>init()</em> method, it will receive the parameters that                                                                                                     
       7                 :  * are in the template code and is called when the block starts                                                                                                                              
       8                 :  *                                                                                                                                                                                           
       9                 :  * This software is provided 'as-is', without any express or implied warranty.                                                                                                               
      10                 :  * In no event will the authors be held liable for any damages arising from the use of this software.                                                                                        
      11                 :  *                                                                                                                                                                                           
      12                 :  * @author     Jordi Boggiano <j.boggiano@seld.be>                                                                                                                                           
      13                 :  * @copyright  Copyright (c) 2008, Jordi Boggiano                                                                                                                                            
      14                 :  * @license    http://dwoo.org/LICENSE   Modified BSD License                                                                                                                                
      15                 :  * @link       http://dwoo.org/                                                                                                                                                              
      16                 :  * @version    1.0.0                                                                                                                                                                         
      17                 :  * @date       2008-10-23                                                                                                                                                                    
      18                 :  * @package    Dwoo                                                                                                                                                                          
      19                 :  */                                                                                                                                                                                          
      20                 : abstract class Dwoo_Block_Plugin extends Dwoo_Plugin                                                                                                                                         
      21                 : {                                                                                                                                                                                            
      22                 :     /**                                                                                                                                                                                      
      23                 :      * stores the contents of the block while it runs                                                                                                                                        
      24                 :      *                                                                                                                                                                                       
      25                 :      * @var string                                                                                                                                                                           
      26                 :      */                                                                                                                                                                                      
      27                 :     protected $buffer = '';                                                                                                                                                                  
      28                 :                                                                                                                                                                                              
      29                 :     /**                                                                                                                                                                                      
      30                 :      * buffers input, override only if necessary                                                                                                                                             
      31                 :      *                                                                                                                                                                                       
      32                 :      * @var string $input the content that must be buffered                                                                                                                                  
      33                 :      */                                                                                                                                                                                      
      34                 :     public function buffer($input)                                                                                                                                                           
      35                 :     {                                                                                                                                                                                        
      36               4 :         $this->buffer .= $input;                                                                                                                                                             
      37               4 :     }                                                                                                                                                                                        
      38                 :                                                                                                                                                                                              
      39                 :     // initialization code, receives the parameters from {block param1 param2}                                                                                                               
      40                 :     // public function init($arg, $arg, ...);                                                                                                                                                
      41                 :                                                                                                                                                                                              
      42                 :     /**                                                                                                                                                                                      
      43                 :      * called when the block ends, this is most of the time followed right away by a call                                                                                                    
      44                 :      * of <em>process()</em> but not always, so this should be used to do any shutdown operations on the                                                                                     
      45                 :      * block object, if required.                                                                                                                                                            
      46                 :      */                                                                                                                                                                                      
      47                 :     public function end()                                                                                                                                                                    
      48                 :     {                                                                                                                                                                                        
      49               4 :     }                                                                                                                                                                                        
      50                 :                                                                                                                                                                                              
      51                 :     /**                                                                                                                                                                                      
      52                 :      * called when the block output is required by a parent block                                                                                                                            
      53                 :      *                                                                                                                                                                                       
      54                 :      * this must read $this->buffer and return it processed                                                                                                                                  
      55                 :      *                                                                                                                                                                                       
      56                 :      * @return string                                                                                                                                                                        
      57                 :      */                                                                                                                                                                                      
      58                 :     public function process()                                                                                                                                                                
      59                 :     {                                                                                                                                                                                        
      60               0 :         return $this->buffer;                                                                                                                                                                
      61                 :     }                                                                                                                                                                                        
      62                 :                                                                                                                                                                                              
      63                 :     /**                                                                                                                                                                                      
      64                 :      * called at compile time to define what the block should output in the compiled template code, happens when the block is declared                                                       
      65                 :      *                                                                                                                                                                                       
      66                 :      * basically this will replace the {block arg arg arg} tag in the template                                                                                                               
      67                 :      *                                                                                                                                                                                       
      68                 :      * @param Dwoo_Compiler $compiler the compiler instance that calls this function                                                                                                         
      69                 :      * @param array $params an array containing original and compiled parameters                                                                                                             
      70                 :      * @param string $prepend that is just meant to allow a child class to call                                                                                                              
      71                 :      *                           parent::postProcessing($compiler, $params, "foo();") to add a command before the                                                                            
      72                 :      *                           default commands are executed                                                                                                                               
      73                 :      * @param string $append that is just meant to allow a child class to call                                                                                                               
      74                 :      *                          parent::postProcessing($compiler, $params, null, "foo();") to add a command after the                                                                        
      75                 :      *                          default commands are executed                                                                                                                                
      76                 :      * @param string $type the type is the plugin class name used                                                                                                                            
      77                 :      */                                                                                                                                                                                      
      78                 :     public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type)                                                                                   
      79                 :     {                                                                                                                                                                                        
      80               4 :         return Dwoo_Compiler::PHP_OPEN.$prepend.'$this->addStack("'.$type.'", array('.Dwoo_Compiler::implode_r($compiler->getCompiledParams($params)).'));'.$append.Dwoo_Compiler::PHP_CLOSE;
      81                 :     }                                                                                                                                                                                        
      82                 :                                                                                                                                                                                              
      83                 :     /**                                                                                                                                                                                      
      84                 :      * called at compile time to define what the block should output in the compiled template code, happens when the block is ended                                                          
      85                 :      *                                                                                                                                                                                       
      86                 :      * basically this will replace the {/block} tag in the template                                                                                                                          
      87                 :      *                                                                                                                                                                                       
      88                 :      * @see preProcessing                                                                                                                                                                    
      89                 :      * @param Dwoo_Compiler $compiler the compiler instance that calls this function                                                                                                         
      90                 :      * @param array $params an array containing original and compiled parameters, see preProcessing() for more details                                                                       
      91                 :      * @param string $prepend that is just meant to allow a child class to call                                                                                                              
      92                 :      *                           parent::postProcessing($compiler, $params, "foo();") to add a command before the                                                                            
      93                 :      *                           default commands are executed                                                                                                                               
      94                 :      * @param string $append that is just meant to allow a child class to call                                                                                                               
      95                 :      *                          parent::postProcessing($compiler, $params, null, "foo();") to add a command after the                                                                        
      96                 :      *                          default commands are executed                                                                                                                                
      97                 :      * @param string $content the entire content of the block being closed                                                                                                                   
      98                 :      */                                                                                                                                                                                      
      99                 :     public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content)                                                                               
     100                 :     {                                                                                                                                                                                        
     101               4 :         return $content . Dwoo_Compiler::PHP_OPEN.$prepend.'$this->delStack();'.$append.Dwoo_Compiler::PHP_CLOSE;                                                                            
     102                 :     }                                                                                                                                                                                        
     103                 : }                                                                                                                                                                                            


Generated by PHPUnit @package_version@ and Xdebug 2.1.0beta2-dev using PHP 5.3.0 at Sun Feb 7 16:30:52 UTC 2010.