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::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
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