ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ILIAS\Setup\CLI\IOWrapper Class Reference

Wrapper around symfonies input and output facilities to provide just the functionality required for the ILIAS-setup. More...

+ Inheritance diagram for ILIAS\Setup\CLI\IOWrapper:
+ Collaboration diagram for ILIAS\Setup\CLI\IOWrapper:

Public Member Functions

 __construct (InputInterface $in, OutputInterface $out, bool $say_yes=false)
 
 inform (string $message)
 
 confirmOrDeny (string $message)
 
 title (string $title)
 
 success (string $text)
 
 error (string $text)
 
 text (string $text)
 
 startObjective (string $label, bool $is_notable)
 
 finishedLastObjective ()
 
 failedLastObjective ()
 

Data Fields

const LABEL_WIDTH = 75
 
const ELLIPSIS = "..."
 

Protected Member Functions

 outputInObjective ()
 
 showLastObjectiveLabel ()
 

Protected Attributes

 $in
 
 $out
 
 $say_yes
 
 $style
 
 $last_objective_was_notable = false
 
 $last_objective_label = ""
 
 $output_in_objective = false
 

Detailed Description

Wrapper around symfonies input and output facilities to provide just the functionality required for the ILIAS-setup.

Definition at line 16 of file IOWrapper.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Setup\CLI\IOWrapper::__construct ( InputInterface  $in,
OutputInterface  $out,
bool  $say_yes = false 
)

Definition at line 57 of file IOWrapper.php.

References ILIAS\Setup\CLI\IOWrapper\$in, ILIAS\Setup\CLI\IOWrapper\$out, and ILIAS\Setup\CLI\IOWrapper\$say_yes.

58  {
59  $this->in = $in;
60  $this->out = $out;
61  $this->style = new SymfonyStyle($in, $out);
62  $this->say_yes = $say_yes;
63  }

Member Function Documentation

◆ confirmOrDeny()

ILIAS\Setup\CLI\IOWrapper::confirmOrDeny ( string  $message)

Implements ILIAS\Setup\AdminInteraction.

Definition at line 73 of file IOWrapper.php.

References ILIAS\Setup\CLI\IOWrapper\inform(), and ILIAS\Setup\CLI\IOWrapper\outputInObjective().

73  : bool
74  {
75  $this->outputInObjective();
76  if (!$this->say_yes) {
77  return $this->style->confirm($message, false);
78  } else {
79  $this->inform("Automatically confirmed:\n\n$message");
80  return true;
81  }
82  }
$message
Definition: xapiexit.php:14
inform(string $message)
Definition: IOWrapper.php:67
+ Here is the call graph for this function:

◆ error()

ILIAS\Setup\CLI\IOWrapper::error ( string  $text)

Definition at line 96 of file IOWrapper.php.

96  : void
97  {
98  $this->style->error($text);
99  }

◆ failedLastObjective()

ILIAS\Setup\CLI\IOWrapper::failedLastObjective ( )

Definition at line 127 of file IOWrapper.php.

References ILIAS\Setup\CLI\IOWrapper\showLastObjectiveLabel(), and ILIAS\Setup\CLI\IOWrapper\startObjective().

128  {
129  // Always show label of failed objectives.
130  if ($this->output_in_objective || !$this->last_objective_was_notable) {
131  $this->startObjective($this->last_objective_label, true);
132  }
133 
134  if ($this->showLastObjectiveLabel()) {
135  $this->style->write("[<fg=red>FAILED</>]\n");
136  }
137  }
startObjective(string $label, bool $is_notable)
Definition: IOWrapper.php:106
+ Here is the call graph for this function:

◆ finishedLastObjective()

ILIAS\Setup\CLI\IOWrapper::finishedLastObjective ( )

Definition at line 116 of file IOWrapper.php.

References ILIAS\Setup\CLI\IOWrapper\showLastObjectiveLabel(), and ILIAS\Setup\CLI\IOWrapper\startObjective().

117  {
118  if ($this->output_in_objective) {
119  $this->startObjective($this->last_objective_label, $this->last_objective_was_notable);
120  }
121 
122  if ($this->showLastObjectiveLabel()) {
123  $this->style->write("[<fg=green>OK</>]\n");
124  }
125  }
startObjective(string $label, bool $is_notable)
Definition: IOWrapper.php:106
+ Here is the call graph for this function:

◆ inform()

ILIAS\Setup\CLI\IOWrapper::inform ( string  $message)

Implements ILIAS\Setup\AdminInteraction.

Definition at line 67 of file IOWrapper.php.

References ILIAS\Setup\CLI\IOWrapper\outputInObjective().

Referenced by ILIAS\Setup\CLI\IOWrapper\confirmOrDeny().

67  : void
68  {
69  $this->outputInObjective();
70  $this->style->note($message);
71  }
$message
Definition: xapiexit.php:14
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ outputInObjective()

ILIAS\Setup\CLI\IOWrapper::outputInObjective ( )
protected

Definition at line 139 of file IOWrapper.php.

