Code Duplication    Length = 64-65 lines in 2 locations

src/Console/Commands/PublishSiteDirectory.php 1 location

@@ 10-74 (lines=65) @@
7
 *
8
 * @package Acacha\ForgePublish\Commands
9
 */
10
class PublishSiteDirectory extends SaveEnvVariable
11
{
12
    /**
13
     * The name and signature of the console command.
14
     *
15
     * @var string
16
     */
17
    protected $signature = 'publish:site_directory {site_directory?}';
18
19
    /**
20
     * The console command description.
21
     *
22
     * @var string
23
     */
24
    protected $description = 'Save Acacha forge site directory';
25
26
    /**
27
     * Env var to set.
28
     *
29
     * @return mixed
30
     */
31
    protected function envVar()
32
    {
33
        return 'ACACHA_FORGE_SITE_DIRECTORY';
34
    }
35
36
    /**
37
     * Argument key.
38
     *
39
     * @return mixed
40
     */
41
    protected function argKey()
42
    {
43
        return 'site_directory';
44
    }
45
46
    /**
47
     * Question text.
48
     *
49
     * @return mixed
50
     */
51
    protected function questionText()
52
    {
53
        return 'Acacha forge site directory?';
54
    }
55
56
    /**
57
     * Default proposed value when asking.
58
     *
59
     */
60
    protected function default()
61
    {
62
        return $default = fp_env($this->envVar()) ? fp_env($this->envVar()) : $this->defaultValue();
63
    }
64
65
    /**
66
     * Default project type.
67
     *
68
     * @return string
69
     */
70
    protected function defaultValue()
71
    {
72
        return config('forge-publish.site_directory');
73
    }
74
}
75

src/Console/Commands/PublishURL.php 1 location

@@ 10-73 (lines=64) @@
7
 *
8
 * @package Acacha\ForgePublish\Commands
9
 */
10
class PublishURL extends SaveEnvVariable
11
{
12
    /**
13
     * The name and signature of the console command.
14
     *
15
     * @var string
16
     */
17
    protected $signature = 'publish:url {url?}';
18
19
    /**
20
     * The console command description.
21
     *
22
     * @var string
23
     */
24
    protected $description = 'Set Acacha Laravel Forge API URL';
25
26
    /**
27
     * Env var to set.
28
     *
29
     * @return mixed
30
     */
31
    protected function envVar()
32
    {
33
        return 'ACACHA_FORGE_URL';
34
    }
35
36
    /**
37
     * Argument key.
38
     *
39
     * @return mixed
40
     */
41
    protected function argKey()
42
    {
43
        return 'url';
44
    }
45
46
    /**
47
     * Question text.
48
     *
49
     * @return mixed
50
     */
51
    protected function questionText()
52
    {
53
        return 'Acacha Forge API URL?';
54
    }
55
56
    /**
57
     * Default proposed value when asking.
58
     *
59
     */
60
    protected function default()
61
    {
62
        return fp_env($this->envVar()) ? fp_env($this->envVar()) : $this->getDefaultAPIURL();
63
    }
64
65
    /**
66
     * Get default API URL..
67
     *
68
     * @return string
69
     */
70
    protected function getDefaultAPIURL()
71
    {
72
        return config('forge-publish.url');
73
    }
74
}
75