Create AddonHelper and proxy to check if addon is enabled

This commit is contained in:
Art4 2025-02-01 21:58:59 +00:00
parent f1dfa63764
commit 91bd6089b5
5 changed files with 61 additions and 1 deletions

View file

@ -0,0 +1,21 @@
<?php
// Copyright (C) 2010-2024, the Friendica project
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
//
// SPDX-License-Identifier: AGPL-3.0-or-later
declare(strict_types=1);
namespace Friendica\Core\Addon;
/**
* Some functions to handle addons
*/
interface AddonHelper
{
/**
* Checks if the provided addon is enabled
*/
public function isEnabled(string $addonId): bool;
}

View file

@ -0,0 +1,28 @@
<?php
// Copyright (C) 2010-2024, the Friendica project
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
//
// SPDX-License-Identifier: AGPL-3.0-or-later
declare(strict_types=1);
namespace Friendica\Core\Addon;
use Friendica\Core\Addon;
/**
* Proxy to the Addon class
*
* @internal
*/
final class AddonProxy implements AddonHelper
{
/**
* Checks if the provided addon is enabled
*/
public function isEnabled(string $addonId): bool
{
return Addon::isEnabled($addonId);
}
}