The second most important method.
Will create RESTful routes for MongoDB model.

@param string $className
@param array $settings
@return PromisesTrait|Resource
348660
public function resource($className, $settings = [])
    {
        /** @var \Hive\Resource $resource */
        $resource = $this->initPromises(Resource::create($className, $settings, $this));

        foreach ($resource->settings['actions'] as $action => $actionSettings) {
            $methodName = "setup$action";
            if (method_exists($this, $methodName)) {
                $this->{$methodName}($resource);
            }
        }

        return $resource;
    }
560970
public function loadRoutesFromClass($className, $hooks=[])
    {
        $cache = new CheckableCache($this->cache);

        $key = 'loadRoutesFromClass:' . md5(__CLASS__ . ':' . $className);
        $routes = $cache->get($key, $this);

        $controller = null;
        if ($routes == $this) { //not cached
            $routes = [];
            $controller = $this->controllerContainerBuilder->build($className);
            foreach ($controller->getRoutes() as $actionName => $route) {
                $routes[] = [$route->getMethod(), $route->getUri(), $actionName];
            }
            $cache->set($key, $routes, 0, new ClassModifiedChecker($className));
        }
        foreach ($routes as $route) {
            list($method, $uri, $actionName) = $route;
            $this->routes[] = [
                $method,
                $uri,
                function (Application $app, Request $request) use ($cache, $className, $actionName, $controller) {

                    $key = 'loadRoutesFromClass:route:' . md5(__CLASS__ . ':' . $className . ':' . $actionName);

                    $routeInstance = $cache->get($key, $this);
                    if ($routeInstance == $this) {
                        if (!$controller) {
                            $controller = $app->controllerContainerBuilder->build($className);
                        }
                        $routeInstance = $controller->getRoute($actionName) or
                        abort(new NotFoundHttpException("action $actionName not found"));
                        $cache->set($key, $routeInstance, 0, new ClassModifiedChecker($className));
                    }
                    return ControllerContainer::dispatch($this, $className, $actionName, $routeInstance, $request);
                },
                $hooks
            ];
        }
        $this->controllers[] = $className;
    }
156514
protected function createPath(string $pathName, \stdClass $definition, array $pathParameters = [])
    {
        /** @var Operation[] $operations */
        $operations = [];
        foreach (self::$methodNames as $method) {
            if (isset($definition->$method)) {
                $operations[$method] = $this->createOperation($definition->$method, $pathName, $method);
            }
        }
        $pathParameters = array_merge($pathParameters, $this->extractParameters($definition));

        return new Path($pathName, $operations, $pathParameters);
    }
1248846
private function addRoute($uri, $method, $callback, $settings)
    {
        $groupItem = count($this->groups) - 1;
        $group = '';
        if ($groupItem > -1) {
            foreach ($this->groups as $key => $value) {
                $group .= $value['route'];
            }
        }

        $page = dirname($_SERVER['PHP_SELF']);
        $page = $page === '/' ? '' : $page;
        if (strstr($page, 'index.php')) {
            $data = implode('/', explode('/', $page));
            $page = str_replace($data, '', $page);
        }

        $route = $page . $group . '/' . trim($uri, '/');
        $route = rtrim($route, '/');
        if ($route === $page) {
            $route .= '/';
        }

        $data = [
            'route' => str_replace('//', '/', $route),
            'method' => strtoupper($method),
            'callback' => $callback,
            'name' => (isset($settings['name'])
                ? $settings['name']
                : null
            ),
            'before' => (isset($settings['before'])
                ? $settings['before']
                : null
            ),
            'after' => (isset($settings['after'])
                ? $settings['after']
                : null
            ),
            'group' => ($groupItem === -1) ? null : $this->groups[$groupItem]
        ];
        array_push($this->routes, $data);
    }
413582
public function collection($classname, ...$args)
    {
        $resource = $this->resolve($classname);
        return $resource->collection(...$args);
    }
911715
protected static function getStaticInvoker(string $className, string $methodName): Closure
    {
        return function (array $args) use ($className, $methodName) {
            return forward_static_call_array([$className, $methodName], $args);
        };
    }
519274
public function get($className,array $options = array()) {
        $Param = $this->getServiceLocator()->get($className);
        if($this->isValidClass($Param)) {
            
            $Param->setName($options[0])
                ->setOperator($options[1])
                ->setValue($options[2])
                ->setServiceLocator($this->getServiceLocator());
            
            return $Param;
        }
        
    }
115346
public static function create($classname, $args = null, $filter = null, $override = null) {
		//obtain provider list for this class
		$profile = Profiler::getClassProfile($classname);
		$providers = $profile->providers;
		
		if (empty($providers)) {
			throw new \RuntimeException("Class $classname does not have any provider associated with it");
		}

		//create new container and register all providers
		$container = new Container();
		
		foreach ($providers as $provider) {
			$providerInstance = self::getProvider($provider);
			$providerInstance->register($container);
		}

		return self::createWith($classname, $container, $args, $filter, $override);
	}
