public function encrypt($data, $key = null, $encode = true)
    {
        if (null !== $key) {
            $this->getContainer()->setKey($key);
        }

        $data = $this->getContainer()->encrypt($data);

        if (true === $encode) {
            $data = $this->encode($data);
        }

        return $data;
    }
public function encrypt($data, $key = null, $encode = true)
    {
        if (null !== $key) {
            $this->getContainer()->setKey($key);
        }

        $data = $this->getContainer()->encrypt($data);

        if (true === $encode) {
            $data = $this->encode($data);
        }

        return $data;
    }
public function encrypt ( $ data , $ key = null , $ encode = true ) { if ( null !== $ key ) { $ this -> getContainer ( ) -> setKey ( $ key ) ; } $ data = $ this -> getContainer ( ) -> encrypt ( $ data ) ; if ( true === $ encode ) { $ data = $ this -> encode ( $ data ) ; } return $ data ; }
This method is intend to encrypt a given string with a given key or default key.

@param string $data   The data to encrypt
@param mixed  $key    The key to use for encryption
@param bool   $encode TRUE to encode the data, otherwise FALSE to do not

@author Benjamin Carl <opensource@clickalicious.de>

@return string The encrypted $content
This method is intend to encrypt a given string with a given key or default key .