• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

optimizely / php-sdk / 13883417585

16 Mar 2025 12:37PM UTC coverage: 97.336%. Remained the same
13883417585

push

github

web-flow
[FSSDK-10015] chore: Prepare release 4.0.2

EventBuilder.php -> Updated SDK version to 4.0.2 
EventBuilderTest.php -> Updated client version to 4.0.2
CHANGELOG.md -> Added version 4.0.2 details (#291)

2704 of 2778 relevant lines covered (97.34%)

109.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.21
/src/Optimizely/OptimizelyConfig/OptimizelyConfig.php
1
<?php
2
/**
3
 * Copyright 2020-2021, Optimizely Inc and Contributors
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
namespace Optimizely\OptimizelyConfig;
18

19
class OptimizelyConfig implements \JsonSerializable
20
{
21
    /**
22
     * @var string environmentKey of the config.
23
     */
24
    private $environmentKey;
25

26
    /**
27
     * @var string sdkKey of the config.
28
     */
29
    private $sdkKey;
30

31
    /**
32
     * @var string Revision of the config.
33
     */
34
    private $revision;
35

36
    /**
37
     * Map of Experiment Keys to OptimizelyExperiments.
38
     * This experimentsMap is for experiments of legacy projects only.
39
     * For flag projects, experiment keys are not guaranteed to be unique
40
     * across multiple flags, so this map may not include all experiments
41
     * when keys conflict. Use experimentRules and deliveryRules instead.
42
     *
43
     * @var <String, OptimizelyExperiment> associative array
44
     */
45
    private $experimentsMap;
46

47
    /**
48
     * Map of Feature Keys to OptimizelyFeatures.
49
     *
50
     * @var <String, OptimizelyFeature> associative array
51
     */
52
    private $featuresMap;
53

54
    /**
55
     * Array of attributes as OptimizelyAttribute.
56
     *
57
     * @var [OptimizelyAttribute]
58
     */
59
    private $attributes;
60

61
    /**
62
     * Array of audiences as OptimizelyAudience.
63
     *
64
     * @var [OptimizelyAudience]
65
     */
66
    private $audiences;
67

68
    /**
69
     * Array of events as OptimizelyEvent.
70
     *
71
     * @var [OptimizelyEvent]
72
     */
73
    private $events;
74

75
    /**
76
     * @var string Contents of datafile.
77
     */
78
    private $datafile;
79
    
80

81
    public function __construct($revision, array $experimentsMap, array $featuresMap, $datafile = null, $environmentKey = '', $sdkKey = '', $attributes = [], $audiences = [], $events = [])
82
    {
83
        $this->environmentKey = $environmentKey;
14✔
84
        $this->sdkKey = $sdkKey;
14✔
85
        $this->revision = $revision;
14✔
86
        $this->experimentsMap = $experimentsMap;
14✔
87
        $this->featuresMap = $featuresMap;
14✔
88
        $this->attributes = $attributes;
14✔
89
        $this->audiences = $audiences;
14✔
90
        $this->events = $events;
14✔
91
        $this->datafile = $datafile;
14✔
92
    }
93

94
    /**
95
     * @return string Config environmentKey.
96
     */
97
    public function getEnvironmentKey()
98
    {
99
        return $this->environmentKey;
2✔
100
    }
101

102
    /**
103
     * @return string Config sdkKey.
104
     */
105
    public function getSdkKey()
106
    {
107
        return $this->sdkKey;
2✔
108
    }
109

110
    /**
111
     * @return string Config revision.
112
     */
113
    public function getRevision()
114
    {
115
        return $this->revision;
4✔
116
    }
117

118
    /**
119
     * @return string Datafile contents.
120
     */
121
    public function getDatafile()
122
    {
123
        return $this->datafile;
2✔
124
    }
125

126
    /**
127
     * @return array Map of Experiment Keys to OptimizelyExperiments.
128
     */
129
    public function getExperimentsMap()
130
    {
131
        return $this->experimentsMap;
8✔
132
    }
133

134
    /**
135
     * @return array Map of Feature Keys to OptimizelyFeatures.
136
     */
137
    public function getFeaturesMap()
138
    {
139
        return $this->featuresMap;
6✔
140
    }
141

142
    /**
143
     * @return array Attributes as  OptimizelyAttribute.
144
     */
145
    public function getAttributes()
146
    {
147
        return $this->attributes;
×
148
    }
149

150
    /**
151
     * @return array Audiences as  OptimizelyAudience.
152
     */
153
    public function getAudiences()
154
    {
155
        return $this->audiences;
×
156
    }
157

158
    /**
159
     * @return array Events as  OptimizelyEvent.
160
     */
161
    public function getEvents()
162
    {
163
        return $this->events;
×
164
    }
165

166
    /**
167
     * @return string JSON representation of the object.
168
     */
169
    #[\ReturnTypeWillChange]
170
    public function jsonSerialize()
171
    {
172
        return get_object_vars($this);
4✔
173
    }
174
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc