| @@ -29,9 +29,9 @@ | ||
| 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 | 35 | /** |
| 36 | 36 | * Class containing functions used to build the Agent header. |
| 37 | 37 | */ |
| @@ -69,9 +69,9 @@ | ||
| 69 | 69 | // - apiCoreVersion (gax/) |
| 70 | 70 | // - grpcVersion (grpc/) |
| 71 | 71 | // - restVersion (rest/) |
| 72 | 72 | // - protobufVersion (pb/) |
| 73 | - $metricsHeaders['gl-php'] = $headerInfo['phpVersion'] ?? phpversion(); | |
| 73 | + $metricsHeaders['gl-php'] = $headerInfo['phpVersion'] ?? \phpversion(); | |
| 74 | 74 | if (isset($headerInfo['libName'])) { |
| 75 | 75 | $metricsHeaders[$headerInfo['libName']] = $headerInfo['libVersion'] ?? self::UNKNOWN_VERSION; |
| 76 | 76 | } |
| 77 | 77 | $apiCoreVersion = $headerInfo['apiCoreVersion'] ?? Version::getApiCoreVersion(); |
| @@ -83,18 +83,18 @@ | ||
| 83 | 83 | // is gRPC+REST or REST-only. However, we cannot use the extension's presence |
| 84 | 84 | // either, since some clients may have the extension installed but opt to use a |
| 85 | 85 | // REST-only library (e.g. GCE). |
| 86 | 86 | // TODO: Should we stop sending empty gRPC headers? |
| 87 | - $metricsHeaders['grpc'] = $headerInfo['grpcVersion'] ?? phpversion('grpc'); | |
| 87 | + $metricsHeaders['grpc'] = $headerInfo['grpcVersion'] ?? \phpversion('grpc'); | |
| 88 | 88 | $metricsHeaders['rest'] = $headerInfo['restVersion'] ?? $apiCoreVersion; |
| 89 | 89 | // The native version is not set by default because it is complex and costly to retrieve. |
| 90 | 90 | // Users can override this default behavior if needed. |
| 91 | - $metricsHeaders['pb'] = $headerInfo['protobufVersion'] ?? (phpversion('protobuf') ? phpversion('protobuf') . '+c' : '+n'); | |
| 91 | + $metricsHeaders['pb'] = $headerInfo['protobufVersion'] ?? (\phpversion('protobuf') ? \phpversion('protobuf') . '+c' : '+n'); | |
| 92 | 92 | $metricsList = []; |
| 93 | 93 | foreach ($metricsHeaders as $key => $value) { |
| 94 | - $metricsList[] = $key . "/" . $value; | |
| 94 | + $metricsList[] = $key . '/' . $value; | |
| 95 | 95 | } |
| 96 | - return [self::AGENT_HEADER_KEY => [implode(" ", $metricsList)]]; | |
| 96 | + return [self::AGENT_HEADER_KEY => [\implode(' ', $metricsList)]]; | |
| 97 | 97 | } |
| 98 | 98 | /** |
| 99 | 99 | * Reads the gapic version string from a VERSION file. In order to determine the file |
| 100 | 100 | * location, this method follows this procedure: |
| @@ -109,8 +109,8 @@ | ||
| 109 | 109 | */ |
| 110 | 110 | public static function readGapicVersionFromFile(string $callingClass) |
| 111 | 111 | { |
| 112 | 112 | $callingClassFile = (new \ReflectionClass($callingClass))->getFileName(); |
| 113 | - $versionFile = substr($callingClassFile, 0, strrpos($callingClassFile, \DIRECTORY_SEPARATOR . 'src' . \DIRECTORY_SEPARATOR)) . \DIRECTORY_SEPARATOR . 'VERSION'; | |
| 113 | + $versionFile = \substr($callingClassFile, 0, \strrpos($callingClassFile, \DIRECTORY_SEPARATOR . 'src' . \DIRECTORY_SEPARATOR)) . \DIRECTORY_SEPARATOR . 'VERSION'; | |
| 114 | 114 | return Version::readVersionFile($versionFile); |
| 115 | 115 | } |
| 116 | 116 | } |