Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ShowCommand.php

function ShowCommand::appendAutoload

Parameters

JsonStructure $json:

Return value

JsonStructure

1 call to ShowCommand::appendAutoload()
ShowCommand::printPackageInfoAsJson in vendor/composer/composer/src/Composer/Command/ShowCommand.php
Prints package info in JSON format.

File

vendor/composer/composer/src/Composer/Command/ShowCommand.php, line 1148

Class

ShowCommand
@author Robert Schönthal <seroscho@googlemail.com> @author Jordi Boggiano <j.boggiano@seld.be> @author Jérémy Romey <jeremyFreeAgent> @author Mihai Plasoianu <mihai@plasoianu.de>

Namespace

Composer\Command

Code

private function appendAutoload(array $json, CompletePackageInterface $package) : array {
    if (\count($package->getAutoload()) > 0) {
        $autoload = [];
        foreach ($package->getAutoload() as $type => $autoloads) {
            if ($type === 'psr-0' || $type === 'psr-4') {
                $psr = [];
                foreach ($autoloads as $name => $path) {
                    if (!$path) {
                        $path = '.';
                    }
                    $psr[$name ?: '*'] = $path;
                }
                $autoload[$type] = $psr;
            }
            elseif ($type === 'classmap') {
                $autoload['classmap'] = $autoloads;
            }
        }
        $json['autoload'] = $autoload;
    }
    return $json;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal