Skip to content

Commit

Permalink
updated PHPDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
akaunderr committed Nov 28, 2023
1 parent 88f3115 commit ef82b65
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/MinifyCSS.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,44 @@

use MatthiasMullie\Minify;

/**
* [Description MinifyCSS].
*/
class MinifyCSS extends ShrinkWrap {
/**
* @var array
*/
private $available_engines = ['matthiasmullie', 'regex'];

/**
* @var string
*/
private $engine;

/**
* @var array
*/
private $options;

/**
* @var mixed
*/
private $minifier;

/**
* @param string $engine
* @param array $options
*/
public function __construct(string $engine = 'matthiasmullie', array $options = []) {
in_array($engine, $this->available_engines) ? $this->engine = $engine : $this->engine = 'matthiasmullie';
$this->options = $options;
}

/**
* @param null|string $data
*
* @return null|mixed
*/
public function init(string $data = null) {
switch ($this->engine) {
case 'matthiasmullie':
Expand All @@ -28,13 +53,23 @@ public function init(string $data = null) {
}
}

/**
* @param null|string $data
*
* @return null|mixed
*/
public function minify(string $data = null) {
switch ($this->engine) {
case 'matthiasmullie':
return $this->minifier->minify($data);
}
}

/**
* @param string $data
*
* @return null|mixed
*/
public function add(string $data) {
switch ($this->engine) {
case 'matthiasmullie':
Expand Down
33 changes: 33 additions & 0 deletions src/MinifyHTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,33 @@

use voku\helper\HtmlMin;

/**
* [Description MinifyHTML].
*/
class MinifyHTML extends ShrinkWrap {
/**
* @var array
*/
private $available_engines = ['voku', 'regex'];

/**
* @var string
*/
private $engine;

/**
* @var array
*/
private $options;

/**
* @var mixed
*/
private $minifier;

/**
* @var array
*/
private $voku_options = [
'doOptimizeViaHtmlDomParser' => false, // optimize html via "HtmlDomParser()"
'doRemoveComments' => false, // remove default HTML comments (depends on "doOptimizeViaHtmlDomParser(true)")
Expand Down Expand Up @@ -41,11 +60,20 @@ class MinifyHTML extends ShrinkWrap {
'doRemoveOmittedHtmlTags' => false, // remove ommitted html tags e.g. <p>lall</p> => <p>lall
];

/**
* @param string $engine
* @param array $options
*/
public function __construct(string $engine = 'voku', array $options = []) {
in_array($engine, $this->available_engines) ? $this->engine = $engine : $this->engine = 'voku';
$this->options = $options;
}

/**
* @param null|string $data
*
* @return null|mixed
*/
public function init(string $data = null) {
switch ($this->engine) {
case 'voku':
Expand All @@ -62,6 +90,11 @@ public function init(string $data = null) {
}
}

/**
* @param null|string $data
*
* @return null|mixed
*/
public function minify(string $data = null) {
switch ($this->engine) {
case 'voku':
Expand Down
35 changes: 35 additions & 0 deletions src/MinifyJS.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,44 @@

use MatthiasMullie\Minify;

/**
* [Description MinifyJS].
*/
class MinifyJS extends ShrinkWrap {
/**
* @var array
*/
private $available_engines = ['matthiasmullie', 'regex'];

/**
* @var string
*/
private $engine;

/**
* @var array
*/
private $options;

/**
* @var mixed
*/
private $minifier;

/**
* @param string $engine
* @param array $options
*/
public function __construct(string $engine = 'matthiasmullie', array $options = []) {
in_array($engine, $this->available_engines) ? $this->engine = $engine : $this->engine = 'matthiasmullie';
$this->options = $options;
}

/**
* @param null|string $data
*
* @return null|mixed
*/
public function init(string $data = null) {
switch ($this->engine) {
case 'matthiasmullie':
Expand All @@ -28,13 +53,23 @@ public function init(string $data = null) {
}
}

/**
* @param null|string $data
*
* @return null|mixed
*/
public function minify(string $data = null) {
switch ($this->engine) {
case 'matthiasmullie':
return $this->minifier->minify($data);
}
}

/**
* @param string $data
*
* @return null|mixed
*/
public function add(string $data) {
switch ($this->engine) {
case 'matthiasmullie':
Expand Down
4 changes: 4 additions & 0 deletions src/ShrinkWrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ public function __construct() {
$this->domparser = new HTML5();
}

/**
* @param mixed $method
* @param mixed $args
*/
public function __call($method, $args) {
echo "Calling unknown object method '{$method}' " . json_encode($args) . "\n";
}
Expand Down

0 comments on commit ef82b65

Please sign in to comment.