public static function loadProfile($profile)
    {
        $decoded = json_decode(file_get_contents($profile));
        if (!empty($decoded->code)) {
            $decoded->code = str_replace(array('-', '.'), array('_', '_'), $decoded->code);
        } else {
            throw new InvalidProfileException("Error getting 'code' from profile {$profile}", E_USER_ERROR);
        }
        return $decoded;
    }