@@ -31,7 +31,7 @@ |
||
| 31 | 31 | * @param array $methods |
| 32 | 32 | * @return \PHPUnit_Framework_MockObject_MockObject |
| 33 | 33 | */ |
| 34 | - public function stub($class, array $methods = []) |
|
| 34 | + public function stub($class, array $methods = [ ]) |
|
| 35 | 35 | { |
| 36 | 36 | $stub = $this->getMockBuilder($class) |
| 37 | 37 | ->disableOriginalConstructor() |
@@ -40,14 +40,14 @@ discard block |
||
| 40 | 40 | $log = pathinfo($logFile); |
| 41 | 41 | // check if $logFile is a dir because of possible stream url |
| 42 | 42 | $isLogdir = is_dir($logFile); |
| 43 | - if (!$isLogdir && (isset($log['dirname']) && !is_dir($log['dirname']))) { |
|
| 43 | + if (!$isLogdir && (isset($log[ 'dirname' ]) && !is_dir($log[ 'dirname' ]))) { |
|
| 44 | 44 | throw new \InvalidArgumentException( |
| 45 | - "Directory does not exist: {$log['dirname']}" |
|
| 45 | + "Directory does not exist: {$log[ 'dirname' ]}" |
|
| 46 | 46 | ); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if ($isLogdir || !isset($log['filename'])) { |
|
| 50 | - $logFile = $logFile . DIRECTORY_SEPARATOR . self::DEFAULT_FILENAME; |
|
| 49 | + if ($isLogdir || !isset($log[ 'filename' ])) { |
|
| 50 | + $logFile = $logFile.DIRECTORY_SEPARATOR.self::DEFAULT_FILENAME; |
|
| 51 | 51 | } |
| 52 | 52 | $this->logFile = $logFile; |
| 53 | 53 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | if (in_array($level, $this->levels)) { |
| 69 | 69 | file_put_contents( |
| 70 | - $this->logFile, $message . PHP_EOL, FILE_APPEND |
|
| 70 | + $this->logFile, $message.PHP_EOL, FILE_APPEND |
|
| 71 | 71 | ); |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | private function trace($type) |
| 75 | 75 | { |
| 76 | - $trace = function () use ($type) { |
|
| 76 | + $trace = function() use ($type) { |
|
| 77 | 77 | switch ($type) { |
| 78 | 78 | case TraceableNetwork::TYPE_DATA: |
| 79 | 79 | $this->traceData(func_get_args(), $type); |
@@ -94,22 +94,22 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | private function traceData(array $args, $type) |
| 96 | 96 | { |
| 97 | - $data = $args[0]; |
|
| 98 | - $socket = $args[1]; |
|
| 97 | + $data = $args[ 0 ]; |
|
| 98 | + $socket = $args[ 1 ]; |
|
| 99 | 99 | |
| 100 | 100 | if (!is_string($data)) { |
| 101 | 101 | $data = serialize($data); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | $to = $socket->to(); |
| 105 | - $message = "-> {$to['port']} {$to['process']['id']} "; |
|
| 105 | + $message = "-> {$to[ 'port' ]} {$to[ 'process' ][ 'id' ]} "; |
|
| 106 | 106 | |
| 107 | 107 | $from = $socket->from(); |
| 108 | - if (isset($from['process'])) { |
|
| 109 | - $message = "{$from['process']['id']} {$from['port']} {$message}"; |
|
| 108 | + if (isset($from[ 'process' ])) { |
|
| 109 | + $message = "{$from[ 'process' ][ 'id' ]} {$from[ 'port' ]} {$message}"; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - $this->logger->info("{$message} {$this->actions[$type]} {$data}"); |
|
| 112 | + $this->logger->info("{$message} {$this->actions[ $type ]} {$data}"); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -118,16 +118,16 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | private function traceAction(array $args, $type) |
| 120 | 120 | { |
| 121 | - $socket = $args[0]; |
|
| 121 | + $socket = $args[ 0 ]; |
|
| 122 | 122 | |
| 123 | 123 | $to = $socket->to(); |
| 124 | - $message = "-> {$to['port']} {$to['process']['id']} "; |
|
| 124 | + $message = "-> {$to[ 'port' ]} {$to[ 'process' ][ 'id' ]} "; |
|
| 125 | 125 | |
| 126 | 126 | $from = $socket->from(); |
| 127 | - if (isset($from['process'])) { |
|
| 128 | - $message = "{$from['process']['id']} {$from['port']} {$message}"; |
|
| 127 | + if (isset($from[ 'process' ])) { |
|
| 128 | + $message = "{$from[ 'process' ][ 'id' ]} {$from[ 'port' ]} {$message}"; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $this->logger->debug("{$message} {$this->actions[$type]}"); |
|
| 131 | + $this->logger->debug("{$message} {$this->actions[ $type ]}"); |
|
| 132 | 132 | } |
| 133 | 133 | } |
@@ -5,20 +5,20 @@ |
||
| 5 | 5 | * to "wc -l <filename>" |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -if (!isset($_SERVER['argv'][1])) { |
|
| 8 | +if (!isset($_SERVER[ 'argv' ][ 1 ])) { |
|
| 9 | 9 | die("You must provide a filename\n"); |
| 10 | 10 | } |
| 11 | -$fileName = $_SERVER['argv'][1]; |
|
| 11 | +$fileName = $_SERVER[ 'argv' ][ 1 ]; |
|
| 12 | 12 | |
| 13 | 13 | // Include standard autoloader |
| 14 | -require __DIR__ . '/../../vendor/autoload.php'; |
|
| 14 | +require __DIR__.'/../../vendor/autoload.php'; |
|
| 15 | 15 | |
| 16 | 16 | // create network |
| 17 | 17 | $traceableNetwork = new \PhpFlo\TraceableNetwork( |
| 18 | 18 | new PhpFlo\Network( |
| 19 | 19 | new PhpFlo\Builder\ComponentFactory() |
| 20 | 20 | ), |
| 21 | - new \PhpFlo\Logger\SimpleFile(__DIR__ . DIRECTORY_SEPARATOR . 'flow.log', 'info') |
|
| 21 | + new \PhpFlo\Logger\SimpleFile(__DIR__.DIRECTORY_SEPARATOR.'flow.log', 'info') |
|
| 22 | 22 | ); |
| 23 | 23 | $traceableNetwork |
| 24 | 24 | ->boot(__DIR__.'/count.fbp') |