Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation is not so clear #416

Open
borgogelli opened this issue May 26, 2023 · 1 comment
Open

Documentation is not so clear #416

borgogelli opened this issue May 26, 2023 · 1 comment

Comments

@borgogelli
Copy link

Hi everyone

referring to the following example, from the README.md

$result = $feedIo->read($url, $feed, $modifiedSince);

I can't understand what is the purpose of the $feed argument ? And why is it mandatory ?

@alexdebril
Copy link
Owner

Hi 👋

Yes, it could be more explicit. $feed is expected to be an instance of FeedInterface or null.

  • if it's a feedInterface then feed-io will populate this instance with data fetched from the feed.
  • if it's a null then feed-io will create a fresh one for you

(so it's a mandatory argument with which can be null)

In both scenarios, the freshly populated $feed will be embedded in the $result.

Now, why ? It's to let you use your own class if you need to. Let's imagine that you use your own class to store data, you could something like:

$result = $feedIo->read($url, $feed, $modifiedSince);
// a bit risky without any proper check before
$feed->save();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants