Skip to content

Commit

Permalink
Use common trait
Browse files Browse the repository at this point in the history
Signed-off-by: Bugo <[email protected]>
  • Loading branch information
dragomano committed Feb 6, 2024
1 parent 9df4f2b commit dd47ce8
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 28 deletions.
15 changes: 1 addition & 14 deletions Sources/Minify/CSS.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,7 @@

class CSS extends BaseCSS
{
public function minify($path = null)
{
$content = $this->execute($path);

// These are not the droids you're looking for
$content = "/* Any changes to this file will be overwritten. To change the content\nof this file, edit the source files from which it was compiled. */\n" . $content;

// save to path
if ($path !== null) {
$this->save($content, $path);
}

return $content;
}
use CustomTrait;
}

?>
36 changes: 36 additions & 0 deletions Sources/Minify/CustomTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* Simple Machines Forum (SMF)
*
* @package SMF
* @author Simple Machines https://www.simplemachines.org
* @copyright 2024 Simple Machines and individual contributors
* @license https://www.simplemachines.org/about/smf/license.php BSD
*
* @version 3.0 Alpha 1
*/

declare(strict_types=1);

namespace SMF\Minify;

trait CustomTrait
{
public function minify($path = null)
{
$content = $this->execute($path);

// These are not the droids you're looking for
$content = "/* Any changes to this file will be overwritten. To change the content\nof this file, edit the source files from which it was compiled. */\n" . $content;

// save to path
if ($path !== null) {
$this->save($content, $path);
}

return $content;
}
}

?>
15 changes: 1 addition & 14 deletions Sources/Minify/JS.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,7 @@

class JS extends BaseJS
{
public function minify($path = null)
{
$content = $this->execute($path);

// These are not the droids you're looking for
$content = "/* Any changes to this file will be overwritten. To change the content\nof this file, edit the source files from which it was compiled. */\n" . $content;

// save to path
if ($path !== null) {
$this->save($content, $path);
}

return $content;
}
use CustomTrait;
}

?>

0 comments on commit dd47ce8

Please sign in to comment.