Remove license based on token information

 - [x] Correct license removal logic
 - [x] Remove license text
 - [x] Ensure license removal also removes new lines
 - [x] Ensure opening PHP tag is not suffixed with an unwanted space