<commit_before><?php

namespace Dotdigitalgroup\Email\Block;

class Basket extends \Magento\Catalog\Block\Product\AbstractProduct
{

    /**
     * @var \Dotdigitalgroup\Email\Helper\Data
     */
    public $helper;
    /**
     * @var \Magento\Framework\Pricing\Helper\Data
     */
    public $priceHelper;
    /**
     * @var
     */
    protected $_quote;
    /**
     * @var \Magento\Quote\Model\QuoteFactory
     */
    protected $_quoteFactory;
    /**
     * @var \Magento\Store\Model\App\EmulationFactory
     */
    protected $_emulationFactory;

    /**
     * Basket constructor.
     *
     * @param \Magento\Store\Model\App\EmulationFactory $emulationFactory
     * @param \Magento\Quote\Model\QuoteFactory         $quoteFactory
     * @param \Magento\Catalog\Block\Product\Context    $context
     * @param \Dotdigitalgroup\Email\Helper\Data        $helper
     * @param \Magento\Framework\Pricing\Helper\Data    $priceHelper
     * @param array                                     $data
     */
    public function __construct(
        \Magento\Store\Model\App\EmulationFactory $emulationFactory,
        \Magento\Quote\Model\QuoteFactory $quoteFactory,
        \Magento\Catalog\Block\Product\Context $context,
        \Dotdigitalgroup\Email\Helper\Data $helper,
        \Magento\Framework\Pricing\Helper\Data $priceHelper,
        array $data = []
    ) {
        $this->_quoteFactory = $quoteFactory;
        $this->helper = $helper;
        $this->priceHelper = $priceHelper;
        $this->_emulationFactory = $emulationFactory;

        parent::__construct($context, $data);
    }

    /**
     * Basket items.
     *
     * @return mixed
     */
    public function getBasketItems()
    {
        $params = $this->getRequest()->getParams();

        if (!isset($params['quote_id']) || !isset($params['code'])) {
            $this->helper->log('Basket no quote id or code is set');

            return false;
        }
        $quoteId = $params['quote_id'];
        $quoteModel = $this->_quoteFactory->create()
            ->load($quoteId);

        //check for any quote for this email, don't want to render further
        if (!$quoteModel->getId()) {
            $this->helper->log('no quote found for '.$quoteId);

            return false;
        }
        if (!$quoteModel->getIsActive()) {
            $this->helper->log('Cart is not active : '.$quoteId);

            return false;
        }

        $this->_quote = $quoteModel;

        //Start environment emulation of the specified store
        $storeId = $quoteModel->getStoreId();

        $appEmulation = $this->_emulationFactory->create();
        $appEmulation->startEnvironmentEmulation($storeId);

        $quoteItems = $quoteModel->getAllItems();

        $itemsData = [];

        foreach ($quoteItems as $quoteItem) {
            //skip configurable products
            if ($quoteItem->getParentItemId() != null) {<commit_msg>Load quote data without store set #53<commit_after><?php

namespace Dotdigitalgroup\Email\Block;

class Basket extends \Magento\Catalog\Block\Product\AbstractProduct
{

    /**
     * @var \Dotdigitalgroup\Email\Helper\Data
     */
    public $helper;
    /**
     * @var \Magento\Framework\Pricing\Helper\Data
     */
    public $priceHelper;
    /**
     * @var
     */
    protected $_quote;
    /**
     * @var \Magento\Quote\Model\QuoteFactory
     */
    protected $_quoteFactory;
    /**
     * @var \Magento\Store\Model\App\EmulationFactory
     */
    protected $_emulationFactory;

    /**
     * Basket constructor.
     *
     * @param \Magento\Store\Model\App\EmulationFactory $emulationFactory
     * @param \Magento\Quote\Model\QuoteFactory         $quoteFactory
     * @param \Magento\Catalog\Block\Product\Context    $context
     * @param \Dotdigitalgroup\Email\Helper\Data        $helper
     * @param \Magento\Framework\Pricing\Helper\Data    $priceHelper
     * @param array                                     $data
     */
    public function __construct(
        \Magento\Store\Model\App\EmulationFactory $emulationFactory,
        \Magento\Quote\Model\QuoteFactory $quoteFactory,
        \Magento\Catalog\Block\Product\Context $context,
        \Dotdigitalgroup\Email\Helper\Data $helper,
        \Magento\Framework\Pricing\Helper\Data $priceHelper,
        array $data = []
    ) {
        $this->_quoteFactory = $quoteFactory;
        $this->helper = $helper;
        $this->priceHelper = $priceHelper;
        $this->_emulationFactory = $emulationFactory;

        parent::__construct($context, $data);
    }

    /**
     * Basket items.
     *
     * @return mixed
     */
    public function getBasketItems()
    {
        $params = $this->getRequest()->getParams();

        if (!isset($params['quote_id']) || !isset($params['code'])) {
            $this->helper->log('Basket no quote id or code is set');

            return false;
        }
        $quoteId = $params['quote_id'];
        $quoteModel = $this->_quoteFactory->create()
            ->loadByIdWithoutStore($quoteId);

        //check for any quote for this email, don't want to render further
        if (!$quoteModel->getId()) {
            $this->helper->log('no quote found for '.$quoteId);

            return false;
        }
        if (!$quoteModel->getIsActive()) {
            $this->helper->log('Cart is not active : '.$quoteId);

            return false;
        }

        $this->_quote = $quoteModel;

        //Start environment emulation of the specified store
        $storeId = $quoteModel->getStoreId();

        $appEmulation = $this->_emulationFactory->create();
        $appEmulation->startEnvironmentEmulation($storeId);

        $quoteItems = $quoteModel->getAllItems();

        $itemsData = [];

        foreach ($quoteItems as $quoteItem) {
            //skip configurable products
            if ($quoteItem->getParentItemId() != null) {
{'fraction_non_alphanumeric': 0.1340924541128484, 'fraction_numerical': 0.0003399048266485384, 'mean_word_length': 2.1487426431246655, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6091401', 'n_tokens_mistral': 1690, 'n_tokens_neox': 1676, 'n_words': 316}