Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply coding style around FunctionCallSignature #5 #21931

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions plugins/Dashboard/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ public function __construct()
*/
public function getLayoutForUser($login, $idDashboard)
{
$query = sprintf('SELECT layout FROM %s WHERE login = ? AND iddashboard = ?',
$this->table);
$query = sprintf(
'SELECT layout FROM %s WHERE login = ? AND iddashboard = ?',
$this->table
);
$bind = array($login, $idDashboard);
$layouts = Db::fetchAll($query, $bind);

Expand Down Expand Up @@ -98,8 +100,10 @@ public function createNewDashboardForUser($login, $name, $layout)
public function createOrUpdateDashboard($login, $idDashboard, $layout)
{
$bind = array($login, $idDashboard, $layout, $layout);
$query = sprintf('INSERT INTO %s (login, iddashboard, layout) VALUES (?,?,?) ON DUPLICATE KEY UPDATE layout=?',
$this->table);
$query = sprintf(
'INSERT INTO %s (login, iddashboard, layout) VALUES (?,?,?) ON DUPLICATE KEY UPDATE layout=?',
$this->table
);
Db::query($query, $bind);
}

Expand All @@ -125,8 +129,10 @@ private function getNextIdDashboard($login)
public function updateLayoutForUser($login, $idDashboard, $layout)
{
$bind = array($login, $idDashboard, $layout, $layout);
$query = sprintf('INSERT INTO %s (login, iddashboard, layout) VALUES (?,?,?) ON DUPLICATE KEY UPDATE layout=?',
$this->table);
$query = sprintf(
'INSERT INTO %s (login, iddashboard, layout) VALUES (?,?,?) ON DUPLICATE KEY UPDATE layout=?',
$this->table
);
Db::query($query, $bind);
}

Expand Down
8 changes: 6 additions & 2 deletions plugins/DevicesDetection/Columns/Os.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ public function configureSegments(SegmentsList $segmentsList, DimensionSegmentFa
return $result;
});
$segment->setSuggestedValuesCallback(function ($idSite, $maxValuesToReturn, $table) {
return $this->sortStaticListByUsage(OperatingSystem::getAvailableOperatingSystems(), $table,
'operatingSystemCode', $maxValuesToReturn);
return $this->sortStaticListByUsage(
OperatingSystem::getAvailableOperatingSystems(),
$table,
'operatingSystemCode',
$maxValuesToReturn
);
});
$segmentsList->addSegment($dimensionSegmentFactory->createSegment($segment));
}
Expand Down
8 changes: 5 additions & 3 deletions plugins/DevicesDetection/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ class Menu extends \Piwik\Plugin\Menu
public function configureAdminMenu(MenuAdmin $menu)
{
if (Piwik::isUserHasSomeAdminAccess()) {
$menu->addDiagnosticItem('DevicesDetection_DeviceDetection',
$this->urlForAction('detection'),
$order = 40);
$menu->addDiagnosticItem(
'DevicesDetection_DeviceDetection',
$this->urlForAction('detection'),
$order = 40
);
}
}
}
6 changes: 3 additions & 3 deletions plugins/DevicesDetection/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@ function _mapLegacyOsShortCodes($shortCode): string
//'VMS' => '', // OpenVMS => ??
];
return ($shortCode && array_key_exists(
$shortCode,
$legacyShortCodes
)) ? $legacyShortCodes[$shortCode] : (string)$shortCode;
$shortCode,
$legacyShortCodes
)) ? $legacyShortCodes[$shortCode] : (string)$shortCode;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ private function setUpWebsitesAndGoals()

if (!self::goalExists($idSite = 1, $idGoal = 1)) {
API::getInstance()->addGoal(
$this->idSite, 'Goal 1 - Thank you', 'title', 'Thank you', 'contains', $caseSensitive = false,
$revenue = 10, $allowMultipleConversions = 1
$this->idSite,
'Goal 1 - Thank you',
'title',
'Thank you',
'contains',
$caseSensitive = false,
$revenue = 10,
$allowMultipleConversions = 1
);
}
}
Expand Down
7 changes: 5 additions & 2 deletions plugins/Diagnostics/Commands/ArchivingConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ class ArchivingConfig extends ConsoleCommand
protected function configure()
{
$this->setName('diagnostics:archiving-config');
$this->addNoValueOption('json', null,
"If supplied, the command will return data in json format");
$this->addNoValueOption(
'json',
null,
"If supplied, the command will return data in json format"
);
$this->setDescription('Show configuration settings that can affect archiving performance');
}

