array to return on conditions
if($originalArraySingle['original-price'] &lt; $priceRange['original-price']['min']){
    $priceRange['original-price']['min'] = is_int($originalArraySingle['original-price']) ? number_format((float)$originalArraySingle['original-price'], 2, '.', '') : $originalArraySingle['original-price'];
}


You could write a function for this. And one for maximize.

protected function minimize($a,&amp;$b){
    if($a&lt;$b){
        $b = is_int($a)?number_format((float)$a,2,'.',''):$a;
    }
}


I would also write.

if($priceRange['price']['max']===$priceRange['price']['min'] ||  $priceRange['price']['max']===$priceRange['price']['min']){
        return null;
    }


and change 

return $showRange ? $priceRange : null;


to

return $priceRange;


so you have one variable less.