* @author Dennis Eichhorn * @copyright 2013 Dennis Eichhorn * @license OMS License 1.0 * @version 1.0.0 * @link http://orange-management.com */ namespace phpOMS\Module; /** * Module abstraction class. * * @category Framework * @package phpOMS\Module * @author OMS Development Team * @author Dennis Eichhorn * @license OMS License 1.0 * @link http://orange-management.com * @since 1.0.0 */ abstract class ModuleAbstract { /** * Module name. * * @var string * @since 1.0.0 */ const MODULE_NAME = ''; /** * Module path. * * @var string * @since 1.0.0 */ const MODULE_PATH = __DIR__ . '/../../Modules'; /** * Module version. * * @var string * @since 1.0.0 */ const MODULE_VERSION = '1.0.0'; /** * Receiving modules from? * * @var string[] * @since 1.0.0 */ protected static $providing = []; /** * Localization files. * * @var array * @since 1.0.0 */ protected static $localization = []; /** * Dependencies. * * @var string * @since 1.0.0 */ protected static $dependencies = []; /** * Receiving modules from? * * @var string[] * @since 1.0.0 */ protected $receiving = []; /** * Application instance. * * @var \phpOMS\ApplicationAbstract * @since 1.0.0 */ protected $app = null; /** * Constructor. * * @param \phpOMS\ApplicationAbstract $app Application instance * * @since 1.0.0 * @author Dennis Eichhorn */ public function __construct($app) { $this->app = $app; } /** * Install external. * * @since 1.0.0 * @author Dennis Eichhorn */ public static function installExternal() /* : void */ { } /** * Get language files. * * @param string $language Language key * @param string $destination Application destination (e.g. Backend) * * @return array * * @since 1.0.0 * @author Dennis Eichhorn */ public static function getLocalization(string $language, string $destination) : array { $lang = []; if (file_exists($oldPath = __DIR__ . '/../../Modules/' . static::MODULE_NAME . '/Theme/' . $destination . '/Lang/' . $language . '.lang.php')) { /** @noinspection PhpIncludeInspection */ $lang = include $oldPath; } return $lang; } /** * {@inheritdoc} */ public function addReceiving(string $module) /* : void */ { $this->receiving[] = $module; } /** * {@inheritdoc} */ public function getProviding() : array { /** @noinspection PhpUndefinedFieldInspection */ return static::$providing; } /** * {@inheritdoc} */ public function getName() : string { /** @noinspection PhpUndefinedFieldInspection */ return static::MODULE_NAME; } /** * {@inheritdoc} */ public function getDependencies() : array { /** @noinspection PhpUndefinedFieldInspection */ return static::$dependencies; } /** * Get event id prefix. * * @return string * * @since 1.0.0 * @author Dennis Eichhorn */ public function getEventId() : string { return static::class; } }