jsonFileToArray() public method

Grabs a json file and returns a array
public jsonFileToArray ( string $path ) : array
$path string The path to the json file
return array The parsed array
 /**
  * Test jsonFileToArray()
  *
  * @return array $jsonArray
  */
 public function testJsonFileToArray()
 {
     // Execute method
     $jsonArray = $this->makeMigrationJson->jsonFileToArray($this->jsonFilePath);
     // Make sure contents are of type array
     $this->assertTrue(is_array($jsonArray), 'json file contents do not return an array');
     // Return json array for more testing
     return $jsonArray;
 }
 /**
  * Validate the json file and console report any issues
  *
  * @return void
  */
 protected function validate()
 {
     // Get json array from file
     $jsonArray = $this->makeMigrationJson->jsonFileToArray($this->filePath);
     // Check for invalid json
     if ($jsonArray === null) {
         // Display error message
         $this->error('Invalid JSON detected: Check that your json file does not contain invalid syntax: ' . $this->filePath);
         // End further execution
         return;
     }
     // Check for data existence
     if (empty($jsonArray)) {
         // Display error message
         $this->error('No data found in json file: It seems you have no data in: ' . $this->filePath);
         // End further execution
         return;
     }
     // Validate
     $errors = $this->makeMigrationJson->validateSchema($jsonArray);
     // If no errors where found
     if (empty($errors)) {
         // Display confirmation message
         $this->info('No validation errors where found, congrats!');
         // End further execution
         return;
     }
     // Report results
     foreach ($errors as $tableName => $fields) {
         // For every field
         foreach ($fields as $fieldName => $fieldProperties) {
             // For every field property
             foreach ($fieldProperties as $property) {
                 // Show error
                 $this->error($property);
                 // Show json reference
                 $this->error("In section: " . json_encode([$tableName => [$fieldName => $jsonArray[$tableName][$fieldName]]], JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
             }
         }
     }
 }