[Pkg-owncloud-commits] [php-sabre-vobject] 15/341: Lots of small tweaks from SensioLabs Insight.

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 13:35:26 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 ea04f0fd9cf0fae055e94959d4238feeb9411e65
Author: Evert Pot <me at evertpot.com>
Date:   Tue Oct 7 17:34:52 2014 -0400

    Lots of small tweaks from SensioLabs Insight.
---
 lib/Cli.php                          |  5 ++---
 lib/Component/VCard.php              |  2 +-
 lib/ITip/Broker.php                  |  4 ++--
 lib/Parser/MimeDir.php               |  1 -
 lib/Property/Binary.php              |  4 +---
 lib/Property/ICalendar/DateTime.php  |  7 +++----
 lib/Property/ICalendar/Duration.php  |  1 -
 lib/Property/ICalendar/Period.php    |  1 -
 lib/Property/Unknown.php             | 12 +++---------
 lib/Property/VCard/Date.php          |  3 ---
 lib/Property/VCard/DateAndOrTime.php |  6 ------
 lib/Property/VCard/DateTime.php      |  3 ---
 lib/Recur/EventIterator.php          | 11 -----------
 lib/Recur/RDateIterator.php          |  1 -
 lib/Recur/RRuleIterator.php          |  2 --
 lib/Splitter/ICalendar.php           | 10 ++++------
 lib/UUIDUtil.php                     |  2 +-
 17 files changed, 17 insertions(+), 58 deletions(-)

diff --git a/lib/Cli.php b/lib/Cli.php
index bd287f0..81bc96e 100644
--- a/lib/Cli.php
+++ b/lib/Cli.php
@@ -328,7 +328,7 @@ HELP
      * @param Component $vObj
      * @return int
      */
