Comments (9)
@sabas
I created this pr:
#135
I did some small refactoring to reduce the amount of nested if/else constructions.
Please let me know if you have any comments.
from edifact.
The processs doesn't exist actually, in my projects I use directly the master branch 🤣
I usually do it after someone reminds me to do it... I'll tag 1.1 in a few hours!
from edifact.
unwrap
function in Reader
removes CR+LF+0x00, but unwrap
in Parser
doesn't:
$string = \preg_replace('#[\x00\r\n]#', '', $string);
Is that how it should be?
https://github.com/php-edifact/edifact/blob/master/src/EDI/Reader.php#L557
https://github.com/php-edifact/edifact/blob/master/src/EDI/Parser.php#L467
from edifact.
Hi, your input EDI has a line-break inside the segment, it shouldn't be valid as the linebreak character isn't in the UNOB charset...
I modified the Parser to add a feature to detect an error where there's no segment terminator in files that are formatted with one segment per line.
If you pass ->setStrict(true)
to the Parser instance before running it on the edi it reverts to the previous behaviour... @johanib
@iGrog I believe the unwrap function in Reader is a version of more than 5 years ago of the same function in Parser :-D
Reader and Analyser need some refactoring probably....
from edifact.
@sabas Thanks! I'm not sure how I missed ->setStrict(true), but it solves my linebreak issue 😅
One more thing I don't understand, given these EDI segments:
FTX+AAI+++PLS ENSURE TO TAKE OUR APPROVAL PRIOR STUFFING ANY NON HAZ CHEMICA:LS'
FTX+ABV+++THIS BOOKING CONFIRMATION IS SUBJECT TO SEALING'
FTX+AAI+++THE SHIPPER SHALL NOT BE RESPONSIBLE FOR ANY COSTS/DELAYS OCCUR
I really can't figure out how to extract the FTX+AAI segments...
Do you know if this library is capable of reading these segments?
It seems it always returns with the error 'Segment is ambiguous'.
I wrote some hacky solution to accomplish this and a test to illustrate what I expect as output:
https://github.com/johanib/edifact/pull/1/files
from edifact.
What about returning you an array of results instead of null? Would it make sense? Are you using Reader to extract specific information?
from edifact.
For my purposes I do not need to extract the individual FTX+AAI segments.
But afaik, the readEdiDataValue function is build on the idea that the caller specifies what it wants to read, so I added the $offset parameter.
Returning an array would work for my case.
There are also some checks at the bottom of the readEdiDataValue function. They would need to be looped if the function would start to return arrays. So I'm not sure if that will make it better.
I can probably improve my initial suggestion to make it more nice if you think it's a good addition.
from edifact.
Of course, feel free to send a PR :)
from edifact.
🎊
Just a question: What is the release process like?
I see the latest tag / composer package is from October last year.
Can we release this version? :)
from edifact.
Related Issues (20)
- How to create edi document with .edi extension for healthcare HOT 4
- readEdiSegmentDTM for SG12 HOT 5
- File has multiple messages HOT 6
- question marks are not parsed correctly HOT 5
- Fatal error on integer-value segments for Encoder HOT 2
- Reader cannot be init with a null param HOT 3
- Release 0.5.0 not available via Composer HOT 2
- Possibility to have IDs instead of name as output from Interpreter::prepare HOT 5
- CDR read HOT 4
- Problems reading RFF segment from EDI-File HOT 1
- Array to string conversion, if an epty array met. HOT 1
- X12 HOT 6
- Package ramsey/array_column is abandoned HOT 2
- Trouble understanding how to get the data we need HOT 5
- Segment is ambiguous HOT 1
- Elements with maxrepeat > 1 should be considered arrays when parsed as json HOT 6
- Reader doesn't return full multi-line texts HOT 4
- Multiple SG2 segments not allowed HOT 8
- Unable to parse DESADV with multiple NAD HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from edifact.