[Pkg-owncloud-commits] [php-sabre-vobject] 02/341: Moved a bunch of classes to PHP 5.4 array syntax and dropped unnneeded 'public'.

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 13:35:24 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 2cba2153fc3c6a5978cef2ff1c5bfc54d73c730d
Author: Evert Pot <me at evertpot.com>
Date:   Wed Aug 20 00:20:45 2014 -0400

    Moved a bunch of classes to PHP 5.4 array syntax and dropped unnneeded 'public'.
---
 lib/Cli.php                 | 24 +++++++--------
 lib/Component.php           | 74 ++++++++++++++++++++++-----------------------
 lib/Component/VAlarm.php    | 10 +++---
 lib/Component/VCalendar.php | 56 +++++++++++++++++-----------------
 lib/Component/VCard.php     | 52 +++++++++++++++----------------
 lib/Component/VEvent.php    | 12 ++++----
 lib/Component/VFreeBusy.php |  8 ++---
 lib/Component/VJournal.php  |  8 ++---
 lib/Component/VTimeZone.php |  6 ++--
 lib/Component/VTodo.php     | 18 +++++------
 lib/DateTimeParser.php      | 32 ++++++++++----------
 lib/Document.php            | 36 +++++++++++-----------
 lib/ElementList.php         | 24 +++++++--------
 lib/FreeBusyGenerator.php   | 32 ++++++++++----------
 lib/Node.php                | 24 +++++++--------
 lib/Parameter.php           | 30 +++++++++---------
 lib/Property.php            | 64 +++++++++++++++++++--------------------
 lib/Reader.php              |  4 +--
 lib/StringUtil.php          |  6 ++--
 lib/TimeZoneUtil.php        |  8 ++---
 lib/UUIDUtil.php            |  4 +--
 lib/VCardConverter.php      | 32 ++++++++++----------
 22 files changed, 282 insertions(+), 282 deletions(-)

