Code Duplication    Length = 24-24 lines in 3 locations

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

@@ 441-464 (lines=24) @@
438
     *
439
     * @return integer $order_id
440
     */
441
    public function placeOrder($credentials, $shop_id, $values)
442
    {
443
        $this->checkCredentials($credentials);
444
445
        $this->_factoryWebshop($shop_id);
446
447
        $values = $this->processRequestData($values);
448
449
        if (!is_array($this->webshop->getBasket()->getItems()) or count($this->webshop->getBasket()->getItems()) <= 0) {
450
            require_once 'XML/RPC2/Exception.php';
451
            throw new XML_RPC2_FaultException('order could not be sent - cart is empty', -4);
452
        }
453
454
        if (empty($values['description'])) {
455
            $values['description'] = $this->webshop->getShop()->getName();
456
        }
457
458
        if (!$order_id = $this->webshop->placeOrder($values)) {
459
            require_once 'XML/RPC2/Exception.php';
460
            throw new XML_RPC2_FaultException('order could not be placed. It returned the following error: ' . strtolower(implode(', ', $this->webshop->error->getMessage())), -4);
461
        }
462
463
        return $this->prepareResponseData($this->webshop->getOrderIdentifierKey());
464
    }
465
466
    /**
467
     * Saves buyer details

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

@@ 697-720 (lines=24) @@
694
     *
695
     * @return integer $order_id
696
     */
697
    public function placeOrder($credentials, $shop_id, $values)
698
    {
699
        $this->checkCredentials($credentials);
700
701
        $this->_factoryWebshop($shop_id);
702
703
        $values = $this->processRequestData($values);
704
705
        if (!is_array($this->webshop->getBasket()->getItems()) or count($this->webshop->getBasket()->getItems()) <= 0) {
706
            require_once 'XML/RPC2/Exception.php';
707
            throw new XML_RPC2_FaultException('order could not be sent - cart is empty', -4);
708
        }
709
710
        if (empty($values['description'])) {
711
            $values['description'] = $this->webshop->getShop()->getName();
712
        }
713
714
        if (!$order_id = $this->webshop->placeOrder($values)) {
715
            require_once 'XML/RPC2/Exception.php';
716
            throw new XML_RPC2_FaultException('order could not be placed. It returned the following error: ' . strtolower(implode(', ', $this->webshop->error->getMessage())), -4);
717
        }
718
719
        return $this->prepareResponseData($this->webshop->getOrderIdentifierKey());
720
    }
721
722
    /**
723
     * Saves buyer details

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

@@ 860-883 (lines=24) @@
857
     *
858
     * @return integer $order_id
859
     */
860
    public function placeOrder($credentials, $shop_id, $values)
861
    {
862
        $this->checkCredentials($credentials);
863
864
        $this->_factoryWebshop($shop_id);
865
866
        $values = $this->processRequestData($values);
867
868
        if (!is_array($this->webshop->getBasket()->getItems()) or count($this->webshop->getBasket()->getItems()) <= 0) {
869
            require_once 'XML/RPC2/Exception.php';
870
            throw new XML_RPC2_FaultException('order could not be sent - cart is empty', -4);
871
        }
872
873
        if (empty($values['description'])) {
874
            $values['description'] = $this->webshop->getShop()->getName();
875
        }
876
877
        if (!$order_id = $this->webshop->placeOrder($values)) {
878
            require_once 'XML/RPC2/Exception.php';
879
            throw new XML_RPC2_FaultException('order could not be placed. It returned the following error: ' . strtolower(implode(', ', $this->webshop->error->getMessage())), -4);
880
        }
881
882
        return $this->prepareResponseData($this->webshop->getOrderIdentifierKey());
883
    }
884
885
    /**
886
     * Saves buyer details