正向递归，取下级
@return array
502896
private function recur_forward($id, $if_recur=false)
    {
        if (!$id) return array();
        if (!$if_recur) $this->resultIds = array();
        
        if ($this->stack[$id]) {
            foreach ($this->stack[$id] as $v) {
                $this->resultIds[] = $v[$this->fields[0]];
                if ($v['items']) {
                    foreach($v['items'] as $v2) {
                        $this->resultIds[] = $v2[$this->fields[0]];  // 先将子级加到列表，再递归获取子子级
                        $this->recur_forward($v2[$this->fields[0]], true);
                    }
                }
                
            }
        }
        return $this->resultIds;
    }
148662
protected function getDefault()
    {
        $current_url = $this->url->get();

        return array(
            'id' => uniqid(),
            'status' => true,
            'title' => '',
            'url' => '',
            'total' => 0,
            'errors' => 0,
            'done' => 0,
            'inserted' => 0,
            'updated' => 0,
            'context' => array(
                'offset' => 0,
                'line' => 1,
            ),
            'data' => array(),
            'message' => array(
                'start' => $this->translation->text('Starting...'),
                'finish' => $this->translation->text('Finished'),
                'process' => $this->translation->text('Processing...')
            ),
            'redirect' => array(
                'finish' => $current_url,
                'errors' => $current_url,
                'no_results' => $current_url
            ),
            'redirect_message' => array(
                'finish' => '',
                'errors' => '',
                'no_results' => ''
            ),
            'log' => array(
                'errors' => ''
            )
        );
    }
289849
private static function getSeconds(): array
    {
        $seconds = [-1 => static::getConstant('TXT_DATETIME_SS', 'TXT_DATETIME_SS')];
        for ($i = 0; $i <= 59; $i++) {
            $seconds[$i] = \sprintf('%02s', $i);
        }
        return $seconds;
    }
628161
public function getPatterns()
    {
        if (!$this->patternsCache) {
            $this->patternsCache = $this->getOption('patterns');
            usort($this->patternsCache, function (Pattern $first, Pattern $second) {
                return $first->priority - $second->priority;
            });
        }

        return $this->patternsCache;
    }
