File tree Expand file tree Collapse file tree 4 files changed +23
-17
lines changed
lib/private/Files/ObjectStore
tests/lib/Files/ObjectStore Expand file tree Collapse file tree 4 files changed +23
-17
lines changed Original file line number Diff line number Diff line change 2626namespace OC \Files \ObjectStore ;
2727
2828class AppdataPreviewObjectStoreStorage extends ObjectStoreStorage {
29- /** @var string */
30- private $ internalId ;
29+ private string $ internalId ;
3130
31+ /**
32+ * @param array $params
33+ * @throws \Exception
34+ */
3235 public function __construct ($ params ) {
3336 if (!isset ($ params ['internal-id ' ])) {
3437 throw new \Exception ('missing id in parameters ' );
@@ -37,7 +40,7 @@ public function __construct($params) {
3740 parent ::__construct ($ params );
3841 }
3942
40- public function getId () {
43+ public function getId (): string {
4144 return 'object::appdata::preview: ' . $ this ->internalId ;
4245 }
4346}
Original file line number Diff line number Diff line change 2626 */
2727namespace OC \Files \ObjectStore ;
2828
29+ use Exception ;
2930use OCP \Files \IHomeStorage ;
3031use OCP \IUser ;
3132
@@ -34,31 +35,30 @@ class HomeObjectStoreStorage extends ObjectStoreStorage implements IHomeStorage
3435
3536 /**
3637 * The home user storage requires a user object to create a unique storage id
38+ *
3739 * @param array $params
40+ * @throws Exception
3841 */
3942 public function __construct ($ params ) {
4043 if (! isset ($ params ['user ' ]) || ! $ params ['user ' ] instanceof IUser) {
41- throw new \ Exception ('missing user object in parameters ' );
44+ throw new Exception ('missing user object in parameters ' );
4245 }
4346 $ this ->user = $ params ['user ' ];
4447 parent ::__construct ($ params );
4548 }
4649
47- public function getId () {
50+ public function getId (): string {
4851 return 'object::user: ' . $ this ->user ->getUID ();
4952 }
5053
5154 /**
5255 * get the owner of a path
5356 *
5457 * @param string $path The path to get the owner
55- * @return false| string uid
58+ * @return string uid
5659 */
57- public function getOwner ($ path ) {
58- if (is_object ($ this ->user )) {
59- return $ this ->user ->getUID ();
60- }
61- return false ;
60+ public function getOwner ($ path ): string {
61+ return $ this ->user ->getUID ();
6262 }
6363
6464 public function getUser (): IUser {
Original file line number Diff line number Diff line change 4747use OCP \Files \ObjectStore \IObjectStoreMultiPartUpload ;
4848use OCP \Files \Storage \IChunkedFileWrite ;
4949use OCP \Files \Storage \IStorage ;
50+ use OCP \ILogger ;
5051
5152class ObjectStoreStorage extends \OC \Files \Storage \Common implements IChunkedFileWrite {
5253 use CopyDirectory;
@@ -55,13 +56,15 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
5556 protected string $ id ;
5657 private string $ objectPrefix = 'urn:oid: ' ;
5758
58- private $ logger ;
59+ private ILogger $ logger ;
5960
6061 private bool $ handleCopiesAsOwned ;
62+ protected bool $ validateWrites = true ;
6163
62- /** @var bool */
63- protected $ validateWrites = true ;
64-
64+ /**
65+ * @param array $params
66+ * @throws \Exception
67+ */
6568 public function __construct ($ params ) {
6669 if (isset ($ params ['objectstore ' ]) && $ params ['objectstore ' ] instanceof IObjectStore) {
6770 $ this ->objectStore = $ params ['objectstore ' ];
Original file line number Diff line number Diff line change 3030 * Allow overwriting the object store instance for test purposes
3131 */
3232class ObjectStoreStorageOverwrite extends ObjectStoreStorage {
33- public function setObjectStore (IObjectStore $ objectStore ) {
33+ public function setObjectStore (IObjectStore $ objectStore ): void {
3434 $ this ->objectStore = $ objectStore ;
3535 }
3636
3737 public function getObjectStore (): IObjectStore {
3838 return $ this ->objectStore ;
3939 }
4040
41- public function setValidateWrites (bool $ validate ) {
41+ public function setValidateWrites (bool $ validate ): void {
4242 $ this ->validateWrites = $ validate ;
4343 }
4444}
You can’t perform that action at this time.
0 commit comments