Skip to content

Commit

Permalink
Changing setStyle to setAttribute
Browse files Browse the repository at this point in the history
This fixes #1, so no more CSP violation because of `unsafe-inline`
  • Loading branch information
S1SYPHOS committed Aug 9, 2020
1 parent 6fba159 commit 42da0de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/Donut.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Donut
/**
* Current version number of tiny-phpeanuts
*/
const VERSION = '0.1.0';
const VERSION = '0.2.0';


/**
Expand Down
12 changes: 6 additions & 6 deletions lib/Segment.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ public function getSVGElement(): \SVG\Nodes\Shapes\SVGCircle
$this->size / 2,
$this->size / 2,
$radius
))->setStyle('fill', $this->backgroundColor);
))->setAttribute('fill', $this->backgroundColor);

if ($this->backgroundColor === 'transparent') {
$circle
->setStyle('fill-opacity', 0)
->setStyle('stroke', $this->color)
->setStyle('stroke-width', (string) $this->thickness)
->setStyle('stroke-dashoffset', (string) $offset)
->setStyle('stroke-dasharray', Butler::join([
->setAttribute('fill-opacity', 0)
->setAttribute('stroke', $this->color)
->setAttribute('stroke-width', (string) $this->thickness)
->setAttribute('stroke-dashoffset', (string) $offset)
->setAttribute('stroke-dasharray', Butler::join([
(string) $lengthOnCircle,
(string) $circumference - $lengthOnCircle
], ' '))
Expand Down

0 comments on commit 42da0de

Please sign in to comment.