Step 1
Search for the longest among the following suffixes, and perform the action indicated.

@return integer Next step number
507442
private function step1()
    {
        // ance   iqUe   isme   able   iste   eux   ances   iqUes   ismes   ables   istes
        //     delete if in R2
        if ( ($position = $this->search(array('ances', 'iqUes', 'ismes', 'ables', 'istes', 'ance', 'iqUe','isme', 'able', 'iste', 'eux'))) !== false) {
            if ($this->inR2($position)) {
                $this->word = Utf8::substr($this->word, 0, $position);
            }
            return 3;
        }

        // atrice   ateur   ation   atrices   ateurs   ations
        //      delete if in R2
        //      if preceded by ic, delete if in R2, else replace by iqU
        if ( ($position = $this->search(array('atrices', 'ateurs', 'ations', 'atrice', 'ateur', 'ation'))) !== false) {
            if ($this->inR2($position)) {
                $this->word = Utf8::substr($this->word, 0, $position);

                if ( ($position2 = $this->searchIfInR2(array('ic'))) !== false) {
                    $this->word = Utf8::substr($this->word, 0, $position2);
                } else {
                    $this->word = preg_replace('#(ic)$#u', 'iqU', $this->word);
                }
            }

            return 3;
        }

        // logie   logies
        //      replace with log if in R2
        if ( ($position = $this->search(array('logies', 'logie'))) !== false) {
            if ($this->inR2($position)) {
                $this->word = preg_replace('#(logies|logie)$#u', 'log', $this->word);
            }
            return 3;
        }

        // usion   ution   usions   utions
        //      replace with u if in R2
        if ( ($position = $this->search(array('usions', 'utions', 'usion', 'ution'))) !== false) {
            if ($this->inR2($position)) {
                $this->word = preg_replace('#(usion|ution|usions|utions)$#u', 'u', $this->word);
            }
            return 3;
        }

        // ence   ences
        //      replace with ent if in R2
        if ( ($position = $this->search(array('ences', 'ence'))) !== false) {
            if ($this->inR2($position)) {
                $this->word = preg_replace('#(ence|ences)$#u', 'ent', $this->word);
            }
            return 3;
        }

        // issement   issements
        //      delete if in R1 and preceded by a non-vowel
        if ( ($position = $this->search(array('issements', 'issement'))) != false) {
            if ($this->inR1($position)) {
                $before = $position - 1;
                $letter = Utf8::substr($this->word, $before, 1);
                if (! in_array($letter, self::$vowels)) {
                    $this->word = Utf8::substr($this->word, 0, $position);
                }
            }
            return 3;
        }

        // ement   ements
        //      delete if in RV
        //      if preceded by iv, delete if in R2 (and if further preceded by at, delete if in R2), otherwise,
        //      if preceded by eus, delete if in R2, else replace by eux if in R1, otherwise,
        //      if preceded by abl or iqU, delete if in R2, otherwise,
        //      if preceded by ièr or Ièr, replace by i if in RV
        if ( ($position = $this->search(array('ements', 'ement'))) !== false) {

            // delete if in RV
            if ($this->inRv($position)) {
                $this->word = Utf8::substr($this->word, 0, $position);
            }

            // if preceded by iv, delete if in R2 (and if further preceded by at, delete if in R2), otherwise,
            if ( ($position = $this->searchIfInR2(array('iv'))) !== false) {
                $this->word = Utf8::substr($this->word, 0, $position);
                if ( ($position2 = $this->searchIfInR2(array('at'))) !== false) {
                    $this->word = Utf8::substr($this->word, 0, $position2);
                }

            // if preceded by eus, delete if in R2, else replace by eux if in R1, otherwise,
            } elseif ( ($position = $this->search(array('eus'))) !== false) {
                if ($this->inR2($position)) {
                    $this->word = Utf8::substr($this->word, 0, $position);

                } elseif ($this->inR1($position)) {
                    $this->word = preg_replace('#(eus)$#u', 'eux', $this->word);
                }

            // if preceded by abl or iqU, delete if in R2, otherwise,
            } elseif ( ($position = $this->searchIfInR2(array('abl', 'iqU'))) !== false) {
                $this->word = Utf8::substr($this->word, 0, $position);

            // if preceded by ièr or Ièr, replace by i if in RV
            } elseif ( ($position = $this->searchIfInRv(array('ièr', 'Ièr'))) !== false) {
                $this->word = preg_replace('#(ièr|Ièr)$#u', 'i', $this->word);
            }
            return 3;
        }

        // ité   ités
        //      delete if in R2
        //      if preceded by abil, delete if in R2, else replace by abl, otherwise,
        //      if preceded by ic, delete if in R2, else replace by iqU, otherwise,
        //      if preceded by iv, delete if in R2
        if ( ($position = $this->search(array('ités', 'ité'))) !== false) {

            // delete if in R2
            if ($this->inR2($position)) {
                $this->word = Utf8::substr($this->word, 0, $position);
            }

            // if preceded by abil, delete if in R2, else replace by abl, otherwise,
            if ( ($position = $this->search(array('abil'))) !== false) {
                if ($this->inR2($position)) {
                    $this->word = Utf8::substr($this->word, 0, $position);
                } else {
                    $this->word = preg_replace('#(abil)$#u', 'abl', $this->word);
                }

            // if preceded by ic, delete if in R2, else replace by iqU, otherwise,
            } elseif ( ($position = $this->search(array('ic'))) !== false) {
                if ($this->inR2($position)) {
                    $this->word = Utf8::substr($this->word, 0, $position);
                } else {
                    $this->word = preg_replace('#(ic)$#u', 'iqU', $this->word);
                }

            // if preceded by iv, delete if in R2
            } elseif ( ($position = $this->searchIfInR2(array('iv'))) !== false) {
                $this->word = Utf8::substr($this->word, 0, $position);
            }

            return 3;
        }

        // if   ive   ifs   ives
        //      delete if in R2
        //      if preceded by at, delete if in R2 (and if further preceded by ic, delete if in R2, else replace by iqU)
        if ( ($position = $this->search(array('ifs', 'ives', 'if', 'ive'))) !== false) {

            if ($this->inR2($position)) {
                $this->word = Utf8::substr($this->word, 0, $position);
            }

            if ( ($position = $this->searchIfInR2(array('at'))) !== false) {
                $this->word = Utf8::substr($this->word, 0, $position);

                if ( ($position2 = $this->search(array('ic'))) !== false) {
                    if ($this->inR2($position2)) {
                        $this->word = Utf8::substr($this->word, 0, $position2);
                    } else {
                        $this->word = preg_replace('#(ic)$#u', 'iqU', $this->word);
                    }
                }
            }

            return 3;
        }

        // eaux
        //      replace with eau
        if ( ($position = $this->search(array('eaux'))) !== false) {
            $this->word = preg_replace('#(eaux)$#u', 'eau', $this->word);
            return 3;
        }

        // aux
        //      replace with al if in R1
        if ( ($position = $this->search(array('aux'))) !== false) {
            if ($this->inR1($position)) {
                $this->word = preg_replace('#(aux)$#u', 'al', $this->word);
            }
            return 3;
        }

        // euse   euses
        //      delete if in R2, else replace by eux if in R1
        if ( ($position = $this->search(array('euses', 'euse'))) !== false) {
            if ($this->inR2($position)) {
                $this->word = Utf8::substr($this->word, 0, $position);

            } elseif ($this->inR1($position)) {
                $this->word = preg_replace('#(euses|euse)$#u', 'eux', $this->word);
                //return 3;
            }
            return 3;
        }

        // amment
        //      replace with ant if in RV
        if ( ($position = $this->search(array('amment'))) !== false) {
            if ($this->inRv($position)) {
                $this->word = preg_replace('#(amment)$#u', 'ant', $this->word);
            }
            return 2;
        }

        // emment
        //      replace with ent if in RV
        if ( ($position = $this->search(array('emment'))) !== false) {
            if ($this->inRv($position)) {
                $this->word = preg_replace('#(emment)$#u', 'ent', $this->word);
            }
            return 2;
        }

        // ment   ments
        //      delete if preceded by a vowel in RV
        if ( ($position = $this->search(array('ments', 'ment'))) != false) {
            $before = $position - 1;
            $letter = Utf8::substr($this->word, $before, 1);
            if ( $this->inRv($before) && (in_array($letter, self::$vowels)) ) {
                $this->word = Utf8::substr($this->word, 0, $position);
            }

            return 2;
        }

        return 2;
    }
