PhpCsFixer\Fixer\Whitespace\NoExtraConsecutiveBlankLinesFixer::configure PHP Метод

configure() публичный Метод

Valid configuration options are: - 'break' remove blank lines after a line with a 'break' statement - 'continue' remove blank lines after a line with a 'continue' statement - 'extra' [default] consecutive blank lines are squashed into one - 'return' remove blank lines after a line with a 'return' statement - 'throw' remove blank lines after a line with a 'throw' statement - 'use' remove blank lines between 'use' import statements - 'useTrait' remove blank lines between 'use' trait statements - 'curly_brace_block' remove blank lines after a curly opening block brace ('{') and/or end block brace ('}') - 'parenthesis_brace_block' remove blank lines after a parenthesis opening block brace ('(') and/or end block brace (')') - 'square_brace_block' remove blank lines after a square opening block brace ('[') and/or end block brace (']')
public configure ( array $configuration = null )
$configuration array
    public function configure(array $configuration = null)
    {
        if (null === $configuration) {
            $this->tokenKindCallbackMap = self::$defaultTokenKindCallbackMap;
            $this->tokenEqualsMap = self::$defaultTokenEqualsMap;
            return;
        }
        $this->tokenKindCallbackMap = array();
        $this->tokenEqualsMap = array();
        foreach ($configuration as $item) {
            switch ($item) {
                case 'break':
                    $this->tokenKindCallbackMap[T_BREAK] = 'fixAfterToken';
                    break;
                case 'continue':
                    $this->tokenKindCallbackMap[T_CONTINUE] = 'fixAfterToken';
                    break;
                case 'extra':
                    $this->tokenKindCallbackMap[T_WHITESPACE] = 'removeMultipleBlankLines';
                    break;
                case 'return':
                    $this->tokenKindCallbackMap[T_RETURN] = 'fixAfterToken';
                    break;
                case 'throw':
                    $this->tokenKindCallbackMap[T_THROW] = 'fixAfterToken';
                    break;
                case 'use':
                    $this->tokenKindCallbackMap[T_USE] = 'removeBetweenUse';
                    break;
                case 'useTrait':
                    $this->tokenKindCallbackMap[CT::T_USE_TRAIT] = 'removeBetweenUse';
                    break;
                case 'curly_brace_block':
                    $this->tokenEqualsMap['{'] = 'fixStructureOpenCloseIfMultiLine';
                    // i.e. not: CT::T_ARRAY_INDEX_CURLY_BRACE_OPEN
                    break;
                case 'parenthesis_brace_block':
                    $this->tokenEqualsMap['('] = 'fixStructureOpenCloseIfMultiLine';
                    // i.e. not: CT::T_BRACE_CLASS_INSTANTIATION_OPEN
                    break;
                case 'square_brace_block':
                    $this->tokenKindCallbackMap[CT::T_ARRAY_SQUARE_BRACE_OPEN] = 'fixStructureOpenCloseIfMultiLine';
                    // typeless '[' tokens should not be fixed (too rare)
                    break;
                default:
                    throw new InvalidFixerConfigurationException($this->getName(), sprintf('Unknown configuration item "%s" passed.', $item));
            }
        }
    }