Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
_DtoXData
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 getLocalXCodes
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
1
 getXMessageTemplates
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/** @noinspection SpellCheckingInspection */
3
4/**
5 * @author: Doug Wilbourne (dougwilbourne@gmail.com)
6 * @noinspection PhpCSValidationInspection
7 */
8
9declare(strict_types=1);
10
11namespace pvc\struct\dto\err;
12
13use pvc\err\XDataAbstract;
14
15class _DtoXData extends XDataAbstract
16{
17
18    public function getLocalXCodes(): array
19    {
20        return [
21            InvalidDtoClassException::class => 1000,
22            DtoInvalidPropertyNameException::class => 1001,
23            DtoInvalidArrayKeyException::class => 1002,
24            DtoInvalidEntityGetterException::class => 1003,
25            InvalidDtoReflection::class => 1004,
26            DtoClassDefinitionException::class => 1005,
27        ];
28    }
29
30    public function getXMessageTemplates(): array
31    {
32        return [
33            DtoInvalidPropertyNameException::class => 'Property name (\'${propertyName}\') does not exist in the supplied DTO.',
34            DtoInvalidArrayKeyException::class => 'Array key (\'${arrayKey}\') does not exist in the source array.',
35            DtoInvalidEntityGetterException::class => 'Method ${getterName} does not exist in class ${entityClassString}',
36            InvalidDtoReflection::class => '${badClassString} does not implement DtoInterface',
37            InvalidDtoClassException::class => 'Invalid Dto class ${badDtoClassName}. Dto constructor must populate all public properties.',
38            DtoClassDefinitionException::class => 'Bad class definition for ${badDtoClassName}.  Some public properties are not initialized in the constructor',
39        ];
40    }
41}