Expand Down
13 changes: 9 additions & 4 deletions plugins/Diagnostics/Commands/ArchivingInstanceStatistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ class ArchivingInstanceStatistics extends ConsoleCommand
protected function configure()
{
$this->setName('diagnostics:archiving-instance-statistics');
$this->addNoValueOption('json', null,
"If supplied, the command will return data in json format");
$this->addNoValueOption(
'json',
null,
"If supplied, the command will return data in json format"
);
$this->setDescription('Show data statistics which can affect archiving performance');
}

Expand Down Expand Up @@ -59,14 +62,16 @@ public function getArchivingInstanceStatistics(): array
[
Date::now()->setDay(1)->subMonth(1)->setTime('00:00:00')->toString('Y-m-d H:i:s'),
Date::now()->setDay(1)->subDay(1)->setTime('23:59:59')->toString('Y-m-d H:i:s')
])
]
)
];
$stats[] = ['Last 12 Month Hits', (int) Db::fetchOne(
"SELECT COUNT(*) FROM " . Common::prefixTable("log_link_visit_action") . " WHERE server_time >= ? AND server_time <= ?",
[
Date::now()->setDay(1)->subMonth(12)->setTime('00:00:00')->toString('Y-m-d H:i:s'),
Date::now()->setDay(1)->subDay(1)->setTime('23:59:59')->toString('Y-m-d H:i:s')
])
]
)
];
return $stats;
}
Expand Down
7 changes: 5 additions & 2 deletions plugins/Diagnostics/Commands/ArchivingMetrics.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ class ArchivingMetrics extends ConsoleCommand
protected function configure()
{
$this->setName('diagnostics:archiving-metrics');
$this->addNoValueOption('json', null,
"If supplied, the command will return data in json format");
$this->addNoValueOption(
'json',
null,
"If supplied, the command will return data in json format"
);
$this->setDescription('Show metrics describing the current archiving status');
}

Expand Down
7 changes: 5 additions & 2 deletions plugins/Diagnostics/Commands/ArchivingQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ class ArchivingQueue extends ConsoleCommand
protected function configure()
{
$this->setName('diagnostics:archiving-queue');
$this->addNoValueOption('json', null,
"If supplied, the command will return table data in json format");
$this->addNoValueOption(
'json',
null,
"If supplied, the command will return table data in json format"
);
$this->setDescription('Show the current state of the archive invalidations queue as a table');
}

Expand Down
14 changes: 10 additions & 4 deletions plugins/Diagnostics/Commands/ArchivingStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ class ArchivingStatus extends ConsoleCommand
protected function configure()
{
$this->setName('diagnostics:archiving-status');
$this->addNoValueOption('with-stats', null,
"If supplied, the command will include instance statistics such as monthly hits and site count");
$this->addOptionalValueOption('email', null,
"If supplied, the command will email the output to the supplied email address");
$this->addNoValueOption(
'with-stats',
null,
"If supplied, the command will include instance statistics such as monthly hits and site count"
);
$this->addOptionalValueOption(
'email',
null,
"If supplied, the command will email the output to the supplied email address"
);
$this->setDescription('');
}

Expand Down
6 changes: 4 additions & 2 deletions plugins/Diagnostics/Diagnostic/CronArchivingCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ public function execute()
$comment .= $this->translator->translate('Installation_NotSupported')
. ' ' . $this->translator->translate('Goals_Optional')
. ' (' . $this->translator->translate('General_Reasons') . ': ' . $reasonText . ')'
. $this->translator->translate('General_LearnMore',
[' <a target="_blank" href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/troubleshooting/how-to-make-the-diagnostic-managing-processes-via-cli-to-display-ok/') . '">', '</a>']);
. $this->translator->translate(
'General_LearnMore',
[' <a target="_blank" href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/troubleshooting/how-to-make-the-diagnostic-managing-processes-via-cli-to-display-ok/') . '">', '</a>']
);
$status = DiagnosticResult::STATUS_INFORMATIONAL;
}

