src/Installer/SummernoteInstaller.php
private function clear(array $options)
    {
        if (!file_exists($options['path'].'/summernote.js')) {
            return self::CLEAR_DROP;
        }

        if (null === $options['clear'] && null !== $options['notifier']) {
            $options['clear'] = $this->notify($options['notifier'], self::NOTIFY_CLEAR, $options['path']);
        }

        if (null === $options['clear']) {
            $options['clear'] = self::CLEAR_SKIP;
        }

        if (self::CLEAR_DROP === $options['clear']) {
            $files = new \RecursiveIteratorIterator(
                new \RecursiveDirectoryIterator($options['path'], \RecursiveDirectoryIterator::SKIP_DOTS),
                \RecursiveIteratorIterator::CHILD_FIRST
            );

            $this->notify($options['notifier'], self::NOTIFY_CLEAR_SIZE, iterator_count($files));

            foreach ($files as $file) {
                $filePath = $file->getRealPath();
                $this->notify($options['notifier'], self::NOTIFY_CLEAR_PROGRESS, $filePath);

                if ($dir = $file->isDir()) {
                    $success = @rmdir($filePath);
                } else {
                    $success = @unlink($filePath);
                }

                if (!$success) {
                    throw $this->createException(sprintf(
                        'Unable to remove the %s "%s".',
                        $dir ? 'directory' : 'file',
                        $filePath
                    ));
                }
            }

            $this->notify($options['notifier'], self::NOTIFY_CLEAR_COMPLETE);
        }

        return $options['clear'];
    }
private function clear(array $options)
    {
        if (!file_exists($options['path'].'/summernote.js')) {
            return self::CLEAR_DROP;
        }

        if (null === $options['clear'] && null !== $options['notifier']) {
            $options['clear'] = $this->notify($options['notifier'], self::NOTIFY_CLEAR, $options['path']);
        }

        if (null === $options['clear']) {
            $options['clear'] = self::CLEAR_SKIP;
        }

        if (self::CLEAR_DROP === $options['clear']) {
            $files = new \RecursiveIteratorIterator(
                new \RecursiveDirectoryIterator($options['path'], \RecursiveDirectoryIterator::SKIP_DOTS),
                \RecursiveIteratorIterator::CHILD_FIRST
            );

            $this->notify($options['notifier'], self::NOTIFY_CLEAR_SIZE, iterator_count($files));

            foreach ($files as $file) {
                $filePath = $file->getRealPath();
                $this->notify($options['notifier'], self::NOTIFY_CLEAR_PROGRESS, $filePath);

                if ($dir = $file->isDir()) {
                    $success = @rmdir($filePath);
                } else {
                    $success = @unlink($filePath);
                }

                if (!$success) {
                    throw $this->createException(sprintf(
                        'Unable to remove the %s "%s".',
                        $dir ? 'directory' : 'file',
                        $filePath
                    ));
                }
            }

            $this->notify($options['notifier'], self::NOTIFY_CLEAR_COMPLETE);
        }

        return $options['clear'];
    }
private function clear ( array $ options ) { if ( ! file_exists ( $ options [ 'path' ] . '/summernote.js' ) ) { return self :: CLEAR_DROP ; } if ( null === $ options [ 'clear' ] && null !== $ options [ 'notifier' ] ) { $ options [ 'clear' ] = $ this -> notify ( $ options [ 'notifier' ] , self :: NOTIFY_CLEAR , $ options [ 'path' ] ) ; } if ( null === $ options [ 'clear' ] ) { $ options [ 'clear' ] = self :: CLEAR_SKIP ; } if ( self :: CLEAR_DROP === $ options [ 'clear' ] ) { $ files = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ options [ 'path' ] , \ RecursiveDirectoryIterator :: SKIP_DOTS ) , \ RecursiveIteratorIterator :: CHILD_FIRST ) ; $ this -> notify ( $ options [ 'notifier' ] , self :: NOTIFY_CLEAR_SIZE , iterator_count ( $ files ) ) ; foreach ( $ files as $ file ) { $ filePath = $ file -> getRealPath ( ) ; $ this -> notify ( $ options [ 'notifier' ] , self :: NOTIFY_CLEAR_PROGRESS , $ filePath ) ; if ( $ dir = $ file -> isDir ( ) ) { $ success = @ rmdir ( $ filePath ) ; } else { $ success = @ unlink ( $ filePath ) ; } if ( ! $ success ) { throw $ this -> createException ( sprintf ( 'Unable to remove the %s "%s".' , $ dir ? 'directory' : 'file' , $ filePath ) ) ; } } $ this -> notify ( $ options [ 'notifier' ] , self :: NOTIFY_CLEAR_COMPLETE ) ; } return $ options [ 'clear' ] ; }
@param mixed[] $options

@return int
@param mixed [] $options