Skip to content

Commit

Permalink
Merge branch '3.0.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurujai committed Jan 31, 2022
2 parents 74d18a9 + ec5f637 commit 8755cb5
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 11 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Code validation

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php-versions: ['7.4']

steps:
- name: Checkout
uses: actions/checkout@v2

- name: PHP validator
run: find . -type f -name "*.php" -print0 | xargs -0 -n1 -P8 php -l

- name: PHPCSFixer
uses: docker://oskarstark/php-cs-fixer-ga:3.1.0
with:
args: --config=.php-cs-fixer.dist.php --diff --dry-run
23 changes: 23 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
;

$config = new PhpCsFixer\Config();
return $config->setRules([
'@Symfony' => true,
'@PhpCsFixer' => true,
'array_syntax' => ['syntax' => 'short'],
'is_null' => true,
'list_syntax' => ['syntax' => 'short'],
'modernize_types_casting' => true,
'ternary_to_null_coalescing' => true,
'combine_nested_dirname' => true,
'phpdoc_types_order' => [
'null_adjustment' => 'always_last',
'sort_algorithm' => 'none',
],
])
->setFinder($finder)
->setRiskyAllowed(true)
;
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

11 changes: 9 additions & 2 deletions Controller/StatsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,21 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface;

/**
* @Route("/admin/stats")
* @Security("is_granted('ROLE_ACCESS_STATS')")
*/
class StatsController extends AbstractController
{
private $translator;

public function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
}

/**
* @Route("/series", name="pumukit_stats_series_index")
* @Route("/objects", name="pumukit_stats_mmobj_index")
Expand All @@ -25,7 +33,6 @@ class StatsController extends AbstractController
public function indexAction(Request $request): Response
{
$routeName = $request->get('_route');
$translator = $this->get('translator');

if ('pumukit_stats_series_index' === $routeName) {
$title = 'General Statistics for Series';
Expand All @@ -38,7 +45,7 @@ public function indexAction(Request $request): Response
}

return $this->render('@PumukitStatsUI/Stats/index.html.twig', [
'template_title' => $translator->trans($title),
'template_title' => $this->translator->trans($title),
]);
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"authors": [
{
"name": "Teltek Team",
"homepage": "http://teltek.es"
"homepage": "https://teltek.es"
}
],
"autoload": {
Expand Down

0 comments on commit 8755cb5

Please sign in to comment.