Skip to content

Instantly share code, notes, and snippets.

@stefanledin
Last active September 12, 2017 15:52
Show Gist options
  • Save stefanledin/4c2675e921da98acc1f189412aeaa7d3 to your computer and use it in GitHub Desktop.
Save stefanledin/4c2675e921da98acc1f189412aeaa7d3 to your computer and use it in GitHub Desktop.
<?php
use Carbon\Carbon;
class TimeCounter
{
protected $startTime;
protected $endTime;
public function start() {
$this->startTime = Carbon::now();
}
public function end() {
$this->endTime = Carbon::now();
}
public function duration() {
return $this->startTime->diffInMinutes($this->endTime);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment