8000 merged branch stloyd/crawler_phpdoc (PR #3834) · phreaknerd/symfony@27c41f1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 27c41f1

Browse files
committed
merged branch stloyd/crawler_phpdoc (PR symfony#3834)
Commits ------- 292364a [DomCrawler] Added some docbocks into DomCrawler classes. Closes symfony#3832 Discussion ---------- [DomCrawler] Added some docbocks into DomCrawler classes, reordered func... ...tions to follow Symfony 2 CS. Closes symfony#3832 --------------------------------------------------------------------------- by fabpot at 2012-04-08T10:38:39Z Can you revert the code move as it makes merges between 2.0 and master much more complex. Thanks. --------------------------------------------------------------------------- by stloyd at 2012-04-08T11:36:53Z Reverted and changed commit message. @fabpot Should I make PR for `master` according to CS ? --------------------------------------------------------------------------- by stof at 2012-04-08T11:40:58Z @stloyd this can be considered as a bugfix as you are fixing the phpdoc. So 2.0 is fine
2 parents 38e17c2 + 292364a commit 27c41f1

File tree

5 files changed

+75
-13
lines changed

5 files changed

+75
-13
lines changed

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
*/
2323
class Crawler extends \SplObjectStorage
2424
{
25+
/**
26+
* @var string The current URI or the base href value
27+
*/
2528
private $uri;
2629

2730
/**
@@ -75,8 +78,10 @@ public function add($node)
7578
/**
7679
* Adds HTML/XML content.
7780
*
78-
* @param string $content A string to parse as HTML/XML
79-
* @param string $type The content type of the string
81+
* @param string $content A string to parse as HTML/XML
82+
* @param null|string $type The content type of the string
83+
*
84+
* @return null|void
8085
*/
8186
public function addContent($content, $type = null)
8287
{
@@ -208,7 +213,7 @@ public function addNode(\DOMNode $node)
208213
*
209214
* @param integer $position The position
210215
*
211-
* @return A new instance of the Crawler with the selected node, or an empty Crawler if it does not exist.
216+
* @return Crawler A new instance of the Crawler with the selected node, or an empty Crawler if it does not exist.
212217
*
213218
* @api
214219
*/

src/Symfony/Component/DomCrawler/Field/ChoiceFormField.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,17 @@
2222
*/
2323
class ChoiceFormField extends FormField
2424
{
25+
/**
26+
* @var string
27+
*/
2528
private $type;
29+
/**
30+
* @var Boolean
31+
*/
2632
private $multiple;
33+
/**
34+
* @var array
35+
*/
2736
private $options;
2837

2938
/**
@@ -44,7 +53,7 @@ public function hasValue()
4453
/**
4554
* Check if the current selected option is disabled
4655
*
47-
* @return bool
56+
* @return Boolean
4857
*/
4958
public function isDisabled()
5059
{
@@ -62,8 +71,6 @@ public function isDisabled()
6271
*
6372
* @param string $value The value of the field
6473
*
65-
* @throws \InvalidArgumentException When value type provided is not correct
66-
*
6774
* @api
6875
*/
6976
public function select($value)
@@ -74,7 +81,7 @@ public function select($value)
7481
/**
7582
* Ticks a checkbox.
7683
*
77-
* @throws \InvalidArgumentException When value type provided is not correct
84+
* @throws \LogicException When the type provided is not correct
7885
*
7986
* @api
8087
*/
@@ -90,7 +97,7 @@ public function tick()
9097
/**
9198
* Ticks a checkbox.
9299
*
93-
* @throws \InvalidArgumentException When value type provided is not correct
100+
* @throws \LogicException When the type provided is not correct
94101
*
95102
* @api
96103
*/
@@ -248,7 +255,7 @@ protected function initialize()
248255
/**
249256
* Returns option value with associated disabled flag
250257
*
251-
* @param type $node
258+
* @param \DOMNode $node
252259
*
253260
* @return array
254261
*/

src/Symfony/Component/DomCrawler/Field/FormField.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,29 @@
1818
*/
1919
abstract class FormField
2020
{
21+
/**
22+
* @var \DOMNode
23+
*/
2124
protected $node;
25+
/**
26+
* @var string
27+
*/
2228
protected $name;
29+
/**
30+
* @var string
31+
*/
2332
protected $value;
33+
/**
34+
* @var \DOMDocument
35+
*/
2436
protected $document;
37+
/**
38+
* @var \DOMXPath
39+
*/
2540
protected $xpath;
41+
/**
42+
* @var Boolean
43+
*/
2644
protected $disabled;
2745

2846
/**
@@ -87,6 +105,11 @@ public function hasValue()
87105
return true;
88106
}
89107

108+
/**
109+
* Check if the current field is disabled
110+
*
111+
* @return Boolean
112+
*/
90113
public function isDisabled()
91114
{
92115
return $this->node->hasAttribute('disabled');

src/Symfony/Component/DomCrawler/Form.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@
2222
*/
2323
class Form extends Link implements \ArrayAccess
2424
{
25+
/**
26+
* @var \DOMNode
27+
*/
2528
private $button;
29+
/**
30+
* @var Field\FormField[]
31+
*/
2632
private $fields;
2733

2834
/**
@@ -58,6 +64,8 @@ public function getFormNode()
5864
*
5965
* @param array $values An array of field values
6066
*
67+
* @return Form
68+
*
6169
* @api
6270
*/
6371
public function setValues(array $values)
@@ -254,8 +262,6 @@ public function get($name)
254262
*
255263
* @param Field\FormField $field The field
256264
*
257-
* @return FormField The field instance
258-
*
259265
* @api
260266
*/
261267
public function set(Field\FormField $field)

src/Symfony/Component/DomCrawler/Link.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,17 @@
2020
*/
2121
class Link
2222
{
23+
/**
24+
* @var \DOMNode A \DOMNode instance
25+
*/
2326
protected $node;
27+
/**
28+
* @var string The method to use for the link
29+
*/
2430
protected $method;
31+
/**
32+
* @var string The URI of the page where the link is embedded (or the base href)
33+
*/
2534
protected $currentUri;
2635

2736
/**
@@ -31,7 +40,7 @@ class Link
3140
* @param string $currentUri The URI of the page where the link is embedded (or the base href)
3241
* @param string $method The method to use for the link (get by default)
3342
*
34-
* @throws \LogicException if the node is not a link
43+
* @throws \InvalidArgumentException if the node is not a link
3544
*
3645
* @api
3746
*/
@@ -90,7 +99,7 @@ public function getUri()
9099
}
91100

92101
// only an anchor
93-
if ('#' === $uri[0]) {
102+
if ('#' === $uri[0]) {
94103
$baseUri = $this->currentUri;
95104
if (false !== $pos = strpos($baseUri, '#')) {
96105
$baseUri = substr($baseUri, 0, $pos);
@@ -120,11 +129,23 @@ public function getUri()
120129
return substr($this->currentUri, 0, strrpos($this->currentUri, '/') + 1).$uri;
121130
}
122131

132+
/**
133+
* Returns raw uri data
134+
*
135+
* @return string
136+
*/
123137
protected function getRawUri()
124138
{
125139
return $this->node->getAttribute('href');
126140
}
127141

142+
/**
143+
* Sets current \DOMNode instance
144+
*
145+
* @param \DOMNode $node A \DOMNode instance
146+
*
147+
* @throws \LogicException If given node is not an anchor
148+
*/
128149
protected function setNode(\DOMNode $node)
129150
{
130151
if ('a' != $node->nodeName) {

0 commit comments

Comments
 (0)
0