public function resolveClauses(array &$parameters)
    {
        $parameters = array_merge($parameters, $this->parameters);

        $filter = function($clause) use ($parameters) {
            $is_exist = true;
            
            if (preg_match_all('/@(?P<type>.):(?P<name>.+?)@/', $clause, $match) > 0) {
                foreach ($match['name'] as $name) {
                    if (!($is_exist = isset($parameters[$name]))) {
                        // all fields must be available
                        break;
                    }
                }
            }

            return $is_exist;
        };

        $clauses = [
            true => array_filter($this->clauses[true], $filter),
            false => array_filter($this->clauses[false], $filter)
        ];

        if (count($clauses[true]) > 0) {
            $snippet = $this->prefix . implode(
                $this->joiner,
                array_merge(
                    $clauses[false],
                    [
                        ' ( ' . implode(' OR ', $clauses[true]) . ' ) '
                    ]
                )
            ) . $this->postfix;
        } elseif (count($clauses[false]) > 0) {
            $snippet = $this->prefix . implode($this->joiner, $clauses[false]) . $this->postfix;
        } else {
            $snippet = '';
        }

        return $snippet;
    }