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

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