/**
  * todo: docs
  *
  * @param Parser $parser
  *
  * @endpoint ignore
  * @return array
  */
 public function getDocJSON(Parser $parser)
 {
     $doc = parent::getDocJSON($parser);
     $rClass = new \ReflectionClass(get_called_class());
     foreach ($doc['methods'] as $k => $methodDoc) {
         if ($methodDoc['InternalMethodName'] == 'get') {
             $doc['methods'][$k]['MethodName'] = 'Get Full Collection';
         } elseif ($methodDoc['InternalMethodName'] == 'post') {
             $doc['methods'][$k]['MethodName'] = 'Add to Collection';
         } elseif ($methodDoc['InternalMethodName'] == 'put') {
             $doc['methods'][$k]['MethodName'] = 'Replace Full Collection';
         } elseif ($methodDoc['InternalMethodName'] == 'delete') {
             $doc['methods'][$k]['MethodName'] = 'Delete Full Collection';
         }
     }
     $methodDoc = $this->getRestMethodDocJSON($parser, 'Get Resource', 'GET', "/{$this->base}/:id", $rClass, '_restGetResource');
     if (!empty($methodDoc)) {
         $doc['methods'][] = $methodDoc;
     }
     $methodDoc = $this->getRestMethodDocJSON($parser, 'Update Resource', 'PUT', "/{$this->base}/:id", $rClass, '_restPutResource');
     if (!empty($methodDoc)) {
         $doc['methods'][] = $methodDoc;
     }
     $methodDoc = $this->getRestMethodDocJSON($parser, 'Delete Resource', 'DELETE', "/{$this->base}/:id", $rClass, '_restDeleteResource');
     if (!empty($methodDoc)) {
         $doc['methods'][] = $methodDoc;
     }
     // Add documentation for custom rest actions
     $rMethods = $rClass->getMethods(\ReflectionMethod::IS_PUBLIC);
     foreach ($rMethods as $rMethod) {
         $docComment = $rMethod->getDocComment();
         // If there is a '@endpoint ignore' property, the function is not served as an endpoint
         if (in_array('ignore', ReflectionHelper::getDocDirective($docComment, 'endpoint'))) {
             continue;
         }
         $methodDoc = array();
         $methodDoc['InternalMethodName'] = $rMethod->name;
         if (strpos($rMethod->name, 'restGet', 0) === 0) {
             $methodDoc['MethodName'] = substr($rMethod->name, 7);
             $methodDoc['HTTPMethod'] = 'GET';
         } elseif (strpos($rMethod->name, 'restPut', 0) === 0) {
             $methodDoc['MethodName'] = substr($rMethod->name, 7);
             $methodDoc['HTTPMethod'] = 'PUT';
         } elseif (strpos($rMethod->name, 'restPost', 0) === 0) {
             $methodDoc['MethodName'] = substr($rMethod->name, 8);
             $methodDoc['HTTPMethod'] = 'POST';
         } elseif (strpos($rMethod->name, 'restDelete', 0) === 0) {
             $methodDoc['MethodName'] = substr($rMethod->name, 10);
             $methodDoc['HTTPMethod'] = 'DELETE';
         } else {
             continue;
         }
         $action = strtolower($methodDoc['MethodName']);
         $methodDoc['URI'] = "/{$this->base}/:id/{$action}";
         $methodDoc['Synopsis'] = $parser->parse(ReflectionHelper::getDocText($docComment));
         $methodDoc['parameters'][] = array('Name' => 'id', 'Required' => 'Y', 'Type' => 'string', 'Location' => 'url', 'Description' => 'The id of the resource');
         $methodDoc['parameters'] = array_merge($methodDoc['parameters'], $this->getDocParameters($rMethod));
         // Allow controller middlewares to modify the documentation for this method
         if (!empty($this->middlewares)) {
             $middleware = reset($this->middlewares);
             $middleware->documentMethod($rClass, $rMethod, $methodDoc);
         }
         if (!empty($methodDoc)) {
             $doc['methods'][] = $methodDoc;
         }
     }
     return $doc;
 }