for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace RuthgerIdema\UrlRewrite\Http;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Route;
use RuthgerIdema\UrlRewrite\Repositories\Interfaces\UrlRewriteInterface;
class UrlRewriteController
{
/** @var UrlRewriteInterface */
protected $repository;
public function __construct(
UrlRewriteInterface $repository
) {
$this->repository = $repository;
}
public function __invoke($url): object
if (! $urlRewrite = $this->repository->getByRequestPath($url)) {
abort(404);
if ($urlRewrite->isForward()) {
return $this->forwardResponse($urlRewrite->target_path);
return redirect($urlRewrite->target_path, $urlRewrite->getRedirectType());
protected function forwardResponse($url): Response
return Route::dispatch(
Request::create(
create()
Illuminate\Support\Facades\Request
createFreshMockInstance()
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.
'/'.ltrim($url, '/'),
request()->getMethod()
)
);
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.