. * * This file is a part of iCalcreator. */ namespace Kigkonsult\Icalcreator\Traits; use Kigkonsult\Icalcreator\Util\Util; /** * STATUS property functions * * @author Kjell-Inge Gustafsson, kigkonsult * @since 2.22.23 - 2017-02-02 */ trait STATUStrait { /** * @var array component property STATUS value * @access protected */ protected $status = null; /** * Return formatted output for calendar component property status * * @return string */ public function createStatus() { if( empty( $this->status )) { return null; } if( empty( $this->status[Util::$LCvalue] )) { return ( $this->getConfig( Util::$ALLOWEMPTY )) ? Util::createElement( Util::$STATUS ) : null; } return Util::createElement( Util::$STATUS, Util::createParams( $this->status[Util::$LCparams] ), $this->status[Util::$LCvalue] ); } /** * Set calendar component property status * * @param string $value * @param array $params * @return bool */ public function setStatus( $value, $params = null ) { if( empty( $value )) { if( $this->getConfig( Util::$ALLOWEMPTY )) { $value = Util::$SP0; } else { return false; } } $this->status = [ Util::$LCvalue => Util::trimTrailNL( $value ), Util::$LCparams => Util::setParams( $params ), ]; return true; } }