| 1: | <?php | 
| 2: | /** | 
| 3: | * This code is licensed under AGPLv3 license or Afterlogic Software License | 
| 4: | * if commercial version of the product was purchased. | 
| 5: | * For full statements of the licenses see LICENSE-AFTERLOGIC and LICENSE-AGPL3 files. | 
| 6: | */ | 
| 7: | |
| 8: | namespace Aurora\System\Module; | 
| 9: | |
| 10: | /** | 
| 11: | * @license https://www.gnu.org/licenses/agpl-3.0.html AGPL-3.0 | 
| 12: | * @license https://afterlogic.com/products/common-licensing Afterlogic Software License | 
| 13: | * @copyright Copyright (c) 2019, Afterlogic Corp. | 
| 14: | * | 
| 15: | * @package Api | 
| 16: | */ | 
| 17: | class Decorator | 
| 18: | { | 
| 19: | /** | 
| 20: | * | 
| 21: | * @var string | 
| 22: | */ | 
| 23: | protected $sModuleName; | 
| 24: | |
| 25: | /** | 
| 26: | * | 
| 27: | * @param string $sModuleName | 
| 28: | */ | 
| 29: | public function __construct($sModuleName) | 
| 30: | { | 
| 31: | $this->sModuleName = $sModuleName; | 
| 32: | } | 
| 33: | |
| 34: | /** | 
| 35: | * | 
| 36: | * @return Decorator | 
| 37: | */ | 
| 38: | public static function __callStatic($sMethodName, $aArguments) | 
| 39: | { | 
| 40: | return new self($sMethodName); | 
| 41: | } | 
| 42: | |
| 43: | /** | 
| 44: | * | 
| 45: | * @param string $sMethodName | 
| 46: | * @param array $aArguments | 
| 47: | * @return mixed | 
| 48: | */ | 
| 49: | public function __call($sMethodName, $aArguments) | 
| 50: | { | 
| 51: | $mResult = false; | 
| 52: | $oModule = \Aurora\System\Api::GetModule($this->sModuleName); | 
| 53: | if ($oModule instanceof AbstractModule) { | 
| 54: | $mResult = $oModule->CallMethod($sMethodName, $aArguments); | 
| 55: | } | 
| 56: | |
| 57: | return $mResult; | 
| 58: | } | 
| 59: | } | 
| 60: | |
| 61: | function Decorator() | 
| 62: | { | 
| 63: | echo 'Decorator'; | 
| 64: | } | 
| 65: |