Bart\Git\Commit::getProjectName PHP Method

getProjectName() public method

public getProjectName ( ) : string
return string Name of the repository in which commit was made. This may or may not include the ".git" suffix
    public function getProjectName()
    {
        return $this->projectName;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Run the action
  * @param Commit $commit commit to verify
  * @throws GitHookException if requirement fails
  */
 public function run(Commit $commit)
 {
     $frozenRepos = $this->config->frozenRepoNames();
     if (count($frozenRepos) == 0) {
         $this->logger->debug("No frozen repos.");
         return;
     }
     // Super users are exempt from frozen checks
     // So hope they don't do anything bad by mistake!
     if ($this->isSuperUser()) {
         $this->logger->debug("Superuser exempt from freeze");
         return;
     }
     if ($frozenRepos === ['all']) {
         throw new GitHookException('All repositories are frozen.');
     }
     $project = $commit->getProjectName();
     $this->logger->debug("Validating if {$project} is frozen");
     if (in_array($project, $frozenRepos)) {
         throw new GitHookException("{$project} repository is frozen.");
     }
 }
All Usage Examples Of Bart\Git\Commit::getProjectName