protected function merge_boxes( array $boxes ) {
		$result = [];

		foreach ( $boxes as $box ) {
			if ( ! isset( $result[$box->id] ) ) {
				$result[$box->id] = $box;
				continue;
			}

			foreach ( $box->properties as $property ) {
				$result[$box->id]->properties[] = $property;
			}

			$result[$box->id]->properties = array_unique( $result[$box->id]->properties );
		}

		return array_values( $result );
	}
protected function merge_boxes( array $boxes ) {
		$result = [];

		foreach ( $boxes as $box ) {
			if ( ! isset( $result[$box->id] ) ) {
				$result[$box->id] = $box;
				continue;
			}

			foreach ( $box->properties as $property ) {
				$result[$box->id]->properties[] = $property;
			}

			$result[$box->id]->properties = array_unique( $result[$box->id]->properties );
		}

		return array_values( $result );
	}
protected function merge_boxes ( array $ boxes ) { $ result = [ ] ; foreach ( $ boxes as $ box ) { if ( ! isset ( $ result [ $ box -> id ] ) ) { $ result [ $ box -> id ] = $ box ; continue ; } foreach ( $ box -> properties as $ property ) { $ result [ $ box -> id ] -> properties [ ] = $ property ; } $ result [ $ box -> id ] -> properties = array_unique ( $ result [ $ box -> id ] -> properties ) ; } return array_values ( $ result ) ; }
Merge boxes with same title.

@param  array $boxes

@return array
Merge boxes with same title .