writeSuperSakeFileToWebRoot()   A
last analyzed

Complexity

Conditions 2
Paths 3

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 0
loc 12
rs 9.4285
cc 2
eloc 8
nc 3
nop 0
1
<?php
2
3
4
class PublishSuperSakeCommmand extends SilverstripeCommand
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
5
{
6
    /**
7
     * @var string
8
     */
9
    protected $name = 'console:publish';
10
11
    /**
12
     * @var string
13
     */
14
    protected $description = 'Copy the supersake to your webroot';
15
16
    public function fire()
17
    {
18
        $this->writeSuperSakeFileToWebRoot();
19
    }
20
21
    protected function writeSuperSakeFileToWebRoot()
22
    {
23
        try {
24
            file_put_contents(
25
                BASE_PATH.'/supersake',
26
                file_get_contents(BASE_PATH.'/console/publish/supersake')
27
            );
28
            $this->info('supersake file copied to webroot');
29
        } catch (Exception $e) {
30
            $this->error($e->getMessage());
31
        }
32
    }
33
}
34