Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation.

This commit is contained in:
Pantheon Automation 2015-11-17 13:42:33 -08:00 committed by Greg Anderson
parent 4afb23bbd3
commit 7784f4c23d
929 changed files with 19798 additions and 5304 deletions

View file

@ -17,8 +17,6 @@ use Symfony\Component\CssSelector\CssSelector;
* Crawler eases navigation of a list of \DOMElement objects.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class Crawler extends \SplObjectStorage
{
@ -48,8 +46,6 @@ class Crawler extends \SplObjectStorage
* @param mixed $node A Node to use as the base for the crawling
* @param string $currentUri The current URI
* @param string $baseHref The base href value
*
* @api
*/
public function __construct($node = null, $currentUri = null, $baseHref = null)
{
@ -61,8 +57,6 @@ class Crawler extends \SplObjectStorage
/**
* Removes all the nodes.
*
* @api
*/
public function clear()
{
@ -78,8 +72,6 @@ class Crawler extends \SplObjectStorage
* @param \DOMNodeList|\DOMNode|array|string|null $node A node
*
* @throws \InvalidArgumentException When node is not the expected type.
*
* @api
*/
public function add($node)
{
@ -155,8 +147,6 @@ class Crawler extends \SplObjectStorage
*
* @param string $content The HTML content
* @param string $charset The charset
*
* @api
*/
public function addHtmlContent($content, $charset = 'UTF-8')
{
@ -239,8 +229,6 @@ class Crawler extends \SplObjectStorage
*
* @param string $content The XML content
* @param string $charset The charset
*
* @api
*/
public function addXmlContent($content, $charset = 'UTF-8')
{
@ -269,8 +257,6 @@ class Crawler extends \SplObjectStorage
* Adds a \DOMDocument to the list of nodes.
*
* @param \DOMDocument $dom A \DOMDocument instance
*
* @api
*/
public function addDocument(\DOMDocument $dom)
{
@ -283,8 +269,6 @@ class Crawler extends \SplObjectStorage
* Adds a \DOMNodeList to the list of nodes.
*
* @param \DOMNodeList $nodes A \DOMNodeList instance
*
* @api
*/
public function addNodeList(\DOMNodeList $nodes)
{
@ -299,8 +283,6 @@ class Crawler extends \SplObjectStorage
* Adds an array of \DOMNode instances to the list of nodes.
*
* @param \DOMNode[] $nodes An array of \DOMNode instances
*
* @api
*/
public function addNodes(array $nodes)
{
@ -313,8 +295,6 @@ class Crawler extends \SplObjectStorage
* Adds a \DOMNode instance to the list of nodes.
*
* @param \DOMNode $node A \DOMNode instance
*
* @api
*/
public function addNode(\DOMNode $node)
{
@ -325,24 +305,33 @@ class Crawler extends \SplObjectStorage
}
}
// Serializing and unserializing a crawler creates DOM objects in a corrupted state. DOM elements are not properly serializable.
public function unserialize($serialized)
{
throw new \BadMethodCallException('A Crawler cannot be serialized.');
}
public function serialize()
{
throw new \BadMethodCallException('A Crawler cannot be serialized.');
}
/**
* Returns a node given its position in the node list.
*
* @param int $position The position
*
* @return Crawler A new instance of the Crawler with the selected node, or an empty Crawler if it does not exist.
*
* @api
*/
public function eq($position)
{
foreach ($this as $i => $node) {
if ($i == $position) {
return new static($node, $this->uri, $this->baseHref);
return $this->createSubCrawler($node);
}
}
return new static(null, $this->uri, $this->baseHref);
return $this->createSubCrawler(null);
}
/**
@ -360,14 +349,12 @@ class Crawler extends \SplObjectStorage
* @param \Closure $closure An anonymous function
*
* @return array An array of values returned by the anonymous function
*
* @api
*/
public function each(\Closure $closure)
{
$data = array();
foreach ($this as $i => $node) {
$data[] = $closure(new static($node, $this->uri, $this->baseHref), $i);
$data[] = $closure($this->createSubCrawler($node), $i);
}
return $data;
@ -383,7 +370,7 @@ class Crawler extends \SplObjectStorage
*/
public function slice($offset = 0, $length = -1)
{
return new static(iterator_to_array(new \LimitIterator($this, $offset, $length)), $this->uri);
return $this->createSubCrawler(iterator_to_array(new \LimitIterator($this, $offset, $length)));
}
/**
@ -394,27 +381,23 @@ class Crawler extends \SplObjectStorage
* @param \Closure $closure An anonymous function
*
* @return Crawler A Crawler instance with the selected nodes.
*
* @api
*/
public function reduce(\Closure $closure)
{
$nodes = array();
foreach ($this as $i => $node) {
if (false !== $closure(new static($node, $this->uri, $this->baseHref), $i)) {
if (false !== $closure($this->createSubCrawler($node), $i)) {
$nodes[] = $node;
}
}
return new static($nodes, $this->uri, $this->baseHref);
return $this->createSubCrawler($nodes);
}
/**
* Returns the first node of the current selection.
*
* @return Crawler A Crawler instance with the first selected node
*
* @api
*/
public function first()
{
@ -425,8 +408,6 @@ class Crawler extends \SplObjectStorage
* Returns the last node of the current selection.
*
* @return Crawler A Crawler instance with the last selected node
*
* @api
*/
public function last()
{
@ -439,8 +420,6 @@ class Crawler extends \SplObjectStorage
* @return Crawler A Crawler instance with the sibling nodes
*
* @throws \InvalidArgumentException When current node is empty
*
* @api
*/
public function siblings()
{
@ -448,7 +427,7 @@ class Crawler extends \SplObjectStorage
throw new \InvalidArgumentException('The current node list is empty.');
}
return new static($this->sibling($this->getNode(0)->parentNode->firstChild), $this->uri, $this->baseHref);
return $this->createSubCrawler($this->sibling($this->getNode(0)->parentNode->firstChild));
}
/**
@ -457,8 +436,6 @@ class Crawler extends \SplObjectStorage
* @return Crawler A Crawler instance with the next sibling nodes
*
* @throws \InvalidArgumentException When current node is empty
*
* @api
*/
public function nextAll()
{
@ -466,7 +443,7 @@ class Crawler extends \SplObjectStorage
throw new \InvalidArgumentException('The current node list is empty.');
}
return new static($this->sibling($this->getNode(0)), $this->uri, $this->baseHref);
return $this->createSubCrawler($this->sibling($this->getNode(0)));
}
/**
@ -475,8 +452,6 @@ class Crawler extends \SplObjectStorage
* @return Crawler A Crawler instance with the previous sibling nodes
*
* @throws \InvalidArgumentException
*
* @api
*/
public function previousAll()
{
@ -484,7 +459,7 @@ class Crawler extends \SplObjectStorage
throw new \InvalidArgumentException('The current node list is empty.');
}
return new static($this->sibling($this->getNode(0), 'previousSibling'), $this->uri, $this->baseHref);
return $this->createSubCrawler($this->sibling($this->getNode(0), 'previousSibling'));
}
/**
@ -493,8 +468,6 @@ class Crawler extends \SplObjectStorage
* @return Crawler A Crawler instance with the parents nodes of the current selection
*
* @throws \InvalidArgumentException When current node is empty
*
* @api
*/
public function parents()
{
@ -511,7 +484,7 @@ class Crawler extends \SplObjectStorage
}
}
return new static($nodes, $this->uri, $this->baseHref);
return $this->createSubCrawler($nodes);
}
/**
@ -520,8 +493,6 @@ class Crawler extends \SplObjectStorage
* @return Crawler A Crawler instance with the children nodes
*
* @throws \InvalidArgumentException When current node is empty
*
* @api
*/
public function children()
{
@ -531,7 +502,7 @@ class Crawler extends \SplObjectStorage
$node = $this->getNode(0)->firstChild;
return new static($node ? $this->sibling($node) : array(), $this->uri, $this->baseHref);
return $this->createSubCrawler($node ? $this->sibling($node) : array());
}
/**
@ -542,8 +513,6 @@ class Crawler extends \SplObjectStorage
* @return string|null The attribute value or null if the attribute does not exist
*
* @throws \InvalidArgumentException When current node is empty
*
* @api
*/
public function attr($attribute)
{
@ -578,8 +547,6 @@ class Crawler extends \SplObjectStorage
* @return string The node value
*
* @throws \InvalidArgumentException When current node is empty
*
* @api
*/
public function text()
{
@ -623,8 +590,6 @@ class Crawler extends \SplObjectStorage
* @param array $attributes An array of attributes
*
* @return array An array of extracted values
*
* @api
*/
public function extract($attributes)
{
@ -659,8 +624,6 @@ class Crawler extends \SplObjectStorage
* @param string $xpath An XPath expression
*
* @return Crawler A new instance of Crawler with the filtered list of nodes
*
* @api
*/
public function filterXPath($xpath)
{
@ -668,7 +631,7 @@ class Crawler extends \SplObjectStorage
// If we dropped all expressions in the XPath while preparing it, there would be no match
if ('' === $xpath) {
return new static(null, $this->uri, $this->baseHref);
return $this->createSubCrawler(null);
}
return $this->filterRelativeXPath($xpath);
@ -684,8 +647,6 @@ class Crawler extends \SplObjectStorage
* @return Crawler A new instance of Crawler with the filtered list of nodes
*
* @throws \RuntimeException if the CssSelector Component is not available
*
* @api
*/
public function filter($selector)
{
@ -703,8 +664,6 @@ class Crawler extends \SplObjectStorage
* @param string $value The link text
*
* @return Crawler A new instance of Crawler with the filtered list of nodes
*
* @api
*/
public function selectLink($value)
{
@ -720,8 +679,6 @@ class Crawler extends \SplObjectStorage
* @param string $value The button text
*
* @return Crawler A new instance of Crawler with the filtered list of nodes
*
* @api
*/
public function selectButton($value)
{
@ -741,8 +698,6 @@ class Crawler extends \SplObjectStorage
* @return Link A Link instance
*
* @throws \InvalidArgumentException If the current node list is empty
*
* @api
*/
public function link($method = 'get')
{
@ -759,8 +714,6 @@ class Crawler extends \SplObjectStorage
* Returns an array of Link objects for the nodes in the list.
*
* @return Link[] An array of Link instances
*
* @api
*/
public function links()
{
@ -781,8 +734,6 @@ class Crawler extends \SplObjectStorage
* @return Form A Form instance
*
* @throws \InvalidArgumentException If the current node list is empty
*
* @api
*/
public function form(array $values = null, $method = null)
{
@ -878,7 +829,7 @@ class Crawler extends \SplObjectStorage
{
$prefixes = $this->findNamespacePrefixes($xpath);
$crawler = new static(null, $this->uri, $this->baseHref);
$crawler = $this->createSubCrawler(null);
foreach ($this as $node) {
$domxpath = $this->createDOMXPath($node->ownerDocument, $prefixes);
@ -1048,4 +999,18 @@ class Crawler extends \SplObjectStorage
return array();
}
/**
* Creates a crawler for some subnodes.
*
* @param \DOMElement|\DOMElement[]|\DOMNodeList|null $nodes
*
* @return static
*/
private function createSubCrawler($nodes)
{
$crawler = new static($nodes, $this->uri, $this->baseHref);
return $crawler;
}
}

View file

@ -17,8 +17,6 @@ namespace Symfony\Component\DomCrawler\Field;
* It is constructed from a HTML select tag, or a HTML checkbox, or radio inputs.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class ChoiceFormField extends FormField
{
@ -74,8 +72,6 @@ class ChoiceFormField extends FormField
* Sets the value of the field.
*
* @param string $value The value of the field
*
* @api
*/
public function select($value)
{
@ -86,8 +82,6 @@ class ChoiceFormField extends FormField
* Ticks a checkbox.
*
* @throws \LogicException When the type provided is not correct
*
* @api
*/
public function tick()
{
@ -102,8 +96,6 @@ class ChoiceFormField extends FormField
* Ticks a checkbox.
*
* @throws \LogicException When the type provided is not correct
*
* @api
*/
public function untick()
{

View file

@ -15,8 +15,6 @@ namespace Symfony\Component\DomCrawler\Field;
* FileFormField represents a file form field (an HTML file input tag).
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class FileFormField extends FormField
{
@ -41,8 +39,6 @@ class FileFormField extends FormField
* Sets the value of the field.
*
* @param string $value The value of the field
*
* @api
*/
public function upload($value)
{

View file

@ -81,8 +81,6 @@ abstract class FormField
* Sets the value of the field.
*
* @param string $value The value of the field
*
* @api
*/
public function setValue($value)
{

View file

@ -18,8 +18,6 @@ namespace Symfony\Component\DomCrawler\Field;
* specialized classes (cf. FileFormField and ChoiceFormField).
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class InputFormField extends FormField
{

View file

@ -15,8 +15,6 @@ namespace Symfony\Component\DomCrawler\Field;
* TextareaFormField represents a textarea form field (an HTML textarea tag).
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class TextareaFormField extends FormField
{

View file

@ -18,8 +18,6 @@ use Symfony\Component\DomCrawler\Field\FormField;
* Form represents an HTML form.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class Form extends Link implements \ArrayAccess
{
@ -47,8 +45,6 @@ class Form extends Link implements \ArrayAccess
* @param string $baseHref The URI of the <base> used for relative links, but not for empty action
*
* @throws \LogicException if the node is not a button inside a form tag
*
* @api
*/
public function __construct(\DOMElement $node, $currentUri, $method = null, $baseHref = null)
{
@ -74,8 +70,6 @@ class Form extends Link implements \ArrayAccess
* @param array $values An array of field values
*
* @return Form
*
* @api
*/
public function setValues(array $values)
{
@ -92,8 +86,6 @@ class Form extends Link implements \ArrayAccess
* The returned array does not include file fields (@see getFiles).
*
* @return array An array of field values.
*
* @api
*/
public function getValues()
{
@ -115,8 +107,6 @@ class Form extends Link implements \ArrayAccess
* Gets the file field values.
*
* @return array An array of file field values.
*
* @api
*/
public function getFiles()
{
@ -146,8 +136,6 @@ class Form extends Link implements \ArrayAccess
* (like foo[bar] to arrays) like PHP does.
*
* @return array An array of field values.
*
* @api
*/
public function getPhpValues()
{
@ -171,8 +159,6 @@ class Form extends Link implements \ArrayAccess
* (like foo[bar] to arrays) like PHP does.
*
* @return array An array of field values.
*
* @api
*/
public function getPhpFiles()
{
@ -197,8 +183,6 @@ class Form extends Link implements \ArrayAccess
* browser behavior.
*
* @return string The URI
*
* @api
*/
public function getUri()
{
@ -232,8 +216,6 @@ class Form extends Link implements \ArrayAccess
* If no method is defined in the form, GET is returned.
*
* @return string The method
*
* @api
*/
public function getMethod()
{
@ -250,8 +232,6 @@ class Form extends Link implements \ArrayAccess
* @param string $name The field name
*
* @return bool true if the field exists, false otherwise
*
* @api
*/
public function has($name)
{
@ -264,8 +244,6 @@ class Form extends Link implements \ArrayAccess
* @param string $name The field name
*
* @throws \InvalidArgumentException when the name is malformed
*
* @api
*/
public function remove($name)
{
@ -280,8 +258,6 @@ class Form extends Link implements \ArrayAccess
* @return FormField The field instance
*
* @throws \InvalidArgumentException When field is not present in this form
*
* @api
*/
public function get($name)
{
@ -292,8 +268,6 @@ class Form extends Link implements \ArrayAccess
* Sets a named field.
*
* @param FormField $field The field
*
* @api
*/
public function set(FormField $field)
{
@ -304,8 +278,6 @@ class Form extends Link implements \ArrayAccess
* Gets all fields.
*
* @return FormField[] An array of fields
*
* @api
*/
public function all()
{

View file

@ -15,8 +15,6 @@ namespace Symfony\Component\DomCrawler;
* Link represents an HTML link (an HTML a, area or link tag).
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class Link
{
@ -43,8 +41,6 @@ class Link
* @param string $method The method to use for the link (get by default)
*
* @throws \InvalidArgumentException if the node is not a link
*
* @api
*/
public function __construct(\DOMElement $node, $currentUri, $method = 'GET')
{
@ -71,8 +67,6 @@ class Link
* Gets the method associated with this link.
*
* @return string The method
*
* @api
*/
public function getMethod()
{
@ -83,8 +77,6 @@ class Link
* Gets the URI associated with this link.
*
* @return string The URI
*
* @api
*/
public function getUri()
{

View file

@ -19,7 +19,6 @@
"php": ">=5.3.9"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7",
"symfony/css-selector": "~2.3"
},
"suggest": {