@param int $amount
@param int $radius
@param int $threshold

@return $this
541937
private function _unsharpMask(int $amount, int $radius, int $threshold)
    {
        $this->check();

        $img = $this->image_resource;
        // $img is an image that is already created within php using
        // imgcreatetruecolor. No url! $img must be a truecolor image.

        // Attempt to calibrate the parameters to Photoshop:
        if ($amount > 500) {
            $amount = 500;
        }

        $amount = $amount * 0.016;
        $radius = abs($radius);

        if ($radius > 50) {
            $radius = 50;
        }

        $radius = round($radius * 2);

        if ($threshold > 255) {
            $threshold = 255;
        }

        if (!$radius) {
            // No need to modify
            return $this;
        }
        $w = $this->image_width;
        $h = $this->image_height;
        $imgCanvas = imagecreatetruecolor($w, $h);
        $imgBlur = imagecreatetruecolor($w, $h);

        /*
         Gaussian blur matrix:
         1	2	1
         2	4	2
         1	2	1
         */
        if (function_exists('imageconvolution')) { // PHP >= 5.1
            imagecopy($imgBlur, $img, 0, 0, 0, 0, $w, $h);
            imageconvolution($imgBlur, [
                [1, 2, 1],
                [2, 4, 2],
                [1, 2, 1],
            ], 16, 0);
        } else {
            // Move copies of the image around one pixel at the time and merge them with weight according to the matrix. The same matrix is simply repeated for higher radii.
            for ($i = 0; $i < $radius; ++$i) {
                imagecopy($imgBlur, $img, 0, 0, 1, 0, $w - 1, $h); // left
                imagecopymerge($imgBlur, $img, 1, 0, 0, 0, $w, $h, 50); // right
                imagecopymerge($imgBlur, $img, 0, 0, 0, 0, $w, $h, 50); // center
                imagecopy($imgCanvas, $imgBlur, 0, 0, 0, 0, $w, $h);

                imagecopymerge($imgBlur, $imgCanvas, 0, 0, 0, 1, $w, $h - 1, 33.33333); // up
                imagecopymerge($imgBlur, $imgCanvas, 0, 1, 0, 0, $w, $h, 25); // down
            }
        }

        if ($threshold) {
            // Calculate the difference between the blurred pixels and the original and set the pixels
            $so = $w - 1;
            for ($x = 0; $x < $so; ++$x) { // each row
                for ($y = 0; $y < $h; ++$y) { // each pixel
                    $rgbOrig = imagecolorat($img, $x, $y);
                    $rOrig = (($rgbOrig >> 16) & 0xFF);
                    $gOrig = (($rgbOrig >> 8) & 0xFF);
                    $bOrig = ($rgbOrig & 0xFF);

                    $rgbBlur = imagecolorat($imgBlur, $x, $y);

                    $rBlur = (($rgbBlur >> 16) & 0xFF);
                    $gBlur = (($rgbBlur >> 8) & 0xFF);
                    $bBlur = ($rgbBlur & 0xFF);

                    // When the masked pixels differ less from the original than the threshold specifies, they are set to their original value.
                    $rNew = (abs($rOrig - $rBlur) >= $threshold) ? max(0, min(255, ($amount * ($rOrig - $rBlur)) + $rOrig)) : $rOrig;
                    $gNew = (abs($gOrig - $gBlur) >= $threshold) ? max(0, min(255, ($amount * ($gOrig - $gBlur)) + $gOrig)) : $gOrig;
                    $bNew = (abs($bOrig - $bBlur) >= $threshold) ? max(0, min(255, ($amount * ($bOrig - $bBlur)) + $bOrig)) : $bOrig;

                    if ($rOrig != $rNew || $gOrig != $gNew || $bOrig != $bNew) {
                        imagesetpixel($img, $x, $y, imagecolorallocate($img, $rNew, $gNew, $bNew));
                    }
                }
            }
        } else {
            for ($x = 0; $x < $w; ++$x) { // each row
                for ($y = 0; $y < $h; ++$y) { // each pixel
                    $rgbOrig = imagecolorat($img, $x, $y);
                    $rOrig = (($rgbOrig >> 16) & 0xFF);
                    $gOrig = (($rgbOrig >> 8) & 0xFF);
                    $bOrig = ($rgbOrig & 0xFF);

                    $rgbBlur = imagecolorat($imgBlur, $x, $y);

                    $rNew = ($amount * ($rOrig - (($rgbBlur >> 16) & 0xFF))) + $rOrig;

                    if ($rNew > 255) {
                        $rNew = 255;
                    } elseif ($rNew < 0) {
                        $rNew = 0;
                    }

                    $gNew = ($amount * ($gOrig - (($rgbBlur >> 8) & 0xFF))) + $gOrig;

                    if ($gNew > 255) {
                        $gNew = 255;
                    } elseif ($gNew < 0) {
                        $gNew = 0;
                    }

                    $bNew = ($amount * ($bOrig - ($rgbBlur & 0xFF))) + $bOrig;

                    if ($bNew > 255) {
                        $bNew = 255;
                    } elseif ($bNew < 0) {
                        $bNew = 0;
                    }

                    imagesetpixel($img, $x, $y, ($rNew << 16) + ($gNew << 8) + $bNew);
                }
            }
        }

        imagedestroy($imgCanvas);
        imagedestroy($imgBlur);

        return $this;
    }
