protected function getDatasets($dataset = false)
    {
        $source_packages = config('datasets.source', []);

        $result = [];

        foreach ($source_packages as $folder) {

            // Get folder contents of datasets
            $datasets = new Filesystem(new Adapter(base_path('vendor/'.$folder.'/datasets/')));

            try {
                $files = $datasets->listContents();
            } catch (\Exception $exception) {
            }

            foreach ($files as $file) {
                $result[$file['filename']] = base_path('vendor/'.$folder.'/datasets/'.$file['basename']);
            }
        }

        if ($dataset !== false) {
            if (!isset($result[$dataset])) {
                $this->error(sprintf("Requested dataset '%s' could not be found.", $dataset));

                exit(1);
            }

            // Supplied dataset config file does not exist.
            if (!file_exists($result[$dataset])) {
                $this->error(sprintf('\'%s\' dataset does not exist.', $this->argument('dataset')));
                $this->line('');

                exit(1);
            }

            return $result[$dataset];
        }

        return $result;
    }
protected function getDatasets($dataset = false)
    {
        $source_packages = config('datasets.source', []);

        $result = [];

        foreach ($source_packages as $folder) {

            // Get folder contents of datasets
            $datasets = new Filesystem(new Adapter(base_path('vendor/'.$folder.'/datasets/')));

            try {
                $files = $datasets->listContents();
            } catch (\Exception $exception) {
            }

            foreach ($files as $file) {
                $result[$file['filename']] = base_path('vendor/'.$folder.'/datasets/'.$file['basename']);
            }
        }

        if ($dataset !== false) {
            if (!isset($result[$dataset])) {
                $this->error(sprintf("Requested dataset '%s' could not be found.", $dataset));

                exit(1);
            }

            // Supplied dataset config file does not exist.
            if (!file_exists($result[$dataset])) {
                $this->error(sprintf('\'%s\' dataset does not exist.', $this->argument('dataset')));
                $this->line('');

                exit(1);
            }

            return $result[$dataset];
        }

        return $result;
    }
protected function getDatasets ( $ dataset = false ) { $ source_packages = config ( 'datasets.source' , [ ] ) ; $ result = [ ] ; foreach ( $ source_packages as $ folder ) { // Get folder contents of datasets $ datasets = new Filesystem ( new Adapter ( base_path ( 'vendor/' . $ folder . '/datasets/' ) ) ) ; try { $ files = $ datasets -> listContents ( ) ; } catch ( \ Exception $ exception ) { } foreach ( $ files as $ file ) { $ result [ $ file [ 'filename' ] ] = base_path ( 'vendor/' . $ folder . '/datasets/' . $ file [ 'basename' ] ) ; } } if ( $ dataset !== false ) { if ( ! isset ( $ result [ $ dataset ] ) ) { $ this -> error ( sprintf ( "Requested dataset '%s' could not be found." , $ dataset ) ) ; exit ( 1 ) ; } // Supplied dataset config file does not exist. if ( ! file_exists ( $ result [ $ dataset ] ) ) { $ this -> error ( sprintf ( '\'%s\' dataset does not exist.' , $ this -> argument ( 'dataset' ) ) ) ; $ this -> line ( '' ) ; exit ( 1 ) ; } return $ result [ $ dataset ] ; } return $ result ; }
Get list of dataset's paths, or a specific dataset's path.

@param bool $dataset

@return array|string

@SuppressWarnings(PHPMD.BooleanArgumentFlag)
@SuppressWarnings(PHPMD.ExitExpression)
@SuppressWarnings(PHPMD.CognitiveComplexity)
Get list of dataset s paths or a specific dataset s path .