public function setData($data)
    {
        if (!is_array($data) && !is_object($data)) {
            throw new \InvalidArgumentException(sprintf(
                'Expected argument of type array or object, "%s" given',
                is_object($data) ? get_class($data) : gettype($data)
            ));
        }
        $this->data = $data;
        return $this;
    }
public function setData($data)
    {
        if (!is_array($data) && !is_object($data)) {
            throw new \InvalidArgumentException(sprintf(
                'Expected argument of type array or object, "%s" given',
                is_object($data) ? get_class($data) : gettype($data)
            ));
        }
        $this->data = $data;
        return $this;
    }
public function setData ( $ data ) { if ( ! is_array ( $ data ) && ! is_object ( $ data ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Expected argument of type array or object, "%s" given' , is_object ( $ data ) ? get_class ( $ data ) : gettype ( $ data ) ) ) ; } $ this -> data = $ data ; return $ this ; }
Sets data for validation

@param array|object $data
@throws \InvalidArgumentException when argument type is not array or object
@return $this
Sets data for validation