From 2d6cfb7b00c58d0d7e405980223c64b026a0a4a8 Mon Sep 17 00:00:00 2001 From: dylangl Date: Sun, 29 Oct 2017 13:48:57 +0800 Subject: [PATCH 01/11] add params id fork --- lib/Gitlab/Api/Projects.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Gitlab/Api/Projects.php b/lib/Gitlab/Api/Projects.php index 489ddb666..11ac2b775 100644 --- a/lib/Gitlab/Api/Projects.php +++ b/lib/Gitlab/Api/Projects.php @@ -498,9 +498,9 @@ public function removeLabel($project_id, $name) * @param int $project_id * @return mixed */ - public function fork($project_id) + public function fork($project_id, array $params) { - return $this->post('projects/'.$this->encodePath($project_id).'/fork'); + return $this->post('projects/'.$this->encodePath($project_id).'/fork', $params); } /** From faf18f41eb6e2864f216a1e0f9a75118405c9c69 Mon Sep 17 00:00:00 2001 From: dylangl Date: Sun, 29 Oct 2017 05:58:06 -0500 Subject: [PATCH 02/11] Update Projects.php --- lib/Gitlab/Api/Projects.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Gitlab/Api/Projects.php b/lib/Gitlab/Api/Projects.php index 11ac2b775..f81d9ff20 100644 --- a/lib/Gitlab/Api/Projects.php +++ b/lib/Gitlab/Api/Projects.php @@ -496,6 +496,7 @@ public function removeLabel($project_id, $name) /** * @param int $project_id + * @param array $params * @return mixed */ public function fork($project_id, array $params) From 43cd60741d2cf1be430c3a12bc0f41c177474823 Mon Sep 17 00:00:00 2001 From: dylangl Date: Sun, 29 Oct 2017 06:19:05 -0500 Subject: [PATCH 03/11] Update Projects.php fork default value --- lib/Gitlab/Api/Projects.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Gitlab/Api/Projects.php b/lib/Gitlab/Api/Projects.php index f81d9ff20..b14c78b4f 100644 --- a/lib/Gitlab/Api/Projects.php +++ b/lib/Gitlab/Api/Projects.php @@ -499,7 +499,7 @@ public function removeLabel($project_id, $name) * @param array $params * @return mixed */ - public function fork($project_id, array $params) + public function fork($project_id, array $params = array()) { return $this->post('projects/'.$this->encodePath($project_id).'/fork', $params); } From d6ad221e3fd27fb06cf315349026325b526d69e9 Mon Sep 17 00:00:00 2001 From: dylangl Date: Mon, 30 Oct 2017 04:08:55 -0500 Subject: [PATCH 04/11] Update Projects.php --- lib/Gitlab/Api/Projects.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Gitlab/Api/Projects.php b/lib/Gitlab/Api/Projects.php index b14c78b4f..2c04688d1 100644 --- a/lib/Gitlab/Api/Projects.php +++ b/lib/Gitlab/Api/Projects.php @@ -501,7 +501,7 @@ public function removeLabel($project_id, $name) */ public function fork($project_id, array $params = array()) { - return $this->post('projects/'.$this->encodePath($project_id).'/fork', $params); + return $this->post($this->getProjectPath($project_id, 'fork'), $params); } /** From cdf00442ceb201173c416513ed5361874c2a7ac9 Mon Sep 17 00:00:00 2001 From: dylangl Date: Tue, 31 Oct 2017 10:57:16 -0500 Subject: [PATCH 05/11] Update Projects.php --- lib/Gitlab/Api/Projects.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Gitlab/Api/Projects.php b/lib/Gitlab/Api/Projects.php index 2c04688d1..72a86e4d2 100644 --- a/lib/Gitlab/Api/Projects.php +++ b/lib/Gitlab/Api/Projects.php @@ -496,7 +496,10 @@ public function removeLabel($project_id, $name) /** * @param int $project_id - * @param array $params + * @param array $params ( + * + * @var string $namespace The ID or path of the namespace that the project will be forked to + * ) * @return mixed */ public function fork($project_id, array $params = array()) From c68e564a9b426837824e6eaf5d12ce5961511ccf Mon Sep 17 00:00:00 2001 From: dylangl Date: Tue, 31 Oct 2017 11:13:19 -0500 Subject: [PATCH 06/11] Update Projects.php --- lib/Gitlab/Api/Projects.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Gitlab/Api/Projects.php b/lib/Gitlab/Api/Projects.php index 72a86e4d2..045763159 100644 --- a/lib/Gitlab/Api/Projects.php +++ b/lib/Gitlab/Api/Projects.php @@ -497,7 +497,7 @@ public function removeLabel($project_id, $name) /** * @param int $project_id * @param array $params ( - * + * * @var string $namespace The ID or path of the namespace that the project will be forked to * ) * @return mixed From 8f1454da728ce33aeb16caf648fdf6dc35ae7992 Mon Sep 17 00:00:00 2001 From: dylangl Date: Wed, 1 Nov 2017 08:54:30 -0500 Subject: [PATCH 07/11] Update Projects.php use the OptionResolver --- lib/Gitlab/Api/Projects.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Gitlab/Api/Projects.php b/lib/Gitlab/Api/Projects.php index 045763159..3eada43a5 100644 --- a/lib/Gitlab/Api/Projects.php +++ b/lib/Gitlab/Api/Projects.php @@ -504,7 +504,12 @@ public function removeLabel($project_id, $name) */ public function fork($project_id, array $params = array()) { - return $this->post($this->getProjectPath($project_id, 'fork'), $params); + $resolver = $this->createOptionsResolver(); + $resolver->setDefined('namespace'); + + $resolved = $resolver->resolve($params); + + return $this->post($this->getProjectPath($project_id, 'fork'), $resolved); } /** From 9682c4529e480699f092e5a350515d60e52b5043 Mon Sep 17 00:00:00 2001 From: dylangl Date: Mon, 13 Nov 2017 20:22:53 -0600 Subject: [PATCH 08/11] Update Projects.php --- lib/Gitlab/Api/Projects.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/Gitlab/Api/Projects.php b/lib/Gitlab/Api/Projects.php index 3eada43a5..a585c3a92 100644 --- a/lib/Gitlab/Api/Projects.php +++ b/lib/Gitlab/Api/Projects.php @@ -502,14 +502,10 @@ public function removeLabel($project_id, $name) * ) * @return mixed */ - public function fork($project_id, array $params = array()) + public function fork($project_id, array $parameters = array()) { $resolver = $this->createOptionsResolver(); - $resolver->setDefined('namespace'); - - $resolved = $resolver->resolve($params); - - return $this->post($this->getProjectPath($project_id, 'fork'), $resolved); + return $this->post($this->getProjectPath($project_id, 'fork'), $resolver->resolve($parameters)); } /** From 4693d29f03497917c154930d1f7291f23a9b5259 Mon Sep 17 00:00:00 2001 From: dylangl Date: Tue, 14 Nov 2017 02:56:26 -0600 Subject: [PATCH 09/11] Update Projects.php --- lib/Gitlab/Api/Projects.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Gitlab/Api/Projects.php b/lib/Gitlab/Api/Projects.php index a585c3a92..5b415fbef 100644 --- a/lib/Gitlab/Api/Projects.php +++ b/lib/Gitlab/Api/Projects.php @@ -502,7 +502,7 @@ public function removeLabel($project_id, $name) * ) * @return mixed */ - public function fork($project_id, array $parameters = array()) + public function fork($project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); return $this->post($this->getProjectPath($project_id, 'fork'), $resolver->resolve($parameters)); From 97336cca047983b3a3322d26ba55e4bc79dc568e Mon Sep 17 00:00:00 2001 From: dylangl Date: Wed, 15 Nov 2017 04:01:47 -0600 Subject: [PATCH 10/11] Update Projects.php --- lib/Gitlab/Api/Projects.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Gitlab/Api/Projects.php b/lib/Gitlab/Api/Projects.php index 5b415fbef..c8dceeb5c 100644 --- a/lib/Gitlab/Api/Projects.php +++ b/lib/Gitlab/Api/Projects.php @@ -505,6 +505,7 @@ public function removeLabel($project_id, $name) public function fork($project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); + return $this->post($this->getProjectPath($project_id, 'fork'), $resolver->resolve($parameters)); } From 2916023c84d5b6ac25342cd4618e172d6b5cefef Mon Sep 17 00:00:00 2001 From: dylangl Date: Wed, 15 Nov 2017 04:42:45 -0600 Subject: [PATCH 11/11] Update Projects.php use `$resolver = new OptionsResolver();` --- lib/Gitlab/Api/Projects.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Gitlab/Api/Projects.php b/lib/Gitlab/Api/Projects.php index c8dceeb5c..f05415057 100644 --- a/lib/Gitlab/Api/Projects.php +++ b/lib/Gitlab/Api/Projects.php @@ -2,6 +2,7 @@ use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; +use Symfony\Component\OptionsResolver\OptionsResolver; class Projects extends AbstractApi { @@ -504,9 +505,12 @@ public function removeLabel($project_id, $name) */ public function fork($project_id, array $parameters = []) { - $resolver = $this->createOptionsResolver(); - - return $this->post($this->getProjectPath($project_id, 'fork'), $resolver->resolve($parameters)); + $resolver = new OptionsResolver(); + $resolver->setDefined('namespace'); + + $resolved = $resolver->resolve($parameters); + + return $this->post($this->getProjectPath($project_id, 'fork'), $resolved); } /**