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
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Class AnalyticsPodcastByEpisodeModel
|
||||
* Model for analytics_podcasts_by_episodes table in database
|
||||
* Class AnalyticsPodcastByEpisodeModel Model for analytics_podcasts_by_episodes table in database
|
||||
*
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
* @link https://castopod.org/
|
||||
|
|
@ -24,6 +24,7 @@ class AnalyticsPodcastByEpisodeModel extends Model
|
|||
* @var string
|
||||
*/
|
||||
protected $returnType = AnalyticsPodcastsByEpisode::class;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
|
|
@ -40,9 +41,7 @@ class AnalyticsPodcastByEpisodeModel extends Model
|
|||
public function getDataByDay(int $podcastId, int $episodeId): array
|
||||
{
|
||||
if (
|
||||
!($found = cache(
|
||||
"{$podcastId}_{$episodeId}_analytics_podcast_by_episode_by_day",
|
||||
))
|
||||
! ($found = cache("{$podcastId}_{$episodeId}_analytics_podcast_by_episode_by_day",))
|
||||
) {
|
||||
$found = $this->select('date as labels')
|
||||
->selectSum('hits', 'values')
|
||||
|
|
@ -55,11 +54,8 @@ class AnalyticsPodcastByEpisodeModel extends Model
|
|||
->orderBy('labels', 'ASC')
|
||||
->findAll();
|
||||
|
||||
cache()->save(
|
||||
"{$podcastId}_{$episodeId}_analytics_podcast_by_episode_by_day",
|
||||
$found,
|
||||
600,
|
||||
);
|
||||
cache()
|
||||
->save("{$podcastId}_{$episodeId}_analytics_podcast_by_episode_by_day", $found, 600,);
|
||||
}
|
||||
|
||||
return $found;
|
||||
|
|
@ -71,9 +67,7 @@ class AnalyticsPodcastByEpisodeModel extends Model
|
|||
public function getDataByMonth(int $podcastId, int $episodeId = null): array
|
||||
{
|
||||
if (
|
||||
!($found = cache(
|
||||
"{$podcastId}_{$episodeId}_analytics_podcast_by_episode_by_month",
|
||||
))
|
||||
! ($found = cache("{$podcastId}_{$episodeId}_analytics_podcast_by_episode_by_month",))
|
||||
) {
|
||||
$found = $this->select('DATE_FORMAT(date,"%Y-%m-01") as labels')
|
||||
->selectSum('hits', 'values')
|
||||
|
|
@ -85,11 +79,8 @@ class AnalyticsPodcastByEpisodeModel extends Model
|
|||
->orderBy('labels', 'ASC')
|
||||
->findAll();
|
||||
|
||||
cache()->save(
|
||||
"{$podcastId}_{$episodeId}_analytics_podcast_by_episode_by_month",
|
||||
$found,
|
||||
600,
|
||||
);
|
||||
cache()
|
||||
->save("{$podcastId}_{$episodeId}_analytics_podcast_by_episode_by_month", $found, 600,);
|
||||
}
|
||||
|
||||
return $found;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue