@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | StringUtility $stringUtility |
| 21 | 21 | ) |
| 22 | 22 | { |
| 23 | - $this->stringUtility = $stringUtility; |
|
| 23 | + $this->stringUtility = $stringUtility; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | public function parse(array $listOfLine) |
| 33 | 33 | { |
| 34 | 34 | //begin of dependencies |
| 35 | - $stringUtility = $this->stringUtility; |
|
| 35 | + $stringUtility = $this->stringUtility; |
|
| 36 | 36 | //end of dependencies |
| 37 | 37 | |
| 38 | 38 | //begin of business logic |
| 39 | 39 | $listOfLineHasMinimalSize = (count($listOfLine) > 9); |
| 40 | 40 | |
| 41 | 41 | if ($listOfLineHasMinimalSize) { |
| 42 | - $listOfMandatoryPropertyNameToStartsWithPrefix = [ |
|
| 42 | + $listOfMandatoryPropertyNameToStartsWithPrefix = [ |
|
| 43 | 43 | 'current_timestamp' => 'Current Time: ', |
| 44 | 44 | 'cpu_usage' => 'CPU Usage: ', |
| 45 | 45 | 'parent_server_configuration_generation' => 'Parent Server Config. Generation: ', |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | Total Traffic: : 15 |
| 64 | 64 | */ |
| 65 | 65 | |
| 66 | - $listOMandatoryProperties = [ |
|
| 66 | + $listOMandatoryProperties = [ |
|
| 67 | 67 | 'b_per_seconds' => null, |
| 68 | 68 | 'current_time' => null, |
| 69 | 69 | 'cpu_load' => null, |
@@ -87,13 +87,13 @@ discard block |
||
| 87 | 87 | substr($line, 14) |
| 88 | 88 | ); |
| 89 | 89 | } else if ($stringUtility->startsWith($line, $listOfMandatoryPropertyNameToStartsWithPrefix['cpu_usage'])) { |
| 90 | - $lineAsArray = explode(' - ', $line); |
|
| 90 | + $lineAsArray = explode(' - ', $line); |
|
| 91 | 91 | |
| 92 | - $listOMandatoryProperties['cpu_load'] = filter_var( |
|
| 92 | + $listOMandatoryProperties['cpu_load'] = filter_var( |
|
| 93 | 93 | $lineAsArray[1], |
| 94 | 94 | FILTER_SANITIZE_NUMBER_INT |
| 95 | 95 | ); |
| 96 | - $listOMandatoryProperties['cpu_usage'] = substr($lineAsArray[0], 11); |
|
| 96 | + $listOMandatoryProperties['cpu_usage'] = substr($lineAsArray[0], 11); |
|
| 97 | 97 | } else if ($stringUtility->startsWith($line, $listOfMandatoryPropertyNameToStartsWithPrefix['parent_server_configuration_generation'])) { |
| 98 | 98 | $listOMandatoryProperties['parent_server_configuration_generation'] = substr($line, 34); |
| 99 | 99 | } else if ($stringUtility->startsWith($line, $listOfMandatoryPropertyNameToStartsWithPrefix['parent_server_mpm_generation'])) { |
@@ -107,33 +107,33 @@ discard block |
||
| 107 | 107 | } else if ($stringUtility->startsWith($line, $listOfMandatoryPropertyNameToStartsWithPrefix['server_load'])) { |
| 108 | 108 | $listOMandatoryProperties['server_load'] = substr($line, 13); |
| 109 | 109 | } else if ($stringUtility->startsWith($line, $listOfMandatoryPropertyNameToStartsWithPrefix['total_accesses'])) { |
| 110 | - $lineAsArray = explode(' - ', $line); |
|
| 110 | + $lineAsArray = explode(' - ', $line); |
|
| 111 | 111 | |
| 112 | 112 | $listOMandatoryProperties['total_accesses'] = substr($lineAsArray[0], 16); |
| 113 | 113 | $listOMandatoryProperties['total_traffic'] = substr($lineAsArray[1], 15); |
| 114 | 114 | } else if ($stringUtility->endsWith($line, 'request')) { |
| 115 | - $lineAsArray = explode(' - ', $line); |
|
| 115 | + $lineAsArray = explode(' - ', $line); |
|
| 116 | 116 | |
| 117 | - $listOMandatoryProperties['b_per_seconds'] = filter_var( |
|
| 117 | + $listOMandatoryProperties['b_per_seconds'] = filter_var( |
|
| 118 | 118 | $lineAsArray[1], |
| 119 | 119 | FILTER_SANITIZE_NUMBER_INT |
| 120 | 120 | ); |
| 121 | - $listOMandatoryProperties['kb_per_seconds'] = filter_var( |
|
| 121 | + $listOMandatoryProperties['kb_per_seconds'] = filter_var( |
|
| 122 | 122 | $lineAsArray[2], |
| 123 | 123 | FILTER_SANITIZE_NUMBER_INT |
| 124 | 124 | ); |
| 125 | - $listOMandatoryProperties['request_per_seconds'] = filter_var( |
|
| 125 | + $listOMandatoryProperties['request_per_seconds'] = filter_var( |
|
| 126 | 126 | $lineAsArray[0], |
| 127 | 127 | FILTER_SANITIZE_NUMBER_INT |
| 128 | 128 | ); |
| 129 | 129 | } else if ($stringUtility->endsWith($line, 'workers')) { |
| 130 | - $lineAsArray = explode(',', $line); |
|
| 130 | + $lineAsArray = explode(',', $line); |
|
| 131 | 131 | |
| 132 | - $listOMandatoryProperties['idle_workers'] = filter_var( |
|
| 132 | + $listOMandatoryProperties['idle_workers'] = filter_var( |
|
| 133 | 133 | $lineAsArray[1], |
| 134 | 134 | FILTER_SANITIZE_NUMBER_INT |
| 135 | 135 | ); |
| 136 | - $listOMandatoryProperties['request_currently_being_processed'] = filter_var( |
|
| 136 | + $listOMandatoryProperties['request_currently_being_processed'] = filter_var( |
|
| 137 | 137 | $lineAsArray[0], |
| 138 | 138 | FILTER_SANITIZE_NUMBER_INT |
| 139 | 139 | ); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function __construct(StringUtility $stringUtility) |
| 24 | 24 | { |
| 25 | - $this->stringUtility = $stringUtility; |
|
| 25 | + $this->stringUtility = $stringUtility; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | public function parse($line) |
| 34 | 34 | { |
| 35 | 35 | //begin of dependencies |
| 36 | - $stringUtility = $this->stringUtility; |
|
| 36 | + $stringUtility = $this->stringUtility; |
|
| 37 | 37 | //end of dependencies |
| 38 | 38 | |
| 39 | 39 | //begin of business logic |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | '', |
| 73 | 73 | (isset($lineAsArray[19]) ? $lineAsArray[19] : $lineAsArray[18]) |
| 74 | 74 | ); |
| 75 | - $uriPathWithQuery = ( |
|
| 75 | + $uriPathWithQuery = ( |
|
| 76 | 76 | $stringUtility->endsWith($lineAsArray[17], '}') |
| 77 | 77 | ? substr($lineAsArray[17], 0, -1) |
| 78 | 78 | : $lineAsArray[17] |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | StringUtility $stringUtility |
| 20 | 20 | ) |
| 21 | 21 | { |
| 22 | - $this->stringUtility = $stringUtility; |
|
| 22 | + $this->stringUtility = $stringUtility; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -32,21 +32,21 @@ discard block |
||
| 32 | 32 | public function parse(array $listOfLine) |
| 33 | 33 | { |
| 34 | 34 | //begin of dependencies |
| 35 | - $stringUtility = $this->stringUtility; |
|
| 35 | + $stringUtility = $this->stringUtility; |
|
| 36 | 36 | //end of dependencies |
| 37 | 37 | |
| 38 | 38 | //begin of business logic |
| 39 | 39 | $listOfLineHasMinimalSize = (count($listOfLine) > 3); |
| 40 | 40 | |
| 41 | 41 | if ($listOfLineHasMinimalSize) { |
| 42 | - $listOfMandatoryPropertyNameToStartsWithPrefix = [ |
|
| 42 | + $listOfMandatoryPropertyNameToStartsWithPrefix = [ |
|
| 43 | 43 | 'date_of_built' => 'Server Built: ', |
| 44 | 44 | 'identifier' => 'Apache Server Status for ', |
| 45 | 45 | 'mode_of_mpm' => 'Server MPM: ', |
| 46 | 46 | 'version' => 'Server Version: ' |
| 47 | 47 | ]; |
| 48 | 48 | |
| 49 | - $listOMandatoryProperties = [ |
|
| 49 | + $listOMandatoryProperties = [ |
|
| 50 | 50 | 'date_of_built' => null, |
| 51 | 51 | 'identifier' => null, |
| 52 | 52 | 'mode_of_mpm' => null, |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | //stop repeating yourself, us the $listOfMandatoryPropertyNameToStartsWithPrefix |
| 58 | 58 | //take a look to the StatisticListOfLineParser |
| 59 | 59 | if ($stringUtility->startsWith($line, 'Apache Server Status for ')) { |
| 60 | - $listOMandatoryProperties['identifier'] = substr($line, 25); //always use numbers if you are dealing with static strings |
|
| 60 | + $listOMandatoryProperties['identifier'] = substr($line, 25); //always use numbers if you are dealing with static strings |
|
| 61 | 61 | } else if ($stringUtility->startsWith($line, 'Server Version: ')) { |
| 62 | 62 | $listOMandatoryProperties['version'] = substr($line, 16); |
| 63 | 63 | } else if ($stringUtility->startsWith($line, 'Server MPM: ')) { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | function dumpSectionIfThereIsSomeContent(array $lines, $name) |
| 36 | 36 | { |
| 37 | 37 | if (!empty($lines)) { |
| 38 | - echo '==== ' . $name .' ====' . PHP_EOL; |
|
| 38 | + echo '==== ' . $name . ' ====' . PHP_EOL; |
|
| 39 | 39 | echo PHP_EOL; |
| 40 | 40 | |
| 41 | 41 | dumpArray($lines); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $parserBuilderFactory = new \Net\Bazzline\Component\ApacheServerStatusParser\Service\Builder\ParserBuilderFactory(); |
| 54 | 54 | $storageBuilder = new \Net\Bazzline\Component\ApacheServerStatusParser\Service\Builder\LocalStorageBuilder(); |
| 55 | 55 | |
| 56 | -$parserBuilder = $parserBuilderFactory->create(); |
|
| 56 | +$parserBuilder = $parserBuilderFactory->create(); |
|
| 57 | 57 | //end of dependencies |
| 58 | 58 | |
| 59 | 59 | //begin of business logic |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $storageBuilder->selectParseModeAllUpfront(); |
| 64 | 64 | $storageBuilder->build(); |
| 65 | 65 | |
| 66 | -$listOfNameToElapsedTime['fetching'] = PHP_Timer::secondsToTimeString( |
|
| 66 | +$listOfNameToElapsedTime['fetching'] = PHP_Timer::secondsToTimeString( |
|
| 67 | 67 | PHP_Timer::stop() |
| 68 | 68 | ); |
| 69 | 69 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | function dumpSectionIfThereIsSomeContent(array $lines, $name) |
| 35 | 35 | { |
| 36 | 36 | if (!empty($lines)) { |
| 37 | - echo '==== ' . $name .' ====' . PHP_EOL; |
|
| 37 | + echo '==== ' . $name . ' ====' . PHP_EOL; |
|
| 38 | 38 | echo PHP_EOL; |
| 39 | 39 | |
| 40 | 40 | dumpArray($lines); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $parserBuilderFactory = new \Net\Bazzline\Component\ApacheServerStatusParser\Service\Builder\ParserBuilderFactory(); |
| 55 | 55 | $storageBuilder = new \Net\Bazzline\Component\ApacheServerStatusParser\Service\Builder\LocalStorageBuilder(); |
| 56 | 56 | |
| 57 | -$parserBuilder = $parserBuilderFactory->create(); |
|
| 57 | +$parserBuilder = $parserBuilderFactory->create(); |
|
| 58 | 58 | //end of dependencies |
| 59 | 59 | |
| 60 | 60 | //begin of business logic |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $storageBuilder->selectParseModeDetailOnlyUpfront(); |
| 65 | 65 | $storageBuilder->build(); |
| 66 | 66 | |
| 67 | -$listOfNameToElapsedTime['fetching'] = PHP_Timer::secondsToTimeString( |
|
| 67 | +$listOfNameToElapsedTime['fetching'] = PHP_Timer::secondsToTimeString( |
|
| 68 | 68 | PHP_Timer::stop() |
| 69 | 69 | ); |
| 70 | 70 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | function dumpSectionIfThereIsSomeContent(array $lines, $name) |
| 35 | 35 | { |
| 36 | 36 | if (!empty($lines)) { |
| 37 | - echo '==== ' . $name .' ====' . PHP_EOL; |
|
| 37 | + echo '==== ' . $name . ' ====' . PHP_EOL; |
|
| 38 | 38 | echo PHP_EOL; |
| 39 | 39 | |
| 40 | 40 | dumpArray($lines); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | : 'http://testdata.bazzline.net/apache_server_status/index.html' |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | -$parserBuilder = $parserBuilderFactory->create(); |
|
| 57 | +$parserBuilder = $parserBuilderFactory->create(); |
|
| 58 | 58 | //end of dependencies |
| 59 | 59 | |
| 60 | 60 | //begin of business logic |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | $storageBuilder->selectParseModeDetailOnlyUpfront(); |
| 65 | 65 | $storageBuilder->build(); |
| 66 | 66 | |
| 67 | -$listOfNameToElapsedTime['fetching'] = PHP_Timer::secondsToTimeString( |
|
| 67 | +$listOfNameToElapsedTime['fetching'] = PHP_Timer::secondsToTimeString( |
|
| 68 | 68 | PHP_Timer::stop() |
| 69 | 69 | ); |
| 70 | 70 | |
| 71 | -$storage = $storageBuilder->andGetStorageAfterTheBuild(); |
|
| 71 | +$storage = $storageBuilder->andGetStorageAfterTheBuild(); |
|
| 72 | 72 | |
| 73 | 73 | dumpSectionIfThereIsSomeContent($storage->getListOfDetail(), 'Detail'); |
| 74 | 74 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | function dumpSectionIfThereIsSomeContent(array $lines, $name) |
| 35 | 35 | { |
| 36 | 36 | if (!empty($lines)) { |
| 37 | - echo '==== ' . $name .' ====' . PHP_EOL; |
|
| 37 | + echo '==== ' . $name . ' ====' . PHP_EOL; |
|
| 38 | 38 | echo PHP_EOL; |
| 39 | 39 | |
| 40 | 40 | dumpArray($lines); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | : 'http://testdata.bazzline.net/apache_server_status/index.html' |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | -$parserBuilder = $parserBuilderFactory->create(); |
|
| 57 | +$parserBuilder = $parserBuilderFactory->create(); |
|
| 58 | 58 | //end of dependencies |
| 59 | 59 | |
| 60 | 60 | //begin of business logic |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | $storageBuilder->selectParseModeAllUpfront(); |
| 65 | 65 | $storageBuilder->build(); |
| 66 | 66 | |
| 67 | -$listOfNameToElapsedTime['fetching'] = PHP_Timer::secondsToTimeString( |
|
| 67 | +$listOfNameToElapsedTime['fetching'] = PHP_Timer::secondsToTimeString( |
|
| 68 | 68 | PHP_Timer::stop() |
| 69 | 69 | ); |
| 70 | 70 | |
| 71 | -$storage = $storageBuilder->andGetStorageAfterTheBuild(); |
|
| 71 | +$storage = $storageBuilder->andGetStorageAfterTheBuild(); |
|
| 72 | 72 | |
| 73 | 73 | dumpSectionIfThereIsSomeContent($storage->getListOfInformation(), 'Information'); |
| 74 | 74 | dumpSectionIfThereIsSomeContent($storage->getListOfDetail(), 'Detail'); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $parserBuilder->setStorageUpfront($storage); |
| 81 | 81 | $parserBuilder->build(); |
| 82 | 82 | |
| 83 | -$listOfNameToElapsedTime['parsing'] = PHP_Timer::secondsToTimeString( |
|
| 83 | +$listOfNameToElapsedTime['parsing'] = PHP_Timer::secondsToTimeString( |
|
| 84 | 84 | PHP_Timer::stop() |
| 85 | 85 | ); |
| 86 | 86 | |