More work on this, incomplete!
Validate Build / validate-build (push) Canceled after 0s

This commit is contained in:
Cooper Dalrymple
2026-10-06 17:00:20 -05:00
parent 5f702470cc
commit b8902b4afa
23 changed files with 2138 additions and 175 deletions
+20 -7
View File
@@ -10,9 +10,7 @@
namespace Ogre\Consent;
use Ogre\Consent as Plugin;
use Ogre\Singleton;
use WP_HTML_Tag_Processor;
defined('ABSPATH') || exit;
@@ -20,19 +18,34 @@ final class Services {
use Singleton;
protected array $services = [];
protected function __construct() {
}
public function register(Service $service): void
{
$this->services[] = $service;
}
public function get_services(): array
{
return $this->services;
}
public function get_services_by_purpose(string $purpose): array
{
return array_filter(
$this->services,
fn (Service $service): bool => $service->get_purpose() == $purpose
);
}
public function get_config(): array
{
return array_map(fn (Service $service): array => $service->get_config(), $this->services);
return array_map(
fn (Service $service): array => $service->get_config(),
array_values(array_filter(
$this->services,
fn (Service $service): bool => $service->is_enabled()
))
);
}
}