Add PSR-12

This commit is contained in:
Daniel Siepmann 2020-02-25 20:06:38 +01:00
parent 73ec4641ff
commit 50dcb619ea
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
6 changed files with 54 additions and 8 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
/.Build/ /.Build/
/composer.lock /composer.lock
/vendor/

View file

@ -21,15 +21,16 @@ namespace DanielSiepmann\Tracking\Dashboard\Widgets;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
use DanielSiepmann\Tracking\Extension;
use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\Query\QueryBuilder; use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Dashboard\Widgets\AbstractBarChartWidget; use TYPO3\CMS\Dashboard\Widgets\AbstractBarChartWidget;
class PageViewsBar extends AbstractBarChartWidget class PageViewsBar extends AbstractBarChartWidget
{ {
protected $title = 'LLL:EXT:tracking/Resources/Private/Language/locallang.xlf:dashboard.widgets.pageViewsBar.title'; protected $title = Extension::LANGUAGE_PATH . ':dashboard.widgets.pageViewsBar.title';
protected $description = 'LLL:EXT:tracking/Resources/Private/Language/locallang.xlf:dashboard.widgets.pageViewsBar.description'; protected $description = Extension::LANGUAGE_PATH . ':trackingdashboard.widgets.pageViewsBar.description';
protected $width = 2; protected $width = 2;

View file

@ -21,6 +21,7 @@ namespace DanielSiepmann\Tracking\Dashboard\Widgets;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
use DanielSiepmann\Tracking\Extension;
use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\ParameterType;
use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\Query\QueryBuilder; use TYPO3\CMS\Core\Database\Query\QueryBuilder;
@ -28,9 +29,9 @@ use TYPO3\CMS\Dashboard\Widgets\AbstractDoughnutChartWidget;
class PageViewsPerPageDoughnut extends AbstractDoughnutChartWidget class PageViewsPerPageDoughnut extends AbstractDoughnutChartWidget
{ {
protected $title = 'LLL:EXT:tracking/Resources/Private/Language/locallang.xlf:dashboard.widgets.pageViewsPerPageDoughnut.title'; protected $title = Extension::LANGUAGE_PATH . ':dashboard.widgets.pageViewsPerPageDoughnut.title';
protected $description = 'LLL:EXT:tracking/Resources/Private/Language/locallang.xlf:dashboard.widgets.pageViewsPerPageDoughnut.description'; protected $description = Extension::LANGUAGE_PATH . ':dashboard.widgets.pageViewsPerPageDoughnut.description';
/** /**
* @var QueryBuilder * @var QueryBuilder

29
Classes/Extension.php Normal file
View file

@ -0,0 +1,29 @@
<?php
namespace DanielSiepmann\Tracking;
/*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
final class Extension
{
public const EXT_KEY = 'tracking';
public const LANGUAGE_PATH = 'LLL:EXT:' . self::EXT_KEY . 'tracking/Resources/Private/Language/locallang.xlf';
}

View file

@ -26,10 +26,6 @@
"suggest": { "suggest": {
"typo3/cms-dashboard": "To make use of provided TYPO3 widgets" "typo3/cms-dashboard": "To make use of provided TYPO3 widgets"
}, },
"config": {
"vendor-dir": ".Build/vendor",
"bin-dir": ".Build/bin"
},
"extra": { "extra": {
"typo3/cms": { "typo3/cms": {
"cms-package-dir": "{$vendor-dir}/typo3/cms", "cms-package-dir": "{$vendor-dir}/typo3/cms",
@ -45,5 +41,8 @@
"mkdir -p .Build/web/typo3conf/ext/", "mkdir -p .Build/web/typo3conf/ext/",
"[ -L .Build/web/typo3conf/ext/tracking ] || ln -snvf ../../../../. .Build/web/typo3conf/ext/tracking" "[ -L .Build/web/typo3conf/ext/tracking ] || ln -snvf ../../../../. .Build/web/typo3conf/ext/tracking"
] ]
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5"
} }
} }

15
phpcs.xml.dist Normal file
View file

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<ruleset name="project">
<description>This project coding standard</description>
<file>Classes/</file>
<!-- Set default settings -->
<arg value="sp"/>
<arg name="colors"/>
<arg name="encoding" value="utf-8" />
<arg name="extensions" value="php" />
<!-- Base rules -->
<rule ref="PSR12" />
</ruleset>