manual_post_collection = $manual_post_collection; $this->automatic_post_collection = $automatic_post_collection; } /** * Determines which collection class is needed. * * @param string $collection_type The type of collection. * * @throws Exception Throws when an invalid type is given. * @return Post_Collection_Interface */ public function get_post_collection( string $collection_type ): Post_Collection_Interface { switch ( $collection_type ) { case 'manual': return $this->manual_post_collection; case 'auto': return $this->automatic_post_collection; default: throw new Exception( 'Invalid collection type provided' ); } } }