| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Services\Health_Check; |
| 4 |
|
| 5 |
/** |
| 6 |
* Used by classes that use a health check Report_Builder. |
| 7 |
*/ |
| 8 |
trait Reports_Trait { |
| 9 |
|
| 10 |
/** |
| 11 |
* The factory for the builder object that generates WordPress-friendly test results. |
| 12 |
* |
| 13 |
* @var Report_Builder_Factory |
| 14 |
*/ |
| 15 |
private $report_builder_factory; |
| 16 |
|
| 17 |
/** |
| 18 |
* The test identifier that's set on the Report_Builder. |
| 19 |
* |
| 20 |
* @var string |
| 21 |
*/ |
| 22 |
private $test_identifier = ''; |
| 23 |
|
| 24 |
/** |
| 25 |
* Sets the name that WordPress uses to identify this health check. |
| 26 |
* |
| 27 |
* @param string $test_identifier The identifier. |
| 28 |
* @return void |
| 29 |
*/ |
| 30 |
public function set_test_identifier( $test_identifier ) { |
| 31 |
$this->test_identifier = $test_identifier; |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Returns a new Report_Builder instance using the set test identifier. |
| 36 |
* |
| 37 |
* @return Report_Builder |
| 38 |
*/ |
| 39 |
private function get_report_builder() { |
| 40 |
return $this->report_builder_factory->create( $this->test_identifier ); |
| 41 |
} |
| 42 |
} |
| 43 |
|