Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
framework
Validator
AllowedProtocols.php
Go to the documentation of this file.
1
<?php
8
namespace
Magento\Framework\Validator
;
9
10
use \Zend\Uri\Uri;
11
18
class
AllowedProtocols
extends
AbstractValidator
19
{
25
private
$listOfProtocols = [
26
'http'
,
27
'https'
,
28
];
29
34
public
function
__construct
($listOfProtocols = [])
35
{
36
if
(count($listOfProtocols)) {
37
$this->listOfProtocols = $listOfProtocols;
38
}
39
}
40
47
public
function
isValid
(
$value
)
48
{
49
$uri =
new
Uri(
$value
);
50
$isValid = in_array(
51
strtolower($uri->getScheme()),
52
$this->listOfProtocols
53
);
54
if
(!$isValid) {
55
$this->
_addMessages
([
"Protocol isn't allowed"
]);
56
}
57
return
$isValid;
58
}
59
}
Magento\Framework\Validator\AllowedProtocols\isValid
isValid($value)
Definition:
AllowedProtocols.php:47
Magento\Framework\Validator\AllowedProtocols
Definition:
AllowedProtocols.php:18
Magento\Framework\Validator\AllowedProtocols\__construct
__construct($listOfProtocols=[])
Definition:
AllowedProtocols.php:34
Magento\Framework\Validator\AbstractValidator
Definition:
AbstractValidator.php:14
$value
$value
Definition:
gender.phtml:16
Magento\Framework\Validator\AbstractValidator\_addMessages
_addMessages(array $messages)
Definition:
AbstractValidator.php:129
Magento\Framework\Validator
Definition:
AbstractValidator.php:6