mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
[BUGFIX] Bugfixes and optimisations
- When no parameter is recieved, router now returns null instead of empty string. - json method in Response class now stops response after execution. - Updated composer.json with correct autoload.
This commit is contained in:
@@ -54,12 +54,11 @@ class Response {
|
||||
/**
|
||||
* Json encode array
|
||||
* @param array $value
|
||||
* @return self $this
|
||||
*/
|
||||
public function json(array $value) {
|
||||
$this->header('Content-type: application/json');
|
||||
echo json_encode($value);
|
||||
return $this;
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -90,8 +90,8 @@ class RouterRoute extends RouterEntry {
|
||||
}
|
||||
}
|
||||
|
||||
// Add parameter value
|
||||
$parameters[$parameter] = $parameterValue;
|
||||
// Add parameter value, if it doesn't exist - replace it with null value
|
||||
$parameters[$parameter] = ($parameterValue === '') ? null : $parameterValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,5 +160,4 @@ class RouterRoute extends RouterEntry {
|
||||
return parent::setSettings($settings);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user