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

FastyBird / json-api / 7822169728

07 Feb 2024 10:39PM UTC coverage: 4.32%. Remained the same
7822169728

push

github

akadlec
Removed unused package

41 of 949 relevant lines covered (4.32%)

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

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

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

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

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

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

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

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