src/Phinx/Db/Action/AddIndex.php
public static function build(Table $table, $columns, array $options = [])
    {
        // create a new index object if strings or an array of strings were supplied
        $index = $columns;

        if (!$columns instanceof Index) {
            $index = new Index();

            if (is_string($columns)) {
                $columns = [$columns]; // str to array
            }

            $index->setColumns($columns);
            $index->setOptions($options);
        }

        return new static($table, $index);
    }
public static function build(Table $table, $columns, array $options = [])
    {
        // create a new index object if strings or an array of strings were supplied
        $index = $columns;

        if (!$columns instanceof Index) {
            $index = new Index();

            if (is_string($columns)) {
                $columns = [$columns]; // str to array
            }

            $index->setColumns($columns);
            $index->setOptions($options);
        }

        return new static($table, $index);
    }
public static function build ( Table $ table , $ columns , array $ options = [ ] ) { // create a new index object if strings or an array of strings were supplied $ index = $ columns ; if ( ! $ columns instanceof Index ) { $ index = new Index ( ) ; if ( is_string ( $ columns ) ) { $ columns = [ $ columns ] ; // str to array } $ index -> setColumns ( $ columns ) ; $ index -> setOptions ( $ options ) ; } return new static ( $ table , $ index ) ; }
Creates a new AddIndex object after building the index object with the
provided arguments

@param Table $table The table to add the index to
@param mixed $columns The columns to index
@param array $options Additional options for the index creation
@return AddIndex
Creates a new AddIndex object after building the index object with the provided arguments