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
Border.php
48 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Kubio\Core\StyleManager\Props; |
| 4 | |
| 5 | use Kubio\Config; |
| 6 | use Kubio\Core\LodashBasic; |
| 7 | use Kubio\Core\StyleManager\ParserUtils; |
| 8 | |
| 9 | class Border extends PropertyBase { |
| 10 | |
| 11 | public function parse( $value, $options ) { |
| 12 | $borderWithRadius = $this->valueWithDefault( $value ); |
| 13 | $style = array(); |
| 14 | foreach ( $borderWithRadius as $side => $border_side ) { |
| 15 | $border_width = LodashBasic::get( $border_side, 'width.value' ); |
| 16 | |
| 17 | $side_props = array( 'color', 'width', 'style' ); |
| 18 | |
| 19 | if ( ! is_numeric( $border_width ) ) { |
| 20 | $side_props = array( 'color' ); |
| 21 | } |
| 22 | |
| 23 | foreach ( $side_props as $prop ) { |
| 24 | if ( isset( $border_side[ $prop ] ) ) { |
| 25 | ParserUtils::addValueUnitString( |
| 26 | $style, |
| 27 | 'border-' . $side . '-' . $prop, |
| 28 | $border_side[ $prop ] |
| 29 | ); |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | $radiuses = Config::value( 'props.border.radiusMap' ); |
| 35 | foreach ( array_keys( $radiuses ) as $path ) { |
| 36 | $radius = LodashBasic::get( |
| 37 | $borderWithRadius, |
| 38 | $radiuses[ $path ], |
| 39 | null |
| 40 | ); |
| 41 | if ( $radius !== null ) { |
| 42 | ParserUtils::addValueUnitString( $style, $path, $radius ); |
| 43 | } |
| 44 | } |
| 45 | return $style; |
| 46 | } |
| 47 | } |
| 48 |