/** * This method will check if a certain assertion mismatches the scope of this function. * * @param \TechDivision\PBC\Interfaces\AssertionInterface $assertion The assertion to check for a possible mismatch * within this function context * * @return boolean */ protected function conditionIsMismatch(AssertionInterface $assertion) { // If the minimal scope is above or below function scope we cannot determine if this is a mismatch in // function scope. if ($assertion->getMinScope() !== 'function') { return false; } // We will get all parameters and check if we can find any of it in the assertion string. // If not then we have a mismatch as the condition is only function scoped $assertionString = $assertion->getString(); $parameterIterator = $this->parameterDefinitions->getIterator(); foreach ($parameterIterator as $parameter) { if (strpos($assertionString, $parameter->name) !== false) { return false; } } // Still here, that does not sound good return true; }