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
RecordNotFoundException
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
 forId
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 * Record Not Found Domain Exception.
15 *
16 * Thrown when the engine cannot locate a record by the given ID
17 * in the module target table.
18 *
19 * @package App\Core\Engine\Domain\Exception
20 */
21final class RecordNotFoundException extends RuntimeException
22{
23    /**
24     * Creates a RecordNotFoundException for a given module and record ID.
25     *
26     * @param string $moduleName The module where the record was searched.
27     * @param int    $recordId   The ID that could not be found.
28     * @return self Configured exception instance.
29     */
30    public static function forId(string $moduleName, int $recordId): self
31    {
32        return new self(
33            sprintf('Record #%d not found in module "%s".', $recordId, $moduleName)
34        );
35    }
36}