Components/FileService/Csv/CsvConfigurableStepsProvider.php
protected function readFile(array &$stepActionParams, array &$endpointOptions, array &$context)
    {
        $stepParamsResolver = new OptionsResolver();
        $stepParamsResolver->setRequired([
            self::PARAM_FILE_NAME,
            self::PARAM_CONTEXT_RESULT_NAME,
        ]);
        $params = $stepParamsResolver->resolve($stepActionParams);

        $filePath = $params[self::PARAM_FILE_NAME];
        $fullPath = $this->getRootPath($endpointOptions).DIRECTORY_SEPARATOR.$filePath;

        $contextResultName = $params[self::PARAM_CONTEXT_RESULT_NAME];
        $maxLineLength = $endpointOptions[CsvConfigurableProtocol::OPTION_MAX_LENGTH];

        //open the file, reset the pointer to zero
        $fileHandle = fopen($fullPath, 'r');

        $rows = [];

        while (false !== ($row = fgetcsv($fileHandle, $maxLineLength, $endpointOptions[CsvConfigurableProtocol::OPTION_DELIMITER]))) {
            $rows[] = $row;
        }

        fclose($fileHandle);

        $context[$contextResultName] = $rows;
    }
protected function readFile(array &$stepActionParams, array &$endpointOptions, array &$context)
    {
        $stepParamsResolver = new OptionsResolver();
        $stepParamsResolver->setRequired([
            self::PARAM_FILE_NAME,
            self::PARAM_CONTEXT_RESULT_NAME,
        ]);
        $params = $stepParamsResolver->resolve($stepActionParams);

        $filePath = $params[self::PARAM_FILE_NAME];
        $fullPath = $this->getRootPath($endpointOptions).DIRECTORY_SEPARATOR.$filePath;

        $contextResultName = $params[self::PARAM_CONTEXT_RESULT_NAME];
        $maxLineLength = $endpointOptions[CsvConfigurableProtocol::OPTION_MAX_LENGTH];

        //open the file, reset the pointer to zero
        $fileHandle = fopen($fullPath, 'r');

        $rows = [];

        while (false !== ($row = fgetcsv($fileHandle, $maxLineLength, $endpointOptions[CsvConfigurableProtocol::OPTION_DELIMITER]))) {
            $rows[] = $row;
        }

        fclose($fileHandle);

        $context[$contextResultName] = $rows;
    }
protected function readFile ( array & $ stepActionParams , array & $ endpointOptions , array & $ context ) { $ stepParamsResolver = new OptionsResolver ( ) ; $ stepParamsResolver -> setRequired ( [ self :: PARAM_FILE_NAME , self :: PARAM_CONTEXT_RESULT_NAME , ] ) ; $ params = $ stepParamsResolver -> resolve ( $ stepActionParams ) ; $ filePath = $ params [ self :: PARAM_FILE_NAME ] ; $ fullPath = $ this -> getRootPath ( $ endpointOptions ) . DIRECTORY_SEPARATOR . $ filePath ; $ contextResultName = $ params [ self :: PARAM_CONTEXT_RESULT_NAME ] ; $ maxLineLength = $ endpointOptions [ CsvConfigurableProtocol :: OPTION_MAX_LENGTH ] ; //open the file, reset the pointer to zero $ fileHandle = fopen ( $ fullPath , 'r' ) ; $ rows = [ ] ; while ( false !== ( $ row = fgetcsv ( $ fileHandle , $ maxLineLength , $ endpointOptions [ CsvConfigurableProtocol :: OPTION_DELIMITER ] ) ) ) { $ rows [ ] = $ row ; } fclose ( $ fileHandle ) ; $ context [ $ contextResultName ] = $ rows ; }
Read a csv file in to a context variable.

Required Params:
- CsvConfigurableProducer::PARAM_CONTEXT_RESULT_NAME
Optional Params:
- CsvConfigurableProducer::PARAM_FILE_NAME

@param array $stepActionParams
@param array $endpointOptions
@param array $context
Read a csv file in to a context variable .