PHP Classes

Lorem::getPlain() and related methods.

Recommend this page to a friend!

      Flex Lorem  >  All threads  >  Lorem::getPlain() and related methods.  >  (Un) Subscribe thread alerts  
Subject:Lorem::getPlain() and related methods.
Summary:discussion
Messages:1
Author:smori
Date:2012-08-19 19:31:25
 

  1. Lorem::getPlain() and related methods.   Reply   Report abuse  
Picture of smori smori - 2012-08-19 19:31:25
This is another topic for latest version (2012-08-18).

I thought about Lorem::getPlain() and related methods.
Diff file is on https://gist.github.com/3396632

1. Lorem::getWords()
I think it's better that Lorem::getWords() treats
$words array as return value, not as reference argument.

Lorem::getPlain() initializes $words and
passes it to Lorem::getWords() in original implementation.

If Lorem::getWords() is supposed to always start running
with empty array, I think it is preferable that
Lorem::getWords() itself has the responsibility to do so.

2. Lorem::punctuate()
If it is guaranteed that always $commas <= $count,
We can also implement like diff file.

3. Lorem::getPlain()
Code will be simple by using array_slice().

By using implode() for preparing return value,
space will not be added to the tail of $output.