OEModule\OphCiExamination\models\OphCiExamination_EyeDrawBase::checkItems PHP Method

checkItems() private method

Checks to see if the specified image string contains any of the strings given in the items array.
private checkItems ( string[] $contents, string $image_string ) : boolean
$contents string[] an array of string to look for in the image string.
$image_string string the non-null image string in the form of a JSON EyeDraw string.
return boolean true if any of the items exist; false otherwise.
    private function checkItems($contents, $image_string)
    {
        $hasValues = false;
        /* Dirty hack - see if any of the angle grades have values different
         * to -176 - if they have, it's been set; else move on: */
        $json = json_decode($image_string);
        if ($json) {
            foreach ($json as $element) {
                if ($element->{'subclass'} == 'AngleGrade') {
                    if ($element->{'apexY'} != -176) {
                        $hasValues = true;
                    }
                }
            }
        }
        foreach ($contents as $item) {
            if (strpos($image_string, $item) !== false) {
                $hasValues = true;
            }
        }
        return $hasValues;
    }