src/Transaction/MultiExec.php
private function checkBeforeExecution($callable)
    {
        if ($this->state->isExecuting()) {
            throw new ClientException(
                'Cannot invoke "execute" or "exec" inside an active transaction context.'
            );
        }

        if ($callable) {
            if (!is_callable($callable)) {
                throw new \InvalidArgumentException('The argument must be a callable object.');
            }

            if (!$this->commands->isEmpty()) {
                $this->discard();

                throw new ClientException(
                    'Cannot execute a transaction block after using fluent interface.'
                );
            }
        } elseif ($this->attempts) {
            $this->discard();

            throw new ClientException(
                'Automatic retries are supported only when a callable block is provided.'
            );
        }
    }
private function checkBeforeExecution($callable)
    {
        if ($this->state->isExecuting()) {
            throw new ClientException(
                'Cannot invoke "execute" or "exec" inside an active transaction context.'
            );
        }

        if ($callable) {
            if (!is_callable($callable)) {
                throw new \InvalidArgumentException('The argument must be a callable object.');
            }

            if (!$this->commands->isEmpty()) {
                $this->discard();

                throw new ClientException(
                    'Cannot execute a transaction block after using fluent interface.'
                );
            }
        } elseif ($this->attempts) {
            $this->discard();

            throw new ClientException(
                'Automatic retries are supported only when a callable block is provided.'
            );
        }
    }
private function checkBeforeExecution ( $ callable ) { if ( $ this -> state -> isExecuting ( ) ) { throw new ClientException ( 'Cannot invoke "execute" or "exec" inside an active transaction context.' ) ; } if ( $ callable ) { if ( ! is_callable ( $ callable ) ) { throw new \ InvalidArgumentException ( 'The argument must be a callable object.' ) ; } if ( ! $ this -> commands -> isEmpty ( ) ) { $ this -> discard ( ) ; throw new ClientException ( 'Cannot execute a transaction block after using fluent interface.' ) ; } } elseif ( $ this -> attempts ) { $ this -> discard ( ) ; throw new ClientException ( 'Automatic retries are supported only when a callable block is provided.' ) ; } }
Checks the state of the transaction before execution.

@param mixed $callable Callback for execution.

@throws \InvalidArgumentException
@throws ClientException
Checks the state of the transaction before execution .