<commit_before><?php

namespace AppBundle\Service;

use DateTime;
use Doctrine\ORM\EntityManager;
use Exception;
use Symfony\Component\Console\Output\OutputInterface;

class WeborderService {

    private $em;
    private $erp;
    private $auditService;
    private $erpOrderSelect = "order, customer, created_date, cu_po, ship_atn, name, state, postal_code, country_code, adr, stat";

    public function __construct(EntityManager $em, ErpOneConnectorService $erp) {
        $this->em = $em;
        $this->erp = $erp;
        $this->auditService = $auditService;
    }

    private function _getMultipleDbRecordsFromErp($response) {

        $orderNumbers = array();

        foreach ($response as $item) {
            $orderNumbers[] = $item->order;
        }

        $rep = $this->em->getRepository('AppBundle:Weborder');
        $weborders = $rep->findBy(array('orderNumber' => $orderNumbers));

        $knownOrderNumbers = array();

        foreach ($weborders as $weborder) {
            $knownOrderNumbers[] = $weborder->getOrderNumber();
        }

        $newOrderNumbers = array_diff($orderNumbers, $knownOrderNumbers);

        $weborders = array_reverse($weborders);<commit_msg>optimization<commit_after><?php

namespace AppBundle\Service;

use DateTime;
use Doctrine\ORM\EntityManager;
use Exception;
use Symfony\Component\Console\Output\OutputInterface;

class WeborderService {

    private $em;
    private $erp;
    private $erpOrderSelect = "order, customer, created_date, cu_po, ship_atn, name, state, postal_code, country_code, adr, stat";

    public function __construct(EntityManager $em, ErpOneConnectorService $erp) {
        $this->em = $em;
        $this->erp = $erp;
    }

    private function _getMultipleDbRecordsFromErp($response) {

        $orderNumbers = array();

        foreach ($response as $item) {
            $orderNumbers[] = $item->order;
        }

        $rep = $this->em->getRepository('AppBundle:Weborder');
        $weborders = $rep->findBy(array('orderNumber' => $orderNumbers));

        $knownOrderNumbers = array();

        foreach ($weborders as $weborder) {
            $knownOrderNumbers[] = $weborder->getOrderNumber();
        }

        $newOrderNumbers = array_diff($orderNumbers, $knownOrderNumbers);

        $weborders = array_reverse($weborders);
{'fraction_non_alphanumeric': 0.12602503236944324, 'fraction_numerical': 0.0, 'mean_word_length': 3.3165735567970205, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '2389104', 'n_tokens_mistral': 708, 'n_tokens_neox': 663, 'n_words': 141}