Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: typo in property name for PeriodValue ($staring to $starting) #145

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/ValueObjects/PeriodValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,37 @@

class PeriodValue implements HasTimezones
{
private DateTimeInterface $staring;
private DateTimeInterface $starting;

private ?DateTimeInterface $ending = null;

private ?DurationValue $duration = null;

private function __construct(
DateTimeInterface $staring,
DateTimeInterface $starting,
?DateTimeInterface $ending,
?DurationValue $duration
) {
$this->staring = $staring;
$this->starting = $starting;
$this->ending = $ending;
$this->duration = $duration;
}

/**
* @param \DateTimeInterface $staring
* @param \DateTimeInterface $starting
* @param DateTimeInterface|\Spatie\IcalendarGenerator\ValueObjects\DurationValue $ending
*
* @return static
*/
public static function create(DateTimeInterface $staring, $ending): self
public static function create(DateTimeInterface $starting, $ending): self
{
if ($ending instanceof DateTimeInterface) {
/** @psalm-suppress InvalidArgument */
return new self($staring, $ending, null);
return new self($starting, $ending, null);
}

if ($ending instanceof DurationValue) {
return new self($staring, null, $ending);
return new self($starting, null, $ending);
}

throw new Exception('The end of a period can only be a DateTime or Duration');
Expand All @@ -48,16 +48,16 @@ public static function create(DateTimeInterface $staring, $ending): self
public function format(): string
{
if ($this->duration !== null) {
return DateTimeValue::create($this->staring, true)->format() . '/' . $this->duration->format();
return DateTimeValue::create($this->starting, true)->format() . '/' . $this->duration->format();
}

return DateTimeValue::create($this->staring, true)->format() . '/' . DateTimeValue::create($this->ending, true)->format();
return DateTimeValue::create($this->starting, true)->format() . '/' . DateTimeValue::create($this->ending, true)->format();
}

public function getTimezoneRangeCollection(): TimezoneRangeCollection
{
return TimezoneRangeCollection::create()
->add($this->staring)
->add($this->starting)
->add($this->ending);
}
}
Loading