public function set_locked(bool $locked) {
        global $DB;

        if ($this->_locked == $locked) {
            return $this;
        }

        $this->_locked = $locked;
        $DB->set_field('context', 'locked', (int) $locked, ['id' => $this->id]);
        $this->mark_dirty();
        self::reset_caches();

        return $this;
    }
public function set_locked(bool $locked) {
        global $DB;

        if ($this->_locked == $locked) {
            return $this;
        }

        $this->_locked = $locked;
        $DB->set_field('context', 'locked', (int) $locked, ['id' => $this->id]);
        $this->mark_dirty();
        self::reset_caches();

        return $this;
    }
public function set_locked ( bool $ locked ) { global $ DB ; if ( $ this -> _locked == $ locked ) { return $ this ; } $ this -> _locked = $ locked ; $ DB -> set_field ( 'context' , 'locked' , ( int ) $ locked , [ 'id' => $ this -> id ] ) ; $ this -> mark_dirty ( ) ; self :: reset_caches ( ) ; return $ this ; }
Set whether this context has been locked or not.

@param   bool    $locked
@return  $this
Set whether this context has been locked or not .