Code Duplication    Length = 14-21 lines in 2 locations

src/Helpers/DataIncludedHelper.php 1 location

@@ 185-205 (lines=21) @@
182
     * @param array  $value
183
     * @param string $type
184
     */
185
    protected static function addRelationshipsToIncludedResources(
186
        array &$mappings,
187
        array &$data,
188
        array &$value,
189
        $type
190
    ) {
191
        foreach ($value as $propertyName => $attribute) {
192
            if (PropertyHelper::isAttributeProperty($mappings, $propertyName, $type)) {
193
                $propertyName = DataAttributesHelper::transformToValidMemberName($propertyName);
194
195
                if (\is_array($attribute) && \array_key_exists(Serializer::CLASS_IDENTIFIER_KEY, $attribute)) {
196
                    $data[$propertyName][JsonApiTransformer::DATA_KEY] = PropertyHelper::setResponseDataTypeAndId(
197
                        $mappings,
198
                        $attribute
199
                    );
200
201
                    continue;
202
                }
203
            }
204
        }
205
    }
206
207
    /**
208
     * @param array $includedData

src/Helpers/DataLinksHelper.php 1 location

@@ 156-169 (lines=14) @@
153
     * @param       $propertyName
154
     * @param       $data
155
     */
156
    protected static function addRelationshipData(
157
        array &$mappings,
158
        array &$parent,
159
        &$value,
160
        &$propertyName,
161
        &$data
162
    ) {
163
        if (\array_key_exists(Serializer::CLASS_IDENTIFIER_KEY, $value)) {
164
            $propertyName = DataAttributesHelper::transformToValidMemberName($propertyName);
165
            $type = $value[Serializer::CLASS_IDENTIFIER_KEY];
166
            self::relationshipLinksSelf($mappings, $parent, $propertyName, $type, $data, $value);
167
            self::relationshipLinksRelated($propertyName, $mappings, $parent, $data);
168
        }
169
    }
170
171
    /**
172
     * @param \NilPortugues\Api\Mapping\Mapping[] $mappings