Expand Down
6 changes: 4 additions & 2 deletions plugins/Diagnostics/Diagnostic/CronArchivingLastRunCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ public function execute()
$lastRunTime = (int)Option::get(CronArchive::OPTION_ARCHIVING_FINISHED_TS);
if (empty($lastRunTime)) {
$comment = $this->translator->translate('Diagnostics_CronArchivingHasNotRun')
. '<br/><br/>' . $this->translator->translate('Diagnostics_CronArchivingRunDetails',
[$coreArchiveShort, $mailto, $commandToRerun, '<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/docs/setup-auto-archiving/') . '" target="_blank" rel="noreferrer noopener">', '</a>']);
. '<br/><br/>' . $this->translator->translate(
'Diagnostics_CronArchivingRunDetails',
[$coreArchiveShort, $mailto, $commandToRerun, '<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/docs/setup-auto-archiving/') . '" target="_blank" rel="noreferrer noopener">', '</a>']
);
return [DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_ERROR, $comment)];
}

Expand Down
6 changes: 4 additions & 2 deletions plugins/Diagnostics/Diagnostic/DatabaseAbilitiesCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ protected function checkUtf8mb4Charset()

if (DbHelper::getDefaultCharset() === 'utf8mb4') {
return new DiagnosticResultItem(
DiagnosticResult::STATUS_WARNING, 'UTF8mb4 charset<br/><br/>' .
DiagnosticResult::STATUS_WARNING,
'UTF8mb4 charset<br/><br/>' .
$this->translator->translate('Diagnostics_DatabaseUtf8mb4CharsetAvailableButNotUsed', '<code>' . PIWIK_INCLUDE_PATH . '/console core:convert-to-utf8mb4</code>') .
'<br/><br/>' .
$this->translator->translate('Diagnostics_DatabaseUtf8Requirement', ['',
Expand All @@ -72,7 +73,8 @@ protected function checkUtf8mb4Charset()
}

return new DiagnosticResultItem(
DiagnosticResult::STATUS_WARNING, 'UTF8mb4 charset<br/><br/>' .
DiagnosticResult::STATUS_WARNING,
'UTF8mb4 charset<br/><br/>' .
$this->translator->translate('Diagnostics_DatabaseUtf8mb4CharsetRecommended') .
'<br/><br/>' .
$this->translator->translate('Diagnostics_DatabaseUtf8Requirement', ['',
Expand Down
8 changes: 6 additions & 2 deletions plugins/Diagnostics/Diagnostic/DbMaxPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ public function execute()
$formatter = new Formatter\Html();
$pretty = $formatter->getPrettySizeFromBytes($maxPacketBytes['Value'], 'M', $precision = 1);
$configured = str_replace(array(' M', '&nbsp;M'), 'MB', $pretty);
$comment = Piwik::translate('Diagnostics_MysqlMaxPacketSizeWarning',
$comment = Piwik::translate(
'Diagnostics_MysqlMaxPacketSizeWarning',
['<a href="https://dev.mysql.com/doc/refman/en/packet-too-large.html" rel="noreferrer noopener" target="_blank">',
'</a>', '64MB', $configured]);
'</a>',
'64MB',
$configured]
);
}

return array(DiagnosticResult::singleResult($label, $status, $comment));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ public function __construct(Translator $translator)

protected function addError(DiagnosticResult &$result)
{
$result->addItem(new DiagnosticResultItem(DiagnosticResult::STATUS_INFORMATIONAL,
$result->addItem(new DiagnosticResultItem(
DiagnosticResult::STATUS_INFORMATIONAL,
$this->translator->translate('Diagnostics_UrlsAccessibleViaBrowser') . ' ' .
$this->translator->translate('General_ReadThisToLearnMore', [
'<a target="_blank" rel="noopener noreferrer" href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/troubleshooting/how-do-i-fix-the-error-private-directories-are-accessible/') . '">',
'</a>',
])));
])
));
}
}
6 changes: 4 additions & 2 deletions plugins/Ecommerce/Reports/BaseItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ public function getMetricsDocumentation()
// we do not check whether it is abandon carts if not set re performance improvements
if ($this->isAbandonedCart($fetchIfNotSet = false)) {
return array(
'revenue' => Piwik::translate('Goals_ColumnRevenueDocumentation',
Piwik::translate('Goals_DocumentationRevenueGeneratedByProductSales')),
'revenue' => Piwik::translate(
'Goals_ColumnRevenueDocumentation',
Piwik::translate('Goals_DocumentationRevenueGeneratedByProductSales')
),
'quantity' => Piwik::translate('Goals_ColumnQuantityDocumentation', $this->name),
'orders' => Piwik::translate('Goals_ColumnOrdersDocumentation', $this->name),
'avg_price' => Piwik::translate('Goals_ColumnAveragePriceDocumentation', $this->name),
Expand Down
3 changes: 2 additions & 1 deletion plugins/Ecommerce/Tracker/EcommerceRequestProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public function afterRequestProcessed(VisitProperties $visitProperties, Request
$goalsConverted = $request->getMetadata('Goals', 'goalsConverted');
if (!empty($goalsConverted)) {
$isThereExistingCartInVisit = $this->goalManager->detectIsThereExistingCartInVisit(
$visitProperties->getProperties());
$visitProperties->getProperties()
);
$request->setMetadata('Goals', 'isThereExistingCartInVisit', $isThereExistingCartInVisit);
}
}
Expand Down
6 changes: 4 additions & 2 deletions plugins/Ecommerce/VisitorDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ public function extendVisitorDetails(&$visitor)
{
if(Site::isEcommerceEnabledFor($visitor['idSite']))
{
$ecommerceMetrics = $this->queryEcommerceConversionsVisitorLifeTimeMetricsForVisitor($visitor['idSite'],
$visitor['visitorId']);
$ecommerceMetrics = $this->queryEcommerceConversionsVisitorLifeTimeMetricsForVisitor(
$visitor['idSite'],
$visitor['visitorId']
);
$visitor['totalEcommerceRevenue'] = $ecommerceMetrics['totalEcommerceRevenue'];
$visitor['totalEcommerceConversions'] = $ecommerceMetrics['totalEcommerceConversions'];
$visitor['totalEcommerceItems'] = $ecommerceMetrics['totalEcommerceItems'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ private function setUpWebsitesAndGoals()

if (!self::goalExists($this->idSite, $this->idGoalStandard)) {
GoalsAPI::getInstance()->addGoal(
$this->idSite, 'title match, triggered NEVER', 'title', 'saldkfjaslkdfjsalkdjf', 'contains',
$caseSensitive = false, $revenue = 10, $allowMultipleConversions = true
$this->idSite,
'title match, triggered NEVER',
'title',
'saldkfjaslkdfjsalkdjf',
'contains',
$caseSensitive = false,
$revenue = 10,
$allowMultipleConversions = true
);
}
}
Expand Down
8 changes: 6 additions & 2 deletions plugins/ExampleLogTables/Dao/CustomGroupLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ public function addGroupInformation($group, $isAdmin)
$bind = array_values($columns);
$placeholder = Common::getSqlStringFieldsArray($columns);

$sql = sprintf('INSERT INTO %s (`%s`) VALUES(%s)',
$this->tablePrefixed, implode('`,`', array_keys($columns)), $placeholder);
$sql = sprintf(
'INSERT INTO %s (`%s`) VALUES(%s)',
$this->tablePrefixed,
implode('`,`', array_keys($columns)),
$placeholder
);

$db = $this->getDb();

Expand Down
8 changes: 6 additions & 2 deletions plugins/ExampleLogTables/Dao/CustomUserLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ public function addUserInformation($userId, $group, $gender)
$bind = array_values($columns);
$placeholder = Common::getSqlStringFieldsArray($columns);

$sql = sprintf('INSERT INTO %s (`%s`) VALUES(%s)',
$this->tablePrefixed, implode('`,`', array_keys($columns)), $placeholder);
$sql = sprintf(
'INSERT INTO %s (`%s`) VALUES(%s)',
$this->tablePrefixed,
implode('`,`', array_keys($columns)),
$placeholder
);

$db = $this->getDb();

Expand Down
12 changes: 7 additions & 5 deletions plugins/Feedback/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public function sendFeedbackForFeature($featureName, $like = null, $choice = nul

$body .= sprintf("Feedback:\n%s\n", trim($message));

$subject = sprintf("%s for %s",
$subject = sprintf(
"%s for %s",
empty($like) ? "-1" : "+1",
$featureName
);
Expand Down Expand Up @@ -106,10 +107,11 @@ public function sendFeedbackForSurvey($question, $message = false)

$body .= $feedbackMessage ? $feedbackMessage : " \n";

$subject = sprintf("%s for %s %s",
empty($like) ? "-1" : "+1",
$featureName,
empty($feedbackMessage) ? "" : "(w/ feedback Survey)"
$subject = sprintf(
"%s for %s %s",
empty($like) ? "-1" : "+1",
$featureName,
empty($feedbackMessage) ? "" : "(w/ feedback Survey)"
);

$this->sendMail($subject, $body);
Expand Down
Loading
Loading