Giter Site home page Giter Site logo

Comments (5)

sabas avatar sabas commented on May 28, 2024

What about initializing the errors array in the parse function? (after line 38 https://github.com/sabas/edifact/blob/master/src/EDI/Parser.php#L38)
So it should reset itself at each load().

(in a bulk process I use at work I actually build a new object for each message because it's an ajax call)

from edifact.

yoselibero avatar yoselibero commented on May 28, 2024

Hmm.. don't like the idea that much, because:

$parser = new \EDI\Parser();

$parser->load($file);
$parser->parse();
$parser->errors();

$parser->load($anotherFile);
// errors are here, from the previous parsing, and are not related to $anotherFile
$parser->errors();

Personally, i think the better place is the load() and loadString() functions as they are the "entry calls".
Josef

from edifact.

sabas avatar sabas commented on May 28, 2024

But parse() can also be called directly (the constructor calls parse if the data is an array) while load and loadString call parse to do the actual processing. An hypothetical test case would fail if passed an array with errors two times imho...

I committed a fix, if you want to test from master (but I didn't tag it yet).

from edifact.

yoselibero avatar yoselibero commented on May 28, 2024

Cool, looks fine by me, thank you

from edifact.

sabas avatar sabas commented on May 28, 2024

Ok, I tagged a new version for your convenience :-)

from edifact.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.