Skip to content

Commit

Permalink
optimize with spread operator
Browse files Browse the repository at this point in the history
I hope at least! not like I did benchmarking
  • Loading branch information
JohnRDOrazio committed May 19, 2022
1 parent abf6919 commit fcb1108
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion includes/enums/LitCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public static function isValid( string $value ) {

public static function areValid( array $values ) {
$values = array_reduce($values, function( $carry, $key ){
return strpos($key, ':') ? array_merge( explode(':', $key), $carry ) : array_merge( [ $key ], $carry );
return strpos($key, ':') ? ( $carry + explode(':', $key) ) : ( [ ...$carry, $key ] );
}, [] );
return empty( array_diff( $values, self::$values ) );
}
Expand Down

0 comments on commit fcb1108

Please sign in to comment.