[2.0][Component][DomCrawler] cs

This commit is contained in:
Włodzimierz Gajda 2012-04-23 19:19:47 +02:00
parent 44ba841a67
commit 25fed1355b

View File

@ -523,7 +523,7 @@ class Crawler extends \SplObjectStorage
/**
* Selects links by name or alt value for clickable images.
*
* @param string $value The link text
* @param string $value The link text
*
* @return Crawler A new instance of Crawler with the filtered list of nodes
*
@ -540,7 +540,7 @@ class Crawler extends \SplObjectStorage
/**
* Selects a button by name or alt value for images.
*
* @param string $value The button text
* @param string $value The button text
*
* @return Crawler A new instance of Crawler with the filtered list of nodes
*
@ -558,7 +558,7 @@ class Crawler extends \SplObjectStorage
/**
* Returns a Link object for the first node in the list.
*
* @param string $method The method for the link (get by default)
* @param string $method The method for the link (get by default)
*
* @return Link A Link instance
*
@ -597,8 +597,8 @@ class Crawler extends \SplObjectStorage
/**
* Returns a Form object for the first node in the list.
*
* @param array $values An array of values for the form fields
* @param string $method The method for the form
* @param array $values An array of values for the form fields
* @param string $method The method for the form
*
* @return Form A Form instance
*
@ -621,6 +621,28 @@ class Crawler extends \SplObjectStorage
return $form;
}
/**
* Converts string for XPath expressions.
*
* Escaped characters are: quotes (") and apostrophe (').
*
* Examples:
* <code>
* echo Crawler::xpathLiteral('foo " bar');
* //prints 'foo " bar'
*
* echo Crawler::xpathLiteral("foo ' bar");
* //prints "foo ' bar"
*
* echo Crawler::xpathLiteral('a\'b"c');
* //prints concat('a', "'", 'b"c')
* </code>
*
* @param string $s String to be escaped
*
* @return string Converted string
*
*/
static public function xpathLiteral($s)
{
if (false === strpos($s, "'")) {