Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php declare(strict_types = 1);
2
/*
3
 * This file is part of PharIo\Manifest.
4
 *
5
 * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace PharIo\Manifest;
11
 
12
use PharIo\Version\Version;
13
 
14
class Manifest {
15
    /** @var ApplicationName */
16
    private $name;
17
 
18
    /** @var Version */
19
    private $version;
20
 
21
    /** @var Type */
22
    private $type;
23
 
24
    /** @var CopyrightInformation */
25
    private $copyrightInformation;
26
 
27
    /** @var RequirementCollection */
28
    private $requirements;
29
 
30
    /** @var BundledComponentCollection */
31
    private $bundledComponents;
32
 
33
    public function __construct(ApplicationName $name, Version $version, Type $type, CopyrightInformation $copyrightInformation, RequirementCollection $requirements, BundledComponentCollection $bundledComponents) {
34
        $this->name                 = $name;
35
        $this->version              = $version;
36
        $this->type                 = $type;
37
        $this->copyrightInformation = $copyrightInformation;
38
        $this->requirements         = $requirements;
39
        $this->bundledComponents    = $bundledComponents;
40
    }
41
 
42
    public function getName(): ApplicationName {
43
        return $this->name;
44
    }
45
 
46
    public function getVersion(): Version {
47
        return $this->version;
48
    }
49
 
50
    public function getType(): Type {
51
        return $this->type;
52
    }
53
 
54
    public function getCopyrightInformation(): CopyrightInformation {
55
        return $this->copyrightInformation;
56
    }
57
 
58
    public function getRequirements(): RequirementCollection {
59
        return $this->requirements;
60
    }
61
 
62
    public function getBundledComponents(): BundledComponentCollection {
63
        return $this->bundledComponents;
64
    }
65
 
66
    public function isApplication(): bool {
67
        return $this->type->isApplication();
68
    }
69
 
70
    public function isLibrary(): bool {
71
        return $this->type->isLibrary();
72
    }
73
 
74
    public function isExtension(): bool {
75
        return $this->type->isExtension();
76
    }
77
 
78
    public function isExtensionFor(ApplicationName $application, Version $version = null): bool {
79
        if (!$this->isExtension()) {
80
            return false;
81
        }
82
 
83
        /** @var Extension $type */
84
        $type = $this->type;
85
 
86
        if ($version !== null) {
87
            return $type->isCompatibleWith($application, $version);
88
        }
89
 
90
        return $type->isExtensionFor($application);
91
    }
92
}