client = $client; $this->options_helper = $options_helper; } /** * Checks the account limit for tracking keyphrases. * * @return object The response object. */ public function check_limit() { // Code has already been validated at this point. No need to do that again. try { $results = $this->client->get( self::ACCOUNT_URL ); $usage = $results['limits']['keywords']['usage']; $limit = $results['limits']['keywords']['limit']; return (object) [ 'canTrack' => \is_null( $limit ) || $usage < $limit, 'limit' => $limit, 'usage' => $usage, 'status' => 200, ]; } catch ( \Exception $e ) { return (object) [ 'status' => $e->getCode(), 'error' => $e->getMessage(), ]; } } }