Skip to content

Commit

Permalink
Update SVGTemplate.php
Browse files Browse the repository at this point in the history
Fixing php 8.2 errors
  • Loading branch information
Joe Madden committed Jun 22, 2023
1 parent 031d78d commit 443bf3e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/SVGTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,20 @@ class SVGTemplate extends ViewableData
/**
* @var array
*/
private $extraClasses;
private $extra_classes = [];

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

private $name;

private $id;

private $out;


/**
* @param string $name
* @param string $id
Expand All @@ -78,7 +85,7 @@ public function __construct($name, $id = '')
{
$this->name = $name;
$this->id = $id;
$this->extra_classes = $this->config()->get('default_extra_classes');
$this->extra_classes = $this->config()->get('default_extra_classes') ?: [];
$this->extra_classes[] = 'svg-'.$this->name;
$this->subfolders = array();
$this->out = new DOMDocument();
Expand Down Expand Up @@ -227,12 +234,12 @@ public function forTemplate()
{

$path = BASE_PATH . DIRECTORY_SEPARATOR;
$path .= ($this->custom_base_path) ? $this->custom_base_path : $this->stat('base_path');
$path .= ($this->custom_base_path) ? $this->custom_base_path : $this->config()->get('base_path');
$path .= DIRECTORY_SEPARATOR;
foreach($this->subfolders as $subfolder) {
$path .= $subfolder . DIRECTORY_SEPARATOR;
}
$path .= (strpos($this->name, ".") === false) ? $this->name . '.' . $this->stat('extension') : $this->name;
$path .= (strpos($this->name, ".") === false) ? $this->name . '.' . $this->config()->get('extension') : $this->name;

return $this->process($path);

Expand Down

0 comments on commit 443bf3e

Please sign in to comment.