Completed
Push — master ( b350e3...8d2c4d )
by Arne
01:49
created

TouchOperation   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 34
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getAbsolutePath() 0 4 1
A getMtime() 0 4 1
A execute() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
namespace Archivr\Operation;
4
5
class TouchOperation implements OperationInterface
6
{
7
    protected $absolutePath;
8
    protected $mtime;
9
10
    public function __construct(string $absolutePath, int $mtime)
11
    {
12
        $this->absolutePath = $absolutePath;
13
        $this->mtime = $mtime;
14
    }
15
16
    public function getAbsolutePath(): string
17
    {
18
        return $this->absolutePath;
19
    }
20
21
    public function getMtime(): int
22
    {
23
        return $this->mtime;
24
    }
25
26
    public function execute(): bool
27
    {
28
        return touch($this->absolutePath, $this->mtime);
29
    }
30
31
    /**
32
     * @codeCoverageIgnore
33
     */
34
    public function __toString(): string
35
    {
36
        return sprintf('Touch %s to mtime = %s', $this->absolutePath, date('c', $this->mtime));
37
    }
38
}
39