Skip to content

Commit e17d7bd

Browse files
donkiddm1guelpf
authored andcommitted
1 parent f3565b6 commit e17d7bd

File tree

3 files changed

+296
-290
lines changed

3 files changed

+296
-290
lines changed

lib/Gitlab/Api/Projects.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,4 +880,15 @@ public function updateBadge($project_id, $badge_id, array $params = array())
880880
{
881881
return $this->put($this->getProjectPath($project_id, 'badges/' . $this->encodePath($badge_id)));
882882
}
883+
884+
885+
/**
886+
* @param int $project_id
887+
* @param array $params
888+
* @return mixed
889+
*/
890+
public function addProtectedBranch(int $project_id, array $params = [])
891+
{
892+
return $this->post($this->getProjectPath($project_id,'protected_branches'),$params);
893+
}
883894
}

lib/Gitlab/Model/Project.php

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ public static function createForUser($user_id, Client $client, $name, array $par
151151

152152
return static::fromArray($client, $data);
153153
}
154+
154155
/**
155156
* @param int $id
156157
* @param Client $client
@@ -277,9 +278,9 @@ public function removeMember($user_id)
277278
/**
278279
* @param array $parameters
279280
*
281+
* @return ProjectHook[]
280282
* @see Projects::hooks() for available parameters.
281283
*
282-
* @return ProjectHook[]
283284
*/
284285
public function hooks(array $parameters = [])
285286
{
@@ -494,9 +495,9 @@ public function tags()
494495
/**
495496
* @param array $parameters
496497
*
498+
* @return Commit[]
497499
* @see Repositories::commits() for available parameters.
498500
*
499-
* @return Commit[]
500501
*/
501502
public function commits(array $parameters = [])
502503
{
@@ -525,9 +526,9 @@ public function commit($sha)
525526
* @param string $ref
526527
* @param array $parameters
527528
*
529+
* @return Commit[]
528530
* @see Repositories::commitComments() for available parameters.
529531
*
530-
* @return Commit[]
531532
*/
532533
public function commitComments($ref, array $parameters = [])
533534
{
@@ -621,8 +622,14 @@ public function getFile($sha, $filepath)
621622
* @param string $author_name
622623
* @return File
623624
*/
624-
public function createFile($file_path, $content, $branch_name, $commit_message, $author_email = null, $author_name = null)
625-
{
625+
public function createFile(
626+
$file_path,
627+
$content,
628+
$branch_name,
629+
$commit_message,
630+
$author_email = null,
631+
$author_name = null
632+
) {
626633
$parameters = [
627634
'file_path' => $file_path,
628635
'branch' => $branch_name,
@@ -652,8 +659,14 @@ public function createFile($file_path, $content, $branch_name, $commit_message,
652659
* @param string $author_name
653660
* @return File
654661
*/
655-
public function updateFile($file_path, $content, $branch_name, $commit_message, $author_email = null, $author_name = null)
656-
{
662+
public function updateFile(
663+
$file_path,
664+
$content,
665+
$branch_name,
666+
$commit_message,
667+
$author_email = null,
668+
$author_name = null
669+
) {
657670
$parameters = [
658671
'file_path' => $file_path,
659672
'branch' => $branch_name,
@@ -706,9 +719,9 @@ public function deleteFile($file_path, $branch_name, $commit_message, $author_em
706719
/**
707720
* @param array $parameters
708721
*
722+
* @return Event[]
709723
* @see Projects::events() for available parameters.
710724
*
711-
* @return Event[]
712725
*/
713726
public function events(array $parameters = [])
714727
{
@@ -725,9 +738,9 @@ public function events(array $parameters = [])
725738
/**
726739
* @param array $parameters
727740
*
741+
* @return MergeRequest[]
728742
* @see MergeRequests::all() for available parameters.
729743
*
730-
* @return MergeRequest[]
731744
*/
732745
public function mergeRequests(array $parameters = [])
733746
{
@@ -762,7 +775,8 @@ public function mergeRequest($id)
762775
*/
763776
public function createMergeRequest($source, $target, $title, $assignee = null, $description = null)
764777
{
765-
$data = $this->client->mergeRequests()->create($this->id, $source, $target, $title, $assignee, $this->id, $description);
778+
$data = $this->client->mergeRequests()->create($this->id, $source, $target, $title, $assignee, $this->id,
779+
$description);
766780

767781
return MergeRequest::fromArray($this->getClient(), $this, $data);
768782
}
@@ -815,9 +829,9 @@ public function mergeMergeRequest($id)
815829
/**
816830
* @param array $parameters
817831
*
832+
* @return Issue[]
818833
* @see Issues::all() for available parameters.
819834
*
820-
* @return Issue[]
821835
*/
822836
public function issues(array $parameters = [])
823837
{
@@ -893,9 +907,9 @@ public function openIssue($iid)
893907
/**
894908
* @param array $parameters
895909
*
910+
* @return Milestone[]
896911
* @see Milestones::all() for available parameters.
897912
*
898-
* @return Milestone[]
899913
*/
900914
public function milestones(array $parameters = [])
901915
{
@@ -1274,4 +1288,14 @@ public function removeBadge($badge_id)
12741288

12751289
return true;
12761290
}
1291+
1292+
/**
1293+
* @param array $params
1294+
* @return Branch
1295+
*/
1296+
public function addProtectedBranch(array $params = [])
1297+
{
1298+
$data = $this->client->projects()->addProtectedBranch($this->id, $params);
1299+
return Branch::fromArray($this->getClient(), $this, $data);
1300+
}
12771301
}

0 commit comments

Comments
 (0)