function coder_trim_php in Coder 7
Same name and namespace in other branches
- 5.2 scripts/coder_format/coder_format.inc \coder_trim_php()
 - 5 scripts/coder_format/coder_format.inc \coder_trim_php()
 - 6.2 scripts/coder_format/coder_format.inc \coder_trim_php()
 - 6 scripts/coder_format/coder_format.inc \coder_trim_php()
 - 7.2 scripts/coder_format/coder_format.inc \coder_trim_php()
 
Trim overall code.
Strips whitespace at the beginning and end of code, removes the closing PHP tag and appends two empty lines.
1 call to coder_trim_php()
- coder_format_string_all in scripts/
coder_format/ coder_format.inc  - Formats source code according to Drupal conventions, also using post and pre-processors.
 
File
- scripts/
coder_format/ coder_format.inc, line 1056  - Coder format helper functions.
 
Code
function coder_trim_php($code) {
  // Remove surrounding whitespace.
  $code = trim($code);
  // Remove closing PHP tag.
  if (substr($code, -2) == '?>') {
    $code = rtrim($code, '?>');
  }
  // Append two empty lines.
  $code .= str_repeat(chr(10), 2);
  return $code;
}