Set maximum file size

@param string|int $maxSize
@return File
15512
protected function setMaxSize($maxSize)
    {
        $this->maxSize = $this->toBytes($maxSize);
        $this->maxSizeString = $this->fromBytes($this->maxSize);
        return $this;
    }
977299
public function setMaximumLength($maximumLength)
    {
        if ($maximumLength <= $this->minimalLength) {
            throw new Exception\InvalidArgumentException('Maximum length must be larger than minimal length.');
        }

        $this->maximumLength = $maximumLength;

        return $this;
    }
203691
public function setMax($max)
    {
        if (null === $max) {
            $this->_max = null;
        } else if ($max < $this->_min) {
            /**
             * @see Zend_Validate_Exception
             */
            include_once 'Zend/Validate/Exception.php';
            throw new Zend_Validate_Exception(
                "The maximum must be greater than or equal to the minimum length, but "
                . "$max < $this->_min"
            );
        } else {
            $this->_max = (integer) $max;
        }

        return $this;
    }
1035717
public void setMaxSize(long maxSize) {
		// if the new maxSize is <= 0, clear keyLRUList
		if (maxSize <= 0) {
			keyLRUList.clear();
		} else if (maxSize > 0 && this.maxSize <= 0) {
			// if the new maxSize > 0 and the old is <= 0, fill in LRU list -
			// order will be meaningless for now
			Iterator keys = cacheLineTable.keySet().iterator();

			while (keys.hasNext()) {
				keyLRUList.add(keys.next());
			}
		}

		// if the new maxSize is less than the current cache size, shrink the
		// cache.
		if (maxSize > 0 && cacheLineTable.size() > maxSize) {
			while (cacheLineTable.size() > maxSize) {
				Object lastKey = keyLRUList.getLast();

				removeObject(lastKey);
			}
		}

		this.maxSize = maxSize;
	}
386631
public function setAutoSize($max, $min = 1)
    {
        $this->autoSize = [
            'minRows' => intval($min),
            'maxRows' => intval($max),
        ];

        return $this;
    }
1275960
protected function validateInput(int $maxSize=0)
  {
    if (0 == $maxSize) $maxSize = $this->getMaximumFileUploadSize();

    foreach ($this->files as $file)
    {
      # Filesize check
      if ( $maxSize>0 && $file['size']>$maxSize) {
        throw new SpinException('Exceeded filesize limit');
      }

      # Check error codes (http://php.net/manual/en/features.file-upload.errors.php)
      switch ( $file['error'] ) {
        case \UPLOAD_ERR_OK:
            break;

        case \UPLOAD_ERR_PARTIAL:
            throw new SpinException($file['name'] . ': The uploaded file was only partially uploaded');

        case \UPLOAD_ERR_NO_FILE:
            throw new SpinException($file['name'] . ': No file was uploaded');

        case \UPLOAD_ERR_INI_SIZE:
            throw new SpinException($file['name'] . ': The uploaded file exceeds the upload_max_filesize directive in php.ini');

        case \UPLOAD_ERR_FORM_SIZE:
            throw new SpinException($file['name'] . ': The uploaded file exceeds MAX_FILE_SIZE (' . $maxSize . ') ');

        case \UPLOAD_ERR_NO_TMP_DIR:
            throw new SpinException($file['name'] . ': Missing a temporary folder');

        case \UPLOAD_ERR_CANT_WRITE:
            throw new SpinException($file['name'] . ': Failed to write file to disk');

        default:
            throw new SpinException('Unknown errors');
      }
    }

    return true;
  }
92601
public function resizeIn($maxWidth, $maxHeight, $minWidth = null, $minHeight = null)
        {
            $this->_maxWidth = $maxWidth;
            $this->_maxHeight = $maxHeight;
            $this->_minWidth = $minWidth;
            $this->_minHeight = $minHeight;

            $this->_generateThumb();

            $this->_source = $this->_thumb;
            $this->_reloadSize();

            return $this;
        }
1371400
protected function setMinSize($minSize)
    {
        $this->minSize = $this->toBytes($minSize);
        $this->minSizeString = $this->fromBytes($this->minSize);
        return $this;
    }
856293
func (p *PersistentVolume) SetMaxSize(maxSize int) *PersistentVolume {
	p.MaxSize = maxSize
	return p
}
1089395
public function sizeMax($sizeMax = 1048576, $error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::SIZEMAX, 'value' => $sizeMax, 'message' => $error]);
        }

        return $this;
    }
1277842
public function setMaxFilesize($maxFilesize = 'auto')
    {
        switch ($maxFilesize) {
            case 'auto':
                $maxFilesize = $this->convertToBytes(
                    ini_get('upload_max_filesize')
                );
                break;
        }

        $this->maxFilesize = $maxFilesize;
        $this->setAttribute('filesize', $maxFilesize);
    }
331905
function assetFileSize($min = null, $max = null) {
        $range = [];
        if ($min) $range['min'] = $min;
        if ($max) $range['max'] = $max;
        if (count($range)) $this->data['assetFileSize'] = $range;
        return $this;
    }
