Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Public Member Functions | List of all members
Lorem Class Reference
Inheritance diagram for Lorem:
Faker

Public Member Functions

 __construct ()
 __get ($var)
 words ($num=3)
 sentence ($word_count=4)
 sentences ($sentence_count=3)
 paragraph ($sentence_count=3)
 paragraphs ($paragraph_count=3)
- Public Member Functions inherited from Faker
 __tostring ()
 numerify ($string)
 lexify ($string)
 bothify ($string)

Additional Inherited Members

- Static Public Attributes inherited from Faker
static $_instances = array()
- Protected Member Functions inherited from Faker
 random (&$array)
 rand_num ()
 rand_letter ()

Detailed Description

Definition at line 8 of file lorem.php.

Constructor & Destructor Documentation

Lorem::__construct ( )

Do nothing on being instanced

Returns
void
Author
Caius Durling

Reimplemented from Faker.

Definition at line 17 of file lorem.php.

{
}

Member Function Documentation

Lorem::paragraph (   $sentence_count = 3)

Generate a single paragraph

Parameters
string$sentence_countaround how many sentences the paragraph should contain
Returns
string
Author
Caius Durling

Definition at line 82 of file lorem.php.

References sentences().

{
return join( $this->sentences( $sentence_count + rand(0, 3) ), " " );
}
Lorem::paragraphs (   $paragraph_count = 3)

Generate an array of paragraphs

Parameters
string$paragraph_counthow many paragraphs to return
Returns
array
Author
Caius Durling

Definition at line 94 of file lorem.php.

{
for ($i=0; $i < $paragraph_count; $i++) {
$p[] = $this->paragraph;
}
return $p;
}
Lorem::sentence (   $word_count = 4)

Generate a random sentence

Parameters
string$word_countaround how many words the sentence should contain
Returns
string
Author
Caius Durling

Definition at line 52 of file lorem.php.

References words().

{
$words = $this->words( $word_count + rand(0, 4) );
$words[0] = ucwords( $words[0] );
return join( $words, " ") . ".";
}
Lorem::sentences (   $sentence_count = 3)

Generate an array of sentences

Parameters
string$sentence_countaround how many sentences to generate
Returns
array
Author
Caius Durling

Definition at line 66 of file lorem.php.

Referenced by paragraph().

{
$c = $sentence_count + rand(0, 3);
for ($i=0; $i < $c; $i++) {
$s[] = $this->sentence;
}
return $s;
}
Lorem::words (   $num = 3)

Generate an array of random words

Parameters
string$numhow many words to return
Returns
array
Author
Caius Durling

Definition at line 38 of file lorem.php.

Referenced by sentence().

{
$w = $this->word_list;
shuffle( $w );
return array_slice( $w, 0, $num );
}

The documentation for this class was generated from the following file: