Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
40 / 40
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
_TreeXData
100.00% covered (success)
100.00%
40 / 40
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 getLocalXCodes
100.00% covered (success)
100.00%
20 / 20
100.00% covered (success)
100.00%
1 / 1
1
 getXMessageTemplates
100.00% covered (success)
100.00%
20 / 20
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\tree\err;
12
13use pvc\err\XDataAbstract;
14
15class _TreeXData extends XDataAbstract
16{
17
18    public function getLocalXCodes(): array
19    {
20        return [
21            AddNodeException::class                     => 1000,
22            AlreadySetNodeidException::class              => 1001,
23            AlreadySetRootException::class                => 1002,
24            ChildCollectionException::class               => 1004,
25            CircularGraphException::class                 => 1005,
26            DeleteInteriorNodeException::class            => 1006,
27            InvalidNodeIdException::class                 => 1008,
28            InvalidParentNodeIdException::class           => 1010,
29            InvalidTreeidException::class                 => 1011,
30            NodeNotInTreeException::class                 => 1012,
31            RootCountException::class                     => 1013,
32            RootCannotBeMovedException::class             => 1014,
33            SetTreeException::class                       => 1015,
34            NodeNotEmptyHydrationException::class         => 1019,
35            TreeNotInitializedException::class            => 1021,
36            TreenodeFactoryNotInitializedException::class => 1022,
37            NodeNotInitializedException::class            => 1023,
38            DtoCollectionException::class                 => 1024,
39        ];
40    }
41
42    public function getXMessageTemplates(): array
43    {
44        return [
45            AddNodeException::class                        => 'error setting node with nodeId ${nodeId}',
46            AlreadySetNodeidException::class              => 'nodeid ${nodeid} already exists in the tree.',
47            AlreadySetRootException::class                => 'set root error - root of tree is already set.',
48            ChildCollectionException::class               => 'Child collection supplied to the constructor must be empty.',
49            CircularGraphException::class                 => 'circular graph error: nodeid ${nodeid} cannot be its own ancestor.',
50            DeleteInteriorNodeException::class            => 'cannot delete nodeid ${nodeid} - must be a leaf.',
51            InvalidNodeIdException::class                 => 'error trying to set invalid nodeid',
52            InvalidParentNodeIdException::class           => 'Parentid ${parentid} does not exist in the current tree.',
53            InvalidTreeidException::class                 => 'error trying to set invalid treeid',
54            NodeNotInTreeException::class                 => 'treeid ${treeid} does not contain nodeid ${nodeid}.',
55            RootCountException::class                     => 'invalid number of tree roots found.  Expected one, found ${rootCount}.',
56            RootCannotBeMovedException::class             => 'The root node cannot be moved to another place in the tree.',
57            SetTreeException::class                       => 'either the treeid of node ${nodeId} does not match the one in the tree or the tree reference has already been set.',
58            NodeNotEmptyHydrationException::class         => 'cannot hydrate a non-empty node - nodeid ${nodeId} is already set.',
59            TreeNotInitializedException::class            => 'cannot use Tree until it has been initialized.',
60            TreenodeFactoryNotInitializedException::class => 'cannot use TreeNodeFactory until it has been initialized.',
61            NodeNotInitializedException::class            => 'cannot use the node until it has been initialized.',
62            DtoCollectionException::class => 'Treenode dto collection contains orphaned nodes that were not inserted into tree.'
63        ];
64    }
65}