PluginProbe
WPIDE – File Manager & Code Editor / 3.5.9
WPIDE – File Manager & Code Editor v3.5.9
3.5.9 3.5.8 3.5.7 2.0.14 2.0.15 2.0.16 2.0.2 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.2 2.3 2.3.1 2.3.2 2.4.0 2.5 2.6 3.0 3.1 3.2 3.3 All 55 releases
wpide / vendor / league / flysystem / src / Adapter / AbstractAdapter.php

AbstractAdapter.php in WPIDE – File Manager & Code Editor 3.5.9, at vendor/league/flysystem/src/Adapter/AbstractAdapter.php

73 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace League\Flysystem\Adapter;
4
5 use League\Flysystem\AdapterInterface;
6
7 abstract class AbstractAdapter implements AdapterInterface
8 {
9 /**
10 * @var string|null path prefix
11 */
12 protected $pathPrefix;
13
14 /**
15 * @var string
16 */
17 protected $pathSeparator = '/';
18
19 /**
20 * Set the path prefix.
21 *
22 * @param string $prefix
23 *
24 * @return void
25 */
26 public function setPathPrefix($prefix)
27 {
28 $prefix = (string) $prefix;
29
30 if ($prefix === '') {
31 $this->pathPrefix = null;
32
33 return;
34 }
35
36 $this->pathPrefix = rtrim($prefix, '\\/') . $this->pathSeparator;
37 }
38
39 /**
40 * Get the path prefix.
41 *
42 * @return string|null path prefix or null if pathPrefix is empty
43 */
44 public function getPathPrefix()
45 {
46 return $this->pathPrefix;
47 }
48
49 /**
50 * Prefix a path.
51 *
52 * @param string $path
53 *
54 * @return string prefixed path
55 */
56 public function applyPathPrefix($path)
57 {
58 return $this->getPathPrefix() . ltrim($path, '\\/');
59 }
60
61 /**
62 * Remove a path prefix.
63 *
64 * @param string $path
65 *
66 * @return string path without the prefix
67 */
68 public function removePathPrefix($path)
69 {
70 return substr($path, strlen((string) $this->getPathPrefix()));
71 }
72 }
73