Code Duplication    Length = 30-31 lines in 2 locations

src/Intraface/XMLRPC/Shop/Server0004.php 1 location

@@ 656-686 (lines=31) @@
653
     *
654
     * @return array
655
     */
656
    public function getBasket($credentials, $shop_id, $customer = array())
657
    {
658
        $this->checkCredentials($credentials);
659
660
        $this->_factoryWebshop($shop_id);
661
662
        $customer = $this->processRequestData($customer);
663
664
665
        // we put the possibility for BasketEvaluation not to be run.
666
        if (is_string($customer) && $customer == 'no_evaluation') {
667
            // nothing happens
668
        } elseif (is_array($customer)) {
669
            $basketevaluation = new Intraface_modules_shop_BasketEvaluation(MDB2::singleton(DB_DSN), $this->webshop->kernel->intranet, $this->webshop->shop);
670
            if (!$basketevaluation->run($this->webshop->getBasket(), $customer)) {
671
                // We should see to return the result in some way.
672
            }
673
        }
674
675
        if (false !== ($currency_gateway = $this->getCurrencyGateway())) {
676
            $currencies = $currency_gateway->findAllWithExchangeRate();
677
        } else {
678
            $currencies = false;
679
        }
680
681
        return $this->prepareResponseData(array(
682
            'items' => $this->webshop->getBasket()->getItems($currencies),
683
            'total_price' => $this->webshop->getBasket()->getTotalPriceInCurrencies($currencies),
684
            'weight' => $this->webshop->getBasket()->getTotalWeight()
685
        ));
686
    }
687
688
    /**
689
     * Places an order in Intraface based on the current basket

src/Intraface/XMLRPC/Shop/Server0100.php 1 location

@@ 820-849 (lines=30) @@
817
     *
818
     * @return array
819
     */
820
    public function getBasket($credentials, $shop_id, $customer = array())
821
    {
822
        $this->checkCredentials($credentials);
823
824
        $this->_factoryWebshop($shop_id);
825
826
        $customer = $this->processRequestData($customer);
827
828
        // we put the possibility for BasketEvaluation not to be run.
829
        if (is_string($customer) && $customer == 'no_evaluation') {
830
            // nothing happens
831
        } elseif (is_array($customer)) {
832
            $basketevaluation = new Intraface_modules_shop_BasketEvaluation(MDB2::singleton(DB_DSN), $this->webshop->kernel->intranet, $this->webshop->shop);
833
            if (!$basketevaluation->run($this->webshop->getBasket(), $customer)) {
834
                // We should see to return the result in some way.
835
            }
836
        }
837
838
        if (false !== ($currency_gateway = $this->getCurrencyGateway())) {
839
            $currencies = $currency_gateway->findAllWithExchangeRate();
840
        } else {
841
            $currencies = false;
842
        }
843
844
        return $this->prepareResponseData(array(
845
            'items' => $this->webshop->getBasket()->getItems($currencies),
846
            'total_price' => $this->webshop->getBasket()->getTotalPriceInCurrencies($currencies),
847
            'weight' => $this->webshop->getBasket()->getTotalWeight()
848
        ));
849
    }
850
851
    /**
852
     * Places an order in Intraface based on the current basket