PluginProbe
Import Social Events / 1.8.5
Import Social Events v1.8.5
1.9.1 1.9.0 trunk 1.0.0 1.0.1 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.6.0 1.6.1 1.6.10 1.6.11 1.6.12 All 61 releases
import-facebook-events / includes / lib / icalcreator / src / Traits / TZNAMEtrait.php

TZNAMEtrait.php in Import Social Events 1.8.5, at includes/lib/icalcreator/src/Traits/TZNAMEtrait.php

143 lines 4.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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\StringFactory;
34 use Kigkonsult\Icalcreator\Util\Util;
35 use Kigkonsult\Icalcreator\Util\ParameterFactory;
36 use InvalidArgumentException;
37
38 /**
39 * TZNAME property functions
40 *
41 * @author Kjell-Inge Gustafsson, kigkonsult <[email protected]>
42 * @since 2.29.14 2019-09-03
43 */
44 trait TZNAMEtrait
45 {
46 /**
47 * @var array component property TZNAME value
48 */
49 protected $tzname = null;
50
51 /**
52 * Return formatted output for calendar component property tzname
53 *
54 * @return string
55 */
56 public function createTzname()
57 {
58 if( empty( $this->tzname )) {
59 return null;
60 }
61 $output = null;
62 $lang = $this->getConfig( self::LANGUAGE );
63 foreach( $this->tzname as $tzx => $theName ) {
64 if( ! empty( $theName[Util::$LCvalue] )) {
65 $output .= StringFactory::createElement(
66 self::TZNAME,
67 ParameterFactory::createParams(
68 $theName[Util::$LCparams],
69 [ self::LANGUAGE ],
70 $lang
71 ),
72 StringFactory::strrep( $theName[Util::$LCvalue] )
73 );
74 }
75 elseif( $this->getConfig( self::ALLOWEMPTY )) {
76 $output .= StringFactory::createElement( self::TZNAME );
77 }
78 } // end foreach
79 return $output;
80 }
81
82 /**
83 * Delete calendar component property tzname
84 *
85 * @param int $propDelIx specific property in case of multiply occurrence
86 * @return bool
87 * @since 2.27.1 - 2018-12-15
88 */
89 public function deleteTzname( $propDelIx = null )
90 {
91 if( empty( $this->tzname )) {
92 unset( $this->propDelIx[self::TZNAME] );
93 return false;
94 }
95 return $this->deletePropertyM( $this->tzname, self::TZNAME, $propDelIx );
96 }
97
98 /**
99 * Get calendar component property tzname
100 *
101 * @param int $propIx specific property in case of multiply occurrence
102 * @param bool $inclParam
103 * @return bool|array
104 * @since 2.27.1 - 2018-12-12
105 */
106 public function getTzname( $propIx = null, $inclParam = false )
107 {
108 if( empty( $this->tzname )) {
109 unset( $this->propIx[self::TZNAME] );
110 return false;
111 }
112 return $this->getPropertyM( $this->tzname, self::TZNAME, $propIx, $inclParam );
113 }
114
115 /**
116 * Set calendar component property tzname
117 *
118 * @param string $value
119 * @param array $params
120 * @param integer $index
121 * @return static
122 * @throws InvalidArgumentException
123 * @since 2.29.14 2019-09-03
124 */
125 public function setTzname( $value = null, $params = [], $index = null )
126 {
127 if( empty( $value )) {
128 $this->assertEmptyValue( $value, self::TZNAME );
129 $value = Util::$SP0;
130 $params = [];
131 }
132 Util::assertString( $value, self::TZNAME );
133 $this->setMval(
134 $this->tzname,
135 StringFactory::trimTrailNL( $value ),
136 $params,
137 null,
138 $index
139 );
140 return $this;
141 }
142 }
143