public function mode(ConnectionInterface $conn, $mode)
    {

        // switch to the new runlevel
        $this->synchronized(function ($self, $newMode) {
            // wait till the previous commands has been finished
            while ($self->locked === true) {
                sleep(1);
            }

            // set the command name
            $self->command = ModeCommand::COMMAND;

            // lock process
            $self->locked = true;
            $self->params = $newMode;

            // notify the AS to execute the command
            $self->notify();

        }, $this, $mode);
    }
public function mode(ConnectionInterface $conn, $mode)
    {

        // switch to the new runlevel
        $this->synchronized(function ($self, $newMode) {
            // wait till the previous commands has been finished
            while ($self->locked === true) {
                sleep(1);
            }

            // set the command name
            $self->command = ModeCommand::COMMAND;

            // lock process
            $self->locked = true;
            $self->params = $newMode;

            // notify the AS to execute the command
            $self->notify();

        }, $this, $mode);
    }
public function mode ( ConnectionInterface $ conn , $ mode ) { // switch to the new runlevel $ this -> synchronized ( function ( $ self , $ newMode ) { // wait till the previous commands has been finished while ( $ self -> locked === true ) { sleep ( 1 ) ; } // set the command name $ self -> command = ModeCommand :: COMMAND ; // lock process $ self -> locked = true ; $ self -> params = $ newMode ; // notify the AS to execute the command $ self -> notify ( ) ; } , $ this , $ mode ) ; }
Switch to the passed mode, which can either be 'dev', 'prod' or 'install'.

@param \React\Socket\ConnectionInterface $conn The connection resource
@param string                            $mode The setup mode to switch to

@return void
Switch to the passed mode which can either be dev prod or install .