59666
public function getConfig()
    {
        return [
            'validators' => [
                'aliases'   => [
                    'consonant'            => Consonant::class,
                    'Consonant'            => Consonant::class,
                    'dateage'              => DateAge::class,
                    'dateAge'              => DateAge::class,
                    'DateAge'              => DateAge::class,
                    'ein'                  => Ein::class,
                    'Ein'                  => Ein::class,
                    'foldername'           => FolderName::class,
                    'folderName'           => FolderName::class,
                    'FolderName'           => FolderName::class,
                    'iataairlinecode'      => IataAirlineCode::class,
                    'iataAirlineCode'      => IataAirlineCode::class,
                    'IataAirlineCode'      => IataAirlineCode::class,
                    'iban'                 => Iban::class,
                    'Iban'                 => Iban::class,
                    'integer'              => Integer::class,
                    'Integer'              => Integer::class,
                    'luhn'                 => Luhn::class,
                    'Luhn'                 => Luhn::class,
                    'notinarray'           => NotInArray::class,
                    'notInArray'           => NotInArray::class,
                    'NotInArray'           => NotInArray::class,
                    'nowhitespace'         => NoWhitespace::class,
                    'noWhitespace'         => NoWhitespace::class,
                    'NoWhitespace'         => NoWhitespace::class,
                    'number'               => Number::class,
                    'Number'               => Number::class,
                    'password'             => Password::class,
                    'Password'             => Password::class,
                    'postcode'             => PostCode::class,
                    'postCode'             => PostCode::class,
                    'PostCode'             => PostCode::class,
                    'routingtransitnumber' => RoutingTransitNumber::class,
                    'routingTransitNumber' => RoutingTransitNumber::class,
                    'RoutingTransitNumber' => RoutingTransitNumber::class,
                    'ssn'                  => Ssn::class,
                    'Ssn'                  => Ssn::class,
                    'swift'                => Swift::class,
                    'Swift'                => Swift::class,
                    'username'             => Username::class,
                    'Username'             => Username::class,
                    'vatiN'                => VatIN::class,
                    'vatIN'                => VatIN::class,
                    'VatIN'                => VatIN::class,
                    'filecrc32'            => File\Crc32::class,
                    'fileCrc32'            => File\Crc32::class,
                    'FileCrc32'            => File\Crc32::class,
                    'filename'             => File\FileName::class,
                    'fileName'             => File\FileName::class,
                    'FileName'             => File\FileName::class,
                    'fileimagesize'        => File\ImageSize::class,
                    'fileImageSize'        => File\ImageSize::class,
                    'FileImageSize'        => File\ImageSize::class,
                    'fileiscompressed'     => File\IsCompressed::class,
                    'fileIsCompressed'     => File\IsCompressed::class,
                    'FileIsCompressed'     => File\IsCompressed::class,
                    'fileisimage'          => File\IsImage::class,
                    'fileIsImage'          => File\IsImage::class,
                    'FileIsImage'          => File\IsImage::class,
                    'filemd5'              => File\Md5::class,
                    'fileMd5'              => File\Md5::class,
                    'FileMd5'              => File\Md5::class,
                    'filemimetype'         => File\MimeType::class,
                    'fileMimeType'         => File\MimeType::class,
                    'FileMimeType'         => File\MimeType::class,
                    'filesha1'             => File\Sha1::class,
                    'fileSha1'             => File\Sha1::class,
                    'FileSha1'             => File\Sha1::class,
                    'filesize'             => File\Size::class,
                    'fileSize'             => File\Size::class,
                    'FileSize'             => File\Size::class,
                    'filewordcount'        => File\WordCount::class,
                    'fileWordCount'        => File\WordCount::class,
                    'FileWordCount'        => File\WordCount::class
                ],
                'factories' => [
                    Consonant::class            => InvokableFactory::class,
                    DateAge::class              => InvokableFactory::class,
                    Ein::class                  => InvokableFactory::class,
                    FolderName::class           => InvokableFactory::class,
                    IataAirlineCode::class      => InvokableFactory::class,
                    Iban::class                 => InvokableFactory::class,
                    Integer::class              => InvokableFactory::class,
                    Luhn::class                 => InvokableFactory::class,
                    NotInArray::class           => InvokableFactory::class,
                    NoWhitespace::class         => InvokableFactory::class,
                    Password::class             => InvokableFactory::class,
                    RoutingTransitNumber::class => InvokableFactory::class,
                    Ssn::class                  => InvokableFactory::class,
                    Swift::class                => InvokableFactory::class,
                    Username::class             => InvokableFactory::class,
                    VatIN::class                => InvokableFactory::class,
                    File\Crc32::class           => InvokableFactory::class,
                    File\FileName::class        => InvokableFactory::class,
                    File\ImageSize::class       => InvokableFactory::class,
                    File\IsCompressed::class    => InvokableFactory::class,
                    File\IsImage::class         => InvokableFactory::class,
                    File\Md5::class             => InvokableFactory::class,
                    File\MimeType::class        => InvokableFactory::class,
                    File\Sha1::class            => InvokableFactory::class,
                    File\Size::class            => InvokableFactory::class,
                    File\WordCount::class       => InvokableFactory::class
                ]
            ]
        ];
    }
