CronMasterConfigDto::importFromInit()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 16
nc 1
nop 6
1
<?php
2
3
namespace Ridibooks\Platform\Common\Cron\Dto;
4
5
use Ridibooks\Platform\Common\Cron\Interfaced\HealthCheckPingServiceInterface;
6
use Ridibooks\Platform\Common\Cron\Interfaced\PlatformCronHistoryModelInterface;
7
8
class CronMasterConfigDto
9
{
10
	/** @var PlatformCronHistoryModelInterface */
11
	public $cron_history_model;
12
	/** @var HealthCheckPingServiceInterface */
13
	public $health_check_ping_service;
14
	/** @var string */
15
	public $file_lock_prefix;
16
	/** @var string */
17
	public $project_name;
18
	/** @var array */
19
	public $working_classes;
20
	/** @var bool */
21
	public $is_under_dev = true;
22
23
	/**
24
	 * CronMaster constructor.
25
	 *
26
	 * @param PlatformCronHistoryModelInterface $cron_history_model
27
	 * @param HealthCheckPingServiceInterface   $health_check_ping_service
28
	 * @param string                            $file_lock_prefix
29
	 * @param string                            $project_name
30
	 * @param array                             $working_classes
31
	 * @param bool                              $is_under_dev
32
	 *
33
	 * @return CronMasterConfigDto
34
	 */
35
	public static function importFromInit(
36
		PlatformCronHistoryModelInterface $cron_history_model,
37
		HealthCheckPingServiceInterface $health_check_ping_service,
38
		string $file_lock_prefix,
39
		string $project_name,
40
		array $working_classes,
41
		bool $is_under_dev
42
	): self {
43
44
		$dto = new self;
45
46
		$dto->cron_history_model = $cron_history_model;
47
		$dto->health_check_ping_service = $health_check_ping_service;
48
		$dto->file_lock_prefix = $file_lock_prefix;
49
		$dto->project_name = $project_name;
50
		$dto->working_classes = $working_classes;
51
		$dto->is_under_dev = $is_under_dev;
52
53
		return $dto;
54
	}
55
}
56