mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-16 04:57:46 +02:00
style(ecs): add easy-coding-standard to enforce coding style rules for php
- update .devcontainer settings: remove auto-formatting for php + set intelephense as default formatter - remove prettier php plugin as it lacks php 8 support - add captain hook action for checking style pre-commit - fix style with ecs on all files except views
This commit is contained in:
parent
fb3593f828
commit
aa1612342e
230 changed files with 3420 additions and 5884 deletions
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use App\Entities\Page;
|
||||
use CodeIgniter\Exceptions\PageNotFoundException;
|
||||
use App\Models\PageModel;
|
||||
use CodeIgniter\Exceptions\PageNotFoundException;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
|
||||
class PageController extends BaseController
|
||||
{
|
||||
|
|
@ -20,17 +20,17 @@ class PageController extends BaseController
|
|||
public function _remap(string $method, string ...$params): mixed
|
||||
{
|
||||
if (count($params) === 0) {
|
||||
return $this->$method();
|
||||
return $this->{$method}();
|
||||
}
|
||||
|
||||
if ($this->page = (new PageModel())->find($params[0])) {
|
||||
return $this->$method();
|
||||
return $this->{$method}();
|
||||
}
|
||||
|
||||
throw PageNotFoundException::forPageNotFound();
|
||||
}
|
||||
|
||||
function list(): string
|
||||
public function list(): string
|
||||
{
|
||||
$data = [
|
||||
'pages' => (new PageModel())->findAll(),
|
||||
|
|
@ -39,19 +39,21 @@ class PageController extends BaseController
|
|||
return view('admin/page/list', $data);
|
||||
}
|
||||
|
||||
function view(): string
|
||||
public function view(): string
|
||||
{
|
||||
return view('admin/page/view', ['page' => $this->page]);
|
||||
return view('admin/page/view', [
|
||||
'page' => $this->page,
|
||||
]);
|
||||
}
|
||||
|
||||
function create(): string
|
||||
public function create(): string
|
||||
{
|
||||
helper('form');
|
||||
|
||||
return view('admin/page/create');
|
||||
}
|
||||
|
||||
function attemptCreate(): RedirectResponse
|
||||
public function attemptCreate(): RedirectResponse
|
||||
{
|
||||
$page = new Page([
|
||||
'title' => $this->request->getPost('title'),
|
||||
|
|
@ -61,7 +63,7 @@ class PageController extends BaseController
|
|||
|
||||
$pageModel = new PageModel();
|
||||
|
||||
if (!$pageModel->insert($page)) {
|
||||
if (! $pageModel->insert($page)) {
|
||||
return redirect()
|
||||
->back()
|
||||
->withInput()
|
||||
|
|
@ -70,23 +72,24 @@ class PageController extends BaseController
|
|||
|
||||
return redirect()
|
||||
->route('page-list')
|
||||
->with(
|
||||
'message',
|
||||
lang('Page.messages.createSuccess', [
|
||||
'pageTitle' => $page->title,
|
||||
]),
|
||||
);
|
||||
->with('message', lang('Page.messages.createSuccess', [
|
||||
'pageTitle' => $page->title,
|
||||
]),);
|
||||
}
|
||||
|
||||
function edit(): string
|
||||
public function edit(): string
|
||||
{
|
||||
helper('form');
|
||||
|
||||
replace_breadcrumb_params([0 => $this->page->title]);
|
||||
return view('admin/page/edit', ['page' => $this->page]);
|
||||
replace_breadcrumb_params([
|
||||
0 => $this->page->title,
|
||||
]);
|
||||
return view('admin/page/edit', [
|
||||
'page' => $this->page,
|
||||
]);
|
||||
}
|
||||
|
||||
function attemptEdit(): RedirectResponse
|
||||
public function attemptEdit(): RedirectResponse
|
||||
{
|
||||
$this->page->title = $this->request->getPost('title');
|
||||
$this->page->slug = $this->request->getPost('slug');
|
||||
|
|
@ -94,7 +97,7 @@ class PageController extends BaseController
|
|||
|
||||
$pageModel = new PageModel();
|
||||
|
||||
if (!$pageModel->update($this->page->id, $this->page)) {
|
||||
if (! $pageModel->update($this->page->id, $this->page)) {
|
||||
return redirect()
|
||||
->back()
|
||||
->withInput()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue