You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a very large csv file. So I don't need to have a full parsing on my local-machine and want to exit after 2000 rows. I'm using throwing exception for now like this:
$interpreter->addObserver(function (array $row) use (&$i, &$captions) {
// todo remove it for non-local server
if ($i > 2000) {
throw new StrictViolationException('Cant exit with another way', 100);
/* return / return false don't work -
* it still continues and I don't need exit() function
*/
}
$i++;
//do smth...
});
try {
$lexer->parse($file, $interpreter);
} catch (StrictViolationException $e) {
// we'll be here
}
print_r("script continues and that's great");
So what's the best way to go out from observer?
The text was updated successfully, but these errors were encountered:
I have a very large csv file. So I don't need to have a full parsing on my local-machine and want to exit after 2000 rows. I'm using throwing exception for now like this:
So what's the best way to go out from observer?
The text was updated successfully, but these errors were encountered: