GetApplicationTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 9
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getApplication() 0 4 1
1
<?php
2
declare(strict_types = 1);
3
/**
4
 * /src/Command/Traits/GetApplicationTrait.php
5
 *
6
 * @author TLe, Tarmo Leppänen <[email protected]>
7
 */
8
9
namespace App\Command\Traits;
10
11
use Symfony\Component\Console\Application;
12
use Symfony\Component\Console\Exception\RuntimeException;
13
14
/**
15
 * Trait GetApplicationTrait
16
 *
17
 * @package App\Command\Traits
18
 * @author TLe, Tarmo Leppänen <[email protected]>
19
 */
20
trait GetApplicationTrait
21
{
22
    /**
23
     * @throws RuntimeException
24
     */
25
    public function getApplication(): Application
26
    {
27
        return parent::getApplication()
28
            ?? throw new RuntimeException('Cannot determine application for console command to use.');
29
    }
30
}
31