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

Inserts any text before the menu serving as a header. For example, yo… #276

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 7 additions & 0 deletions src/Builder/CliMenuBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@
return $instance;
}

public function setHeader(string $header) : self

Check warning on line 111 in src/Builder/CliMenuBuilder.php

View check run for this annotation

Codecov / codecov/patch

src/Builder/CliMenuBuilder.php#L111

Added line #L111 was not covered by tests
{
$this->menu->setHeader($header);

Check warning on line 113 in src/Builder/CliMenuBuilder.php

View check run for this annotation

Codecov / codecov/patch

src/Builder/CliMenuBuilder.php#L113

Added line #L113 was not covered by tests

return $this;

Check warning on line 115 in src/Builder/CliMenuBuilder.php

View check run for this annotation

Codecov / codecov/patch

src/Builder/CliMenuBuilder.php#L115

Added line #L115 was not covered by tests
}

public function setTitle(string $title) : self
{
$this->menu->setTitle($title);
Expand Down
17 changes: 16 additions & 1 deletion src/CliMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
*/
private $itemStyleLocator;

/**
* @var ?string
*/
protected $header;

/**
* @var ?string
*/
Expand Down Expand Up @@ -143,6 +148,11 @@
}
}

public function setHedader(string $header) : void

Check warning on line 151 in src/CliMenu.php

View check run for this annotation

Codecov / codecov/patch

src/CliMenu.php#L151

Added line #L151 was not covered by tests
{
$this->header = $header;

Check warning on line 153 in src/CliMenu.php

View check run for this annotation

Codecov / codecov/patch

src/CliMenu.php#L153

Added line #L153 was not covered by tests
}

public function setTitle(string $title) : void
{
$this->title = $title;
Expand Down Expand Up @@ -493,7 +503,12 @@
{
$frame = new Frame;

$frame->newLine(2);
if ($this->header) {
$frame -> addRow($this->header);

Check warning on line 507 in src/CliMenu.php

View check run for this annotation

Codecov / codecov/patch

src/CliMenu.php#L507

Added line #L507 was not covered by tests
}
else {
$frame->newLine(2);
}

if ($this->style->getBorderTopWidth() > 0) {
$frame->addRows($this->style->getBorderTopRows());
Expand Down
Loading