/** * CommonReport constructor. * * @param GoogleSheetsStorageBuilder $builder * */ public function __construct(GoogleSheetsStorageBuilder $builder) { $this->googleClientBuilder = $builder->getGoogleClientBuilder(); $this->googleDriveApiBuilder = $builder->getGoogleDriveApiBuilder(); $this->googleSheetsApiBuilder = $builder->getGoogleSheetsApiBuilder(); $this->googleClientSecretPath = $builder->getGoogleClientSecretPath(); $this->reportDir = $builder->getReportDir(); $this->reportFile = $builder->getReportFile(); }
/** * @param array $options * * @throws \Assert\AssertionFailedException * @throws \GitLab\Exception\InvalidArgumentException * @throws \Google_Exception * @throws \InvalidArgumentException * @throws \OldTown\GitLabTools\Analizator\Google\Exception\RuntimeException */ public function build(array $options = []) { Assertion::keyExists($options, 'url', 'GitLab url api not specified'); Assertion::keyExists($options, 'token', 'GitLab url token not specified'); Assertion::keyExists($options, 'googleClientSecretPath', 'googleClientSecretPath not specified'); $this->googleSheetsStorage = null; $this->googleSheetsStorageBuilder->setGoogleClientSecretPath($options['googleClientSecretPath'])->setReportDir(self::REPORT_DIR)->setReportFile(self::REPORT_FILE); $this->gitLabDataStorage = null; $this->gitLabDataStorageBuilder->setToken($options['token'])->setUrl($options['url']); $this->storeReports(); }