-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DomCrawler] Abstract URI logic and crawl images #13620
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
Conversation
valeriangalliat
commented
Feb 7, 2015
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #12429 |
License | MIT |
Doc PR | symfony/symfony-docs#4971 |
All the URI parsing logic is externalized in the AbstractUriElement class, implementing the UriElementInterface interface. The AbstractUriElement class have two abstract methods: * setNode: validate the DOMElement node according to the concrete class rules, and set $this->node. * getRawUri: get the raw URI from $this->node. The Link and Form classs now extends AbstractUriElement (Form don't have to extend Link anymore). This refactor is desirable for #12429.
The DomCrawler tests are passing, but there's a problem with FrameworkBundle. I don't think it's caused by my changes since I have the same failures on the current |
A new Image class is added, extending AbstractUriElement, to leverage URI methods for the HTML img src attribute. Two methods are added to the Crawler class, image and images, that are the equivalent of link and links for images.
This can easily made BC by still letting This would allow users to already make their code compatible for Symfony 3.0. |
This is a fix for BC with Symfony 2.7. It should be reverted in 3.0.
@wouterj I just fixed this in a separate commit, so it's easy to revert in Symfony 3.0 (and I edited the original message to set "BC breaks?" to "no". Do I close this PR and make another one targeting the 2.7 branch (I have it ready on top of 2.7)? Also how to handle the changelog for both 2.7 and 3.0? |
@valeriangalliat please send a PR to 2.7 yes. It is better to ship new features in 2.7 rather than making them wait until November for 3.0. Once it is merged, you would then send a second PR with the 3.0 cleanup. |
/** | ||
* @var string The method to use for the element URI | ||
*/ | ||
protected $method; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make these private (we have public getters for them anyway)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, no. These properties are currently protected in Link, so we cannot make them private yet
…riangalliat) This PR was squashed before being merged into the 3.1-dev branch (closes #17585). Discussion ---------- [DomCrawler] Abstract URI logic and crawl images | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #12429 | License | MIT | Doc PR | symfony/symfony-docs#4971 This is a backward-compatible version of #13620, and a rebase of #13649 on current `master`. Commits ------- 1553b07 [DomCrawler] Abstract URI logic and crawl images