PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
← All changes | includes/sdk/google/google/auth/src/Credentials/AppIdentityCredentials.php +15 -15 1.1.0 → 1.4.2 View file →
@@ -14,9 +14,9 @@
14 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 15 * See the License for the specific language governing permissions and
16 16 * limitations under the License.
17 17 */
18 -namespace Dudlewebs\WPMCS\Google\Auth\Credentials;
18 +namespace Dudlewebs\WPMCS\GCP\Google\Auth\Credentials;
19 19
20 20 /*
21 21 * The AppIdentityService class is automatically defined on App Engine,
22 22 * so including this dependency is not necessary, and will result in a
@@ -21,12 +21,12 @@
21 21 * The AppIdentityService class is automatically defined on App Engine,
22 22 * so including this dependency is not necessary, and will result in a
23 23 * PHP fatal error in the App Engine environment.
24 24 */
25 -use Dudlewebs\WPMCS\google\appengine\api\app_identity\AppIdentityService;
26 -use Dudlewebs\WPMCS\Google\Auth\CredentialsLoader;
27 -use Dudlewebs\WPMCS\Google\Auth\ProjectIdProviderInterface;
28 -use Dudlewebs\WPMCS\Google\Auth\SignBlobInterface;
25 +use Dudlewebs\WPMCS\GCP\google\appengine\api\app_identity\AppIdentityService;
26 +use Dudlewebs\WPMCS\GCP\Google\Auth\CredentialsLoader;
27 +use Dudlewebs\WPMCS\GCP\Google\Auth\ProjectIdProviderInterface;
28 +use Dudlewebs\WPMCS\GCP\Google\Auth\SignBlobInterface;
29 29 /**
30 30 * @deprecated
31 31 *
32 32 * AppIdentityCredentials supports authorization on Google App Engine.
@@ -77,9 +77,9 @@
77 77 * @param string|string[] $scope One or more scopes.
78 78 */
79 79 public function __construct($scope = [])
80 80 {
81 - $this->scope = is_array($scope) ? $scope : explode(' ', (string) $scope);
81 + $this->scope = \is_array($scope) ? $scope : \explode(' ', (string) $scope);
82 82 }
83 83 /**
84 84 * Determines if this an App Engine instance, by accessing the
85 85 * SERVER_SOFTWARE environment variable (prod) or the APPENGINE_RUNTIME
@@ -88,9 +88,9 @@
88 88 * @return bool true if this an App Engine Instance, false otherwise
89 89 */
90 90 public static function onAppEngine()
91 91 {
92 - $appEngineProduction = isset($_SERVER['SERVER_SOFTWARE']) && 0 === strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine');
92 + $appEngineProduction = isset($_SERVER['SERVER_SOFTWARE']) && 0 === \strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine');
93 93 if ($appEngineProduction) {
94 94 return \true;
95 95 }
96 96 $appEngineDevAppServer = isset($_SERVER['APPENGINE_RUNTIME']) && $_SERVER['APPENGINE_RUNTIME'] == 'php';
@@ -105,9 +105,9 @@
105 105 * Fetches the auth tokens using the AppIdentityService if available.
106 106 * As the AppIdentityService uses protobufs to fetch the access token,
107 107 * the GuzzleHttp\ClientInterface instance passed in will not be used.
108 108 *
109 - * @param callable $httpHandler callback which delivers psr7 request
109 + * @param callable|null $httpHandler callback which delivers psr7 request
110 110 * @return array<mixed> {
111 111 * A set of auth related metadata, containing the following
112 112 *
113 113 * @type string $access_token
@@ -113,9 +113,9 @@
113 113 * @type string $access_token
114 114 * @type string $expiration_time
115 115 * }
116 116 */
117 - public function fetchAuthToken(callable $httpHandler = null)
117 + public function fetchAuthToken(?callable $httpHandler = null)
118 118 {
119 119 try {
120 120 $this->checkAppEngineContext();
121 121 } catch (\Exception $e) {
@@ -138,9 +138,9 @@
138 138 public function signBlob($stringToSign, $forceOpenSsl = \false)
139 139 {
140 140 $this->checkAppEngineContext();
141 141 /** @phpstan-ignore-next-line */
142 - return base64_encode(AppIdentityService::signForApp($stringToSign)['signature']);
142 + return \base64_encode(AppIdentityService::signForApp($stringToSign)['signature']);
143 143 }
144 144 /**
145 145 * Get the project ID from AppIdentityService.
146 146 *
@@ -145,12 +145,12 @@
145 145 * Get the project ID from AppIdentityService.
146 146 *
147 147 * Returns null if AppIdentityService is unavailable.
148 148 *
149 - * @param callable $httpHandler Not used by this type.
149 + * @param callable|null $httpHandler Not used by this type.
150 150 * @return string|null
151 151 */
152 - public function getProjectId(callable $httpHandler = null)
152 + public function getProjectId(?callable $httpHandler = null)
153 153 {
154 154 try {
155 155 $this->checkAppEngineContext();
156 156 } catch (\Exception $e) {
@@ -163,13 +163,13 @@
163 163 * Get the client name from AppIdentityService.
164 164 *
165 165 * Subsequent calls to this method will return a cached value.
166 166 *
167 - * @param callable $httpHandler Not used in this implementation.
167 + * @param callable|null $httpHandler Not used in this implementation.
168 168 * @return string
169 169 * @throws \Exception If AppEngine SDK or mock is not available.
170 170 */
171 - public function getClientName(callable $httpHandler = null)
171 + public function getClientName(?callable $httpHandler = null)
172 172 {
173 173 $this->checkAppEngineContext();
174 174 if (!$this->clientName) {
175 175 /** @phpstan-ignore-next-line */
@@ -201,9 +201,9 @@
201 201 * @return void
202 202 */
203 203 private function checkAppEngineContext()
204 204 {
205 - if (!self::onAppEngine() || !class_exists('Dudlewebs\WPMCS\google\appengine\api\app_identity\AppIdentityService')) {
205 + if (!self::onAppEngine() || !\class_exists('Dudlewebs\\WPMCS\\GCP\\google\\appengine\\api\\app_identity\\AppIdentityService')) {
206 206 throw new \Exception('This class must be run in App Engine, or you must include the AppIdentityService ' . 'mock class defined in tests/mocks/AppIdentityService.php');
207 207 }
208 208 }
209 209 }