1365125
public function getAllStepsLinear()
    {
        $stepsFound = ArrayList::create();

        $firstStep = DataObject::get_one($this->config()->get('start_step'), "\"SessionID\" = {$this->session->ID}");
        $firstStep->LinkingMode = ($firstStep->ID == $this->getCurrentStep()->ID) ? 'current' : 'link';
        $firstStep->setForm($this);
        $stepsFound->push($firstStep);

        // mark the further steps as non-completed if the first step is the current
        if ($firstStep->ID == $this->getCurrentStep()->ID) {
            $this->currentStepHasBeenFound = true;
        } else {
            $firstStep->addExtraClass('completed');
        }

        $this->getAllStepsRecursive($firstStep, $stepsFound);

        return $stepsFound;
    }
7932
public function getNextSibling()
	{
		$left = $this->getRightValue() + 1;
		$searchCondition = $this->repository->createSearchCondition()
				->leftEqualsTo($left);

		$nextSibling = $this->repository->search($searchCondition);
		if ( ! isset($nextSibling[0])) {
			return null;
		}
		$nextSibling = $nextSibling[0];
		
		return $nextSibling;
	}
402050
protected function step2()
    {
        switch ($this->b[$this->k-1]) {
            case 'a':
                if ($this->ends("ational",7)) { $this->r("ate",3); break; }
                if ($this->ends("tional",6)) { $this->r("tion",4); break; }
                break;
            case 'c':
                if ($this->ends("enci",4)) { $this->r("ence",4); break; }
                if ($this->ends("anci",4)) { $this->r("ance",4); break; }
                break;
            case 'e':
                if ($this->ends("izer",4)) { $this->r("ize",3); break; }
                break;
            case 'l':
                if ($this->ends("bli",3)) { $this->r("ble",3); break; }
                // -DEPARTURE-
                // To match the published algorithm, replace the above line with
                // if ($this->ends("abli",4)) { $this->r("able",4); break; }
                if ($this->ends("alli",4)) { $this->r("al",2); break; }
                if ($this->ends("entli",5)) { $this->r("ent",3); break; }
                if ($this->ends("eli",3)) { $this->r("e",1); break; }
                if ($this->ends("ousli",5)) { $this->r("ous",3); break; }
                break;
            case 'o':
                if ($this->ends("ization",7)) { $this->r("ize",3); break; }
                if ($this->ends("ation",5)) { $this->r("ate",3); break; }
                if ($this->ends("ator",4)) { $this->r("ate",3); break; }
                break;
            case 's':
                if ($this->ends("alism",5)) { $this->r("al",2); break; }
                if ($this->ends("iveness",7)) { $this->r("ive",3); break; }
                if ($this->ends("fulness",7)) { $this->r("ful",3); break; }
                if ($this->ends("ousness",7)) { $this->r("ous",3); break; }
                break;
            case 't':
                if ($this->ends("aliti",5)) { $this->r("al",2); break; }
                if ($this->ends("iviti",5)) { $this->r("ive",3); break; }
                if ($this->ends("biliti",6)) { $this->r("ble",3); break; }
                break;
            case 'g':
                if ($this->ends("logi",4)) { $this->r("log",3); break; }
                // -DEPARTURE-
                // To match the published algorithm delete the above line
        }
    }
