@@ -48,7 +48,7 @@ |
||
48 | 48 | /** |
49 | 49 | * @param array $assoc |
50 | 50 | * |
51 | - * @return mixed |
|
51 | + * @return SVG |
|
52 | 52 | */ |
53 | 53 | public function apply(array $assoc) |
54 | 54 | { |
@@ -25,7 +25,7 @@ |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
28 | - * @param Stop|Stop[] $stops |
|
28 | + * @param Stop $stops |
|
29 | 29 | */ |
30 | 30 | public function appendStop(Stop $stops) |
31 | 31 | { |
@@ -43,6 +43,9 @@ discard block |
||
43 | 43 | $this->add(); |
44 | 44 | } |
45 | 45 | |
46 | + /** |
|
47 | + * @param string $name |
|
48 | + */ |
|
46 | 49 | public function createElement($name, $value = null, $attributes = []) |
47 | 50 | { |
48 | 51 | return $this->root->createElement($name, $value, $attributes); |
@@ -99,6 +102,9 @@ discard block |
||
99 | 102 | $this->element->setAttribute($name, $value); |
100 | 103 | } |
101 | 104 | |
105 | + /** |
|
106 | + * @param string $name |
|
107 | + */ |
|
102 | 108 | public function getXLinkAttribute($name) |
103 | 109 | { |
104 | 110 | return $this->element->getAttributeNS('xlink', $name); |
@@ -128,6 +134,9 @@ discard block |
||
128 | 134 | return $this; |
129 | 135 | } |
130 | 136 | |
137 | + /** |
|
138 | + * @param string $name |
|
139 | + */ |
|
131 | 140 | protected function setAttribute($name, $value, $xLink = false) |
132 | 141 | { |
133 | 142 | if ($xLink === true) { |
@@ -42,6 +42,7 @@ |
||
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @inheritdoc |
45 | + * @param string $id |
|
45 | 46 | */ |
46 | 47 | public function getChildById($id) |
47 | 48 | { |
@@ -13,7 +13,7 @@ |
||
13 | 13 | trait ElementTrait |
14 | 14 | { |
15 | 15 | /** |
16 | - * @param ElementInterface|ElementInterface[] $elements |
|
16 | + * @param ElementInterface $elements |
|
17 | 17 | * |
18 | 18 | * @return $this |
19 | 19 | */ |
@@ -20,7 +20,7 @@ |
||
20 | 20 | public function append(ElementInterface $elements) |
21 | 21 | { |
22 | 22 | /** @var ElementInterface[] $elements */ |
23 | - $elements = array_filter(func_get_args(), function ($item) { |
|
23 | + $elements = array_filter(func_get_args(), function($item) { |
|
24 | 24 | return $item instanceof ElementInterface; |
25 | 25 | }); |
26 | 26 |
@@ -20,6 +20,10 @@ |
||
20 | 20 | return $tag . (++$count); |
21 | 21 | } |
22 | 22 | |
23 | + /** |
|
24 | + * @param string $prefix |
|
25 | + * @param integer $length |
|
26 | + */ |
|
23 | 27 | public static function random($prefix, $length) |
24 | 28 | { |
25 | 29 | $length = intval($length); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | } |
32 | 32 | } |
33 | 33 | $step = 1 / (count($colors) - 1); |
34 | - $offsets = array_map(function ($item) { |
|
34 | + $offsets = array_map(function($item) { |
|
35 | 35 | return $item % 1 !== 0 ? sprintf('%0.2f', $item) : $item; |
36 | 36 | }, range(0, 1, $step)); |
37 | 37 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | $defs = new Defs($svg); |
18 | 18 | |
19 | 19 | $linearGradient = UniformGradient::uniformGradient($defs, ['#ff0000', '#00ff00', '#0000ff', '#000000'], null); |
20 | -KeyValueWriter::apply($linearGradient->getElement(), ['gradientUnits' => 'userSpaceOnUse', 'x1' => 100, 'y1' => 0, 'x2' => 600, 'y2' => 0,]); |
|
20 | +KeyValueWriter::apply($linearGradient->getElement(), ['gradientUnits' => 'userSpaceOnUse', 'x1' => 100, 'y1' => 0, 'x2' => 600, 'y2' => 0, ]); |
|
21 | 21 | |
22 | 22 | $g = new G($svg); |
23 | 23 | $g->apply(['fontFamily' => 'Verdana', 'fontSize' => 75, 'fontWeight' => 'bold', 'fill' => "url(#$linearGradient->id)"]); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | require_once __DIR__ . '/../vendor/autoload.php'; |
10 | 10 | |
11 | -$style = ['stroke' => 'lightgray', 'stroke-width' => 0.5, 'rx' => 3, 'ry' => 3,]; |
|
11 | +$style = ['stroke' => 'lightgray', 'stroke-width' => 0.5, 'rx' => 3, 'ry' => 3, ]; |
|
12 | 12 | $colors = ['#1D4350', '#A43931']; |
13 | 13 | |
14 | 14 | $svg = new SVG(800, 800); |