public function getResult($ipAddress, $userAgent)
    {
        /** @var PluginEnhancerAnura $record */
        $record = $this->getRepository()->findByIpAndUserAgent($ipAddress, $userAgent);

        if (null === $record || 'failed' === $record->getResult()) {
            //perform lookup, save result
            $httpClient = new Client();

            $payload = [
                'instance' => $this->instance,
                'ip'       => $ipAddress,
                'ua'       => $userAgent,
            ];

            try {
                $response = $httpClient->request('GET', $this->endpoint, ['query' => $payload]);
                $result   = json_decode($response->getBody()->getContents(), true);
            } catch (\Exception $e) {
                $this->logger->error($e->getMessage());
                $result = ['result' => 'failed'];
            }

            if (null === $record) {
                $record = new PluginEnhancerAnura();
                $record
                    ->setIpAddress($ipAddress)
                    ->setUserAgent($userAgent);
            }
            $record
                ->setDateAdded(new \DateTime())
                ->setResult($result['result']);

            $this->getRepository()->saveEntity($record);
        }

        return $record->getResult();
    }
public function getResult($ipAddress, $userAgent)
    {
        /** @var PluginEnhancerAnura $record */
        $record = $this->getRepository()->findByIpAndUserAgent($ipAddress, $userAgent);

        if (null === $record || 'failed' === $record->getResult()) {
            //perform lookup, save result
            $httpClient = new Client();

            $payload = [
                'instance' => $this->instance,
                'ip'       => $ipAddress,
                'ua'       => $userAgent,
            ];

            try {
                $response = $httpClient->request('GET', $this->endpoint, ['query' => $payload]);
                $result   = json_decode($response->getBody()->getContents(), true);
            } catch (\Exception $e) {
                $this->logger->error($e->getMessage());
                $result = ['result' => 'failed'];
            }

            if (null === $record) {
                $record = new PluginEnhancerAnura();
                $record
                    ->setIpAddress($ipAddress)
                    ->setUserAgent($userAgent);
            }
            $record
                ->setDateAdded(new \DateTime())
                ->setResult($result['result']);

            $this->getRepository()->saveEntity($record);
        }

        return $record->getResult();
    }
@param $ipAddress
@param $userAgent

@return string

@throws \GuzzleHttp\Exception\GuzzleException