Clear profile.

Resets profile and removes all collected data so it can:
- be started again
- will not be logged at profiler destruction

@param bool $clearContext [optional] Clear context as well?

@return $this
431560
public function clear($clearContext = false)
    {
        // Clear all stopwatch related values
        $this->start = null;
        $this->stop  = null;
        $this->laps  = [];

        if ($clearContext) {
            $this->context = null;
        }

        return $this;
    }
649070
public function clear()
    {
        $this->models = [];
        $this->modelKeyMap = [];
        $this->added = [];
        $this->removed = $this->original;
        return $this;
    }
330409
public static function delete_data_for_all_users_in_context(\context $context) {
        global $DB;

        if (!($context instanceof \context_course || $context instanceof \context_module)) {
            return;
        }

        $enrolltitools = $DB->get_fieldset_select('enrol_lti_tools', 'id', 'contextid = :contextid',
            ['contextid' => $context->id]);
        if (!empty($enrolltitools)) {
            list($sql, $params) = $DB->get_in_or_equal($enrolltitools, SQL_PARAMS_NAMED);
            $DB->delete_records_select('enrol_lti_users', 'toolid ' . $sql, $params);
        }
    }
519608
public function setProfile($profile)
	{
		$this->_profile = $profile;

		// Set the parser configs.
		$this->setConfig($this->getProfileConfig('parser'));
        $this->reset($this->_string, true);
        $this->defaults();

        return $this;
	}
216394
public function resetProfileAction()
    {
        $this->denyAccessUnlessGranted('ROLE_SUPER_ADMIN');

        $em = $this->getDoctrine()->getManager();
        $em->getRepository('KunstmaanDashboardBundle:AnalyticsConfig')->resetProfileId();

        return $this->redirect($this->generateUrl('KunstmaanDashboardBundle_ProfileSelection'));
    }
26180
public static function delete_data_for_all_users_in_context(\context $context) {
        global $DB;

        if (!$context instanceof \context_module) {
            return;
        }

        if ($cm = get_coursemodule_from_id('choice', $context->instanceid)) {
            $DB->delete_records('choice_answers', ['choiceid' => $cm->instance]);
        }
    }
37237
public function clear () {
        $this->_data = null;
        $this->_count = null;
        $this->getConnection ()->getClient ()->delete ($this->name);
        return $this;
    }
1145764
public static function delete_data_for_all_users_in_context(\context $context) {
        global $DB;

        // Sanity check that context is at the User context level, then get the userid.
        if ($context->contextlevel !== CONTEXT_USER) {
            return;
        }
        $userid = $context->instanceid;

        // Delete the repository_instances records created for the userid.
        $DB->delete_records('repository_instances', ['userid' => $userid]);
    }
41868
public static function reset($profile = null)
    {
        $profile = $profile ?: self::$profile;

        $profile = strtolower(StringNormalise::toDashSeparated($profile));

        if (isset(self::$instances[$profile])) {
            unset(self::$instances[$profile]);
        }
    }
1199685
public function clear()
    {
        $this->clearCountryCode();
        $this->clearNationalNumber();
        $this->clearExtension();
        $this->clearItalianLeadingZero();
        $this->clearNumberOfLeadingZeros();
        $this->clearRawInput();
        $this->clearCountryCodeSource();
        $this->clearPreferredDomesticCarrierCode();
        return $this;
    }
12098
public function clear($group = null) {
        if( isset($group) )
            unset($this->settings[$group]);
        else
            $this->settings = [];

        return $this;
    }
17730
public function init(ServerContextInterface $serverContext)
    {

        // initialize the server context
        $this->serverContext = $serverContext;

        // initialize the profile logger
        if ($serverContext->hasLogger(LoggerUtils::PROFILE)) {
            $this->profileLogger = $serverContext->getLogger(LoggerUtils::PROFILE);
        }
    }
895283
public function set(string $profile, $inheritContext = false)
    {
        return $this->has($profile) ? $this->get($profile) : $this->add($profile, $inheritContext);
    }
810267
public function clear() {
        $this->nested = [];
        $this->getter = null;
        $this->setter = null;
        return $this;
    }
1196107
public static function delete_data_for_all_users_in_context(\context $context) {
        global $DB;

        // Sanity check that context is at the User context level.
        if ($context->contextlevel == CONTEXT_COURSE) {
            $sql = "SELECT ue.id
                      FROM {user_enrolments} ue
                      JOIN {enrol} e ON e.id = ue.enrolid
                     WHERE e.courseid = :courseid";
            $params = ['courseid' => $context->instanceid];
            $enrolsids = $DB->get_fieldset_sql($sql, $params);
            if (!empty($enrolsids)) {
                list($insql, $inparams) = $DB->get_in_or_equal($enrolsids, SQL_PARAMS_NAMED);
                static::delete_user_data($insql, $inparams);
            }
        }
    }
1278295
public static function delete_data_for_all_users_in_context(\context $context) {
        // Only delete data for a user context.
        if ($context->contextlevel == CONTEXT_USER) {
            static::delete_user_data($context->instanceid, $context);
        }
    }
684858
public function clear(): DataObjectInterface
    {
        foreach ($this->getKeys() as $key) {
            $this->attributes[ $key ] = null;
        }

        return $this;
    }