$unique Уникальные сегменты записи, ключ — uniq_hash. * @param array $ids uniq_hash => id строки в sources. * @param int $postId Идентификатор записи. * @return list */ public static function build( array $unique, array $ids, int $postId ): array { $rows = array(); foreach ( $unique as $hash => $postSegment ) { if ( ! isset( $ids[ $hash ] ) ) { continue; } $rows[] = array( 'source_id' => $ids[ $hash ], 'object_type' => 'post', 'object_id' => $postId, 'url_hash' => null, 'attribute_name' => $postSegment->segment->attribute, 'uniq_hash' => Hash::ofParts( array( $ids[ $hash ], 'post', (string) $postId, (string) $postSegment->segment->attribute ) ), ); } return $rows; } }