Test Setup Failed
Push — master ( 4913ba...eddc54 )
by Php Easy Api
03:29
created

Schedule::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 10
nc 2
nop 0
dl 0
loc 19
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
namespace Resta\Console\Source\Schedule;
4
5
use Resta\Console\ConsoleOutputter;
6
use Resta\Console\ConsoleListAccessor;
7
8
class Schedule 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 = 'schedule';
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 schedule 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 = ['schedule'];
26
27
    /**
28
     * @return void
29
     */
30
    public function create(){
31
32
        $schedulePath = app()->path()->schedule();
33
        
34
        if(!file_exists($schedulePath)){
35
            $this->directory['schedule'] = $schedulePath;
36
            $this->file->makeDirectory($this);
37
        }
38
39
        $this->argument['scheduleNamespace'] = app()->namespace()->schedule();
40
        $this->argument['scheduleClass'] = ucfirst($this->argument['schedule']).'';
41
        $this->argument['projectName'] = strtolower($this->projectName());
42
43
        $this->touch['schedule/schedule']= $schedulePath.'/'.$this->argument['schedule'].'.php';
44
45
46
        $this->file->touch($this);
47
48
        echo $this->classical(' > Schedule file called as "'.$this->argument['schedule'].'" has been successfully created in the '.$schedulePath.'');
49
    }
50
    
51
}