/**
 * 月の情報を返す
 *
 * @param string $baseYear 開始年
 * @param string $targetMonth 対象の月
 * @param boolean $beginMonday 基準を月曜日にするか
 * @param int $loop 何年間分欲しいか
 *
 * @return array
 */
function getMonth($baseYear, $targetMonth, $beginMonday = false, $loop = 20)
{
    $ret = array();
    for ($i = 0; $i <= $loop; $i++) {
        $month = Month::forge($baseYear + $i . $targetMonth, $beginMonday)->prepare()->calc();
        $weekCnt = $month->getWeeksCount();
        $weeks = $month->getWeeks();
        $key = $baseYear + $i . '/' . $targetMonth;
        $ret[$key]['days'] = $weeks[$weekCnt]->getDays();
        $ret[$key]['includeNextYear'] = $weeks[$weekCnt]->includedNextMonthDayCnt() > 3;
        $ret[$key]['weekCnt'] = $weekCnt;
    }
    return $ret;
}