Make PHPCI output properly formatted JSON and Yaml files where possible, rather than one-line files.
Closes #547
This commit is contained in:
parent
abfea65c31
commit
6ab7973fd2
3 changed files with 18 additions and 3 deletions
|
|
@ -109,9 +109,19 @@ class PluginController extends \PHPCI\Controller
|
|||
return json_decode($json, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert array to json and save composer.json
|
||||
*
|
||||
* @param $array
|
||||
*/
|
||||
protected function setComposerJson($array)
|
||||
{
|
||||
$json = json_encode($array);
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
$json = json_encode($array, JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
$json = json_encode($array);
|
||||
}
|
||||
|
||||
file_put_contents(APPLICATION_PATH . 'composer.json', $json);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue