final public function bindData($data, $ignore = array(), $strict = true, $filter = array())
    {

        $validate = $this->validator;

        if (!is_object($data) && !is_array($data)) {
            throw new Exception(t("Data must be either an object or array"));
            return false;
        }

        $dataArray = is_array($data);
        $dataObject = is_object($data);


        foreach ($this->schema as $k => $v) {

            // internal attributes of an object are ignored
            if (!in_array($k, $ignore)) {
                if ($dataArray && isset($data[$k])) {
                    //If $data[k] is an array?
                    $this->schema[$k]->Value = $data[$k];
                } else if ($dataObject && isset($data->$k)) {
                    $this->schema[$k]->Value = $data->$k;
                }
            }

            //validate. if only just 1 fails, break and throw an error;
            if (isset($this->schema[$k]->Validate) && isset($this->schema[$k]->Value)) {
                $datatype = $this->schema[$k]->Validate;

                $datavalue = $this->schema[$k]->Value;

                if (method_exists($validate, $datatype)) {

                    if (!\call_user_func(array($validate, $datatype), $datavalue)) {
                        //unpair the value
                        unset($this->schema[$k]->Value);

                        //set the error
                        throw new Exception(sprintf(t("%s is not a valid %2s"), $k, $datatype));

                        //throw an exception if in strict mode
                        if ($strict) {
                            break;
                        }
                    }
                }
            }
        }

        //did we have any validation errors
        return (count($this->getErrors()) > 0) ? false : true;
    }