688249
public function decode(string $input, int $maxSize) { /* : ?array */
        $headers = [];
        $off = 0;
        $inputLength = \strlen($input);
        $size = 0;

        // dynamic $table as per 2.3.2
        while ($off < $inputLength) {
            $index = \ord($input[$off++]);

            if ($index & 0x80) {
                // range check
                if ($index <= self::LAST_INDEX + 0x80) {
                    if ($index === 0x80) {
                        return null;
                    }

                    list($name, $value) = $headers[] = self::TABLE[$index - 0x81];
                } else {
                    if ($index == 0xff) {
                        $index = self::decodeDynamicInteger($input, $off) + 0xff;
                    }

                    $index -= 0x81 + self::LAST_INDEX;
                    if (!isset($this->headers[$index])) {
                        return null;
                    }

                    list($name, $value) = $headers[] = $this->headers[$index];
                }
            } elseif (($index & 0x60) !== 0x20) { // (($index & 0x40) || !($index & 0x20)): bit 4: never index is ignored
                $dynamic = (bool) ($index & 0x40);

                if ($index & ($dynamic ? 0x3f : 0x0f)) { // separate length
                    if ($dynamic) {
                        if ($index === 0x7f) {
                            $index = self::decodeDynamicInteger($input, $off) + 0x3f;
                        } else {
                            $index &= 0x3f;
                        }
                    } else {
                        $index &= 0x0f;
                        if ($index === 0x0f) {
                            $index = self::decodeDynamicInteger($input, $off) + 0x0f;
                        }
                    }

                    if ($index <= self::LAST_INDEX) {
                        $header = self::TABLE[$index - 1];
                    } else {
                        $header = $this->headers[$index - 1 - self::LAST_INDEX];
                    }
                } else {
                    $len = \ord($input[$off++]);
                    $huffman = $len & 0x80;
                    $len &= 0x7f;

                    if ($len === 0x7f) {
                        $len = self::decodeDynamicInteger($input, $off) + 0x7f;
                    }

                    if ($inputLength - $off < $len || $len <= 0) {
                        return null;
                    }

                    if ($huffman) {
                        $header = [self::huffmanDecode(\substr($input, $off, $len))];
                    } else {
                        $header = [\substr($input, $off, $len)];
                    }

                    $off += $len;
                }

                if ($off === $inputLength) {
                    return null;
                }

                $len = \ord($input[$off++]);
                $huffman = $len & 0x80;
                $len &= 0x7f;

                if ($len === 0x7f) {
                    $len = self::decodeDynamicInteger($input, $off) + 0x7f;
                }

                if ($inputLength - $off < $len || $len < 0) {
                    return null;
                }

                if ($huffman) {
                    $header[1] = self::huffmanDecode(\substr($input, $off, $len));
                } else {
                    $header[1] = \substr($input, $off, $len);
                }

                $off += $len;

                if ($dynamic) {
                    \array_unshift($this->headers, $header);
                    $this->size += 32 + \strlen($header[0]) + \strlen($header[1]);
                    if ($this->maxSize < $this->size) {
                        $this->resizeTable();
                    }
                }

                list($name, $value) = $headers[] = $header;
            } else { // if ($index & 0x20) {
                if ($index === 0x3f) {
                    $index = self::decodeDynamicInteger($input, $off) + 0x40;
                }

                if ($index > 4096) { // initial limit … may be adjusted??
                    return null;
                }

                $name = $value = '';
                $this->resizeTable($index);
            }

            $size += \strlen($name) + \strlen($value);

            if ($size > $maxSize) {
                return null;
            }
        }

        return $headers;
    }
1286452
public function setMaxSize($max_size)
    {
        if (is_numeric($max_size)) {
            $this->max_size = $max_size;
        } else {
            $this->max_size = Util::humanReadableToBytes($max_size);
        }

        if ($this->max_size < 0 || $this->max_size == null) {
            throw new \Exception('invalid max_size value');
        }

    }
700354
@Config("thrift.max-frame-size")
    public ThriftServerConfig setMaxFrameSize(DataSize maxFrameSize)
    {
        checkArgument(maxFrameSize.toBytes() <= 0x3FFFFFFF);
        this.maxFrameSize = maxFrameSize;
        return this;
    }
351960
public function setFontSize($min, $max = null) {

		if(false === ('-' . intval($min) == '-' . $min)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($min)), E_USER_ERROR);
		}

		if(null !== $max && false === ('-' . intval($max) == '-' . $max)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($max)), E_USER_ERROR);
		}

		$this -> fontsize = ['min' => $min, 'max' => ($max !== null ? $max : $min)];

		return $this;
	}
746458
public function batchSize($batchSize)
    {
        if (null !== $batchSize) {
            if (!is_numeric($batchSize) || $batchSize != (int) $batchSize) {
                throw new \InvalidArgumentException('The batchSize is not valid.');
            }
            $batchSize = (int) $batchSize;
        }

        $this->batchSize = $batchSize;

        return $this;
    }