[Pkg-owncloud-commits] [php-sabre-vobject] 283/341: Fixing lots of CS issues.
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 13:35:57 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabre-vobject.
commit 37aded7bfb6ad5b7dd345e55a4caa8a978dae16b
Author: Evert Pot <me at evertpot.com>
Date: Tue Jun 23 12:47:01 2015 -0400
Fixing lots of CS issues.
---
lib/Cli.php | 126 +++++-----
lib/Component.php | 98 ++++----
lib/Component/Available.php | 43 ++--
lib/Component/VAlarm.php | 11 +-
lib/Component/VAvailability.php | 45 ++--
lib/Component/VCalendar.php | 74 +++---
lib/Component/VCard.php | 47 ++--
lib/Component/VEvent.php | 59 ++---
lib/Component/VFreeBusy.php | 28 +--
lib/Component/VJournal.php | 39 +--
lib/Component/VTimeZone.php | 5 +-
lib/Component/VTodo.php | 70 +++---
lib/DateTimeParser.php | 71 +++---
lib/Document.php | 43 ++--
lib/ElementList.php | 9 +-
lib/FreeBusyGenerator.php | 50 ++--
lib/ITip/Broker.php | 270 +++++++++++----------
lib/ITip/Message.php | 10 +-
.../SameOrganizerForAllComponentsException.php | 2 +-
lib/Node.php | 21 +-
lib/Parameter.php | 39 +--
lib/Parser/Json.php | 29 ++-
lib/Parser/MimeDir.php | 71 +++---
lib/Parser/Parser.php | 11 +-
lib/Parser/XML.php | 39 +--
lib/Parser/XML/Element/KeyValue.php | 1 +
lib/Property.php | 105 ++++----
lib/Property/Binary.php | 21 +-
lib/Property/Boolean.php | 10 +-
lib/Property/FlatText.php | 7 +-
lib/Property/Float.php | 20 +-
lib/Property/ICalendar/CalAddress.php | 6 +-
lib/Property/ICalendar/Date.php | 2 +-
lib/Property/ICalendar/DateTime.php | 46 ++--
lib/Property/ICalendar/Duration.php | 8 +-
lib/Property/ICalendar/Period.php | 16 +-
lib/Property/ICalendar/Recur.php | 30 ++-
lib/Property/Integer.php | 12 +-
lib/Property/Text.php | 90 +++----
lib/Property/Time.php | 19 +-
lib/Property/Unknown.php | 2 +-
lib/Property/Uri.php | 17 +-
lib/Property/UtcOffset.php | 5 +-
lib/Property/VCard/Date.php | 5 +-
lib/Property/VCard/DateAndOrTime.php | 45 ++--
lib/Property/VCard/DateTime.php | 2 +-
lib/Property/VCard/LanguageTag.php | 9 +-
lib/Property/VCard/TimeStamp.php | 12 +-
lib/Reader.php | 5 +-
lib/Recur/EventIterator.php | 24 +-
lib/Recur/RDateIterator.php | 11 +-
lib/Recur/RRuleIterator.php | 111 ++++-----
lib/Splitter/ICalendar.php | 21 +-
lib/Splitter/SplitterInterface.php | 8 +-
lib/Splitter/VCard.php | 19 +-
lib/StringUtil.php | 9 +-
lib/TimeZoneUtil.php | 25 +-
lib/UUIDUtil.php | 16 +-
lib/VCardConverter.php | 83 ++++---
lib/Version.php | 4 +-
lib/Writer.php | 5 +-
lib/timezonedata/exchangezones.php | 2 +-
lib/timezonedata/lotuszones.php | 2 +-
lib/timezonedata/php-bc.php | 3 +-
lib/timezonedata/php-workaround.php | 3 +-
lib/timezonedata/windowszones.php | 208 ++++++++--------
66 files changed, 1260 insertions(+), 1099 deletions(-)
diff --git a/lib/Cli.php b/lib/Cli.php
index cb8e9c9..8f9c9a8 100644
--- a/lib/Cli.php
+++ b/lib/Cli.php
@@ -15,14 +15,14 @@ use
class Cli {
/**
- * No output
+ * No output.
*
* @var bool
*/
protected $quiet = false;
/**
- * Help display
+ * Help display.
*
* @var bool
*/
@@ -36,49 +36,49 @@ class Cli {
protected $format;
/**
- * JSON pretty print
+ * JSON pretty print.
*
* @var bool
*/
protected $pretty;
/**
- * Source file
+ * Source file.
*
* @var string
*/
protected $inputPath;
/**
- * Destination file
+ * Destination file.
*
* @var string
*/
protected $outputPath;
/**
- * output stream
+ * output stream.
*
* @var resource
*/
protected $stdout;
/**
- * stdin
+ * stdin.
*
* @var resource
*/
protected $stdin;
/**
- * stderr
+ * stderr.
*
* @var resource
*/
protected $stderr;
/**
- * Input format (one of json or mimedir)
+ * Input format (one of json or mimedir).
*
* @var string
*/
@@ -92,7 +92,7 @@ class Cli {
protected $forgiving = false;
/**
- * Main function
+ * Main function.
*
* @return int
*/
@@ -123,9 +123,9 @@ class Cli {
}
$this->log($this->colorize('green', "sabre/vobject ") . $this->colorize('yellow', Version::VERSION));
- foreach($options as $name=>$value) {
+ foreach ($options as $name => $value) {
- switch($name) {
+ switch ($name) {
case 'q' :
// Already handled earlier.
@@ -136,7 +136,7 @@ class Cli {
return 0;
break;
case 'format' :
- switch($value) {
+ switch ($value) {
// jcard/jcal documents
case 'jcard' :
@@ -172,7 +172,7 @@ class Cli {
$this->forgiving = true;
break;
case 'inputformat' :
- switch($value) {
+ switch ($value) {
// json formats
case 'jcard' :
case 'jcal' :
@@ -217,7 +217,7 @@ class Cli {
throw new InvalidArgumentException('Too many arguments');
}
- if (!in_array($positional[0], ['validate','repair','convert','color'])) {
+ if (!in_array($positional[0], ['validate', 'repair', 'convert', 'color'])) {
throw new InvalidArgumentException('Uknown command: ' . $positional[0]);
}
@@ -230,21 +230,21 @@ class Cli {
$command = $positional[0];
$this->inputPath = $positional[1];
- $this->outputPath = isset($positional[2])?$positional[2]:'-';
+ $this->outputPath = isset($positional[2]) ? $positional[2] : '-';
if ($this->outputPath !== '-') {
$this->stdout = fopen($this->outputPath, 'w');
}
if (!$this->inputFormat) {
- if (substr($this->inputPath, -5)==='.json') {
+ if (substr($this->inputPath, -5) === '.json') {
$this->inputFormat = 'json';
} else {
$this->inputFormat = 'mimedir';
}
}
if (!$this->format) {
- if (substr($this->outputPath,-5)==='.json') {
+ if (substr($this->outputPath, -5) === '.json') {
$this->format = 'json';
} else {
$this->format = 'mimedir';
@@ -256,17 +256,17 @@ class Cli {
try {
- while($input = $this->readInput()) {
+ while ($input = $this->readInput()) {
$returnCode = $this->$command($input);
- if ($returnCode!==0) $realCode = $returnCode;
+ if ($returnCode !== 0) $realCode = $returnCode;
}
} catch (EofException $e) {
// end of file
} catch (\Exception $e) {
- $this->log('Error: ' . $e->getMessage(),'red');
+ $this->log('Error: ' . $e->getMessage(), 'red');
return 2;
}
@@ -318,21 +318,22 @@ HELP
$this->log(' vobject convert --inputformat=json --format=mimedir - -');
$this->log(' vobject color calendar.ics');
$this->log('');
- $this->log('https://github.com/fruux/sabre-vobject','purple');
+ $this->log('https://github.com/fruux/sabre-vobject', 'purple');
}
/**
- * Validates a VObject file
+ * Validates a VObject file.
*
* @param Component $vObj
+ *
* @return int
*/
protected function validate(Component $vObj) {
$returnCode = 0;
- switch($vObj->name) {
+ switch ($vObj->name) {
case 'VCALENDAR' :
$this->log("iCalendar: " . (string)$vObj->VERSION);
break;
@@ -352,7 +353,7 @@ HELP
3 => 'ERROR',
];
$returnCode = 2;
- foreach($warnings as $warn) {
+ foreach ($warnings as $warn) {
$extra = '';
if ($warn['node'] instanceof Property) {
@@ -369,16 +370,17 @@ HELP
}
/**
- * Repairs a VObject file
+ * Repairs a VObject file.
*
* @param Component $vObj
+ *
* @return int
*/
protected function repair(Component $vObj) {
$returnCode = 0;
- switch($vObj->name) {
+ switch ($vObj->name) {
case 'VCALENDAR' :
$this->log("iCalendar: " . (string)$vObj->VERSION);
break;
@@ -398,7 +400,7 @@ HELP
3 => 'ERROR',
];
$returnCode = 2;
- foreach($warnings as $warn) {
+ foreach ($warnings as $warn) {
$extra = '';
if ($warn['node'] instanceof Property) {
@@ -419,6 +421,7 @@ HELP
* Converts a vObject file to a new format.
*
* @param Component $vObj
+ *
* @return int
*/
protected function convert($vObj) {
@@ -427,7 +430,7 @@ HELP
$convertVersion = null;
$forceInput = null;
- switch($this->format) {
+ switch ($this->format) {
case 'json' :
$json = true;
if ($vObj->name === 'VCARD') {
@@ -481,9 +484,10 @@ HELP
}
/**
- * Colorizes a file
+ * Colorizes a file.
*
* @param Component $vObj
+ *
* @return int
*/
protected function color($vObj) {
@@ -496,6 +500,7 @@ HELP
* Returns an ansi color string for a color name.
*
* @param string $color
+ *
* @return string
*/
protected function colorize($color, $str, $resetTo = 'default') {
@@ -509,7 +514,7 @@ HELP
'default' => '0',
'purple' => '0;35',
];
- return "\033[" . $colors[$color] . 'm' . $str . "\033[".$colors[$resetTo]."m";
+ return "\033[" . $colors[$color] . 'm' . $str . "\033[" . $colors[$resetTo] . "m";
}
@@ -518,6 +523,7 @@ HELP
*
* @param string $color
* @param string $str
+ *
* @return void
*/
protected function cWrite($color, $str) {
@@ -544,6 +550,7 @@ HELP
*
* @param int $key
* @param array $array
+ *
* @return int
*/
$sortScore = function($key, $array) {
@@ -553,23 +560,23 @@ HELP
// We want to encode VTIMEZONE first, this is a personal
// preference.
if ($array[$key]->name === 'VTIMEZONE') {
- $score=300000000;
- return $score+$key;
+ $score = 300000000;
+ return $score + $key;
} else {
- $score=400000000;
- return $score+$key;
+ $score = 400000000;
+ return $score + $key;
}
} else {
// Properties get encoded first
// VCARD version 4.0 wants the VERSION property to appear first
if ($array[$key] instanceof Property) {
if ($array[$key]->name === 'VERSION') {
- $score=100000000;
- return $score+$key;
+ $score = 100000000;
+ return $score + $key;
} else {
// All other properties
- $score=200000000;
- return $score+$key;
+ $score = 200000000;
+ return $score + $key;
}
}
}
@@ -589,7 +596,7 @@ HELP
}
);
- foreach($vObj->children as $child) {
+ foreach ($vObj->children as $child) {
if ($child instanceof Component) {
$this->serializeComponent($child);
} else {
@@ -607,6 +614,7 @@ HELP
* Colorizes a property.
*
* @param Property $property
+ *
* @return void
*/
protected function serializeProperty(Property $property) {
@@ -618,13 +626,13 @@ HELP
$this->cWrite('yellow', $property->name);
- foreach($property->parameters as $param) {
+ foreach ($property->parameters as $param) {
- $this->cWrite('red',';');
+ $this->cWrite('red', ';');
$this->cWrite('blue', $param->serialize());
}
- $this->cWrite('red',':');
+ $this->cWrite('red', ':');
if ($property instanceof Property\Binary) {
@@ -635,7 +643,7 @@ HELP
$parts = $property->getParts();
$first1 = true;
// Looping through property values
- foreach($parts as $part) {
+ foreach ($parts as $part) {
if ($first1) {
$first1 = false;
} else {
@@ -643,7 +651,7 @@ HELP
}
$first2 = true;
// Looping through property sub-values
- foreach((array)$part as $subPart) {
+ foreach ((array)$part as $subPart) {
if ($first2) {
$first2 = false;
} else {
@@ -675,6 +683,7 @@ HELP
* Parses the list of arguments.
*
* @param array $argv
+ *
* @return void
*/
protected function parseArguments(array $argv) {
@@ -682,24 +691,24 @@ HELP
$positional = [];
$options = [];
- for($ii=0; $ii < count($argv); $ii++) {
+ for ($ii = 0; $ii < count($argv); $ii++) {
// Skipping the first argument.
- if ($ii===0) continue;
+ if ($ii === 0) continue;
$v = $argv[$ii];
- if (substr($v,0,2)==='--') {
+ if (substr($v, 0, 2) === '--') {
// This is a long-form option.
- $optionName = substr($v,2);
+ $optionName = substr($v, 2);
$optionValue = true;
- if (strpos($optionName,'=')) {
+ if (strpos($optionName, '=')) {
list($optionName, $optionValue) = explode('=', $optionName);
}
$options[$optionName] = $optionValue;
- } elseif (substr($v,0,1) === '-' && strlen($v)>1) {
+ } elseif (substr($v, 0, 1) === '-' && strlen($v) > 1) {
// This is a short-form option.
- foreach(str_split(substr($v,1)) as $option) {
+ foreach (str_split(substr($v, 1)) as $option) {
$options[$option] = true;
}
@@ -718,21 +727,21 @@ HELP
protected $parser;
/**
- * Reads the input file
+ * Reads the input file.
*
* @return Component
*/
protected function readInput() {
if (!$this->parser) {
- if ($this->inputPath!=='-') {
- $this->stdin = fopen($this->inputPath,'r');
+ if ($this->inputPath !== '-') {
+ $this->stdin = fopen($this->inputPath, 'r');
}
if ($this->inputFormat === 'mimedir') {
- $this->parser = new Parser\MimeDir($this->stdin, ($this->forgiving?Reader::OPTION_FORGIVING:0));
+ $this->parser = new Parser\MimeDir($this->stdin, ($this->forgiving ? Reader::OPTION_FORGIVING : 0));
} else {
- $this->parser = new Parser\Json($this->stdin, ($this->forgiving?Reader::OPTION_FORGIVING:0));
+ $this->parser = new Parser\Json($this->stdin, ($this->forgiving ? Reader::OPTION_FORGIVING : 0));
}
}
@@ -744,12 +753,13 @@ HELP
* Sends a message to STDERR.
*
* @param string $msg
+ *
* @return void
*/
protected function log($msg, $color = 'default') {
if (!$this->quiet) {
- if ($color!=='default') {
+ if ($color !== 'default') {
$msg = $this->colorize($color, $msg);
}
fwrite($this->stderr, $msg . "\n");
diff --git a/lib/Component.php b/lib/Component.php
index ee7b1af..4408cfd 100644
--- a/lib/Component.php
+++ b/lib/Component.php
@@ -5,7 +5,7 @@ namespace Sabre\VObject;
use Sabre\Xml;
/**
- * Component
+ * Component.
*
* A component represents a group of properties, such as VCALENDAR, VEVENT, or
* VCARD.
@@ -47,6 +47,7 @@ class Component extends Node {
* @param string $name such as VCALENDAR, VEVENT.
* @param array $children
* @param bool $defaults
+ *
* @return void
*/
function __construct(Document $root, $name, array $children = [], $defaults = true) {
@@ -61,7 +62,7 @@ class Component extends Node {
// natural way.
$list = $this->getDefaults();
$nodes = [];
- foreach ($children as $key=>$value) {
+ foreach ($children as $key => $value) {
if ($value instanceof Node) {
if (isset($list[$value->name])) {
unset($list[$value->name]);
@@ -71,14 +72,14 @@ class Component extends Node {
$list[$key] = $value;
}
}
- foreach ($list as $key=>$value) {
+ foreach ($list as $key => $value) {
$this->add($key, $value);
}
foreach ($nodes as $node) {
$this->add($node);
}
} else {
- foreach ($children as $k=>$child) {
+ foreach ($children as $k => $child) {
if ($child instanceof Node) {
// Component or Property
@@ -117,7 +118,7 @@ class Component extends Node {
return $a1;
- } elseif(is_string($a1)) {
+ } elseif (is_string($a1)) {
$item = $this->root->create($a1, $a2, $a3);
$item->parent = $this;
@@ -145,19 +146,20 @@ class Component extends Node {
* removed, only the last one will be returned.
*
* @param mixed $item
+ *
* @return void
*/
function remove($item) {
if (is_string($item)) {
$children = $this->select($item);
- foreach ($children as $k=>$child) {
+ foreach ($children as $k => $child) {
unset($this->children[$k]);
}
return $child;
} else {
foreach ($this->children as $k => $child) {
- if ($child===$item) {
+ if ($child === $item) {
unset($this->children[$k]);
return $child;
}
@@ -170,7 +172,7 @@ class Component extends Node {
}
/**
- * Returns an iterable list of children
+ * Returns an iterable list of children.
*
* @return array
*/
@@ -190,7 +192,7 @@ class Component extends Node {
$result = [];
foreach ($this->children as $child) {
- if ($child instanceof Component) {
+ if ($child instanceof self) {
$result[] = $child;
}
}
@@ -213,23 +215,24 @@ class Component extends Node {
* certain cases.
*
* @param string $name
+ *
* @return array
*/
function select($name) {
$group = null;
$name = strtoupper($name);
- if (strpos($name,'.')!==false) {
- list($group,$name) = explode('.', $name, 2);
+ if (strpos($name, '.') !== false) {
+ list($group, $name) = explode('.', $name, 2);
}
$result = [];
- foreach ($this->children as $key=>$child) {
+ foreach ($this->children as $key => $child) {
if (
(
strtoupper($child->name) === $name
- && (is_null($group) || ( $child instanceof Property && strtoupper($child->group) === $group))
+ && (is_null($group) || ($child instanceof Property && strtoupper($child->group) === $group))
)
||
(
@@ -268,6 +271,7 @@ class Component extends Node {
*
* @param int $key
* @param array $array
+ *
* @return int
*/
$sortScore = function($key, $array) {
@@ -277,23 +281,23 @@ class Component extends Node {
// We want to encode VTIMEZONE first, this is a personal
// preference.
if ($array[$key]->name === 'VTIMEZONE') {
- $score=300000000;
- return $score+$key;
+ $score = 300000000;
+ return $score + $key;
} else {
- $score=400000000;
- return $score+$key;
+ $score = 400000000;
+ return $score + $key;
}
} else {
// Properties get encoded first
// VCARD version 4.0 wants the VERSION property to appear first
if ($array[$key] instanceof Property) {
if ($array[$key]->name === 'VERSION') {
- $score=100000000;
- return $score+$key;
+ $score = 100000000;
+ return $score + $key;
} else {
// All other properties
- $score=200000000;
- return $score+$key;
+ $score = 200000000;
+ return $score + $key;
}
}
}
@@ -313,8 +317,8 @@ class Component extends Node {
}
);
- foreach ($this->children as $child) $str.=$child->serialize();
- $str.= "END:" . $this->name . "\r\n";
+ foreach ($this->children as $child) $str .= $child->serialize();
+ $str .= "END:" . $this->name . "\r\n";
return $str;
@@ -332,7 +336,7 @@ class Component extends Node {
$properties = [];
foreach ($this->children as $child) {
- if ($child instanceof Component) {
+ if ($child instanceof self) {
$components[] = $child->jsonSerialize();
} else {
$properties[] = $child->jsonSerialize();
@@ -352,6 +356,7 @@ class Component extends Node {
* xCal documents.
*
* @param Xml\Writer $writer XML writer.
+ *
* @return void
*/
function xmlSerialize(Xml\Writer $writer) {
@@ -360,7 +365,7 @@ class Component extends Node {
$properties = [];
foreach ($this->children as $child) {
- if ($child instanceof Component) {
+ if ($child instanceof self) {
$components[] = $child;
} else {
$properties[] = $child;
@@ -420,13 +425,14 @@ class Component extends Node {
* $event = $calendar->VEVENT;
*
* @param string $name
+ *
* @return Property
*/
function __get($name) {
$matches = $this->select($name);
- if (count($matches)===0) {
- return null;
+ if (count($matches) === 0) {
+ return;
} else {
$firstMatch = current($matches);
/** @var $firstMatch Property */
@@ -440,17 +446,18 @@ class Component extends Node {
* This method checks if a sub-element with the specified name exists.
*
* @param string $name
+ *
* @return bool
*/
function __isset($name) {
$matches = $this->select($name);
- return count($matches)>0;
+ return count($matches) > 0;
}
/**
- * Using the setter method you can add properties or subcomponents
+ * Using the setter method you can add properties or subcomponents.
*
* You can either pass a Component, Property
* object, or a string to automatically create a Property.
@@ -460,14 +467,15 @@ class Component extends Node {
*
* @param string $name
* @param mixed $value
+ *
* @return void
*/
function __set($name, $value) {
$matches = $this->select($name);
- $overWrite = count($matches)?key($matches):null;
+ $overWrite = count($matches) ? key($matches) : null;
- if ($value instanceof Component || $value instanceof Property) {
+ if ($value instanceof self || $value instanceof Property) {
$value->parent = $this;
if (!is_null($overWrite)) {
$this->children[$overWrite] = $value;
@@ -475,7 +483,7 @@ class Component extends Node {
$this->children[] = $value;
}
} else {
- $property = $this->root->create($name,$value);
+ $property = $this->root->create($name, $value);
$property->parent = $this;
if (!is_null($overWrite)) {
$this->children[$overWrite] = $property;
@@ -490,12 +498,13 @@ class Component extends Node {
* specified name.
*
* @param string $name
+ *
* @return void
*/
function __unset($name) {
$matches = $this->select($name);
- foreach ($matches as $k=>$child) {
+ foreach ($matches as $k => $child) {
unset($this->children[$k]);
$child->parent = null;
@@ -514,7 +523,7 @@ class Component extends Node {
*/
function __clone() {
- foreach ($this->children as $key=>$child) {
+ foreach ($this->children as $key => $child) {
$this->children[$key] = clone $child;
$this->children[$key]->parent = $this;
}
@@ -569,6 +578,7 @@ class Component extends Node {
* 3 - An error.
*
* @param int $options
+ *
* @return array
*/
function validate($options = 0) {
@@ -592,35 +602,35 @@ class Component extends Node {
foreach ($rules as $propName => $rule) {
- switch($rule) {
+ switch ($rule) {
case '0' :
if (isset($propertyCounters[$propName])) {
$messages[] = [
- 'level' => 3,
+ 'level' => 3,
'message' => $propName . ' MUST NOT appear in a ' . $this->name . ' component',
- 'node' => $this,
+ 'node' => $this,
];
}
break;
case '1' :
- if (!isset($propertyCounters[$propName]) || $propertyCounters[$propName]!==1) {
+ if (!isset($propertyCounters[$propName]) || $propertyCounters[$propName] !== 1) {
$repaired = false;
if ($options & self::REPAIR && isset($defaults[$propName])) {
$this->add($propName, $defaults[$propName]);
}
$messages[] = [
- 'level' => $repaired?1:3,
+ 'level' => $repaired ? 1 : 3,
'message' => $propName . ' MUST appear exactly once in a ' . $this->name . ' component',
- 'node' => $this,
+ 'node' => $this,
];
}
break;
case '+' :
if (!isset($propertyCounters[$propName]) || $propertyCounters[$propName] < 1) {
$messages[] = [
- 'level' => 3,
+ 'level' => 3,
'message' => $propName . ' MUST appear at least once in a ' . $this->name . ' component',
- 'node' => $this,
+ 'node' => $this,
];
}
break;
@@ -629,9 +639,9 @@ class Component extends Node {
case '?' :
if (isset($propertyCounters[$propName]) && $propertyCounters[$propName] > 1) {
$messages[] = [
- 'level' => 3,
+ 'level' => 3,
'message' => $propName . ' MUST NOT appear more than once in a ' . $this->name . ' component',
- 'node' => $this,
+ 'node' => $this,
];
}
break;
diff --git a/lib/Component/Available.php b/lib/Component/Available.php
index b616fd7..832c737 100644
--- a/lib/Component/Available.php
+++ b/lib/Component/Available.php
@@ -5,7 +5,7 @@ namespace Sabre\VObject\Component;
use Sabre\VObject;
/**
- * The Available sub-component
+ * The Available sub-component.
*
* This component adds functionality to a component, specific for AVAILABLE
* components.
@@ -33,29 +33,29 @@ class Available extends VObject\Component {
*/
function getValidationRules() {
- return array(
- 'UID' => 1,
+ return [
+ 'UID' => 1,
'DTSTART' => 1,
'DTSTAMP' => 1,
- 'DTEND' => '?',
+ 'DTEND' => '?',
'DURATION' => '?',
- 'CREATED' => '?',
- 'DESCRIPTION' => '?',
+ 'CREATED' => '?',
+ 'DESCRIPTION' => '?',
'LAST-MODIFIED' => '?',
'RECURRENCE-ID' => '?',
- 'RRULE' => '?',
- 'SUMMARY' => '?',
+ 'RRULE' => '?',
+ 'SUMMARY' => '?',
'CATEGORIES' => '*',
- 'COMMENT' => '*',
- 'CONTACT' => '*',
- 'EXDATE' => '*',
- 'RDATE' => '*',
+ 'COMMENT' => '*',
+ 'CONTACT' => '*',
+ 'EXDATE' => '*',
+ 'RDATE' => '*',
'AVAILABLE' => '*',
- );
+ ];
}
@@ -80,6 +80,7 @@ class Available extends VObject\Component {
* 3 - An error.
*
* @param int $options
+ *
* @return array
*/
function validate($options = 0) {
@@ -87,19 +88,19 @@ class Available extends VObject\Component {
$result = parent::validate($options);
if (isset($this->DTEND) && isset($this->DURATION)) {
- $result[] = array(
- 'level' => 3,
+ $result[] = [
+ 'level' => 3,
'message' => 'DTEND and DURATION cannot both be present',
- 'node' => $this
- );
+ 'node' => $this
+ ];
}
if (isset($this->DURATION) && !isset($this->DTSTART)) {
- $result[] = array(
- 'level' => 3,
+ $result[] = [
+ 'level' => 3,
'message' => 'DURATION must be declared with a DTSTART.',
- 'node' => $this
- );
+ 'node' => $this
+ ];
}
return $result;
diff --git a/lib/Component/VAlarm.php b/lib/Component/VAlarm.php
index 4024373..5fd134f 100644
--- a/lib/Component/VAlarm.php
+++ b/lib/Component/VAlarm.php
@@ -7,7 +7,7 @@ use DateTimeInterface;
use DateTimeImmutable;
/**
- * VAlarm component
+ * VAlarm component.
*
* This component contains some additional functionality specific for VALARMs.
*
@@ -27,7 +27,7 @@ class VAlarm extends VObject\Component {
function getEffectiveTriggerTime() {
$trigger = $this->TRIGGER;
- if(!isset($trigger['VALUE']) || strtoupper($trigger['VALUE']) === 'DURATION') {
+ if (!isset($trigger['VALUE']) || strtoupper($trigger['VALUE']) === 'DURATION') {
$triggerDuration = VObject\DateTimeParser::parseDuration($this->TRIGGER);
$related = (isset($trigger['RELATED']) && strtoupper($trigger['RELATED']) == 'END') ? 'END' : 'START';
@@ -80,6 +80,7 @@ class VAlarm extends VObject\Component {
*
* @param DateTime $start
* @param DateTime $end
+ *
* @return bool
*/
function isInTimeRange(DateTimeInterface $start, DateTimeInterface $end) {
@@ -95,7 +96,7 @@ class VAlarm extends VObject\Component {
$period = new \DatePeriod($effectiveTrigger, $duration, (int)$repeat);
- foreach($period as $occurrence) {
+ foreach ($period as $occurrence) {
if ($start <= $occurrence && $end > $occurrence) {
return true;
@@ -126,11 +127,11 @@ class VAlarm extends VObject\Component {
function getValidationRules() {
return [
- 'ACTION' => 1,
+ 'ACTION' => 1,
'TRIGGER' => 1,
'DURATION' => '?',
- 'REPEAT' => '?',
+ 'REPEAT' => '?',
'ATTACH' => '?',
];
diff --git a/lib/Component/VAvailability.php b/lib/Component/VAvailability.php
index ab9ba28..4f9aa24 100644
--- a/lib/Component/VAvailability.php
+++ b/lib/Component/VAvailability.php
@@ -5,7 +5,7 @@ namespace Sabre\VObject\Component;
use Sabre\VObject;
/**
- * The VAvailability component
+ * The VAvailability component.
*
* This component adds functionality to a component, specific for VAVAILABILITY
* components.
@@ -33,28 +33,28 @@ class VAvailability extends VObject\Component {
*/
function getValidationRules() {
- return array(
- 'UID' => 1,
+ return [
+ 'UID' => 1,
'DTSTAMP' => 1,
- 'BUSYTYPE' => '?',
- 'CLASS' => '?',
- 'CREATED' => '?',
- 'DESCRIPTION' => '?',
- 'DTSTART' => '?',
+ 'BUSYTYPE' => '?',
+ 'CLASS' => '?',
+ 'CREATED' => '?',
+ 'DESCRIPTION' => '?',
+ 'DTSTART' => '?',
'LAST-MODIFIED' => '?',
- 'ORGANIZER' => '?',
- 'PRIORITY' => '?',
- 'SEQUENCE' => '?',
- 'SUMMARY' => '?',
- 'URL' => '?',
- 'DTEND' => '?',
- 'DURATION' => '?',
+ 'ORGANIZER' => '?',
+ 'PRIORITY' => '?',
+ 'SEQUENCE' => '?',
+ 'SUMMARY' => '?',
+ 'URL' => '?',
+ 'DTEND' => '?',
+ 'DURATION' => '?',
'CATEGORIES' => '*',
- 'COMMENT' => '*',
- 'CONTACT' => '*',
- );
+ 'COMMENT' => '*',
+ 'CONTACT' => '*',
+ ];
}
@@ -79,6 +79,7 @@ class VAvailability extends VObject\Component {
* 3 - An error.
*
* @param int $options
+ *
* @return array
*/
function validate($options = 0) {
@@ -86,11 +87,11 @@ class VAvailability extends VObject\Component {
$result = parent::validate($options);
if (isset($this->DTEND) && isset($this->DURATION)) {
- $result[] = array(
- 'level' => 3,
+ $result[] = [
+ 'level' => 3,
'message' => 'DTEND and DURATION cannot both be present',
- 'node' => $this
- );
+ 'node' => $this
+ ];
}
return $result;
diff --git a/lib/Component/VCalendar.php b/lib/Component/VCalendar.php
index 3d7e801..efdd316 100644
--- a/lib/Component/VCalendar.php
+++ b/lib/Component/VCalendar.php
@@ -10,7 +10,7 @@ use Sabre\VObject\Recur\EventIterator;
use Sabre\VObject\Recur\NoInstancesException;
/**
- * The VCalendar component
+ * The VCalendar component.
*
* This component adds functionality to a component, specific for a VCALENDAR.
*
@@ -169,12 +169,13 @@ class VCalendar extends VObject\Document {
* VTIMEZONE components will always be excluded.
*
* @param string $componentName filter by component name
+ *
* @return VObject\Component[]
*/
function getBaseComponents($componentName = null) {
$components = [];
- foreach($this->children as $component) {
+ foreach ($this->children as $component) {
if (!$component instanceof VObject\Component)
continue;
@@ -203,11 +204,12 @@ class VCalendar extends VObject\Document {
* If there is no such component, null will be returned.
*
* @param string $componentName filter by component name
+ *
* @return VObject\Component|null
*/
function getBaseComponent($componentName = null) {
- foreach($this->children as $component) {
+ foreach ($this->children as $component) {
if (!$component instanceof VObject\Component)
continue;
@@ -248,6 +250,7 @@ class VCalendar extends VObject\Document {
* @param DateTimeInterface $end
* @param DateTimeZone $timeZone reference timezone for floating dates and
* times.
+ *
* @return void
*/
function expand(DateTimeInterface $start, DateTimeInterface $end, DateTimeZone $timeZone = null) {
@@ -262,7 +265,7 @@ class VCalendar extends VObject\Document {
// array is a list of one or more events that match the UID.
$recurringEvents = [];
- foreach($this->select('VEVENT') as $key=>$vevent) {
+ foreach ($this->select('VEVENT') as $key => $vevent) {
$uid = (string)$vevent->UID;
if (!$uid) {
@@ -287,7 +290,7 @@ class VCalendar extends VObject\Document {
}
- foreach($recurringEvents as $events) {
+ foreach ($recurringEvents as $events) {
try {
$it = new EventIterator($events, $timeZone);
@@ -300,7 +303,7 @@ class VCalendar extends VObject\Document {
}
$it->fastForward($start);
- while($it->valid() && $it->getDTStart() < $end) {
+ while ($it->valid() && $it->getDTStart() < $end) {
if ($it->getDTEnd() > $start) {
@@ -317,9 +320,9 @@ class VCalendar extends VObject\Document {
unset($this->VEVENT);
// Setting all properties to UTC time.
- foreach($newEvents as $newEvent) {
+ foreach ($newEvents as $newEvent) {
- foreach($newEvent->children as $child) {
+ foreach ($newEvent->children as $child) {
if ($child instanceof VObject\Property\ICalendar\DateTime && $child->hasTime()) {
$dt = $child->getDateTimes($timeZone);
// We only need to update the first timezone, because
@@ -346,8 +349,8 @@ class VCalendar extends VObject\Document {
protected function getDefaults() {
return [
- 'VERSION' => '2.0',
- 'PRODID' => '-//Sabre//Sabre VObject ' . VObject\Version::VERSION . '//EN',
+ 'VERSION' => '2.0',
+ 'PRODID' => '-//Sabre//Sabre VObject ' . VObject\Version::VERSION . '//EN',
'CALSCALE' => 'GREGORIAN',
];
@@ -371,11 +374,11 @@ class VCalendar extends VObject\Document {
function getValidationRules() {
return [
- 'PRODID' => 1,
+ 'PRODID' => 1,
'VERSION' => 1,
'CALSCALE' => '?',
- 'METHOD' => '?',
+ 'METHOD' => '?',
];
}
@@ -401,6 +404,7 @@ class VCalendar extends VObject\Document {
* 3 - An error.
*
* @param int $options
+ *
* @return array
*/
function validate($options = 0) {
@@ -410,9 +414,9 @@ class VCalendar extends VObject\Document {
if ($ver = $this->VERSION) {
if ((string)$ver !== '2.0') {
$warnings[] = [
- 'level' => 3,
+ 'level' => 3,
'message' => 'Only iCalendar version 2.0 as defined in rfc5545 is supported.',
- 'node' => $this,
+ 'node' => $this,
];
}
@@ -422,8 +426,8 @@ class VCalendar extends VObject\Document {
$componentsFound = 0;
$componentTypes = [];
- foreach($this->children as $child) {
- if($child instanceof Component) {
+ foreach ($this->children as $child) {
+ if ($child instanceof Component) {
$componentsFound++;
if (!in_array($child->name, ['VEVENT', 'VTODO', 'VJOURNAL'])) {
@@ -432,20 +436,20 @@ class VCalendar extends VObject\Document {
$componentTypes[] = $child->name;
$uid = (string)$child->UID;
- $isMaster = isset($child->{'RECURRENCE-ID'})?0:1;
+ $isMaster = isset($child->{'RECURRENCE-ID'}) ? 0 : 1;
if (isset($uidList[$uid])) {
$uidList[$uid]['count']++;
if ($isMaster && $uidList[$uid]['hasMaster']) {
$warnings[] = [
- 'level' => 3,
+ 'level' => 3,
'message' => 'More than one master object was found for the object with UID ' . $uid,
- 'node' => $this,
+ 'node' => $this,
];
}
- $uidList[$uid]['hasMaster']+=$isMaster;
+ $uidList[$uid]['hasMaster'] += $isMaster;
} else {
$uidList[$uid] = [
- 'count' => 1,
+ 'count' => 1,
'hasMaster' => $isMaster,
];
}
@@ -453,42 +457,42 @@ class VCalendar extends VObject\Document {
}
}
- if ($componentsFound===0) {
+ if ($componentsFound === 0) {
$warnings[] = [
- 'level' => 3,
+ 'level' => 3,
'message' => 'An iCalendar object must have at least 1 component.',
- 'node' => $this,
+ 'node' => $this,
];
}
if ($options & self::PROFILE_CALDAV) {
- if (count($uidList)>1) {
+ if (count($uidList) > 1) {
$warnings[] = [
- 'level' => 3,
+ 'level' => 3,
'message' => 'A calendar object on a CalDAV server may only have components with the same UID.',
- 'node' => $this,
+ 'node' => $this,
];
}
- if (count(array_unique($componentTypes))===0) {
+ if (count(array_unique($componentTypes)) === 0) {
$warnings[] = [
- 'level' => 3,
+ 'level' => 3,
'message' => 'A calendar object on a CalDAV server must have at least 1 component (VTODO, VEVENT, VJOURNAL).',
- 'node' => $this,
+ 'node' => $this,
];
}
- if (count(array_unique($componentTypes))>1) {
+ if (count(array_unique($componentTypes)) > 1) {
$warnings[] = [
- 'level' => 3,
+ 'level' => 3,
'message' => 'A calendar object on a CalDAV server may only have 1 type of component (VEVENT, VTODO or VJOURNAL).',
- 'node' => $this,
+ 'node' => $this,
];
}
if (isset($this->METHOD)) {
$warnings[] = [
- 'level' => 3,
+ 'level' => 3,
'message' => 'A calendar object on a CalDAV server MUST NOT have a METHOD property.',
- 'node' => $this,
+ 'node' => $this,
];
}
}
diff --git a/lib/Component/VCard.php b/lib/Component/VCard.php
index 8379718..4f6a262 100644
--- a/lib/Component/VCard.php
+++ b/lib/Component/VCard.php
@@ -2,12 +2,11 @@
namespace Sabre\VObject\Component;
-use
- Sabre\VObject,
- Sabre\Xml;
+use Sabre\VObject;
+use Sabre\Xml;
/**
- * The VCard component
+ * The VCard component.
*
* This component represents the BEGIN:VCARD and END:VCARD found in every
* vcard.
@@ -28,7 +27,7 @@ class VCard extends VObject\Document {
static $defaultName = 'VCARD';
/**
- * Caching the version number
+ * Caching the version number.
*
* @var int
*/
@@ -142,7 +141,7 @@ class VCard extends VObject\Document {
$version = (string)$this->VERSION;
- switch($version) {
+ switch ($version) {
case '2.1' :
$this->version = self::VCARD21;
break;
@@ -173,6 +172,7 @@ class VCard extends VObject\Document {
* If input and output version are identical, a clone is returned.
*
* @param int $target
+ *
* @return VCard
*/
function convert($target) {
@@ -208,6 +208,7 @@ class VCard extends VObject\Document {
* 3 - A severe issue.
*
* @param int $options
+ *
* @return array
*/
function validate($options = 0) {
@@ -221,13 +222,13 @@ class VCard extends VObject\Document {
];
$version = $this->select('VERSION');
- if (count($version)===1) {
+ if (count($version) === 1) {
$version = (string)$this->VERSION;
- if ($version!=='2.1' && $version!=='3.0' && $version!=='4.0') {
+ if ($version !== '2.1' && $version !== '3.0' && $version !== '4.0') {
$warnings[] = [
- 'level' => 3,
+ 'level' => 3,
'message' => 'Only vcard version 4.0 (RFC6350), version 3.0 (RFC2426) or version 2.1 (icm-vcard-2.1) are supported.',
- 'node' => $this,
+ 'node' => $this,
];
if ($options & self::REPAIR) {
$this->VERSION = $versionMap[self::DEFAULT_VERSION];
@@ -235,9 +236,9 @@ class VCard extends VObject\Document {
}
if ($version === '2.1' && ($options & self::PROFILE_CARDDAV)) {
$warnings[] = [
- 'level' => 3,
+ 'level' => 3,
'message' => 'CardDAV servers are not allowed to accept vCard 2.1.',
- 'node' => $this,
+ 'node' => $this,
];
}
@@ -258,14 +259,14 @@ class VCard extends VObject\Document {
$warningLevel = 1;
}
$warnings[] = [
- 'level' => $warningLevel,
+ 'level' => $warningLevel,
'message' => $message,
- 'node' => $this,
+ 'node' => $this,
];
}
$fn = $this->select('FN');
- if (count($fn)!==1) {
+ if (count($fn) !== 1) {
$repaired = false;
if (($options & self::REPAIR) && count($fn) === 0) {
@@ -288,9 +289,9 @@ class VCard extends VObject\Document {
}
$warnings[] = [
- 'level' => $repaired?1:3,
+ 'level' => $repaired ? 1 : 3,
'message' => 'The FN property must appear in the VCARD component exactly 1 time',
- 'node' => $this,
+ 'node' => $this,
];
}
@@ -373,13 +374,14 @@ class VCard extends VObject\Document {
* a field with that name does not exist, null is returned.
*
* @param string $fieldName
+ *
* @return VObject\Property|null
*/
function preferred($propertyName) {
$preferred = null;
$lastPref = 101;
- foreach($this->select($propertyName) as $field) {
+ foreach ($this->select($propertyName) as $field) {
$pref = 101;
if (isset($field['TYPE']) && $field['TYPE']->has('PREF')) {
@@ -407,7 +409,7 @@ class VCard extends VObject\Document {
return [
'VERSION' => '3.0',
- 'PRODID' => '-//Sabre//Sabre VObject ' . VObject\Version::VERSION . '//EN',
+ 'PRODID' => '-//Sabre//Sabre VObject ' . VObject\Version::VERSION . '//EN',
];
}
@@ -424,7 +426,7 @@ class VCard extends VObject\Document {
// method to remove that array element.
$properties = [];
- foreach($this->children as $child) {
+ foreach ($this->children as $child) {
$properties[] = $child->jsonSerialize();
}
@@ -440,6 +442,7 @@ class VCard extends VObject\Document {
* xCal documents.
*
* @param Xml\Writer $writer XML writer.
+ *
* @return void
*/
function xmlSerialize(Xml\Writer $writer) {
@@ -502,6 +505,7 @@ class VCard extends VObject\Document {
* Returns the default class for a property name.
*
* @param string $propertyName
+ *
* @return string
*/
function getClassNameForPropertyName($propertyName) {
@@ -509,7 +513,7 @@ class VCard extends VObject\Document {
$className = parent::getClassNameForPropertyName($propertyName);
// In vCard 4, BINARY no longer exists, and we need URI instead.
- if ($className == 'Sabre\\VObject\\Property\\Binary' && $this->getDocumentType()===self::VCARD40) {
+ if ($className == 'Sabre\\VObject\\Property\\Binary' && $this->getDocumentType() === self::VCARD40) {
return 'Sabre\\VObject\\Property\\Uri';
}
return $className;
@@ -517,4 +521,3 @@ class VCard extends VObject\Document {
}
}
-
diff --git a/lib/Component/VEvent.php b/lib/Component/VEvent.php
index bc3750d..8353184 100644
--- a/lib/Component/VEvent.php
+++ b/lib/Component/VEvent.php
@@ -7,7 +7,7 @@ use Sabre\VObject;
use Sabre\VObject\Recur\EventIterator;
/**
- * VEvent component
+ * VEvent component.
*
* This component contains some additional functionality specific for VEVENT's.
*
@@ -26,6 +26,7 @@ class VEvent extends VObject\Component {
*
* @param DateTimeInterface $start
* @param DateTimeInterface $end
+ *
* @return bool
*/
function isInTimeRange(DateTimeInterface $start, DateTimeInterface $end) {
@@ -101,37 +102,37 @@ class VEvent extends VObject\Component {
$hasMethod = isset($this->parent->METHOD);
return [
- 'UID' => 1,
- 'DTSTAMP' => 1,
- 'DTSTART' => $hasMethod?'?':'1',
- 'CLASS' => '?',
- 'CREATED' => '?',
- 'DESCRIPTION' => '?',
- 'GEO' => '?',
+ 'UID' => 1,
+ 'DTSTAMP' => 1,
+ 'DTSTART' => $hasMethod ? '?' : '1',
+ 'CLASS' => '?',
+ 'CREATED' => '?',
+ 'DESCRIPTION' => '?',
+ 'GEO' => '?',
'LAST-MODIFIED' => '?',
- 'LOCATION' => '?',
- 'ORGANIZER' => '?',
- 'PRIORITY' => '?',
- 'SEQUENCE' => '?',
- 'STATUS' => '?',
- 'SUMMARY' => '?',
- 'TRANSP' => '?',
- 'URL' => '?',
+ 'LOCATION' => '?',
+ 'ORGANIZER' => '?',
+ 'PRIORITY' => '?',
+ 'SEQUENCE' => '?',
+ 'STATUS' => '?',
+ 'SUMMARY' => '?',
+ 'TRANSP' => '?',
+ 'URL' => '?',
'RECURRENCE-ID' => '?',
- 'RRULE' => '?',
- 'DTEND' => '?',
- 'DURATION' => '?',
-
- 'ATTACH' => '*',
- 'ATTENDEE' => '*',
- 'CATEGORIES' => '*',
- 'COMMENT' => '*',
- 'CONTACT' => '*',
- 'EXDATE' => '*',
+ 'RRULE' => '?',
+ 'DTEND' => '?',
+ 'DURATION' => '?',
+
+ 'ATTACH' => '*',
+ 'ATTENDEE' => '*',
+ 'CATEGORIES' => '*',
+ 'COMMENT' => '*',
+ 'CONTACT' => '*',
+ 'EXDATE' => '*',
'REQUEST-STATUS' => '*',
- 'RELATED-TO' => '*',
- 'RESOURCES' => '*',
- 'RDATE' => '*',
+ 'RELATED-TO' => '*',
+ 'RESOURCES' => '*',
+ 'RDATE' => '*',
];
}
diff --git a/lib/Component/VFreeBusy.php b/lib/Component/VFreeBusy.php
index 6167f38..5fc3da1 100644
--- a/lib/Component/VFreeBusy.php
+++ b/lib/Component/VFreeBusy.php
@@ -6,7 +6,7 @@ use DateTimeInterface;
use Sabre\VObject;
/**
- * The VFreeBusy component
+ * The VFreeBusy component.
*
* This component adds functionality to a component, specific for VFREEBUSY
* components.
@@ -23,15 +23,16 @@ class VFreeBusy extends VObject\Component {
*
* @param DateTimeInterface $start
* @param DateTimeInterface $end
+ *
* @return bool
*/
function isFree(DateTimeInterface $start, DatetimeInterface $end) {
- foreach($this->select('FREEBUSY') as $freebusy) {
+ foreach ($this->select('FREEBUSY') as $freebusy) {
// We are only interested in FBTYPE=BUSY (the default),
// FBTYPE=BUSY-TENTATIVE or FBTYPE=BUSY-UNAVAILABLE.
- if (isset($freebusy['FBTYPE']) && strtoupper(substr((string)$freebusy['FBTYPE'],0,4))!=='BUSY') {
+ if (isset($freebusy['FBTYPE']) && strtoupper(substr((string)$freebusy['FBTYPE'], 0, 4)) !== 'BUSY') {
continue;
}
@@ -39,7 +40,7 @@ class VFreeBusy extends VObject\Component {
// commas.
$periods = explode(',', (string)$freebusy);
- foreach($periods as $period) {
+ foreach ($periods as $period) {
// Every period is formatted as [start]/[end]. The start is an
// absolute UTC time, the end may be an absolute UTC time, or
// duration (relative) value.
@@ -51,7 +52,7 @@ class VFreeBusy extends VObject\Component {
$busyEnd = $busyStart->add($busyEnd);
}
- if($start < $busyEnd && $end > $busyStart) {
+ if ($start < $busyEnd && $end > $busyStart) {
return false;
}
@@ -81,22 +82,21 @@ class VFreeBusy extends VObject\Component {
function getValidationRules() {
return [
- 'UID' => 1,
+ 'UID' => 1,
'DTSTAMP' => 1,
- 'CONTACT' => '?',
- 'DTSTART' => '?',
- 'DTEND' => '?',
+ 'CONTACT' => '?',
+ 'DTSTART' => '?',
+ 'DTEND' => '?',
'ORGANIZER' => '?',
- 'URL' => '?',
+ 'URL' => '?',
- 'ATTENDEE' => '*',
- 'COMMENT' => '*',
- 'FREEBUSY' => '*',
+ 'ATTENDEE' => '*',
+ 'COMMENT' => '*',
+ 'FREEBUSY' => '*',
'REQUEST-STATUS' => '*',
];
}
}
-
diff --git a/lib/Component/VJournal.php b/lib/Component/VJournal.php
index 492fdc7..abea2a7 100644
--- a/lib/Component/VJournal.php
+++ b/lib/Component/VJournal.php
@@ -6,7 +6,7 @@ use DateTimeInterface;
use Sabre\VObject;
/**
- * VJournal component
+ * VJournal component.
*
* This component contains some additional functionality specific for VJOURNALs.
*
@@ -25,11 +25,12 @@ class VJournal extends VObject\Component {
*
* @param DateTimeInterface $start
* @param DateTimeInterface $end
+ *
* @return bool
*/
function isInTimeRange(DateTimeInterface $start, DateTimeInterface $end) {
- $dtstart = isset($this->DTSTART)?$this->DTSTART->getDateTime():null;
+ $dtstart = isset($this->DTSTART) ? $this->DTSTART->getDateTime() : null;
if ($dtstart) {
$effectiveEnd = $dtstart;
if (!$this->DTSTART->hasTime()) {
@@ -61,31 +62,31 @@ class VJournal extends VObject\Component {
function getValidationRules() {
return [
- 'UID' => 1,
+ 'UID' => 1,
'DTSTAMP' => 1,
- 'CLASS' => '?',
- 'CREATED' => '?',
- 'DTSTART' => '?',
+ 'CLASS' => '?',
+ 'CREATED' => '?',
+ 'DTSTART' => '?',
'LAST-MODIFIED' => '?',
- 'ORGANIZER' => '?',
+ 'ORGANIZER' => '?',
'RECURRENCE-ID' => '?',
- 'SEQUENCE' => '?',
- 'STATUS' => '?',
- 'SUMMARY' => '?',
- 'URL' => '?',
+ 'SEQUENCE' => '?',
+ 'STATUS' => '?',
+ 'SUMMARY' => '?',
+ 'URL' => '?',
'RRULE' => '?',
- 'ATTACH' => '*',
- 'ATTENDEE' => '*',
- 'CATEGORIES' => '*',
- 'COMMENT' => '*',
- 'CONTACT' => '*',
+ 'ATTACH' => '*',
+ 'ATTENDEE' => '*',
+ 'CATEGORIES' => '*',
+ 'COMMENT' => '*',
+ 'CONTACT' => '*',
'DESCRIPTION' => '*',
- 'EXDATE' => '*',
- 'RELATED-TO' => '*',
- 'RDATE' => '*',
+ 'EXDATE' => '*',
+ 'RELATED-TO' => '*',
+ 'RDATE' => '*',
];
}
diff --git a/lib/Component/VTimeZone.php b/lib/Component/VTimeZone.php
index bcd12b8..54367e4 100644
--- a/lib/Component/VTimeZone.php
+++ b/lib/Component/VTimeZone.php
@@ -5,7 +5,7 @@ namespace Sabre\VObject\Component;
use Sabre\VObject;
/**
- * The VTimeZone component
+ * The VTimeZone component.
*
* This component adds functionality to a component, specific for VTIMEZONE
* components.
@@ -51,7 +51,7 @@ class VTimeZone extends VObject\Component {
'TZID' => 1,
'LAST-MODIFIED' => '?',
- 'TZURL' => '?',
+ 'TZURL' => '?',
// At least 1 STANDARD or DAYLIGHT must appear, or more. But both
// cannot appear in the same VTIMEZONE.
@@ -65,4 +65,3 @@ class VTimeZone extends VObject\Component {
}
}
-
diff --git a/lib/Component/VTodo.php b/lib/Component/VTodo.php
index 00ae936..9a44caf 100644
--- a/lib/Component/VTodo.php
+++ b/lib/Component/VTodo.php
@@ -6,7 +6,7 @@ use DateTimeInterface;
use Sabre\VObject;
/**
- * VTodo component
+ * VTodo component.
*
* This component contains some additional functionality specific for VTODOs.
*
@@ -25,15 +25,16 @@ class VTodo extends VObject\Component {
*
* @param DateTimeInterface $start
* @param DateTimeInterface $end
+ *
* @return bool
*/
function isInTimeRange(DateTimeInterface $start, DateTimeInterface $end) {
- $dtstart = isset($this->DTSTART)?$this->DTSTART->getDateTime():null;
- $duration = isset($this->DURATION)?VObject\DateTimeParser::parseDuration($this->DURATION):null;
- $due = isset($this->DUE)?$this->DUE->getDateTime():null;
- $completed = isset($this->COMPLETED)?$this->COMPLETED->getDateTime():null;
- $created = isset($this->CREATED)?$this->CREATED->getDateTime():null;
+ $dtstart = isset($this->DTSTART) ? $this->DTSTART->getDateTime() : null;
+ $duration = isset($this->DURATION) ? VObject\DateTimeParser::parseDuration($this->DURATION) : null;
+ $due = isset($this->DUE) ? $this->DUE->getDateTime() : null;
+ $completed = isset($this->COMPLETED) ? $this->COMPLETED->getDateTime() : null;
+ $created = isset($this->CREATED) ? $this->CREATED->getDateTime() : null;
if ($dtstart) {
if ($duration) {
@@ -83,40 +84,40 @@ class VTodo extends VObject\Component {
function getValidationRules() {
return [
- 'UID' => 1,
+ 'UID' => 1,
'DTSTAMP' => 1,
- 'CLASS' => '?',
- 'COMPLETED' => '?',
- 'CREATED' => '?',
- 'DESCRIPTION' => '?',
- 'DTSTART' => '?',
- 'GEO' => '?',
+ 'CLASS' => '?',
+ 'COMPLETED' => '?',
+ 'CREATED' => '?',
+ 'DESCRIPTION' => '?',
+ 'DTSTART' => '?',
+ 'GEO' => '?',
'LAST-MODIFIED' => '?',
- 'LOCATION' => '?',
- 'ORGANIZER' => '?',
- 'PERCENT' => '?',
- 'PRIORITY' => '?',
+ 'LOCATION' => '?',
+ 'ORGANIZER' => '?',
+ 'PERCENT' => '?',
+ 'PRIORITY' => '?',
'RECURRENCE-ID' => '?',
- 'SEQUENCE' => '?',
- 'STATUS' => '?',
- 'SUMMARY' => '?',
- 'URL' => '?',
+ 'SEQUENCE' => '?',
+ 'STATUS' => '?',
+ 'SUMMARY' => '?',
+ 'URL' => '?',
- 'RRULE' => '?',
- 'DUE' => '?',
+ 'RRULE' => '?',
+ 'DUE' => '?',
'DURATION' => '?',
- 'ATTACH' => '*',
- 'ATTENDEE' => '*',
- 'CATEGORIES' => '*',
- 'COMMENT' => '*',
- 'CONTACT' => '*',
- 'EXDATE' => '*',
+ 'ATTACH' => '*',
+ 'ATTENDEE' => '*',
+ 'CATEGORIES' => '*',
+ 'COMMENT' => '*',
+ 'CONTACT' => '*',
+ 'EXDATE' => '*',
'REQUEST-STATUS' => '*',
- 'RELATED-TO' => '*',
- 'RESOURCES' => '*',
- 'RDATE' => '*',
+ 'RELATED-TO' => '*',
+ 'RESOURCES' => '*',
+ 'RDATE' => '*',
];
}
@@ -140,6 +141,7 @@ class VTodo extends VObject\Component {
* 3 - A severe issue.
*
* @param int $options
+ *
* @return array
*/
function validate($options = 0) {
@@ -155,7 +157,7 @@ class VTodo extends VObject\Component {
$result[] = [
'level' => 3,
'message' => 'The value type (DATE or DATE-TIME) must be identical for DUE and DTSTART',
- 'node' => $due,
+ 'node' => $due,
];
} elseif ($due->getDateTime() < $dtStart->getDateTime()) {
@@ -163,7 +165,7 @@ class VTodo extends VObject\Component {
$result[] = [
'level' => 3,
'message' => 'DUE must occur after DTSTART',
- 'node' => $due,
+ 'node' => $due,
];
}
diff --git a/lib/DateTimeParser.php b/lib/DateTimeParser.php
index d022138..0fe8143 100644
--- a/lib/DateTimeParser.php
+++ b/lib/DateTimeParser.php
@@ -9,7 +9,7 @@ use InvalidArgumentException;
use LogicException;
/**
- * DateTimeParser
+ * DateTimeParser.
*
* This class is responsible for parsing the several different date and time
* formats iCalendar and vCards have.
@@ -22,7 +22,7 @@ class DateTimeParser {
/**
* Parses an iCalendar (rfc5545) formatted datetime and returns a
- * DateTimeImmutable object
+ * DateTimeImmutable object.
*
* Specifying a reference timezone is optional. It will only be used
* if the non-UTC format is used. The argument is used as a reference, the
@@ -30,37 +30,39 @@ class DateTimeParser {
*
* @param string $dt
* @param DateTimeZone $tz
+ *
* @return DateTimeImmutable
*/
static function parseDateTime($dt, DateTimeZone $tz = null) {
// Format is YYYYMMDD + "T" + hhmmss
- $result = preg_match('/^([0-9]{4})([0-1][0-9])([0-3][0-9])T([0-2][0-9])([0-5][0-9])([0-5][0-9])([Z]?)$/',$dt,$matches);
+ $result = preg_match('/^([0-9]{4})([0-1][0-9])([0-3][0-9])T([0-2][0-9])([0-5][0-9])([0-5][0-9])([Z]?)$/', $dt, $matches);
if (!$result) {
throw new LogicException('The supplied iCalendar datetime value is incorrect: ' . $dt);
}
- if ($matches[7]==='Z' || is_null($tz)) {
+ if ($matches[7] === 'Z' || is_null($tz)) {
$tz = new DateTimeZone('UTC');
}
- $date = new DateTimeImmutable($matches[1] . '-' . $matches[2] . '-' . $matches[3] . ' ' . $matches[4] . ':' . $matches[5] .':' . $matches[6], $tz);
+ $date = new DateTimeImmutable($matches[1] . '-' . $matches[2] . '-' . $matches[3] . ' ' . $matches[4] . ':' . $matches[5] . ':' . $matches[6], $tz);
return $date;
}
/**
- * Parses an iCalendar (rfc5545) formatted date and returns a DateTimeImmutable object
+ * Parses an iCalendar (rfc5545) formatted date and returns a DateTimeImmutable object.
*
* @param string $date
* @param DateTimeZone $tz
+ *
* @return DateTimeImmutable
*/
static function parseDate($date, DateTimeZone $tz = null) {
// Format is YYYYMMDD
- $result = preg_match('/^([0-9]{4})([0-1][0-9])([0-3][0-9])$/',$date,$matches);
+ $result = preg_match('/^([0-9]{4})([0-1][0-9])([0-3][0-9])$/', $date, $matches);
if (!$result) {
throw new LogicException('The supplied iCalendar date value is incorrect: ' . $date);
@@ -84,6 +86,7 @@ class DateTimeParser {
*
* @param string $duration
* @param bool $asString
+ *
* @return DateInterval|string
*/
static function parseDuration($duration, $asString = false) {
@@ -97,7 +100,7 @@ class DateTimeParser {
$invert = false;
- if ($matches['plusminus']==='-') {
+ if ($matches['plusminus'] === '-') {
$invert = true;
}
@@ -109,8 +112,8 @@ class DateTimeParser {
'second',
];
- foreach($parts as $part) {
- $matches[$part] = isset($matches[$part])&&$matches[$part]?(int)$matches[$part]:0;
+ foreach ($parts as $part) {
+ $matches[$part] = isset($matches[$part]) && $matches[$part] ? (int)$matches[$part] : 0;
}
// We need to re-construct the $duration string, because weeks and
@@ -119,32 +122,32 @@ class DateTimeParser {
$days = $matches['day'];
if ($matches['week']) {
- $days+=$matches['week']*7;
+ $days += $matches['week'] * 7;
}
if ($days) {
- $duration.=$days . 'D';
+ $duration .= $days . 'D';
}
if ($matches['minute'] || $matches['second'] || $matches['hour']) {
- $duration.='T';
+ $duration .= 'T';
if ($matches['hour']) {
- $duration.=$matches['hour'].'H';
+ $duration .= $matches['hour'] . 'H';
}
if ($matches['minute']) {
- $duration.=$matches['minute'].'M';
+ $duration .= $matches['minute'] . 'M';
}
if ($matches['second']) {
- $duration.=$matches['second'].'S';
+ $duration .= $matches['second'] . 'S';
}
}
- if ($duration==='P') {
+ if ($duration === 'P') {
$duration = 'PT0S';
}
@@ -168,13 +171,13 @@ class DateTimeParser {
$newDur = '';
- foreach($parts as $part) {
+ foreach ($parts as $part) {
if (isset($matches[$part]) && $matches[$part]) {
- $newDur.=' '.$matches[$part] . ' ' . $part . 's';
+ $newDur .= ' ' . $matches[$part] . ' ' . $part . 's';
}
}
- $newDur = ($matches['plusminus']==='-'?'-':'+') . trim($newDur);
+ $newDur = ($matches['plusminus'] === '-' ? '-' : '+') . trim($newDur);
if ($newDur === '+') {
$newDur = '+0 seconds';
@@ -189,13 +192,14 @@ class DateTimeParser {
*
* @param string $date
* @param DateTimeZone|string $referenceTz
+ *
* @return DateTimeImmutable|DateInterval
*/
static function parse($date, $referenceTz = null) {
- if ($date[0]==='P' || ($date[0]==='-' && $date[1]==='P')) {
+ if ($date[0] === 'P' || ($date[0] === '-' && $date[1] === 'P')) {
return self::parseDuration($date);
- } elseif (strlen($date)===8) {
+ } elseif (strlen($date) === 8) {
return self::parseDate($date, $referenceTz);
} else {
return self::parseDateTime($date, $referenceTz);
@@ -256,6 +260,7 @@ class DateTimeParser {
* UTC, or a string like -0500 or +1100.
*
* @param string $date
+ *
* @return array
*/
static function parseVCardDateTime($date) {
@@ -324,7 +329,7 @@ class DateTimeParser {
];
$result = [];
- foreach($parts as $part) {
+ foreach ($parts as $part) {
if (empty($matches[$part])) {
$result[$part] = null;
@@ -379,6 +384,7 @@ class DateTimeParser {
* UTC, or a string like -0500 or +11:00.
*
* @param string $date
+ *
* @return array
*/
static function parseVCardTime($date) {
@@ -426,7 +432,7 @@ class DateTimeParser {
];
$result = [];
- foreach($parts as $part) {
+ foreach ($parts as $part) {
if (empty($matches[$part])) {
$result[$part] = null;
@@ -490,6 +496,7 @@ class DateTimeParser {
* UTC, or a string like -0500 or +1100.
*
* @param string $date
+ *
* @return array
*/
static function parseVCardDateAndOrTime($date) {
@@ -513,7 +520,7 @@ class DateTimeParser {
// (\d{8}|--\d{4}|---\d\d)T\d\d(\d\d(\d\d)?)?(Z|[+\-]\d\d(\d\d?)?
$valueDateTime = '/^(?:' .
'((?<year0>\d{4})(?<month0>\d\d)(?<date0>\d\d)' .
- '|--(?<month1>\d\d)(?<date1>\d\d)'.
+ '|--(?<month1>\d\d)(?<date1>\d\d)' .
'|---(?<date2>\d\d))' .
'T' .
'(?<hour>\d\d)((?<minute>\d\d)(?<second>\d\d)?)?' .
@@ -523,19 +530,19 @@ class DateTimeParser {
// date-and-or-time is date | date-time | time
// in this strict order.
- if ( 0 === preg_match($valueDate, $date, $matches)
+ if (0 === preg_match($valueDate, $date, $matches)
&& 0 === preg_match($valueDateTime, $date, $matches)
&& 0 === preg_match($valueTime, $date, $matches)) {
throw new InvalidArgumentException('Invalid vCard date-time string: ' . $date);
}
$parts = [
- 'year' => null,
- 'month' => null,
- 'date' => null,
- 'hour' => null,
- 'minute' => null,
- 'second' => null,
+ 'year' => null,
+ 'month' => null,
+ 'date' => null,
+ 'hour' => null,
+ 'minute' => null,
+ 'second' => null,
'timezone' => null
];
diff --git a/lib/Document.php b/lib/Document.php
index 6ba737e..464c8d1 100644
--- a/lib/Document.php
+++ b/lib/Document.php
@@ -3,7 +3,7 @@
namespace Sabre\VObject;
/**
- * Document
+ * Document.
*
* A document is just like a component, except that it's also the top level
* element.
@@ -19,32 +19,32 @@ namespace Sabre\VObject;
abstract class Document extends Component {
/**
- * Unknown document type
+ * Unknown document type.
*/
const UNKNOWN = 1;
/**
- * vCalendar 1.0
+ * vCalendar 1.0.
*/
const VCALENDAR10 = 2;
/**
- * iCalendar 2.0
+ * iCalendar 2.0.
*/
const ICALENDAR20 = 3;
/**
- * vCard 2.1
+ * vCard 2.1.
*/
const VCARD21 = 4;
/**
- * vCard 3.0
+ * vCard 3.0.
*/
const VCARD30 = 5;
/**
- * vCard 4.0
+ * vCard 4.0.
*/
const VCARD40 = 6;
@@ -55,28 +55,28 @@ abstract class Document extends Component {
*
* @var string
*/
- static public $defaultName;
+ static $defaultName;
/**
* List of properties, and which classes they map to.
*
* @var array
*/
- static public $propertyMap = [];
+ static $propertyMap = [];
/**
* List of components, along with which classes they map to.
*
* @var array
*/
- static public $componentMap = [];
+ static $componentMap = [];
/**
* List of value-types, and which classes they map to.
*
* @var array
*/
- static public $valueMap = [];
+ static $valueMap = [];
/**
* Creates a new document.
@@ -97,7 +97,7 @@ abstract class Document extends Component {
function __construct() {
$args = func_get_args();
- if (count($args)===0 || is_array($args[0])) {
+ if (count($args) === 0 || is_array($args[0])) {
array_unshift($args, $this, static::$defaultName);
call_user_func_array(['parent', '__construct'], $args);
} else {
@@ -126,24 +126,25 @@ abstract class Document extends Component {
*
* @param string $name
* @param string $arg1,... Unlimited number of args
+ *
* @return mixed
*/
function create($name) {
if (isset(static::$componentMap[strtoupper($name)])) {
- return call_user_func_array([$this,'createComponent'], func_get_args());
+ return call_user_func_array([$this, 'createComponent'], func_get_args());
} else {
- return call_user_func_array([$this,'createProperty'], func_get_args());
+ return call_user_func_array([$this, 'createProperty'], func_get_args());
}
}
/**
- * Creates a new component
+ * Creates a new component.
*
* This method automatically searches for the correct component class, based
* on its name.
@@ -159,6 +160,7 @@ abstract class Document extends Component {
* @param string $name
* @param array $children
* @param bool $defaults
+ *
* @return Component
*/
function createComponent($name, array $children = null, $defaults = true) {
@@ -167,7 +169,7 @@ abstract class Document extends Component {
$class = 'Sabre\\VObject\\Component';
if (isset(static::$componentMap[$name])) {
- $class=static::$componentMap[$name];
+ $class = static::$componentMap[$name];
}
if (is_null($children)) $children = [];
return new $class($this, $name, $children, $defaults);
@@ -175,7 +177,7 @@ abstract class Document extends Component {
}
/**
- * Factory method for creating new properties
+ * Factory method for creating new properties.
*
* This method automatically searches for the correct property class, based
* on its name.
@@ -188,14 +190,15 @@ abstract class Document extends Component {
* @param mixed $value
* @param array $parameters
* @param string $valueType Force a specific valuetype, such as URI or TEXT
+ *
* @return Property
*/
function createProperty($name, $value = null, array $parameters = null, $valueType = null) {
// If there's a . in the name, it means it's prefixed by a groupname.
- if (($i=strpos($name,'.'))!==false) {
+ if (($i = strpos($name, '.')) !== false) {
$group = substr($name, 0, $i);
- $name = strtoupper(substr($name, $i+1));
+ $name = strtoupper(substr($name, $i + 1));
} else {
$name = strtoupper($name);
$group = null;
@@ -233,6 +236,7 @@ abstract class Document extends Component {
* This method returns null if we don't have a specialized class.
*
* @param string $valueParam
+ *
* @return void
*/
function getClassNameForPropertyValue($valueParam) {
@@ -248,6 +252,7 @@ abstract class Document extends Component {
* Returns the default class for a property name.
*
* @param string $propertyName
+ *
* @return string
*/
function getClassNameForPropertyName($propertyName) {
diff --git a/lib/ElementList.php b/lib/ElementList.php
index 866c86f..2eeb049 100644
--- a/lib/ElementList.php
+++ b/lib/ElementList.php
@@ -2,12 +2,11 @@
namespace Sabre\VObject;
-use
- ArrayIterator,
- LogicException;
+use ArrayIterator;
+use LogicException;
/**
- * VObject ElementList
+ * VObject ElementList.
*
* This class represents a list of elements. Lists are the result of queries,
* such as doing $vcalendar->vevent where there's multiple VEVENT objects.
@@ -26,6 +25,7 @@ class ElementList extends ArrayIterator {
*
* @param int $offset
* @param mixed $value
+ *
* @return void
*/
function offsetSet($offset, $value) {
@@ -40,6 +40,7 @@ class ElementList extends ArrayIterator {
* This method just forwards the request to the inner iterator
*
* @param int $offset
+ *
* @return void
*/
function offsetUnset($offset) {
diff --git a/lib/FreeBusyGenerator.php b/lib/FreeBusyGenerator.php
index aa5a211..7484c11 100644
--- a/lib/FreeBusyGenerator.php
+++ b/lib/FreeBusyGenerator.php
@@ -26,28 +26,28 @@ use Sabre\VObject\Recur\NoInstancesException;
class FreeBusyGenerator {
/**
- * Input objects
+ * Input objects.
*
* @var array
*/
protected $objects = [];
/**
- * Start of range
+ * Start of range.
*
* @var DateTimeInterface|null
*/
protected $start;
/**
- * End of range
+ * End of range.
*
* @var DateTimeInterface|null
*/
protected $end;
/**
- * VCALENDAR object
+ * VCALENDAR object.
*
* @var Component
*/
@@ -104,6 +104,7 @@ class FreeBusyGenerator {
* The VFREEBUSY object will be automatically added though.
*
* @param Component $vcalendar
+ *
* @return void
*/
function setBaseObject(Component $vcalendar) {
@@ -113,13 +114,14 @@ class FreeBusyGenerator {
}
/**
- * Sets the input objects
+ * Sets the input objects.
*
* You must either specify a valendar object as a strong, or as the parse
* Component.
* It's also possible to specify multiple objects as an array.
*
* @param mixed $objects
+ *
* @return void
*/
function setObjects($objects) {
@@ -129,7 +131,7 @@ class FreeBusyGenerator {
}
$this->objects = [];
- foreach($objects as $object) {
+ foreach ($objects as $object) {
if (is_string($object)) {
$this->objects[] = Reader::read($object);
@@ -144,12 +146,13 @@ class FreeBusyGenerator {
}
/**
- * Sets the time range
+ * Sets the time range.
*
* Any freebusy object falling outside of this time range will be ignored.
*
* @param DateTimeInterface $start
* @param DateTimeInterface $end
+ *
* @return void
*/
function setTimeRange(DateTimeInterface $start = null, DateTimeInterface $end = null) {
@@ -163,9 +166,10 @@ class FreeBusyGenerator {
* Sets the reference timezone for floating times.
*
* @param DateTimeZone $timeZone
+ *
* @return void
*/
- public function setTimeZone(DateTimeZone $timeZone) {
+ function setTimeZone(DateTimeZone $timeZone) {
$this->timeZone = $timeZone;
@@ -181,11 +185,11 @@ class FreeBusyGenerator {
$busyTimes = [];
- foreach($this->objects as $key=>$object) {
+ foreach ($this->objects as $key => $object) {
- foreach($object->getBaseComponents() as $component) {
+ foreach ($object->getBaseComponents() as $component) {
- switch($component->name) {
+ switch ($component->name) {
case 'VEVENT' :
@@ -195,10 +199,10 @@ class FreeBusyGenerator {
}
if (isset($component->STATUS)) {
$status = strtoupper($component->STATUS);
- if ($status==='CANCELLED') {
+ if ($status === 'CANCELLED') {
break;
}
- if ($status==='TENTATIVE') {
+ if ($status === 'TENTATIVE') {
$FBTYPE = 'BUSY-TENTATIVE';
}
}
@@ -222,7 +226,7 @@ class FreeBusyGenerator {
$maxRecurrences = 200;
- while($iterator->valid() && --$maxRecurrences) {
+ while ($iterator->valid() && --$maxRecurrences) {
$startTime = $iterator->getDTStart();
if ($this->end && $startTime > $this->end) {
@@ -262,7 +266,7 @@ class FreeBusyGenerator {
}
- foreach($times as $time) {
+ foreach ($times as $time) {
if ($this->end && $time[0] > $this->end) break;
if ($this->start && $time[1] < $this->start) break;
@@ -276,20 +280,20 @@ class FreeBusyGenerator {
break;
case 'VFREEBUSY' :
- foreach($component->FREEBUSY as $freebusy) {
+ foreach ($component->FREEBUSY as $freebusy) {
- $fbType = isset($freebusy['FBTYPE'])?strtoupper($freebusy['FBTYPE']):'BUSY';
+ $fbType = isset($freebusy['FBTYPE']) ? strtoupper($freebusy['FBTYPE']) : 'BUSY';
// Skipping intervals marked as 'free'
- if ($fbType==='FREE')
+ if ($fbType === 'FREE')
continue;
$values = explode(',', $freebusy);
- foreach($values as $value) {
+ foreach ($values as $value) {
list($startTime, $endTime) = explode('/', $value);
$startTime = DateTimeParser::parseDateTime($startTime);
- if (substr($endTime,0,1)==='P' || substr($endTime,0,2)==='-P') {
+ if (substr($endTime, 0, 1) === 'P' || substr($endTime, 0, 2) === '-P') {
$duration = DateTimeParser::parseDuration($endTime);
$endTime = clone $startTime;
$endTime = $endTime->add($duration);
@@ -297,8 +301,8 @@ class FreeBusyGenerator {
$endTime = DateTimeParser::parseDateTime($endTime);
}
- if($this->start && $this->start > $endTime) continue;
- if($this->end && $this->end < $startTime) continue;
+ if ($this->start && $this->start > $endTime) continue;
+ if ($this->end && $this->end < $startTime) continue;
$busyTimes[] = [
$startTime,
$endTime,
@@ -343,7 +347,7 @@ class FreeBusyGenerator {
$dtstamp->setDateTime(new DateTimeImmutable('now', new \DateTimeZone('UTC')));
$vfreebusy->add($dtstamp);
- foreach($busyTimes as $busyTime) {
+ foreach ($busyTimes as $busyTime) {
$busyTime[0] = $busyTime[0]->setTimeZone(new \DateTimeZone('UTC'));
$busyTime[1] = $busyTime[1]->setTimeZone(new \DateTimeZone('UTC'));
diff --git a/lib/ITip/Broker.php b/lib/ITip/Broker.php
index 5dada56..77d4038 100644
--- a/lib/ITip/Broker.php
+++ b/lib/ITip/Broker.php
@@ -66,7 +66,7 @@ class Broker {
*
* @var string[]
*/
- public $significantChangeProperties = array(
+ public $significantChangeProperties = [
'DTSTART',
'DTEND',
'DURATION',
@@ -75,7 +75,7 @@ class Broker {
'RDATE',
'EXDATE',
'STATUS',
- );
+ ];
/**
* This method is used to process an incoming itip message.
@@ -106,16 +106,17 @@ class Broker {
*
* @param Message $itipMessage
* @param VCalendar $existingObject
+ *
* @return VCalendar|null
*/
- public function processMessage(Message $itipMessage, VCalendar $existingObject = null) {
+ function processMessage(Message $itipMessage, VCalendar $existingObject = null) {
// We only support events at the moment.
if ($itipMessage->component !== 'VEVENT') {
return false;
}
- switch($itipMessage->method) {
+ switch ($itipMessage->method) {
case 'REQUEST' :
return $this->processMessageRequest($itipMessage, $existingObject);
@@ -128,7 +129,7 @@ class Broker {
default :
// Unsupported iTip message
- return null;
+ return;
}
@@ -162,9 +163,10 @@ class Broker {
* @param VCalendar|string $calendar
* @param string|array $userHref
* @param VCalendar|string $oldCalendar
+ *
* @return array
*/
- public function parseEvent($calendar = null, $userHref, $oldCalendar = null) {
+ function parseEvent($calendar = null, $userHref, $oldCalendar = null) {
if ($oldCalendar) {
if (is_string($oldCalendar)) {
@@ -172,16 +174,16 @@ class Broker {
}
if (!isset($oldCalendar->VEVENT)) {
// We only support events at the moment
- return array();
+ return [];
}
$oldEventInfo = $this->parseEventInfo($oldCalendar);
} else {
- $oldEventInfo = array(
- 'organizer' => null,
+ $oldEventInfo = [
+ 'organizer' => null,
'significantChangeHash' => '',
- 'attendees' => array(),
- );
+ 'attendees' => [],
+ ];
}
$userHref = (array)$userHref;
@@ -193,17 +195,17 @@ class Broker {
}
if (!isset($calendar->VEVENT)) {
// We only support events at the moment
- return array();
+ return [];
}
$eventInfo = $this->parseEventInfo($calendar);
if (!$eventInfo['attendees'] && !$oldEventInfo['attendees']) {
// If there were no attendees on either side of the equation,
// we don't need to do anything.
- return array();
+ return [];
}
if (!$eventInfo['organizer'] && !$oldEventInfo['organizer']) {
// There was no organizer before or after the change.
- return array();
+ return [];
}
$baseCalendar = $calendar;
@@ -221,24 +223,24 @@ class Broker {
// cancellation / decline.
if (!$oldCalendar) {
// No old and no new calendar, there's no thing to do.
- return array();
+ return [];
}
$eventInfo = $oldEventInfo;
if (in_array($eventInfo['organizer'], $userHref)) {
// This is an organizer deleting the event.
- $eventInfo['attendees'] = array();
+ $eventInfo['attendees'] = [];
// Increasing the sequence, but only if the organizer deleted
// the event.
$eventInfo['sequence']++;
} else {
// This is an attendee deleting the event.
- foreach($eventInfo['attendees'] as $key=>$attendee) {
+ foreach ($eventInfo['attendees'] as $key => $attendee) {
if (in_array($attendee['href'], $userHref)) {
- $eventInfo['attendees'][$key]['instances'] = array('master' =>
- array('id'=>'master', 'partstat' => 'DECLINED')
- );
+ $eventInfo['attendees'][$key]['instances'] = ['master' =>
+ ['id' => 'master', 'partstat' => 'DECLINED']
+ ];
}
}
}
@@ -252,13 +254,13 @@ class Broker {
// We need to figure out if the user is an attendee, but we're only
// doing so if there's an oldCalendar, because we only want to
// process updates, not creation of new events.
- foreach($eventInfo['attendees'] as $attendee) {
+ foreach ($eventInfo['attendees'] as $attendee) {
if (in_array($attendee['href'], $userHref)) {
return $this->parseEventForAttendee($baseCalendar, $eventInfo, $oldEventInfo, $attendee['href']);
}
}
}
- return array();
+ return [];
}
@@ -271,6 +273,7 @@ class Broker {
*
* @param Message $itipMessage
* @param VCalendar $existingObject
+ *
* @return VCalendar|null
*/
protected function processMessageRequest(Message $itipMessage, VCalendar $existingObject = null) {
@@ -279,17 +282,17 @@ class Broker {
// This is a new invite, and we're just going to copy over
// all the components from the invite.
$existingObject = new VCalendar();
- foreach($itipMessage->message->getComponents() as $component) {
+ foreach ($itipMessage->message->getComponents() as $component) {
$existingObject->add(clone $component);
}
} else {
// We need to update an existing object with all the new
// information. We can just remove all existing components
// and create new ones.
- foreach($existingObject->getComponents() as $component) {
+ foreach ($existingObject->getComponents() as $component) {
$existingObject->remove($component);
}
- foreach($itipMessage->message->getComponents() as $component) {
+ foreach ($itipMessage->message->getComponents() as $component) {
$existingObject->add(clone $component);
}
}
@@ -306,6 +309,7 @@ class Broker {
*
* @param Message $itipMessage
* @param VCalendar $existingObject
+ *
* @return VCalendar|null
*/
protected function processMessageCancel(Message $itipMessage, VCalendar $existingObject = null) {
@@ -314,7 +318,7 @@ class Broker {
// The event didn't exist in the first place, so we're just
// ignoring this message.
} else {
- foreach($existingObject->VEVENT as $vevent) {
+ foreach ($existingObject->VEVENT as $vevent) {
$vevent->STATUS = 'CANCELLED';
$vevent->SEQUENCE = $itipMessage->sequence;
}
@@ -331,6 +335,7 @@ class Broker {
*
* @param Message $itipMessage
* @param VCalendar $existingObject
+ *
* @return VCalendar|null
*/
protected function processMessageReply(Message $itipMessage, VCalendar $existingObject = null) {
@@ -338,14 +343,14 @@ class Broker {
// A reply can only be processed based on an existing object.
// If the object is not available, the reply is ignored.
if (!$existingObject) {
- return null;
+ return;
}
- $instances = array();
+ $instances = [];
$requestStatus = '2.0';
// Finding all the instances the attendee replied to.
- foreach($itipMessage->message->VEVENT as $vevent) {
- $recurId = isset($vevent->{'RECURRENCE-ID'})?$vevent->{'RECURRENCE-ID'}->getValue():'master';
+ foreach ($itipMessage->message->VEVENT as $vevent) {
+ $recurId = isset($vevent->{'RECURRENCE-ID'}) ? $vevent->{'RECURRENCE-ID'}->getValue() : 'master';
$attendee = $vevent->ATTENDEE;
$instances[$recurId] = $attendee['PARTSTAT']->getValue();
if (isset($vevent->{'REQUEST-STATUS'})) {
@@ -357,15 +362,15 @@ class Broker {
// Now we need to loop through the original organizer event, to find
// all the instances where we have a reply for.
$masterObject = null;
- foreach($existingObject->VEVENT as $vevent) {
- $recurId = isset($vevent->{'RECURRENCE-ID'})?$vevent->{'RECURRENCE-ID'}->getValue():'master';
- if ($recurId==='master') {
+ foreach ($existingObject->VEVENT as $vevent) {
+ $recurId = isset($vevent->{'RECURRENCE-ID'}) ? $vevent->{'RECURRENCE-ID'}->getValue() : 'master';
+ if ($recurId === 'master') {
$masterObject = $vevent;
}
if (isset($instances[$recurId])) {
$attendeeFound = false;
if (isset($vevent->ATTENDEE)) {
- foreach($vevent->ATTENDEE as $attendee) {
+ foreach ($vevent->ATTENDEE as $attendee) {
if ($attendee->getValue() === $itipMessage->sender) {
$attendeeFound = true;
$attendee['PARTSTAT'] = $instances[$recurId];
@@ -380,22 +385,22 @@ class Broker {
if (!$attendeeFound) {
// Adding a new attendee. The iTip documentation calls this
// a party crasher.
- $attendee = $vevent->add('ATTENDEE', $itipMessage->sender, array(
+ $attendee = $vevent->add('ATTENDEE', $itipMessage->sender, [
'PARTSTAT' => $instances[$recurId]
- ));
+ ]);
if ($itipMessage->senderName) $attendee['CN'] = $itipMessage->senderName;
}
unset($instances[$recurId]);
}
}
- if(!$masterObject) {
+ if (!$masterObject) {
// No master object, we can't add new instances.
- return null;
+ return;
}
// If we got replies to instances that did not exist in the
// original list, it means that new exceptions must be created.
- foreach($instances as $recurId=>$partstat) {
+ foreach ($instances as $recurId => $partstat) {
$recurrenceIterator = new EventIterator($existingObject, $itipMessage->uid);
$found = false;
@@ -405,12 +410,12 @@ class Broker {
$newObject = $recurrenceIterator->getEventObject();
$recurrenceIterator->next();
- if (isset($newObject->{'RECURRENCE-ID'}) && $newObject->{'RECURRENCE-ID'}->getValue()===$recurId) {
+ if (isset($newObject->{'RECURRENCE-ID'}) && $newObject->{'RECURRENCE-ID'}->getValue() === $recurId) {
$found = true;
}
$iterations--;
- } while($recurrenceIterator->valid() && !$found && $iterations);
+ } while ($recurrenceIterator->valid() && !$found && $iterations);
// Invalid recurrence id. Skipping this object.
if (!$found) continue;
@@ -422,7 +427,7 @@ class Broker {
);
$attendeeFound = false;
if (isset($newObject->ATTENDEE)) {
- foreach($newObject->ATTENDEE as $attendee) {
+ foreach ($newObject->ATTENDEE as $attendee) {
if ($attendee->getValue() === $itipMessage->sender) {
$attendeeFound = true;
$attendee['PARTSTAT'] = $partstat;
@@ -432,9 +437,9 @@ class Broker {
}
if (!$attendeeFound) {
// Adding a new attendee
- $attendee = $newObject->add('ATTENDEE', $itipMessage->sender, array(
+ $attendee = $newObject->add('ATTENDEE', $itipMessage->sender, [
'PARTSTAT' => $partstat
- ));
+ ]);
if ($itipMessage->senderName) {
$attendee['CN'] = $itipMessage->senderName;
}
@@ -457,44 +462,45 @@ class Broker {
* @param VCalendar $calendar
* @param array $eventInfo
* @param array $oldEventInfo
+ *
* @return array
*/
protected function parseEventForOrganizer(VCalendar $calendar, array $eventInfo, array $oldEventInfo) {
// Merging attendee lists.
- $attendees = array();
- foreach($oldEventInfo['attendees'] as $attendee) {
- $attendees[$attendee['href']] = array(
- 'href' => $attendee['href'],
+ $attendees = [];
+ foreach ($oldEventInfo['attendees'] as $attendee) {
+ $attendees[$attendee['href']] = [
+ 'href' => $attendee['href'],
'oldInstances' => $attendee['instances'],
- 'newInstances' => array(),
- 'name' => $attendee['name'],
- 'forceSend' => null,
- );
+ 'newInstances' => [],
+ 'name' => $attendee['name'],
+ 'forceSend' => null,
+ ];
}
- foreach($eventInfo['attendees'] as $attendee) {
+ foreach ($eventInfo['attendees'] as $attendee) {
if (isset($attendees[$attendee['href']])) {
$attendees[$attendee['href']]['name'] = $attendee['name'];
$attendees[$attendee['href']]['newInstances'] = $attendee['instances'];
$attendees[$attendee['href']]['forceSend'] = $attendee['forceSend'];
} else {
- $attendees[$attendee['href']] = array(
- 'href' => $attendee['href'],
- 'oldInstances' => array(),
+ $attendees[$attendee['href']] = [
+ 'href' => $attendee['href'],
+ 'oldInstances' => [],
'newInstances' => $attendee['instances'],
- 'name' => $attendee['name'],
- 'forceSend' => $attendee['forceSend'],
- );
+ 'name' => $attendee['name'],
+ 'forceSend' => $attendee['forceSend'],
+ ];
}
}
- $messages = array();
+ $messages = [];
- foreach($attendees as $attendee) {
+ foreach ($attendees as $attendee) {
// An organizer can also be an attendee. We should not generate any
// messages for those.
- if ($attendee['href']===$eventInfo['organizer']) {
+ if ($attendee['href'] === $eventInfo['organizer']) {
continue;
}
@@ -517,19 +523,19 @@ class Broker {
// Creating the new iCalendar body.
$icalMsg = new VCalendar();
$icalMsg->METHOD = $message->method;
- $event = $icalMsg->add('VEVENT', array(
- 'UID' => $message->uid,
+ $event = $icalMsg->add('VEVENT', [
+ 'UID' => $message->uid,
'SEQUENCE' => $message->sequence,
- ));
+ ]);
if (isset($calendar->VEVENT->SUMMARY)) {
$event->add('SUMMARY', $calendar->VEVENT->SUMMARY->getValue());
}
$event->add(clone $calendar->VEVENT->DTSTART);
$org = $event->add('ORGANIZER', $eventInfo['organizer']);
if ($eventInfo['organizerName']) $org['CN'] = $eventInfo['organizerName'];
- $event->add('ATTENDEE', $attendee['href'], array(
+ $event->add('ATTENDEE', $attendee['href'], [
'CN' => $attendee['name'],
- ));
+ ]);
$message->significantChange = true;
} else {
@@ -541,7 +547,7 @@ class Broker {
$icalMsg = new VCalendar();
$icalMsg->METHOD = $message->method;
- foreach($calendar->select('VTIMEZONE') as $timezone) {
+ foreach ($calendar->select('VTIMEZONE') as $timezone) {
$icalMsg->add(clone $timezone);
}
@@ -556,17 +562,17 @@ class Broker {
$message->significantChange =
$attendee['forceSend'] === 'REQUEST' ||
array_keys($attendee['oldInstances']) != array_keys($attendee['newInstances']) ||
- $oldEventInfo['significantChangeHash']!==$eventInfo['significantChangeHash'];
+ $oldEventInfo['significantChangeHash'] !== $eventInfo['significantChangeHash'];
- foreach($attendee['newInstances'] as $instanceId => $instanceInfo) {
+ foreach ($attendee['newInstances'] as $instanceId => $instanceInfo) {
$currentEvent = clone $eventInfo['instances'][$instanceId];
if ($instanceId === 'master') {
// We need to find a list of events that the attendee
// is not a part of to add to the list of exceptions.
- $exceptions = array();
- foreach($eventInfo['instances'] as $instanceId=>$vevent) {
+ $exceptions = [];
+ foreach ($eventInfo['instances'] as $instanceId => $vevent) {
if (!isset($attendee['newInstances'][$instanceId])) {
$exceptions[] = $instanceId;
}
@@ -590,7 +596,7 @@ class Broker {
unset($currentEvent->ORGANIZER['SCHEDULE-FORCE-SEND']);
unset($currentEvent->ORGANIZER['SCHEDULE-STATUS']);
- foreach($currentEvent->ATTENDEE as $attendee) {
+ foreach ($currentEvent->ATTENDEE as $attendee) {
unset($attendee['SCHEDULE-FORCE-SEND']);
unset($attendee['SCHEDULE-STATUS']);
@@ -628,44 +634,45 @@ class Broker {
* @param array $eventInfo
* @param array $oldEventInfo
* @param string $attendee
+ *
* @return Message[]
*/
protected function parseEventForAttendee(VCalendar $calendar, array $eventInfo, array $oldEventInfo, $attendee) {
- if ($this->scheduleAgentServerRules && $eventInfo['organizerScheduleAgent']==='CLIENT') {
- return array();
+ if ($this->scheduleAgentServerRules && $eventInfo['organizerScheduleAgent'] === 'CLIENT') {
+ return [];
}
// Don't bother generating messages for events that have already been
// cancelled.
- if ($eventInfo['status']==='CANCELLED') {
- return array();
+ if ($eventInfo['status'] === 'CANCELLED') {
+ return [];
}
$oldInstances = !empty($oldEventInfo['attendees'][$attendee]['instances']) ?
$oldEventInfo['attendees'][$attendee]['instances'] :
- array();
+ [];
- $instances = array();
- foreach($oldInstances as $instance) {
+ $instances = [];
+ foreach ($oldInstances as $instance) {
- $instances[$instance['id']] = array(
- 'id' => $instance['id'],
+ $instances[$instance['id']] = [
+ 'id' => $instance['id'],
'oldstatus' => $instance['partstat'],
'newstatus' => null,
- );
+ ];
}
- foreach($eventInfo['attendees'][$attendee]['instances'] as $instance) {
+ foreach ($eventInfo['attendees'][$attendee]['instances'] as $instance) {
if (isset($instances[$instance['id']])) {
$instances[$instance['id']]['newstatus'] = $instance['partstat'];
} else {
- $instances[$instance['id']] = array(
- 'id' => $instance['id'],
+ $instances[$instance['id']] = [
+ 'id' => $instance['id'],
'oldstatus' => null,
'newstatus' => $instance['partstat'],
- );
+ ];
}
}
@@ -676,17 +683,17 @@ class Broker {
// instances.
// We only need to do that though, if the master event is not declined.
if (isset($instances['master']) && $instances['master']['newstatus'] !== 'DECLINED') {
- foreach($eventInfo['exdate'] as $exDate) {
+ foreach ($eventInfo['exdate'] as $exDate) {
if (!in_array($exDate, $oldEventInfo['exdate'])) {
if (isset($instances[$exDate])) {
$instances[$exDate]['newstatus'] = 'DECLINED';
} else {
- $instances[$exDate] = array(
- 'id' => $exDate,
+ $instances[$exDate] = [
+ 'id' => $exDate,
'oldstatus' => null,
'newstatus' => 'DECLINED',
- );
+ ];
}
}
@@ -694,7 +701,7 @@ class Broker {
}
// Gathering a few extra properties for each instance.
- foreach($instances as $recurId=>$instanceInfo) {
+ foreach ($instances as $recurId => $instanceInfo) {
if (isset($eventInfo['instances'][$recurId])) {
$instances[$recurId]['dtstart'] = clone $eventInfo['instances'][$recurId]->DTSTART;
@@ -719,18 +726,18 @@ class Broker {
$hasReply = false;
- foreach($instances as $instance) {
+ foreach ($instances as $instance) {
- if ($instance['oldstatus']==$instance['newstatus'] && $eventInfo['organizerForceSend'] !== 'REPLY') {
+ if ($instance['oldstatus'] == $instance['newstatus'] && $eventInfo['organizerForceSend'] !== 'REPLY') {
// Skip
continue;
}
- $event = $icalMsg->add('VEVENT', array(
- 'UID' => $message->uid,
+ $event = $icalMsg->add('VEVENT', [
+ 'UID' => $message->uid,
'SEQUENCE' => $message->sequence,
- ));
- $summary = isset($calendar->VEVENT->SUMMARY)?$calendar->VEVENT->SUMMARY->getValue():'';
+ ]);
+ $summary = isset($calendar->VEVENT->SUMMARY) ? $calendar->VEVENT->SUMMARY->getValue() : '';
// Adding properties from the correct source instance
if (isset($eventInfo['instances'][$instance['id']])) {
$instanceObj = $eventInfo['instances'][$instance['id']];
@@ -748,7 +755,7 @@ class Broker {
$dt = DateTimeParser::parse($instance['id'], $eventInfo['timezone']);
// Treat is as a DATE field
if (strlen($instance['id']) <= 8) {
- $recur = $event->add('DTSTART', $dt, array('VALUE' => 'DATE'));
+ $recur = $event->add('DTSTART', $dt, ['VALUE' => 'DATE']);
} else {
$recur = $event->add('DTSTART', $dt);
}
@@ -760,7 +767,7 @@ class Broker {
$dt = DateTimeParser::parse($instance['id'], $eventInfo['timezone']);
// Treat is as a DATE field
if (strlen($instance['id']) <= 8) {
- $recur = $event->add('RECURRENCE-ID', $dt, array('VALUE' => 'DATE'));
+ $recur = $event->add('RECURRENCE-ID', $dt, ['VALUE' => 'DATE']);
} else {
$recur = $event->add('RECURRENCE-ID', $dt);
}
@@ -769,9 +776,9 @@ class Broker {
if ($message->recipientName) {
$organizer['CN'] = $message->recipientName;
}
- $attendee = $event->add('ATTENDEE', $message->sender, array(
+ $attendee = $event->add('ATTENDEE', $message->sender, [
'PARTSTAT' => $instance['newstatus']
- ));
+ ]);
if ($message->senderName) {
$attendee['CN'] = $message->senderName;
}
@@ -781,9 +788,9 @@ class Broker {
if ($hasReply) {
$message->message = $icalMsg;
- return array($message);
+ return [$message];
} else {
- return array();
+ return [];
}
}
@@ -801,6 +808,7 @@ class Broker {
* 5. instances
*
* @param VCalendar $calendar
+ *
* @return array
*/
protected function parseEventInfo(VCalendar $calendar = null) {
@@ -818,12 +826,12 @@ class Broker {
// Now we need to collect a list of attendees, and which instances they
// are a part of.
- $attendees = array();
+ $attendees = [];
- $instances = array();
- $exdate = array();
+ $instances = [];
+ $exdate = [];
- foreach($calendar->VEVENT as $vevent) {
+ foreach ($calendar->VEVENT as $vevent) {
if (is_null($uid)) {
$uid = $vevent->UID->getValue();
@@ -840,7 +848,7 @@ class Broker {
if (isset($vevent->ORGANIZER)) {
if (is_null($organizer)) {
$organizer = $vevent->ORGANIZER->getNormalizedValue();
- $organizerName = isset($vevent->ORGANIZER['CN'])?$vevent->ORGANIZER['CN']:null;
+ $organizerName = isset($vevent->ORGANIZER['CN']) ? $vevent->ORGANIZER['CN'] : null;
} else {
if ($organizer !== $vevent->ORGANIZER->getNormalizedValue()) {
throw new SameOrganizerForAllComponentsException('Every instance of the event must have the same organizer.');
@@ -868,12 +876,12 @@ class Broker {
$status = strtoupper($vevent->STATUS->getValue());
}
- $recurId = isset($vevent->{'RECURRENCE-ID'})?$vevent->{'RECURRENCE-ID'}->getValue():'master';
- if ($recurId==='master') {
+ $recurId = isset($vevent->{'RECURRENCE-ID'}) ? $vevent->{'RECURRENCE-ID'}->getValue() : 'master';
+ if ($recurId === 'master') {
$timezone = $vevent->DTSTART->getDateTime()->getTimeZone();
}
- if(isset($vevent->ATTENDEE)) {
- foreach($vevent->ATTENDEE as $attendee) {
+ if (isset($vevent->ATTENDEE)) {
+ foreach ($vevent->ATTENDEE as $attendee) {
if ($this->scheduleAgentServerRules &&
isset($attendee['SCHEDULE-AGENT']) &&
@@ -893,23 +901,23 @@ class Broker {
if (isset($attendees[$attendee->getNormalizedValue()])) {
- $attendees[$attendee->getNormalizedValue()]['instances'][$recurId] = array(
- 'id' => $recurId,
- 'partstat' => $partStat,
+ $attendees[$attendee->getNormalizedValue()]['instances'][$recurId] = [
+ 'id' => $recurId,
+ 'partstat' => $partStat,
'force-send' => $forceSend,
- );
+ ];
} else {
- $attendees[$attendee->getNormalizedValue()] = array(
- 'href' => $attendee->getNormalizedValue(),
- 'instances' => array(
- $recurId => array(
- 'id' => $recurId,
+ $attendees[$attendee->getNormalizedValue()] = [
+ 'href' => $attendee->getNormalizedValue(),
+ 'instances' => [
+ $recurId => [
+ 'id' => $recurId,
'partstat' => $partStat,
- ),
- ),
- 'name' => isset($attendee['CN'])?(string)$attendee['CN']:null,
+ ],
+ ],
+ 'name' => isset($attendee['CN']) ? (string)$attendee['CN'] : null,
'forceSend' => $forceSend,
- );
+ ];
}
}
@@ -917,20 +925,20 @@ class Broker {
}
- foreach($this->significantChangeProperties as $prop) {
+ foreach ($this->significantChangeProperties as $prop) {
if (isset($vevent->$prop)) {
$propertyValues = $vevent->select($prop);
- $significantChangeHash.=$prop.':';
+ $significantChangeHash .= $prop . ':';
if ($prop === 'EXDATE') {
- $significantChangeHash.= implode(',', $exdate).';';
+ $significantChangeHash .= implode(',', $exdate) . ';';
} else {
- foreach($propertyValues as $val) {
- $significantChangeHash.= $val->getValue().';';
+ foreach ($propertyValues as $val) {
+ $significantChangeHash .= $val->getValue() . ';';
}
}
diff --git a/lib/ITip/Message.php b/lib/ITip/Message.php
index 0b18af6..c8d16e2 100644
--- a/lib/ITip/Message.php
+++ b/lib/ITip/Message.php
@@ -3,7 +3,7 @@
namespace Sabre\VObject\ITip;
/**
- * This class represents an iTip message
+ * This class represents an iTip message.
*
* A message holds all the information relevant to the message, including the
* object itself.
@@ -17,14 +17,14 @@ namespace Sabre\VObject\ITip;
class Message {
/**
- * The object's UID
+ * The object's UID.
*
* @var string
*/
public $uid;
/**
- * The component type, such as VEVENT
+ * The component type, such as VEVENT.
*
* @var string
*/
@@ -123,9 +123,9 @@ class Message {
*
* @return mixed bool|string
*/
- public function getScheduleStatus() {
+ function getScheduleStatus() {
- if(!$this->scheduleStatus) {
+ if (!$this->scheduleStatus) {
return false;
diff --git a/lib/ITip/SameOrganizerForAllComponentsException.php b/lib/ITip/SameOrganizerForAllComponentsException.php
index 759d1ca..47cb9e8 100644
--- a/lib/ITip/SameOrganizerForAllComponentsException.php
+++ b/lib/ITip/SameOrganizerForAllComponentsException.php
@@ -3,7 +3,7 @@
namespace Sabre\VObject\ITip;
/**
- * SameOrganizerForAllComponentsException
+ * SameOrganizerForAllComponentsException.
*
* This exception is emitted when an event is encountered with more than one
* component (e.g.: exceptions), but the organizer is not identical in every
diff --git a/lib/Node.php b/lib/Node.php
index 9afd1c0..74398a9 100644
--- a/lib/Node.php
+++ b/lib/Node.php
@@ -52,21 +52,21 @@ abstract class Node
public $parent;
/**
- * Iterator override
+ * Iterator override.
*
* @var ElementList
*/
protected $iterator = null;
/**
- * The root document
+ * The root document.
*
* @var Component
*/
protected $root;
/**
- * Serializes the node into a mimedir format
+ * Serializes the node into a mimedir format.
*
* @return string
*/
@@ -85,6 +85,7 @@ abstract class Node
* xCal documents.
*
* @param Xml\Writer $writer XML writer.
+ *
* @return void
*/
abstract function xmlSerialize(Xml\Writer $writer);
@@ -92,7 +93,7 @@ abstract class Node
/* {{{ IteratorAggregator interface */
/**
- * Returns the iterator for this object
+ * Returns the iterator for this object.
*
* @return ElementList
*/
@@ -107,11 +108,12 @@ abstract class Node
}
/**
- * Sets the overridden iterator
+ * Sets the overridden iterator.
*
* Note that this is not actually part of the iterator interface
*
* @param ElementList $iterator
+ *
* @return void
*/
function setIterator(ElementList $iterator) {
@@ -139,6 +141,7 @@ abstract class Node
* 3 - A severe issue.
*
* @param int $options
+ *
* @return array
*/
function validate($options = 0) {
@@ -152,7 +155,7 @@ abstract class Node
/* {{{ Countable interface */
/**
- * Returns the number of elements
+ * Returns the number of elements.
*
* @return int
*/
@@ -174,6 +177,7 @@ abstract class Node
* This method just forwards the request to the inner iterator
*
* @param int $offset
+ *
* @return bool
*/
function offsetExists($offset) {
@@ -189,6 +193,7 @@ abstract class Node
* This method just forwards the request to the inner iterator
*
* @param int $offset
+ *
* @return mixed
*/
function offsetGet($offset) {
@@ -205,12 +210,13 @@ abstract class Node
*
* @param int $offset
* @param mixed $value
+ *
* @return void
*/
function offsetSet($offset, $value) {
$iterator = $this->getIterator();
- $iterator->offsetSet($offset,$value);
+ $iterator->offsetSet($offset, $value);
// @codeCoverageIgnoreStart
//
@@ -225,6 +231,7 @@ abstract class Node
* This method just forwards the request to the inner iterator
*
* @param int $offset
+ *
* @return void
*/
function offsetUnset($offset) {
diff --git a/lib/Parameter.php b/lib/Parameter.php
index 7e5670f..4f526bc 100644
--- a/lib/Parameter.php
+++ b/lib/Parameter.php
@@ -2,12 +2,11 @@
namespace Sabre\VObject;
-use
- Sabre\Xml,
- ArrayIterator;
+use Sabre\Xml;
+use ArrayIterator;
/**
- * VObject Parameter
+ * VObject Parameter.
*
* This class represents a parameter. A parameter is always tied to a property.
* In the case of:
@@ -21,7 +20,7 @@ use
class Parameter extends Node {
/**
- * Parameter name
+ * Parameter name.
*
* @var string
*/
@@ -37,7 +36,7 @@ class Parameter extends Node {
public $noName = false;
/**
- * Parameter value
+ * Parameter value.
*
* @var string
*/
@@ -80,10 +79,11 @@ class Parameter extends Node {
* used, but we like to be complete.
*
* @param string $value
+ *
* @return string
*/
- public static function guessParameterNameByValue($value) {
- switch(strtoupper($value)) {
+ static function guessParameterNameByValue($value) {
+ switch (strtoupper($value)) {
// Encodings
case '7-BIT' :
@@ -177,6 +177,7 @@ class Parameter extends Node {
* This may be either a single, or multiple strings in an array.
*
* @param string|array $value
+ *
* @return void
*/
function setValue($value) {
@@ -186,7 +187,7 @@ class Parameter extends Node {
}
/**
- * Returns the current value
+ * Returns the current value.
*
* This method will always return a string, or null. If there were multiple
* values, it will automatically concatenate them (separated by comma).
@@ -196,7 +197,7 @@ class Parameter extends Node {
function getValue() {
if (is_array($this->value)) {
- return implode(',' , $this->value);
+ return implode(',', $this->value);
} else {
return $this->value;
}
@@ -207,6 +208,7 @@ class Parameter extends Node {
* Sets multiple values for this parameter.
*
* @param array $value
+ *
* @return void
*/
function setParts(array $value) {
@@ -235,12 +237,13 @@ class Parameter extends Node {
}
/**
- * Adds a value to this parameter
+ * Adds a value to this parameter.
*
* If the argument is specified as an array, all items will be added to the
* parameter value list.
*
* @param string|array $part
+ *
* @return void
*/
function addValue($part) {
@@ -261,6 +264,7 @@ class Parameter extends Node {
* 'WORK' or 'FAX'.
*
* @param string $value
+ *
* @return bool
*/
function has($value) {
@@ -281,7 +285,7 @@ class Parameter extends Node {
$value = $this->getParts();
- if (count($value)===0) {
+ if (count($value) === 0) {
return $this->name . '=';
}
@@ -295,7 +299,7 @@ class Parameter extends Node {
$value,
function($out, $item) {
- if (!is_null($out)) $out.=',';
+ if (!is_null($out)) $out .= ',';
// If there's no special characters in the string, we'll use the simple
// format.
@@ -314,11 +318,11 @@ class Parameter extends Node {
// severaly trips on + characters not being quoted, so we
// added + as well.
if (!preg_match('#(?: [\n":;\^,\+] )#x', $item)) {
- return $out.$item;
+ return $out . $item;
} else {
// Enclosing in double-quotes, and using RFC6868 for encoding any
// special characters
- $out.='"' . strtr(
+ $out .= '"' . strtr(
$item,
[
'^' => '^^',
@@ -351,6 +355,7 @@ class Parameter extends Node {
* xCal documents.
*
* @param Xml\Writer $writer XML writer.
+ *
* @return void
*/
function xmlSerialize(Xml\Writer $writer) {
@@ -362,7 +367,7 @@ class Parameter extends Node {
}
/**
- * Called when this object is being cast to a string
+ * Called when this object is being cast to a string.
*
* @return string
*/
@@ -373,7 +378,7 @@ class Parameter extends Node {
}
/**
- * Returns the iterator for this object
+ * Returns the iterator for this object.
*
* @return ElementList
*/
diff --git a/lib/Parser/Json.php b/lib/Parser/Json.php
index 9141f8f..4b7bfbd 100644
--- a/lib/Parser/Json.php
+++ b/lib/Parser/Json.php
@@ -2,11 +2,10 @@
namespace Sabre\VObject\Parser;
-use
- Sabre\VObject\Component\VCalendar,
- Sabre\VObject\Component\VCard,
- Sabre\VObject\ParseException,
- Sabre\VObject\EofException;
+use Sabre\VObject\Component\VCalendar;
+use Sabre\VObject\Component\VCard;
+use Sabre\VObject\ParseException;
+use Sabre\VObject\EofException;
/**
* Json Parser.
@@ -43,9 +42,10 @@ class Json extends Parser {
*
* @param resource|string|array|null $input
* @param int $options
+ *
* @return Sabre\VObject\Document
*/
- public function parse($input = null, $options = 0) {
+ function parse($input = null, $options = 0) {
if (!is_null($input)) {
$this->setInput($input);
@@ -58,7 +58,7 @@ class Json extends Parser {
$this->options = $options;
}
- switch($this->input[0]) {
+ switch ($this->input[0]) {
case 'vcalendar' :
$this->root = new VCalendar([], false);
break;
@@ -69,10 +69,10 @@ class Json extends Parser {
throw new ParseException('The root component must either be a vcalendar, or a vcard');
}
- foreach($this->input[1] as $prop) {
+ foreach ($this->input[1] as $prop) {
$this->root->add($this->parseProperty($prop));
}
- if (isset($this->input[2])) foreach($this->input[2] as $comp) {
+ if (isset($this->input[2])) foreach ($this->input[2] as $comp) {
$this->root->add($this->parseComponent($comp));
}
@@ -84,12 +84,13 @@ class Json extends Parser {
}
/**
- * Parses a component
+ * Parses a component.
*
* @param array $jComp
+ *
* @return \Sabre\VObject\Component
*/
- public function parseComponent(array $jComp) {
+ function parseComponent(array $jComp) {
// We can remove $self from PHP 5.4 onward.
$self = $this;
@@ -124,9 +125,10 @@ class Json extends Parser {
* Parses properties.
*
* @param array $jProp
+ *
* @return \Sabre\VObject\Property
*/
- public function parseProperty(array $jProp) {
+ function parseProperty(array $jProp) {
list(
$propertyName,
@@ -177,9 +179,10 @@ class Json extends Parser {
* Sets the input data.
*
* @param resource|string|array $input
+ *
* @return void
*/
- public function setInput($input) {
+ function setInput($input) {
if (is_resource($input)) {
$input = stream_get_contents($input);
diff --git a/lib/Parser/MimeDir.php b/lib/Parser/MimeDir.php
index 5fb4e1b..986708f 100644
--- a/lib/Parser/MimeDir.php
+++ b/lib/Parser/MimeDir.php
@@ -2,12 +2,11 @@
namespace Sabre\VObject\Parser;
-use
- Sabre\VObject\ParseException,
- Sabre\VObject\EofException,
- Sabre\VObject\Component,
- Sabre\VObject\Component\VCalendar,
- Sabre\VObject\Component\VCard;
+use Sabre\VObject\ParseException;
+use Sabre\VObject\EofException;
+use Sabre\VObject\Component;
+use Sabre\VObject\Component\VCalendar;
+use Sabre\VObject\Component\VCard;
/**
* MimeDir parser.
@@ -46,9 +45,10 @@ class MimeDir extends Parser {
*
* @param string|resource|null $input
* @param int $options
+ *
* @return Sabre\VObject\Document
*/
- public function parse($input = null, $options = 0) {
+ function parse($input = null, $options = 0) {
$this->root = null;
@@ -70,9 +70,10 @@ class MimeDir extends Parser {
* Sets the input buffer. Must be a string or stream.
*
* @param resource|string $input
+ *
* @return void
*/
- public function setInput($input) {
+ function setInput($input) {
// Resetting the parser
$this->lineIndex = 0;
@@ -103,14 +104,14 @@ class MimeDir extends Parser {
// BOM is ZERO WIDTH NO-BREAK SPACE (U+FEFF).
// It's 0xEF 0xBB 0xBF in UTF-8 hex.
- if ( 3 <= strlen($line)
+ if (3 <= strlen($line)
&& ord($line[0]) === 0xef
&& ord($line[1]) === 0xbb
&& ord($line[2]) === 0xbf) {
$line = substr($line, 3);
}
- switch(strtoupper($line)) {
+ switch (strtoupper($line)) {
case 'BEGIN:VCALENDAR' :
$class = isset(VCalendar::$componentMap['VCALENDAR'])
? VCalendar::$componentMap[$name]
@@ -127,11 +128,11 @@ class MimeDir extends Parser {
$this->root = new $class([], false);
- while(true) {
+ while (true) {
// Reading until we hit END:
$line = $this->readLine();
- if (strtoupper(substr($line,0,4)) === 'END:') {
+ if (strtoupper(substr($line, 0, 4)) === 'END:') {
break;
}
$result = $this->parseLine($line);
@@ -142,7 +143,7 @@ class MimeDir extends Parser {
}
$name = strtoupper(substr($line, 4));
- if ($name!==$this->root->name) {
+ if ($name !== $this->root->name) {
throw new ParseException('Invalid MimeDir file. expected: "END:' . $this->root->name . '" got: "END:' . $name . '"');
}
@@ -150,9 +151,10 @@ class MimeDir extends Parser {
/**
* Parses a line, and if it hits a component, it will also attempt to parse
- * the entire component
+ * the entire component.
*
* @param string $line Unfolded line
+ *
* @return Node
*/
protected function parseLine($line) {
@@ -160,13 +162,13 @@ class MimeDir extends Parser {
// Start of a new component
if (strtoupper(substr($line, 0, 6)) === 'BEGIN:') {
- $component = $this->root->createComponent(substr($line,6), [], false);
+ $component = $this->root->createComponent(substr($line, 6), [], false);
- while(true) {
+ while (true) {
// Reading until we hit END:
$line = $this->readLine();
- if (strtoupper(substr($line,0,4)) === 'END:') {
+ if (strtoupper(substr($line, 0, 4)) === 'END:') {
break;
}
$result = $this->parseLine($line);
@@ -177,7 +179,7 @@ class MimeDir extends Parser {
}
$name = strtoupper(substr($line, 4));
- if ($name!==$component->name) {
+ if ($name !== $component->name) {
throw new ParseException('Invalid MimeDir file. expected: "END:' . $component->name . '" got: "END:' . $name . '"');
}
@@ -233,6 +235,7 @@ class MimeDir extends Parser {
* This method strips any newlines and also takes care of unfolding.
*
* @throws \Sabre\VObject\EofException
+ *
* @return string
*/
protected function readLine() {
@@ -246,7 +249,7 @@ class MimeDir extends Parser {
$rawLine = fgets($this->input);
- if ($eof || (feof($this->input) && $rawLine===false)) {
+ if ($eof || (feof($this->input) && $rawLine === false)) {
throw new EofException('End of document reached prematurely');
}
if ($rawLine === false) {
@@ -316,9 +319,9 @@ class MimeDir extends Parser {
preg_match_all($regex, $line, $matches, PREG_SET_ORDER);
$property = [
- 'name' => null,
+ 'name' => null,
'parameters' => [],
- 'value' => null
+ 'value' => null
];
$lastParam = null;
@@ -330,7 +333,7 @@ class MimeDir extends Parser {
* sub-pattern matched, the subsequent named patterns will not show up
* in the result.
*/
- foreach($matches as $match) {
+ foreach ($matches as $match) {
if (isset($match['paramValue'])) {
if ($match['paramValue'] && $match['paramValue'][0] === '"') {
@@ -393,7 +396,7 @@ class MimeDir extends Parser {
$namedParameters = [];
$namelessParameters = [];
- foreach($property['parameters'] as $name=>$value) {
+ foreach ($property['parameters'] as $name => $value) {
if (!is_null($value)) {
$namedParameters[$name] = $value;
} else {
@@ -403,7 +406,7 @@ class MimeDir extends Parser {
$propObj = $this->root->createProperty($property['name'], null, $namedParameters);
- foreach($namelessParameters as $namelessParameter) {
+ foreach ($namelessParameters as $namelessParameter) {
$propObj->add(null, $namelessParameter);
}
@@ -476,9 +479,10 @@ class MimeDir extends Parser {
*
* @param string $input
* @param string $delimiter
+ *
* @return string|string[]
*/
- static public function unescapeValue($input, $delimiter = ';') {
+ static function unescapeValue($input, $delimiter = ';') {
$regex = '# (?: (\\\\ (?: \\\\ | N | n | ; | , ) )';
if ($delimiter) {
@@ -491,21 +495,21 @@ class MimeDir extends Parser {
$resultArray = [];
$result = '';
- foreach($matches as $match) {
+ foreach ($matches as $match) {
switch ($match) {
case '\\\\' :
- $result .='\\';
+ $result .= '\\';
break;
case '\N' :
case '\n' :
- $result .="\n";
+ $result .= "\n";
break;
case '\;' :
- $result .=';';
+ $result .= ';';
break;
case '\,' :
- $result .=',';
+ $result .= ',';
break;
case $delimiter :
$resultArray[] = $result;
@@ -555,6 +559,7 @@ class MimeDir extends Parser {
* * " is encoded as ^'
*
* @param string $input
+ *
* @return void
*/
private function unescapeParam($input) {
@@ -563,7 +568,7 @@ class MimeDir extends Parser {
preg_replace_callback(
'#(\^(\^|n|\'))#',
function($matches) {
- switch($matches[2]) {
+ switch ($matches[2]) {
case 'n' :
return "\n";
case '^' :
@@ -613,11 +618,11 @@ class MimeDir extends Parser {
// missing a whitespace. So if 'forgiving' is turned on, we will take
// those as well.
if ($this->options & self::OPTION_FORGIVING) {
- while(substr($value,-1) === '=') {
+ while (substr($value, -1) === '=') {
// Reading the line
$this->readLine();
// Grabbing the raw form
- $value.="\n" . $this->rawLine;
+ $value .= "\n" . $this->rawLine;
}
}
diff --git a/lib/Parser/Parser.php b/lib/Parser/Parser.php
index 4dcddad..f6eb2e9 100644
--- a/lib/Parser/Parser.php
+++ b/lib/Parser/Parser.php
@@ -29,7 +29,7 @@ abstract class Parser {
const OPTION_IGNORE_INVALID_LINES = 2;
/**
- * Bitmask of parser options
+ * Bitmask of parser options.
*
* @var int
*/
@@ -42,9 +42,10 @@ abstract class Parser {
*
* @param mixed $input
* @param int $options Any parser options (OPTION constants).
+ *
* @return void
*/
- public function __construct($input = null, $options = 0) {
+ function __construct($input = null, $options = 0) {
if (!is_null($input)) {
$this->setInput($input);
@@ -62,16 +63,18 @@ abstract class Parser {
*
* @param mixed $input
* @param int $options
+ *
* @return array
*/
- abstract public function parse($input = null, $options = 0);
+ abstract function parse($input = null, $options = 0);
/**
* Sets the input data.
*
* @param mixed $input
+ *
* @return void
*/
- abstract public function setInput($input);
+ abstract function setInput($input);
}
diff --git a/lib/Parser/XML.php b/lib/Parser/XML.php
index 59ce146..07ab6bc 100644
--- a/lib/Parser/XML.php
+++ b/lib/Parser/XML.php
@@ -2,13 +2,12 @@
namespace Sabre\VObject\Parser;
-use
- Sabre\VObject\Component,
- Sabre\VObject\Component\VCalendar,
- Sabre\VObject\Component\VCard,
- Sabre\VObject\EofException,
- Sabre\VObject\ParseException,
- Sabre\Xml as SabreXml;
+use Sabre\VObject\Component;
+use Sabre\VObject\Component\VCalendar;
+use Sabre\VObject\Component\VCard;
+use Sabre\VObject\EofException;
+use Sabre\VObject\ParseException;
+use Sabre\Xml as SabreXml;
/**
* XML Parser.
@@ -52,9 +51,10 @@ class XML extends Parser {
*
* @param mixed $input
* @param int $options Any parser options (OPTION constants).
+ *
* @return void
*/
- public function __construct($input = null, $options = 0) {
+ function __construct($input = null, $options = 0) {
if (0 === $options) {
$options = parent::OPTION_FORGIVING;
@@ -69,10 +69,12 @@ class XML extends Parser {
*
* @param resource|string $input
* @param int $options
+ *
* @throws \Exception
+ *
* @return Sabre\VObject\Document
*/
- public function parse($input = null, $options = 0) {
+ function parse($input = null, $options = 0) {
if (!is_null($input)) {
$this->setInput($input);
@@ -119,6 +121,7 @@ class XML extends Parser {
* Parse a xCalendar component.
*
* @param Component $parentComponent
+ *
* @return void
*/
protected function parseVCalendarComponents(Component $parentComponent) {
@@ -145,6 +148,7 @@ class XML extends Parser {
* Parse a xCard component.
*
* @param Component $parentComponent
+ *
* @return void
*/
protected function parseVCardComponents(Component $parentComponent) {
@@ -159,6 +163,7 @@ class XML extends Parser {
*
* @param Component $parentComponent
* @param string $propertyNamePrefix
+ *
* @return void
*/
protected function parseProperties(Component $parentComponent, $propertyNamePrefix = '') {
@@ -173,7 +178,7 @@ class XML extends Parser {
$propertyType = 'text';
// A property which is not part of the standard.
- if ( $namespace !== self::XCAL_NAMESPACE
+ if ($namespace !== self::XCAL_NAMESPACE
&& $namespace !== self::XCARD_NAMESPACE) {
$propertyName = 'xml';
@@ -183,7 +188,7 @@ class XML extends Parser {
$value .= ' ' . $attributeName . '="' . str_replace('"', '\"', $attributeValue) . '"';
}
- $value .= '>' . $xmlProperty['value'] . '</' . $tagName. '>';
+ $value .= '>' . $xmlProperty['value'] . '</' . $tagName . '>';
$propertyValue = [$value];
@@ -218,7 +223,7 @@ class XML extends Parser {
// Collect parameters.
foreach ($xmlProperty['value'] as $i => $xmlPropertyChild) {
- if ( !is_array($xmlPropertyChild)
+ if (!is_array($xmlPropertyChild)
|| 'parameters' !== static::getTagName($xmlPropertyChild['name']))
continue;
@@ -228,7 +233,7 @@ class XML extends Parser {
$propertyParameterValues = [];
- foreach($xmlParameter['value'] as $xmlParameterValues) {
+ foreach ($xmlParameter['value'] as $xmlParameterValues) {
$propertyParameterValues[] = $xmlParameterValues['value'];
}
@@ -329,6 +334,7 @@ class XML extends Parser {
* Parse a component.
*
* @param Component $parentComponent
+ *
* @return void
*/
protected function parseComponent(Component $parentComponent) {
@@ -361,6 +367,7 @@ class XML extends Parser {
* @param array $parameters
* @param string $type
* @param mixed $value
+ *
* @return void
*/
protected function createProperty(Component $parentComponent, $name, $parameters, $type, $value) {
@@ -380,9 +387,10 @@ class XML extends Parser {
* Sets the input data.
*
* @param resource|string $input
+ *
* @return void
*/
- public function setInput($input) {
+ function setInput($input) {
if (is_resource($input)) {
$input = stream_get_contents($input);
@@ -408,9 +416,10 @@ class XML extends Parser {
* Get tag name from a Clark notation.
*
* @param string $clarkedTagName
+ *
* @return string
*/
- static protected function getTagName($clarkedTagName) {
+ protected static function getTagName($clarkedTagName) {
list(, $tagName) = SabreXml\Util::parseClarkNotation($clarkedTagName);
return $tagName;
diff --git a/lib/Parser/XML/Element/KeyValue.php b/lib/Parser/XML/Element/KeyValue.php
index e2df687..c1d9433 100644
--- a/lib/Parser/XML/Element/KeyValue.php
+++ b/lib/Parser/XML/Element/KeyValue.php
@@ -34,6 +34,7 @@ class KeyValue extends SabreXml\Element\KeyValue {
* the next element.
*
* @param XML\Reader $reader
+ *
* @return mixed
*/
static function xmlDeserialize(SabreXml\Reader $reader) {
diff --git a/lib/Property.php b/lib/Property.php
index 46469ca..b10b191 100644
--- a/lib/Property.php
+++ b/lib/Property.php
@@ -5,7 +5,7 @@ namespace Sabre\VObject;
use Sabre\Xml;
/**
- * Property
+ * Property.
*
* A property is always in a KEY:VALUE structure, and may optionally contain
* parameters.
@@ -35,14 +35,14 @@ abstract class Property extends Node {
public $group;
/**
- * List of parameters
+ * List of parameters.
*
* @var array
*/
public $parameters = [];
/**
- * Current value
+ * Current value.
*
* @var mixed
*/
@@ -66,6 +66,7 @@ abstract class Property extends Node {
* @param string|array|null $value
* @param array $parameters List of parameters
* @param string $group The vcard property group
+ *
* @return void
*/
function __construct(Component $root, $name, $value = null, array $parameters = [], $group = null) {
@@ -75,7 +76,7 @@ abstract class Property extends Node {
$this->root = $root;
- foreach($parameters as $k=>$v) {
+ foreach ($parameters as $k => $v) {
$this->add($k, $v);
}
@@ -91,6 +92,7 @@ abstract class Property extends Node {
* This may be either a single, or multiple strings in an array.
*
* @param string|array $value
+ *
* @return void
*/
function setValue($value) {
@@ -113,9 +115,9 @@ abstract class Property extends Node {
function getValue() {
if (is_array($this->value)) {
- if (count($this->value)==0) {
- return null;
- } elseif (count($this->value)===1) {
+ if (count($this->value) == 0) {
+ return;
+ } elseif (count($this->value) === 1) {
return $this->value[0];
} else {
return $this->getRawMimeDirValue($this->value);
@@ -130,6 +132,7 @@ abstract class Property extends Node {
* Sets a multi-valued property.
*
* @param array $parts
+ *
* @return void
*/
function setParts(array $parts) {
@@ -186,7 +189,7 @@ abstract class Property extends Node {
}
/**
- * Returns an iterable list of children
+ * Returns an iterable list of children.
*
* @return array
*/
@@ -213,6 +216,7 @@ abstract class Property extends Node {
* not yet done, but parameters are not included.
*
* @param string $val
+ *
* @return void
*/
abstract function setRawMimeDirValue($val);
@@ -234,22 +238,22 @@ abstract class Property extends Node {
$str = $this->name;
if ($this->group) $str = $this->group . '.' . $this->name;
- foreach($this->parameters as $param) {
+ foreach ($this->parameters as $param) {
- $str.=';' . $param->serialize();
+ $str .= ';' . $param->serialize();
}
- $str.=':' . $this->getRawMimeDirValue();
+ $str .= ':' . $this->getRawMimeDirValue();
$out = '';
- while(strlen($str)>0) {
- if (strlen($str)>75) {
- $out.= mb_strcut($str,0,75,'utf-8') . "\r\n";
- $str = ' ' . mb_strcut($str,75,strlen($str),'utf-8');
+ while (strlen($str) > 0) {
+ if (strlen($str) > 75) {
+ $out .= mb_strcut($str, 0, 75, 'utf-8') . "\r\n";
+ $str = ' ' . mb_strcut($str, 75, strlen($str), 'utf-8');
} else {
- $out.=$str . "\r\n";
- $str='';
+ $out .= $str . "\r\n";
+ $str = '';
break;
}
}
@@ -277,11 +281,12 @@ abstract class Property extends Node {
* The value must always be an array.
*
* @param array $value
+ *
* @return void
*/
function setJsonValue(array $value) {
- if (count($value)===1) {
+ if (count($value) === 1) {
$this->setValue(reset($value));
} else {
$this->setValue($value);
@@ -299,7 +304,7 @@ abstract class Property extends Node {
$parameters = [];
- foreach($this->parameters as $parameter) {
+ foreach ($this->parameters as $parameter) {
if ($parameter->name === 'VALUE') {
continue;
}
@@ -326,6 +331,7 @@ abstract class Property extends Node {
* object.
*
* @param array $value
+ *
* @return void
*/
function setXmlValue(array $value) {
@@ -339,13 +345,14 @@ abstract class Property extends Node {
* xCal documents.
*
* @param Xml\Writer $writer XML writer.
+ *
* @return void
*/
function xmlSerialize(Xml\Writer $writer) {
$parameters = [];
- foreach($this->parameters as $parameter) {
+ foreach ($this->parameters as $parameter) {
if ($parameter->name === 'VALUE') {
continue;
@@ -383,6 +390,7 @@ abstract class Property extends Node {
* create xCard or xCal documents.
*
* @param Xml\Writer $writer XML writer.
+ *
* @return void
*/
protected function xmlSerializeValue(Xml\Writer $writer) {
@@ -390,7 +398,7 @@ abstract class Property extends Node {
$valueType = strtolower($this->getValueType());
foreach ($this->getJsonValue() as $values) {
- foreach((array)$values as $value) {
+ foreach ((array)$values as $value) {
$writer->writeElement($valueType, $value);
}
}
@@ -415,9 +423,10 @@ abstract class Property extends Node {
/* ArrayAccess interface {{{ */
/**
- * Checks if an array element exists
+ * Checks if an array element exists.
*
* @param mixed $name
+ *
* @return bool
*/
function offsetExists($name) {
@@ -426,7 +435,7 @@ abstract class Property extends Node {
$name = strtoupper($name);
- foreach($this->parameters as $parameter) {
+ foreach ($this->parameters as $parameter) {
if ($parameter->name == $name) return true;
}
return false;
@@ -439,6 +448,7 @@ abstract class Property extends Node {
* If the parameter does not exist, null is returned.
*
* @param string $name
+ *
* @return Node
*/
function offsetGet($name) {
@@ -447,7 +457,7 @@ abstract class Property extends Node {
$name = strtoupper($name);
if (!isset($this->parameters[$name])) {
- return null;
+ return;
}
return $this->parameters[$name];
@@ -455,10 +465,11 @@ abstract class Property extends Node {
}
/**
- * Creates a new parameter
+ * Creates a new parameter.
*
* @param string $name
* @param mixed $value
+ *
* @return void
*/
function offsetSet($name, $value) {
@@ -478,9 +489,10 @@ abstract class Property extends Node {
}
/**
- * Removes one or more parameters with the specified name
+ * Removes one or more parameters with the specified name.
*
* @param string $name
+ *
* @return void
*/
function offsetUnset($name) {
@@ -507,7 +519,7 @@ abstract class Property extends Node {
*/
function __clone() {
- foreach($this->parameters as $key=>$child) {
+ foreach ($this->parameters as $key => $child) {
$this->parameters[$key] = clone $child;
$this->parameters[$key]->parent = $this;
}
@@ -529,6 +541,7 @@ abstract class Property extends Node {
* * node - (reference to the offending node)
*
* @param int $options
+ *
* @return array
*/
function validate($options = 0) {
@@ -557,18 +570,18 @@ abstract class Property extends Node {
}
$warnings[] = [
- 'level' => $level,
+ 'level' => $level,
'message' => $message,
- 'node' => $this,
+ 'node' => $this,
];
}
// Checking if the propertyname does not contain any invalid bytes.
if (!preg_match('/^([A-Z0-9-]+)$/', $this->name)) {
$warnings[] = [
- 'level' => 1,
+ 'level' => 1,
'message' => 'The propertyname: ' . $this->name . ' contains invalid characters. Only A-Z, 0-9 and - are allowed',
- 'node' => $this,
+ 'node' => $this,
];
if ($options & self::REPAIR) {
// Uppercasing and converting underscores to dashes.
@@ -584,43 +597,43 @@ abstract class Property extends Node {
if ($encoding = $this->offsetGet('ENCODING')) {
- if ($this->root->getDocumentType()===Document::VCARD40) {
- $warnings[] = array(
- 'level' => 1,
+ if ($this->root->getDocumentType() === Document::VCARD40) {
+ $warnings[] = [
+ 'level' => 1,
'message' => 'ENCODING parameter is not valid in vCard 4.',
- 'node' => $this
- );
+ 'node' => $this
+ ];
} else {
$encoding = (string)$encoding;
- $allowedEncoding = array();
+ $allowedEncoding = [];
- switch($this->root->getDocumentType()) {
+ switch ($this->root->getDocumentType()) {
case Document::ICALENDAR20 :
- $allowedEncoding = array('8BIT', 'BASE64');
+ $allowedEncoding = ['8BIT', 'BASE64'];
break;
case Document::VCARD21 :
- $allowedEncoding = array('QUOTED-PRINTABLE', 'BASE64', '8BIT');
+ $allowedEncoding = ['QUOTED-PRINTABLE', 'BASE64', '8BIT'];
break;
case Document::VCARD30 :
- $allowedEncoding = array('B');
+ $allowedEncoding = ['B'];
break;
}
if ($allowedEncoding && !in_array(strtoupper($encoding), $allowedEncoding)) {
- $warnings[] = array(
- 'level' => 1,
+ $warnings[] = [
+ 'level' => 1,
'message' => 'ENCODING=' . strtoupper($encoding) . ' is not valid for this document type.',
- 'node' => $this
- );
+ 'node' => $this
+ ];
}
}
}
// Validating inner parameters
- foreach($this->parameters as $param) {
+ foreach ($this->parameters as $param) {
$warnings = array_merge($warnings, $param->validate($options));
}
diff --git a/lib/Property/Binary.php b/lib/Property/Binary.php
index 62c5a1f..dc964a3 100644
--- a/lib/Property/Binary.php
+++ b/lib/Property/Binary.php
@@ -5,7 +5,7 @@ namespace Sabre\VObject\Property;
use Sabre\VObject\Property;
/**
- * BINARY property
+ * BINARY property.
*
* This object represents BINARY values.
*
@@ -34,13 +34,14 @@ class Binary extends Property {
* This may be either a single, or multiple strings in an array.
*
* @param string|array $value
+ *
* @return void
*/
- public function setValue($value) {
+ function setValue($value) {
- if(is_array($value)) {
+ if (is_array($value)) {
- if(count($value) === 1) {
+ if (count($value) === 1) {
$this->value = $value[0];
} else {
throw new \InvalidArgumentException('The argument must either be a string or an array with only one child');
@@ -61,9 +62,10 @@ class Binary extends Property {
* not yet done, but parameters are not included.
*
* @param string $val
+ *
* @return void
*/
- public function setRawMimeDirValue($val) {
+ function setRawMimeDirValue($val) {
$this->value = base64_decode($val);
@@ -74,7 +76,7 @@ class Binary extends Property {
*
* @return string
*/
- public function getRawMimeDirValue() {
+ function getRawMimeDirValue() {
return base64_encode($this->value);
@@ -88,7 +90,7 @@ class Binary extends Property {
*
* @return string
*/
- public function getValueType() {
+ function getValueType() {
return 'BINARY';
@@ -101,7 +103,7 @@ class Binary extends Property {
*
* @return array
*/
- public function getJsonValue() {
+ function getJsonValue() {
return [base64_encode($this->getValue())];
@@ -113,9 +115,10 @@ class Binary extends Property {
* The value must always be an array.
*
* @param array $value
+ *
* @return void
*/
- public function setJsonValue(array $value) {
+ function setJsonValue(array $value) {
$value = array_map('base64_decode', $value);
parent::setJsonValue($value);
diff --git a/lib/Property/Boolean.php b/lib/Property/Boolean.php
index c3b62bc..ba4e5cb 100644
--- a/lib/Property/Boolean.php
+++ b/lib/Property/Boolean.php
@@ -6,7 +6,7 @@ use
Sabre\VObject\Property;
/**
- * Boolean property
+ * Boolean property.
*
* This object represents BOOLEAN values. These are always the case-insenstive
* string TRUE or FALSE.
@@ -26,9 +26,10 @@ class Boolean extends Property {
* not yet done, but parameters are not included.
*
* @param string $val
+ *
* @return void
*/
- public function setRawMimeDirValue($val) {
+ function setRawMimeDirValue($val) {
$val = strtoupper($val) === 'TRUE' ? true : false;
$this->setValue($val);
@@ -40,7 +41,7 @@ class Boolean extends Property {
*
* @return string
*/
- public function getRawMimeDirValue() {
+ function getRawMimeDirValue() {
return $this->value ? 'TRUE' : 'FALSE';
@@ -54,7 +55,7 @@ class Boolean extends Property {
*
* @return string
*/
- public function getValueType() {
+ function getValueType() {
return 'BOOLEAN';
@@ -65,6 +66,7 @@ class Boolean extends Property {
* object.
*
* @param array $value
+ *
* @return void
*/
function setXmlValue(array $value) {
diff --git a/lib/Property/FlatText.php b/lib/Property/FlatText.php
index 146969c..e243201 100644
--- a/lib/Property/FlatText.php
+++ b/lib/Property/FlatText.php
@@ -3,7 +3,7 @@
namespace Sabre\VObject\Property;
/**
- * FlatText property
+ * FlatText property.
*
* This object represents certain TEXT values.
*
@@ -25,7 +25,7 @@ namespace Sabre\VObject\Property;
class FlatText extends Text {
/**
- * Field separator
+ * Field separator.
*
* @var string
*/
@@ -37,9 +37,10 @@ class FlatText extends Text {
* Overriding this so we're not splitting on a ; delimiter.
*
* @param string $val
+ *
* @return void
*/
- public function setQuotedPrintableValue($val) {
+ function setQuotedPrintableValue($val) {
$val = quoted_printable_decode($val);
$this->setValue($val);
diff --git a/lib/Property/Float.php b/lib/Property/Float.php
index de795f0..3d8ad0b 100644
--- a/lib/Property/Float.php
+++ b/lib/Property/Float.php
@@ -2,12 +2,11 @@
namespace Sabre\VObject\Property;
-use
- Sabre\VObject\Property,
- Sabre\Xml;
+use Sabre\VObject\Property;
+use Sabre\Xml;
/**
- * Float property
+ * Float property.
*
* This object represents FLOAT values. These can be 1 or more floating-point
* numbers.
@@ -33,12 +32,13 @@ class Float extends Property {
* not yet done, but parameters are not included.
*
* @param string $val
+ *
* @return void
*/
- public function setRawMimeDirValue($val) {
+ function setRawMimeDirValue($val) {
$val = explode($this->delimiter, $val);
- foreach($val as &$item) {
+ foreach ($val as &$item) {
$item = (float)$item;
}
$this->setParts($val);
@@ -50,7 +50,7 @@ class Float extends Property {
*
* @return string
*/
- public function getRawMimeDirValue() {
+ function getRawMimeDirValue() {
return implode(
$this->delimiter,
@@ -67,7 +67,7 @@ class Float extends Property {
*
* @return string
*/
- public function getValueType() {
+ function getValueType() {
return 'FLOAT';
@@ -80,7 +80,7 @@ class Float extends Property {
*
* @return array
*/
- public function getJsonValue() {
+ function getJsonValue() {
$val = array_map('floatval', $this->getParts());
@@ -101,6 +101,7 @@ class Float extends Property {
* object.
*
* @param array $value
+ *
* @return void
*/
function setXmlValue(array $value) {
@@ -115,6 +116,7 @@ class Float extends Property {
* create xCard or xCal documents.
*
* @param Xml\Writer $writer XML writer.
+ *
* @return void
*/
protected function xmlSerializeValue(Xml\Writer $writer) {
diff --git a/lib/Property/ICalendar/CalAddress.php b/lib/Property/ICalendar/CalAddress.php
index b7c47ce..0faad5a 100644
--- a/lib/Property/ICalendar/CalAddress.php
+++ b/lib/Property/ICalendar/CalAddress.php
@@ -6,7 +6,7 @@ use
Sabre\VObject\Property\Text;
/**
- * CalAddress property
+ * CalAddress property.
*
* This object encodes CAL-ADDRESS values, as defined in rfc5545
*
@@ -32,7 +32,7 @@ class CalAddress extends Text {
*
* @return string
*/
- public function getValueType() {
+ function getValueType() {
return 'CAL-ADDRESS';
@@ -48,7 +48,7 @@ class CalAddress extends Text {
*
* @return string
*/
- public function getNormalizedValue() {
+ function getNormalizedValue() {
$input = $this->getValue();
if (!strpos($input, ':')) {
diff --git a/lib/Property/ICalendar/Date.php b/lib/Property/ICalendar/Date.php
index 1a238e9..0e3f2cb 100644
--- a/lib/Property/ICalendar/Date.php
+++ b/lib/Property/ICalendar/Date.php
@@ -3,7 +3,7 @@
namespace Sabre\VObject\Property\ICalendar;
/**
- * DateTime property
+ * DateTime property.
*
* This object represents DATE values, as defined here:
*
diff --git a/lib/Property/ICalendar/DateTime.php b/lib/Property/ICalendar/DateTime.php
index 804d7a9..4f46d3a 100644
--- a/lib/Property/ICalendar/DateTime.php
+++ b/lib/Property/ICalendar/DateTime.php
@@ -9,7 +9,7 @@ use Sabre\VObject\DateTimeParser;
use Sabre\VObject\TimeZoneUtil;
/**
- * DateTime property
+ * DateTime property.
*
* This object represents DATE-TIME values, as defined here:
*
@@ -39,6 +39,7 @@ class DateTime extends Property {
* You may also specify DateTime objects here.
*
* @param array $parts
+ *
* @return void
*/
function setParts(array $parts) {
@@ -59,6 +60,7 @@ class DateTime extends Property {
* Instead of strings, you may also use DateTime here.
*
* @param string|array|DateTimeInterface $value
+ *
* @return void
*/
function setValue($value) {
@@ -80,6 +82,7 @@ class DateTime extends Property {
* not yet done, but parameters are not included.
*
* @param string $val
+ *
* @return void
*/
function setRawMimeDirValue($val) {
@@ -115,13 +118,13 @@ class DateTime extends Property {
*
* Note that DATE is always floating.
*/
- public function isFloating() {
+ function isFloating() {
return
!$this->hasTime() ||
(
!isset($this['TZID']) &&
- strpos($this->getValue(),'Z')===false
+ strpos($this->getValue(), 'Z') === false
);
}
@@ -138,12 +141,13 @@ class DateTime extends Property {
* figure out the exact date.
*
* @param DateTimeZone $timeZone
+ *
* @return DateTimeImmutable
*/
function getDateTime(DateTimeZone $timeZone = null) {
$dt = $this->getDateTimes($timeZone);
- if (!$dt) return null;
+ if (!$dt) return;
return $dt[0];
@@ -157,6 +161,7 @@ class DateTime extends Property {
* figure out the exact date.
*
* @param DateTimeZone $timeZone
+ *
* @return DateTimeImmutable[]
* @return \DateTime[]
*/
@@ -170,7 +175,7 @@ class DateTime extends Property {
}
$dts = [];
- foreach($this->getParts() as $part) {
+ foreach ($this->getParts() as $part) {
$dts[] = DateTimeParser::parse($part, $timeZone);
}
return $dts;
@@ -182,6 +187,7 @@ class DateTime extends Property {
*
* @param DateTimeInterface $dt
* @param bool isFloating If set to true, timezones will be ignored.
+ *
* @return void
*/
function setDateTime(DateTimeInterface $dt, $isFloating = false) {
@@ -198,18 +204,19 @@ class DateTime extends Property {
*
* @param DateTimeInterface[] $dt
* @param bool isFloating If set to true, timezones will be ignored.
+ *
* @return void
*/
function setDateTimes(array $dt, $isFloating = false) {
$values = [];
- if($this->hasTime()) {
+ if ($this->hasTime()) {
$tz = null;
$isUtc = false;
- foreach($dt as $d) {
+ foreach ($dt as $d) {
if ($isFloating) {
$values[] = $d->format('Ymd\\THis');
@@ -217,7 +224,7 @@ class DateTime extends Property {
}
if (is_null($tz)) {
$tz = $d->getTimeZone();
- $isUtc = in_array($tz->getName() , ['UTC', 'GMT', 'Z']);
+ $isUtc = in_array($tz->getName(), ['UTC', 'GMT', 'Z']);
if (!$isUtc) {
$this->offsetSet('TZID', $tz->getName());
}
@@ -238,7 +245,7 @@ class DateTime extends Property {
} else {
- foreach($dt as $d) {
+ foreach ($dt as $d) {
$values[] = $d->format('Ymd');
@@ -261,7 +268,7 @@ class DateTime extends Property {
*/
function getValueType() {
- return $this->hasTime()?'DATE-TIME':'DATE';
+ return $this->hasTime() ? 'DATE-TIME' : 'DATE';
}
@@ -279,13 +286,13 @@ class DateTime extends Property {
$isFloating = $this->isFloating();
$tz = $dts[0]->getTimeZone();
- $isUtc = $isFloating ? false : in_array($tz->getName() , ['UTC', 'GMT', 'Z']);
+ $isUtc = $isFloating ? false : in_array($tz->getName(), ['UTC', 'GMT', 'Z']);
return array_map(
function(DateTimeInterface $dt) use ($hasTime, $isUtc) {
if ($hasTime) {
- return $dt->format('Y-m-d\\TH:i:s') . ($isUtc?'Z':'');
+ return $dt->format('Y-m-d\\TH:i:s') . ($isUtc ? 'Z' : '');
} else {
return $dt->format('Y-m-d');
}
@@ -302,6 +309,7 @@ class DateTime extends Property {
* The value must always be an array.
*
* @param array $value
+ *
* @return void
*/
function setJsonValue(array $value) {
@@ -314,7 +322,7 @@ class DateTime extends Property {
array_map(
function($item) {
- return strtr($item, [':'=>'', '-'=>'']);
+ return strtr($item, [':' => '', '-' => '']);
},
$value
@@ -329,12 +337,13 @@ class DateTime extends Property {
*
* @param string $name
* @param mixed $value
+ *
* @return void
*/
function offsetSet($name, $value) {
parent::offsetSet($name, $value);
- if (strtoupper($name)!=='VALUE') {
+ if (strtoupper($name) !== 'VALUE') {
return;
}
@@ -362,6 +371,7 @@ class DateTime extends Property {
* 3 - A severe issue.
*
* @param int $options
+ *
* @return array
*/
function validate($options = 0) {
@@ -370,8 +380,8 @@ class DateTime extends Property {
$valueType = $this->getValueType();
$values = $this->getParts();
try {
- foreach($values as $value) {
- switch($valueType) {
+ foreach ($values as $value) {
+ switch ($valueType) {
case 'DATE' :
DateTimeParser::parseDate($value);
break;
@@ -382,9 +392,9 @@ class DateTime extends Property {
}
} catch (\LogicException $e) {
$messages[] = [
- 'level' => 3,
+ 'level' => 3,
'message' => 'The supplied value (' . $value . ') is not a correct ' . $valueType,
- 'node' => $this,
+ 'node' => $this,
];
}
return $messages;
diff --git a/lib/Property/ICalendar/Duration.php b/lib/Property/ICalendar/Duration.php
index 2454f13..594ff4a 100644
--- a/lib/Property/ICalendar/Duration.php
+++ b/lib/Property/ICalendar/Duration.php
@@ -2,12 +2,11 @@
namespace Sabre\VObject\Property\ICalendar;
-use
- Sabre\VObject\Property,
- Sabre\VObject\DateTimeParser;
+use Sabre\VObject\Property;
+use Sabre\VObject\DateTimeParser;
/**
- * Duration property
+ * Duration property.
*
* This object represents DURATION values, as defined here:
*
@@ -34,6 +33,7 @@ class Duration extends Property {
* not yet done, but parameters are not included.
*
* @param string $val
+ *
* @return void
*/
function setRawMimeDirValue($val) {
diff --git a/lib/Property/ICalendar/Period.php b/lib/Property/ICalendar/Period.php
index 98ba313..b262f4d 100644
--- a/lib/Property/ICalendar/Period.php
+++ b/lib/Property/ICalendar/Period.php
@@ -2,13 +2,12 @@
namespace Sabre\VObject\Property\ICalendar;
-use
- Sabre\VObject\Property,
- Sabre\VObject\DateTimeParser,
- Sabre\Xml;
+use Sabre\VObject\Property;
+use Sabre\VObject\DateTimeParser;
+use Sabre\Xml;
/**
- * Period property
+ * Period property.
*
* This object represents PERIOD values, as defined here:
*
@@ -35,6 +34,7 @@ class Period extends Property {
* not yet done, but parameters are not included.
*
* @param string $val
+ *
* @return void
*/
function setRawMimeDirValue($val) {
@@ -74,6 +74,7 @@ class Period extends Property {
* The value must always be an array.
*
* @param array $value
+ *
* @return void
*/
function setJsonValue(array $value) {
@@ -100,14 +101,14 @@ class Period extends Property {
function getJsonValue() {
$return = [];
- foreach($this->getParts() as $item) {
+ foreach ($this->getParts() as $item) {
list($start, $end) = explode('/', $item, 2);
$start = DateTimeParser::parseDateTime($start);
// This is a duration value.
- if ($end[0]==='P') {
+ if ($end[0] === 'P') {
$return[] = [
$start->format('Y-m-d\\TH:i:s'),
$end
@@ -131,6 +132,7 @@ class Period extends Property {
* create xCard or xCal documents.
*
* @param Xml\Writer $writer XML writer.
+ *
* @return void
*/
protected function xmlSerializeValue(Xml\Writer $writer) {
diff --git a/lib/Property/ICalendar/Recur.php b/lib/Property/ICalendar/Recur.php
index e75b0c0..b75d786 100644
--- a/lib/Property/ICalendar/Recur.php
+++ b/lib/Property/ICalendar/Recur.php
@@ -2,12 +2,11 @@
namespace Sabre\VObject\Property\ICalendar;
-use
- Sabre\VObject\Property,
- Sabre\Xml;
+use Sabre\VObject\Property;
+use Sabre\Xml;
/**
- * Recur property
+ * Recur property.
*
* This object represents RECUR properties.
* These values are just used for RRULE and the now deprecated EXRULE.
@@ -31,6 +30,7 @@ class Recur extends Property {
* This may be either a single, or multiple strings in an array.
*
* @param string|array $value
+ *
* @return void
*/
function setValue($value) {
@@ -42,13 +42,13 @@ class Recur extends Property {
if (is_array($value)) {
$newVal = [];
- foreach($value as $k=>$v) {
+ foreach ($value as $k => $v) {
if (is_string($v)) {
$v = strtoupper($v);
// The value had multiple sub-values
- if (strpos($v,',')!==false) {
+ if (strpos($v, ',') !== false) {
$v = explode(',', $v);
}
} else {
@@ -80,10 +80,10 @@ class Recur extends Property {
function getValue() {
$out = [];
- foreach($this->value as $key=>$value) {
- $out[] = $key . '=' . (is_array($value)?implode(',', $value):$value);
+ foreach ($this->value as $key => $value) {
+ $out[] = $key . '=' . (is_array($value) ? implode(',', $value) : $value);
}
- return strtoupper(implode(';',$out));
+ return strtoupper(implode(';', $out));
}
@@ -91,6 +91,7 @@ class Recur extends Property {
* Sets a multi-valued property.
*
* @param array $parts
+ *
* @return void
*/
function setParts(array $parts) {
@@ -120,6 +121,7 @@ class Recur extends Property {
* not yet done, but parameters are not included.
*
* @param string $val
+ *
* @return void
*/
function setRawMimeDirValue($val) {
@@ -163,7 +165,7 @@ class Recur extends Property {
function getJsonValue() {
$values = [];
- foreach($this->getParts() as $k=>$v) {
+ foreach ($this->getParts() as $k => $v) {
$values[strtolower($k)] = $v;
}
return [$values];
@@ -175,6 +177,7 @@ class Recur extends Property {
* create xCard or xCal documents.
*
* @param Xml\Writer $writer XML writer.
+ *
* @return void
*/
protected function xmlSerializeValue(Xml\Writer $writer) {
@@ -191,13 +194,14 @@ class Recur extends Property {
* Parses an RRULE value string, and turns it into a struct-ish array.
*
* @param string $value
+ *
* @return array
*/
static function stringToArray($value) {
$value = strtoupper($value);
$newValue = [];
- foreach(explode(';', $value) as $part) {
+ foreach (explode(';', $value) as $part) {
// Skipping empty parts.
if (empty($part)) {
@@ -206,8 +210,8 @@ class Recur extends Property {
list($partName, $partValue) = explode('=', $part);
// The value itself had multiple values..
- if (strpos($partValue,',')!==false) {
- $partValue=explode(',', $partValue);
+ if (strpos($partValue, ',') !== false) {
+ $partValue = explode(',', $partValue);
}
$newValue[$partName] = $partValue;
diff --git a/lib/Property/Integer.php b/lib/Property/Integer.php
index 1d3e6cc..459040f 100644
--- a/lib/Property/Integer.php
+++ b/lib/Property/Integer.php
@@ -6,7 +6,7 @@ use
Sabre\VObject\Property;
/**
- * Integer property
+ * Integer property.
*
* This object represents INTEGER values. These are always a single integer.
* They may be preceeded by either + or -.
@@ -24,9 +24,10 @@ class Integer extends Property {
* not yet done, but parameters are not included.
*
* @param string $val
+ *
* @return void
*/
- public function setRawMimeDirValue($val) {
+ function setRawMimeDirValue($val) {
$this->setValue((int)$val);
@@ -37,7 +38,7 @@ class Integer extends Property {
*
* @return string
*/
- public function getRawMimeDirValue() {
+ function getRawMimeDirValue() {
return $this->value;
@@ -51,7 +52,7 @@ class Integer extends Property {
*
* @return string
*/
- public function getValueType() {
+ function getValueType() {
return 'INTEGER';
@@ -64,7 +65,7 @@ class Integer extends Property {
*
* @return array
*/
- public function getJsonValue() {
+ function getJsonValue() {
return [(int)$this->getValue()];
@@ -75,6 +76,7 @@ class Integer extends Property {
* object.
*
* @param array $value
+ *
* @return void
*/
function setXmlValue(array $value) {
diff --git a/lib/Property/Text.php b/lib/Property/Text.php
index 8e08ec7..81a810f 100644
--- a/lib/Property/Text.php
+++ b/lib/Property/Text.php
@@ -2,15 +2,14 @@
namespace Sabre\VObject\Property;
-use
- Sabre\VObject\Property,
- Sabre\VObject\Component,
- Sabre\VObject\Parser\MimeDir,
- Sabre\VObject\Document,
- Sabre\Xml;
+use Sabre\VObject\Property;
+use Sabre\VObject\Component;
+use Sabre\VObject\Parser\MimeDir;
+use Sabre\VObject\Document;
+use Sabre\Xml;
/**
- * Text property
+ * Text property.
*
* This object represents TEXT values.
*
@@ -54,7 +53,7 @@ class Text extends Property {
* @var array
*/
protected $minimumPropertyValues = [
- 'N' => 5,
+ 'N' => 5,
'ADR' => 7,
];
@@ -70,9 +69,10 @@ class Text extends Property {
* @param string|array|null $value
* @param array $parameters List of parameters
* @param string $group The vcard property group
+ *
* @return void
*/
- public function __construct(Component $root, $name, $value = null, array $parameters = [], $group = null) {
+ function __construct(Component $root, $name, $value = null, array $parameters = [], $group = null) {
// There's two types of multi-valued text properties:
// 1. multivalue properties.
@@ -94,9 +94,10 @@ class Text extends Property {
* not yet done, but parameters are not included.
*
* @param string $val
+ *
* @return void
*/
- public function setRawMimeDirValue($val) {
+ function setRawMimeDirValue($val) {
$this->setValue(MimeDir::unescapeValue($val, $this->delimiter));
@@ -106,9 +107,10 @@ class Text extends Property {
* Sets the value as a quoted-printable encoded string.
*
* @param string $val
+ *
* @return void
*/
- public function setQuotedPrintableValue($val) {
+ function setQuotedPrintableValue($val) {
$val = quoted_printable_decode($val);
@@ -129,7 +131,7 @@ class Text extends Property {
*
* @return string
*/
- public function getRawMimeDirValue() {
+ function getRawMimeDirValue() {
$val = $this->getParts();
@@ -137,13 +139,13 @@ class Text extends Property {
$val = array_pad($val, $this->minimumPropertyValues[$this->name], '');
}
- foreach($val as &$item) {
+ foreach ($val as &$item) {
if (!is_array($item)) {
$item = [$item];
}
- foreach($item as &$subItem) {
+ foreach ($item as &$subItem) {
$subItem = strtr(
$subItem,
[
@@ -170,7 +172,7 @@ class Text extends Property {
*
* @return array
*/
- public function getJsonValue() {
+ function getJsonValue() {
// Structured text values should always be returned as a single
// array-item. Multi-value text should be returned as multiple items in
@@ -190,7 +192,7 @@ class Text extends Property {
*
* @return string
*/
- public function getValueType() {
+ function getValueType() {
return 'TEXT';
@@ -201,7 +203,7 @@ class Text extends Property {
*
* @return string
*/
- public function serialize() {
+ function serialize() {
// We need to kick in a special type of encoding, if it's a 2.1 vcard.
if ($this->root->getDocumentType() !== Document::VCARD21) {
@@ -216,9 +218,9 @@ class Text extends Property {
// Imploding multiple parts into a single value, and splitting the
// values with ;.
- if (count($val)>1) {
- foreach($val as $k=>$v) {
- $val[$k] = str_replace(';','\;', $v);
+ if (count($val) > 1) {
+ foreach ($val as $k => $v) {
+ $val[$k] = str_replace(';', '\;', $v);
}
$val = implode(';', $val);
} else {
@@ -227,12 +229,12 @@ class Text extends Property {
$str = $this->name;
if ($this->group) $str = $this->group . '.' . $this->name;
- foreach($this->parameters as $param) {
+ foreach ($this->parameters as $param) {
if ($param->getValue() === 'QUOTED-PRINTABLE') {
continue;
}
- $str.=';' . $param->serialize();
+ $str .= ';' . $param->serialize();
}
@@ -240,44 +242,44 @@ class Text extends Property {
// If the resulting value contains a \n, we must encode it as
// quoted-printable.
- if (strpos($val,"\n") !== false) {
+ if (strpos($val, "\n") !== false) {
- $str.=';ENCODING=QUOTED-PRINTABLE:';
- $lastLine=$str;
+ $str .= ';ENCODING=QUOTED-PRINTABLE:';
+ $lastLine = $str;
$out = null;
// The PHP built-in quoted-printable-encode does not correctly
// encode newlines for us. Specifically, the \r\n sequence must in
// vcards be encoded as =0D=OA and we must insert soft-newlines
// every 75 bytes.
- for($ii=0;$ii<strlen($val);$ii++) {
+ for ($ii = 0;$ii < strlen($val);$ii++) {
$ord = ord($val[$ii]);
// These characters are encoded as themselves.
- if ($ord >= 32 && $ord <=126) {
- $lastLine.=$val[$ii];
+ if ($ord >= 32 && $ord <= 126) {
+ $lastLine .= $val[$ii];
} else {
- $lastLine.='=' . strtoupper(bin2hex($val[$ii]));
+ $lastLine .= '=' . strtoupper(bin2hex($val[$ii]));
}
- if (strlen($lastLine)>=75) {
+ if (strlen($lastLine) >= 75) {
// Soft line break
- $out.=$lastLine. "=\r\n ";
+ $out .= $lastLine . "=\r\n ";
$lastLine = null;
}
}
- if (!is_null($lastLine)) $out.= $lastLine . "\r\n";
+ if (!is_null($lastLine)) $out .= $lastLine . "\r\n";
return $out;
} else {
- $str.=':' . $val;
+ $str .= ':' . $val;
$out = '';
- while(strlen($str)>0) {
- if (strlen($str)>75) {
- $out.= mb_strcut($str,0,75,'utf-8') . "\r\n";
- $str = ' ' . mb_strcut($str,75,strlen($str),'utf-8');
+ while (strlen($str) > 0) {
+ if (strlen($str) > 75) {
+ $out .= mb_strcut($str, 0, 75, 'utf-8') . "\r\n";
+ $str = ' ' . mb_strcut($str, 75, strlen($str), 'utf-8');
} else {
- $out.=$str . "\r\n";
- $str='';
+ $out .= $str . "\r\n";
+ $str = '';
break;
}
}
@@ -293,13 +295,14 @@ class Text extends Property {
* create xCard or xCal documents.
*
* @param Xml\Writer $writer XML writer.
+ *
* @return void
*/
protected function xmlSerializeValue(Xml\Writer $writer) {
$values = $this->getParts();
- $map = function($items) use($values, $writer) {
+ $map = function($items) use ($values, $writer) {
foreach ($items as $i => $item) {
$writer->writeElement(
$item,
@@ -380,9 +383,10 @@ class Text extends Property {
* * node - (reference to the offending node)
*
* @param int $options
+ *
* @return array
*/
- public function validate($options = 0) {
+ function validate($options = 0) {
$warnings = parent::validate($options);
@@ -392,9 +396,9 @@ class Text extends Property {
$parts = $this->getParts();
if (count($parts) < $minimum) {
$warnings[] = [
- 'level' => 1,
+ 'level' => 1,
'message' => 'This property must have at least ' . $minimum . ' components. It only has ' . count($parts),
- 'node' => $this,
+ 'node' => $this,
];
if ($options & self::REPAIR) {
$parts = array_pad($parts, $minimum, '');
diff --git a/lib/Property/Time.php b/lib/Property/Time.php
index 5237763..8664332 100644
--- a/lib/Property/Time.php
+++ b/lib/Property/Time.php
@@ -5,7 +5,7 @@ namespace Sabre\VObject\Property;
use Sabre\VObject\DateTimeParser;
/**
- * Time property
+ * Time property.
*
* This object encodes TIME values.
*
@@ -51,39 +51,39 @@ class Time extends Text {
// Hour
if (!is_null($parts['hour'])) {
- $timeStr.=$parts['hour'];
+ $timeStr .= $parts['hour'];
if (!is_null($parts['minute'])) {
- $timeStr.=':';
+ $timeStr .= ':';
}
} else {
// We know either minute or second _must_ be set, so we insert a
// dash for an empty value.
- $timeStr.='-';
+ $timeStr .= '-';
}
// Minute
if (!is_null($parts['minute'])) {
- $timeStr.=$parts['minute'];
+ $timeStr .= $parts['minute'];
if (!is_null($parts['second'])) {
- $timeStr.=':';
+ $timeStr .= ':';
}
} else {
if (isset($parts['second'])) {
// Dash for empty minute
- $timeStr.='-';
+ $timeStr .= '-';
}
}
// Second
if (!is_null($parts['second'])) {
- $timeStr.=$parts['second'];
+ $timeStr .= $parts['second'];
}
// Timezone
if (!is_null($parts['timezone'])) {
- $timeStr.=$parts['timezone'];
+ $timeStr .= $parts['timezone'];
}
return [$timeStr];
@@ -95,6 +95,7 @@ class Time extends Text {
* object.
*
* @param array $value
+ *
* @return void
*/
function setXmlValue(array $value) {
diff --git a/lib/Property/Unknown.php b/lib/Property/Unknown.php
index 91d27eb..dd32f29 100644
--- a/lib/Property/Unknown.php
+++ b/lib/Property/Unknown.php
@@ -3,7 +3,7 @@
namespace Sabre\VObject\Property;
/**
- * Unknown property
+ * Unknown property.
*
* This object represents any properties not recognized by the parser.
* This type of value has been introduced by the jCal, jCard specs.
diff --git a/lib/Property/Uri.php b/lib/Property/Uri.php
index b5d8c23..a997f32 100644
--- a/lib/Property/Uri.php
+++ b/lib/Property/Uri.php
@@ -5,7 +5,7 @@ namespace Sabre\VObject\Property;
use Sabre\VObject\Property;
/**
- * URI property
+ * URI property.
*
* This object encodes URI values. vCard 2.1 calls these URL.
*
@@ -31,7 +31,7 @@ class Uri extends Text {
*
* @return string
*/
- public function getValueType() {
+ function getValueType() {
return 'URI';
@@ -44,9 +44,10 @@ class Uri extends Text {
* not yet done, but parameters are not included.
*
* @param string $val
+ *
* @return void
*/
- public function setRawMimeDirValue($val) {
+ function setRawMimeDirValue($val) {
// Normally we don't need to do any type of unescaping for these
// properties, however.. we've noticed that Google Contacts
@@ -60,13 +61,13 @@ class Uri extends Text {
$regex = '# (?: (\\\\ (?: \\\\ | : ) ) ) #x';
$matches = preg_split($regex, $val, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
$newVal = '';
- foreach($matches as $match) {
- switch($match) {
+ foreach ($matches as $match) {
+ switch ($match) {
case '\:' :
- $newVal.=':';
+ $newVal .= ':';
break;
default :
- $newVal.=$match;
+ $newVal .= $match;
break;
}
}
@@ -82,7 +83,7 @@ class Uri extends Text {
*
* @return string
*/
- public function getRawMimeDirValue() {
+ function getRawMimeDirValue() {
if (is_array($this->value)) {
$value = $this->value[0];
diff --git a/lib/Property/UtcOffset.php b/lib/Property/UtcOffset.php
index c336130..6f52a28 100644
--- a/lib/Property/UtcOffset.php
+++ b/lib/Property/UtcOffset.php
@@ -3,7 +3,7 @@
namespace Sabre\VObject\Property;
/**
- * UtcOffset property
+ * UtcOffset property.
*
* This object encodes UTC-OFFSET values.
*
@@ -29,7 +29,7 @@ class UtcOffset extends Text {
*
* @return string
*/
- public function getValueType() {
+ function getValueType() {
return 'UTC-OFFSET';
@@ -41,6 +41,7 @@ class UtcOffset extends Text {
* The value must always be an array.
*
* @param array $value
+ *
* @return void
*/
function setJsonValue(array $value) {
diff --git a/lib/Property/VCard/Date.php b/lib/Property/VCard/Date.php
index 2369447..f93c63a 100644
--- a/lib/Property/VCard/Date.php
+++ b/lib/Property/VCard/Date.php
@@ -3,7 +3,7 @@
namespace Sabre\VObject\Property\VCard;
/**
- * Date property
+ * Date property.
*
* This object encodes vCard DATE values.
*
@@ -31,9 +31,10 @@ class Date extends DateAndOrTime {
* Sets the property as a DateTime object.
*
* @param \DateTimeInterface $dt
+ *
* @return void
*/
- public function setDateTime(\DateTimeInterface $dt) {
+ function setDateTime(\DateTimeInterface $dt) {
$this->value = $dt->format('Ymd');
diff --git a/lib/Property/VCard/DateAndOrTime.php b/lib/Property/VCard/DateAndOrTime.php
index 02465c7..3560884 100644
--- a/lib/Property/VCard/DateAndOrTime.php
+++ b/lib/Property/VCard/DateAndOrTime.php
@@ -2,16 +2,15 @@
namespace Sabre\VObject\Property\VCard;
-use
- Sabre\VObject\DateTimeParser,
- Sabre\VObject\Property,
- Sabre\Xml,
- DateTimeInterface,
- DateTimeImmutable,
- DateTime;
+use Sabre\VObject\DateTimeParser;
+use Sabre\VObject\Property;
+use Sabre\Xml;
+use DateTimeInterface;
+use DateTimeImmutable;
+use DateTime;
/**
- * DateAndOrTime property
+ * DateAndOrTime property.
*
* This object encodes DATE-AND-OR-TIME values.
*
@@ -22,7 +21,7 @@ use
class DateAndOrTime extends Property {
/**
- * Field separator
+ * Field separator.
*
* @var null|string
*/
@@ -48,11 +47,12 @@ class DateAndOrTime extends Property {
* You may also specify DateTime objects here.
*
* @param array $parts
+ *
* @return void
*/
function setParts(array $parts) {
- if (count($parts)>1) {
+ if (count($parts) > 1) {
throw new \InvalidArgumentException('Only one value allowed');
}
if (isset($parts[0]) && $parts[0] instanceof \DateTime) {
@@ -71,6 +71,7 @@ class DateAndOrTime extends Property {
* Instead of strings, you may also use DateTime here.
*
* @param string|array|\DateTime $value
+ *
* @return void
*/
function setValue($value) {
@@ -87,6 +88,7 @@ class DateAndOrTime extends Property {
* Sets the property as a DateTime object.
*
* @param DateTimeInterface $dt
+ *
* @return void
*/
function setDateTime(DateTimeInterface $dt) {
@@ -95,7 +97,7 @@ class DateAndOrTime extends Property {
$isUtc = false;
$tz = $dt->getTimeZone();
- $isUtc = in_array($tz->getName() , ['UTC', 'GMT', 'Z']);
+ $isUtc = in_array($tz->getName(), ['UTC', 'GMT', 'Z']);
if ($isUtc) {
$value = $dt->format('Ymd\\THis\\Z');
@@ -128,7 +130,7 @@ class DateAndOrTime extends Property {
$now = new DateTime();
- $tzFormat = $now->getTimezone()->getOffset($now)===0?'\\Z':'O';
+ $tzFormat = $now->getTimezone()->getOffset($now) === 0 ? '\\Z' : 'O';
$nowParts = DateTimeParser::parseVCardDateTime($now->format('Ymd\\This' . $tzFormat));
$dateParts = DateTimeParser::parseVCardDateTime($this->getValue());
@@ -136,7 +138,7 @@ class DateAndOrTime extends Property {
// This sets all the missing parts to the current date/time.
// So if the year was missing for a birthday, we're making it 'this
// year'.
- foreach($dateParts as $k=>$v) {
+ foreach ($dateParts as $k => $v) {
if (is_null($v)) {
$dateParts[$k] = $nowParts[$k];
}
@@ -255,6 +257,7 @@ class DateAndOrTime extends Property {
* create xCard or xCal documents.
*
* @param Xml\Writer $writer XML writer.
+ *
* @return void
*/
protected function xmlSerializeValue(Xml\Writer $writer) {
@@ -264,12 +267,12 @@ class DateAndOrTime extends Property {
$value = '';
// $d = defined
- $d = function($part) use($parts) {
+ $d = function($part) use ($parts) {
return !is_null($parts[$part]);
};
// $r = read
- $r = function($part) use($parts) {
+ $r = function($part) use ($parts) {
return $parts[$part];
};
@@ -279,7 +282,7 @@ class DateAndOrTime extends Property {
// value-date = element date {
// xsd:string { pattern = "\d{8}|\d{4}-\d\d|--\d\d(\d\d)?|---\d\d" }
// }
- if ( ( $d('year') || $d('month') || $d('date'))
+ if (($d('year') || $d('month') || $d('date'))
&& (!$d('hour') && !$d('minute') && !$d('second') && !$d('timezone'))) {
if ($d('year') && $d('month') && $d('date')) {
@@ -297,8 +300,8 @@ class DateAndOrTime extends Property {
// xsd:string { pattern = "(\d\d(\d\d(\d\d)?)?|-\d\d(\d\d?)|--\d\d)"
// ~ "(Z|[+\-]\d\d(\d\d)?)?" }
// }
- } elseif ( (!$d('year') && !$d('month') && !$d('date'))
- && ( $d('hour') || $d('minute') || $d('second'))) {
+ } elseif ((!$d('year') && !$d('month') && !$d('date'))
+ && ($d('hour') || $d('minute') || $d('second'))) {
if ($d('hour')) {
$value .= $r('hour') . $r('minute') . $r('second');
@@ -341,6 +344,7 @@ class DateAndOrTime extends Property {
* not yet done, but parameters are not included.
*
* @param string $val
+ *
* @return void
*/
function setRawMimeDirValue($val) {
@@ -379,6 +383,7 @@ class DateAndOrTime extends Property {
* 3 - A severe issue.
*
* @param int $options
+ *
* @return array
*/
function validate($options = 0) {
@@ -390,9 +395,9 @@ class DateAndOrTime extends Property {
DateTimeParser::parseVCardDateTime($value);
} catch (\InvalidArgumentException $e) {
$messages[] = [
- 'level' => 3,
+ 'level' => 3,
'message' => 'The supplied value (' . $value . ') is not a correct DATE-AND-OR-TIME property',
- 'node' => $this,
+ 'node' => $this,
];
}
diff --git a/lib/Property/VCard/DateTime.php b/lib/Property/VCard/DateTime.php
index 76addf8..eb97de5 100644
--- a/lib/Property/VCard/DateTime.php
+++ b/lib/Property/VCard/DateTime.php
@@ -3,7 +3,7 @@
namespace Sabre\VObject\Property\VCard;
/**
- * DateTime property
+ * DateTime property.
*
* This object encodes DATE-TIME values for vCards.
*
diff --git a/lib/Property/VCard/LanguageTag.php b/lib/Property/VCard/LanguageTag.php
index edee89e..bdc7909 100644
--- a/lib/Property/VCard/LanguageTag.php
+++ b/lib/Property/VCard/LanguageTag.php
@@ -6,7 +6,7 @@ use
Sabre\VObject\Property;
/**
- * LanguageTag property
+ * LanguageTag property.
*
* This object represents LANGUAGE-TAG values as used in vCards.
*
@@ -23,9 +23,10 @@ class LanguageTag extends Property {
* not yet done, but parameters are not included.
*
* @param string $val
+ *
* @return void
*/
- public function setRawMimeDirValue($val) {
+ function setRawMimeDirValue($val) {
$this->setValue($val);
@@ -36,7 +37,7 @@ class LanguageTag extends Property {
*
* @return string
*/
- public function getRawMimeDirValue() {
+ function getRawMimeDirValue() {
return $this->getValue();
@@ -50,7 +51,7 @@ class LanguageTag extends Property {
*
* @return string
*/
- public function getValueType() {
+ function getValueType() {
return 'LANGUAGE-TAG';
diff --git a/lib/Property/VCard/TimeStamp.php b/lib/Property/VCard/TimeStamp.php
index 498788a..7906672 100644
--- a/lib/Property/VCard/TimeStamp.php
+++ b/lib/Property/VCard/TimeStamp.php
@@ -2,13 +2,12 @@
namespace Sabre\VObject\Property\VCard;
-use
- Sabre\VObject\DateTimeParser,
- Sabre\VObject\Property\Text,
- Sabre\Xml;
+use Sabre\VObject\DateTimeParser;
+use Sabre\VObject\Property\Text;
+use Sabre\Xml;
/**
- * TimeStamp property
+ * TimeStamp property.
*
* This object encodes TIMESTAMP values.
*
@@ -61,7 +60,7 @@ class TimeStamp extends Text {
// Timezone
if (!is_null($parts['timezone'])) {
- $dateStr.=$parts['timezone'];
+ $dateStr .= $parts['timezone'];
}
return [$dateStr];
@@ -73,6 +72,7 @@ class TimeStamp extends Text {
* create xCard or xCal documents.
*
* @param Xml\Writer $writer XML writer.
+ *
* @return void
*/
protected function xmlSerializeValue(Xml\Writer $writer) {
diff --git a/lib/Reader.php b/lib/Reader.php
index acedfc5..7376e58 100644
--- a/lib/Reader.php
+++ b/lib/Reader.php
@@ -36,6 +36,7 @@ class Reader {
*
* @param string|resource $data
* @param int $options
+ *
* @return Document
*/
static function read($data, $options = 0) {
@@ -59,6 +60,7 @@ class Reader {
*
* @param string|resource|array $data
* @param int $options
+ *
* @return Document
*/
static function readJson($data, $options = 0) {
@@ -80,9 +82,10 @@ class Reader {
*
* @param string|resource $data
* @param int $options
+ *
* @return Document
*/
- static public function readXML($data, $options = 0) {
+ static function readXML($data, $options = 0) {
$parser = new Parser\XML();
$result = $parser->parse($data, $options);
diff --git a/lib/Recur/EventIterator.php b/lib/Recur/EventIterator.php
index 32001f8..45ab4eb 100644
--- a/lib/Recur/EventIterator.php
+++ b/lib/Recur/EventIterator.php
@@ -72,7 +72,7 @@ class EventIterator implements \Iterator {
protected $allDay = false;
/**
- * Creates the iterator
+ * Creates the iterator.
*
* There's three ways to set up the iterator.
*
@@ -115,7 +115,7 @@ class EventIterator implements \Iterator {
}
- foreach($events as $vevent) {
+ foreach ($events as $vevent) {
if (!isset($vevent->{'RECURRENCE-ID'})) {
@@ -150,9 +150,9 @@ class EventIterator implements \Iterator {
if (isset($this->masterEvent->EXDATE)) {
- foreach($this->masterEvent->EXDATE as $exDate) {
+ foreach ($this->masterEvent->EXDATE as $exDate) {
- foreach($exDate->getDateTimes($this->timeZone) as $dt) {
+ foreach ($exDate->getDateTimes($this->timeZone) as $dt) {
$this->exceptions[$dt->getTimeStamp()] = true;
}
@@ -188,7 +188,7 @@ class EventIterator implements \Iterator {
} else {
$this->recurIterator = new RRuleIterator(
[
- 'FREQ' => 'DAILY',
+ 'FREQ' => 'DAILY',
'COUNT' => 1,
],
$this->startDate
@@ -238,7 +238,7 @@ class EventIterator implements \Iterator {
function getDtEnd() {
if (!$this->valid()) {
- return null;
+ return;
}
$end = clone $this->currentDate;
return $end->modify('+' . $this->eventDuration . ' seconds');
@@ -326,7 +326,7 @@ class EventIterator implements \Iterator {
$this->recurIterator->rewind();
// re-creating overridden event index.
$index = [];
- foreach($this->overriddenEvents as $key=>$event) {
+ foreach ($this->overriddenEvents as $key => $event) {
$stamp = $event->DTSTART->getDateTime($this->timeZone)->getTimeStamp();
$index[$stamp] = $key;
}
@@ -366,7 +366,7 @@ class EventIterator implements \Iterator {
}
$nextDate = $this->recurIterator->current();
$this->recurIterator->next();
- } while(isset($this->exceptions[$nextDate->getTimeStamp()]));
+ } while (isset($this->exceptions[$nextDate->getTimeStamp()]));
}
@@ -406,7 +406,7 @@ class EventIterator implements \Iterator {
*/
function fastForward(DateTimeInterface $dateTime) {
- while($this->valid() && $this->getDtEnd() < $dateTime ) {
+ while ($this->valid() && $this->getDtEnd() < $dateTime) {
$this->next();
}
@@ -424,7 +424,7 @@ class EventIterator implements \Iterator {
}
/**
- * RRULE parser
+ * RRULE parser.
*
* @var RRuleIterator
*/
@@ -470,7 +470,7 @@ class EventIterator implements \Iterator {
protected $exceptions = [];
/**
- * Internal event counter
+ * Internal event counter.
*
* @var int
*/
@@ -484,7 +484,7 @@ class EventIterator implements \Iterator {
protected $startDate;
/**
- * Where we are currently in the iteration process
+ * Where we are currently in the iteration process.
*
* @var DateTimeImmutable
*/
diff --git a/lib/Recur/RDateIterator.php b/lib/Recur/RDateIterator.php
index ac1c545..985c2d7 100644
--- a/lib/Recur/RDateIterator.php
+++ b/lib/Recur/RDateIterator.php
@@ -6,9 +6,8 @@ use DateTimeInterface;
use Iterator;
use Sabre\VObject\DateTimeParser;
-
/**
- * RRuleParser
+ * RRuleParser.
*
* This class receives an RRULE string, and allows you to iterate to get a list
* of dates in that recurrence.
@@ -40,7 +39,7 @@ class RDateIterator implements Iterator {
function current() {
- if (!$this->valid()) return null;
+ if (!$this->valid()) return;
return clone $this->currentDate;
}
@@ -92,7 +91,7 @@ class RDateIterator implements Iterator {
$this->currentDate =
DateTimeParser::parse(
- $this->dates[$this->counter-1]
+ $this->dates[$this->counter - 1]
);
}
@@ -115,11 +114,12 @@ class RDateIterator implements Iterator {
* specified date.
*
* @param DateTimeInterface $dt
+ *
* @return void
*/
function fastForward(DateTimeInterface $dt) {
- while($this->valid() && $this->currentDate < $dt ) {
+ while ($this->valid() && $this->currentDate < $dt) {
$this->next();
}
@@ -158,6 +158,7 @@ class RDateIterator implements Iterator {
* class with all the values.
*
* @param string|array $rrule
+ *
* @return void
*/
protected function parseRDate($rdate) {
diff --git a/lib/Recur/RRuleIterator.php b/lib/Recur/RRuleIterator.php
index 4586d6c..2f18324 100644
--- a/lib/Recur/RRuleIterator.php
+++ b/lib/Recur/RRuleIterator.php
@@ -9,9 +9,8 @@ use Iterator;
use Sabre\VObject\DateTimeParser;
use Sabre\VObject\Property;
-
/**
- * RRuleParser
+ * RRuleParser.
*
* This class receives an RRULE string, and allows you to iterate to get a list
* of dates in that recurrence.
@@ -26,7 +25,7 @@ use Sabre\VObject\Property;
class RRuleIterator implements Iterator {
/**
- * Creates the Iterator
+ * Creates the Iterator.
*
* @param string|array $rrule
* @param DateTimeInterface $start
@@ -43,13 +42,13 @@ class RRuleIterator implements Iterator {
function current() {
- if (!$this->valid()) return null;
+ if (!$this->valid()) return;
return clone $this->currentDate;
}
/**
- * Returns the current item number
+ * Returns the current item number.
*
* @return int
*/
@@ -76,7 +75,7 @@ class RRuleIterator implements Iterator {
}
/**
- * Resets the iterator
+ * Resets the iterator.
*
* @return void
*/
@@ -88,7 +87,7 @@ class RRuleIterator implements Iterator {
}
/**
- * Goes on to the next iteration
+ * Goes on to the next iteration.
*
* @return void
*/
@@ -96,7 +95,7 @@ class RRuleIterator implements Iterator {
// Otherwise, we find the next event in the normal RRULE
// sequence.
- switch($this->frequency) {
+ switch ($this->frequency) {
case 'hourly' :
$this->nextHourly();
@@ -141,11 +140,12 @@ class RRuleIterator implements Iterator {
* specified date.
*
* @param DateTimeInterface $dt
+ *
* @return void
*/
function fastForward(DateTimeInterface $dt) {
- while($this->valid() && $this->currentDate < $dt ) {
+ while ($this->valid() && $this->currentDate < $dt) {
$this->next();
}
@@ -194,7 +194,7 @@ class RRuleIterator implements Iterator {
protected $interval = 1;
/**
- * The last instance of this recurrence, inclusively
+ * The last instance of this recurrence, inclusively.
*
* @var DateTimeInterface|null
*/
@@ -210,7 +210,7 @@ class RRuleIterator implements Iterator {
protected $bySecond;
/**
- * Which minutes to recur
+ * Which minutes to recur.
*
* This is an array of integers (between 0 and 59)
*
@@ -219,7 +219,7 @@ class RRuleIterator implements Iterator {
protected $byMinute;
/**
- * Which hours to recur
+ * Which hours to recur.
*
* This is an array of integers (between 0 and 23)
*
@@ -251,7 +251,7 @@ class RRuleIterator implements Iterator {
protected $byDay;
/**
- * Which days of the month to recur
+ * Which days of the month to recur.
*
* This is an array of days of the months (1-31). The value can also be
* negative. -5 for instance means the 5th last day of the month.
@@ -354,7 +354,7 @@ class RRuleIterator implements Iterator {
if ($this->byHour) {
if ($this->currentDate->format('G') == '23') {
// to obey the interval rule
- $this->currentDate = $this->currentDate->modify('+' . $this->interval-1 . ' days');
+ $this->currentDate = $this->currentDate->modify('+' . $this->interval - 1 . ' days');
}
$this->currentDate = $this->currentDate->modify('+1 hours');
@@ -413,18 +413,18 @@ class RRuleIterator implements Iterator {
}
// Current day of the week
- $currentDay = (int) $this->currentDate->format('w');
+ $currentDay = (int)$this->currentDate->format('w');
// Current hour of the day
- $currentHour = (int) $this->currentDate->format('G');
+ $currentHour = (int)$this->currentDate->format('G');
// We need to roll over to the next week
if ($currentDay === $firstDay && (!$this->byHour || $currentHour == '0')) {
- $this->currentDate = $this->currentDate->modify('+' . $this->interval-1 . ' weeks');
+ $this->currentDate = $this->currentDate->modify('+' . $this->interval - 1 . ' weeks');
// We need to go to the first day of this week, but only if we
// are not already on this first day of this week.
- if($this->currentDate->format('w') != $firstDay) {
+ if ($this->currentDate->format('w') != $firstDay) {
$this->currentDate = $this->currentDate->modify('last ' . $this->dayNames[$this->dayMap[$this->weekStart]]);
}
}
@@ -453,18 +453,18 @@ class RRuleIterator implements Iterator {
do {
$increase++;
$tempDate = clone $this->currentDate;
- $tempDate = $tempDate->modify('+ ' . ($this->interval*$increase) . ' months');
+ $tempDate = $tempDate->modify('+ ' . ($this->interval * $increase) . ' months');
} while ($tempDate->format('j') != $currentDayOfMonth);
$this->currentDate = $tempDate;
}
return;
}
- while(true) {
+ while (true) {
$occurrences = $this->getMonthlyOccurrences();
- foreach($occurrences as $occurrence) {
+ foreach ($occurrences as $occurrence) {
// The first occurrence thats higher than the current
// day of the month wins.
@@ -510,7 +510,7 @@ class RRuleIterator implements Iterator {
if (!$this->byMonth) {
// Unless it was a leap day!
- if ($currentMonth==2 && $currentDayOfMonth==29) {
+ if ($currentMonth == 2 && $currentDayOfMonth == 29) {
$counter = 0;
do {
@@ -524,8 +524,8 @@ class RRuleIterator implements Iterator {
// 400. (1800, 1900, 2100). So we just rely on the datetime
// functions instead.
$nextDate = clone $this->currentDate;
- $nextDate = $nextDate->modify('+ ' . ($this->interval*$counter) . ' years');
- } while ($nextDate->format('n')!=2);
+ $nextDate = $nextDate->modify('+ ' . ($this->interval * $counter) . ' years');
+ } while ($nextDate->format('n') != 2);
$this->currentDate = $nextDate;
@@ -549,11 +549,11 @@ class RRuleIterator implements Iterator {
// further.
if ($this->byDay || $this->byMonthDay) {
- while(true) {
+ while (true) {
$occurrences = $this->getMonthlyOccurrences();
- foreach($occurrences as $occurrence) {
+ foreach ($occurrences as $occurrence) {
// The first occurrence that's higher than the current
// day of the month wins.
@@ -572,8 +572,8 @@ class RRuleIterator implements Iterator {
do {
$currentMonth++;
- if ($currentMonth>12) {
- $currentYear+=$this->interval;
+ if ($currentMonth > 12) {
+ $currentYear += $this->interval;
$currentMonth = 1;
}
} while (!in_array($currentMonth, $this->byMonth));
@@ -593,8 +593,8 @@ class RRuleIterator implements Iterator {
do {
$currentMonth++;
- if ($currentMonth>12) {
- $currentYear+=$this->interval;
+ if ($currentMonth > 12) {
+ $currentYear += $this->interval;
$currentMonth = 1;
}
} while (!in_array($currentMonth, $this->byMonth));
@@ -613,6 +613,7 @@ class RRuleIterator implements Iterator {
* class with all the values.
*
* @param string|array $rrule
+ *
* @return void
*/
protected function parseRRule($rrule) {
@@ -621,16 +622,16 @@ class RRuleIterator implements Iterator {
$rrule = Property\ICalendar\Recur::stringToArray($rrule);
}
- foreach($rrule as $key=>$value) {
+ foreach ($rrule as $key => $value) {
$key = strtoupper($key);
- switch($key) {
+ switch ($key) {
case 'FREQ' :
$value = strtolower($value);
if (!in_array(
$value,
- ['secondly','minutely','hourly','daily','weekly','monthly','yearly']
+ ['secondly', 'minutely', 'hourly', 'daily', 'weekly', 'monthly', 'yearly']
)) {
throw new InvalidArgumentException('Unknown value for FREQ=' . strtoupper($value));
}
@@ -648,7 +649,7 @@ class RRuleIterator implements Iterator {
//
// So we are modifying the parameter so our code doesn't
// break.
- if($this->until < $this->startDate) {
+ if ($this->until < $this->startDate) {
$this->until = $this->startDate;
}
break;
@@ -679,7 +680,7 @@ class RRuleIterator implements Iterator {
case 'BYDAY' :
$value = (array)$value;
- foreach($value as $part) {
+ foreach ($value as $part) {
if (!preg_match('#^ (-|\+)? ([1-5])? (MO|TU|WE|TH|FR|SA|SU) $# xi', $part)) {
throw new \InvalidArgumentException('Invalid part in BYDAY clause: ' . $part);
}
@@ -751,9 +752,9 @@ class RRuleIterator implements Iterator {
// Our strategy is to simply go through the byDays, advance the date to
// that point and add it to the results.
- if ($this->byDay) foreach($this->byDay as $day) {
+ if ($this->byDay) foreach ($this->byDay as $day) {
- $dayName = $this->dayNames[$this->dayMap[substr($day,-2)]];
+ $dayName = $this->dayNames[$this->dayMap[substr($day, -2)]];
// Dayname will be something like 'wednesday'. Now we need to find
@@ -775,14 +776,14 @@ class RRuleIterator implements Iterator {
// So now we have 'all wednesdays' for month. It is however
// possible that the user only really wanted the 1st, 2nd or last
// wednesday.
- if (strlen($day)>2) {
- $offset = (int)substr($day,0,-2);
+ if (strlen($day) > 2) {
+ $offset = (int)substr($day, 0, -2);
- if ($offset>0) {
+ if ($offset > 0) {
// It is possible that the day does not exist, such as a
// 5th or 6th wednesday of the month.
- if (isset($dayHits[$offset-1])) {
- $byDayResults[] = $dayHits[$offset-1];
+ if (isset($dayHits[$offset - 1])) {
+ $byDayResults[] = $dayHits[$offset - 1];
}
} else {
@@ -802,14 +803,14 @@ class RRuleIterator implements Iterator {
}
$byMonthDayResults = [];
- if ($this->byMonthDay) foreach($this->byMonthDay as $monthDay) {
+ if ($this->byMonthDay) foreach ($this->byMonthDay as $monthDay) {
// Removing values that are out of range for this month
if ($monthDay > $startDate->format('t') ||
- $monthDay < 0-$startDate->format('t')) {
+ $monthDay < 0 - $startDate->format('t')) {
continue;
}
- if ($monthDay>0) {
+ if ($monthDay > 0) {
$byMonthDayResults[] = $monthDay;
} else {
// Negative values
@@ -837,13 +838,13 @@ class RRuleIterator implements Iterator {
}
$filteredResult = [];
- foreach($this->bySetPos as $setPos) {
+ foreach ($this->bySetPos as $setPos) {
- if ($setPos<0) {
- $setPos = count($result)+($setPos+1);
+ if ($setPos < 0) {
+ $setPos = count($result) + ($setPos + 1);
}
- if (isset($result[$setPos-1])) {
- $filteredResult[] = $result[$setPos-1];
+ if (isset($result[$setPos - 1])) {
+ $filteredResult[] = $result[$setPos - 1];
}
}
@@ -853,7 +854,7 @@ class RRuleIterator implements Iterator {
}
/**
- * Simple mapping from iCalendar day names to day numbers
+ * Simple mapping from iCalendar day names to day numbers.
*
* @var array
*/
@@ -870,7 +871,7 @@ class RRuleIterator implements Iterator {
protected function getHours() {
$recurrenceHours = [];
- foreach($this->byHour as $byHour) {
+ foreach ($this->byHour as $byHour) {
$recurrenceHours[] = $byHour;
}
@@ -880,12 +881,12 @@ class RRuleIterator implements Iterator {
protected function getDays() {
$recurrenceDays = [];
- foreach($this->byDay as $byDay) {
+ foreach ($this->byDay as $byDay) {
// The day may be preceeded with a positive (+n) or
// negative (-n) integer. However, this does not make
// sense in 'weekly' so we ignore it here.
- $recurrenceDays[] = $this->dayMap[substr($byDay,-2)];
+ $recurrenceDays[] = $this->dayMap[substr($byDay, -2)];
}
@@ -895,7 +896,7 @@ class RRuleIterator implements Iterator {
protected function getMonths() {
$recurrenceMonths = [];
- foreach($this->byMonth as $byMonth) {
+ foreach ($this->byMonth as $byMonth) {
$recurrenceMonths[] = $byMonth;
}
diff --git a/lib/Splitter/ICalendar.php b/lib/Splitter/ICalendar.php
index e89558d..67a619b 100644
--- a/lib/Splitter/ICalendar.php
+++ b/lib/Splitter/ICalendar.php
@@ -2,12 +2,11 @@
namespace Sabre\VObject\Splitter;
-use
- Sabre\VObject,
- Sabre\VObject\Component\VCalendar;
+use Sabre\VObject;
+use Sabre\VObject\Component\VCalendar;
/**
- * Splitter
+ * Splitter.
*
* This class is responsible for splitting up iCalendar objects.
*
@@ -23,21 +22,21 @@ use
class ICalendar implements SplitterInterface {
/**
- * Timezones
+ * Timezones.
*
* @var array
*/
protected $vtimezones = [];
/**
- * iCalendar objects
+ * iCalendar objects.
*
* @var array
*/
protected $objects = [];
/**
- * Constructor
+ * Constructor.
*
* The splitter should receive an readable file stream as it's input.
*
@@ -52,7 +51,7 @@ class ICalendar implements SplitterInterface {
throw new VObject\ParseException('Supplied input could not be parsed as VCALENDAR.');
}
- foreach($data->children() as $component) {
+ foreach ($data->children() as $component) {
if (!$component instanceof VObject\Component) {
continue;
}
@@ -64,7 +63,7 @@ class ICalendar implements SplitterInterface {
}
// Get component UID for recurring Events search
- if(!$component->UID) {
+ if (!$component->UID) {
$component->UID = sha1(microtime()) . '-vobjectimport';
}
$uid = (string)$component->UID;
@@ -89,7 +88,7 @@ class ICalendar implements SplitterInterface {
*/
function getNext() {
- if($object=array_shift($this->objects)) {
+ if ($object = array_shift($this->objects)) {
// create our baseobject
$object->version = '2.0';
@@ -105,7 +104,7 @@ class ICalendar implements SplitterInterface {
} else {
- return null;
+ return;
}
diff --git a/lib/Splitter/SplitterInterface.php b/lib/Splitter/SplitterInterface.php
index c41b412..2c9fe62 100644
--- a/lib/Splitter/SplitterInterface.php
+++ b/lib/Splitter/SplitterInterface.php
@@ -3,7 +3,7 @@
namespace Sabre\VObject\Splitter;
/**
- * VObject splitter
+ * VObject splitter.
*
* The splitter is responsible for reading a large vCard or iCalendar object,
* and splitting it into multiple objects.
@@ -18,13 +18,13 @@ namespace Sabre\VObject\Splitter;
interface SplitterInterface {
/**
- * Constructor
+ * Constructor.
*
* The splitter should receive an readable file stream as it's input.
*
* @param resource $input
*/
- public function __construct($input);
+ function __construct($input);
/**
* Every time getNext() is called, a new object will be parsed, until we
@@ -34,6 +34,6 @@ interface SplitterInterface {
*
* @return Sabre\VObject\Component|null
*/
- public function getNext();
+ function getNext();
}
diff --git a/lib/Splitter/VCard.php b/lib/Splitter/VCard.php
index f474174..9de8253 100644
--- a/lib/Splitter/VCard.php
+++ b/lib/Splitter/VCard.php
@@ -2,12 +2,11 @@
namespace Sabre\VObject\Splitter;
-use
- Sabre\VObject,
- Sabre\VObject\Parser\MimeDir;
+use Sabre\VObject;
+use Sabre\VObject\Parser\MimeDir;
/**
- * Splitter
+ * Splitter.
*
* This class is responsible for splitting up VCard objects.
*
@@ -23,28 +22,28 @@ use
class VCard implements SplitterInterface {
/**
- * File handle
+ * File handle.
*
* @var resource
*/
protected $input;
/**
- * Persistent parser
+ * Persistent parser.
*
* @var MimeDir
*/
protected $parser;
/**
- * Constructor
+ * Constructor.
*
* The splitter should receive an readable file stream as it's input.
*
* @param resource $input
* @param int $options Parser options, see the OPTIONS constants.
*/
- public function __construct($input, $options = 0) {
+ function __construct($input, $options = 0) {
$this->input = $input;
$this->parser = new MimeDir($input, $options);
@@ -59,7 +58,7 @@ class VCard implements SplitterInterface {
*
* @return Sabre\VObject\Component|null
*/
- public function getNext() {
+ function getNext() {
try {
$object = $this->parser->parse();
@@ -69,7 +68,7 @@ class VCard implements SplitterInterface {
}
} catch (VObject\EofException $e) {
- return null;
+ return;
}
return $object;
diff --git a/lib/StringUtil.php b/lib/StringUtil.php
index db1b681..4947dc5 100644
--- a/lib/StringUtil.php
+++ b/lib/StringUtil.php
@@ -12,9 +12,10 @@ namespace Sabre\VObject;
class StringUtil {
/**
- * Returns true or false depending on if a string is valid UTF-8
+ * Returns true or false depending on if a string is valid UTF-8.
*
* @param string $str
+ *
* @return bool
*/
static function isUTF8($str) {
@@ -35,13 +36,14 @@ class StringUtil {
* may be expanded upon if we receive other examples.
*
* @param string $str
+ *
* @return string
*/
static function convertToUTF8($str) {
- $encoding = mb_detect_encoding($str , ['UTF-8','ISO-8859-1', 'WINDOWS-1252'], true);
+ $encoding = mb_detect_encoding($str, ['UTF-8', 'ISO-8859-1', 'WINDOWS-1252'], true);
- switch($encoding) {
+ switch ($encoding) {
case 'ISO-8859-1' :
$newStr = utf8_encode($str);
break;
@@ -62,4 +64,3 @@ class StringUtil {
}
}
-
diff --git a/lib/TimeZoneUtil.php b/lib/TimeZoneUtil.php
index 808dcce..6053565 100644
--- a/lib/TimeZoneUtil.php
+++ b/lib/TimeZoneUtil.php
@@ -3,7 +3,7 @@
namespace Sabre\VObject;
/**
- * Time zone name translation
+ * Time zone name translation.
*
* This file translates well-known time zone names into "Olson database" time zone names.
*
@@ -14,14 +14,14 @@ namespace Sabre\VObject;
*/
class TimeZoneUtil {
- public static $map = null;
+ static $map = null;
/**
* List of microsoft exchange timezone ids.
*
* Source: http://msdn.microsoft.com/en-us/library/aa563018(loband).aspx
*/
- public static $microsoftExchangeMap = [
+ static $microsoftExchangeMap = [
0 => 'UTC',
31 => 'Africa/Casablanca',
@@ -119,6 +119,7 @@ class TimeZoneUtil {
*
* @param string $tzid
* @param Sabre\VObject\Component $vcalendar
+ *
* @return DateTimeZone
*/
static function getTimeZone($tzid, Component $vcalendar = null, $failIfUncertain = false) {
@@ -134,7 +135,7 @@ class TimeZoneUtil {
// Since PHP 5.5.10, the first bit will be used as the timezone and
// this method will return just GMT+01:00. This is wrong, because it
// doesn't take DST into account.
- if ($tzid[0]!=='(') {
+ if ($tzid[0] !== '(') {
// PHP has a bug that logs PHP warnings even it shouldn't:
// https://bugs.php.net/bug.php?id=67881
@@ -152,7 +153,7 @@ class TimeZoneUtil {
) {
return new \DateTimeZone($tzid);
}
- } catch(\Exception $e) {
+ } catch (\Exception $e) {
}
}
@@ -174,14 +175,14 @@ class TimeZoneUtil {
// for versions under PHP 5.5.10, this bit can be taken out of the
// source.
// @codeCoverageIgnoreStart
- return new \DateTimeZone('Etc/GMT' . $matches[1] . ltrim(substr($matches[2],0,2),'0'));
+ return new \DateTimeZone('Etc/GMT' . $matches[1] . ltrim(substr($matches[2], 0, 2), '0'));
// @codeCoverageIgnoreEnd
}
if ($vcalendar) {
// If that didn't work, we will scan VTIMEZONE objects
- foreach($vcalendar->select('VTIMEZONE') as $vtimezone) {
+ foreach ($vcalendar->select('VTIMEZONE') as $vtimezone) {
if ((string)$vtimezone->TZID === $tzid) {
@@ -193,8 +194,8 @@ class TimeZoneUtil {
// Libical generators may specify strings like
// "SystemV/EST5EDT". For those we must remove the
// SystemV part.
- if (substr($lic,0,8)==='SystemV/') {
- $lic = substr($lic,8);
+ if (substr($lic, 0, 8) === 'SystemV/') {
+ $lic = substr($lic, 8);
}
return self::getTimeZone($lic, null, $failIfUncertain);
@@ -206,7 +207,7 @@ class TimeZoneUtil {
$cdoId = (int)$vtimezone->{'X-MICROSOFT-CDO-TZID'}->getValue();
// 2 can mean both Europe/Lisbon and Europe/Sarajevo.
- if ($cdoId===2 && strpos((string)$vtimezone->TZID, 'Sarajevo')!==false) {
+ if ($cdoId === 2 && strpos((string)$vtimezone->TZID, 'Sarajevo') !== false) {
return new \DateTimeZone('Europe/Sarajevo');
}
@@ -249,7 +250,7 @@ class TimeZoneUtil {
/**
* This method returns an array of timezone identifiers, that are supported
- * by DateTimeZone(), but not returned by DateTimeZone::listIdentifiers()
+ * by DateTimeZone(), but not returned by DateTimeZone::listIdentifiers().
*
* We're not using DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC) because:
* - It's not supported by some PHP versions as well as HHVM.
@@ -258,7 +259,7 @@ class TimeZoneUtil {
*
* @return array
*/
- static public function getIdentifiersBC() {
+ static function getIdentifiersBC() {
return include __DIR__ . '/timezonedata/php-bc.php';
}
diff --git a/lib/UUIDUtil.php b/lib/UUIDUtil.php
index 7b85c91..9fcbd99 100644
--- a/lib/UUIDUtil.php
+++ b/lib/UUIDUtil.php
@@ -3,7 +3,7 @@
namespace Sabre\VObject;
/**
- * UUID Utility
+ * UUID Utility.
*
* This class has static methods to generate and validate UUID's.
* UUIDs are used a decent amount within various *DAV standards, so it made
@@ -16,11 +16,12 @@ namespace Sabre\VObject;
class UUIDUtil {
/**
- * Returns a pseudo-random v4 UUID
+ * Returns a pseudo-random v4 UUID.
*
* This function is based on a comment by Andrew Moore on php.net
*
* @see http://www.php.net/manual/en/function.uniqid.php#94959
+ *
* @return string
*/
static function getUUID() {
@@ -30,22 +31,22 @@ class UUIDUtil {
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
// 32 bits for "time_low"
- mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
+ mt_rand(0, 0xffff), mt_rand(0, 0xffff),
// 16 bits for "time_mid"
- mt_rand( 0, 0xffff ),
+ mt_rand(0, 0xffff),
// 16 bits for "time_hi_and_version",
// four most significant bits holds version number 4
- mt_rand( 0, 0x0fff ) | 0x4000,
+ mt_rand(0, 0x0fff) | 0x4000,
// 16 bits, 8 bits for "clk_seq_hi_res",
// 8 bits for "clk_seq_low",
// two most significant bits holds zero and one for variant DCE1.1
- mt_rand( 0, 0x3fff ) | 0x8000,
+ mt_rand(0, 0x3fff) | 0x8000,
// 48 bits for "node"
- mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
+ mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
);
}
@@ -53,6 +54,7 @@ class UUIDUtil {
* Checks if a string is a valid UUID.
*
* @param string $uuid
+ *
* @return bool
*/
static function validateUUID($uuid) {
diff --git a/lib/VCardConverter.php b/lib/VCardConverter.php
index e2b8c89..2b0814e 100644
--- a/lib/VCardConverter.php
+++ b/lib/VCardConverter.php
@@ -32,7 +32,7 @@ class VCardConverter {
function convert(Component\VCard $input, $targetVersion) {
$inputVersion = $input->getDocumentType();
- if ($inputVersion===$targetVersion) {
+ if ($inputVersion === $targetVersion) {
return clone $input;
}
@@ -43,13 +43,13 @@ class VCardConverter {
throw new \InvalidArgumentException('You can only use vCard 3.0 or 4.0 for the target version');
}
- $newVersion = $targetVersion===Document::VCARD40?'4.0':'3.0';
+ $newVersion = $targetVersion === Document::VCARD40 ? '4.0' : '3.0';
$output = new Component\VCard([
'VERSION' => $newVersion,
]);
- foreach($input->children as $property) {
+ foreach ($input->children as $property) {
$this->convertProperty($input, $output, $property, $targetVersion);
@@ -66,6 +66,7 @@ class VCardConverter {
* @param Component\VCard $output
* @param Property $property
* @param int $targetVersion
+ *
* @return void
*/
protected function convertProperty(Component\VCard $input, Component\VCard $output, Property $property, $targetVersion) {
@@ -87,14 +88,14 @@ class VCardConverter {
$newProperty = $output->createProperty(
$property->name,
$property->getParts(),
- array(), // parameters will get added a bit later.
+ [], // parameters will get added a bit later.
$valueType
);
- if ($targetVersion===Document::VCARD30) {
+ if ($targetVersion === Document::VCARD30) {
- if ($property instanceof Property\Uri && in_array($property->name, ['PHOTO','LOGO','SOUND'])) {
+ if ($property instanceof Property\Uri && in_array($property->name, ['PHOTO', 'LOGO', 'SOUND'])) {
$newProperty = $this->convertUriToBinary($output, $newProperty);
@@ -123,21 +124,21 @@ class VCardConverter {
// group, so we first need to find a groupname that doesn't
// exist yet.
$x = 1;
- while($output->select('ITEM' . $x . '.')) {
+ while ($output->select('ITEM' . $x . '.')) {
$x++;
}
- $output->add('ITEM' . $x . '.X-ABDATE', $newProperty->getValue(), array('VALUE' => 'DATE-AND-OR-TIME'));
+ $output->add('ITEM' . $x . '.X-ABDATE', $newProperty->getValue(), ['VALUE' => 'DATE-AND-OR-TIME']);
$output->add('ITEM' . $x . '.X-ABLABEL', '_$!<Anniversary>!$_');
}
} elseif ($property->name === 'KIND') {
- switch(strtolower($property->getValue())) {
+ switch (strtolower($property->getValue())) {
case 'org' :
// vCard 3.0 does not have an equivalent to KIND:ORG,
// but apple has an extension that means the same
// thing.
- $newProperty = $output->createProperty('X-ABSHOWAS','COMPANY');
+ $newProperty = $output->createProperty('X-ABSHOWAS', 'COMPANY');
break;
case 'individual' :
@@ -146,14 +147,14 @@ class VCardConverter {
case 'group' :
// OS X addressbook property
- $newProperty = $output->createProperty('X-ADDRESSBOOKSERVER-KIND','GROUP');
+ $newProperty = $output->createProperty('X-ADDRESSBOOKSERVER-KIND', 'GROUP');
break;
}
}
- } elseif ($targetVersion===Document::VCARD40) {
+ } elseif ($targetVersion === Document::VCARD40) {
// These properties were removed in vCard 4.0
if (in_array($property->name, ['NAME', 'MAILER', 'LABEL', 'CLASS'])) {
@@ -169,7 +170,7 @@ class VCardConverter {
// If a property such as BDAY contained 'X-APPLE-OMIT-YEAR',
// then we're stripping the year from the vcard 4 value.
$parts = DateTimeParser::parseVCardDateTime($property->getValue());
- if ($parts['year']===$property['X-APPLE-OMIT-YEAR']->getValue()) {
+ if ($parts['year'] === $property['X-APPLE-OMIT-YEAR']->getValue()) {
$newValue = '--' . $parts['month'] . '-' . $parts['date'];
$newProperty->setValue($newValue);
}
@@ -179,15 +180,15 @@ class VCardConverter {
unset($parameters['X-APPLE-OMIT-YEAR']);
}
- switch($property->name) {
+ switch ($property->name) {
case 'X-ABSHOWAS' :
if (strtoupper($property->getValue()) === 'COMPANY') {
- $newProperty = $output->createProperty('KIND','ORG');
+ $newProperty = $output->createProperty('KIND', 'ORG');
}
break;
case 'X-ADDRESSBOOKSERVER-KIND' :
if (strtoupper($property->getValue()) === 'GROUP') {
- $newProperty = $output->createProperty('KIND','GROUP');
+ $newProperty = $output->createProperty('KIND', 'GROUP');
}
break;
case 'X-ANNIVERSARY' :
@@ -208,7 +209,7 @@ class VCardConverter {
$label = $input->{$property->group . '.X-ABLABEL'};
// We only support converting anniversaries.
- if (!$label || $label->getValue()!=='_$!<Anniversary>!$_') {
+ if (!$label || $label->getValue() !== '_$!<Anniversary>!$_') {
break;
}
@@ -223,7 +224,7 @@ class VCardConverter {
break;
// Apple's per-property label system.
case 'X-ABLABEL' :
- if($newProperty->getValue() === '_$!<Anniversary>!$_') {
+ if ($newProperty->getValue() === '_$!<Anniversary>!$_') {
// We can safely remove these, as they are converted to
// ANNIVERSARY properties.
return;
@@ -237,7 +238,7 @@ class VCardConverter {
// set property group
$newProperty->group = $property->group;
- if ($targetVersion===Document::VCARD40) {
+ if ($targetVersion === Document::VCARD40) {
$this->convertParameters40($newProperty, $parameters);
} else {
$this->convertParameters30($newProperty, $parameters);
@@ -266,6 +267,7 @@ class VCardConverter {
* @param Property\Uri $property The input property.
* @param $parameters List of parameters that will eventually be added to
* the new property.
+ *
* @return Property\Uri
*/
protected function convertBinaryToUri(Component\VCard $output, Property\Binary $newProperty, array &$parameters) {
@@ -284,10 +286,10 @@ class VCardConverter {
if (isset($parameters['TYPE'])) {
$newTypes = [];
- foreach($parameters['TYPE']->getParts() as $typePart) {
+ foreach ($parameters['TYPE']->getParts() as $typePart) {
if (in_array(
strtoupper($typePart),
- ['JPEG','PNG','GIF']
+ ['JPEG', 'PNG', 'GIF']
)) {
$mimeType = 'image/' . strtolower($typePart);
} else {
@@ -319,6 +321,7 @@ class VCardConverter {
*
* @param Component\VCard $output
* @param Property\Uri $property The input property.
+ *
* @return Property\Binary|null
*/
protected function convertUriToBinary(Component\VCard $output, Property\Uri $newProperty) {
@@ -326,7 +329,7 @@ class VCardConverter {
$value = $newProperty->getValue();
// Only converting data: uris
- if (substr($value, 0, 5)!=='data:') {
+ if (substr($value, 0, 5) !== 'data:') {
return $newProperty;
}
@@ -337,17 +340,17 @@ class VCardConverter {
'BINARY'
);
- $mimeType = substr($value, 5, strpos($value, ',')-5);
+ $mimeType = substr($value, 5, strpos($value, ',') - 5);
if (strpos($mimeType, ';')) {
- $mimeType = substr($mimeType,0,strpos($mimeType, ';'));
- $newProperty->setValue(base64_decode(substr($value, strpos($value,',')+1)));
+ $mimeType = substr($mimeType, 0, strpos($mimeType, ';'));
+ $newProperty->setValue(base64_decode(substr($value, strpos($value, ',') + 1)));
} else {
- $newProperty->setValue(substr($value, strpos($value,',')+1));
+ $newProperty->setValue(substr($value, strpos($value, ',') + 1));
}
unset($value);
$newProperty['ENCODING'] = 'b';
- switch($mimeType) {
+ switch ($mimeType) {
case 'image/jpeg' :
$newProperty['TYPE'] = 'JPEG';
@@ -367,29 +370,30 @@ class VCardConverter {
}
/**
- * Adds parameters to a new property for vCard 4.0
+ * Adds parameters to a new property for vCard 4.0.
*
* @param Property $newProperty
* @param array $parameters
+ *
* @return void
*/
protected function convertParameters40(Property $newProperty, array $parameters) {
// Adding all parameters.
- foreach($parameters as $param) {
+ foreach ($parameters as $param) {
// vCard 2.1 allowed parameters with no name
if ($param->noName) $param->noName = false;
- switch($param->name) {
+ switch ($param->name) {
// We need to see if there's any TYPE=PREF, because in vCard 4
// that's now PREF=1.
case 'TYPE' :
- foreach($param->getParts() as $paramPart) {
+ foreach ($param->getParts() as $paramPart) {
- if (strtoupper($paramPart)==='PREF') {
- $newProperty->add('PREF','1');
+ if (strtoupper($paramPart) === 'PREF') {
+ $newProperty->add('PREF', '1');
} else {
$newProperty->add($param->name, $paramPart);
}
@@ -412,26 +416,27 @@ class VCardConverter {
}
/**
- * Adds parameters to a new property for vCard 3.0
+ * Adds parameters to a new property for vCard 3.0.
*
* @param Property $newProperty
* @param array $parameters
+ *
* @return void
*/
protected function convertParameters30(Property $newProperty, array $parameters) {
// Adding all parameters.
- foreach($parameters as $param) {
+ foreach ($parameters as $param) {
// vCard 2.1 allowed parameters with no name
if ($param->noName) $param->noName = false;
- switch($param->name) {
+ switch ($param->name) {
case 'ENCODING' :
// This value only existed in vCard 2.1, and should be
// removed for anything else.
- if (strtoupper($param->getValue())!=='QUOTED-PRINTABLE') {
+ if (strtoupper($param->getValue()) !== 'QUOTED-PRINTABLE') {
$newProperty->add($param->name, $param->getParts());
}
break;
@@ -442,8 +447,8 @@ class VCardConverter {
* Any other PREF numbers we'll drop.
*/
case 'PREF' :
- if ($param->getValue()=='1') {
- $newProperty->add('TYPE','PREF');
+ if ($param->getValue() == '1') {
+ $newProperty->add('TYPE', 'PREF');
}
break;
diff --git a/lib/Version.php b/lib/Version.php
index c7b7bf2..380577a 100644
--- a/lib/Version.php
+++ b/lib/Version.php
@@ -3,7 +3,7 @@
namespace Sabre\VObject;
/**
- * This class contains the version number for the VObject package
+ * This class contains the version number for the VObject package.
*
* @copyright Copyright (C) 2011-2015 fruux GmbH (https://fruux.com/).
* @author Evert Pot (http://evertpot.com/)
@@ -12,7 +12,7 @@ namespace Sabre\VObject;
class Version {
/**
- * Full version number
+ * Full version number.
*/
const VERSION = '4.0.0-alpha1';
diff --git a/lib/Writer.php b/lib/Writer.php
index 6e9006c..4633185 100644
--- a/lib/Writer.php
+++ b/lib/Writer.php
@@ -20,6 +20,7 @@ class Writer {
* Serializes a vCard or iCalendar object.
*
* @param Component $component
+ *
* @return string
*/
static function write(Component $component) {
@@ -33,6 +34,7 @@ class Writer {
*
* @param Component $component
* @param int $options
+ *
* @return string
*/
static function writeJson(Component $component, $options = 0) {
@@ -45,9 +47,10 @@ class Writer {
* Serializes a xCal or xCard object.
*
* @param Component $component
+ *
* @return string
*/
- static public function writeXml(Component $component) {
+ static function writeXml(Component $component) {
$writer = new Xml\Writer();
$writer->openMemory();
diff --git a/lib/timezonedata/exchangezones.php b/lib/timezonedata/exchangezones.php
index e772a5d..131c901 100644
--- a/lib/timezonedata/exchangezones.php
+++ b/lib/timezonedata/exchangezones.php
@@ -3,7 +3,7 @@
/**
* Microsoft exchange timezones
* Source:
- * http://msdn.microsoft.com/en-us/library/ms988620%28v=exchg.65%29.aspx
+ * http://msdn.microsoft.com/en-us/library/ms988620%28v=exchg.65%29.aspx.
*
* Correct timezones deduced with help from:
* http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
diff --git a/lib/timezonedata/lotuszones.php b/lib/timezonedata/lotuszones.php
index 753a9bb..7064938 100644
--- a/lib/timezonedata/lotuszones.php
+++ b/lib/timezonedata/lotuszones.php
@@ -2,7 +2,7 @@
/**
* The following list are timezone names that could be generated by
- * Lotus / Domino
+ * Lotus / Domino.
*
* @copyright Copyright (C) 2011-2015 fruux GmbH (https://fruux.com/).
* @license http://sabre.io/license/ Modified BSD License
diff --git a/lib/timezonedata/php-bc.php b/lib/timezonedata/php-bc.php
index 74d78b0..fd56618 100644
--- a/lib/timezonedata/php-bc.php
+++ b/lib/timezonedata/php-bc.php
@@ -1,8 +1,9 @@
<?php
+
/**
* A list of additional PHP timezones that are returned by
* DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC)
- * valid for new DateTimeZone()
+ * valid for new DateTimeZone().
*
* This list does not include those timezone identifiers that we have to map to
* a different identifier for some PHP versions (see php-workaround.php).
diff --git a/lib/timezonedata/php-workaround.php b/lib/timezonedata/php-workaround.php
index 8690a4b..0a173a6 100644
--- a/lib/timezonedata/php-workaround.php
+++ b/lib/timezonedata/php-workaround.php
@@ -1,7 +1,8 @@
<?php
+
/**
* A list of PHP timezones that were supported until 5.5.9, removed in
- * PHP 5.5.10 and re-introduced in PHP 5.5.17
+ * PHP 5.5.10 and re-introduced in PHP 5.5.17.
*
* DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC) returns them,
* but they are invalid for new DateTimeZone(). Fixed in PHP 5.5.17.
diff --git a/lib/timezonedata/windowszones.php b/lib/timezonedata/windowszones.php
index 62bc939..032291c 100644
--- a/lib/timezonedata/windowszones.php
+++ b/lib/timezonedata/windowszones.php
@@ -1,7 +1,7 @@
<?php
/**
- * Automatically generated timezone file
+ * Automatically generated timezone file.
*
* Last update: 2015-01-30T15:01:05-05:00
* Source: http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml
@@ -10,109 +10,109 @@
* @license http://sabre.io/license/ Modified BSD License
*/
-return array (
- 'AUS Central Standard Time' => 'Australia/Darwin',
- 'AUS Eastern Standard Time' => 'Australia/Sydney',
- 'Afghanistan Standard Time' => 'Asia/Kabul',
- 'Alaskan Standard Time' => 'America/Anchorage',
- 'Arab Standard Time' => 'Asia/Riyadh',
- 'Arabian Standard Time' => 'Asia/Dubai',
- 'Arabic Standard Time' => 'Asia/Baghdad',
- 'Argentina Standard Time' => 'America/Buenos_Aires',
- 'Atlantic Standard Time' => 'America/Halifax',
- 'Azerbaijan Standard Time' => 'Asia/Baku',
- 'Azores Standard Time' => 'Atlantic/Azores',
- 'Bahia Standard Time' => 'America/Bahia',
- 'Bangladesh Standard Time' => 'Asia/Dhaka',
- 'Belarus Standard Time' => 'Europe/Minsk',
- 'Canada Central Standard Time' => 'America/Regina',
- 'Cape Verde Standard Time' => 'Atlantic/Cape_Verde',
- 'Caucasus Standard Time' => 'Asia/Yerevan',
- 'Cen. Australia Standard Time' => 'Australia/Adelaide',
- 'Central America Standard Time' => 'America/Guatemala',
- 'Central Asia Standard Time' => 'Asia/Almaty',
+return [
+ 'AUS Central Standard Time' => 'Australia/Darwin',
+ 'AUS Eastern Standard Time' => 'Australia/Sydney',
+ 'Afghanistan Standard Time' => 'Asia/Kabul',
+ 'Alaskan Standard Time' => 'America/Anchorage',
+ 'Arab Standard Time' => 'Asia/Riyadh',
+ 'Arabian Standard Time' => 'Asia/Dubai',
+ 'Arabic Standard Time' => 'Asia/Baghdad',
+ 'Argentina Standard Time' => 'America/Buenos_Aires',
+ 'Atlantic Standard Time' => 'America/Halifax',
+ 'Azerbaijan Standard Time' => 'Asia/Baku',
+ 'Azores Standard Time' => 'Atlantic/Azores',
+ 'Bahia Standard Time' => 'America/Bahia',
+ 'Bangladesh Standard Time' => 'Asia/Dhaka',
+ 'Belarus Standard Time' => 'Europe/Minsk',
+ 'Canada Central Standard Time' => 'America/Regina',
+ 'Cape Verde Standard Time' => 'Atlantic/Cape_Verde',
+ 'Caucasus Standard Time' => 'Asia/Yerevan',
+ 'Cen. Australia Standard Time' => 'Australia/Adelaide',
+ 'Central America Standard Time' => 'America/Guatemala',
+ 'Central Asia Standard Time' => 'Asia/Almaty',
'Central Brazilian Standard Time' => 'America/Cuiaba',
- 'Central Europe Standard Time' => 'Europe/Budapest',
- 'Central European Standard Time' => 'Europe/Warsaw',
- 'Central Pacific Standard Time' => 'Pacific/Guadalcanal',
- 'Central Standard Time' => 'America/Chicago',
- 'Central Standard Time (Mexico)' => 'America/Mexico_City',
- 'China Standard Time' => 'Asia/Shanghai',
- 'Dateline Standard Time' => 'Etc/GMT+12',
- 'E. Africa Standard Time' => 'Africa/Nairobi',
- 'E. Australia Standard Time' => 'Australia/Brisbane',
- 'E. South America Standard Time' => 'America/Sao_Paulo',
- 'Eastern Standard Time' => 'America/New_York',
- 'Egypt Standard Time' => 'Africa/Cairo',
- 'Ekaterinburg Standard Time' => 'Asia/Yekaterinburg',
- 'FLE Standard Time' => 'Europe/Kiev',
- 'Fiji Standard Time' => 'Pacific/Fiji',
- 'GMT Standard Time' => 'Europe/London',
- 'GTB Standard Time' => 'Europe/Bucharest',
- 'Georgian Standard Time' => 'Asia/Tbilisi',
- 'Greenland Standard Time' => 'America/Godthab',
- 'Greenwich Standard Time' => 'Atlantic/Reykjavik',
- 'Hawaiian Standard Time' => 'Pacific/Honolulu',
- 'India Standard Time' => 'Asia/Calcutta',
- 'Iran Standard Time' => 'Asia/Tehran',
- 'Israel Standard Time' => 'Asia/Jerusalem',
- 'Jordan Standard Time' => 'Asia/Amman',
- 'Kaliningrad Standard Time' => 'Europe/Kaliningrad',
- 'Korea Standard Time' => 'Asia/Seoul',
- 'Libya Standard Time' => 'Africa/Tripoli',
- 'Line Islands Standard Time' => 'Pacific/Kiritimati',
- 'Magadan Standard Time' => 'Asia/Magadan',
- 'Mauritius Standard Time' => 'Indian/Mauritius',
- 'Middle East Standard Time' => 'Asia/Beirut',
- 'Montevideo Standard Time' => 'America/Montevideo',
- 'Morocco Standard Time' => 'Africa/Casablanca',
- 'Mountain Standard Time' => 'America/Denver',
+ 'Central Europe Standard Time' => 'Europe/Budapest',
+ 'Central European Standard Time' => 'Europe/Warsaw',
+ 'Central Pacific Standard Time' => 'Pacific/Guadalcanal',
+ 'Central Standard Time' => 'America/Chicago',
+ 'Central Standard Time (Mexico)' => 'America/Mexico_City',
+ 'China Standard Time' => 'Asia/Shanghai',
+ 'Dateline Standard Time' => 'Etc/GMT+12',
+ 'E. Africa Standard Time' => 'Africa/Nairobi',
+ 'E. Australia Standard Time' => 'Australia/Brisbane',
+ 'E. South America Standard Time' => 'America/Sao_Paulo',
+ 'Eastern Standard Time' => 'America/New_York',
+ 'Egypt Standard Time' => 'Africa/Cairo',
+ 'Ekaterinburg Standard Time' => 'Asia/Yekaterinburg',
+ 'FLE Standard Time' => 'Europe/Kiev',
+ 'Fiji Standard Time' => 'Pacific/Fiji',
+ 'GMT Standard Time' => 'Europe/London',
+ 'GTB Standard Time' => 'Europe/Bucharest',
+ 'Georgian Standard Time' => 'Asia/Tbilisi',
+ 'Greenland Standard Time' => 'America/Godthab',
+ 'Greenwich Standard Time' => 'Atlantic/Reykjavik',
+ 'Hawaiian Standard Time' => 'Pacific/Honolulu',
+ 'India Standard Time' => 'Asia/Calcutta',
+ 'Iran Standard Time' => 'Asia/Tehran',
+ 'Israel Standard Time' => 'Asia/Jerusalem',
+ 'Jordan Standard Time' => 'Asia/Amman',
+ 'Kaliningrad Standard Time' => 'Europe/Kaliningrad',
+ 'Korea Standard Time' => 'Asia/Seoul',
+ 'Libya Standard Time' => 'Africa/Tripoli',
+ 'Line Islands Standard Time' => 'Pacific/Kiritimati',
+ 'Magadan Standard Time' => 'Asia/Magadan',
+ 'Mauritius Standard Time' => 'Indian/Mauritius',
+ 'Middle East Standard Time' => 'Asia/Beirut',
+ 'Montevideo Standard Time' => 'America/Montevideo',
+ 'Morocco Standard Time' => 'Africa/Casablanca',
+ 'Mountain Standard Time' => 'America/Denver',
'Mountain Standard Time (Mexico)' => 'America/Chihuahua',
- 'Myanmar Standard Time' => 'Asia/Rangoon',
- 'N. Central Asia Standard Time' => 'Asia/Novosibirsk',
- 'Namibia Standard Time' => 'Africa/Windhoek',
- 'Nepal Standard Time' => 'Asia/Katmandu',
- 'New Zealand Standard Time' => 'Pacific/Auckland',
- 'Newfoundland Standard Time' => 'America/St_Johns',
- 'North Asia East Standard Time' => 'Asia/Irkutsk',
- 'North Asia Standard Time' => 'Asia/Krasnoyarsk',
- 'Pacific SA Standard Time' => 'America/Santiago',
- 'Pacific Standard Time' => 'America/Los_Angeles',
- 'Pacific Standard Time (Mexico)' => 'America/Santa_Isabel',
- 'Pakistan Standard Time' => 'Asia/Karachi',
- 'Paraguay Standard Time' => 'America/Asuncion',
- 'Romance Standard Time' => 'Europe/Paris',
- 'Russia Time Zone 10' => 'Asia/Srednekolymsk',
- 'Russia Time Zone 11' => 'Asia/Kamchatka',
- 'Russia Time Zone 3' => 'Europe/Samara',
- 'Russian Standard Time' => 'Europe/Moscow',
- 'SA Eastern Standard Time' => 'America/Cayenne',
- 'SA Pacific Standard Time' => 'America/Bogota',
- 'SA Western Standard Time' => 'America/La_Paz',
- 'SE Asia Standard Time' => 'Asia/Bangkok',
- 'Samoa Standard Time' => 'Pacific/Apia',
- 'Singapore Standard Time' => 'Asia/Singapore',
- 'South Africa Standard Time' => 'Africa/Johannesburg',
- 'Sri Lanka Standard Time' => 'Asia/Colombo',
- 'Syria Standard Time' => 'Asia/Damascus',
- 'Taipei Standard Time' => 'Asia/Taipei',
- 'Tasmania Standard Time' => 'Australia/Hobart',
- 'Tokyo Standard Time' => 'Asia/Tokyo',
- 'Tonga Standard Time' => 'Pacific/Tongatapu',
- 'Turkey Standard Time' => 'Europe/Istanbul',
- 'US Eastern Standard Time' => 'America/Indianapolis',
- 'US Mountain Standard Time' => 'America/Phoenix',
- 'UTC' => 'Etc/GMT',
- 'UTC+12' => 'Etc/GMT-12',
- 'UTC-02' => 'Etc/GMT+2',
- 'UTC-11' => 'Etc/GMT+11',
- 'Ulaanbaatar Standard Time' => 'Asia/Ulaanbaatar',
- 'Venezuela Standard Time' => 'America/Caracas',
- 'Vladivostok Standard Time' => 'Asia/Vladivostok',
- 'W. Australia Standard Time' => 'Australia/Perth',
+ 'Myanmar Standard Time' => 'Asia/Rangoon',
+ 'N. Central Asia Standard Time' => 'Asia/Novosibirsk',
+ 'Namibia Standard Time' => 'Africa/Windhoek',
+ 'Nepal Standard Time' => 'Asia/Katmandu',
+ 'New Zealand Standard Time' => 'Pacific/Auckland',
+ 'Newfoundland Standard Time' => 'America/St_Johns',
+ 'North Asia East Standard Time' => 'Asia/Irkutsk',
+ 'North Asia Standard Time' => 'Asia/Krasnoyarsk',
+ 'Pacific SA Standard Time' => 'America/Santiago',
+ 'Pacific Standard Time' => 'America/Los_Angeles',
+ 'Pacific Standard Time (Mexico)' => 'America/Santa_Isabel',
+ 'Pakistan Standard Time' => 'Asia/Karachi',
+ 'Paraguay Standard Time' => 'America/Asuncion',
+ 'Romance Standard Time' => 'Europe/Paris',
+ 'Russia Time Zone 10' => 'Asia/Srednekolymsk',
+ 'Russia Time Zone 11' => 'Asia/Kamchatka',
+ 'Russia Time Zone 3' => 'Europe/Samara',
+ 'Russian Standard Time' => 'Europe/Moscow',
+ 'SA Eastern Standard Time' => 'America/Cayenne',
+ 'SA Pacific Standard Time' => 'America/Bogota',
+ 'SA Western Standard Time' => 'America/La_Paz',
+ 'SE Asia Standard Time' => 'Asia/Bangkok',
+ 'Samoa Standard Time' => 'Pacific/Apia',
+ 'Singapore Standard Time' => 'Asia/Singapore',
+ 'South Africa Standard Time' => 'Africa/Johannesburg',
+ 'Sri Lanka Standard Time' => 'Asia/Colombo',
+ 'Syria Standard Time' => 'Asia/Damascus',
+ 'Taipei Standard Time' => 'Asia/Taipei',
+ 'Tasmania Standard Time' => 'Australia/Hobart',
+ 'Tokyo Standard Time' => 'Asia/Tokyo',
+ 'Tonga Standard Time' => 'Pacific/Tongatapu',
+ 'Turkey Standard Time' => 'Europe/Istanbul',
+ 'US Eastern Standard Time' => 'America/Indianapolis',
+ 'US Mountain Standard Time' => 'America/Phoenix',
+ 'UTC' => 'Etc/GMT',
+ 'UTC+12' => 'Etc/GMT-12',
+ 'UTC-02' => 'Etc/GMT+2',
+ 'UTC-11' => 'Etc/GMT+11',
+ 'Ulaanbaatar Standard Time' => 'Asia/Ulaanbaatar',
+ 'Venezuela Standard Time' => 'America/Caracas',
+ 'Vladivostok Standard Time' => 'Asia/Vladivostok',
+ 'W. Australia Standard Time' => 'Australia/Perth',
'W. Central Africa Standard Time' => 'Africa/Lagos',
- 'W. Europe Standard Time' => 'Europe/Berlin',
- 'West Asia Standard Time' => 'Asia/Tashkent',
- 'West Pacific Standard Time' => 'Pacific/Port_Moresby',
- 'Yakutsk Standard Time' => 'Asia/Yakutsk',
-);
+ 'W. Europe Standard Time' => 'Europe/Berlin',
+ 'West Asia Standard Time' => 'Asia/Tashkent',
+ 'West Pacific Standard Time' => 'Pacific/Port_Moresby',
+ 'Yakutsk Standard Time' => 'Asia/Yakutsk',
+];
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git
More information about the Pkg-owncloud-commits
mailing list