← All changes
|
includes/sdk/google/google/gax/src/ResourceHelperTrait.php
+6
-7
1.2.11
→
1.4.1
View file →
| @@ -29,11 +29,10 @@ | ||
| 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; | |
| 33 | +namespace Dudlewebs\WPMCS\GCP\Google\ApiCore; | |
| 34 | 34 | |
| 35 | -use Dudlewebs\WPMCS\Google\ApiCore\ValidationException; | |
| 36 | 35 | /** |
| 37 | 36 | * Provides functionality for loading a resource name template map from a descriptor config, |
| 38 | 37 | * retrieving a PathTemplate, and parsing values using registered templates. |
| 39 | 38 | * |
| @@ -58,12 +57,12 @@ | ||
| 58 | 57 | } |
| 59 | 58 | private static function loadPathTemplates(string $configPath, string $serviceName) |
| 60 | 59 | { |
| 61 | 60 | // TODO: Add void return type hint. |
| 62 | - if (!is_null(self::$templateMap)) { | |
| 61 | + if (!\is_null(self::$templateMap)) { | |
| 63 | 62 | return; |
| 64 | 63 | } |
| 65 | - $descriptors = require $configPath; | |
| 64 | + $descriptors = (require $configPath); | |
| 66 | 65 | $templates = $descriptors['interfaces'][$serviceName]['templateMap'] ?? []; |
| 67 | 66 | self::$templateMap = []; |
| 68 | 67 | foreach ($templates as $name => $template) { |
| 69 | 68 | self::$templateMap[$name] = new PathTemplate($template); |
| @@ -71,16 +70,16 @@ | ||
| 71 | 70 | } |
| 72 | 71 | private static function getPathTemplate(string $key) |
| 73 | 72 | { |
| 74 | 73 | // TODO: Add nullable return type reference once PHP 7.1 is minimum. |
| 75 | - if (is_null(self::$templateMap)) { | |
| 74 | + if (\is_null(self::$templateMap)) { | |
| 76 | 75 | self::registerPathTemplates(); |
| 77 | 76 | } |
| 78 | 77 | return self::$templateMap[$key] ?? null; |
| 79 | 78 | } |
| 80 | - private static function parseFormattedName(string $formattedName, string $template = null): array | |
| 79 | + private static function parseFormattedName(string $formattedName, ?string $template = null) : array | |
| 81 | 80 | { |
| 82 | - if (is_null(self::$templateMap)) { | |
| 81 | + if (\is_null(self::$templateMap)) { | |
| 83 | 82 | self::registerPathTemplates(); |
| 84 | 83 | } |
| 85 | 84 | if ($template) { |
| 86 | 85 | if (!isset(self::$templateMap[$template])) { |