namespace OC\Files\ObjectStore;
class AppdataPreviewObjectStoreStorage extends ObjectStoreStorage {
- /** @var string */
- private $internalId;
+ private string $internalId;
+ /**
+ * @param array $params
+ * @throws \Exception
+ */
public function __construct($params) {
if (!isset($params['internal-id'])) {
throw new \Exception('missing id in parameters');
parent::__construct($params);
}
- public function getId() {
+ public function getId(): string {
return 'object::appdata::preview:' . $this->internalId;
}
}
*/
namespace OC\Files\ObjectStore;
+use Exception;
use OCP\Files\IHomeStorage;
use OCP\IUser;
/**
* The home user storage requires a user object to create a unique storage id
+ *
* @param array $params
+ * @throws Exception
*/
public function __construct($params) {
if (! isset($params['user']) || ! $params['user'] instanceof IUser) {
- throw new \Exception('missing user object in parameters');
+ throw new Exception('missing user object in parameters');
}
$this->user = $params['user'];
parent::__construct($params);
}
- public function getId() {
+ public function getId(): string {
return 'object::user:' . $this->user->getUID();
}
* get the owner of a path
*
* @param string $path The path to get the owner
- * @return false|string uid
+ * @return string uid
*/
- public function getOwner($path) {
- if (is_object($this->user)) {
- return $this->user->getUID();
- }
- return false;
+ public function getOwner($path): string {
+ return $this->user->getUID();
}
public function getUser(): IUser {
use OCP\Files\ObjectStore\IObjectStoreMultiPartUpload;
use OCP\Files\Storage\IChunkedFileWrite;
use OCP\Files\Storage\IStorage;
+use OCP\ILogger;
class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFileWrite {
use CopyDirectory;
protected string $id;
private string $objectPrefix = 'urn:oid:';
- private $logger;
+ private ILogger $logger;
private bool $handleCopiesAsOwned;
+ protected bool $validateWrites = true;
- /** @var bool */
- protected $validateWrites = true;
-
+ /**
+ * @param array $params
+ * @throws \Exception
+ */
public function __construct($params) {
if (isset($params['objectstore']) && $params['objectstore'] instanceof IObjectStore) {
$this->objectStore = $params['objectstore'];
* Allow overwriting the object store instance for test purposes
*/
class ObjectStoreStorageOverwrite extends ObjectStoreStorage {
- public function setObjectStore(IObjectStore $objectStore) {
+ public function setObjectStore(IObjectStore $objectStore): void {
$this->objectStore = $objectStore;
}
return $this->objectStore;
}
- public function setValidateWrites(bool $validate) {
+ public function setValidateWrites(bool $validate): void {
$this->validateWrites = $validate;
}
}