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:
Yassine Doghri 2021-05-19 16:35:13 +00:00
commit aa1612342e
No known key found for this signature in database
GPG key ID: 3E7F89498B960C9F
230 changed files with 3420 additions and 5884 deletions

View file

@ -1,8 +1,8 @@
<?php
/**
* Class AnalyticsPodcastByCountryModel
* Model for analytics_podcasts_by_country table in database
* Class AnalyticsPodcastByCountryModel Model for analytics_podcasts_by_country 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 AnalyticsPodcastByCountryModel extends Model
* @var string
*/
protected $returnType = AnalyticsPodcastsByCountry::class;
/**
* @var bool
*/
@ -42,9 +43,7 @@ class AnalyticsPodcastByCountryModel extends Model
public function getDataWeekly(int $podcastId): array
{
if (
!($found = cache(
"{$podcastId}_analytics_podcast_by_country_weekly",
))
! ($found = cache("{$podcastId}_analytics_podcast_by_country_weekly",))
) {
$oneWeekAgo = date('Y-m-d', strtotime('-1 week'));
$found = $this->select('country_code as labels')
@ -57,11 +56,8 @@ class AnalyticsPodcastByCountryModel extends Model
->orderBy('values', 'DESC')
->findAll();
cache()->save(
"{$podcastId}_analytics_podcast_by_country_weekly",
$found,
600,
);
cache()
->save("{$podcastId}_analytics_podcast_by_country_weekly", $found, 600,);
}
return $found;
@ -75,9 +71,7 @@ class AnalyticsPodcastByCountryModel extends Model
public function getDataYearly(int $podcastId): array
{
if (
!($found = cache(
"{$podcastId}_analytics_podcast_by_country_yearly",
))
! ($found = cache("{$podcastId}_analytics_podcast_by_country_yearly",))
) {
$oneYearAgo = date('Y-m-d', strtotime('-1 year'));
$found = $this->select('country_code as labels')
@ -90,11 +84,8 @@ class AnalyticsPodcastByCountryModel extends Model
->orderBy('values', 'DESC')
->findAll();
cache()->save(
"{$podcastId}_analytics_podcast_by_country_yearly",
$found,
600,
);
cache()
->save("{$podcastId}_analytics_podcast_by_country_yearly", $found, 600,);
}
return $found;
}