Code Duplication    Length = 5-5 lines in 2 locations

src/MenuStyle.php 1 location

@@ 155-159 (lines=5) @@
152
        TerminalInterface $terminal = null
153
    ) {
154
        $builder = debug_backtrace();
155
        if (count($builder) < 2 || !isset($builder[1]['class']) || $builder[1]['class'] !== $this->allowedConsumer) {
156
            throw new InvalidInstantiationException(
157
                sprintf('The CliMenu must be instantiated by "%s"', $this->allowedConsumer)
158
            );
159
        }
160
161
        $this->terminal        = $terminal ?: TerminalFactory::fromSystem();
162
        $this->bg              = $bg;

src/CliMenu.php 1 location

@@ 77-81 (lines=5) @@
74
        MenuStyle $style = null
75
    ) {
76
        $builder = debug_backtrace();
77
        if (count($builder) < 2 || !isset($builder[1]['class']) || $builder[1]['class'] !== $this->allowedConsumer) {
78
            throw new InvalidInstantiationException(
79
                sprintf('The CliMenu must be instantiated by "%s"', $this->allowedConsumer)
80
            );
81
        }
82
83
        $this->title      = $title;
84
        $this->items      = $items;