Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add docs for Process::getIterator() #7184

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

Closed
javiereguiluz opened this issue Nov 25, 2016 · 2 comments
Closed

Add docs for Process::getIterator() #7184

javiereguiluz opened this issue Nov 25, 2016 · 2 comments
Labels
hasPR A Pull Request has already been submitted for this issue. Process
Milestone

Comments

@javiereguiluz
Copy link
Member

Should we add docs for this method? We recently improved it adding config flags to it: symfony/symfony#18513

@javiereguiluz
Copy link
Member Author

I'm trying to document this but I'm having problems deciding the purpose of this getIterator() method. Does it:

  1. Replace/improve the existing way to get the normal output:
$process = new Process('ls -lsa');
$process->start();

foreach ($process as $type => $data) {
    // ...
}
  1. Replace/improve the existing way the output in real time:
$process = new Process('ls -lsa');
$process->run(function ($type, $buffer) {
    // ...
}
  1. Is it something completely different?

Let's ping some Process experts: @romainneutron @nicolas-grekas

@javiereguiluz
Copy link
Member Author

On Symfony Slack, @stof answered me:

Process::getIterator is how foreach ($process as $type => $data) is implemented (through IteratorAggregate) but calling the method explicitly allows to use the optional arguments to tweak the behavior

@javiereguiluz javiereguiluz added the hasPR A Pull Request has already been submitted for this issue. label Apr 24, 2017
xabbuh added a commit that referenced this issue May 11, 2017
This PR was squashed before being merged into the 3.2 branch (closes #7833).

Discussion
----------

Documented the getIterator() method

This fixes #7184.

Commits
-------

c84cb10 Documented the getIterator() method
@xabbuh xabbuh closed this as completed May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hasPR A Pull Request has already been submitted for this issue. Process
Projects
None yet
Development

No branches or pull requests

2 participants