src/Date/DateUtil.php
public function getTimePeriodInSeconds($timePeriod)
    {
        $timePeriod = StringUtil::deserialize($timePeriod, true);

        if (!isset($timePeriod['unit']) || !isset($timePeriod['value'])) {
            return null;
        }

        $factor = 1;

        switch ($timePeriod['unit']) {
            case 'm':
                $factor = 60;

                break;

            case 'h':
                $factor = 60 * 60;

                break;

            case 'd':
                $factor = 24 * 60 * 60;

                break;
        }

        return $timePeriod['value'] * $factor;
    }
public function getTimePeriodInSeconds($timePeriod)
    {
        $timePeriod = StringUtil::deserialize($timePeriod, true);

        if (!isset($timePeriod['unit']) || !isset($timePeriod['value'])) {
            return null;
        }

        $factor = 1;

        switch ($timePeriod['unit']) {
            case 'm':
                $factor = 60;

                break;

            case 'h':
                $factor = 60 * 60;

                break;

            case 'd':
                $factor = 24 * 60 * 60;

                break;
        }

        return $timePeriod['value'] * $factor;
    }
public function getTimePeriodInSeconds ( $ timePeriod ) { $ timePeriod = StringUtil :: deserialize ( $ timePeriod , true ) ; if ( ! isset ( $ timePeriod [ 'unit' ] ) || ! isset ( $ timePeriod [ 'value' ] ) ) { return null ; } $ factor = 1 ; switch ( $ timePeriod [ 'unit' ] ) { case 'm' : $ factor = 60 ; break ; case 'h' : $ factor = 60 * 60 ; break ; case 'd' : $ factor = 24 * 60 * 60 ; break ; } return $ timePeriod [ 'value' ] * $ factor ; }
Returns the time in seconds of an given time period.

@param string|array $timePeriod Array or serialized string containing an value and an unit key

@return float|int|null
Returns the time in seconds of an given time period .