[ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This file is part of the Symfony package. 5 * 6 * (c) Fabien Potencier <fabien@symfony.com> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 namespace Symfony\Component\Config\Definition\Builder; 13 14 use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; 15 16 /** 17 * Abstract class that contains common code of integer and float node definitions. 18 * 19 * @author David Jeanmonod <david.jeanmonod@gmail.com> 20 */ 21 abstract class NumericNodeDefinition extends ScalarNodeDefinition 22 { 23 protected $min; 24 protected $max; 25 26 /** 27 * Ensures that the value is smaller than the given reference. 28 * 29 * @param mixed $max 30 * 31 * @return $this 32 * 33 * @throws \InvalidArgumentException when the constraint is inconsistent 34 */ 35 public function max($max) 36 { 37 if (isset($this->min) && $this->min > $max) { 38 throw new \InvalidArgumentException(sprintf('You cannot define a max(%s) as you already have a min(%s).', $max, $this->min)); 39 } 40 $this->max = $max; 41 42 return $this; 43 } 44 45 /** 46 * Ensures that the value is bigger than the given reference. 47 * 48 * @param mixed $min 49 * 50 * @return $this 51 * 52 * @throws \InvalidArgumentException when the constraint is inconsistent 53 */ 54 public function min($min) 55 { 56 if (isset($this->max) && $this->max < $min) { 57 throw new \InvalidArgumentException(sprintf('You cannot define a min(%s) as you already have a max(%s).', $min, $this->max)); 58 } 59 $this->min = $min; 60 61 return $this; 62 } 63 64 /** 65 * {@inheritdoc} 66 * 67 * @throws InvalidDefinitionException 68 */ 69 public function cannotBeEmpty() 70 { 71 throw new InvalidDefinitionException('->cannotBeEmpty() is not applicable to NumericNodeDefinition.'); 72 } 73 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |