@@ -87,7 +87,7 @@ An anonymous function can be used to filter with more complex criteria::
87
87
$crawler = $crawler
88
88
->filter('body > p')
89
89
->reduce(function (Crawler $node, $i) {
90
- // filter every other node
90
+ // filters every other node
91
91
return ($i % 2) == 0;
92
92
});
93
93
@@ -183,7 +183,7 @@ Accessing Node Values
183
183
184
184
Access the node name (HTML tag name) of the first node of the current selection (eg. "p" or "div")::
185
185
186
- // will return the node name (HTML tag name) of the first child element under <body>
186
+ // returns the node name (HTML tag name) of the first child element under <body>
187
187
$tag = $crawler->filterXPath('//body/*')->nodeName();
188
188
189
189
Access the value of the first node of the current selection::
@@ -304,7 +304,7 @@ instance with just the selected link(s). Calling ``link()`` gives you a special
304
304
The :class: `Symfony\\ Component\\ DomCrawler\\ Link ` object has several useful
305
305
methods to get more information about the selected link itself::
306
306
307
- // return the proper URI that can be used to make another request
307
+ // returns the proper URI that can be used to make another request
308
308
$uri = $link->getUri();
309
309
310
310
.. note ::
@@ -355,13 +355,13 @@ attribute followed by a query string of all of the form's values.
355
355
356
356
You can virtually set and get values on the form::
357
357
358
- // set values on the form internally
358
+ // sets values on the form internally
359
359
$form->setValues(array(
360
360
'registration[username]' => 'symfonyfan',
361
361
'registration[terms]' => 1,
362
362
));
363
363
364
- // get back an array of values - in the "flat" array like above
364
+ // gets back an array of values - in the "flat" array like above
365
365
$values = $form->getValues();
366
366
367
367
// returns the values like PHP would see them,
@@ -378,10 +378,10 @@ To work with multi-dimensional fields::
378
378
379
379
Pass an array of values::
380
380
381
- // Set a single field
381
+ // sets a single field
382
382
$form->setValues(array('multi' => array('value')));
383
383
384
- // Set multiple fields at once
384
+ // sets multiple fields at once
385
385
$form->setValues(array('multi' => array(
386
386
1 => 'value',
387
387
'dimensional' => 'an other value'
@@ -393,17 +393,17 @@ and uploading files::
393
393
394
394
$form['registration[username]']->setValue('symfonyfan');
395
395
396
- // check or uncheck a checkbox
396
+ // checks or unchecks a checkbox
397
397
$form['registration[terms]']->tick();
398
398
$form['registration[terms]']->untick();
399
399
400
- // select an option
400
+ // selects an option
401
401
$form['registration[birthday][year]']->select(1984);
402
402
403
- // select many options from a "multiple" select
403
+ // selects many options from a "multiple" select
404
404
$form['registration[interests]']->select(array('symfony', 'cookies'));
405
405
406
- // even fake a file upload
406
+ // fakes a file upload
407
407
$form['registration[photo]']->upload('/path/to/lucas.jpg');
408
408
409
409
Using the Form Data
@@ -432,7 +432,7 @@ directly::
432
432
433
433
use Goutte\Client;
434
434
435
- // make a real request to an external site
435
+ // makes a real request to an external site
436
436
$client = new Client();
437
437
$crawler = $client->request('GET', 'https://github.com/login');
438
438
@@ -441,7 +441,7 @@ directly::
441
441
$form['login'] = 'symfonyfan';
442
442
$form['password'] = 'anypass';
443
443
444
- // submit that form
444
+ // submits the given form
445
445
$crawler = $client->submit($form);
446
446
447
447
.. _components-dom-crawler-invalid :
@@ -454,10 +454,10 @@ to prevent you from setting invalid values. If you want to be able to set
454
454
invalid values, you can use the ``disableValidation() `` method on either
455
455
the whole form or specific field(s)::
456
456
457
- // Disable validation for a specific field
457
+ // disables validation for a specific field
458
458
$form['country']->disableValidation()->select('Invalid value');
459
459
460
- // Disable validation for the whole form
460
+ // disables validation for the whole form
461
461
$form->disableValidation();
462
462
$form['country']->select('Invalid value');
463
463
0 commit comments