aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-09-05 23:00:27 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2024-09-05 23:00:27 +0200
commitede38709b5df0ede2542a3f62ee0a5e72243ba40 (patch)
treef8bb4ebb9a88171715df852e85a2bd92913bb1cd
parent9aafc0f989ea78e3536299da96861ea8a6c13f43 (diff)
downloadnextcloud-server-ede38709b5df0ede2542a3f62ee0a5e72243ba40.tar.gz
nextcloud-server-ede38709b5df0ede2542a3f62ee0a5e72243ba40.zip
chore(files): Use public API where possiblechore/use-public-api-helper
This is not fixing all issues in the helper, but at least where possible use the public methods. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
-rw-r--r--apps/files/lib/Helper.php25
-rw-r--r--build/psalm-baseline.xml8
2 files changed, 14 insertions, 19 deletions
diff --git a/apps/files/lib/Helper.php b/apps/files/lib/Helper.php
index f79d4bc5f9c..6126c1270eb 100644
--- a/apps/files/lib/Helper.php
+++ b/apps/files/lib/Helper.php
@@ -119,16 +119,18 @@ class Helper {
public static function formatFileInfo(FileInfo $i) {
$entry = [];
- $entry['id'] = $i['fileid'];
- $entry['parentId'] = $i['parent'];
- $entry['mtime'] = $i['mtime'] * 1000;
+ $entry['id'] = $i->getId();
+ $entry['parentId'] = $i->getParentId();
+ $entry['mtime'] = $i->getMtime() * 1000;
// only pick out the needed attributes
$entry['name'] = $i->getName();
- $entry['permissions'] = $i['permissions'];
- $entry['mimetype'] = $i['mimetype'];
- $entry['size'] = $i['size'];
- $entry['type'] = $i['type'];
- $entry['etag'] = $i['etag'];
+ $entry['permissions'] = $i->getPermissions();
+ $entry['mimetype'] = $i->getMimetype();
+ $entry['size'] = $i->getSize();
+ $entry['type'] = $i->getType();
+ $entry['etag'] = $i->getEtag();
+ // TODO: this is using the private implementation of FileInfo
+ // the array access is not part of the public interface
if (isset($i['tags'])) {
$entry['tags'] = $i['tags'];
}
@@ -138,6 +140,10 @@ class Helper {
if (isset($i['is_share_mount_point'])) {
$entry['isShareMountPoint'] = $i['is_share_mount_point'];
}
+ if (isset($i['extraData'])) {
+ $entry['extraData'] = $i['extraData'];
+ }
+
$mountType = null;
$mount = $i->getMountPoint();
$mountType = $mount->getMountType();
@@ -147,9 +153,6 @@ class Helper {
}
$entry['mountType'] = $mountType;
}
- if (isset($i['extraData'])) {
- $entry['extraData'] = $i['extraData'];
- }
return $entry;
}
diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml
index 564236c360d..80e6493fd36 100644
--- a/build/psalm-baseline.xml
+++ b/build/psalm-baseline.xml
@@ -802,14 +802,6 @@
<code><![CDATA[$i]]></code>
<code><![CDATA[$i]]></code>
<code><![CDATA[$i]]></code>
- <code><![CDATA[$i]]></code>
- <code><![CDATA[$i]]></code>
- <code><![CDATA[$i]]></code>
- <code><![CDATA[$i]]></code>
- <code><![CDATA[$i]]></code>
- <code><![CDATA[$i]]></code>
- <code><![CDATA[$i]]></code>
- <code><![CDATA[$i]]></code>
</UndefinedInterfaceMethod>
</file>
<file src="apps/files/lib/Service/OwnershipTransferService.php">