diff --git a/Admin/Install/Interfaces/DatabaseExchanger/Exporter.php b/Admin/Install/Interfaces/DatabaseExchanger/Exporter.php index 6875c9c..bc7c0b2 100755 --- a/Admin/Install/Interfaces/DatabaseExchanger/Exporter.php +++ b/Admin/Install/Interfaces/DatabaseExchanger/Exporter.php @@ -29,14 +29,6 @@ final class Exporter extends ExporterAbstract { use ExchangeTrait; - /** - * Account - * - * @var int - * @since 1.0.0 - */ - private int $account = 1; - /** * Export all data in time span * diff --git a/Admin/Install/Interfaces/DatabaseExchanger/Importer.php b/Admin/Install/Interfaces/DatabaseExchanger/Importer.php index ac4b29b..43177b3 100755 --- a/Admin/Install/Interfaces/DatabaseExchanger/Importer.php +++ b/Admin/Install/Interfaces/DatabaseExchanger/Importer.php @@ -29,14 +29,6 @@ final class Importer extends ImporterAbstract { use ExchangeTrait; - /** - * Account - * - * @var int - * @since 1.0.0 - */ - private int $account = 1; - /** * Import all data in time span * diff --git a/Admin/Install/Interfaces/DatabaseExchanger/Lang/en.lang.php b/Admin/Install/Interfaces/DatabaseExchanger/Lang/en.lang.php index fff046b..b5d2704 100755 --- a/Admin/Install/Interfaces/DatabaseExchanger/Lang/en.lang.php +++ b/Admin/Install/Interfaces/DatabaseExchanger/Lang/en.lang.php @@ -24,7 +24,6 @@ return [ 'Type' => 'Type', 'Field' => 'Field', 'Protocol' => 'Protocol', - 'Settings' => 'Settings', 'Import' => 'Import', 'Export' => 'Export', 'Connection' => 'Connection', diff --git a/Admin/Installer.php b/Admin/Installer.php index 0ec3b8c..8d5b119 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -15,6 +15,7 @@ declare(strict_types=1); namespace Modules\Exchange\Admin; use Modules\Exchange\Models\InterfaceManager; +use Modules\Exchange\Models\NullInterfaceManager; use phpOMS\Application\ApplicationAbstract; use phpOMS\Config\SettingsInterface; use phpOMS\Message\Http\HttpRequest; @@ -49,6 +50,10 @@ final class Installer extends InstallerAbstract parent::install($app, $info, $cfgHandler); $interfaces = \scandir(__DIR__ . '/Install/Interfaces'); + if ($interfaces === false) { + return; + } + foreach ($interfaces as $interface) { if (!\is_dir(__DIR__ . '/Install/Interfaces/' . $interface) || $interface === '.' @@ -79,7 +84,15 @@ final class Installer extends InstallerAbstract $response = new HttpResponse(); $request = new HttpRequest(new HttpUri('')); - $data = \json_decode(\file_get_contents($path . '/interface.json'), true); + $contents = \file_get_contents($path . '/interface.json'); + if ($contents === false) { + return new NullInterfaceManager(); + } + + $data = \json_decode($contents, true); + if (!\is_array($data)) { + return new NullInterfaceManager(); + } $request->header->account = 1; $request->setData('title', $data['name']); @@ -92,6 +105,10 @@ final class Installer extends InstallerAbstract } $exchangeFiles = \scandir($path); + if ($exchangeFiles === false) { + return new NullInterfaceManager(); + } + foreach ($exchangeFiles as $filePath) { if ($filePath === '..' || $filePath === '.') { continue; @@ -99,6 +116,10 @@ final class Installer extends InstallerAbstract if (\is_dir($path . '/' . $filePath)) { $subdir = \scandir($path . '/' . $filePath); + if ($subdir === false) { + continue; + } + foreach ($subdir as $subPath) { if (!\is_file($path . '/' . $filePath . '/' . $subPath)) { continue; diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e9b4371..4bbb819 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,7 +16,7 @@ Generally, the development philosophy is result orientated. This means that anyo Developers are encouraged to pick open tasks with high priorities according to their own skill level. Senior developers may directly assign tasks to developers based on their importance. New developers may find it easier to start with a task that has a low priority as they often also have a lower difficulty. -Open tasks can be found in the project overview: [PROJECT.md](../Project/PROJECT.md) +Open tasks can be found in the project overview: [PROJECT.md](https://github.com/Karaka-Management/Organization-Guide/blob/master/Project/PROJECT.md) Tasks currently in development are prefixed in the priority column with an asterisk `*` and a name tag in the task description of the developer who is working on the task. diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 5b0be76..a81d885 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -60,7 +60,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function apiExchangeImport(RequestAbstract $request, ResponseAbstract $response, $data = null) : void + public function apiExchangeImport(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { $import = $this->importDataFromRequest($request); $status = NotificationLevel::ERROR; @@ -93,6 +93,8 @@ final class ApiController extends Controller */ private function importDataFromRequest(RequestAbstract $request) : array { + $importer = null; + /** @var \Modules\Exchange\Models\InterfaceManager $interface */ $interface = InterfaceManagerMapper::get() ->with('source') @@ -131,7 +133,7 @@ final class ApiController extends Controller } /** @var \Modules\Exchange\Models\ImporterAbstract $importer */ - return $importer->importFromRequest($request); + return $importer === null ? [] : $importer->importFromRequest($request); } /** @@ -168,7 +170,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function apiInterfaceInstall(RequestAbstract $request, ResponseAbstract $response, $data = null) : void + public function apiInterfaceInstall(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { $uploadedFiles = $request->getFiles(); $files = []; @@ -276,7 +278,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function apiExchangeExport(RequestAbstract $request, HttpResponse $response, $data = null) : void + public function apiExchangeExport(RequestAbstract $request, HttpResponse $response, mixed $data = null) : void { $export = $this->exportDataFromRequest($request); @@ -329,6 +331,8 @@ final class ApiController extends Controller */ private function exportDataFromRequest(RequestAbstract $request) : array { + $exporter = null; + /** @var \Modules\Exchange\Models\InterfaceManager $interface */ $interface = InterfaceManagerMapper::get() ->with('source') @@ -354,7 +358,7 @@ final class ApiController extends Controller } } - return $exporter->exportFromRequest($request); + return $exporter === null ? [] : $exporter->exportFromRequest($request); } /** @@ -370,7 +374,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function apiExchangeSettingCreate(RequestAbstract $request, HttpResponse $response, $data = null) : void + public function apiExchangeSettingCreate(RequestAbstract $request, HttpResponse $response, mixed $data = null) : void { if (!empty($val = $this->validateSettingCreate($request))) { $response->set('setting_create', new FormValidation($val)); diff --git a/Controller/BackendController.php b/Controller/BackendController.php index e347a0b..f81fa3e 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -44,7 +44,7 @@ final class BackendController extends Controller * @since 1.0.0 * @codeCoverageIgnore */ - public function viewExchangeLogList(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + public function viewExchangeLogList(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Exchange/Theme/Backend/exchange-log-list'); @@ -79,7 +79,7 @@ final class BackendController extends Controller * @since 1.0.0 * @codeCoverageIgnore */ - public function viewExchangeLog(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + public function viewExchangeLog(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Exchange/Theme/Backend/exchange-log'); @@ -103,7 +103,7 @@ final class BackendController extends Controller * @since 1.0.0 * @codeCoverageIgnore */ - public function viewExchangeExportList(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + public function viewExchangeExportList(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Exchange/Theme/Backend/exchange-export-list'); @@ -136,7 +136,7 @@ final class BackendController extends Controller * @since 1.0.0 * @codeCoverageIgnore */ - public function viewExchangeImportList(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + public function viewExchangeImportList(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Exchange/Theme/Backend/exchange-import-list'); @@ -169,7 +169,7 @@ final class BackendController extends Controller * @since 1.0.0 * @codeCoverageIgnore */ - public function viewExchangeExport(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + public function viewExchangeExport(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Exchange/Theme/Backend/exchange-export'); @@ -206,7 +206,7 @@ final class BackendController extends Controller * @since 1.0.0 * @codeCoverageIgnore */ - public function viewExchangeImport(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + public function viewExchangeImport(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Exchange/Theme/Backend/exchange-import'); diff --git a/Models/ExchangeLogMapper.php b/Models/ExchangeLogMapper.php index 951a2a3..38962f3 100755 --- a/Models/ExchangeLogMapper.php +++ b/Models/ExchangeLogMapper.php @@ -71,7 +71,7 @@ final class ExchangeLogMapper extends DataMapperFactory /** * Belongs to. * - * @var array + * @var array * @since 1.0.0 */ public const BELONGS_TO = [ diff --git a/Models/ExchangeSetting.php b/Models/ExchangeSetting.php index d44d5c4..a3e2706 100755 --- a/Models/ExchangeSetting.php +++ b/Models/ExchangeSetting.php @@ -81,7 +81,7 @@ class ExchangeSetting implements \JsonSerializable /** * Set data. * - * @param int $data Data + * @param array $data Data * * @return void * diff --git a/Models/InterfaceManager.php b/Models/InterfaceManager.php index 2ec58e9..52d6dde 100755 --- a/Models/InterfaceManager.php +++ b/Models/InterfaceManager.php @@ -106,7 +106,7 @@ class InterfaceManager /** * Settings. * - * @var ExchangeSettings[] + * @var ExchangeSetting[] * @since 1.0.0 */ protected array $settings = []; diff --git a/Models/InterfaceManagerMapper.php b/Models/InterfaceManagerMapper.php index 4c344b5..4db441a 100755 --- a/Models/InterfaceManagerMapper.php +++ b/Models/InterfaceManagerMapper.php @@ -65,7 +65,7 @@ final class InterfaceManagerMapper extends DataMapperFactory /** * Belongs to. * - * @var array + * @var array * @since 1.0.0 */ public const BELONGS_TO = [