DmitryDulepov\Realurl\Encoder\UrlEncoder::handleFileNameUsingGetVars PHP Method

handleFileNameUsingGetVars() protected method

Checks if the file name like 'rss.xml' should be produced according to _GET vars.
protected handleFileNameUsingGetVars ( ) : boolean
return boolean
    protected function handleFileNameUsingGetVars()
    {
        $result = FALSE;
        $fileNameConfigurations = (array) $this->configuration->get('fileName/index');
        foreach ($fileNameConfigurations as $fileName => $fileNameConfiguration) {
            if (strpos($fileName, '.') !== FALSE && is_array($fileNameConfiguration) && is_array($fileNameConfiguration['keyValues'])) {
                $useThisConfiguration = TRUE;
                $variablesToRemove = array();
                foreach ($fileNameConfiguration['keyValues'] as $getVarName => $getVarValue) {
                    if (!isset($this->urlParameters[$getVarName]) || (string) $this->urlParameters[$getVarName] !== (string) $getVarValue) {
                        $useThisConfiguration = FALSE;
                        break;
                    }
                    $variablesToRemove[$getVarName] = '';
                }
                if ($useThisConfiguration) {
                    if ($fileName[0] === '.') {
                        if ($this->encodedUrl === '') {
                            $this->encodedUrl = 'index';
                        } else {
                            $this->encodedUrl = rtrim($this->encodedUrl, '/');
                        }
                    }
                    $this->encodedUrl .= $fileName;
                    $this->urlParameters = array_diff_key($this->urlParameters, $variablesToRemove);
                    $result = TRUE;
                    break;
                }
            }
        }
        return $result;
    }