Fix code style

This commit is contained in:
Art4 2025-01-08 15:06:24 +00:00
parent 525b1c6440
commit d16614e06a
3 changed files with 23 additions and 24 deletions

View file

@ -29,21 +29,21 @@ final class AddonContainer implements ContainerInterface
private function __construct(Container $container, array $allowedServices) private function __construct(Container $container, array $allowedServices)
{ {
$this->container = $container; $this->container = $container;
$this->allowedServices = $allowedServices; $this->allowedServices = $allowedServices;
} }
/** /**
* Finds an entry of the container by its identifier and returns it. * Finds an entry of the container by its identifier and returns it.
* *
* @param string $id Identifier of the entry to look for. * @param string $id Identifier of the entry to look for.
* *
* @throws \Psr\Container\NotFoundExceptionInterface No entry was found for **this** identifier. * @throws \Psr\Container\NotFoundExceptionInterface No entry was found for **this** identifier.
* @throws \Psr\Container\ContainerExceptionInterface Error while retrieving the entry. * @throws \Psr\Container\ContainerExceptionInterface Error while retrieving the entry.
* *
* @return mixed Entry. * @return mixed Entry.
*/ */
public function get(string $id) public function get(string $id)
{ {
if ($this->has($id)) { if ($this->has($id)) {
return $this->container->create($id); return $this->container->create($id);
@ -58,17 +58,17 @@ final class AddonContainer implements ContainerInterface
} }
/** /**
* Returns true if the container can return an entry for the given identifier. * Returns true if the container can return an entry for the given identifier.
* Returns false otherwise. * Returns false otherwise.
* *
* `has($id)` returning true does not mean that `get($id)` will not throw an exception. * `has($id)` returning true does not mean that `get($id)` will not throw an exception.
* It does however mean that `get($id)` will not throw a `NotFoundExceptionInterface`. * It does however mean that `get($id)` will not throw a `NotFoundExceptionInterface`.
* *
* @param string $id Identifier of the entry to look for. * @param string $id Identifier of the entry to look for.
* *
* @return bool * @return bool
*/ */
public function has(string $id): bool public function has(string $id): bool
{ {
return in_array($id, $this->allowedServices); return in_array($id, $this->allowedServices);
} }

View file

@ -37,7 +37,7 @@ final class AddonManager
foreach ($this->addons as $addon) { foreach ($this->addons as $addon) {
// @TODO Here we can filter or deny dependencies from addons // @TODO Here we can filter or deny dependencies from addons
$dependencies[$addon->getId()] = $addon->getRequiredDependencies(); $dependencies[$addon->getId()] = $addon->getRequiredDependencies();
} }
return $dependencies; return $dependencies;

View file

@ -17,7 +17,6 @@ use Friendica\Service\Addon\Addon;
use Friendica\Service\Addon\AddonProxy; use Friendica\Service\Addon\AddonProxy;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
/** /**
* Helper interface to combine AddonBootstrap and DependencyProvider. * Helper interface to combine AddonBootstrap and DependencyProvider.