From 50dcb619ea40868c22cfbb1a7aa5a3decd8a4a93 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 25 Feb 2020 20:06:38 +0100 Subject: [PATCH] Add PSR-12 --- .gitignore | 1 + Classes/Dashboard/Widgets/PageViewsBar.php | 5 ++-- .../Widgets/PageViewsPerPageDoughnut.php | 5 ++-- Classes/Extension.php | 29 +++++++++++++++++++ composer.json | 7 ++--- phpcs.xml.dist | 15 ++++++++++ 6 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 Classes/Extension.php create mode 100644 phpcs.xml.dist diff --git a/.gitignore b/.gitignore index e951a59..51313d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /.Build/ /composer.lock +/vendor/ diff --git a/Classes/Dashboard/Widgets/PageViewsBar.php b/Classes/Dashboard/Widgets/PageViewsBar.php index b98ac75..63ec302 100644 --- a/Classes/Dashboard/Widgets/PageViewsBar.php +++ b/Classes/Dashboard/Widgets/PageViewsBar.php @@ -21,15 +21,16 @@ namespace DanielSiepmann\Tracking\Dashboard\Widgets; * 02110-1301, USA. */ +use DanielSiepmann\Tracking\Extension; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\Query\QueryBuilder; use TYPO3\CMS\Dashboard\Widgets\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; diff --git a/Classes/Dashboard/Widgets/PageViewsPerPageDoughnut.php b/Classes/Dashboard/Widgets/PageViewsPerPageDoughnut.php index 54776e3..30eb1d2 100644 --- a/Classes/Dashboard/Widgets/PageViewsPerPageDoughnut.php +++ b/Classes/Dashboard/Widgets/PageViewsPerPageDoughnut.php @@ -21,6 +21,7 @@ namespace DanielSiepmann\Tracking\Dashboard\Widgets; * 02110-1301, USA. */ +use DanielSiepmann\Tracking\Extension; use Doctrine\DBAL\ParameterType; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\Query\QueryBuilder; @@ -28,9 +29,9 @@ use TYPO3\CMS\Dashboard\Widgets\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 diff --git a/Classes/Extension.php b/Classes/Extension.php new file mode 100644 index 0000000..1716c56 --- /dev/null +++ b/Classes/Extension.php @@ -0,0 +1,29 @@ + + * + * 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'; +} diff --git a/composer.json b/composer.json index 5cc9086..ee05abe 100644 --- a/composer.json +++ b/composer.json @@ -26,10 +26,6 @@ "suggest": { "typo3/cms-dashboard": "To make use of provided TYPO3 widgets" }, - "config": { - "vendor-dir": ".Build/vendor", - "bin-dir": ".Build/bin" - }, "extra": { "typo3/cms": { "cms-package-dir": "{$vendor-dir}/typo3/cms", @@ -45,5 +41,8 @@ "mkdir -p .Build/web/typo3conf/ext/", "[ -L .Build/web/typo3conf/ext/tracking ] || ln -snvf ../../../../. .Build/web/typo3conf/ext/tracking" ] + }, + "require-dev": { + "squizlabs/php_codesniffer": "^3.5" } } diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..0fe8bf8 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,15 @@ + + + This project coding standard + + Classes/ + + + + + + + + + +