GetApplicationTrait::getApplication()   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
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
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