private function getNextVersion($path)
    {
        $file = $path.'/composer.json';

        if (!file_exists($file)) {
            return 'Initial commit';
        }

        $json = json_decode(file_get_contents($file));

        if (!isset($json->version)) {
            return 'Initial commit';
        }

        $ver = explode('.', trim($json->version));
        $min = array_pop($ver);
        $ver[] = $min + 1;
        $json->version = implode('.', $ver);
        $size = file_put_contents(
            $file,
            json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
        );

        if (!$size) {
            $this->error("Error to write file '{$file}'.");
        }

        return 'Version '.$json->version;
    }
private function getNextVersion($path)
    {
        $file = $path.'/composer.json';

        if (!file_exists($file)) {
            return 'Initial commit';
        }

        $json = json_decode(file_get_contents($file));

        if (!isset($json->version)) {
            return 'Initial commit';
        }

        $ver = explode('.', trim($json->version));
        $min = array_pop($ver);
        $ver[] = $min + 1;
        $json->version = implode('.', $ver);
        $size = file_put_contents(
            $file,
            json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
        );

        if (!$size) {
            $this->error("Error to write file '{$file}'.");
        }

        return 'Version '.$json->version;
    }
private function getNextVersion ( $ path ) { $ file = $ path . '/composer.json' ; if ( ! file_exists ( $ file ) ) { return 'Initial commit' ; } $ json = json_decode ( file_get_contents ( $ file ) ) ; if ( ! isset ( $ json -> version ) ) { return 'Initial commit' ; } $ ver = explode ( '.' , trim ( $ json -> version ) ) ; $ min = array_pop ( $ ver ) ; $ ver [ ] = $ min + 1 ; $ json -> version = implode ( '.' , $ ver ) ; $ size = file_put_contents ( $ file , json_encode ( $ json , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) ) ; if ( ! $ size ) { $ this -> error ( "Error to write file '{$file}'." ) ; } return 'Version ' . $ json -> version ; }
Get next version number.

@param mixed $path
Get next version number .