Skip to content

Instantly share code, notes, and snippets.

@x0st
Created September 5, 2017 20:19
Show Gist options
  • Save x0st/f827c3bb730d93084e16cc000cbc42e3 to your computer and use it in GitHub Desktop.
Save x0st/f827c3bb730d93084e16cc000cbc42e3 to your computer and use it in GitHub Desktop.
/**
* Class IndexAction
* @package App\Http\Controllers\EditingController
*/
class IndexAction
{
/**
* @var EgnyteState
*/
private $stateModel;
/**
* IndexAction constructor.
* @param EgnyteState $stateModel
*/
public function __construct(EgnyteState $stateModel)
{
$this->stateModel = $stateModel;
}
/**
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function act()
{
$this->checkIfUserIsEditingDocument();
$this->checkDocumentSize();
$documentLocalPath = $this->downloadDocumentFromEgnyte();
$this->checkDocumentPageCount($documentLocalPath);
$pdffillerDocument = $this->uploadDocumentToPDFfiller($documentLocalPath);
$url = $this->urlForOpeningEditor($pdffillerDocument);
$this->updateStateModel($pdffillerDocument);
$this->deleteLocalFile($documentLocalPath);
return view('editing.index', [
'url' => $url,
'state' => $this->stateModel->getState()
]);
}
/**
* @return void
*
* @throws ConflictHttpException
*/
private function checkIfUserIsEditingDocument() {}
/**
* @param string $documentFilePath
*/
private function deleteLocalFile(string $documentFilePath) {}
/**
* @param Document $documentRepresentation
*/
private function updateStateModel(Document $documentRepresentation) {}
/**
* @param Document $documentRepresentation
*
* @return string
*/
private function urlForOpeningEditor(Document $documentRepresentation) {}
/**
* @param $localPath
* @return \App\Services\PDFfillerCore\Entities\Document
*/
private function uploadDocumentToPDFfiller(string $localPath) {}
/**
* @return string
*/
private function downloadDocumentFromEgnyte() {}
/**
* @return void
*
* @throws BadRequestHttpException
*/
private function checkDocumentSize() {}
/**
* @param string $localPath
*
* @return void
*
* @throws BadRequestHttpException
*/
private function checkDocumentPageCount(string $localPath) {}
/**
* @return int
*/
private function egnyteDocumentSize() {}
}
@x0st
Copy link
Author

x0st commented Sep 5, 2017

/**
 * @param EgnyteState $stateModel
 *
 * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
 */
public function index(EgnyteState $stateModel)
{
    return (new IndexAction($stateModel))->act();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment