diff --git a/src/Eluceo/iCal/Component.php b/src/Eluceo/iCal/Component.php index 063c9c86..ce3f77c7 100644 --- a/src/Eluceo/iCal/Component.php +++ b/src/Eluceo/iCal/Component.php @@ -68,10 +68,12 @@ public function build() $lines[] = sprintf('BEGIN:%s', $this->getType()); + /** @var $property Property */ foreach ($this->properties as $property) { $lines[] = $property->toLine(); } + /** @var $component Component */ foreach ($this->components as $component) { foreach ($component->build() as $l) { $lines[] = $l; diff --git a/src/Eluceo/iCal/Component/Calendar.php b/src/Eluceo/iCal/Component/Calendar.php index 06e52089..659dd30e 100644 --- a/src/Eluceo/iCal/Component/Calendar.php +++ b/src/Eluceo/iCal/Component/Calendar.php @@ -49,21 +49,34 @@ public function getType() return 'VCALENDAR'; } + /** + * @param $method + * @return $this + */ public function setMethod($method) { $this->method = $method; return $this; } + /** + * @param $name + * @return $this + */ public function setName($name) { $this->name = $name; return $this; } + /** + * @param $timezone + * @return $this + */ public function setTimezone($timezone) { $this->timezone = $timezone; + return $this; } diff --git a/src/Eluceo/iCal/Component/Event.php b/src/Eluceo/iCal/Component/Event.php index a80d9712..cfd77ae8 100644 --- a/src/Eluceo/iCal/Component/Event.php +++ b/src/Eluceo/iCal/Component/Event.php @@ -22,9 +22,9 @@ */ class Event extends Component { - - const TIME_TRANSPARENCY_OPAQUE = 'OPAQUE'; + const TIME_TRANSPARENCY_OPAQUE = 'OPAQUE'; const TIME_TRANSPARENCY_TRANSPARENT = 'TRANSPARENT'; + const STATUS_TENTATIVE = 'TENTATIVE'; const STATUS_CONFIRMED = 'CONFIRMED'; const STATUS_CANCELLED = 'CANCELLED'; @@ -210,8 +210,9 @@ public function buildPropertyBag() $this->properties->set('RRULE', $this->recurrenceRule); } - if( $this->noTime ) + if( $this->noTime ) { $this->properties->set('X-MICROSOFT-CDO-ALLDAYEVENT', 'TRUE'); + } } /** @@ -232,8 +233,9 @@ protected function buildDateTimeProperty($name, \DateTime $dateTime, $noTime = f $params['TZID'] = $timeZone; } - if( $noTime ) + if($noTime) { $params['VALUE'] = 'DATE'; + } return new Property($name, $dateString, $params); } @@ -270,30 +272,52 @@ protected function getDateString(\DateTime $dateTime = null, $noTime = false) return $dateTime->format($this->getDateFormat($noTime)); } + /** + * @param $dtEnd + * @return $this + */ public function setDtEnd($dtEnd) { $this->dtEnd = $dtEnd; return $this; } + /** + * @param $dtStart + * @return $this + */ public function setDtStart($dtStart) { $this->dtStart = $dtStart; return $this; } + /** + * @param $dtStamp + * @return $this + */ public function setDtStamp($dtStamp) { $this->dtStamp = $dtStamp; return $this; } + /** + * @param $duration + * @return $this + */ public function setDuration($duration) { $this->duration = $duration; return $this; } + /** + * @param $location + * @param string $title + * @param null $geo + * @return $this + */ public function setLocation($location, $title = '', $geo = null) { $this->location = $location; @@ -302,49 +326,77 @@ public function setLocation($location, $title = '', $geo = null) return $this; } + /** + * @param $noTime + * @return $this + */ public function setNoTime($noTime) { $this->noTime = $noTime; return $this; } + /** + * @param $sequence + * @return $this + */ public function setSequence($sequence) { $this->sequence = $sequence; return $this; } + /** + * @param $summary + * @return $this + */ public function setSummary($summary) { $this->summary = $summary; return $this; } + /** + * @param $uniqueId + * @return $this + */ public function setUniqueId($uniqueId) { $this->uniqueId = $uniqueId; return $this; } + /** + * @param $url + * @return $this + */ public function setUrl($url) { $this->url = $url; return $this; } + /** + * @param $useTimezone + * @return $this + */ public function setUseTimezone($useTimezone) { $this->useTimezone = $useTimezone; return $this; } + /** + * @return bool + */ public function getUseTimezone() { return $this->useTimezone; } /** - * @param string $description + * @param $attendee + * @return $this */ public function setAttendee($attendee) { @@ -361,7 +413,8 @@ public function getAttendee() } /** - * @param string $description + * @param $description + * @return $this */ public function setDescription($description) { @@ -369,6 +422,10 @@ public function setDescription($description) return $this; } + /** + * @param bool $useUtc + * @return $this + */ public function setUseUtc($useUtc = true) { $this->useUtc = $useUtc; @@ -383,6 +440,11 @@ public function getDescription() return $this->description; } + /** + * @param $transparency + * @return $this + * @throws \InvalidArgumentException + */ public function setTimeTransparency($transparency) { $transparency = strtoupper($transparency); @@ -395,6 +457,11 @@ public function setTimeTransparency($transparency) return $this; } + /** + * @param $status + * @return $this + * @throws \InvalidArgumentException + */ public function setStatus($status) { $status = strtoupper($status); @@ -410,6 +477,7 @@ public function setStatus($status) /** * @param RecurrenceRule $recurrenceRule + * @return $this */ public function setRecurrenceRule(RecurrenceRule $recurrenceRule) { diff --git a/src/Eluceo/iCal/ParameterBag.php b/src/Eluceo/iCal/ParameterBag.php index ba0b94bc..07747c2c 100644 --- a/src/Eluceo/iCal/ParameterBag.php +++ b/src/Eluceo/iCal/ParameterBag.php @@ -11,9 +11,9 @@ class ParameterBag */ protected $params; - public function __construct($parms = array()) + public function __construct($params = array()) { - $this->params = $parms; + $this->params = $params; } /** diff --git a/src/Eluceo/iCal/Property.php b/src/Eluceo/iCal/Property.php index 3f295f67..84f047a2 100644 --- a/src/Eluceo/iCal/Property.php +++ b/src/Eluceo/iCal/Property.php @@ -76,11 +76,14 @@ public function toLine() /** * @param string $name - * @param mixed $value + * @param mixed $value + * + * @return $this */ public function setParam($name, $value) { $this->parameterBag->setParam($name, $value); + return $this; } @@ -95,6 +98,7 @@ public function getParam($name) /** * @param mixed $value + * @return $this * @throws \Exception */ public function setValue($value) @@ -106,6 +110,7 @@ public function setValue($value) } else { $this->value = $value; } + return $this; } diff --git a/src/Eluceo/iCal/PropertyBag.php b/src/Eluceo/iCal/PropertyBag.php index 380a800a..e13e0189 100644 --- a/src/Eluceo/iCal/PropertyBag.php +++ b/src/Eluceo/iCal/PropertyBag.php @@ -26,11 +26,13 @@ class PropertyBag implements \IteratorAggregate * @param $name * @param $value * @param array $params + * @return $this */ public function set($name, $value, $params = array()) { $property = new Property($name, $value, $params); $this->elements[] = $property; + return $this; } @@ -41,6 +43,7 @@ public function set($name, $value, $params = array()) public function get($name) { // Searching Property in elements-array + /** @var $property Property */ foreach ($this->elements as $property) { if ($property->getName() == $name) { return $property; @@ -53,7 +56,8 @@ public function get($name) /** * Adds a Property. If Property already exists an Exception will be thrown. * - * @param Property $property + * @param Property $property + * @return $this * @throws \Exception */ public function add(Property $property) @@ -64,6 +68,7 @@ public function add(Property $property) } $this->elements[] = $property; + return $this; }