PHPIDS
Current file: | /home/lstrojny/Projekte/php-ids/trunk/lib/IDS/Caching/Factory.php
Legend: | executed not executed dead code

| Coverage
| Classes | Methods | Lines
Total |
| 100.00% | 1 / 1 |
| 100.00% | 1 / 1 |
| 100.00% | 17 / 17
IDS_Caching |
| 100.00% | 1 / 1 |
| 100.00% | 1 / 1 |
| 100.00% | 17 / 17
public static function factory($init, $type) |
| 100.00% | 1 / 1 |
| 100.00% | 17 / 17

           1                 : <?php
           2                 :
           3                 : /**
           4                 :  * PHPIDS
           5                 :  *
           6                 :  * Requirements: PHP5, SimpleXML
           7                 :  *
           8                 :  * Copyright (c) 2008 PHPIDS group (https://phpids.org)
           9                 :  *
          10                 :  * PHPIDS is free software; you can redistribute it and/or modify
          11                 :  * it under the terms of the GNU Lesser General Public License as published by
          12                 :  * the Free Software Foundation, version 3 of the License, or
          13                 :  * (at your option) any later version.
          14                 :  *
          15                 :  * PHPIDS is distributed in the hope that it will be useful,
          16                 :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
          17                 :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
          18                 :  * GNU Lesser General Public License for more details.
          19                 :  *
          20                 :  * You should have received a copy of the GNU Lesser General Public License
          21                 :  * along with PHPIDS. If not, see <http://www.gnu.org/licenses/>.
          22                 :  *
          23                 :  * PHP version 5.1.6+
          24                 :  *
          25                 :  * @category Security
          26                 :  * @package  PHPIDS
          27                 :  * @author   Mario Heiderich <mario.heiderich@gmail.com>
          28                 :  * @author   Christian Matthies <ch0012@gmail.com>
          29                 :  * @author   Lars Strojny <lars@strojny.net>
          30                 :  * @license  http://www.gnu.org/licenses/lgpl.html LGPL
          31                 :  * @link     http://php-ids.org/
          32                 :  */
          33                 :
          34                 : /**
          35                 :  * Caching factory
          36                 :  *
          37                 :  * This class is used as a factory to load the correct concrete caching
          38                 :  * implementation.
          39                 :  *
          40                 :  * @category  Security
          41                 :  * @package   PHPIDS
          42                 :  * @author    Christian Matthies <ch0012@gmail.com>
          43                 :  * @author    Mario Heiderich <mario.heiderich@gmail.com>
          44                 :  * @author    Lars Strojny <lars@strojny.net>
          45                 :  * @copyright 2007 The PHPIDS Group
          46                 :  * @license   http://www.gnu.org/licenses/lgpl.html LGPL
          47                 :  * @version   Release: $Id:Factory.php 517 2007-09-15 15:04:13Z mario $
          48                 :  * @link      http://php-ids.org/
          49                 :  * @since     Version 0.4
          50                 :  */
          51                 : class IDS_Caching
          52                 : {
          53                 :
          54                 :     /**
          55                 :      * Factory method
          56                 :      *
          57                 :      * @param array  $init the IDS_Init object
          58                 :      * @param string $type the caching type
          59                 :      *
          60                 :      * @return object the caching facility
          61                 :      */
          62                 :     public static function factory($init, $type)
          63                 :     {
          64                 :
          65              50 :         $object  = false;
          66              50 :         $wrapper = preg_replace(
          67              50 :             '/\W+/m',
          68              50 :             null,
          69              50 :             ucfirst($init->config['Caching']['caching'])
          70              50 :         );
          71              50 :         $class   = 'IDS_Caching_' . $wrapper;
          72              50 :         $path    = dirname(__FILE__) . DIRECTORY_SEPARATOR .
          73              50 :             $wrapper . '.php';
          74                 :
          75              50 :         if (file_exists($path)) {
          76              49 :             include_once $path;
          77                 :
          78              49 :             if (class_exists($class)) {
          79              49 :                 $object = call_user_func(array($class, 'getInstance'),
          80              49 :                     $type, $init);
          81              49 :             }
          82              49 :         }
          83                 :
          84              50 :         return $object;
          85                 :     }
          86                 : }
          87                 :
          88                 : /*
          89                 :  * Local variables:
          90                 :  * tab-width: 4
          91                 :  * c-basic-offset: 4
          92                 :  * End:

Generated by PHPUnit 3.3.1 and Xdebug 2.1.0-dev at Mon Dec 22 13:57:42 CET 2008.