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

queryProcessorIncorrectArgumentFormat()   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 queryProcessor
5
{
6
    /**
7
     * Message to show error when query prcocessor found
8
     * invalid value for $format option.
9
     *
10
     * @return string The message
11
     */
12
    public static function queryProcessorInvalidValueForFormat()
13
    {
14
        return 'Invalid $format query option - the only acceptable values are "json" and "atom"';
15
    }
16
17
    /**
18
     * Message to show error when query processor found odata query option
19
     * in the request uri which is not applicable for the
20
     * resource targeted by the resource path.
21
     *
22
     * @return string The message
23
     */
24
    public static function queryProcessorNoQueryOptionsApplicable()
25
    {
26
        return 'Query options $select, $expand, $filter, $orderby, $inlinecount, $skip, $skiptoken and $top are not supported by this request method or cannot be applied to the requested resource.';
27
    }
28
29
    /**
30
     * Message to show error when query processor found $filter option in the
31
     * request uri but is not applicable for the resource targeted by the
32
     * resource path.
33
     *
34
     * @return string The message
35
     */
36
    public static function queryProcessorQueryFilterOptionNotApplicable()
37
    {
38
        return 'Query option $filter cannot be applied to the requested resource.';
39
    }
40
41
    /**
42
     * Message to show error when query processor found any $orderby,
43
     * $inlinecount, $skip or $top options in the request uri but is not
44
     * applicable for the resource targeted by the resource path.
45
     *
46
     * @return string The message
47
     */
48
    public static function queryProcessorQuerySetOptionsNotApplicable()
49
    {
50
        return 'Query options $orderby, $inlinecount, $skip and $top cannot be applied to the requested resource.';
51
    }
52
53
    /**
54
     * Message to show error when query processor found skiptoken option in the
55
     * request uri but is not applicable for the resource targeted by the
56
     * resource path.
57
     *
58
     * @return string The message
59
     */
60
    public static function queryProcessorSkipTokenNotAllowed()
61
    {
62
        return 'Query option $skiptoken cannot be applied to the requested resource.';
63
    }
64
65
    /**
66
     * Message to show error when query processor found $expand option in the
67
     * request uri but is not applicable for the resource targeted by the
68
     * resource path.
69
     *
70
     * @return string The message
71
     */
72
    public static function queryProcessorQueryExpandOptionNotApplicable()
73
    {
74
        return 'Query option $expand cannot be applied to the requested resource.';
75
    }
76
77
    /**
78
     * Message to show error when query processor found usage of $inline count
79
     * option for a resource path ending with $count.
80
     *
81
     * @return string The message
82
     */
83
    public static function queryProcessorInlineCountWithValueCount()
84
    {
85
        return '$inlinecount cannot be applied to the resource segment $count';
86
    }
87
88
    /**
89
     * Message to show error when value of $inlinecount option found invalid.
90
     *
91
     * @return string The message
92
     */
93
    public static function queryProcessorInvalidInlineCountOptionError()
94
    {
95
        return 'Unknown $inlinecount option, only "allpages" and "none" are supported';
96
    }
97
98
    /**
99
     * Format a message to show error when query processor found invalid
100
     * value for a query option.
101
     *
102
     * @param string $argName  The name of the argument
103
     * @param string $argValue The value of the argument
104
     *
105
     * @return string The formatted message
106
     */
107
    public static function queryProcessorIncorrectArgumentFormat($argName, $argValue)
108
    {
109
        return "Incorrect format for $argName argument '$argValue'";
110
    }
111
112
    /**
113
     * Format a message to show error when query processor found $skiptoken
114
     * in the request uri targetting to a resource for which paging is not
115
     * enabled.
116
     *
117
     * @param string $resourceSetName The name of the resource set
118
     *
119
     * @return string The formatted message
120
     */
121
    public static function queryProcessorSkipTokenCannotBeAppliedForNonPagedResourceSet($resourceSetName)
122
    {
123
        return "\$skiptoken cannot be applied to the resource set '$resourceSetName', since paging is not enabled for this resource set";
124
    }
125
126
    /**
127
     * Format a message to show error when query processor found $select
128
     * or $expand which cannot be applied to resource targeted by the
129
     * request uri.
130
     *
131
     * @param string $queryItem Query item
132
     *
133
     * @return string The formatted message
134
     */
135
    public static function queryProcessorSelectOrExpandOptionNotApplicable($queryItem)
136
    {
137
        return "Query option $queryItem cannot be applied to the requested resource";
138
    }
139
}
140