From afbd9c4e6ed834e713039f2cff88ba3eec03dadb Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Thu, 9 Apr 2020 13:53:40 +0200 Subject: Unify function spacing to PSR2 recommendation Signed-off-by: Christoph Wurst --- apps/files_versions/lib/AppInfo/Application.php | 2 +- apps/files_versions/lib/BackgroundJob/ExpireVersions.php | 2 +- apps/files_versions/lib/Command/ExpireVersions.php | 2 +- apps/files_versions/lib/Expiration.php | 12 ++++++------ apps/files_versions/lib/Hooks.php | 2 +- apps/files_versions/lib/Storage.php | 4 ++-- apps/files_versions/tests/ExpirationTest.php | 12 ++++++------ apps/files_versions/tests/VersioningTest.php | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) (limited to 'apps/files_versions') diff --git a/apps/files_versions/lib/AppInfo/Application.php b/apps/files_versions/lib/AppInfo/Application.php index 32ba9d40505..040b72a8f0a 100644 --- a/apps/files_versions/lib/AppInfo/Application.php +++ b/apps/files_versions/lib/AppInfo/Application.php @@ -75,7 +75,7 @@ class Application extends App { ); }); - $container->registerService(IVersionManager::class, function(IAppContainer $c) { + $container->registerService(IVersionManager::class, function (IAppContainer $c) { return new VersionManager(); }); diff --git a/apps/files_versions/lib/BackgroundJob/ExpireVersions.php b/apps/files_versions/lib/BackgroundJob/ExpireVersions.php index cb2e0abb0c4..eb4287376e9 100644 --- a/apps/files_versions/lib/BackgroundJob/ExpireVersions.php +++ b/apps/files_versions/lib/BackgroundJob/ExpireVersions.php @@ -58,7 +58,7 @@ class ExpireVersions extends \OC\BackgroundJob\TimedJob { return; } - $this->userManager->callForSeenUsers(function(IUser $user) { + $this->userManager->callForSeenUsers(function (IUser $user) { $uid = $user->getUID(); if (!$this->setupFS($uid)) { return; diff --git a/apps/files_versions/lib/Command/ExpireVersions.php b/apps/files_versions/lib/Command/ExpireVersions.php index ba12ce2a496..d67542db259 100644 --- a/apps/files_versions/lib/Command/ExpireVersions.php +++ b/apps/files_versions/lib/Command/ExpireVersions.php @@ -91,7 +91,7 @@ class ExpireVersions extends Command { } else { $p = new ProgressBar($output); $p->start(); - $this->userManager->callForSeenUsers(function(IUser $user) use ($p) { + $this->userManager->callForSeenUsers(function (IUser $user) use ($p) { $p->advance(); $this->expireVersionsForUser($user); }); diff --git a/apps/files_versions/lib/Expiration.php b/apps/files_versions/lib/Expiration.php index 6959de6a943..d57bc20dc81 100644 --- a/apps/files_versions/lib/Expiration.php +++ b/apps/files_versions/lib/Expiration.php @@ -47,7 +47,7 @@ class Expiration { /** @var bool */ private $canPurgeToSaveSpace; - public function __construct(IConfig $config,ITimeFactory $timeFactory){ + public function __construct(IConfig $config,ITimeFactory $timeFactory) { $this->timeFactory = $timeFactory; $this->retentionObligation = $config->getSystemValue('versions_retention_obligation', 'auto'); @@ -60,14 +60,14 @@ class Expiration { * Is versions expiration enabled * @return bool */ - public function isEnabled(){ + public function isEnabled() { return $this->retentionObligation !== 'disabled'; } /** * Is default expiration active */ - public function shouldAutoExpire(){ + public function shouldAutoExpire() { return $this->minAge === self::NO_OBLIGATION || $this->maxAge === self::NO_OBLIGATION; } @@ -78,7 +78,7 @@ class Expiration { * @param bool $quotaExceeded * @return bool */ - public function isExpired($timestamp, $quotaExceeded = false){ + public function isExpired($timestamp, $quotaExceeded = false) { // No expiration if disabled if (!$this->isEnabled()) { return false; @@ -119,7 +119,7 @@ class Expiration { * Get maximal retention obligation as a timestamp * @return int */ - public function getMaxAgeAsTimestamp(){ + public function getMaxAgeAsTimestamp() { $maxAge = false; if ($this->isEnabled() && $this->maxAge !== self::NO_OBLIGATION) { $time = $this->timeFactory->getTime(); @@ -132,7 +132,7 @@ class Expiration { * Read versions_retention_obligation, validate it * and set private members accordingly */ - private function parseRetentionObligation(){ + private function parseRetentionObligation() { $splitValues = explode(',', $this->retentionObligation); if (!isset($splitValues[0])) { $minValue = 'auto'; diff --git a/apps/files_versions/lib/Hooks.php b/apps/files_versions/lib/Hooks.php index b45b082865d..179a404ed9a 100644 --- a/apps/files_versions/lib/Hooks.php +++ b/apps/files_versions/lib/Hooks.php @@ -56,7 +56,7 @@ class Hooks { /** * listen to write event. */ - public static function write_hook( $params ) { + public static function write_hook($params) { $path = $params[Filesystem::signal_param_path]; if($path !== '') { Storage::store($path); diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index b1d6c689c61..1c4e424ec78 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -497,7 +497,7 @@ class Storage { * Expire versions that older than max version retention time * @param string $uid */ - public static function expireOlderThanMaxForUser($uid){ + public static function expireOlderThanMaxForUser($uid) { $expiration = self::getExpiration(); $threshold = $expiration->getMaxAgeAsTimestamp(); $versions = self::getAllVersions($uid); @@ -848,7 +848,7 @@ class Storage { * Static workaround * @return Expiration */ - protected static function getExpiration(){ + protected static function getExpiration() { if (self::$application === null) { self::$application = \OC::$server->query(Application::class); } diff --git a/apps/files_versions/tests/ExpirationTest.php b/apps/files_versions/tests/ExpirationTest.php index 1153d53bbaa..426d07e4b42 100644 --- a/apps/files_versions/tests/ExpirationTest.php +++ b/apps/files_versions/tests/ExpirationTest.php @@ -33,7 +33,7 @@ use PHPUnit\Framework\MockObject\MockObject; class ExpirationTest extends \Test\TestCase { const SECONDS_PER_DAY = 86400; //60*60*24 - public function expirationData(){ + public function expirationData() { $today = 100*self::SECONDS_PER_DAY; $back10Days = (100-10)*self::SECONDS_PER_DAY; $back20Days = (100-20)*self::SECONDS_PER_DAY; @@ -106,7 +106,7 @@ class ExpirationTest extends \Test\TestCase { * @param bool $quotaExceeded * @param string $expectedResult */ - public function testExpiration($retentionObligation, $timeNow, $timestamp, $quotaExceeded, $expectedResult){ + public function testExpiration($retentionObligation, $timeNow, $timestamp, $quotaExceeded, $expectedResult) { $mockedConfig = $this->getMockedConfig($retentionObligation); $mockedTimeFactory = $this->getMockedTimeFactory($timeNow); @@ -117,7 +117,7 @@ class ExpirationTest extends \Test\TestCase { } - public function configData(){ + public function configData() { return [ [ 'disabled', null, null, null], [ 'auto', Expiration::NO_OBLIGATION, Expiration::NO_OBLIGATION, true ], @@ -141,7 +141,7 @@ class ExpirationTest extends \Test\TestCase { * @param int $expectedMaxAge * @param bool $expectedCanPurgeToSaveSpace */ - public function testParseRetentionObligation($configValue, $expectedMinAge, $expectedMaxAge, $expectedCanPurgeToSaveSpace){ + public function testParseRetentionObligation($configValue, $expectedMinAge, $expectedMaxAge, $expectedCanPurgeToSaveSpace) { $mockedConfig = $this->getMockedConfig($configValue); $mockedTimeFactory = $this->getMockedTimeFactory( time() @@ -157,7 +157,7 @@ class ExpirationTest extends \Test\TestCase { * @param int $time * @return ITimeFactory|MockObject */ - private function getMockedTimeFactory($time){ + private function getMockedTimeFactory($time) { $mockedTimeFactory = $this->createMock(ITimeFactory::class); $mockedTimeFactory->expects($this->any()) ->method('getTime') @@ -170,7 +170,7 @@ class ExpirationTest extends \Test\TestCase { * @param string $returnValue * @return IConfig|MockObject */ - private function getMockedConfig($returnValue){ + private function getMockedConfig($returnValue) { $mockedConfig = $this->createMock(IConfig::class); $mockedConfig->expects($this->any()) ->method('getSystemValue') diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php index aa572a36ea9..ae052335a95 100644 --- a/apps/files_versions/tests/VersioningTest.php +++ b/apps/files_versions/tests/VersioningTest.php @@ -746,7 +746,7 @@ class VersioningTest extends \Test\TestCase { $eventHandler->expects($this->any()) ->method('callback') ->willReturnCallback( - function($p) use (&$params) { + function ($p) use (&$params) { $params = $p; } ); -- cgit v1.2.3