8000 [DomCrawler] [3.0] Abstract URI logic and crawl images by valeriangalliat · Pull Request #13650 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DomCrawler] [3.0] Abstract URI logic and crawl images #13650

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
wants to merge 3 commits into from
Closed

[DomCrawler] [3.0] Abstract URI logic and crawl images #13650

wants to merge 3 commits into from

Conversation

valeriangalliat
Copy link
Contributor
Q A
Bug fix? no
New feature? yes
BC breaks? yes
Deprecations? no
Tests pass? yes
Fixed tickets #12429
License MIT
Doc PR symfony/symfony-docs#4971

This is the 3.0-ready version of #13649 (I cherry-picked the two first commits and added "Cleanup AbstractUriElement" which contains the actual changes for 3.0 according to the discussion in #13620).

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 classs now extends AbstractUriElement.

This refactor is desirable for #12429.
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.
* `Form` now extends `AbstractUriElement` instead of `Link`.
* The `node` and `method` properties of `AbstractUriElement` are now
  private (they already have public getters).
* Since `node` is private, `setNode` in child classes can't set the
  `node` property directly, thus `setNode` have been renamed to
  `findNode` and now returns the node instead of setting the property.
@fabpot
Copy link
Member
fabpot commented Jan 25, 2016

This one should be rebased once #13649 (or the new one on master) is merged

@fabpot fabpot closed this Feb 18, 2016
xabbuh added a commit to symfony/symfony-docs that referenced this pull request Mar 10, 2016
This PR was merged into the master branch.

Discussion
----------

[DomCrawler] Document images crawler

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | yes (symfony/symfony#13649, symfony/symfony#13650)
| Applies to    | 3.0.0
| Fixed tickets | symfony/symfony#12429

Commits
-------

355a83f [DomCrawler] Document images crawler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0