FileStateExpectations::isReadable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace PHPKitchen\CodeSpecsCore\Expectation\Mixin;
4
5
/**
6
 * Represents a common file expectations that being used in both file and directory matchers.
7
 *
8
 * @method \PHPKitchen\CodeSpecsCore\Expectation\Internal\Assert startStep($stepName)
9
 *
10
 * @package PHPKitchen\CodeSpecsCore\Matchers\Mixins
11
 * @author Dmitry Kolodko <[email protected]>
12
 */
13
trait FileStateExpectations {
14
    abstract public function isExist();
15
16
    abstract public function isNotExist();
17
18
    /**
19
     * @return $this
20
     */
21
    public function isReadable() {
22
        $this->isExist();
23
        $this->startStep('is readable')
24
            ->assertIsReadable();
25
        return $this;
26
    }
27
28
    /**
29
     * @return $this
30
     */
31
    public function isNotReadable() {
32
        $this->isExist();
33
        $this->startStep('is not readable')
34
            ->assertNotIsReadable();
35
        return $this;
36
    }
37
38
    /**
39
     * @return $this
40
     */
41
    public function isWritable() {
42
        $this->isExist();
43
        $this->startStep('is writable')
44
            ->assertIsWritable();
45
        return $this;
46
    }
47
48
    /**
49
     * @return $this
50
     */
51
    public function isNotWritable() {
52
        $this->isExist();
53
        $this->startStep('is not writable')
54
            ->assertNotIsWritable();
55
        return $this;
56
    }
57
}