Last active
September 12, 2017 15:52
-
-
Save stefanledin/4c2675e921da98acc1f189412aeaa7d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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