public function processResourcesBySource(SourceInterface $source)
    {
        // Getting all resources for the given source and process them (save the content in the configured output folder)
        // Getting result iterator
        $resources = $this->getResources($source);

        // Parsing the resource iterator
        $globalSuccess = true;
        $postParseErrors = array();
        foreach ($resources as $resourceKey => $resource) {
            if ($resource instanceof ResourceInterface) {
                // Moving the content of the current resource to the output folder
                $success = $resource->moveToOutputFolder($this->outputFolder);
                if (!$success) {
                    $globalSuccess = false;
                }
                try {
                    // Launching the post parse unit action for the current resource object
                    $result = $source->postParseUnitAction($resourceKey, $success);
                    if ($result instanceof ParseResult && $result->getResult() === false) {
                        $sourcePostParseError = sprintf(
                            'Post parse error for source \'%s\'. Error message is: \'%s\'.',
                            $source->toString(),
                            $result->getMessage()
                        );
                        array_push($postParseErrors, $sourcePostParseError);
                    }
                } catch (\Exception $e) {
                    $sourcePostParseError = sprintf(
                        'Exception has been caught while parsing the resources for the source object \'%s\'. Error is: \'%s\'',
                        $source->toString(),
                        $e->getMessage()
                    );
                    array_push($postParseErrors, $sourcePostParseError);
                }
            }
        }

        try {
            // Running the global post parse action for the current source object
            $result = $source->postParseGlobalAction($globalSuccess);
            if ($result instanceof ParseResult && $result->getResult() === false) {
                $globalSourcePostParseError = sprintf(
                    'Post global parse error for source \'%s\'. Error message is: \'%s\'.',
                    $source->toString(),
                    $result->getMessage()
                );
                array_push($postParseErrors, $globalSourcePostParseError);
            }
        } catch (\Exception $e) {
            $globalSourcePostParseError = sprintf(
                'Exception has been caught while running the post global action for the source object \'%s\'. Error is: \'%s\'',
                $source->toString(),
                $e->getMessage()
            );
            array_push($postParseErrors, $globalSourcePostParseError);
        }

        // Launch a unique exception with all the post parse unit and post global errors
        if (count($postParseErrors) > 0) {
            throw new Exception\PostParseException(
                $postParseErrors,
                sprintf(
                    'Errors while running post unit and global actions for the following source: \'%s\'.',
                    $source->toString()
                )
            );
        }

        // Return true if no exception
        return true;
    }
public function processResourcesBySource(SourceInterface $source)
    {
        // Getting all resources for the given source and process them (save the content in the configured output folder)
        // Getting result iterator
        $resources = $this->getResources($source);

        // Parsing the resource iterator
        $globalSuccess = true;
        $postParseErrors = array();
        foreach ($resources as $resourceKey => $resource) {
            if ($resource instanceof ResourceInterface) {
                // Moving the content of the current resource to the output folder
                $success = $resource->moveToOutputFolder($this->outputFolder);
                if (!$success) {
                    $globalSuccess = false;
                }
                try {
                    // Launching the post parse unit action for the current resource object
                    $result = $source->postParseUnitAction($resourceKey, $success);
                    if ($result instanceof ParseResult && $result->getResult() === false) {
                        $sourcePostParseError = sprintf(
                            'Post parse error for source \'%s\'. Error message is: \'%s\'.',
                            $source->toString(),
                            $result->getMessage()
                        );
                        array_push($postParseErrors, $sourcePostParseError);
                    }
                } catch (\Exception $e) {
                    $sourcePostParseError = sprintf(
                        'Exception has been caught while parsing the resources for the source object \'%s\'. Error is: \'%s\'',
                        $source->toString(),
                        $e->getMessage()
                    );
                    array_push($postParseErrors, $sourcePostParseError);
                }
            }
        }

        try {
            // Running the global post parse action for the current source object
            $result = $source->postParseGlobalAction($globalSuccess);
            if ($result instanceof ParseResult && $result->getResult() === false) {
                $globalSourcePostParseError = sprintf(
                    'Post global parse error for source \'%s\'. Error message is: \'%s\'.',
                    $source->toString(),
                    $result->getMessage()
                );
                array_push($postParseErrors, $globalSourcePostParseError);
            }
        } catch (\Exception $e) {
            $globalSourcePostParseError = sprintf(
                'Exception has been caught while running the post global action for the source object \'%s\'. Error is: \'%s\'',
                $source->toString(),
                $e->getMessage()
            );
            array_push($postParseErrors, $globalSourcePostParseError);
        }

        // Launch a unique exception with all the post parse unit and post global errors
        if (count($postParseErrors) > 0) {
            throw new Exception\PostParseException(
                $postParseErrors,
                sprintf(
                    'Errors while running post unit and global actions for the following source: \'%s\'.',
                    $source->toString()
                )
            );
        }

        // Return true if no exception
        return true;
    }
