Issues (28)

src/Console/ThemePublishCommand.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Wingsline\Blog\Console;
4
5
use Illuminate\Console\Command;
6
7
class ThemePublishCommand extends Command
8
{
9
    /**
10
     * The console command description.
11
     *
12
     * @var string
13
     */
14
    protected $description = 'Create a symbolic link from "theme/public" to "public/theme"';
15
    /**
16
     * The console command signature.
17
     *
18
     * @var string
19
     */
20
    protected $signature = 'blog:theme-publish';
21
22
    /**
23
     * Execute the console command.
24
     *
25
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
26
     */
27
    public function handle()
28
    {
29
        if (! file_exists(base_path('theme/public'))) {
30
            return $this->error('The theme doesn\'t have any public assets.');
0 ignored issues
show
Are you sure the usage of $this->error('The theme ...ve any public assets.') targeting Illuminate\Console\Command::error() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
31
        }
32
33
        $this->laravel->make('files')->delete(public_path('theme'));
34
35
        $this->laravel->make('files')->link(
36
            base_path('theme/public'),
37
            public_path('theme')
38
        );
39
40
        $this->info('The theme\'s public assets were linked.');
41
    }
42
}
43