     1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

    <?php
    /**
     * @type Size
     *
     * A size that satisfies Catapult API
     * exceptions
     */

    namespace Catapult;
    final class Size extends Types {
        public function __construct($size=DEFAULTS::SIZE)
        {
          if ($size > DEFAULTS::SIZE_MAX) {
            Throw new \CatapultApiException("Size too large. Size was: " . $size);
          }

          if ($size < DEFAULTS::SIZE_MIN) {
            Throw new \CatapultApiException("Size too small. Size was: " . $size);
          }

          $this->size = $size;
        }

        public function __toString()
        {
          return (string) ($this->size);
        }
    }