Code Duplication    Length = 4-6 lines in 2 locations

includes/objects.php 2 locations

@@ 130-135 (lines=6) @@
127
		if ( is_object( $object ) ) {
128
			if ( $object instanceof Object\Calendar ) {
129
				return $this->get_object( $object->type, 'feed', $object );
130
			} elseif ( $object instanceof \WP_Post ) {
131
				if ( $type = wp_get_object_terms( $object->ID, 'calendar_type' ) ) {
132
					$name = sanitize_title( current( $type )->name );
133
					return $this->get_object( $name, 'calendar', $object );
134
				}
135
			} elseif ( isset( $object->type ) && isset( $object->id ) ) {
136
				return $this->get_object( $object->type, 'calendar', $object->id );
137
			}
138
		}
@@ 142-145 (lines=4) @@
139
140
		if ( is_int( $object ) ) {
141
			$post = get_post( $object );
142
			if ( $post && ( $type = wp_get_object_terms( $post->ID, 'calendar_type' ) ) ) {
143
				$name = sanitize_title( current( $type )->name );
144
				return $this->get_object( $name, 'calendar', $post );
145
			}
146
		}
147
148
		return null;