Browse Source

cleanup and PHPCS

antograssiot 10 years ago
parent
commit
969fc4438d
1 changed files with 7 additions and 6 deletions
  1. 7 6
      src/Utility/Text.php

+ 7 - 6
src/Utility/Text.php

@@ -342,27 +342,28 @@ class Text
         $wrapped = self::wrap($text, $options);
 
         if (!empty($options['indent'])) {
-            $indentationLength = !empty($options['indent']) ? strlen($options['indent']) : 0;
+            $indentationLength = strlen($options['indent']);
             $chunks = explode("\n", $wrapped);
-            if (count($chunks) < 2) {
+            $count = count($chunks);
+            if ($count < 2) {
                 return $wrapped;
             }
             $toRewrap = '';
-            for ($i = $options['indentAt'], $len = count($chunks); $i < $len; $i++) {
+            for ($i = $options['indentAt']; $i < $count; $i++) {
                 $toRewrap .= substr($chunks[$i], $indentationLength) . ' ';
                 unset($chunks[$i]);
             }
-            $options['width'] = $options['width'] - $indentationLength;
+            $options['width'] -= $indentationLength;
             $options['indentAt'] = 0;
             $rewrapped = self::wrap($toRewrap, $options);
             $newChunks = explode("\n", $rewrapped);
 
             $chunks = array_merge($chunks, $newChunks);
-            $wrapped =  implode("\n", $chunks);
+            $wrapped = implode("\n", $chunks);
         }
         return $wrapped;
     }
-    
+
     /**
      * Unicode and newline aware version of wordwrap.
      *