Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal authored and youknowriad committed May 20, 2021
1 parent c9fc39f commit d45d090
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/class-wp-theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ public function get_stylesheet( $type = 'all' ) {
* Merge new incoming data.
*
* @param WP_Theme_JSON $incoming Data to merge.
* @param string $update_or_remove Whether update or remove existing colors
* @param string $update_or_remove Whether update or remove existing colors
* for which the incoming data has a duplicated slug.
*/
public function merge( $incoming, $update_or_remove = 'remove' ) {
Expand Down Expand Up @@ -1129,15 +1129,15 @@ public function merge( $incoming, $update_or_remove = 'remove' ) {
$index_table = array();
$existing_slugs = array();
$merged = array();
foreach( $existing_node as $key => $value ) {
foreach ( $existing_node as $key => $value ) {
$index_table[ $value['slug'] ] = $key;
$existing_slugs[] = $value['slug'];
$merged[ $key ] = $value;
}

$to_remove = [];
foreach( $incoming_node as $value ) {
if ( ! in_array( $value['slug'], $existing_slugs ) ) {
$to_remove = array();
foreach ( $incoming_node as $value ) {
if ( ! in_array( $value['slug'], $existing_slugs, true ) ) {
$merged[] = $value;
} elseif ( 'update' === $update_or_remove ) {
$merged[ $index_table[ $value['slug'] ] ] = $value;
Expand All @@ -1148,7 +1148,7 @@ public function merge( $incoming, $update_or_remove = 'remove' ) {
}

// Remove the duplicated values and pack the sparsed array.
foreach( $to_remove as $index ) {
foreach ( $to_remove as $index ) {
unset( $merged[ $index ] );
}
$merged = array_values( $merged );
Expand Down

0 comments on commit d45d090

Please sign in to comment.