public function add(SplFileInfo $splFileInfo)
    {
        $fileSystem = new Filesystem();

        if (!$fileSystem->exists($splFileInfo->getRealPath())) {
            throw new Exception('Trying to add '.$splFileInfo->getRealPath().' missing file to the index');
        }

        // if the file is already present in the index, and its mtime has been modified, we add it to the change set
        if ($this->has($splFileInfo->getRealPath())
            && $splFileInfo->getMTime() !== $this->index[$splFileInfo->getRealPath()]) {
            $this->changes[$splFileInfo->getRealPath()] = $splFileInfo;
        }
        // add new or existing file to the index
        $this->index[$splFileInfo->getRealPath()] = $splFileInfo->getMTime();
    }
public function add(SplFileInfo $splFileInfo)
    {
        $fileSystem = new Filesystem();

        if (!$fileSystem->exists($splFileInfo->getRealPath())) {
            throw new Exception('Trying to add '.$splFileInfo->getRealPath().' missing file to the index');
        }

        // if the file is already present in the index, and its mtime has been modified, we add it to the change set
        if ($this->has($splFileInfo->getRealPath())
            && $splFileInfo->getMTime() !== $this->index[$splFileInfo->getRealPath()]) {
            $this->changes[$splFileInfo->getRealPath()] = $splFileInfo;
        }
        // add new or existing file to the index
        $this->index[$splFileInfo->getRealPath()] = $splFileInfo->getMTime();
    }
public function add ( SplFileInfo $ splFileInfo ) { $ fileSystem = new Filesystem ( ) ; if ( ! $ fileSystem -> exists ( $ splFileInfo -> getRealPath ( ) ) ) { throw new Exception ( 'Trying to add ' . $ splFileInfo -> getRealPath ( ) . ' missing file to the index' ) ; } // if the file is already present in the index, and its mtime has been modified, we add it to the change set if ( $ this -> has ( $ splFileInfo -> getRealPath ( ) ) && $ splFileInfo -> getMTime ( ) !== $ this -> index [ $ splFileInfo -> getRealPath ( ) ] ) { $ this -> changes [ $ splFileInfo -> getRealPath ( ) ] = $ splFileInfo ; } // add new or existing file to the index $ this -> index [ $ splFileInfo -> getRealPath ( ) ] = $ splFileInfo -> getMTime ( ) ; }
Add an entry to the indexer. If a entry already exists, it will also be added to the changes.

@param SplFileInfo $splFileInfo

@throws Exception
Add an entry to the indexer . If a entry already exists it will also be added to the changes .