public function toMinutes($duration = null, $precision = false)
    {
        if (null !== $duration) {
            $this->parse($duration);
        }

        // backward compatibility, true = round to integer
        if ($precision === true) {
            $precision = 0;
        }

        $this->output = ($this->days * $this->hoursPerDay * 60 * 60) + ($this->hours * 60 * 60) + ($this->minutes * 60) + $this->seconds;
        $result = intval($this->output()) / 60;

        return $precision !== false ? round($result, $precision) : $result;
    }