Completed
Push — master ( fb0370...84a128 )
by Ronaldo
03:03
created

CreateOrderService::createOrderBuilder()   A

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 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace WSW\SiftScience\Services;
4
5
use WSW\SiftScience\Events\CreateOrder;
6
use WSW\SiftScience\Transformers\CreateOrderTransformer;
7
8
/**
9
 * Class CreateOrderService
10
 *
11
 * @package WSW\SiftScience\Services
12
 * @author Ronaldo Matos Rodrigues <[email protected]>
13
 */
14
class CreateOrderService extends BaseService
15
{
16
    /**
17
     * @return CreateOrder
18
     */
19
    public function createOrderBuilder()
20
    {
21
        return new CreateOrder();
22
    }
23
24
    /**
25
     * @param CreateOrder $createOrder
26
     *
27
     * @return bool
28
     */
29
    public function send(CreateOrder $createOrder)
30
    {
31
        $createOrder->setApiKey($this->credentials->getApiKey());
32
        $body = $this->item($createOrder, new CreateOrderTransformer)->toJson();
33
        $this->post(static::ENDPOINT, $body);
34
35
        return true;
36
    }
37
}
38