-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathfilesystem_and_finder_components.yaml
411 lines (411 loc) · 21 KB
/
filesystem_and_finder_components.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
questions:
-
uuid: 1eebf878-8b97-6dcc-8979-99d84c92580c
question: 'What is returned by the Symfony\Component\Filesystem\Filesystem::mkdir method if the directory has been successfully created ?'
answers:
- { value: 'The FileSystem object', correct: false }
- { value: 'A string with the directory path', correct: false }
- { value: Nothing, correct: true }
- { value: 'true or false', correct: false }
help: 'https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/Filesystem/Filesystem.php#L91'
-
uuid: 1eebf878-8b98-6d26-9152-99d84c92580c
question: "Is the following code valid? $mirror('/srv/app', '/srv/bar', null, ['copy_on_windows' => true]);"
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://symfony.com/doc/current/components/filesystem.html#mirror'
-
uuid: 1eebf878-8b99-60d2-94e5-99d84c92580c
question: 'What is the Symfony\Component\Filesystem\Filesystem method to check if the given path is absolute ?'
answers:
- { value: "$fs->isAbsolutePath('/tmp');", correct: true }
- { value: "$fs->absolutePath('/tmp');", correct: false }
- { value: "$fs->checkAbsolutePath('/tmp');", correct: false }
- { value: "$fs->isAbsolute('/tmp');", correct: false }
help: 'https://symfony.com/doc/current/components/filesystem.html#isabsolutepath'
-
uuid: 1eebf878-8b99-628a-b149-99d84c92580c
question: 'When using mirror(...), could files instead of links be mirrored on Windows?'
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://symfony.com/doc/current/components/filesystem.html#mirror'
-
uuid: 1eebf878-8b9a-613a-bac4-99d84c92580c
question: 'What is the Symfony\Component\Filesystem\Filesystem method to dump contents to a file?'
answers:
- { value: "$fs->dumpToFile('file.txt', 'Hello World');", correct: false }
- { value: "$fs->file('file.txt', 'Hello World');", correct: false }
- { value: "$fs->dump('file.txt', 'Hello World');", correct: false }
- { value: "$fs->dumpFile('file.txt', 'Hello World');", correct: true }
help: 'https://symfony.com/doc/current/components/filesystem.html#dumpfile'
-
uuid: 1eebf878-8b9a-67de-9c30-99d84c92580c
question: "Is the following code valid? $fs = (new Filesystem())->mirror('/srv/app', '/srv/bar', null, ['delete' => true]);"
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/Filesystem/Filesystem.php#L527'
-
uuid: 1eebf878-8b9c-6336-848b-99d84c92580c
question: 'When using mirror(...), could files that are not present in the source directory be deleted?'
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
- { value: 'May be', correct: false }
help: 'https://symfony.com/doc/current/components/filesystem.html#mirror'
-
uuid: 1eebf878-8b9c-6386-8337-99d84c92580c
question: 'Which exception is thrown when the origin file does not exist when you use the Filesystem::copy method ?'
answers:
- { value: FileException, correct: false }
- { value: FileNotExistException, correct: false }
- { value: FileErrorException, correct: false }
- { value: FileNotFoundException, correct: true }
- { value: FilesystemException, correct: false }
help: 'https://symfony.com/doc/current/components/filesystem.html#copy'
-
uuid: 1eebf878-8b9c-6426-87bc-99d84c92580c
question: 'Which of the following are Filesystem methods?'
answers:
- { value: copy, correct: true }
- { value: delete, correct: false }
- { value: move, correct: false }
- { value: chown, correct: true }
- { value: makePathRelative, correct: true }
- { value: symlink, correct: true }
- { value: mirror, correct: true }
help: 'https://symfony.com/doc/current/components/filesystem.html#usage'
-
uuid: 1eebf878-8b9d-615a-828d-99d84c92580c
question: 'Which methods belong to Symfony\Component\Finder\Finder class ?'
answers:
- { value: size, correct: true }
- { value: notPath, correct: true }
- { value: type, correct: true }
- { value: notName, correct: true }
- { value: notSize, correct: true }
- { value: owner, correct: false }
- { value: name, correct: true }
- { value: path, correct: true }
help: 'https://symfony.com/doc/current/components/finder.html'
-
uuid: 1eebf878-8ba1-6c96-bc52-99d84c92580c
question: 'What is the first argument of the Symfony\Component\Config\FileLocator::locate method?'
answers:
- { value: 'The name of the directory to look for.', correct: false }
- { value: 'The name of the configuration value to look for.', correct: false }
- { value: 'The type of file to look for.', correct: false }
- { value: 'The name of the file to look for.', correct: true }
help: 'https://symfony.com/doc/current/components/config/resources.html#locating-resources'
-
uuid: 1eebf878-8ba1-6d2c-819c-99d84c92580c
question: 'Is the following code valid?use Symfony\Component\Filesystem\Path;$path = new Path(''/srv/app/var/cache'');'
answers:
- { value: 'Yes', correct: false }
- { value: 'No', correct: true }
help: 'https://github.com/symfony/filesystem/blob/7.0/Path.php#L813'
-
uuid: 1eebf878-8ba2-6a24-adfc-99d84c92580c
question: 'Could FileLocator::locate() returns only the first occurrence?'
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://symfony.com/doc/current/components/config/resources.html'
-
uuid: 1eebf878-8ba3-6302-9bf6-99d84c92580c
question: 'What is the correct signature of the Symfony\Component\Filesystem\Filesystem::copy method?'
answers:
- { value: 'public function copy($originFile, $targetFile, $overwriteNewerFiles)', correct: false }
- { value: 'public function copy($targetFile, $originFile, $overwriteNewerFiles)', correct: false }
- { value: 'public function copy($originFile, $targetFile, $overwriteNewerFiles = false)', correct: true }
- { value: 'public function copy($targetFile, $originFile, $overwriteNewerFiles = false)', correct: false }
help: 'https://symfony.com/doc/current/components/filesystem.html#copy'
-
uuid: 1eebf878-8ba3-64ec-8a4c-99d84c92580c
question: 'What is the definition of an Adapter?'
answers:
- { value: 'It implements the actual caching mechanism to store the information.', correct: true }
- { value: 'It is a single unit of information stored as a key/value pair.', correct: false }
- { value: 'It is a logical repository of cache items.', correct: false }
help: 'https://symfony.com/doc/current/components/cache.html#generic-caching-psr-6'
-
uuid: 1eebf878-8ba4-6374-985a-99d84c92580c
question: 'With the Finder, which method is correct to exclude a logs directory from matching ?'
answers:
- { value: "$finder->in(__DIR__)->ignoreDirectory('logs');", correct: false }
- { value: "$finder->in(__DIR__)->ignoreFiles('logs');", correct: false }
- { value: "$finder->in(__DIR__)->notMatch('logs');", correct: false }
- { value: "$finder->in(__DIR__)->exclude('logs');", correct: true }
- { value: "$finder->in(__DIR__)->ignoreDir('logs');", correct: false }
- { value: "$finder->in(__DIR__)->excludeDir('logs');", correct: false }
- { value: "$finder->in(__DIR__)->ignore('logs');", correct: false }
help: 'https://symfony.com/doc/current/components/finder.html#location'
-
uuid: 1eebf878-8ba4-6fe0-bbbb-99d84c92580c
question: "Will the following code trigger an error if the /tmp/photos directory already exists ? $fs = new Filesystem(); $fs->mkdir('/tmp/photos', 0700);"
answers:
- { value: 'Yes', correct: false }
- { value: 'No', correct: true }
help: 'https://symfony.com/doc/current/components/filesystem.html#mkdir'
-
uuid: 1eebf878-8ba6-6e62-8ca9-99d84c92580c
question: 'By default, the Finder ignores popular VCS files, what is the method to use them ?'
answers:
- { value: $finder->enableVCSFiles();, correct: false }
- { value: $finder->ignoreVCS(false);, correct: true }
- { value: "$finder->useTypes(array('vcs' => true);", correct: false }
- { value: "$finder->ignoreFiles(array('vcs' => false));", correct: false }
help: 'https://symfony.com/doc/current/components/finder.html#files-or-directories'
-
uuid: 1ef84dec-e737-68be-ac37-eb42c4b750a2
question: "Which method should be used to create a directory recursively in Symfony's Filesystem component?"
answers:
- { value: mkdir(), correct: true }
- { value: createDir(), correct: false }
- { value: makeDir(), correct: false }
- { value: createFolder(), correct: false }
help: 'https://symfony.com/doc/7.2/components/filesystem.html#filesystem-utilities'
-
uuid: 1ef84df0-583b-6e40-96e0-af7efd2ace38
question: "What does the second argument of the mkdir() method define in Symfony's Filesystem?"
answers:
- { value: 'Directory path', correct: false }
- { value: 'The owner of the directory', correct: false }
- { value: 'Directory permissions', correct: true }
- { value: 'File permissions', correct: false }
help: 'https://symfony.com/doc/7.2/components/filesystem.html#mkdir'
-
uuid: 1ef84df5-4085-6ddc-ab1e-5144548fe866
question: "Which method checks for the existence of files or directories in Symfony's Filesystem component?"
answers:
- { value: exists(), correct: true }
- { value: fileExists(), correct: false }
- { value: checkExists(), correct: false }
- { value: isPresent(), correct: false }
help: 'https://symfony.com/doc/7.2/components/filesystem.html#exists'
-
uuid: 1ef84dfa-4be7-6c70-8675-1507a1a6cb1e
question: 'In the copy() method of the Filesystem component, what does the third argument (boolean) represent?'
answers:
- { value: 'Whether to overwrite the target file', correct: true }
- { value: 'The permissions of the copied file', correct: false }
- { value: 'The owner of the copied file', correct: false }
- { value: 'Whether to create a symlink', correct: false }
help: 'https://symfony.com/doc/7.2/components/filesystem.html#copy'
-
uuid: 1ef84dff-7920-6a3e-b1f1-3bc4c3004014
question: "What does the touch() method in Symfony's Filesystem component do?"
answers:
- { value: 'Modifies the permissions of a file', correct: false }
- { value: 'Creates a symbolic link to the file', correct: false }
- { value: 'Updates the access and modification time of a file', correct: true }
- { value: 'Moves the file to another location', correct: false }
help: 'https://symfony.com/doc/7.2/components/filesystem.html#touch'
-
uuid: 1ef84e03-07a8-6ec0-a268-2bb37289340e
question: 'What is the purpose of the chown() method in the Filesystem component?'
answers:
- { value: 'To change the file group', correct: false }
- { value: 'To change the owner of a file', correct: true }
- { value: 'To delete the owner information', correct: false }
- { value: 'To check the ownership of the file', correct: false }
help: 'https://symfony.com/doc/7.2/components/filesystem.html#chown'
-
uuid: 1ef84e06-9321-6f62-9fb4-adaa052a6856
question: "Which method in Symfony's Filesystem component changes the group of a file?"
answers:
- { value: chmod(), correct: false }
- { value: setGroup(), correct: false }
- { value: chown(), correct: false }
- { value: chgrp(), correct: true }
help: 'https://symfony.com/doc/7.2/components/filesystem.html#chgrp'
-
uuid: 1ef84e09-d696-68d0-a4e4-9bd453f9a498
question: "Which method in Symfony's Filesystem component removes files, directories, or symlinks?"
answers:
- { value: delete(), correct: false }
- { value: remove(), correct: true }
- { value: erase(), correct: false }
- { value: unlink(), correct: false }
help: 'https://symfony.com/doc/7.2/components/filesystem.html#remove'
-
uuid: 1ef84e0d-c0d9-6ad4-856a-f3dff73eb252
question: 'When using the rename() method, what does the third argument control?'
answers:
- { value: 'Setting a custom file path', correct: false }
- { value: 'Whether to overwrite an existing file', correct: true }
- { value: 'Applying custom permissions', correct: false }
- { value: 'Enabling a recursive rename', correct: false }
help: 'https://symfony.com/doc/7.2/components/filesystem.html#rename'
-
uuid: 1ef84e12-b245-60b8-af2b-a5d18ce6642c
question: 'Which method creates a symbolic link in the Symfony Filesystem component?'
answers:
- { value: symlink(), correct: true }
- { value: link(), correct: false }
- { value: createLink(), correct: false }
- { value: createSymlink(), correct: false }
help: 'https://symfony.com/doc/7.2/components/filesystem.html#symlink'
-
uuid: 1ef84e17-945c-611e-9249-afc877a92179
question: 'What is the function of the readlink() method in the Filesystem component?'
answers:
- { value: 'Resolves the absolute path of a link', correct: true }
- { value: 'Reads the content of a file linked via a symlink', correct: false }
- { value: 'Deletes a symbolic link', correct: false }
- { value: 'Checks if a symbolic link is valid', correct: false }
help: 'https://symfony.com/doc/7.2/components/filesystem.html#readlink'
-
uuid: 1ef84e1a-8834-64ce-9b21-2db45b7f2b96
question: 'Which method copies the entire contents of a directory to a target location in Symfony Filesystem?'
answers:
- { value: mirror(), correct: true }
- { value: clone(), correct: false }
- { value: copyDir(), correct: false }
- { value: copy(), correct: false }
help: 'https://symfony.com/doc/7.2/components/filesystem.html#mirror'
-
uuid: 1ef84e1d-7afe-639c-9a3d-7ff7ce849018
question: "Which method in Symfony's Path class returns the shortest path equivalent to the given one?"
answers:
- { value: resolve(), correct: false }
- { value: canonicalize(), correct: true }
- { value: shorten(), correct: false }
- { value: minimize(), correct: false }
help: 'https://symfony.com/doc/7.2/components/filesystem.html#canonicalization'
-
uuid: 1ef84e21-3c22-6020-8d3a-a11204d5a255
question: 'Which method in the Symfony Filesystem component saves file contents atomically, ensuring either the complete new or old file is present?'
answers:
- { value: dumpFile(), correct: true }
- { value: writeFile(), correct: false }
- { value: saveFile(), correct: false }
- { value: writeContents(), correct: false }
help: 'https://symfony.com/doc/7.2/components/filesystem.html#dumpfile'
-
uuid: 1ef84e24-fab7-600a-b829-5dbd8c03f866
question: 'What does the makePathRelative() method do in the Symfony Path utility?'
answers:
- { value: 'Converts an absolute path to a relative path', correct: true }
- { value: 'Converts a relative path to an absolute path', correct: false }
- { value: 'Resolves a symlink to its target path', correct: false }
- { value: 'Appends segments to a given path', correct: false }
help: 'https://symfony.com/doc/7.2/components/filesystem.html#makepathrelative'
-
uuid: 1ef84e32-2f6b-6136-8709-6bb6e459ecbb
question: 'How do you specify a directory to search in with the Finder component?'
answers:
- { value: $finder->from(DIR);, correct: false }
- { value: $finder->in(DIR);, correct: true }
- { value: $finder->search(DIR);, correct: false }
help: 'https://symfony.com/doc/7.2/components/finder.html#usage'
-
uuid: 1ef84e34-adfc-6c82-93f8-8b021db55f5f
question: 'Can the Finder component search in multiple directories?'
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://symfony.com/doc/7.2/components/finder.html#file-name'
-
uuid: 1ef84e37-4396-6af2-af9b-f1e316a4d018
question: 'What method should you use to exclude directories during a search?'
answers:
- { value: "$finder->skip('folder');", correct: false }
- { value: "$finder->exclude('folder');", correct: true }
- { value: "$finder->ignore('folder');", correct: false }
help: 'https://symfony.com/doc/7.2/components/finder.html#file-name'
-
uuid: 1ef84e3b-0327-6814-a4f5-f5ce03db1273
question: 'How do you ignore unreadable directories in a Finder search?'
answers:
- { value: $finder->ignoreUnreadableDirs();, correct: true }
- { value: $finder->skipUnreadableDirs();, correct: false }
- { value: $finder->omitUnreadableDirs();, correct: false }
help: 'https://symfony.com/doc/7.2/components/finder.html#searching-for-files-and-directories'
-
uuid: 1ef84e3e-58e0-69f6-beff-6b20a60c31cf
question: 'Which method allows you to include files with a specific name or pattern?'
answers:
- { value: "$finder->has('*.php');", correct: false }
- { value: "$finder->name('*.php');", correct: true }
- { value: "$finder->match('*.php');", correct: false }
help: 'https://symfony.com/doc/7.2/components/finder.html#location'
-
uuid: 1ef84e41-555a-66bc-9569-69cb8f63e06e
question: 'How do you exclude files that match a specific name pattern?'
answers:
- { value: "$finder->notName('*.php');", correct: true }
- { value: "$finder->ignoreName('*.php');", correct: false }
- { value: "$finder->skipName('*.php');", correct: false }
help: 'https://symfony.com/doc/7.2/components/finder.html#file-name'
-
uuid: 1ef84e43-ce3b-6b2e-8041-25f2eebb6781
question: 'Can the Finder component search for files by their content?'
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://symfony.com/doc/7.2/components/finder.html#file-contents'
-
uuid: 1ef84e47-3140-6df2-853a-97c4c8285485
question: 'Which method do you use to search for files that contain a specific string?'
answers:
- { value: "$finder->content('lorem ipsum');", correct: false }
- { value: "$finder->contains('lorem ipsum');", correct: true }
- { value: "$finder->searchContent('lorem ipsum');", correct: false }
help: 'https://symfony.com/doc/7.2/components/finder.html#file-contents'
-
uuid: 1ef84e4a-2dcb-62e6-87c2-bb3797ac4914
question: 'How do you search for files by size using the Finder component?'
answers:
- { value: "$finder->size('>= 1K');", correct: true }
- { value: "$finder->fileSize('>= 1K');", correct: false }
- { value: "$finder->file('>= 1K');", correct: false }
help: 'https://symfony.com/doc/7.2/components/finder.html#file-size'
-
uuid: 1ef84e4d-18f4-68e2-bab2-d7516d13cf2b
question: 'What method should you use to sort Finder results by file name?'
answers:
- { value: $finder->orderByName();, correct: false }
- { value: $finder->sortByName();, correct: true }
- { value: $finder->arrangeByName();, correct: false }
help: 'https://symfony.com/doc/7.2/components/finder.html#sorting-results'
-
uuid: 1ef84e4f-e5b7-6828-b5d3-230992b1d42a
question: 'How do you reverse the sorting of Finder results?'
answers:
- { value: $finder->reverseOrder();, correct: false }
- { value: $finder->reverseSorting();, correct: true }
- { value: $finder->sortReverse();, correct: false }
help: 'https://symfony.com/doc/7.2/components/finder.html#sorting-results'
-
uuid: 1ef84e52-7b8e-6c64-9241-f56b7179f995
question: 'Which method allows you to follow symbolic links during a search?'
answers:
- { value: $finder->followLinks();, correct: true }
- { value: $finder->useLinks();, correct: false }
- { value: $finder->traceLinks();, correct: false }
help: 'https://symfony.com/doc/7.2/components/finder.html#files-or-directories'
-
uuid: 1ef84e56-29a1-6fb0-aea9-698b6c1e1873
question: 'How do you get the contents of a file found by the Finder component?'
answers:
- { value: $file->read();, correct: false }
- { value: $file->getContent();, correct: false }
- { value: $file->getContents();, correct: true }
help: 'https://symfony.com/doc/7.2/components/finder.html#reading-contents-of-returned-files'
-
uuid: 1ef84e58-30c4-67a0-b09d-d16093ed9458
question: 'Can you filter Finder results based on a custom logic using a callback function?'
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://symfony.com/doc/7.2/components/finder.html#sorting-results'
-
uuid: 1ef91eff-7bd1-6608-a1bf-2ba11eeedc3d
question: "Is the Filesystem component implemented in a lazy or eager manner?"
answers:
- { value: 'Lazy', correct: false }
- { value: 'Eager', correct: true }
help: 'https://github.com/symfony/symfony/blob/7.0/src/Symfony/Component/Filesystem/Filesystem.php'