From 7ee36f0797310f704ef11a46056eec11d82804d9 Mon Sep 17 00:00:00 2001 From: sgiehl Date: Tue, 13 Feb 2024 18:10:10 +0100 Subject: [PATCH] Apply coding style around FunctionCallSignature #6 --- .../Commands/CalculateConversionPages.php | 18 ++-- .../RecordBuilders/GeneralGoalsRecords.php | 10 +- plugins/Goals/TranslationHelper.php | 9 +- .../CalculateConversionPagesCommandTest.php | 6 +- .../NumericAttributeGoalTrackingTest.php | 6 +- plugins/ImageGraph/API.php | 8 +- plugins/ImageGraph/StaticGraph.php | 4 +- .../Insights/tests/Unit/InsightReportTest.php | 35 +++++- plugins/Installation/Controller.php | 11 +- plugins/Installation/Menu.php | 8 +- plugins/Installation/ServerFilesGenerator.php | 12 ++- plugins/Intl/DateTimeFormatProvider.php | 3 +- .../Fixtures/IntranetSitesWithVisits.php | 12 ++- .../Commands/SetTranslations.php | 6 +- plugins/LanguagesManager/Menu.php | 6 +- .../Integration/LanguagesManagerTest.php | 14 ++- plugins/Live/API.php | 36 ++++++- plugins/Live/Model.php | 3 +- plugins/Live/tests/Integration/ModelTest.php | 54 +++++----- plugins/Login/Emails/PasswordResetEmail.php | 12 ++- plugins/Marketplace/Api/Service.php | 28 +++-- plugins/MobileMessaging/SMSProvider.php | 3 +- plugins/Monolog/config/config.php | 10 +- plugins/Morpheus/Controller.php | 102 ++++++++++++------ plugins/MultiSites/API.php | 6 +- plugins/Overlay/API.php | 11 +- plugins/PagePerformance/Controller.php | 6 +- .../RecordBuilders/PerformanceTotals.php | 12 ++- .../Tracker/PerformanceDataProcessorTest.php | 7 +- .../Commands/AnonymizeRawData.php | 22 ++-- 30 files changed, 333 insertions(+), 147 deletions(-) diff --git a/plugins/Goals/Commands/CalculateConversionPages.php b/plugins/Goals/Commands/CalculateConversionPages.php index 843c753cc6a8..9ee21273ebbe 100644 --- a/plugins/Goals/Commands/CalculateConversionPages.php +++ b/plugins/Goals/Commands/CalculateConversionPages.php @@ -32,8 +32,12 @@ protected function configure() $this->setDescription('Calculate the pages before metric for historic conversions'); $this->addOptionalValueOption('dates', null, 'Calculate for conversions in this date range. Eg, 2012-01-01,2013-01-01', null); $this->addOptionalValueOption('last-n', null, 'Calculate just the last n conversions', 0); - $this->addOptionalValueOption('idsite', null, - 'Calculate for conversions belonging to the site with this ID. Comma separated list of website id. Eg, 1, 2, 3, etc. By default conversions from all sites are calculated.', null); + $this->addOptionalValueOption( + 'idsite', + null, + 'Calculate for conversions belonging to the site with this ID. Comma separated list of website id. Eg, 1, 2, 3, etc. By default conversions from all sites are calculated.', + null + ); $this->addOptionalValueOption('idgoal', null, 'Calculate conversions for this goal. A comma separated list of goal ids can be used only if a single site is specified. Eg, 1, 2, 3, etc. By default conversions for all goals are calculated.', null); $this->addOptionalValueOption('force-recalc', null, 'Recalculate for conversions which already have a pages before value', 0); } @@ -70,8 +74,8 @@ protected function doExecute(): int "Preparing to calculate the pages before metric for %s conversions belonging to %s %sfor %s.", $lastN ? "the last " . $lastN : 'all', $idSite ? "website $idSite" : "ALL websites", - !empty($dates) ? "between " . $from . " and " . $to . " " : '', - $idGoal ? "goal id $idGoal" : "ALL goals" + !empty($dates) ? "between " . $from . " and " . $to . " " : '', + $idGoal ? "goal id $idGoal" : "ALL goals" )); $timer = new Timer(); @@ -108,8 +112,10 @@ public static function calculateYesterdayAndToday(): void { $migration = StaticContainer::get(MigrationFactory::class); - $queries = self::getQueries(Date::factory('yesterday')->getDatetime(), - Date::factory('today')->getEndOfDay()->getDatetime()); + $queries = self::getQueries( + Date::factory('yesterday')->getDatetime(), + Date::factory('today')->getEndOfDay()->getDatetime() + ); $migrations = []; foreach ($queries as $query) { diff --git a/plugins/Goals/RecordBuilders/GeneralGoalsRecords.php b/plugins/Goals/RecordBuilders/GeneralGoalsRecords.php index c57205e3b2e7..283192e868d5 100644 --- a/plugins/Goals/RecordBuilders/GeneralGoalsRecords.php +++ b/plugins/Goals/RecordBuilders/GeneralGoalsRecords.php @@ -69,10 +69,16 @@ protected function aggregate(ArchiveProcessor $archiveProcessor): array if ($siteHasEcommerceOrGoals) { $selects = []; $selects = array_merge($selects, LogAggregator::getSelectsFromRangedColumn( - self::VISITS_COUNT_FIELD, Archiver::$visitCountRanges, self::LOG_CONVERSION_TABLE, $prefixes[Archiver::VISITS_UNTIL_RECORD_NAME] + self::VISITS_COUNT_FIELD, + Archiver::$visitCountRanges, + self::LOG_CONVERSION_TABLE, + $prefixes[Archiver::VISITS_UNTIL_RECORD_NAME] )); $selects = array_merge($selects, LogAggregator::getSelectsFromRangedColumn( - 'FLOOR(log_conversion.' . self::SECONDS_SINCE_FIRST_VISIT_FIELD . ' / 86400)', Archiver::$daysToConvRanges, self::LOG_CONVERSION_TABLE, $prefixes[Archiver::DAYS_UNTIL_CONV_RECORD_NAME] + 'FLOOR(log_conversion.' . self::SECONDS_SINCE_FIRST_VISIT_FIELD . ' / 86400)', + Archiver::$daysToConvRanges, + self::LOG_CONVERSION_TABLE, + $prefixes[Archiver::DAYS_UNTIL_CONV_RECORD_NAME] )); $query = $logAggregator->queryConversionsByDimension([], false, $selects); diff --git a/plugins/Goals/TranslationHelper.php b/plugins/Goals/TranslationHelper.php index 06d13f64f1a4..f85b95307911 100644 --- a/plugins/Goals/TranslationHelper.php +++ b/plugins/Goals/TranslationHelper.php @@ -89,19 +89,22 @@ protected function getTranslationForPattern($patternType, $pattern) { switch ($patternType) { case 'regex': - return sprintf('%s %s', + return sprintf( + '%s %s', Piwik::translate('Goals_Pattern'), Piwik::translate('Goals_MatchesExpression', array($pattern)) ); case 'contains': - return sprintf('%s %s', + return sprintf( + '%s %s', Piwik::translate('Goals_Pattern'), Piwik::translate('Goals_Contains', array($pattern)) ); case 'exact': - return sprintf('%s %s', + return sprintf( + '%s %s', Piwik::translate('Goals_Pattern'), Piwik::translate('Goals_IsExactly', array($pattern)) ); diff --git a/plugins/Goals/tests/System/CalculateConversionPagesCommandTest.php b/plugins/Goals/tests/System/CalculateConversionPagesCommandTest.php index 7933fa885a58..5e64c74a97df 100644 --- a/plugins/Goals/tests/System/CalculateConversionPagesCommandTest.php +++ b/plugins/Goals/tests/System/CalculateConversionPagesCommandTest.php @@ -71,8 +71,10 @@ public function test_CommandSuccessfullyCalculates_ForLastN() */ private function unsetPageviewsBefore(): void { - Db::query('UPDATE ' . Common::prefixTable('log_conversion') . ' SET pageviews_before = NULL WHERE idsite = ?', - [self::$fixture->idSite]); + Db::query( + 'UPDATE ' . Common::prefixTable('log_conversion') . ' SET pageviews_before = NULL WHERE idsite = ?', + [self::$fixture->idSite] + ); } /** diff --git a/plugins/Goals/tests/System/NumericAttributeGoalTrackingTest.php b/plugins/Goals/tests/System/NumericAttributeGoalTrackingTest.php index 0691a5679bab..7dfe4c1ec597 100644 --- a/plugins/Goals/tests/System/NumericAttributeGoalTrackingTest.php +++ b/plugins/Goals/tests/System/NumericAttributeGoalTrackingTest.php @@ -57,7 +57,9 @@ protected static function configureFixture($fixture) private function getConversionCount($idGoal) { - return Db::fetchOne('SELECT COUNT(*) FROM ' . Common::prefixTable('log_conversion') . ' WHERE idsite = ? AND idgoal = ?', - [$this->idSite, $idGoal]); + return Db::fetchOne( + 'SELECT COUNT(*) FROM ' . Common::prefixTable('log_conversion') . ' WHERE idsite = ? AND idgoal = ?', + [$this->idSite, $idGoal] + ); } } diff --git a/plugins/ImageGraph/API.php b/plugins/ImageGraph/API.php index 14f96a7860f6..c101330fbdc3 100644 --- a/plugins/ImageGraph/API.php +++ b/plugins/ImageGraph/API.php @@ -244,10 +244,10 @@ public function get( $ordinateColumns[] = key($metadata['metrics']); } else { throw new Exception( - Piwik::translate( - 'ImageGraph_ColumnOrdinateMissing', - array(self::DEFAULT_ORDINATE_METRIC, implode(',', array_keys($reportColumns))) - ) + Piwik::translate( + 'ImageGraph_ColumnOrdinateMissing', + array(self::DEFAULT_ORDINATE_METRIC, implode(',', array_keys($reportColumns))) + ) ); } } else { diff --git a/plugins/ImageGraph/StaticGraph.php b/plugins/ImageGraph/StaticGraph.php index 464383007e7d..a2830d16476e 100644 --- a/plugins/ImageGraph/StaticGraph.php +++ b/plugins/ImageGraph/StaticGraph.php @@ -339,7 +339,9 @@ protected function getTextWidthHeight($text, $fontSize = false) // could not find a way to get pixel perfect width & height info using imageftbbox $textInfo = $this->pImage->drawText( - 0, 0, $text, + 0, + 0, + $text, array( 'Alpha' => 0, 'FontSize' => $fontSize, diff --git a/plugins/Insights/tests/Unit/InsightReportTest.php b/plugins/Insights/tests/Unit/InsightReportTest.php index 19a88dbb0301..4ed8def81a26 100644 --- a/plugins/Insights/tests/Unit/InsightReportTest.php +++ b/plugins/Insights/tests/Unit/InsightReportTest.php @@ -438,8 +438,19 @@ private function generateMoverAndShaker($totalValue, $lastTotalValue, $orderBy = $reportMetadata = array('name' => 'TestReport', 'metrics' => array('nb_visits' => 'Visits')); $report = $this->insightReport->generateMoverAndShaker( - $reportMetadata, 'day', '2012-12-12', '2012-12-11', 'nb_visits', $this->currentTable, $this->pastTable, - $totalValue, $lastTotalValue, $orderBy, $limitIncreaser, $limitDecreaser); + $reportMetadata, + 'day', + '2012-12-12', + '2012-12-11', + 'nb_visits', + $this->currentTable, + $this->pastTable, + $totalValue, + $lastTotalValue, + $orderBy, + $limitIncreaser, + $limitDecreaser + ); return $report; } @@ -453,9 +464,23 @@ private function generateInsight($minMoversPercent, $minNewPercent, $minDisappea $reportMetadata = array('name' => 'TestReport', 'metrics' => array('nb_visits' => 'Visits')); $report = $this->insightReport->generateInsight( - $reportMetadata, 'day', '2012-12-12', '2012-12-11', 'nb_visits', $this->currentTable, $this->pastTable, - $totalValue = 200, $minMoversPercent, $minNewPercent, $minDisappearedPercent, - $minGrowthPercentPositive, $minGrowthPercentNegative, $orderBy, $limitIncreaser, $limitDecreaser); + $reportMetadata, + 'day', + '2012-12-12', + '2012-12-11', + 'nb_visits', + $this->currentTable, + $this->pastTable, + $totalValue = 200, + $minMoversPercent, + $minNewPercent, + $minDisappearedPercent, + $minGrowthPercentPositive, + $minGrowthPercentNegative, + $orderBy, + $limitIncreaser, + $limitDecreaser + ); return $report; } diff --git a/plugins/Installation/Controller.php b/plugins/Installation/Controller.php index 30d00d322257..2f13ecbfc42a 100644 --- a/plugins/Installation/Controller.php +++ b/plugins/Installation/Controller.php @@ -289,9 +289,11 @@ function setupSuperUser() $loginName = $form->getSubmitValue('login'); $email = $form->getSubmitValue('email'); - $this->createSuperUser($loginName, - $form->getSubmitValue('password'), - $email); + $this->createSuperUser( + $loginName, + $form->getSubmitValue('password'), + $email + ); $newsletterPiwikORG = $form->getSubmitValue('subscribe_newsletter_piwikorg'); $newsletterProfessionalServices = $form->getSubmitValue('subscribe_newsletter_professionalservices'); @@ -628,7 +630,8 @@ private function checkPiwikIsNotInstalled($possibleErrorMessage = null) $possibleErrorMessage = $possibleErrorMessage ? sprintf('

