Send content to a gitter.im chat room through the rest api.

@param string $content
@see https://developer.gitter.im/docs/messages-resource
13967
protected function send($content)
    {
        $url = sprintf('https://%s/%s/%s/%s', self::HOST, self::ROOMS_ENDPOINT, $this->roomId, self::MESSAGES_ENDPOINT);
        $data = json_encode(array('text' => $content));
        $headers = array(
            'Content-Type: application/json',
            'Accept: application/json',
            "Authorization: Bearer {$this->token}"
        );

        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        curl_exec($ch);
        curl_close($ch);
    }
949729
protected function sendHeader($header, $content)
    {
        if (!headers_sent() && self::$sendHeaders) {
            header(sprintf('%s: %s', $header, $content));
        }
    }
692662
public function sendMessage($recipients, $sender, $subject, $content)
    {
        $this->client->sendMessage($this->createMessage($recipients, $sender, $subject, $content));
    }
658516
protected function ajaxContent($content)
    {
        $message = null;

        $this->header('Content-Type', 'application/json');

        if ($content instanceof Arrayable) {
            $content = $content->toArray();
        } elseif (is_string($content)) {
            $content = ['content' => $content];
        } elseif (!is_array($content) && !$content instanceof \Exception) {
            return $this->ajaxContent(new \Exception("No valid content has been submitted!", BaseResponse::HTTP_BAD_REQUEST));
        } elseif ($content instanceof \Exception) {

            $this->setStatusCode($content->getCode() < 300 ? BaseResponse::HTTP_BAD_REQUEST : $content->getCode());

            $message = $content->getMessage();

            if ($content instanceof MbException) {
                $content = $content->getMessages();
            } else {
                $content = null;
            }
        }

        $this->original = [
            'meta' => [
                'code'    => $this->getStatusCode(),
                'message' => $message,
            ],
            'data' => $content,
        ];

        $this->getMbAudit()->setResponseType('ajax');
        $this->getMbAudit()->setResponseData($this->original);

        return $this->original;
    }
1323157
public function json($content)
    {
        $this->header('Content-Type', 'application/json');
        $this->json = true;
        $this->content = $content;

        return $this;
    }
712508
public function indexContent(Content $content)
    {
        $fullTextValue = $this->mapper->mapContent($content);

        $this->indexerGateway->index($fullTextValue);
    }
148459
public function setContent($content)
    {
        if (!is_null($content)) {
            $content = (string) $content;
        }

        $this->content = $content;
        return $this;
    }
937063
protected function sendHeader(string $header, string $content): void
    {
        if (!headers_sent() && self::$sendHeaders) {
            header(sprintf('%s: %s', $header, $content));
        }
    }
1023294
protected function notifyInfo($content) {
        $notification = NotificationFactory::newInfoNotification($content);
        return $this->notify(NotificationEvents::NOTIFICATION_INFO, $notification);
    }
652469
public function setContent(string $content): void {
		
		// there's two options here:  that the concatenation of $this->root_path
		// and $content is a file and we pass that to our view or that it isn't
		// and we pass the $content argument to the view directly assuming that
		// it's a string of content.
		
		$temp = $this->root_path . DIRECTORY_SEPARATOR . $content;
		$this->view->setContent(is_file($temp) ? $temp : $content);
	}
1180990
public function addContent($content)
    {
        $freeBufferLength = $this->chunkSize - StringHelper::byteLength($this->_buffer);
        $contentLength = StringHelper::byteLength($content);
        if ($contentLength > $freeBufferLength) {
            $this->_buffer .= StringHelper::byteSubstr($content, 0, $freeBufferLength);
            $this->flushBuffer(true);
            return $this->addContent(StringHelper::byteSubstr($content, $freeBufferLength));
        } else {
            $this->_buffer .= $content;
            $this->flushBuffer();
        }

        return $this;
    }
1252662
public function publishDraft( Content $content )
    {
        $this->getRepository()->sudo(
            function(Repository $repository) use ( $content )
            {
                $repository->getContentService()->publishVersion($content->versionInfo->id);
            }
        );
    }
1321867
public function setJsonContent($content)
    {
        $context = $this->_context;

        $this->setHeader('Content-Type', 'application/json; charset=utf-8');

        if (is_array($content)) {
            if (!isset($content['code'])) {
                $content = ['code' => 0, 'message' => '', 'data' => $content];
            }
        } elseif ($content instanceof \JsonSerializable) {
            $content = ['code' => 0, 'message' => '', 'data' => $content];
        } elseif (is_string($content)) {
            null;
        } elseif (is_int($content)) {
            $content = ['code' => $content, 'message' => ''];
        } elseif ($content === null) {
            $content = ['code' => 0, 'message' => '', 'data' => null];
        } elseif ($content instanceof ValidatorException) {
            $content = ['code' => -2, 'message' => $content->getMessage()];
        } elseif ($content instanceof \Exception) {
            if ($content instanceof \ManaPHP\Exception) {
                $this->setStatus($content->getStatusCode());
                $content = $content->getJson();
            } else {
                $this->setStatus(500);
                $content = ['code' => 500, 'message' => 'Server Internal Error'];
            }
        }

        $context->content = $this->_jsonEncode($content);

        return $this;
    }
207716
public function putContent($content)
    {
        // write to io stream
        $this->size = fwrite($this->inputStream, $content);
        // rewind file pointer
        rewind($this->inputStream);
    }
678282
protected function send($content)
	{
		$streamOptions = array(
			'http' => array(
				'method'  => 'POST',
				'header'  => 'Content-Type: application/json',
				'content' => $content,
			)
		);

		$context = stream_context_create($streamOptions);
		$result = @file_get_contents($this->getServerUrl(), false, $context);

		if ($result === false) {
			throw new Exception('Unable to connect to server');
		}

		return $result;
	}
1261695
public function setContent( Content $content )
    {
        foreach ( $this->handlers as $handler )
        {
            if ( $handler instanceof ContentAwareHandlerInterface )
            {
                $handler->setContent( $content );
            }
        }
    }
1309098
public function setContent($content)
    {
        $this->content = $content;
        $this->setHeader('content-length', strlen($this->content));
    }