Code Duplication    Length = 5-5 lines in 2 locations

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;

src/MenuStyle.php 1 location

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