Passed
Push — master ( 21719d...7c0196 )
by Caen
03:52 queued 12s
created

ResetsApplication::resetPosts()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Hyde\Testing;
4
5
use Hyde\Framework\Hyde;
6
7
/**
8
 * @internal
9
 */
10
trait ResetsApplication
11
{
12
    public function resetApplication()
13
    {
14
        $this->resetMedia();
15
        $this->resetPages();
16
        $this->resetPosts();
17
        $this->resetDocs();
18
        $this->resetSite();
19
    }
20
21
    public function resetMedia()
22
    {
23
        //
24
    }
25
26
    public function resetPages()
27
    {
28
        array_map('unlinkUnlessDefault', glob(Hyde::path('_pages/*.md')));
29
        array_map('unlinkUnlessDefault', glob(Hyde::path('_pages/*.blade.php')));
30
    }
31
32
    public function resetPosts()
33
    {
34
        array_map('unlinkUnlessDefault', glob(Hyde::path('_posts/*.md')));
35
    }
36
37
    public function resetDocs()
38
    {
39
        array_map('unlinkUnlessDefault', glob(Hyde::path('_docs/*.md')));
40
    }
41
42
    public function resetSite()
43
    {
44
        array_map('unlinkUnlessDefault', glob(Hyde::path('_site/**/*.html')));
45
        array_map('unlinkUnlessDefault', glob(Hyde::path('_site/**/*.json')));
46
        array_map('unlinkUnlessDefault', glob(Hyde::path('_site/*.xml')));
47
    }
48
}
49