| 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\Traits; |
| 32 |
|
| 33 |
use Kigkonsult\Icalcreator\Util\Util; |
| 34 |
|
| 35 |
use function sprintf; |
| 36 |
|
| 37 |
/** |
| 38 |
* METHOD property functions |
| 39 |
* |
| 40 |
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se> |
| 41 |
* @since 2.29.14 2019-09-03 |
| 42 |
*/ |
| 43 |
trait METHODtrait |
| 44 |
{ |
| 45 |
/** |
| 46 |
* @var string calendar property METHOD |
| 47 |
*/ |
| 48 |
protected $method = null; |
| 49 |
|
| 50 |
/** |
| 51 |
* Return formatted output for calendar property method |
| 52 |
* |
| 53 |
* @return string |
| 54 |
*/ |
| 55 |
public function createMethod() |
| 56 |
{ |
| 57 |
return ( empty( $this->method )) |
| 58 |
? null |
| 59 |
: sprintf( self::$FMTICAL, self::METHOD, $this->method ); |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Delete calendar component property method |
| 64 |
* |
| 65 |
* @return bool |
| 66 |
* @since 2.27.1 - 2018-12-15 |
| 67 |
*/ |
| 68 |
public function deleteMethod() |
| 69 |
{ |
| 70 |
$this->method = null; |
| 71 |
return true; |
| 72 |
} |
| 73 |
|
| 74 |
/** |
| 75 |
* Return method |
| 76 |
* |
| 77 |
* @return string |
| 78 |
* @since 2.27.1 - 2018-12-15 |
| 79 |
*/ |
| 80 |
public function getMethod() { |
| 81 |
if( empty( $this->method )) { |
| 82 |
return false; |
| 83 |
} |
| 84 |
return $this->method; |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* Set calendar property method |
| 89 |
* |
| 90 |
* @param string $value |
| 91 |
* @return static |
| 92 |
* @since 2.29.14 - 2019-09-03 |
| 93 |
*/ |
| 94 |
public function setMethod( $value ) |
| 95 |
{ |
| 96 |
if( empty( $value )) { |
| 97 |
$this->assertEmptyValue( $value, self::METHOD ); |
| 98 |
$value = Util::$SP0; |
| 99 |
} |
| 100 |
Util::assertString( $value, self::METHOD ); |
| 101 |
$this->method = (string) $value; |
| 102 |
return $this; |
| 103 |
} |
| 104 |
} |
| 105 |
|