1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @package: chapi |
4
|
|
|
* |
5
|
|
|
* @author: bthapaliya |
6
|
|
|
* @since: 2017-02-14 |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
namespace Chapi\Service\JobRepository; |
11
|
|
|
|
12
|
|
|
|
13
|
|
|
use Chapi\Component\Cache\CacheInterface; |
14
|
|
|
use Chapi\Component\RemoteClients\ApiClientInterface; |
15
|
|
|
use Chapi\Entity\Chronos\ChronosJobEntity; |
16
|
|
|
use Chapi\Entity\Marathon\MarathonAppEntity; |
17
|
|
|
use Chapi\Service\JobValidator\JobValidatorServiceInterface; |
18
|
|
|
use Psr\Log\LoggerInterface; |
19
|
|
|
use Symfony\Component\Filesystem\Filesystem; |
20
|
|
|
|
21
|
|
|
class BridgeFactory |
|
|
|
|
22
|
|
|
{ |
23
|
|
View Code Duplication |
public static function getChronosBridge( |
|
|
|
|
24
|
|
|
ApiClientInterface $oApiClient, |
25
|
|
|
CacheInterface $oCache, |
26
|
|
|
JobValidatorServiceInterface $oJobEntityValidatorService, |
27
|
|
|
LoggerInterface $oLogger |
28
|
|
|
) { |
29
|
|
|
if ($oApiClient->ping()) { |
30
|
|
|
return new BridgeChronos( |
31
|
|
|
$oApiClient, |
32
|
|
|
$oCache, |
33
|
|
|
$oJobEntityValidatorService, |
34
|
|
|
$oLogger); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
return new DummyBridge($oLogger); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
View Code Duplication |
public static function getMarathonBridge( |
|
|
|
|
41
|
|
|
ApiClientInterface $oApiClient, |
42
|
|
|
CacheInterface $oCache, |
43
|
|
|
JobValidatorServiceInterface $oJobEntityValidatorService, |
44
|
|
|
LoggerInterface $oLogger |
45
|
|
|
) { |
46
|
|
|
if ($oApiClient->ping()) { |
47
|
|
|
return new BridgeMarathon( |
48
|
|
|
$oApiClient, |
49
|
|
|
$oCache, |
50
|
|
|
$oJobEntityValidatorService, |
51
|
|
|
$oLogger); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
return new DummyBridge($oLogger); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
|
58
|
|
|
public static function getFilesystemBridge( |
59
|
|
|
Filesystem $oFileSystemService, |
60
|
|
|
CacheInterface $oCache, |
61
|
|
|
$sRepositoryDir, |
62
|
|
|
LoggerInterface $oLogger |
63
|
|
|
) { |
64
|
|
|
if (empty($sRepositoryDir)) { |
65
|
|
|
return new DummyBridge($oLogger); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
return new BridgeFileSystem( |
69
|
|
|
$oFileSystemService, |
70
|
|
|
$oCache, |
71
|
|
|
$sRepositoryDir |
72
|
|
|
); |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.