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