protected function delete($file, $expires)
    {
        if (!is_array($file['path'])) {
            $file['path'] = [$file['path']];
        }
        
        foreach ($file['path'] as $path) {
            if (File::exists($path)) {
                if ((time() - File::lastModified($path)) >= $expires) {
                    if (!empty($file['before']) && is_callable($file['before'])) {
                        $file['before']($path);
                    }
                    if (File::isDirectory($path)) {
                        File::deleteDirectory($path);
                    } else {
                        File::delete($path);
                    }
                    if (!empty($file['after']) && is_callable($file['after'])) {
                        $file['after']($path);
                    }
                }
            }
        }
    }
protected function delete($file, $expires)
    {
        if (!is_array($file['path'])) {
            $file['path'] = [$file['path']];
        }
        
        foreach ($file['path'] as $path) {
            if (File::exists($path)) {
                if ((time() - File::lastModified($path)) >= $expires) {
                    if (!empty($file['before']) && is_callable($file['before'])) {
                        $file['before']($path);
                    }
                    if (File::isDirectory($path)) {
                        File::deleteDirectory($path);
                    } else {
                        File::delete($path);
                    }
                    if (!empty($file['after']) && is_callable($file['after'])) {
                        $file['after']($path);
                    }
                }
            }
        }
    }
protected function delete ( $ file , $ expires ) { if ( ! is_array ( $ file [ 'path' ] ) ) { $ file [ 'path' ] = [ $ file [ 'path' ] ] ; } foreach ( $ file [ 'path' ] as $ path ) { if ( File :: exists ( $ path ) ) { if ( ( time ( ) - File :: lastModified ( $ path ) ) >= $ expires ) { if ( ! empty ( $ file [ 'before' ] ) && is_callable ( $ file [ 'before' ] ) ) { $ file [ 'before' ] ( $ path ) ; } if ( File :: isDirectory ( $ path ) ) { File :: deleteDirectory ( $ path ) ; } else { File :: delete ( $ path ) ; } if ( ! empty ( $ file [ 'after' ] ) && is_callable ( $ file [ 'after' ] ) ) { $ file [ 'after' ] ( $ path ) ; } } } } }
Delete file or directory at given path

@param  array $file [Config item]
@param  int $expires [Expiration in seconds]
@return void
Delete file or directory at given path