refactor(Doctrine): improve in DqlQueryGenerator::getPatternMatcher()

Reduce complexity and remove duplication