Exemplo n.º 1
0
 /**
  * @param array $types
  *
  * @throws \InvalidArgumentException
  *
  * @return static
  */
 public function withTypes(array $types)
 {
     $choices = [PlatformInterface::TYPE_MOBILE, PlatformInterface::TYPE_TV, PlatformInterface::TYPE_WEB];
     Assertion::allChoice($types, $choices);
     Assertion::same($types, array_unique($types));
     $instance = clone $this;
     $instance->types = $types;
     return $instance;
 }
Exemplo n.º 2
0
 /**
  * @param array $genres
  *
  * @throws \InvalidArgumentException
  *
  * @return static
  */
 public function withGenres(array $genres)
 {
     $choices = [NewsInterface::GENRE_BLOG, NewsInterface::GENRE_OP_ED, NewsInterface::GENRE_OPINION, NewsInterface::GENRE_SATIRE, NewsInterface::GENRE_USER_GENERATED];
     Assertion::allChoice($genres, $choices);
     Assertion::same($genres, array_unique($genres));
     $instance = clone $this;
     $instance->genres = $genres;
     return $instance;
 }