src/Etl.php
public function process($data, ...$initLoaderArgs): void
    {
        $flushCounter = $totalCounter = 0;
        $this->start();

        foreach ($this->extract($data) as $key => $item) {
            if ($this->shouldSkip) {
                $this->skip($item, $key);
                continue;
            }

            if ($this->shouldStop) {
                $this->stop($item, $key);
                break;
            }

            $transformed = $this->transform($item, $key);

            if ($this->shouldSkip) {
                $this->skip($item, $key);
                continue;
            }

            if ($this->shouldStop) {
                $this->stop($item, $key);
                break;
            }

            $flushCounter++;
            $totalCounter++;

            if (1 === $totalCounter) {
                $this->initLoader($item, $key, ...$initLoaderArgs);
            }

            $flush = (null === $this->flushEvery ? false : (0 === ($totalCounter % $this->flushEvery)));
            $this->load($transformed(), $item, $key, $flush, $flushCounter, $totalCounter);
        }

        $this->end($flushCounter, $totalCounter);
    }
public function process($data, ...$initLoaderArgs): void
    {
        $flushCounter = $totalCounter = 0;
        $this->start();

        foreach ($this->extract($data) as $key => $item) {
            if ($this->shouldSkip) {
                $this->skip($item, $key);
                continue;
            }

            if ($this->shouldStop) {
                $this->stop($item, $key);
                break;
            }

            $transformed = $this->transform($item, $key);

            if ($this->shouldSkip) {
                $this->skip($item, $key);
                continue;
            }

            if ($this->shouldStop) {
                $this->stop($item, $key);
                break;
            }

            $flushCounter++;
            $totalCounter++;

            if (1 === $totalCounter) {
                $this->initLoader($item, $key, ...$initLoaderArgs);
            }

            $flush = (null === $this->flushEvery ? false : (0 === ($totalCounter % $this->flushEvery)));
            $this->load($transformed(), $item, $key, $flush, $flushCounter, $totalCounter);
        }

        $this->end($flushCounter, $totalCounter);
    }
public function process ( $ data , ... $ initLoaderArgs ) : void { $ flushCounter = $ totalCounter = 0 ; $ this -> start ( ) ; foreach ( $ this -> extract ( $ data ) as $ key => $ item ) { if ( $ this -> shouldSkip ) { $ this -> skip ( $ item , $ key ) ; continue ; } if ( $ this -> shouldStop ) { $ this -> stop ( $ item , $ key ) ; break ; } $ transformed = $ this -> transform ( $ item , $ key ) ; if ( $ this -> shouldSkip ) { $ this -> skip ( $ item , $ key ) ; continue ; } if ( $ this -> shouldStop ) { $ this -> stop ( $ item , $ key ) ; break ; } $ flushCounter ++ ; $ totalCounter ++ ; if ( 1 === $ totalCounter ) { $ this -> initLoader ( $ item , $ key , ... $ initLoaderArgs ) ; } $ flush = ( null === $ this -> flushEvery ? false : ( 0 === ( $ totalCounter % $ this -> flushEvery ) ) ) ; $ this -> load ( $ transformed ( ) , $ item , $ key , $ flush , $ flushCounter , $ totalCounter ) ; } $ this -> end ( $ flushCounter , $ totalCounter ) ; }
Run the ETL on the given input.

@param $data
@param ...$initLoaderArgs - Optional arguments for loader init
@throws EtlException
Run the ETL on the given input .