| @@ -14,12 +14,12 @@ | ||
| 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; | |
| 18 | +namespace Dudlewebs\WPMCS\GCP\Google\Auth; | |
| 19 | 19 | |
| 20 | -use Dudlewebs\WPMCS\Google\Auth\Credentials\GCECredentials; | |
| 21 | -use Dudlewebs\WPMCS\Psr\Cache\CacheItemPoolInterface; | |
| 20 | +use Dudlewebs\WPMCS\GCP\Google\Auth\Credentials\GCECredentials; | |
| 21 | +use Dudlewebs\WPMCS\GCP\Psr\Cache\CacheItemPoolInterface; | |
| 22 | 22 | /** |
| 23 | 23 | * A class to implement caching for calls to GCECredentials::onGce. This class |
| 24 | 24 | * is used automatically when you pass a `Psr\Cache\CacheItemPoolInterface` |
| 25 | 25 | * cache object to `ApplicationDefaultCredentials::getCredentials`. |
| @@ -41,28 +41,28 @@ | ||
| 41 | 41 | /** |
| 42 | 42 | * @param array<mixed> $cacheConfig Configuration for the cache |
| 43 | 43 | * @param CacheItemPoolInterface $cache |
| 44 | 44 | */ |
| 45 | - public function __construct(array $cacheConfig = null, CacheItemPoolInterface $cache = null) | |
| 45 | + public function __construct(?array $cacheConfig = null, ?CacheItemPoolInterface $cache = null) | |
| 46 | 46 | { |
| 47 | 47 | $this->cache = $cache; |
| 48 | - $this->cacheConfig = array_merge(['lifetime' => 1500, 'prefix' => ''], (array) $cacheConfig); | |
| 48 | + $this->cacheConfig = \array_merge(['lifetime' => 1500, 'prefix' => ''], (array) $cacheConfig); | |
| 49 | 49 | } |
| 50 | 50 | /** |
| 51 | 51 | * Caches the result of onGce so the metadata server is not called multiple |
| 52 | 52 | * times. |
| 53 | 53 | * |
| 54 | - * @param callable $httpHandler callback which delivers psr7 request | |
| 54 | + * @param callable|null $httpHandler callback which delivers psr7 request | |
| 55 | 55 | * @return bool True if this a GCEInstance, false otherwise |
| 56 | 56 | */ |
| 57 | - public function onGce(callable $httpHandler = null) | |
| 57 | + public function onGce(?callable $httpHandler = null) | |
| 58 | 58 | { |
| 59 | - if (is_null($this->cache)) { | |
| 59 | + if (\is_null($this->cache)) { | |
| 60 | 60 | return GCECredentials::onGce($httpHandler); |
| 61 | 61 | } |
| 62 | 62 | $cacheKey = self::GCE_CACHE_KEY; |
| 63 | 63 | $onGce = $this->getCachedValue($cacheKey); |
| 64 | - if (is_null($onGce)) { | |
| 64 | + if (\is_null($onGce)) { | |
| 65 | 65 | $onGce = GCECredentials::onGce($httpHandler); |
| 66 | 66 | $this->setCachedValue($cacheKey, $onGce); |
| 67 | 67 | } |
| 68 | 68 | return $onGce; |