src/Way/Generators/Parsers/MigrationNameParser.php
protected function getTableName(array $pieces)
    {
        $tableName = [];

        // This is deceptively complex, because
        // there are a number of ways to write
        // these migration names. We'll work backwards
        // to figure out the name.
        foreach(array_reverse($pieces) as $piece)
        {
            // Once we get to a connecting word (if any), this
            // will signal the end of our search. So, for
            // add_name_to_archived_lessons, "archived_lessons"
            // would be the table name
            if (in_array($piece, ['to', 'for', 'on', 'from', 'into'])) break;

            $tableName[] = $piece;
        }

        // We can't forget to reverse it back again!
        return implode('_', array_reverse($tableName));
    }
protected function getTableName(array $pieces)
    {
        $tableName = [];

        // This is deceptively complex, because
        // there are a number of ways to write
        // these migration names. We'll work backwards
        // to figure out the name.
        foreach(array_reverse($pieces) as $piece)
        {
            // Once we get to a connecting word (if any), this
            // will signal the end of our search. So, for
            // add_name_to_archived_lessons, "archived_lessons"
            // would be the table name
            if (in_array($piece, ['to', 'for', 'on', 'from', 'into'])) break;

            $tableName[] = $piece;
        }

        // We can't forget to reverse it back again!
        return implode('_', array_reverse($tableName));
    }
protected function getTableName ( array $ pieces ) { $ tableName = [ ] ; // This is deceptively complex, because // there are a number of ways to write // these migration names. We'll work backwards // to figure out the name. foreach ( array_reverse ( $ pieces ) as $ piece ) { // Once we get to a connecting word (if any), this // will signal the end of our search. So, for // add_name_to_archived_lessons, "archived_lessons" // would be the table name if ( in_array ( $ piece , [ 'to' , 'for' , 'on' , 'from' , 'into' ] ) ) break ; $ tableName [ ] = $ piece ; } // We can't forget to reverse it back again! return implode ( '_' , array_reverse ( $ tableName ) ) ; }
Determine what the table name should be

@param array $pieces
@return string
Determine what the table name should be