AbstractSchemaCommand::config()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace Realshadow\RequestDeserializer\Console\Commands\Schema;
4
5
use Illuminate\Console\Command;
6
use Realshadow\RequestDeserializer\Providers\LaravelServiceProvider;
7
8
9
/**
10
 * Base class for all schema commands
11
 *
12
 * @package Realshadow\RequestDeserializer\Console\Commands\Schema
13
 * @author Lukáš Homza <[email protected]>
14
 */
15
abstract class AbstractSchemaCommand extends Command
16
{
17
18
    /**
19
     * Prefix used by pattern used for replacing data in template files
20
     */
21
    const PATTERN_PREFIX = '{';
22
23
    /**
24
     * Suffix used by pattern used for replacing data in template files
25
     */
26
    const PATTERN_SUFFIX = '}';
27
28
    /**
29
     * File extension used by template files
30
     */
31
    const TEMPLATE_EXTENSION = 'tpl';
32
33
    /**
34
     * Get the value from configuration depending on provided configuration path
35
     *
36
     * @param string $path
37
     * @param null $default
38
     *
39
     * @return null|string
40
     */
41
    protected function config($path, $default = null)
42
    {
43
        return config(LaravelServiceProvider::CONFIG_KEY . '.' . $path, $default);
44
    }
45
46
    /**
47
     * Merges provided chunks into path
48
     *
49
     * @param array ...$chunks
50
     *
51
     * @return string
52
     */
53
    protected function path(...$chunks)
54
    {
55
        return join(DIRECTORY_SEPARATOR, $chunks);
56
    }
57
58
}
59