Skip to content

Commit

Permalink
Merge pull request #172 from ten7/fix-171
Browse files Browse the repository at this point in the history
AMP.php: ensure that $this->options['scope'] is always set
  • Loading branch information
Sigurður Guðbrandsson committed Mar 14, 2017
2 parents a9bb7fe + 0a8f790 commit 476cae4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/AMP.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,13 @@ public function loadHtml($html, $options = [])
$options['remove_non_converted_img_tag'] = false;
}

// By default the scope is 'body'
if (!isset($options['scope'])) {
$options['scope'] = Scope::BODY_SCOPE;
}

$this->options = $options;
$this->scope = !empty($options['scope']) ? $options['scope'] : Scope::BODY_SCOPE;
$this->scope = $options['scope'];

// Currently we only support these two scopes
if (!in_array($this->scope, [Scope::HTML_SCOPE, Scope::BODY_SCOPE])) {
Expand Down

0 comments on commit 476cae4

Please sign in to comment.