src/Image.php
public function saveStack(Stack $stack, array $requestConfig = [])
    {
        if (empty($stack->getName())) {
            throw new \LogicException('Stack has no name, please set one.');
        }
        if (empty($stack->getOrganization())) {
            $stack->setOrganization($this->defaultOrganization);
        }

        $queryString = [];
        if (isset($requestConfig['overwrite']) && true === $requestConfig['overwrite']) {
            $queryString['overwrite'] = 'true';
        }
        $contents = $this
            ->call(
                'PUT',
                implode('/', [self::STACK_RESOURCE, $stack->getOrganization(), $stack->getName()]),
                ['json' => $stack->getConfig(), 'query' => $queryString]
            )
            ->getBody()
            ->getContents();

        return Stack::createFromJsonResponse($contents);
    }
public function saveStack(Stack $stack, array $requestConfig = [])
    {
        if (empty($stack->getName())) {
            throw new \LogicException('Stack has no name, please set one.');
        }
        if (empty($stack->getOrganization())) {
            $stack->setOrganization($this->defaultOrganization);
        }

        $queryString = [];
        if (isset($requestConfig['overwrite']) && true === $requestConfig['overwrite']) {
            $queryString['overwrite'] = 'true';
        }
        $contents = $this
            ->call(
                'PUT',
                implode('/', [self::STACK_RESOURCE, $stack->getOrganization(), $stack->getName()]),
                ['json' => $stack->getConfig(), 'query' => $queryString]
            )
            ->getBody()
            ->getContents();

        return Stack::createFromJsonResponse($contents);
    }
public function saveStack ( Stack $ stack , array $ requestConfig = [ ] ) { if ( empty ( $ stack -> getName ( ) ) ) { throw new \ LogicException ( 'Stack has no name, please set one.' ) ; } if ( empty ( $ stack -> getOrganization ( ) ) ) { $ stack -> setOrganization ( $ this -> defaultOrganization ) ; } $ queryString = [ ] ; if ( isset ( $ requestConfig [ 'overwrite' ] ) && true === $ requestConfig [ 'overwrite' ] ) { $ queryString [ 'overwrite' ] = 'true' ; } $ contents = $ this -> call ( 'PUT' , implode ( '/' , [ self :: STACK_RESOURCE , $ stack -> getOrganization ( ) , $ stack -> getName ( ) ] ) , [ 'json' => $ stack -> getConfig ( ) , 'query' => $ queryString ] ) -> getBody ( ) -> getContents ( ) ; return Stack :: createFromJsonResponse ( $ contents ) ; }
Save a stack on rokka.

Example:
```language-php
$stack = new Stack(null, 'teststack');
$stack->addStackOperation(new StackOperation('resize', ['width' => 200, 'height' => 200]));
$stack->addStackOperation(new StackOperation('rotate', ['angle' => 45]));
$stack->setStackOptions(['jpg.quality' => 80]);
$requestConfig = ['overwrite' => true];
$stack = $client->saveStack($stack, $requestConfig);
echo 'Created stack ' . $stack->getName() . PHP_EOL;
```
The only requestConfig option currently can be
['overwrite' => true|false] (false is the default)

@since 1.1.0

@param Stack $stack         the Stack object to be saved
@param array $requestConfig options for the request

@throws GuzzleException
@throws \LogicException   when stack name is not set
@throws \RuntimeException

@return Stack
Save a stack on rokka .