• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ICanBoogie / ActiveRecord / 4437457574

pending completion
4437457574

push

github

Olivier Laviale
Case of a nullable belong_to

7 of 7 new or added lines in 1 file covered. (100.0%)

1356 of 1686 relevant lines covered (80.43%)

34.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/lib/ActiveRecord/ScopeNotDefined.php
1
<?php
2

3
/*
4
 * This file is part of the ICanBoogie package.
5
 *
6
 * (c) Olivier Laviale <olivier.laviale@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
namespace ICanBoogie\ActiveRecord;
13

14
use ICanBoogie\Accessor\AccessorTrait;
15
use LogicException;
16
use Throwable;
17

18
/**
19
 * Exception thrown in attempt to obtain a scope that is not defined.
20
 *
21
 * @property-read string $scope_name
22
 * @property-read Model $model
23
 */
24
class ScopeNotDefined extends LogicException implements Exception
25
{
26
    /**
27
     * @uses get_scope_name
28
     * @uses get_model
29
     */
30
    use AccessorTrait;
31

32
    private function get_scope_name(): string
33
    {
34
        return $this->scope_name;
×
35
    }
36

37
    private function get_model(): Model
38
    {
39
        return $this->model;
×
40
    }
41

42
    public function __construct(
43
        private string $scope_name,
44
        private Model $model,
45
        Throwable $previous = null
46
    ) {
47
        parent::__construct($this->format_message($scope_name, $model), 0, $previous);
2✔
48
    }
49

50
    private function format_message(string $scope_name, Model $model): string
51
    {
52
        return "Unknown scope `$scope_name` for model `$model->unprefixed_name`.";
2✔
53
    }
54
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc