@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | public function parse(array $listOfLine) |
| 31 | 31 | { |
| 32 | 32 | //begin of dependencies |
| 33 | - $stringUtility = $this->stringUtility; |
|
| 33 | + $stringUtility = $this->stringUtility; |
|
| 34 | 34 | //end of dependencies |
| 35 | 35 | |
| 36 | 36 | //begin of business logic |
| 37 | 37 | $listOfLineHasMinimalSize = (count($listOfLine) > 9); |
| 38 | 38 | |
| 39 | 39 | if ($listOfLineHasMinimalSize) { |
| 40 | - $listOfMandatoryPropertyNameToStartsWithPrefix = [ |
|
| 40 | + $listOfMandatoryPropertyNameToStartsWithPrefix = [ |
|
| 41 | 41 | 'current_timestamp' => 'Current Time: ', |
| 42 | 42 | 'cpu_usage' => 'CPU Usage: ', |
| 43 | 43 | 'parent_server_configuration_generation' => 'Parent Server Config. Generation: ', |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | Total Traffic: : 15 |
| 62 | 62 | */ |
| 63 | 63 | |
| 64 | - $listOMandatoryProperties = [ |
|
| 64 | + $listOMandatoryProperties = [ |
|
| 65 | 65 | 'b_per_seconds' => null, |
| 66 | 66 | 'current_time' => null, |
| 67 | 67 | 'cpu_load' => null, |
@@ -105,33 +105,33 @@ discard block |
||
| 105 | 105 | } else if ($stringUtility->startsWith($line, $listOfMandatoryPropertyNameToStartsWithPrefix['server_load'])) { |
| 106 | 106 | $listOMandatoryProperties['server_load'] = substr($line, 13); |
| 107 | 107 | } else if ($stringUtility->startsWith($line, $listOfMandatoryPropertyNameToStartsWithPrefix['total_accesses'])) { |
| 108 | - $lineAsArray = explode(' - ', $line); |
|
| 108 | + $lineAsArray = explode(' - ', $line); |
|
| 109 | 109 | |
| 110 | 110 | $listOMandatoryProperties['total_accesses'] = substr($lineAsArray[0], 16); |
| 111 | 111 | $listOMandatoryProperties['total_traffic'] = substr($lineAsArray[1], 15); |
| 112 | 112 | } else if ($stringUtility->endsWith($line, 'request')) { |
| 113 | - $lineAsArray = explode(' - ', $line); |
|
| 113 | + $lineAsArray = explode(' - ', $line); |
|
| 114 | 114 | |
| 115 | - $listOMandatoryProperties['b_per_seconds'] = filter_var( |
|
| 115 | + $listOMandatoryProperties['b_per_seconds'] = filter_var( |
|
| 116 | 116 | $lineAsArray[1], |
| 117 | 117 | FILTER_SANITIZE_NUMBER_INT |
| 118 | 118 | ); |
| 119 | - $listOMandatoryProperties['kb_per_seconds'] = filter_var( |
|
| 119 | + $listOMandatoryProperties['kb_per_seconds'] = filter_var( |
|
| 120 | 120 | $lineAsArray[2], |
| 121 | 121 | FILTER_SANITIZE_NUMBER_INT |
| 122 | 122 | ); |
| 123 | - $listOMandatoryProperties['request_per_seconds'] = filter_var( |
|
| 123 | + $listOMandatoryProperties['request_per_seconds'] = filter_var( |
|
| 124 | 124 | $lineAsArray[0], |
| 125 | 125 | FILTER_SANITIZE_NUMBER_INT |
| 126 | 126 | ); |
| 127 | 127 | } else if ($stringUtility->endsWith($line, 'workers')) { |
| 128 | - $lineAsArray = explode(',', $line); |
|
| 128 | + $lineAsArray = explode(',', $line); |
|
| 129 | 129 | |
| 130 | - $listOMandatoryProperties['idle_workers'] = filter_var( |
|
| 130 | + $listOMandatoryProperties['idle_workers'] = filter_var( |
|
| 131 | 131 | $lineAsArray[1], |
| 132 | 132 | FILTER_SANITIZE_NUMBER_INT |
| 133 | 133 | ); |
| 134 | - $listOMandatoryProperties['request_currently_being_processed'] = filter_var( |
|
| 134 | + $listOMandatoryProperties['request_currently_being_processed'] = filter_var( |
|
| 135 | 135 | $lineAsArray[0], |
| 136 | 136 | FILTER_SANITIZE_NUMBER_INT |
| 137 | 137 | ); |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | '', |
| 74 | 74 | (isset($lineAsArray[19]) ? $lineAsArray[19] : $lineAsArray[18]) |
| 75 | 75 | ); |
| 76 | - $uriPathWithQuery = ( |
|
| 76 | + $uriPathWithQuery = ( |
|
| 77 | 77 | $stringUtility->endsWith($lineAsArray[17], '}') |
| 78 | 78 | ? substr($lineAsArray[17], 0, -1) |
| 79 | 79 | : $lineAsArray[17] |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | public function __construct( |
| 26 | 26 | StringUtility $stringUtility |
| 27 | 27 | ) { |
| 28 | - $this->stringUtility = $stringUtility; |
|
| 28 | + $this->stringUtility = $stringUtility; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | //stop repeating yourself, us the $listOfMandatoryPropertyNameToStartsWithPrefix |
| 64 | 64 | //take a look to the StatisticListOfLineParser |
| 65 | 65 | if ($stringUtility->startsWith($line, 'Apache Server Status for ')) { |
| 66 | - $listOMandatoryProperties['identifier'] = substr($line, 25); //always use numbers if you are dealing with static strings |
|
| 66 | + $listOMandatoryProperties['identifier'] = substr($line, 25); //always use numbers if you are dealing with static strings |
|
| 67 | 67 | } else if ($stringUtility->startsWith($line, 'Server Version: ')) { |
| 68 | 68 | $listOMandatoryProperties['version'] = substr($line, 16); |
| 69 | 69 | } else if ($stringUtility->startsWith($line, 'Server MPM: ')) { |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | |
| 23 | 23 | $lines = array_filter( |
| 24 | 24 | $contentAsArray, |
| 25 | - function ($item) { |
|
| 25 | + function($item) { |
|
| 26 | 26 | return (strlen(trim($item)) > 0); |
| 27 | 27 | } |
| 28 | 28 | ); |