Original error was "%s".
', $possibleErrorMessage) : ''; \Piwik\Plugins\Login\Controller::clearSession(); - $message = Piwik::translate('Installation_InvalidStateError', + $message = Piwik::translate( + 'Installation_InvalidStateError', array($possibleErrorMessage . '
', // piwik-is-already-installed is checked against in checkPiwikServerWorking '', diff --git a/plugins/Installation/Menu.php b/plugins/Installation/Menu.php index 5e20199fae4f..836291b752cc 100644 --- a/plugins/Installation/Menu.php +++ b/plugins/Installation/Menu.php @@ -17,9 +17,11 @@ class Menu extends \Piwik\Plugin\Menu public function configureAdminMenu(MenuAdmin $menu) { if (Piwik::hasUserSuperUserAccess() && Manager::getInstance()->isPluginActivated('Diagnostics')) { - $menu->addDiagnosticItem('Installation_SystemCheck', - $this->urlForAction('systemCheckPage'), - $order = 1); + $menu->addDiagnosticItem( + 'Installation_SystemCheck', + $this->urlForAction('systemCheckPage'), + $order = 1 + ); } } } diff --git a/plugins/Installation/ServerFilesGenerator.php b/plugins/Installation/ServerFilesGenerator.php index 04e981109098..b92408abfc24 100644 --- a/plugins/Installation/ServerFilesGenerator.php +++ b/plugins/Installation/ServerFilesGenerator.php @@ -128,7 +128,8 @@ protected static function createWebConfigFiles() if (!SettingsServer::isIIS()) { return; } - @file_put_contents(PIWIK_INCLUDE_PATH . '/web.config', + @file_put_contents( + PIWIK_INCLUDE_PATH . '/web.config', ' @@ -167,7 +168,8 @@ protected static function createWebConfigFiles() -'); +' + ); // deny direct access to .php files $directoriesToProtect = array( @@ -183,7 +185,8 @@ protected static function createWebConfigFiles() '; foreach ($directoriesToProtect as $directoryToProtect) { - @file_put_contents(PIWIK_INCLUDE_PATH . $directoryToProtect . '/web.config', + @file_put_contents( + PIWIK_INCLUDE_PATH . $directoryToProtect . '/web.config', ' @@ -195,7 +198,8 @@ protected static function createWebConfigFiles() -'); +' + ); } } diff --git a/plugins/Intl/DateTimeFormatProvider.php b/plugins/Intl/DateTimeFormatProvider.php index e4fa6ac2358e..88c1b70793ad 100644 --- a/plugins/Intl/DateTimeFormatProvider.php +++ b/plugins/Intl/DateTimeFormatProvider.php @@ -101,7 +101,8 @@ public function getRangeFormatPattern($short = false, $maxDifference = 'Y') 'Intl_Format_Interval_%s_%s', $short ? 'Short' : 'Long', $maxDifference - )); + ) + ); } protected function getTimeFormat() diff --git a/plugins/IntranetMeasurable/tests/Fixtures/IntranetSitesWithVisits.php b/plugins/IntranetMeasurable/tests/Fixtures/IntranetSitesWithVisits.php index 8ed41e8783a2..017d8f7172c3 100644 --- a/plugins/IntranetMeasurable/tests/Fixtures/IntranetSitesWithVisits.php +++ b/plugins/IntranetMeasurable/tests/Fixtures/IntranetSitesWithVisits.php @@ -38,9 +38,15 @@ private function setUpWebsites() { if (!self::siteCreated($this->idSite)) { Fixture::createWebsite( - '2014-01-02 03:04:05', $ecommerce = 0, $siteName = false, $siteUrl = false, - $siteSearch = 1, $searchKeywordParameters = null, - $searchCategoryParameters = null, $timezone = null, Type::ID + '2014-01-02 03:04:05', + $ecommerce = 0, + $siteName = false, + $siteUrl = false, + $siteSearch = 1, + $searchKeywordParameters = null, + $searchCategoryParameters = null, + $timezone = null, + Type::ID ); } diff --git a/plugins/LanguagesManager/Commands/SetTranslations.php b/plugins/LanguagesManager/Commands/SetTranslations.php index 29b4c58b3d1c..5392890726e2 100644 --- a/plugins/LanguagesManager/Commands/SetTranslations.php +++ b/plugins/LanguagesManager/Commands/SetTranslations.php @@ -41,14 +41,16 @@ protected function doExecute(): int $languageCodes = (new API())->getAvailableLanguages(true); if (empty($languageCode) || !in_array($languageCode, $languageCodes)) { - $languageCode = $this->askAndValidate('Please provide a valid language code: ', + $languageCode = $this->askAndValidate( + 'Please provide a valid language code: ', function ($code) use ($languageCodes) { if (!in_array($code, array_values($languageCodes))) { throw new \InvalidArgumentException(sprintf('Language code "%s" is invalid.', $code)); } return $code; - }); + } + ); } if (empty($filename) || !file_exists($filename)) { diff --git a/plugins/LanguagesManager/Menu.php b/plugins/LanguagesManager/Menu.php index 76a46f040a32..951f64217964 100644 --- a/plugins/LanguagesManager/Menu.php +++ b/plugins/LanguagesManager/Menu.php @@ -27,8 +27,10 @@ public function configureTopMenu(MenuTop $menu) public function configureAdminMenu(MenuAdmin $menu) { if (Development::isEnabled() && Piwik::isUserHasSomeAdminAccess()) { - $menu->addDevelopmentItem('LanguagesManager_TranslationSearch', - $this->urlForAction('searchTranslation')); + $menu->addDevelopmentItem( + 'LanguagesManager_TranslationSearch', + $this->urlForAction('searchTranslation') + ); } } } diff --git a/plugins/LanguagesManager/tests/Integration/LanguagesManagerTest.php b/plugins/LanguagesManager/tests/Integration/LanguagesManagerTest.php index d04fc22027a8..82e223200d8a 100644 --- a/plugins/LanguagesManager/tests/Integration/LanguagesManagerTest.php +++ b/plugins/LanguagesManager/tests/Integration/LanguagesManagerTest.php @@ -147,8 +147,11 @@ function testTranslationsUseNumberedPlaceholders() $translations = $translator->getAllTranslations(); foreach ($translations as $plugin => $pluginTranslations) { foreach ($pluginTranslations as $key => $pluginTranslation) { - $this->assertLessThanOrEqual(1, substr_count($pluginTranslation, '%s'), - sprintf('%s.%s must use numbered placeholders instead of multiple %%s', $plugin, $key)); + $this->assertLessThanOrEqual( + 1, + substr_count($pluginTranslation, '%s'), + sprintf('%s.%s must use numbered placeholders instead of multiple %%s', $plugin, $key) + ); } } } @@ -173,8 +176,11 @@ function testTranslationsUseEscapedPercentSigns() foreach ($pluginTranslations as $key => $pluginTranslation) { $pluginTranslation = preg_replace('/(%(?:[1-9]\$)?[a-z])/', '', $pluginTranslation); // remove placeholders $pluginTranslation = str_replace('%%', '', $pluginTranslation); // remove already escaped symbols - $this->assertEquals(0, substr_count($pluginTranslation, '%'), - sprintf('%s.%s must use escaped %% symbols', $plugin, $key)); + $this->assertEquals( + 0, + substr_count($pluginTranslation, '%'), + sprintf('%s.%s must use escaped %% symbols', $plugin, $key) + ); } } } diff --git a/plugins/Live/API.php b/plugins/Live/API.php index 5e0e116f3823..857e2ab3834e 100644 --- a/plugins/Live/API.php +++ b/plugins/Live/API.php @@ -226,8 +226,17 @@ public function getVisitorProfile($idSite, $visitorId = false, $segment = false, $limit = Config::getInstance()->General['live_visitor_profile_max_visits_to_aggregate']; - $visits = $this->loadLastVisitsDetailsFromDatabase($idSite, $period = false, $date = false, $segment, - $offset = 0, $limit, false, false, $visitorId); + $visits = $this->loadLastVisitsDetailsFromDatabase( + $idSite, + $period = false, + $date = false, + $segment, + $offset = 0, + $limit, + false, + false, + $visitorId + ); $this->addFilterToCleanVisitors($visits, $idSite, $flat = false, $doNotFetchActions = false, $filterNow = true); if ($visits->getRowsCount() == 0) { @@ -255,21 +264,38 @@ public function getMostRecentVisitorId($idSite, $segment = false) $minTimestamp = Date::now()->subDay(7)->getTimestamp(); $dataTable = $this->loadLastVisitsDetailsFromDatabase( - $idSite, $period = false, $date = false, $segment, $offset = 0, $limit = 1, $minTimestamp + $idSite, + $period = false, + $date = false, + $segment, + $offset = 0, + $limit = 1, + $minTimestamp ); if (0 >= $dataTable->getRowsCount()) { $minTimestamp = Date::now()->subYear(1)->getTimestamp(); // no visitor found in last 7 days, look further back for up to 1 year. This query will be slower $dataTable = $this->loadLastVisitsDetailsFromDatabase( - $idSite, $period = false, $date = false, $segment, $offset = 0, $limit = 1, $minTimestamp + $idSite, + $period = false, + $date = false, + $segment, + $offset = 0, + $limit = 1, + $minTimestamp ); } if (0 >= $dataTable->getRowsCount()) { // no visitor found in last year, look over all logs. This query might be quite slow $dataTable = $this->loadLastVisitsDetailsFromDatabase( - $idSite, $period = false, $date = false, $segment, $offset = 0, $limit = 1 + $idSite, + $period = false, + $date = false, + $segment, + $offset = 0, + $limit = 1 ); } diff --git a/plugins/Live/Model.php b/plugins/Live/Model.php index 226b6db39262..d4546b340ffb 100644 --- a/plugins/Live/Model.php +++ b/plugins/Live/Model.php @@ -579,7 +579,8 @@ public function makeLogVisitsQueryString($idSite, $startDate, $endDate, $segment if (!$visitorId) { // for now let's not apply when looking for a specific visitor - $innerQuery['sql'] = DbHelper::addMaxExecutionTimeHintToQuery($innerQuery['sql'], + $innerQuery['sql'] = DbHelper::addMaxExecutionTimeHintToQuery( + $innerQuery['sql'], $this->getLiveQueryMaxExecutionTime() ); } diff --git a/plugins/Live/tests/Integration/ModelTest.php b/plugins/Live/tests/Integration/ModelTest.php index 8b87c8858679..20ca59ad102e 100644 --- a/plugins/Live/tests/Integration/ModelTest.php +++ b/plugins/Live/tests/Integration/ModelTest.php @@ -215,15 +215,15 @@ public function test_makeLogVisitsQueryString() $model = new Model(); list($dateStart, $dateEnd) = $model->getStartAndEndDate($idSite = 1, 'month', '2010-01-01'); list($sql, $bind) = $model->makeLogVisitsQueryString( - $idSite = 1, - $dateStart, - $dateEnd, - $segment = false, - $offset = 0, - $limit = 100, - $visitorId = false, - $minTimestamp = false, - $filterSortOrder = false + $idSite = 1, + $dateStart, + $dateEnd, + $segment = false, + $offset = 0, + $limit = 100, + $visitorId = false, + $minTimestamp = false, + $filterSortOrder = false ); $expectedSql = ' SELECT log_visit.* FROM ' . Common::prefixTable('log_visit') . ' AS log_visit @@ -250,15 +250,15 @@ public function test_makeLogVisitsQueryString_withMultipleIdSites() $model = new Model(); list($dateStart, $dateEnd) = $model->getStartAndEndDate($idSite = 1, 'month', '2010-01-01'); list($sql, $bind) = $model->makeLogVisitsQueryString( - $idSite = 1, - $dateStart, - $dateEnd, - $segment = false, - $offset = 0, - $limit = 100, - $visitorId = false, - $minTimestamp = false, - $filterSortOrder = false + $idSite = 1, + $dateStart, + $dateEnd, + $segment = false, + $offset = 0, + $limit = 100, + $visitorId = false, + $minTimestamp = false, + $filterSortOrder = false ); $expectedSql = ' SELECT log_visit.* FROM ' . Common::prefixTable('log_visit') . ' AS log_visit @@ -284,15 +284,15 @@ public function test_makeLogVisitsQueryStringWithOffset() list($dateStart, $dateEnd) = $model->getStartAndEndDate($idSite = 1, 'month', '2010-01-01'); list($sql, $bind) = $model->makeLogVisitsQueryString( - $idSite = 1, - $dateStart, - $dateEnd, - $segment = false, - $offset = 15, - $limit = 100, - $visitorId = false, - $minTimestamp = false, - $filterSortOrder = false + $idSite = 1, + $dateStart, + $dateEnd, + $segment = false, + $offset = 15, + $limit = 100, + $visitorId = false, + $minTimestamp = false, + $filterSortOrder = false ); $expectedSql = ' SELECT log_visit.* FROM ' . Common::prefixTable('log_visit') . ' AS log_visit diff --git a/plugins/Login/Emails/PasswordResetEmail.php b/plugins/Login/Emails/PasswordResetEmail.php index c5954b94dcbc..636848d311cb 100644 --- a/plugins/Login/Emails/PasswordResetEmail.php +++ b/plugins/Login/Emails/PasswordResetEmail.php @@ -65,8 +65,10 @@ private function getDefaultSubject() */ private function getDefaultBodyText(): string { - return Piwik::translate('Login_MailPasswordChangeBody2', - [Common::sanitizeInputValue($this->login), Common::sanitizeInputValue($this->ip), Common::sanitizeInputValue($this->resetUrl)]); + return Piwik::translate( + 'Login_MailPasswordChangeBody2', + [Common::sanitizeInputValue($this->login), Common::sanitizeInputValue($this->ip), Common::sanitizeInputValue($this->resetUrl)] + ); } /** @@ -79,11 +81,13 @@ private function getHTMLBody(): string return '

