FileContent   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 84.62%

Importance

Changes 0
Metric Value
dl 0
loc 56
c 0
b 0
f 0
wmc 5
lcom 1
cbo 0
ccs 11
cts 13
cp 0.8462
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A set() 0 3 1
A get() 0 3 1
A isChanged() 0 3 1
A getContentHash() 0 3 1
1
<?php
2
3
  namespace Funivan\Cs\Fs;
4
5
  /**
6
   *
7
   */
8
  class FileContent {
9
10
    /**
11
     * @var string
12
     */
13
    private $content;
14
15
16
    /**
17
     * @var string|null
18
     */
19
    private $initialContentHashSum = null;
20
21
22
    /**
23
     * @param string $content
24
     */
25 74
    public function __construct($content) {
26 74
      $this->content = $content;
27 74
      $this->initialContentHashSum = $this->getContentHash();
28 74
    }
29
30
31
    /**
32
     * @param string $content
33
     * @void
34
     */
35 38
    public function set($content) {
36 38
      $this->content = $content;
37 38
    }
38
39
40
    /**
41
     * @return string
42
     */
43 74
    public function get() {
44 74
      return $this->content;
45
    }
46
47
48
    /**
49
     * @return boolean
50
     */
51
    public function isChanged() {
52
      return ($this->initialContentHashSum !== $this->getContentHash());
53
    }
54
55
56
    /**
57
     * @return string
58
     */
59 74
    private function getContentHash() {
60 74
      return md5($this->content);
61
    }
62
63
  }