@param $type
@param $id
@param $level

@return mixed
431966
public function render($type, $id, $level)
    {
        return $this->providers[$type]->getHtml($id, $level);
    }
399165
public static function get_courseid_from_type_id($type, $id) {
        global $DB;
        if ($type == backup::TYPE_1COURSE) {
            return $id; // id is the course id

        } else if ($type == backup::TYPE_1SECTION) {
            if (! $courseid = $DB->get_field('course_sections', 'course', array('id' => $id))) {
                throw new backup_dbops_exception('course_not_found_for_section', $id);
            }
            return $courseid;
        } else if ($type == backup::TYPE_1ACTIVITY) {
            if (! $courseid = $DB->get_field('course_modules', 'course', array('id' => $id))) {
                throw new backup_dbops_exception('course_not_found_for_moduleid', $id);
            }
            return $courseid;
        }
    }
1360623
public function delete($_type = null, $id = null)
    {
        // setting up an event for the delete
        $_event = new Event('Controller.PostTypes.beforeDelete.' . $this->_type, $this, [
            'id' => $id,
        ]);
        $this->eventManager()->dispatch($_event);

        $postType = $this->Model->get($id);
        
        $this->request->allowMethod(['post', 'delete']);
        
        if ($this->Model->delete($postType)) {
            // setting up an event for the delete
            $_event = new Event('Controller.PostTypes.afterDelete.' . $this->_type, $this, [
                'id' => $id,
            ]);
            $this->eventManager()->dispatch($_event);
            
            $this->Flash->success(__('The {0} has been deleted.', [$this->Settings['type']]));
            
            return $this->redirect(['action' => 'index', 'type' => $this->_type]);
        } else {
            $this->Flash->error(__('The {0} could not be deleted. Please, try again.', [$this->Settings['type']]));
            return $this->redirect(['action' => 'index', 'type' => $this->_type]);
        }
    }
548035
public function log($data, $level = self::LEVEL_INFO, $type = null)
    {
        if (!is_string($data)) {
            $data = print_r($data, true);
        }

        file_put_contents(
            $this->getLogDirectory() . '/' . $this->getLogFilename(),
            $this->getLogMessage($data, $level, $type),
            FILE_APPEND
        );
    }
53588
public function actionIndex($id, $type = 'users')
    {
        $model = $this->findModel($id);
        if (!isset($this->attentionClassMaps[$type])) {
            throw new NotFoundHttpException(Yii::t('yii', 'The requested page does not exist.'));
        }

        $dataProvider = new ActiveDataProvider([
            'query' => $model->getAttentions()->andWhere(['model' => $this->attentionClassMaps[$type]])->orderBy(['created_at' => SORT_DESC]),
        ]);
        return $this->render('index', [
            'model' => $model,
            'type' => $type,
            'dataProvider' => $dataProvider
        ]);
    }
1243481
public static function get($type, $id = null)
    {
        if (!is_null($id) && isset(self::$modelMap[$type][$id]))
            return action(self::$modelMap[$type][$id]);
        elseif (isset(self::$typeMap[$type]))
            return action(self::$typeMap[$type]);

        return null;
    }
989069
protected function buildTemplateIdentifier($id, $type = self::TEMPLATE_IDENTIFIER_FORM)
    {
        $type = strtoupper($type);

        return self::TEMPLATE_BRACKETS_OPEN.
            self::TEMPLATE_PREFIX.
            $type.
            '-'.
            $id.
            self::TEMPLATE_BRACKETS_CLOSE;
    }
978792
public function createHandler(string $id, string $type, int $level, array $config): HandlerInterface
    {
        if (!isset($this->_handlers[$id])) {
            $config = array_replace(
                [
                    'processorIds'          => []
                ],
                $config
            );

            if (!is_array($config['processorIds'])) {
                throw InvalidConfigException::create('processorIds', 'array');
            }

            /** @var HandlerInterface $handler */
            $handler = null;

            switch ($type) {
                case self::HANDLER_TYPE_STREAM:
                    $config = array_replace(
                        [
                            'bubble'            => true,
                            'filePermission'    => null,
                            'useLocking'        => false
                        ],
                        $config
                    );

                    if (!isset($config['stream']) || !is_string($config['stream'])) {
                        throw InvalidConfigException::create('stream', 'string');
                    }

                    $handler = new StreamHandler(
                        $config['stream'],
                        $level,
                        $config['bubble'],
                        $config['filePermission'],
                        $config['useLocking']
                    );

                    $this->setHandler($id, $handler);

                    break;
                case self::HANDLER_TYPE_ERROR_LOG:
                    $config = array_replace(
                        [
                            'messageType'       => ErrorLogHandler::OPERATING_SYSTEM,
                            'bubble'            => true,
                            'expandNewLines'    => false
                        ],
                        $config
                    );
                    $handler = new ErrorLogHandler(
                        $config['messageType'],
                        $level,
                        $config['bubble'],
                        $config['expandNewLines']
                    );

                    $this->setHandler($id, $handler);

                    break;
                case self::HANDLER_TYPE_NULL:
                    $handler = new NullHandler($level);

                    $this->setHandler($id, $handler);

                    break;
                default:
                    throw new \InvalidArgumentException(
                        'Type "'.$type.'" is not handled yet by this component. You can set manually the handler '.
                        'instance using the "setHandler" method.'
                    );
            }

            if ($config['processorIds']) {
                foreach ($config['processorIds'] as $processorId) {
                    if (!isset($this->_processors[$processorId])) {
                        throw InvalidConfigException::create(
                            'processorIds',
                            'array',
                            'Additionally, processor ID "'.$processorId.'" does not exist.'
                        );
                    }

                    $handler->pushProcessor($this->_processors[$processorId]);
                }
            }

            $this->_handlers[$id] = $handler;
        }

        return $this->_handlers[$id];
    }
