Browse Source

phpcs fixes

AD7six 11 years ago
parent
commit
3e201892dd

+ 3 - 2
src/View/BakeView.php

@@ -20,10 +20,11 @@ use Cake\Utility\Inflector;
 class BakeView extends View {
 
 	use ConventionsTrait;
+
 /**
  * An array of names of built-in helpers to include.
  *
- * @var mixed
+ * @var array
  */
 	public $helpers = [
 		'Bake'
@@ -152,7 +153,7 @@ class BakeView extends View {
  */
 	protected function _paths($plugin = null, $cached = true) {
 		$paths = parent::_paths($plugin, false);
-		foreach($paths as &$path) {
+		foreach ($paths as &$path) {
 			$path .= 'Bake' . DS;
 		}
 		return $paths;

+ 17 - 9
src/View/Helper/BakeHelper.php

@@ -2,8 +2,8 @@
 namespace Cake\View\Helper;
 
 use Cake\Core\ConventionsTrait;
-use Cake\View\Helper;
 use Cake\Utility\Inflector;
+use Cake\View\Helper;
 
 /**
  * Bake helper
@@ -24,17 +24,17 @@ class BakeHelper extends Helper {
  *
  * Used for generating formatted properties such as component and helper arrays
  *
- * @param string $name
- * @param array $value
- * @param array $options
+ * @param string $name the name of the property
+ * @param array $value the array of values
+ * @param array $options extra options to be passed ot the element
  * @return string
  */
-	public function arrayProperty($name, $value, $options = []) {
+	public function arrayProperty($name, $value = [], $options = []) {
 		if (!$value) {
 			return '';
 		}
 
-		foreach($value as &$val) {
+		foreach ($value as &$val) {
 			$val = Inflector::camelize($val);
 		}
 		$options += [
@@ -49,8 +49,8 @@ class BakeHelper extends Helper {
  *
  * Returns an array converted into a formatted multiline string
  *
- * @param array $list
- * @param array $options
+ * @param array $list array of items to be stringified
+ * @param array $options options to use
  * @return string
  */
 	public function stringifyList($list, $options = []) {
@@ -62,7 +62,7 @@ class BakeHelper extends Helper {
 			return '';
 		}
 
-		foreach($list as $k => &$v) {
+		foreach ($list as $k => &$v) {
 			$v = "'$v'";
 			if (!is_numeric($k)) {
 				$v = "'$k' => $v";
@@ -80,6 +80,13 @@ class BakeHelper extends Helper {
 		return $start . implode($join, $list) . $end;
 	}
 
+/**
+ * aliasExtractor
+ *
+ * @param \Cake\Datasource\EntityInterface $modelObj object to find associations on
+ * @param string $assoc association to extract
+ * @return array
+ */
 	public function aliasExtractor($modelObj, $assoc) {
 		$extractor = function ($val) {
 			return $val->target()->alias();
@@ -87,4 +94,5 @@ class BakeHelper extends Helper {
 
 		return array_map($extractor, $modelObj->associations()->type($assoc));
 	}
+
 }

+ 9 - 9
tests/TestCase/Shell/Task/TemplateTaskTest.php

@@ -50,16 +50,16 @@ class TemplateTaskTest extends TestCase {
 
 /**
  * test generate
-	*
-	* @return void
-	*/
-		public function testGenerate() {
-			$this->Task->initialize();
-			$this->Task->expects($this->any())->method('in')->will($this->returnValue(1));
+ *
+ * @return void
+ */
+	public function testGenerate() {
+		$this->Task->initialize();
+		$this->Task->expects($this->any())->method('in')->will($this->returnValue(1));
 
-			$result = $this->Task->generate('classes/test_object', array('test' => 'foo'));
-			$expected = "I got rendered\nfoo";
-			$this->assertTextEquals($expected, $result);
+		$result = $this->Task->generate('classes/test_object', array('test' => 'foo'));
+		$expected = "I got rendered\nfoo";
+		$this->assertTextEquals($expected, $result);
 	}
 
 /**