@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | - * @return int|float |
|
| 74 | + * @return double |
|
| 75 | 75 | */ |
| 76 | 76 | public function length() |
| 77 | 77 | { |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | /** |
| 224 | 224 | * @param Point|int $upTo |
| 225 | - * @param int|float $step |
|
| 225 | + * @param integer $step |
|
| 226 | 226 | * |
| 227 | 227 | * @return \Traversable |
| 228 | 228 | */ |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | /** |
| 243 | 243 | * @param Point|int $upTo |
| 244 | - * @param int|float $step |
|
| 244 | + * @param integer $step |
|
| 245 | 245 | * |
| 246 | 246 | * @return \Traversable |
| 247 | 247 | */ |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // if library is in dev environement with its own vendor, include its autoload |
| 4 | -if(file_exists(__DIR__ . '/vendor')) |
|
| 4 | +if (file_exists(__DIR__ . '/vendor')) |
|
| 5 | 5 | require_once __DIR__ . '/vendor/autoload.php'; |
| 6 | 6 | // if library is in vendor of another project, include the global autolaod |
| 7 | 7 | else |
@@ -1,8 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // if library is in dev environement with its own vendor, include its autoload |
| 4 | -if(file_exists(__DIR__ . '/vendor')) |
|
| 4 | +if(file_exists(__DIR__ . '/vendor')) { |
|
| 5 | 5 | require_once __DIR__ . '/vendor/autoload.php'; |
| 6 | +} |
|
| 6 | 7 | // if library is in vendor of another project, include the global autolaod |
| 7 | -else |
|
| 8 | +else { |
|
| 8 | 9 | require_once __DIR__ . '/../../autoload.php'; |
| 10 | +} |
|
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | { |
| 43 | 43 | $callback = null; |
| 44 | 44 | if ($valueProvider instanceof ValueProvider) { |
| 45 | - $callback = function (Point $p) use ($valueProvider) { |
|
| 45 | + $callback = function(Point $p) use ($valueProvider) { |
|
| 46 | 46 | return $valueProvider->get($p); |
| 47 | 47 | }; |
| 48 | 48 | } elseif (is_callable($valueProvider)) { |
@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | public function count_provider() |
| 11 | 11 | { |
| 12 | 12 | return [ |
| 13 | - [new Point(1,1), new Point(1, 1), 1], |
|
| 14 | - [new Point(1,1), new Point(2, 2), 4], |
|
| 15 | - [new Point(1,1), new Point(3, 3), 9], |
|
| 13 | + [new Point(1, 1), new Point(1, 1), 1], |
|
| 14 | + [new Point(1, 1), new Point(2, 2), 4], |
|
| 15 | + [new Point(1, 1), new Point(3, 3), 9], |
|
| 16 | 16 | |
| 17 | - [new Point(1,1), new Point(4, 3), 12], |
|
| 17 | + [new Point(1, 1), new Point(4, 3), 12], |
|
| 18 | 18 | ]; |
| 19 | 19 | } |
| 20 | 20 | |
@@ -33,15 +33,15 @@ discard block |
||
| 33 | 33 | public function point_belongs_to_rectangular_provider() |
| 34 | 34 | { |
| 35 | 35 | return [ |
| 36 | - [new Point(1,1), new Point(4, 3), new Point(1,1), true], |
|
| 37 | - [new Point(1,1), new Point(4, 3), new Point(2,2), true], |
|
| 38 | - [new Point(1,1), new Point(4, 3), new Point(3,3), true], |
|
| 39 | - [new Point(1,1), new Point(4, 3), new Point(4,3), true], |
|
| 40 | - |
|
| 41 | - [new Point(1,1), new Point(4, 3), new Point(0,0), false], |
|
| 42 | - [new Point(1,1), new Point(4, 3), new Point(0,4), false], |
|
| 43 | - [new Point(1,1), new Point(4, 3), new Point(4,4), false], |
|
| 44 | - [new Point(1,1), new Point(4, 3), new Point(4,0), false], |
|
| 36 | + [new Point(1, 1), new Point(4, 3), new Point(1, 1), true], |
|
| 37 | + [new Point(1, 1), new Point(4, 3), new Point(2, 2), true], |
|
| 38 | + [new Point(1, 1), new Point(4, 3), new Point(3, 3), true], |
|
| 39 | + [new Point(1, 1), new Point(4, 3), new Point(4, 3), true], |
|
| 40 | + |
|
| 41 | + [new Point(1, 1), new Point(4, 3), new Point(0, 0), false], |
|
| 42 | + [new Point(1, 1), new Point(4, 3), new Point(0, 4), false], |
|
| 43 | + [new Point(1, 1), new Point(4, 3), new Point(4, 4), false], |
|
| 44 | + [new Point(1, 1), new Point(4, 3), new Point(4, 0), false], |
|
| 45 | 45 | ]; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | public function test_draw() |
| 13 | 13 | { |
| 14 | - $circularProducer = new CircularCenterRadius(new Point(15,15), 10, true); |
|
| 14 | + $circularProducer = new CircularCenterRadius(new Point(15, 15), 10, true); |
|
| 15 | 15 | $circle = $circularProducer->produce(); |
| 16 | 16 | |
| 17 | 17 | $circle->smallestRectangularEnvelope(); |
| 18 | - $rectangularProducer = new RectangularFromTwoPoints(new Point(0,0), new Point(30, 30)); |
|
| 18 | + $rectangularProducer = new RectangularFromTwoPoints(new Point(0, 0), new Point(30, 30)); |
|
| 19 | 19 | $rect = $rectangularProducer->produce(); |
| 20 | 20 | |
| 21 | 21 | if (false) { |
@@ -47,18 +47,18 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | print "\n\n\n\n"; |
| 49 | 49 | $firstLine = true; |
| 50 | - for ($y=0, $yMax = count($arr); $y<$yMax; $y++) { |
|
| 50 | + for ($y = 0, $yMax = count($arr); $y < $yMax; $y++) { |
|
| 51 | 51 | $row = $arr[$y]; |
| 52 | 52 | if ($firstLine) { |
| 53 | 53 | $firstLine = false; |
| 54 | 54 | print 'y '; |
| 55 | - for ($x=0, $xMax = count($row); $x<$xMax; $x++) { |
|
| 55 | + for ($x = 0, $xMax = count($row); $x < $xMax; $x++) { |
|
| 56 | 56 | print $x % 10; |
| 57 | 57 | } |
| 58 | 58 | print " x \n"; |
| 59 | 59 | } |
| 60 | 60 | print str_pad($y, 3); |
| 61 | - for ($x=0, $xMax = count($row); $x<$xMax; $x++) { |
|
| 61 | + for ($x = 0, $xMax = count($row); $x < $xMax; $x++) { |
|
| 62 | 62 | print $row[$x]; |
| 63 | 63 | } |
| 64 | 64 | print "\n"; |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | public function test_index_data_with_points() |
| 11 | 11 | { |
| 12 | 12 | $set = new PointSet(); |
| 13 | - $set->attach($p11 = new Point(1,1), $v11 = 'v11'); |
|
| 13 | + $set->attach($p11 = new Point(1, 1), $v11 = 'v11'); |
|
| 14 | 14 | |
| 15 | 15 | static::assertTrue($set->contains($p11)); |
| 16 | 16 | static::assertEquals($set[$p11], $v11); |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public function test_union() |
| 20 | 20 | { |
| 21 | - $a = new PointSet([new Point(1,1), new Point(2,2), new Point(3,3)]); |
|
| 22 | - $b = new PointSet([new Point(3,1), new Point(2,2), new Point(1,3)]); |
|
| 21 | + $a = new PointSet([new Point(1, 1), new Point(2, 2), new Point(3, 3)]); |
|
| 22 | + $b = new PointSet([new Point(3, 1), new Point(2, 2), new Point(1, 3)]); |
|
| 23 | 23 | $r = $a->union($b); |
| 24 | 24 | |
| 25 | 25 | static::assertEquals(3, $a->count()); |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | public function test_intersect() |
| 40 | 40 | { |
| 41 | - $a = new PointSet([new Point(1,1), new Point(2,2), new Point(3,3)]); |
|
| 42 | - $b = new PointSet([new Point(3,1), new Point(2,2), new Point(1,3)]); |
|
| 41 | + $a = new PointSet([new Point(1, 1), new Point(2, 2), new Point(3, 3)]); |
|
| 42 | + $b = new PointSet([new Point(3, 1), new Point(2, 2), new Point(1, 3)]); |
|
| 43 | 43 | $r = $a->intersect($b); |
| 44 | 44 | |
| 45 | 45 | static::assertEquals(3, $a->count()); |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | static::assertNotSame($r, $a); |
| 49 | 49 | static::assertNotSame($r, $b); |
| 50 | 50 | |
| 51 | - static::assertTrue($r->contains(new Point(2,2))); |
|
| 51 | + static::assertTrue($r->contains(new Point(2, 2))); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function test_diff() |
| 55 | 55 | { |
| 56 | - $a = new PointSet([new Point(1,1), new Point(2,2), new Point(3,3)]); |
|
| 57 | - $b = new PointSet([new Point(3,1), new Point(2,2), new Point(1,3)]); |
|
| 56 | + $a = new PointSet([new Point(1, 1), new Point(2, 2), new Point(3, 3)]); |
|
| 57 | + $b = new PointSet([new Point(3, 1), new Point(2, 2), new Point(1, 3)]); |
|
| 58 | 58 | $r = $a->diff($b); |
| 59 | 59 | |
| 60 | 60 | static::assertEquals(3, $a->count()); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | static::assertNotSame($r, $a); |
| 64 | 64 | static::assertNotSame($r, $b); |
| 65 | 65 | |
| 66 | - static::assertTrue($r->contains(new Point(1,1))); |
|
| 67 | - static::assertTrue($r->contains(new Point(3,3))); |
|
| 66 | + static::assertTrue($r->contains(new Point(1, 1))); |
|
| 67 | + static::assertTrue($r->contains(new Point(3, 3))); |
|
| 68 | 68 | } |
| 69 | 69 | } |
@@ -18,20 +18,20 @@ |
||
| 18 | 18 | |
| 19 | 19 | public function test_length_is_sum_of_coordinates() |
| 20 | 20 | { |
| 21 | - $point = new Point(5,8); |
|
| 21 | + $point = new Point(5, 8); |
|
| 22 | 22 | static::assertEquals(13, $point->length()); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function test_distance_is_distance_from_the_origin() |
| 26 | 26 | { |
| 27 | - $point = new Point(3,4); |
|
| 27 | + $point = new Point(3, 4); |
|
| 28 | 28 | static::assertEquals(5, $point->distance()); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function test_move_returns_new_point() |
| 32 | 32 | { |
| 33 | - $a = new Point(1,1); |
|
| 34 | - $c = $a->move($by = new Point(2,2)); |
|
| 33 | + $a = new Point(1, 1); |
|
| 34 | + $c = $a->move($by = new Point(2, 2)); |
|
| 35 | 35 | |
| 36 | 36 | static::assertNotSame($a, $c); |
| 37 | 37 | static::assertNotSame($by, $c); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function getAllX() |
| 64 | 64 | { |
| 65 | - return array_map(function (Point $p) { |
|
| 65 | + return array_map(function(Point $p) { |
|
| 66 | 66 | return $p->getX(); |
| 67 | 67 | }, $this->points); |
| 68 | 68 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function getAllY() |
| 74 | 74 | { |
| 75 | - return array_map(function (Point $p) { |
|
| 75 | + return array_map(function(Point $p) { |
|
| 76 | 76 | return $p->getY(); |
| 77 | 77 | }, $this->points); |
| 78 | 78 | } |