← All changes
|
includes/sdk/google/google/gax/src/ResourceTemplate/AbsoluteResourceTemplate.php
+12
-12
1.2.10
→
1.4.2
View file →
| @@ -29,11 +29,11 @@ | ||
| 29 | 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 30 | 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 31 | 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 32 | 32 | */ |
| 33 | -namespace Dudlewebs\WPMCS\Google\ApiCore\ResourceTemplate; | |
| 33 | +namespace Dudlewebs\WPMCS\GCP\Google\ApiCore\ResourceTemplate; | |
| 34 | 34 | |
| 35 | -use Dudlewebs\WPMCS\Google\ApiCore\ValidationException; | |
| 35 | +use Dudlewebs\WPMCS\GCP\Google\ApiCore\ValidationException; | |
| 36 | 36 | /** |
| 37 | 37 | * Represents an absolute resource template, meaning that it will always contain a leading slash, |
| 38 | 38 | * and may contain a trailing verb (":<verb>"). |
| 39 | 39 | * |
| @@ -68,10 +68,10 @@ | ||
| 68 | 68 | if ($path[0] !== '/') { |
| 69 | 69 | throw new ValidationException("Could not construct AbsoluteResourceTemplate from '{$path}': must begin with '/'"); |
| 70 | 70 | } |
| 71 | 71 | $verbSeparatorPos = $this->verbSeparatorPos($path); |
| 72 | - $this->resourceTemplate = new RelativeResourceTemplate(substr($path, 1, $verbSeparatorPos - 1)); | |
| 73 | - $this->verb = substr($path, $verbSeparatorPos + 1); | |
| 72 | + $this->resourceTemplate = new RelativeResourceTemplate(\substr($path, 1, $verbSeparatorPos - 1)); | |
| 73 | + $this->verb = \substr($path, $verbSeparatorPos + 1); | |
| 74 | 74 | } |
| 75 | 75 | /** |
| 76 | 76 | * @inheritdoc |
| 77 | 77 | */ |
| @@ -76,9 +76,9 @@ | ||
| 76 | 76 | * @inheritdoc |
| 77 | 77 | */ |
| 78 | 78 | public function __toString() |
| 79 | 79 | { |
| 80 | - return sprintf("/%s%s", $this->resourceTemplate, $this->renderVerb()); | |
| 80 | + return \sprintf('/%s%s', $this->resourceTemplate, $this->renderVerb()); | |
| 81 | 81 | } |
| 82 | 82 | /** |
| 83 | 83 | * @inheritdoc |
| 84 | 84 | */ |
| @@ -83,9 +83,9 @@ | ||
| 83 | 83 | * @inheritdoc |
| 84 | 84 | */ |
| 85 | 85 | public function render(array $bindings) |
| 86 | 86 | { |
| 87 | - return sprintf("/%s%s", $this->resourceTemplate->render($bindings), $this->renderVerb()); | |
| 87 | + return \sprintf('/%s%s', $this->resourceTemplate->render($bindings), $this->renderVerb()); | |
| 88 | 88 | } |
| 89 | 89 | /** |
| 90 | 90 | * @inheritdoc |
| 91 | 91 | */ |
| @@ -103,18 +103,18 @@ | ||
| 103 | 103 | */ |
| 104 | 104 | public function match(string $path) |
| 105 | 105 | { |
| 106 | 106 | if (empty($path)) { |
| 107 | - throw $this->matchException($path, "path cannot be empty"); | |
| 107 | + throw $this->matchException($path, 'path cannot be empty'); | |
| 108 | 108 | } |
| 109 | 109 | if ($path[0] !== '/') { |
| 110 | 110 | throw $this->matchException($path, "missing leading '/'"); |
| 111 | 111 | } |
| 112 | 112 | $verbSeparatorPos = $this->verbSeparatorPos($path); |
| 113 | - if (substr($path, $verbSeparatorPos + 1) !== $this->verb) { | |
| 113 | + if (\substr($path, $verbSeparatorPos + 1) !== $this->verb) { | |
| 114 | 114 | throw $this->matchException($path, "trailing verb did not match '{$this->verb}'"); |
| 115 | 115 | } |
| 116 | - return $this->resourceTemplate->match(substr($path, 1, $verbSeparatorPos - 1)); | |
| 116 | + return $this->resourceTemplate->match(\substr($path, 1, $verbSeparatorPos - 1)); | |
| 117 | 117 | } |
| 118 | 118 | private function matchException(string $path, string $reason) |
| 119 | 119 | { |
| 120 | 120 | return new ValidationException("Could not match path '{$path}' to template '{$this}': {$reason}"); |
| @@ -124,12 +124,12 @@ | ||
| 124 | 124 | return $this->verb ? ':' . $this->verb : ''; |
| 125 | 125 | } |
| 126 | 126 | private function verbSeparatorPos(string $path) |
| 127 | 127 | { |
| 128 | - $finalSeparatorPos = strrpos($path, '/'); | |
| 129 | - $verbSeparatorPos = strrpos($path, ':', $finalSeparatorPos); | |
| 128 | + $finalSeparatorPos = \strrpos($path, '/'); | |
| 129 | + $verbSeparatorPos = \strrpos($path, ':', $finalSeparatorPos); | |
| 130 | 130 | if ($verbSeparatorPos === \false) { |
| 131 | - $verbSeparatorPos = strlen($path); | |
| 131 | + $verbSeparatorPos = \strlen($path); | |
| 132 | 132 | } |
| 133 | 133 | return $verbSeparatorPos; |
| 134 | 134 | } |
| 135 | 135 | } |