protected function extractData($text, $template)
    {
        //Extract the text based on the provided template using REGEX
        preg_match('/' . $template . '/s', $text, $matches);

        //Extract only the named parameters from the matched regex array
        $keys = array_filter(array_keys($matches), 'is_string');
        $matches = array_intersect_key($matches, array_flip($keys));

        if (!empty($matches)) {
            return $this->cleanExtractedData($matches);
        }

        return false;
    }
protected function extractData($text, $template)
    {
        
        preg_match('/' . $template . '/s', $text, $matches);

        
        $keys = array_filter(array_keys($matches), 'is_string');
        $matches = array_intersect_key($matches, array_flip($keys));

        if (!empty($matches)) {
            return $this->cleanExtractedData($matches);
        }

        return false;
    }
protected function extractData ( $ text , $ template ) { //Extract the text based on the provided template using REGEX preg_match ( '/' . $ template . '/s' , $ text , $ matches ) ; //Extract only the named parameters from the matched regex array $ keys = array_filter ( array_keys ( $ matches ) , 'is_string' ) ; $ matches = array_intersect_key ( $ matches , array_flip ( $ keys ) ) ; if ( ! empty ( $ matches ) ) { return $ this -> cleanExtractedData ( $ matches ) ; } return false ; }
Extracts the named variables values from within the text based on the provided template

@param string $text ; The prepared text provided by the user for parsing
@param string $template ; The template regex pattern from the matched template
@return array|bool; The matched data array or false on unmatched text
Extracts the named variables values from within the text based on the provided template