Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IUserInteraction interface #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Command/Analyze.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use HalloWelt\MediaWiki\Lib\Migration\DataBuckets;
use HalloWelt\MediaWiki\Lib\Migration\IAnalyzer;
use HalloWelt\MediaWiki\Lib\Migration\IOutputAwareInterface;
use HalloWelt\MediaWiki\Lib\Migration\IUserInteraction;

class Analyze extends CliCommandBase {

Expand Down Expand Up @@ -56,6 +57,11 @@ protected function doProcessFile(): bool {
if ( $analyzer instanceof IOutputAwareInterface ) {
$analyzer->setOutput( $this->output );
}
if ( $analyzer instanceof IUserInteraction ) {
$analyzer->setQuestionHelper( $this->getHelper( 'question' ) );
$analyzer->setOutput( $this->output );
$analyzer->setInput( $this->input );
}
$result = $analyzer->analyze( $this->currentFile );
// TODO: Evaluate result
}
Expand Down
28 changes: 28 additions & 0 deletions src/IUserInteraction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace HalloWelt\MediaWiki\Lib\Migration;

use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\Input;
use Symfony\Component\Console\Output\Output;

interface IUserInteraction {

/**
* @param QuestionHelper $questionHelper
* @return void
*/
public function setQuestionHelper( QuestionHelper $questionHelper );

/**
* @param Input $input
* @return void
*/
public function setInput( Input $input );

/**
* @param Output $output
* @return void
*/
public function setOutput( Output $output );
}