/** * Handle the analyze branch command. * * @param \StyleCI\StyleCI\Commands\Analysis\AnalyzeBranchCommand $command * * @return void */ public function handle(AnalyzeBranchCommand $command) { $repo = $command->repo; $branch = $command->branch; $commit = $this->branches->getCommit($repo, $branch); $message = Str::commit($this->commits->get($repo, $commit)['commit']['message']); $analysis = Analysis::create(['repo_id' => $repo->id, 'branch' => $branch, 'commit' => $commit, 'message' => $message, 'status' => Analysis::PENDING, 'hidden' => false]); $this->dispatch(new RunAnalysisJob($analysis)); }
/** * Handle the repo event. * * @param \StyleCI\StyleCI\Events\Repo\RepoEventInterface $event * * @return void */ public function handle(RepoEventInterface $event) { $this->branches->flush($event->repo); }
/** * Trigger the notification. * * @param \StyleCI\StyleCI\Models\Repo $repo * @param string $event * * @return void */ protected function trigger(Repo $repo, $event) { $branches = collect($this->branches->get($repo))->lists('name')->all(); $this->pusher->trigger("repo-{$repo->id}", $event, ['event' => ['branches' => $branches]]); }