BackupGuard
6 years ago
Dropbox
6 years ago
Request
6 years ago
SGArchive.php
6 years ago
SGArchiveToZip.php
6 years ago
SGAuthClient.php
6 years ago
SGCallback.php
6 years ago
SGCdrEntry.php
6 years ago
SGCharsetHandler.php
6 years ago
SGDBState.php
6 years ago
SGEntry.php
6 years ago
SGFileEntry.php
6 years ago
SGFileState.php
6 years ago
SGMigrateState.php
6 years ago
SGMysqldump.php
6 years ago
SGReloadHandler.php
6 years ago
SGReloader.php
6 years ago
SGReloaderState.php
6 years ago
SGReviewManager.php
6 years ago
SGState.php
6 years ago
SGUploadHandler.php
6 years ago
SGUploadState.php
6 years ago
test.txt
6 years ago
SGCallback.php
54 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * |
| 5 | */ |
| 6 | class SGCallback |
| 7 | { |
| 8 | private $className; |
| 9 | private $methodName; |
| 10 | private $params; |
| 11 | |
| 12 | function __construct($className, $methodName, $params = array()) |
| 13 | { |
| 14 | $this->className = $className; |
| 15 | $this->methodName = $methodName; |
| 16 | $this->params = $params; |
| 17 | } |
| 18 | |
| 19 | public function canPerform() |
| 20 | { |
| 21 | if (class_exists($this->className)) { |
| 22 | |
| 23 | $callbackClass = $this->className; |
| 24 | $sgCallback = new $callbackClass(); |
| 25 | |
| 26 | if (method_exists($sgCallback, $this->methodName)) { |
| 27 | return true; |
| 28 | } |
| 29 | |
| 30 | return false; |
| 31 | } |
| 32 | |
| 33 | return false; |
| 34 | } |
| 35 | |
| 36 | public function perform() |
| 37 | { |
| 38 | $callbackClass = $this->className; |
| 39 | $methodName = $this->methodName; |
| 40 | |
| 41 | $obj = new $callbackClass(); |
| 42 | $obj->$methodName($this->params); |
| 43 | } |
| 44 | |
| 45 | public function toString() |
| 46 | { |
| 47 | return json_encode(array( |
| 48 | 'class' => $this->className, |
| 49 | 'method' => $this->methodName, |
| 50 | 'params' => $this->params |
| 51 | )); |
| 52 | } |
| 53 | } |
| 54 |