<commit_before><?php namespace Fastwebmedia\LaravelVouchering\Factories;

use Fastwebmedia\LaravelVouchering\models\Campaign;
use Fastwebmedia\LaravelVouchering\Repositories\CampaignRepository;

class CampaignFactory
{
    /**
     * @var Campaign
     */
    protected $model;

    /**
     * @var CampaignRepository
     */
    protected $repo;

    /**
     * Constructs models.
     *
     * @param Campaign $model
     * @param CampaignRepository @campaignRepository
     */
    public function __construct(Campaign $model, CampaignRepository $campaignRepository)
    {
        $this->model = $model;
        $this->repo = $campaignRepository;
    }

    /**
     * createCampaign function.
     *
     * @access public
     *
     * @param array $data
     *
     * @return Campaign
     */
    public function createCampaign($data)
    {
        $urn = $data['urn'];

        // Check campaign already exists
        if (! $this->repo->loadCampaign($urn) && $urn != '') {
            $campaign = $this->model->create($data);

            return $campaign;
        }

        return false;
    }

    /**
     * destroyCampaign function.
     *
     * @access public
     *
     * @param string $urn
     *
     * @return Campaign
     */
    public function destroyCampaign($urn)
    {
        if ($campaign = $this->model->where('urn', '=', $urn)->first()) {
            if ($campaign->delete()) {
                return $campaign;
            }
        }

        return false;
    }
}
<commit_msg>Updated namespace of campaign model<commit_after><?php namespace Fastwebmedia\LaravelVouchering\Factories;

use Fastwebmedia\LaravelVouchering\Models\Campaign;
use Fastwebmedia\LaravelVouchering\Repositories\CampaignRepository;

class CampaignFactory
{
    /**
     * @var Campaign
     */
    protected $model;

    /**
     * @var CampaignRepository
     */
    protected $repo;

    /**
     * Constructs models.
     *
     * @param Campaign $model
     * @param CampaignRepository @campaignRepository
     */
    public function __construct(Campaign $model, CampaignRepository $campaignRepository)
    {
        $this->model = $model;
        $this->repo = $campaignRepository;
    }

    /**
     * createCampaign function.
     *
     * @access public
     *
     * @param array $data
     *
     * @return Campaign
     */
    public function createCampaign($data)
    {
        $urn = $data['urn'];

        // Check campaign already exists
        if (! $this->repo->loadCampaign($urn) && $urn != '') {
            $campaign = $this->model->create($data);

            return $campaign;
        }

        return false;
    }

    /**
     * destroyCampaign function.
     *
     * @access public
     *
     * @param string $urn
     *
     * @return Campaign
     */
    public function destroyCampaign($urn)
    {
        if ($campaign = $this->model->where('urn', '=', $urn)->first()) {
            if ($campaign->delete()) {
                return $campaign;
            }
        }

        return false;
    }
}

{'fraction_non_alphanumeric': 0.12779973649538867, 'fraction_numerical': 0.0, 'mean_word_length': 1.9342995169082127, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '4207977', 'n_tokens_mistral': 887, 'n_tokens_neox': 854, 'n_words': 172}