579781
public function make($name, $description, $amount, $currency, array $otherAttributes = [])
    {
        $this->name = $name;
        $this->description = $description;
        $this->amount = $amount;
        $this->currency = $currency;

        $this->_setAttributes($otherAttributes);
        $this->setCreatable(true);

        return $this;
    }
153555
public function validateMin($amount)
    {
        $this->validator_attributes[] = 'data-parsley-min="' . (float)$amount . '"';

        $this->validator_checks['min'] = (float)$amount;

        return $this;
    }
552939
public function setAmount($value)
    {
        if ($value === null || $value === '') {
            $this->_amount = null;
        } else {
            if (!is_scalar($value)) {
                if (!is_object($value) || !method_exists($value, '__toString')) {
                    throw new InvalidPropertyValueTypeException(
                        'Invalid amount value type', 0, 'amount.value', $value
                    );
                }
                $value = (string)$value;
            }
            if (!is_numeric($value) || $value < 0.0) {
                throw new InvalidPropertyValueException(
                    'Invalid amount value "' . $value . '"', 0, 'amount.value', $value
                );
            } elseif ($value < 0.01) {
                $this->_amount = null;
            } else {
                $this->_amount = number_format($value, 2, '.', '');
            }
        }
    }
965117
public function setColumns(int $amount)
    {
        if (!$amount) {
            throw new InvalidArgumentException('Columns amount must be set');
        }

        if ($this->columns === $amount) {
            return $this;
        }

        foreach ($this->structure as &$v) {
            if ($this->columns < $amount) {
                // Add rows
                $v += $amount ? array_fill(0, $amount, $this->cell_example) : [];
            } else {
                // Remove rows from the end
                $v = \array_slice($v, 0, $amount);
            }
        }
        unset($v);

        $this->columns = $amount;

        return $this;
    }
473172
private function setFraction($amount)
    {
        $doubleFraction = $amount * 100;
        $intFraction = ($this->round(abs($doubleFraction))) % 100;
        if($intFraction < 0)
            $intFraction = -$intFraction;
        $this->fraction = $intFraction;
    }
679687
public function setAccounting($account_local_traffic, $enabled, $threshold) {
        $sentence = new SentenceUtil();
        $sentence->addCommand("/ip/accounting/set");
        $sentence->setAttribute("account-local-traffic", $account_local_traffic);
        $sentence->setAttribute("enabled", $enabled);
        $sentence->setAttribute("threshold", $threshold);
        $this->talker->send($sentence);
        return "Sucsess";
    }
191452
public function sale($amount = null)
    {
        $builder = new HpsGiftCardServiceSaleBuilder($this);
        return $builder
            ->withAmount($amount)
            ->withCurrency('usd');
    }
995394
public function spacers(int $count = 1): Writer
    {
        for ($x = 0; $x < $count; $x++) {
            $this->spacer();
        }

        return $this;
    }
600027
public function setAmount($amount)
    {
        $effects = $this->unserializeEffects($this->getSerializedEffects());
        $effects['amount'] = \floatval($amount);
        $this->setEffects($effects);

        return $this;
    }
214297
public function capture($amount = null)
    {
        return (new ManagementBuilder(TransactionType::CAPTURE))
            ->withPaymentMethod($this->transactionReference)
            ->withAmount($amount);
    }
226114
public function setReducedPrice(\Elcodi\Component\Currency\Entity\Interfaces\MoneyInterface $amount)
    {
        $this->reducedPrice = $amount->getAmount();
        $this->reducedPriceCurrency = $amount->getCurrency();

        return $this;
    }
295172
public function lighten($amount)
    {
        if ($amount < 0 || $amount > 100) {
            throw new InvalidArgumentException('The given amount must be between 0 and 100');
        }
        $amount /= 100;
        $this->lightness += (100 - $this->lightness) * $amount;

        return $this;
    }
684427
public function setThreshold($threshold)
    {

        // need to return << true
        if (is_array($threshold) === true) {
            $threshold = array_map('intval', array_splice($threshold, 0, 2));
        }

        else {
            $threshold = intval($threshold);
        }
        $this->validator->verify($threshold, [], 'threshold');

        return $this;
    }
796323
public function setAmount($amount)
    {
        if ($amount < 0) {
            throw new TpvException('Amount must be greater than or equal to 0.');
        }

        $amount = $this->convertNumber($amount);
        $amount = intval(strval($amount * 100));

        $this->_setParameters['DS_MERCHANT_AMOUNT'] = $amount;

        return $this;
    }
648166
private static function roundTowardsZero($amount)
    {
        $result = self::discardDecimalDigitsZero($amount);

        $point = strpos($result, '.');

        if (false !== $point) {
            $result = substr($result, 0, $point);
        }

        return $result;
    }
399258
public function setAmount(MoneyInterface $amount)
    {
        $this->amount = $amount->getAmount();
        $this->amountCurrency = $amount->getCurrency();

        return $this;
    }