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