Esempio n. 1
0
 public function handleCommand($command, $data = null)
 {
     switch (strtolower($command)) {
         case 'method':
             // alias
         // alias
         case 'operation':
             $method = strtolower(self::words_shift($data));
             if (!in_array($method, self::$methods)) {
                 throw new \SwaggerGen\Exception("Unrecognized operation method '{$method}'.");
             }
             if (isset($this->operations[$method])) {
                 $Operation = $this->operations[$method];
             } else {
                 $summary = $data;
                 $Operation = new Operation($this, $summary, $this->tag);
                 $this->operations[$method] = $Operation;
             }
             return $Operation;
         case 'description':
             if ($this->tag) {
                 return $this->tag->handleCommand($command, $data);
             }
             break;
     }
     return parent::handleCommand($command, $data);
 }
Esempio n. 2
0
 public function handleCommand($command, $data = null)
 {
     // Pass through to Type
     if ($this->Type && $this->Type->handleCommand($command, $data)) {
         return $this;
     }
     return parent::handleCommand($command, $data);
 }
Esempio n. 3
0
 public function handleCommand($command, $data = null)
 {
     switch (strtolower($command)) {
         case 'description':
             $this->description = $data;
             return $this;
     }
     return parent::handleCommand($command, $data);
 }
 public function handleCommand($command, $data = null)
 {
     // Pass through to Type
     $return = $this->schema->handleCommand($command, $data);
     if ($return) {
         return $return;
     }
     return parent::handleCommand($command, $data);
 }
 /**
  * @param string $command
  * @param string $data
  * @return AbstractObject
  */
 public function handleCommand($command, $data = null)
 {
     switch (strtolower($command)) {
         case 'doc':
         case 'docs':
             $url = self::words_shift($data);
             $this->externalDocs = new ExternalDocumentation($this, $url, $data);
             return $this->externalDocs;
     }
     return parent::handleCommand($command, $data);
 }
Esempio n. 6
0
 public function handleCommand($command, $data = null)
 {
     switch (strtolower($command)) {
         case 'name':
         case 'url':
         case 'email':
             $this->{$command} = $data;
             return $this;
     }
     return parent::handleCommand($command, $data);
 }
Esempio n. 7
0
 public function handleCommand($command, $data = null)
 {
     switch (strtolower($command)) {
         case 'name':
             $this->name = $data;
             if (empty($this->url) && !empty(self::$licenses[strtolower($data)])) {
                 $this->url = self::$licenses[strtolower($data)];
             }
             return $this;
         case 'url':
             $this->url = $data;
             return $this;
     }
     return parent::handleCommand($command, $data);
 }
Esempio n. 8
0
 public function handleCommand($command, $data = null)
 {
     switch (strtolower($command)) {
         case 'title':
         case 'description':
         case 'termsofservice':
         case 'version':
             $this->{$command} = $data;
             return $this;
         case 'terms':
             // alias
         // alias
         case 'tos':
             // alias
             $this->termsofservice = $data;
             return $this;
         case 'contact':
             $name = array();
             $url = null;
             $email = null;
             foreach (self::words_split($data) as $word) {
                 if (filter_var($word, FILTER_VALIDATE_URL)) {
                     $url = $word;
                 } elseif (filter_var($word, FILTER_VALIDATE_EMAIL)) {
                     $email = $word;
                 } else {
                     $name[] = $word;
                 }
             }
             $name = join(' ', array_filter($name));
             $this->contact = new Contact($this, $name, $url, $email);
             return $this->contact;
         case 'license':
             $name = array();
             $url = null;
             foreach (self::words_split($data) as $word) {
                 if (filter_var($word, FILTER_VALIDATE_URL)) {
                     $url = $word;
                 } else {
                     $name[] = $word;
                 }
             }
             $name = join(' ', array_filter($name));
             $this->license = new License($this, $name, $url);
             return $this->license;
     }
     return parent::handleCommand($command, $data);
 }
 public function handleCommand($command, $data = null)
 {
     switch (strtolower($command)) {
         case 'description':
             $this->description = $data;
             return $this;
         case 'scope':
             if ($this->type !== 'oauth2') {
                 throw new \SwaggerGen\Exception("Cannot set scope on type '{$this->type}'");
             }
             $name = self::words_shift($data);
             $this->scopes[$name] = $data;
             return $this;
     }
     return parent::handleCommand($command, $data);
 }
Esempio n. 10
0
 public function handleCommand($command, $data = null)
 {
     switch (strtolower($command)) {
         case 'header':
             $type = self::words_shift($data);
             $name = self::words_shift($data);
             $Header = new Header($this, $type, $data);
             $this->Headers[$name] = $Header;
             return $Header;
     }
     return parent::handleCommand($command, $data);
 }