@@ -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 |
@@ -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 | ); |
@@ -2,7 +2,6 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace drupol\Yaroc\Http; |
4 | 4 | |
5 | -use drupol\Yaroc\Plugin\MethodPluginInterface; |
|
6 | 5 | use Http\Client\Common\HttpMethodsClient; |
7 | 6 | use Http\Client\Common\Plugin; |
8 | 7 | use Http\Client\Common\PluginClient; |
@@ -14,6 +13,7 @@ discard block |
||
14 | 13 | use Http\Message\UriFactory; |
15 | 14 | use Psr\Http\Message\ResponseInterface; |
16 | 15 | use Psr\Http\Message\UriInterface; |
16 | +use drupol\Yaroc\Plugin\MethodPluginInterface; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Class Client |
@@ -2,13 +2,13 @@ |
||
2 | 2 | |
3 | 3 | namespace drupol\Yaroc; |
4 | 4 | |
5 | -use drupol\Yaroc\Http\Client; |
|
6 | -use drupol\Yaroc\Plugin\MethodPluginInterface; |
|
7 | -use drupol\Yaroc\Plugin\MethodPluginManager; |
|
8 | 5 | use Http\Client\Common\Plugin; |
9 | 6 | use Http\Client\HttpClient; |
10 | 7 | use Http\Message\UriFactory; |
11 | 8 | use Psr\Http\Message\ResponseInterface; |
9 | +use drupol\Yaroc\Http\Client; |
|
10 | +use drupol\Yaroc\Plugin\MethodPluginInterface; |
|
11 | +use drupol\Yaroc\Plugin\MethodPluginManager; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Class RandomOrgAPIClient |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace drupol\Yaroc\Plugin\RychRandom\Generator; |
4 | 4 | |
5 | -use drupol\Yaroc\RandomOrgAPI; |
|
6 | 5 | use Rych\Random\Generator\GeneratorInterface; |
6 | +use drupol\Yaroc\RandomOrgAPI; |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * The Random.Org Generator. |
@@ -18,20 +18,20 @@ |
||
18 | 18 | * @return self |
19 | 19 | */ |
20 | 20 | public 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 | ->getData(); |
23 | 23 | |
24 | 24 | $inside = 0; |
25 | 25 | for ($i = 0; $i < $n; $i++) { |
26 | 26 | $x = $numbers[$i]; |
27 | - $y = $numbers[$i+1]; |
|
27 | + $y = $numbers[$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 | } |