/** * Get the base directory for the type/lookup info provided * * @param DirectoryMapper $mapper * @param $type * @param array $lookup * * @return null|string */ public function getBasePath(DirectoryMapper $mapper, $type, array $lookup) { $cache = $type . '-' . implode('.', $lookup); //If the path is cached, return it if (isset($this->_baseHash[$cache])) { return $this->_baseHash[$cache]; } $parts = array_merge([$type], $lookup); switch ($type) { case DirectoryMapper::MAP_ALIAS: $this->_baseHash[$cache] = $mapper->aliasPath($parts); break; case DirectoryMapper::MAP_SOURCE: $this->_baseHash[$cache] = $mapper->sourcePath(); break; case DirectoryMapper::MAP_ASSET: $this->_baseHash[$cache] = $mapper->assetPath(); break; case DirectoryMapper::MAP_VENDOR: $this->_baseHash[$cache] = $mapper->vendorPath($parts); break; } //Return the cache return isset($this->_baseHash[$cache]) ? $this->_baseHash[$cache] : null; }