Browse Source

Code cleanup

Michael Francis 14 năm trước cách đây
mục cha
commit
6e9d03ee45
1 tập tin đã thay đổi với 3 bổ sung7 xóa
  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);