Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Console\Concerns;
4
 
5
use Symfony\Component\Console\Input\InputArgument;
6
use Symfony\Component\Console\Input\InputOption;
7
 
8
trait HasParameters
9
{
10
    /**
11
     * Specify the arguments and options on the command.
12
     *
13
     * @return void
14
     */
15
    protected function specifyParameters()
16
    {
17
        // We will loop through all of the arguments and options for the command and
18
        // set them all on the base command instance. This specifies what can get
19
        // passed into these commands as "parameters" to control the execution.
20
        foreach ($this->getArguments() as $arguments) {
21
            if ($arguments instanceof InputArgument) {
22
                $this->getDefinition()->addArgument($arguments);
23
            } else {
24
                $this->addArgument(...$arguments);
25
            }
26
        }
27
 
28
        foreach ($this->getOptions() as $options) {
29
            if ($options instanceof InputOption) {
30
                $this->getDefinition()->addOption($options);
31
            } else {
32
                $this->addOption(...$options);
33
            }
34
        }
35
    }
36
 
37
    /**
38
     * Get the console command arguments.
39
     *
40
     * @return array
41
     */
42
    protected function getArguments()
43
    {
44
        return [];
45
    }
46
 
47
    /**
48
     * Get the console command options.
49
     *
50
     * @return array
51
     */
52
    protected function getOptions()
53
    {
54
        return [];
55
    }
56
}