MissingPackageSolution::getSolutionTitle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Facade\Ignition\Solutions;
4
5
use Facade\Ignition\Support\Packagist\Package;
6
use Facade\IgnitionContracts\Solution;
7
8
class MissingPackageSolution implements Solution
9
{
10
    /** @var \Facade\Flare\Support\Packagist\Package */
11
    protected $possiblePackage;
12
13
    public function __construct(Package $possiblePackage)
14
    {
15
        $this->possiblePackage = $possiblePackage;
0 ignored issues
show
Documentation Bug introduced by
It seems like $possiblePackage of type object<Facade\Ignition\Support\Packagist\Package> is incompatible with the declared type object<Facade\Flare\Support\Packagist\Package> of property $possiblePackage.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
16
    }
17
18
    public function getSolutionTitle(): string
19
    {
20
        return 'A composer dependency is missing';
21
    }
22
23
    public function getSolutionDescription(): string
24
    {
25
        $output = [
26
            'You might be missing a composer dependency.',
27
            'A possible package that was found is `'.$this->possiblePackage->name.'`.',
28
            '',
29
            'See if this is the package that you need and install it via `composer require '.$this->possiblePackage->name.'`.',
30
        ];
31
32
        return implode(PHP_EOL, $output);
33
    }
34
35
    public function getDocumentationLinks(): array
36
    {
37
        return [
38
            'Git repository' => $this->possiblePackage->repository,
39
            'Package on Packagist' => $this->possiblePackage->url,
40
        ];
41
    }
42
}
43