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

Skip to content

[DomCrawler] Exposed getter for baseHref #18143

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 2 commits into from
Closed

[DomCrawler] Exposed getter for baseHref #18143

wants to merge 2 commits into from

Conversation

a-ast
Copy link
Contributor

@a-ast a-ast commented Mar 12, 2016

Q A
Branch master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #15584
License MIT
Doc PR n/a

I know that PR for this issue already created, but it is Hack Day, so I'm making my first contribution anyway.

@a-ast a-ast changed the title Exposed getter for baseHref in DomCrawler [DomCrawler] Exposed getter for baseHref Mar 12, 2016
@javiereguiluz
Copy link
Member

@AAstakhov in other circumstances it would be weird to open a PR for some issue which already has a PR ... but you are right and we are in the Hack Day so you can open it. Maybe it gets closed without merging it ... but maybe the other one is closed. Let's wait and see. Thanks!

public function testGetBaseHref()
{
$crawler = new Crawler(null, null, 'http://symfony.com');
$this->assertEquals('http://symfony.com', $crawler->getBaseHref());
Copy link
Contributor

Choose a reason for hiding this comment

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

You could put the string 'http://symfony.com' into a single variable, so one of them can't possibly be typo'd.

@a-ast
Copy link
Contributor Author

a-ast commented Mar 13, 2016

@patrick-mcdougle, thank you for the comment, I've fixed CrawlerTest regarding to your suggestion.

@stof
Copy link
Member

stof commented Mar 15, 2016

👍

Status: reviewed

@nicolas-grekas
Copy link
Member

👍
Status: reviewed
Note for an other reader: $this->baseHref is stateful in that it can change when addHtmlContent is called. This maybe the reason why the property has no getter. WDOT?

@fabpot
Copy link
Member

fabpot commented Mar 15, 2016

@nicolas-grekas That's true in theory, but in practice, if you can addHtmlContent() several times, you end up with a broken crawler, so I don't think it matters too much.

@fabpot
Copy link
Member

fabpot commented Mar 15, 2016

Thank you @AAstakhov.

@fabpot fabpot closed this in b629710 Mar 15, 2016
fabpot added a commit that referenced this pull request May 13, 2016
This PR was merged into the 3.1-dev branch.

Discussion
----------

[DomCrawler] Expose getter for uri

| Q             | A
| ------------- | ---
| Branch        |
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Same as #18143

Commits
-------

baebdb4 [DomCrawler] Exposed getter for uri
@fabpot fabpot mentioned this pull request May 13, 2016
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.

7 participants