OphCoTherapyapplication_DecisionTreeNode::canAddRule PHP Method

canAddRule() public method

*
public canAddRule ( )
    public function canAddRule()
    {
        // if it's the root node, there are no rules to define for it.
        if (!$this->parent) {
            return false;
        }
        // check the parent response type, and the number of rules already extant
        // if there is room for another one, return true
        if ($this->parent && ($limit = $this->parent->response_type->ruleLimit())) {
            if ($limit <= count($this->rules)) {
                return false;
            }
        }
        return true;
    }