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

FastyBird / json-api / 10238182751

04 Aug 2024 05:56PM UTC coverage: 4.214% (-0.09%) from 4.302%
10238182751

push

github

web-flow
Merge pull request #2 from FastyBird/feature/constructor-params

Added parameters from entity constructor

0 of 41 new or added lines in 3 files covered. (0.0%)

9 existing lines in 2 files now uncovered.

41 of 973 relevant lines covered (4.21%)

0.13 hits per line

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

0.0
/src/Exceptions/JsonApiError.php
1
<?php declare(strict_types = 1);
2

3
/**
4
 * JsonApiError.php
5
 *
6
 * @license        More in LICENSE.md
7
 * @copyright      https://www.fastybird.com
8
 * @author         Adam Kadlec <adam.kadlec@fastybird.com>
9
 * @package        FastyBird:JsonApi!
10
 * @subpackage     Exceptions
11
 * @since          0.1.0
12
 *
13
 * @date           12.04.19
14
 */
15

16
namespace FastyBird\JsonApi\Exceptions;
17

18
use Exception as PHPException;
19
use Neomerx\JsonApi as NeomerxJsonApi;
20
use function strval;
21

22
/**
23
 * Process single error
24
 *
25
 * @package        FastyBird:JsonApi!
26
 * @subpackage     Exceptions
27
 *
28
 * @author         Adam Kadlec <adam.kadlec@fastybird.com>
29
 */
30
class JsonApiError extends PHPException implements Exception, JsonApi
31
{
32

33
        /**
34
         * @param array<mixed>|null $source
35
         */
36
        public function __construct(
37
                int $code,
38
                string $title,
39
                private readonly string|null $detail = null,
40
                private readonly array|null $source = null,
41
                private readonly string|null $type = null,
42
        )
43
        {
UNCOV
44
                parent::__construct($title, $code);
×
45
        }
46

47
        public function getError(): NeomerxJsonApi\Schema\Error
48
        {
49
                return new NeomerxJsonApi\Schema\Error(
×
NEW
50
                        strval($this->getType()),
×
51
                        null,
×
52
                        null,
×
53
                        (string) $this->code,
×
54
                        (string) $this->code,
×
55
                        $this->message,
×
NEW
56
                        strval($this->getDetail()),
×
57
                        $this->getSource(),
×
UNCOV
58
                );
×
59
        }
60

61
        public function getType(): string|null
62
        {
UNCOV
63
                return $this->type;
×
64
        }
65

66
        public function getDetail(): string|null
67
        {
UNCOV
68
                return $this->detail;
×
69
        }
70

71
        /**
72
         * @return array<mixed>|null
73
         */
74
        public function getSource(): array|null
75
        {
UNCOV
76
                return $this->source;
×
77
        }
78

79
}
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

© 2025 Coveralls, Inc