Browse Source

Removing unused Object::_set().

Renan Gonçalves 12 years ago
parent
commit
114d4077ad
3 changed files with 2 additions and 49 deletions
  1. 2 1
      src/Controller/ErrorController.php
  2. 0 18
      src/Core/Object.php
  3. 0 30
      tests/TestCase/Core/ObjectTest.php

+ 2 - 1
src/Controller/ErrorController.php

@@ -51,7 +51,8 @@ class ErrorController extends Controller {
 		if (isset($this->Security)) {
 			$eventManager->detach($this->Security);
 		}
-		$this->_set(array('cacheAction' => false, 'viewPath' => 'Error'));
+		$this->cacheAction = false;
+		$this->viewPath = 'Error';
 	}
 
 }

+ 0 - 18
src/Core/Object.php

@@ -56,22 +56,4 @@ class Object {
 		exit($status);
 	}
 
-/**
- * Allows setting of multiple properties of the object in a single line of code. Will only set
- * properties that are part of a class declaration.
- *
- * @param array $properties An associative array containing properties and corresponding values.
- * @return void
- */
-	protected function _set($properties = []) {
-		if (is_array($properties) && !empty($properties)) {
-			$vars = get_object_vars($this);
-			foreach ($properties as $key => $val) {
-				if (array_key_exists($key, $vars)) {
-					$this->{$key} = $val;
-				}
-			}
-		}
-	}
-
 }

+ 0 - 30
tests/TestCase/Core/ObjectTest.php

@@ -147,16 +147,6 @@ class TestObject extends Object {
 		$this->methodCalls[] = array('methodWithOptionalParam' => array($param));
 	}
 
-/**
- * undocumented function
- *
- * @param array $properties
- * @return void
- */
-	public function set($properties = array()) {
-		return parent::_set($properties);
-	}
-
 }
 
 /**
@@ -229,26 +219,6 @@ class ObjectTest extends TestCase {
 	}
 
 /**
- * testSet method
- *
- * @return void
- */
-	public function testSet() {
-		$this->object->set('a string');
-		$this->assertEquals('Joel', $this->object->firstName);
-
-		$this->object->set(array('firstName'));
-		$this->assertEquals('Joel', $this->object->firstName);
-
-		$this->object->set(array('firstName' => 'Ashley'));
-		$this->assertEquals('Ashley', $this->object->firstName);
-
-		$this->object->set(array('firstName' => 'Joel', 'lastName' => 'Moose'));
-		$this->assertEquals('Joel', $this->object->firstName);
-		$this->assertEquals('Moose', $this->object->lastName);
-	}
-
-/**
  * testToString method
  *
  * @return void