$lines = explode( "\n", $this->msg );
foreach ( $lines as $line ) {
- if ( strpos( $line, '*' ) !== 0 )
+ if ( strpos( $line, '*' ) !== 0 ) {
continue;
- else {
+ } else {
list( $level, $line ) = $this->trimStars( $line );
if ( strpos( $line, '|' ) !== false ) {
$obj = new License( $line );
$this->stackItem( $this->licenses, $levels, $obj );
} else {
- if ( $level < count( $levels ) )
+ if ( $level < count( $levels ) ) {
$levels = array_slice( $levels, 0, $level );
- if ( $level == count( $levels ) )
+ }
+ if ( $level == count( $levels ) ) {
$levels[$level - 1] = $line;
- else if ( $level > count( $levels ) )
+ } elseif ( $level > count( $levels ) ) {
$levels[] = $line;
+ }
}
}
- }
+ } // end foreach
}
function trimStars( $str ) {
* is one.
*/
function matchVariableStartToEnd( $text ) {
+ $matches = array();
$matchcount = preg_match( $this->getVariableStartToEndRegex(), $text, $matches );
if ( $matchcount == 0 ) {
return NULL;
* Input word must contain $1
*/
function substituteCallback( $text, $callback ) {
- $regex = $this->getVariableRegex();
$res = preg_replace_callback( $this->getVariableRegex(), $callback, $text );
$this->mModified = !($res === $text);
return $res;