protected function __initInputValidate( array &$data )
    {

        // $data must be a array
        if( !is_array( $data ) ) {
            throw \Exception( "Entity\Base expects a array for it's first argument" );
        }

        // check to see if any keys exist in $this->data that don't in $data
        switch( static::$inputValidate ) {

            case self::VALIDATE_DISABLE:
                break;

            case self::VALIDATE_STRIP:

                $data = \array_intersect_key( $data, $this->data );
                break;

            case self::VALIDATE_EXCEPTION:

                if( $extraKeys = array_diff_key( $data, $this->data ) ) {
                    throw new UnexpectedPropertyException( sprintf(
                        "Entity\Base via %s is not happy with undeclared keys in \$data input array.\nExtras keys not present in \$this->data: %s.\nPassed: %s",
                        get_called_class(),
                        implode( ', ', array_keys( $extraKeys ) ),
                        print_r( $data, true )
                    ));
                }

        }

        return true;

    }
protected function __initInputValidate( array &$data )
    {

        // $data must be a array
        if( !is_array( $data ) ) {
            throw \Exception( "Entity\Base expects a array for it's first argument" );
        }

        // check to see if any keys exist in $this->data that don't in $data
        switch( static::$inputValidate ) {

            case self::VALIDATE_DISABLE:
                break;

            case self::VALIDATE_STRIP:

                $data = \array_intersect_key( $data, $this->data );
                break;

            case self::VALIDATE_EXCEPTION:

                if( $extraKeys = array_diff_key( $data, $this->data ) ) {
                    throw new UnexpectedPropertyException( sprintf(
                        "Entity\Base via %s is not happy with undeclared keys in \$data input array.\nExtras keys not present in \$this->data: %s.\nPassed: %s",
                        get_called_class(),
                        implode( ', ', array_keys( $extraKeys ) ),
                        print_r( $data, true )
                    ));
                }

        }

        return true;

    }
protected function __initInputValidate ( array & $ data ) { // $data must be a array if ( ! is_array ( $ data ) ) { throw \ Exception ( "Entity\Base expects a array for it's first argument" ) ; } // check to see if any keys exist in $this->data that don't in $data switch ( static :: $ inputValidate ) { case self :: VALIDATE_DISABLE : break ; case self :: VALIDATE_STRIP : $ data = \ array_intersect_key ( $ data , $ this -> data ) ; break ; case self :: VALIDATE_EXCEPTION : if ( $ extraKeys = array_diff_key ( $ data , $ this -> data ) ) { throw new UnexpectedPropertyException ( sprintf ( "Entity\Base via %s is not happy with undeclared keys in \$data input array.\nExtras keys not present in \$this->data: %s.\nPassed: %s" , get_called_class ( ) , implode ( ', ' , array_keys ( $ extraKeys ) ) , print_r ( $ data , true ) ) ) ; } } return true ; }
Constructor input validation.
External to the constructor so that the constructor may itself be overloaded more easily.

Does base input validation for the constructor.
Checks, that $data is a array.
Performs input validation as per the entity constructs in static::$inputValidate

@return bool Success
Constructor input validation . External to the constructor so that the constructor may itself be overloaded more easily .