Compare commits

..

11 Commits

Author SHA1 Message Date
Simon Sessingø 847cb3e273 Merge pull request #655 from skipperbent/v5-development
Version 5.3.0.1
2023-04-08 20:00:55 +02:00
Simon Sessingø b937b610de Merge pull request #651 from skipperbent/v5-development
Version 5.3.0.0
2023-04-07 15:41:04 +02:00
Simon Sessingø fadb783d3c Merge pull request #647 from skipperbent/v5-development
Fixed Response not initialized + incorrect phpDoc.
2023-04-02 03:24:14 +02:00
Simon Sessingø 8477ea19d4 Merge pull request #645 from skipperbent/v5-development
Version 5.2.0.0
2023-04-02 03:20:01 +02:00
Simon Sessingø 4121011ef2 Merge pull request #642 from skipperbent/v5-development
Version 5.1.1.0
2023-03-30 16:26:44 +02:00
Simon Sessingø 5dbfc3dbfe Merge pull request #639 from skipperbent/v5-development
Version 5.1.0.0
2023-03-25 03:19:13 +01:00
Simon Sessingø 0aea8673d9 Merge pull request #632 from skipperbent/v5-development
Version 5.0.0.3
2023-02-13 14:06:24 +01:00
Simon Sessingø 9c66a4dfd8 Merge pull request #630 from skipperbent/v5-development
Version 5.0.0.2
2023-02-11 17:34:48 +01:00
Simon Sessingø d5bf77cbd4 Merge pull request #628 from skipperbent/v5-development
Fixed offsetGet return type deprication warning
2023-02-09 03:34:48 +01:00
Simon Sessingø 1e9fa9c6a1 Merge pull request #627 from skipperbent/v4-development
Version 5.0.0.0
2023-02-09 03:07:54 +01:00
Simon Sessingø 0630569f56 Merge pull request #592 from skipperbent/master
fixed json_encode 2nd parameter int flag issue in response and issue with offsetGet return type incompatibility
2023-02-09 02:30:02 +01:00
4 changed files with 28 additions and 44 deletions
-1
View File
@@ -89,7 +89,6 @@ class InputItem implements ArrayAccess, IInputItem, IteratorAggregate
return isset($this->value[$offset]);
}
#[\ReturnTypeWillChange]
public function offsetGet($offset): ?self
{
if ($this->offsetExists($offset) === true) {
+22 -25
View File
@@ -7,22 +7,22 @@ use Pecee\Http\Request;
class RouteResource extends LoadableRoute implements IControllerRoute
{
protected array $urls = [
'index' => '',
'create' => 'create',
'store' => '',
'show' => '',
'edit' => 'edit',
'update' => '',
'index' => '',
'create' => 'create',
'store' => '',
'show' => '',
'edit' => 'edit',
'update' => '',
'destroy' => '',
];
protected array $methodNames = [
'index' => 'index',
'create' => 'create',
'store' => 'store',
'show' => 'show',
'edit' => 'edit',
'update' => 'update',
'index' => 'index',
'create' => 'create',
'store' => 'store',
'show' => 'show',
'edit' => 'edit',
'update' => 'update',
'destroy' => 'destroy',
];
@@ -68,15 +68,12 @@ class RouteResource extends LoadableRoute implements IControllerRoute
*/
public function findUrl(?string $method = null, $parameters = null, ?string $name = null): string
{
$url = parent::findUrl($method, $parameters, $name);
$action = array_search($name, $this->names, true);
if ($action !== false) {
return $url . $this->urls[$action];
$url = array_search($name, $this->names, true);
if ($url !== false) {
return rtrim($this->url . $this->urls[$url], '/') . '/';
}
return $url;
return $this->url;
}
protected function call($method): bool
@@ -175,12 +172,12 @@ class RouteResource extends LoadableRoute implements IControllerRoute
$this->name = $name;
$this->names = [
'index' => $this->name . '.index',
'create' => $this->name . '.create',
'store' => $this->name . '.store',
'show' => $this->name . '.show',
'edit' => $this->name . '.edit',
'update' => $this->name . '.update',
'index' => $this->name . '.index',
'create' => $this->name . '.create',
'store' => $this->name . '.store',
'show' => $this->name . '.show',
'edit' => $this->name . '.edit',
'update' => $this->name . '.update',
'destroy' => $this->name . '.destroy',
];
+6 -2
View File
@@ -443,8 +443,12 @@ class Router
}
}
} catch (Exception $e) {
return $this->handleException($e);
} catch (\Throwable $e) {
if ($e instanceof Exception) {
return $this->handleException($e);
}
return $this->handleException(new Exception($e->getMessage(), $e->getCode()));
}
if ($methodNotAllowed === true) {
@@ -66,20 +66,4 @@ class RouterResourceTest extends \PHPUnit\Framework\TestCase
}
public function testResourceUrls()
{
TestRouter::resource('/resource', 'ResourceController')->name('resource');
TestRouter::debugOutputNoReset('/resource');
$this->assertEquals('/resource/3/create/', TestRouter::router()->getUrl('resource.create', ['id' => 3]));
$this->assertEquals('/resource/3/edit/', TestRouter::router()->getUrl('resource.edit', ['id' => 3]));
$this->assertEquals('/resource/3/', TestRouter::router()->getUrl('resource.update', ['id' => 3]));
$this->assertEquals('/resource/3/', TestRouter::router()->getUrl('resource.destroy', ['id' => 3]));
$this->assertEquals('/resource/3/', TestRouter::router()->getUrl('resource.delete', ['id' => 3]));
$this->assertEquals('/resource/', TestRouter::router()->getUrl('resource'));
TestRouter::router()->reset();
}
}