<commit_before><?php namespace Vinelab\NeoEloquent\Query\Grammars;

use Illuminate\Database\Query\Grammars\Grammar as IlluminateGrammar;

class Grammar extends IlluminateGrammar {

    /**
	 * Get the appropriate query parameter place-holder for a value.
	 *
	 * @param  mixed   $value
	 * @return string
	 */
	public function parameter($value)
	{
        // Validate whether the requested field is the
        // node id, in that case id(n) doesn't work as
        // a placeholder so we transform it to _nodeId instead
        $property = ($value['column'] == 'id(n)') ? '_nodeId' : $value['column'];

		return $this->isExpression($value) ? $this->getValue($value) : '{' . $property . '}';
	}

    /**
     * Prepare a label by formatting it as expected,
     * trim out trailing spaces and add backticks
     *
     * @var  string  $label
     * @return string
     */
    protected function prepareLabel($label)
    {
        // we do not accept any existing backticks so we remove them
        // and add them as they should be, around the label string
        return '`' . preg_replace('/`/', '', trim($label)) . '`';
    }

    /**
     * Wrap a value in keyword identifiers.<commit_msg>add the 'id' as a column to check in the Grammar when parameterizing<commit_after><?php namespace Vinelab\NeoEloquent\Query\Grammars;

use Illuminate\Database\Query\Grammars\Grammar as IlluminateGrammar;

class Grammar extends IlluminateGrammar {

    /**
	 * Get the appropriate query parameter place-holder for a value.
	 *
	 * @param  mixed   $value
	 * @return string
	 */
	public function parameter($value)
	{
        // Validate whether the requested field is the
        // node id, in that case id(n) doesn't work as
        // a placeholder so we transform it to _nodeId instead
        $property = ($value['column'] == 'id(n)' or $value['column'] == 'id') ? '_nodeId' : $value['column'];

		return $this->isExpression($property) ? $this->getValue($property) : '{' . $property . '}';
	}

    /**
     * Prepare a label by formatting it as expected,
     * trim out trailing spaces and add backticks
     *
     * @var  string  $label
     * @return string
     */
    protected function prepareLabel($label)
    {
        // we do not accept any existing backticks so we remove them
        // and add them as they should be, around the label string
        return '`' . preg_replace('/`/', '', trim($label)) . '`';
    }

    /**
     * Wrap a value in keyword identifiers.
{'fraction_non_alphanumeric': 0.12151796528058134, 'fraction_numerical': 0.0, 'mean_word_length': 2.671111111111111, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7144474', 'n_tokens_mistral': 735, 'n_tokens_neox': 724, 'n_words': 246}