public function load()
    {
        $location = $this->location;

        // no location given from commandline -> use config values or fallback to default location
        if (empty($location)) {
            $location = $this->parameters->get(
                'read_location',
                $this->parameters->get(
                    'location',
                    $this->getDefaultLocation()
                )
            );
        }

        $this->location = $location;

        if (!is_readable($location) || !is_file($location)) {
            return false;
        }

        $content = file_get_contents($location);

        if (false === $content) {
            return false;
        }

        $result = json_decode($content, true);

        if (null === $result) {
            throw new \InvalidArgumentException('Cache could not be decoded from file: ' . $location);
        }

        $items = array();
        foreach ($result as $setting) {
            $items[] = new Setting($setting['name'], $setting['value'], $setting['group'], $setting['flag']);
        }

        $this->settings = $items;

        return true;
    }
public function load()
    {
        $location = $this->location;

        // no location given from commandline -> use config values or fallback to default location
        if (empty($location)) {
            $location = $this->parameters->get(
                'read_location',
                $this->parameters->get(
                    'location',
                    $this->getDefaultLocation()
                )
            );
        }

        $this->location = $location;

        if (!is_readable($location) || !is_file($location)) {
            return false;
        }

        $content = file_get_contents($location);

        if (false === $content) {
            return false;
        }

        $result = json_decode($content, true);

        if (null === $result) {
            throw new \InvalidArgumentException('Cache could not be decoded from file: ' . $location);
        }

        $items = array();
        foreach ($result as $setting) {
            $items[] = new Setting($setting['name'], $setting['value'], $setting['group'], $setting['flag']);
        }

        $this->settings = $items;

        return true;
    }
public function load ( ) { $ location = $ this -> location ; // no location given from commandline -> use config values or fallback to default location if ( empty ( $ location ) ) { $ location = $ this -> parameters -> get ( 'read_location' , $ this -> parameters -> get ( 'location' , $ this -> getDefaultLocation ( ) ) ) ; } $ this -> location = $ location ; if ( ! is_readable ( $ location ) || ! is_file ( $ location ) ) { return false ; } $ content = file_get_contents ( $ location ) ; if ( false === $ content ) { return false ; } $ result = json_decode ( $ content , true ) ; if ( null === $ result ) { throw new \ InvalidArgumentException ( 'Cache could not be decoded from file: ' . $ location ) ; } $ items = array ( ) ; foreach ( $ result as $ setting ) { $ items [ ] = new Setting ( $ setting [ 'name' ] , $ setting [ 'value' ] , $ setting [ 'group' ] , $ setting [ 'flag' ] ) ; } $ this -> settings = $ items ; return true ; }
Loads the settings from the configured or default location.

@return boolean true, if reading from cache succeeded; false otherwise.

@throws \InvalidArgumentException on invalid or broken cache file
Loads the settings from the configured or default location .