Skip to content

Commit

Permalink
Merge pull request #9 from Packet-Clearing-House/dev-8
Browse files Browse the repository at this point in the history
move precook random declare inside loop per #8
  • Loading branch information
Ths2-9Y-LqJt6 authored Jan 17, 2018
2 parents c60cf0a + 142275d commit 525f78e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Faux-Logs-Class.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,19 @@ function read_config($configFile){
* @param $iterations of log lines
*/
function generate_lines($iterations){
// generate pre cooked values
if(isset($this->config['pre']) && is_array($this->config['pre']) && sizeof($this->config['pre'] > 0)){
foreach ($this->config['pre'] as $fieldConfig){
$this->preCooked[] = $this->generate_field($fieldConfig);
}
}

// generate log entries
$count = 1;
while ($count <= $iterations) {
if (is_array($this->config['log']) && sizeof($this->config['log'] > 0)) {
// generate pre cooked values
if(isset($this->config['pre']) && is_array($this->config['pre']) && sizeof($this->config['pre'] > 0)){
$this->preCooked = array();
foreach ($this->config['pre'] as $fieldConfig){
$this->preCooked[] = $this->generate_field($fieldConfig);
}
}

foreach ($this->config['log'] as $fieldConfig) {
$this->lines .= $this->generate_field($fieldConfig);
}
Expand Down

0 comments on commit 525f78e

Please sign in to comment.