getInputFiles() as $boxedName => $file ) { if ( $file instanceof InputFileFromUrl ) { $filesToDownload[$boxedName] = $file; } } if ( $filesToDownload ) { $this->downloadFiles( $filesToDownload ); } } protected function collectOutputFiles( BoxedCommand $command, BoxedResult $result ) { if ( !( $result instanceof ServerBoxedResult ) ) { throw new ShellboxError( "Unexpected result class" ); } $generatedFilesNames = []; $filesToUpload = []; foreach ( $this->findOutputFiles( $command, $result ) as $boxedName => $file ) { if ( $file instanceof OutputFileToUrl ) { $filesToUpload[$boxedName] = $file; } $generatedFilesNames[] = $boxedName; } if ( $filesToUpload ) { $this->uploadFiles( $filesToUpload ); } $sentFileNames = array_diff( $generatedFilesNames, array_keys( $filesToUpload ) ); $result->setFileNames( $generatedFilesNames, $sentFileNames ); } protected function cleanup() { } }