diff --git a/src/Configuration.php b/src/Configuration.php new file mode 100644 index 0000000..2aacd2b --- /dev/null +++ b/src/Configuration.php @@ -0,0 +1,114 @@ +ownerList->add(...$owners); + + return $this; + } + + public function packages(): array + { + $repositories = $this->repositoryList->toArray(); + + foreach ($this->ownerList->toArray() as $organization) { + $repositories = array_merge($repositories, $organization->repositories()); + } + + return array_diff($repositories, $this->skippedRepositoryList->toArray()); + } + + public function repositories(string ...$repositories): self + { + $this->repositoryList->add(...$repositories); + + return $this; + } + + public function repositoryList(): RepositoryList + { + return $this->repositoryList; + } + + public function skip(string ...$repositories): self + { + $this->skippedRepositoryList->add(...$repositories); + + return $this; + } + + public function skipTopics(string ...$topics): self + { + $this->skippedTopicList->add(...$topics); + + return $this; + } + + public function taskList(): TaskList + { + return $this->taskList; + } + + /** + * @param array,array|string>> $tasks + * + * @return $this + */ + public function tasks(array $tasks): self + { + $this->taskList->add($tasks); + + return $this; + } + + public function workspace(): WorkspaceInterface + { + return $this->workspace; + } + + public static function new(?string $workingDirectory = null): self + { + $workingDirectory = match ($workingDirectory) { + null => getcwd() ?: sys_get_temp_dir(), + default => $workingDirectory, + }; + + return new self( + OwnerList::new(), + RepositoryList::new(), + SkippedRepositoryList::new(), + SkippedTopicList::new(), + TaskList::new(), + Workspace::new($workingDirectory), + ); + } +}