CommentRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 34
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A findById() 0 7 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