| Total Complexity | 7 |
| Total Lines | 81 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | abstract class Gateway implements GatewayInterface |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * 配置信息 |
||
| 11 | * |
||
| 12 | * @var |
||
| 13 | */ |
||
| 14 | protected $config; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var string|null path prefix |
||
| 18 | */ |
||
| 19 | protected $pathPrefix; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | protected $pathSeparator = '/'; |
||
| 25 | /** |
||
| 26 | * @var |
||
| 27 | */ |
||
| 28 | protected $client; |
||
| 29 | |||
| 30 | |||
| 31 | /** |
||
| 32 | * Gateway constructor. |
||
| 33 | * @param null $config |
||
|
|
|||
| 34 | * @throws \Exception |
||
| 35 | */ |
||
| 36 | public function __construct($config = null) |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Set the path prefix. |
||
| 46 | * @param string $prefix |
||
| 47 | * @return void |
||
| 48 | */ |
||
| 49 | public function setPathPrefix($prefix) |
||
| 50 | { |
||
| 51 | $prefix = (string) $prefix; |
||
| 52 | |||
| 53 | if ($prefix === '') { |
||
| 54 | $this->pathPrefix = null; |
||
| 55 | return; |
||
| 56 | } |
||
| 57 | |||
| 58 | $this->pathPrefix = rtrim($prefix, '\\/') . $this->pathSeparator; |
||
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Get the path prefix. |
||
| 63 | * @return string|null path prefix or null if pathPrefix is empty |
||
| 64 | */ |
||
| 65 | public function getPathPrefix() |
||
| 66 | { |
||
| 67 | return $this->pathPrefix; |
||
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * Prefix a path. |
||
| 72 | * @param string $path |
||
| 73 | * @return string prefixed path |
||
| 74 | */ |
||
| 75 | public function applyPathPrefix($path) |
||
| 78 | } |
||
| 79 | |||
| 80 | /** |
||
| 81 | * Remove a path prefix. |
||
| 82 | * @param string $path |
||
| 83 | * @return string path without the prefix |
||
| 84 | */ |
||
| 85 | public function removePathPrefix($path) |
||
| 88 | } |
||
| 89 | |||
| 90 | |||
| 92 |