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

eTag::eTagValueDoesNotMatch()   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 eTag
5
{
6
    /**
7
     * Message to show error when data service found eTag
8
     * header for non-existing resource.
9
     *
10
     * @return string The message
11
     */
12
    public static function eTagNotAllowedForNonExistingResource()
13
    {
14
        return 'The resource targeted by the request does not exists, eTag header is not allowed for non-existing resource.';
15
    }
16
17
    /**
18
     * Message to show error when request contains eTag headers
19
     * but targeted resource type does not have eTag properties defined.
20
     *
21
     * @return string The message
22
     */
23
    public static function noETagPropertiesForType()
24
    {
25
        return 'If-Match or If-None-Match headers cannot be specified if the target type does not have etag properties defined.';
26
    }
27
28
    /**
29
     * Message to show error when data service found the request eTag
30
     * does not match with entry eTag.
31
     *
32
     * @return string The message
33
     */
34
    public static function eTagValueDoesNotMatch()
35
    {
36
        return 'The etag value in the request header does not match with the current etag value of the object.';
37
    }
38
39
    /**
40
     * Format a message to show error when request eTag header has been
41
     * specified but eTag is not allowed for the targeted resource.
42
     *
43
     * @param string $uri Url
44
     *
45
     * @return string The formatted message
46
     */
47
    public static function eTagCannotBeSpecified($uri)
48
    {
49
        return "If-Match or If-None-Match HTTP headers cannot be specified since the URI '$uri' refers to a collection of resources or has a \$count or \$link segment or has a \$expand as one of the query parameters.";
50
    }
51
}
52