public function handleCommand($command, $data = null) { if ($this->Items) { $return = $this->Items->handleCommand($command, $data); if ($return) { return $return; } } switch (strtolower($command)) { case 'min': $this->minItems = intval($data); return $this; case 'max': $this->maxItems = intval($data); return $this; case 'items': $match = array(); if (preg_match('/^([a-z]+)/i', $data, $match) !== 1) { throw new \SwaggerGen\Exception("Unparseable items definition: '{$data}'"); } foreach (self::$classTypes as $type => $format) { if (in_array($match[1], $format)) { break; } } $classname = "SwaggerGen\\Swagger\\Type\\{$type}Type"; $this->Items = new $classname($this, $match[2]); return $this->Items; } return parent::handleCommand($command, $data); }
public function handleCommand($command, $data = null) { switch (strtolower($command)) { case 'default': $this->setDefault($value); return $this; } return parent::handleCommand($command, $data); }
public function handleCommand($command, $data = null) { switch (strtolower($command)) { case 'default': if (!in_array($data, array('0', '1', 'true', 'false'))) { throw new \SwaggerGen\Exception("Invalid boolean default: '{$data}'"); } $this->default = $data == '1' || strtolower($data) === 'true'; return $this; } return parent::handleCommand($command, $data); }
public function handleCommand($command, $data = null) { switch (strtolower($command)) { case 'default': $this->default = $data; return $this; case 'pattern': $this->pattern = $data; return $this; case 'enum': $words = self::words_split($data); $this->enum = is_array($this->enum) ? array_merge($this->enum, $words) : $words; return $this; } return parent::handleCommand($command, $data); }
public function handleCommand($command, $data = null) { switch (strtolower($command)) { case 'default': $this->default = $this->validateDefault($data); return $this; case 'enum': $words = self::words_split($data); foreach ($words as &$word) { $word = $this->validateDefault($word); } $this->enum = array_merge($this->enum, $words); return $this; case 'step': if (($step = intval($data)) > 0) { $this->multipleOf = $step; } return $this; } return parent::handleCommand($command, $data); }
public function handleCommand($command, $data = null) { switch (strtolower($command)) { // type name description... case 'property': case 'property?': $definition = self::words_shift($data); $name = self::words_shift($data); $this->properties[$name] = new Property($this, $definition, $data); if (substr($command, -1) !== '?') { $this->required[] = $name; } return $this; case 'min': $this->minProperties = intval($data); return $this; case 'max': $this->maxProperties = intval($data); return $this; } return parent::handleCommand($command, $data); }