File tree 2 files changed +19
-3
lines changed
2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ public function removeMeta($name)
153
153
*/
154
154
public function getMeta ($ name )
155
155
{
156
- $ node = $ this ->filterXPath ('descendant-or-self::meta[@name = \'' . $ name . '\'] ' )->getFirstNode ( );
156
+ $ node = $ this ->filterXPath ('descendant-or-self::meta[@name = \'' . $ name . '\'] ' )->getNode ( 0 );
157
157
if ($ node instanceof \DOMElement) {
158
158
return $ node ->getAttribute ('content ' );
159
159
} else {
@@ -168,7 +168,7 @@ public function getMeta($name)
168
168
*/
169
169
public function setBaseHref ($ url )
170
170
{
171
- $ node = $ this ->filterXPath ('descendant-or-self::base ' )->getFirstNode ( );
171
+ $ node = $ this ->filterXPath ('descendant-or-self::base ' )->getNode ( 0 );
172
172
if ($ node == null ) {
173
173
$ node = $ this ->dom ->createElement ('base ' );
174
174
$ this ->getHeadNode ()->appendChild ($ node );
@@ -183,7 +183,7 @@ public function setBaseHref($url)
183
183
*/
184
184
public function getBaseHref ()
185
185
{
186
- $ node = $ this ->filterXPath ('descendant-or-self::base ' )->getFirstNode ( );
186
+ $ node = $ this ->filterXPath ('descendant-or-self::base ' )->getNode ( 0 );
187
187
if ($ node instanceof \DOMElement) {
188
188
return $ node ->getAttribute ('href ' );
189
189
} else {
Original file line number Diff line number Diff line change @@ -590,6 +590,7 @@ public function replaceWith($content)
590
590
*
591
591
* @param null|string $text
592
592
* @return string|HtmlPageCrawler
593
+ * @api
593
594
*/
594
595
public function text ($ text = null )
595
596
{
@@ -897,13 +898,28 @@ public function getFirstNode()
897
898
return $ this ->getNode (0 );
898
899
}
899
900
901
+ /**
902
+ * @param int $position
903
+ *
904
+ * overridden from Crawler because it is not public in Symfony 2.3
905
+ * TODO: throw away as soon as we don't need to support SF 2.3 any more
906
+ *
907
+ * @return \DOMElement|null
908
+ */
909
+ public function getNode ($ position )
910
+ {
911
+ return parent ::getNode ($ position );
912
+ }
913
+
900
914
/**
901
915
* Returns the node name of the first node of the list.
902
916
*
903
917
* in Crawler (parent), this function will be available starting with 2.6.0,
904
918
* therefore this method be removed from here as soon as we don't need to keep compatibility
905
919
* with Symfony < 2.6
906
920
*
921
+ * TODO: throw away as soon as we don't need to support SF 2.3 any more
922
+ *
907
923
* @return string The node name
908
924
*
909
925
* @throws \InvalidArgumentException When current node is empty
You can’t perform that action at this time.
0 commit comments