WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
функция не описана

Automattic\Jetpack\Autoloader

AutoloadGenerator::parseAutoloadsType() protected WC 1.0

This function differs from the composer parseAutoloadsType in that beside returning the path. It also return the path and the version of a package.

Currently supports only psr-4 and clasmap parsing.

Это метод класса: AutoloadGenerator{}

Хуков нет.

Возвращает

Массив.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->parseAutoloadsType( $packageMap, $type, $mainPackage );
$packageMap(массив) (обязательный)
Map of all the packages.
$type(строка) (обязательный)
Type of autoloader to use, currently not used, since we only support psr-4.
$mainPackage(Packageчислоerface) (обязательный)
Instance of the Package Object.

Код AutoloadGenerator::parseAutoloadsType() WC 4.6.1

<?php
protected function parseAutoloadsType( array $packageMap, $type, PackageInterface $mainPackage ) {
	$autoloads = array();

	if ( 'psr-4' !== $type && 'classmap' !== $type && 'files' !== $type ) {
		return parent::parseAutoloadsType( $packageMap, $type, $mainPackage );
	}

	foreach ( $packageMap as $item ) {
		list($package, $installPath) = $item;
		$autoload                    = $package->getAutoload();

		if ( $package === $mainPackage ) {
			$autoload = array_merge_recursive( $autoload, $package->getDevAutoload() );
		}

		if ( null !== $package->getTargetDir() && $package !== $mainPackage ) {
			$installPath = substr( $installPath, 0, -strlen( '/' . $package->getTargetDir() ) );
		}

		if ( 'psr-4' === $type && isset( $autoload['psr-4'] ) && is_array( $autoload['psr-4'] ) ) {
			foreach ( $autoload['psr-4'] as $namespace => $paths ) {
				$paths = is_array( $paths ) ? $paths : array( $paths );
				foreach ( $paths as $path ) {
					$relativePath              = empty( $installPath ) ? ( empty( $path ) ? '.' : $path ) : $installPath . '/' . $path;
					$autoloads[ $namespace ][] = array(
						'path'    => $relativePath,
						'version' => $package->getVersion(), // Version of the class comes from the package - should we try to parse it?
					);
				}
			}
		}

		if ( 'classmap' === $type && isset( $autoload['classmap'] ) && is_array( $autoload['classmap'] ) ) {
			foreach ( $autoload['classmap'] as $paths ) {
				$paths = is_array( $paths ) ? $paths : array( $paths );
				foreach ( $paths as $path ) {
					$relativePath = empty( $installPath ) ? ( empty( $path ) ? '.' : $path ) : $installPath . '/' . $path;
					$autoloads[]  = array(
						'path'    => $relativePath,
						'version' => $package->getVersion(), // Version of the class comes from the package - should we try to parse it?
					);
				}
			}
		}
		if ( 'files' === $type && isset( $autoload['files'] ) && is_array( $autoload['files'] ) ) {
			foreach ( $autoload['files'] as $file_id => $paths ) {
				$paths = is_array( $paths ) ? $paths : array( $paths );
				foreach ( $paths as $path ) {
					$relativePath = empty( $installPath ) ? ( empty( $path ) ? '.' : $path ) : $installPath . '/' . $path;
					$autoloads[ $this->getFileIdentifier( $package, $path ) ] = array(
						'path'    => $relativePath,
						'version' => $package->getVersion(), // Version of the file comes from the package - should we try to parse it?
					);
				}
			}
		}
	}

	return $autoloads;
}