} $overrides Settings to use instead of the saved ones. * @param bool $coverage Also check the page text against the Markdown. * @return VerifyResult The outcome. */ public function verify( WP_Post $post, array $overrides = array(), bool $coverage = true ): VerifyResult { $reason = $this->eligibility->reason( $post ); if ( null !== $reason ) { return new VerifyResult( VerifyResult::NOT_SERVED, $this->eligibility->describe( $reason ) ); } $render = $this->renderer->render( $post ); $page = $this->generator->build( $post, $render, $overrides ); $entry = $this->store->get( $post->ID ); $blocks = $coverage ? $this->generator->text_blocks( $render, $overrides ) : null; $result = new VerifyResult( VerifyResult::NOT_STORED, '', $entry, $page, array(), 0, null === $blocks ? null : Comparison::coverage( $blocks['kept'], $page->markdown ), null === $blocks ? array() : $blocks['excluded'] ); if ( null === $entry ) { return $result; } $ignore = array_map( 'strval', (array) apply_filters( 'agentwelcome_compare_ignore', array(), $post ) ); $stored_text = Comparison::normalise( $entry->markdown, $ignore ); $fresh_text = Comparison::normalise( $page->markdown, $ignore ); $result->state = $stored_text === $fresh_text ? VerifyResult::IN_SYNC : VerifyResult::DIFFERS; if ( VerifyResult::DIFFERS === $result->state ) { $result->diff = Comparison::diff( $stored_text, $fresh_text ); $result->changed = Comparison::changed( $result->diff ); } return $result; } }