本文整理汇总了PHP中Info::handleCommand方法的典型用法代码示例。如果您正苦于以下问题:PHP Info::handleCommand方法的具体用法?PHP Info::handleCommand怎么用?PHP Info::handleCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Info
的用法示例。
在下文中一共展示了Info::handleCommand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleCommand
public function handleCommand($command, $data = null)
{
switch (strtolower($command)) {
// Info.string
case 'title':
case 'description':
case 'version':
case 'terms':
// alias
// alias
case 'tos':
// alias
// alias
case 'termsofservice':
case 'contact':
case 'license':
return $this->Info->handleCommand($command, $data);
// string[]
// string[]
case 'scheme':
case 'schemes':
$this->{$command} = array_unique(array_merge($this->{$command}, self::words_split($data)));
return $this;
// MIME[]
// MIME[]
case 'consume':
case 'consumes':
case 'produce':
case 'produces':
$this->{$command} = array_merge($this->{$command}, self::translateMimeTypes(self::words_split($data)));
return $this;
case 'model':
// alias
$data = 'params ' . $data;
case 'define':
case 'definition':
$type = self::words_shift($data);
switch ($type) {
case 'response':
// $definition = new SwaggerResponseDefinition($this);
// break;
// $definition = new SwaggerResponseDefinition($this);
// break;
case 'params':
case 'parameters':
// alias
$definition = new Schema($this);
break;
default:
throw new \SwaggerGen\Exception('Unsupported definition type: ' . $type);
}
$this->definitions[self::words_shift($data)] = $definition;
return $definition;
case 'api':
// alias
// alias
case 'tag':
$tagname = self::words_shift($data);
$Tag = null;
foreach ($this->Tags as $T) {
if ($T->getName() === $tagname) {
$Tag = $T;
break;
}
}
if (!$Tag) {
$Tag = new Tag($this, $tagname, $data);
$this->Tags[] = $Tag;
}
// @todo remove this; it's for backwards compatibility only
if ($command === 'api') {
// backwards compatibility
$this->defaultTag = $Tag;
}
return $Tag;
case 'endpoint':
$path = self::words_shift($data);
if ($path[0] !== '/') {
$path = '/' . $path;
}
$Tag = null;
if (($tagname = self::words_shift($data)) !== false) {
foreach ($this->Tags as $T) {
if (strtolower($T->getName()) === strtolower($tagname)) {
$Tag = $T;
break;
}
}
if (!$Tag) {
$Tag = new Tag($this, $tagname, $data);
$this->Tags[] = $Tag;
}
}
if (!isset($this->Paths[$path])) {
$this->Paths[$path] = new Path($this, $Tag ?: $this->defaultTag);
}
return $this->Paths[$path];
case 'security':
$name = self::words_shift($data);
$type = self::words_shift($data);
//.........这里部分代码省略.........