@@ -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
48D1
$tag = $crawler->filterXPath('//body/*')->nodeName();
190
190
191
191
Access the value of the first node of the current selection::
@@ -358,7 +358,7 @@ instance with just the selected link(s). Calling ``link()`` gives you a special
358
358
The :class: `Symfony\\ Component\\ DomCrawler\\ Link ` object has several useful
359
359
methods to get more information about the selected link itself::
360
360
361
- // return the proper URI that can be used to make another request
361
+ // returns the proper URI that can be used to make another request
362
362
$uri = $link->getUri();
363
363
364
364
.. note ::
@@ -433,13 +433,13 @@ attribute followed by a query string of all of the form's values.
433
433
434
434
You can virtually set and get values on the form::
435
435
436
- // set values on the form internally
436
+ // sets values on the form internally
437
437
$form->setValues(array(
438
438
'registration[username]' => 'symfonyfan',
439
439
'registration[terms]' => 1,
440
440
));
441
441
442
- // get back an array of values - in the "flat" array like above
442
+ // gets back an array of values - in the "flat" array like above
443
443
$values = $form->getValues();
444
444
445
445
// returns the values like PHP would see them,
@@ -456,10 +456,10 @@ To work with multi-dimensional fields::
456
456
457
457
Pass an array of values::
458
458
459
- // Set a single field
459
+ // sets a single field
460
460
$form->setValues(array('multi' => array('value')));
461
461
462
- // Set multiple fields at once
462
+ // sets multiple fields at once
463
463
$form->setValues(array('multi' => array(
464
464
1 => 'value',
465
465
'dimensional' => 'an other value'
@@ -471,17 +471,17 @@ and uploading files::
471
471
472
472
$form['registration[username]']->setValue('symfonyfan');
473
473
474
- // check or uncheck a checkbox
474
+ // checks or unchecks a checkbox
475
475
$form['registration[terms]']->tick();
476
476
$form['registration[terms]']->untick();
477
477
478
- // select an option
478
+ // selects an option
479
479
$form['registration[birthday][year]']->select(1984);
480
480
481
- // select many options from a "multiple" select
481
+ // selects many options from a "multiple" select
482
482
$form['registration[interests]']->select(array('symfony', 'cookies'));
483
483
484
- // even fake a file upload
484
+ // fakes a file upload
485
485
$form['registration[photo]']->upload('/path/to/lucas.jpg');
486
486
487
487
Using the Form Data
@@ -510,7 +510,7 @@ directly::
510
510
511
511
use Goutte\Client;
512
512
513
- // make a real request to an external site
513
+ // makes a real request to an external site
514
514
$client = new Client();
515
515
$crawler = $client->request('GET', 'https://github.com/login');
516
516
@@ -519,7 +519,7 @@ directly::
519
519
$form['login'] = 'symfonyfan';
520
520
$form['password'] = 'anypass';
521
521
522
- // submit that form
522
+ // submits the given form
523
523
$crawler = $client->submit($form);
524
524
525
525
.. _components-dom-crawler-invalid :
@@ -532,10 +532,10 @@ to prevent you from setting invalid values. If you want to be able to set
532
532
invalid values, you can use the ``disableValidation() `` method on either
533
533
the whole form or specific field(s)::
534
534
535
- // Disable validation for a specific field
535
+ // disables validation for a specific field
536
536
$form['country']->disableValidation()->select('Invalid value');
537
537
538
- // Disable validation for the whole form
538
+ // disables validation for the whole form
539
539
$form->disableValidation();
540
540
$form['country']->select('Invalid value');
541
541
0 commit comments