Passed
Push — master ( 95f661...656593 )
by Php Easy Api
04:28
created

Test   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 18 2
1
<?php
2
3
namespace Resta\Console\Source\Test;
4
5
use Resta\Console\ConsoleOutputter;
6
use Resta\Console\ConsoleListAccessor;
7
8
class Test extends ConsoleOutputter {
9
10
    use ConsoleListAccessor;
11
12
    /**
13
     * @var $type
0 ignored issues
show
Documentation Bug introduced by
The doc comment $type at position 0 could not be parsed: Unknown type name '$type' at position 0 in $type.
Loading history...
14
     */
15
    public $type = 'test';
16
17
    /**
18
     * @var $define
0 ignored issues
show
Documentation Bug introduced by
The doc comment $define at position 0 could not be parsed: Unknown type name '$define' at position 0 in $define.
Loading history...
19
     */
20
    public $define = 'creates test file for application';
21
22
    /**
23
     * @var $commandRule
0 ignored issues
show
Documentation Bug introduced by
The doc comment $commandRule at position 0 could not be parsed: Unknown type name '$commandRule' at position 0 in $commandRule.
Loading history...
24
     */
25
    public $commandRule = ['test'];
26
27
    /**
28
     * @method generate
29
     * @return mixed
30
     */
31
    public function create()
32
    {
33
34
        if(!file_exists(app()->path()->tests())){
35
            $this->directory['test'] = app()->path()->tests();
36
            $this->file->makeDirectory($this);
37
        }
38
39
        $this->argument['testPath'] = app()->namespace()->tests();
40
        $this->argument['testNamespace'] = ucfirst($this->argument['test']);
41
        $this->argument['projectName'] = strtolower($this->projectName());
42
43
        $this->touch['test/test']= app()->path()->tests().'/'.ucfirst($this->argument['test']).'.php';
44
45
46
        $this->file->touch($this);
47
48
        echo $this->classical(' > Test file called as "'.$this->argument['test'].'" has been successfully created in the '.app()->namespace()->tests().'');
49
    }
50
}