Current file: D:\data\micmap\cgi-bin\dicfro\4.5\application\Model\Query\Whitaker.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% 2 / 2 CRAP
100.00%100.00%
100.00% 9 / 9
 
Model_Query_Whitaker
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 2 / 2
100.00%100.00%
100.00% 9 / 9
 __construct($directory = '.')
100.00%100.00%
100.00% 1 / 1 1
100.00%100.00%
100.00% 2 / 2
 searchWords($word)
100.00%100.00%
100.00% 1 / 1 1
100.00%100.00%
100.00% 7 / 7


       1                 : <?php                                                                                                      
       2                 :                                                                                                            
       3                 : /**                                                                                                        
       4                 :  * Dictionaries of Old French and Latin                                                                    
       5                 :  *                                                                                                         
       6                 :  * PHP 5                                                                                                   
       7                 :  *                                                                                                         
       8                 :  * @category   DicFro                                                                                      
       9                 :  * @package    Model                                                                                       
      10                 :  * @subpackage Query                                                                                       
      11                 :  * @author     Michel Corne <mcorne@yahoo.com>                                                             
      12                 :  * @copyright  2008-2010 Michel Corne                                                                      
      13                 :  * @license    http://opensource.org/licenses/gpl-3.0.html GNU General Public License, version 3 (GPLv3)   
      14                 :  * @link       http://www.micmap.org/dicfro                                                                
      15                 :  */                                                                                                        
      16                 :                                                                                                            
      17                 : require_once 'Model/Query.php';                                                                            
      18                 :                                                                                                            
      19                 : /**                                                                                                        
      20                 :  * Queries the Whitaker database                                                                           
      21                 :  *                                                                                                         
      22                 :  * @category   DicFro                                                                                      
      23                 :  * @package    Model                                                                                       
      24                 :  * @subpackage Query                                                                                       
      25                 :  * @author     Michel Corne <mcorne@yahoo.com>                                                             
      26                 :  * @copyright  2008-2010 Michel Corne                                                                      
      27                 :  * @license    http://opensource.org/licenses/gpl-3.0.html GNU General Public License, version 3 (GPLv3)   
      28                 :  */                                                                                                        
      29                 :                                                                                                            
      30                 : class Model_Query_Whitaker extends Model_Query                                                             
      31                 : {                                                                                                          
      32                 :     /**                                                                                                    
      33                 :      * Constructor                                                                                         
      34                 :      *                                                                                                     
      35                 :      * @param  string $directory the dictionaries directory                                                
      36                 :      * @return void                                                                                        
      37                 :      */                                                                                                    
      38                 :     public function __construct($directory = '.')                                                          
      39                 :     {                                                                                                      
      40               4 :         parent::__construct($directory . '/whitaker');                                                     
      41               4 :     }                                                                                                      
      42                 :                                                                                                            
      43                 :     /**                                                                                                    
      44                 :      * Searches a word form                                                                                
      45                 :      *                                                                                                     
      46                 :      * @param  string $word the word form to search                                                        
      47                 :      * @return array  the list of words matching that form                                                 
      48                 :      */                                                                                                    
      49                 :     public function searchWords($word)                                                                     
      50                 :     {                                                                                                      
      51               4 :         $string = new Base_String;                                                                         
      52               4 :         $latin = $string->toLatin($word);                                                                  
      53                 :                                                                                                            
      54               4 :         $query = "SELECT DISTINCT info, frequency FROM word, entry ";                                      
      55               4 :         $query .= "WHERE latin = :latin AND entry.line = word.line ";                                      
      56               4 :         $query .= "ORDER BY frequency, info";                                                              
      57                 :                                                                                                            
      58               4 :         $result = $this->execute($query, array(':latin' => $latin), PDO::FETCH_COLUMN | PDO::FETCH_UNIQUE);
      59                 :                                                                                                            
      60               4 :         return array_keys($result);                                                                        
      61                 :     }                                                                                                      

Generated by PHP_CodeCoverage 1.0.0 using PHP 5.3.3 and PHPUnit 3.5.0 at Wed Jan 4 16:32:24 UTC 2012.