src/Analyzers/TrafficAnalyzer.php
public function getLogCollection($now, $then)
    {
        if (!file_exists($this->fileName)) {
            throw new Exception("Access log file is not present - no traffic to report.", 1);
        }

        $collection = [];
        $lines = file($this->fileName, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);

        foreach ($lines as $line) {
            $collection[] = $this->parser->parse($line);
        }

        $logs = collect($collection);

        return $logs->where('stamp', '<=', $now)
            ->where('stamp', '>=', $then);
    }
public function getLogCollection($now, $then)
    {
        if (!file_exists($this->fileName)) {
            throw new Exception("Access log file is not present - no traffic to report.", 1);
        }

        $collection = [];
        $lines = file($this->fileName, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);

        foreach ($lines as $line) {
            $collection[] = $this->parser->parse($line);
        }

        $logs = collect($collection);

        return $logs->where('stamp', '<=', $now)
            ->where('stamp', '>=', $then);
    }
public function getLogCollection ( $ now , $ then ) { if ( ! file_exists ( $ this -> fileName ) ) { throw new Exception ( "Access log file is not present - no traffic to report." , 1 ) ; } $ collection = [ ] ; $ lines = file ( $ this -> fileName , FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ) ; foreach ( $ lines as $ line ) { $ collection [ ] = $ this -> parser -> parse ( $ line ) ; } $ logs = collect ( $ collection ) ; return $ logs -> where ( 'stamp' , '<=' , $ now ) -> where ( 'stamp' , '>=' , $ then ) ; }
Get the log collection based on time

@param  int $now
@param  int $then

@return Illuminate\Support\Collection
Get the log collection based on time