/** * exception thrown when you try to perform an operation on a version * number type where it makes no sense * * @param string $type * the data type that is not supported */ public function __construct($type) { $data = ['type' => $type]; $msg = "operation not supported for version numbers of type '{$type}'"; // all done parent::__construct(400, $msg, $data); }
/** * exception thrown when a method's input parameter has a type that cannot * be processed * * @param string $type * the data type that is not supported */ public function __construct($type) { // our list of args, in case someone wants to dig deeper into // what went wrong $data = $this->buildErrorData($type); // what do we want to tell our error handler? $msg = $this->buildErrorMessage($data['type'], $data['caller']); // all done parent::__construct(400, $msg, $data); }
public function __construct($expression) { $msgData = ['expression' => $expression]; $msg = "Unsupported range expression '{$expression}'"; parent::__construct(400, $msg, $msgData); }
/** * @param mixed $input * the data that is not a string */ public function __construct($input) { parent::__construct(400, "Data of type '" . gettype($input) . "' is not a version string"); }
/** * exception thrown when we have been given two version numbers that are * not compatible with each other * * @param mixed $a * the LHS of the operation that was attempted * @param mixed $b * the RHS of the operation that was attempted */ public function __construct($a, $b) { $msgData = ['typeA' => SimpleType::from($a), 'typeB' => SimpleType::from($b)]; $msg = "RHS (of type '" . $msgData['typeB'] . "') is not compatible with LHS (of type '" . $msgData['typeA'] . "')"; parent::__construct(400, $msg, $msgData); }
public function __construct() { $msg = "a VersionParser is needed to perform this action"; parent::__construct(400, $msg); }
/** * @param string $input * the unknown operator */ public function __construct($input) { parent::__construct(400, "unknown operator '{$input}'"); }
/** * @param VersionNumber $versionNumber * the unsupported type of version number * @param array $supportedTypes * a list of version number types that are supported */ public function __construct(VersionNumber $versionNumber, $supportedTypes) { $msgData = ['versionNumber' => $versionNumber, 'supportedTypes' => $supportedTypes]; $msg = "Unsupported type '" . get_class($versionNumber) . "'; supported types are: {$supportedTypes}"; parent::__construct(400, $msg, $msgData); }
/** * @param string $versionString * the version number that we could not parse */ public function __construct($versionString) { $msgData = ['versionString' => $versionString]; $msg = "Cannot parse version '{$versionString}'"; parent::__construct(400, $msg, $msgData); }