Package   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 60
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getVersion() 0 3 1
A getName() 0 3 1
A setVersion() 0 3 1
A setName() 0 5 1
A getId() 0 3 1
1
<?php
2
3
namespace App\Satis\Model;
4
5
use App\Satis\ConfigManager;
6
use JMS\Serializer\Annotation\Type;
7
8
/**
9
* Package class
10
*
11
* @author Lukas Homza <[email protected]>
12
*/
13
class Package {
14
  /**
15
   * @Type("string")
16
   */
17
  private $name;
18
19
  /**
20
   * @Type("string")
21
   */
22
  private $version;
23
24
  /**
25
   * Initialize with default opinionated values
26
   */
27
  public function __construct() {
28
    $this->name = '';
29
    $this->version = '*';
30
  }
31
32
  /**
33
   * @return string
34
   */
35
  public function getVersion() {
36
    return $this->version;
37
  }
38
39
  /**
40
   * @return string
41
   */
42
  public function getName() {
43
    return $this->name;
44
  }
45
46
  /**
47
   * @param string $version
48
   */
49
  public function setVersion($version) {
50
    $this->version = $version;
51
  }
52
53
  /**
54
   * @param mixed $name
55
   * @return Package
56
   */
57
  public function setName($name) {
58
    $this->name = trim($name);
59
60
    return $this;
61
  }
62
63
  /**
64
   * Get repository ID
65
   *
66
   * @return string
67
   */
68
  public function getId() {
69
    return ConfigManager::nameToId($this->name);
70
  }
71
72
}
73