import($resource); /** @var Route $importedRoute */ foreach ($importedRoutes as $importedRoute) { $path = $importedRoute->getPath(); if (!\in_array($path, ['/', ''], true)) { $path = rtrim($path, '/'); if (!pathinfo($path, PATHINFO_EXTENSION)) { $path .= '.json'; } $importedRoute->setPath($path); } } return $importedRoutes; } /** * Returns whether this class supports the given resource. * * @param mixed $resource A resource * @param string|null $type The resource type or null if unknown * * @return bool True if this class supports the given resource, false otherwise */ public function supports($resource, $type = null): bool { return 'json_extension' === $type; } }