LinkedPackage::getPackage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the composer-link plugin.
7
 *
8
 * Copyright (c) 2021-2022 Sander Visser <[email protected]>.
9
 *
10
 * For the full copyright and license information, please view the LICENSE.md
11
 * file that was distributed with this source code.
12
 *
13
 * @link https://github.com/SanderSander/composer-link
14
 */
15
16
namespace ComposerLink;
17
18
use Composer\Package\CompletePackage;
19
use Composer\Package\PackageInterface;
20
21
class LinkedPackage
22
{
23
    protected string $path;
24
25
    protected CompletePackage $package;
26
27
    protected ?PackageInterface $originalPackage;
28
29
    protected string $installationPath;
30
31
    public function __construct(
32
        string $path,
33
        CompletePackage $package,
34
        ?PackageInterface $originalPackage,
35
        string $installationPath
36
    ) {
37
        $this->path = $path;
38
        $this->package = $package;
39
        $this->originalPackage = $originalPackage;
40
        $this->installationPath = $installationPath;
41
    }
42
43
    public function getPath(): string
44
    {
45
        return $this->path;
46
    }
47
48
    public function getName(): string
49
    {
50
        return $this->package->getName();
51
    }
52
53
    public function getPackage(): CompletePackage
54
    {
55
        return $this->package;
56
    }
57
58
    public function getOriginalPackage(): ?PackageInterface
59
    {
60
        return $this->originalPackage;
61
    }
62
63
    public function getInstallationPath(): string
64
    {
65
        return $this->installationPath;
66
    }
67
68
    public function setOriginalPackage(?PackageInterface $package): void
69
    {
70
        $this->originalPackage = $package;
71
    }
72
}
73