| 1 |
<?php |
| 2 |
|
| 3 |
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong |
| 4 |
namespace Yoast\WP\SEO\Task_List\Application\Configuration; |
| 5 |
|
| 6 |
use Yoast\WP\SEO\Helpers\Options_Helper; |
| 7 |
use Yoast\WP\SEO\Task_List\Application\Endpoints\Endpoints_Repository; |
| 8 |
|
| 9 |
/** |
| 10 |
* Responsible for the task list configuration. |
| 11 |
*/ |
| 12 |
class Task_List_Configuration { |
| 13 |
|
| 14 |
/** |
| 15 |
* The options helper. |
| 16 |
* |
| 17 |
* @var Options_Helper |
| 18 |
*/ |
| 19 |
private $options_helper; |
| 20 |
|
| 21 |
/** |
| 22 |
* The endpoints repository. |
| 23 |
* |
| 24 |
* @var Endpoints_Repository |
| 25 |
*/ |
| 26 |
private $endpoints_repository; |
| 27 |
|
| 28 |
/** |
| 29 |
* The constructor. |
| 30 |
* |
| 31 |
* @param Options_Helper $options_helper The options helper. |
| 32 |
* @param Endpoints_Repository $endpoints_repository The endpoints repository. |
| 33 |
*/ |
| 34 |
public function __construct( |
| 35 |
Options_Helper $options_helper, |
| 36 |
Endpoints_Repository $endpoints_repository |
| 37 |
) { |
| 38 |
$this->options_helper = $options_helper; |
| 39 |
$this->endpoints_repository = $endpoints_repository; |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* Returns a configuration |
| 44 |
* |
| 45 |
* @return array<string, array<string>|array<string, string|array<string, array<string, int>>>> |
| 46 |
*/ |
| 47 |
public function get_configuration(): array { |
| 48 |
$configuration = [ |
| 49 |
'enabled' => $this->options_helper->get( 'enable_task_list', true ), |
| 50 |
'endpoints' => $this->endpoints_repository->get_all_endpoints()->to_array(), |
| 51 |
]; |
| 52 |
|
| 53 |
return $configuration; |
| 54 |
} |
| 55 |
} |
| 56 |
|