Skip to content

Commit 53a91a2

Browse files
Remove append_head_html() and append_body_html() methods from OD_Template_Optimization_Context for now
Co-authored-by: Felix Arntz <[email protected]>
1 parent 5da134c commit 53a91a2

File tree

12 files changed

+12
-81
lines changed

12 files changed

+12
-81
lines changed

plugins/optimization-detective/class-od-template-optimization-context.php

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,6 @@ final class OD_Template_Optimization_Context {
3333
*/
3434
private $url_metric_group_collection;
3535

36-
/**
37-
* HTML Tag Processor.
38-
*
39-
* This object is not directly exposed with an accessor property. This class exposes {@see self::append_head_html()}
40-
* and {@see self::append_body_html()} methods which wrap calls to the underlying
41-
* {@see OD_HTML_Tag_Processor::append_head_html()} and {@see OD_HTML_Tag_Processor::append_body_html()}.s
42-
*
43-
* @since n.e.x.t
44-
* @var OD_HTML_Tag_Processor
45-
*/
46-
private $processor;
47-
4836
/**
4937
* ID for the od_url_metrics post which provided the URL Metrics in the collection.
5038
*
@@ -83,55 +71,22 @@ final class OD_Template_Optimization_Context {
8371
* Constructor.
8472
*
8573
* @since n.e.x.t
74+
* @access private
8675
*
87-
* @param OD_HTML_Tag_Processor $processor HTML Tag Processor.
8876
* @param OD_URL_Metric_Group_Collection $url_metric_group_collection URL Metric group collection.
8977
* @param OD_Link_Collection $link_collection Link collection.
9078
* @param array<string, mixed> $normalized_query_vars Normalized query vars.
9179
* @param non-empty-string $url_metrics_slug Slug for the od_url_metrics post.
9280
* @param positive-int|null $url_metrics_id ID for the od_url_metrics post which provided the URL Metrics in the collection. May be null if no post has been created yet.
9381
*/
94-
public function __construct( OD_HTML_Tag_Processor $processor, OD_URL_Metric_Group_Collection $url_metric_group_collection, OD_Link_Collection $link_collection, array $normalized_query_vars, string $url_metrics_slug, ?int $url_metrics_id ) {
95-
$this->processor = $processor;
82+
public function __construct( OD_URL_Metric_Group_Collection $url_metric_group_collection, OD_Link_Collection $link_collection, array $normalized_query_vars, string $url_metrics_slug, ?int $url_metrics_id ) {
9683
$this->url_metric_group_collection = $url_metric_group_collection;
9784
$this->link_collection = $link_collection;
9885
$this->normalized_query_vars = $normalized_query_vars;
9986
$this->url_metrics_slug = $url_metrics_slug;
10087
$this->url_metrics_id = $url_metrics_id;
10188
}
10289

103-
/**
104-
* Appends raw HTML to the HEAD.
105-
*
106-
* The provided HTML must be valid for insertion in the HEAD. No validation is currently performed. However, in the
107-
* future the HTML Processor may be used to ensure the validity of the provided HTML. At that time, when invalid
108-
* HTML is provided, this method may emit a `_doing_it_wrong()` warning.
109-
*
110-
* @since n.e.x.t
111-
* @see OD_HTML_Tag_Processor::append_head_html()
112-
*
113-
* @param string $raw_html Raw HTML to inject.
114-
*/
115-
public function append_head_html( string $raw_html ): void {
116-
$this->processor->append_head_html( $raw_html );
117-
}
118-
119-
/**
120-
* Appends raw HTML to the BODY.
121-
*
122-
* The provided HTML must be valid for insertion in the BODY. No validation is currently performed. However, in the
123-
* future the HTML Processor may be used to ensure the validity of the provided HTML. At that time, when invalid
124-
* HTML is provided, this method may emit a `_doing_it_wrong()` warning.
125-
*
126-
* @since n.e.x.t
127-
* @see OD_HTML_Tag_Processor::append_body_html()
128-
*
129-
* @param string $raw_html HTML to inject.
130-
*/
131-
public function append_body_html( string $raw_html ): void {
132-
$this->processor->append_body_html( $raw_html );
133-
}
134-
13590
/**
13691
* Gets a property.
13792
*

plugins/optimization-detective/optimization.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ function od_optimize_template_output_buffer( string $buffer ): string {
278278
$link_collection = new OD_Link_Collection();
279279

280280
$template_optimization_context = new OD_Template_Optimization_Context(
281-
$processor,
282281
$group_collection,
283282
$link_collection,
284283
$query_vars,

plugins/optimization-detective/tests/test-cases/admin-bar/expected.html

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/optimization-detective/tests/test-cases/complete-url-metrics/expected.html

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/optimization-detective/tests/test-cases/many-images/expected.html

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/optimization-detective/tests/test-cases/no-url-metrics/expected.html

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/optimization-detective/tests/test-cases/noscript/expected.html

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/optimization-detective/tests/test-cases/preload-link/expected.html

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/optimization-detective/tests/test-cases/tag-track-opt-in/expected.html

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/optimization-detective/tests/test-cases/video/expected.html

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)