. * * This file is a part of iCalcreator. */ namespace Kigkonsult\Icalcreator\Traits; use Kigkonsult\Icalcreator\Util\Util; use function sprintf; use function strtoupper; /** * PRODID property functions * * @author Kjell-Inge Gustafsson, kigkonsult * @since 2.22.23 - 2017-03-15 */ trait PRODIDtrait { /** * @var string calendar property PRODID * @access protected */ protected $prodid = null; /** * Return formatted output for calendar property prodid * * @return string */ public function createProdid() { if( ! isset( $this->prodid )) { $this->makeProdid(); } return Util::createElement( Util::$PRODID, null, $this->prodid ); } /** * Create default value for calendar prodid, * Do NOT alter or remove this method or the invoke of this method, * a licence violation. * * [rfc5545] * "Conformance: The property MUST be specified once in an iCalendar object. * Description: The vendor of the implementation SHOULD assure that this * is a globally unique identifier; using some technique such as an FPI * value, as defined in [ISO 9070]." * * @author Kjell-Inge Gustafsson, kigkonsult * @since 2.26.2 - 2018-11-29 */ public function makeProdid() { static $FMT = '-//%s//NONSGML kigkonsult.se %s//%s'; if( false !== ( $lang = $this->getConfig( Util::$LANGUAGE ))) { $lang = strtoupper( $lang ); } else { $lang = Util::$SP0; } $this->prodid = sprintf( $FMT, $this->getConfig( Util::$UNIQUE_ID ), ICALCREATOR_VERSION, $lang ); } }