Overview

Namespaces

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

Classes

  • B2CSwitchSymlink
  • BuildLanguage
  • CVSExport
  • GitExport
  • Minifier
  • SwitchSymlink
  • TwengaServers
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: 
 3: namespace Himedia\Padocc\Task\Extended;
 4: 
 5: use Himedia\Padocc\AttributeProperties;
 6: use Himedia\Padocc\Minifier\Factory;
 7: use Himedia\Padocc\Minifier\MinifierInterface;
 8: use Himedia\Padocc\Task;
 9: 
10: /**
11:  * Minifie/compacte un ou plusieurs fichiers soit JS soit CSS.
12:  * À inclure dans une tâche ''env'' ou ''target''.
13:  *
14:  * @author Geoffroy AUBRY <gaubry@hi-media.com>
15:  */
16: class Minifier extends Task
17: {
18: 
19:     /**
20:      * Instance MinifierInterface.
21:      * @var MinifierInterface
22:      */
23:     private $oMinifier;
24: 
25:     /**
26:      * {@inheritdoc}
27:      */
28:     protected function init()
29:     {
30:         parent::init();
31: 
32:         $this->aAttrProperties = array(
33:             'srcfile' => AttributeProperties::FILEJOKER | AttributeProperties::ALLOW_PARAMETER,
34:             'destfile' => AttributeProperties::FILE | AttributeProperties::ALLOW_PARAMETER
35:         );
36:         $this->oMinifier = Factory::getInstance(Factory::TYPE_JSMIN, $this->oShell);
37:     }
38: 
39:     /**
40:      * {@inheritdoc}
41:      * @codeCoverageIgnore
42:      */
43:     public static function getTagName ()
44:     {
45:         return 'minify';
46:     }
47: 
48:     /**
49:      * Phase de traitements centraux de l'exécution de la tâche.
50:      * Elle devrait systématiquement commencer par "parent::centralExecute();".
51:      * Appelé par execute().
52:      * @see execute()
53:      */
54:     protected function centralExecute ()
55:     {
56:         parent::centralExecute();
57: 
58:         $sMsg = "+++Minify '" . $this->aAttValues['srcfile'] . "' into '" . $this->aAttValues['destfile'] . "'.";
59:         $this->getLogger()->info($sMsg);
60: 
61:         $aSrcPaths = $this->processPath($this->aAttValues['srcfile']);
62:         $sDestPaths = $this->processSimplePath($this->aAttValues['destfile']);
63:         $this->oMinifier->minify($aSrcPaths, $sDestPaths);
64: 
65:         $this->getLogger()->info('---');
66:     }
67: }
68: 
Platform for Automatized Deployments with pOwerful Concise Configuration API documentation generated by ApiGen 2.8.0