Skip to content

Commit

Permalink
Refactoring helper classes
Browse files Browse the repository at this point in the history
  • Loading branch information
GaziYucel committed Jan 23, 2024
1 parent 1a1ea6d commit 709b9f7
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ cd /path-to-some-latex-project
│ ├── Handler
│ │ └── PluginHandler.php # Main plugin handler / controller
│ ├── Helpers # Helper classes
│ │ ├── ArticleSubmissionFile.php # Add submission files to submission
│ │ ├── SubmissionFileHelper.php # Add submission files to submission
│ │ ├── FileSystemHelper.php # FileSystem methods
│ │ ├── Log.php # Logging methods
│ │ ├── LogHelper.php # Logging methods
│ │ └── ZipHelper.php # ZipArchive methods
├── locale # Language files
├── templates # Templates folder
Expand Down
10 changes: 5 additions & 5 deletions classes/Action/Convert.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use APP\notification\Notification;
use APP\notification\NotificationManager;
use APP\plugins\generic\latexConverter\classes\Helpers\FileSystemHelper;
use APP\plugins\generic\latexConverter\classes\Helpers\ArticleSubmissionFile;
use APP\plugins\generic\latexConverter\classes\Helpers\SubmissionFileHelper;
use PKP\config\Config;
use PKP\core\JSONMessage;
use PKP\core\PKPRequest;
Expand Down Expand Up @@ -355,8 +355,8 @@ private function addFiles(string $fileToAdd, string $fileToAddWithoutExtension):
if ($file !== $this->mainFileName && $file !== $fileToAdd)
$this->dependentFileNames[] = $file;

$articleSubmissionFile =
new ArticleSubmissionFile(
$submissionFileHelper =
new SubmissionFileHelper(
$this->request,
$this->submissionId,
$this->submissionFile,
Expand All @@ -365,10 +365,10 @@ private function addFiles(string $fileToAdd, string $fileToAddWithoutExtension):
$fileToAdd,
$this->dependentFileNames);

if (!$articleSubmissionFile->addMainFile()) return false;
if (!$submissionFileHelper->addMainFile()) return false;

if (!empty($this->dependentFileNames))
if (!$articleSubmissionFile->addDependentFiles()) return false;
if (!$submissionFileHelper->addDependentFiles()) return false;

return true;
}
Expand Down
10 changes: 5 additions & 5 deletions classes/Action/Extract.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use APP\notification\NotificationManager;
use APP\plugins\generic\latexConverter\classes\Helpers\FileSystemHelper;
use APP\plugins\generic\latexConverter\classes\Helpers\ZipHelper;
use APP\plugins\generic\latexConverter\classes\Helpers\ArticleSubmissionFile;
use APP\plugins\generic\latexConverter\classes\Helpers\SubmissionFileHelper;
use APP\plugins\generic\latexConverter\LatexConverterPlugin;
use APP\template\TemplateManager;
use PKP\core\JSONMessage;
Expand Down Expand Up @@ -245,8 +245,8 @@ public function process(): JSONMessage
}

