Code Duplication    Length = 28-28 lines in 2 locations

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

@@ 134-161 (lines=28) @@
131
    /**
132
     * Returns this object as array.
133
     */
134
    public function toArray()
135
    {
136
        $options = array(
137
            'api_name' => $this->getApiName(),
138
            'archived' => $this->getArchived(),
139
            'category' => $this->getCategory(),
140
            'created' => $this->getCreated(),
141
            'description' => $this->getDescription(),
142
            'event_filter' => $this->getEventFilter()?$this->getEventFilter()->toArray():null,
143
            'event_type' => $this->getEventType(),
144
            'key' => $this->getKey(),
145
            'name' => $this->getName(),
146
            'page_id' => $this->getPageId(),
147
            'project_id' => $this->getProjectId(),
148
            'id' => $this->getId(),
149
            'is_classic' => $this->getIsClassic(),
150
            'is_editable' => $this->getIsEditable()
151
        );
152
        
153
        // Remove options with empty values
154
        $cleanedOptions = array();
155
        foreach ($options as $name=>$value) {
156
            if ($value!==null)
157
                $cleanedOptions[$name] = $value;
158
        }
159
        
160
        return $cleanedOptions;
161
    }
162
    
163
    public function getApiName()
164
    {

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

@@ 129-156 (lines=28) @@
126
    /**
127
     * Returns this object as array.
128
     */
129
    public function toArray()
130
    {
131
        $options = array(
132
            'edit_url' => $this->getEditUrl(),
133
            'name' => $this->getName(),
134
            'project_id' => $this->getProjectId(),
135
            'activation_code' => $this->getActivationCode(),
136
            'activation_type' => $this->getActivationType(),
137
            'api_name' => $this->getApiName(),
138
            'archived' => $this->getArchived(),
139
            'category' => $this->getCategory(),
140
            'conditions' => $this->getConditions(),
141
            'key' => $this->getKey(),
142
            'page_type' => $this->getPageType(),            
143
            'created' => $this->getCreated(),
144
            'id' => $this->getId(),
145
            'last_modified' => $this->getLastModified()
146
        );
147
        
148
        // Remove options with empty values
149
        $cleanedOptions = array();
150
        foreach ($options as $name=>$value) {
151
            if ($value!==null)
152
                $cleanedOptions[$name] = $value;
153
        }
154
        
155
        return $cleanedOptions;
156
    }
157
    
158
    public function getEditUrl()
159
    {