Code Duplication    Length = 14-14 lines in 2 locations

src/FirstClass.php 2 locations

@@ 27-40 (lines=14) @@
24
     * @return string
25
     * @throws \Exception
26
     */
27
    public function encodeString($string)
28
    {
29
        $string=strtolower($string);
30
        $src="abcdefghijklmnopqrstuvwxyz0123456789 ";
31
        $dst="jklmnopqrstuvwxyz0123456789abcdefghi ";
32
        for ($i=0; $i<strlen($string); $i++) {
33
            $pos=strpos($src, $string[$i]);
34
            if ($pos===false) {
35
                throw new \Exception("Please provide only numbers and alphanumerical characters");
36
            }
37
            $string[$i]=$dst[$pos];
38
        }
39
        return $string;
40
    }
41
42
    /**
43
     * Decodes a string by a simple shift of characters
@@ 49-62 (lines=14) @@
46
     * @return string
47
     * @throws \Exception
48
     */
49
    public function decodeString($string)
50
    {
51
        $string=strtolower($string);
52
        $src="jklmnopqrstuvwxyz0123456789abcdefghi ";
53
        $dst="abcdefghijklmnopqrstuvwxyz0123456789 ";
54
        for ($i=0; $i<strlen($string); $i++) {
55
            $pos=strpos($src, $string[$i]);
56
            if ($pos===false) {
57
                throw new \Exception("Please provide only numbers and alphanumerical characters");
58
            }
59
            $string[$i]=$dst[$pos];
60
        }
61
        return $string;
62
    }
63
}
64