From 53054b2bf6a919fd4ff9b44b6ad1986f21f488b6 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 22 Sep 2020 20:25:47 +0200 Subject: Apply PHP Code Beautifier on source code for linter automatic fixes --- application/updater/Updater.php | 6 ++++-- application/updater/UpdaterUtils.php | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'application/updater') diff --git a/application/updater/Updater.php b/application/updater/Updater.php index 88a7bc7b..3451cf36 100644 --- a/application/updater/Updater.php +++ b/application/updater/Updater.php @@ -88,7 +88,8 @@ class Updater foreach ($this->methods as $method) { // Not an update method or already done, pass. - if (! startsWith($method->getName(), 'updateMethod') + if ( + ! startsWith($method->getName(), 'updateMethod') || in_array($method->getName(), $this->doneUpdates) ) { continue; @@ -152,7 +153,8 @@ class Updater $updated = false; foreach ($this->bookmarkService->search() as $bookmark) { - if ($bookmark->isNote() + if ( + $bookmark->isNote() && startsWith($bookmark->getUrl(), '?') && 1 === preg_match('/^\?([a-zA-Z0-9-_@]{6})($|&|#)/', $bookmark->getUrl(), $match) ) { diff --git a/application/updater/UpdaterUtils.php b/application/updater/UpdaterUtils.php index 828a49fc..908bdc39 100644 --- a/application/updater/UpdaterUtils.php +++ b/application/updater/UpdaterUtils.php @@ -19,7 +19,7 @@ class UpdaterUtils return explode(';', $content); } } - return array(); + return []; } /** @@ -38,7 +38,7 @@ class UpdaterUtils $res = file_put_contents($updatesFilepath, implode(';', $updates)); if ($res === false) { - throw new \Exception('Unable to write updates in '. $updatesFilepath . '.'); + throw new \Exception('Unable to write updates in ' . $updatesFilepath . '.'); } } } -- cgit v1.2.3 From b99e00f7cd5f7e2090f44cd97bfb426db55340c2 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sun, 8 Nov 2020 15:02:45 +0100 Subject: Manually fix remaining PHPCS errors --- application/updater/Updater.php | 4 ++-- application/updater/UpdaterUtils.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'application/updater') diff --git a/application/updater/Updater.php b/application/updater/Updater.php index 3451cf36..4f557d0f 100644 --- a/application/updater/Updater.php +++ b/application/updater/Updater.php @@ -122,12 +122,12 @@ class Updater public function readUpdates(string $updatesFilepath): array { - return UpdaterUtils::read_updates_file($updatesFilepath); + return UpdaterUtils::readUpdatesFile($updatesFilepath); } public function writeUpdates(string $updatesFilepath, array $updates): void { - UpdaterUtils::write_updates_file($updatesFilepath, $updates); + UpdaterUtils::writeUpdatesFile($updatesFilepath, $updates); } /** diff --git a/application/updater/UpdaterUtils.php b/application/updater/UpdaterUtils.php index 908bdc39..206f826e 100644 --- a/application/updater/UpdaterUtils.php +++ b/application/updater/UpdaterUtils.php @@ -11,7 +11,7 @@ class UpdaterUtils * * @return array Already done update methods. */ - public static function read_updates_file($updatesFilepath) + public static function readUpdatesFile($updatesFilepath) { if (! empty($updatesFilepath) && is_file($updatesFilepath)) { $content = file_get_contents($updatesFilepath); @@ -30,7 +30,7 @@ class UpdaterUtils * * @throws \Exception Couldn't write version number. */ - public static function write_updates_file($updatesFilepath, $updates) + public static function writeUpdatesFile($updatesFilepath, $updates) { if (empty($updatesFilepath)) { throw new \Exception('Updates file path is not set, can\'t write updates.'); -- cgit v1.2.3