mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-14 12:07: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,33 +8,28 @@
|
|||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use App\Entities\Podcast;
|
||||
use CodeIgniter\Exceptions\PageNotFoundException;
|
||||
use App\Models\PlatformModel;
|
||||
use App\Models\PodcastModel;
|
||||
use CodeIgniter\Exceptions\PageNotFoundException;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use Config\Services;
|
||||
|
||||
class PodcastPlatformController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var Podcast|null
|
||||
*/
|
||||
protected ?Podcast $podcast;
|
||||
|
||||
public function _remap(string $method, string ...$params): mixed
|
||||
{
|
||||
if (count($params) === 0) {
|
||||
return $this->$method();
|
||||
return $this->{$method}();
|
||||
}
|
||||
|
||||
if (
|
||||
($this->podcast = (new PodcastModel())->getPodcastById(
|
||||
(int) $params[0],
|
||||
)) !== null
|
||||
($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0],)) !== null
|
||||
) {
|
||||
unset($params[0]);
|
||||
return $this->$method(...$params);
|
||||
return $this->{$method}(...$params);
|
||||
}
|
||||
|
||||
throw PageNotFoundException::forPageNotFound();
|
||||
|
|
@ -52,19 +47,17 @@ class PodcastPlatformController extends BaseController
|
|||
$data = [
|
||||
'podcast' => $this->podcast,
|
||||
'platformType' => $platformType,
|
||||
'platforms' => (new PlatformModel())->getPlatformsWithLinks(
|
||||
$this->podcast->id,
|
||||
$platformType,
|
||||
),
|
||||
'platforms' => (new PlatformModel())->getPlatformsWithLinks($this->podcast->id, $platformType,),
|
||||
];
|
||||
|
||||
replace_breadcrumb_params([0 => $this->podcast->title]);
|
||||
replace_breadcrumb_params([
|
||||
0 => $this->podcast->title,
|
||||
]);
|
||||
return view('admin/podcast/platforms', $data);
|
||||
}
|
||||
|
||||
public function attemptPlatformsUpdate(
|
||||
string $platformType
|
||||
): RedirectResponse {
|
||||
public function attemptPlatformsUpdate(string $platformType): RedirectResponse
|
||||
{
|
||||
$platformModel = new PlatformModel();
|
||||
$validation = Services::validation();
|
||||
|
||||
|
|
@ -78,7 +71,7 @@ class PodcastPlatformController extends BaseController
|
|||
if ($podcastPlatformUrl === null) {
|
||||
continue;
|
||||
}
|
||||
if (!$validation->check($podcastPlatformUrl, 'validate_url')) {
|
||||
if (! $validation->check($podcastPlatformUrl, 'validate_url')) {
|
||||
continue;
|
||||
}
|
||||
$podcastsPlatformsData[] = [
|
||||
|
|
@ -88,36 +81,28 @@ class PodcastPlatformController extends BaseController
|
|||
'link_content' => $podcastPlatform['content'],
|
||||
'is_visible' =>
|
||||
array_key_exists('visible', $podcastPlatform) &&
|
||||
$podcastPlatform['visible'] == 'yes',
|
||||
$podcastPlatform['visible'] === 'yes',
|
||||
'is_on_embeddable_player' =>
|
||||
array_key_exists(
|
||||
'on_embeddable_player',
|
||||
$podcastPlatform,
|
||||
) && $podcastPlatform['on_embeddable_player'] == 'yes',
|
||||
) && $podcastPlatform['on_embeddable_player'] === 'yes',
|
||||
];
|
||||
return redirect()
|
||||
->back()
|
||||
->with('message', lang('Platforms.messages.updateSuccess'));
|
||||
}
|
||||
|
||||
$platformModel->savePodcastPlatforms(
|
||||
$this->podcast->id,
|
||||
$platformType,
|
||||
$podcastsPlatformsData,
|
||||
);
|
||||
$platformModel->savePodcastPlatforms($this->podcast->id, $platformType, $podcastsPlatformsData,);
|
||||
|
||||
return redirect()
|
||||
->back()
|
||||
->with('message', lang('Platforms.messages.updateSuccess'));
|
||||
}
|
||||
|
||||
public function removePodcastPlatform(
|
||||
string $platformSlug
|
||||
): RedirectResponse {
|
||||
(new PlatformModel())->removePodcastPlatform(
|
||||
$this->podcast->id,
|
||||
$platformSlug,
|
||||
);
|
||||
public function removePodcastPlatform(string $platformSlug): RedirectResponse
|
||||
{
|
||||
(new PlatformModel())->removePodcastPlatform($this->podcast->id, $platformSlug,);
|
||||
|
||||
return redirect()
|
||||
->back()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue