/**
  * @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;
 }
 public function test_it_clears_canvas()
 {
     $canvas = new Canvas(3, 2);
     $canvas->markPoint(2, 2);
     $canvas->clear();
     $canvasContent = $canvas->getContent();
     $this->assertEquals(Canvas::POINT_EMPTY, $canvasContent[2][2]);
 }