Compare commits

...

7 Commits

Author SHA1 Message Date
jay a16a554457 typos 2026-08-15 13:18:10 -04:00
jay 2b47495d60 remove space 2026-08-15 13:15:05 -04:00
jay ad53457ca2 make not static and public 2026-08-15 13:14:40 -04:00
jay 3213c0f84f make methods public 2026-08-14 18:43:38 -04:00
jay 735c111e12 change mapRoutes to protected 2026-08-14 18:39:42 -04:00
jay fdf0f55b8d correct use 2026-08-14 18:35:26 -04:00
jay ec798515d1 "psr/http-message": "^1.1.0" 2026-08-14 18:30:45 -04:00
2 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -19,7 +19,7 @@
"potter/controller": ">=0.0.1",
"potter/response": ">=0.0.1",
"potter/router": ">=0.0.1",
"psr/http-message": "^2.0.0",
"psr/http-message": "^1.1.0",
"twbs/bootstrap": "^5.3.8"
}
}
+9 -9
View File
@@ -4,28 +4,28 @@ declare(strict_types=1);
namespace Potter;
use \Potter\Response\Text,
\Psr\Http\Message\{ResponseInterface, ServerRequestInterface};
use \Potter\Response\Text;
use \Psr\Http\Message\{ResponseInterface, ServerRequestInterface};
final class Bootstrap extends Controller
{
static private function getBootstrapScript(ServerRequestInterface $request): ResponseInterface
public function getBootstrapScript(ServerRequestInterface $request): ResponseInterface
{
return new Text(
text: file_get_contents(getcwd() . '/vendor/twbs/bootstrap/dist/jss/bootstrap.js'),
text: file_get_contents(getcwd() . '/vendor/twbs/bootstrap/dist/js/bootstrap.js'),
headers: ['Content-Type' => ['application/javascript; charset=utf-8']]);
}
static private function getBootstrapStyle(ServerRequestInterface $request): ResponseInterface
public function getBootstrapStyle(ServerRequestInterface $request): ResponseInterface
{
return new Text(
text: file_get_contents(getcwd() . '/vendor/twbs/bootstrap/dist/jss/bootstrap.js'),
text: file_get_contents(getcwd() . '/vendor/twbs/bootstrap/dist/css/bootstrap.css'),
headers: ['Content-Type' => ['text/css; charset=utf-8']]);
}
static private function mapRoutes(Container $container, \Potter\Router\Router $router): void
protected function mapRoutes(Container $container, \Potter\Router\Router $router): void
{
$router->map('GET', '/bootstrap.js', [self::class, 'getBootstrapScript']);
$router->map('GET', '/bootstrap.css', [self::class, 'getBootstrapStyle']);
$router->map('GET', '/bootstrap.js', [$this, 'getBootstrapScript']);
$router->map('GET', '/bootstrap.css', [$this, 'getBootstrapStyle']);
}
}