summaryrefslogtreecommitdiff
path: root/src/Routing
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2018-09-07 20:50:31 +0200
committermsquare <msquare@notrademark.de>2018-09-07 20:50:31 +0200
commit2d6bca1357faff28bc1f86a56b432cc463ff7574 (patch)
treece18461d2e170ac28dd365342a1f125a8a31aa3a /src/Routing
parentb320fc779063ee80b8f0ba505cb323287ccccbf5 (diff)
parentce6d0fd13b54ac79a955b85d50860736a520d333 (diff)
Merge branch 'MyIgel-routing'
Diffstat (limited to 'src/Routing')
-rw-r--r--src/Routing/LegacyUrlGenerator.php31
-rw-r--r--src/Routing/RoutingServiceProvider.php24
-rw-r--r--src/Routing/UrlGenerator.php30
-rw-r--r--src/Routing/UrlGeneratorInterface.php16
4 files changed, 0 insertions, 101 deletions
diff --git a/src/Routing/LegacyUrlGenerator.php b/src/Routing/LegacyUrlGenerator.php
deleted file mode 100644
index fdac4f96..00000000
--- a/src/Routing/LegacyUrlGenerator.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-namespace Engelsystem\Routing;
-
-/**
- * Provides urls when webserver rewriting is disabled.
- *
- * The urls have the form <app url>/index.php?p=<path>&<parameters>
- */
-class LegacyUrlGenerator extends UrlGenerator
-{
- /**
- * @param string $path
- * @param array $parameters
- * @return string urls in the form <app url>/index.php?p=<path>&<parameters>
- */
- public function linkTo($path, $parameters = [])
- {
- $page = ltrim($path, '/');
- if (!empty($page)) {
- $page = str_replace('-', '_', $page);
- $parameters = array_merge(['p' => $page], $parameters);
- }
-
- $uri = parent::linkTo('index.php', $parameters);
- $uri = preg_replace('~(/index\.php)+~', '/index.php', $uri);
- $uri = preg_replace('~(/index\.php)$~', '/', $uri);
-
- return $uri;
- }
-}
diff --git a/src/Routing/RoutingServiceProvider.php b/src/Routing/RoutingServiceProvider.php
deleted file mode 100644
index beaa6a94..00000000
--- a/src/Routing/RoutingServiceProvider.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-namespace Engelsystem\Routing;
-
-use Engelsystem\Container\ServiceProvider;
-
-/**
- * Registers the url generator depending on config.
- */
-class RoutingServiceProvider extends ServiceProvider
-{
-
- public function register()
- {
- $config = $this->app->get('config');
- $class = UrlGenerator::class;
- if (! $config->get('rewrite_urls', true)) {
- $class = LegacyUrlGenerator::class;
- }
-
- $urlGenerator = $this->app->make($class);
- $this->app->instance('routing.urlGenerator', $urlGenerator);
- $this->app->bind(UrlGeneratorInterface::class, 'routing.urlGenerator');
- }
-}
diff --git a/src/Routing/UrlGenerator.php b/src/Routing/UrlGenerator.php
deleted file mode 100644
index 188bac3b..00000000
--- a/src/Routing/UrlGenerator.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-namespace Engelsystem\Routing;
-
-/**
- * Provides urls when rewriting on the webserver is enabled. (default)
- *
- * The urls have the form <app url>/<path>?<parameters>
- */
-class UrlGenerator implements UrlGeneratorInterface
-{
- /**
- * @param string $path
- * @param array $parameters
- * @return string url in the form [app url]/[path]?[parameters]
- */
- public function linkTo($path, $parameters = [])
- {
- $path = '/' . ltrim($path, '/');
- $request = app('request');
- $uri = $request->getUriForPath($path);
-
- if (!empty($parameters) && is_array($parameters)) {
- $parameters = http_build_query($parameters);
- $uri .= '?' . $parameters;
- }
-
- return $uri;
- }
-}
diff --git a/src/Routing/UrlGeneratorInterface.php b/src/Routing/UrlGeneratorInterface.php
deleted file mode 100644
index f1a8ffed..00000000
--- a/src/Routing/UrlGeneratorInterface.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-namespace Engelsystem\Routing;
-
-/**
- * To switch between different URL schemes.
- */
-interface UrlGeneratorInterface
-{
- /**
- * @param string $path
- * @param array $parameters
- * @return string
- */
- public function linkTo($path, $parameters = []);
-}