| Total Complexity | 13 |
| Total Lines | 86 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class DataBag extends \Jaxon\Plugin\Response |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var DataBag\Bag |
||
| 13 | */ |
||
| 14 | protected $xBag; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The constructor |
||
| 18 | */ |
||
| 19 | public function __construct() |
||
| 20 | { |
||
| 21 | $aData = isset($_POST['jxnbags']) ? $this->readData($_POST) : |
||
| 22 | (isset($_GET['jxnbags']) ? $this->readData($_GET) : []); |
||
| 23 | $this->xBag = new DataBag\Bag($aData); |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param array $aFrom |
||
| 28 | * |
||
| 29 | * @return array |
||
| 30 | */ |
||
| 31 | private function readData(array $aFrom) |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @inheritDoc |
||
| 47 | */ |
||
| 48 | public function getName() |
||
| 49 | { |
||
| 50 | return 'bags'; |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @inheritDoc |
||
| 55 | */ |
||
| 56 | public function getHash() |
||
| 57 | { |
||
| 58 | // Use the version number as hash |
||
| 59 | return '1.0.0'; |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @inheritDoc |
||
| 64 | */ |
||
| 65 | public function getReadyScript() |
||
| 68 | jaxon.command.handler.register("bags.set", function(args) { |
||
| 69 | for (const bag in args.data) { |
||
| 70 | jaxon.ajax.parameters.bags[bag] = args.data[bag]; |
||
| 71 | } |
||
| 72 | }); |
||
| 73 | '; |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @return bool |
||
| 78 | */ |
||
| 79 | public function writeCommand() |
||
| 84 | } |
||
| 85 | } |
||
| 86 | |||
| 87 | /** |
||
| 88 | * @param string $sName |
||
| 89 | * |
||
| 90 | * @return DataBag\Context |
||
| 91 | */ |
||
| 92 | public function bag($sName) |
||
| 97 |