src/Model/Type/Duration.php
private static function stringToSeconds($duration)
    {
        if (isset(self::$suffixes[substr($duration, -1)])) {
            $amount = substr($duration, 0, strlen($duration) - 1);
            $unit = self::$suffixes[substr($duration, -1)];
        } else {
            $unit = 1;
            $amount = $duration;
        }

        if (!is_numeric($amount)) {
            throw new \InvalidArgumentException('Invalid duration: ' . $duration);
        }

        return $unit * $amount;
    }
private static function stringToSeconds($duration)
    {
        if (isset(self::$suffixes[substr($duration, -1)])) {
            $amount = substr($duration, 0, strlen($duration) - 1);
            $unit = self::$suffixes[substr($duration, -1)];
        } else {
            $unit = 1;
            $amount = $duration;
        }

        if (!is_numeric($amount)) {
            throw new \InvalidArgumentException('Invalid duration: ' . $duration);
        }

        return $unit * $amount;
    }
private static function stringToSeconds ( $ duration ) { if ( isset ( self :: $ suffixes [ substr ( $ duration , - 1 ) ] ) ) { $ amount = substr ( $ duration , 0 , strlen ( $ duration ) - 1 ) ; $ unit = self :: $ suffixes [ substr ( $ duration , - 1 ) ] ; } else { $ unit = 1 ; $ amount = $ duration ; } if ( ! is_numeric ( $ amount ) ) { throw new \ InvalidArgumentException ( 'Invalid duration: ' . $ duration ) ; } return $ unit * $ amount ; }
Converts a duration string to seconds.

@param string $duration

@return int|float
Converts a duration string to seconds .