public static function fromAnything($relation, array $links=[], array $meta=[]) {
		if (is_array($relation)) {
			$relation = CollectionDocument::fromResources(...$relation);
		}
		
		if ($relation instanceof ResourceInterface) {
			$relationshipObject = self::fromResource($relation, $links, $meta);
		}
		elseif ($relation instanceof CollectionDocument) {
			$relationshipObject = self::fromCollectionDocument($relation, $links, $meta);
		}
		elseif ($relation === null) {
			$relationshipObject = new RelationshipObject(RelationshipObject::TO_ONE);
		}
		else {
			throw new InputException('unknown format of relation "'.gettype($relation).'"');
		}
		
		return $relationshipObject;
	}
public static function fromAnything($relation, array $links=[], array $meta=[]) {
		if (is_array($relation)) {
			$relation = CollectionDocument::fromResources(...$relation);
		}
		
		if ($relation instanceof ResourceInterface) {
			$relationshipObject = self::fromResource($relation, $links, $meta);
		}
		elseif ($relation instanceof CollectionDocument) {
			$relationshipObject = self::fromCollectionDocument($relation, $links, $meta);
		}
		elseif ($relation === null) {
			$relationshipObject = new RelationshipObject(RelationshipObject::TO_ONE);
		}
		else {
			throw new InputException('unknown format of relation "'.gettype($relation).'"');
		}
		
		return $relationshipObject;
	}
public static function fromAnything ( $ relation , array $ links = [ ] , array $ meta = [ ] ) { if ( is_array ( $ relation ) ) { $ relation = CollectionDocument :: fromResources ( ... $ relation ) ; } if ( $ relation instanceof ResourceInterface ) { $ relationshipObject = self :: fromResource ( $ relation , $ links , $ meta ) ; } elseif ( $ relation instanceof CollectionDocument ) { $ relationshipObject = self :: fromCollectionDocument ( $ relation , $ links , $ meta ) ; } elseif ( $ relation === null ) { $ relationshipObject = new RelationshipObject ( RelationshipObject :: TO_ONE ) ; } else { throw new InputException ( 'unknown format of relation "' . gettype ( $ relation ) . '"' ) ; } return $ relationshipObject ; }
create a RelationshipObject from mixed input

@param  mixed  $relation ResourceInterface | ResourceInterface[] | CollectionDocument
@param  array  $links    optional
@param  array  $meta     optional
@return RelationshipObject

@throws InputException if $relation is not one of the supported formats
create a RelationshipObject from mixed input