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: 12: 13: 14: 15:
16: class Minifier extends Task
17: {
18:
19: 20: 21: 22:
23: private $oMinifier;
24:
25: 26: 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: 41: 42:
43: public static function getTagName ()
44: {
45: return 'minify';
46: }
47:
48: 49: 50: 51: 52: 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: