<commit_before><?php

/*
* This file is part of the moss-storage package
*
* (c) <NAME> <<EMAIL>>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Moss\Storage\Query\Join;


use Moss\Storage\Model\ModelBag;
use Moss\Storage\Query\QueryException;

/**
 * Table join factory
 *
 * @author  <NAME> <<EMAIL>>
 * @package Moss\Storage
 */
class JoinFactory
{
    /** @var ModelBag */
    private $bag;

    /**
     * Constructor
     *
     * @param ModelBag $bag
     */
    public function __construct(ModelBag $bag)
    {
        $this->bag = & $bag;
    }

    /**
     * Creates join instance
     *
     * @param string $entity
     * @param string $type
     * @param string $join
     *
     * @return JoinInterface
     * @throws QueryException
     */
    public function create($entity, $type, $join)
    {
        $model = $this->bag->get($entity);

        if (!$model->hasRelation($join)) {
            throw new QueryException(sprintf('Unable to join "%s" in query "%s" undefined relation', $join, $model->entity()));
        }

        $relation = $model->relation($join);

        return new Join(
            $type,
            $relation,
            $this->bag->get($entity),
            $this->bag->get($join),
            in_array($relation->type(), array('oneTrough', 'manyTrough')) ? $this->bag->get($relation->mediator()) : null,
            $join
        );
    }
}<commit_msg>removed unnecessary argument<commit_after><?php

/*
* This file is part of the moss-storage package
*
* (c) <NAME> <<EMAIL>>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Moss\Storage\Query\Join;


use Moss\Storage\Model\ModelBag;
use Moss\Storage\Query\QueryException;

/**
 * Table join factory
 *
 * @author  <NAME> <<EMAIL>>
 * @package Moss\Storage
 */
class JoinFactory
{
    /** @var ModelBag */
    private $bag;

    /**
     * Constructor
     *
     * @param ModelBag $bag
     */
    public function __construct(ModelBag $bag)
    {
        $this->bag = & $bag;
    }

    /**
     * Creates join instance
     *
     * @param string $entity
     * @param string $type
     * @param string $join
     *
     * @return JoinInterface
     * @throws QueryException
     */
    public function create($entity, $type, $join)
    {
        $model = $this->bag->get($entity);

        if (!$model->hasRelation($join)) {
            throw new QueryException(sprintf('Unable to join "%s" in query "%s" undefined relation', $join, $model->entity()));
        }

        $relation = $model->relation($join);

        return new Join(
            $type,
            $relation,
            $this->bag->get($entity),
            $this->bag->get($join),
            in_array($relation->type(), array('oneTrough', 'manyTrough')) ? $this->bag->get($relation->mediator()) : null
        );
    }
}
{'fraction_non_alphanumeric': 0.15120967741935484, 'fraction_numerical': 0.0, 'mean_word_length': 2.300443458980044, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 43, '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': '6187283', 'n_tokens_mistral': 894, 'n_tokens_neox': 877, 'n_words': 229}