protected function _createContext() { $options = []; if ($this->_userAgent) { $options['http']['user_agent'] = $this->_userAgent; } return stream_context_create($options); }