File tree Expand file tree Collapse file tree 4 files changed +10
-12
lines changed
Expand file tree Collapse file tree 4 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ method::
5050
5151 use Symfony\Component\ClassLoader\ClassMapGenerator;
5252
53- print_r (ClassMapGenerator::createMap(__DIR__.'/library'));
53+ dump (ClassMapGenerator::createMap(__DIR__.'/library'));
5454
5555Given the files and class from the table above, you should see an output like
5656this:
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ equivalents::
5151
5252 use Symfony\Component\CssSelector\CssSelector;
5353
54- print CssSelector::toXPath('div.item > h4 > a');
54+ dump( CssSelector::toXPath('div.item > h4 > a') );
5555
5656This gives the following output:
5757
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ traverse easily::
4747 $crawler = new Crawler($html);
4848
4949 foreach ($crawler as $domElement) {
50- print $domElement->nodeName;
50+ dump( $domElement->nodeName) ;
5151 }
5252
5353Specialized :class: `Symfony\\ Component\\ DomCrawler\\ Link ` and
Original file line number Diff line number Diff line change @@ -30,14 +30,14 @@ directories::
3030 $finder->files()->in(__DIR__);
3131
3232 foreach ($finder as $file) {
33- // Print the absolute path
34- print $file->getRealpath()."\n" ;
33+ // Dump the absolute path
34+ dump( $file->getRealpath()) ;
3535
36- // Print the relative path to the file, omitting the filename
37- print $file->getRelativePath()."\n" ;
36+ // Dump the relative path to the file, omitting the filename
37+ dump( $file->getRelativePath()) ;
3838
39- // Print the relative path to the file
40- print $file->getRelativePathname()."\n" ;
39+ // Dump the relative path to the file
40+ dump( $file->getRelativePathname()) ;
4141 }
4242
4343The ``$file `` is an instance of :class: `Symfony\\ Component\\ Finder\\ SplFileInfo `
@@ -121,9 +121,7 @@ And it also works with user-defined streams::
121121 $finder = new Finder();
122122 $finder->name('photos*')->size('< 100K')->date('since 1 hour ago');
123123 foreach ($finder->in('s3://bucket-name') as $file) {
124- // ... do something
125-
126- print $file->getFilename()."\n";
124+ // ... do something with the file
127125 }
128126
129127.. note ::
You can’t perform that action at this time.
0 commit comments