File   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 32
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A timestamp() 0 4 1
A mimetype() 0 8 2
A content() 0 4 1
A isFile() 0 4 1
1
<?php
2
/******************************************************************************
3
 * An iterator interface over the Leagues flysystem.
4
 * Copyright (c) 2021, 2015 Richard Klees <[email protected]>
5
 *
6
 * This software is licensed under GPLv3. You should have received
7
 * a copy of the along with the code.
8
 */
9
10
namespace Lechimp\Flightcontrol;
11
12
/**
13
 * A file.
14
 */
15
class File extends FSObject
16
{
17
    /**
18
     * @return string|int
19
     */
20 1
    public function timestamp()
21
    {
22 1
        return $this->filesystem()->lastModified($this->path);
23
    }
24
25 3
    public function mimetype() : ?string
26
    {
27
        try {
28 3
            return $this->filesystem()->mimetype($this->path);
29 1
        } catch (\League\Flysystem\UnableToRetrieveMetadata $e) {
30 1
            return null;
31
        }
32
    }
33
34 1
    public function content() : string
35
    {
36 1
        return $this->filesystem()->read($this->path);
37
    }
38
39
    /**
40
     * @inheritdoc
41
     */
42 31
    public function isFile() : bool
43
    {
44 31
        return true;
45
    }
46
}
47