Skip to content

Commit

Permalink
Removed validation of parameters
Browse files Browse the repository at this point in the history
removed MissingArgumentException
  • Loading branch information
SergkeiM committed Mar 10, 2023
1 parent 289c0ab commit cbf08fc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
11 changes: 0 additions & 11 deletions lib/Github/Api/Environment/Secrets.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Github\Api\Environment;

use Github\Api\AbstractApi;
use Github\Exception\MissingArgumentException;

/**
* @link https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28
Expand Down Expand Up @@ -45,20 +44,10 @@ public function show(int $id, string $name, string $secretName)
* @param string $secretName
* @param array $parameters
*
* @throws MissingArgumentException
*
* @return array|string
*/
public function createOrUpdate(int $id, string $name, string $secretName, array $parameters = [])
{
if (!isset($parameters['encrypted_value'])) {
throw new MissingArgumentException(['encrypted_value']);
}

if (!isset($parameters['key_id'])) {
throw new MissingArgumentException(['key_id']);
}

return $this->put('/repositories/'.$id.'/environments/'.rawurlencode($name).'/secrets/'.rawurlencode($secretName), $parameters);
}

Expand Down
13 changes: 0 additions & 13 deletions lib/Github/Api/Environment/Variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Github\Api\Environment;

use Github\Api\AbstractApi;
use Github\Exception\MissingArgumentException;

/**
* @link https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28
Expand Down Expand Up @@ -44,20 +43,10 @@ public function show(int $id, string $name, string $variableName)
* @param string $name
* @param array $parameters
*
* @throws MissingArgumentException
*
* @return array|string
*/
public function create(int $id, string $name, array $parameters)
{
if (!isset($parameters['name'])) {
throw new MissingArgumentException(['name']);
}

if (!isset($parameters['value'])) {
throw new MissingArgumentException(['value']);
}

return $this->post('/repositories/'.$id.'/environments/'.rawurlencode($name).'/variables', $parameters);
}

Expand All @@ -69,8 +58,6 @@ public function create(int $id, string $name, array $parameters)
* @param string $variableName
* @param array $parameters
*
* @throws MissingArgumentException
*
* @return array|string
*/
public function update(int $id, string $name, string $variableName, array $parameters)
Expand Down

0 comments on commit cbf08fc

Please sign in to comment.