Lines 100.00% 7 / 7
Methods 100.00% 1 / 1
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 __construct 100.00% 7 / 7 100.00% 1 / 1 1
11final class StaleRowException extends \RuntimeException
12{
13    /**
14     * The class-string of the model whose row was already gone.
15     *
16     * @var class-string<\BlueprintAU\Radiant\Model>
17     */
18    public readonly string $model;
19
20    /**
21     * The operation that matched no rows (`delete`, `restore`).
22     *
23     * @var string
24     */
25    public readonly string $operation;
26
27    /**
28     * @param  class-string<\BlueprintAU\Radiant\Model>  $modelClass
29     * @param  string  $operation
30     */
31    public function __construct(string $modelClass, string $operation)
32    {
33        parent::__construct(
34            "The {$operation} on model [{$modelClass}] matched no rows — the row was "
35            . 'already removed by another connection (a stale instance). Re-fetch the '
36            . 'model before writing again.'
37        );
38
39        $this->model = $modelClass;
40        $this->operation = $operation;
41    }
42}