. * * This file is a part of iCalcreator. */ namespace Kigkonsult\Icalcreator\Traits; use Kigkonsult\Icalcreator\Util\Util; /** * ACTION property functions * * @author Kjell-Inge Gustafsson, kigkonsult * @since 2.26.2 - 2018-11-27 */ trait ACTIONtrait { /** * @var array component property ACTION value * @access protected */ protected $action = null; /** * Return formatted output for calendar component property action * * @return string */ public function createAction() { if( empty( $this->action )) { return null; } if( empty( $this->action[Util::$LCvalue] )) { return ( $this->getConfig( Util::$ALLOWEMPTY )) ? Util::createElement( Util::$ACTION ) : null; } return Util::createElement( Util::$ACTION, Util::createParams( $this->action[Util::$LCparams] ), $this->action[Util::$LCvalue] ); } /** * Set calendar component property action * * @param string $value "AUDIO" / "DISPLAY" / "EMAIL" / "PROCEDURE" / iana-token / x-name * @param mixed $params * @return bool */ public function setAction( $value, $params = null ) { if( empty( $value )) { if( $this->getConfig( Util::$ALLOWEMPTY )) { $value = Util::$SP0; } else { return false; } } $this->action = [ Util::$LCvalue => Util::trimTrailNL( $value ), Util::$LCparams => Util::setParams( $params ), ]; return true; } }