The Helper class is a collection of static utility methods used throughout the myPOS IPC SDK. These include input validation, HTML sanitization, and array manipulation functions commonly required when handling API requests.
Class Information
Namespace:Mypos\IPC
File:Helper.php
Type: Static utility class
Method Summary
Method
Return Type
Description
isValidEmail(string $email)
bool
Validates an email address.
isValidURL(string $url)
bool
Validates a URL.
isValidIP(string $ip)
bool
Validates an IPv4 or IPv6 address.
isValidName(string $name)
bool
Checks if a customer name is valid.
isValidAmount(float $amt)
bool
Validates if the amount is a positive number.
isValidCartQuantity(int $quantity)
bool
Ensures quantity is a valid positive integer.
isValidTrnRef(string $trnref)
bool
Validates a transaction reference string.
isValidOrderId(string $orderId)
bool
Validates an order ID format.
isValidOutputFormat(string $outputFormat)
bool
Validates if the format is supported (json, xml, post).
isValidCardNumber($cardNo)
bool
Validates a card number using standard checks (Luhn algorithm, etc.).
isValidCVC($cvc)
bool
Validates the CVC code (3 or 4 digits).
HTML Utility Methods
Method
Return Type
Description
escape(string $text)
string
Escapes HTML special characters for safe output.
unescape(string $text)
string
Converts escaped HTML characters back to normal text.