src/Model/Environment.php
public function setVariable(
        $name,
        $value,
        $json = false,
        $enabled = true,
        $sensitive = false
    )
    {
        if (!is_scalar($value)) {
            $value = json_encode($value);
            $json = true;
        }
        $values = ['value' => $value, 'is_json' => $json, 'is_enabled' => $enabled];
        if ($sensitive) {
            $values['is_sensitive'] = $sensitive;
        }
        $existing = $this->getVariable($name);
        if ($existing) {
            return $existing->update($values);
        }
        $values['name'] = $name;

        return Variable::create($values, $this->getLink('#manage-variables'), $this->client);
    }
public function setVariable(
        $name,
        $value,
        $json = false,
        $enabled = true,
        $sensitive = false
    )
    {
        if (!is_scalar($value)) {
            $value = json_encode($value);
            $json = true;
        }
        $values = ['value' => $value, 'is_json' => $json, 'is_enabled' => $enabled];
        if ($sensitive) {
            $values['is_sensitive'] = $sensitive;
        }
        $existing = $this->getVariable($name);
        if ($existing) {
            return $existing->update($values);
        }
        $values['name'] = $name;

        return Variable::create($values, $this->getLink('#manage-variables'), $this->client);
    }
public function setVariable ( $ name , $ value , $ json = false , $ enabled = true , $ sensitive = false ) { if ( ! is_scalar ( $ value ) ) { $ value = json_encode ( $ value ) ; $ json = true ; } $ values = [ 'value' => $ value , 'is_json' => $ json , 'is_enabled' => $ enabled ] ; if ( $ sensitive ) { $ values [ 'is_sensitive' ] = $ sensitive ; } $ existing = $ this -> getVariable ( $ name ) ; if ( $ existing ) { return $ existing -> update ( $ values ) ; } $ values [ 'name' ] = $ name ; return Variable :: create ( $ values , $ this -> getLink ( '#manage-variables' ) , $ this -> client ) ; }
Set a variable

@param string $name
@param mixed  $value
@param bool   $json
@param bool   $enabled
@param bool   $sensitive

@return Result
Set a variable