/** * Initalises the border style into an array of individual style compontents * * @param string $value The value the style has * @return css_style_bordercolor */ public static function init($value) { $value = preg_replace('#\\s+#', ' ', $value); $bits = explode(' ', $value, 3); $return = array(); if (count($bits) > 0) { $width = array_shift($bits); if (!css_style_borderwidth::is_border_width($width)) { $width = '0'; } $return[] = new css_style_borderwidth('border-top-width', $width); $return[] = new css_style_borderwidth('border-right-width', $width); $return[] = new css_style_borderwidth('border-bottom-width', $width); $return[] = new css_style_borderwidth('border-left-width', $width); } if (count($bits) > 0) { $style = array_shift($bits); $return[] = new css_style_borderstyle('border-top-style', $style); $return[] = new css_style_borderstyle('border-right-style', $style); $return[] = new css_style_borderstyle('border-bottom-style', $style); $return[] = new css_style_borderstyle('border-left-style', $style); } if (count($bits) > 0) { $colour = array_shift($bits); $return[] = new css_style_bordercolor('border-top-color', $colour); $return[] = new css_style_bordercolor('border-right-color', $colour); $return[] = new css_style_bordercolor('border-bottom-color', $colour); $return[] = new css_style_bordercolor('border-left-color', $colour); } return $return; }
/** * Initalises the border style into an array of individual style compontents * * @param string $value The value the style has * @return css_style_bordercolor */ public static function init($value) { $value = preg_replace('#\\s+#', ' ', $value); $bits = explode(' ', $value, 3); $return = array(); if (count($bits) > 0) { $width = array_shift($bits); if (!css_style_borderwidth::is_border_width($width)) { $width = '0'; } $return[] = css_style_bordertopwidth::init($width); $return[] = css_style_borderrightwidth::init($width); $return[] = css_style_borderbottomwidth::init($width); $return[] = css_style_borderleftwidth::init($width); } if (count($bits) > 0) { $style = array_shift($bits); $return[] = css_style_bordertopstyle::init($style); $return[] = css_style_borderrightstyle::init($style); $return[] = css_style_borderbottomstyle::init($style); $return[] = css_style_borderleftstyle::init($style); } if (count($bits) > 0) { $colour = array_shift($bits); $return[] = css_style_bordertopcolor::init($colour); $return[] = css_style_borderrightcolor::init($colour); $return[] = css_style_borderbottomcolor::init($colour); $return[] = css_style_borderleftcolor::init($colour); } return $return; }