/**
  * @inheritdoc
  */
 public function getPublicPath($location, $resource, ModuleInterface $module = null)
 {
     // Ensure the passed-in resource has no leading slashes and no surrounding whitespace
     $resource = ltrim(trim($resource), '/');
     switch ($location) {
         case ResourceLocations::RESOURCE_LOCATION_SITE:
             $root = $this->getSiteRoot();
             break;
         case ResourceLocations::RESOURCE_LOCATION_VENDOR:
             $root = $this->engine->getApplicationInfo()->getSitegearVendorResourcesRoot();
             break;
         case ResourceLocations::RESOURCE_LOCATION_MODULE:
             $root = sprintf('%s/%s', $module->getModuleRoot(), ResourceLocations::RESOURCES_DIRECTORY);
             break;
         case ResourceLocations::RESOURCE_LOCATION_ENGINE:
             $root = sprintf('%s/%s', $this->engine->getEngineRoot(), ResourceLocations::RESOURCES_DIRECTORY);
             break;
         default:
             throw new \InvalidArgumentException(sprintf('Cannot find public resource in unknown location "%s"', $location));
     }
     // Ensure the configured public path ends with a single trailing slash and return the result
     return sprintf('%s/public/%s', $root, $resource);
 }
 /**
  * @inheritdoc
  */
 public function getSitegearRoot()
 {
     return dirname(dirname(dirname($this->engine->getEngineRoot())));
 }