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

Resolves issue #2 #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions src/ReadingTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ class ReadingTime
private $content;
private $wordsPerMinute = 200;

public function __construct($content)
public function __construct(string $content)
{
$this->content = $content;
}

public function setWordsPerMinute($wordsPerMinute)
public function setWordsPerMinute(int $wordsPerMinute): self
{
$this->wordsPerMinute = $wordsPerMinute;

return $this;
}

public function minutes()
public function minutes(): float
{
return str_word_count($this->content) / $this->wordsPerMinute;
}

public function seconds()
public function seconds(): float
{
return $this->minutes() * 60;
}
Expand Down