-    protected function validate($vObj) {
+    protected function validate(Component $vObj) {
 
         $returnCode = 0;
 
@@ -374,7 +374,7 @@ HELP
      * @param Component $vObj
      * @return int
      */
-    protected function repair($vObj) {
+    protected function repair(Component $vObj) {
 
         $returnCode = 0;
 
@@ -616,7 +616,6 @@ HELP
             $this->cWrite('red', '.');
         }
 
-        $str = '';
         $this->cWrite('yellow', $property->name);
 
         foreach($property->parameters as $param) {
diff --git a/lib/Component/VCard.php b/lib/Component/VCard.php
index 2539fa6..2ec7691 100644
--- a/lib/Component/VCard.php
+++ b/lib/Component/VCard.php
@@ -67,7 +67,7 @@ class VCard extends VObject\Document {
         // vCard 2.1 properties and up
         'N'       => 'Sabre\\VObject\\Property\\Text',
         'FN'      => 'Sabre\\VObject\\Property\\FlatText',
-        'PHOTO'   => 'Sabre\\VObject\\Property\\Binary', // Todo: we should add a class for Binary values.
+        'PHOTO'   => 'Sabre\\VObject\\Property\\Binary',
         'BDAY'    => 'Sabre\\VObject\\Property\\VCard\\DateAndOrTime',
         'ADR'     => 'Sabre\\VObject\\Property\\Text',
         'LABEL'   => 'Sabre\\VObject\\Property\\FlatText', // Removed in vCard 4.0
diff --git a/lib/ITip/Broker.php b/lib/ITip/Broker.php
index 54a334a..306d7da 100644
--- a/lib/ITip/Broker.php
+++ b/lib/ITip/Broker.php
@@ -746,9 +746,9 @@ 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'));
+                    $event->add('RECURRENCE-ID', $dt, array('VALUE' => 'DATE'));
                 } else {
-                    $recur = $event->add('RECURRENCE-ID', $dt);
+                    $event->add('RECURRENCE-ID', $dt);
                 }
             }
             $organizer = $event->add('ORGANIZER', $message->recipient);
diff --git a/lib/Parser/MimeDir.php b/lib/Parser/MimeDir.php
index 8dd2e63..29fb1c1 100644
--- a/lib/Parser/MimeDir.php
+++ b/lib/Parser/MimeDir.php
@@ -6,7 +6,6 @@ use
     Sabre\VObject\ParseException,
     Sabre\VObject\EofException,
     Sabre\VObject\Component,
-    Sabre\VObject\Property,
     Sabre\VObject\Component\VCalendar,
     Sabre\VObject\Component\VCard;
 
diff --git a/lib/Property/Binary.php b/lib/Property/Binary.php
index 7fdd990..9ca1bef 100644
--- a/lib/Property/Binary.php
+++ b/lib/Property/Binary.php
@@ -2,9 +2,7 @@
 
 namespace Sabre\VObject\Property;
 
-use
-    LogicException,
-    Sabre\VObject\Property;
+use Sabre\VObject\Property;
 
 /**
  * BINARY property
diff --git a/lib/Property/ICalendar/DateTime.php b/lib/Property/ICalendar/DateTime.php
index b3c4cfe..ba454ac 100644
--- a/lib/Property/ICalendar/DateTime.php
+++ b/lib/Property/ICalendar/DateTime.php
@@ -4,7 +4,6 @@ namespace Sabre\VObject\Property\ICalendar;
 
 use DateTimeInterface;
 use Sabre\VObject\Property;
-use Sabre\VObject\Parser\MimeDir;
 use Sabre\VObject\DateTimeParser;
 use Sabre\VObject\TimeZoneUtil;
 
@@ -254,7 +253,7 @@ class DateTime extends Property {
         $isUtc = in_array($tz->getName() , ['UTC', 'GMT', 'Z']);
 
         return array_map(
-            function($dt) use ($hasTime, $isUtc) {
+            function(DateTimeInterface $dt) use ($hasTime, $isUtc) {
 
                 if ($hasTime) {
                     return $dt->format('Y-m-d\\TH:i:s') . ($isUtc?'Z':'');
@@ -343,10 +342,10 @@ class DateTime extends Property {
         try {
             switch($valueType) {
                 case 'DATE' :
-                    $foo = DateTimeParser::parseDate($value);
+                    DateTimeParser::parseDate($value);
                     break;
                 case 'DATE-TIME' :
-                    $foo = DateTimeParser::parseDateTime($value);
+                    DateTimeParser::parseDateTime($value);
                     break;
             }
         } catch (\LogicException $e) {
diff --git a/lib/Property/ICalendar/Duration.php b/lib/Property/ICalendar/Duration.php
index a0498fe..d4445d6 100644
--- a/lib/Property/ICalendar/Duration.php
+++ b/lib/Property/ICalendar/Duration.php
@@ -4,7 +4,6 @@ namespace Sabre\VObject\Property\ICalendar;
 
 use
     Sabre\VObject\Property,
-    Sabre\VObject\Parser\MimeDir,
     Sabre\VObject\DateTimeParser;
 
 /**
diff --git a/lib/Property/ICalendar/Period.php b/lib/Property/ICalendar/Period.php
index c7f464b..0fe6b6c 100644
--- a/lib/Property/ICalendar/Period.php
+++ b/lib/Property/ICalendar/Period.php
@@ -4,7 +4,6 @@ namespace Sabre\VObject\Property\ICalendar;
 
 use
     Sabre\VObject\Property,
-    Sabre\VObject\Parser\MimeDir,
     Sabre\VObject\DateTimeParser;
 
 /**
diff --git a/lib/Property/Unknown.php b/lib/Property/Unknown.php
index baf7285..b95d3bf 100644
--- a/lib/Property/Unknown.php
+++ b/lib/Property/Unknown.php
@@ -2,12 +2,6 @@
 
 namespace Sabre\VObject\Property;
 
-use
-    Sabre\VObject\Property,
-    Sabre\VObject\Component,
-    Sabre\VObject\Parser\MimeDir,
-    Sabre\VObject\Document;
-
 /**
  * Unknown property
  *
@@ -27,9 +21,9 @@ class Unknown extends Text {
      *
      * @return array
      */
-    public function getJsonValue() {
+    function getJsonValue() {
 
-        return array($this->getRawMimeDirValue());
+        return [$this->getRawMimeDirValue()];
 
     }
 
@@ -41,7 +35,7 @@ class Unknown extends Text {
      *
      * @return string
      */
-    public function getValueType() {
+    function getValueType() {
 
         return "UNKNOWN";
 
diff --git a/lib/Property/VCard/Date.php b/lib/Property/VCard/Date.php
index 5a82cdd..1e0cece 100644
--- a/lib/Property/VCard/Date.php
+++ b/lib/Property/VCard/Date.php
@@ -2,9 +2,6 @@
 
 namespace Sabre\VObject\Property\VCard;
 
-use
-    Sabre\VObject\DateTimeParser;
-
 /**
  * Date property
  *
diff --git a/lib/Property/VCard/DateAndOrTime.php b/lib/Property/VCard/DateAndOrTime.php
index d0eb0ef..f9572b0 100644
--- a/lib/Property/VCard/DateAndOrTime.php
+++ b/lib/Property/VCard/DateAndOrTime.php
@@ -3,7 +3,6 @@
 namespace Sabre\VObject\Property\VCard;
 
 use Sabre\VObject\DateTimeParser;
-use Sabre\VObject\Property\Text;
 use Sabre\VObject\Property;
 use DateTimeInterface;
 use DateTimeImmutable;
@@ -90,8 +89,6 @@ class DateAndOrTime extends Property {
      */
     function setDateTime(DateTimeInterface $dt) {
 
-        $values = [];
-
         $tz = null;
         $isUtc = false;
 
@@ -127,14 +124,11 @@ class DateAndOrTime extends Property {
      */
     function getDateTime() {
 
-        $dts = [];
         $now = new DateTime();
 
         $tzFormat = $now->getTimezone()->getOffset($now)===0?'\\Z':'O';
         $nowParts = DateTimeParser::parseVCardDateTime($now->format('Ymd\\This' . $tzFormat));
 
-        $value = $this->getValue();
-
         $dateParts = DateTimeParser::parseVCardDateTime($this->getValue());
 
         // This sets all the missing parts to the current date/time.
diff --git a/lib/Property/VCard/DateTime.php b/lib/Property/VCard/DateTime.php
index 9285497..f180506 100644
--- a/lib/Property/VCard/DateTime.php
+++ b/lib/Property/VCard/DateTime.php
@@ -2,9 +2,6 @@
 
 namespace Sabre\VObject\Property\VCard;
 
-use
-    Sabre\VObject\DateTimeParser;
-
 /**
  * DateTime property
  *
diff --git a/lib/Recur/EventIterator.php b/lib/Recur/EventIterator.php
index 0e60580..10266f7 100644
--- a/lib/Recur/EventIterator.php
+++ b/lib/Recur/EventIterator.php
@@ -116,17 +116,6 @@ class EventIterator implements \Iterator {
             $this->masterEvent = array_shift($this->overriddenEvents);
         }
 
-        // master event.
-        if (isset($this->masterEvent->RRULE)) {
-            $rrule = $this->masterEvent->RRULE->getParts();
-        } else {
-            // master event has no rrule. We default to something that
-            // iterates once.
-            $rrule = [
-                'FREQ' => 'DAILY',
-                'COUNT' => 1,
-            ];
-        }
         $this->startDate = $this->masterEvent->DTSTART->getDateTime();
 
         if (isset($this->masterEvent->EXDATE)) {
diff --git a/lib/Recur/RDateIterator.php b/lib/Recur/RDateIterator.php
index 0ec1ce1..08272b3 100644
--- a/lib/Recur/RDateIterator.php
+++ b/lib/Recur/RDateIterator.php
@@ -3,7 +3,6 @@
 namespace Sabre\VObject\Recur;
 
 use DateTimeInterface;
-use InvalidArgumentException;
 use Iterator;
 use Sabre\VObject\DateTimeParser;
 
diff --git a/lib/Recur/RRuleIterator.php b/lib/Recur/RRuleIterator.php
index b1bb3ec..727d3b8 100644
--- a/lib/Recur/RRuleIterator.php
+++ b/lib/Recur/RRuleIterator.php
@@ -94,8 +94,6 @@ class RRuleIterator implements Iterator {
      */
     function next() {
 
-        $previousStamp = $this->currentDate->getTimeStamp();
-
         // Otherwise, we find the next event in the normal RRULE
         // sequence.
         switch($this->frequency) {
diff --git a/lib/Splitter/ICalendar.php b/lib/Splitter/ICalendar.php
index 9a70832..3b5618d 100644
--- a/lib/Splitter/ICalendar.php
+++ b/lib/Splitter/ICalendar.php
@@ -27,14 +27,14 @@ class ICalendar implements SplitterInterface {
      *
      * @var array
      */
-    protected $vtimezones = array();
+    protected $vtimezones = [];
 
     /**
      * iCalendar objects
      *
      * @var array
      */
-    protected $objects = array();
+    protected $objects = [];
 
     /**
      * Constructor
@@ -44,11 +44,9 @@ class ICalendar implements SplitterInterface {
      * @param resource $input
      * @param int $options Parser options, see the OPTIONS constants.
      */
-    public function __construct($input, $options = 0) {
+    function __construct($input, $options = 0) {
 
         $data = VObject\Reader::read($input, $options);
-        $vtimezones = array();
-        $components = array();
 
         if (!$data instanceof VObject\Component\VCalendar) {
             throw new VObject\ParseException('Supplied input could not be parsed as VCALENDAR.');
@@ -89,7 +87,7 @@ class ICalendar implements SplitterInterface {
      *
      * @return Sabre\VObject\Component|null
      */
-    public function getNext() {
+    function getNext() {
 
         if($object=array_shift($this->objects)) {
 
diff --git a/lib/UUIDUtil.php b/lib/UUIDUtil.php
index 5bcdd32..60a2d61 100644
--- a/lib/UUIDUtil.php
+++ b/lib/UUIDUtil.php
@@ -60,7 +60,7 @@ class UUIDUtil {
         return preg_match(
             '/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i',
             $uuid
-        ) == true;
+        ) !== 0;
 
     }
 

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