Locate every class, interface, trait or function definition.
17257
protected function locateDeclarations()
    {
        foreach ($this->getTokens() as $tokenID => $token) {
            if (!in_array($token[self::TOKEN_TYPE], self::$processTokens)) {
                continue;
            }

            switch ($token[self::TOKEN_TYPE]) {
                case T_NAMESPACE:
                    $this->registerNamespace($tokenID);
                    break;

                case T_USE:
                    $this->registerUse($tokenID);
                    break;

                case T_FUNCTION:
                    $this->registerFunction($tokenID);
                    break;

                case T_CLASS:
                case T_TRAIT:
                case T_INTERFACE:
                    if ($this->isClassNameConst($tokenID)) {
                        //PHP5.5 ClassName::class constant
                        continue 2;
                    }

                    $this->registerDeclaration($tokenID, $token[self::TOKEN_TYPE]);
                    break;

                case T_INCLUDE:
                case T_INCLUDE_ONCE:
                case T_REQUIRE:
                case T_REQUIRE_ONCE:
                    $this->hasIncludes = true;
            }
        }

        //Dropping empty namespace
        if (isset($this->namespaces[''])) {
            $this->namespaces['\\'] = $this->namespaces[''];
            unset($this->namespaces['']);
        }
    }
340769
private static Class<?>[] getParamTypes(Context context, Object... arguments)
    {
        final Collection<Object> params = new ArrayList<>();
        params.add(context);
        params.addAll(Arrays.asList(arguments));
        return UtilReflection.getParamTypes(params.toArray());
    }
954287
def find_or_build_all(cls, list_of_kwargs):
        
        return cls.add_all([cls.first(**kwargs) or cls.new(**kwargs)
                            for kwargs in list_of_kwargs], commit=False)
601248
def _find_global(self, module, func):
        """"""
        if module == __name__:
            if func == '_unpickle_call_error' or func == 'CallError':
                return _unpickle_call_error
            elif func == '_unpickle_sender':
                return self._unpickle_sender
            elif func == '_unpickle_context':
                return self._unpickle_context
            elif func == 'Blob':
                return Blob
            elif func == 'Secret':
                return Secret
            elif func == 'Kwargs':
                return Kwargs
        elif module == '_codecs' and func == 'encode':
            return self._unpickle_bytes
        elif module == '__builtin__' and func == 'bytes':
            return BytesType
        raise StreamError('cannot unpickle %r/%r', module, func)
1362868
def get_all_classes(module_name):
    """"""
    module = importlib.import_module(module_name)
    return getmembers(module, lambda m: isclass(m) and not isabstract(m))
1125680
private void findReferenced(ClassDocImpl containingClass) {
        if (where.length() > 0) {
            if (containingClass != null) {
                referencedClass = containingClass.findClass(where);
            } else {
                referencedClass = docenv().lookupClass(where);
            }
            if (referencedClass == null && holder() instanceof ProgramElementDoc) {
                referencedClass = docenv().lookupClass(
                    ((ProgramElementDoc) holder()).containingPackage().name() + "." + where);
            }

            if (referencedClass == null) { /* may just not be in this run */
                // check if it's a package name
                referencedPackage = docenv().lookupPackage(where);
                return;
            }
        } else {
            if (containingClass == null) {
                docenv().warning(holder,
                                 "tag.see.class_not_specified",
                                 name, text);
                return;
            } else {
                referencedClass = containingClass;
            }
        }
        where = referencedClass.qualifiedName();

        if (what == null) {
            return;
        } else {
            int paren = what.indexOf('(');
            String memName = (paren >= 0 ? what.substring(0, paren) : what);
            String[] paramarr;
            if (paren > 0) {
                // has parameter list -- should be method or constructor
                paramarr = new ParameterParseMachine(what.
                        substring(paren, what.length())).parseParameters();
                if (paramarr != null) {
                    referencedMember = findExecutableMember(memName, paramarr,
                                                            referencedClass);
                } else {
                    referencedMember = null;
                }
            } else {
                // no parameter list -- should be field
                referencedMember = findExecutableMember(memName, null,
                                                        referencedClass);
                FieldDoc fd = ((ClassDocImpl)referencedClass).
                                                            findField(memName);
                // when no args given, prefer fields over methods
                if (referencedMember == null ||
                    (fd != null &&
                     fd.containingClass()
                         .subclassOf(referencedMember.containingClass()))) {
                    referencedMember = fd;
                }
            }
            if (referencedMember == null) {
                docenv().warning(holder,
                                 "tag.see.can_not_find_member",
                                 name, what, where);
            }
        }
    }
67497
def __findout_decl_type(match_class, **keywds):
        """"""
        if 'decl_type' in keywds:
            return keywds['decl_type']

        matcher_args = keywds.copy()
        del matcher_args['function']
        del matcher_args['recursive']
        if 'allow_empty' in matcher_args:
            del matcher_args['allow_empty']

        decl_matcher = match_class(**matcher_args)
        if decl_matcher.decl_type:
            return decl_matcher.decl_type
        return None
