src/MikeFunk/BustersPhp/BustersPhp.php
protected function checkAndGetBusters()
    {
        // if no bustersJson, exception
        if ($this->fileSystem->fileExists($this->config['bustersJsonPath']) === false) {
            throw new LengthException('busters json not found.');
        }

        // get busters json and decode it
        $bustersJson = $this->fileSystem->getFile($this->config['bustersJsonPath']);
        if ($bustersJson == '') {
            throw new UnderflowException('busters json is empty.');
        }
        $busters = json_decode($bustersJson);

        // is it valid json?
        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new UnexpectedValueException('bustersJson is invalid JSON.');
        }

        return $busters;
    }
protected function checkAndGetBusters()
    {
        // if no bustersJson, exception
        if ($this->fileSystem->fileExists($this->config['bustersJsonPath']) === false) {
            throw new LengthException('busters json not found.');
        }

        // get busters json and decode it
        $bustersJson = $this->fileSystem->getFile($this->config['bustersJsonPath']);
        if ($bustersJson == '') {
            throw new UnderflowException('busters json is empty.');
        }
        $busters = json_decode($bustersJson);

        // is it valid json?
        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new UnexpectedValueException('bustersJson is invalid JSON.');
        }

        return $busters;
    }
protected function checkAndGetBusters ( ) { // if no bustersJson, exception if ( $ this -> fileSystem -> fileExists ( $ this -> config [ 'bustersJsonPath' ] ) === false ) { throw new LengthException ( 'busters json not found.' ) ; } // get busters json and decode it $ bustersJson = $ this -> fileSystem -> getFile ( $ this -> config [ 'bustersJsonPath' ] ) ; if ( $ bustersJson == '' ) { throw new UnderflowException ( 'busters json is empty.' ) ; } $ busters = json_decode ( $ bustersJson ) ; // is it valid json? if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new UnexpectedValueException ( 'bustersJson is invalid JSON.' ) ; } return $ busters ; }
Check for errors in busters.json

@throws LengthException          if the busters.json file is not found
@throws UnderflowException       if the busters.json file contents are empty
@throws UnexpectedValueException if the busters.json has text but is not
@return array                    the parsed json in busters.json
Check for errors in busters . json