Code Duplication    Length = 9-9 lines in 2 locations

lib/private/Comments/Manager.php 2 locations

@@ 776-784 (lines=9) @@
773
	 * Only one resolver shall be registered per type. Otherwise a
774
	 * \OutOfBoundsException has to thrown.
775
	 */
776
	public function registerDisplayNameResolver($type, \Closure $closure) {
777
		if(!is_string($type)) {
778
			throw new \InvalidArgumentException('String expected.');
779
		}
780
		if(isset($this->displayNameResolvers[$type])) {
781
			throw new \OutOfBoundsException('Displayname resolver for this type already registered');
782
		}
783
		$this->displayNameResolvers[$type] = $closure;
784
	}
785
786
	/**
787
	 * resolves a given ID of a given Type to a display name.
@@ 799-807 (lines=9) @@
796
	 * be thrown. It is upon the resolver discretion what to return of the
797
	 * provided ID is unknown. It must be ensured that a string is returned.
798
	 */
799
	public function resolveDisplayName($type, $id) {
800
		if(!is_string($type)) {
801
			throw new \InvalidArgumentException('String expected.');
802
		}
803
		if(!isset($this->displayNameResolvers[$type])) {
804
			throw new \OutOfBoundsException('No Displayname resolver for this type registered');
805
		}
806
		return (string)$this->displayNameResolvers[$type]($id);
807
	}
808
809
	/**
810
	 * returns valid, registered entities