Mojopollo\Schema\MakeMigrationJson::jsonFileToArray PHP Метод

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

Grabs a json file and returns a array
public jsonFileToArray ( string $path ) : array
$path string The path to the json file
Результат array The parsed array
    public function jsonFileToArray($path)
    {
        // Get file contents
        $contents = $this->filesystem->get($path);
        // Return array
        return json_decode($contents, true);
    }

Usage Example

 /**
  * 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;
 }
All Usage Examples Of Mojopollo\Schema\MakeMigrationJson::jsonFileToArray