@@ -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
@@ -196,7 +196,7 @@ Accessing Node Values
196
196
197
197
Access the node name (HTML tag name) of the first node of the current selection (eg. "p" or "div")::
198
198
199
- // will return the node name (HTML tag name) of the first child element under <body>
199
+ // returns the node name (HTML tag name) of the first child element under <body>
200
200
$tag = $crawler->filterXPath('//body/*')->nodeName();
201
201
202
202
Access the value of the first node of the current selection::
@@ -317,7 +317,7 @@ instance with just the selected link(s). Calling ``link()`` gives you a special
317
317
The :class: `Symfony\\ Component\\ DomCrawler\\ Link ` object has several useful
318
318
methods to get more information about the selected link itself::
319
319
320
- // return the proper URI that can be used to make another request
320
+ // returns the proper URI that can be used to make another request
321
321
$uri = $link->getUri();
322
322
323
323
.. note ::
@@ -368,13 +368,13 @@ attribute followed by a query string of all of the form's values.
368
368
369
369
You can virtually set and get values on the form::
370
370
371
- // set values on the form internally
371
+ // sets values on the form internally
372
372
$form->setValues(array(
373
373
'registration[username]' => 'symfonyfan',
374
374
'registration[terms]' => 1,
375
375
));
376
376
377
- // get back an array of values - in the "flat" array like above
377
+ // gets back an array of values - in the "flat" array like above
378
378
$values = $form->getValues();
379
379
380
380
// returns the values like PHP would see them,
@@ -391,10 +391,10 @@ To work with multi-dimensional fields::
391
391
392
392
Pass an array of values::
393
393
394
- // Set a single field
394
+ // sets a single field
395
395
$form->setValues(array('multi' => array('value')));
396
396
397
- // Set multiple fields at once
397
+ // sets multiple fields at once
398
398
$form->setValues(array('multi' => array(
399
399
1 => 'value',
400
400
'dimensional' => 'an other value'
@@ -406,17 +406,17 @@ and uploading files::
406
406
407
407
$form['registration[username]']->setValue('symfonyfan');
408
408
409
- // check or uncheck a checkbox
409
+ // checks or unchecks a checkbox
410
410
$form['registration[terms]']->tick();
411
411
$form['registration[terms]']->untick();
412
412
413
- // select an option
413
+ // selects an option
414
414
$form['registration[birthday][year]']->select(1984);
415
415
416
- // select many options from a "multiple" select
416
+ // selects many options from a "multiple" select
417
417
$form['registration[interests]']->select(array('symfony', 'cookies'));
418
418
419
- // even fake a file upload
419
+ // fakes a file upload
420
420
$form['registration[photo]']->upload('/path/to/lucas.jpg');
421
421
422
422
Using the Form Data
@@ -445,7 +445,7 @@ directly::
445
445
446
446
use Goutte\Client;
447
447
448
- // make a real request to an external site
448
+ // makes a real request to an external site
449
449
$client = new Client();
450
450
$crawler = $client->request('GET', 'https://github.com/login');
451
451
@@ -454,7 +454,7 @@ directly::
454
454
$form['login'] = 'symfonyfan';
455
455
$form['password'] = 'anypass';
456
456
457
- // submit that form
457
+ // submits the given form
458
458
$crawler = $client->submit($form);
459
459
460
460
.. _components-dom-crawler-invalid :
@@ -467,10 +467,10 @@ to prevent you from setting invalid values. If you want to be able to set
467
467
invalid values, you can use the ``disableValidation() `` method on either
468
468
the whole form or specific field(s)::
469
469
470
- // Disable validation for a specific field
470
+ // disables validation for a specific field
471
471
$form['country']->disableValidation()->select('Invalid value');
472
472
473
- // Disable validation for the whole form
473
+ // disables validation for the whole form
474
474
$form->disableValidation();
475
475
$form['country']->select('Invalid value');
476
476
0 commit comments