Skip to content

Commit

Permalink
Merge pull request #90 from ven-com/perf-fixes
Browse files Browse the repository at this point in the history
Improve performance by switching from in_array() to isset()
  • Loading branch information
tedivm authored Sep 22, 2019
2 parents 566e0c7 + 3ac0766 commit f1bbf84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/JShrink/Minifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Minifier
/**
* These characters are used to define strings.
*/
protected $stringDelimiters = ['\'', '"', '`'];
protected $stringDelimiters = ['\'' => true, '"' => true, '`' => true];

/**
* Contains the default options for minification. This array is merged with
Expand Down Expand Up @@ -447,7 +447,7 @@ protected function saveString()
$this->a = $this->b;

// If this isn't a string we don't need to do anything.
if (!in_array($this->a, $this->stringDelimiters)) {
if (!isset($this->stringDelimiters[$this->a])) {
return;
}

Expand Down

0 comments on commit f1bbf84

Please sign in to comment.