. * * This file is a part of iCalcreator. */ namespace Kigkonsult\Icalcreator\Traits; use Kigkonsult\Icalcreator\Util\Util; /** * CLASS property functions * * @author Kjell-Inge Gustafsson, kigkonsult * @since 2.22.23 - 2017-02-17 */ trait CLASStrait { /** * @var string component property CLASS value * @access protected */ protected $class = null; /** * @var string * @access private * @static */ private static $KLASS = 'class'; /** * Return formatted output for calendar component property class * * @return string */ public function createClass() { if( empty( $this->{self::$KLASS} )) { return null; } if( empty( $this->{self::$KLASS}[Util::$LCvalue] )) { return ( $this->getConfig( Util::$ALLOWEMPTY )) ? Util::createElement( Util::$CLASS ) : null; } return Util::createElement( Util::$CLASS, Util::createParams( $this->{self::$KLASS}[Util::$LCparams] ), $this->{self::$KLASS}[Util::$LCvalue] ); } /** * Set calendar component property class * * @param string $value "PUBLIC" / "PRIVATE" / "CONFIDENTIAL" / iana-token / x-name * @param array $params * @return bool */ public function setClass( $value, $params = null ) { if( empty( $value )) { if( $this->getConfig( Util::$ALLOWEMPTY )) { $value = Util::$SP0; } else { return false; } } $this->{self::$KLASS} = [ Util::$LCvalue => Util::trimTrailNL( $value ), Util::$LCparams => Util::setParams( $params ), ]; return true; } }