private function buildPackageMap($package)
	{
		$package_map  = array();
		$requirements = $package->getRequires();
		$extra        = $package->getExtra();
		$mappings     = $extra[self::NAME][$this->framework];

		foreach ($mappings as $element => $value) {
			if (is_array($value)) {

				//
				// Check for external mapping support
				//

				if ($element != $package->getName() && !$this->externalMapping) {
					throw new \Exception(sprintf(
						'Cannot perform external mapping for %s, disabled', $element
					));
				}

				if (strpos($element, '*') !== FALSE) {
					$parts   = explode('*', $element);
					$parts   = array_map(function($v) { return preg_quote($v, '#'); }, $parts);
					$element = implode('(.*)', $parts);
				}

				foreach ($requirements as $link) {
					if (preg_match('#' . $element . '#', $link->getTarget())) {
						$package_map[$link->getTarget()] = $value;
					}
				}

				$package_map[$element] = $value;

			} elseif (is_string($value)) {

				if (!isset($package_map[$package->getName()])) {
					$package_map[$package->getName()] = array();
				}

				$package_map[$package->getName()][$element] = $value;

			} else {
				throw new \Exception (sprintf(
					'Ivalid element %s of type %s', $element, gettype($value)
				));
			}
		}

		return $package_map;
	}
private function buildPackageMap($package)
	{
		$package_map  = array();
		$requirements = $package->getRequires();
		$extra        = $package->getExtra();
		$mappings     = $extra[self::NAME][$this->framework];

		foreach ($mappings as $element => $value) {
			if (is_array($value)) {

				//
				// Check for external mapping support
				//

				if ($element != $package->getName() && !$this->externalMapping) {
					throw new \Exception(sprintf(
						'Cannot perform external mapping for %s, disabled', $element
					));
				}

				if (strpos($element, '*') !== FALSE) {
					$parts   = explode('*', $element);
					$parts   = array_map(function($v) { return preg_quote($v, '#'); }, $parts);
					$element = implode('(.*)', $parts);
				}

				foreach ($requirements as $link) {
					if (preg_match('#' . $element . '#', $link->getTarget())) {
						$package_map[$link->getTarget()] = $value;
					}
				}

				$package_map[$element] = $value;

			} elseif (is_string($value)) {

				if (!isset($package_map[$package->getName()])) {
					$package_map[$package->getName()] = array();
				}

				$package_map[$package->getName()][$element] = $value;

			} else {
				throw new \Exception (sprintf(
					'Ivalid element %s of type %s', $element, gettype($value)
				));
			}
		}

		return $package_map;
	}
private function buildPackageMap ( $ package ) { $ package_map = array ( ) ; $ requirements = $ package -> getRequires ( ) ; $ extra = $ package -> getExtra ( ) ; $ mappings = $ extra [ self :: NAME ] [ $ this -> framework ] ; foreach ( $ mappings as $ element => $ value ) { if ( is_array ( $ value ) ) { // // Check for external mapping support // if ( $ element != $ package -> getName ( ) && ! $ this -> externalMapping ) { throw new \ Exception ( sprintf ( 'Cannot perform external mapping for %s, disabled' , $ element ) ) ; } if ( strpos ( $ element , '*' ) !== FALSE ) { $ parts = explode ( '*' , $ element ) ; $ parts = array_map ( function ( $ v ) { return preg_quote ( $ v , '#' ) ; } , $ parts ) ; $ element = implode ( '(.*)' , $ parts ) ; } foreach ( $ requirements as $ link ) { if ( preg_match ( '#' . $ element . '#' , $ link -> getTarget ( ) ) ) { $ package_map [ $ link -> getTarget ( ) ] = $ value ; } } $ package_map [ $ element ] = $ value ; } elseif ( is_string ( $ value ) ) { if ( ! isset ( $ package_map [ $ package -> getName ( ) ] ) ) { $ package_map [ $ package -> getName ( ) ] = array ( ) ; } $ package_map [ $ package -> getName ( ) ] [ $ element ] = $ value ; } else { throw new \ Exception ( sprintf ( 'Ivalid element %s of type %s' , $ element , gettype ( $ value ) ) ) ; } } return $ package_map ; }
Builds a package map

The package map is an array of packages to their installation sources and destinations.
This will resolve any globs for external integration packages.  An external integration
package *cannot* handle installation of a package it does not depend on, so it looks
through the requires to determine this.

@access private
@param PackageInterface $package The package to build a map for
@return array The package map
Builds a package map