protected function getControlStructureRegEx(string $structure, array $additionalComponents): string
    {
        $structureRegex = "(end)?$structure";

        if ($additionalComponents) {
            $structureRegex = "($structureRegex|" . join('|', $additionalComponents) . ')';
        }

        return $structureRegex;
    }
protected function getControlStructureRegEx(string $structure, array $additionalComponents): string
    {
        $structureRegex = "(end)?$structure";

        if ($additionalComponents) {
            $structureRegex = "($structureRegex|" . join('|', $additionalComponents) . ')';
        }

        return $structureRegex;
    }
protected function getControlStructureRegEx ( string $ structure , array $ additionalComponents ) : string { $ structureRegex = "(end)?$structure" ; if ( $ additionalComponents ) { $ structureRegex = "($structureRegex|" . join ( '|' , $ additionalComponents ) . ')' ; } return $ structureRegex ; }
Get the regular expression for finding control structures

@param string $structure            The control structure (eg. 'foreach', 'if')
@param array  $additionalComponents [optional] Holds additional components for the structure (eg. 'else')

@return string
Get the regular expression for finding control structures