CouponBlock.php
3 months ago
CouponBlockAttributeParser.php
3 months ago
CouponBlockDetector.php
3 months ago
CouponBlockFailureTranslator.php
3 months ago
CouponBlockGenerationFailureCollector.php
3 months ago
CouponBlockGenerator.php
3 months ago
CouponBlockValidationException.php
3 months ago
CouponBlockValidator.php
3 months ago
EmailContextBuilder.php
1 month ago
index.php
3 months ago
CouponBlockAttributeParser.php
21 lines
| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace MailPoet\EmailEditor\Integrations\MailPoet\Coupons; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | class CouponBlockAttributeParser { |
| 9 | public static function toBoolean($value): bool { |
| 10 | if (is_bool($value)) { |
| 11 | return $value; |
| 12 | } |
| 13 | |
| 14 | if (is_string($value)) { |
| 15 | return in_array(strtolower($value), ['1', 'true', 'yes', 'on'], true); |
| 16 | } |
| 17 | |
| 18 | return (bool)$value; |
| 19 | } |
| 20 | } |
| 21 |