src/Watcher/Watcher.php
private function addModifiedTimes($path)
    {
        if (is_file($path)) {
            $stat = stat($path);
            $this->modifiedTimes[realpath($path)] = $stat['mtime'];

            return;
        }

        $directoryIterator = new \RecursiveDirectoryIterator(realpath($path));
        $files = new \RecursiveIteratorIterator($directoryIterator);

        // Iterate over instances of \SplFileObject
        foreach ($files as $file) {
            $modifiedTime = $file->getMTime();
            $this->modifiedTimes[$file->getRealPath()] = $modifiedTime;
        }
    }
private function addModifiedTimes($path)
    {
        if (is_file($path)) {
            $stat = stat($path);
            $this->modifiedTimes[realpath($path)] = $stat['mtime'];

            return;
        }

        $directoryIterator = new \RecursiveDirectoryIterator(realpath($path));
        $files = new \RecursiveIteratorIterator($directoryIterator);

        // Iterate over instances of \SplFileObject
        foreach ($files as $file) {
            $modifiedTime = $file->getMTime();
            $this->modifiedTimes[$file->getRealPath()] = $modifiedTime;
        }
    }
private function addModifiedTimes ( $ path ) { if ( is_file ( $ path ) ) { $ stat = stat ( $ path ) ; $ this -> modifiedTimes [ realpath ( $ path ) ] = $ stat [ 'mtime' ] ; return ; } $ directoryIterator = new \ RecursiveDirectoryIterator ( realpath ( $ path ) ) ; $ files = new \ RecursiveIteratorIterator ( $ directoryIterator ) ; // Iterate over instances of \SplFileObject foreach ( $ files as $ file ) { $ modifiedTime = $ file -> getMTime ( ) ; $ this -> modifiedTimes [ $ file -> getRealPath ( ) ] = $ modifiedTime ; } }
Given the path to a file or directory, recursively adds the modified
times of any nested folders to the modifiedTimes property.

@param string $path A valid path to a file or directory
Given the path to a file or directory recursively adds the modified times of any nested folders to the modifiedTimes property .