public function dirSize($directory = '.', $recursive = true)
    {
        $items = $this->scanDir($directory, $recursive);
        $size  = 0;

        foreach ($items as $item) {
            $size += (int) $item['size'];
        }

        return $size;
    }
public function dirSize($directory = '.', $recursive = true)
    {
        $items = $this->scanDir($directory, $recursive);
        $size  = 0;

        foreach ($items as $item) {
            $size += (int) $item['size'];
        }

        return $size;
    }
public function dirSize ( $ directory = '.' , $ recursive = true ) { $ items = $ this -> scanDir ( $ directory , $ recursive ) ; $ size = 0 ; foreach ( $ items as $ item ) { $ size += ( int ) $ item [ 'size' ] ; } return $ size ; }
Returns the total size of the given directory in bytes.

@param  string $directory The directory, by default is the current directory.
@param  bool   $recursive true by default
@return int    The size in bytes.
Returns the total size of the given directory in bytes .