public function setAdapter($adapter)
    {
        if (is_array($adapter)) {
            $adapter = Yii::createObject($adapter);
        }
        if (interface_exists('League\Flysystem\AdapterInterface') && $adapter instanceof AdapterInterface) {
            $this->adapter = $adapter;
        } else {
            throw new InaccessibleKeyPairException("Flysystem adapter for retrieving the key pair is invalid");
        }
    }