485862
private static function DaftObjectIdPropertiesFromType(string $type, $id) : array
    {
        /**
        * @var array<int, string>
        */
        $idProps = array_values($type::DaftObjectIdProperties());

        if (is_scalar($id) && 1 === count($idProps)) {
            $id = [$id];
        }

        /**
        * @var array<string, mixed>
        */
        $idkv = [];

        if (is_array($id)) {
            foreach ($idProps as $i => $prop) {
                /**
                * @var scalar|array|object|null
                */
                $propVal = $id[$i] ?? null;

                $idkv[$prop] = $propVal;
            }
        }

        return $idkv;
    }
500141
public function loadTypeData($typeId, $status)
    {
        $q = $this->getLoadTypeQueryBuilder();
        $q
            ->where($q->expr()->eq('c.id', ':id'))
            ->andWhere($q->expr()->eq('c.version', ':version'))
            ->setParameter('id', $typeId, ParameterType::INTEGER)
            ->setParameter('version', $status, ParameterType::INTEGER);

        return $q->execute()->fetchAll();
    }
137946
private function getRowLevel(string $id, int $lvl = 0)
    {
        reset($this->child_ids);

        foreach ($this->child_ids as $pid => $data) {
            if (!\in_array($id, $data['children'], true)) {
                continue;
            }
            if (!$pid) {
                return $lvl;
            }
            $lvl += $this->getRowLevel((string)$pid, $lvl++);
            break;
        }

        if ($lvl > $this->_max_level) {
            $this->_max_level = $lvl;
        }

        return $lvl;
    }
532816
public function limit($id, $type, $value) {
		$params = array(
			'id' => $id,
			'type' => $type,
			'value' => $value
		);
		return $this->master->call('subaccounts/limit', $params);
	}
1332399
public function options(string $id_option = null, string $type = 'page'): ?array
  {
    if (
      ($id_option = $this->_get_id_option($id_option, $type)) &&
      ($os = $this->opt->options(\func_get_args()))
    ){
      $res = [];
      foreach ( $os as $o ){
        if ( $this->pref->has($o['id']) ){
          $res[] = $o;
        }
      }
      return $res;
    }
    return null;
  }
490720
public function getMessage($type, $id = null)
    {
        $result = null;
        if (null === $id) {
            if (array_key_exists($type, $this->messages)) {
                $result = $this->messages[$type];

                if (!$this->persistMessages) {
                    unset($this->messages[$type]);
                }
            }
        }

        if (null !== $id) {
            if (array_key_exists($type, $this->messages)) {
                if (array_key_exists($id, $this->messages[$type])) {
                    $result = $this->messages[$type][$id];
                    if (!$this->persistMessages) {
                        unset($this->messages[$type][$id]);
                    }
                }
            }
        }

        return $result;
    }
383913
private function partial($id, $indent, $level)
    {
        if ($indent !== '') {
            $indentParam = sprintf(self::PARTIAL_INDENT, var_export($indent, true));
        } else {
            $indentParam = '';
        }

        return sprintf(
            $this->prepare(self::PARTIAL, $level),
            var_export($id, true),
            $indentParam
        );
    }
259114
public function get($index, $type, $id, $options = [])
    {
        return $this->db->get([$index, $type, $id], $options);
    }
508748
public function define($id, $type)
    {
        $id = (string) $id;

        $this->validateName($id);

        if ($type[0] == ':') {
            $expectedType = substr($type, 1);
            $allowedTypes = (array) $this->getAllowedTypes();
            if (!in_array($expectedType, $allowedTypes)) {
                throw new InvalidArgumentException(sprintf('Cannot use type %s to define item "%s" in %s container. Allowed types are: %s.',
                    $expectedType, $id, $this->name, join(', ', $allowedTypes)));
            }
        } else {
            if (!class_exists($type)) {
                throw new InvalidArgumentException(sprintf('Cannot use non-existing class %s as type to define item "%s" in %s container.',
                    $type, $id, $this->name));
            }
        }

        $this->typemap[$id] = $type;
    }