Nathanmac\Utilities\Parser\Parser::xml PHP Метод

xml() публичный Метод

XML parser, helper function.
public xml ( $payload ) : array
$payload
Результат array
    public function xml($payload)
    {
        return $this->parse($payload, new XML());
    }

Usage Example

Пример #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $file = Request::file('xmlfile');
     $type = Input::get('type');
     $userid = Input::get('userid');
     $alpha = Input::get('alpha');
     $extension = $file->getClientOriginalExtension();
     $oname = $file->getClientOriginalName();
     Storage::disk('local')->put("uploads/" . $file->getClientOriginalName(), File::get($file));
     $parser = new Parser();
     $contents = Storage::get("uploads/" . $file->getClientOriginalName());
     $rawxml = $parser->xml($contents);
     $importer = new Importer();
     if ($type == 'recipes') {
         $importer->parseRecipe($rawxml, $userid, $alpha, 1);
     }
     if ($type == 'blocks') {
         $importer->parseBlocks($rawxml, $userid, $alpha, 1);
     }
     if ($type == 'materials') {
         $importer->parseMaterial($rawxml, $userid, $alpha, 1);
     }
     if ($type == 'items') {
         $importer->parseItems($rawxml, $userid, $alpha, 1);
     }
     //Flash::success('You successfully imported a '.$type.' xml file for 7 Days to Die Alpha '.$alpha.'!');
     return view('pages.import');
 }
All Usage Examples Of Nathanmac\Utilities\Parser\Parser::xml