clear conditions in notification

@param String $source
@return String
491062
protected function clearCondition($source)
    {
        $line = $this->getStringBetween($source, '{%', '%}');
        if (strlen($line) > 0) {
            return str_replace(['&#39;', '&nbsp;'], ["'", ' '], $source);
        }
        return $source;
    }
732747
private function normalizeEndings($source, Isolator $isolator)
    {
        //Step #1, \n only
        $source = $isolator->isolatePHP(preg_replace('/[\n\r]+/', "\n", $source));

        //Step #2, chunk by lines
        $sourceLines = explode("\n", $source);

        //Step #3, no blank lines and html comments (will keep conditional commends)
        $sourceLines = array_filter($sourceLines, function ($line) {
            return trim($line);
        });

        $source = $isolator->repairPHP(join("\n", $sourceLines));
        $isolator->reset();

        return $source;
    }
1133168
public function convertToString($source)
    {
        if (is_object($source)) {
            if ($source instanceof NamedInterface) {
                return $source->getName();
            } elseif (method_exists($source, '__toString')) {
                return (string) $source;
            } else {
                return get_class($source);
            }
        } elseif (is_scalar($source) || is_null($source)) {
            return (string) $source;
        } else {
            return gettype($source);
        }
    }
1338286
public function delete($source=null) {
        $grade_item = $this->load_grade_item();

        if ($this->is_course_category()) {

            if ($categories = grade_category::fetch_all(array('courseid'=>$this->courseid))) {

                foreach ($categories as $category) {

                    if ($category->id == $this->id) {
                        continue; // do not delete course category yet
                    }
                    $category->delete($source);
                }
            }

            if ($items = grade_item::fetch_all(array('courseid'=>$this->courseid))) {

                foreach ($items as $item) {

                    if ($item->id == $grade_item->id) {
                        continue; // do not delete course item yet
                    }
                    $item->delete($source);
                }
            }

        } else {
            $this->force_regrading();

            $parent = $this->load_parent_category();

            // Update children's categoryid/parent field first
            if ($children = grade_item::fetch_all(array('categoryid'=>$this->id))) {
                foreach ($children as $child) {
                    $child->set_parent($parent->id);
                }
            }

            if ($children = grade_category::fetch_all(array('parent'=>$this->id))) {
                foreach ($children as $child) {
                    $child->set_parent($parent->id);
                }
            }
        }

        // first delete the attached grade item and grades
        $grade_item->delete($source);

        // delete category itself
        return parent::delete($source);
    }
252401
public function clearCurrent($namespace = null)
    {
        $container = $this->getContainer();

        if ($namespace) {
            if (!$container->offsetExists($namespace)) {
                return false;
            }

            unset($container->{$namespace});
            return true;
        }

        foreach ($container as $namespace => $notifications) {
            $container->offsetUnset($namespace);
        }

        return true;
    }
970432
public function actionClean()
	{
		$class = $this->module->notificationClass;

		// Delete all notifications seen or flashed
		$criteria = ['or', ['seen=1'], ['flashed=1']];

		// Delete old notification according to expiration time setting
		if ( $this->module->expirationTime > 0 ) {
			$criteria[] = ['<', 'created_at', time()-$this->module->expirationTime ];
		}

		$records_deleted = $class::deleteAll($criteria);

		echo "$records_deleted obsolete notifications removed\n";
	}
134498
public function removeExpiredRegistrations($conditions = []) {
		$defaults = [
			$this->_table->aliasField($this->_field('emailVerified')) => 0,
			$this->_table->aliasField($this->_field('emailTokenExpires')) . ' <' => date('Y-m-d H:i:s')
		];

		$conditions = Hash::merge($defaults, $conditions);
		$count = $this->_table
			->find()
			->where($conditions)
			->count();

		if ($count > 0) {
			$this->_table->deleteAll($conditions);
		}

		return $count;
	}
746406
public static function translateFile($source)
    {
        if ($source == null) {
            return "";
        }

        $result = $source;
        for ($i = 0, $_i = strlen($source); $i < $_i; $i++) {
            self::translateFileSep($result, $i);
        }

        return $result;
    }
