MenaraSolutions\Geographer\Repositories\File::getData PHP Method

getData() public method

public getData ( $class, array $params ) : array
$class
$params array
return array
    public function getData($class, array $params)
    {
        $file = $this->getPath($class, $this->prefix, $params);
        try {
            $data = self::loadJson($file);
        } catch (FileNotFoundException $e) {
            // Some divisions don't have data files, so we don't want to throw the exception
            return [];
        }
        // ToDo: remove this logic from here
        if ($class == State::class && isset($params['code'])) {
            foreach ($data as $key => $meta) {
                if ($meta['parent'] != $params['code']) {
                    unset($data[$key]);
                }
            }
        }
        return $data;
    }