Language/src/LanguageClient.php
public function analyzeSentiment($content, array $options = [])
    {
        return new Annotation(
            $this->connection->analyzeSentiment(
                $this->formatRequest($content, $options)
            )
        );
    }
public function analyzeSentiment($content, array $options = [])
    {
        return new Annotation(
            $this->connection->analyzeSentiment(
                $this->formatRequest($content, $options)
            )
        );
    }
public function analyzeSentiment ( $ content , array $ options = [ ] ) { return new Annotation ( $ this -> connection -> analyzeSentiment ( $ this -> formatRequest ( $ content , $ options ) ) ) ; }
Analyzes the sentiment of the provided document.

Example:
```
$annotation = $language->analyzeSentiment('Google Cloud Platform is a powerful tool.');
$sentiment = $annotation->sentiment();

if ($sentiment['score'] > 0) {
echo 'This is a positive message.';
}
```

@codingStandardsIgnoreStart
@see https://cloud.google.com/natural-language/docs/reference/rest/v1/documents/analyzeSentiment Analyze Sentiment API documentation
@codingStandardsIgnoreEnd

@param string|StorageObject $content The content to analyze. May be
either a string of UTF-8 encoded content, a URI pointing to a
Google Cloud Storage object in the format of
`gs://{bucket-name}/{object-name}` or a
{@see Google\Cloud\Storage\StorageObject}.
@param array $options [optional] {
Configuration options.

@type bool $detectGcsUri When providing $content as a string, this
flag determines whether or not to attempt to detect if the
string represents a Google Cloud Storage URI in the format of
`gs://{bucket-name}/{object-name}`. **Defaults to** `true`.
@type string $type The document type. Acceptable values are
`PLAIN_TEXT` or `HTML`. **Defaults to** `"PLAIN_TEXT"`.
@type string $language The language of the document. Both ISO
(e.g., en, es) and BCP-47 (e.g., en-US, es-ES) language codes
are accepted. If no value is provided, the language will be
detected by the service.
@type string $encodingType The text encoding type used by the API to
calculate offsets. Acceptable values are `"NONE"`, `"UTF8"`,
`"UTF16"` and `"UTF32"`. **Defaults to** `"UTF8"`. Please note
the following behaviors for the encoding type setting: `"NONE"`
will return a value of "-1" for offsets. `"UTF8"` will
return byte offsets. `"UTF16"` will return
[code unit](http://unicode.org/glossary/#code_unit) offsets.
`"UTF32"` will return
[unicode character](http://unicode.org/glossary/#character)
offsets.
}
@return Annotation
Analyzes the sentiment of the provided document .