Passed
Push — devel ( 210a55...99da33 )
by Litera
07:36 queued 06:36
created

CategoryRepository::setCategoryModel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
rs 9.4285
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