GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Pull Request — master (#16)
by Raed
02:23
created

ShortenCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 48
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getOptions() 0 4 1
A getArguments() 0 4 1
A handle() 0 8 1
1
<?php
2
3
namespace LaraCrafts\UrlShortener\Console\Commands;
4
5
use Illuminate\Console\Command;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputOption;
8
9
class ShortenCommand extends Command
10
{
11
    /**
12
     * The console command name.
13
     *
14
     * @var string
15
     */
16
    protected $name = 'shorten';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Shorten a given URL';
24
25
    /**
26
     * Execute the console command.
27
     *
28
     * @return mixed
29
     */
30 24
    public function handle()
31
    {
32 24
        $driver = $this->laravel['url.shortener']->driver($this->input->getOption('driver'));
33
34 24
        $shortUrl = $driver->shorten($this->input->getArgument('url'));
35
36 24
        $this->info('URL shortened successfully.');
37 24
        $this->info("Your short URL is: $shortUrl");
38 24
    }
39
40
    /**
41
     * {@inheritDoc}
42
     */
43 24
    protected function getArguments()
44
    {
45
        return [
46 24
            ['url', InputArgument::REQUIRED, 'The URL to shorten'],
47
        ];
48
    }
49
50
    /**
51
     * {@inheritDoc}
52
     */
53 24
    protected function getOptions()
54
    {
55
        return [
56 24
            ['driver', 'D', InputOption::VALUE_REQUIRED, 'The driver to use for shortening the given URL'],
57
        ];
58
    }
59
}
60