Completed
Push — master ( 46eee0...8fdee6 )
by Cedric
01:51
created

FlysystemDriver::addFile()   B

Complexity

Conditions 6
Paths 6

Size

Total Lines 26
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 8.1174

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 26
ccs 11
cts 18
cp 0.6111
rs 8.439
cc 6
eloc 18
nc 6
nop 4
crap 8.1174
1
<?php
2
3
namespace CedricZiel\FalFlysystem\Fal;
4
5
use League\Flysystem\Adapter\Local;
6
use League\Flysystem\AdapterInterface;
7
use League\Flysystem\Config;
8
use League\Flysystem\FilesystemInterface;
9
use TYPO3\CMS\Core\Resource\Driver\AbstractHierarchicalFilesystemDriver;
10
use TYPO3\CMS\Core\Resource\ResourceStorage;
11
use TYPO3\CMS\Core\Utility\GeneralUtility;
12
use TYPO3\CMS\Core\Utility\PathUtility;
13
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
14
15
/**
16
 * Class FlysystemDriver
17
 * @package CedricZiel\FalFlysystem\Fal
18
 */
19
abstract class FlysystemDriver extends AbstractHierarchicalFilesystemDriver
20
{
21
    /**
22
     * @var FilesystemInterface
23
     */
24
    protected $filesystem;
25
26
    /**
27
     * @var AdapterInterface
28
     */
29
    protected $adapter;
30
31
    /**
32
     * @var string
33
     */
34
    protected $entryPath;
35
36
    /**
37
     * FlysystemDriver constructor.
38
     * @param array $configuration
39
     */
40 30
    public function __construct(array $configuration = [])
41
    {
42 30
        parent::__construct($configuration);
43
        // The capabilities default of this driver. See CAPABILITY_* constants for possible values
44 30
        $this->capabilities =
45 10
            ResourceStorage::CAPABILITY_BROWSABLE
46 30
            | ResourceStorage::CAPABILITY_PUBLIC
47 30
            | ResourceStorage::CAPABILITY_WRITABLE;
48 30
    }
49
50
    /**
51
     * Processes the configuration for this driver.
52
     * @return void
53
     */
54
    public function processConfiguration()
55
    {
56
        $this->entryPath = $this->configuration['path'];
57
    }
58
59
    /**
60
     * Merges the capabilities merged by the user at the storage
61
     * configuration into the actual capabilities of the driver
62
     * and returns the result.
63
     *
64
     * @param int $capabilities
65
     * @return int
66
     */
67
    public function mergeConfigurationCapabilities($capabilities)
68
    {
69
        // TODO: Implement mergeConfigurationCapabilities() method.
70
    }
71
72
    /**
73
     * Returns the identifier of the root level folder of the storage.
74
     *
75
     * @return string
76
     */
77
    public function getRootLevelFolder()
78
    {
79
        return '/';
80
    }
81
82
    /**
83
     * Returns the identifier of the default folder new files should be put into.
84
     *
85
     * @return string
86
     */
87 3
    public function getDefaultFolder()
88
    {
89 3
        $identifier = '/user_upload/';
90 3
        $createFolder = !$this->folderExists($identifier);
91 3
        if (true === $createFolder) {
92 3
            $identifier = $this->createFolder('user_upload');
93 2
        }
94 3
        return $identifier;
95
    }
96
97
    /**
98
     * Checks if a folder exists.
99
     *
100
     * @param string $folderIdentifier
101
     * @return bool
102
     */
103 6
    public function folderExists($folderIdentifier)
104
    {
105 6
        if ('/' === $folderIdentifier) {
106
            return true;
107
        } else {
108 6
            return $this->filesystem->has('/' . $folderIdentifier);
109
        }
110
    }
111
112
    /**
113
     * Creates a folder, within a parent folder.
114
     * If no parent folder is given, a root level folder will be created
115
     *
116
     * @param string $newFolderName
117
     * @param string $parentFolderIdentifier
118
     * @param bool $recursive
119
     * @return string the Identifier of the new folder
120
     */
121 9
    public function createFolder($newFolderName, $parentFolderIdentifier = '', $recursive = false)
122
    {
123 9
        $parentFolderIdentifier = $this->canonicalizeAndCheckFolderIdentifier($parentFolderIdentifier);
124 9
        $newFolderName = trim($newFolderName, '/');
125 9
        if (false === $recursive) {
126 9
            $newFolderName = $this->sanitizeFileName($newFolderName);
127 9
            $newIdentifier = $parentFolderIdentifier . $newFolderName . '/';
128 9
            $this->filesystem->createDir($newIdentifier);
129 6
        } else {
130
            $parts = GeneralUtility::trimExplode('/', $newFolderName);
131
            $parts = array_map(array($this, 'sanitizeFileName'), $parts);
132
            $newFolderName = implode('/', $parts);
133
            $newIdentifier = $parentFolderIdentifier . $newFolderName . '/';
134
        }
135 9
        return $newIdentifier;
136
    }
137
138
    /**
139
     * Returns the public URL to a file.
140
     * Either fully qualified URL or relative to PATH_site (rawurlencoded).
141
     *
142
     * @param string $identifier
143
     * @return string
144
     */
145
    public function getPublicUrl($identifier)
146
    {
147
        // TODO: Implement getPublicUrl() method.
148
        DebuggerUtility::var_dump([
149
            '$identifier' => $identifier
150
        ], 'getPublicUrl');
151
    }
152
153
    /**
154
     * Renames a folder in this storage.
155
     *
156
     * @param string $folderIdentifier
157
     * @param string $newName
158
     * @return array A map of old to new file identifiers of all affected resources
159
     */
160 3
    public function renameFolder($folderIdentifier, $newName)
161
    {
162 3
        $renameResult = $this->filesystem->rename($folderIdentifier, $newName);
163
164 3
        if (true === $renameResult) {
165 3
            return [$folderIdentifier => $newName];
166
        } else {
167
            return [$folderIdentifier => $folderIdentifier];
168
        }
169
    }
170
171
    /**
172
     * Removes a folder in filesystem.
173
     *
174
     * @param string $folderIdentifier
175
     * @param bool $deleteRecursively
176
     * @return bool
177
     */
178
    public function deleteFolder($folderIdentifier, $deleteRecursively = false)
179
    {
180
        return $this->filesystem->deleteDir($folderIdentifier);
181
    }
182
183
    /**
184
     * Checks if a file exists.
185
     *
186
     * @param string $fileIdentifier
187
     * @return bool
188
     */
189 3
    public function fileExists($fileIdentifier)
190
    {
191 3
        return $this->filesystem->has($fileIdentifier);
192
    }
193
194
    /**
195
     * Checks if a folder contains files and (if supported) other folders.
196
     *
197
     * @param string $folderIdentifier
198
     * @return bool TRUE if there are no files and folders within $folder
199
     */
200 3
    public function isFolderEmpty($folderIdentifier)
201
    {
202 3
        return 0 === count($this->filesystem->listContents($folderIdentifier));
203
    }
204
205
    /**
206
     * Adds a file from the local server hard disk to a given path in TYPO3s
207
     * virtual file system. This assumes that the local file exists, so no
208
     * further check is done here! After a successful the original file must
209
     * not exist anymore.
210
     *
211
     * @param string $localFilePath (within PATH_site)
212
     * @param string $targetFolderIdentifier
213
     * @param string $newFileName optional, if not given original name is used
214
     * @param bool $removeOriginal if set the original file will be removed
215
     *                                after successful operation
216
     * @return string the identifier of the new file
217
     */
218 3
    public function addFile($localFilePath, $targetFolderIdentifier, $newFileName = '', $removeOriginal = true)
219
    {
220 3
        $localFilePath = $this->canonicalizeAndCheckFilePath($localFilePath);
221 3
        $newFileName = $this->sanitizeFileName($newFileName !== '' ? $newFileName : PathUtility::basename($localFilePath));
222 3
        $newFileIdentifier = $this->canonicalizeAndCheckFolderIdentifier($targetFolderIdentifier) . $newFileName;
223
224 3
        $targetPath = ltrim($newFileIdentifier, '/');
225
226 3
        $content = file_get_contents($localFilePath);
227
228 3
        if ($removeOriginal) {
229
            if (is_uploaded_file($localFilePath)) {
230
                $result = $this->filesystem->put($targetPath, $content);
231
            } else {
232
                $result = rename($localFilePath, $targetPath);
233
            }
234
            unlink($localFilePath);
235
        } else {
236 3
            $result = $this->filesystem->put($targetPath, $content);
237
        }
238 3
        if ($result === false || !$this->filesystem->has($targetPath)) {
239
            throw new \RuntimeException('Adding file ' . $localFilePath . ' at ' . $newFileIdentifier . ' failed.');
240
        }
241 3
        clearstatcache();
242 3
        return $newFileIdentifier;
243
    }
244
245
    /**
246
     * Creates a new (empty) file and returns the identifier.
247
     *
248
     * @param string $fileName
249
     * @param string $parentFolderIdentifier
250
     * @return string
251
     */
252
    public function createFile($fileName, $parentFolderIdentifier)
253
    {
254
        // TODO: Implement createFile() method.
255
        DebuggerUtility::var_dump([
256
            '$fileName' => $fileName,
257
            '$parentFolderIdentifier' => $parentFolderIdentifier
258
        ], 'createFile');
259
    }
260
261
    /**
262
     * Copies a file *within* the current storage.
263
     * Note that this is only about an inner storage copy action,
264
     * where a file is just copied to another folder in the same storage.
265
     *
266
     * @param string $fileIdentifier
267
     * @param string $targetFolderIdentifier
268
     * @param string $fileName
269
     * @return string the Identifier of the new file
270
     */
271
    public function copyFileWithinStorage($fileIdentifier, $targetFolderIdentifier, $fileName)
272
    {
273
        // TODO: Implement copyFileWithinStorage() method.
274
        DebuggerUtility::var_dump([
275
            '$fileIdentifier' => $fileIdentifier,
276
            '$targetFolderIdentifier' => $targetFolderIdentifier,
277
            '$fileName' => $fileName
278
        ], 'copyFileWithinStorage');
279
    }
280
281
    /**
282
     * Renames a file in this storage.
283
     *
284
     * @param string $fileIdentifier
285
     * @param string $newName The target path (including the file name!)
286
     * @return string The identifier of the file after renaming
287
     */
288
    public function renameFile($fileIdentifier, $newName)
289
    {
290
        // TODO: Implement renameFile() method.
291
        DebuggerUtility::var_dump([
292
            '$fileIdentifier' => $fileIdentifier,
293
            '$newName' => $newName
294
        ], 'renameFile');
295
    }
296
297
    /**
298
     * Replaces a file with file in local file system.
299
     *
300
     * @param string $fileIdentifier
301
     * @param string $localFilePath
302
     * @return bool TRUE if the operation succeeded
303
     */
304
    public function replaceFile($fileIdentifier, $localFilePath)
305
    {
306
        // TODO: Implement replaceFile() method.
307
        DebuggerUtility::var_dump([
308
            '$fileIdentifier' => $fileIdentifier,
309
            '$localFilePath' => $localFilePath
310
        ], 'replaceFile');
311
    }
312
313
    /**
314
     * Removes a file from the filesystem. This does not check if the file is
315
     * still used or if it is a bad idea to delete it for some other reason
316
     * this has to be taken care of in the upper layers (e.g. the Storage)!
317
     *
318
     * @param string $fileIdentifier
319
     * @return bool TRUE if deleting the file succeeded
320
     */
321
    public function deleteFile($fileIdentifier)
322
    {
323
        return $this->filesystem->delete($fileIdentifier);
324
    }
325
326
    /**
327
     * Creates a hash for a file.
328
     *
329
     * @param string $fileIdentifier
330
     * @param string $hashAlgorithm The hash algorithm to use
331
     * @return string
332
     */
333
    public function hash($fileIdentifier, $hashAlgorithm)
334
    {
335
        // TODO: Implement hash() method.
336
    }
337
338
    /**
339
     * Moves a file *within* the current storage.
340
     * Note that this is only about an inner-storage move action,
341
     * where a file is just moved to another folder in the same storage.
342
     *
343
     * @param string $fileIdentifier
344
     * @param string $targetFolderIdentifier
345
     * @param string $newFileName
346
     * @return string
347
     */
348
    public function moveFileWithinStorage($fileIdentifier, $targetFolderIdentifier, $newFileName)
349
    {
350
        // TODO: Implement moveFileWithinStorage() method.
351
    }
352
353
    /**
354
     * Folder equivalent to moveFileWithinStorage().
355
     *
356
     * @param string $sourceFolderIdentifier
357
     * @param string $targetFolderIdentifier
358
     * @param string $newFolderName
359
     * @return array All files which are affected, map of old => new file identifiers
360
     */
361
    public function moveFolderWithinStorage($sourceFolderIdentifier, $targetFolderIdentifier, $newFolderName)
362
    {
363
        // TODO: Implement moveFolderWithinStorage() method.
364
    }
365
366
    /**
367
     * Folder equivalent to copyFileWithinStorage().
368
     *
369
     * @param string $sourceFolderIdentifier
370
     * @param string $targetFolderIdentifier
371
     * @param string $newFolderName
372
     * @return bool
373
     */
374
    public function copyFolderWithinStorage($sourceFolderIdentifier, $targetFolderIdentifier, $newFolderName)
375
    {
376
        // TODO: Implement copyFolderWithinStorage() method.
377
    }
378
379
    /**
380
     * Returns the contents of a file. Beware that this requires to load the
381
     * complete file into memory and also may require fetching the file from an
382
     * external location. So this might be an expensive operation (both in terms
383
     * of processing resources and money) for large files.
384
     *
385
     * @param string $fileIdentifier
386
     * @return string The file contents
387
     */
388 3
    public function getFileContents($fileIdentifier)
389
    {
390 3
        return $this->filesystem->read($fileIdentifier);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The expression $this->filesystem->read($fileIdentifier); of type string|false adds false to the return on line 390 which is incompatible with the return type declared by the interface TYPO3\CMS\Core\Resource\...erface::getFileContents of type string. It seems like you forgot to handle an error condition.
Loading history...
391
    }
392
393
    /**
394
     * Sets the contents of a file to the specified value.
395
     *
396
     * @param string $fileIdentifier
397
     * @param string $contents
398
     * @return int The number of bytes written to the file
399
     */
400 3
    public function setFileContents($fileIdentifier, $contents)
401
    {
402 3
        $this->filesystem->put($fileIdentifier, $contents);
403
404 3
        return $this->filesystem->getSize($fileIdentifier);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The expression $this->filesystem->getSize($fileIdentifier); of type integer|false adds false to the return on line 404 which is incompatible with the return type declared by the interface TYPO3\CMS\Core\Resource\...erface::setFileContents of type integer. It seems like you forgot to handle an error condition.
Loading history...
405
    }
406
407
    /**
408
     * Checks if a file inside a folder exists
409
     *
410
     * @param string $fileName
411
     * @param string $folderIdentifier
412
     * @return bool
413
     */
414
    public function fileExistsInFolder($fileName, $folderIdentifier)
415
    {
416
        // TODO: Implement fileExistsInFolder() method.
417
    }
418
419
    /**
420
     * Checks if a folder inside a folder exists.
421
     *
422
     * @param string $folderName
423
     * @param string $folderIdentifier
424
     * @return bool
425
     */
426
    public function folderExistsInFolder($folderName, $folderIdentifier)
427
    {
428
        return $this->filesystem->has($folderIdentifier . $folderName);
429
    }
430
431
    /**
432
     * Returns a path to a local copy of a file for processing it. When changing the
433
     * file, you have to take care of replacing the current version yourself!
434
     *
435
     * @param string $fileIdentifier
436
     * @param bool $writable Set this to FALSE if you only need the file for read
437
     *                       operations. This might speed up things, e.g. by using
438
     *                       a cached local version. Never modify the file if you
439
     *                       have set this flag!
440
     * @return string The path to the file on the local disk
441
     */
442
    public function getFileForLocalProcessing($fileIdentifier, $writable = true)
443
    {
444
        // TODO: Implement getFileForLocalProcessing() method.
445
        DebuggerUtility::var_dump([
446
            '$fileIdentifier' => $fileIdentifier,
447
            '$writable' => $writable,
448
        ], 'getFileForLocalProcessing');
449
    }
450
451
    /**
452
     * Returns the permissions of a file/folder as an array
453
     * (keys r, w) of boolean flags
454
     *
455
     * @param string $identifier
456
     * @return array
457
     */
458
    public function getPermissions($identifier)
459
    {
460
        return array(
461
            'r' => true,
462
            'w' => true,
463
        );
464
    }
465
466
    /**
467
     * Directly output the contents of the file to the output
468
     * buffer. Should not take care of header files or flushing
469
     * buffer before. Will be taken care of by the Storage.
470
     *
471
     * @param string $identifier
472
     * @return void
473
     */
474
    public function dumpFileContents($identifier)
475
    {
476
        // TODO: Implement dumpFileContents() method.
477
        DebuggerUtility::var_dump([
478
            '$identifier' => $identifier,
479
        ], 'dumpFileContents');
480
    }
481
482
    /**
483
     * Checks if a given identifier is within a container, e.g. if
484
     * a file or folder is within another folder.
485
     * This can e.g. be used to check for web-mounts.
486
     *
487
     * Hint: this also needs to return TRUE if the given identifier
488
     * matches the container identifier to allow access to the root
489
     * folder of a filemount.
490
     *
491
     * @param string $folderIdentifier
492
     * @param string $identifier identifier to be checked against $folderIdentifier
493
     * @return bool TRUE if $content is within or matches $folderIdentifier
494
     */
495
    public function isWithin($folderIdentifier, $identifier)
496
    {
497
        // TODO: Implement isWithin() method.
498
        DebuggerUtility::var_dump([
499
            '$folderIdentifier' => $folderIdentifier,
500
            '$identifier' => $identifier,
501
        ], 'isWithin');
502
503
        $contents = $this->adapter->listContents($folderIdentifier);
504
        DebuggerUtility::var_dump($contents);
505
506
        if ($folderIdentifier === $identifier) {
507
            return true;
508
        } elseif (substr($folderIdentifier, -strlen($identifier)) === $identifier) {
509
            return true;
510
        }
511
512
        return file_exists($this->entryPath . $folderIdentifier . $identifier);
513
    }
514
515
    /**
516
     * Returns information about a file.
517
     *
518
     * @param string $fileIdentifier
519
     * @param array $propertiesToExtract Array of properties which are be extracted
520
     *                                   If empty all will be extracted
521
     * @return array
522
     */
523
    public function getFileInfoByIdentifier($fileIdentifier, array $propertiesToExtract = array())
524
    {
525
        // TODO: Implement getFileInfoByIdentifier() method.
526
        DebuggerUtility::var_dump([
527
            '$fileIdentifier' => $fileIdentifier,
528
            '$propertiesToExtract' => $propertiesToExtract,
529
        ], 'getFileInfoByIdentifier');
530
    }
531
532
    /**
533
     * Returns information about a file.
534
     *
535
     * @param string $folderIdentifier
536
     * @return array
537
     */
538
    public function getFolderInfoByIdentifier($folderIdentifier)
539
    {
540
        // TODO: Implement getFolderInfoByIdentifier() method.
541
        DebuggerUtility::var_dump([
542
            '$folderIdentifier' => $folderIdentifier,
543
        ], 'getFolderInfoByIdentifier');
544
545
        return [
546
            'identifier' => $folderIdentifier,
547
            'name' => PathUtility::basename($folderIdentifier),
548
            'storage' => $this->storageUid
549
        ];
550
    }
551
552
    /**
553
     * Returns the identifier of a file inside the folder
554
     *
555
     * @param string $fileName
556
     * @param string $folderIdentifier
557
     * @return string file identifier
558
     */
559
    public function getFileInFolder($fileName, $folderIdentifier)
560
    {
561
        // TODO: Implement getFileInFolder() method.
562
        DebuggerUtility::var_dump([
563
            '$fileName' => $fileName,
564
            '$folderIdentifier' => $folderIdentifier
565
        ], 'getFileInFolder');
566
    }
567
568
    /**
569
     * Returns a list of files inside the specified path
570
     *
571
     * @param string $folderIdentifier
572
     * @param int $start
573
     * @param int $numberOfItems
574
     * @param bool $recursive
575
     * @param array $filenameFilterCallbacks callbacks for filtering the items
576
     * @param string $sort Property name used to sort the items.
577
     *                     Among them may be: '' (empty, no sorting), name,
578
     *                     fileext, size, tstamp and rw.
579
     *                     If a driver does not support the given property, it
580
     *                     should fall back to "name".
581
     * @param bool $sortRev TRUE to indicate reverse sorting (last to first)
582
     * @return array of FileIdentifiers
583
     */
584 3
    public function getFilesInFolder(
585
        $folderIdentifier,
586
        $start = 0,
587
        $numberOfItems = 0,
588
        $recursive = false,
589
        array $filenameFilterCallbacks = array(),
590
        $sort = '',
591
        $sortRev = false
592
    ) {
593 3
        $calculatedFolderIdentifier = ltrim($this->canonicalizeAndCheckFolderIdentifier($folderIdentifier), '/');
594 3
        $contents = $this->filesystem->listContents($calculatedFolderIdentifier);
595 3
        $files = [];
596
597
        /*
598
         * Filter directories
599
         */
600 3
        foreach ($contents as $directoryItem) {
601 3
            if ('file' === $directoryItem['type']) {
602 3
                $files[$calculatedFolderIdentifier . $directoryItem['path']]
603 3
                    = $calculatedFolderIdentifier . $directoryItem['path'];
604 2
            }
605 2
        }
606
607 3
        return $files;
608
    }
609
610
    /**
611
     * Returns the identifier of a folder inside the folder
612
     *
613
     * @param string $folderName The name of the target folder
614
     * @param string $folderIdentifier
615
     * @return string folder identifier
616
     */
617
    public function getFolderInFolder($folderName, $folderIdentifier)
618
    {
619
        // TODO: Implement getFolderInFolder() method.
620
        DebuggerUtility::var_dump([
621
            '$folderName' => $folderName,
622
            '$folderIdentifier' => $folderIdentifier,
623
        ], 'getFolderInFolder');
624
    }
625
626
    /**
627
     * Returns a list of folders inside the specified path
628
     *
629
     * @param string $folderIdentifier
630
     * @param int $start
631
     * @param int $numberOfItems
632
     * @param bool $recursive
633
     * @param array $folderNameFilterCallbacks callbacks for filtering the items
634
     * @param string $sort Property name used to sort the items.
635
     *                     Among them may be: '' (empty, no sorting), name,
636
     *                     fileext, size, tstamp and rw.
637
     *                     If a driver does not support the given property, it
638
     *                     should fall back to "name".
639
     * @param bool $sortRev TRUE to indicate reverse sorting (last to first)
640
     * @return array of Folder Identifier
641
     * @TODO: Implement pagination with $start and $numberOfItems
642
     * @TODO: Implement directory filter callbacks
643
     * @TODO: Implement sorting
644
     */
645 3
    public function getFoldersInFolder(
646
        $folderIdentifier,
647
        $start = 0,
648
        $numberOfItems = 0,
649
        $recursive = false,
650
        array $folderNameFilterCallbacks = array(),
651
        $sort = '',
652
        $sortRev = false
653
    ) {
654 3
        $calculatedFolderIdentifier = ltrim($this->canonicalizeAndCheckFolderIdentifier($folderIdentifier), '/');
655 3
        $contents = $this->filesystem->listContents($calculatedFolderIdentifier);
656 3
        $directories = [];
657
658
        /*
659
         * Filter directories
660
         */
661 3
        foreach ($contents as $directoryItem) {
662 3
            if ('dir' === $directoryItem['type']) {
663 3
                $directories[$calculatedFolderIdentifier . $directoryItem['path']]
664 3
                    = $calculatedFolderIdentifier . $directoryItem['path'];
665 2
            }
666 2
        }
667
668 3
        return $directories;
669
    }
670
671
    /**
672
     * Returns the number of files inside the specified path
673
     *
674
     * @param string $folderIdentifier
675
     * @param bool $recursive
676
     * @param array $filenameFilterCallbacks callbacks for filtering the items
677
     * @return int Number of files in folder
678
     * @TODO: Implement recursive count
679
     * @TODO: Implement filename filtering
680
     */
681
    public function countFilesInFolder($folderIdentifier, $recursive = false, array $filenameFilterCallbacks = array())
682
    {
683
684
        return count($this->getFilesInFolder($folderIdentifier, 0, 0, $recursive, $filenameFilterCallbacks));
685
    }
686
687
    /**
688
     * Returns the number of folders inside the specified path
689
     *
690
     * @param string $folderIdentifier
691
     * @param bool $recursive
692
     * @param array $folderNameFilterCallbacks callbacks for filtering the items
693
     * @return int Number of folders in folder
694
     */
695
    public function countFoldersInFolder(
696
        $folderIdentifier,
697
        $recursive = false,
698
        array $folderNameFilterCallbacks = array()
699
    ) {
700
        // TODO: Implement countFoldersInFolder() method.
701
        DebuggerUtility::var_dump([
702
            '$folderIdentifier' => $folderIdentifier,
703
            '$recursive' => $recursive,
704
            '$folderNameFilterCallbacks' => $folderNameFilterCallbacks,
705
        ], 'countFoldersInFolder');
706
    }
707
}
708