Code Duplication    Length = 12-16 lines in 4 locations

lib/Cake/Console/Command/Task/TemplateTask.php 1 location

@@ 113-128 (lines=16) @@
110
 *   Unused if $one is an associative array, otherwise serves as the values to $one's keys.
111
 * @return void
112
 */
113
	public function set($one, $two = null) {
114
		if (is_array($one)) {
115
			if (is_array($two)) {
116
				$data = array_combine($one, $two);
117
			} else {
118
				$data = $one;
119
			}
120
		} else {
121
			$data = array($one => $two);
122
		}
123
124
		if (!$data) {
125
			return false;
126
		}
127
		$this->templateVars = $data + $this->templateVars;
128
	}
129
130
/**
131
 * Runs the template

lib/Cake/Controller/Controller.php 1 location

@@ 838-849 (lines=12) @@
835
 * @return void
836
 * @link http://book.cakephp.org/2.0/en/controllers.html#interacting-with-views
837
 */
838
	public function set($one, $two = null) {
839
		if (is_array($one)) {
840
			if (is_array($two)) {
841
				$data = array_combine($one, $two);
842
			} else {
843
				$data = $one;
844
			}
845
		} else {
846
			$data = array($one => $two);
847
		}
848
		$this->viewVars = $data + $this->viewVars;
849
	}
850
851
/**
852
 * Internally redirects one action to another. Does not perform another HTTP request unlike Controller::redirect()

lib/Cake/View/Helper/JsHelper.php 1 location

@@ 330-345 (lines=16) @@
327
 * @return void
328
 * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#JsHelper::set
329
 */
330
	public function set($one, $two = null) {
331
		$data = null;
332
		if (is_array($one)) {
333
			if (is_array($two)) {
334
				$data = array_combine($one, $two);
335
			} else {
336
				$data = $one;
337
			}
338
		} else {
339
			$data = array($one => $two);
340
		}
341
		if (!$data) {
342
			return false;
343
		}
344
		$this->_jsVars = array_merge($this->_jsVars, $data);
345
	}
346
347
/**
348
 * Uses the selected JS engine to create a submit input

lib/Cake/View/View.php 1 location

@@ 787-802 (lines=16) @@
784
 *    Unused if $one is an associative array, otherwise serves as the values to $one's keys.
785
 * @return void
786
 */
787
	public function set($one, $two = null) {
788
		$data = null;
789
		if (is_array($one)) {
790
			if (is_array($two)) {
791
				$data = array_combine($one, $two);
792
			} else {
793
				$data = $one;
794
			}
795
		} else {
796
			$data = array($one => $two);
797
		}
798
		if (!$data) {
799
			return false;
800
		}
801
		$this->viewVars = $data + $this->viewVars;
802
	}
803
804
/**
805
 * Magic accessor for helpers. Provides access to attributes that were deprecated.