CommentRepository::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
1
<?php namespace jlourenco\comments\Repositories;
2
3
use Cartalyst\Support\Traits\RepositoryTrait;
4
5
class CommentRepository implements CommentRepositoryInterface
6
{
7
    use RepositoryTrait;
8
9
    /**
10
     * The comment model name.
11
     *
12
     * @var string
13
     */
14
    protected $model = 'jlourenco\comments\Models\Comment';
15
16
    /**
17
     * Create a new comment repository.
18
     *
19
     * @param  string  $model
20
     */
21
    public function __construct($model = null)
22
    {
23
        if (isset($model))
24
            $this->model = $model;
25
    }
26
27
    /**
28
     * {@inheritDoc}
29
     */
30
    public function findById($id)
31
    {
32
        return $this
33
            ->createModel()
34
            ->newQuery()
35
            ->find($id);
36
    }
37
38
}
39