for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PhpSchool\CliMenu\MenuItem;
use Assert\Assertion;
use PhpSchool\CliMenu\CliMenu;
/**
* @author Michael Woodward <[email protected]>
*/
class MenuMenuItem implements MenuItemInterface
{
use SelectableTrait;
* @var CliMenu
private $subMenu;
public function __construct(string $text, CliMenu $subMenu, bool $disabled = false)
$this->text = $text;
$this->subMenu = $subMenu;
$this->disabled = $disabled;
}
* Execute the items callable if required
public function getSelectAction() : ?callable
return [$this, 'showSubMenu'];
* Return the raw string of text
public function getText() : string
return $this->text;
* Set the raw string of text
public function setText(string $text) : void
* Returns the sub menu
public function getSubMenu() : CliMenu
return $this->subMenu;
* Display the sub menu
public function showSubMenu(CliMenu $parentMenu) : void
$parentMenu->closeThis();
$this->subMenu->open();