protected function selectQuerySource(&$query)
    {
        foreach ($query['trace'] as $i => &$trace) {
            $isSource = true;
            foreach ($this->getNamespacesCutoff() as $namespace) {
                $namespace = trim($namespace, '/\\').'\\';
                if (isset($trace['class']) && strpos($trace['class'], $namespace) !== false) {
                    $isSource = false;
                }
            }
            if ($isSource) {
                $query['trace'][$i - 1]['query_source'] = true;
                break;
            }
        }
    }