460145
public function getConfig()
    {
        return [
            'filters' => [
                'aliases'   => [
                    'carriagereturntohtml' => CarriageReturnToHtml::class,
                    'carriageReturnToHtml' => CarriageReturnToHtml::class,
                    'CarriageReturnToHtml' => CarriageReturnToHtml::class,
                    'datetimetodateTime'   => DateTimeToDateTime::class,
                    'dateTimeToDateTime'   => DateTimeToDateTime::class,
                    'DateTimeToDateTime'   => DateTimeToDateTime::class,
                    'datetodatetime'       => DateToDateTime::class,
                    'dateToDateTime'       => DateToDateTime::class,
                    'DateToDateTime'       => DateToDateTime::class,
                    'slugify'              => Slugify::class,
                    'Slugify'              => Slugify::class,
                    'stripcarriagereturn'  => StripCarriageReturn::class,
                    'stripCarriageReturn'  => StripCarriageReturn::class,
                    'StripCarriageReturn'  => StripCarriageReturn::class,
                    'timetodatetime'       => TimeToDateTime::class,
                    'timeToDateTime'       => TimeToDateTime::class,
                    'TimeToDateTime'       => TimeToDateTime::class,
                    'filerenameupload'     => File\RenameUpload::class,
                    'fileRenameUpload'     => File\RenameUpload::class,
                    'FileRenameUpload'     => File\RenameUpload::class,
                    'wordtitlecase'        => Word\TitleCase::class,
                    'wordTitleCase'        => Word\TitleCase::class,
                    'WordTitleCase'        => Word\TitleCase::class
                ],
                'factories' => [
                    CarriageReturnToHtml::class => InvokableFactory::class,
                    DateTimeToDateTime::class   => InvokableFactory::class,
                    DateToDateTime::class       => InvokableFactory::class,
                    Slugify::class              => InvokableFactory::class,
                    StripCarriageReturn::class  => InvokableFactory::class,
                    TimeToDateTime::class       => InvokableFactory::class,
                    File\RenameUpload::class    => InvokableFactory::class,
                    Word\TitleCase::class       => InvokableFactory::class
                ]
            ]
        ];
    }
694601
public function getCoveredLines(): array
    {
        $this->getDiff();

        $coveredFiles = $this->fileChecker->parseLines();
        $this->uncoveredLines = [];
        $this->coveredLines = [];

        $diffFiles = array_keys($this->cache->diff);
        foreach ($diffFiles as $file) {
            $matchedFile = $this->findFile($file, $coveredFiles);
            if ($matchedFile !== '') {
                $this->matchLines($file, $matchedFile);
            }
        }

        return [
            'uncoveredLines' => $this->uncoveredLines,
            'coveredLines' => $this->coveredLines,
        ];
    }
866830
protected function getCommonReplacements()
    {
        return [
            '{{sectionBaseName}}' => end($this->sectionSegments),
            '{{studlySectionBaseName}}' => end($this->sectionSegmentsStudly),
            '{{routeBaseAlias}}' => $this->section,
            '{{langBaseKey}}'    => ($this->langDir ? $this->langDir.'/' : '').implode('/', $this->sectionSegments),
            '{{viewBaseName}}'   => ($this->viewsDir ? $this->viewsDir.'.' : '').$this->section,
            '{{modelClass}}'     => $this->modelClass,
        ];
    }
791442
public function actionCheckname(){
        $request = \Yii::$app->request;
        if ($request->getIsOptions()) {
            return $this->ResponseOptions($this->verbs()['checkname']);
        }
        $model = new BizRule(null);
        $mo =$model->find(Yii::$app->request->post()['BizRule']['name']);
        if($mo==null){
            return ['message'=>true];
        }else{
            return ['message'=>false];
        }

    }
712315
public function getActionText()
    {
        switch ($this->action) {
            case 'follow_user':
                return Yii::t('doing', 'follow on you');
                break;
            case 'answer_question':
                return Yii::t('doing', 'answered the question');
                break;
            case 'follow_question':
                return Yii::t('doing', 'is concerned about the problem');
                break;
            case 'create_article':
                return Yii::t('doing', 'Share an article');
                break;
            case 'create_note':
                return Yii::t('doing', 'Share an note');
                break;
            case 'create_news':
                return Yii::t('doing', 'Share an news');
                break;
            case 'create_live':
                return Yii::t('doing', 'Create the stream');
                break;
            case 'join_live':
                return Yii::t('doing', 'join the live');
                break;
            default:
                return null;
                break;
        }
    }
14122
private function getSuffixesToTry()
    {
        if ($this->suffixesToTry === null) {
            $this->suffixesToTry = [];

            if (isset($this->conf['salutation'])) {
                if ($this->conf['salutation'] === 'informal') {
                    $this->suffixesToTry[] = '_informal';
                }
                $this->suffixesToTry[] = '_formal';
            }
            $this->suffixesToTry[] = '';
        }

        return $this->suffixesToTry;
    }
