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

resourceAssociationSetEndPropertyMustBeNavigationProperty()   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 2
1
<?php
2
namespace POData\Common\Messages;
3
4
trait resourceAssociationSet
5
{
6
    /**
7
     * Format a message to show error when target resource property
8
     * argument is not null or instance of ResourceProperty.
9
     *
10
     * @param string $argumentName The name of the target resource property argument
11
     *
12
     * @return string The formatted message
13
     */
14
    public static function resourceAssociationSetPropertyMustBeNullOrInstanceofResourceProperty($argumentName)
15
    {
16
        return "The argument '$argumentName' must be either null or instance of 'ResourceProperty";
17
    }
18
19
    /**
20
     * Format a message when a property is used as
21
     * navigation property of a resource type which is actually not.
22
     *
23
     * @param string $propertyName     Property
24
     * @param string $resourceTypeName Resource type
25
     *
26
     * @return string The formatted message
27
     */
28
    public static function resourceAssociationSetEndPropertyMustBeNavigationProperty($propertyName, $resourceTypeName)
29
    {
30
        return "The property $propertyName must be a navigation property of the resource type $resourceTypeName";
31
    }
32
33
    /**
34
     * Format a message for showing the error when a resource type is
35
     * not assignable to resource set.
36
     *
37
     * @param string $resourceTypeName Resource type
38
     * @param string $resourceSetName  Resource set name
39
     *
40
     * @return string The formatted message
41
     */
42
    public static function resourceAssociationSetEndResourceTypeMustBeAssignableToResourceSet($resourceTypeName, $resourceSetName)
43
    {
44
        return "The resource type $resourceTypeName must be assignable to the resource set $resourceSetName";
45
    }
46
47
    /**
48
     * Format a message for showing the error when trying to
49
     * create an association set with both null resource property.
50
     *
51
     * @return string The formatted message
52
     */
53
    public static function resourceAssociationSetResourcePropertyCannotBeBothNull()
54
    {
55
        return 'Both the resource property of the association set cannot be null';
56
    }
57
58
    /**
59
     * Format a message for showing the error when trying to
60
     * create a self referencing bidirectional association.
61
     *
62
     * @return string The formatted message
63
     */
64
    public static function resourceAssociationSetSelfReferencingAssociationCannotBeBiDirectional()
65
    {
66
        return 'Bidirectional self referencing association is not allowed';
67
    }
68
}
69