Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DomCrawler] Added support for slicing nodes#10699

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
beratdogan wants to merge6 commits intosymfony:masterfromberatdogan:patch-1
Closed

[DomCrawler] Added support for slicing nodes#10699

beratdogan wants to merge6 commits intosymfony:masterfromberatdogan:patch-1

Conversation

@beratdogan
Copy link

QA
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets
LicenseMIT

There are no easy way to slice nodes in specific range. I created a method using \LimitIterator. Works fine for me.

An example using is:

$crawler->filter('h1')->slice(5,10)->each(function ($node,$i) {return$node->text();     });

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove@api please. It can't be part of the stable api untill it... well, stablisies ;)

Copy link
Author

Choose a reason for hiding this comment

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

Of cource, I'll do. Thanks for understanding I'm apprentice. :)

@jakzal
Copy link
Contributor

Would be nice to cover the new method by tests andthe PR checklist is missing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not simply call:

returnnewstatic(iterator_to_array(new \LimitIterator($this,$offset,$length)),$this->uri);

Copy link
Author

Choose a reason for hiding this comment

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

Oh, you right! Will be used in next commit.

@beratdogan
Copy link
Author

@jakzal I don't have right experience on writing tests. Could you help to me on this?

@jakzal
Copy link
Contributor

@Grafitus look at the existing ones in the CrawlerTest. If you still need help, I can write tests for you.

@beratdogan
Copy link
Author

I've problems with Git. I wrote the first commit on GitHub --Editing Files. Now, I tried to clone my forked repository into my PC. I couldn't see my 'patch-1' branch, and my changes. :/

@jakzal
Copy link
Contributor

@Grafitus it is there:https://github.com/grafitus/symfony/tree/patch-1

Run:

git pullgit checout patch-1

@beratdogan
Copy link
Author

OMG! I think I made it! 👍

@jakzal can check my commits please? :)

@cordoval
Copy link
Contributor

you changed permissions on the files not good 👶

Copy link
Contributor

Choose a reason for hiding this comment

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

Should beint

Copy link
Author

Choose a reason for hiding this comment

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

@yguedidi Used asinteger in doc blocks, likeeq() andgetNode(). Are you sure?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, look at#10701 ;)

@beratdogan
Copy link
Author

@cordoval You got me! :) I'm still new at Unix-like systems. And file permissions makes me nervous. Do you have suggestions for me to cope with permissions?

@cordoval
Copy link
Contributor

there is an option on .git/config to avoid making that mistake, also there are tools to fix cs like php-cs-fixer and if you need help doing a PR check the documentation for how the table PR is defined. You can finally use tools like Gush to send a PR also.

@beratdoganberatdogan changed the titleAdded support for slicing nodes.[DomCrawler] Added support for slicing nodesApr 23, 2014
@beratdogan
Copy link
Author

@jakzal Everything looks good. Can you check for merging?

@stof
Copy link
Member

@beratdogan there is 2 things preventing the merge:

  • we are in feature freeze for 2.5, so new features cannot be merged anymore since 1.5 month. It needs to wait until we start the development of 2.6 (very soon as 2.5 is due soon)
  • this PR is not mergeable. It conflicts with the current master branch

@beratdogan
Copy link
Author

I guess there is no anything I can do, right?

@stof
Copy link
Member

for the first part, no.
For the second part, you can rebase your branch and fix the conflicts. Seehttp://symfony.com/doc/current/contributing/code/patches.html#rebase-your-patch for the instruction about rebasing (the git doc will also provide more details)

@fabpot
Copy link
Member

Can you rebase this PR on current master?

@fabpot
Copy link
Member

Thank you@beratdogan.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

8 participants

@beratdogan@jakzal@cordoval@stof@fabpot@stloyd@yguedidi@Grafitus

[8]ページ先頭

©2009-2025 Movatter.jp