Nette\Utils\Finder::size PHP Method

size() public method

Restricts the search by size.
public size ( $operator, $size = NULL ) : self
return self
    public function size($operator, $size = NULL)
    {
        if (func_num_args() === 1) {
            // in $operator is predicate
            if (!preg_match('#^(?:([=<>!]=?|<>)\\s*)?((?:\\d*\\.)?\\d+)\\s*(K|M|G|)B?\\z#i', $operator, $matches)) {
                throw new Nette\InvalidArgumentException('Invalid size predicate format.');
            }
            list(, $operator, $size, $unit) = $matches;
            static $units = ['' => 1, 'k' => 1000.0, 'm' => 1000000.0, 'g' => 1000000000.0];
            $size *= $units[strtolower($unit)];
            $operator = $operator ? $operator : '=';
        }
        return $this->filter(function (RecursiveDirectoryIterator $file) use($operator, $size) {
            return self::compare($file->getSize(), $operator, $size);
        });
    }