Code Duplication    Length = 9-18 lines in 2 locations

src/POData/Providers/Metadata/Type/Guid.php 1 location

@@ 89-97 (lines=9) @@
86
     * 
87
     * @return string
88
     */
89
    public function convert($stringValue)
90
    {
91
        $len = strlen($stringValue);
92
        if ($len < 2) {
93
            return $stringValue;
94
        }
95
96
        return substr($stringValue, 1, $len - 2);
97
    }
98
99
    /**
100
     * Convert the given value to a form that can be used in OData uri. 

src/POData/Providers/Metadata/Type/StringType.php 1 location

@@ 73-90 (lines=18) @@
70
     * 
71
     * @return string
72
     */
73
    public function convert($stringValue)
74
    {
75
        //Consider the odata url option 
76
        //$filter=ShipName eq 'Antonio%20Moreno%20Taquer%C3%ADa'
77
        //WebOperationContext will do urldecode, so the clause become
78
        //$filter=ShipName eq 'Antonio Moreno Taquería', the lexer will
79
        //give the token as
80
        //Token {Text string(25):'Antonio Moreno Taquería', Id: String}, 
81
        //this function is used to remove the pre-post quotes from Token::Text 
82
        //i.e. 'Antonio Moreno Taquería'
83
        //to Antonio Moreno Taquería
84
        $len = strlen($stringValue);
85
        if ($len < 2) {
86
            return $stringValue;
87
        }
88
89
        return substr($stringValue, 1, $len - 2);
90
    }
91
92
    /**
93
     * Convert the given value to a form that can be used in OData uri.