public static function dirSize($directory)
    {
        $size = 0;
        foreach (new \RecursiveIteratorIterator(
                     new RecursiveDirectoryIterator($directory, \FilesystemIterator::KEY_AS_PATHNAME)
                 ) as $file) {
            $size += $file->getSize();
        }

        return $size;
    }