References ILIAS\Setup\CLI\IOWrapper\showLastObjectiveLabel().

Referenced by ILIAS\Setup\CLI\IOWrapper\confirmOrDeny(), and ILIAS\Setup\CLI\IOWrapper\inform().

139  : void
140  {
141  if (!$this->output_in_objective && $this->showLastObjectiveLabel()) {
142  $this->output_in_objective = true;
143  $this->style->write("[in progress]\n");
144  }
145  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showLastObjectiveLabel()

ILIAS\Setup\CLI\IOWrapper::showLastObjectiveLabel ( )
protected

Definition at line 147 of file IOWrapper.php.

Referenced by ILIAS\Setup\CLI\IOWrapper\failedLastObjective(), ILIAS\Setup\CLI\IOWrapper\finishedLastObjective(), ILIAS\Setup\CLI\IOWrapper\outputInObjective(), and ILIAS\Setup\CLI\IOWrapper\startObjective().

148  {
149  return $this->last_objective_was_notable
150  || $this->out->isVeryVerbose()
151  || $this->out->isDebug();
152  }
+ Here is the caller graph for this function:

◆ startObjective()

ILIAS\Setup\CLI\IOWrapper::startObjective ( string  $label,
bool  $is_notable 
)

Definition at line 106 of file IOWrapper.php.

References ILIAS\Setup\CLI\IOWrapper\showLastObjectiveLabel().

Referenced by ILIAS\Setup\CLI\IOWrapper\failedLastObjective(), and ILIAS\Setup\CLI\IOWrapper\finishedLastObjective().

107  {
108  $this->last_objective_was_notable = $is_notable;
109  $this->last_objective_label = $label;
110  $this->output_in_objective = false;
111  if ($this->showLastObjectiveLabel()) {
112  $this->style->write(str_pad($label . "...", self::LABEL_WIDTH));
113  }
114  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ success()

ILIAS\Setup\CLI\IOWrapper::success ( string  $text)

Definition at line 91 of file IOWrapper.php.

Referenced by ILIAS\Setup\CLI\BuildArtifactsCommand\printOutroMessage(), ILIAS\Setup\CLI\ReloadControlStructureCommand\printOutroMessage(), ILIAS\Setup\CLI\InstallCommand\printOutroMessage(), and ILIAS\Setup\CLI\UpdateCommand\printOutroMessage().

91  : void
92  {
93  $this->style->success($text);
94  }
+ Here is the caller graph for this function:

◆ text()

ILIAS\Setup\CLI\IOWrapper::text ( string  $text)

Definition at line 101 of file IOWrapper.php.

Referenced by ILIAS\Setup\CLI\BaseCommand\printLicenseMessage().

101  : void
102  {
103  $this->style->text($text);
104  }
+ Here is the caller graph for this function:

◆ title()

ILIAS\Setup\CLI\IOWrapper::title ( string  $title)

Definition at line 86 of file IOWrapper.php.

Referenced by ILIAS\Setup\CLI\BuildArtifactsCommand\printIntroMessage(), ILIAS\Setup\CLI\ReloadControlStructureCommand\printIntroMessage(), ILIAS\Setup\CLI\InstallCommand\printIntroMessage(), and ILIAS\Setup\CLI\UpdateCommand\printIntroMessage().

86  : void
87  {
88  $this->style->title($title);
89  }
+ Here is the caller graph for this function:

Field Documentation

◆ $in

ILIAS\Setup\CLI\IOWrapper::$in
protected

Definition at line 24 of file IOWrapper.php.

Referenced by ILIAS\Setup\CLI\IOWrapper\__construct().

◆ $last_objective_label

ILIAS\Setup\CLI\IOWrapper::$last_objective_label = ""
protected

Definition at line 50 of file IOWrapper.php.

◆ $last_objective_was_notable

ILIAS\Setup\CLI\IOWrapper::$last_objective_was_notable = false
protected

Definition at line 45 of file IOWrapper.php.

◆ $out

ILIAS\Setup\CLI\IOWrapper::$out
protected

Definition at line 29 of file IOWrapper.php.

Referenced by ILIAS\Setup\CLI\IOWrapper\__construct().

◆ $output_in_objective

ILIAS\Setup\CLI\IOWrapper::$output_in_objective = false
protected

Definition at line 55 of file IOWrapper.php.

◆ $say_yes

ILIAS\Setup\CLI\IOWrapper::$say_yes
protected

Definition at line 34 of file IOWrapper.php.

Referenced by ILIAS\Setup\CLI\IOWrapper\__construct().

◆ $style

ILIAS\Setup\CLI\IOWrapper::$style
protected

Definition at line 40 of file IOWrapper.php.

◆ ELLIPSIS

const ILIAS\Setup\CLI\IOWrapper::ELLIPSIS = "..."

Definition at line 19 of file IOWrapper.php.

◆ LABEL_WIDTH

const ILIAS\Setup\CLI\IOWrapper::LABEL_WIDTH = 75

Definition at line 18 of file IOWrapper.php.


The documentation for this class was generated from the following file: