Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
Dictionary Class Reference

Public Member Functions

 __construct ($dictionaryFilePath)
 
 getRandWord ()
 

Detailed Description

Provide random word from dictionary

Definition at line 11 of file Dictionary.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $dictionaryFilePath)
Parameters
string$dictionaryFilePath
Exceptions

Definition at line 27 of file Dictionary.php.

28  {
29  $this->dictionaryFilePath = $dictionaryFilePath;
30  }

Member Function Documentation

◆ getRandWord()

getRandWord ( )

Returns random word from dictionary

Returns
string

Definition at line 37 of file Dictionary.php.

38  {
39  if ($this->dictionary === null) {
40  $this->readDictionary();
41  }
42 
43  $randIndex = random_int(0, count($this->dictionary) - 1);
44  return trim($this->dictionary[$randIndex]);
45  }

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