Happyr\LinkedIn\LinkedIn::filterRequestOption PHP Method

filterRequestOption() protected method

Modify and filter the request options. Make sure we use the correct query parameters and headers.
protected filterRequestOption ( array &$options ) : string
$options array
return string the request format to use
    protected function filterRequestOption(array &$options)
    {
        if (isset($options['json'])) {
            $options['format'] = 'json';
            $options['body'] = json_encode($options['json']);
        } elseif (!isset($options['format'])) {
            // Make sure we always have a format
            $options['format'] = $this->getFormat();
        }
        // Set correct headers for this format
        switch ($options['format']) {
            case 'xml':
                $options['headers']['Content-Type'] = 'text/xml';
                break;
            case 'json':
                $options['headers']['Content-Type'] = 'application/json';
                $options['headers']['x-li-format'] = 'json';
                $options['query']['format'] = 'json';
                break;
            default:
                // Do nothing
        }
        return $options['format'];
    }