@@ -15,7 +15,6 @@ |
||
| 15 | 15 | use Symfony\Component\Console\Input\InputOption; |
| 16 | 16 | use Symfony\Component\Console\Input\InputInterface; |
| 17 | 17 | use Symfony\Component\Console\Output\OutputInterface; |
| 18 | - |
|
| 19 | 18 | use EoC\Opt\ViewQueryOpts; |
| 20 | 19 | |
| 21 | 20 | |
@@ -39,10 +39,11 @@ discard block |
||
| 39 | 39 | * @return bool |
| 40 | 40 | */ |
| 41 | 41 | protected function isArray($arg) { |
| 42 | - if (preg_match('/\A[\[]([^\[\]]+)[\]]\z/i', $arg, $matches)) |
|
| 43 | - return TRUE; |
|
| 44 | - else |
|
| 45 | - return FALSE; |
|
| 42 | + if (preg_match('/\A[\[]([^\[\]]+)[\]]\z/i', $arg, $matches)) { |
|
| 43 | + return TRUE; |
|
| 44 | + } else { |
|
| 45 | + return FALSE; |
|
| 46 | + } |
|
| 46 | 47 | } |
| 47 | 48 | |
| 48 | 49 | |
@@ -94,8 +95,7 @@ discard block |
||
| 94 | 95 | } |
| 95 | 96 | |
| 96 | 97 | return TRUE; |
| 97 | - } |
|
| 98 | - else { |
|
| 98 | + } else { |
|
| 99 | 99 | return FALSE; |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -109,16 +109,17 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | protected function castArg($arg, $encode = TRUE) { |
| 111 | 111 | echo "Original argument: ".$arg.PHP_EOL; |
| 112 | - if ($this->isArray($arg)) |
|
| 113 | - return $arg; |
|
| 114 | - elseif ($this->isFormatted($arg)) { |
|
| 115 | - if ($encode) |
|
| 116 | - return json_encode($arg); |
|
| 117 | - else |
|
| 118 | - return $arg; |
|
| 112 | + if ($this->isArray($arg)) { |
|
| 113 | + return $arg; |
|
| 114 | + } elseif ($this->isFormatted($arg)) { |
|
| 115 | + if ($encode) { |
|
| 116 | + return json_encode($arg); |
|
| 117 | + } else { |
|
| 118 | + return $arg; |
|
| 119 | + } |
|
| 120 | + } else { |
|
| 121 | + return $arg + 0; |
|
| 119 | 122 | } |
| 120 | - else |
|
| 121 | - return $arg + 0; |
|
| 122 | 123 | } |
| 123 | 124 | |
| 124 | 125 | |
@@ -134,15 +135,16 @@ discard block |
||
| 134 | 135 | $shmSize = shmop_size($shmId); |
| 135 | 136 | |
| 136 | 137 | // Now lets read the memory segment. |
| 137 | - if ($buffer = shmop_read($shmId, 0, $shmSize)) |
|
| 138 | - $connection = unserialize($buffer); |
|
| 139 | - else |
|
| 140 | - throw new \RuntimeException("You are not connected to the server."); |
|
| 138 | + if ($buffer = shmop_read($shmId, 0, $shmSize)) { |
|
| 139 | + $connection = unserialize($buffer); |
|
| 140 | + } else { |
|
| 141 | + throw new \RuntimeException("You are not connected to the server."); |
|
| 142 | + } |
|
| 141 | 143 | |
| 142 | 144 | shmop_close($shmId); |
| 145 | + } else { |
|
| 146 | + throw new \RuntimeException("You are not connected to the server."); |
|
| 143 | 147 | } |
| 144 | - else |
|
| 145 | - throw new \RuntimeException("You are not connected to the server."); |
|
| 146 | 148 | |
| 147 | 149 | return new Couch(new CurlAdapter($connection['server'], $connection['user'], $connection['password'])); |
| 148 | 150 | } |
@@ -160,15 +162,16 @@ discard block |
||
| 160 | 162 | $shmSize = shmop_size($shmId); |
| 161 | 163 | |
| 162 | 164 | // Now lets read the memory segment. |
| 163 | - if ($buffer = shmop_read($shmId, 0, $shmSize)) |
|
| 164 | - $database = $buffer; |
|
| 165 | - else |
|
| 166 | - throw new \RuntimeException("No database selected."); |
|
| 165 | + if ($buffer = shmop_read($shmId, 0, $shmSize)) { |
|
| 166 | + $database = $buffer; |
|
| 167 | + } else { |
|
| 168 | + throw new \RuntimeException("No database selected."); |
|
| 169 | + } |
|
| 167 | 170 | |
| 168 | 171 | shmop_close($shmId); |
| 172 | + } else { |
|
| 173 | + throw new \RuntimeException("No database selected."); |
|
| 169 | 174 | } |
| 170 | - else |
|
| 171 | - throw new \RuntimeException("No database selected."); |
|
| 172 | 175 | |
| 173 | 176 | return $database; |
| 174 | 177 | } |