Code Duplication    Length = 46-49 lines in 2 locations

app/components/CategoryStylesControl.php 1 location

@@ 7-52 (lines=46) @@
4
5
use App\Services\CategoryService;
6
7
class CategoryStylesControl extends BaseControl
8
{
9
10
	const TEMPLATE_NAME = 'CategoryStyles';
11
12
	/**
13
	 * @var CategoryService
14
	 */
15
	private $categoryService;
16
17
	/**
18
	 * @param CategoryService $service
19
	 */
20
	public function __construct(CategoryService $service)
21
	{
22
		$this->setCategoryService($service);
23
	}
24
25
	public function render()
26
	{
27
		$template = $this->getTemplate();
28
		$template->setFile($this->buildTemplatePath());
29
		$template->categories = $this->getCategoryService()->all();
30
		$template->render();
31
	}
32
33
	/**
34
	 * @return CategoryService
35
	 */
36
	protected function getCategoryService()
37
	{
38
		return $this->categoryService;
39
	}
40
41
	/**
42
	 * @param  CategoryService $service
43
	 * @return self
44
	 */
45
	protected function setCategoryService(CategoryService $service): self
46
	{
47
		$this->categoryService = $service;
48
49
		return $this;
50
	}
51
52
}
53

app/components/PublicBlockDetailControl.php 1 location

@@ 7-55 (lines=49) @@
4
5
use App\Models\BlockModel;
6
7
class PublicBlockDetailControl extends BaseControl
8
{
9
10
	const TEMPLATE_NAME = 'PublicBlockDetail';
11
12
	/**
13
	 * @var BlockModel
14
	 */
15
	private $blockModel;
16
17
	/**
18
	 * @param BlockModel $model
19
	 */
20
	public function __construct(BlockModel $model)
21
	{
22
		$this->setBlockModel($model);
23
	}
24
25
	/**
26
	 * @return void
27
	 */
28
	public function render($blockId)
29
	{
30
		$template = $this->getTemplate();
31
		$template->setFile($this->buildTemplatePath());
32
		$template->block = $this->getBlockModel()->find($blockId);
33
		$template->render();
34
	}
35
36
	/**
37
	 * @return BlockModel
38
	 */
39
	protected function getBlockModel(): BlockModel
40
	{
41
		return $this->blockModel;
42
	}
43
44
	/**
45
	 * @param BlockModel $model
46
	 * @return self
47
	 */
48
	protected function setBlockModel(BlockModel $model): self
49
	{
50
		$this->blockModel = $model;
51
52
		return $this;
53
	}
54
55
}
56