Completed
Push — master ( 8a3fde...3a0813 )
by Taosikai
14s queued 11s
created

CustomerManager::sendInvite()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the slince/shopify-api-php
5
 *
6
 * (c) Slince <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Slince\Shopify\Manager\Customer;
13
14
use Slince\Shopify\Common\Manager\GeneralCurdable;
15
16
class CustomerManager extends GeneralCurdable implements CustomerManagerInterface
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public static function getServiceName()
22
    {
23
        return 'customers';
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function getResourceName()
30
    {
31
        return 'customer';
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function getModelClass()
38
    {
39
        return Customer::class;
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function createAccountActivationUrl($id)
46
    {
47
        $data = $this->client->post('customers/'.$id.'/account_activation_url', []);
48
49
        return $data['account_activation_url'];
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function sendInvite($id, array $data)
56
    {
57
        $data = $this->client->post('customers/'.$id.'/send_invite', [
58
            'customer_invite' => $data,
59
        ]);
60
61
        return $this->fromArray($data, CustomerInvite::class);
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67
    public function search(array $query = [])
68
    {
69
        $data = $this->client->get('customers/search', $query);
70
71
        return $this->createMany(reset($data));
72
    }
73
74
    /**
75
     * {@inheritdoc}
76
     */
77
    public function orders($id)
78
    {
79
        $data = $this->client->get('customers/'.$id.'/orders');
80
81
        return $this->createMany(reset($data));
82
    }
83
}