Skip to content

Commit

Permalink
Merge pull request #20 from obj63mc/master
Browse files Browse the repository at this point in the history
Update SVGTemplate.php - fix php8.2 deprecations
  • Loading branch information
stevie-mayhew authored Jul 16, 2023
2 parents 031d78d + 443bf3e commit 7098407
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 7098407

Please sign in to comment.