@@ -15,7 +15,7 @@ |
||
15 | 15 | protected $face; |
16 | 16 | |
17 | 17 | /** |
18 | - * @return array |
|
18 | + * @return string |
|
19 | 19 | */ |
20 | 20 | function flip() { |
21 | 21 | $result = $this->randomOrgAPI->call('generateIntegers', ['n' => 1, 'min' => 0, 'max' => 1]) |
@@ -183,6 +183,7 @@ discard block |
||
183 | 183 | /** |
184 | 184 | * Set the API version. |
185 | 185 | * |
186 | + * @param integer $version |
|
186 | 187 | * @return int |
187 | 188 | */ |
188 | 189 | public function setApiVersion($version) { |
@@ -230,7 +231,7 @@ discard block |
||
230 | 231 | /** |
231 | 232 | * Get the response. |
232 | 233 | * |
233 | - * @return bool|\Psr\Http\Message\ResponseInterface |
|
234 | + * @return null|ResponseInterface |
|
234 | 235 | */ |
235 | 236 | public function getResponse() { |
236 | 237 | return $this->response; |
@@ -7,7 +7,6 @@ |
||
7 | 7 | use drupol\Yaroc\Plugin\MethodPluginInterface; |
8 | 8 | use drupol\Yaroc\Plugin\MethodPluginManager; |
9 | 9 | use Http\Client\HttpClient; |
10 | -use Http\Message\Decorator\ResponseDecorator; |
|
11 | 10 | use Mockery\Generator\Method; |
12 | 11 | use Psr\Http\Message\ResponseInterface; |
13 | 12 | use Psr\Log\LoggerInterface; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | const appRoot = __DIR__ . "/../../"; |
16 | 16 | |
17 | 17 | /** |
18 | - * @param $namespace |
|
18 | + * @param string $namespace |
|
19 | 19 | * |
20 | 20 | * @return array |
21 | 21 | */ |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * @param $namespace |
48 | 48 | * |
49 | - * @return bool|string |
|
49 | + * @return string|false |
|
50 | 50 | */ |
51 | 51 | private static function getNamespaceDirectory($namespace) { |
52 | 52 | $composerNamespaces = self::getDefinedNamespaces(); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | * @package drupol\Yaroc\Utilities |
9 | 9 | */ |
10 | -class ClassFinder { |
|
10 | +class ClassFinder { |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | return $namespace . '\\' . str_replace('.php', '', $file); |
27 | 27 | }, $files); |
28 | 28 | |
29 | - return array_filter($classes, function($possibleClass){ |
|
29 | + return array_filter($classes, function($possibleClass) { |
|
30 | 30 | return class_exists($possibleClass); |
31 | 31 | }); |
32 | 32 | } |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | $namespaceFragments = explode('\\', $namespace); |
55 | 55 | $undefinedNamespaceFragments = []; |
56 | 56 | |
57 | - while($namespaceFragments) { |
|
57 | + while ($namespaceFragments) { |
|
58 | 58 | $possibleNamespace = implode('\\', $namespaceFragments) . '\\'; |
59 | 59 | |
60 | - if(array_key_exists($possibleNamespace, $composerNamespaces)){ |
|
60 | + if (array_key_exists($possibleNamespace, $composerNamespaces)) { |
|
61 | 61 | return realpath(self::appRoot . $composerNamespaces[$possibleNamespace] . implode('/', array_reverse($undefinedNamespaceFragments))); |
62 | 62 | } |
63 | 63 |
@@ -45,13 +45,13 @@ |
||
45 | 45 | public function handleRequest(RequestInterface $request, callable $next, callable $first) { |
46 | 46 | $this->logger->info(sprintf('Emit request: "%s"', $this->formatter->formatRequest($request))); |
47 | 47 | |
48 | - return $next($request)->then(function (ResponseInterface $response) use ($request) { |
|
48 | + return $next($request)->then(function(ResponseInterface $response) use ($request) { |
|
49 | 49 | $this->logger->info( |
50 | 50 | sprintf('Receive response: "%s" for request: "%s"', $this->formatter->formatResponse($response), $this->formatter->formatRequest($request)) |
51 | 51 | ); |
52 | 52 | |
53 | 53 | return $response; |
54 | - }, function (Exception $exception) use ($request) { |
|
54 | + }, function(Exception $exception) use ($request) { |
|
55 | 55 | if ($exception instanceof Exception\HttpException) { |
56 | 56 | $this->logger->error( |
57 | 57 | sprintf('Error: "%s" with response: "%s" when emitting request: "%s"', $exception->getMessage(), $this->formatter->formatResponse($exception->getResponse()), $this->formatter->formatRequest($request)), |
@@ -17,6 +17,6 @@ |
||
17 | 17 | $this->setHandlers([ |
18 | 18 | new StreamHandler('php://memory', \Monolog\Logger::DEBUG), |
19 | 19 | ]); |
20 | - } |
|
20 | + } |
|
21 | 21 | |
22 | 22 | } |
@@ -18,20 +18,20 @@ |
||
18 | 18 | * @return self |
19 | 19 | */ |
20 | 20 | function run($n = 1000) { |
21 | - $numbers = $this->randomOrgAPI->call('generateDecimalFractions', ['n' => $n * 2, 'decimalPlaces' => 6]) |
|
21 | + $numbers = $this->randomOrgAPI->call('generateDecimalFractions', ['n' => $n*2, 'decimalPlaces' => 6]) |
|
22 | 22 | ->getResult(); |
23 | 23 | |
24 | 24 | $inside = 0; |
25 | 25 | for ($i = 0; $i < $n; $i++) { |
26 | 26 | $x = $numbers['random']['data'][$i]; |
27 | - $y = $numbers['random']['data'][$i+1]; |
|
27 | + $y = $numbers['random']['data'][$i + 1]; |
|
28 | 28 | |
29 | 29 | if (sqrt($x*$x + $y*$y) <= 1) { |
30 | 30 | $inside++; |
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | - $this->estimation = 4 * $inside/$n; |
|
34 | + $this->estimation = 4*$inside/$n; |
|
35 | 35 | |
36 | 36 | return $this; |
37 | 37 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | public function getPlugins() { |
20 | 20 | $candidates = array_filter( |
21 | 21 | ClassFinder::getClassesInNamespace('drupol\Yaroc\Plugin\Method'), |
22 | - function ($className) { |
|
22 | + function($className) { |
|
23 | 23 | return in_array('drupol\Yaroc\Plugin\MethodPluginInterface', class_implements($className)); |
24 | 24 | } |
25 | 25 | ); |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $defaultParameters = $this->getDefaultParameters(); |
61 | 61 | |
62 | 62 | $params = []; |
63 | - foreach($this->getDefaultParameters() as $key => $parameter) { |
|
63 | + foreach ($this->getDefaultParameters() as $key => $parameter) { |
|
64 | 64 | if (in_array($this->getApiVersion(), (array) $defaultParameters[$key]['api'])) { |
65 | 65 | if (!is_null($parameter['value'])) |
66 | 66 | $params[$key] = $parameter['value']; |
@@ -62,8 +62,9 @@ |
||
62 | 62 | $params = []; |
63 | 63 | foreach($this->getDefaultParameters() as $key => $parameter) { |
64 | 64 | if (in_array($this->getApiVersion(), (array) $defaultParameters[$key]['api'])) { |
65 | - if (!is_null($parameter['value'])) |
|
66 | - $params[$key] = $parameter['value']; |
|
65 | + if (!is_null($parameter['value'])) { |
|
66 | + $params[$key] = $parameter['value']; |
|
67 | + } |
|
67 | 68 | } |
68 | 69 | } |
69 | 70 |