protected function checkPositions(InputInterface $input, OutputInterface $output, &$isAbsolute = false)
    {
        $isRelative = false;
        foreach (array_count_values($this->positionsList) as $value => $count) {
            if (\is_int($value) && $value[0] !== '+' && $value[0] !== '-') {
                $isAbsolute = true;

                if ($count > 1) {
                    throw new \InvalidArgumentException('Two (or more) absolute positions are identical.');
                }
            } else {
                $isRelative = true;
            }
        }

        if ($isAbsolute && $isRelative) {
            /** @var FormatterHelper $formatter */
            $formatter = $this->getHelper('formatter');
            $formattedBlock = $formatter->formatBlock(
                'Mix absolute and relative positions may produce unexpected results !',
                'bg=yellow;fg=black',
                true
            );
            $output->writeln($formattedBlock);

            /** @var QuestionHelper $helper */
            $helper = $this->getHelper('question');

            $question = new ConfirmationQuestion('<question>Do you want to continue ? y/[n]<question>', false);

            return $helper->ask($input, $output, $question);
        }

        return true;
    }
protected function checkPositions(InputInterface $input, OutputInterface $output, &$isAbsolute = false)
    {
        $isRelative = false;
        foreach (array_count_values($this->positionsList) as $value => $count) {
            if (\is_int($value) && $value[0] !== '+' && $value[0] !== '-') {
                $isAbsolute = true;

                if ($count > 1) {
                    throw new \InvalidArgumentException('Two (or more) absolute positions are identical.');
                }
            } else {
                $isRelative = true;
            }
        }

        if ($isAbsolute && $isRelative) {
            /** @var FormatterHelper $formatter */
            $formatter = $this->getHelper('formatter');
            $formattedBlock = $formatter->formatBlock(
                'Mix absolute and relative positions may produce unexpected results !',
                'bg=yellow;fg=black',
                true
            );
            $output->writeln($formattedBlock);

            /** @var QuestionHelper $helper */
            $helper = $this->getHelper('question');

            $question = new ConfirmationQuestion('<question>Do you want to continue ? y/[n]<question>', false);

            return $helper->ask($input, $output, $question);
        }

        return true;
    }
protected function checkPositions ( InputInterface $ input , OutputInterface $ output , & $ isAbsolute = false ) { $ isRelative = false ; foreach ( array_count_values ( $ this -> positionsList ) as $ value => $ count ) { if ( \ is_int ( $ value ) && $ value [ 0 ] !== '+' && $ value [ 0 ] !== '-' ) { $ isAbsolute = true ; if ( $ count > 1 ) { throw new \ InvalidArgumentException ( 'Two (or more) absolute positions are identical.' ) ; } } else { $ isRelative = true ; } } if ( $ isAbsolute && $ isRelative ) { /** @var FormatterHelper $formatter */ $ formatter = $ this -> getHelper ( 'formatter' ) ; $ formattedBlock = $ formatter -> formatBlock ( 'Mix absolute and relative positions may produce unexpected results !' , 'bg=yellow;fg=black' , true ) ; $ output -> writeln ( $ formattedBlock ) ; /** @var QuestionHelper $helper */ $ helper = $ this -> getHelper ( 'question' ) ; $ question = new ConfirmationQuestion ( '<question>Do you want to continue ? y/[n]<question>' , false ) ; return $ helper -> ask ( $ input , $ output , $ question ) ; } return true ; }
Check positions consistency

@param InputInterface $input     An InputInterface instance
@param OutputInterface $output     An OutputInterface instance
@param bool            $isAbsolute Set to true or false according to position values

@throws \InvalidArgumentException

@return bool Continue or stop command
Check positions consistency