public function addComparison($varComparison)
    {
        $objComparison = null;

        if (is_array($varComparison)) {
            $varArguments = array_keys($varComparison);
            if (isset($varComparison["subject"])) {
                // Apparently, this is an associative array
                $varArguments = array_values($varComparison);
            }

            try {
                // @todo Replace Reflection with call_user_func_array()
                $objReflection = new \ReflectionClass("Comparison");
                $objComparison = $objReflection->newInstanceArgs($varArguments);
            } catch (\Exception $e) {
                throw new \Exception("Failed to add Comparison: " . $e->getMessage(), 1);
            }

            if (is_object($objComparison)) {
                array_push($this->__comparisons, $objComparison);
            } else {
                throw new \InvalidArgumentException("No valid comparison data supplied in addComparison() method.", 1);
            }
        } elseif (is_object($varComparison) && get_class($varComparison) === "ValidFormBuilder\\Comparison") {
            array_push($this->__comparisons, $varComparison);
        } else {
            throw new \InvalidArgumentException("No valid comparison data supplied in addComparison() method.", 1);
        }
    }
public function addComparison($varComparison)
    {
        $objComparison = null;

        if (is_array($varComparison)) {
            $varArguments = array_keys($varComparison);
            if (isset($varComparison["subject"])) {
                // Apparently, this is an associative array
                $varArguments = array_values($varComparison);
            }

            try {
                // @todo Replace Reflection with call_user_func_array()
                $objReflection = new \ReflectionClass("Comparison");
                $objComparison = $objReflection->newInstanceArgs($varArguments);
            } catch (\Exception $e) {
                throw new \Exception("Failed to add Comparison: " . $e->getMessage(), 1);
            }

            if (is_object($objComparison)) {
                array_push($this->__comparisons, $objComparison);
            } else {
                throw new \InvalidArgumentException("No valid comparison data supplied in addComparison() method.", 1);
            }
        } elseif (is_object($varComparison) && get_class($varComparison) === "ValidFormBuilder\\Comparison") {
            array_push($this->__comparisons, $varComparison);
        } else {
            throw new \InvalidArgumentException("No valid comparison data supplied in addComparison() method.", 1);
        }
    }
public function addComparison ( $ varComparison ) { $ objComparison = null ; if ( is_array ( $ varComparison ) ) { $ varArguments = array_keys ( $ varComparison ) ; if ( isset ( $ varComparison [ "subject" ] ) ) { // Apparently, this is an associative array $ varArguments = array_values ( $ varComparison ) ; } try { // @todo Replace Reflection with call_user_func_array() $ objReflection = new \ ReflectionClass ( "Comparison" ) ; $ objComparison = $ objReflection -> newInstanceArgs ( $ varArguments ) ; } catch ( \ Exception $ e ) { throw new \ Exception ( "Failed to add Comparison: " . $ e -> getMessage ( ) , 1 ) ; } if ( is_object ( $ objComparison ) ) { array_push ( $ this -> __comparisons , $ objComparison ) ; } else { throw new \ InvalidArgumentException ( "No valid comparison data supplied in addComparison() method." , 1 ) ; } } elseif ( is_object ( $ varComparison ) && get_class ( $ varComparison ) === "ValidFormBuilder\\Comparison" ) { array_push ( $ this -> __comparisons , $ varComparison ) ; } else { throw new \ InvalidArgumentException ( "No valid comparison data supplied in addComparison() method." , 1 ) ; } }
Add new comparison to Condition

@param Comparison|array $varComparison Comparison array or Comparison object
@throws \Exception if Reflection couldn't initialize new Comparison object
@throws \InvalidArgumentException if no valid Comparison data is supplied
Add new comparison to Condition