public function toArray($protect = null)
    {
        $protect = is_array($protect)
            ? $protect
            : $this->_protect;

        if ($protect) {
            $new = $this->_params;


            foreach ($protect as $key) {
                unset($new[$key]);
            }

            // Do json encode and decode to convert all levels to arrays
            return json_decode(json_encode($new), true, 512);
        }

        // Do json encode and decode to convert all levels to arrays
        return json_decode(json_encode($this->_params), true, 512);
    }
public function toArray($protect = null)
    {
        $protect = is_array($protect)
            ? $protect
            : $this->_protect;

        if ($protect) {
            $new = $this->_params;


            foreach ($protect as $key) {
                unset($new[$key]);
            }

            // Do json encode and decode to convert all levels to arrays
            return json_decode(json_encode($new), true, 512);
        }

        // Do json encode and decode to convert all levels to arrays
        return json_decode(json_encode($this->_params), true, 512);
    }
public function toArray ( $ protect = null ) { $ protect = is_array ( $ protect ) ? $ protect : $ this -> _protect ; if ( $ protect ) { $ new = $ this -> _params ; foreach ( $ protect as $ key ) { unset ( $ new [ $ key ] ) ; } // Do json encode and decode to convert all levels to arrays return json_decode ( json_encode ( $ new ) , true , 512 ) ; } // Do json encode and decode to convert all levels to arrays return json_decode ( json_encode ( $ this -> _params ) , true , 512 ) ; }
Return the params as array and remove the protected keys

@param array|null $protect

@return array
Return the params as array and remove the protected keys