public function deleteDirectoryContents($path)
    {
        $dir = new \RecursiveDirectoryIterator($path);
        $iterator = new \RecursiveIteratorIterator($dir, \RecursiveIteratorIterator::CHILD_FIRST);

        /** @var \SplFileInfo $object */
        foreach ($iterator as $object) {
            if (!in_array($object->getBasename(), ['.', '..'])) {
                if ($object->isLink() || $object->isFile()) {
                    unlink($object->getPathname());
                } else if ($object->isDir()) {
                    rmdir($object->getPathname());
                }
            }
        }
    }