Filesystem   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 52
ccs 0
cts 16
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A has() 0 4 1
A read() 0 4 1
A put() 0 4 1
1
<?php
2
3
namespace SvImages\Filesystem;
4
5
/**
6
 * @author Vytautas Stankus <[email protected]>
7
 * @license MIT
8
 */
9
class Filesystem
10
{
11
    /**
12
     * @var FilesystemAdapterInterface
13
     */
14
    protected $adapter;
15
16
    /**
17
     * @param FilesystemAdapterInterface $adapter
18
     */
19
    public function __construct(FilesystemAdapterInterface $adapter)
20
    {
21
        $this->adapter = $adapter;
22
    }
23
24
    /**
25
     * Check whether a file exists.
26
     *
27
     * @param string $path
28
     *
29
     * @return bool
30
     */
31
    public function has($path)
32
    {
33
        return $this->adapter->has($path);
34
    }
35
36
    /**
37
     * Read a file.
38
     *
39
     * @param string $path The path to the file.
40
     *
41
     * @return string|false The file contents or false on failure.
42
     */
43
    public function read($path)
44
    {
45
        return $this->adapter->read($path);
46
    }
47
48
    /**
49
     * Create a file or update if exists.
50
     *
51
     * @param string $path     The path to the file.
52
     * @param string $contents The file contents.
53
     *
54
     * @return bool True on success, false on failure.
55
     */
56
    public function put($path, $contents)
57
    {
58
        return $this->adapter->put($path, $contents);
59
    }
60
}
61