chore: Removed trailing spaces and cleaned up code

This commit is contained in:
Aerex 2021-07-05 16:41:38 -05:00
parent 39feb2edb9
commit 0755b84fdd
4 changed files with 33 additions and 33 deletions

View File

@ -47,11 +47,12 @@ class Plugin extends ServerPlugin {
function __construct($configFile){
$this->rawConfigs = $this->buildConfigurations($configFile);
$this->storageManager = new StorageManager($this->rawConfigs);
$this->logger = new Logger($this->rawConfigs, 'BaikalStorage');
$this->initializeStorages($this->rawConfigs);
}
private function getDisplayName($path) {
// Remove filepath (e.g Remove xxxx.ics from calendars/collection_name/xxxx.ics)
// Remove filepath
$urlParts = explode('/', $path);
$calendarUrl = implode('/', array_slice($urlParts, 0, sizeof($urlParts)-1));
@ -307,4 +308,3 @@ class Plugin extends ServerPlugin {
}
}

View File

@ -22,6 +22,10 @@ class StorageManager {
$this->configs = $configs;
}
public function getStorages() {
return $this->storages;
}
public function fromStorageSource(Calendar $calendar) {
if (!isset($this->configs)) {
throw new \Exception('StorageManager was not initialize or configs are not defined');
@ -34,9 +38,6 @@ class StorageManager {
return false;
}
public function getStorages() {
return $this->storages;
}
public function getConfigs() {
return $this->configs;
@ -72,4 +73,3 @@ class StorageManager {
}
}
}

View File

@ -11,4 +11,3 @@ interface IStorage {
public function getConfigBrowser();
public function updateConfigs($postData);
}

View File

@ -179,6 +179,7 @@ class Taskwarrior implements IStorage {
if (!isset($c->VTODO)){
throw new \Exception('Calendar event does not contain VTODO');
}
$this->logger->info(sprintf('Executing on calendar %s', $displayname));
$this->logger->info(json_encode($c->jsonSerialize()));
$this->refresh();
$task = $this->vObjectToTask($c->VTODO, $displayname);
@ -206,6 +207,7 @@ class Taskwarrior implements IStorage {
}
$task = $this->tasks[(string)$uid];
if (isset($task) && $task['status'] !== 'deleted') {
$this->logger->info(sprintf('Deleting iCal %s from taskwarrior', $uid));
$uuid = $task['uuid'];
$this->logger->info(
sprintf('Executing TASKRC = %s TASKDATA = %s task delete %s', $this->configs['taskrc'], $this->configs['taskdata'], $uuid)
@ -225,6 +227,5 @@ class Taskwarrior implements IStorage {
$this->logger->error($e->getTraceAsString());
throw $e;
}
}
}