public function cleanTarget()
    {
        $filesystem = new Filesystem();

        // Get files and directories to remove
        $files = array_diff(scandir($this->target), ['.', '..']);
        $files = preg_grep('/[^.gitignore]/i', $files);

        // Remove files
        foreach ($files as $file) {
            $filesystem->remove("$this->target/$file");
        }

        // Fire event
        Event::fire('target.cleaned', [$this]);
    }
public function cleanTarget()
    {
        $filesystem = new Filesystem();

        // Get files and directories to remove
        $files = array_diff(scandir($this->target), ['.', '..']);
        $files = preg_grep('/[^.gitignore]/i', $files);

        // Remove files
        foreach ($files as $file) {
            $filesystem->remove("$this->target/$file");
        }

        // Fire event
        Event::fire('target.cleaned', [$this]);
    }
public function cleanTarget ( ) { $ filesystem = new Filesystem ( ) ; // Get files and directories to remove $ files = array_diff ( scandir ( $ this -> target ) , [ '.' , '..' ] ) ; $ files = preg_grep ( '/[^.gitignore]/i' , $ files ) ; // Remove files foreach ( $ files as $ file ) { $ filesystem -> remove ( "$this->target/$file" ) ; } // Fire event Event :: fire ( 'target.cleaned' , [ $ this ] ) ; }
Clean target directory

@return void
Clean target directory