. * * This file is a part of iCalcreator. */ namespace Kigkonsult\Icalcreator\Traits; use Kigkonsult\Icalcreator\Util\Util; /** * ATTACH property functions * * @author Kjell-Inge Gustafsson, kigkonsult * @since 2.22.23 - 2017-02-02 */ trait ATTACHtrait { /** * @var array component property ATTACH value * @access protected */ protected $attach = null; /** * Return formatted output for calendar component property attach * * @return string */ public function createAttach() { if( empty( $this->attach )) { return null; } $output = null; foreach( $this->attach as $aix => $attachPart ) { if( ! empty( $attachPart[Util::$LCvalue] )) { $output .= Util::createElement( Util::$ATTACH, Util::createParams( $attachPart[Util::$LCparams] ), $attachPart[Util::$LCvalue] ); } elseif( $this->getConfig( Util::$ALLOWEMPTY )) { $output .= Util::createElement( Util::$ATTACH ); } } return $output; } /** * Set calendar component property attach * * @param string $value * @param array $params * @param integer $index * @return bool */ public function setAttach( $value, $params = null, $index = null ) { if( empty( $value )) { if( $this->getConfig( Util::$ALLOWEMPTY )) { $value = Util::$SP0; } else { return false; } } Util::setMval( $this->attach, $value, $params, false, $index ); return true; } }