Overview

Namespaces

  • GAubry
    • ErrorHandler
    • Helpers
    • Logger
    • Shell
  • Himedia
    • Padocc
      • DB
      • Minifier
      • Numbering
      • Properties
      • Task
        • Base
        • Extended
  • None
  • Psr
    • Log

Classes

  • Factory
  • JSMinAdapter

Interfaces

  • MinifierInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: 
 3: namespace Himedia\Padocc\Minifier;
 4: 
 5: use GAubry\Shell\ShellAdapter;
 6: 
 7: /**
 8:  * Factory de MinifierInterface.
 9:  *
10:  * @author Geoffroy AUBRY <gaubry@hi-media.com>
11:  */
12: class Factory
13: {
14:     /**
15:      * Pour indiquer que l'on souhaite construire une instance de JSMinAdapter.
16:      * @var int
17:      * @see getInstance()
18:      */
19:     const TYPE_JSMIN = 1;
20: 
21:     /**
22:      * Retourne une instance de MinifierInterface selon le $iType spécifié.
23:      *
24:      * @param int $iType type d'instance désiré
25:      * @param ShellAdapter $oShell
26:      * @throws \BadMethodCallException si type inconnu.
27:      * @return MinifierInterface une instance de MinifierInterface selon le $iType spécifié.
28:      */
29:     public static function getInstance ($iType, ShellAdapter $oShell)
30:     {
31:         switch ($iType) {
32:             case self::TYPE_JSMIN:
33:                 $oMinifier = new JSMinAdapter('$this->aConfig[\'jsmin_path\']', $oShell);
34:                 break;
35: 
36:             default:
37:                 throw new \BadMethodCallException("Unknown type: '$iType'!");
38:                 break;
39:         }
40:         return $oMinifier;
41:     }
42: 
43:     /**
44:      * Simple factory, non instanciable.
45:      * @codeCoverageIgnore
46:      */
47:     private function __construct()
48:     {
49:     }
50: }
51: 
Platform for Automatized Deployments with pOwerful Concise Configuration API documentation generated by ApiGen 2.8.0