PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / trunk
Kubio AI Page Builder vtrunk
2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / lib / src / Core / StyleManager / Props / Property.php
kubio / lib / src / Core / StyleManager / Props Last commit date
Animation.php 1 year ago Background.php 1 year ago BackgroundImage.php 1 year ago Border.php 2 years ago BoxShadow.php 1 year ago ColumnWidth.php 1 year ago CustomHeight.php 1 year ago CustomSize.php 4 years ago Gap.php 1 year ago Height.php 1 year ago JustifyContent.php 1 year ago MaxWidth.php 1 year ago MultipleImage.php 1 year ago ObjectCss.php 1 year ago Opacity.php 1 year ago Property.php 1 year ago PropertyBase.php 1 year ago Size.php 1 year ago Stroke.php 1 year ago TBLR.php 1 year ago TextShadow.php 1 year ago Transform.php 2 years ago Transition.php 1 year ago Typography.php 1 month ago UnitValuePercentage.php 1 year ago UnitValuePx.php 1 year ago ValueProxy.php 4 years ago Width.php 1 year ago
Property.php
71 lines
1 <?php
2
3 namespace Kubio\Core\StyleManager\Props;
4 use Kubio\Core\LodashBasic;
5 use function is_string;
6
7 class Property {
8 public $properties = array();
9 public $default;
10 public $value;
11
12 public function __construct( $value, $default = array() ) {
13 $this->value = $value;
14 $this->default = $default;
15 }
16
17 public function matchTypeOf( $types, $value ) {
18 foreach ( $types as $type_value ) {
19 $type = $type_value['type'];
20 switch ( $type ) {
21 case 'string':
22 if ( is_string( $value ) ) {
23 return $type;
24 }
25 break;
26 }
27 }
28 }
29
30 public function resolveProperties() {
31 $resolved = array();
32 foreach ( $this->properties as $key => $property ) {
33 if ( $key == 'anyOf' ) {
34
35 }
36 if ( isset( $property['type'] ) ) {
37 $resolved[ $key ] = $this->createProperty( $property, $this->value[] );
38 }
39 }
40 }
41
42 public function createProperty( $propery ) {
43 if ( isset( $propery['type'] ) ) {
44 $class = $propery['type'];
45
46 return new $class();
47 }
48 }
49
50 public function resolveMap( $resolvedProperties ) {
51 $mapped = array();
52 foreach ( $this->map as $key => $value ) {
53 $mapped[ $key ] = $resolvedProperties[ $value ];
54 }
55 }
56
57 public function get( $path, $default = null ) {
58 return LodashBasic::get( $this->merged(), $path, $default );
59 }
60
61 public function merged() {
62 return LodashBasic::merge( $this->default, $this->value );
63 }
64
65 public function __toString() {
66 if ( is_string( $this->value ) ) {
67 return $this->value;
68 }
69 }
70 }
71