579910
public function GetFinallyIndex()
     {
        $rearr = array();
        foreach($this->finallyResult as $v)
        {
            if( $this->resultType==2 && ($v['t']==3 || $v['t']==5) )
            {
                continue;
            }
            $w = $this->_out_string_encoding($v['w']);
            if( $w == ' ' )
            {
                continue;
            }
            if( isset($rearr[$w]) )
            {
                 $rearr[$w]++;
            }
            else
            {
                 $rearr[$w] = 1;
            }
        }
        arsort( $rearr );
        return $rearr;
     }
343213
public function getStepFormat()
    {
        if ($this->lang == 'en') {
            switch ($this->step) {
                case self::$YEARLY:
                    return 'Y';
                    break;
                case self::$MONTHLY:
                    return 'Y-m';
                    break;
                case self::$DAILY:
                    return 'Y-m-d';
                    break;
                case self::$HOURLY:
                    return 'Y-m-d H:00';
                    break;
            }
        } elseif ($this->lang == 'fr') {
            switch ($this->step) {
                case self::$YEARLY:
                    return 'Y';
                    break;
                case self::$MONTHLY:
                    return 'm/Y';
                    break;
                case self::$DAILY:
                    return 'd/m/Y';
                    break;
                case self::$HOURLY:
                    return 'd/m/Y H:00';
                    break;
            }
        }

        return false;
    }
