CustomersRepository::createCustomer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Elimuswift\Core\Repositories;
4
5
use Elimuswift\Core\Customer;
6
7
/**
8
 * Update data repository.
9
 */
10
class CustomersRepository
11
{
12
    /**
13
     * Customer Model instance.
14
     *
15
     * @var mixed
16
     **/
17
    public $customer;
18
19
    /**
20
     * Create a new instance of the CustomerRepository::class.
21
     **/
22
    public function __construct(Customer $customer)
23
    {
24
        $this->customer = $customer;
25
    }
26
27
//end __construct()
28
29
    /**
30
     * Find a customer by a field.
31
     *
32
     * @return mixid $this
33
     **/
34
    public function findCustomer($key, $value)
35
    {
36
        return $this->customer->where($key, $value)->first();
37
    }
38
39
//end findCustomer()
40
41
    /**
42
     * Create Customer with the received response.
43
     *
44
     * @return Customer
45
     *
46
     * @param array $data
47
     **/
48
    public function createCustomer($data)
49
    {
50
        // TODO: Perform basic validation on the customer object before saving
51
        return $this->customer->create($data);
52
    }
53
54
//end createCustomer()
55
}//end class
56