Skip to content
Draft
20 changes: 10 additions & 10 deletions plugins/embed-optimizer/class-embed-optimizer-tag-visitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ final class Embed_Optimizer_Tag_Visitor {
*
* @since n.e.x.t
*
* @param OD_HTML_Tag_Processor $processor Processor.
* @param OD_Tag_Visitor_Context $context Tag visitor context.
* @return bool Whether at the tag.
*/
private function is_embed_figure( OD_HTML_Tag_Processor $processor ): bool {
private function is_embed_figure( OD_Tag_Visitor_Context $context ): bool {
return (
'FIGURE' === $processor->get_tag()
'FIGURE' === $context->processor->get_tag()
&&
true === $processor->has_class( 'wp-block-embed' )
true === $context->processor->has_class( 'wp-block-embed' )
);
}

Expand All @@ -49,14 +49,14 @@ private function is_embed_figure( OD_HTML_Tag_Processor $processor ): bool {
*
* @since n.e.x.t
*
* @param OD_HTML_Tag_Processor $processor Processor.
* @param OD_Tag_Visitor_Context $context Tag visitor context.
* @return bool Whether the tag should be measured and stored in URL metrics.
*/
private function is_embed_wrapper( OD_HTML_Tag_Processor $processor ): bool {
private function is_embed_wrapper( OD_Tag_Visitor_Context $context ): bool {
return (
'DIV' === $processor->get_tag()
'DIV' === $context->processor->get_tag()
&&
true === $processor->has_class( 'wp-block-embed__wrapper' )
true === $context->processor->has_class( 'wp-block-embed__wrapper' )
);
}

Expand Down Expand Up @@ -92,12 +92,12 @@ public function __invoke( OD_Tag_Visitor_Context $context ): bool {
* The only thing we need to do if it is a div.wp-block-embed__wrapper tag is return true so that the tag
* will get measured and stored in the URL Metrics.
*/
if ( $this->is_embed_wrapper( $processor ) ) {
if ( $this->is_embed_wrapper( $context ) ) {
return true;
}

// Short-circuit if not a figure.wp-block-embed tag.
if ( ! $this->is_embed_figure( $processor ) ) {
if ( ! $this->is_embed_figure( $context ) ) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ protected function is_data_url( string $url ): bool {
*
* @phpstan-param NormalizedAttributeNames $attribute_name
*
* @param OD_HTML_Tag_Processor $processor Processor.
* @param string $attribute_name Attribute name.
* @param OD_HTML_Tag_Processor|OD_HTML_Processor $processor Processor.
* @param string $attribute_name Attribute name.
* @return string|true|null Normalized attribute value.
*/
protected function get_attribute_value( OD_HTML_Tag_Processor $processor, string $attribute_name ) {
protected function get_attribute_value( $processor, string $attribute_name ) {
$value = $processor->get_attribute( $attribute_name );
if ( is_string( $value ) ) {
$value = strtolower( trim( $value, " \t\f\r\n" ) );
Expand Down
Loading
Loading