code: public function size($path)
      {
          if (!file_exists($path)) {
              throw new \RuntimeException("$path does not exist.");
          }
          if (is_dir($path)) {
              return $this->directorySize($path);
          }
  
          return filesize($path);
      }
docs: Returns size of a file or directory specified by path. If a directory is
  given, it's size will be computed recursively.
  
  @param  string            $path Path to the file or directory
  @throws \RuntimeException
  @return int