protected function parseOptions(OptionsBag $sessionOptions)
    {
        $options = new OptionsBag($sessionOptions->get('options', []));

        $iniKeys = [
            'persistent'             => 'bool',
            'binary_protocol'        => 'bool',
            'consistent_hash'        => 'bool',
            'server_failure_limit'   => 'int',
            'remove_failed_servers'  => 'bool',
            'randomize_replica_read' => 'bool',
            'number_of_replicas'     => 'int',
            'connect_timeout'        => 'int',
            'sasl_username'          => 'string',
            'sasl_password'          => 'string',
            'prefix'                 => 'string',
        ];
        $v2IniKeys = [
            'remove_failed_servers' => ['remove_failed', 'bool'],
            'binary_protocol'       => ['binary', 'bool'],
        ];

        // If user specified v2 option, warn and replace with new name
        foreach ($v2IniKeys as $new => list($old, $type)) {
            if ($options->has($old)) {
                Deprecated::warn("Memcached option \"$old\"", 1.0, "Use \"$new\" instead.");

                if (!$options->has($new)) {
                    $options->set($new, $options->get($old));
                }

                $options->remove($old);
            }
        }

        // Merge ini values in as defaults.
        foreach ($iniKeys as $key => $type) {
            if (!$options->has($key) && $this->ini->has($key)) {
                if ($type === 'bool') {
                    $value = $this->ini->getBoolean($key);
                } elseif ($type === 'int') {
                    $value = $this->ini->getInt($key);
                } else {
                    $value = $this->ini->get($key);
                }
                $options[$key] = $value;
            }
        }

        // Merge v2 ini values in as defaults.
        foreach ($v2IniKeys as $new => list($old, $type)) {
            if (!$options->has($new) && $this->ini->has($old)) {
                if ($type === 'bool') {
                    $value = $this->ini->getBoolean($old);
                } elseif ($type === 'int') {
                    $value = $this->ini->getInt($old);
                } else {
                    $value = $this->ini->get($old);
                }
                $options[$new] = $value;
            }
        }

        // Convert sasl_username/sasl_password to username/password
        if (!$options->has('username')) {
            $options['username'] = $options->get('sasl_username');
        }
        if (!$options->has('password')) {
            $options['password'] = $options->get('sasl_password');
        }
        $options->remove('sasl_username');
        $options->remove('sasl_password');

        return $options;
    }
protected function parseOptions(OptionsBag $sessionOptions)
    {
        $options = new OptionsBag($sessionOptions->get('options', []));

        $iniKeys = [
            'persistent'             => 'bool',
            'binary_protocol'        => 'bool',
            'consistent_hash'        => 'bool',
            'server_failure_limit'   => 'int',
            'remove_failed_servers'  => 'bool',
            'randomize_replica_read' => 'bool',
            'number_of_replicas'     => 'int',
            'connect_timeout'        => 'int',
            'sasl_username'          => 'string',
            'sasl_password'          => 'string',
            'prefix'                 => 'string',
        ];
        $v2IniKeys = [
            'remove_failed_servers' => ['remove_failed', 'bool'],
            'binary_protocol'       => ['binary', 'bool'],
        ];

        // If user specified v2 option, warn and replace with new name
        foreach ($v2IniKeys as $new => list($old, $type)) {
            if ($options->has($old)) {
                Deprecated::warn("Memcached option \"$old\"", 1.0, "Use \"$new\" instead.");

                if (!$options->has($new)) {
                    $options->set($new, $options->get($old));
                }

                $options->remove($old);
            }
        }

        // Merge ini values in as defaults.
        foreach ($iniKeys as $key => $type) {
            if (!$options->has($key) && $this->ini->has($key)) {
                if ($type === 'bool') {
                    $value = $this->ini->getBoolean($key);
                } elseif ($type === 'int') {
                    $value = $this->ini->getInt($key);
                } else {
                    $value = $this->ini->get($key);
                }
                $options[$key] = $value;
            }
        }

        // Merge v2 ini values in as defaults.
        foreach ($v2IniKeys as $new => list($old, $type)) {
            if (!$options->has($new) && $this->ini->has($old)) {
                if ($type === 'bool') {
                    $value = $this->ini->getBoolean($old);
                } elseif ($type === 'int') {
                    $value = $this->ini->getInt($old);
                } else {
                    $value = $this->ini->get($old);
                }
                $options[$new] = $value;
            }
        }

        // Convert sasl_username/sasl_password to username/password
        if (!$options->has('username')) {
            $options['username'] = $options->get('sasl_username');
        }
        if (!$options->has('password')) {
            $options['password'] = $options->get('sasl_password');
        }
        $options->remove('sasl_username');
        $options->remove('sasl_password');

        return $options;
    }
protected function parseOptions ( OptionsBag $ sessionOptions ) { $ options = new OptionsBag ( $ sessionOptions -> get ( 'options' , [ ] ) ) ; $ iniKeys = [ 'persistent' => 'bool' , 'binary_protocol' => 'bool' , 'consistent_hash' => 'bool' , 'server_failure_limit' => 'int' , 'remove_failed_servers' => 'bool' , 'randomize_replica_read' => 'bool' , 'number_of_replicas' => 'int' , 'connect_timeout' => 'int' , 'sasl_username' => 'string' , 'sasl_password' => 'string' , 'prefix' => 'string' , ] ; $ v2IniKeys = [ 'remove_failed_servers' => [ 'remove_failed' , 'bool' ] , 'binary_protocol' => [ 'binary' , 'bool' ] , ] ; // If user specified v2 option, warn and replace with new name foreach ( $ v2IniKeys as $ new => list ( $ old , $ type ) ) { if ( $ options -> has ( $ old ) ) { Deprecated :: warn ( "Memcached option \"$old\"" , 1.0 , "Use \"$new\" instead." ) ; if ( ! $ options -> has ( $ new ) ) { $ options -> set ( $ new , $ options -> get ( $ old ) ) ; } $ options -> remove ( $ old ) ; } } // Merge ini values in as defaults. foreach ( $ iniKeys as $ key => $ type ) { if ( ! $ options -> has ( $ key ) && $ this -> ini -> has ( $ key ) ) { if ( $ type === 'bool' ) { $ value = $ this -> ini -> getBoolean ( $ key ) ; } elseif ( $ type === 'int' ) { $ value = $ this -> ini -> getInt ( $ key ) ; } else { $ value = $ this -> ini -> get ( $ key ) ; } $ options [ $ key ] = $ value ; } } // Merge v2 ini values in as defaults. foreach ( $ v2IniKeys as $ new => list ( $ old , $ type ) ) { if ( ! $ options -> has ( $ new ) && $ this -> ini -> has ( $ old ) ) { if ( $ type === 'bool' ) { $ value = $ this -> ini -> getBoolean ( $ old ) ; } elseif ( $ type === 'int' ) { $ value = $ this -> ini -> getInt ( $ old ) ; } else { $ value = $ this -> ini -> get ( $ old ) ; } $ options [ $ new ] = $ value ; } } // Convert sasl_username/sasl_password to username/password if ( ! $ options -> has ( 'username' ) ) { $ options [ 'username' ] = $ options -> get ( 'sasl_username' ) ; } if ( ! $ options -> has ( 'password' ) ) { $ options [ 'password' ] = $ options -> get ( 'sasl_password' ) ; } $ options -> remove ( 'sasl_username' ) ; $ options -> remove ( 'sasl_password' ) ; return $ options ; }
Parse Memcached options from session options and from ini.

@param OptionsBag $sessionOptions

@return OptionsBag
Parse Memcached options from session options and from ini .