/**
  * @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 getSitegearVendorResourcesRoot()
 {
     return sprintf('%s/%s', $this->engine->getSiteInfo()->getSiteRoot(), $this->engine->config('system.resources.vendor-resources'));
 }
 /**
  * @inheritdoc
  */
 public function getArguments(Request $request, $controller)
 {
     return TypeUtilities::getArguments($controller, null, array($this->engine->getViewFactory()->getPage(), $request), $request->attributes->get('_route_params') ?: array());
 }