Package::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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