Merge branch 'master' into patch-1
This commit is contained in:
commit
b60a6c9922
112 changed files with 3790 additions and 421 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue