Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Conversation

@beroso
Copy link

@beroso beroso commented Feb 14, 2018

Fix #34

@mkopinsky
Copy link

+1.

In mkopinsky@f44df3a I added a unit test/fixture for a oneline OFX file which does include some line breaks, and this PR passed that with no problem. (I also tested with the actual QFX file from Ally Bank, which also passed.)

@beroso
Copy link
Author

beroso commented Feb 14, 2018

I'm glad to hear that, @mkopinsky, I will include your OFX in this PR. Thank you for your feedback.


/**
* Detect if the OFX file is on one line. If it is, add newlines automatically.
* Prepare OFX file contents.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put a better description here of what's going on to make it clearer please? Something like:

Normalise newlines by removing and adding newlines only before opening tags


return $ofxContent;
// clear all new line characters first
$ofxContent = str_replace(["\r", "\n"], '', $ofxContent);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, seems unlikely, but possible that there might be other newlines we didn't intend to replace here (for example, maybe a transaction description has a newline that should be kept for whatever reason). We don't have an existing test, but this may be a BC break.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

understood

$tag = ltrim(substr($line, 1, strpos($line, '>') - 1), '/');

// Line is "<SOMETHING>" or "</SOMETHING>"
if ($line == '<' . $tag . '>' || $line == '</' . $tag . '>') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use === for equality checks

@asgrim asgrim added the enhancement This adds new functionality or improves existing functionality. label Feb 14, 2018
@asgrim
Copy link
Owner

asgrim commented Feb 14, 2018

Nice improvement, thank you @berosoboy - just a couple of changes please as above :)

@asgrim asgrim self-assigned this Oct 29, 2018
@asgrim
Copy link
Owner

asgrim commented Jan 18, 2019

Sorry for the delay on this one, there seems to be a conflict - could you take a look please and poke me when resolved? Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement This adds new functionality or improves existing functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants