Code Duplication    Length = 7-8 lines in 3 locations

lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Action.php 1 location

@@ 35-41 (lines=7) @@
32
    {
33
        foreach ($options as $name=>$value) {
34
            switch ($name) {                
35
                case 'changes': {
36
                    $changes = array();
37
                    foreach ($value as $changeInfo) {
38
                        $changes[] = new Change($changeInfo);
39
                    }
40
                    $this->setChanges($changes); break;
41
                }
42
                case 'page_id': $this->setPageId($value); break;
43
                default:
44
                    throw new \Exception('Unknown option: ' . $name);

lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Campaign.php 1 location

@@ 110-116 (lines=7) @@
107
        foreach ($options as $name=>$value) {
108
            switch ($name) {                
109
                case 'project_id': $this->setProjectId($value); break;
110
                case 'changes': {
111
                    $changes = array();
112
                    foreach ($value as $changeInfo) {
113
                        $changes[] = new Change($changeInfo);
114
                    }
115
                    $this->setChanges($changes); break;
116
                }
117
                case 'created': $this->setCreated($value); break;
118
                case 'earliest': $this->setEarliest($value); break;
119
                case 'experiment_ids': $this->setExperimentIds($value); break;

lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Experiment.php 1 location

@@ 128-135 (lines=8) @@
125
                case 'project_id': $this->setProjectId($value); break;
126
                case 'audience_ids': $this->setAudienceIds($value); break;
127
                case 'campaign_id': $this->setCampaignId($value); break;
128
                case 'changes': {
129
                    $changes = array();
130
                    foreach ($value as $changeInfo) {
131
                        $changes[] = new Change($changeInfo);
132
                    }
133
                    $this->setChanges($changes); 
134
                    break;
135
                }
136
                case 'created': $this->setCreated($value); break;    
137
                case 'description': $this->setDescription($value); break;    
138
                case 'holdback': $this->setHoldback($value); break;