Completed
Push — master ( 118c60...254398 )
by Litera
03:47
created

CategoryRepository   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 44
c 0
b 0
f 0
rs 10
wmc 4
lcom 1
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A findAll() 0 4 1
A getCategoryModel() 0 4 1
A setCategoryModel() 0 6 1
1
<?php
2
3
namespace App\Repositories;
4
5
use App\Models\CategoryModel;
6
7
class CategoryRepository
8
{
9
10
	/**
11
	 * @var CategoryModel
12
	 */
13
	protected $categoryModel;
14
15
	/**
16
	 * @param CategoryModel $categoryModel
17
	 */
18
	public function __construct(CategoryModel $categoryModel)
19
	{
20
		$this->setCategoryModel($categoryModel);
21
	}
22
23
	/**
24
	 * @return array
25
	 */
26
	public function findAll(): array
27
	{
28
		return $this->getCategoryModel()->all();
29
	}
30
31
	/**
32
	 * @return CategoryModel
33
	 */
34
	protected function getCategoryModel(): CategoryModel
35
	{
36
		return $this->categoryModel;
37
	}
38
39
	/**
40
	 * @param  CategoryModel $model
41
	 * @return $this
42
	 */
43
	protected function setCategoryModel(CategoryModel $model): self
44
	{
45
		$this->categoryModel = $model;
46
47
		return $this;
48
	}
49
50
}
51