/** * Checks to see if the rectangle fully contains another rectangle. * * @param Rectangle $other * @return bool */ public function contains(Rectangle $other) { $normThis = $this->normalized(); $normOther = $other->normalized(); return $normThis->x1 <= $normOther->x1 && $normThis->x2 >= $normOther->x2 && $normThis->y1 <= $normOther->y1 && $normThis->y2 >= $normOther->y2; }