fixed location
This commit is contained in:
parent
5dae2ef258
commit
62cb7facea
|
@ -70,7 +70,7 @@
|
|||
}
|
||||
|
||||
/* (5) Manage if empty */
|
||||
if( count($lines) < 2 )
|
||||
if( count($lines) < 3 )
|
||||
throw new \Exception("Nothing read");
|
||||
|
||||
}
|
||||
|
@ -83,10 +83,10 @@
|
|||
$title = $lines[0];
|
||||
|
||||
/* (2) Get last non-empty line */
|
||||
for( $i = count($lines)-1 ; $i > 0 ; $i-- ){
|
||||
for( $i = 2 ; $i < count($lines) ; $i++ ){
|
||||
|
||||
// Amphi ... //
|
||||
if( preg_match('@^a[nm]([bp][hln])?[ir] ?(.+)$@i', $lines[$i], $m) ) // 'amphi A', 'amphi 600 droit'
|
||||
if( preg_match('@^a[nm](?:[bp][hln])?[ir] ?(.+)$@i', $lines[$i], $m) ) // 'amphi A', 'amphi 600 droit'
|
||||
return [ $title, "Amphi ${m[1]}" ];
|
||||
|
||||
|
||||
|
@ -94,12 +94,15 @@
|
|||
if( preg_match('@^[S|5] ?(\d+)@i', $lines[$i], $m) ) // 'S10', 'S22'
|
||||
return [ $title, "S. ${m[1]}" ];
|
||||
|
||||
// If not 'Cours', 'CTD', 'TD', 'TP' //
|
||||
if( preg_match('@^(co[hu][trn][s5]|t[dp|c[mn]|ct[dp])@i', $lines[$i]) )
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return [ $title, null ];
|
||||
return [ $title, $lines[2] ];
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue