Code Duplication    Length = 14-14 lines in 2 locations

src/Mautic/Form.php 2 locations

@@ 100-113 (lines=14) @@
97
     *
98
     * @return string|null
99
     */
100
    public function getSessionIdFromHeader($headers)
101
    {
102
        if (!$headers) {
103
            return null;
104
        }
105
106
        preg_match("/mautic_session_id=(.+?);/", $headers, $matches);
107
108
        if (isset($matches[1])) {
109
            return $matches[1];
110
        }
111
112
        return null;
113
    }
114
115
    /**
116
     * Finds the Mautic Contact ID hash in the response header
@@ 123-136 (lines=14) @@
120
     *
121
     * @return int|null
122
     */
123
    public function getContactIdFromHeader($headers, $sessionId)
124
    {
125
        if (!$headers || !$sessionId) {
126
            return null;
127
        }
128
129
        preg_match("/$sessionId=(.+?);/", $headers, $matches);
130
131
        if (isset($matches[1])) {
132
            return (int) $matches[1];
133
        }
134
135
        return null;
136
    }
137
138
    /**
139
     * Prepares data for CURL request based on provided form data, $_COOKIE and $_SERVER