Completed
Push — master ( d66c3c...7db86c )
by Alex
05:11
created

providersWrapperContainerNameMustNotBeNullOrEmpty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace POData\Common\Messages;
3
4
trait providersWrapper
5
{
6
    /**
7
     * Message to show error service implementation returns null for IMetadataProvider or IQueryProvider.
8
     *
9
     * @return string The message
10
     */
11
    public static function providersWrapperNull()
12
    {
13
        return 'For custom providers, GetService should not return null for both IMetadataProvider and IQueryProvider types.';
14
    }
15
16
    /**
17
     * The error message to show when IQueryProvider::getExpressionProvider
18
     * method returns empty or null.
19
     *
20
     * @return string The message
21
     */
22
    public static function providersWrapperExpressionProviderMustNotBeNullOrEmpty()
23
    {
24
        return 'The value returned by IQueryProvider::getExpressionProvider method must not be null or empty';
25
    }
26
27
    /**
28
     * The error message to show when IQueryProvider::getExpressionProvider
29
     * method returns non-object or an object which does not implement IExpressionProvider.
30
     *
31
     * @return string The message
32
     */
33
    public static function providersWrapperInvalidExpressionProviderInstance()
34
    {
35
        return 'The value returned by IQueryProvider::getExpressionProvider method must be an implementation of IExpressionProvider';
36
    }
37
38
    /**
39
     * The error message to show when IMetadataProvider::getContainerName
40
     * method returns empty container name.
41
     *
42
     * @return string The message
43
     */
44
    public static function providersWrapperContainerNameMustNotBeNullOrEmpty()
45
    {
46
        return 'The value returned by IMetadataProvider::getContainerName method must not be null or empty';
47
    }
48
49
    /**
50
     * The error message to show when
51
     * IMetadataProvider::getContainerNamespace
52
     * method returns empty container name.
53
     *
54
     * @return string The message
55
     */
56
    public static function providersWrapperContainerNamespaceMustNotBeNullOrEmpty()
57
    {
58
        return 'The value returned by IMetadataProvider::getContainerNamespace method must not be null or empty';
59
    }
60
61
    /**
62
     * Format a message to show error when
63
     * more than one entity set with the same name found.
64
     *
65
     * @param string $entitySetName The name of the entity set
66
     *
67
     * @return string The formatted message
68
     */
69
    public static function providersWrapperEntitySetNameShouldBeUnique($entitySetName)
70
    {
71
        return "More than one entity set with the name '$entitySetName' was found. Entity set names must be unique";
72
    }
73
74
    /**
75
     * Format a message to show error when
76
     * more than one entity type with the same name found.
77
     *
78
     * @param string $entityTypeName The name of the entity type
79
     *
80
     * @return string The formatted message
81
     */
82
    public static function providersWrapperEntityTypeNameShouldBeUnique($entityTypeName)
83
    {
84
        return "More than one entity type with the name '$entityTypeName' was found. Entity type names must be unique.";
85
    }
86
87
    /**
88
     * Format a message to show error when IDSMP::getResourceSet
89
     * returns inconsistent instance of ResourceSet.
90
     *
91
     * @param string $resourceSetName      Name of the resource set
92
     * @param string $resourceTypeName     Name of the resource type
93
     * @param string $resourcePropertyName Name of the navigation property
94
     *
95
     * @return string The formatted message
96
     */
97
    public static function providersWrapperIDSMPGetResourceSetReturnsInvalidResourceSet($resourceSetName, $resourceTypeName, $resourcePropertyName)
98
    {
99
        return "IDSMP::GetResourceSet retruns invalid instance of ResourceSet when invoked with params {ResourceSet with name $resourceSetName, ResourceType with name $resourceTypeName, ResourceProperty with name $resourcePropertyName}.";
100
    }
101
102
    /**
103
     * Format a message to show error when IDSMP::getResourceFromResourceSet
104
     * returns an instnce which is not an instance of expected entity instance.
105
     *
106
     * @param string $entityTypeName The name of expected entity type
107
     * @param string $methodName     Method name
108
     *
109
     * @return string The formatted message
110
     */
111
    public static function providersWrapperIDSQPMethodReturnsUnExpectedType($entityTypeName, $methodName)
112
    {
113
        return 'The implementation of the method ' . $methodName . ' must return an instance of type described by resource set\'s type(' . $entityTypeName . ') or null if resource does not exists';
114
    }
115
116
    /**
117
     * A message to show error when IDSQP::getResourceFromResourceSet
118
     * returns an entity instance with null key properties.
119
     *
120
     * @param string $methodName Method name
121
     *
122
     * @return string The message
123
     */
124
    public static function providersWrapperIDSQPMethodReturnsInstanceWithNullKeyProperties($methodName)
125
    {
126
        return 'The ' . $methodName . ' implementation returns an entity with null key propert(y|ies)';
127
    }
128
129
    /**
130
     * A message to show error when IDSQP::getResourceFromResourceSet
131
     * returns an entity instance with keys
132
     * not matching with the expected keys in the uri predicate.
133
     *
134
     * @param string $methodName Method name
135
     *
136
     * @return string The message
137
     */
138
    public static function providersWrapperIDSQPMethodReturnsInstanceWithNonMatchingKeys($methodName)
139
    {
140
        return 'The ' . $methodName . ' implementation returns an instance with non-matching key';
141
    }
142
}
143