function resolve($content) { $output = ""; $rows = explode("\n", $content); $casesCount = array_shift($rows); for ($i = 1; $i <= $casesCount; $i++) { $output .= method1($rows, $i); } return trim($output); }
function resolve($content) { $output = ""; $rows = explode("\n", trim($content)); $casesCount = array_shift($rows); for ($i = 1; $i <= $casesCount; $i++) { $count = array_shift($rows); $x = explode(' ', array_shift($rows)); $y = explode(' ', array_shift($rows)); $output .= "Case #{$i}: " . method1($x, $y) . "\n"; } return trim($output); }
function resolve($content) { $output = ""; $rows = explode("\n", trim($content)); $casesCount = array_shift($rows); $vocabulary = method1(); foreach ($rows as $key => $value) { $output .= "Case #" . ($key + 1) . ": "; for ($i = 0; $i < strlen($value); $i++) { if (isset($prevDigit) && $vocabulary[$value[$i]]['digit'] == $prevDigit) { $output .= " "; } $prevDigit = $vocabulary[$value[$i]]['digit']; $output .= $vocabulary[$value[$i]]['value']; } $output .= "\n"; } return trim($output); }
<?php $x = new class1(); new class1(); // Noncompliant new class1() . method1(); $x; class1();