![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/allure-framework/allure-php-commons/src/Internal/ |
<?php declare(strict_types=1); namespace Qameta\Allure\Internal; use Qameta\Allure\Internal\Exception\StorableNotFoundException; use Qameta\Allure\Model\ContainerResult; use Qameta\Allure\Model\ExecutionContextInterface; use Qameta\Allure\Model\FixtureResult; use Qameta\Allure\Model\ResultType; use Qameta\Allure\Model\StepResult; use Qameta\Allure\Model\StorableResultInterface; use Qameta\Allure\Model\TestResult; /** * @internal */ class ResultStorage implements ResultStorageInterface { /** * @var array<string, StorableResultInterface> */ private array $storage = []; public function set(StorableResultInterface $object): void { $this->storage[$object->getUuid()] = $object; } public function unset(string $uuid): void { unset($this->storage[$uuid]); } public function getContainer(string $uuid): ContainerResult { return $this->findObject(ContainerResult::class, $uuid) ?? throw new StorableNotFoundException(ResultType::container(), $uuid); } public function getFixture(string $uuid): FixtureResult { return $this->findObject(FixtureResult::class, $uuid) ?? throw new StorableNotFoundException(ResultType::fixture(), $uuid); } public function getTest(string $uuid): TestResult { return $this->findObject(TestResult::class, $uuid) ?? throw new StorableNotFoundException(ResultType::test(), $uuid); } public function getStep(string $uuid): StepResult { return $this->findObject(StepResult::class, $uuid) ?? throw new StorableNotFoundException(ResultType::step(), $uuid); } public function getExecutionContext(string $uuid): ExecutionContextInterface { return $this->findObject(ExecutionContextInterface::class, $uuid) ?? throw new StorableNotFoundException(ResultType::executableContext(), $uuid); } /** * @template T of StorableResultInterface * @param class-string<T> $class * @param string $uuid * @return T|null */ private function findObject(string $class, string $uuid): ?StorableResultInterface { $object = $this->storage[$uuid] ?? null; return $object instanceof $class ? $object : null; } }