Passed
Push — master ( 705e3b...7aff0e )
by Christopher
04:03 queued 13s
created

IsOK.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace AlgoWeb\ODataMetadata
3
4
abstract class IsOK
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_ABSTRACT, expecting ';' or '{'
Loading history...
5
{
6
    abstract protected function IsOK(&$msg);
7
8
    public protected function isStringNotNullOrEmpty($str){
9
        if($this->isStringNull($str)){
10
            return false;
11
        }
12
        if(empty(trim($str))){
13
           return false;
14
        }
15
        return true;
16
    }
17
18
    public protected function isStringNotNull($str)
19
    {
20
        if(null == $str){
21
           return false;
22
        if(!is_string($str)){
23
           return false;
24
        }
25
        return true;
26
    }
27
28
    public protected  function isNotNullIstanceOf($var, $insanceOf){
29
        if(null == $var){
30
            return false;
31
        }
32
        if(!($var instanceof $insanceOf)){
33
            return false;
34
        }
35
        return true;
36
    }
37
38
    public protected function isValidArray($arr, $insanceOf, $minCount = -1, $maxCount = -1){
39
        if(null == $arr){
40
            return false;
41
        }
42
        if(!is_array ($arr)){
43
            return false;
44
        }
45
        if($minCount != -1 && count($arr) < $minCount){
46
            return false;
47
        }
48
        if($maxCount != -1 && count($arr) > $maxCount){
49
            return false;
50
        }
51
        foreach($arr as $item){
52
            if(!($item instanceof $insanceOf)){
53
                return false;
54
            }
55
        }
56
        return true;
57
    }
58
}
59