1068947
public function next()
    {
        if (! $this->startedIterating) {
            $this->ensureIterator();
            $this->startedIterating = true;
        } else {
            if ($this->cursorNeedsAdvancing) {
                $this->ensureIterator()->next();
            }

            $this->cursorNeedsAdvancing = true;
            $this->position++;
        }

        return $this->storeIteratorState();
    }
1362381
protected function getLongestSize()
    {
        if ($this->longest) {
            return $this->longest;
        }

        // Build possible handles
        $strings = [];
        $connections = $this->connections->getActiveConnections();
        $stages = (array) $this->connections->getAvailableStages() ?: [''];
        foreach ($connections as $handle => $connection) {
            $servers = $connection->getConnectionKey()->servers;
            if (count($servers) > 1) {
                $handle .= '/'.count($servers);
            }

            foreach ($stages as $stage) {
                $strings[] = trim($handle.'/'.$stage, '/');
            }
        }

        // Get longest string
        $strings = array_map('strlen', $strings);
        $strings = $strings ? max($strings) : 0;

        // Cache value
        $this->longest = $strings;

        return $this->longest;
    }
1294628
public function step1()
    {
        // abilitate   abilitati   abilităi   abilităţi
        //      replace with abil
        if ( ($position = $this->search(array('abilitate', 'abilitati', 'abilităi', 'abilităţi'))) !== false) {
            if ($this->inR1($position)) {
                $this->word = preg_replace('#(abilitate|abilitati|abilităi|abilităţi)$#u', 'abil', $this->word);
            }
            return true;
        }

        // ibilitate
        //      replace with ibil
        if ( ($position = $this->search(array('ibilitate'))) !== false) {
            if ($this->inR1($position)) {
                $this->word = preg_replace('#(ibilitate)$#u', 'ibil', $this->word);
            }
            return true;
        }

        // ivitate   ivitati   ivităi   ivităţi
        //      replace with iv
        if ( ($position = $this->search(array('ivitate', 'ivitati', 'ivităi', 'ivităţi'))) !== false) {
            if ($this->inR1($position)) {
                $this->word = preg_replace('#(ivitate|ivitati|ivităi|ivităţi)$#u', 'iv', $this->word);
            }
            return true;
        }

        // icitate   icitati   icităi   icităţi   icator   icatori   iciv   iciva   icive   icivi   icivă   ical   icala   icale   icali   icală
        //      replace with ic
        if ( ($position = $this->search(array(
            'icitate', 'icitati', 'icităi', 'icităţi', 'icatori', 'icator', 'iciva',
            'icive', 'icivi', 'icivă', 'icala', 'icale', 'icali', 'icală', 'iciv', 'ical'))) !== false) {
            if ($this->inR1($position)) {
                $this->word = preg_replace('#(icitate|icitati|icităi|icităţi|cator|icatori|iciva|icive|icivi|icivă|icala|icale|icali|icală|ical|iciv)$#u', 'ic', $this->word);
            }
            return true;
        }

        // ativ   ativa   ative   ativi   ativă   aţiune   atoare   ator   atori   ătoare   ător   ători
        //      replace with at
        if ( ($position = $this->search(array('ativa', 'ative', 'ativi', 'ativă', 'ativ', 'aţiune', 'atoare', 'atori', 'ătoare', 'ători', 'ător', 'ator'))) !== false) {
            if ($this->inR1($position)) {
                $this->word = preg_replace('#(ativa|ative|ativi|ativă|ativ|aţiune|atoare|atori|ătoare|ători|ător|ator)$#u', 'at', $this->word);
            }
            return true;
        }

        // itiv   itiva   itive   itivi   itivă   iţiune   itoare   itor   itori
        //      replace with it
        if ( ($position = $this->search(array('itiva', 'itive', 'itivi', 'itivă', 'itiv', 'iţiune', 'itoare', 'itori', 'itor'))) !== false) {
            if ($this->inR1($position)) {
                $this->word = preg_replace('#(itiva|itive|itivi|itivă|itiv|iţiune|itoare|itori|itor)$#u', 'it', $this->word);
            }
            return true;
        }

        return false;
    }
