@@ -89,7 +89,7 @@ An anonymous function can be used to filter with more complex criteria::
89
89
$crawler = $crawler
90
90
->filter('body > p')
91
91
->reduce(function (Crawler $node, $i) {
92
- // filter every other node
92
+ // filters every other node
93
93
return ($i % 2) == 0;
94
94
});
95
95
@@ -185,7 +185,7 @@ Accessing Node Values
185
185
186
186
Access the node name (HTML tag name) of the first node of the current selection (eg. "p" or "div")::
187
187
188
- // will return the node name (HTML tag name) of the first child element under <body>
188
+ // returns the node name (HTML tag name) of the first child element under <body>
189
189
$tag = $crawler->filterXPath('//body/*')->nodeName();
190
190
191
191
Access the value of the first node of the current selection::
@@ -367,7 +367,7 @@ instance with just the selected link(s). Calling ``link()`` gives you a special
367
367
The :class: `Symfony\\ Component\\ DomCrawler\\ Link ` object has several useful
368
368
methods to get more information about the selected link itself::
369
369
370
- // return the proper URI that can be used to make another request
370
+ // returns the proper URI that can be used to make another request
371
371
$uri = $link->getUri();
372
372
373
373
.. note ::
@@ -441,13 +441,13 @@ attribute followed by a query string of all of the form's values.
441
441
442
442
You can virtually set and get values on the form::
443
443
444
- // set values on the form internally
444
+ // sets values on the form internally
445
445
$form->setValues(array(
446
446
'registration[username]' => 'symfonyfan',
447
447
'registration[terms]' => 1,
448
448
));
449
449
450
- // get back an array of values - in the "flat" array like above
450
+ // gets back an array of values - in the "flat" array like above
451
451
$values = $form->getValues();
452
452
453
453
// returns the values like PHP would see them,
@@ -464,10 +464,10 @@ To work with multi-dimensional fields::
464
464
465
465
Pass an array of values::
466
466
467
- // Set a single field
467
+ // sets a single field
468
468
$form->setValues(array('multi' => array('value')));
469
469
470
- // Set multiple fields at once
470
+ // sets multiple fields at once
471
471
$form->setValues(array('multi' => array(
472
472
1 => 'value',
473
473
'dimensional' => 'an other value'
@@ -479,17 +479,17 @@ and uploading files::
479
479
480
480
$form['registration[username]']->setValue('symfonyfan');
481
481
482
- // check or uncheck a checkbox
482
+ // checks or unchecks a checkbox
483
483
$form['registration[terms]']->tick();
484
484
$form['registration[terms]']->untick();
485
485
486
- // select an option
486
+ // selects an option
487
487
$form['registration[birthday][year]']->select(1984);
488
488
489
- // select many options from a "multiple" select
489
+ // selects many options from a "multiple" select
490
490
$form['registration[interests]']->select(array('symfony', 'cookies'));
491
491
492
- // even fake a file upload
492
+ // fakes a file upload
493
493
$form['registration[photo]']->upload('/path/to/lucas.jpg');
494
494
495
495
Using the Form Data
@@ -518,7 +518,7 @@ directly::
518
518
519
519
use Goutte\Client;
520
520
521
- // make a real request to an external site
521
+ // makes a real request to an external site
522
522
$client = new Client();
523
523
$crawler = $client->request('GET', 'https://github.com/login');
524
524
@@ -527,7 +527,7 @@ directly::
527
527
$form['login'] = 'symfonyfan';
528
528
$form['password'] = 'anypass';
529
529
530
- // submit that form
530
+ // submits the given form
531
531
$crawler = $client->submit($form);
532
532
533
533
.. _components-dom-crawler-invalid :
@@ -540,10 +540,10 @@ to prevent you from setting invalid values. If you want to be able to set
540
540
invalid values, you can use the ``disableValidation() `` method on either
541
541
the whole form or specific field(s)::
542
542
543
- // Disable validation for a specific field
543
+ // disables validation for a specific field
544
544
$form['country']->disableValidation()->select('Invalid value');
545
545
546
- // Disable validation for the whole form
546
+ // disables validation for the whole form
547
547
$form->disableValidation();
548
548
$form['country']->select('Invalid value');
549
549
0 commit comments