1<?php 2 3 4namespace ComboStrap; 5 6 7class Underline 8{ 9 10 const UNDERLINE_ATTRIBUTE = "underline"; 11 const CANONICAL = self::UNDERLINE_ATTRIBUTE; 12 13 /** 14 * @param TagAttributes $attributes 15 */ 16 public static function processUnderlineAttribute(TagAttributes &$attributes) 17 { 18 19 20 if ($attributes->hasComponentAttribute(Underline::UNDERLINE_ATTRIBUTE)) { 21 $value = $attributes->removeComponentAttribute(Underline::UNDERLINE_ATTRIBUTE); 22 if (empty($value)){ 23 $value = true; 24 } else { 25 $value = filter_var($value, FILTER_VALIDATE_BOOLEAN); 26 } 27 if ($value) { 28 $attributes->addClassName("text-decoration-underline"); 29 } else { 30 $attributes->addClassName("text-decoration-none"); 31 } 32 33 } 34 35 } 36 37 38} 39