Animation.php
4 years ago
Background.php
4 years ago
BackgroundImage.php
4 years ago
Border.php
4 years ago
BoxShadow.php
4 years ago
ColumnWidth.php
4 years ago
CustomHeight.php
4 years ago
CustomSize.php
4 years ago
Gap.php
4 years ago
Height.php
4 years ago
MaxWidth.php
4 years ago
MultipleImage.php
4 years ago
ObjectCss.php
4 years ago
Opacity.php
4 years ago
Property.php
4 years ago
PropertyBase.php
4 years ago
Size.php
4 years ago
Stroke.php
4 years ago
TBLR.php
4 years ago
TextShadow.php
4 years ago
Transform.php
4 years ago
Transition.php
4 years ago
Typography.php
4 years ago
UnitValuePercentage.php
4 years ago
ValueProxy.php
4 years ago
Width.php
4 years ago
Border.php
43 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 => $borderSide ) { |
| 15 | $borderWidth = LodashBasic::get( $borderSide, 'width.value' ); |
| 16 | if ( is_numeric( $borderWidth ) ) { |
| 17 | foreach ( array( 'color', 'width', 'style' ) as $prop ) { |
| 18 | if ( isset( $borderSide[ $prop ] ) ) { |
| 19 | ParserUtils::addValueUnitString( |
| 20 | $style, |
| 21 | 'border-' . $side . '-' . $prop, |
| 22 | $borderSide[ $prop ] |
| 23 | ); |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | $radiuses = Config::value( 'props.border.radiusMap' ); |
| 30 | foreach ( $radiuses as $path => $___ ) { |
| 31 | $radius = LodashBasic::get( |
| 32 | $borderWithRadius, |
| 33 | $radiuses[ $path ], |
| 34 | null |
| 35 | ); |
| 36 | if ( $radius !== null ) { |
| 37 | ParserUtils::addValueUnitString( $style, $path, $radius ); |
| 38 | } |
| 39 | } |
| 40 | return $style; |
| 41 | } |
| 42 | } |
| 43 |