PluginProbe
Tableberg – Simple Gutenberg Table Block / 1.1.2
Tableberg – Simple Gutenberg Table Block v1.1.2
1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 trunk 0.0.2 0.2.1 0.3.2 0.3.3 0.4.1 0.5.0 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 0.5.7 All 42 releases
tableberg / renderer / Attrs / SvgIconAttrs.php

SvgIconAttrs.php in Tableberg – Simple Gutenberg Table Block 1.1.2, at renderer/Attrs/SvgIconAttrs.php

45 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Tableberg\Renderer\Attrs;
4
5 use function Tableberg\Renderer\getOrNull;
6
7 class SvgIconAttrs {
8 /** @var StringAttr */
9 public $viewBox;
10
11 /** @var StringAttr */
12 public $path;
13
14 /**
15 * @param array<string, mixed>|null $data
16 * @param array<string, mixed> $defaults
17 * @param string $fallbackViewBox
18 * @param string $fallbackPath
19 * @return self
20 */
21 public static function from_array(
22 $data,
23 $defaults = [],
24 $fallbackViewBox = '0 0 24 24',
25 $fallbackPath = ''
26 ) {
27 $data = is_array($data) ? $data : [];
28
29 $defaultViewBox = getOrNull($defaults['viewBox']);
30 $defaultPath = getOrNull($defaults['path']);
31
32 $instance = new self();
33 $instance->viewBox = new StringAttr(
34 getOrNull($data['viewBox']),
35 $defaultViewBox
36 );
37 $instance->path = new StringAttr(
38 getOrNull($data['path']),
39 $defaultPath
40 );
41
42 return $instance;
43 }
44 }
45