Yoast\WP\SEO\Actions\Wincher

Wincher_Account_Action::check_limit()publicYoast 1.0

Checks the account limit for tracking keyphrases.

Метод класса: Wincher_Account_Action{}

Хуков нет.

Возвращает

Объект. The response object.

Использование

$Wincher_Account_Action = new Wincher_Account_Action();
$Wincher_Account_Action->check_limit();

Код Wincher_Account_Action::check_limit() Yoast 19.11

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(),
		];
	}
}