// add main file
$articleSubmissionFile =
new ArticleSubmissionFile(
$submissionFileHelper =
new SubmissionFileHelper(
$this->request,
$this->submissionId,
$this->submissionFile,
Expand All @@ -256,11 +256,11 @@ public function process(): JSONMessage
$this->dependentFileNames);

if (!empty($this->mainFileName))
if (!$articleSubmissionFile->addMainFile()) return $this->defaultResponse();
if (!$submissionFileHelper->addMainFile()) return $this->defaultResponse();

// add dependent files
if (!empty($this->dependentFileNames))
if (!$articleSubmissionFile->addDependentFiles()) return $this->defaultResponse();
if (!$submissionFileHelper->addDependentFiles()) return $this->defaultResponse();

// all went well, return ok
return $this->defaultResponse(true);
Expand Down
6 changes: 3 additions & 3 deletions classes/Helpers/Log.php → classes/Helpers/LogHelper.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
/**
* @file plugins/generic/latexConverter/classes/Models/Log.php
* @file plugins/generic/latexConverter/classes/Models/LogHelper.php
*
* Copyright (c) 2023+ TIB Hannover
* Copyright (c) 2023+ Gazi Yucel
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class Log
* @class LogHelper
* @ingroup plugins_generic_latexconverter
*
* @brief Logging helper class
Expand All @@ -16,7 +16,7 @@

use PKP\config\Config;

class Log
class LogHelper
{
/**
* Path to file
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php
/**
* @file plugins/generic/latexConverter/classes/Models/ArticleSubmissionFile.php
* @file plugins/generic/latexConverter/classes/Models/SubmissionFileHelper.php
*
* Copyright (c) 2023+ TIB Hannover
* Copyright (c) 2023+ Gazi Yucel
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class ArticleSubmissionFile
* @class SubmissionFileHelper
* @ingroup plugins_generic_latexconverter
*
* @brief ArticleSubmissionFile methods
* @brief SubmissionFileHelper methods
*/

namespace APP\plugins\generic\latexConverter\classes\Helpers;
Expand All @@ -24,7 +24,7 @@
use PKP\core\PKPRequest;
use PKP\submissionFile\SubmissionFile;

class ArticleSubmissionFile
class SubmissionFileHelper
{
/**
* @var NotificationManager
Expand Down
4 changes: 2 additions & 2 deletions vendor/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
'APP\\plugins\\generic\\latexConverter\\classes\\Action\\Extract' => $baseDir . '/classes/Action/Extract.php',
'APP\\plugins\\generic\\latexConverter\\classes\\Components\\Forms\\SettingsForm' => $baseDir . '/classes/Components/Forms/SettingsForm.php',
'APP\\plugins\\generic\\latexConverter\\classes\\Handler\\PluginHandler' => $baseDir . '/classes/Handler/PluginHandler.php',
'APP\\plugins\\generic\\latexConverter\\classes\\Helpers\\ArticleSubmissionFile' => $baseDir . '/classes/Helpers/ArticleSubmissionFile.php',
'APP\\plugins\\generic\\latexConverter\\classes\\Helpers\\SubmissionFileHelper' => $baseDir . '/classes/Helpers/SubmissionFileHelper.php',
'APP\\plugins\\generic\\latexConverter\\classes\\Helpers\\FileSystemHelper' => $baseDir . '/classes/Helpers/FileSystemHelper.php',
'APP\\plugins\\generic\\latexConverter\\classes\\Helpers\\Log' => $baseDir . '/classes/Helpers/Log.php',
'APP\\plugins\\generic\\latexConverter\\classes\\Helpers\\LogHelper' => $baseDir . '/classes/Helpers/LogHelper.php',
'APP\\plugins\\generic\\latexConverter\\classes\\Helpers\\ZipHelper' => $baseDir . '/classes/Helpers/ZipHelper.php',
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
);
4 changes: 2 additions & 2 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class ComposerStaticInit1b66bd88bb6dab52bf3af9b9a16ca7a1
'APP\\plugins\\generic\\latexConverter\\classes\\Action\\Extract' => __DIR__ . '/../..' . '/classes/Action/Extract.php',
'APP\\plugins\\generic\\latexConverter\\classes\\Components\\Forms\\SettingsForm' => __DIR__ . '/../..' . '/classes/Components/Forms/SettingsForm.php',
'APP\\plugins\\generic\\latexConverter\\classes\\Handler\\PluginHandler' => __DIR__ . '/../..' . '/classes/Handler/PluginHandler.php',
'APP\\plugins\\generic\\latexConverter\\classes\\Helpers\\ArticleSubmissionFile' => __DIR__ . '/../..' . '/classes/Helpers/ArticleSubmissionFile.php',
'APP\\plugins\\generic\\latexConverter\\classes\\Helpers\\SubmissionFileHelper' => __DIR__ . '/../..' . '/classes/Helpers/SubmissionFileHelper.php',
'APP\\plugins\\generic\\latexConverter\\classes\\Helpers\\FileSystemHelper' => __DIR__ . '/../..' . '/classes/Helpers/FileSystemHelper.php',
'APP\\plugins\\generic\\latexConverter\\classes\\Helpers\\Log' => __DIR__ . '/../..' . '/classes/Helpers/Log.php',
'APP\\plugins\\generic\\latexConverter\\classes\\Helpers\\LogHelper' => __DIR__ . '/../..' . '/classes/Helpers/LogHelper.php',
'APP\\plugins\\generic\\latexConverter\\classes\\Helpers\\ZipHelper' => __DIR__ . '/../..' . '/classes/Helpers/ZipHelper.php',
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
);
Expand Down
4 changes: 2 additions & 2 deletions version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<version>
<application>latexConverter</application>
<type>plugins.generic</type>
<release>1.0.0.0</release>
<date>2023-05-01</date>
<release>1.1.0.0</release>
<date>2024-01-23</date>
<lazy-load>1</lazy-load>
<class>latexConverterPlugin</class>
</version>

0 comments on commit 709b9f7

Please sign in to comment.