PluginProbe ʕ •ᴥ•ʔ
Nested Pages / 3.2.14
Nested Pages v3.2.14
3.3.1 3.2.15 3.2.14 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 trunk 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.3.0 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.2 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.3.1 1.6.3.2 1.6.4 1.6.5 1.6.5.1 1.6.5.2 1.6.6 1.6.7 1.6.8 1.7.0 1.7.1 2.0.1 2.0.2 2.0.3 2.0.4 3.0.1 3.0.10 3.0.11 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.20 3.1.21 3.1.22 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7
wp-nested-pages / vendor / composer / installers / src / Composer / Installers / Installer.php
wp-nested-pages / vendor / composer / installers / src / Composer / Installers Last commit date
AglInstaller.php 11 years ago AnnotateCmsInstaller.php 11 years ago BaseInstaller.php 11 years ago CakePHPInstaller.php 11 years ago CodeIgniterInstaller.php 11 years ago CroogoInstaller.php 11 years ago DrupalInstaller.php 11 years ago FuelInstaller.php 11 years ago Installer.php 11 years ago JoomlaInstaller.php 11 years ago KohanaInstaller.php 11 years ago LaravelInstaller.php 11 years ago LithiumInstaller.php 11 years ago MODULEWorkInstaller.php 11 years ago MagentoInstaller.php 11 years ago MakoInstaller.php 11 years ago MediaWikiInstaller.php 11 years ago OxidInstaller.php 11 years ago PPIInstaller.php 11 years ago PhpBBInstaller.php 11 years ago SilverStripeInstaller.php 11 years ago Symfony1Installer.php 11 years ago TYPO3CmsInstaller.php 11 years ago TYPO3FlowInstaller.php 11 years ago WordPressInstaller.php 11 years ago ZendInstaller.php 11 years ago
Installer.php
129 lines
1 <?php
2 namespace Composer\Installers;
3
4 use Composer\Installer\LibraryInstaller;
5 use Composer\Package\PackageInterface;
6 use Composer\Repository\InstalledRepositoryInterface;
7
8 class Installer extends LibraryInstaller
9 {
10 /**
11 * Package types to installer class map
12 *
13 * @var array
14 */
15 private $supportedTypes = array(
16 'agl' => 'AglInstaller',
17 'annotatecms' => 'AnnotateCmsInstaller',
18 'cakephp' => 'CakePHPInstaller',
19 'codeigniter' => 'CodeIgniterInstaller',
20 'croogo' => 'CroogoInstaller',
21 'drupal' => 'DrupalInstaller',
22 'fuel' => 'FuelInstaller',
23 'joomla' => 'JoomlaInstaller',
24 'kohana' => 'KohanaInstaller',
25 'laravel' => 'LaravelInstaller',
26 'lithium' => 'LithiumInstaller',
27 'magento' => 'MagentoInstaller',
28 'mako' => 'MakoInstaller',
29 'mediawiki' => 'MediaWikiInstaller',
30 'modulework' => 'MODULEWorkInstaller',
31 'oxid' => 'OxidInstaller',
32 'phpbb' => 'PhpBBInstaller',
33 'ppi' => 'PPIInstaller',
34 'silverstripe' => 'SilverStripeInstaller',
35 'symfony1' => 'Symfony1Installer',
36 'wordpress' => 'WordPressInstaller',
37 'zend' => 'ZendInstaller',
38 'typo3-flow' => 'TYPO3FlowInstaller',
39 'typo3-cms' => 'TYPO3CmsInstaller',
40 );
41
42 /**
43 * {@inheritDoc}
44 */
45 public function getInstallPath(PackageInterface $package)
46 {
47 $type = $package->getType();
48 $frameworkType = $this->findFrameworkType($type);
49
50 if ($frameworkType === false) {
51 throw new \InvalidArgumentException(
52 'Sorry the package type of this package is not yet supported.'
53 );
54 }
55
56 $class = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
57 $installer = new $class($package, $this->composer);
58
59 return $installer->getInstallPath($package, $frameworkType);
60 }
61
62 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
63 {
64 if (!$repo->hasPackage($package)) {
65 throw new \InvalidArgumentException('Package is not installed: '.$package);
66 }
67
68 $repo->removePackage($package);
69
70 $installPath = $this->getInstallPath($package);
71 $this->io->write(sprintf('Deleting %s - %s', $installPath, $this->filesystem->removeDirectory($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
72 }
73
74 /**
75 * {@inheritDoc}
76 */
77 public function supports($packageType)
78 {
79 $frameworkType = $this->findFrameworkType($packageType);
80
81 if ($frameworkType === false) {
82 return false;
83 }
84
85 $locationPattern = $this->getLocationPattern($frameworkType);
86 return preg_match('#' . $frameworkType . '-' . $locationPattern . '#', $packageType, $matches) === 1;
87 }
88
89 /**
90 * Finds a supported framework type if it exists and returns it
91 *
92 * @param string $type
93 * @return string
94 */
95 protected function findFrameworkType($type)
96 {
97 $frameworkType = false;
98
99 foreach ($this->supportedTypes as $key => $val) {
100 if ($key === substr($type, 0, strlen($key))) {
101 $frameworkType = substr($type, 0, strlen($key));
102 break;
103 }
104 }
105
106 return $frameworkType;
107 }
108
109 /**
110 * Get the second part of the regular expression to check for support of a
111 * package type
112 *
113 * @param string $frameworkType
114 * @return string
115 */
116 protected function getLocationPattern($frameworkType)
117 {
118 $pattern = false;
119 if (!empty($this->supportedTypes[$frameworkType])) {
120 $frameworkClass = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
121 /** @var BaseInstaller $framework */
122 $framework = new $frameworkClass;
123 $locations = array_keys($framework->getLocations());
124 $pattern = $locations ? '(' . implode('|', $locations) . ')' : false;
125 }
126 return $pattern ? : '(\w+)';
127 }
128 }
129