Skip to content

Commit

Permalink
removed instance
Browse files Browse the repository at this point in the history
  • Loading branch information
BradCrumb committed Sep 2, 2013
1 parent f0234bc commit 3c25508
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 29 deletions.
36 changes: 11 additions & 25 deletions Controller/Component/LessComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,6 @@ class LessComponent extends Component {
*/
public $enabled = true;

/**
* Holder for the LessCompiler instance
*
* @var LessCompiler
*/
protected static $_instance;

/**
* Minimum required PHP version
*
Expand Down Expand Up @@ -405,7 +398,7 @@ public function generateCss() {
* @param string $inputFile
* @param string $outputFile
* @param string $lessFolder
*
*non
* @return boolean
*/
protected function _autoCompileLess($inputFile, $outputFile, $lessFolder) {
Expand All @@ -417,18 +410,18 @@ protected function _autoCompileLess($inputFile, $outputFile, $lessFolder) {
unserialize(file_get_contents($cacheFile)):
$inputFile;

if (!self::$_instance instanceof LessCompiler) {
self::$_instance = new LessCompiler();
self::$_instance->setFormatter($this->settings['formatter']);
if (is_bool($this->settings['preserveComments'])) {
self::$_instance->setPreserveComments($this->settings['preserveComments']);
}
if ($this->settings['variables']) {
self::$_instance->setVariables($this->settings['variables']);
}
$lessCompiler = new LessCompiler();
$lessCompiler->setFormatter($this->settings['formatter']);

if (is_bool($this->settings['preserveComments'])) {
$lessCompiler->setPreserveComments($this->settings['preserveComments']);
}

if ($this->settings['variables']) {
$lessCompiler->setVariables($this->settings['variables']);
}

$newCache = self::$_instance->cachedCompile($cache, $this->settings['forceCompiling']);
$newCache = $lessCompiler->cachedCompile($cache, $this->settings['forceCompiling']);

if (true === $this->settings['forceCompiling'] ||
!is_array($cache) ||
Expand Down Expand Up @@ -480,11 +473,4 @@ public function cleanGeneratedCss() {

return $cleanedFiles;
}

/**
* Remove the existing instance of lessc
*/
public function removeInstance() {
self::$_instance = null;
}
}
4 changes: 0 additions & 4 deletions Test/Case/Controller/Component/LessComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ public function testPreserveComments() {
$Less->startup($this->Controller);
$Less->initialize($this->Controller);

$Less->removeInstance();

$this->assertTrue($Less->settings['preserveComments']);

//Clean all generated CSS files
Expand All @@ -124,8 +122,6 @@ public function testVariables() {
$Less->startup($this->Controller);
$Less->initialize($this->Controller);

$Less->removeInstance();

$this->assertTrue($Less->settings['variables']['color'] == '#ffffff');

//Clean all generated CSS files
Expand Down

0 comments on commit 3c25508

Please sign in to comment.