741328
public function find(): self
    {
        $preparedPaths = \array_unique(
            \array_merge(
                $this->getPreparedPaths((array) $this->paths['psr0']),
                $this->getPreparedPaths((array) $this->paths['psr4']),
                $this->getPreparedPaths((array) $this->paths['classmap'])
            ),
            \SORT_STRING
        );

        $finder = Finder::create()
            ->files()
            ->in($preparedPaths)
            ->exclude($this->excludes)
            ->name('*.php')
            ->sortByName();

        if ($this->filter !== null) {
            $finder->filter($this->filter);
        }

        /** @var \SplFileInfo $file */
        foreach ($finder as $file) {
            $realPath  = (string) $file->getRealPath();

            $namespace = null;
            $tokens    = \token_get_all((string) \file_get_contents($realPath));

            foreach ($tokens as $key => $token) {
                if (\is_array($token)) {
                    if ($token[0] === \T_NAMESPACE) {
                        $namespace = self::getNamespace($key + 2, $tokens);
                    } elseif ($token[0] === \T_INTERFACE) {
                        $name = self::getName($key + 2, $tokens);

                        if ($name === null) {
                            continue 2;
                        }

                        $this->interfaces[\ltrim($namespace . '\\' . $name, '\\')] = $realPath;
                    } elseif ($token[0] === \T_TRAIT) {
                        $name = self::getName($key + 2, $tokens);

                        if ($name === null) {
                            continue 2;
                        }

                        $this->traits[\ltrim($namespace . '\\' . $name, '\\')] = $realPath;
                    } elseif ($token[0] === \T_ABSTRACT) {
                        $name = self::getName($key + 4, $tokens);

                        if ($name === null) {
                            continue 2;
                        }

                        $this->abstractClasses[\ltrim($namespace . '\\' . $name, '\\')] = $realPath;

                        continue 2;
                    } elseif ($token[0] === \T_CLASS) {
                        $name = self::getName($key + 2, $tokens);

                        if ($name === null) {
                            continue 2;
                        }

                        $this->classes[\ltrim($namespace . '\\' . $name, '\\')] = $realPath;
                    }
                }
            }

            unset($tokens);
            // PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
            \gc_mem_caches();
        }

        return $this;
    }
1818
@VisibleForTesting
    public static List<IStruct> getAllTraits(IReferenceableInstance entityDefinition,
                                              TypeSystem typeSystem) throws AtlasException {
        List<IStruct> traitInfo = new LinkedList<>();
        for (String traitName : entityDefinition.getTraits()) {
            IStruct trait = entityDefinition.getTrait(traitName);
            String typeName = trait.getTypeName();
            Map<String, Object> valuesMap = trait.getValuesMap();
            traitInfo.add(new Struct(typeName, valuesMap));
            traitInfo.addAll(getSuperTraits(typeName, valuesMap, typeSystem));
        }
        return traitInfo;
    }
27519
def implementations(interface, recurse=True, abstract=False):
    """"""
    result = []
    find_implementations(interface, recurse, abstract, result)
    return result
767185
private ZooClassDef locateClassDefinition(Class<?> cls, Node node) {
		ZooClassDef def = cache.getSchema(cls, node);
		if (def == null || def.jdoZooIsDeleted()) {
			return null;
		}
		return def;
	}
11970
private static Map<Method, EventType> findMethods(Class<?> type) {
    Map<Method, EventType> events = new HashMap<>();
    for (Method method : type.getDeclaredMethods()) {
      Event event = method.getAnnotation(Event.class);
      if (event != null) {
        String name = event.value().equals("") ? method.getName() : event.value();
        events.put(method, EventType.from(name));
      }
    }
    for (Class<?> iface : type.getInterfaces()) {
      events.putAll(findMethods(iface));
    }
    return events;
  }
813545
def typedefs(
            self,
            name=None,
            function=None,
            header_dir=None,
            header_file=None,
            recursive=None,
            allow_empty=None):
        """"""
        return (
            self._find_multiple(
                self._impl_matchers[scopedef_t.typedef],
                name=name,
                function=function,
                decl_type=self._impl_decl_types[
                    scopedef_t.typedef],
                header_dir=header_dir,
                header_file=header_file,
                recursive=recursive,
                allow_empty=allow_empty)
        )
414406
def get_object_members(self, want_all):
        """"""
        check, members = super().get_object_members(want_all)
        get_traits = self.object.class_own_traits if self.options.inherited_members \
                     else self.object.class_traits
        trait_members = []
        for name, trait in sorted(get_traits(config=True).items()):
            # put help in __doc__ where autodoc will look for it
            trait.__doc__ = trait.help
            trait_members.append((name, trait))
        return check, trait_members + members
129947
def all_methods(cls):
        
        def name(fn):
            return fn.__get__(cls).__name__.replace("_", "-")
        return sorted(name(f) for f in cls.__dict__.values()
                      if isinstance(f, staticmethod))
1179195
def get_all_methods(entry_point=ALL, protocol=ALL, sort_methods=False):
    """"""
    return registry.get_all_methods(entry_point=entry_point, protocol=protocol, sort_methods=sort_methods)
1280829
private static <T> List<Method> getMethods(Class<T> type, String... names) {

		Assert.notNull(type, "Missing class to search for methods!");
		Assert.notNullOrEmpty(names, "Missing method names to search for!");

		Map<String, Method> candidates = new HashMap<>();
		for (Method method : type.getMethods()) {

			if (Modifier.isStatic(method.getModifiers()) &&
			    method.getReturnType().equals(type) &&
			    method.getParameterTypes().length == 1 &&
			    method.getParameterTypes()[0].isAssignableFrom(String.class)) {

				candidates.put(method.getName(), method);
			}
		}

		List<Method> output = new ArrayList<>();

		// go in order desired
		for (String name : names) {
			if (candidates.containsKey(name)) {
				output.add(candidates.get(name));
			}
		}

		return output;
	}