original_string: private function getAnnotations($class)
      {
          $parsed = $this->getParser()->parse($class);
          if (!is_array($parsed)) {
              return [];
          }
          $context = [
              'class' => $class,
              'declaringClass' => $class,
              'type' => Context::TYPE_CLASS,
              'name' => $class
          ];
          $annotations = [];
          if (!empty($parsed['class'])) {
              foreach ($parsed['class'] as $value) {
                  $anno = $this->create($value, $context);
                  if ($anno) {
                      $annotations[] = $anno;
                  }
              }
          }
          $map = [
              'methods' => Context::TYPE_METHOD,
              'properties' => Context::TYPE_PROPERTY
          ];
          $reflection = new \ReflectionClass($class);
          foreach ($map as $type_name => $type) {
              if (!empty($parsed[$type_name])) {
                  foreach ($parsed[$type_name] as $name => $values) {
                      $reflType = $type == 'method' ? $reflection->getMethod($name)
                                 : $reflection->getProperty($name);
                      $context['type'] = $type;
                      $context['name'] = $name;
                      $context['declaringClass'] = $reflType->getDeclaringClass()->getName();
                      foreach ($values as $value) {
                          $anno = $this->create($value, $context);
                          if ($anno) {
                              $annotations[] = $anno;
                          }
                      }
                  }
              }
          }
          return $annotations;
      }
code: private function getAnnotations($class)
      {
          $parsed = $this->getParser()->parse($class);
          if (!is_array($parsed)) {
              return [];
          }
          $context = [
              'class' => $class,
              'declaringClass' => $class,
              'type' => Context::TYPE_CLASS,
              'name' => $class
          ];
          $annotations = [];
          if (!empty($parsed['class'])) {
              foreach ($parsed['class'] as $value) {
                  $anno = $this->create($value, $context);
                  if ($anno) {
                      $annotations[] = $anno;
                  }
              }
          }
          $map = [
              'methods' => Context::TYPE_METHOD,
              'properties' => Context::TYPE_PROPERTY
          ];
          $reflection = new \ReflectionClass($class);
          foreach ($map as $type_name => $type) {
              if (!empty($parsed[$type_name])) {
                  foreach ($parsed[$type_name] as $name => $values) {
                      $reflType = $type == 'method' ? $reflection->getMethod($name)
                                 : $reflection->getProperty($name);
                      $context['type'] = $type;
                      $context['name'] = $name;
                      $context['declaringClass'] = $reflType->getDeclaringClass()->getName();
                      foreach ($values as $value) {
                          $anno = $this->create($value, $context);
                          if ($anno) {
                              $annotations[] = $anno;
                          }
                      }
                  }
              }
          }
          return $annotations;
      }
code_tokens: private function getAnnotations ( $ class ) { $ parsed = $ this -> getParser ( ) -> parse ( $ class ) ; if ( ! is_array ( $ parsed ) ) { return [ ] ; } $ context = [ 'class' => $ class , 'declaringClass' => $ class , 'type' => Context :: TYPE_CLASS , 'name' => $ class ] ; $ annotations = [ ] ; if ( ! empty ( $ parsed [ 'class' ] ) ) { foreach ( $ parsed [ 'class' ] as $ value ) { $ anno = $ this -> create ( $ value , $ context ) ; if ( $ anno ) { $ annotations [ ] = $ anno ; } } } $ map = [ 'methods' => Context :: TYPE_METHOD , 'properties' => Context :: TYPE_PROPERTY ] ; $ reflection = new \ ReflectionClass ( $ class ) ; foreach ( $ map as $ type_name => $ type ) { if ( ! empty ( $ parsed [ $ type_name ] ) ) { foreach ( $ parsed [ $ type_name ] as $ name => $ values ) { $ reflType = $ type == 'method' ? $ reflection -> getMethod ( $ name ) : $ reflection -> getProperty ( $ name ) ; $ context [ 'type' ] = $ type ; $ context [ 'name' ] = $ name ; $ context [ 'declaringClass' ] = $ reflType -> getDeclaringClass ( ) -> getName ( ) ; foreach ( $ values as $ value ) { $ anno = $ this -> create ( $ value , $ context ) ; if ( $ anno ) { $ annotations [ ] = $ anno ; } } } } } return $ annotations ; }
docstring: parse all annotations from class
docstring_tokens: parse all annotations from class