summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2018-01-26 10:15:39 +0100
committerGitHub <noreply@github.com>2018-01-26 10:15:39 +0100
commitc2b1bd92d6f6e675f7ffab420cd61c5be701c4a6 (patch)
tree10e093ff030f1436fe3862c4b1944dbcf050723d
parentfab951e4b3d103b68b21ccb864d229c4023b57ac (diff)
parent0a56d2185e79caf81f5160cb8503955d9c3108a6 (diff)
downloadnextcloud-server-c2b1bd92d6f6e675f7ffab420cd61c5be701c4a6.tar.gz
nextcloud-server-c2b1bd92d6f6e675f7ffab420cd61c5be701c4a6.zip
Merge pull request #8063 from nextcloud/inline-value
Return value immediately instead of assigning to a one-time variable
-rw-r--r--apps/dav/lib/CardDAV/Converter.php3
-rw-r--r--apps/dav/lib/Connector/Sabre/FilesPlugin.php3
-rw-r--r--apps/encryption/lib/Util.php3
-rw-r--r--apps/federatedfilesharing/lib/AddressHandler.php3
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Share.php3
-rw-r--r--apps/files_external/lib/Service/UserStoragesService.php3
-rw-r--r--apps/files_sharing/lib/Controller/ShareesAPIController.php4
-rw-r--r--apps/files_sharing/lib/ShareBackend/Folder.php4
-rw-r--r--apps/files_trashbin/lib/Storage.php3
-rw-r--r--apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php3
-rw-r--r--apps/user_ldap/lib/Helper.php3
-rw-r--r--core/Command/Config/Import.php3
-rw-r--r--lib/private/App/Platform.php3
-rw-r--r--lib/private/Files/View.php9
-rw-r--r--lib/private/Security/CertificateManager.php4
-rw-r--r--lib/private/Server.php4
-rw-r--r--lib/private/legacy/db.php3
-rw-r--r--lib/private/legacy/db/statementwrapper.php3
-rw-r--r--settings/Controller/UsersController.php4
19 files changed, 21 insertions, 47 deletions
diff --git a/apps/dav/lib/CardDAV/Converter.php b/apps/dav/lib/CardDAV/Converter.php
index a480f0ea45d..e047ee2a772 100644
--- a/apps/dav/lib/CardDAV/Converter.php
+++ b/apps/dav/lib/CardDAV/Converter.php
@@ -143,8 +143,7 @@ class Converter {
*/
private function getAvatarImage(IUser $user) {
try {
- $image = $user->getAvatarImage(-1);
- return $image;
+ return $user->getAvatarImage(-1);
} catch (\Exception $ex) {
return null;
}
diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
index a3a0893259b..b5333f48374 100644
--- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
@@ -340,8 +340,7 @@ class FilesPlugin extends ServerPlugin {
});
$propFind->handle(self::IS_ENCRYPTED_PROPERTYNAME, function() use ($node) {
- $result = $node->getFileInfo()->isEncrypted() ? '1' : '0';
- return $result;
+ return $node->getFileInfo()->isEncrypted() ? '1' : '0';
});
$propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function () use ($node) {
diff --git a/apps/encryption/lib/Util.php b/apps/encryption/lib/Util.php
index 5926817dc48..eb2357bd10f 100644
--- a/apps/encryption/lib/Util.php
+++ b/apps/encryption/lib/Util.php
@@ -196,8 +196,7 @@ class Util {
* @return \OC\Files\Storage\Storage
*/
public function getStorage($path) {
- $storage = $this->files->getMount($path)->getStorage();
- return $storage;
+ return $this->files->getMount($path)->getStorage();
}
}
diff --git a/apps/federatedfilesharing/lib/AddressHandler.php b/apps/federatedfilesharing/lib/AddressHandler.php
index 78234f17ed7..be3a624e28f 100644
--- a/apps/federatedfilesharing/lib/AddressHandler.php
+++ b/apps/federatedfilesharing/lib/AddressHandler.php
@@ -84,8 +84,7 @@ class AddressHandler {
* @return string url of the current server
*/
public function generateRemoteURL() {
- $url = $this->urlGenerator->getAbsoluteURL('/');
- return $url;
+ return $this->urlGenerator->getAbsoluteURL('/');
}
/**
diff --git a/apps/files_external/3rdparty/icewind/smb/src/Share.php b/apps/files_external/3rdparty/icewind/smb/src/Share.php
index 8f1dace2be2..be1ba025508 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/Share.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Share.php
@@ -370,8 +370,7 @@ class Share extends AbstractShare {
protected function execute($command) {
$this->connect();
$this->connection->write($command . PHP_EOL);
- $output = $this->connection->read();
- return $output;
+ return $this->connection->read();
}
/**
diff --git a/apps/files_external/lib/Service/UserStoragesService.php b/apps/files_external/lib/Service/UserStoragesService.php
index b225f1eec8c..db03befa852 100644
--- a/apps/files_external/lib/Service/UserStoragesService.php
+++ b/apps/files_external/lib/Service/UserStoragesService.php
@@ -112,8 +112,7 @@ class UserStoragesService extends StoragesService {
*/
public function addStorage(StorageConfig $newStorage) {
$newStorage->setApplicableUsers([$this->getUser()->getUID()]);
- $config = parent::addStorage($newStorage);
- return $config;
+ return parent::addStorage($newStorage);
}
/**
diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php
index 575bf01fdb0..742962e6490 100644
--- a/apps/files_sharing/lib/Controller/ShareesAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php
@@ -230,9 +230,7 @@ class ShareesAPIController extends OCSController {
$url = $this->urlGenerator->getAbsoluteURL('/ocs/v1.php/apps/files_sharing/api/v1/sharees') . '?';
}
$params['page'] = $page + 1;
- $link = '<' . $url . http_build_query($params) . '>; rel="next"';
-
- return $link;
+ return '<' . $url . http_build_query($params) . '>; rel="next"';
}
/**
diff --git a/apps/files_sharing/lib/ShareBackend/Folder.php b/apps/files_sharing/lib/ShareBackend/Folder.php
index 80b141326d3..c48a26300a2 100644
--- a/apps/files_sharing/lib/ShareBackend/Folder.php
+++ b/apps/files_sharing/lib/ShareBackend/Folder.php
@@ -73,9 +73,7 @@ class Folder extends File implements \OCP\Share_Backend_Collection {
$query = \OCP\DB::prepare('SELECT `parent` FROM `*PREFIX*filecache` WHERE `fileid` = ?');
$result = $query->execute(array($child));
$row = $result->fetchRow();
- $parent = $row ? $row['parent'] : null;
-
- return $parent;
+ return $row ? $row['parent'] : null;
}
public function getChildren($itemSource) {
diff --git a/apps/files_trashbin/lib/Storage.php b/apps/files_trashbin/lib/Storage.php
index e6609034f91..3025d36a210 100644
--- a/apps/files_trashbin/lib/Storage.php
+++ b/apps/files_trashbin/lib/Storage.php
@@ -254,8 +254,7 @@ class Storage extends Wrapper {
* @return MoveToTrashEvent
*/
protected function createMoveToTrashEvent(Node $node) {
- $event = new MoveToTrashEvent($node);
- return $event;
+ return new MoveToTrashEvent($node);
}
/**
diff --git a/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php b/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php
index 5c5500862e6..f5b01649bbb 100644
--- a/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php
+++ b/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php
@@ -90,8 +90,7 @@ class BackupCodesProvider implements IProvider {
* @return Template
*/
public function getTemplate(IUser $user) {
- $tmpl = new Template('twofactor_backupcodes', 'challenge');
- return $tmpl;
+ return new Template('twofactor_backupcodes', 'challenge');
}
/**
diff --git a/apps/user_ldap/lib/Helper.php b/apps/user_ldap/lib/Helper.php
index 3157a7ab09d..3d1ae31cfef 100644
--- a/apps/user_ldap/lib/Helper.php
+++ b/apps/user_ldap/lib/Helper.php
@@ -123,8 +123,7 @@ class Helper {
sort($serverConnections);
$lastKey = array_pop($serverConnections);
$lastNumber = intval(str_replace('s', '', $lastKey));
- $nextPrefix = 's' . str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT);
- return $nextPrefix;
+ return 's' . str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT);
}
private function getServersConfig($value) {
diff --git a/core/Command/Config/Import.php b/core/Command/Config/Import.php
index 4a8db1c9656..b6aa6e3411d 100644
--- a/core/Command/Config/Import.php
+++ b/core/Command/Config/Import.php
@@ -113,8 +113,7 @@ class Import extends Command implements CompletionAwareInterface {
* @return string
*/
protected function getArrayFromFile($importFile) {
- $content = file_get_contents($importFile);
- return $content;
+ return file_get_contents($importFile);
}
/**
diff --git a/lib/private/App/Platform.php b/lib/private/App/Platform.php
index 344e420b7d3..fe4d7ff48f7 100644
--- a/lib/private/App/Platform.php
+++ b/lib/private/App/Platform.php
@@ -94,7 +94,6 @@ class Platform {
public function getLibraryVersion($name) {
$repo = new PlatformRepository();
- $lib = $repo->findLibrary($name);
- return $lib;
+ return $repo->findLibrary($name);
}
}
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index fb0b116666e..a6971cb0205 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -426,8 +426,7 @@ class View {
flush();
}
fclose($handle);
- $size = $this->filesize($path);
- return $size;
+ return $this->filesize($path);
}
return false;
}
@@ -476,8 +475,7 @@ class View {
echo fread($handle, $len);
flush();
}
- $size = ftell($handle) - $from;
- return $size;
+ return ftell($handle) - $from;
}
throw new \OCP\Files\UnseekableException('fseek error');
@@ -1083,8 +1081,7 @@ class View {
}
list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix);
if ($storage) {
- $result = $storage->hash($type, $internalPath, $raw);
- return $result;
+ return $storage->hash($type, $internalPath, $raw);
}
}
return null;
diff --git a/lib/private/Security/CertificateManager.php b/lib/private/Security/CertificateManager.php
index 90ad7de9b59..a213a5b3b9b 100644
--- a/lib/private/Security/CertificateManager.php
+++ b/lib/private/Security/CertificateManager.php
@@ -249,9 +249,7 @@ class CertificateManager implements ICertificateManager {
if ($uid === '') {
$uid = $this->uid;
}
- $path = is_null($uid) ? '/files_external/' : '/' . $uid . '/files_external/';
-
- return $path;
+ return is_null($uid) ? '/files_external/' : '/' . $uid . '/files_external/';
}
/**
diff --git a/lib/private/Server.php b/lib/private/Server.php
index c0fb96dce86..1f572280c7c 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -243,9 +243,7 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService('SystemTagManagerFactory', function (Server $c) {
$config = $c->getConfig();
$factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory');
- /** @var \OC\SystemTag\ManagerFactory $factory */
- $factory = new $factoryClass($this);
- return $factory;
+ return new $factoryClass($this);
});
$this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) {
return $c->query('SystemTagManagerFactory')->getManager();
diff --git a/lib/private/legacy/db.php b/lib/private/legacy/db.php
index 6e487e25ad5..7c556baeaeb 100644
--- a/lib/private/legacy/db.php
+++ b/lib/private/legacy/db.php
@@ -170,8 +170,7 @@ class OC_DB {
*/
public static function createDbFromStructure( $file ) {
$schemaManager = self::getMDB2SchemaManager();
- $result = $schemaManager->createDbFromStructure($file);
- return $result;
+ return $schemaManager->createDbFromStructure($file);
}
/**
diff --git a/lib/private/legacy/db/statementwrapper.php b/lib/private/legacy/db/statementwrapper.php
index 7c3c4776aa7..12774c894e8 100644
--- a/lib/private/legacy/db/statementwrapper.php
+++ b/lib/private/legacy/db/statementwrapper.php
@@ -77,8 +77,7 @@ class OC_DB_StatementWrapper {
return false;
}
if ($this->isManipulation) {
- $count = $this->statement->rowCount();
- return $count;
+ return $this->statement->rowCount();
} else {
return $this;
}
diff --git a/settings/Controller/UsersController.php b/settings/Controller/UsersController.php
index af5aff8371d..c373cb0d521 100644
--- a/settings/Controller/UsersController.php
+++ b/settings/Controller/UsersController.php
@@ -723,9 +723,7 @@ class UsersController extends Controller {
protected function signMessage(IUser $user, $message) {
$privateKey = $this->keyManager->getKey($user)->getPrivate();
openssl_sign(json_encode($message), $signature, $privateKey, OPENSSL_ALGO_SHA512);
- $signatureBase64 = base64_encode($signature);
-
- return $signatureBase64;
+ return base64_encode($signature);
}
/**