More refactoring as precursor to PHP-875: Command cursors.