src/Core/Stack.php
public static function createFromDecodedJsonResponse($data)
    {
        $stack_operations = [];
        if (isset($data['stack_operations']) && \is_array($data['stack_operations'])) {
            foreach ($data['stack_operations'] as $operation) {
                $stack_operations[] = StackOperation::createFromDecodedJsonResponse($operation);
            }
        }

        $stack = new self(
            $data['organization'],
            $data['name'],
            $stack_operations,
            [],
            new \DateTime($data['created'])
        );

        if (isset($data['stack_options']) && \is_array($data['stack_options'])) {
            $stack->setStackOptions($data['stack_options']);
        }

        if (isset($data['stack_variables']) && \is_array($data['stack_variables'])) {
            $stack->setStackVariables($data['stack_variables']);
        }

        if (isset($data['stack_expressions']) && \is_array($data['stack_expressions'])) {
            $stack_expressions = [];
            foreach ($data['stack_expressions'] as $expression) {
                $stack_expressions[] = StackExpression::createFromDecodedJsonResponse($expression);
            }

            $stack->setStackExpressions($stack_expressions);
        }

        return $stack;
    }
public static function createFromDecodedJsonResponse($data)
    {
        $stack_operations = [];
        if (isset($data['stack_operations']) && \is_array($data['stack_operations'])) {
            foreach ($data['stack_operations'] as $operation) {
                $stack_operations[] = StackOperation::createFromDecodedJsonResponse($operation);
            }
        }

        $stack = new self(
            $data['organization'],
            $data['name'],
            $stack_operations,
            [],
            new \DateTime($data['created'])
        );

        if (isset($data['stack_options']) && \is_array($data['stack_options'])) {
            $stack->setStackOptions($data['stack_options']);
        }

        if (isset($data['stack_variables']) && \is_array($data['stack_variables'])) {
            $stack->setStackVariables($data['stack_variables']);
        }

        if (isset($data['stack_expressions']) && \is_array($data['stack_expressions'])) {
            $stack_expressions = [];
            foreach ($data['stack_expressions'] as $expression) {
                $stack_expressions[] = StackExpression::createFromDecodedJsonResponse($expression);
            }

            $stack->setStackExpressions($stack_expressions);
        }

        return $stack;
    }
public static function createFromDecodedJsonResponse ( $ data ) { $ stack_operations = [ ] ; if ( isset ( $ data [ 'stack_operations' ] ) && \ is_array ( $ data [ 'stack_operations' ] ) ) { foreach ( $ data [ 'stack_operations' ] as $ operation ) { $ stack_operations [ ] = StackOperation :: createFromDecodedJsonResponse ( $ operation ) ; } } $ stack = new self ( $ data [ 'organization' ] , $ data [ 'name' ] , $ stack_operations , [ ] , new \ DateTime ( $ data [ 'created' ] ) ) ; if ( isset ( $ data [ 'stack_options' ] ) && \ is_array ( $ data [ 'stack_options' ] ) ) { $ stack -> setStackOptions ( $ data [ 'stack_options' ] ) ; } if ( isset ( $ data [ 'stack_variables' ] ) && \ is_array ( $ data [ 'stack_variables' ] ) ) { $ stack -> setStackVariables ( $ data [ 'stack_variables' ] ) ; } if ( isset ( $ data [ 'stack_expressions' ] ) && \ is_array ( $ data [ 'stack_expressions' ] ) ) { $ stack_expressions = [ ] ; foreach ( $ data [ 'stack_expressions' ] as $ expression ) { $ stack_expressions [ ] = StackExpression :: createFromDecodedJsonResponse ( $ expression ) ; } $ stack -> setStackExpressions ( $ stack_expressions ) ; } return $ stack ; }
Create a stack from a decoded JSON data returned by the rokka.io API.

@param array $data Decoded JSON data

@return Stack
Create a stack from a decoded JSON data returned by the rokka . io API .