Skip to content

Example: Level stages (stages.xml)

Chris edited this page May 26, 2016 · 2 revisions

Options

The parser implementation (pandaac\Exporter\Parsers\Stages in this case) has no options.

Example

use pandaac\Exporter\Exporter;
use pandaac\Exporter\Parsers\Stages;

try {

  $stages = new Exporter(
    './data/XML/stages.xml',
    new Stages
  );

  $response = $stages->export();

} catch (Exception $e) {
  // Log errors...
}

The export() method returns a Illuminate\Support\Collection object, please refer to its documentation. If you would prefer a JSON or an array response however, you may do as follows...

$response = $stages->export()->toJson();
$response = $stages->export()->toArray();

Example output (JSON)

{
  "enabled": false,
  "stages": [
    {
      "minlevel": 1,
      "maxlevel": 8,
      "multiplier": 7
    },
    {
      "minlevel": 9,
      "maxlevel": 20,
      "multiplier": 6
    },
    {
      "minlevel": 21,
      "maxlevel": 50,
      "multiplier": 5
    },
    {
      "minlevel": 51,
      "maxlevel": 100,
      "multiplier": 4
    },
    {
      "minlevel": 101,
      "multiplier": 5
    }
  ],

  ...
}

Clone this wiki locally