original_string: protected function distributeText()
      {
          // Explode input text on word boundaries
          $words = explode(' ', $this->text);
  
          // Fill lines with words, toss exception if exceed available lines
          while ($words) {
              $tooLong = true;
              $word = array_shift($words);
  
              for ($i = 0; $i < count($this->lines); $i++) {
                  $line =& $this->lines[$i];
                  if ($line['full'] === false) {
                      $charsPotential = strlen($word) + $line['chars'];
  
                      if ($charsPotential <= $this->width) {
                          array_push($line['words'], $word);
                          $line['chars'] = $charsPotential;
                          $tooLong = false;
                          break;
                      } else {
                          $line['full'] = true;
                      }
                  }
              }
          }
  
          // Throw if too long
          if ($tooLong === true) {
              throw new \Exception('Text is too long');
          }
      }
code: protected function distributeText()
      {
          // Explode input text on word boundaries
          $words = explode(' ', $this->text);
  
          // Fill lines with words, toss exception if exceed available lines
          while ($words) {
              $tooLong = true;
              $word = array_shift($words);
  
              for ($i = 0; $i < count($this->lines); $i++) {
                  $line =& $this->lines[$i];
                  if ($line['full'] === false) {
                      $charsPotential = strlen($word) + $line['chars'];
  
                      if ($charsPotential <= $this->width) {
                          array_push($line['words'], $word);
                          $line['chars'] = $charsPotential;
                          $tooLong = false;
                          break;
                      } else {
                          $line['full'] = true;
                      }
                  }
              }
          }
  
          // Throw if too long
          if ($tooLong === true) {
              throw new \Exception('Text is too long');
          }
      }
code_tokens: protected function distributeText ( ) { // Explode input text on word boundaries $ words = explode ( ' ' , $ this -> text ) ; // Fill lines with words, toss exception if exceed available lines while ( $ words ) { $ tooLong = true ; $ word = array_shift ( $ words ) ; for ( $ i = 0 ; $ i < count ( $ this -> lines ) ; $ i ++ ) { $ line = & $ this -> lines [ $ i ] ; if ( $ line [ 'full' ] === false ) { $ charsPotential = strlen ( $ word ) + $ line [ 'chars' ] ; if ( $ charsPotential <= $ this -> width ) { array_push ( $ line [ 'words' ] , $ word ) ; $ line [ 'chars' ] = $ charsPotential ; $ tooLong = false ; break ; } else { $ line [ 'full' ] = true ; } } } } // Throw if too long if ( $ tooLong === true ) { throw new \ Exception ( 'Text is too long' ) ; } }
docstring: Distribute text to lines
  @throws \Exception If text is too long given available lines and max character width
docstring_tokens: Distribute text to lines