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