diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-10-05 15:12:57 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-10-05 20:25:24 +0200 |
commit | d9015a8c94bfd71fe484618a06d276701d3bf9ff (patch) | |
tree | 3f7a1cd6ec2fd982dd02de71b76076f7f01cef70 /lib/private | |
parent | d357f4b10fe1b59e1e07bb90641d647522c7bfe2 (diff) | |
download | nextcloud-server-d9015a8c94bfd71fe484618a06d276701d3bf9ff.tar.gz nextcloud-server-d9015a8c94bfd71fe484618a06d276701d3bf9ff.zip |
Format code to a single space around binary operators
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private')
74 files changed, 242 insertions, 242 deletions
diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php index 20f4afd0ded..36f5f2cd40a 100644 --- a/lib/private/AllConfig.php +++ b/lib/private/AllConfig.php @@ -351,7 +351,7 @@ class AllConfig implements \OCP\IConfig { // TODO - FIXME $this->fixDIInit(); - $sql = 'DELETE FROM `*PREFIX*preferences` '. + $sql = 'DELETE FROM `*PREFIX*preferences` '. 'WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?'; $this->connection->executeUpdate($sql, [$userId, $appName, $key]); @@ -369,7 +369,7 @@ class AllConfig implements \OCP\IConfig { // TODO - FIXME $this->fixDIInit(); - $sql = 'DELETE FROM `*PREFIX*preferences` '. + $sql = 'DELETE FROM `*PREFIX*preferences` '. 'WHERE `userid` = ?'; $this->connection->executeUpdate($sql, [$userId]); @@ -385,7 +385,7 @@ class AllConfig implements \OCP\IConfig { // TODO - FIXME $this->fixDIInit(); - $sql = 'DELETE FROM `*PREFIX*preferences` '. + $sql = 'DELETE FROM `*PREFIX*preferences` '. 'WHERE `appid` = ?'; $this->connection->executeUpdate($sql, [$appName]); @@ -408,7 +408,7 @@ class AllConfig implements \OCP\IConfig { return $this->userCache[$userId]; } if ($userId === null || $userId === '') { - $this->userCache[$userId]=[]; + $this->userCache[$userId] = []; return $this->userCache[$userId]; } @@ -457,7 +457,7 @@ class AllConfig implements \OCP\IConfig { $placeholders = (count($chunk) === 50) ? $placeholders50 : implode(',', array_fill(0, count($chunk), '?')); - $query = 'SELECT `userid`, `configvalue` ' . + $query = 'SELECT `userid`, `configvalue` ' . 'FROM `*PREFIX*preferences` ' . 'WHERE `appid` = ? AND `configkey` = ? ' . 'AND `userid` IN (' . $placeholders . ')'; @@ -483,7 +483,7 @@ class AllConfig implements \OCP\IConfig { // TODO - FIXME $this->fixDIInit(); - $sql = 'SELECT `userid` FROM `*PREFIX*preferences` ' . + $sql = 'SELECT `userid` FROM `*PREFIX*preferences` ' . 'WHERE `appid` = ? AND `configkey` = ? '; if ($this->getSystemValue('dbtype', 'sqlite') === 'oci') { @@ -515,7 +515,7 @@ class AllConfig implements \OCP\IConfig { // TODO - FIXME $this->fixDIInit(); - $sql = 'SELECT `userid` FROM `*PREFIX*preferences` ' . + $sql = 'SELECT `userid` FROM `*PREFIX*preferences` ' . 'WHERE `appid` = ? AND `configkey` = ? '; if ($this->getSystemValue('dbtype', 'sqlite') === 'oci') { diff --git a/lib/private/App/CodeChecker/CodeChecker.php b/lib/private/App/CodeChecker/CodeChecker.php index 13d6ff887f3..9dec9c9f4d7 100644 --- a/lib/private/App/CodeChecker/CodeChecker.php +++ b/lib/private/App/CodeChecker/CodeChecker.php @@ -40,10 +40,10 @@ class CodeChecker extends BasicEmitter { public const CLASS_IMPLEMENTS_NOT_ALLOWED = 1001; public const STATIC_CALL_NOT_ALLOWED = 1002; public const CLASS_CONST_FETCH_NOT_ALLOWED = 1003; - public const CLASS_NEW_NOT_ALLOWED = 1004; - public const OP_OPERATOR_USAGE_DISCOURAGED = 1005; - public const CLASS_USE_NOT_ALLOWED = 1006; - public const CLASS_METHOD_CALL_NOT_ALLOWED = 1007; + public const CLASS_NEW_NOT_ALLOWED = 1004; + public const OP_OPERATOR_USAGE_DISCOURAGED = 1005; + public const CLASS_USE_NOT_ALLOWED = 1006; + public const CLASS_METHOD_CALL_NOT_ALLOWED = 1007; /** @var Parser */ private $parser; diff --git a/lib/private/App/CodeChecker/NodeVisitor.php b/lib/private/App/CodeChecker/NodeVisitor.php index 635f1357ffd..c1bc04afb43 100644 --- a/lib/private/App/CodeChecker/NodeVisitor.php +++ b/lib/private/App/CodeChecker/NodeVisitor.php @@ -103,7 +103,7 @@ class NodeVisitor extends NodeVisitorAbstract { public function enterNode(Node $node) { if ($this->checkEqualOperatorUsage && $node instanceof Node\Expr\BinaryOp\Equal) { - $this->errors[]= [ + $this->errors[] = [ 'disallowedToken' => '==', 'errorCode' => CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED, 'line' => $node->getLine(), @@ -111,7 +111,7 @@ class NodeVisitor extends NodeVisitorAbstract { ]; } if ($this->checkEqualOperatorUsage && $node instanceof Node\Expr\BinaryOp\NotEqual) { - $this->errors[]= [ + $this->errors[] = [ 'disallowedToken' => '!=', 'errorCode' => CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED, 'line' => $node->getLine(), @@ -247,7 +247,7 @@ class NodeVisitor extends NodeVisitorAbstract { $lowerName = strtolower($name); if (isset($this->blackListedClassNames[$lowerName])) { - $this->errors[]= [ + $this->errors[] = [ 'disallowedToken' => $name, 'errorCode' => $errorCode, 'line' => $node->getLine(), @@ -261,7 +261,7 @@ class NodeVisitor extends NodeVisitorAbstract { $lowerName = strtolower($name); if (isset($this->blackListedConstants[$lowerName])) { - $this->errors[]= [ + $this->errors[] = [ 'disallowedToken' => $name, 'errorCode' => CodeChecker::CLASS_CONST_FETCH_NOT_ALLOWED, 'line' => $node->getLine(), @@ -275,7 +275,7 @@ class NodeVisitor extends NodeVisitorAbstract { $lowerName = strtolower($name); if (isset($this->blackListedFunctions[$lowerName])) { - $this->errors[]= [ + $this->errors[] = [ 'disallowedToken' => $name, 'errorCode' => CodeChecker::STATIC_CALL_NOT_ALLOWED, 'line' => $node->getLine(), @@ -289,7 +289,7 @@ class NodeVisitor extends NodeVisitorAbstract { $lowerName = strtolower($name); if (isset($this->blackListedMethods[$lowerName])) { - $this->errors[]= [ + $this->errors[] = [ 'disallowedToken' => $name, 'errorCode' => CodeChecker::CLASS_METHOD_CALL_NOT_ALLOWED, 'line' => $node->getLine(), diff --git a/lib/private/App/DependencyAnalyzer.php b/lib/private/App/DependencyAnalyzer.php index f63cb384b15..90f3b28d9c6 100644 --- a/lib/private/App/DependencyAnalyzer.php +++ b/lib/private/App/DependencyAnalyzer.php @@ -168,7 +168,7 @@ class DependencyAnalyzer { } if (isset($dependencies['php']['@attributes']['min-int-size'])) { $intSize = $dependencies['php']['@attributes']['min-int-size']; - if ($intSize > $this->platform->getIntSize()*8) { + if ($intSize > $this->platform->getIntSize() * 8) { $missing[] = (string)$this->l->t('%sbit or higher PHP required.', [$intSize]); } } diff --git a/lib/private/AppFramework/App.php b/lib/private/AppFramework/App.php index 563ef6bffa8..d93849a6db6 100644 --- a/lib/private/AppFramework/App.php +++ b/lib/private/AppFramework/App.php @@ -60,7 +60,7 @@ class App { * the transformed app id, defaults to OCA\ * @return string the starting namespace for the app */ - public static function buildAppNamespace(string $appId, string $topNamespace='OCA\\'): string { + public static function buildAppNamespace(string $appId, string $topNamespace = 'OCA\\'): string { // Hit the cache! if (isset(self::$nameSpaceCache[$appId])) { return $topNamespace . self::$nameSpaceCache[$appId]; @@ -88,7 +88,7 @@ class App { return $topNamespace . self::$nameSpaceCache[$appId]; } - public static function getAppIdForClass(string $className, string $topNamespace='OCA\\'): ?string { + public static function getAppIdForClass(string $className, string $topNamespace = 'OCA\\'): ?string { if (strpos($className, $topNamespace) !== 0) { return null; } @@ -223,7 +223,7 @@ class App { $dispatcher = $container['Dispatcher']; - list(, , $output) = $dispatcher->dispatch($controller, $methodName); + list(, , $output) = $dispatcher->dispatch($controller, $methodName); return $output; } } diff --git a/lib/private/AppFramework/Http.php b/lib/private/AppFramework/Http.php index 88e49816eb9..828efe390e7 100644 --- a/lib/private/AppFramework/Http.php +++ b/lib/private/AppFramework/Http.php @@ -41,7 +41,7 @@ class Http extends BaseHttp { * @param array $server $_SERVER * @param string $protocolVersion the http version to use defaults to HTTP/1.1 */ - public function __construct($server, $protocolVersion='HTTP/1.1') { + public function __construct($server, $protocolVersion = 'HTTP/1.1') { $this->server = $server; $this->protocolVersion = $protocolVersion; diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index dcc3c8ec68d..3705ab2e92d 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -136,7 +136,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @param string $stream * @see http://www.php.net/manual/en/reserved.variables.php */ - public function __construct(array $vars= [], + public function __construct(array $vars = [], ISecureRandom $secureRandom = null, IConfig $config, CsrfTokenManager $csrfTokenManager = null, @@ -827,7 +827,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { */ public function getScriptName(): string { $name = $this->server['SCRIPT_NAME']; - $overwriteWebRoot = $this->config->getSystemValue('overwritewebroot'); + $overwriteWebRoot = $this->config->getSystemValue('overwritewebroot'); if ($overwriteWebRoot !== '' && $this->isOverwriteCondition()) { // FIXME: This code is untestable due to __DIR__, also that hardcoded path is really dangerous $serverRoot = str_replace('\\', '/', substr(__DIR__, 0, -\strlen('lib/private/appframework/http/'))); diff --git a/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php b/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php index 270058dc554..577931b8222 100644 --- a/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php +++ b/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php @@ -116,7 +116,7 @@ class MiddlewareDispatcher { * @throws \Exception the passed in exception if it can't handle it */ public function afterException(Controller $controller, string $methodName, \Exception $exception): Response { - for ($i=$this->middlewareCounter-1; $i>=0; $i--) { + for ($i = $this->middlewareCounter - 1; $i >= 0; $i--) { $middleware = $this->middlewares[$i]; try { return $middleware->afterException($controller, $methodName, $exception); @@ -139,7 +139,7 @@ class MiddlewareDispatcher { * @return Response a Response object */ public function afterController(Controller $controller, string $methodName, Response $response): Response { - for ($i= \count($this->middlewares)-1; $i>=0; $i--) { + for ($i = \count($this->middlewares) - 1; $i >= 0; $i--) { $middleware = $this->middlewares[$i]; $response = $middleware->afterController($controller, $methodName, $response); } @@ -158,7 +158,7 @@ class MiddlewareDispatcher { * @return string the output that should be printed */ public function beforeOutput(Controller $controller, string $methodName, string $output): string { - for ($i= \count($this->middlewares)-1; $i>=0; $i--) { + for ($i = \count($this->middlewares) - 1; $i >= 0; $i--) { $middleware = $this->middlewares[$i]; $output = $middleware->beforeOutput($controller, $methodName, $output); } diff --git a/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php b/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php index af6d3de6570..765311858de 100644 --- a/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php @@ -145,7 +145,7 @@ class CORSMiddleware extends Middleware { */ public function afterException($controller, $methodName, \Exception $exception) { if ($exception instanceof SecurityException) { - $response = new JSONResponse(['message' => $exception->getMessage()]); + $response = new JSONResponse(['message' => $exception->getMessage()]); if ($exception->getCode() !== 0) { $response->setStatus($exception->getCode()); } else { diff --git a/lib/private/AppFramework/Middleware/Security/SameSiteCookieMiddleware.php b/lib/private/AppFramework/Middleware/Security/SameSiteCookieMiddleware.php index 7a358f6ebf2..48d386e749e 100644 --- a/lib/private/AppFramework/Middleware/Security/SameSiteCookieMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/SameSiteCookieMiddleware.php @@ -48,7 +48,7 @@ class SameSiteCookieMiddleware extends Middleware { public function beforeController($controller, $methodName) { $requestUri = $this->request->getScriptName(); $processingScript = explode('/', $requestUri); - $processingScript = $processingScript[count($processingScript)-1]; + $processingScript = $processingScript[count($processingScript) - 1]; if ($processingScript !== 'index.php') { return; diff --git a/lib/private/AppFramework/OCS/V1Response.php b/lib/private/AppFramework/OCS/V1Response.php index 5a3e4090425..8264c4ea2c0 100644 --- a/lib/private/AppFramework/OCS/V1Response.php +++ b/lib/private/AppFramework/OCS/V1Response.php @@ -35,7 +35,7 @@ class V1Response extends BaseResponse { * @return int */ public function getStatus() { - $status = parent::getStatus(); + $status = parent::getStatus(); if ($status === Http::STATUS_FORBIDDEN || $status === API::RESPOND_UNAUTHORISED) { return Http::STATUS_UNAUTHORIZED; } diff --git a/lib/private/AppFramework/OCS/V2Response.php b/lib/private/AppFramework/OCS/V2Response.php index b6863262d81..3d1868857ce 100644 --- a/lib/private/AppFramework/OCS/V2Response.php +++ b/lib/private/AppFramework/OCS/V2Response.php @@ -36,7 +36,7 @@ class V2Response extends BaseResponse { * @return int */ public function getStatus() { - $status = parent::getStatus(); + $status = parent::getStatus(); if ($status === API::RESPOND_UNAUTHORISED) { return Http::STATUS_UNAUTHORIZED; } elseif ($status === API::RESPOND_NOT_FOUND) { diff --git a/lib/private/Archive/Archive.php b/lib/private/Archive/Archive.php index ee27009ca83..633e5e8ab0e 100644 --- a/lib/private/Archive/Archive.php +++ b/lib/private/Archive/Archive.php @@ -47,7 +47,7 @@ abstract class Archive { * @param string $source either a local file or string data * @return bool */ - abstract public function addFile($path, $source=''); + abstract public function addFile($path, $source = ''); /** * rename a file or folder in the archive * @param string $source diff --git a/lib/private/Archive/ZIP.php b/lib/private/Archive/ZIP.php index 31aea420a3d..fd34f4d4cea 100644 --- a/lib/private/Archive/ZIP.php +++ b/lib/private/Archive/ZIP.php @@ -39,15 +39,15 @@ class ZIP extends Archive { /** * @var \ZipArchive zip */ - private $zip=null; + private $zip = null; private $path; /** * @param string $source */ public function __construct($source) { - $this->path=$source; - $this->zip=new \ZipArchive(); + $this->path = $source; + $this->zip = new \ZipArchive(); if ($this->zip->open($source, \ZipArchive::CREATE)) { } else { \OCP\Util::writeLog('files_archive', 'Error while opening archive '.$source, ILogger::WARN); @@ -67,11 +67,11 @@ class ZIP extends Archive { * @param string $source either a local file or string data * @return bool */ - public function addFile($path, $source='') { - if ($source and $source[0]=='/' and file_exists($source)) { - $result=$this->zip->addFile($source, $path); + public function addFile($path, $source = '') { + if ($source and $source[0] == '/' and file_exists($source)) { + $result = $this->zip->addFile($source, $path); } else { - $result=$this->zip->addFromString($path, $source); + $result = $this->zip->addFromString($path, $source); } if ($result) { $this->zip->close();//close and reopen to save the zip @@ -86,8 +86,8 @@ class ZIP extends Archive { * @return boolean|null */ public function rename($source, $dest) { - $source=$this->stripPath($source); - $dest=$this->stripPath($dest); + $source = $this->stripPath($source); + $dest = $this->stripPath($dest); $this->zip->renameName($source, $dest); } /** @@ -96,7 +96,7 @@ class ZIP extends Archive { * @return int */ public function filesize($path) { - $stat=$this->zip->statName($path); + $stat = $this->zip->statName($path); return $stat['size']; } /** @@ -113,13 +113,13 @@ class ZIP extends Archive { * @return array */ public function getFolder($path) { - $files=$this->getFiles(); - $folderContent=[]; - $pathLength=strlen($path); + $files = $this->getFiles(); + $folderContent = []; + $pathLength = strlen($path); foreach ($files as $file) { - if (substr($file, 0, $pathLength)==$path and $file!=$path) { - if (strrpos(substr($file, 0, -1), '/')<=$pathLength) { - $folderContent[]=substr($file, $pathLength); + if (substr($file, 0, $pathLength) == $path and $file != $path) { + if (strrpos(substr($file, 0, -1), '/') <= $pathLength) { + $folderContent[] = substr($file, $pathLength); } } } @@ -130,10 +130,10 @@ class ZIP extends Archive { * @return array */ public function getFiles() { - $fileCount=$this->zip->numFiles; - $files=[]; - for ($i=0;$i<$fileCount;$i++) { - $files[]=$this->zip->getNameIndex($i); + $fileCount = $this->zip->numFiles; + $files = []; + for ($i = 0;$i < $fileCount;$i++) { + $files[] = $this->zip->getNameIndex($i); } return $files; } @@ -169,7 +169,7 @@ class ZIP extends Archive { * @return bool */ public function fileExists($path) { - return ($this->zip->locateName($path)!==false) or ($this->zip->locateName($path.'/')!==false); + return ($this->zip->locateName($path) !== false) or ($this->zip->locateName($path.'/') !== false); } /** * remove a file or folder from the archive @@ -190,16 +190,16 @@ class ZIP extends Archive { * @return resource */ public function getStream($path, $mode) { - if ($mode=='r' or $mode=='rb') { + if ($mode == 'r' or $mode == 'rb') { return $this->zip->getStream($path); } else { //since we can't directly get a writable stream, //make a temp copy of the file and put it back //in the archive when the stream is closed - if (strrpos($path, '.')!==false) { - $ext=substr($path, strrpos($path, '.')); + if (strrpos($path, '.') !== false) { + $ext = substr($path, strrpos($path, '.')); } else { - $ext=''; + $ext = ''; } $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext); if ($this->fileExists($path)) { @@ -225,7 +225,7 @@ class ZIP extends Archive { * @return string */ private function stripPath($path) { - if (!$path || $path[0]=='/') { + if (!$path || $path[0] == '/') { return substr($path, 1); } else { return $path; diff --git a/lib/private/Authentication/Token/DefaultToken.php b/lib/private/Authentication/Token/DefaultToken.php index 9df907dfb4a..d91866ae66f 100644 --- a/lib/private/Authentication/Token/DefaultToken.php +++ b/lib/private/Authentication/Token/DefaultToken.php @@ -163,7 +163,7 @@ class DefaultToken extends Entity implements INamedToken { $scope = json_decode($this->getScope(), true); if (!$scope) { return [ - 'filesystem'=> true + 'filesystem' => true ]; } return $scope; diff --git a/lib/private/Authentication/Token/PublicKeyToken.php b/lib/private/Authentication/Token/PublicKeyToken.php index 320373436f1..d2336c81efd 100644 --- a/lib/private/Authentication/Token/PublicKeyToken.php +++ b/lib/private/Authentication/Token/PublicKeyToken.php @@ -180,7 +180,7 @@ class PublicKeyToken extends Entity implements INamedToken, IWipeableToken { $scope = json_decode($this->getScope(), true); if (!$scope) { return [ - 'filesystem'=> true + 'filesystem' => true ]; } return $scope; diff --git a/lib/private/Calendar/Manager.php b/lib/private/Calendar/Manager.php index ab8af870221..f8401259eb4 100644 --- a/lib/private/Calendar/Manager.php +++ b/lib/private/Calendar/Manager.php @@ -31,12 +31,12 @@ class Manager implements \OCP\Calendar\IManager { /** * @var ICalendar[] holds all registered calendars */ - private $calendars=[]; + private $calendars = []; /** * @var \Closure[] to call to load/register calendar providers */ - private $calendarLoaders=[]; + private $calendarLoaders = []; /** * This function is used to search and find objects within the user's calendars. @@ -51,7 +51,7 @@ class Manager implements \OCP\Calendar\IManager { * @return array an array of events/journals/todos which are arrays of arrays of key-value-pairs * @since 13.0.0 */ - public function search($pattern, array $searchProperties=[], array $options=[], $limit=null, $offset=null) { + public function search($pattern, array $searchProperties = [], array $options = [], $limit = null, $offset = null) { $this->loadCalendars(); $result = []; foreach ($this->calendars as $calendar) { diff --git a/lib/private/Collaboration/AutoComplete/Manager.php b/lib/private/Collaboration/AutoComplete/Manager.php index dc3b76f1f4d..d03de3a9fd3 100644 --- a/lib/private/Collaboration/AutoComplete/Manager.php +++ b/lib/private/Collaboration/AutoComplete/Manager.php @@ -30,7 +30,7 @@ use OCP\IServerContainer; class Manager implements IManager { /** @var string[] */ - protected $sorters =[]; + protected $sorters = []; /** @var ISorter[] */ protected $sorterInstances = []; diff --git a/lib/private/Collaboration/Collaborators/GroupPlugin.php b/lib/private/Collaboration/Collaborators/GroupPlugin.php index f65763a5007..18a6631ed80 100644 --- a/lib/private/Collaboration/Collaborators/GroupPlugin.php +++ b/lib/private/Collaboration/Collaborators/GroupPlugin.php @@ -71,7 +71,7 @@ class GroupPlugin implements ISearchPlugin { $hasMoreResults = true; } - $userGroups = []; + $userGroups = []; if (!empty($groups) && ($this->shareWithGroupOnly || $this->shareeEnumerationInGroupOnly)) { // Intersect all the groups that match with the groups this user is a member of $userGroups = $this->groupManager->getUserGroups($this->userSession->getUser()); diff --git a/lib/private/Comments/Comment.php b/lib/private/Comments/Comment.php index 7c553c25a1c..7368425174a 100644 --- a/lib/private/Comments/Comment.php +++ b/lib/private/Comments/Comment.php @@ -32,19 +32,19 @@ use OCP\Comments\MessageTooLongException; class Comment implements IComment { protected $data = [ - 'id' => '', - 'parentId' => '0', + 'id' => '', + 'parentId' => '0', 'topmostParentId' => '0', - 'childrenCount' => '0', - 'message' => '', - 'verb' => '', - 'actorType' => '', - 'actorId' => '', - 'objectType' => '', - 'objectId' => '', - 'referenceId' => null, - 'creationDT' => null, - 'latestChildDT' => null, + 'childrenCount' => '0', + 'message' => '', + 'verb' => '', + 'actorType' => '', + 'actorId' => '', + 'objectType' => '', + 'objectId' => '', + 'referenceId' => null, + 'creationDT' => null, + 'latestChildDT' => null, ]; /** @@ -301,12 +301,12 @@ class Comment implements IComment { public function setActor($actorType, $actorId) { if ( !is_string($actorType) || !trim($actorType) - || !is_string($actorId) || $actorId === '' + || !is_string($actorId) || $actorId === '' ) { throw new \InvalidArgumentException('String expected.'); } $this->data['actorType'] = trim($actorType); - $this->data['actorId'] = $actorId; + $this->data['actorId'] = $actorId; return $this; } @@ -387,12 +387,12 @@ class Comment implements IComment { public function setObject($objectType, $objectId) { if ( !is_string($objectType) || !trim($objectType) - || !is_string($objectId) || trim($objectId) === '' + || !is_string($objectId) || trim($objectId) === '' ) { throw new \InvalidArgumentException('String expected.'); } $this->data['objectType'] = trim($objectType); - $this->data['objectId'] = trim($objectId); + $this->data['objectId'] = trim($objectId); return $this; } diff --git a/lib/private/DB/Adapter.php b/lib/private/DB/Adapter.php index 562fea25f5c..26fd018dec1 100644 --- a/lib/private/DB/Adapter.php +++ b/lib/private/DB/Adapter.php @@ -103,7 +103,7 @@ class Adapter { } $query = 'INSERT INTO `' .$table . '` (`' . implode('`,`', array_keys($input)) . '`) SELECT ' - . str_repeat('?,', count($input)-1).'? ' // Is there a prettier alternative? + . str_repeat('?,', count($input) - 1).'? ' // Is there a prettier alternative? . 'FROM `' . $table . '` WHERE '; $inserts = array_values($input); diff --git a/lib/private/DB/AdapterSqlite.php b/lib/private/DB/AdapterSqlite.php index 43ec4a90c62..5731ee1721a 100644 --- a/lib/private/DB/AdapterSqlite.php +++ b/lib/private/DB/AdapterSqlite.php @@ -71,7 +71,7 @@ class AdapterSqlite extends Adapter { } $fieldList = '`' . implode('`,`', array_keys($input)) . '`'; $query = "INSERT INTO `$table` ($fieldList) SELECT " - . str_repeat('?,', count($input)-1).'? ' + . str_repeat('?,', count($input) - 1).'? ' . " WHERE NOT EXISTS (SELECT 1 FROM `$table` WHERE "; $inserts = array_values($input); diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index ba3e6aae5bc..c6c01930cc4 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -175,7 +175,7 @@ class Connection extends ReconnectWrapper implements IDBConnection { * @param int $offset * @return \Doctrine\DBAL\Driver\Statement The prepared statement. */ - public function prepare($statement, $limit=null, $offset=null) { + public function prepare($statement, $limit = null, $offset = null) { if ($limit === -1) { $limit = null; } diff --git a/lib/private/DB/Migrator.php b/lib/private/DB/Migrator.php index be3d6557e95..7cb642401cb 100644 --- a/lib/private/DB/Migrator.php +++ b/lib/private/DB/Migrator.php @@ -304,13 +304,13 @@ class Migrator { if (is_null($this->dispatcher)) { return; } - $this->dispatcher->dispatch('\OC\DB\Migrator::executeSql', new GenericEvent($sql, [$step+1, $max])); + $this->dispatcher->dispatch('\OC\DB\Migrator::executeSql', new GenericEvent($sql, [$step + 1, $max])); } private function emitCheckStep($tableName, $step, $max) { if (is_null($this->dispatcher)) { return; } - $this->dispatcher->dispatch('\OC\DB\Migrator::checkTable', new GenericEvent($tableName, [$step+1, $max])); + $this->dispatcher->dispatch('\OC\DB\Migrator::checkTable', new GenericEvent($tableName, [$step + 1, $max])); } } diff --git a/lib/private/DirectEditing/Manager.php b/lib/private/DirectEditing/Manager.php index 3542aeed252..0e7e988eef2 100644 --- a/lib/private/DirectEditing/Manager.php +++ b/lib/private/DirectEditing/Manager.php @@ -121,7 +121,7 @@ class Manager implements IManager { } } $return = []; - $return['templates'] = $templates; + $return['templates'] = $templates; return $return; } diff --git a/lib/private/Encryption/Keys/Storage.php b/lib/private/Encryption/Keys/Storage.php index 43a291b886c..248011aee5b 100644 --- a/lib/private/Encryption/Keys/Storage.php +++ b/lib/private/Encryption/Keys/Storage.php @@ -269,7 +269,7 @@ class Storage implements IStorage { if ($this->view->file_exists($path)) { if (isset($this->keyCache[$path])) { - $key = $this->keyCache[$path]; + $key = $this->keyCache[$path]; } else { $data = $this->view->file_get_contents($path); diff --git a/lib/private/Encryption/Util.php b/lib/private/Encryption/Util.php index 0bda00a5cbc..f5107d2ec43 100644 --- a/lib/private/Encryption/Util.php +++ b/lib/private/Encryption/Util.php @@ -174,7 +174,7 @@ class Util { if ($c->getType() === 'dir') { $dirList[] = $c->getPath(); } else { - $result[] = $c->getPath(); + $result[] = $c->getPath(); } } } @@ -255,7 +255,7 @@ class Util { // if path also contains a transaction id, we remove it too $extension = pathinfo($fPath, PATHINFO_EXTENSION); if (substr($extension, 0, 12) === 'ocTransferId') { // 12 = strlen("ocTransferId") - $newLength = strlen($fPath) - strlen($extension) -1; + $newLength = strlen($fPath) - strlen($extension) - 1; $fPath = substr($fPath, 0, $newLength); } return $fPath; diff --git a/lib/private/Federation/CloudFederationProviderManager.php b/lib/private/Federation/CloudFederationProviderManager.php index 459d82c5bfb..56bc9a95322 100644 --- a/lib/private/Federation/CloudFederationProviderManager.php +++ b/lib/private/Federation/CloudFederationProviderManager.php @@ -75,7 +75,7 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager IClientService $httpClientService, ICloudIdManager $cloudIdManager, ILogger $logger) { - $this->cloudFederationProvider= []; + $this->cloudFederationProvider = []; $this->appManager = $appManager; $this->httpClientService = $httpClientService; $this->cloudIdManager = $cloudIdManager; diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index 3c6bdd3b5a0..8f42aff85bb 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -95,7 +95,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { * @param \OCP\Files\Mount\IMountPoint $mount * @param \OCP\IUser|null $owner */ - public function __construct($path, $storage, $internalPath, $data, $mount, $owner= null) { + public function __construct($path, $storage, $internalPath, $data, $mount, $owner = null) { $this->path = $path; $this->storage = $storage; $this->internalPath = $internalPath; diff --git a/lib/private/Files/ObjectStore/S3Signature.php b/lib/private/Files/ObjectStore/S3Signature.php index f83b0e0064e..ab8854849fa 100644 --- a/lib/private/Files/ObjectStore/S3Signature.php +++ b/lib/private/Files/ObjectStore/S3Signature.php @@ -129,7 +129,7 @@ class S3Signature implements SignatureInterface { ) { $modify = [ 'remove_headers' => ['X-Amz-Date'], - 'set_headers' => ['Date' => gmdate(\DateTime::RFC2822)] + 'set_headers' => ['Date' => gmdate(\DateTime::RFC2822)] ]; // Add the security token header if one is being used by the credentials diff --git a/lib/private/Files/Storage/CommonTest.php b/lib/private/Files/Storage/CommonTest.php index b59090893d4..43a87f8d704 100644 --- a/lib/private/Files/Storage/CommonTest.php +++ b/lib/private/Files/Storage/CommonTest.php @@ -41,7 +41,7 @@ class CommonTest extends \OC\Files\Storage\Common { private $storage; public function __construct($params) { - $this->storage=new \OC\Files\Storage\Local($params); + $this->storage = new \OC\Files\Storage\Local($params); } public function getId() { @@ -80,7 +80,7 @@ class CommonTest extends \OC\Files\Storage\Common { public function free_space($path) { return $this->storage->free_space($path); } - public function touch($path, $mtime=null) { + public function touch($path, $mtime = null) { return $this->storage->touch($path, $mtime); } } diff --git a/lib/private/Files/Stream/Encryption.php b/lib/private/Files/Stream/Encryption.php index 980be6d043e..76668b14008 100644 --- a/lib/private/Files/Stream/Encryption.php +++ b/lib/private/Files/Stream/Encryption.php @@ -432,7 +432,7 @@ class Encryption extends Wrapper { public function stream_close() { $this->flush('end'); - $position = (int)floor($this->position/$this->unencryptedBlockSize); + $position = (int)floor($this->position / $this->unencryptedBlockSize); $remainingData = $this->encryptionModule->end($this->fullPath, $position . 'end'); if ($this->readOnly === false) { if (!empty($remainingData)) { @@ -465,7 +465,7 @@ class Encryption extends Wrapper { // automatically attempted when the file is written to disk - // we are handling that separately here and we don't want to // get into an infinite loop - $position = (int)floor($this->position/$this->unencryptedBlockSize); + $position = (int)floor($this->position / $this->unencryptedBlockSize); $encrypted = $this->encryptionModule->encrypt($this->cache, $position . $positionPrefix); $bytesWritten = parent::stream_write($encrypted); $this->writeFlag = false; @@ -473,8 +473,8 @@ class Encryption extends Wrapper { // If so then update the encrypted filesize // Note that the unencrypted pointer and filesize are NOT yet updated when flush() is called // We recalculate the encrypted filesize as we do not know the context of calling flush() - $completeBlocksInFile=(int)floor($this->unencryptedSize/$this->unencryptedBlockSize); - if ($completeBlocksInFile === (int)floor($this->position/$this->unencryptedBlockSize)) { + $completeBlocksInFile = (int)floor($this->unencryptedSize / $this->unencryptedBlockSize); + if ($completeBlocksInFile === (int)floor($this->position / $this->unencryptedBlockSize)) { $this->size = $this->util->getBlockSize() * $completeBlocksInFile; $this->size += $bytesWritten; $this->size += $this->headerSize; @@ -493,7 +493,7 @@ class Encryption extends Wrapper { if ($this->cache === '' && !($this->position === $this->unencryptedSize && ($this->position % $this->unencryptedBlockSize) === 0)) { // Get the data from the file handle $data = $this->stream_read_block($this->util->getBlockSize()); - $position = (int)floor($this->position/$this->unencryptedBlockSize); + $position = (int)floor($this->position / $this->unencryptedBlockSize); $numberOfChunks = (int)($this->unencryptedSize / $this->unencryptedBlockSize); if ($numberOfChunks === $position) { $position .= 'end'; diff --git a/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php b/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php index c015c4c1579..a6cef00764e 100644 --- a/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php +++ b/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php @@ -173,8 +173,8 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS */ public function jsonSerialize() { return [ - 'type' => $this->getType(), - 'field' => $this->getField(), + 'type' => $this->getType(), + 'field' => $this->getField(), 'values' => $this->getValues() ]; } diff --git a/lib/private/Installer.php b/lib/private/Installer.php index 9be79ac72bb..47d6c42d518 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -173,10 +173,10 @@ class Installer { \OC::$server->getConfig()->setAppValue($info['id'], 'enabled', 'no'); //set remote/public handlers - foreach ($info['remote'] as $name=>$path) { + foreach ($info['remote'] as $name => $path) { \OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $info['id'].'/'.$path); } - foreach ($info['public'] as $name=>$path) { + foreach ($info['public'] as $name => $path) { \OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $info['id'].'/'.$path); } @@ -455,7 +455,7 @@ class Installer { */ public function isDownloaded($name) { foreach (\OC::$APPSROOTS as $dir) { - $dirToTest = $dir['path']; + $dirToTest = $dir['path']; $dirToTest .= '/'; $dirToTest .= $name; $dirToTest .= '/'; @@ -535,7 +535,7 @@ class Installer { if ($filename[0] !== '.' and is_dir($app_dir['path']."/$filename")) { if (file_exists($app_dir['path']."/$filename/appinfo/info.xml")) { if ($config->getAppValue($filename, "installed_version", null) === null) { - $info=OC_App::getAppInfo($filename); + $info = OC_App::getAppInfo($filename); $enabled = isset($info['default_enable']); if (($enabled || in_array($filename, $appManager->getAlwaysEnabledApps())) && $config->getAppValue($filename, 'enabled') !== 'no') { @@ -609,10 +609,10 @@ class Installer { } //set remote/public handlers - foreach ($info['remote'] as $name=>$path) { + foreach ($info['remote'] as $name => $path) { $config->setAppValue('core', 'remote_'.$name, $app.'/'.$path); } - foreach ($info['public'] as $name=>$path) { + foreach ($info['public'] as $name => $path) { $config->setAppValue('core', 'public_'.$name, $app.'/'.$path); } diff --git a/lib/private/LargeFileHelper.php b/lib/private/LargeFileHelper.php index 6d03e78ab56..b07d77a02fa 100755 --- a/lib/private/LargeFileHelper.php +++ b/lib/private/LargeFileHelper.php @@ -193,7 +193,7 @@ class LargeFileHelper { try { $result = filemtime($fullPath); } catch (\Exception $e) { - $result =- 1; + $result = - 1; } if ($result < 0) { if (\OC_Helper::is_function_enabled('exec')) { diff --git a/lib/private/Log/ErrorHandler.php b/lib/private/Log/ErrorHandler.php index e87da0b5d83..b58fae60d51 100644 --- a/lib/private/Log/ErrorHandler.php +++ b/lib/private/Log/ErrorHandler.php @@ -41,7 +41,7 @@ class ErrorHandler { return preg_replace('/\/\/(.*):(.*)@/', '//xxx:xxx@', $msg); } - public static function register($debug=false) { + public static function register($debug = false) { $handler = new ErrorHandler(); if ($debug) { diff --git a/lib/private/Log/File.php b/lib/private/Log/File.php index b2fb16029c8..289afed9179 100644 --- a/lib/private/Log/File.php +++ b/lib/private/Log/File.php @@ -107,7 +107,7 @@ class File extends LogDetails implements IWriter, IFileBased { * @param int $offset * @return array */ - public function getEntries(int $limit=50, int $offset=0):array { + public function getEntries(int $limit = 50, int $offset = 0):array { $minLevel = $this->config->getValue("loglevel", ILogger::WARN); $entries = []; $handle = @fopen($this->logFile, 'rb'); @@ -118,7 +118,7 @@ class File extends LogDetails implements IWriter, IFileBased { $entriesCount = 0; $lines = 0; // Loop through each character of the file looking for new lines - while ($pos >= 0 && ($limit === null ||$entriesCount < $limit)) { + while ($pos >= 0 && ($limit === null || $entriesCount < $limit)) { fseek($handle, $pos); $ch = fgetc($handle); if ($ch == "\n" || $pos == 0) { diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php index ade4390cec7..f274d8acdb1 100644 --- a/lib/private/Mail/EMailTemplate.php +++ b/lib/private/Mail/EMailTemplate.php @@ -500,7 +500,7 @@ EOF; $label = ($plainMetaInfo !== false)? $plainMetaInfo : ''; $this->plainBody .= sprintf("%${plainIndent}s %s\n", $label, - str_replace("\n", "\n" . str_repeat(' ', $plainIndent+1), $plainText)); + str_replace("\n", "\n" . str_repeat(' ', $plainIndent + 1), $plainText)); } } } @@ -595,7 +595,7 @@ EOF; $this->plainBody .= $plainText . ': '; } - $this->plainBody .= $url . PHP_EOL; + $this->plainBody .= $url . PHP_EOL; } /** diff --git a/lib/private/Memcache/Memcached.php b/lib/private/Memcache/Memcached.php index eff76a41c45..7b852a418e1 100644 --- a/lib/private/Memcache/Memcached.php +++ b/lib/private/Memcache/Memcached.php @@ -52,13 +52,13 @@ class Memcached extends Cache implements IMemcache { $defaultOptions = [ \Memcached::OPT_CONNECT_TIMEOUT => 50, - \Memcached::OPT_RETRY_TIMEOUT => 50, - \Memcached::OPT_SEND_TIMEOUT => 50, - \Memcached::OPT_RECV_TIMEOUT => 50, - \Memcached::OPT_POLL_TIMEOUT => 50, + \Memcached::OPT_RETRY_TIMEOUT => 50, + \Memcached::OPT_SEND_TIMEOUT => 50, + \Memcached::OPT_RECV_TIMEOUT => 50, + \Memcached::OPT_POLL_TIMEOUT => 50, // Enable compression - \Memcached::OPT_COMPRESSION => true, + \Memcached::OPT_COMPRESSION => true, // Turn on consistent hashing \Memcached::OPT_LIBKETAMA_COMPATIBLE => true, @@ -110,7 +110,7 @@ class Memcached extends Cache implements IMemcache { public function set($key, $value, $ttl = 0) { if ($ttl > 0) { - $result = self::$cache->set($this->getNameSpace() . $key, $value, $ttl); + $result = self::$cache->set($this->getNameSpace() . $key, $value, $ttl); } else { $result = self::$cache->set($this->getNameSpace() . $key, $value); } @@ -126,7 +126,7 @@ class Memcached extends Cache implements IMemcache { } public function remove($key) { - $result= self::$cache->delete($this->getNameSpace() . $key); + $result = self::$cache->delete($this->getNameSpace() . $key); if (self::$cache->getResultCode() !== \Memcached::RES_NOTFOUND) { $this->verifyReturnCode(); } diff --git a/lib/private/Migration/BackgroundRepair.php b/lib/private/Migration/BackgroundRepair.php index fd616d505e0..679ad80b5dc 100644 --- a/lib/private/Migration/BackgroundRepair.php +++ b/lib/private/Migration/BackgroundRepair.php @@ -62,7 +62,7 @@ class BackgroundRepair extends TimedJob { */ public function execute($jobList, ILogger $logger = null) { // add an interval of 15 mins - $this->setInterval(15*60); + $this->setInterval(15 * 60); $this->jobList = $jobList; $this->logger = $logger; diff --git a/lib/private/OCS/DiscoveryService.php b/lib/private/OCS/DiscoveryService.php index 1c69d1ecc9a..0a28b09fda1 100644 --- a/lib/private/OCS/DiscoveryService.php +++ b/lib/private/OCS/DiscoveryService.php @@ -97,7 +97,7 @@ class DiscoveryService implements IDiscoveryService { } // Write into cache - $this->cache->set($remote . '#' . $service, json_encode($discoveredServices), 60*60*24); + $this->cache->set($remote . '#' . $service, json_encode($discoveredServices), 60 * 60 * 24); return $discoveredServices; } diff --git a/lib/private/Preview/TXT.php b/lib/private/Preview/TXT.php index 4004b0a0647..968a15a5683 100644 --- a/lib/private/Preview/TXT.php +++ b/lib/private/Preview/TXT.php @@ -76,7 +76,7 @@ class TXT extends ProviderV2 { imagecolorallocate($image, 255, 255, 255); $textColor = imagecolorallocate($image, 0, 0, 0); - $fontFile = __DIR__; + $fontFile = __DIR__; $fontFile .= '/../../../core'; $fontFile .= '/fonts/NotoSans-Regular.ttf'; diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php index f6f6671f08b..8fa0fc92da5 100644 --- a/lib/private/PreviewManager.php +++ b/lib/private/PreviewManager.php @@ -369,14 +369,14 @@ class PreviewManager implements IPreview { $checkImagick = new \Imagick(); $imagickProviders = [ - 'SVG' => ['mimetype' => '/image\/svg\+xml/', 'class' => Preview\SVG::class], - 'TIFF' => ['mimetype' => '/image\/tiff/', 'class' => Preview\TIFF::class], - 'PDF' => ['mimetype' => '/application\/pdf/', 'class' => Preview\PDF::class], - 'AI' => ['mimetype' => '/application\/illustrator/', 'class' => Preview\Illustrator::class], - 'PSD' => ['mimetype' => '/application\/x-photoshop/', 'class' => Preview\Photoshop::class], - 'EPS' => ['mimetype' => '/application\/postscript/', 'class' => Preview\Postscript::class], - 'TTF' => ['mimetype' => '/application\/(?:font-sfnt|x-font$)/', 'class' => Preview\Font::class], - 'HEIC' => ['mimetype' => '/image\/hei(f|c)/', 'class' => Preview\HEIC::class], + 'SVG' => ['mimetype' => '/image\/svg\+xml/', 'class' => Preview\SVG::class], + 'TIFF' => ['mimetype' => '/image\/tiff/', 'class' => Preview\TIFF::class], + 'PDF' => ['mimetype' => '/application\/pdf/', 'class' => Preview\PDF::class], + 'AI' => ['mimetype' => '/application\/illustrator/', 'class' => Preview\Illustrator::class], + 'PSD' => ['mimetype' => '/application\/x-photoshop/', 'class' => Preview\Photoshop::class], + 'EPS' => ['mimetype' => '/application\/postscript/', 'class' => Preview\Postscript::class], + 'TTF' => ['mimetype' => '/application\/(?:font-sfnt|x-font$)/', 'class' => Preview\Font::class], + 'HEIC' => ['mimetype' => '/image\/hei(f|c)/', 'class' => Preview\HEIC::class], ]; foreach ($imagickProviders as $queryFormat => $provider) { diff --git a/lib/private/Repair.php b/lib/private/Repair.php index bba797a098d..79e3366fdbb 100644 --- a/lib/private/Repair.php +++ b/lib/private/Repair.php @@ -87,7 +87,7 @@ class Repair implements IOutput { */ public function __construct(array $repairSteps, EventDispatcherInterface $dispatcher) { $this->repairSteps = $repairSteps; - $this->dispatcher = $dispatcher; + $this->dispatcher = $dispatcher; } /** @@ -185,8 +185,8 @@ class Repair implements IOutput { */ public static function getBeforeUpgradeRepairSteps() { $connection = \OC::$server->getDatabaseConnection(); - $config = \OC::$server->getConfig(); - $steps = [ + $config = \OC::$server->getConfig(); + $steps = [ new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), $connection, true), new SqliteAutoincrement($connection), new SaveAccountsTableData($connection, $config), diff --git a/lib/private/Repair/ClearFrontendCaches.php b/lib/private/Repair/ClearFrontendCaches.php index 4f48d9623b1..789f73adf7f 100644 --- a/lib/private/Repair/ClearFrontendCaches.php +++ b/lib/private/Repair/ClearFrontendCaches.php @@ -46,8 +46,8 @@ class ClearFrontendCaches implements IRepairStep { SCSSCacher $SCSSCacher, JSCombiner $JSCombiner) { $this->cacheFactory = $cacheFactory; - $this->scssCacher = $SCSSCacher; - $this->jsCombiner = $JSCombiner; + $this->scssCacher = $SCSSCacher; + $this->jsCombiner = $JSCombiner; } public function getName() { diff --git a/lib/private/Repair/ClearGeneratedAvatarCache.php b/lib/private/Repair/ClearGeneratedAvatarCache.php index 44a390d66a1..00a5aac1ff3 100644 --- a/lib/private/Repair/ClearGeneratedAvatarCache.php +++ b/lib/private/Repair/ClearGeneratedAvatarCache.php @@ -38,7 +38,7 @@ class ClearGeneratedAvatarCache implements IRepairStep { private $config; public function __construct(IConfig $config, AvatarManager $avatarManager) { - $this->config = $config; + $this->config = $config; $this->avatarManager = $avatarManager; } diff --git a/lib/private/Route/Route.php b/lib/private/Route/Route.php index 705183d24ae..8e419344881 100644 --- a/lib/private/Route/Route.php +++ b/lib/private/Route/Route.php @@ -151,7 +151,7 @@ class Route extends SymfonyRoute implements IRoute { public function actionInclude($file) { $function = function ($param) use ($file) { unset($param["_route"]); - $_GET=array_merge($_GET, $param); + $_GET = array_merge($_GET, $param); unset($param); require_once "$file"; } ; diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php index 01c0e02ef8f..377d9c309b4 100644 --- a/lib/private/Security/Bruteforce/Throttler.php +++ b/lib/private/Security/Bruteforce/Throttler.php @@ -195,8 +195,8 @@ class Throttler { $valid = true; for ($i = 0; $i < $mask; $i++) { - $part = ord($addr[(int)($i/8)]); - $orig = ord($ip[(int)($i/8)]); + $part = ord($addr[(int)($i / 8)]); + $orig = ord($ip[(int)($i / 8)]); $bitmask = 1 << (7 - ($i % 8)); @@ -273,7 +273,7 @@ class Throttler { return self::MAX_DELAY_MS; } - $delay = $firstDelay * 2**$attempts; + $delay = $firstDelay * 2 ** $attempts; if ($delay > self::MAX_DELAY) { return self::MAX_DELAY_MS; } diff --git a/lib/private/Security/Normalizer/IpAddress.php b/lib/private/Security/Normalizer/IpAddress.php index b471c499440..1aac69d1b06 100644 --- a/lib/private/Security/Normalizer/IpAddress.php +++ b/lib/private/Security/Normalizer/IpAddress.php @@ -78,7 +78,7 @@ class IpAddress { } $pos = strpos($ip, '%'); // if there is an explicit interface added to the IP, e.g. fe80::ae2d:d1e7:fe1e:9a8d%enp2s0 if ($pos !== false) { - $ip = substr($ip, 0, $pos-1); + $ip = substr($ip, 0, $pos - 1); } $binary = \inet_pton($ip); for ($i = 128; $i > $maskBits; $i -= 8) { diff --git a/lib/private/Setup/AbstractDatabase.php b/lib/private/Setup/AbstractDatabase.php index b2c290eb874..98d6b84ab9c 100644 --- a/lib/private/Setup/AbstractDatabase.php +++ b/lib/private/Setup/AbstractDatabase.php @@ -90,10 +90,10 @@ abstract class AbstractDatabase { $dbTablePrefix = isset($config['dbtableprefix']) ? $config['dbtableprefix'] : 'oc_'; $this->config->setValues([ - 'dbname' => $dbName, - 'dbhost' => $dbHost, + 'dbname' => $dbName, + 'dbhost' => $dbHost, 'dbport' => $dbPort, - 'dbtableprefix' => $dbTablePrefix, + 'dbtableprefix' => $dbTablePrefix, ]); $this->dbUser = $dbUser; diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php index 6a5513eab43..bbd292d4e0c 100644 --- a/lib/private/Setup/MySQL.php +++ b/lib/private/Setup/MySQL.php @@ -57,7 +57,7 @@ class MySQL extends AbstractDatabase { $this->createDatabase($connection); //fill the database if needed - $query='select count(*) from information_schema.tables where table_schema=? AND table_name = ?'; + $query = 'select count(*) from information_schema.tables where table_schema=? AND table_name = ?'; $connection->executeQuery($query, [$this->dbName, $this->tablePrefix.'users']); $connection->close(); @@ -93,7 +93,7 @@ class MySQL extends AbstractDatabase { try { //this query will fail if there aren't the right permissions, ignore the error - $query="GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `$name` . * TO '$user'"; + $query = "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `$name` . * TO '$user'"; $connection->executeUpdate($query); } catch (\Exception $ex) { $this->logger->logException($ex, [ @@ -165,7 +165,7 @@ class MySQL extends AbstractDatabase { $this->dbUser = $adminUser; //create a random password so we don't need to store the admin password in the config file - $this->dbPassword = $this->random->generate(30); + $this->dbPassword = $this->random->generate(30); $this->createDBUser($connection); diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index aed233692ed..0648e40f162 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -355,13 +355,13 @@ class Share extends Constants { // Pass all the vars we have for now, they may be useful $hookParams = [ - 'id' => $item['id'], - 'itemType' => $item['item_type'], - 'itemSource' => $item['item_source'], - 'shareType' => $shareType, - 'shareWith' => $shareWith, - 'itemParent' => $item['parent'], - 'uidOwner' => $item['uid_owner'], + 'id' => $item['id'], + 'itemType' => $item['item_type'], + 'itemSource' => $item['item_source'], + 'shareType' => $shareType, + 'shareWith' => $shareWith, + 'itemParent' => $item['parent'], + 'uidOwner' => $item['uid_owner'], ]; if ($item['item_type'] === 'file' || $item['item_type'] === 'folder') { $hookParams['fileSource'] = $item['file_source']; @@ -474,7 +474,7 @@ class Share extends Constants { */ public static function getItems($itemType, $item = null, $shareType = null, $shareWith = null, $uidOwner = null, $format = self::FORMAT_NONE, $parameters = null, $limit = -1, - $includeCollections = false, $itemShareWithBySource = false, $checkExpireDate = true) { + $includeCollections = false, $itemShareWithBySource = false, $checkExpireDate = true) { if (\OC::$server->getConfig()->getAppValue('core', 'shareapi_enabled', 'yes') != 'yes') { return []; } diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 1b1818a6e48..a12658f10d7 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -1395,7 +1395,7 @@ class Manager implements IManager { * * @return Share[] */ - public function getSharesByPath(\OCP\Files\Node $path, $page=0, $perPage=50) { + public function getSharesByPath(\OCP\Files\Node $path, $page = 0, $perPage = 50) { return []; } diff --git a/lib/private/SubAdmin.php b/lib/private/SubAdmin.php index 89fd63b4230..a9e3855639c 100644 --- a/lib/private/SubAdmin.php +++ b/lib/private/SubAdmin.php @@ -200,7 +200,7 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { $group = $this->groupManager->get($row['gid']); if (!is_null($user) && !is_null($group)) { $subadmins[] = [ - 'user' => $user, + 'user' => $user, 'group' => $group ]; } @@ -228,7 +228,7 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID()))) ->execute(); - $fetch = $result->fetch(); + $fetch = $result->fetch(); $result->closeCursor(); $result = !empty($fetch) ? true : false; diff --git a/lib/private/Tagging/TagMapper.php b/lib/private/Tagging/TagMapper.php index d9c8a7fb470..cf1d93e3d26 100644 --- a/lib/private/Tagging/TagMapper.php +++ b/lib/private/Tagging/TagMapper.php @@ -57,7 +57,7 @@ class TagMapper extends Mapper { } $sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` ' - . 'WHERE `uid` IN (' . str_repeat('?,', count($owners)-1) . '?) AND `type` = ? ORDER BY `category`'; + . 'WHERE `uid` IN (' . str_repeat('?,', count($owners) - 1) . '?) AND `type` = ? ORDER BY `category`'; return $this->findEntities($sql, array_merge($owners, [$type])); } diff --git a/lib/private/Tags.php b/lib/private/Tags.php index 22c6c68ba6c..8ab61f7c1bb 100644 --- a/lib/private/Tags.php +++ b/lib/private/Tags.php @@ -417,7 +417,7 @@ class Tags implements ITags { * @param int|null $id int Optional object id to add to this|these tag(s) * @return bool Returns false on error. */ - public function addMultiple($names, $sync=false, $id = null) { + public function addMultiple($names, $sync = false, $id = null) { if (!is_array($names)) { $names = [$names]; } @@ -576,7 +576,7 @@ class Tags implements ITags { $updates = $ids; try { $query = 'DELETE FROM `' . self::RELATION_TABLE . '` '; - $query .= 'WHERE `objid` IN (' . str_repeat('?,', count($ids)-1) . '?) '; + $query .= 'WHERE `objid` IN (' . str_repeat('?,', count($ids) - 1) . '?) '; $query .= 'AND `type`= ?'; $updates[] = $this->type; $stmt = \OC_DB::prepare($query); @@ -675,7 +675,7 @@ class Tags implements ITags { if (!$this->hasTag($tag)) { $this->add($tag); } - $tagId = $this->getTagId($tag); + $tagId = $this->getTagId($tag); } else { $tagId = $tag; } @@ -711,7 +711,7 @@ class Tags implements ITags { \OCP\Util::writeLog('core', __METHOD__.', Tag name is empty', ILogger::DEBUG); return false; } - $tagId = $this->getTagId($tag); + $tagId = $this->getTagId($tag); } else { $tagId = $tag; } @@ -791,7 +791,7 @@ class Tags implements ITags { } // case-insensitive array_search - protected function array_searchi($needle, $haystack, $mem='getName') { + protected function array_searchi($needle, $haystack, $mem = 'getName') { if (!is_array($haystack)) { return false; } @@ -847,10 +847,10 @@ class Tags implements ITags { */ private function tagMap(Tag $tag) { return [ - 'id' => $tag->getId(), - 'name' => $tag->getName(), + 'id' => $tag->getId(), + 'name' => $tag->getName(), 'owner' => $tag->getOwner(), - 'type' => $tag->getType() + 'type' => $tag->getType() ]; } } diff --git a/lib/private/Template/CSSResourceLocator.php b/lib/private/Template/CSSResourceLocator.php index b5c16d1690b..7b33e181f76 100644 --- a/lib/private/Template/CSSResourceLocator.php +++ b/lib/private/Template/CSSResourceLocator.php @@ -66,7 +66,7 @@ class CSSResourceLocator extends ResourceLocator { ) { return; } - $style = substr($style, strpos($style, '/')+1); + $style = substr($style, strpos($style, '/') + 1); $app_path = \OC_App::getAppPath($app); $app_url = \OC_App::getAppWebPath($app); diff --git a/lib/private/Template/IconsCacher.php b/lib/private/Template/IconsCacher.php index f9497c9a144..9b80711dd29 100644 --- a/lib/private/Template/IconsCacher.php +++ b/lib/private/Template/IconsCacher.php @@ -79,10 +79,10 @@ class IconsCacher { Factory $appDataFactory, IURLGenerator $urlGenerator, ITimeFactory $timeFactory) { - $this->logger = $logger; - $this->appData = $appDataFactory->get('css'); + $this->logger = $logger; + $this->appData = $appDataFactory->get('css'); $this->urlGenerator = $urlGenerator; - $this->timeFactory = $timeFactory; + $this->timeFactory = $timeFactory; try { $this->folder = $this->appData->getFolder('icons'); diff --git a/lib/private/Template/JSCombiner.php b/lib/private/Template/JSCombiner.php index 48f6dadfd6a..e9e4333c380 100644 --- a/lib/private/Template/JSCombiner.php +++ b/lib/private/Template/JSCombiner.php @@ -138,7 +138,7 @@ class JSCombiner { return false; } - foreach ($deps as $file=>$mtime) { + foreach ($deps as $file => $mtime) { if (!file_exists($file) || filemtime($file) > $mtime) { return false; } diff --git a/lib/private/Template/JSResourceLocator.php b/lib/private/Template/JSResourceLocator.php index 50af5fd34cc..2f0fe16f491 100644 --- a/lib/private/Template/JSResourceLocator.php +++ b/lib/private/Template/JSResourceLocator.php @@ -75,7 +75,7 @@ class JSResourceLocator extends ResourceLocator { } $app = substr($script, 0, strpos($script, '/')); - $script = substr($script, strpos($script, '/')+1); + $script = substr($script, strpos($script, '/') + 1); $app_path = \OC_App::getAppPath($app); $app_url = \OC_App::getAppWebPath($app); diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php index 120ed585e16..64d3caf9b6b 100644 --- a/lib/private/Template/SCSSCacher.php +++ b/lib/private/Template/SCSSCacher.php @@ -110,14 +110,14 @@ class SCSSCacher { ICacheFactory $cacheFactory, IconsCacher $iconsCacher, ITimeFactory $timeFactory) { - $this->logger = $logger; - $this->appData = $appDataFactory->get('css'); + $this->logger = $logger; + $this->appData = $appDataFactory->get('css'); $this->urlGenerator = $urlGenerator; - $this->config = $config; - $this->defaults = $defaults; - $this->serverRoot = $serverRoot; + $this->config = $config; + $this->defaults = $defaults; + $this->serverRoot = $serverRoot; $this->cacheFactory = $cacheFactory; - $this->depsCache = $cacheFactory->createDistributed('SCSS-deps-' . md5($this->urlGenerator->getBaseUrl())); + $this->depsCache = $cacheFactory->createDistributed('SCSS-deps-' . md5($this->urlGenerator->getBaseUrl())); $this->isCachedCache = $cacheFactory->createDistributed('SCSS-cached-' . md5($this->urlGenerator->getBaseUrl())); $lockingCache = $cacheFactory->createDistributed('SCSS-locks-' . md5($this->urlGenerator->getBaseUrl())); if (!($lockingCache instanceof IMemcache)) { @@ -141,9 +141,9 @@ class SCSSCacher { $path = explode('/', $root . '/' . $file); $fileNameSCSS = array_pop($path); - $fileNameCSS = $this->prependVersionPrefix($this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileNameSCSS)), $app); + $fileNameCSS = $this->prependVersionPrefix($this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileNameSCSS)), $app); - $path = implode('/', $path); + $path = implode('/', $path); $webDir = $this->getWebDir($path, $app, $this->serverRoot, \OC::$WEBROOT); if (!$this->variablesChanged() && $this->isCached($fileNameCSS, $app)) { @@ -202,7 +202,7 @@ class SCSSCacher { * @return ISimpleFile */ public function getCachedCSS(string $appName, string $fileName): ISimpleFile { - $folder = $this->appData->getFolder($appName); + $folder = $this->appData->getFolder($appName); $cachedFileName = $this->prependVersionPrefix($this->prependBaseurlPrefix($fileName), $appName); return $folder->getFile($cachedFileName); @@ -238,10 +238,10 @@ class SCSSCacher { $cachedFile = $folder->getFile($fileNameCSS); if ($cachedFile->getSize() > 0) { $depFileName = $fileNameCSS . '.deps'; - $deps = $this->depsCache->get($folder->getName() . '-' . $depFileName); + $deps = $this->depsCache->get($folder->getName() . '-' . $depFileName); if ($deps === null) { $depFile = $folder->getFile($depFileName); - $deps = $depFile->getContent(); + $deps = $depFile->getContent(); // Set to memcache for next run $this->depsCache->set($folder->getName() . '-' . $depFileName, $deps); } @@ -419,7 +419,7 @@ class SCSSCacher { * @return string */ private function rebaseUrls(string $css, string $webDir): string { - $re = '/url\([\'"]([^\/][\.\w?=\/-]*)[\'"]\)/x'; + $re = '/url\([\'"]([^\/][\.\w?=\/-]*)[\'"]\)/x'; $subst = 'url(\'' . $webDir . '/$1\')'; return preg_replace($re, $subst, $css); @@ -433,8 +433,8 @@ class SCSSCacher { */ public function getCachedSCSS(string $appName, string $fileName): string { $tmpfileLoc = explode('/', $fileName); - $fileName = array_pop($tmpfileLoc); - $fileName = $this->prependVersionPrefix($this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileName)), $appName); + $fileName = array_pop($tmpfileLoc); + $fileName = $this->prependVersionPrefix($this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileName)), $appName); return substr($this->urlGenerator->linkToRoute('core.Css.getCss', [ 'fileName' => $fileName, diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php index 4da6a91b6c9..d7de6cf92a2 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -198,34 +198,34 @@ class URLGenerator implements IURLGenerator { $path = \OC::$WEBROOT . "/themes/$theme/apps/$appName/img/$file"; } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$appName/img/$basename.svg") && file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$appName/img/$basename.png")) { - $path = \OC::$WEBROOT . "/themes/$theme/apps/$appName/img/$basename.png"; + $path = \OC::$WEBROOT . "/themes/$theme/apps/$appName/img/$basename.png"; } elseif (!empty($appName) and file_exists(\OC::$SERVERROOT . "/themes/$theme/$appName/img/$file")) { - $path = \OC::$WEBROOT . "/themes/$theme/$appName/img/$file"; + $path = \OC::$WEBROOT . "/themes/$theme/$appName/img/$file"; } elseif (!empty($appName) and (!file_exists(\OC::$SERVERROOT . "/themes/$theme/$appName/img/$basename.svg") && file_exists(\OC::$SERVERROOT . "/themes/$theme/$appName/img/$basename.png"))) { - $path = \OC::$WEBROOT . "/themes/$theme/$appName/img/$basename.png"; + $path = \OC::$WEBROOT . "/themes/$theme/$appName/img/$basename.png"; } elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$file")) { - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$file"; + $path = \OC::$WEBROOT . "/themes/$theme/core/img/$file"; } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.svg") && file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.png")) { - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; + $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; } elseif ($themingEnabled && $themingImagePath) { $path = $themingImagePath; } elseif ($appPath && file_exists($appPath . "/img/$file")) { - $path = \OC_App::getAppWebPath($appName) . "/img/$file"; + $path = \OC_App::getAppWebPath($appName) . "/img/$file"; } elseif ($appPath && !file_exists($appPath . "/img/$basename.svg") && file_exists($appPath . "/img/$basename.png")) { - $path = \OC_App::getAppWebPath($appName) . "/img/$basename.png"; + $path = \OC_App::getAppWebPath($appName) . "/img/$basename.png"; } elseif (!empty($appName) and file_exists(\OC::$SERVERROOT . "/$appName/img/$file")) { - $path = \OC::$WEBROOT . "/$appName/img/$file"; + $path = \OC::$WEBROOT . "/$appName/img/$file"; } elseif (!empty($appName) and (!file_exists(\OC::$SERVERROOT . "/$appName/img/$basename.svg") && file_exists(\OC::$SERVERROOT . "/$appName/img/$basename.png"))) { - $path = \OC::$WEBROOT . "/$appName/img/$basename.png"; + $path = \OC::$WEBROOT . "/$appName/img/$basename.png"; } elseif (file_exists(\OC::$SERVERROOT . "/core/img/$file")) { - $path = \OC::$WEBROOT . "/core/img/$file"; + $path = \OC::$WEBROOT . "/core/img/$file"; } elseif (!file_exists(\OC::$SERVERROOT . "/core/img/$basename.svg") && file_exists(\OC::$SERVERROOT . "/core/img/$basename.png")) { - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; + $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; } if ($path !== '') { diff --git a/lib/private/User/Backend.php b/lib/private/User/Backend.php index 477448279a5..c87dc5d2d50 100644 --- a/lib/private/User/Backend.php +++ b/lib/private/User/Backend.php @@ -39,14 +39,14 @@ abstract class Backend implements UserInterface { /** * actions that user backends can define */ - public const CREATE_USER = 1; // 1 << 0 - public const SET_PASSWORD = 16; // 1 << 4 - public const CHECK_PASSWORD = 256; // 1 << 8 - public const GET_HOME = 4096; // 1 << 12 - public const GET_DISPLAYNAME = 65536; // 1 << 16 - public const SET_DISPLAYNAME = 1048576; // 1 << 20 - public const PROVIDE_AVATAR = 16777216; // 1 << 24 - public const COUNT_USERS = 268435456; // 1 << 28 + public const CREATE_USER = 1; // 1 << 0 + public const SET_PASSWORD = 16; // 1 << 4 + public const CHECK_PASSWORD = 256; // 1 << 8 + public const GET_HOME = 4096; // 1 << 12 + public const GET_DISPLAYNAME = 65536; // 1 << 16 + public const SET_DISPLAYNAME = 1048576; // 1 << 20 + public const PROVIDE_AVATAR = 16777216; // 1 << 24 + public const COUNT_USERS = 268435456; // 1 << 28 protected $possibleActions = [ self::CREATE_USER => 'createUser', diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 365b8ae33a1..3ca05afb313 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -472,7 +472,7 @@ class User implements IUser { public function getCloudId() { $uid = $this->getUID(); $server = $this->urlGenerator->getAbsoluteURL('/'); - $server = rtrim($this->removeProtocolFromUrl($server), '/'); + $server = rtrim($this->removeProtocolFromUrl($server), '/'); return \OC::$server->getCloudIdManager()->getCloudId($uid, $server)->getId(); } diff --git a/lib/private/legacy/OC_API.php b/lib/private/legacy/OC_API.php index 37a496a38fe..5e4a46ab4d7 100644 --- a/lib/private/legacy/OC_API.php +++ b/lib/private/legacy/OC_API.php @@ -44,7 +44,7 @@ class OC_API { * @param \OC\OCS\Result $result * @param string $format the format xml|json */ - public static function respond($result, $format='xml') { + public static function respond($result, $format = 'xml') { $request = \OC::$server->getRequest(); // Send 401 headers if unauthorised diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index 5851fc01379..d2f8e536005 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -1118,7 +1118,7 @@ class OC_App { $similarLangFallback = $option['@value']; } elseif (strpos($attributeLang, $similarLang . '_') === 0) { if ($similarLangFallback === false) { - $similarLangFallback = $option['@value']; + $similarLangFallback = $option['@value']; } } } else { diff --git a/lib/private/legacy/OC_DB.php b/lib/private/legacy/OC_DB.php index 1d2e9bd1429..50dab74abb9 100644 --- a/lib/private/legacy/OC_DB.php +++ b/lib/private/legacy/OC_DB.php @@ -68,7 +68,7 @@ class OC_DB { // return the result try { - $result =$connection->prepare($query, $limit, $offset); + $result = $connection->prepare($query, $limit, $offset); } catch (\Doctrine\DBAL\DBALException $e) { throw new \OC\DatabaseException($e->getMessage()); } diff --git a/lib/private/legacy/OC_DB_StatementWrapper.php b/lib/private/legacy/OC_DB_StatementWrapper.php index d4072caf28e..668e97c5650 100644 --- a/lib/private/legacy/OC_DB_StatementWrapper.php +++ b/lib/private/legacy/OC_DB_StatementWrapper.php @@ -66,7 +66,7 @@ class OC_DB_StatementWrapper { * @param array $input * @return \OC_DB_StatementWrapper|int|bool */ - public function execute($input= []) { + public function execute($input = []) { $this->lastArguments = $input; if (count($input) > 0) { $result = $this->statement->execute($input); diff --git a/lib/private/legacy/OC_FileChunking.php b/lib/private/legacy/OC_FileChunking.php index 8aef29541fe..0075d5c53f7 100644 --- a/lib/private/legacy/OC_FileChunking.php +++ b/lib/private/legacy/OC_FileChunking.php @@ -88,7 +88,7 @@ class OC_FileChunking { $cache = $this->getCache(); $chunkcount = (int)$this->info['chunkcount']; - for ($i=($chunkcount-1); $i >= 0; $i--) { + for ($i = ($chunkcount - 1); $i >= 0; $i--) { if (!$cache->hasKey($prefix.$i)) { return false; } @@ -144,7 +144,7 @@ class OC_FileChunking { public function cleanup() { $cache = $this->getCache(); $prefix = $this->getPrefix(); - for ($i=0; $i < $this->info['chunkcount']; $i++) { + for ($i = 0; $i < $this->info['chunkcount']; $i++) { $cache->remove($prefix.$i); } } diff --git a/lib/private/legacy/OC_Files.php b/lib/private/legacy/OC_Files.php index f5f91fc9958..ab8a70941fd 100644 --- a/lib/private/legacy/OC_Files.php +++ b/lib/private/legacy/OC_Files.php @@ -232,7 +232,7 @@ class OC_Files { * @return array $rangeArray ('from'=>int,'to'=>int), ... */ private static function parseHttpRangeHeader($rangeHeaderPos, $fileSize) { - $rArray=explode(',', $rangeHeaderPos); + $rArray = explode(',', $rangeHeaderPos); $minOffset = 0; $ind = 0; @@ -244,7 +244,7 @@ class OC_Files { if ($ranges[0] < $minOffset) { // case: bytes=500-700,601-999 $ranges[0] = $minOffset; } - if ($ind > 0 && $rangeArray[$ind-1]['to']+1 == $ranges[0]) { // case: bytes=500-600,601-999 + if ($ind > 0 && $rangeArray[$ind - 1]['to'] + 1 == $ranges[0]) { // case: bytes=500-600,601-999 $ind--; $ranges[0] = $rangeArray[$ind]['from']; } @@ -253,7 +253,7 @@ class OC_Files { if (is_numeric($ranges[0]) && is_numeric($ranges[1]) && $ranges[0] < $fileSize && $ranges[0] <= $ranges[1]) { // case: x-x if ($ranges[1] >= $fileSize) { - $ranges[1] = $fileSize-1; + $ranges[1] = $fileSize - 1; } $rangeArray[$ind++] = [ 'from' => $ranges[0], 'to' => $ranges[1], 'size' => $fileSize ]; $minOffset = $ranges[1] + 1; @@ -262,14 +262,14 @@ class OC_Files { } } elseif (is_numeric($ranges[0]) && $ranges[0] < $fileSize) { // case: x- - $rangeArray[$ind++] = [ 'from' => $ranges[0], 'to' => $fileSize-1, 'size' => $fileSize ]; + $rangeArray[$ind++] = [ 'from' => $ranges[0], 'to' => $fileSize - 1, 'size' => $fileSize ]; break; } elseif (is_numeric($ranges[1])) { // case: -x if ($ranges[1] > $fileSize) { $ranges[1] = $fileSize; } - $rangeArray[$ind++] = [ 'from' => $fileSize-$ranges[1], 'to' => $fileSize-1, 'size' => $fileSize ]; + $rangeArray[$ind++] = [ 'from' => $fileSize - $ranges[1], 'to' => $fileSize - 1, 'size' => $fileSize ]; break; } } diff --git a/lib/private/legacy/OC_Hook.php b/lib/private/legacy/OC_Hook.php index 1da03df3a1f..d6062f30fbd 100644 --- a/lib/private/legacy/OC_Hook.php +++ b/lib/private/legacy/OC_Hook.php @@ -128,15 +128,15 @@ class OC_Hook { * @param string $signalClass * @param string $signalName */ - public static function clear($signalClass='', $signalName='') { + public static function clear($signalClass = '', $signalName = '') { if ($signalClass) { if ($signalName) { - self::$registered[$signalClass][$signalName]=[]; + self::$registered[$signalClass][$signalName] = []; } else { - self::$registered[$signalClass]=[]; + self::$registered[$signalClass] = []; } } else { - self::$registered=[]; + self::$registered = []; } } diff --git a/lib/private/legacy/OC_Template.php b/lib/private/legacy/OC_Template.php index 54c203a3ab6..c14a43ea430 100644 --- a/lib/private/legacy/OC_Template.php +++ b/lib/private/legacy/OC_Template.php @@ -161,8 +161,8 @@ class OC_Template extends \OC\Template\Base { * @param string $text the text content for the element. If $text is null then the * element will be written as empty element. So use "" to get a closing tag. */ - public function addHeader($tag, $attributes, $text=null) { - $this->headers[]= [ + public function addHeader($tag, $attributes, $text = null) { + $this->headers[] = [ 'tag' => $tag, 'attributes' => $attributes, 'text' => $text @@ -195,7 +195,7 @@ class OC_Template extends \OC\Template\Base { if (strcasecmp($header['tag'], 'script') === 0 && in_array('src', array_map('strtolower', array_keys($header['attributes'])))) { $headers .= ' defer'; } - foreach ($header['attributes'] as $name=>$value) { + foreach ($header['attributes'] as $name => $value) { $headers .= ' '.\OCP\Util::sanitizeHTML($name).'="'.\OCP\Util::sanitizeHTML($value).'"'; } if ($header['text'] !== null) { diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index cb0eef5fce2..80e43a0514a 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -912,7 +912,7 @@ class OC_Util { } $errors[] = [ 'error' => $l->t('PHP setting "%s" is not set to "%s".', [$setting[0], var_export($setting[1], true)]), - 'hint' => $l->t('Adjusting this setting in php.ini will make Nextcloud run again') + 'hint' => $l->t('Adjusting this setting in php.ini will make Nextcloud run again') ]; $webServerRestart = true; } @@ -936,9 +936,9 @@ class OC_Util { if (function_exists('xml_parser_create') && LIBXML_LOADED_VERSION < 20700) { $version = LIBXML_LOADED_VERSION; - $major = floor($version/10000); + $major = floor($version / 10000); $version -= ($major * 10000); - $minor = floor($version/100); + $minor = floor($version / 100); $version -= ($minor * 100); $patch = $version; $errors[] = [ diff --git a/lib/private/legacy/template/functions.php b/lib/private/legacy/template/functions.php index e2a1c476433..e69abbe9f60 100644 --- a/lib/private/legacy/template/functions.php +++ b/lib/private/legacy/template/functions.php @@ -47,12 +47,12 @@ function p($string) { * @param string $opts, additional optional options */ function emit_css_tag($href, $opts = '') { - $s='<link rel="stylesheet"'; + $s = '<link rel="stylesheet"'; if (!empty($href)) { - $s.=' href="' . $href .'"'; + $s .= ' href="' . $href .'"'; } if (!empty($opts)) { - $s.=' '.$opts; + $s .= ' '.$opts; } print_unescaped($s.">\n"); } @@ -75,20 +75,20 @@ function emit_css_loading_tags($obj) { * @param string $src the source URL, ignored when empty * @param string $script_content the inline script content, ignored when empty */ -function emit_script_tag($src, $script_content='') { - $defer_str=' defer'; - $s='<script nonce="' . \OC::$server->getContentSecurityPolicyNonceManager()->getNonce() . '"'; +function emit_script_tag($src, $script_content = '') { + $defer_str = ' defer'; + $s = '<script nonce="' . \OC::$server->getContentSecurityPolicyNonceManager()->getNonce() . '"'; if (!empty($src)) { // emit script tag for deferred loading from $src - $s.=$defer_str.' src="' . $src .'">'; + $s .= $defer_str.' src="' . $src .'">'; } elseif (!empty($script_content)) { // emit script tag for inline script from $script_content without defer (see MDN) - $s.=">\n".$script_content."\n"; + $s .= ">\n".$script_content."\n"; } else { // no $src nor $src_content, really useless empty tag - $s.='>'; + $s .= '>'; } - $s.='</script>'; + $s .= '</script>'; print_unescaped($s."\n"); } @@ -306,9 +306,9 @@ function relative_modified_date($timestamp, $fromTime = null, $dateOnly = false) return $formatter->formatTimeSpan($timestamp, $fromTime); } -function html_select_options($options, $selected, $params=[]) { +function html_select_options($options, $selected, $params = []) { if (!is_array($selected)) { - $selected=[$selected]; + $selected = [$selected]; } if (isset($params['combine']) && $params['combine']) { $options = array_combine($options, $options); |