Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ModuleNotFoundException
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 forName
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5/** @license For full copyright and license information, please see the LICENSE.md file. */
6
7namespace App\Core\Engine\Domain\Exception;
8
9defined('AMMONLY_APP') || exit('Direct script access is forbidden.');
10
11use RuntimeException;
12
13/**
14 * Module Not Found Domain Exception.
15 *
16 * Thrown when the engine cannot locate a module metadata record
17 * by the given module name in a_core_module_records.
18 *
19 * @package App\Core\Engine\Domain\Exception
20 */
21final class ModuleNotFoundException extends RuntimeException
22{
23    /**
24     * Creates a ModuleNotFoundException for a given module name.
25     *
26     * @param string $moduleName The unresolvable module name.
27     * @return self Configured exception instance.
28     */
29    public static function forName(string $moduleName): self
30    {
31        return new self(
32            sprintf('Engine module not found: "%s". Register module in a_core_module_records.', $moduleName)
33        );
34    }
35}