summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2018-08-06 12:57:48 +0200
committermsquare <msquare@notrademark.de>2018-08-06 12:57:48 +0200
commit9496e3571168feff780f6efb17ddc00c670e2dee (patch)
tree7313a4fecc2da111a199e727b12e88346d5db230
parent86b29370786de35cc40e3424e09c3cf48551ee28 (diff)
added comments and renamed short method to url generators
-rw-r--r--includes/model/User_model.php2
-rw-r--r--src/Routing/LegacyUrlGenerator.php4
-rw-r--r--src/Routing/UrlGenerator.php2
-rw-r--r--src/Routing/UrlGeneratorInterface.php2
-rw-r--r--src/helpers.php2
-rw-r--r--tests/Unit/HelpersTest.php2
-rw-r--r--tests/Unit/Routing/LegacyUrlGeneratorTest.php2
-rw-r--r--tests/Unit/Routing/UrlGeneratorTest.php2
8 files changed, 9 insertions, 9 deletions
diff --git a/includes/model/User_model.php b/includes/model/User_model.php
index 5a31e7b8..7ea3ca3e 100644
--- a/includes/model/User_model.php
+++ b/includes/model/User_model.php
@@ -33,7 +33,7 @@ function User_tshirt_score($user) {
WHERE `User`.`UID` = ?
AND `Shifts`.`end` < ?
GROUP BY `User`.`UID`
- ',[
+ ', [
$user['UID'],
time()
]);
diff --git a/src/Routing/LegacyUrlGenerator.php b/src/Routing/LegacyUrlGenerator.php
index e2434e1f..4c1e736b 100644
--- a/src/Routing/LegacyUrlGenerator.php
+++ b/src/Routing/LegacyUrlGenerator.php
@@ -14,7 +14,7 @@ class LegacyUrlGenerator extends UrlGenerator
* @param array $parameters
* @return string urls in the form <app url>/index.php?p=<path>&<parameters>
*/
- public function link_to($path, $parameters = [])
+ public function linkTo($path, $parameters = [])
{
$page = ltrim($path, '/');
if (!empty($page)) {
@@ -22,7 +22,7 @@ class LegacyUrlGenerator extends UrlGenerator
$parameters = array_merge(['p' => $page], $parameters);
}
- $uri = parent::link_to('index.php', $parameters);
+ $uri = parent::linkTo('index.php', $parameters);
$uri = preg_replace('~(/index\.php)+~', '/index.php', $uri);
return $uri;
diff --git a/src/Routing/UrlGenerator.php b/src/Routing/UrlGenerator.php
index a8fc88c1..188bac3b 100644
--- a/src/Routing/UrlGenerator.php
+++ b/src/Routing/UrlGenerator.php
@@ -14,7 +14,7 @@ class UrlGenerator implements UrlGeneratorInterface
* @param array $parameters
* @return string url in the form [app url]/[path]?[parameters]
*/
- public function link_to($path, $parameters = [])
+ public function linkTo($path, $parameters = [])
{
$path = '/' . ltrim($path, '/');
$request = app('request');
diff --git a/src/Routing/UrlGeneratorInterface.php b/src/Routing/UrlGeneratorInterface.php
index 17385bc2..f1a8ffed 100644
--- a/src/Routing/UrlGeneratorInterface.php
+++ b/src/Routing/UrlGeneratorInterface.php
@@ -12,5 +12,5 @@ interface UrlGeneratorInterface
* @param array $parameters
* @return string
*/
- public function link_to($path, $parameters = []);
+ public function linkTo($path, $parameters = []);
}
diff --git a/src/helpers.php b/src/helpers.php
index 8b1f0cee..8d8f74e1 100644
--- a/src/helpers.php
+++ b/src/helpers.php
@@ -124,7 +124,7 @@ function url($path = null, $parameters = [])
return $urlGenerator;
}
- return $urlGenerator->link_to($path, $parameters);
+ return $urlGenerator->linkTo($path, $parameters);
}
/**
diff --git a/tests/Unit/HelpersTest.php b/tests/Unit/HelpersTest.php
index 01ff99b1..9514ad8c 100644
--- a/tests/Unit/HelpersTest.php
+++ b/tests/Unit/HelpersTest.php
@@ -177,7 +177,7 @@ class HelpersTest extends TestCase
$this->assertEquals($urlGeneratorMock, url());
$urlGeneratorMock->expects($this->once())
- ->method('link_to')
+ ->method('linkTo')
->with('foo/bar', ['param' => 'value'])
->willReturn('http://lorem.ipsum/foo/bar?param=value');
diff --git a/tests/Unit/Routing/LegacyUrlGeneratorTest.php b/tests/Unit/Routing/LegacyUrlGeneratorTest.php
index 7c28eaed..9576a260 100644
--- a/tests/Unit/Routing/LegacyUrlGeneratorTest.php
+++ b/tests/Unit/Routing/LegacyUrlGeneratorTest.php
@@ -48,7 +48,7 @@ class LegacyUrlGeneratorTest extends TestCase
$urlGenerator = new LegacyUrlGenerator();
$this->assertInstanceOf(UrlGeneratorInterface::class, $urlGenerator);
- $url = $urlGenerator->link_to($urlToPath, $arguments);
+ $url = $urlGenerator->linkTo($urlToPath, $arguments);
$this->assertEquals($expectedUrl, $url);
}
}
diff --git a/tests/Unit/Routing/UrlGeneratorTest.php b/tests/Unit/Routing/UrlGeneratorTest.php
index 34c2f610..ddb6c975 100644
--- a/tests/Unit/Routing/UrlGeneratorTest.php
+++ b/tests/Unit/Routing/UrlGeneratorTest.php
@@ -48,7 +48,7 @@ class UrlGeneratorTest extends TestCase
$urlGenerator = new UrlGenerator();
$this->assertInstanceOf(UrlGeneratorInterface::class, $urlGenerator);
- $url = $urlGenerator->link_to($urlToPath, $arguments);
+ $url = $urlGenerator->linkTo($urlToPath, $arguments);
$this->assertEquals($expectedUrl, $url);
}
}