<commit_before><?php
namespace Jackalope\Query;

use Jackalope\ObjectManager, Jackalope\NotImplementedException;

// inherit all doc
/**
 * @api
 */
class QueryManager implements \PHPCR\Query\QueryManagerInterface
{
    /**
     * The factory to instantiate objects
     * @var \Jackalope\Factory
     */
    protected $factory;

    /**
     * @var \Jackalope\ObjectManager
     */
    protected $objectManager;

    /**
     * Create the query manager - akquire through the session.
     *
     * @param object $factory an object factory implementing "get" as
     *      described in \Jackalope\Factory
     * @param ObjectManager $objectManager
     */
    public function __construct($factory, ObjectManager $objectManager)
    {
        $this->factory = $factory;
        $this->objectManager = $objectManager;
    }

    // inherit all doc
    /**
     * @api
     */
    public function createQuery($statement, $language)
    {
        switch($language) {
            case \PHPCR\Query\QueryInterface::JCR_SQL2:
                return $this->factory->get('Query\SqlQuery', array($statement, $this->objectManager));
            case \PHPCR\Query\QueryInterface::JCR_JQOM:
                throw new NotImplementedException();
            default:
                throw new \PHPCR\Query\InvalidQueryException("No such query language: $language");
        }
    }

    // inherit all doc
    /**
     * @api
     */
    public function getQOMFactory()
    {
        return $this->factory->get('Query\QOM\QueryObjectModelFactory', array($this->objectManager));
    }<commit_msg>throwing a better exception in the QueryManager if you try to build a QOM query from a string<commit_after><?php
namespace Jackalope\Query;

use Jackalope\ObjectManager, Jackalope\NotImplementedException;

// inherit all doc
/**
 * @api
 */
class QueryManager implements \PHPCR\Query\QueryManagerInterface
{
    /**
     * The factory to instantiate objects
     * @var \Jackalope\Factory
     */
    protected $factory;

    /**
     * @var \Jackalope\ObjectManager
     */
    protected $objectManager;

    /**
     * Create the query manager - akquire through the session.
     *
     * @param object $factory an object factory implementing "get" as
     *      described in \Jackalope\Factory
     * @param ObjectManager $objectManager
     */
    public function __construct($factory, ObjectManager $objectManager)
    {
        $this->factory = $factory;
        $this->objectManager = $objectManager;
    }

    // inherit all doc
    /**
     * @api
     */
    public function createQuery($statement, $language)
    {
        switch($language) {
            case \PHPCR\Query\QueryInterface::JCR_SQL2:
                return $this->factory->get('Query\SqlQuery', array($statement, $this->objectManager));
            case \PHPCR\Query\QueryInterface::JCR_JQOM:
                throw new \PHPCR\Query\InvalidQueryException('Please use getQOMFactory to get the query object model factory. You can not build a QOM query from a string.');
            default:
                throw new \PHPCR\Query\InvalidQueryException("No such query language: $language");
        }
    }

    // inherit all doc
    /**
     * @api
     */
    public function getQOMFactory()
    {
        return $this->factory->get('Query\QOM\QueryObjectModelFactory', array($this->objectManager));
    }
{'fraction_non_alphanumeric': 0.11091287540886113, 'fraction_numerical': 0.0005947071067499256, 'mean_word_length': 2.425661914460285, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '3612856', 'n_tokens_mistral': 933, 'n_tokens_neox': 909, 'n_words': 230}