Google\Cloud\Vision\Annotation::__construct PHP Method

__construct() public method

This class represents a single image annotation response from Cloud Vision. If multiple images were tested at once, the result will be an array of Annotation instances. This class is not intended to be instantiated outside the Google Cloud Platform Client Library.
public __construct ( array $info )
$info array The annotation result
    public function __construct($info)
    {
        $this->info = $info;
        if (isset($info['faceAnnotations'])) {
            $this->faces = [];
            foreach ($info['faceAnnotations'] as $face) {
                $this->faces[] = new Face($face);
            }
        }
        if (isset($info['landmarkAnnotations'])) {
            $this->landmarks = [];
            foreach ($info['landmarkAnnotations'] as $landmark) {
                $this->landmarks[] = new Entity($landmark);
            }
        }
        if (isset($info['logoAnnotations'])) {
            $this->logos = [];
            foreach ($info['logoAnnotations'] as $logo) {
                $this->logos[] = new Entity($logo);
            }
        }
        if (isset($info['labelAnnotations'])) {
            $this->labels = [];
            foreach ($info['labelAnnotations'] as $label) {
                $this->labels[] = new Entity($label);
            }
        }
        if (isset($info['textAnnotations'])) {
            $this->text = [];
            foreach ($info['textAnnotations'] as $text) {
                $this->text[] = new Entity($text);
            }
        }
        if (isset($info['safeSearchAnnotation'])) {
            $this->safeSearch = new SafeSearch($info['safeSearchAnnotation']);
        }
        if (isset($info['imagePropertiesAnnotation'])) {
            $this->imageProperties = new ImageProperties($info['imagePropertiesAnnotation']);
        }
        if (isset($info['error'])) {
            $this->error = $info['error'];
        }
    }