src/Duration.php
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;
    }
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;
    }
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 ; }
Returns the duration as an amount of minutes.

For example, one hour and 42 minutes would be "102" minutes

@param  int|float|string $duration A string or number, representing a duration
@param  int|bool $precision Number of decimal digits to round to. If set to false, the number is not rounded.
@return int|float
Returns the duration as an amount of minutes .