Repository::find()   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 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 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of the HRis Software package.
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * Licensed under the 3-clause BSD License.
9
 *
10
 * This source file is subject to the 3-clause BSD License that is
11
 * bundled with this package in the LICENSE file.
12
 *
13
 * @version    alpha
14
 *
15
 * @author     Bertrand Kintanar <[email protected]>
16
 * @license    BSD License (3-clause)
17
 * @copyright  (c) 2014-2016, b8 Studios, Ltd
18
 *
19
 * @link       http://github.com/HB-Co/HRis
20
 */
21
22
namespace HRis\Api\Repositories;
23
24
class Repository implements RepositoryInterface
25
{
26
    /**
27
     * Eloquent model.
28
     *
29
     * @var \Illuminate\Database\Eloquent\Model
30
     */
31
    protected $model;
32
33
    /**
34
     * Repository constructor.
35
     *
36
     * @param \Illuminate\Database\Eloquent\Model $model
37
     *
38
     * @author Harlequin Doyon
39
     */
40 6
    public function __construct($model)
41
    {
42 6
        $this->model = $model;
43 6
    }
44
45
    /**
46
     * Get all records.
47
     *
48
     * @return \Illuminate\Database\Eloquent\Collection|static[]
49
     *
50
     * @author Harlequin Doyon
51
     */
52
    public function all()
53
    {
54
        return $this->model->all();
55
    }
56
57
    /**
58
     * Find a certain record.
59
     *
60
     * @param int $id
61
     *
62
     * @return \Illuminate\Database\Eloquent\Model
63
     *
64
     * @author Harlequin Doyon
65
     */
66
    public function find($id)
67
    {
68
        return $this->model->findOrFail($id);
69
    }
70
}
71