cloud_bbb/lib/BigBlueButton/Presentation.php

39 lines
720 B
PHP
Raw Normal View History

2020-05-16 17:14:17 +02:00
<?php
namespace OCA\BigBlueButton\BigBlueButton;
use OCP\Files\Storage\IStorage;
class Presentation {
2020-05-16 17:14:17 +02:00
private $url;
private $filename;
private $path;
/** @var IStorage */
private $storage;
public function __construct(string $path, IStorage $storage) {
$this->storage = $storage;
$this->path = preg_replace('/^\//', '', $path);
$this->filename = preg_replace('/[^\x20-\x7E]+/','#', $path);
}
public function generateUrl(): string {
return $this->storage->getDirectDownload($this->path);
2020-05-16 17:14:17 +02:00
}
public function getUrl(): string {
2020-05-16 17:14:17 +02:00
return $this->url;
}
public function getFilename(): string {
2020-05-16 17:14:17 +02:00
return $this->filename;
}
public function isValid(): bool {
return !empty($this->filename);
2020-05-16 17:14:17 +02:00
}
}