Touch   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 30
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getMethod() 0 4 1
A handle() 0 12 2
1
<?php
2
3
namespace Twistor\Flysystem\Plugin;
4
5
use League\Flysystem\Util;
6
7
class Touch extends AbstractPlugin
8
{
9
    /**
10
     * @inheritdoc
11
     */
12 210
    public function getMethod()
13
    {
14 210
        return 'touch';
15
    }
16
17
    /**
18
     * Emulates touch().
19
     *
20
     * @param string $path
21
     *
22
     * @return bool True on success, false on failure.
23
     */
24 27
    public function handle($path)
25
    {
26 27
        $path = Util::normalizePath($path);
27
28 27
        $adapter = $this->filesystem->getAdapter();
29
30 27
        if ($adapter->has($path)) {
31 6
            return true;
32
        }
33
34 27
        return (bool) $adapter->write($path, '', $this->defaultConfig());
35
    }
36
}
37