dimanche 19 mai 2019

Problems porting a Java Chain of Responsability example to PHP

I am trying to port this example of Chain of Responsability made in Java to PHP

My java fork is running here: https://repl.it/@CelsoF/chain-of-responsability-design-pattern

The java result is:

A text parser is handling the file: someFile.txt
A JSON parser is handling the file: otherFile.json
A XML parser is handling the file: xmlFile.xml
A CSV parser is handling the file: csvFile.csv
Unable to find the correct parser for the file: csvFile.doc

My current PHP code is running here: https://3v4l.org/ukJtE

But, unfortunately, the PHP result is different:

A text parser is handling the file: someFile.txt
A JSON parser is handling the file: otherFile.json
Unable to find the correct parser for the file:xmlFile.xml
Unable to find the correct parser for the file:csvFile.csv
Unable to find the correct parser for the file:csvFile.doc

I am trying to discover why but without success :(

Thanks in advance

Celso

Aucun commentaire:

Enregistrer un commentaire