芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/public_html/fmd/vendor/respect/validation/library/Rules/LeapYear.php
* * For the full copyright and license information, please view the "LICENSE.md" * file that was distributed with this source code. */ namespace Respect\Validation\Rules; use DateTime; class LeapYear extends AbstractRule { public function validate($year) { if (is_numeric($year)) { $year = (int) $year; } elseif (is_string($year)) { $year = (int) date('Y', strtotime($year)); } elseif ($year instanceof DateTime) { $year = (int) $year->format('Y'); } else { return false; } $date = strtotime(sprintf('%d-02-29', $year)); return (bool) date('L', $date); } }