FileStateExpectations::isWritable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
namespace PHPKitchen\CodeSpecs\Expectation\Mixin;
4
5
/**
6
 * Represents a common file expectations that being used in both file and directory matchers.
7
 *
8
 * @method \PHPKitchen\CodeSpecs\Expectation\Internal\Assert startStep($stepName)
9
 *
10
 * @package PHPKitchen\CodeSpecs\Matchers\Mixins
11
 * @author Dima 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
26
        return $this;
27
    }
28
29
    /**
30
     * @return $this
31
     */
32
    public function isNotReadable() {
33
        $this->isExist();
34
        $this->startStep('is not readable')
35
             ->assertNotIsReadable();
36
37
        return $this;
38
    }
39
40
    /**
41
     * @return $this
42
     */
43
    public function isWritable() {
44
        $this->isExist();
45
        $this->startStep('is writable')
46
             ->assertIsWritable();
47
48
        return $this;
49
    }
50
51
    /**
52
     * @return $this
53
     */
54
    public function isNotWritable() {
55
        $this->isExist();
56
        $this->startStep('is not writable')
57
             ->assertNotIsWritable();
58
59
        return $this;
60
    }
61
}