/**
  * @param Canvas $canvas
  * @param array  $args
  * @return Canvas
  */
 public function draw(Canvas $canvas, array $args)
 {
     $this->checkArgumentsValid($args);
     $startRow = $args[0];
     $startCol = $args[1];
     if ($canvas->isPointOutOfBounds($startRow, $startCol)) {
         // If the starting point is out of bounds, then draw nothing
         return $canvas;
     }
     $endRow = $args[2];
     $endCol = $args[3];
     if ($canvas->isRowOutOfBounds($endRow)) {
         // If the ending row is out of bounds, draw until the canvas ends
         $endRow = $canvas->getWidth();
     }
     if ($canvas->isColumnOutOfBounds($endCol)) {
         // If the ending column is out of bounds, draw until the canvas ends
         $endCol = $canvas->getHeight();
     }
     // Draw
     for ($i = $startRow; $i <= $endRow; ++$i) {
         for ($j = $startCol; $j <= $endCol; ++$j) {
             $canvas->markPoint($i, $j);
         }
     }
     return $canvas;
 }
 /**
  * @dataProvider rowDataProvider
  */
 public function test_it_correctly_verifies_whether_row_is_out_of_bounds($row, $expected)
 {
     $canvas = new Canvas(3, 2);
     $result = $canvas->isRowOutOfBounds($row);
     $this->assertEquals($expected, $result);
 }