/**
  * @param Number $number
  * @return array
  * @throws \Exception
  */
 public function generateBuddies(Number $number)
 {
     if ($number->getValue() <= 0) {
         throw new \Exception("Invalid Number");
     }
     $buddies = [];
     for ($i = 1; $i <= $number->getValue(); $i++) {
         if (count($buddies) >= $number->getValue()) {
             return;
         }
         $modThree = $i % 3;
         $modFive = $i % 5;
         if ($modThree != 0 && $modFive != 0) {
             continue;
         }
         if ($modThree == 0) {
             $buddies[] = $this->multiplyThreeByddy->getBuddy($number, $i);
         }
         if ($modFive == 0) {
             $buddies[] = $this->multiplyFiveByddy->getBuddy($number, $i);
         }
         if ($modThree == 0 && $modFive == 0) {
             $buddies[] = $this->multiplyThreeAndFiveByddy->getBuddy($number, $i);
         }
     }
     return $buddies;
 }
 /**
  * @param Number $number
  * @return bool|mixed
  */
 public function readByNumber(Number $number)
 {
     $sql = "SELECT * FROM number_buddy WHERE number_value = ?";
     $query = $this->getPdo()->prepare($sql);
     $query->execute([$number->getValue()]);
     if ($query->rowCount() == 0) {
         return false;
     }
     return $query->fetch();
 }
 /**
  * @param Number $number
  * @param int $indent
  * @return int
  */
 protected function calculateBuddy(Number $number, $indent)
 {
     return $indent + $indent * $number->getValue();
 }
 /**
  * @param Number $number
  * @param int $indent
  * @return int
  */
 protected function calculateBuddy(Number $number, $indent)
 {
     return (int) ($indent + $indent * $number->getRoundedSquareRoot() + 1);
 }