getTraceAsString()); // reverse array to make steps line up chronologically $trace = array_reverse($trace); array_shift($trace); // remove {main} // array_pop($trace); // remove call to this method $length = count($trace); $result = []; for ($i = 0; $i < $length; $i++) { $result[] = ($i + 1) . ')' . substr($trace[$i], strpos($trace[$i], ' ')); // replace '#someNum' with '$i)', set the right ordering } return $result; } /** * Единый метод выброса исключения об устаревании метода * * @param string|null $method Наименование метода * * @throws ScException */ public static function throwExceptionOldMethod(?string $method = null) { if (strlen(trim($method)) > 0) { $text = 'Метод ' . $method . ' устарел. Обновите приложение или обратитесь по другому каналу'; } else { $text = 'Метод устарел. Обновите приложение или обратитесь по другому каналу'; } throw new ScException( $text, ScException::ERROR_INPUT_DATA ); } }