<?php
namespace Intervention\Image\Commands;
use Intervention\Image\Exception\InvalidArgumentException;
class Argument
{
/**
* Command with arguments
*
* @var AbstractCommand
*/
public $command;
/**
* Key of argument in array
*
* @var int
*/
public $key;
/**
* Creates new instance from given command and key
*
* @param AbstractCommand $command
* @param int $key
*/
public function __construct(AbstractCommand $command, $key = 0)
{
$this->command = $command;
$this->key = $key;
}
/**
* Returns name of current arguments command
*
* @return string
*/
public function getCommandName()
{
preg_match("/\\\\([\w]+)Command$/", get_class($this->command), $matches);
return isset($matches[1]) ? lcfirst($matches[1]).'()' : 'Method';
}
/**
* Returns value of current argument
*
* @param mixed $default
* @return mixed
*/
public function value($default = null)
{
$arguments = $this->command->arguments;
if (is_array($arguments)) {
return isset($arguments[$this->key]) ? $arguments[$this->key] : $default;
}
return $default;
}
/**
* Defines current argument as required
*
* @return \Intervention\Image\Commands\Argument
*/
public function required()
{
if ( ! array_key_exists($this->key, $this->command->arguments)) {
throw new InvalidArgumentException(
sprintf("Missing argument %d for %s", $this->key + 1, $this->getCommandName())
);
}
return $this;
}
/**
* Determines that current argument must be of given type
*
* @return \Intervention\Image\Commands\Argument
*/
public function type($type)
{
$valid = true;
$value = $this->value();
if ($value === null) {
return $this;
}
switch (strtolower($type)) {
case 'bool':
case 'boolean':
$valid = \is_bool($value);
$message = '%s accepts only boolean values as argument %d.';
break;
case 'int':
case 'integer':
$valid = \is_int($value);
$message = '%s accepts only integer values as argument %d.';
break;
case 'num':
case 'numeric':
$valid = is_numeric($value);
$message = '%s accepts only numeric values as argument %d.';
break;
case 'str':
case 'string':
$valid = \is_string($value);
$message = '%s accepts only string values as argument %d.';
break;
case 'array':
$valid = \is_array($value);
$message = '%s accepts only array as argument %d.';
break;
case 'closure':
$valid = is_a($value, '\Closure');
$message = '%s accepts only Closure as argument %d.';
break;
case 'digit':
$valid = $this->isDigit($value);
$message = '%s accepts only integer values as argument %d.';
break;
}
if (! $valid) {
$commandName = $this->getCommandName();
$argument = $this->key + 1;
if (isset($message)) {
$message = sprintf($message, $commandName, $argument);
} else {
$message = sprintf('Missing argument for %d.', $argument);
}
throw new InvalidArgumentException(
$message
);
}
return $this;
}
/**
* Determines that current argument value must be numeric between given values
*
* @return \Intervention\Image\Commands\Argument
*/
public function between($x, $y)
{
$value = $this->type('numeric')->value();
if (is_null($value)) {
return $this;
}
$alpha = min($x, $y);
$omega = max($x, $y);
if ($value < $alpha || $value > $omega) {
throw new InvalidArgumentException(
sprintf('Argument %d must be between %s and %s.', $this->key, $x, $y)
);
}
return $this;
}
/**
* Determines that current argument must be over a minimum value
*
* @return \Intervention\Image\Commands\Argument
*/
public function min($value)
{
$v = $this->type('numeric')->value();
if (is_null($v)) {
return $this;
}
if ($v < $value) {
throw new InvalidArgumentException(
sprintf('Argument %d must be at least %s.', $this->key, $value)
);
}
return $this;
}
/**
* Determines that current argument must be under a maxiumum value
*
* @return \Intervention\Image\Commands\Argument
*/
public function max($value)
{
$v = $this->type('numeric')->value();
if (is_null($v)) {
return $this;
}
if ($v > $value) {
throw new InvalidArgumentException(
sprintf('Argument %d may not be greater than %s.', $this->key, $value)
);
}
return $this;
}
/**
* Checks if value is "PHP" integer (120 but also 120.0)
*
* @param mixed $value
* @return boolean
*/
private function isDigit($value)
{
return is_numeric($value) ? intval($value) == $value : false;
}
}
The Kueue Pay Payment Gateway is an innovative technology that facilitates seamless and secure transactions between merchants and their customers. It enables businesses to accept debit and credit card payments both online and in physical stores.
The Kueue Pay Payment Gateway acts as a bridge between a merchant’s website or point-of-sale system and the payment processing network. It securely transmits payment information, authorizes transactions, and provides real-time status updates.
The Kueue Pay Developer API empowers developers and entrepreneurs to integrate the Kueue Pay Payment Gateway directly into their websites or applications. This streamlines the payment process for customers and provides businesses with a customizable and efficient payment solution.
To access the Kueue Pay Developer API, you need to sign up for a developer account on our platform. Once registered, you’ll receive an API key that you can use to authenticate your API requests.
The Kueue Pay Developer API allows you to initiate payments, check the status of payments, and process refunds. You can create a seamless payment experience for your customers while maintaining control over transaction management.
Yes, the Kueue Pay Developer API is designed to accommodate businesses of varying sizes and industries. Whether you’re a small online store or a large enterprise, our API can be tailored to fit your specific payment needs.
The Kueue Pay Developer API is designed with simplicity and ease of use in mind. Our comprehensive documentation, code samples, and developer support resources ensure a smooth integration process for any web platform.
We offer competitive pricing plans for using the Kueue Pay Payment Gateway and Developer API. Details about fees and pricing tiers can be found on our developer portal.
Absolutely, the Kueue Pay Developer API offers customization options that allow you to tailor the payment experience to match your brand and user interface. You can create a seamless and cohesive payment journey for your customers.
We provide dedicated developer support to assist you with any issues or questions you may have during the API integration process. Reach out to our support team at developersupport@NFCPay.com for prompt assistance.
Remember, our goal is to empower your business with a robust and efficient payment solution. If you have any additional questions or concerns, feel free to explore our developer portal or contact our support team.