src/Kunstmaan/AdminBundle/Helper/VersionCheck/VersionChecker.php
protected function getPackages()
    {
        $translator = $this->container->get('translator');
        $errorMessage = $translator->trans('settings.version.error_parsing_composer');

        $composerPath = $this->getLockPath();
        if (!file_exists($composerPath)) {
            throw new ParseException(
                $translator->trans('settings.version.composer_lock_not_found')
            );
        }

        $json = file_get_contents($composerPath);
        $result = json_decode($json, true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new ParseException($errorMessage.' (#'.json_last_error().')');
        }

        if (array_key_exists('packages', $result) && is_array($result['packages'])) {
            return $result['packages'];
        }

        // No package list in JSON structure
        throw new ParseException($errorMessage);
    }
protected function getPackages()
    {
        $translator = $this->container->get('translator');
        $errorMessage = $translator->trans('settings.version.error_parsing_composer');

        $composerPath = $this->getLockPath();
        if (!file_exists($composerPath)) {
            throw new ParseException(
                $translator->trans('settings.version.composer_lock_not_found')
            );
        }

        $json = file_get_contents($composerPath);
        $result = json_decode($json, true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new ParseException($errorMessage.' (#'.json_last_error().')');
        }

        if (array_key_exists('packages', $result) && is_array($result['packages'])) {
            return $result['packages'];
        }

        // No package list in JSON structure
        throw new ParseException($errorMessage);
    }
protected function getPackages ( ) { $ translator = $ this -> container -> get ( 'translator' ) ; $ errorMessage = $ translator -> trans ( 'settings.version.error_parsing_composer' ) ; $ composerPath = $ this -> getLockPath ( ) ; if ( ! file_exists ( $ composerPath ) ) { throw new ParseException ( $ translator -> trans ( 'settings.version.composer_lock_not_found' ) ) ; } $ json = file_get_contents ( $ composerPath ) ; $ result = json_decode ( $ json , true ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new ParseException ( $ errorMessage . ' (#' . json_last_error ( ) . ')' ) ; } if ( array_key_exists ( 'packages' , $ result ) && is_array ( $ result [ 'packages' ] ) ) { return $ result [ 'packages' ] ; } // No package list in JSON structure throw new ParseException ( $ errorMessage ) ; }
Returns a list of composer packages.

@return array

@throws ParseException
Returns a list of composer packages .