mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-11 02:36:42 +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,14 +8,15 @@
|
|||
|
||||
namespace Analytics\Controllers;
|
||||
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Exceptions\PageNotFoundException;
|
||||
use CodeIgniter\Controller;
|
||||
use CodeIgniter\Exceptions\PageNotFoundException;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class AnalyticsController extends Controller
|
||||
{
|
||||
protected Model $analyticsModel;
|
||||
|
||||
protected string $methodName = '';
|
||||
|
||||
public function _remap(string $method, string ...$params): mixed
|
||||
|
|
@ -27,26 +28,20 @@ class AnalyticsController extends Controller
|
|||
$this->analyticsModel = model('Analytics' . $params[1] . 'Model');
|
||||
$this->methodName = 'getData' . (count($params) >= 3 ? $params[2] : '');
|
||||
|
||||
return $this->$method(
|
||||
return $this->{$method}(
|
||||
$params[0],
|
||||
count($params) >= 4 ? $params[3] : null,
|
||||
);
|
||||
}
|
||||
|
||||
public function getData(
|
||||
int $podcastId,
|
||||
?int $episodeId = null
|
||||
): ResponseInterface {
|
||||
public function getData(int $podcastId, ?int $episodeId = null): ResponseInterface
|
||||
{
|
||||
$methodName = $this->methodName;
|
||||
|
||||
if ($episodeId === null) {
|
||||
return $this->response->setJSON(
|
||||
$this->analyticsModel->$methodName($podcastId),
|
||||
);
|
||||
return $this->response->setJSON($this->analyticsModel->{$methodName}($podcastId),);
|
||||
}
|
||||
|
||||
return $this->response->setJSON(
|
||||
$this->analyticsModel->$methodName($podcastId, $episodeId),
|
||||
);
|
||||
return $this->response->setJSON($this->analyticsModel->{$methodName}($podcastId, $episodeId),);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue