将Java责任链示例移植到PHP时遇到问题

时间:2019-05-19 22:48:14

标签: java php design-patterns chain-of-responsibility

我正尝试将Java中创建的this责任链示例移植到PHP

我的java fork在这里运行:https://repl.it/@CelsoF/chain-of-responsability-design-pattern

java结果是:

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

我当前的PHP代码在这里运行:https://3v4l.org/ukJtE

但是,不幸的是,PHP结果不同:

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

我试图找出原因,但没有成功:(

预先感谢

塞尔索

0 个答案:

没有答案