| 1 |
<?php |
| 2 |
/** |
| 3 |
* iCalcreator, the PHP class package managing iCal (rfc2445/rfc5445) calendar information. |
| 4 |
* |
| 5 |
* copyright (c) 2007-2021 Kjell-Inge Gustafsson, kigkonsult, All rights reserved |
| 6 |
* Link https://kigkonsult.se |
| 7 |
* Package iCalcreator |
| 8 |
* Version 2.30 |
| 9 |
* License Subject matter of licence is the software iCalcreator. |
| 10 |
* The above copyright, link, package and version notices, |
| 11 |
* this licence notice and the invariant [rfc5545] PRODID result use |
| 12 |
* as implemented and invoked in iCalcreator shall be included in |
| 13 |
* all copies or substantial portions of the iCalcreator. |
| 14 |
* |
| 15 |
* iCalcreator is free software: you can redistribute it and/or modify |
| 16 |
* it under the terms of the GNU Lesser General Public License as published |
| 17 |
* by the Free Software Foundation, either version 3 of the License, |
| 18 |
* or (at your option) any later version. |
| 19 |
* |
| 20 |
* iCalcreator is distributed in the hope that it will be useful, |
| 21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 |
* GNU Lesser General Public License for more details. |
| 24 |
* |
| 25 |
* You should have received a copy of the GNU Lesser General Public License |
| 26 |
* along with iCalcreator. If not, see <https://www.gnu.org/licenses/>. |
| 27 |
* |
| 28 |
* This file is a part of iCalcreator. |
| 29 |
*/ |
| 30 |
|
| 31 |
namespace Kigkonsult\Icalcreator; |
| 32 |
|
| 33 |
use Exception; |
| 34 |
|
| 35 |
use function sprintf; |
| 36 |
use function strtoupper; |
| 37 |
|
| 38 |
/** |
| 39 |
* iCalcreator (Vtimezone) Daylight/Standard base component class |
| 40 |
* |
| 41 |
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se> |
| 42 |
* @since 2.29.11 - 2019-08-30 |
| 43 |
*/ |
| 44 |
abstract class DScomponent extends CalendarComponent |
| 45 |
{ |
| 46 |
use Traits\COMMENTtrait, |
| 47 |
Traits\DTSTARTtrait, |
| 48 |
Traits\RDATEtrait, |
| 49 |
Traits\RRULEtrait, |
| 50 |
Traits\TZNAMEtrait, |
| 51 |
Traits\TZOFFSETFROMtrait, |
| 52 |
Traits\TZOFFSETTOtrait; |
| 53 |
|
| 54 |
/** |
| 55 |
* @var string |
| 56 |
* @access protected |
| 57 |
* @static |
| 58 |
*/ |
| 59 |
protected static $compSgn = 'ds'; |
| 60 |
|
| 61 |
/** |
| 62 |
* Destructor |
| 63 |
* |
| 64 |
* @since 2.29.11 - 2019-08-30 |
| 65 |
*/ |
| 66 |
public function __destruct() { |
| 67 |
unset( |
| 68 |
$this->compType, |
| 69 |
$this->xprop, |
| 70 |
$this->components, |
| 71 |
$this->unparsed, |
| 72 |
$this->config, |
| 73 |
$this->propIx, |
| 74 |
$this->compix, |
| 75 |
$this->propDelIx |
| 76 |
); |
| 77 |
unset( |
| 78 |
$this->cno, |
| 79 |
$this->srtk |
| 80 |
); |
| 81 |
unset( |
| 82 |
$this->comment, |
| 83 |
$this->dtstart, |
| 84 |
$this->rdate, |
| 85 |
$this->rrule, |
| 86 |
$this->tzname, |
| 87 |
$this->tzoffsetfrom, |
| 88 |
$this->tzoffsetto |
| 89 |
); |
| 90 |
} |
| 91 |
|
| 92 |
/** |
| 93 |
* Return formatted output for calendar component VTIMEZONE Daylight/Standard object instances |
| 94 |
* |
| 95 |
* @return string |
| 96 |
* @throws Exception (on Rdate err) |
| 97 |
* @since 2.29.11 - 2019-08-30 |
| 98 |
*/ |
| 99 |
public function createComponent() |
| 100 |
{ |
| 101 |
$compType = strtoupper( $this->getCompType()); |
| 102 |
$component = sprintf( self::$FMTBEGIN, $compType ); |
| 103 |
$component .= $this->createTzname(); |
| 104 |
$component .= $this->createDtstart(); |
| 105 |
$component .= $this->createTzoffsetfrom(); |
| 106 |
$component .= $this->createTzoffsetto(); |
| 107 |
$component .= $this->createRdate(); |
| 108 |
$component .= $this->createRrule(); |
| 109 |
$component .= $this->createComment(); |
| 110 |
$component .= $this->createXprop(); |
| 111 |
return $component . sprintf( self::$FMTEND, $compType ); |
| 112 |
} |
| 113 |
} |
| 114 |
|