Merge branch 'master' into patch-1

This commit is contained in:
CDNRocket 2018-03-01 21:13:47 +01:00 committed by GitHub
commit b60a6c9922
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
112 changed files with 3790 additions and 421 deletions

View file

@ -16,10 +16,15 @@ class Point
private $x;
private $y;
public function __construct($x, $y)
public function __construct($x, $y, $dynamic = false)
{
$this->x = (int) $x;
$this->y = (int) $y;
if ($dynamic) {
$this->x = $x;
$this->y = $y;
} else {
$this->x = (int)$x;
$this->y = (int)$y;
}
}
/**

View file

@ -89,4 +89,32 @@ class TimeCode
return new static($hours, $minutes, $seconds, $frames);
}
/**
* Returns this timecode in seconds
* @return int
*/
public function toSeconds() {
$seconds = 0;
$seconds += $this->hours * 60 * 60;
$seconds += $this->minutes * 60;
$seconds += $this->seconds;
// TODO: Handle frames?
return (int) $seconds;
}
/**
* Helper function wether `$timecode` is after this one
*
* @param TimeCode $timecode The Timecode to compare
* @return bool
*/
public function isAfter(TimeCode $timecode) {
// convert everything to seconds and compare
return ($this->toSeconds() > $timecode->toSeconds());
}
}