result" follow-up poll is disabled while push is * active (see {@see Cron::check_adstxt()}). * * @link https://actirise.com * @since 4.3.0 * @package actirise * @subpackage actirise/includes/push/handler * @author actirise */ final class AdstxtMonitoringPushHandler implements PushEndpointHandlerInterface { /** * {@inheritDoc} * * @since 4.3.0 * @return string */ public function endpoint() { return 'adstxt-monitoring'; } /** * {@inheritDoc} * * @since 4.3.0 * @return string */ public function event_type() { return 'wordpress.adstxt_monitoring.completed'; // phpcs:ignore WordPress.WP.CapitalPDangit.MisspelledInText -- Actirise API event-type identifier. } /** * {@inheritDoc} * * @since 4.3.0 * @return int[] */ public function supported_versions() { return array( 1 ); } /** * Apply an ads.txt validation verdict. * * The payload must be an object carrying a final `state` (`ok` or `error`); * a missing, `pending` or unknown state is treated as a schema error and * rejected with a 400 by the controller. The counts and the update flag are * derived by the shared writers reused by the polling fallback. * * @since 4.3.0 * @param mixed $data The validation verdict `{state, missing[], blacklistLines[]}`. * @return bool True when the verdict was applied. */ public function apply( $data ) { if ( ! is_array( $data ) || ! isset( $data['state'] ) ) { return false; } if ( 'ok' !== $data['state'] && 'error' !== $data['state'] ) { return false; } AdsTxt::store_validation_counts( $data ); Cron::finalize_adstxt_check( $data ); return true; } }