. * * This file is a part of iCalcreator. */ namespace Kigkonsult\Icalcreator\Traits; use Kigkonsult\Icalcreator\Util\Util; /** * COMMENT property functions * * @author Kjell-Inge Gustafsson, kigkonsult * @since 2.22.23 - 2017-02-02 */ trait COMMENTtrait { /** * @var array component property COMMENT value * @access protected */ protected $comment = null; /** * Return formatted output for calendar component property comment * * @return string */ public function createComment() { if( empty( $this->comment )) { return null; } $output = null; $lang = $this->getConfig( Util::$LANGUAGE ); foreach( $this->comment as $cx => $commentPart ) { if( empty( $commentPart[Util::$LCvalue] )) { if( $this->getConfig( Util::$ALLOWEMPTY )) { $output .= Util::createElement( Util::$COMMENT ); } continue; } $output .= Util::createElement( Util::$COMMENT, Util::createParams( $commentPart[Util::$LCparams], Util::$ALTRPLANGARR, $lang ), Util::strrep( $commentPart[Util::$LCvalue] ) ); } return $output; } /** * Set calendar component property comment * * @param string $value * @param array $params * @param integer $index * @return bool */ public function setComment( $value, $params = null, $index = null ) { if( empty( $value )) { if( $this->getConfig( Util::$ALLOWEMPTY )) { $value = Util::$SP0; } else { return false; } } Util::setMval( $this->comment, $value, $params, false, $index ); return true; } }