public function processResourcesBySource ( SourceInterface $ source ) { // Getting all resources for the given source and process them (save the content in the configured output folder) // Getting result iterator $ resources = $ this -> getResources ( $ source ) ; // Parsing the resource iterator $ globalSuccess = true ; $ postParseErrors = array ( ) ; foreach ( $ resources as $ resourceKey => $ resource ) { if ( $ resource instanceof ResourceInterface ) { // Moving the content of the current resource to the output folder $ success = $ resource -> moveToOutputFolder ( $ this -> outputFolder ) ; if ( ! $ success ) { $ globalSuccess = false ; } try { // Launching the post parse unit action for the current resource object $ result = $ source -> postParseUnitAction ( $ resourceKey , $ success ) ; if ( $ result instanceof ParseResult && $ result -> getResult ( ) === false ) { $ sourcePostParseError = sprintf ( 'Post parse error for source \'%s\'. Error message is: \'%s\'.' , $ source -> toString ( ) , $ result -> getMessage ( ) ) ; array_push ( $ postParseErrors , $ sourcePostParseError ) ; } } catch ( \ Exception $ e ) { $ sourcePostParseError = sprintf ( 'Exception has been caught while parsing the resources for the source object \'%s\'. Error is: \'%s\'' , $ source -> toString ( ) , $ e -> getMessage ( ) ) ; array_push ( $ postParseErrors , $ sourcePostParseError ) ; } } } try { // Running the global post parse action for the current source object $ result = $ source -> postParseGlobalAction ( $ globalSuccess ) ; if ( $ result instanceof ParseResult && $ result -> getResult ( ) === false ) { $ globalSourcePostParseError = sprintf ( 'Post global parse error for source \'%s\'. Error message is: \'%s\'.' , $ source -> toString ( ) , $ result -> getMessage ( ) ) ; array_push ( $ postParseErrors , $ globalSourcePostParseError ) ; } } catch ( \ Exception $ e ) { $ globalSourcePostParseError = sprintf ( 'Exception has been caught while running the post global action for the source object \'%s\'. Error is: \'%s\'' , $ source -> toString ( ) , $ e -> getMessage ( ) ) ; array_push ( $ postParseErrors , $ globalSourcePostParseError ) ; } // Launch a unique exception with all the post parse unit and post global errors if ( count ( $ postParseErrors ) > 0 ) { throw new Exception \ PostParseException ( $ postParseErrors , sprintf ( 'Errors while running post unit and global actions for the following source: \'%s\'.' , $ source -> toString ( ) ) ) ; } // Return true if no exception return true ; }
Processes all resources associated to the given Source object

@param SourceInterface $source the source object to be processed

@throws \Msl\ResourceProxy\Exception\SourceGetDataException
@throws \Msl\ResourceProxy\Exception\PostParseException

@return bool
Processes all resources associated to the given Source object