817767
protected function next()
    {
        $get = $this->get();
        if ($get === '/') {
            switch ($this->peek()) {
                case '/':
                    $this->consumeSingleLineComment();
                    $get = "\n";
                    break;
                case '*':
                    $this->consumeMultipleLineComment();
                    $get = ' ';
                    break;
            }
        }

        return $get;
    }
369020
private function step2()
    {
        if ( ($position = $this->searchIfInRv(array(
            'assimo', 'assero', 'eranno', 'erebbero', 'erebbe', 'eremmo', 'ereste', 'eresti', 'essero', 'iranno', 'irebbero', 'irebbe', 'iremmo',
            'iscano', 'ireste', 'iresti', 'iscono', 'issero',
            'avamo', 'arono', 'avano', 'avate', 'eremo', 'erete', 'erono', 'evamo', 'evano', 'evate', 'ivamo', 'ivano', 'ivate', 'iremo', 'irete', 'irono',
            'ammo', 'ando', 'asse', 'assi', 'emmo', 'enda', 'ende', 'endi', 'endo', 'erai', 'erei', 'Yamo', 'iamo', 'immo', 'irà', 'irai', 'irei',
            'isca', 'isce', 'isci', 'isco',
            'ano', 'are', 'ata', 'ate', 'ati', 'ato', 'ava', 'avi', 'avo', 'erà', 'ere', 'erò', 'ete', 'eva',
            'evi', 'evo', 'ire', 'ita', 'ite', 'iti', 'ito', 'iva', 'ivi', 'ivo', 'ono', 'uta', 'ute', 'uti', 'uto', 'irò', 'ar', 'ir'))) !== false) {

            $this->word = Utf8::substr($this->word, 0, $position);
        }
    }
1204898
private int getNextStep(int currentStep) {
        int nextStep = -1;
        
        // we find the next available step.
        for (int i = currentStep + 1; i <= STEP_THANKS; i++) {
            if(isStepEnabled(i)) {
                nextStep = i;
                break;
            }
        }

        return nextStep;
    }
1259811
public function next()
    {
        $this->firstItemIdx++;

        if (isset($this->firstItems[$this->firstItemIdx])) {
            return $this->firstItems[$this->firstItemIdx][1];
        } else {
            if (!isset($this->firstItems[$this->firstItemIdx - 1])) {
                $this->items->next();
            }

            if ($this->excludedItems) {
                while (($c = $this->items->current()) && in_array($c->{$this->keyField}, $this->excludedItems, true)) {
                    $this->items->next();
                }
            }
        }

        if (!$this->items->valid()) {
            // iterator has passed the preface items, off the end of the items
            // list. Track through the end items to go through to the next
            if ($this->endItemIdx === null) {
                $this->endItemIdx = -1;
            }

            $this->endItemIdx++;

            if (isset($this->lastItems[$this->endItemIdx])) {
                return $this->lastItems[$this->endItemIdx];
            }

            return false;
        }
    }
1310531
public function getNextStepFromDatabase()
    {
        if ($this->SessionID && is_numeric($this->SessionID)) {
            $nextSteps = $this->config()->get('next_steps');

            if (is_string($nextSteps)) {
                return DataObject::get_one($nextSteps, "\"SessionID\" = {$this->SessionID}");
            } elseif (is_array($nextSteps)) {
                return DataObject::get_one($nextSteps[0], "\"SessionID\" = {$this->SessionID}");
            } else {
                return false;
            }
        }
    }
1125017
public function next() {
        if (is_int($this->current)) {
            return $this->get($this->current + 1);
        }

        return $this->first;
    }
567128
public function step2()
    {
        if ( ($position = $this->searchIfInRv(array('и'))) !== false) {
            if ($this->inRv($position)) {
                $this->word = Utf8::substr($this->word, 0, $position);
                return true;
            }
        }
        return false;
    }
508095
public function next()
    {
        return $this->getParent() !== null ? $this->getParent()->getChildByIndex($this->getIndex() + 1) : null;
    }