src/Resolvers/PatchesFile.php
protected function readPatchesFile($patches_file)
    {
        $patches = file_get_contents($patches_file);
        $patches = json_decode($patches, true);

        // First, check for JSON syntax issues.
        $json_error = json_last_error_msg();
        if ($json_error !== "No error") {
            throw new \InvalidArgumentException($json_error);
        }

        // Next, make sure there is a patches key in the file.
        if (!array_key_exists('patches', $patches)) {
            throw new \InvalidArgumentException('No patches found.');
        }

        // If nothing is wrong at this point, we can return the list of patches.
        return $patches['patches'];
    }
protected function readPatchesFile($patches_file)
    {
        $patches = file_get_contents($patches_file);
        $patches = json_decode($patches, true);

        // First, check for JSON syntax issues.
        $json_error = json_last_error_msg();
        if ($json_error !== "No error") {
            throw new \InvalidArgumentException($json_error);
        }

        // Next, make sure there is a patches key in the file.
        if (!array_key_exists('patches', $patches)) {
            throw new \InvalidArgumentException('No patches found.');
        }

        // If nothing is wrong at this point, we can return the list of patches.
        return $patches['patches'];
    }
protected function readPatchesFile ( $ patches_file ) { $ patches = file_get_contents ( $ patches_file ) ; $ patches = json_decode ( $ patches , true ) ; // First, check for JSON syntax issues. $ json_error = json_last_error_msg ( ) ; if ( $ json_error !== "No error" ) { throw new \ InvalidArgumentException ( $ json_error ) ; } // Next, make sure there is a patches key in the file. if ( ! array_key_exists ( 'patches' , $ patches ) ) { throw new \ InvalidArgumentException ( 'No patches found.' ) ; } // If nothing is wrong at this point, we can return the list of patches. return $ patches [ 'patches' ] ; }
Read a patches file.

@param $patches_file
A URI to a file. Can be anything accepted by file_get_contents().
@return array
A list of patches.
@throws \InvalidArgumentException
Read a patches file .