parseSchema() public method

Parses the schema from the json array into a readable format laravel generators extended understand
public parseSchema ( array $data, array $only = [] ) : array
$data array The array containing the json output from file
$only array (optional) array containing specific table/migration names to retrieve from the json file
return array The finished parsed schema for use with generators extended
 /**
  * Make the json migration
  *
  * @return void
  */
 protected function makeJsonMigration()
 {
     // Set start time of file generation
     $this->startTime = time();
     // Get json array from file
     $jsonArray = $this->makeMigrationJson->jsonFileToArray($this->filePath);
     // Parse only option
     $only = [];
     if (!empty($this->option('only'))) {
         $only = explode(',', $this->option('only'));
         $only = array_map('trim', $only);
     }
     // Parse json and get schema
     $schema = $this->makeMigrationJson->parseSchema($jsonArray, $only);
     // For every migration in the schema
     foreach ($schema as $migrationName => $fieldSchema) {
         // Check if this migration is a pivot table
         if (substr($migrationName, -6) === '_pivot') {
             // Get tables
             $tables = explode(' ', $fieldSchema, 3);
             // Invoke the extended generator command for pivot tables
             $this->call('make:migration:pivot', ['tableOne' => $tables[0], 'tableTwo' => $tables[1]]);
             // Go to next migration
             continue 1;
         }
         // Invoke the extended generator command
         $this->call('make:migration:schema', ['name' => $migrationName, '--schema' => $fieldSchema]);
         // wait 1 second in-between schemas to run the insequence later with "php artisan migrate"
         sleep(1);
     }
     // $this->info(var_export($schema, true));
 }
 /**
  * Test parseSchema() with $only parameter
  *
  * @return void
  */
 public function testParseSchemaWithOnlyParameter()
 {
     // Set json array
     $jsonArray = ['dogs' => ['field1' => 'schema1'], 'cats' => ['field1' => 'schema1'], 'birds' => ['field1' => 'schema1']];
     // Set only array
     $only = ['cats', 'birds'];
     // Execute method
     $results = $this->makeMigrationJson->parseSchema($jsonArray, $only);
     // Expected results
     $expected = ['create_cats_table' => 'field1:schema1', 'create_birds_table' => 'field1:schema1'];
     // We should only get back cats and birds
     $this->assertEquals($results, $expected);
 }