Code Duplication    Length = 21-21 lines in 2 locations

lib/elFinderVolumeBox.class.php 1 location

@@ 371-391 (lines=21) @@
368
     *
369
     * @return array
370
     */
371
    protected function _bd_splitPath($path)
372
    {
373
        $path = trim($path, '/');
374
        $pid = '';
375
        if ($path === '') {
376
            $id = '0';
377
            $parent = '';
378
        } else {
379
            $paths = explode('/', trim($path, '/'));
380
            $id = array_pop($paths);
381
            if ($paths) {
382
                $parent = '/'.implode('/', $paths);
383
                $pid = array_pop($paths);
384
            } else {
385
                $pid = '0';
386
                $parent = '/';
387
            }
388
        }
389
390
        return [$pid, $id, $parent];
391
    }
392
393
    /**
394
     * Obtains a new access token from OAuth. This token is valid for one hour.

lib/elFinderVolumeOneDrive.class.php 1 location

@@ 541-561 (lines=21) @@
538
     *
539
     * @return array
540
     */
541
    protected function _od_splitPath($path)
542
    {
543
        $path = trim($path, '/');
544
        $pid = '';
545
        if ($path === '') {
546
            $id = 'root';
547
            $parent = '';
548
        } else {
549
            $paths = explode('/', trim($path, '/'));
550
            $id = array_pop($paths);
551
            if ($paths) {
552
                $parent = '/'.implode('/', $paths);
553
                $pid = array_pop($paths);
554
            } else {
555
                $pid = 'root';
556
                $parent = '/';
557
            }
558
        }
559
560
        return [$pid, $id, $parent];
561
    }
562
563
    /**
564
     * Creates a base cURL object which is compatible with the OneDrive API.