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

ResetsApplication   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A resetPosts() 0 3 1
A resetMedia() 0 2 1
A resetPages() 0 4 1
A resetApplication() 0 7 1
A resetSite() 0 5 1
A resetDocs() 0 3 1
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