private function mapElements(array $elements, array $mainElements, array &$map, array &$inverse): void
    {
        foreach ($elements as $index => $element) {
            $elementId = (int) $element['id'];
            if (!array_key_exists($index, $mainElements)) {
                $this->logger->warning(
                    'Content element {id} has no mapping in main. Element skipped.',
                    [
                        'id' => $elementId,
                        'msg_type' => 'article_content_no_main',
                    ]
                );
                continue;
            }
            $mainElement = $mainElements[$index];
            $mainId      = (int) $mainElement['id'];
            if ($element['type'] !== $mainElement['type']) {
                $this->logger->warning(
                    'Content element {id} has different type as element in main. Element skipped.',
                    [
                        'id' => $elementId,
                        'mainId' => $mainId,

                        'msg_type' => 'article_content_type_mismatch'
                    ]
                );
                continue;
            }

            $map[$elementId]  = $mainId;
            $inverse[$mainId] = $elementId;
        }
    }
private function mapElements(array $elements, array $mainElements, array &$map, array &$inverse): void
    {
        foreach ($elements as $index => $element) {
            $elementId = (int) $element['id'];
            if (!array_key_exists($index, $mainElements)) {
                $this->logger->warning(
                    'Content element {id} has no mapping in main. Element skipped.',
                    [
                        'id' => $elementId,
                        'msg_type' => 'article_content_no_main',
                    ]
                );
                continue;
            }
            $mainElement = $mainElements[$index];
            $mainId      = (int) $mainElement['id'];
            if ($element['type'] !== $mainElement['type']) {
                $this->logger->warning(
                    'Content element {id} has different type as element in main. Element skipped.',
                    [
                        'id' => $elementId,
                        'mainId' => $mainId,

                        'msg_type' => 'article_content_type_mismatch'
                    ]
                );
                continue;
            }

            $map[$elementId]  = $mainId;
            $inverse[$mainId] = $elementId;
        }
    }
private function mapElements ( array $ elements , array $ mainElements , array & $ map , array & $ inverse ) : void { foreach ( $ elements as $ index => $ element ) { $ elementId = ( int ) $ element [ 'id' ] ; if ( ! array_key_exists ( $ index , $ mainElements ) ) { $ this -> logger -> warning ( 'Content element {id} has no mapping in main. Element skipped.' , [ 'id' => $ elementId , 'msg_type' => 'article_content_no_main' , ] ) ; continue ; } $ mainElement = $ mainElements [ $ index ] ; $ mainId = ( int ) $ mainElement [ 'id' ] ; if ( $ element [ 'type' ] !== $ mainElement [ 'type' ] ) { $ this -> logger -> warning ( 'Content element {id} has different type as element in main. Element skipped.' , [ 'id' => $ elementId , 'mainId' => $ mainId , 'msg_type' => 'article_content_type_mismatch' ] ) ; continue ; } $ map [ $ elementId ] = $ mainId ; $ inverse [ $ mainId ] = $ elementId ; } }
Map the passed elements.

@param array $elements     The elements to map.
@param array $mainElements The main elements.
@param array $map          The map to store elements to.
@param array $inverse      The inverse map.

@return void
Map the passed elements .