Completed
Pull Request — master (#13)
by Christopher
05:56 queued 01:57
created

VoidType::getTypeCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace POData\Providers\Metadata\Type;
4
5
use POData\Common\NotImplementedException;
6
7
/**
8
 * Class VoidType. Named so as to avoid issues with php71
9
 */
10
class VoidType implements IType
11
{
12
    /**
13
     * Gets the type code
14
     * Note: implementation of IType::getTypeCode.
15
     *
16
     * @return TypeCode
17
     */
18
    public function getTypeCode()
19
    {
20
        return TypeCode::VOID;
21
    }
22
23
    /**
24
     * Checks this type (Void) is compatible with another type
25
     * Note: implementation of IType::isCompatibleWith.
26
     *
27
     * @param IType $type Type to check compatibility
28
     *
29
     * @return bool
30
     */
31
    public function isCompatibleWith(IType $type)
32
    {
33
        return $type->getTypeCode() == TypeCode::VOID;
34
    }
35
36
    /**
37
     * Validate a value in Astoria uri is in a format for this type
38
     * Note: implementation of IType::validate.
39
     *
40
     * @param string $value     The value to validate
41
     * @param string &$outValue The stripped form of $value that can
42
     *                          be used in PHP expressions
43
     *
44
     * @return bool
45
     */
46
    public function validate($value, &$outValue)
47
    {
48
        //No EDM void primitive type
49
        throw new NotImplementedException();
50
    }
51
52
    /**
53
     * Gets full name of this type in EDM namespace
54
     * Note: implementation of IType::getFullTypeName.
55
     *
56
     * @return string
57
     */
58
    public function getFullTypeName()
59
    {
60
        return 'System.Void';
61
    }
62
63
    /**
64
     * Converts the given string value to void type.
65
     *
66
     * @param string $stringValue value to convert
67
     *
68
     * @throws NotImplementedException
69
     */
70
    public function convert($stringValue)
71
    {
72
        throw new NotImplementedException();
73
    }
74
75
    /**
76
     * Convert the given value to a form that can be used in OData uri.
77
     *
78
     * @param string $value value to convert to OData
79
     *
80
     * @throws NotImplementedException
81
     */
82
    public function convertToOData($value)
83
    {
84
        throw new NotImplementedException();
85
    }
86
}
87