/
RequiredPackageException.php
61 lines (55 loc) · 1.61 KB
/
RequiredPackageException.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
namespace Concrete\Core\Package\Dependency;
use Concrete\Core\Package\Package;
/**
* Package dependency failure: an installed package can't be uninstalled since it's required by another package.
*/
class RequiredPackageException extends DependencyException
{
/**
* The package that can't be uninstalled.
*
* @var Package
*/
protected $uninstallablePackage;
/**
* The package that requires the package that can't be uninstalled.
*
* @var Package
*/
protected $blockingPackage;
/**
* Initialize the instance.
*
* @param Package $uninstallablePackage the package that can't be uninstalled
* @param Package $blockingPackage the package that requires the package that can't be uninstalled
*/
public function __construct(Package $uninstallablePackage, Package $blockingPackage)
{
$this->uninstallablePackage = $uninstallablePackage;
$this->blockingPackage = $blockingPackage;
parent::__construct(t(
'The package "%1$s" can\'t be uninstalled since the package "%2$s" requires it.',
$uninstallablePackage->getPackageName(),
$blockingPackage->getPackageName()
));
}
/**
* Get the package that can't be uninstalled.
*
* @return Package
*/
public function getUninstallablePackage()
{
return $this->uninstallablePackage;
}
/**
* Get the package that requires the package that can't be uninstalled.
*
* @return Package
*/
public function getBlockingPackage()
{
return $this->blockingPackage;
}
}