Skip to content

Commit 3fd73a2

Browse files
[FSSDK-9573] Fix: Deprecation warning (#279)
* Add PHP pack ext * Add missing field definition * Add missing field definition * Add phpunit test runner ext * Change to use consistent _privateFieldNaming * Add gitlens * Fix rename Didn't have a proper refactor ext/function * Update copyright header * Refactor CI slightly * Add back EOL for file
1 parent 4eea483 commit 3fd73a2

File tree

3 files changed

+32
-19
lines changed

3 files changed

+32
-19
lines changed

Diff for: .devcontainer/devcontainer.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
"extensions": [
1919
"bmewburn.vscode-intelephense-client",
2020
"xdebug.php-debug",
21-
"DEVSENSE.composer-php-vscode"
21+
"DEVSENSE.composer-php-vscode",
22+
"xdebug.php-pack",
23+
"recca0120.vscode-phpunit",
24+
"eamodio.gitlens"
2225
]
2326
}
2427
}

Diff for: .github/workflows/php.yml

+15-10
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ jobs:
1111
name: Linting
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
14+
- name: Checkout code
15+
uses: actions/checkout@v3
1516
- name: Set up PHP
1617
uses: shivammathur/setup-php@v2
1718
with:
@@ -25,28 +26,24 @@ jobs:
2526
name: Source Clear Scan
2627
runs-on: ubuntu-latest
2728
steps:
28-
- uses: actions/checkout@v2
29+
- name: Checkout code
30+
uses: actions/checkout@v3
2931
- name: Source clear scan
3032
env:
3133
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
3234
run: curl -sSL https://download.sourceclear.com/ci.sh | bash -s – scan
3335

34-
integration_tests:
35-
name: Integration Tests
36-
uses: optimizely/php-sdk/.github/workflows/integration_test.yml@master
37-
secrets:
38-
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
39-
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
40-
4136
unit_tests:
4237
name: Unit Tests ${{ matrix.php-versions }}
38+
needs: [ linting, source_clear ]
4339
runs-on: ubuntu-latest
4440
strategy:
4541
fail-fast: false
4642
matrix:
4743
php-versions: [ '8.1', '8.2' ]
4844
steps:
49-
- uses: actions/checkout@v3
45+
- name: Checkout code
46+
uses: actions/checkout@v3
5047
- name: Set up PHP v${{ matrix.php-versions }}
5148
uses: shivammathur/setup-php@v2
5249
with:
@@ -77,3 +74,11 @@ jobs:
7774
run: |
7875
composer global require php-coveralls/php-coveralls
7976
php-coveralls --coverage_clover=./build/logs/clover.xml -v
77+
78+
integration_tests:
79+
name: Integration Tests
80+
needs: [ unit_tests ]
81+
uses: optimizely/php-sdk/.github/workflows/integration_test.yml@master
82+
secrets:
83+
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
84+
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}

Diff for: src/Optimizely/ProjectConfigManager/HTTPProjectConfigManager.php

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22
/**
3-
* Copyright 2019-2020, 2022 Optimizely Inc and Contributors
3+
* Copyright 2019-2020, 2022-2023 Optimizely Inc and Contributors
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
77
* You may obtain a copy of the License at
88
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
9+
* https://www.apache.org/licenses/LICENSE-2.0
1010
*
1111
* Unless required by applicable law or agreed to in writing, software
1212
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -75,7 +75,12 @@ class HTTPProjectConfigManager implements ProjectConfigManagerInterface
7575
/**
7676
* @var String datafile access token.
7777
*/
78-
private $datafileAccessToken;
78+
private $_datafileAccessToken;
79+
80+
/**
81+
* @var boolean Flag indicates that the datafile access token is valid.
82+
*/
83+
private $_isDatafileAccessTokenValid;
7984

8085
public function __construct(
8186
$sdkKey = null,
@@ -93,8 +98,8 @@ public function __construct(
9398
$this->_logger = $logger ?: new NoOpLogger();
9499
$this->_errorHandler = $errorHandler ?: new NoOpErrorHandler();
95100
$this->_notificationCenter = $notificationCenter ?: new NotificationCenter($this->_logger, $this->_errorHandler);
96-
$this->datafileAccessToken = $datafileAccessToken;
97-
$this->isDatafileAccessTokenValid = Validator::validateNonEmptyString($this->datafileAccessToken);
101+
$this->_datafileAccessToken = $datafileAccessToken;
102+
$this->_isDatafileAccessTokenValid = Validator::validateNonEmptyString($this->_datafileAccessToken);
98103

99104
$this->httpClient = new HttpClient();
100105
$this->_url = $this->getUrl($sdkKey, $url, $urlTemplate);
@@ -136,7 +141,7 @@ protected function getUrl($sdkKey, $url, $urlTemplate)
136141
}
137142

138143
if (!Validator::validateNonEmptyString($urlTemplate)) {
139-
if ($this->isDatafileAccessTokenValid) {
144+
if ($this->_isDatafileAccessTokenValid) {
140145
$urlTemplate = ProjectConfigManagerConstants::AUTHENTICATED_DATAFILE_URL_TEMPLATE;
141146
} else {
142147
$urlTemplate = ProjectConfigManagerConstants::DEFAULT_DATAFILE_URL_TEMPLATE;
@@ -179,8 +184,8 @@ protected function fetchDatafile()
179184
}
180185

181186
// Add Authorization header if access token available.
182-
if ($this->isDatafileAccessTokenValid) {
183-
$headers['Authorization'] = "Bearer {$this->datafileAccessToken}";
187+
if ($this->_isDatafileAccessTokenValid) {
188+
$headers['Authorization'] = "Bearer {$this->_datafileAccessToken}";
184189
}
185190

186191
$options = [

0 commit comments

Comments
 (0)