Michael Francis 14 жил өмнө
parent
commit
6e9d03ee45
1 өөрчлөгдсөн 3 нэмэгдсэн , 7 устгасан
  1. 3 7
      models/Post.php

+ 3 - 7
models/Post.php

@@ -26,13 +26,9 @@ class Post extends \lithium\data\Model {
  	 */ 
  	public function parse($entity, $input)
  	{
- 		$words;
- 		if (is_array($input)) {
- 			$words = $input;
- 		}
- 		else {
- 			$words = explode(" ", $input);
- 		}
+
+ 		//If $input is an array, set words to it otherwise, explode it. 
+ 		$words = (is_array($input)) ? $input : explode(" ", $input);
 
  		//Count the number of words 
  		$count = count($words);