public static function fromArray(array $data): Time
    {
        if (!isset($data['hours'])) {
            throw new \InvalidArgumentException('Array is not valid.');
        }

        return new Time(
            $data['hours'],
            $data['minutes'] ?? 0,
            $data['seconds'] ?? 0
        );
    }
public static function fromArray(array $data): Time
    {
        if (!isset($data['hours'])) {
            throw new \InvalidArgumentException('Array is not valid.');
        }

        return new Time(
            $data['hours'],
            $data['minutes'] ?? 0,
            $data['seconds'] ?? 0
        );
    }
public static function fromArray ( array $ data ) : Time { if ( ! isset ( $ data [ 'hours' ] ) ) { throw new \ InvalidArgumentException ( 'Array is not valid.' ) ; } return new Time ( $ data [ 'hours' ] , $ data [ 'minutes' ] ?? 0 , $ data [ 'seconds' ] ?? 0 ) ; }
Create a new Time from an array.

@param array $data The data.
@return Time
Create a new Time from an array .