Orders::add()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace CdekSDK2\Actions;
6
7
use CdekSDK2\BaseTypes\Order;
8
use CdekSDK2\Http\ApiResponse;
9
10
/**
11
 * Class Orders
12
 * @package CdekSDK2\Actions
13
 */
14
class Orders extends ActionsWithDelete
15
{
16
    /**
17
     * URL для запросов к API
18
     * @var string
19
     */
20
    public const URL = '/orders';
21
22
    /**
23
     * Создание заказа
24
     * @param Order $order
25
     * @return ApiResponse
26
     * @throws \CdekSDK2\Exceptions\RequestException
27
     */
28
    public function add(Order $order): ApiResponse
29
    {
30
        $params = $this->serializer->toArray($order);
31
        return $this->preparedAdd($params);
32
    }
33
}
34