' . str_replace( "\n\n", "

", - Piwik::translate('Login_MailPasswordChangeBody2', + Piwik::translate( + 'Login_MailPasswordChangeBody2', [Common::sanitizeInputValue($this->login), Common::sanitizeInputValue($this->ip), '

' . - Common::sanitizeInputValue($this->resetUrl) . '

']) + Common::sanitizeInputValue($this->resetUrl) . '

'] + ) ) . "

"; } } diff --git a/plugins/Marketplace/Api/Service.php b/plugins/Marketplace/Api/Service.php index 7d7670e87ff1..afbdbb50cda2 100644 --- a/plugins/Marketplace/Api/Service.php +++ b/plugins/Marketplace/Api/Service.php @@ -98,17 +98,23 @@ public function download($url, $destinationPath = null, $timeout = null) $file = Http::ensureDestinationDirectoryExists($destinationPath); - $response = Http::sendHttpRequestBy($method, - $url, - $timeout, - $userAgent = null, - $destinationPath, - $file, - $followDepth = 0, - $acceptLanguage = false, - $acceptInvalidSslCertificate = false, - $byteRange = false, $getExtendedInfo = false, $httpMethod = 'POST', - $httpUsername = null, $httpPassword = null, $post); + $response = Http::sendHttpRequestBy( + $method, + $url, + $timeout, + $userAgent = null, + $destinationPath, + $file, + $followDepth = 0, + $acceptLanguage = false, + $acceptInvalidSslCertificate = false, + $byteRange = false, + $getExtendedInfo = false, + $httpMethod = 'POST', + $httpUsername = null, + $httpPassword = null, + $post + ); return $response; } diff --git a/plugins/MobileMessaging/SMSProvider.php b/plugins/MobileMessaging/SMSProvider.php index d27a7d7d7317..7a1ab89c137b 100644 --- a/plugins/MobileMessaging/SMSProvider.php +++ b/plugins/MobileMessaging/SMSProvider.php @@ -117,7 +117,8 @@ public static function factory($provider) $providers = self::findAvailableSmsProviders(); if (!array_key_exists($provider, $providers)) { - throw new \Exception(Piwik::translate('MobileMessaging_Exception_UnknownProvider', + throw new \Exception(Piwik::translate( + 'MobileMessaging_Exception_UnknownProvider', array($provider, implode(', ', array_keys($providers))) )); } diff --git a/plugins/Monolog/config/config.php b/plugins/Monolog/config/config.php index 59cdc8f0cd26..49d0dec85ed9 100644 --- a/plugins/Monolog/config/config.php +++ b/plugins/Monolog/config/config.php @@ -68,8 +68,14 @@ $handler->setLevel(Logger::DEBUG); - $handler = new \Monolog\Handler\FingersCrossedHandler($handler, $activationStrategy = null, $bufferSize = 0, - $bubble = true, $fingersCrossedStopBuffering, $passthruLevel); + $handler = new \Monolog\Handler\FingersCrossedHandler( + $handler, + $activationStrategy = null, + $bufferSize = 0, + $bubble = true, + $fingersCrossedStopBuffering, + $passthruLevel + ); } $writers[$writerName] = $handler; diff --git a/plugins/Morpheus/Controller.php b/plugins/Morpheus/Controller.php index 7e54ffac2dbd..e8611129e100 100644 --- a/plugins/Morpheus/Controller.php +++ b/plugins/Morpheus/Controller.php @@ -254,7 +254,11 @@ public function demo() // TODOO: handle arrays $snippets[] = $this->formSnippet( - 'language', ['language', 'phoneNumber', 'selectedExpand'], ['1', '[\'1\']', 'null'], [1, ['1'], null], '
+ 'language', + ['language', 'phoneNumber', 'selectedExpand'], + ['1', '[\'1\']', 'null'], + [1, ['1'], null], + '
-
'); +
' + ); $snippets[] = $this->formSnippet('multitupletext', 'values', '[]', [], '
'); - $snippets[] = $this->formSnippet('multitupletextvalue', 'values', + $snippets[] = $this->formSnippet( + 'multitupletextvalue', + 'values', '[{\'index\': \'test\', \'value\':\'myfoo\'},{\'index\': \'test 2\', \'value\':\'myfoo 2\'}]', - [['index' => 'test', 'value' => 'myfoo'], ['index' => 'test 2', 'value' => 'myfoo 2']], '
+ [['index' => 'test', 'value' => 'myfoo'], ['index' => 'test 2', 'value' => 'myfoo 2']], + '
-
'); +
' + ); - $snippets[] = $this->formSnippet('multitupleselect', 'values', + $snippets[] = $this->formSnippet( + 'multitupleselect', + 'values', '[{\'index\': \'test\', \'value\': \'myfoo\'}]', - [["index" => "test", "value" => "myfoo"]], '
+ [["index" => "test", "value" => "myfoo"]], + '
-
'); +
' + ); $snippets[] = $this->formSnippet('multitupletext2', 'values', '[]', [], '
'); - $snippets[] = $this->formSnippet('multitupletextvalue2', 'values', + $snippets[] = $this->formSnippet( + 'multitupletextvalue2', + 'values', "[{'index': 'test', 'value':'myfoo'},{'index': 'test 2', 'value':'myfoo 2'}]", - [["index" => "test", "value" => "myfoo"], ["index" => "test 2", "value" => "myfoo 2"]], '
+ [["index" => "test", "value" => "myfoo"], ["index" => "test 2", "value" => "myfoo 2"]], + '
-
'); +
' + ); - $snippets[] = $this->formSnippet('multitupleselect2', 'values', + $snippets[] = $this->formSnippet( + 'multitupleselect2', + 'values', '[{\'index\': \'test\', \'value\': \'myfoo\'}]', - [['index' => 'test', 'value' => 'myfoo']], '
+ [['index' => 'test', 'value' => 'myfoo']], + '
-
'); +
' + ); $snippets[] = $this->formSnippet('multitupletext3', 'values', '[]', [], '
'); - $snippets[] = $this->formSnippet('multitupletextvalue3', 'values', + $snippets[] = $this->formSnippet( + 'multitupletextvalue3', + 'values', '[{\'index\': \'test\', \'value\':\'myfoo\'},{\'index\': \'test 2\', \'value\':\'myfoo 2\'}]', - [["index" => "test", "value" => "myfoo"], ["index" => "test 2", "value" => "myfoo 2"]], '
+ [["index" => "test", "value" => "myfoo"], ["index" => "test 2", "value" => "myfoo 2"]], + '
-
'); +
' + ); - $snippets[] = $this->formSnippet('multitupleselect3', 'values', - '[{\'index\': \'test\', \'value\': \'myfoo\'}]', - [["index" => "test", "value" => "myfoo"]], '
+ $snippets[] = $this->formSnippet( + 'multitupleselect3', + 'values', + '[{\'index\': \'test\', \'value\': \'myfoo\'}]', + [["index" => "test", "value" => "myfoo"]], + '
-
'); +
' + ); - $snippets[] = $this->formSnippet('multituplesingleselect', 'values', + $snippets[] = $this->formSnippet( + 'multituplesingleselect', + 'values', '[{\'index\': \'test\', \'value\': \'myfoo\'}]', - [["index" => "test", "value" => "myfoo"]], '
+ [["index" => "test", "value" => "myfoo"]], + '
-
'); +
' + ); - $snippets[] = $this->formSnippet('multituplesingletext', 'values', + $snippets[] = $this->formSnippet( + 'multituplesingletext', + 'values', '[{\'index\': \'test\', \'value\': \'myfoo\'}]', - [["index" => "test", "value" => "myfoo"]], '
+ [["index" => "test", "value" => "myfoo"]], + '
-
'); +
' + ); $snippets[] = $this->formSnippet('text-field-array', 'values', "['text one', 'text two']", ['text one', 'text two'], '
'); - $snippets[] = $this->formSnippet('enableFeatures', ['enable', 'enableArray', 'defaultReportDate'], - ['false', '[]', 'null'], [false, [], null], '
+ $snippets[] = $this->formSnippet( + 'enableFeatures', + ['enable', 'enableArray', 'defaultReportDate'], + ['false', '[]', 'null'], + [false, [], null], + '
-
'); +
' + ); $snippets[] = $this->formSnippet('currentsite', ['site', 'isDisabled', 'saveCount', 'isLoading'], ['null', 'false', '0', 'false'], [null, false, 0, false], '
getSitesWithAtLeastViewAccess($limit = false, $_restrictSitesToLogin); } } else { - $sites = Request::processRequest('SitesManager.getPatternMatchSites', + $sites = Request::processRequest( + 'SitesManager.getPatternMatchSites', array('pattern' => $pattern, // added because caller could overwrite these 'limit' => SettingsPiwik::getWebsitesCountToDisplay(), 'showColumns' => '', 'hideColumns' => '', - 'format' => 'original')); + 'format' => 'original') + ); if (!empty($sites)) { Site::setSitesFromArray($sites); diff --git a/plugins/Overlay/API.php b/plugins/Overlay/API.php index da0a97e88614..9bdd1f88fc61 100644 --- a/plugins/Overlay/API.php +++ b/plugins/Overlay/API.php @@ -72,8 +72,15 @@ public function getFollowingPages($url, $idSite, $period, $date, $segment = fals try { $limitBeforeGrouping = Config::getInstance()->General['overlay_following_pages_limit']; $transitionsReport = APITransitions::getInstance()->getTransitionsForAction( - $url, $type = 'url', $idSite, $period, $date, $segment, $limitBeforeGrouping, - $part = 'followingActions'); + $url, + $type = 'url', + $idSite, + $period, + $date, + $segment, + $limitBeforeGrouping, + $part = 'followingActions' + ); } catch (Exception $e) { return $resultDataTable; } diff --git a/plugins/PagePerformance/Controller.php b/plugins/PagePerformance/Controller.php index 01440c2fccd7..ad9ad89d1b66 100644 --- a/plugins/PagePerformance/Controller.php +++ b/plugins/PagePerformance/Controller.php @@ -87,7 +87,11 @@ public function getRowEvolutionGraph($dataTable = null) // set up the view data table $view = ViewDataTableFactory::build( - StackedBarEvolution::ID, $apiMethod, 'PagePerformance.getRowEvolutionGraph', $forceDefault = true); + StackedBarEvolution::ID, + $apiMethod, + 'PagePerformance.getRowEvolutionGraph', + $forceDefault = true + ); $view->setDataTable($dataTable); $view->config->columns_to_display = array_keys(Metrics::getPagePerformanceMetrics()); diff --git a/plugins/PagePerformance/RecordBuilders/PerformanceTotals.php b/plugins/PagePerformance/RecordBuilders/PerformanceTotals.php index 3823ad0b4d05..e62d2726ceb6 100644 --- a/plugins/PagePerformance/RecordBuilders/PerformanceTotals.php +++ b/plugins/PagePerformance/RecordBuilders/PerformanceTotals.php @@ -74,8 +74,16 @@ protected function aggregate(ArchiveProcessor $archiveProcessor): array $joinLogActionOnColumn = array('idaction_url'); $where = sprintf("COALESCE(%s) IS NOT NULL", implode(',', $allColumns)); - $query = $logAggregator->queryActionsByDimension([], $where, $selects, false, null, - $joinLogActionOnColumn, null, -1); + $query = $logAggregator->queryActionsByDimension( + [], + $where, + $selects, + false, + null, + $joinLogActionOnColumn, + null, + -1 + ); $result = $query->fetchAll(); diff --git a/plugins/PagePerformance/tests/Integration/Tracker/PerformanceDataProcessorTest.php b/plugins/PagePerformance/tests/Integration/Tracker/PerformanceDataProcessorTest.php index e57ca759b267..8b1f0bd72d42 100644 --- a/plugins/PagePerformance/tests/Integration/Tracker/PerformanceDataProcessorTest.php +++ b/plugins/PagePerformance/tests/Integration/Tracker/PerformanceDataProcessorTest.php @@ -108,11 +108,14 @@ public function test_shouldNotUseObviouslyTooHighNumbers() protected function checkActionHasTimings($pageViewId, $network = null, $server = null, $transfer = null, $domProcessing = null, $domCompletion = null, $onload = null) { $result = Db::fetchRow( - sprintf('SELECT time_network, time_server, time_transfer, time_dom_processing, time_dom_completion, time_on_load + sprintf( + 'SELECT time_network, time_server, time_transfer, time_dom_processing, time_dom_completion, time_on_load FROM %1$s LEFT JOIN %2$s ON idaction_url = idaction WHERE idpageview = ? AND %2$s.type = 1', Common::prefixTable('log_link_visit_action'), Common::prefixTable('log_action') - ), $pageViewId); + ), + $pageViewId + ); $this->assertEquals([ 'time_network' => $network, diff --git a/plugins/PrivacyManager/Commands/AnonymizeRawData.php b/plugins/PrivacyManager/Commands/AnonymizeRawData.php index 3fd340cb7414..1fd45d3df964 100644 --- a/plugins/PrivacyManager/Commands/AnonymizeRawData.php +++ b/plugins/PrivacyManager/Commands/AnonymizeRawData.php @@ -79,19 +79,23 @@ protected function doExecute(): int } if (!empty($visitColumnsToUnset) - && !$this->confirmAnonymize($startDate, - $endDate, - 'unset the log_visit columns "' . implode(', ', $visitColumnsToUnset) . '"')) { + && !$this->confirmAnonymize( + $startDate, + $endDate, + 'unset the log_visit columns "' . implode(', ', $visitColumnsToUnset) . '"' + )) { $visitColumnsToUnset = false; $output->writeln('SKIPPING unset log_visit columns.'); } if (!empty($linkVisitActionColumns) - && !$this->confirmAnonymize($startDate, - $endDate, - 'unset the log_link_visit_action columns "' . implode( - ', ', - $linkVisitActionColumns - ) . '"')) { + && !$this->confirmAnonymize( + $startDate, + $endDate, + 'unset the log_link_visit_action columns "' . implode( + ', ', + $linkVisitActionColumns + ) . '"' + )) { $linkVisitActionColumns = false; $output->writeln('SKIPPING unset log_link_visit_action columns.'); }