Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 06e2c01

Browse filesBrowse files
merkfabpot
authored andcommitted
[CssSelector] PHPDoc additions
1 parent 76e9b6e commit 06e2c01
Copy full SHA for 06e2c01

File tree

Expand file treeCollapse file tree

9 files changed

+236
-2
lines changed
Filter options
Expand file treeCollapse file tree

9 files changed

+236
-2
lines changed

‎src/Symfony/Component/CssSelector/Node/AttribNode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/CssSelector/Node/AttribNode.php
+23-1Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ class AttribNode implements NodeInterface
3030
protected $operator;
3131
protected $value;
3232

33+
/**
34+
* Constructor.
35+
*
36+
* @param NodeInterface $selector The XPath selector
37+
* @param string $namespace The namespace
38+
* @param string $attrib The attribute
39+
* @param string $operator The operator
40+
* @param string $value The value
41+
*/
3342
public function __construct($selector, $namespace, $attrib, $operator, $value)
3443
{
3544
$this->selector = $selector;
@@ -39,6 +48,9 @@ public function __construct($selector, $namespace, $attrib, $operator, $value)
3948
$this->value = $value;
4049
}
4150

51+
/**
52+
* {@inheritDoc}
53+
*/
4254
public function __toString()
4355
{
4456
if ($this->operator == 'exists') {
@@ -49,7 +61,7 @@ public function __toString()
4961
}
5062

5163
/**
52-
* @throws SyntaxError When unknown operator is found
64+
* {@inheritDoc}
5365
*/
5466
public function toXpath()
5567
{
@@ -88,6 +100,11 @@ public function toXpath()
88100
return $path;
89101
}
90102

103+
/**
104+
* Returns the XPath Attribute
105+
*
106+
* @return string The XPath attribute
107+
*/
91108
protected function xpathAttrib()
92109
{
93110
// FIXME: if attrib is *?
@@ -98,6 +115,11 @@ protected function xpathAttrib()
98115
return sprintf('@%s:%s', $this->namespace, $this->attrib);
99116
}
100117

118+
/**
119+
* Returns a formatted attribute
120+
*
121+
* @return string The formatted attributep
122+
*/
101123
protected function formatAttrib()
102124
{
103125
if ($this->namespace == '*') {

‎src/Symfony/Component/CssSelector/Node/ClassNode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/CssSelector/Node/ClassNode.php
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,29 @@ class ClassNode implements NodeInterface
2626
protected $selector;
2727
protected $className;
2828

29+
/**
30+
* The constructor.
31+
*
32+
* @param NodeInterface $selector The XPath Selector
33+
* @param string $className The class name
34+
*/
2935
public function __construct($selector, $className)
3036
{
3137
$this->selector = $selector;
3238
$this->className = $className;
3339
}
3440

41+
/**
42+
* {@inheritDoc}
43+
*/
3544
public function __toString()
3645
{
3746
return sprintf('%s[%s.%s]', __CLASS__, $this->selector, $this->className);
3847
}
3948

49+
/**
50+
* {@inheritDoc}
51+
*/
4052
public function toXpath()
4153
{
4254
$selXpath = $this->selector->toXpath();

‎src/Symfony/Component/CssSelector/Node/CombinedSelectorNode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/CssSelector/Node/CombinedSelectorNode.php
+35Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,23 @@ class CombinedSelectorNode implements NodeInterface
3434
protected $combinator;
3535
protected $subselector;
3636

37+
/**
38+
* The constructor.
39+
*
40+
* @param NodeInterface $selector The XPath selector
41+
* @param string $combinator The combinator
42+
* @param NodeInterface $subselector The sub XPath selector
43+
*/
3744
public function __construct($selector, $combinator, $subselector)
3845
{
3946
$this->selector = $selector;
4047
$this->combinator = $combinator;
4148
$this->subselector = $subselector;
4249
}
4350

51+
/**
52+
* {@inheritDoc}
53+
*/
4454
public function __toString()
4555
{
4656
$comb = $this->combinator == ' ' ? '<followed>' : $this->combinator;
@@ -49,6 +59,7 @@ public function __toString()
4959
}
5060

5161
/**
62+
* {@inheritDoc}
5263
* @throws SyntaxError When unknown combinator is found
5364
*/
5465
public function toXpath()
@@ -63,6 +74,12 @@ public function toXpath()
6374
return $this->$method($path, $this->subselector);
6475
}
6576

77+
/**
78+
* Joins a NodeInterface into the XPath of this object.
79+
*
80+
* @param XPathExpr $xpath The XPath expression for this object
81+
* @param NodeInterface $sub The NodeInterface object to add
82+
*/
6683
protected function _xpath_descendant($xpath, $sub)
6784
{
6885
// when sub is a descendant in any way of xpath
@@ -71,6 +88,12 @@ protected function _xpath_descendant($xpath, $sub)
7188
return $xpath;
7289
}
7390

91+
/**
92+
* Joins a NodeInterface as a child of this object.
93+
*
94+
* @param XPathExpr $xpath The parent XPath expression
95+
* @param NodeInterface $sub The NodeInterface object to add
96+
*/
7497
protected function _xpath_child($xpath, $sub)
7598
{
7699
// when sub is an immediate child of xpath
@@ -79,6 +102,12 @@ protected function _xpath_child($xpath, $sub)
79102
return $xpath;
80103
}
81104

105+
/**
106+
* Joins an XPath expression as an adjacent of another.
107+
*
108+
* @param XPathExpr $xpath The parent XPath expression
109+
* @param NodeInterface $sub The adjacent XPath expression
110+
*/
82111
protected function _xpath_direct_adjacent($xpath, $sub)
83112
{
84113
// when sub immediately follows xpath
@@ -89,6 +118,12 @@ protected function _xpath_direct_adjacent($xpath, $sub)
89118
return $xpath;
90119
}
91120

121+
/**
122+
* Joins an XPath expression as an indirect adjacent of another.
123+
*
124+
* @param XPathExpr $xpath The parent XPath expression
125+
* @param NodeInterface $sub The indirect adjacent NodeInterface object
126+
*/
92127
protected function _xpath_indirect_adjacent($xpath, $sub)
93128
{
94129
// when sub comes somewhere after xpath as a sibling

‎src/Symfony/Component/CssSelector/Node/ElementNode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/CssSelector/Node/ElementNode.php
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,31 @@ class ElementNode implements NodeInterface
2626
protected $namespace;
2727
protected $element;
2828

29+
/**
30+
* Constructor.
31+
*
32+
* @param string $namespace Namespace
33+
* @param string $element Element
34+
*/
2935
public function __construct($namespace, $element)
3036
{
3137
$this->namespace = $namespace;
3238
$this->element = $element;
3339
}
3440

41+
/**
42+
* {@inheritDoc}
43+
*/
3544
public function __toString()
3645
{
3746
return sprintf('%s[%s]', __CLASS__, $this->formatElement());
3847
}
3948

49+
/**
50+
* Formats the element into a string.
51+
*
52+
* @return string Element as an XPath string
53+
*/
4054
public function formatElement()
4155
{
4256
if ($this->namespace == '*') {
@@ -46,6 +60,9 @@ public function formatElement()
4660
return sprintf('%s|%s', $this->namespace, $this->element);
4761
}
4862

63+
/**
64+
* {@inheritDoc}
65+
*/
4966
public function toXpath()
5067
{
5168
if ($this->namespace == '*') {

‎src/Symfony/Component/CssSelector/Node/FunctionNode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/CssSelector/Node/FunctionNode.php
+62-1Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ class FunctionNode implements NodeInterface
3131
protected $name;
3232
protected $expr;
3333

34+
/**
35+
* Constructor.
36+
*
37+
* @param NodeInterface $selector The XPath expression
38+
* @param string $type
39+
* @param string $name
40+
* @param XPathExpr $expr
41+
*/
3442
public function __construct($selector, $type, $name, $expr)
3543
{
3644
$this->selector = $selector;
@@ -39,12 +47,16 @@ public function __construct($selector, $type, $name, $expr)
3947
$this->expr = $expr;
4048
}
4149

50+
/**
51+
* {@inheritDoc}
52+
*/
4253
public function __toString()
4354
{
4455
return sprintf('%s[%s%s%s(%s)]', __CLASS__, $this->selector, $this->type, $this->name, $this->expr);
4556
}
4657

4758
/**
59+
* {@inheritDoc}
4860
* @throws SyntaxError When unsupported or unknown pseudo-class is found
4961
*/
5062
public function toXpath()
@@ -61,6 +73,15 @@ public function toXpath()
6173
return $this->$method($sel_path, $this->expr);
6274
}
6375

76+
/**
77+
* undocumented function
78+
*
79+
* @param XPathExpr $xpath
80+
* @param mixed $expr
81+
* @param string $last
82+
* @param string $addNameTest
83+
* @return XPathExpr
84+
*/
6485
protected function _xpath_nth_child($xpath, $expr, $last = false, $addNameTest = true)
6586
{
6687
list($a, $b) = $this->parseSeries($expr);
@@ -124,11 +145,25 @@ protected function _xpath_nth_child($xpath, $expr, $last = false, $addNameTest =
124145
-1n+6 means elements 6 and previous */
125146
}
126147

148+
/**
149+
* undocumented function
150+
*
151+
* @param XPathExpr $xpath
152+
* @param XPathExpr $expr
153+
* @return XPathExpr
154+
*/
127155
protected function _xpath_nth_last_child($xpath, $expr)
128156
{
129157
return $this->_xpath_nth_child($xpath, $expr, true);
130158
}
131159

160+
/**
161+
* undocumented function
162+
*
163+
* @param XPathExpr $xpath
164+
* @param XPathExpr $expr
165+
* @return XPathExpr
166+
*/
132167
protected function _xpath_nth_of_type($xpath, $expr)
133168
{
134169
if ($xpath->getElement() == '*') {
@@ -138,11 +173,25 @@ protected function _xpath_nth_of_type($xpath, $expr)
138173
return $this->_xpath_nth_child($xpath, $expr, false, false);
139174
}
140175

176+
/**
177+
* undocumented function
178+
*
179+
* @param XPathExpr $xpath
180+
* @param XPathExpr $expr
181+
* @return XPathExpr
182+
*/
141183
protected function _xpath_nth_last_of_type($xpath, $expr)
142184
{
143185
return $this->_xpath_nth_child($xpath, $expr, true, false);
144186
}
145187

188+
/**
189+
* undocumented function
190+
*
191+
* @param XPathExpr $xpath
192+
* @param XPathExpr $expr
193+
* @return XPathExpr
194+
*/
146195
protected function _xpath_contains($xpath, $expr)
147196
{
148197
// text content, minus tags, must contain expr
@@ -159,6 +208,13 @@ protected function _xpath_contains($xpath, $expr)
159208
return $xpath;
160209
}
161210

211+
/**
212+
* undocumented function
213+
*
214+
* @param XPathExpr $xpath
215+
* @param XPathExpr $expr
216+
* @return XPathExpr
217+
*/
162218
protected function _xpath_not($xpath, $expr)
163219
{
164220
// everything for which not expr applies
@@ -170,7 +226,12 @@ protected function _xpath_not($xpath, $expr)
170226
return $xpath;
171227
}
172228

173-
// Parses things like '1n+2', or 'an+b' generally, returning (a, b)
229+
/**
230+
* Parses things like '1n+2', or 'an+b' generally, returning (a, b)
231+
*
232+
* @param mixed $s
233+
* @return array
234+
*/
174235
protected function parseSeries($s)
175236
{
176237
if ($s instanceof ElementNode) {

‎src/Symfony/Component/CssSelector/Node/HashNode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/CssSelector/Node/HashNode.php
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,29 @@ class HashNode implements NodeInterface
2626
protected $selector;
2727
protected $id;
2828

29+
/**
30+
* Constructor.
31+
*
32+
* @param NodeInterface $selector The NodeInterface object
33+
* @param string $id The ID
34+
*/
2935
public function __construct($selector, $id)
3036
{
3137
$this->selector = $selector;
3238
$this->id = $id;
3339
}
3440

41+
/**
42+
* {@inheritDoc}
43+
*/
3544
public function __toString()
3645
{
3746
return sprintf('%s[%s#%s]', __CLASS__, $this->selector, $this->id);
3847
}
3948

49+
/**
50+
* {@inheritDoc}
51+
*/
4052
public function toXpath()
4153
{
4254
$path = $this->selector->toXpath();

‎src/Symfony/Component/CssSelector/Node/NodeInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/CssSelector/Node/NodeInterface.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,17 @@
2121
*/
2222
interface NodeInterface
2323
{
24+
/**
25+
* Returns a string representation of the object.
26+
*
27+
* @return string The string representation
28+
*/
2429
function __toString();
2530

31+
/**
32+
* @return XPathExpr The XPath expression
33+
*
34+
* @throws SyntaxError When unknown operator is found
35+
*/
2636
function toXpath();
2737
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.