Symfony\Component\Form\TimeField::isMinuteWithinRange PHP Method

isMinuteWithinRange() public method

The minute is valid if it is contained in the list passed to the field's option "minutes".
public isMinuteWithinRange ( ) : boolean
return boolean
    public function isMinuteWithinRange()
    {
        $date = $this->getNormalizedData();

        return $date === null || in_array($date->format('i'), $this->getOption('minutes'));
    }

Usage Example

コード例 #1
0
 public function testIsMinuteWithinRange_returnsFalseIfNotContained()
 {
     $field = new TimeField('name', array('minutes' => array(6, 7)));
     $field->submit(array('hour' => '06', 'minute' => '08'));
     $this->assertFalse($field->isMinuteWithinRange());
 }