Service   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 7
c 2
b 0
f 1
lcom 0
cbo 0
dl 0
loc 83
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getName() 0 4 1
A getRepository() 0 4 1
A getTag() 0 4 1
A getConfig() 0 4 1
A getContainer() 0 4 1
A setContainer() 0 4 1
1
<?php
2
3
namespace Joli\JoliCi;
4
5
use Docker\Container as DockerContainer;
6
7
/**
8
 * A service is just an application or a tool link to a build which helps running tests
9
 *
10
 * It can be for example a MySQL database which contains the needed fixtures in order
11
 * to make functional tests
12
 *
13
 * Multiple services can be link to a Job and they are started before creation of the Job.
14
 * Once the Job is finished, all services linkes are shutdown and reset to initial state for subsequent Job
15
 */
16
class Service
17
{
18
    /**
19
     * @var string Service name (use in link to container)
20
     */
21
    private $name;
22
23
    /**
24
     * @var string Repository for this service (from docker hub)
25
     */
26
    private $repository;
27
28
    /**
29
     * @var string Tag for this service (generally the version)
30
     */
31
    private $tag;
32
33
    /**
34
     * @var array Config when creating a container
35
     */
36
    private $config;
37
38
    /**
39
     * @var string Container id used for this service
40
     */
41
    private $container;
42
43
    public function __construct($name, $repository, $tag, $config = array())
44
    {
45
        $this->name       = $name;
46
        $this->repository = $repository;
47
        $this->tag        = $tag;
48
        $this->config     = $config;
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getName()
55
    {
56
        return $this->name;
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function getRepository()
63
    {
64
        return $this->repository;
65
    }
66
67
    /**
68
     * @return string
69
     */
70
    public function getTag()
71
    {
72
        return $this->tag;
73
    }
74
75
    /**
76
     * @return array
77
     */
78
    public function getConfig()
79
    {
80
        return $this->config;
81
    }
82
83
    /**
84
     * @return string The container id
85
     */
86
    public function getContainer()
87
    {
88
        return $this->container;
89
    }
90
91
    /**
92
     * @param string $container The container id
93
     */
94
    public function setContainer($container)
95
    {
96
        $this->container = $container;
97
    }
98
}
99