1181360
protected function getSignalList(): array
    {
        if (null !== self::$list) {
            return self::$list;
        }

        $signals = [
            SIGHUP,
            SIGINT,
            SIGQUIT,
            SIGILL,
            SIGABRT,
            SIGTRAP,
            SIGBUS,
            SIGTERM,
            SIGSEGV,
            SIGFPE,
            SIGALRM,
            SIGVTALRM,
            SIGPROF,
            SIGIO,
            SIGCONT,
            SIGURG,
            SIGPIPE,
            SIGXCPU,
            SIGXFSZ,
            SIGTTIN,
            SIGTTOU,
            SIGUSR1,
            SIGUSR2,
        ];

        if (defined('SIGIOT')) {
            $signals[] = SIGIOT;
        }

        if (defined('SIGSTKFLT')) {
            $signals[] = SIGSTKFLT;
        }

        if (defined('SIGCLD')) {
            $signals[] = SIGCLD;
        }

        if (defined('SIGCHLD')) {
            $signals[] = SIGCHLD;
        }

        return self::$list = $signals;
    }
1306688
public static function getList()
    {
        $time = time();
        $return = [];
        
        foreach (self::find()->with('user')->all() as $item) {
            /* @var $item \luya\admin\models\UserOnline */
            $inactiveSince = ($time - $item->last_timestamp);
            $return[] = [
                'firstname' => $item->user->firstname,
                'lastname' => $item->user->lastname,
                'email' => $item->user->email,
                'last_timestamp' => $item->last_timestamp,
                'is_active' => ($inactiveSince >= (3*60)) ? false : true,
                'inactive_since' => round(($inactiveSince / 60)).' min',
                'lock_description' => Module::t($item->lock_translation, empty($item->lock_translation_args) ? [] : Json::decode($item->lock_translation_args)),
            ];
        }

        return $return;
    }
13701
protected function getFormattedReplacements()
    {
        $time = $this->getMembers();

        $negative = $this->isNegative();

        return [
            self::HOUR_FORMAT          => sprintf('%02d', $time['hours']),
            self::MINUTE_FORMAT        => sprintf('%02d', $time['minutes']),
            self::SECOND_FORMAT        => sprintf('%02d', $time['seconds']),
            self::TOTAL_MINUTES_FORMAT => sprintf('%02d', $time['total_minutes']),
            self::SIGN_ANY             => $negative ? '-' : '+',
            self::SIGN_NEGATIVE        => $negative ? '-'  : '',
        ];
    }
163810
public function check()
    {
        if ($this->valueChanged && $this->readonly) {
            return array('read_only', $this->printName());
        }

        if (null === $this->value || '' === $this->value) {
            if ($this->required) {
                return array('value_required', $this->printName());
            }
        } else {
            // Expressions régulière
            if ($this->regex) {
                if (!preg_match('/'.$this->regex.'/mUsi', $this->value)) {
                    return array('bad_format', $this->printName());
                }
            }

            // Longueur minimum et maximum
            if ($this->minlength && strlen($this->value) < $this->minlength) {
                return array('at_least', $this->printName(), $this->minlength);
            }

            if ($this->maxlength && strlen($this->value) > $this->maxlength) {
                return array('not_more', $this->printName(), $this->maxlength);
            }
        }

        // Custom constraints
        foreach ($this->constraints as $constraint) {
            $error = $constraint($this->value);
            if ($error) {
                return $error;
            }
        }
    }
225925
public function getReplaces()
    {
        return [
            "<header>" => Colors::COLOR_FGL_WHITE . Colors::FONT_BOLD,
            "</header>" => Colors::RESET,

            "<highlight>" => Colors::COLOR_FGL_YELLOW . Colors::FONT_BOLD,
            "</highlight>" => Colors::RESET,

            "<warn>" => Colors::COLOR_FG_RED,
            "</warn>" => Colors::RESET,

            "<info>" => Colors::COLOR_FGL_BLUE,
            "</info>" => Colors::RESET,

            "<error>" => Colors::COLOR_BG_RED . Colors::COLOR_FGL_WHITE,
            "</error>" => Colors::RESET
        ];
    }
600612
public function losLogMe()
    {
        $ret = [];
        $ret[get_class($this)] = [];
        foreach (get_object_vars($this) as $name => $content) {
            if (! is_object($content)) {
                $ret[$name] = ['type' => gettype($content), 'content' => $content];
            } else {
                $ret[$name] = ['type' => gettype($content), 'class' => get_class($content)];
            }
        }

        return $ret;
    }