Skip to content

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
Minor formatting and code updates
  • Loading branch information
junaidbhura committed Oct 30, 2020
1 parent 8784ddb commit c18cf1e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@ public function uninstall( Composer $composer, IOInterface $io ) {
public static function getSubscribedEvents() {

if ( version_compare( PluginInterface::PLUGIN_API_VERSION, '2.0.0', '<' ) ) {
return [
return array(
PackageEvents::PRE_PACKAGE_INSTALL => 'onPrePackageInstallOrUpdateInComposer1',
PackageEvents::PRE_PACKAGE_UPDATE => 'onPrePackageInstallOrUpdateInComposer1',
PluginEvents::PRE_FILE_DOWNLOAD => array( 'onPreFileDownloadInComposer1', -1 ),
];
);
}

return [
return array(
PluginEvents::PRE_FILE_DOWNLOAD => array( 'onPreFileDownloadInComposer2', -1 ),
];
);
}

/**
Expand Down Expand Up @@ -161,8 +161,9 @@ public function onPreFileDownloadInComposer1( PreFileDownloadEvent $event ) {
*/
public function onPreFileDownloadInComposer2( PreFileDownloadEvent $event ) {
/**
* Bail early if this event is not for a package.
*
* @see https://github.com/composer/composer/pull/8975
* Bail early if this event is not for a package.
*/
if ( $event->getType() !== 'package' ) {
return;
Expand Down Expand Up @@ -234,7 +235,7 @@ protected function getDownloadUrl( PackageInterface $package ) {
}
}

if ( $plugin ) {
if ( ! empty( $plugin ) ) {
return $plugin->getDownloadUrl();
}

Expand Down

0 comments on commit c18cf1e

Please sign in to comment.