start() public static method

Start a editing session or return an existing one
public static start ( string $uid, File $file ) : array
$uid string of the user starting a session
$file OCA\Richdocuments\File - file object
return array
 /**
  * @NoAdminRequired
  */
 public function join($fileId)
 {
     try {
         $view = \OC\Files\Filesystem::getView();
         $path = $view->getPath($fileId);
         if ($view->isUpdatable($path)) {
             $file = new File($fileId);
             $response = Db\Session::start($this->uid, $file);
         } else {
             $info = $view->getFileInfo($path);
             $response = ['permissions' => $info['permissions'], 'id' => $fileId];
         }
         $response = array_merge($response, ['status' => 'success']);
     } catch (\Exception $e) {
         $this->logger->warning('Starting a session failed. Reason: ' . $e->getMessage(), ['app' => $this->appName]);
         $response = ['status' => 'error'];
     }
     return $response;
 }