Skip to content

Commit abf39fd

Browse files
committed
merged branch gajdaw/2_0_component_domcrawler_cs (PR symfony#4091)
Commits ------- 25fed13 [2.0][Component][DomCrawler] cs Discussion ---------- [2.0][Component][DomCrawler] cs Bug fix: no Feature addition: no Backwards compatibility break: no Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/gajdaw/symfony.png?branch=2_0_component_domcrawler_cs)](http://travis-ci.org/gajdaw/symfony) Fixes the following tickets: - Todo: - Code standard fix + some documentation.
2 parents f6f4ba9 + 25fed13 commit abf39fd

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

src/Symfony/Component/DomCrawler/Crawler.php

+27-5
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ public function filter($selector)
523523
/**
524524
* Selects links by name or alt value for clickable images.
525525
*
526-
* @param string $value The link text
526+
* @param string $value The link text
527527
*
528528
* @return Crawler A new instance of Crawler with the filtered list of nodes
529529
*
@@ -540,7 +540,7 @@ public function selectLink($value)
540540
/**
541541
* Selects a button by name or alt value for images.
542542
*
543-
* @param string $value The button text
543+
* @param string $value The button text
544544
*
545545
* @return Crawler A new instance of Crawler with the filtered list of nodes
546546
*
@@ -558,7 +558,7 @@ public function selectButton($value)
558558
/**
559559
* Returns a Link object for the first node in the list.
560560
*
561-
* @param string $method The method for the link (get by default)
561+
* @param string $method The method for the link (get by default)
562562
*
563563
* @return Link A Link instance
564564
*
@@ -597,8 +597,8 @@ public function links()
597597
/**
598598
* Returns a Form object for the first node in the list.
599599
*
600-
* @param array $values An array of values for the form fields
601-
* @param string $method The method for the form
600+
* @param array $values An array of values for the form fields
601+
* @param string $method The method for the form
602602
*
603603
* @return Form A Form instance
604604
*
@@ -621,6 +621,28 @@ public function form(array $values = null, $method = null)
621621
return $form;
622622
}
623623

624+
/**
625+
* Converts string for XPath expressions.
626+
*
627+
* Escaped characters are: quotes (") and apostrophe (').
628+
*
629+
* Examples:
630+
* <code>
631+
* echo Crawler::xpathLiteral('foo " bar');
632+
* //prints 'foo " bar'
633+
*
634+
* echo Crawler::xpathLiteral("foo ' bar");
635+
* //prints "foo ' bar"
636+
*
637+
* echo Crawler::xpathLiteral('a\'b"c');
638+
* //prints concat('a', "'", 'b"c')
639+
* </code>
640+
*
641+
* @param string $s String to be escaped
642+
*
643+
* @return string Converted string
644+
*
645+
*/
624646
static public function xpathLiteral($s)
625647
{
626648
if (false === strpos($s, "'")) {

0 commit comments

Comments
 (0)