diff --git a/lib/Cli.php b/lib/Cli.php
index cac0763..bd287f0 100644
--- a/lib/Cli.php
+++ b/lib/Cli.php
@@ -96,7 +96,7 @@ class Cli {
      *
      * @return int
      */
-    public function main(array $argv) {
+    function main(array $argv) {
 
         // @codeCoverageIgnoreStart
         // We cannot easily test this, so we'll skip it. Pretty basic anyway.
@@ -346,11 +346,11 @@ HELP
             $this->log("  No warnings!");
         } else {
 
-            $levels = array(
+            $levels = [
                 1 => 'REPAIRED',
                 2 => 'WARNING',
                 3 => 'ERROR',
-            );
+            ];
             $returnCode = 2;
             foreach($warnings as $warn) {
 
@@ -392,11 +392,11 @@ HELP
             $this->log("  No warnings!");
         } else {
 
-            $levels = array(
+            $levels = [
                 1 => 'REPAIRED',
                 2 => 'WARNING',
                 3 => 'ERROR',
-            );
+            ];
             $returnCode = 2;
             foreach($warnings as $warn) {
 
@@ -500,7 +500,7 @@ HELP
      */
     protected function colorize($color, $str, $resetTo = 'default') {
 
-        $colors = array(
+        $colors = [
             'cyan'    => '1;36',
             'red'     => '1;31',
             'yellow'  => '1;33',
@@ -508,7 +508,7 @@ HELP
             'green'   => '0;32',
             'default' => '0',
             'purple'  => '0;35',
-        );
+        ];
         return "\033[" . $colors[$color] . 'm' . $str . "\033[".$colors[$resetTo]."m";
 
     }
@@ -654,13 +654,13 @@ HELP
 
                     $subPart = strtr(
                         $subPart,
-                        array(
+                        [
                             '\\' => $this->colorize('purple', '\\\\', 'green'),
                             ';'  => $this->colorize('purple', '\;', 'green'),
                             ','  => $this->colorize('purple', '\,', 'green'),
                             "\n" => $this->colorize('purple', "\\n\n\t", 'green'),
                             "\r" => "",
-                        )
+                        ]
                     );
 
                     $this->cWrite('green', $subPart);
@@ -680,8 +680,8 @@ HELP
      */
     protected function parseArguments(array $argv) {
 
-        $positional = array();
-        $options = array();
+        $positional = [];
+        $options = [];
 
         for($ii=0; $ii < count($argv); $ii++) {
 
@@ -712,7 +712,7 @@ HELP
 
         }
 
-        return array($options, $positional);
+        return [$options, $positional];
 
     }
 
diff --git a/lib/Component.php b/lib/Component.php
index 4ac0314..1333978 100644
--- a/lib/Component.php
+++ b/lib/Component.php
@@ -28,7 +28,7 @@ class Component extends Node {
      *
      * @var array
      */
-    public $children = array();
+    public $children = [];
 
     /**
      * Creates a new component.
@@ -47,7 +47,7 @@ class Component extends Node {
      * @param bool $defaults
      * @return void
      */
-    public function __construct(Document $root, $name, array $children = array(), $defaults = true) {
+    function __construct(Document $root, $name, array $children = [], $defaults = true) {
 
         $this->name = strtoupper($name);
         $this->root = $root;
@@ -58,7 +58,7 @@ class Component extends Node {
             // defaults and the childrens list, are inserted in the object in a
             // natural way.
             $list = $this->getDefaults();
-            $nodes = array();
+            $nodes = [];
             foreach($children as $key=>$value) {
                 if ($value instanceof Node) {
                     if (isset($list[$value->name])) {
@@ -98,13 +98,13 @@ class Component extends Node {
      *
      * add(Component $comp) // Adds a new component
      * add(Property $prop)  // Adds a new property
-     * add($name, $value, array $parameters = array()) // Adds a new property
-     * add($name, array $children = array()) // Adds a new component
+     * add($name, $value, array $parameters = []) // Adds a new property
+     * add($name, array $children = []) // Adds a new component
      * by name.
      *
      * @return Node
      */
-    public function add($a1, $a2 = null, $a3 = null) {
+    function add($a1, $a2 = null, $a3 = null) {
 
         if ($a1 instanceof Node) {
             if (!is_null($a2)) {
@@ -145,7 +145,7 @@ class Component extends Node {
      * @param mixed $item
      * @return void
      */
-    public function remove($item) {
+    function remove($item) {
 
         if (is_string($item)) {
             $children = $this->select($item);
@@ -172,7 +172,7 @@ class Component extends Node {
      *
      * @return array
      */
-    public function children() {
+    function children() {
 
         return $this->children;
 
@@ -184,9 +184,9 @@ class Component extends Node {
      *
      * @return array
      */
-    public function getComponents() {
+    function getComponents() {
 
-        $result = array();
+        $result = [];
         foreach($this->children as $child) {
             if ($child instanceof Component) {
                 $result[] = $child;
@@ -213,7 +213,7 @@ class Component extends Node {
      * @param string $name
      * @return array
      */
-    public function select($name) {
+    function select($name) {
 
         $group = null;
         $name = strtoupper($name);
@@ -221,7 +221,7 @@ class Component extends Node {
             list($group,$name) = explode('.', $name, 2);
         }
 
-        $result = array();
+        $result = [];
         foreach($this->children as $key=>$child) {
 
             if (
@@ -244,7 +244,7 @@ class Component extends Node {
      *
      * @return string
      */
-    public function serialize() {
+    function serialize() {
 
         $str = "BEGIN:" . $this->name . "\r\n";
 
@@ -318,10 +318,10 @@ class Component extends Node {
      *
      * @return array
      */
-    public function jsonSerialize() {
+    function jsonSerialize() {
 
-        $components = array();
-        $properties = array();
+        $components = [];
+        $properties = [];
 
         foreach($this->children as $child) {
             if ($child instanceof Component) {
@@ -331,11 +331,11 @@ class Component extends Node {
             }
         }
 
-        return array(
+        return [
             strtolower($this->name),
             $properties,
             $components
-        );
+        ];
 
     }
 
@@ -346,7 +346,7 @@ class Component extends Node {
      */
     protected function getDefaults() {
 
-        return array();
+        return [];
 
     }
 
@@ -365,7 +365,7 @@ class Component extends Node {
      * @param string $name
      * @return Property
      */
-    public function __get($name) {
+    function __get($name) {
 
         $matches = $this->select($name);
         if (count($matches)===0) {
@@ -385,7 +385,7 @@ class Component extends Node {
      * @param string $name
      * @return bool
      */
-    public function __isset($name) {
+    function __isset($name) {
 
         $matches = $this->select($name);
         return count($matches)>0;
@@ -405,7 +405,7 @@ class Component extends Node {
      * @param mixed $value
      * @return void
      */
-    public function __set($name, $value) {
+    function __set($name, $value) {
 
         $matches = $this->select($name);
         $overWrite = count($matches)?key($matches):null;
@@ -435,7 +435,7 @@ class Component extends Node {
      * @param string $name
      * @return void
      */
-    public function __unset($name) {
+    function __unset($name) {
 
         $matches = $this->select($name);
         foreach($matches as $k=>$child) {
@@ -455,7 +455,7 @@ class Component extends Node {
      *
      * @return void
      */
-    public function __clone() {
+    function __clone() {
 
         foreach($this->children as $key=>$child) {
             $this->children[$key] = clone $child;
@@ -485,9 +485,9 @@ class Component extends Node {
      *
      * @var array
      */
-    public function getValidationRules() {
+    function getValidationRules() {
 
-        return array();
+        return [];
 
     }
 
@@ -512,14 +512,14 @@ class Component extends Node {
      * @param int $options
      * @return array
      */
-    public function validate($options = 0) {
+    function validate($options = 0) {
 
         $rules = $this->getValidationRules();
         $defaults = $this->getDefaults();
 
-        $propertyCounters = array();
+        $propertyCounters = [];
 
-        $messages = array();
+        $messages = [];
 
         foreach($this->children as $child) {
             $name = strtoupper($child->name);
@@ -536,11 +536,11 @@ class Component extends Node {
             switch($rule) {
                 case '0' :
                     if (isset($propertyCounters[$propName])) {
-                        $messages[] = array(
+                        $messages[] = [
                             'level' => 3,
                             'message' => $propName . ' MUST NOT appear in a ' . $this->name . ' component',
                             'node' => $this,
-                        );
+                        ];
                     }
                     break;
                 case '1' :
@@ -549,31 +549,31 @@ class Component extends Node {
                         if ($options & self::REPAIR && isset($defaults[$propName])) {
                             $this->add($propName, $defaults[$propName]);
                         }
-                        $messages[] = array(
+                        $messages[] = [
                             'level' => $repaired?1:3,
                             'message' => $propName . ' MUST appear exactly once in a ' . $this->name . ' component',
                             'node' => $this,
-                        );
+                        ];
                     }
                     break;
                 case '+' :
                     if (!isset($propertyCounters[$propName]) || $propertyCounters[$propName] < 1) {
-                        $messages[] = array(
+                        $messages[] = [
                             'level' => 3,
                             'message' => $propName . ' MUST appear at least once in a ' . $this->name . ' component',
                             'node' => $this,
-                        );
+                        ];
                     }
                     break;
                 case '*' :
                     break;
                 case '?' :
                     if (isset($propertyCounters[$propName]) && $propertyCounters[$propName] > 1) {
-                        $messages[] = array(
+                        $messages[] = [
                             'level' => 3,
                             'message' => $propName . ' MUST NOT appear more than once in a ' . $this->name . ' component',
                             'node' => $this,
-                        );
+                        ];
                     }
                     break;
 
diff --git a/lib/Component/VAlarm.php b/lib/Component/VAlarm.php
index b9aaae1..58d3de9 100644
--- a/lib/Component/VAlarm.php
+++ b/lib/Component/VAlarm.php
@@ -21,7 +21,7 @@ class VAlarm extends VObject\Component {
      *
      * @return DateTime
      */
-    public function getEffectiveTriggerTime() {
+    function getEffectiveTriggerTime() {
 
         $trigger = $this->TRIGGER;
         if(!isset($trigger['VALUE']) || strtoupper($trigger['VALUE']) === 'DURATION') {
@@ -79,7 +79,7 @@ class VAlarm extends VObject\Component {
      * @param \DateTime $end
      * @return bool
      */
-    public function isInTimeRange(\DateTime $start, \DateTime $end) {
+    function isInTimeRange(\DateTime $start, \DateTime $end) {
 
         $effectiveTrigger = $this->getEffectiveTriggerTime();
 
@@ -119,9 +119,9 @@ class VAlarm extends VObject\Component {
      *
      * @var array
      */
-    public function getValidationRules() {
+    function getValidationRules() {
 
-        return array(
+        return [
             'ACTION' => 1,
             'TRIGGER' => 1,
 
@@ -129,7 +129,7 @@ class VAlarm extends VObject\Component {
             'REPEAT' => '?',
 
             'ATTACH' => '?',
-        );
+        ];
 
     }
 
diff --git a/lib/Component/VCalendar.php b/lib/Component/VCalendar.php
index 8e609f2..3be3f59 100644
--- a/lib/Component/VCalendar.php
+++ b/lib/Component/VCalendar.php
@@ -32,21 +32,21 @@ class VCalendar extends VObject\Document {
      *
      * @var array
      */
-    static public $componentMap = array(
+    static public $componentMap = [
         'VALARM'    => 'Sabre\\VObject\\Component\\VAlarm',
         'VEVENT'    => 'Sabre\\VObject\\Component\\VEvent',
         'VFREEBUSY' => 'Sabre\\VObject\\Component\\VFreeBusy',
         'VJOURNAL'  => 'Sabre\\VObject\\Component\\VJournal',
         'VTIMEZONE' => 'Sabre\\VObject\\Component\\VTimeZone',
         'VTODO'     => 'Sabre\\VObject\\Component\\VTodo',
-    );
+    ];
 
     /**
      * List of value-types, and which classes they map to.
      *
      * @var array
      */
-    static public $valueMap = array(
+    static public $valueMap = [
         'BINARY'           => 'Sabre\\VObject\\Property\\Binary',
         'BOOLEAN'          => 'Sabre\\VObject\\Property\\Boolean',
         'CAL-ADDRESS'      => 'Sabre\\VObject\\Property\\ICalendar\\CalAddress',
@@ -62,14 +62,14 @@ class VCalendar extends VObject\Document {
         'UNKNOWN'          => 'Sabre\\VObject\\Property\\Unknown', // jCard / jCal-only.
         'URI'              => 'Sabre\\VObject\\Property\\Uri',
         'UTC-OFFSET'       => 'Sabre\\VObject\\Property\\UtcOffset',
-    );
+    ];
 
     /**
      * List of properties, and which classes they map to.
      *
      * @var array
      */
-    static public $propertyMap = array(
+    static public $propertyMap = [
         // Calendar properties
         'CALSCALE'      => 'Sabre\\VObject\\Property\\FlatText',
         'METHOD'        => 'Sabre\\VObject\\Property\\FlatText',
@@ -141,14 +141,14 @@ class VCalendar extends VObject\Document {
         'PROXIMITY'      => 'Sabre\\VObject\\Property\\Text',
         'DEFAULT-ALARM'  => 'Sabre\\VObject\\Property\\Boolean',
 
-    );
+    ];
 
     /**
      * Returns the current document type.
      *
      * @return void
      */
-    public function getDocumentType() {
+    function getDocumentType() {
 
         return self::ICALENDAR20;
 
@@ -164,9 +164,9 @@ class VCalendar extends VObject\Document {
      * @param string $componentName filter by component name
      * @return VObject\Component[]
      */
-    public function getBaseComponents($componentName = null) {
+    function getBaseComponents($componentName = null) {
 
-        $components = array();
+        $components = [];
         foreach($this->children as $component) {
 
             if (!$component instanceof VObject\Component)
@@ -198,7 +198,7 @@ class VCalendar extends VObject\Document {
      * @param string $componentName filter by component name
      * @return VObject\Component|null
      */
-    public function getBaseComponent($componentName = null) {
+    function getBaseComponent($componentName = null) {
 
         foreach($this->children as $component) {
 
@@ -241,9 +241,9 @@ class VCalendar extends VObject\Document {
      * @param DateTime $end
      * @return void
      */
-    public function expand(\DateTime $start, \DateTime $end) {
+    function expand(\DateTime $start, \DateTime $end) {
 
-        $newEvents = array();
+        $newEvents = [];
 
         foreach($this->select('VEVENT') as $key=>$vevent) {
 
@@ -314,11 +314,11 @@ class VCalendar extends VObject\Document {
      */
     protected function getDefaults() {
 
-        return array(
+        return [
             'VERSION' => '2.0',
             'PRODID' => '-//Sabre//Sabre VObject ' . VObject\Version::VERSION . '//EN',
             'CALSCALE' => 'GREGORIAN',
-        );
+        ];
 
     }
 
@@ -336,15 +336,15 @@ class VCalendar extends VObject\Document {
      *
      * @var array
      */
-    public function getValidationRules() {
+    function getValidationRules() {
 
-        return array(
+        return [
             'PRODID' => 1,
             'VERSION' => 1,
 
             'CALSCALE' => '?',
             'METHOD' => '?',
-        );
+        ];
 
     }
 
@@ -359,29 +359,29 @@ class VCalendar extends VObject\Document {
      *
      * @return array
      */
-    public function validate($options = 0) {
+    function validate($options = 0) {
 
         $warnings = parent::validate($options);
 
         if ($ver = $this->VERSION) {
             if ((string)$ver !== '2.0') {
-                $warnings[] = array(
+                $warnings[] = [
                     'level' => 3,
                     'message' => 'Only iCalendar version 2.0 as defined in rfc5545 is supported.',
                     'node' => $this,
-                );
+                ];
             }
 
         }
 
-        $uidList = array();
+        $uidList = [];
 
         $componentsFound = 0;
         foreach($this->children as $child) {
             if($child instanceof Component) {
                 $componentsFound++;
 
-                if (!in_array($child->name, array('VEVENT', 'VTODO', 'VJOURNAL'))) {
+                if (!in_array($child->name, ['VEVENT', 'VTODO', 'VJOURNAL'])) {
                     continue;
                 }
 
@@ -390,29 +390,29 @@ class VCalendar extends VObject\Document {
                 if (isset($uidList[$uid])) {
                     $uidList[$uid]['count']++;
                     if ($isMaster && $uidList[$uid]['hasMaster']) {
-                        $warnings[] = array(
+                        $warnings[] = [
                             'level' => 3,
                             'message' => 'More than one master object was found for the object with UID ' . $uid,
                             'node' => $this,
-                        );
+                        ];
                     }
                     $uidList[$uid]['hasMaster']+=$isMaster;
                 } else {
-                    $uidList[$uid] = array(
+                    $uidList[$uid] = [
                         'count' => 1,
                         'hasMaster' => $isMaster,
-                    );
+                    ];
                 }
 
             }
         }
 
         if ($componentsFound===0) {
-            $warnings[] = array(
+            $warnings[] = [
                 'level' => 3,
                 'message' => 'An iCalendar object must have at least 1 component.',
                 'node' => $this,
-            );
+            ];
         }
 
         return $warnings;
diff --git a/lib/Component/VCard.php b/lib/Component/VCard.php
index 632ddc3..2539fa6 100644
--- a/lib/Component/VCard.php
+++ b/lib/Component/VCard.php
@@ -24,7 +24,7 @@ class VCard extends VObject\Document {
      *
      * @var string
      */
-    static public $defaultName = 'VCARD';
+    static $defaultName = 'VCARD';
 
     /**
      * Caching the version number
@@ -38,7 +38,7 @@ class VCard extends VObject\Document {
      *
      * @var array
      */
-    static public $valueMap = array(
+    static $valueMap = [
         'BINARY'           => 'Sabre\\VObject\\Property\\Binary',
         'BOOLEAN'          => 'Sabre\\VObject\\Property\\Boolean',
         'CONTENT-ID'       => 'Sabre\\VObject\\Property\\FlatText',   // vCard 2.1 only
@@ -55,14 +55,14 @@ class VCard extends VObject\Document {
         'URI'              => 'Sabre\\VObject\\Property\\Uri',
         'URL'              => 'Sabre\\VObject\\Property\\Uri', // vCard 2.1 only
         'UTC-OFFSET'       => 'Sabre\\VObject\\Property\\UtcOffset',
-    );
+    ];
 
     /**
      * List of properties, and which classes they map to.
      *
      * @var array
      */
-    static public $propertyMap = array(
+    static $propertyMap = [
 
         // vCard 2.1 properties and up
         'N'       => 'Sabre\\VObject\\Property\\Text',
@@ -124,14 +124,14 @@ class VCard extends VObject\Document {
         'INTEREST'      => 'Sabre\\VObject\\Property\\FlatText',
         'ORG-DIRECTORY' => 'Sabre\\VObject\\Property\\FlatText',
 
-    );
+    ];
 
     /**
      * Returns the current document type.
      *
      * @return void
      */
-    public function getDocumentType() {
+    function getDocumentType() {
 
         if (!$this->version) {
             $version = (string)$this->VERSION;
@@ -169,7 +169,7 @@ class VCard extends VObject\Document {
      * @param int $target
      * @return VCard
      */
-    public function convert($target) {
+    function convert($target) {
 
         $converter = new VObject\VCardConverter();
         return $converter->convert($this, $target);
@@ -204,25 +204,25 @@ class VCard extends VObject\Document {
      * @param int $options
      * @return array
      */
-    public function validate($options = 0) {
+    function validate($options = 0) {
 
-        $warnings = array();
+        $warnings = [];
 
-        $versionMap = array(
+        $versionMap = [
             self::VCARD21 => '2.1',
             self::VCARD30 => '3.0',
             self::VCARD40 => '4.0',
-        );
+        ];
 
         $version = $this->select('VERSION');
         if (count($version)===1) {
             $version = (string)$this->VERSION;
             if ($version!=='2.1' && $version!=='3.0' && $version!=='4.0') {
-                $warnings[] = array(
+                $warnings[] = [
                     '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,
-                );
+                ];
                 if ($options & self::REPAIR) {
                     $this->VERSION = $versionMap[self::DEFAULT_VERSION];
                 }
@@ -252,11 +252,11 @@ class VCard extends VObject\Document {
                 }
 
             }
-            $warnings[] = array(
+            $warnings[] = [
                 'level' => $repaired?1:3,
                 'message' => 'The FN property must appear in the VCARD component exactly 1 time',
                 'node' => $this,
-            );
+            ];
         }
 
         return array_merge(
@@ -280,9 +280,9 @@ class VCard extends VObject\Document {
      *
      * @var array
      */
-    public function getValidationRules() {
+    function getValidationRules() {
 
-        return array(
+        return [
             'ADR'          => '*',
             'ANNIVERSARY'  => '?',
             'BDAY'         => '?',
@@ -332,7 +332,7 @@ class VCard extends VObject\Document {
             // If so, I may have to add a facility that allows us to check
             // specifically for validity in the context of 'DAV'.
             'UID'          => '1',
-        );
+        ];
 
     }
 
@@ -349,7 +349,7 @@ class VCard extends VObject\Document {
      * @param string $fieldName
      * @return VObject\Property|null
      */
-    public function preferred($propertyName) {
+    function preferred($propertyName) {
 
         $preferred = null;
         $lastPref = 101;
@@ -379,10 +379,10 @@ class VCard extends VObject\Document {
      */
     protected function getDefaults() {
 
-        return array(
+        return [
             'VERSION' => '3.0',
             'PRODID' => '-//Sabre//Sabre VObject ' . VObject\Version::VERSION . '//EN',
-        );
+        ];
 
     }
 
@@ -392,20 +392,20 @@ class VCard extends VObject\Document {
      *
      * @return array
      */
-    public function jsonSerialize() {
+    function jsonSerialize() {
 
         // A vcard does not have sub-components, so we're overriding this
         // method to remove that array element.
-        $properties = array();
+        $properties = [];
 
         foreach($this->children as $child) {
             $properties[] = $child->jsonSerialize();
         }
 
-        return array(
+        return [
             strtolower($this->name),
             $properties,
-        );
+        ];
 
     }
 
@@ -415,7 +415,7 @@ class VCard extends VObject\Document {
      * @param string $propertyName
      * @return string
      */
-    public function getClassNameForPropertyName($propertyName) {
+    function getClassNameForPropertyName($propertyName) {
 
         $className = parent::getClassNameForPropertyName($propertyName);
         // In vCard 4, BINARY no longer exists, and we need URI instead.
diff --git a/lib/Component/VEvent.php b/lib/Component/VEvent.php
index 9931922..59417de 100644
--- a/lib/Component/VEvent.php
+++ b/lib/Component/VEvent.php
@@ -27,7 +27,7 @@ class VEvent extends VObject\Component {
      * @param \DateTime $end
      * @return bool
      */
-    public function isInTimeRange(\DateTime $start, \DateTime $end) {
+    function isInTimeRange(\DateTime $start, \DateTime $end) {
 
         if ($this->RRULE) {
             $it = new EventIterator($this);
@@ -76,10 +76,10 @@ class VEvent extends VObject\Component {
      */
     protected function getDefaults() {
 
-        return array(
+        return [
             'UID'     => 'sabre-vobject-' . VObject\UUIDUtil::getUUID(),
             'DTSTAMP' => date('Ymd\\THis\\Z'),
-        );
+        ];
 
     }
 
@@ -98,10 +98,10 @@ class VEvent extends VObject\Component {
      *
      * @var array
      */
-    public function getValidationRules() {
+    function getValidationRules() {
 
         $hasMethod = isset($this->parent->METHOD);
-        return array(
+        return [
             'UID' => 1,
             'DTSTAMP' => 1,
             'DTSTART' => $hasMethod?'?':'1',
@@ -133,7 +133,7 @@ class VEvent extends VObject\Component {
             'RELATED' => '*',
             'RESOURCES' => '*',
             'RDATE' => '*',
-        );
+        ];
 
     }
 
diff --git a/lib/Component/VFreeBusy.php b/lib/Component/VFreeBusy.php
index 358b8fa..cea208e 100644
--- a/lib/Component/VFreeBusy.php
+++ b/lib/Component/VFreeBusy.php
@@ -24,7 +24,7 @@ class VFreeBusy extends VObject\Component {
      * @param Datetime $end
      * @return bool
      */
-    public function isFree(\DateTime $start, \Datetime $end) {
+    function isFree(\DateTime $start, \Datetime $end) {
 
         foreach($this->select('FREEBUSY') as $freebusy) {
 
@@ -78,9 +78,9 @@ class VFreeBusy extends VObject\Component {
      *
      * @var array
      */
-    public function getValidationRules() {
+    function getValidationRules() {
 
-        return array(
+        return [
             'UID' => 1,
             'DTSTAMP' => 1,
 
@@ -94,7 +94,7 @@ class VFreeBusy extends VObject\Component {
             'COMMENT' => '*',
             'FREEBUSY' => '*',
             'REQUEST-STATUS' => '*',
-        );
+        ];
 
     }
 
diff --git a/lib/Component/VJournal.php b/lib/Component/VJournal.php
index 80dab47..4509895 100644
--- a/lib/Component/VJournal.php
+++ b/lib/Component/VJournal.php
@@ -26,7 +26,7 @@ class VJournal extends VObject\Component {
      * @param DateTime $end
      * @return bool
      */
-    public function isInTimeRange(\DateTime $start, \DateTime $end) {
+    function isInTimeRange(\DateTime $start, \DateTime $end) {
 
         $dtstart = isset($this->DTSTART)?$this->DTSTART->getDateTime():null;
         if ($dtstart) {
@@ -56,9 +56,9 @@ class VJournal extends VObject\Component {
      *
      * @var array
      */
-    public function getValidationRules() {
+    function getValidationRules() {
 
-        return array(
+        return [
             'UID' => 1,
             'DTSTAMP' => 1,
 
@@ -84,7 +84,7 @@ class VJournal extends VObject\Component {
             'EXDATE' => '*',
             'RELATED' => '*',
             'RDATE' => '*',
-        );
+        ];
 
     }
 }
diff --git a/lib/Component/VTimeZone.php b/lib/Component/VTimeZone.php
index e1bf5dc..74c0071 100644
--- a/lib/Component/VTimeZone.php
+++ b/lib/Component/VTimeZone.php
@@ -30,9 +30,9 @@ class VTimeZone extends VObject\Component {
      *
      * @var array
      */
-    public function getValidationRules() {
+    function getValidationRules() {
 
-        return array(
+        return [
             'TZID' => 1,
 
             'LAST-MODIFICATION' => '?',
@@ -45,7 +45,7 @@ class VTimeZone extends VObject\Component {
             // rules are too loose.
             'STANDARD' => '*',
             'DAYLIGHT' => '*',
-        );
+        ];
 
     }
 
diff --git a/lib/Component/VTodo.php b/lib/Component/VTodo.php
index 9152356..4330f88 100644
--- a/lib/Component/VTodo.php
+++ b/lib/Component/VTodo.php
@@ -26,7 +26,7 @@ class VTodo extends VObject\Component {
      * @param DateTime $end
      * @return bool
      */
-    public function isInTimeRange(\DateTime $start, \DateTime $end) {
+    function isInTimeRange(\DateTime $start, \DateTime $end) {
 
         $dtstart = isset($this->DTSTART)?$this->DTSTART->getDateTime():null;
         $duration = isset($this->DURATION)?VObject\DateTimeParser::parseDuration($this->DURATION):null;
@@ -79,9 +79,9 @@ class VTodo extends VObject\Component {
      *
      * @var array
      */
-    public function getValidationRules() {
+    function getValidationRules() {
 
-        return array(
+        return [
             'UID' => 1,
             'DTSTAMP' => 1,
 
@@ -116,7 +116,7 @@ class VTodo extends VObject\Component {
             'RELATED' => '*',
             'RESOURCES' => '*',
             'RDATE' => '*',
-        );
+        ];
 
     }
 
@@ -141,7 +141,7 @@ class VTodo extends VObject\Component {
      * @param int $options
      * @return array
      */
-    public function validate($options = 0) {
+    function validate($options = 0) {
 
         $result = parent::validate($options);
         if (isset($this->DUE) && isset($this->DTSTART)) {
@@ -151,19 +151,19 @@ class VTodo extends VObject\Component {
 
             if ($due->getValueType() !== $dtStart->getValueType()) {
 
-                $result[] = array(
+                $result[] = [
                     'level'   => 3,
                     'message' => 'The value type (DATE or DATE-TIME) must be identical for DUE and DTSTART',
                     'node' => $due,
-                );
+                ];
 
             } elseif ($due->getDateTime() < $dtStart->getDateTime()) {
 
-                $result[] = array(
+                $result[] = [
                     'level'   => 3,
                     'message' => 'DUE must occur after DTSTART',
                     'node' => $due,
-                );
+                ];
 
             }
 
diff --git a/lib/DateTimeParser.php b/lib/DateTimeParser.php
index e702b40..f8f22df 100644
--- a/lib/DateTimeParser.php
+++ b/lib/DateTimeParser.php
@@ -25,7 +25,7 @@ class DateTimeParser {
      * @param DateTimeZone $tz
      * @return DateTime
      */
-    static public function parseDateTime($dt, \DateTimeZone $tz = null) {
+    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);
@@ -51,7 +51,7 @@ class DateTimeParser {
      * @param string $date
      * @return DateTime
      */
-    static public function parseDate($date) {
+    static function parseDate($date) {
 
         // Format is YYYYMMDD
         $result = preg_match('/^([0-9]{4})([0-1][0-9])([0-3][0-9])$/',$date,$matches);
@@ -75,7 +75,7 @@ class DateTimeParser {
      * @param bool $asString
      * @return DateInterval|string
      */
-    static public function parseDuration($duration, $asString = false) {
+    static function parseDuration($duration, $asString = false) {
 
         $result = preg_match('/^(?P<plusminus>\+|-)?P((?P<week>\d+)W)?((?P<day>\d+)D)?(T((?P<hour>\d+)H)?((?P<minute>\d+)M)?((?P<second>\d+)S)?)?$/', $duration, $matches);
         if (!$result) {
@@ -89,13 +89,13 @@ class DateTimeParser {
             }
 
 
-            $parts = array(
+            $parts = [
                 'week',
                 'day',
                 'hour',
                 'minute',
                 'second',
-            );
+            ];
             foreach($parts as $part) {
                 $matches[$part] = isset($matches[$part])&&$matches[$part]?(int)$matches[$part]:0;
             }
@@ -137,13 +137,13 @@ class DateTimeParser {
 
 
 
-        $parts = array(
+        $parts = [
             'week',
             'day',
             'hour',
             'minute',
             'second',
-        );
+        ];
 
         $newDur = '';
         foreach($parts as $part) {
@@ -167,7 +167,7 @@ class DateTimeParser {
      * @param DateTimeZone|string $referenceTZ
      * @return DateTime|DateInterval
      */
-    static public function parse($date, $referenceTZ = null) {
+    static function parse($date, $referenceTZ = null) {
 
         if ($date[0]==='P' || ($date[0]==='-' && $date[1]==='P')) {
             return self::parseDuration($date);
@@ -234,7 +234,7 @@ class DateTimeParser {
      * @param string $date
      * @return array
      */
-    static public function parseVCardDateTime($date) {
+    static function parseVCardDateTime($date) {
 
         $regex = '/^
             (?:  # date part
@@ -288,7 +288,7 @@ class DateTimeParser {
             }
 
         }
-        $parts = array(
+        $parts = [
             'year',
             'month',
             'date',
@@ -296,9 +296,9 @@ class DateTimeParser {
             'minute',
             'second',
             'timezone'
-        );
+        ];
 
-        $result = array();
+        $result = [];
         foreach($parts as $part) {
 
             if (empty($matches[$part])) {
@@ -356,7 +356,7 @@ class DateTimeParser {
      * @param string $date
      * @return array
      */
-    static public function parseVCardTime($date) {
+    static function parseVCardTime($date) {
 
         $regex = '/^
             (?P<hour> [0-9]{2} | -)
@@ -391,14 +391,14 @@ class DateTimeParser {
             }
 
         }
-        $parts = array(
+        $parts = [
             'hour',
             'minute',
             'second',
             'timezone'
-        );
+        ];
 
-        $result = array();
+        $result = [];
         foreach($parts as $part) {
 
             if (empty($matches[$part])) {
diff --git a/lib/Document.php b/lib/Document.php
index 78d209d..3624037 100644
--- a/lib/Document.php
+++ b/lib/Document.php
@@ -62,21 +62,21 @@ abstract class Document extends Component {
      *
      * @var array
      */
-    static public $propertyMap = array();
+    static public $propertyMap = [];
 
     /**
      * List of components, along with which classes they map to.
      *
      * @var array
      */
-    static public $componentMap = array();
+    static public $componentMap = [];
 
     /**
      * List of value-types, and which classes they map to.
      *
      * @var array
      */
-    static public $valueMap = array();
+    static public $valueMap = [];
 
     /**
      * Creates a new document.
@@ -89,20 +89,20 @@ abstract class Document extends Component {
      *
      * So the two sigs:
      *
-     * new Document(array $children = array(), $defaults = true);
-     * new Document(string $name, array $children = array(), $defaults = true)
+     * new Document(array $children = [], $defaults = true);
+     * new Document(string $name, array $children = [], $defaults = true)
      *
      * @return void
      */
-    public function __construct() {
+    function __construct() {
 
         $args = func_get_args();
         if (count($args)===0 || is_array($args[0])) {
             array_unshift($args, $this, static::$defaultName);
-            call_user_func_array(array('parent', '__construct'), $args);
+            call_user_func_array(['parent', '__construct'], $args);
         } else {
             array_unshift($args, $this);
-            call_user_func_array(array('parent', '__construct'), $args);
+            call_user_func_array(['parent', '__construct'], $args);
         }
 
     }
@@ -112,7 +112,7 @@ abstract class Document extends Component {
      *
      * @return void
      */
-    public function getDocumentType() {
+    function getDocumentType() {
 
         return self::UNKNOWN;
 
@@ -128,15 +128,15 @@ abstract class Document extends Component {
      * @param string $arg1,... Unlimited number of args
      * @return mixed
      */
-    public function create($name) {
+    function create($name) {
 
         if (isset(static::$componentMap[strtoupper($name)])) {
 
-            return call_user_func_array(array($this,'createComponent'), func_get_args());
+            return call_user_func_array([$this,'createComponent'], func_get_args());
 
         } else {
 
-            return call_user_func_array(array($this,'createProperty'), func_get_args());
+            return call_user_func_array([$this,'createProperty'], func_get_args());
 
         }
 
@@ -161,7 +161,7 @@ abstract class Document extends Component {
      * @param bool $defaults
      * @return Component
      */
-    public function createComponent($name, array $children = null, $defaults = true) {
+    function createComponent($name, array $children = null, $defaults = true) {
 
         $name = strtoupper($name);
         $class = 'Sabre\\VObject\\Component';
@@ -169,7 +169,7 @@ abstract class Document extends Component {
         if (isset(static::$componentMap[$name])) {
             $class=static::$componentMap[$name];
         }
-        if (is_null($children)) $children = array();
+        if (is_null($children)) $children = [];
         return new $class($this, $name, $children, $defaults);
 
     }
@@ -190,7 +190,7 @@ abstract class Document extends Component {
      * @param string $valueType Force a specific valuetype, such as URI or TEXT
      * @return Property
      */
-    public function createProperty($name, $value = null, array $parameters = null, $valueType = null) {
+    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) {
@@ -216,7 +216,7 @@ abstract class Document extends Component {
         if (is_null($class)) {
             $class = $this->getClassNameForPropertyName($name);
         }
-        if (is_null($parameters)) $parameters = array();
+        if (is_null($parameters)) $parameters = [];
 
         return new $class($this, $name, $value, $parameters, $group);
 
@@ -233,7 +233,7 @@ abstract class Document extends Component {
      * @param string $valueParam
      * @return void
      */
-    public function getClassNameForPropertyValue($valueParam) {
+    function getClassNameForPropertyValue($valueParam) {
 
         $valueParam = strtoupper($valueParam);
         if (isset(static::$valueMap[$valueParam])) {
@@ -248,7 +248,7 @@ abstract class Document extends Component {
      * @param string $propertyName
      * @return string
      */
-    public function getClassNameForPropertyName($propertyName) {
+    function getClassNameForPropertyName($propertyName) {
 
         if (isset(static::$propertyMap[$propertyName])) {
             return static::$propertyMap[$propertyName];
diff --git a/lib/ElementList.php b/lib/ElementList.php
index d0c4ed8..551d4fa 100644
--- a/lib/ElementList.php
+++ b/lib/ElementList.php
@@ -19,14 +19,14 @@ class ElementList implements \Iterator, \Countable, \ArrayAccess {
      *
      * @var array
      */
-    protected $elements = array();
+    protected $elements = [];
 
     /**
      * Creates the element list.
      *
      * @param array $elements
      */
-    public function __construct(array $elements) {
+    function __construct(array $elements) {
 
         $this->elements = $elements;
 
@@ -46,7 +46,7 @@ class ElementList implements \Iterator, \Countable, \ArrayAccess {
      *
      * @return Element
      */
-    public function current() {
+    function current() {
 
         return $this->elements[$this->key];
 
@@ -57,7 +57,7 @@ class ElementList implements \Iterator, \Countable, \ArrayAccess {
      *
      * @return void
      */
-    public function next() {
+    function next() {
 
         $this->key++;
 
@@ -68,7 +68,7 @@ class ElementList implements \Iterator, \Countable, \ArrayAccess {
      *
      * @return int
      */
-    public function key() {
+    function key() {
 
         return $this->key;
 
@@ -79,7 +79,7 @@ class ElementList implements \Iterator, \Countable, \ArrayAccess {
      *
      * @return bool
      */
-    public function valid() {
+    function valid() {
 
         return isset($this->elements[$this->key]);
 
@@ -90,7 +90,7 @@ class ElementList implements \Iterator, \Countable, \ArrayAccess {
      *
      * @return void
      */
-    public function rewind() {
+    function rewind() {
 
         $this->key = 0;
 
@@ -105,7 +105,7 @@ class ElementList implements \Iterator, \Countable, \ArrayAccess {
      *
      * @return int
      */
-    public function count() {
+    function count() {
 
         return count($this->elements);
 
@@ -122,7 +122,7 @@ class ElementList implements \Iterator, \Countable, \ArrayAccess {
      * @param int $offset
      * @return bool
      */
-    public function offsetExists($offset) {
+    function offsetExists($offset) {
 
         return isset($this->elements[$offset]);
 
@@ -134,7 +134,7 @@ class ElementList implements \Iterator, \Countable, \ArrayAccess {
      * @param int $offset
      * @return mixed
      */
-    public function offsetGet($offset) {
+    function offsetGet($offset) {
 
         return $this->elements[$offset];
 
@@ -147,7 +147,7 @@ class ElementList implements \Iterator, \Countable, \ArrayAccess {
      * @param mixed $value
      * @return void
      */
-    public function offsetSet($offset, $value) {
+    function offsetSet($offset, $value) {
 
         throw new \LogicException('You can not add new objects to an ElementList');
 
@@ -161,7 +161,7 @@ class ElementList implements \Iterator, \Countable, \ArrayAccess {
      * @param int $offset
      * @return void
      */
-    public function offsetUnset($offset) {
+    function offsetUnset($offset) {
 
         throw new \LogicException('You can not remove objects from an ElementList');
 
diff --git a/lib/FreeBusyGenerator.php b/lib/FreeBusyGenerator.php
index f71d2db..321d2d4 100644
--- a/lib/FreeBusyGenerator.php
+++ b/lib/FreeBusyGenerator.php
@@ -60,7 +60,7 @@ class FreeBusyGenerator {
      * @param mixed $objects
      * @return void
      */
-    public function __construct(\DateTime $start = null, \DateTime $end = null, $objects = null) {
+    function __construct(\DateTime $start = null, \DateTime $end = null, $objects = null) {
 
         if ($start && $end) {
             $this->setTimeRange($start, $end);
@@ -83,7 +83,7 @@ class FreeBusyGenerator {
      * @param Component $vcalendar
      * @return void
      */
-    public function setBaseObject(Component $vcalendar) {
+    function setBaseObject(Component $vcalendar) {
 
         $this->baseObject = $vcalendar;
 
@@ -99,13 +99,13 @@ class FreeBusyGenerator {
      * @param mixed $objects
      * @return void
      */
-    public function setObjects($objects) {
+    function setObjects($objects) {
 
         if (!is_array($objects)) {
-            $objects = array($objects);
+            $objects = [$objects];
         }
 
-        $this->objects = array();
+        $this->objects = [];
         foreach($objects as $object) {
 
             if (is_string($object)) {
@@ -129,7 +129,7 @@ class FreeBusyGenerator {
      * @param DateTime $end
      * @return void
      */
-    public function setTimeRange(\DateTime $start = null, \DateTime $end = null) {
+    function setTimeRange(\DateTime $start = null, \DateTime $end = null) {
 
         $this->start = $start;
         $this->end = $end;
@@ -142,9 +142,9 @@ class FreeBusyGenerator {
      *
      * @return Component
      */
-    public function getResult() {
+    function getResult() {
 
-        $busyTimes = array();
+        $busyTimes = [];
 
         foreach($this->objects as $object) {
 
@@ -168,7 +168,7 @@ class FreeBusyGenerator {
                             }
                         }
 
-                        $times = array();
+                        $times = [];
 
                         if ($component->RRULE) {
 
@@ -185,10 +185,10 @@ class FreeBusyGenerator {
                                 if ($this->end && $startTime > $this->end) {
                                     break;
                                 }
-                                $times[] = array(
+                                $times[] = [
                                     $iterator->getDTStart(),
                                     $iterator->getDTEnd(),
-                                );
+                                ];
 
                                 $iterator->next();
 
@@ -215,7 +215,7 @@ class FreeBusyGenerator {
                                 break;
                             }
 
-                            $times[] = array($startTime, $endTime);
+                            $times[] = [$startTime, $endTime];
 
                         }
 
@@ -224,11 +224,11 @@ class FreeBusyGenerator {
                             if ($this->end && $time[0] > $this->end) break;
                             if ($this->start && $time[1] < $this->start) break;
 
-                            $busyTimes[] = array(
+                            $busyTimes[] = [
                                 $time[0],
                                 $time[1],
                                 $FBTYPE,
-                            );
+                            ];
                         }
                         break;
 
@@ -256,11 +256,11 @@ class FreeBusyGenerator {
 
                                 if($this->start && $this->start > $endTime) continue;
                                 if($this->end && $this->end < $startTime) continue;
-                                $busyTimes[] = array(
+                                $busyTimes[] = [
                                     $startTime,
                                     $endTime,
                                     $fbType
-                                );
+                                ];
 
                             }
 
diff --git a/lib/Node.php b/lib/Node.php
index 29bae61..3220adc 100644
--- a/lib/Node.php
+++ b/lib/Node.php
@@ -42,7 +42,7 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable {
      *
      * @return string
      */
-    abstract public function serialize();
+    abstract function serialize();
 
     /**
      * This method returns an array, with the representation as it should be
@@ -50,7 +50,7 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable {
      *
      * @return array
      */
-    abstract public function jsonSerialize();
+    abstract function jsonSerialize();
 
     /* {{{ IteratorAggregator interface */
 
@@ -59,12 +59,12 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable {
      *
      * @return ElementList
      */
-    public function getIterator() {
+    function getIterator() {
 
         if (!is_null($this->iterator))
             return $this->iterator;
 
-        return new ElementList(array($this));
+        return new ElementList([$this]);
 
     }
 
@@ -76,7 +76,7 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable {
      * @param ElementList $iterator
      * @return void
      */
-    public function setIterator(ElementList $iterator) {
+    function setIterator(ElementList $iterator) {
 
         $this->iterator = $iterator;
 
@@ -103,9 +103,9 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable {
      * @param int $options
      * @return array
      */
-    public function validate($options = 0) {
+    function validate($options = 0) {
 
-        return array();
+        return [];
 
     }
 
@@ -118,7 +118,7 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable {
      *
      * @return int
      */
-    public function count() {
+    function count() {
 
         $it = $this->getIterator();
         return $it->count();
@@ -138,7 +138,7 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable {
      * @param int $offset
      * @return bool
      */
-    public function offsetExists($offset) {
+    function offsetExists($offset) {
 
         $iterator = $this->getIterator();
         return $iterator->offsetExists($offset);
@@ -153,7 +153,7 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable {
      * @param int $offset
      * @return mixed
      */
-    public function offsetGet($offset) {
+    function offsetGet($offset) {
 
         $iterator = $this->getIterator();
         return $iterator->offsetGet($offset);
@@ -169,7 +169,7 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable {
      * @param mixed $value
      * @return void
      */
-    public function offsetSet($offset, $value) {
+    function offsetSet($offset, $value) {
 
         $iterator = $this->getIterator();
         $iterator->offsetSet($offset,$value);
@@ -189,7 +189,7 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable {
      * @param int $offset
      * @return void
      */
-    public function offsetUnset($offset) {
+    function offsetUnset($offset) {
 
         $iterator = $this->getIterator();
         $iterator->offsetUnset($offset);
diff --git a/lib/Parameter.php b/lib/Parameter.php
index 9750d78..bc0120d 100644
--- a/lib/Parameter.php
+++ b/lib/Parameter.php
@@ -50,7 +50,7 @@ class Parameter extends Node {
      * @param string $name
      * @param string $value
      */
-    public function __construct(Document $root, $name, $value = null) {
+    function __construct(Document $root, $name, $value = null) {
 
         $this->name = strtoupper($name);
         $this->root = $root;
@@ -168,7 +168,7 @@ class Parameter extends Node {
      * @param string|array $value
      * @return void
      */
-    public function setValue($value) {
+    function setValue($value) {
 
         $this->value = $value;
 
@@ -182,7 +182,7 @@ class Parameter extends Node {
      *
      * @return string|null
      */
-    public function getValue() {
+    function getValue() {
 
         if (is_array($this->value)) {
             return implode(',' , $this->value);
@@ -198,7 +198,7 @@ class Parameter extends Node {
      * @param array $value
      * @return void
      */
-    public function setParts(array $value) {
+    function setParts(array $value) {
 
         $this->value = $value;
 
@@ -211,14 +211,14 @@ class Parameter extends Node {
      *
      * @return array
      */
-    public function getParts() {
+    function getParts() {
 
         if (is_array($this->value)) {
             return $this->value;
         } elseif (is_null($this->value)) {
-            return array();
+            return [];
         } else {
-            return array($this->value);
+            return [$this->value];
         }
 
     }
@@ -232,7 +232,7 @@ class Parameter extends Node {
      * @param string|array $part
      * @return void
      */
-    public function addValue($part) {
+    function addValue($part) {
 
         if (is_null($this->value)) {
             $this->value = $part;
@@ -252,7 +252,7 @@ class Parameter extends Node {
      * @param string $value
      * @return bool
      */
-    public function has($value) {
+    function has($value) {
 
         return in_array(
             strtolower($value),
@@ -266,7 +266,7 @@ class Parameter extends Node {
      *
      * @return string
      */
-    public function serialize() {
+    function serialize() {
 
         $value = $this->getParts();
 
@@ -295,11 +295,11 @@ class Parameter extends Node {
                     // special characters
                     $out.='"' . strtr(
                         $item,
-                        array(
+                        [
                             '^'  => '^^',
                             "\n" => '^n',
                             '"'  => '^\'',
-                        )
+                        ]
                     ) . '"';
                     return $out;
                 }
@@ -315,7 +315,7 @@ class Parameter extends Node {
      *
      * @return array
      */
-    public function jsonSerialize() {
+    function jsonSerialize() {
 
         return $this->value;
 
@@ -326,7 +326,7 @@ class Parameter extends Node {
      *
      * @return string
      */
-    public function __toString() {
+    function __toString() {
 
         return (string)$this->getValue();
 
@@ -337,7 +337,7 @@ class Parameter extends Node {
      *
      * @return ElementList
      */
-    public function getIterator() {
+    function getIterator() {
 
         if (!is_null($this->iterator))
             return $this->iterator;
diff --git a/lib/Property.php b/lib/Property.php
index ea606d3..c2fddb2 100644
--- a/lib/Property.php
+++ b/lib/Property.php
@@ -37,7 +37,7 @@ abstract class Property extends Node {
      *
      * @var array
      */
-    public $parameters = array();
+    public $parameters = [];
 
     /**
      * Current value
@@ -66,7 +66,7 @@ abstract class Property extends Node {
      * @param string $group The vcard property group
      * @return void
      */
-    public function __construct(Component $root, $name, $value = null, array $parameters = array(), $group = null) {
+    function __construct(Component $root, $name, $value = null, array $parameters = [], $group = null) {
 
         $this->name = $name;
         $this->group = $group;
@@ -91,7 +91,7 @@ abstract class Property extends Node {
      * @param string|array $value
      * @return void
      */
-    public function setValue($value) {
+    function setValue($value) {
 
         $this->value = $value;
 
@@ -108,7 +108,7 @@ abstract class Property extends Node {
      *
      * @return string
      */
-    public function getValue() {
+    function getValue() {
 
         if (is_array($this->value)) {
             if (count($this->value)==0) {
@@ -130,7 +130,7 @@ abstract class Property extends Node {
      * @param array $parts
      * @return void
      */
-    public function setParts(array $parts) {
+    function setParts(array $parts) {
 
         $this->value = $parts;
 
@@ -144,14 +144,14 @@ abstract class Property extends Node {
      *
      * @return array
      */
-    public function getParts() {
+    function getParts() {
 
         if (is_null($this->value)) {
-            return array();
+            return [];
         } elseif (is_array($this->value)) {
             return $this->value;
         } else {
-            return array($this->value);
+            return [$this->value];
         }
 
     }
@@ -167,7 +167,7 @@ abstract class Property extends Node {
      * @param string|null|array $value
      * @return Node
      */
-    public function add($name, $value = null) {
+    function add($name, $value = null) {
         $noName = false;
         if ($name === null) {
             $name = Parameter::guessParameterNameByValue($value);
@@ -189,7 +189,7 @@ abstract class Property extends Node {
      *
      * @return array
      */
-    public function parameters() {
+    function parameters() {
 
         return $this->parameters;
 
@@ -203,7 +203,7 @@ abstract class Property extends Node {
      *
      * @return string
      */
-    abstract public function getValueType();
+    abstract function getValueType();
 
     /**
      * Sets a raw value coming from a mimedir (iCalendar/vCard) file.
@@ -214,21 +214,21 @@ abstract class Property extends Node {
      * @param string $val
      * @return void
      */
-    abstract public function setRawMimeDirValue($val);
+    abstract function setRawMimeDirValue($val);
 
     /**
      * Returns a raw mime-dir representation of the value.
      *
      * @return string
      */
-    abstract public function getRawMimeDirValue();
+    abstract function getRawMimeDirValue();
 
     /**
      * Turns the object back into a serialized blob.
      *
      * @return string
      */
-    public function serialize() {
+    function serialize() {
 
         $str = $this->name;
         if ($this->group) $str = $this->group . '.' . $this->name;
@@ -264,7 +264,7 @@ abstract class Property extends Node {
      *
      * @return array
      */
-    public function getJsonValue() {
+    function getJsonValue() {
 
         return $this->getParts();
 
@@ -278,7 +278,7 @@ abstract class Property extends Node {
      * @param array $value
      * @return void
      */
-    public function setJsonValue(array $value) {
+    function setJsonValue(array $value) {
 
         if (count($value)===1) {
             $this->setValue(reset($value));
@@ -294,9 +294,9 @@ abstract class Property extends Node {
      *
      * @return array
      */
-    public function jsonSerialize() {
+    function jsonSerialize() {
 
-        $parameters = array();
+        $parameters = [];
 
         foreach($this->parameters as $parameter) {
             if ($parameter->name === 'VALUE') {
@@ -311,11 +311,11 @@ abstract class Property extends Node {
         }
 
         return array_merge(
-            array(
+            [
                 strtolower($this->name),
                 (object)$parameters,
                 strtolower($this->getValueType()),
-            ),
+            ],
             $this->getJsonValue()
         );
     }
@@ -330,7 +330,7 @@ abstract class Property extends Node {
      *
      * @return string
      */
-    public function __toString() {
+    function __toString() {
 
         return (string)$this->getValue();
 
@@ -344,7 +344,7 @@ abstract class Property extends Node {
      * @param mixed $name
      * @return bool
      */
-    public function offsetExists($name) {
+    function offsetExists($name) {
 
         if (is_int($name)) return parent::offsetExists($name);
 
@@ -365,7 +365,7 @@ abstract class Property extends Node {
      * @param string $name
      * @return Node
      */
-    public function offsetGet($name) {
+    function offsetGet($name) {
 
         if (is_int($name)) return parent::offsetGet($name);
         $name = strtoupper($name);
@@ -385,7 +385,7 @@ abstract class Property extends Node {
      * @param mixed $value
      * @return void
      */
-    public function offsetSet($name, $value) {
+    function offsetSet($name, $value) {
 
         if (is_int($name)) {
             parent::offsetSet($name, $value);
@@ -407,7 +407,7 @@ abstract class Property extends Node {
      * @param string $name
      * @return void
      */
-    public function offsetUnset($name) {
+    function offsetUnset($name) {
 
         if (is_int($name)) {
             parent::offsetUnset($name);
@@ -429,7 +429,7 @@ abstract class Property extends Node {
      *
      * @return void
      */
-    public function __clone() {
+    function __clone() {
 
         foreach($this->parameters as $key=>$child) {
             $this->parameters[$key] = clone $child;
@@ -455,9 +455,9 @@ abstract class Property extends Node {
      * @param int $options
      * @return array
      */
-    public function validate($options = 0) {
+    function validate($options = 0) {
 
-        $warnings = array();
+        $warnings = [];
 
         // Checking if our value is UTF-8
         if (!StringUtil::isUTF8($this->getRawMimeDirValue())) {
@@ -480,20 +480,20 @@ abstract class Property extends Node {
                 $message = 'Property is not valid UTF-8! ' . $oldValue;
             }
 
-            $warnings[] = array(
+            $warnings[] = [
                 'level' => $level,
                 'message' => $message,
                 'node' => $this,
-            );
+            ];
         }
 
         // Checking if the propertyname does not contain any invalid bytes.
         if (!preg_match('/^([A-Z0-9-]+)$/', $this->name)) {
-            $warnings[] = array(
+            $warnings[] = [
                 'level' => 1,
                 'message' => 'The propertyname: ' . $this->name . ' contains invalid characters. Only A-Z, 0-9 and - are allowed',
                 'node' => $this,
-            );
+            ];
             if ($options & self::REPAIR) {
                 // Uppercasing and converting underscores to dashes.
                 $this->name = strtoupper(
diff --git a/lib/Reader.php b/lib/Reader.php
index 65a2543..acb4f44 100644
--- a/lib/Reader.php
+++ b/lib/Reader.php
@@ -38,7 +38,7 @@ class Reader {
      * @param int $options
      * @return Document
      */
-    static public function read($data, $options = 0) {
+    static function read($data, $options = 0) {
 
         $parser = new Parser\MimeDir();
         $result = $parser->parse($data, $options);
@@ -61,7 +61,7 @@ class Reader {
      * @param int $options
      * @return Node
      */
-    static public function readJson($data, $options = 0) {
+    static function readJson($data, $options = 0) {
 
         $parser = new Parser\Json();
         $result = $parser->parse($data, $options);
diff --git a/lib/StringUtil.php b/lib/StringUtil.php
index 456cd43..be0198a 100644
--- a/lib/StringUtil.php
+++ b/lib/StringUtil.php
@@ -17,7 +17,7 @@ class StringUtil {
      * @param string $str
      * @return bool
      */
-    static public function isUTF8($str) {
+    static function isUTF8($str) {
 
         // First check.. mb_check_encoding
         if (!mb_check_encoding($str, 'UTF-8')) {
@@ -42,9 +42,9 @@ class StringUtil {
      * @param string $str
      * @return string
      */
-    static public function convertToUTF8($str) {
+    static function convertToUTF8($str) {
 
-        $encoding = mb_detect_encoding($str , array('UTF-8','ISO-8859-1', 'WINDOWS-1252'), true);
+        $encoding = mb_detect_encoding($str , ['UTF-8','ISO-8859-1', 'WINDOWS-1252'], true);
 
         switch($encoding) {
             case 'ISO-8859-1' :
diff --git a/lib/TimeZoneUtil.php b/lib/TimeZoneUtil.php
index dc90ebf..4a02ce2 100644
--- a/lib/TimeZoneUtil.php
+++ b/lib/TimeZoneUtil.php
@@ -21,7 +21,7 @@ class TimeZoneUtil {
      *
      * Source: http://msdn.microsoft.com/en-us/library/aa563018(loband).aspx
      */
-    public static $microsoftExchangeMap = array(
+    public static $microsoftExchangeMap = [
         0  => 'UTC',
         31 => 'Africa/Casablanca',
 
@@ -101,7 +101,7 @@ class TimeZoneUtil {
         15 => 'Pacific/Honolulu',
         16 => 'Pacific/Midway',
         39 => 'Pacific/Kwajalein',
-    );
+    ];
 
     /**
      * This method will try to find out the correct timezone for an iCalendar
@@ -121,7 +121,7 @@ class TimeZoneUtil {
      * @param Sabre\VObject\Component $vcalendar
      * @return DateTimeZone
      */
-    static public function getTimeZone($tzid, Component $vcalendar = null, $failIfUncertain = false) {
+    static function getTimeZone($tzid, Component $vcalendar = null, $failIfUncertain = false) {
 
         // First we will just see if the tzid is a support timezone identifier.
         //
@@ -218,7 +218,7 @@ class TimeZoneUtil {
      * This method will load in all the tz mapping information, if it's not yet
      * done.
      */
-    static public function loadTzMaps() {
+    static function loadTzMaps() {
 
         if (!is_null(self::$map)) return;
 
diff --git a/lib/UUIDUtil.php b/lib/UUIDUtil.php
index 81cdc7d..5bcdd32 100644
--- a/lib/UUIDUtil.php
+++ b/lib/UUIDUtil.php
@@ -23,7 +23,7 @@ class UUIDUtil {
      * @see http://www.php.net/manual/en/function.uniqid.php#94959
      * @return string
      */
-    static public function getUUID() {
+    static function getUUID() {
 
         return sprintf(
 
@@ -55,7 +55,7 @@ class UUIDUtil {
      * @param string $uuid
      * @return bool
      */
-    static public function validateUUID($uuid) {
+    static function validateUUID($uuid) {
 
         return preg_match(
             '/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i',
diff --git a/lib/VCardConverter.php b/lib/VCardConverter.php
index 6afa486..e78f088 100644
--- a/lib/VCardConverter.php
+++ b/lib/VCardConverter.php
@@ -29,25 +29,25 @@ class VCardConverter {
      * @param Component\VCard $input
      * @param int $targetVersion
      */
-    public function convert(Component\VCard $input, $targetVersion) {
+    function convert(Component\VCard $input, $targetVersion) {
 
         $inputVersion = $input->getDocumentType();
         if ($inputVersion===$targetVersion) {
             return clone $input;
         }
 
-        if (!in_array($inputVersion, array(Document::VCARD21, Document::VCARD30, Document::VCARD40))) {
+        if (!in_array($inputVersion, [Document::VCARD21, Document::VCARD30, Document::VCARD40])) {
             throw new \InvalidArgumentException('Only vCard 2.1, 3.0 and 4.0 are supported for the input data');
         }
-        if (!in_array($targetVersion, array(Document::VCARD30, Document::VCARD40))) {
+        if (!in_array($targetVersion, [Document::VCARD30, Document::VCARD40])) {
             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';
 
-        $output = new Component\VCard(array(
+        $output = new Component\VCard([
             'VERSION' => $newVersion,
-        ));
+        ]);
 
         foreach($input->children as $property) {
 
@@ -71,7 +71,7 @@ class VCardConverter {
     protected function convertProperty(Component\VCard $input, Component\VCard $output, Property $property, $targetVersion) {
 
         // Skipping these, those are automatically added.
-        if (in_array($property->name, array('VERSION', 'PRODID'))) {
+        if (in_array($property->name, ['VERSION', 'PRODID'])) {
             return;
         }
 
@@ -90,7 +90,7 @@ class VCardConverter {
 
         if ($targetVersion===Document::VCARD30) {
 
-            if ($property instanceof Property\Uri && in_array($property->name, array('PHOTO','LOGO','SOUND'))) {
+            if ($property instanceof Property\Uri && in_array($property->name, ['PHOTO','LOGO','SOUND'])) {
 
                 $newProperty = $this->convertUriToBinary($output, $property, $parameters);
 
@@ -109,9 +109,9 @@ class VCardConverter {
                     $newProperty = $output->createProperty(
                         $property->name,
                         $newValue,
-                        array(
+                        [
                             'X-APPLE-OMIT-YEAR' => '1604'
-                        ),
+                        ],
                         $valueType
                     );
 
@@ -140,7 +140,7 @@ class VCardConverter {
         } elseif ($targetVersion===Document::VCARD40) {
 
             // These properties were removed in vCard 4.0
-            if (in_array($property->name, array('NAME', 'MAILER', 'LABEL', 'CLASS'))) {
+            if (in_array($property->name, ['NAME', 'MAILER', 'LABEL', 'CLASS'])) {
                 return;
             }
 
@@ -158,7 +158,7 @@ class VCardConverter {
                     $newProperty = $output->createProperty(
                         $property->name,
                         $newValue,
-                        array(),
+                        [],
                         $valueType
                     );
                 }
@@ -191,7 +191,7 @@ class VCardConverter {
             $newProperty = $output->createProperty(
                 $property->name,
                 $property->getParts(),
-                array(), // no parameters yet
+                [], // no parameters yet
                 $valueType
             );
 
@@ -236,7 +236,7 @@ class VCardConverter {
         $newProperty = $output->createProperty(
             $property->name,
             null, // no value
-            array(), // no parameters yet
+            [], // no parameters yet
             'URI' // Forcing the BINARY type
         );
 
@@ -245,11 +245,11 @@ class VCardConverter {
         // See if we can find a better mimetype.
         if (isset($parameters['TYPE'])) {
 
-            $newTypes = array();
+            $newTypes = [];
             foreach($parameters['TYPE']->getParts() as $typePart) {
                 if (in_array(
                     strtoupper($typePart),
-                    array('JPEG','PNG','GIF')
+                    ['JPEG','PNG','GIF']
                 )) {
                     $mimeType = 'image/' . strtolower($typePart);
                 } else {
@@ -298,7 +298,7 @@ class VCardConverter {
         $newProperty = $output->createProperty(
             $property->name,
             null, // no value
-            array(), // no parameters yet
+            [], // no parameters yet
             'BINARY'
         );
 

-- 
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