1333847
private function createContainerFromString($settings)
    {
        if (0 === mb_strpos($settings, '@')) {
            return $this->loadContainerFromContainer(mb_substr($settings, 1));
        }

        return $this->createContainerFromClassSpec($settings);
    }
761410
public function getDatas($objects, &$classname = null) {
		$objects = \array_map ( function ($o) use (&$classname) {
			return $this->cleanRestObject ( $o, $classname );
		}, $objects );
		return \array_values ( $objects );
	}
906586
protected function loadPluginInstance($pluginClassName, array $settings) {
		$pluginClassName = '\\' . ltrim($pluginClassName, '\\');
		/** @var PluginInterface $plugin */
		$plugin = new $pluginClassName();
		$plugin->initialize($settings);
		return $plugin;
	}
1013777
protected function buildLevel($classname)
    {
        $parts = explode('.', $classname);
        
        $lastLevel = &$this->methods;
        foreach ($parts as $part) {
            $lastLevel[$part] = array();
            $lastLevel = &$lastLevel[$part];
        }
        
        return $lastLevel;
    }
294658
public function injectSettings(array $settings)
    {
        if (isset($settings['security']['authentication']['authenticationStrategy'])) {
            $authenticationStrategyName = $settings['security']['authentication']['authenticationStrategy'];
            switch ($authenticationStrategyName) {
                case 'allTokens':
                    $this->authenticationStrategy = self::AUTHENTICATE_ALL_TOKENS;
                    break;
                case 'oneToken':
                    $this->authenticationStrategy = self::AUTHENTICATE_ONE_TOKEN;
                    break;
                case 'atLeastOneToken':
                    $this->authenticationStrategy = self::AUTHENTICATE_AT_LEAST_ONE_TOKEN;
                    break;
                case 'anyToken':
                    $this->authenticationStrategy = self::AUTHENTICATE_ANY_TOKEN;
                    break;
                default:
                    throw new Exception('Invalid setting "' . $authenticationStrategyName . '" for security.authentication.authenticationStrategy', 1291043022);
            }
        }

        if (isset($settings['security']['csrf']['csrfStrategy'])) {
            $csrfStrategyName = $settings['security']['csrf']['csrfStrategy'];
            switch ($csrfStrategyName) {
                case 'onePerRequest':
                    $this->csrfProtectionStrategy = self::CSRF_ONE_PER_REQUEST;
                    break;
                case 'onePerSession':
                    $this->csrfProtectionStrategy = self::CSRF_ONE_PER_SESSION;
                    break;
                case 'onePerUri':
                    $this->csrfProtectionStrategy = self::CSRF_ONE_PER_URI;
                    break;
                default:
                    throw new Exception('Invalid setting "' . $csrfStrategyName . '" for security.csrf.csrfStrategy', 1291043024);
            }
        }
    }
338527
public function group($name, $settings = null, $callback = null)
    {
        if($this->cacheLoaded) {
            return true;
        }

        $groupName = trim($name, '/');
        $group = [];
        $group['route'] = '/' . $groupName;
        $group['before'] = $group['after'] = null;

        if (is_null($callback)) {
            $callback = $settings;
        } else {
            $group['before'][] = (!isset($settings['before']) ? null : $settings['before']);
            $group['after'][]  = (!isset($settings['after']) ? null : $settings['after']);
        }

        $groupCount = count($this->groups);
        if ($groupCount > 0) {
            $list = [];
            foreach ($this->groups as $key => $value) {
                if (is_array($value['before'])) {
                    foreach ($value['before'] as $k => $v) {
                        $list['before'][] = $v;
                    }
                    foreach ($value['after'] as $k => $v) {
                        $list['after'][] = $v;
                    }
                }
            }

            if (! is_null($group['before'])) {
                $list['before'][] = $group['before'][0];
            }

            if (! is_null($group['after'])) {
                $list['after'][] = $group['after'][0];
            }

            $group['before'] = $list['before'];
            $group['after'] = $list['after'];
        }

        $group['before'] = array_values(array_unique( (array) $group['before']));
        $group['after'] = array_values(array_unique( (array) $group['after']));

        array_push($this->groups, $group);

        if (is_object($callback)) {
            call_user_func_array($callback, [$this]);
        }

        $this->endGroup();

        return true;
    }
53954
public function write($settings) : ?Model
    {
        if (!$this->enabled) {
            return null;
        }

        $settings = $this->parseSettings($settings);

        return Tracker::createNew($this->getPayload($settings));
    }
1145105
public static MongoClient create(final PippoSettings settings) {
        String host = settings.getString(HOST, "mongodb://localhost:27017");
        return create(host);
    }
175140
public function createCollection($collectionName, array $options = [])
    {
        $this->document = $this->db->getQueryBuilder()->createCollection($collectionName, $options);

        $result = current($this->execute()->toArray());
        return $result['ok'] > 0;
    }