Browse Source

Remove encrpyption method.

It really served no point. People can simply use config() and
configKey().
mark_story 12 years ago
parent
commit
33908a5079

+ 0 - 23
src/Controller/Component/CookieComponent.php

@@ -267,29 +267,6 @@ class CookieComponent extends Component {
 	}
 
 /**
- * Get / set encryption type. Use this method in ex: AppController::beforeFilter()
- * before you have read or written any cookies.
- *
- * @param string|null $type Encryption type to set or null to get current type.
- * @return string|null
- * @throws \Cake\Error\Exception When an unknown type is used.
- */
-	public function encryption($type = null) {
-		if ($type === null) {
-			return $this->_config['encryption'];
-		}
-
-		$availableTypes = [
-			'rijndael',
-			'aes'
-		];
-		if (!in_array($type, $availableTypes)) {
-			throw new Error\Exception('You must use rijndael, or aes for cookie encryption type');
-		}
-		$this->config('encryption', $type);
-	}
-
-/**
  * Set cookie
  *
  * @param string $name Name for cookie

+ 4 - 2
tests/TestCase/Controller/Component/CookieComponentTest.php

@@ -213,8 +213,10 @@ class CookieComponentTest extends TestCase {
  * @return void
  */
 	public function testWriteWithFalseyValue() {
-		$this->Cookie->encryption('aes');
-		$this->Cookie->key = 'qSI232qs*&sXOw!adre@34SAv!@*(XSL#$%)asGb$@11~_+!@#HKis~#^';
+		$this->Cookie->config([
+			'encryption' => 'aes',
+			'key' => 'qSI232qs*&sXOw!adre@34SAv!@*(XSL#$%)asGb$@11~_+!@#HKis~#^',
+		]);
 
 		$this->Cookie->write('Testing');
 		$result = $this->Cookie->read('Testing');