This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
40
{
41
if (null == $var) {
42
return true;
43
}
44
if (!($var instanceof $instanceOf)) {
45
return false;
46
}
47
return false;
48
}
49
50
protected function isValidArray($arr, $instanceOf, $minCount = -1, $maxCount = -1)
51
{
52
if (null == $arr) {
53
return false;
54
}
55
if (!is_array($arr)) {
56
return false;
57
}
58
$numberOfItem = count($arr);
59
if (-1 != $minCount && $numberOfItem < $minCount) {
60
return false;
61
}
62
if (-1 != $maxCount && $numberOfItem > $maxCount) {
63
return false;
64
}
65
foreach ($arr as $item) {
66
if (!($item instanceof $instanceOf)) {
67
return false;
68
}
69
}
70
return true;
71
}
72
73
protected function isChildArrayOK(array $arr, &$msg)
74
{
75
foreach ($arr as $item) {
76
if (!($item instanceof IsOK)) {
77
$msg = "Child item is not an instance of IsOK";
78
return false;
79
}
80
if (!$item->isOK($msg)) {
81
return false;
82
}
83
}
84
}
85
86
abstract protected function isOK(&$msg = null);
87
88
protected function isURLValid($url)
89
{
90
if (!isStringNotNull($url)) {
91
return false;
92
}
93
if (false === filter_var($url, FILTER_VALIDATE_URL)) {
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.