11<?php
22
3- /**
4- * @file
5- * Contains \DrupalComposer\DrupalScaffold\Handler.
6- */
7-
83namespace DrupalComposer \DrupalScaffold ;
94
5+ use Composer \Script \Event ;
6+ use Composer \Installer \PackageEvent ;
7+ use Composer \Plugin \CommandEvent ;
108use Composer \Composer ;
119use Composer \DependencyResolver \Operation \InstallOperation ;
1210use Composer \DependencyResolver \Operation \UpdateOperation ;
1816use Composer \Util \RemoteFilesystem ;
1917use Symfony \Component \Filesystem \Filesystem as SymfonyFilesystem ;
2018
19+ /**
20+ * Core class of the plugin, contains all logic which files should be fetched.
21+ */
2122class Handler {
2223
2324 const PRE_DRUPAL_SCAFFOLD_CMD = 'pre-drupal-scaffold-cmd ' ;
@@ -48,8 +49,8 @@ class Handler {
4849 /**
4950 * Handler constructor.
5051 *
51- * @param Composer $composer
52- * @param IOInterface $io
52+ * @param \Composer\ Composer $composer
53+ * @param \Composer\IO\ IOInterface $io
5354 */
5455 public function __construct (Composer $ composer , IOInterface $ io ) {
5556 $ this ->composer = $ composer ;
@@ -79,7 +80,7 @@ protected function getCorePackage($operation) {
7980 *
8081 * @param \Composer\Plugin\CommandEvent $event
8182 */
82- public function onCmdBeginsEvent (\ Composer \ Plugin \ CommandEvent $ event ) {
83+ public function onCmdBeginsEvent (CommandEvent $ event ) {
8384 if ($ event ->getInput ()->hasOption ('no-progress ' )) {
8485 $ this ->progress = !($ event ->getInput ()->getOption ('no-progress ' ));
8586 }
@@ -93,7 +94,7 @@ public function onCmdBeginsEvent(\Composer\Plugin\CommandEvent $event) {
9394 *
9495 * @param \Composer\Installer\PackageEvent $event
9596 */
96- public function onPostPackageEvent (\ Composer \ Installer \ PackageEvent $ event ){
97+ public function onPostPackageEvent (PackageEvent $ event ) {
9798 $ package = $ this ->getCorePackage ($ event ->getOperation ());
9899 if ($ package ) {
99100 // By explicitly setting the core package, the onPostCmdEvent() will
@@ -107,7 +108,7 @@ public function onPostPackageEvent(\Composer\Installer\PackageEvent $event){
107108 *
108109 * @param \Composer\Script\Event $event
109110 */
110- public function onPostCmdEvent (\ Composer \ Script \ Event $ event ) {
111+ public function onPostCmdEvent (Event $ event ) {
111112 // Only install the scaffolding if drupal/core was installed,
112113 // AND there are no scaffolding files present.
113114 if (isset ($ this ->drupalCorePackage )) {
@@ -138,10 +139,10 @@ public function downloadScaffold() {
138139
139140 $ fetcher = new PrestissimoFileFetcher ($ remoteFs , $ options ['source ' ], $ this ->io , $ this ->progress , $ this ->composer ->getConfig ());
140141 $ fetcher ->setFilenames (array_combine ($ files , $ files ));
141- $ fetcher ->fetch ($ version , $ webroot , true );
142+ $ fetcher ->fetch ($ version , $ webroot , TRUE );
142143
143144 $ fetcher ->setFilenames ($ this ->getInitial ());
144- $ fetcher ->fetch ($ version , $ webroot , false );
145+ $ fetcher ->fetch ($ version , $ webroot , FALSE );
145146
146147 // Call post-scaffold scripts.
147148 $ dispatcher ->dispatch (self ::POST_DRUPAL_SCAFFOLD_CMD );
@@ -212,7 +213,7 @@ public function getVendorPath() {
212213 * Look up the Drupal core package object, or return it from where we cached
213214 * it in the $drupalCorePackage field.
214215 *
215- * @return PackageInterface
216+ * @return \Composer\Package\ PackageInterface
216217 */
217218 public function getDrupalCorePackage () {
218219 if (!isset ($ this ->drupalCorePackage )) {
@@ -240,7 +241,7 @@ protected function getDrupalCoreVersion(PackageInterface $drupalCorePackage) {
240241 /**
241242 * Retrieve the path to the web root.
242243 *
243- * @return string
244+ * @return string
244245 */
245246 public function getWebRoot () {
246247 $ drupalCorePackage = $ this ->getDrupalCorePackage ();
@@ -258,7 +259,7 @@ public function getWebRoot() {
258259 * @param string $name
259260 * Name of the package to get from the current composer installation.
260261 *
261- * @return PackageInterface
262+ * @return \Composer\Package\ PackageInterface
262263 */
263264 protected function getPackage ($ name ) {
264265 return $ this ->composer ->getRepositoryManager ()->getLocalRepository ()->findPackage ($ name , '* ' );
@@ -361,7 +362,7 @@ protected function getIncludesDefault() {
361362 'sites/example.settings.local.php ' ,
362363 'sites/example.sites.php ' ,
363364 'update.php ' ,
364- 'web.config '
365+ 'web.config ' ,
365366 ];
366367
367368 // Version specific variations.
0 commit comments