935171
public function fillSource($source)
    {
        $ki = $this->keyIndex;
        $kn = $this->keyName;
        $index = $source->$ki;
        $name = $source->$kn;
        if ($index !== null) {
            if (!isset($this->names[$index])) {
                $message = 'Invalid index '.$this->contextKey.'#'.$index;
                throw new InvalidIndexed($message);
            }
            $newName = $this->names[$index];
            if ($name === null) {
                $source->$kn = $newName;
            } elseif ($name !== $newName) {
                $message = 'Mismatch '.$this->contextKey.'#'.$index.' and "'.$name.'"';
                throw new InvalidIndexed($message);
            }
            return true;
        } elseif ($name !== null) {
            $source->$ki = $this->add($name);
            return true;
        }
        return false;
    }
572280
public static function clearMsg($msg)
    {
        $nmsg = str_replace([' standalone="no"', 'default:', ':default', "\n", "\r", "\t"], '', $msg);
        $nnmsg = str_replace('> ', '>', $nmsg);
        if (strpos($nnmsg, '> ')) {
            $nnmsg = self::clearMsg((string) $nnmsg);
        }

        return $nnmsg;
    }
125180
public function delete_all_grades($source=null) {
        if (!$this->is_course_item()) {
            $this->force_regrading();
        }

        if ($grades = grade_grade::fetch_all(array('itemid'=>$this->id))) {
            foreach ($grades as $grade) {
                $grade->delete($source);
            }
        }

        // Delete all the historical files.
        // We only support feedback files for modules atm.
        if ($this->is_external_item()) {
            $fs = new file_storage();
            $fs->delete_area_files($this->get_context()->id, GRADE_FILE_COMPONENT, GRADE_HISTORY_FEEDBACK_FILEAREA);
        }

        return true;
    }
84652
public function clear_notification( $queue_id, Notification $notification ) {

		$notifications = $this->get_notifications( $queue_id );

		$notification = array_search( $notification, $notifications );

		if ( false === $notification ) {
			return false;
		}

		unset( $notifications[ $notification ] );

		return $this->store_notifications( $queue_id, $notifications );
	}
298557
public static final function clear(array $Source, $keys): array {
		return count($keys = self::simplify(array_slice(func_get_args(), 1))) > 0 ? (count($keys) > 1
			? array_merge($Source, [$keys[0] => self::clear(self::cast(self::get($Source, $keys[0], [])),
				array_slice($keys, 1))]) : self::except($Source, $keys[0])): $Source;
	}
663398
public function normalizeCondition($condition)
    {
        if ($condition === true || $condition === 1) {
            return 'true';
        }

        if ($condition === false || $condition === 0) {
            return 'false';
        }

        return Helper::slugify($condition);
    }
839584
public function truncate($source)
    {
        $this->execute('DELETE' . ' FROM ' . $this->_escapeIdentifier($source));
        $this->execute('DELETE' . ' FROM sqlite_sequence WHERE name=:name', ['name' => $source]);

        return $this;
    }
1356700
public function prune($source = null)
    {
        if ($source) {
            $this->addUsingAlias(SourceTableMap::COL_ID, $source->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }
486706
public function clear()
    {
        $this->id = null;
        $this->type = null;
        $this->name = null;
        $this->domain = null;
        $this->api_url = null;
        $this->api_auth_http_user = null;
        $this->api_auth_http_password = null;
        $this->api_auth_type = null;
        $this->api_auth_user = null;
        $this->api_auth_password = null;
        $this->api_auth_token = null;
        $this->api_auth_url_user_key = null;
        $this->api_auth_url_pw_key = null;
        $this->cron = null;
        $this->customer_id = null;
        $this->activated = null;
        $this->notes = null;
        $this->last_run = null;
        $this->includelog = null;
        $this->public_key = null;
        $this->website_hash = null;
        $this->notification_recipient = null;
        $this->notification_sender = null;
        $this->notification_change = null;
        $this->notification_error = null;
        $this->alreadyInSave = false;
        $this->alreadyInValidation = false;
        $this->alreadyInClearAllReferencesDeep = false;
        $this->clearAllReferences();
        $this->applyDefaultValues();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }