Файловый менеджер - Редактировать - /var/www/html/VariableTypes.zip
Ðазад
PK ! %�;� � CountryCodeType.phpnu �[��� <?php /* * Created by tpay.com. * Date: 19.06.2017 * Time: 14:39 */ namespace Omnipay\Tpay\_class_tpay\Validators\VariableTypes; use Omnipay\Tpay\_class_tpay\Utilities\TException; use Omnipay\Tpay\_class_tpay\Validators\VariableTypesInterface; use Omnipay\Tpay\Dictionaries\ISO_codes\CountryCodesDictionary; class CountryCodeType implements VariableTypesInterface { public function validateType($value, $name) { if (!is_string($value) || (strlen($value) !== 2 && strlen($value) !== 3) || (!in_array($value, CountryCodesDictionary::CODES)) ) { throw new TException( sprintf('Field "%s" has invalid country code', $name) ); } } } PK ! ?��Z� � BooleanType.phpnu �[��� <?php /* * Created by tpay.com. * Date: 19.06.2017 * Time: 14:39 */ namespace Omnipay\Tpay\_class_tpay\Validators\VariableTypes; use Omnipay\Tpay\_class_tpay\Utilities\TException; use Omnipay\Tpay\_class_tpay\Validators\VariableTypesInterface; class BooleanType implements VariableTypesInterface { public function validateType($value, $name) { if (!is_bool($value)) { throw new TException(sprintf('Field "%s" must be a boolean', $name)); } } } PK ! �X� � ArrayType.phpnu �[��� <?php /* * Created by tpay.com. * Date: 19.06.2017 * Time: 14:39 */ namespace Omnipay\Tpay\_class_tpay\Validators\VariableTypes; use Omnipay\Tpay\_class_tpay\Utilities\TException; use Omnipay\Tpay\_class_tpay\Validators\VariableTypesInterface; class ArrayType implements VariableTypesInterface { public function validateType($value, $name) { if (!is_array($value)) { throw new TException(sprintf('Field "%s" must be an array', $name)); } else { if (count($value) <= 0) { throw new TException(sprintf('Array "%s" must not be empty', $name)); } } } } PK ! ���^O O DescriptionType.phpnu �[��� <?php /* * Created by tpay.com. * Date: 19.06.2017 * Time: 14:39 */ namespace Omnipay\Tpay\_class_tpay\Validators\VariableTypes; use Omnipay\Tpay\_class_tpay\Utilities\TException; use Omnipay\Tpay\_class_tpay\Validators\VariableTypesInterface; class DescriptionType implements VariableTypesInterface { public function validateType($value, $name) { if (preg_match('/[^a-zA-Z0-9 ]/', $value) !== 0) { throw new TException( sprintf('Field "%s" contains invalid characters. Only a-z A-Z 0-9 and space', $name) ); } } } PK ! ���� � VariableTypesValidator.phpnu �[��� <?php /* * Created by tpay.com. * Date: 26.06.2017 * Time: 12:28 */ namespace Omnipay\Tpay\_class_tpay\Validators\VariableTypes; use Omnipay\Tpay\_class_tpay\Utilities\TException; use Omnipay\Tpay\Dictionaries\FieldsConfigDictionary; class VariableTypesValidator { public function __construct($type, $value, $name) { $this->validateType($type, $value, $name); } /** * @param string $type * @param $value * @param string $name * @throws TException */ private function validateType($type, $value, $name) { $a = [ FieldsConfigDictionary::FLOAT => new FloatType(), FieldsConfigDictionary::STRING => new StringType(), FieldsConfigDictionary::INT => new IntType(), FieldsConfigDictionary::EMAIL_LIST => new EmailListType(), FieldsConfigDictionary::ARR => new ArrayType(), FieldsConfigDictionary::BOOLEAN => new BooleanType(), FieldsConfigDictionary::OPIS_DODATKOWY => new DescriptionType(), 'CountryCode' => new CountryCodeType(), ]; if (array_key_exists($type, $a)) { foreach ($a as $key => $value2) { if ($key === $type) { $value2->validateType($value, $name); } } } } } PK ! yr�� � FloatType.phpnu �[��� <?php /* * Created by tpay.com. * Date: 19.06.2017 * Time: 14:39 */ namespace Omnipay\Tpay\_class_tpay\Validators\VariableTypes; use Omnipay\Tpay\_class_tpay\Utilities\TException; use Omnipay\Tpay\_class_tpay\Validators\VariableTypesInterface; class FloatType implements VariableTypesInterface { public function validateType($value, $name) { if (!is_numeric($value) && !is_int($value)) { throw new TException(sprintf('Field "%s" must be a float|int number', $name)); } else { if ($value < 0) { throw new TException(sprintf('Field "%s" must be higher than zero', $name)); } } } } PK ! �J� StringType.phpnu �[��� <?php /* * Created by tpay.com. * Date: 19.06.2017 * Time: 14:39 */ namespace Omnipay\Tpay\_class_tpay\Validators\VariableTypes; use Omnipay\Tpay\_class_tpay\Utilities\TException; use Omnipay\Tpay\_class_tpay\Validators\VariableTypesInterface; class StringType implements VariableTypesInterface { public function validateType($value, $name) { if (!is_string($value)) { throw new TException(sprintf('Field "%s" must be a string, type given: ' . gettype($value), $name)); } } } PK ! @M; ; EmailListType.phpnu �[��� <?php /* * Created by tpay.com. * Date: 19.06.2017 * Time: 14:39 */ namespace Omnipay\Tpay\_class_tpay\Validators\VariableTypes; use Omnipay\Tpay\_class_tpay\Utilities\TException; use Omnipay\Tpay\_class_tpay\Validators\VariableTypesInterface; class EmailListType implements VariableTypesInterface { public function validateType($value, $name) { if (!is_string($value)) { throw new TException(sprintf('Field "%s" must be a string', $name)); } $emails = explode(',', $value); foreach ($emails as $email) { if (filter_var($email, FILTER_VALIDATE_EMAIL) === false && strlen($email) > 0) { throw new TException( sprintf('Field "%s" contains invalid email address', $name) ); } } } } PK ! ��'�� � IntType.phpnu �[��� <?php /* * Created by tpay.com. * Date: 19.06.2017 * Time: 14:39 */ namespace Omnipay\Tpay\_class_tpay\Validators\VariableTypes; use Omnipay\Tpay\_class_tpay\Utilities\TException; use Omnipay\Tpay\_class_tpay\Validators\VariableTypesInterface; class IntType implements VariableTypesInterface { public function validateType($value, $name) { if (!is_int($value)) { throw new TException(sprintf('Field "%s" must be an integer', $name)); } else { if ($value <= 0) { throw new TException(sprintf('Field "%s" must be higher than zero', $name)); } } } } PK ! %�;� � CountryCodeType.phpnu �[��� PK ! ?��Z� � # BooleanType.phpnu �[��� PK ! �X� � N ArrayType.phpnu �[��� PK ! ���^O O DescriptionType.phpnu �[��� PK ! ���� � � VariableTypesValidator.phpnu �[��� PK ! yr�� � w FloatType.phpnu �[��� PK ! �J� W StringType.phpnu �[��� PK ! @M; ; � EmailListType.phpnu �[��� PK ! ��'�� � IntType.phpnu �[��� PK � �
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка