check size
@param  string|int $filesize
@return boolean
428429
public function checkSize($filesize)
    {
        if (is_string($filesize)) {
            $filesize = filesize($filesize);
        }
        return $filesize <= $this->allowedSize;
    }
1002036
public static function dirSize(string $directory, bool $includeDirAllocSize = false): int
    {
        $size = 0;
        foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file) {
            /**
             * @var \SplFileInfo $file
             */
            if ($file->isFile()) {
                $size += filesize($file->getRealPath());
            } else {
                if ($includeDirAllocSize) {
                    $size += $file->getSize();
                }
            }
        }

        return $size;
    }
783481
public function stream_truncate($size)
    {
        if ($this->fileHandle === null) {
            return false;
        }
        self::restore();
        $success = ftruncate($this->fileHandle, $size);
        self::register();
        return $success;
    }
85396
public function setSize($size) {
		$this->owner->ButtonSize = trim(strtolower($size));
		return $this->owner;
	}
838752
public final function contains( Size $size ) : bool
   {

      return (
         ( $size->_width <= $this->_width )
         &&
         ( $size->_height <= $this->_height )
      );

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

        return $size;
    }
832928
public function filesize()
    {
        $path = $this->basePath();

        if (file_exists($path) && is_file($path)) {
            return filesize($path);
        }
        
        return false;
    }
1288119
public function stream_truncate(int $size): bool
    {
        if (self::READONLY === $this->mode) {
            return false;
        }

        if ($this->content->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) {
            return false;
        }

        if ($this->content->getType() !== vfsStreamContent::TYPE_FILE) {
            return false;
        }

        if (self::$quota->isLimited() && $this->content->size() < $size) {
            $maxSize = self::$quota->spaceLeft(self::$root->sizeSummarized());
            if (0 === $maxSize) {
                return false;
            }

            if ($size > $maxSize) {
                $size = $maxSize;
            }
        }

        return $this->content->truncate($size);
    }
138465
protected function validateFileSize (int $allowedSize=0) : bool
	{
		$allowedSize = (!empty($allowedSize) AND $allowedSize >= 1) ? $allowedSize : $this->allowedFIleSize;
		if ($this->fileSize < $allowedSize) return TRUE;
		$this->error = "File is too large try another one.";
		return FALSE;			
	}
809601
public function sizeIs(int $size): bool
    {
        // init
        $itemsTempCount = 0;

        foreach ($this->getGenerator() as $key => $value) {
            ++$itemsTempCount;
            if ($itemsTempCount > $size) {
                return false;
            }
        }

        return $itemsTempCount === $size;
    }
393194
public function alloc($filesize, &$result = null)
    {
        return ftp_alloc($this->link->getStream(), $filesize, $result);
    }
1083932
public function size($file, int $size): bool
    {
        if (empty($filename = $this->resolveFilename($file))) {
            return false;
        }

        return $this->files->size($filename) <= ($size * 1024);
    }
81928
public static function getSize($filename) {
        if (false === file_exists($filename)) {
            throw new FileNotFoundException($filename);
        }
        clearstatcache();
        return filesize($filename);
    }
1324661
public function getSize() : int
    {
        $size = -1;

        if ($this->isFile()) {
            $size = filesize($this->realPath);
        }

        return $size;
    }
209216
public static function size(string $path) : ?int
    {
        $size = filesize($path);
        return $size === false ? null : $size;
    }
77733
public final function containsSize( $widthOrSize, int $height = null ) : bool
   {

      $width = $widthOrSize;

      if ( $width instanceof Size )
      {
         $height = $width->height;
         $width  = $width->width;
      }
      else if ( \is_integer( $widthOrSize ) )
      {
         $width = $widthOrSize;
      }
      else if ( TypeTool::IsInteger( $widthOrSize ) )
      {
         $width = \intval( $widthOrSize );
      }
      else
      {
         $width = 0;
      }

      if ( ! \is_int( $height ) )
      {
         $height = \intval( $height );
      }

      return
         $this->size->width  >= $width
         &&
         $this->size->height >= $height;

   }
1085445
public function getSize($path)
    {
        $stat = $this->getMetadata($path);

        return isset($stat['filesize']) ? ['size' => $stat['filesize']] : false;
    }