+ /**
+ * Check whether the domain $other meets the specifications of this domain
+ *
+ * If this instance has a null database specifier, then $other can have any database
+ * specified, including the null, and likewise if the schema specifier is null. This
+ * is not transitive like equals() since a domain that explicitly wants a certain
+ * database or schema cannot be satisfied by one of another (nor null). If the prefix
+ * is empty and the DB and schema are both null, then the entire domain is considered
+ * unspecified, and any prefix of $other is considered compatible.
+ *
+ * @param DatabaseDomain|string $other
+ * @return bool
+ * @since 1.32
+ */
+ public function isCompatible( $other ) {
+ if ( $this->isUnspecified() ) {
+ return true; // even the prefix doesn't matter
+ }
+
+ $other = ( $other instanceof self ) ? $other : self::newFromId( $other );
+
+ return (
+ ( $this->database === $other->database || $this->database === null ) &&
+ ( $this->schema === $other->schema || $this->schema === null ) &&
+ $this->prefix === $other->prefix
+ );
+ }
+
+ /**
+ * @return bool
+ * @since 1.32
+ */
+ public function isUnspecified() {
+ return (
+ $this->database === null && $this->schema === null && $this->prefix === ''
+ );
+ }
+