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 / PRIORITYtrait.php

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

129 lines 4.0 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 * PRIORITY property functions
40 *
41 * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
42 * @since 2.27.2 2019-01-03
43 */
44 trait PRIORITYtrait
45 {
46 /**
47 * @var array component property PRIORITY value
48 */
49 protected $priority = null;
50
51 /**
52 * Return formatted output for calendar component property priority
53 *
54 * @return string
55 */
56 public function createPriority()
57 {
58 if( empty( $this->priority )) {
59 return null;
60 }
61 if( ! isset( $this->priority[Util::$LCvalue] ) ||
62 ( empty( $this->priority[Util::$LCvalue] ) &&
63 ! is_numeric( $this->priority[Util::$LCvalue] ))) {
64 return $this->getConfig( self::ALLOWEMPTY )
65 ? StringFactory::createElement( self::PRIORITY )
66 : null;
67 }
68 return StringFactory::createElement(
69 self::PRIORITY,
70 ParameterFactory::createParams( $this->priority[Util::$LCparams] ),
71 $this->priority[Util::$LCvalue]
72 );
73 }
74
75 /**
76 * Delete calendar component property priority
77 *
78 * @return bool
79 * @since 2.27.1 - 2018-12-15
80 */
81 public function deletePriority()
82 {
83 $this->priority = null;
84 return true;
85 }
86
87 /**
88 * Get calendar component property priority
89 *
90 * @param bool $inclParam
91 * @return bool|array
92 * @since 2.27.1 - 2018-12-12
93 */
94 public function getPriority( $inclParam = false )
95 {
96 if( empty( $this->priority )) {
97 return false;
98 }
99 return ( $inclParam ) ? $this->priority : $this->priority[Util::$LCvalue];
100 }
101
102 /**
103 * Set calendar component property priority
104 *
105 * @param int $value
106 * @param array $params
107 * @return static
108 * @throws InvalidArgumentException
109 * @since 2.27.2 2019-01-03
110 */
111 public function setPriority( $value = null, $params = [] )
112 {
113 if( empty( $value ) && ( Util::$ZERO != $value )) {
114 $this->assertEmptyValue( $value, self::PRIORITY );
115 $value = Util::$SP0;
116 $params = [];
117
118 }
119 else {
120 Util::assertInteger( $value, self::PRIORITY, 0, 9 );
121 }
122 $this->priority = [
123 Util::$LCvalue => $value,
124 Util::$LCparams => ParameterFactory::setParams( $params ),
125 ];
126 return $this;
127 }
128 }
129