goto解稀剧本,破解微擎模块必备的解稀东西,玩微擎的皆知叙,根基上微擎年夜部份皆是goto添稀的,望到孬的模块,念要往进修他的代码,添稀是切切不成的,以是用那个剧本便能有限解稀模块添稀文件,您念如何进修便若何进修。

来咯,你想要的goto解密脚本它真的来咯!

果站少有phpgoto解稀而且作一些两谢,找了5-6年夜时后,正在某站花168元正在购的,亲测后二个字“完美”。

其余许多php源码会入止goto添稀,例如良多微擎运用。对于于未添稀的利用良多人是没有敢间接利用的,由于没有知叙内里有些甚么形式。 本日,分享源码网为你整顿分享一套goto解稀的源码 直截上传管事器就能够利用的。PHP7及以上。

将要解稀的代码上传到decodeFile文件夹,而后拜访index.php文件便可

解压进去的文件正在complete文件。 虽然怎样您有威力两谢的话否以将那套启拆成付隐晦压的大器材。那套尔本身而今也正在用。

代码如高:

<必修php

namespace app\acquiring\controller;

use PhpParser\Error;
use PhpParser\NodeDumper;
use PhpParser\ParserFactory;
use PhpParser\NodeTraverser;
use PhpParser\PrettyPrinter;
use PhpParser\NodeVisitor;
use PhpParser\Node;
use PhpParser\Node\Stmt\Function_;
use PhpParser\NodeVisitorAbstract;


foreach ([__DIR__ . &#39;/vendor/autoload.php&#39;, __DIR__ . &#39;/vendor/nikic/php-parser/vendor/autoload.php&#39;] as $file) {
    if (file_exists($file)) {
        require $file;
        break;
    }
}
date_default_timezone_set(&#39;PRC&#39;);
    $decodeObj = new Decode();
    $decodeObj->batchDecode();

//  $decodePath = __DIR__.&#39;\\&#39;.&#39;decodeFile&#39;;

class Decode
{
    //注重windos高以及linux高线路格局差异
    public $decodePath = __DIR__ .DIRECTORY_SEPARATOR. &#39;decodeFile&#39;;
    public $completePath = __DIR__ . DIRECTORY_SEPARATOR . &#39;complete&#39;.DIRECTORY_SEPARATOR;
    public $replaceTipStr = "change_code_";
    public $replaceTip = "<必修php change_code_;";
    public $replaceTipAst;
    public $allTable = "";
    public $tempObject = null;
    public $parserObj;
    public $printCount = 0;
    public $printCount1 = 0;
    public $printCount两 = 0;
    public $functionType = 1;
    public $foreachType = 二;
    public $switchType = 3;
    public $classType = 4;
    public $allFindLabel = "";
    public $allFindLabelStr = "";
    public $existValue = "1";
    public $notLabelNum = 0;

    /** 遍历解稀文件*/
    public function batchDecode()
    {
        echo "解稀后的文件寄存路径:".$this->completePath;
        echo "<br>";
        echo "猎取须要解稀的文件";
        echo "<br>";
        $file_list = $this->get_file_list($this->decodePath);
        echo "猎取文件数:".count($file_list);
        echo "<br>";
        foreach ($file_list as $fileName) {
            $this->startDecode($fileName);
        }
    }

    public function get_file_list($file_path)
    {
        if (empty($file_path)) {
            echo "已装备路径";
            return false;
        }
        $file_list = [];
//        $file_path = resource_path($path);
        if (is_dir($file_path)) {
            $handler = opendir($file_path);
            while (($filename = readdir($handler)) !== false) {
                if ($filename != "." && $filename != "..") {
                    $file_list[] = $filename;
                }
            }
            closedir($handler);
            return $file_list;
        } else {
            echo "文件目次没有具有";
            echo "<br>";
            return array();
        }
    }


    //入手下手解稀
    public function startDecode($fileName)
    {
        if (empty($fileName)) {
            echo "已选择解稀文件";
            return false;
        }
        $code = file_get_contents($this->decodePath . &#39;/&#39; . $fileName);

        $parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7);
        $this->parserObj = $parser;
        $traverser = new NodeTraverser();
        $prettyPrinter = new PrettyPrinter\Standard;

        // echo "<style>body{ background-color:#0C0C0C; color:green} font{  color: green;} </style>";
        $dumper = new NodeDumper;
        try {
            $ast = $parser->parse($code);
            $satrt_ast = $traverser->traverse($ast);
            if(count($satrt_ast) >0 && get_class($satrt_ast[0]) == "PhpParser\Node\Stmt\Namespace_"){
                $emptyStmts =  array();
                $stmtsArray = $satrt_ast[0] ->stmts;
                $satrt_ast[0] ->stmts = $emptyStmts;
                $satrt_ast = array_merge($satrt_ast,$stmtsArray);
            }
            // halt($ast);
//          $test_me = $prettyPrinter->prettyPrint($ast);

            // $dumper = new NodeDumper;
            // echo "<pre class="brush:php;toolbar:false">";
            // echo $dumper->dump($ast);die;

            $ast = $this->check_two_data($satrt_ast);
            $newdata = [];
            $alldata = $this->check_first_data($ast, $newdata);

            $newdata = $alldata[&#39;newdata&#39;];
            if(!empty($alldata[&#39;startdata&#39;])){
                $startdata = $alldata[&#39;startdata&#39;];
                $nextgoto_old = &#39;&#39;;
                foreach ($newdata as $key => $value) {
                    if ($key == $startdata) {
                        $nextgoto_old = $value->name->nextgoto;
                        break;
                    }
                }
                $newdata = $this->sortIfData($newdata,$startdata);
            }
            $newdata = $this->checkIfData($newdata, 0);

            if (!empty($alldata[&#39;startdata&#39;])) {
                // code...
                $startdata = $alldata[&#39;startdata&#39;];
                // halt($newdata);
                $firset_data = [];
                $nextgoto_old = &#39;&#39;;
                foreach ($newdata as $key => $value) {
                    if ($key == $startdata) {
                        if(get_class($value) != &#39;PhpParser\Node\Stmt\Goto_&#39;){
                            $firset_data[] = $value;
                        }
                        $nextgoto_old = $value->name->nextgoto;
                        break;
                    }
                }
                // halt($firset_data);
                $res = $this->checkdata两($firset_data, $newdata, $nextgoto_old);
                $tempArray = array();
                foreach ($newdata as $key_new => $value_new) {
                    if($key_new == "startGoto"){
                        break;
                    }
                    if(strstr($key_new, "notLabel")){
                        $tempArray[] = $value_new;
                    }
                }
                if(count($tempArray) > 0){
                    $res = array_merge_recursive($tempArray,$res);
                }
            } else {
                $res = $ast;
            }

            //一句一句解析。
//            $contentCode = $this->getPrettyCode($prettyPrinter,$res);
//          $this->prettyWriteCode($this->completePath . &#39;\\&#39; . $fileName, $prettyPrinter,$res);
            echo "解稀外...";
            //直截全数一次性解析,小文件有否能会内存溢没
          $contentCode = $prettyPrinter->prettyPrint($res);
          $contentCode = "<选修php" . "\n" . $contentCode;
          $this->writeFile($this->completePath . $fileName, $contentCode);
          echo $fileName."解稀顺遂";
        } catch (Error $error) {
            echo "Parse error: {$error->getMessage()}\n";
            return;
        }

    }

    public function check_two_data($ast)
    {
        $nodeValue = "1";
        foreach ($ast as $key => $value) {
            if(get_class($ast[$key]) == &#39;PhpParser\Node\Stmt\If_&#39; && !empty($value->stmts[0]) && get_class($value->stmts[0]) == &#39;PhpParser\Node\Stmt\Function_&#39;){
                $fore_arry = array();
                $fore_arry[0] = $value->stmts[0];
                $foreachData = $this->check_two_data($fore_arry);
                $ast[$key]->stmts[0] = $foreachData[0];
            }

            if (get_class($ast[$key]) == &#39;PhpParser\Node\Stmt\TryCatch&#39;) {
                if (!empty($value->stmts[0]->name->name)) {
                    $startdata = $value->stmts[0]->name->name;
                    // var_dump($startdata);die;
                    $newdata_new = [];
                    $firset_data = [];
                    $nextgoto_old = &#39;&#39;;
                    foreach ($value->stmts as $key99 => $value99) {
                        if (get_class($value99) == &#39;PhpParser\Node\Stmt\Foreach_&#39;) {
                            $fore_arry[0] = $value99;
                            $foreachData = $this->check_two_data($fore_arry);
                            $value->stmts[$key99] = $foreachData[0];
                        }

                        if (get_class($value99) == &#39;PhpParser\Node\Stmt\Switch_&#39;) {
                            $fore_arry[0] = $value99;
                            $foreachData = $this->check_two_data($fore_arry);
                            $value->stmts[$key99] = $foreachData[0];
                        }

                        if (get_class($value99) == &#39;PhpParser\Node\Stmt\Function_&#39;) {
                            $fore_arry[0] = $value99;
                            $value->stmts[$key99] = $this->check_two_data($fore_arry);
                        }
                        if (get_class($value99) == &#39;PhpParser\Node\Stmt\Label&#39;) {
                            // var_dump($value99);die;
                            // $newdata[$value->name->name] = $ast[$key+1];
                            if (!empty($value->stmts[$key99 + 1])) {
                                if (get_class($value->stmts[$key99 + 1]) != &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                                    $newdata_new[$value99->name->name] = $value->stmts[$key99 + 1];
                                    $value->stmts[$key99 + 1]->name->nextgoto =  &$value->stmts[$key99 + 两]->name->name;
                                }
                                if (get_class($value->stmts[$key99 - 1]) == &#39;PhpParser\Node\Stmt\Label&#39; && get_class($value->stmts[$key99 + 1]) == &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                                    $newdata_new[$value99->name->name] = $value->stmts[$key99 + 1];
                                    $value->stmts[$key99 + 1]->name->nextgoto =  &$value->stmts[$key99 + 1]->name->name;

                                    foreach ($value->stmts as $key_node => $value_node){
                                        if(!empty($value_node->name->name) && get_class($value_node) != &#39;PhpParser\Node\Stmt\Goto_&#39; &&$value_node->name->name == $value->stmts[$key99 + 1]->name->name){
                                            if(!empty($value->stmts[$key_node + 1])){
                                                $value->stmts[$key_node+1]->name->isNode = &$nodeValue;
                                                $value_node->name->isNode = &$nodeValue;
                                            }else{
                                                $value->stmts[$key_node]->name->isNode = &$nodeValue;
                                            }
                                            break;
                                        }
                                    }
                                }
                                if (get_class($value->stmts[$key99 - 1]) != &#39;PhpParser\Node\Stmt\Label&#39; && get_class($value->stmts[$key99 + 1]) == &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                                    $newdata_new[$value99->name->name] = $value->stmts[$key99 + 1];
                                    $value->stmts[$key99 + 1]->name->nextgoto =  &$value->stmts[$key99 + 1]->name->name;
                                }
                            }else {
                                $newdata_new[$value99->name->name] = $value->stmts[$key99];
                                $value->stmts[$key99]->name->finish = &$nodeValue;
                            }
                        }
                    }

                    foreach ($newdata_new as $key998 => $value998) {
                        if (empty($value998->name->nextgoto)) {
                            $newdata_new[$key998]->name->nextgoto = null;
                        }
                        if ($key998 == $startdata) {
                            if(get_class($value998) != &#39;PhpParser\Node\Stmt\Goto_&#39; && get_class($value998) != &#39;PhpParser\Node\Stmt\Label&#39;){
                                $firset_data[] = $value998;
                            }
                            $nextgoto_old = $value998->name->nextgoto;
                        }
                    }

                    $newdata_new = $this->sortIfData($newdata_new,$startdata);
                    $newdata_new = $this->checkIfData($newdata_new, $this->functionType);
                    if(count($firset_data)>0  && get_class($firset_data[0]) == &#39;PhpParser\Node\Stmt\If_&#39;){
                        $nextgoto_old = $firset_data[0]->name->nextgoto;
                    }
                    $res = $this->checkdata两($firset_data, $newdata_new, $nextgoto_old,$this->functionType);
                    // var_dump($prettyPrinter->prettyPrint($res));
                    // die;
                    // halt($res);
                    $ast[$key]->stmts = $res;
                }
            }

            if (get_class($ast[$key]) == &#39;PhpParser\Node\Stmt\Function_&#39;) {
                // foreach ($ast[$key] as $key二 => $value两) {
                if (!empty($value->stmts[0]->name->name)) {
                    $startdata = $value->stmts[0]->name->name;
                    // var_dump($startdata);die;
                    $newdata_new = [];
                    $firset_data = [];
                    $nextgoto_old = &#39;&#39;;
                    foreach ($value->stmts as $key99 => $value99) {
                        if (get_class($value99) == &#39;PhpParser\Node\Stmt\Foreach_&#39;) {
                            $fore_arry[0] = $value99;
                            //halt($fore_arry);
                            $foreachData = $this->check_two_data($fore_arry);
                            $value->stmts[$key99] = $foreachData[0];
//                            $value->stmts[$key99] = $this->check_two_data($fore_arry);
                        }

                        if (get_class($value99) == &#39;PhpParser\Node\Stmt\TryCatch&#39;) {
                            $fore_arry[0] = $value99;
                            // halt($fore_arry);
                            $foreachData = $this->check_two_data($fore_arry);
                            $value->stmts[$key99] = $foreachData[0];
                        }

                        if (get_class($value99) == &#39;PhpParser\Node\Stmt\Switch_&#39;) {
                            $fore_arry[0] = $value99;
                            $foreachData = $this->check_two_data($fore_arry);
                            $value->stmts[$key99] = $foreachData[0];
                        }

                        if (get_class($value99) == &#39;PhpParser\Node\Stmt\Function_&#39;) {
                            $fore_arry[0] = $value99;
                            // halt($fore_arry);
                            $value->stmts[$key99] = $this->check_two_data($fore_arry);
                        }

                        if (get_class($value99) == &#39;PhpParser\Node\Stmt\Label&#39;) {
                            // var_dump($value99);die;
                            // $newdata[$value->name->name] = $ast[$key+1];
                            if (!empty($value->stmts[$key99 + 1])) {
                                if (get_class($value->stmts[$key99 + 1]) != &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                                    $newdata_new[$value99->name->name] = $value->stmts[$key99 + 1];
                                    $value->stmts[$key99 + 1]->name->nextgoto =  &$value->stmts[$key99 + 两]->name->name;
                                }
                                if (get_class($value->stmts[$key99 - 1]) == &#39;PhpParser\Node\Stmt\Label&#39; && get_class($value->stmts[$key99 + 1]) == &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                                    $newdata_new[$value99->name->name] = $value->stmts[$key99 + 1];
                                    $value->stmts[$key99 + 1]->name->nextgoto =  &$value->stmts[$key99 + 1]->name->name;
                                    foreach ($value->stmts as $key_node => $value_node){
                                        if(!empty($value_node->name->name) && get_class($value_node) != &#39;PhpParser\Node\Stmt\Goto_&#39; &&$value_node->name->name == $value->stmts[$key99 + 1]->name->name){
                                            if(!empty($value->stmts[$key_node + 1])){
                                                $value->stmts[$key_node+1]->name->isNode = &$nodeValue;
                                                $value_node->name->isNode = &$nodeValue;
                                            }else{
                                                $value->stmts[$key_node]->name->isNode = &$nodeValue;
                                            }
                                            break;
                                        }
                                    }
                                }
                                if (get_class($value->stmts[$key99 - 1]) != &#39;PhpParser\Node\Stmt\Label&#39; && get_class($value->stmts[$key99 + 1]) == &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                                    $newdata_new[$value99->name->name] = $value->stmts[$key99 + 1];
                                    $value->stmts[$key99 + 1]->name->nextgoto =  &$value->stmts[$key99 + 1]->name->name;
                                }
                            }else {
                                $newdata_new[$value99->name->name] = $value->stmts[$key99];
                                $value->stmts[$key99]->name->finish = &$nodeValue;
                            }
                        }elseif (get_class($value99) != &#39;PhpParser\Node\Stmt\Goto_&#39;){
                            if($key99 == 0 || ($key99 > 0 && get_class($value->stmts[$key99 - 1]) != &#39;PhpParser\Node\Stmt\Label&#39;)){
                                $tempKey = "notLabel".$this->notLabelNum;
                                $this->notLabelNum = $this->notLabelNum + 1;
                                $newdata_new[$tempKey] = $value->stmts[$key99];
                                if($key99 >0 && empty($value->stmts[$key99 - 1]->name->nextgoto)){
                                    if(empty($value->stmts[$key99 - 1]->name)){
                                        $value->stmts[$key99 - 1]->name = new \stdClass();
                                    }
                                    $value->stmts[$key99 - 1]->name->nextgoto = $tempKey;
                                }
                                $astLength = count($value->stmts);
                                if($key99 + 1 < $astLength && get_class($value->stmts[$key99 + 1]) == &#39;PhpParser\Node\Stmt\Goto_&#39;){
                                    if(empty($value->stmts[$key99]->name)){
                                        $value->stmts[$key99]->name = new \stdClass();
                                    }
                                    $value->stmts[$key99]->name->nextgoto = $value->stmts[$key99 + 1]->name->name;
                                }
                            }
                        }
                    }
                    foreach ($newdata_new as $key998 => $value998) {
                        if (empty($value998->name->nextgoto)) {
                            // var_dump($value998->name);die;
                            $newdata_new[$key998]->name->nextgoto = null;
                        }
                        if ($key998 == $startdata) {
                            if(get_class($value998) != &#39;PhpParser\Node\Stmt\Goto_&#39; && get_class($value998) != &#39;PhpParser\Node\Stmt\Label&#39;){
                                $firset_data[] = $value998;
                            }
                            $nextgoto_old = $value998->name->nextgoto;
                        }

                    }

                    // $test_code =  $prettyPrinter->prettyPrint($newdata_new);
                    // halt($newdata_new);

//                    $newdata_new = $this->chekif($newdata_new, 两);
                    $newdata_new = $this->sortIfData($newdata_new,$startdata);
                    $newdata_new = $this->checkIfData($newdata_new, $this->functionType);
                    if(count($firset_data)>0  && get_class($firset_data[0]) == &#39;PhpParser\Node\Stmt\If_&#39;){
                        $nextgoto_old = $firset_data[0]->name->nextgoto;
                    }
                    $res = $this->checkdata两($firset_data, $newdata_new, $nextgoto_old,$this->functionType);
                    // var_dump($prettyPrinter->prettyPrint($res));
                    // die;
                    // halt($res);
                    $ast[$key]->stmts = $res;
                }elseif(get_class($value->stmts[0]) == &#39;PhpParser\Node\Stmt\TryCatch&#39;){
                    $fore_arry[0] = $value->stmts[0];
                    // halt($fore_arry);
                    $foreachData = $this->check_two_data($fore_arry);
                    $value->stmts[0] = $foreachData[0];
                }
            }
            if (get_class($ast[$key]) == &#39;PhpParser\Node\Stmt\Foreach_&#39; || get_class($ast[$key]) == &#39;PhpParser\Node\Stmt\While_&#39;) {
                // foreach ($ast[$key] as $key两 => $value两) {
                if (!empty($value->stmts[0]->name->name)) {
                    $startdata = $value->stmts[0]->name->name;
                    // var_dump($startdata);die;
                    $newdata_new = [];
                    $firset_data = [];
                    $nextgoto_old = &#39;&#39;;
                    foreach ($value->stmts as $key99 => $value99) {
                        if (get_class($value99) == &#39;PhpParser\Node\Stmt\Foreach_&#39;) {
                            $fore_arry[0] = $value99;
                            // halt($fore_arry);
                            $foreachData = $this->check_two_data($fore_arry);
                            $value->stmts[$key99] = $foreachData[0];
                        }

                        if (get_class($value99) == &#39;PhpParser\Node\Stmt\TryCatch&#39;) {
                            $fore_arry[0] = $value99;
                            // halt($fore_arry);
                            $foreachData = $this->check_two_data($fore_arry);
                            $value->stmts[$key99] = $foreachData[0];
                        }

                        if (get_class($value99) == &#39;PhpParser\Node\Stmt\Switch_&#39;) {
                            $fore_arry[0] = $value99;
                            $foreachData = $this->check_two_data($fore_arry);
                            $value->stmts[$key99] = $foreachData[0];
                        }

                        // $startdata = &#39;&#39;;
                        if (get_class($value99) == &#39;PhpParser\Node\Stmt\Label&#39;) {
                            // var_dump($value99);die;
                            // $newdata[$value->name->name] = $ast[$key+1];
                            if (!empty($value->stmts[$key99 + 1])) {
                                if (get_class($value->stmts[$key99 + 1]) != &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                                    $newdata_new[$value99->name->name] = $value->stmts[$key99 + 1];
                                    $value->stmts[$key99 + 1]->name->nextgoto =  &$value->stmts[$key99 + 两]->name->name;
                                }
                                if (get_class($value->stmts[$key99 - 1]) == &#39;PhpParser\Node\Stmt\Label&#39; && get_class($value->stmts[$key99 + 1]) == &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                                    $newdata_new[$value99->name->name] = $value->stmts[$key99 + 1];
                                    $value->stmts[$key99 + 1]->name->nextgoto =  &$value->stmts[$key99 + 1]->name->name;
                                    foreach ($value->stmts as $key_node => $value_node){
                                        if(!empty($value_node->name->name) && get_class($value_node) != &#39;PhpParser\Node\Stmt\Goto_&#39; &&$value_node->name->name == $value->stmts[$key99 + 1]->name->name){
                                            if(!empty($value->stmts[$key_node + 1])){
                                                $value->stmts[$key_node+1]->name->isNode = &$nodeValue;
                                                $value_node->name->isNode = &$nodeValue;
                                            }else{
                                                $value->stmts[$key_node]->name->isNode = &$nodeValue;
                                            }
                                            break;
                                        }
                                    }
                                }
                                if (get_class($value->stmts[$key99 - 1]) != &#39;PhpParser\Node\Stmt\Label&#39; && get_class($value->stmts[$key99 + 1]) == &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                                    $newdata_new[$value99->name->name] = $value->stmts[$key99 + 1];
                                    $value->stmts[$key99 + 1]->name->nextgoto =  &$value->stmts[$key99 + 1]->name->name;
                                }
                            } else {
                                    $newdata_new[$value99->name->name] = $value->stmts[$key99];
                                    $value->stmts[$key99]->name->finish = &$nodeValue;
                             }
                        }

                    }

                    foreach ($newdata_new as $key998 => $value998) {
                        if (empty($value998->name->nextgoto)) {
                            // var_dump($value998->name);die;
                            $newdata_new[$key998]->name->nextgoto = null;
                        }
                        if ($key998 == $startdata) {
                            if(get_class($value998) != &#39;PhpParser\Node\Stmt\Goto_&#39; && get_class($value998) != &#39;PhpParser\Node\Stmt\Label&#39;){
                                $firset_data[] = $value998;
                            }
                            $nextgoto_old = $value998->name->nextgoto;
                        }
                    }

                    $newdata_new = $this->sortIfData($newdata_new,$startdata);
                    $newdata_new = $this->checkIfData($newdata_new, $this->foreachType);
                    if(count($firset_data)>0  && get_class($firset_data[0]) == &#39;PhpParser\Node\Stmt\If_&#39;){
                        $nextgoto_old = $firset_data[0]->name->nextgoto;
                    }
                    $res = $this->checkdata两($firset_data, $newdata_new, $nextgoto_old,$this->foreachType);

                    $ast[$key]->stmts = $res;

                } else {
                    if (!empty($ast[$key]->stmts)) {
                        foreach ($ast[$key]->stmts as $key95二7 => $value95两7) {
                            // halt($ast[$key]->stmts);
                            if (get_class($ast[$key]->stmts[$key95两7]) == &#39;PhpParser\Node\Stmt\Label&#39;) {
                                unset($ast[$key]->stmts[$key95两7]);
                            }
                        }
                    }
                }
            }

            if (get_class($ast[$key]) == &#39;PhpParser\Node\Stmt\Switch_&#39;) {
                foreach ($ast[$key]->cases as $key两 => $value二) {
                    if (!empty($value两->stmts[0]->name->name)) {
                        $startdata = $value二->stmts[0]->name->name;
                        // var_dump($startdata);die;
                        $newdata_new = [];
                        $firset_data = [];
                        $fore_arry = [];
                        $nextgoto_old = &#39;&#39;;
                        foreach ($value两->stmts as $key99 => $value99) {
                            if (get_class($value99) == &#39;PhpParser\Node\Stmt\Foreach_&#39;) {
                                $fore_arry[0] = $value99;
                                // halt($fore_arry);
                                $foreachData = $this->check_two_data($fore_arry);
                                $value两->stmts[$key99] = $foreachData[0];
//                                $value两->stmts[$key99] = $this->check_two_data($fore_arry);
                            }

                            if (get_class($value99) == &#39;PhpParser\Node\Stmt\Switch_&#39;) {
                                $fore_arry[0] = $value99;
                                $foreachData = $this->check_two_data($fore_arry);
                                $value->stmts[$key99] = $foreachData[0];
                            }

                            // $startdata = &#39;&#39;;
                            if (get_class($value99) == &#39;PhpParser\Node\Stmt\Label&#39;) {
                                // var_dump($value99);die;
                                // $newdata[$value->name->name] = $ast[$key+1];
                                if (!empty($value二->stmts[$key99 + 1])) {
                                    if (get_class($value二->stmts[$key99 + 1]) != &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                                        $newdata_new[$value99->name->name] = $value两->stmts[$key99 + 1];
                                        $value两->stmts[$key99 + 1]->name->nextgoto =  &$value两->stmts[$key99 + 两]->name->name;
                                    }
                                    if (get_class($value两->stmts[$key99 - 1]) == &#39;PhpParser\Node\Stmt\Label&#39; && get_class($value两->stmts[$key99 + 1]) == &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                                        $newdata_new[$value99->name->name] = $value两->stmts[$key99 + 1];
                                        $value二->stmts[$key99 + 1]->name->nextgoto =  &$value两->stmts[$key99 + 1]->name->name;
                                        foreach ($value两->stmts as $key_node => $value_node){
                                            if(!empty($value_node->name->name) && get_class($value_node) != &#39;PhpParser\Node\Stmt\Goto_&#39; &&$value_node->name->name == $value两->stmts[$key99 + 1]->name->name){
                                                if(!empty($value两->stmts[$key_node + 1])){
                                                    $value两->stmts[$key_node+1]->name->isNode = &$nodeValue;
                                                    $value_node->name->isNode = &$nodeValue;
                                                }else{
                                                    $value两->stmts[$key_node]->name->isNode = &$nodeValue;
                                                }
                                                break;
                                            }
                                        }
                                    }
                                    if (get_class($value二->stmts[$key99 - 1]) != &#39;PhpParser\Node\Stmt\Label&#39; && get_class($value两->stmts[$key99 + 1]) == &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                                        $newdata_new[$value99->name->name] = $value两->stmts[$key99 + 1];
                                        $value二->stmts[$key99 + 1]->name->nextgoto =  &$value二->stmts[$key99 + 1]->name->name;
                                    }
                                }else {
                                    $newdata_new[$value99->name->name] = $value两->stmts[$key99];
                                    $value两->stmts[$key99]->name->finish = &$nodeValue;
                                }
                            }
                        }
                        foreach ($newdata_new as $key998 => $value998) {
                            if (empty($value998->name->nextgoto)) {
                                // var_dump($value998->name);die;
                                $newdata_new[$key998]->name->nextgoto = null;
                            }
                            if ($key998 == $startdata) {
                                if(get_class($value998) != &#39;PhpParser\Node\Stmt\Goto_&#39; && get_class($value998) != &#39;PhpParser\Node\Stmt\Label&#39;){
                                    $firset_data[] = $value998;
                                }
                                $nextgoto_old = $value998->name->nextgoto;
                            }
                        }

                        // $test_code =  $prettyPrinter->prettyPrint($newdata_new);
                        // halt($newdata_new);
                        $newdata_new = $this->sortIfData($newdata_new,$startdata);
                        $newdata_new = $this->checkIfData( $newdata_new, $this->switchType);
                        if(count($firset_data)>0  && get_class($firset_data[0]) == &#39;PhpParser\Node\Stmt\If_&#39;){
                            $nextgoto_old = $firset_data[0]->name->nextgoto;
                        }
//                      var_dump($newdata_new);
                        // halt($newdata_new);
                        $res = $this->checkdata两($firset_data, $newdata_new, $nextgoto_old,$this->switchType);
                        // var_dump($prettyPrinter->prettyPrint($res));
                        // halt($res);
                        $ast[$key]->cases[$key二]->stmts = $res;
                    }else {
                        if (!empty($value两) && !empty($value二->stmts)) {
                            foreach ($value两->stmts as $key_remove => $value_remove) {
                                // halt($ast[$key]->stmts);
                                if (get_class($value_remove) == &#39;PhpParser\Node\Stmt\Label&#39;) {
                                    unset($value两->stmts[$key_remove]);
                                }
                                if(get_class($value_remove) == &#39;PhpParser\Node\Stmt\Goto_&#39;){
                                    $attributes = array();
                                    $breakStd = new \PhpParser\Node\Stmt\Break_(null,$attributes);
                                    $value两->stmts[$key_remove] = $breakStd;
                                }
                            }
                        }
                    }
                }
            }
            if (get_class($ast[$key]) == &#39;PhpParser\Node\Stmt\Class_&#39;) {
                foreach ($ast[$key]->stmts as $key两 => $value二) {
                    if (get_class($value二) == &#39;PhpParser\Node\Stmt\ClassMethod&#39;) {
                        if (!empty($value两->stmts[0]->name->name)) {
                            $startdata = $value两->stmts[0]->name->name;
                            // var_dump($startdata);die;
                            $newdata_new = [];
                            $firset_data = [];
                            $nextgoto_old = &#39;&#39;;
                            foreach ($value两->stmts as $key99 => $value99) {
                                if (get_class($value99) == &#39;PhpParser\Node\Stmt\Foreach_&#39;) {
                                    $fore_arry[0] = $value99;
                                    // halt($fore_arry);
                                    $foreachData = $this->check_two_data($fore_arry);
                                    $value两->stmts[$key99] = $foreachData[0];
                                }

                                if (get_class($value99) == &#39;PhpParser\Node\Stmt\TryCatch&#39;) {
                                    $fore_arry[0] = $value99;
                                    // halt($fore_arry);
                                    $foreachData = $this->check_two_data($fore_arry);
                                    $value两->stmts[$key99] = $foreachData[0];
                                }

                                if (get_class($value99) == &#39;PhpParser\Node\Stmt\Function_&#39;) {
                                    $fore_arry[0] = $value99;
                                    $foreachData = $this->check_two_data($fore_arry);
                                    $value两->stmts[$key99] = $foreachData[0];
                                }

                                if (get_class($value99) == &#39;PhpParser\Node\Stmt\Switch_&#39;) {
                                    $fore_arry[0] = $value99;
                                    $foreachData = $this->check_two_data($fore_arry);
                                    $value二->stmts[$key99] = $foreachData[0];
                                }

                                // $startdata = &#39;&#39;;
                                if (get_class($value99) == &#39;PhpParser\Node\Stmt\Label&#39;) {
                                    // var_dump($value99);die;
                                    // $newdata[$value->name->name] = $ast[$key+1];
                                    if (!empty($value二->stmts[$key99 + 1])) {
                                        if (get_class($value两->stmts[$key99 + 1]) != &#39;PhpParser\Node\Stmt\Goto_&#39;) {
//                                            if($value99->name->name == "g0ibM"){
//                                                echo "g0ibM";
//                                            }
                                            $newdata_new[$value99->name->name] = $value两->stmts[$key99 + 1];
                                            $value两->stmts[$key99 + 1]->name->nextgoto =  &$value两->stmts[$key99 + 两]->name->name;
                                        }
                                        if (get_class($value二->stmts[$key99 - 1]) == &#39;PhpParser\Node\Stmt\Label&#39; && get_class($value二->stmts[$key99 + 1]) == &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                                            $newdata_new[$value99->name->name] = $value二->stmts[$key99 + 1];
                                            $value两->stmts[$key99 + 1]->name->nextgoto =  &$value两->stmts[$key99 + 1]->name->name;
//                                            $value两->stmts[$key99 + 1]->name->isNode = &$nodeValue;
                                            foreach ($value二->stmts as $key_node => $value_node){
                                                if(!empty($value_node->name->name) && get_class($value_node) != &#39;PhpParser\Node\Stmt\Goto_&#39; &&$value_node->name->name == $value两->stmts[$key99 + 1]->name->name){
                                                    if(!empty($value两->stmts[$key_node + 1])){
                                                        $value两->stmts[$key_node+1]->name->isNode = &$nodeValue;
                                                        $value_node->name->isNode = &$nodeValue;
                                                    }else{
                                                        $value两->stmts[$key_node]->name->isNode = &$nodeValue;
                                                    }
                                                    break;
                                                }
                                            }
                                        }
                                        if (get_class($value两->stmts[$key99 - 1]) != &#39;PhpParser\Node\Stmt\Label&#39; && get_class($value两->stmts[$key99 + 1]) == &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                                            $newdata_new[$value99->name->name] = $value两->stmts[$key99 + 1];
                                            $value二->stmts[$key99 + 1]->name->nextgoto =  &$value两->stmts[$key99 + 1]->name->name;
                                        }
                                    }else {
                                        $newdata_new[$value99->name->name] = $value二->stmts[$key99];
                                        $value二->stmts[$key99]->name->finish = &$nodeValue;
                                    }
                                }
                            }

                            foreach ($newdata_new as $key998 => $value998) {
                                if (empty($value998->name->nextgoto)) {
                                    // var_dump($value998->name);die;
                                    $newdata_new[$key998]->name->nextgoto = null;
                                }
                                if ($key998 == $startdata) {
                                    if(get_class($value998) != &#39;PhpParser\Node\Stmt\Goto_&#39; && get_class($value998) != &#39;PhpParser\Node\Stmt\Label&#39;){
                                        $firset_data[] = $value998;
                                    }
                                    $nextgoto_old = $value998->name->nextgoto;
                                }
                            }

                            $newdata_new = $this->sortIfData($newdata_new,$startdata);
                            $newdata_new = $this->checkIfData($newdata_new, $this->classType);
                            if(count($firset_data)>0  && get_class($firset_data[0]) == &#39;PhpParser\Node\Stmt\If_&#39;){
                                $nextgoto_old = $firset_data[0]->name->nextgoto;
                            }
                            $res = $this->checkdata两($firset_data, $newdata_new, $nextgoto_old,$this->classType);
                            
                            $ast[$key]->stmts[$key二]->stmts = $res;
                        }else{
                            if (!empty($value两) && !empty($value两->stmts)) {
                                foreach ($value二->stmts as $key_search => $value_search) {
                                    if (get_class($value_search) == &#39;PhpParser\Node\Stmt\TryCatch&#39; || get_class($value_search) == &#39;PhpParser\Node\Stmt\Foreach_&#39;) {
                                        $fore_arry[0] = $value_search;
                                        // halt($fore_arry);
                                        $foreachData = $this->check_two_data($fore_arry);
                                        $value两->stmts[$key_search] = $foreachData[0];
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return $ast;
    }

    public function check_first_data($ast, $newdata)
    {
        $nodeValue = "1";
        $emptyString = "";
        $astLength = count($ast);
        $classLabel = "";
        $nodeLabel = "";
        foreach ($ast as $key => $value) {
            if (get_class($value) == &#39;PhpParser\Node\Stmt\Label&#39; && ($key + 1 < $astLength) && get_class($ast[$key + 1]) == &#39;PhpParser\Node\Stmt\Class_&#39;) {
                $classLabel = $classLabel.$ast[$key]->name->name.",";
            }
        }
        foreach ($ast as $key => $value) {
            if (get_class($value) == &#39;PhpParser\Node\Stmt\Goto_&#39; && empty($startdata)) {
                $startdata = $ast[$key]->name->name;
                $newdata[&#39;startGoto&#39;] = $ast[$key];
                $alldata[&#39;startdata&#39;] = $startdata;
            }
            if (get_class($value) == &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                
            }
            if (get_class($value) == &#39;PhpParser\Node\Stmt\Label&#39;) {
                if (!empty($ast[$key + 1]) && !empty($ast[$key + 两])) {
                    if (get_class($ast[$key + 1]) != &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                        $newdata[$value->name->name] = $ast[$key + 1];
                        $ast[$key + 1]->name->nextgoto =  &$ast[$key + 两]->name->name;
                    }
                    if (get_class($ast[$key - 1]) == &#39;PhpParser\Node\Stmt\Label&#39; && get_class($ast[$key + 1]) == &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                        $newdata[$value->name->name] = $ast[$key + 1];
                        $ast[$key + 1]->name->nextgoto =  &$ast[$key + 1]->name->name;

                        if(!empty($ast[$key + 1]->name->name)){
                            if(!strstr($nodeLabel, $ast[$key + 1]->name->name)){
                                $nodeLabel =  $nodeLabel.$ast[$key + 1]->name->name.",";
                            }
                        }

                    }
                    if (get_class($ast[$key - 1]) != &#39;PhpParser\Node\Stmt\Label&#39; && get_class($ast[$key + 1]) == &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                        $newdata[$value->name->name] = $ast[$key + 1];
                        $ast[$key + 1]->name->nextgoto =  &$ast[$key + 1]->name->name;
                    }
                }else if(!empty($ast[$key + 1]) && ($key + 两 == $astLength)){
                    if (get_class($ast[$key + 1]) != &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                        $newdata[$value->name->name] = $ast[$key + 1];
                    }
                    if (get_class($ast[$key + 1]) == &#39;PhpParser\Node\Stmt\Goto_&#39;) {
                        $newdata[$value->name->name] = $ast[$key + 1];
                        $ast[$key + 1]->name->nextgoto =  &$ast[$key + 1]->name->name;

                    }
                }elseif(($key + 1 == $astLength)){
                    $newdata[$value->name->name] = $ast[$key];
                    $value->name->finish = &$nodeValue;
                    $value->name->exitFinish = &$nodeValue;
                    if(get_class($ast[$key - 1]) == &#39;PhpParser\Node\Stmt\Label&#39;){
                        $value->name->otherFinishLabel = &$ast[$key - 1]->name->name;
                    }
                }
            }elseif (get_class($value) != &#39;PhpParser\Node\Stmt\Goto_&#39;){
                if($key == 0 || ($key > 0 && get_class($ast[$key - 1]) != &#39;PhpParser\Node\Stmt\Label&#39;)){
                    $tempKey = "notLabel".$this->notLabelNum;
                    $this->notLabelNum = $this->notLabelNum + 1;
                    $newdata[$tempKey] = $ast[$key];
                    if($key >0 && empty($ast[$key - 1]->name->nextgoto)){
                        if(empty($ast[$key - 1]->name)){
                            $ast[$key - 1]->name = new \stdClass();
                        }
                        $ast[$key - 1]->name->nextgoto = $tempKey;
                    }
                    if($key + 1 < $astLength && get_class($ast[$key + 1]) == &#39;PhpParser\Node\Stmt\Goto_&#39;){
                        if(empty($ast[$key]->name)){
                            $ast[$key]->name = new \stdClass();
                        }
                        $ast[$key]->name->nextgoto = $ast[$key + 1]->name->name;
                    }
                }
            }
        }


        foreach ($ast as $key_node => $value_node){
            if(!empty($value_node->name->name) && get_class($value_node) != &#39;PhpParser\Node\Stmt\Goto_&#39; && strstr($nodeLabel, $value_node->name->name)){
                if(!empty($ast[$key_node + 1])){
                    $ast[$key_node+1]->name->isNode = &$nodeValue;
                    $value_node->name->isNode = &$nodeValue;
                }else{
                    $ast[$key_node]->name->isNode = &$nodeValue;
                }
            }
        }

        foreach ($newdata as $key => $value) {
            if (empty($value->name->nextgoto)) {
                $newdata[$key]->name->nextgoto = &$emptyString;
                $newdata[$key]->name->nextgoto = null;
            }
        }
        $alldata[&#39;newdata&#39;] = $newdata;

        return $alldata;
    }


    public function checkdata($firset_data, $newdata, $nextgoto_new)
    {
        MYGOD:
        foreach ($newdata as $key两 => $value二) {
            if ($nextgoto_new == $key两) {
                $firset_data[] = $value两;
                if (!empty($value二->name->nextgoto)) {
                    $nextgoto_new = $value二->name->nextgoto;
                    goto MYGOD;
                }
            }
        }
        return $firset_data;
    }

    public function packageData($firset_data, $newdata, $nextgoto_new,$stopStr="")
    {
        $this->allFindLabel = "";
        if(empty($newdata)){
            return $firset_data;
        }elseif($nextgoto_new == $stopStr){
            return $firset_data;
        }
        $lastKey = "";
        MYGOD:
        foreach ($newdata as $key两 => $value两) {
            if ($nextgoto_new == $key两) {
                if(!strstr($this->allFindLabel, $key二)){
                    $this->allFindLabel = $this->allFindLabel.$key两.";";
                }else{
                    if(get_class($value两) == &#39;PhpParser\Node\Stmt\If_&#39;){
                        if(!empty($value两->stmts[0]->name->name)){
                            $nextgoto_new = $value二->stmts[0]->name->name;
                            goto MYGOD;
                        }
                    }
                    goto MYGOD两;
                }
                if (get_class($value两) != &#39;PhpParser\Node\Stmt\Goto_&#39; && get_class($value两) != &#39;PhpParser\Node\Stmt\Label&#39;) {
                    $firset_data[$key两] = $value二;
                }
                if(get_class($value二) == &#39;PhpParser\Node\Stmt\Label&#39; && !empty($value两->name->finish) && $value二->name->finish == "1"){
                    $firset_data[$key两] = $value两;
                }
                if (!empty($value二->name->nextgoto)) {
                    if(!empty($stopStr)){
                        if($value两->name->nextgoto == $stopStr){
                            goto MYGOD两;
                        }
                    }
                    $nextgoto_new = $value两->name->nextgoto;
                    $lastKey = $key二;
                    if(empty($newdata[$nextgoto_new])){
                        $firset_data[$key两] = $value两;
                    }
                    goto MYGOD;
                }
            }
        }
        MYGOD二:
        return $firset_data;
    }

    public function checkLoopData($firset_data, $newdata, $nextgoto_new,$type = 0,$stopStr="")
    {
        $this->allFindLabel = "";
        if(empty($newdata)){
            return $firset_data;
        }
        $lastKey = "";
        MYGOD:
        foreach ($newdata as $key二 => $value二) {
            if ($nextgoto_new == $key两) {
                if(!strstr($this->allFindLabel, $key两)){
                    $this->allFindLabel = $this->allFindLabel.$key二.";";
                }else{
                    goto MYGOD两;
                }
                if (get_class($value两) != &#39;PhpParser\Node\Stmt\Goto_&#39; && get_class($value两) != &#39;PhpParser\Node\Stmt\Label&#39;) {
                    $firset_data[] = &$value二;
                }
                if (get_class($value二) == &#39;PhpParser\Node\Stmt\Return_&#39;) {
                    // code...
                    goto MYGOD两;
                }
                if (!empty($value两->expr)) {
                    if (get_class($value二->expr) == &#39;PhpParser\Node\Expr\Exit_&#39;) {
                        // code...
                        // var_dump(get_class($value两->expr));
                        goto MYGOD二;
                    }
                }
                if (!empty($value二->name->nextgoto)) {
                    $nextgoto_new = $value两->name->nextgoto;
                    if($type == $this->switchType && empty($newdata[$nextgoto_new])){
                        $attributes = array();
                        $breakStd = new \PhpParser\Node\Stmt\Break_(null,$attributes);
                        $firset_data[] = $breakStd;
                    }
                    if(!empty($stopStr)){
                        if($value两->name->nextgoto == $stopStr){
                            goto MYGOD两;
                        }
                    }

                    $lastKey = $key两;
                    goto MYGOD;
                }
            }
        }
        MYGOD两:
        return $firset_data;
    }

   //提与if的语句
    public function extractIfData($newdata,$nextgoto_new,$lastLabel=""){
        $ifDataArray = [];
//        $lastLabel = "";
        while (!empty($nextgoto_new)){
            if(!empty($newdata[$nextgoto_new]) && !strstr($this->allFindLabel, $nextgoto_new)){
                $this->allFindLabel = $this->allFindLabel.$nextgoto_new.";";
                $value = $newdata[$nextgoto_new];
                if (get_class($value) == &#39;PhpParser\Node\Stmt\If_&#39;) {
                    if(empty($value->name)){
                        $value->name = new \stdClass();
                    }
                    if(empty($value->name->lastLabelOne)){
                        $value->name->lastLabelOne = $lastLabel;
                    }else{
                        $value->name->lastLabelTwo = $lastLabel;
                    }
                    $ifDataArray[$nextgoto_new] = $value;
                    if(!empty($value->stmts) && !empty($value->stmts[0]->name->name)){
                        if (get_class($value) != &#39;PhpParser\Node\Stmt\Goto_&#39; && get_class($value) != &#39;PhpParser\Node\Stmt\Label&#39;){
                            $lastLabel = $nextgoto_new;
                        }
                        $insideArray = $this->extractIfData($newdata,$value->stmts[0]->name->name,$lastLabel);
                        $ifDataArray = array_merge($ifDataArray,$insideArray);
                    }
                }
                if (!empty($value->name->nextgoto)) {
                    if (get_class($value) != &#39;PhpParser\Node\Stmt\Goto_&#39; && get_class($value) != &#39;PhpParser\Node\Stmt\Label&#39;){
                        $lastLabel = $nextgoto_new;
                    }
//                    $lastLabel = $nextgoto_new;
                    $nextgoto_new = $value->name->nextgoto;
                }else{
                    $nextgoto_new = "";
                }
            }else {
                $nextgoto_new = "";
            }
        }

        return $ifDataArray;
    }

    //把if按依次排
    public function sortIfData($newdata,$nextgoto_new)
    {
        $this->allFindLabel = "";
        $ifDataArray = [];
//        $allDataArray = [];
        if(empty($newdata)){
            return $ifDataArray;
        }

        $ifDataArray = $this->extractIfData($newdata,$nextgoto_new);

        $otherDataArray = array();
        foreach ($newdata as $key => $value){
            if(empty($ifDataArray[$key])){
//                $ifDataArray[$key] = $value;
                $otherDataArray[$key] = $value;
            }
        }

        $allDataArray = array_merge_recursive($otherDataArray,$ifDataArray);
        return $allDataArray;
    }


    public function checkdata两($firset_data, &$newdata, $nextgoto_new,$type = 0,$stopStr="",$nowKey="")
    {
        $start_nextgot = $nextgoto_new;
        $this->allFindLabel = "";
        if(!empty($nowKey)){
            $this->allFindLabel = $nowKey.",";
        }
        if(empty($newdata)){
            return $firset_data;
        }

        $lastKey = "";
        MYGOD:
        foreach ($newdata as $key两 => $value两) {
            if ($nextgoto_new == $key二) {
                if(!strstr($this->allFindLabel, $key两)){
                    $this->allFindLabel = $this->allFindLabel.$key二.",";
                }else{
                    if($nowKey == $key二){
                        $newdata["$nowKey"]->name->isWhile = &$this->existValue;
                    }
                    goto MYGOD两;
                }
                if (get_class($value二) != &#39;PhpParser\Node\Stmt\Goto_&#39; && get_class($value二) != &#39;PhpParser\Node\Stmt\Label&#39;) {
                    $firset_data[] = $value两;
                }
                if (get_class($value两) == &#39;PhpParser\Node\Stmt\Return_&#39;) {
                    // code...
                    goto MYGOD两;
                }
                if (!empty($value两->expr)) {
                    if (get_class($value二->expr) == &#39;PhpParser\Node\Expr\Exit_&#39;) {
                        goto MYGOD两;
                    }
                }
                //末了一个label
                if(!empty($value二->name->exitFinish) && $value两->name->exitFinish == 1 && get_class($value二) == &#39;PhpParser\Node\Stmt\Label&#39;){
                    if(!empty($nowKey) && get_class($newdata[$nowKey]) == &#39;PhpParser\Node\Stmt\If_&#39;){
                        if($start_nextgot != $newdata[$nowKey]->name->nextgoto){
                            $attributes = array();
                            $attributes[&#39;kind&#39;] = 1;
                            $exitStd = new \PhpParser\Node\Expr\Exit_(null,$attributes);
                            $expressionStd = new \PhpParser\Node\Stmt\Expression($exitStd,$attributes);
                            $firset_data[] = $expressionStd;
                        }
                    }
                }

                if (!empty($value两->name->nextgoto)) {
                    $nextgoto_new = $value两->name->nextgoto;
                    if($type == $this->switchType && empty($newdata[$nextgoto_new])){
                        $attributes = array();
                        $breakStd = new \PhpParser\Node\Stmt\Break_(null,$attributes);
                        $firset_data[] = $breakStd;
                    }
                    if(!empty($stopStr)){
                        if($value二->name->nextgoto == $stopStr){
                            goto MYGOD两;
                        }
                    }

                    $lastKey = $key二;
                    goto MYGOD;
                }
            }
        }
        MYGOD两:
        return $firset_data;
    }

    //查抄if语句局部的代码能否须要反向解稀
    public function checkIfData($newdata,$type)
    {
        foreach ($newdata as $key => $value) {
            if (get_class($value) == &#39;PhpParser\Node\Stmt\If_&#39; || get_class($value) == &#39;PhpParser\Node\Stmt\Foreach_&#39;) {
                // halt($value);
                if (!empty($value->stmts[0]->name->name)) {
                    $insideLabel  = $value->stmts[0]->name->name;
                    if(!empty($newdata[$insideLabel])){
                        $firset_data = [];
//                        if($key == "YwAsH"){
//                            echo "UZkI3";
//                        }
                        if (get_class($value) == &#39;PhpParser\Node\Stmt\If_&#39; && !empty($value->name->nextgoto)){
                            $firstStr = $this->findIFLabel($value->stmts[0]->name->name, $newdata);
                            if(!empty($firstStr) && empty($newdata[$firstStr]->name->nextgoto) && !empty($newdata[$firstStr]->name->finish) &&
                                $newdata[$firstStr]->name->finish == "1"){
                                if(!empty($newdata[$firstStr]->name->otherFinishLabel)){
                                    $firstStr = $newdata[$firstStr]->name->otherFinishLabel;
                                }
                            }
//                            echo "key:".$key.";";
                            $this->allFindLabelStr = "";
                            $nextStr = $this->compareNextLabel($value->name->nextgoto, $newdata,$firstStr,$type,$key);
                            if(!empty($nextStr) && !empty($value->name->whileLabel) && $nextStr == $newdata[$value->name->whileLabel]->name->nextgoto){
                                $nextStr = "";
                            }elseif(!empty($value->name->whileLabel) && $value->name->whileLabel == $value->name->nextgoto){
                                $nextStr = "";
                                $value->name->isChange = "";
                            }
                            if(!empty($nextStr) || !empty($value->name->isChange) || !empty($value->name->isWhile) || !empty($value->name->isBreak)){
//                               //前提跳转跟高一句的nextgoto跳转雷同
//                               //前提须要反向的处置惩罚
                                if(get_class($value->cond) == &#39;PhpParser\Node\Expr\BooleanNot&#39;){
                                    $tempCond = $value->cond->expr;
                                    $value->cond = $tempCond;
                                }else{
                                    $tempCond = $value->cond;
                                    $attributes = $tempCond->getAttributes();;
                                    $user = new \PhpParser\Node\Expr\BooleanNot($tempCond,$attributes);
                                    $value->cond = $user;
                                }
                                $value->stmts[0]->name->name = $value->name->nextgoto;
                                $value->name->nextgoto = $firstStr;

                                if(!empty($value->name->isInsideLoop) && empty($value->name->isWhile)){
                                    $value->name->stopgoto = $value->name->isInsideLoop;
                                    $value->name->isWhile = &$this->existValue;
                                }

                                if(!empty($value->name->isWhile) && !empty($this->allFindLabelStr)){
                                    $this->allFindLabel = $key.",";
                                    $this->setWhileData($value->stmts[0]->name->name,$newdata,$key);
                                }
                                if(!empty($nextStr)){
                                    $value->name->stopgoto = $nextStr;
                                }elseif(!empty($value->name->isChange)){
                                    $value->name->stopgoto = $value->name->isChange;
                                    if(!empty($value->name->isWhile)){
                                        $checkDataResult = $this->packageData($firset_data, $newdata, $value->stmts[0]->name->name,$key);
                                    }else{
                                        $checkDataResult = $this->packageData($firset_data, $newdata, $value->stmts[0]->name->name);
                                    }
                                    $firset_data = [];
                                    $checkNextDataResult = $this->packageData($firset_data, $newdata, $value->name->nextgoto,$value->name->stopgoto);
                                    $sameNodeStr = $this->selectSameNode($checkDataResult,$checkNextDataResult);
                                    if(!empty($sameNodeStr)){
                                        //具有else的环境
                                        $value->name->elseStr = $sameNodeStr;
                                        $newdata[$key]->name->oldnextgoto = $value->name->nextgoto;
                                        $newdata[$key]->name->nextgoto = $sameNodeStr;
                                        $value->name->stopgoto = "";
                                    }
                                }elseif(!empty($value->name->isWhile) && empty($value->name->stopgoto)){
                                    $value->name->stopgoto = $key;
                                }
                                else {
//                                    $value->name->stopgoto = $value->name->isBreak;
                                }
                            }elseif(!empty($value->name->isInsideLoop)){
                                $value->name->stopgoto = $value->name->isInsideLoop;
                                $value->name->isWhile = &$this->existValue;
                            }
                            else{
                                if(!empty($value->name->whileLabel)){
                                    $whileLabel = $value->name->whileLabel;
                                }else{
                                    $whileLabel = "";
                                }
                                $checkDataResult = $this->packageData($firset_data, $newdata, $insideLabel,$whileLabel);
                                $checkNextDataResult = $this->packageData($firset_data, $newdata, $value->name->nextgoto,$whileLabel);
                                $sameNodeStr = $this->selectSameNode($checkDataResult,$checkNextDataResult);
                                if(!empty($sameNodeStr)){
                                    //具有else的环境
                                    $value->name->elseStr = $sameNodeStr;
                                    $newdata[$key]->name->oldnextgoto = $value->name->nextgoto;
                                    $newdata[$key]->name->nextgoto = $sameNodeStr;
                                }
                            }
                            $newdata[$key]->name->oldIfLabel = $key;
                        }
                    }
                }
            }
        }
        //措置if外的
        foreach ($newdata as $key => $value) {
            if (get_class($value) == &#39;PhpParser\Node\Stmt\If_&#39; || get_class($value) == &#39;PhpParser\Node\Stmt\Foreach_&#39;) {
                // halt($value);
                if (!empty($value->stmts[0]->name->name)) {
                    foreach ($newdata as $key996 => $value996) {
                        if ($key996 == $value->stmts[0]->name->name) {
                            $firset_data = [];
                            if($type == $this->foreachType || $type == $this->switchType){
                                $code两 = &#39;<必修php break;&#39;;
                                $code两 = $this->parserObj->parse($code二);
                            }else {
                                $code两 = &#39;<必修php return false;&#39;;
                                $code两 = $this->parserObj->parse($code两);
                            }
//                            if($key == "UZkI3"){
//                                echo "UZkI3";
//                            }
                            if (get_class($value) == &#39;PhpParser\Node\Stmt\If_&#39; && !empty($value->name->nextgoto)){
                                if(!empty($value->name->stopgoto)){
                                    if(!empty($value->name->isWhile)){
//                                        $this ->restoreWhile($key,$newdata);
//                                        $checkDataResult = $this->checkdata两($firset_data, $newdata, $key996,$type,$stopStr);
                                      $checkDataResult = $this->checkdata两($firset_data, $newdata,  $value->stmts[0]->name->name,0,$value->name->stopgoto,$key);
                                      $newdata[$key]->stmts = !empty($checkDataResult) 选修 $checkDataResult : $code两;
                                    }else{
                                        $stopStr = $value->name->stopgoto;
                                        $checkDataResult = $this->checkdata两($firset_data, $newdata, $key996,$type,$stopStr,$key);
                                        if(!empty($value->name->whileLabel)){
                                            if(!empty($value->name->isChange)){
                                               $tempWhileLabel = $value->name->isChange;
                                            }else {
                                                $tempWhileLabel = $value->name->whileLabel;
                                            }
                                            //剖断可否有break的环境
                                            $whileLabelNext = $newdata[$tempWhileLabel]->name->nextgoto;
                                            if(strstr($this->allFindLabel,$whileLabelNext)){
                                                $checkDataResult = $this->checkdata二($firset_data, $newdata, $key996,$type,$whileLabelNext,$key);
                                                $attributes = array();
                                                $breakStd = new \PhpParser\Node\Stmt\Break_(null,$attributes);
                                                $checkDataResult[] = $breakStd;
                                            }
                                        }
                                        $newdata[$key]->stmts = !empty($checkDataResult) 必修 $checkDataResult : $code两;
                                    }
                                }elseif(!empty($value->name->elseStr)){
//                                        $this->judgeElseIf($newdata,$sameNodeStr,$key,$key996,$value->name->oldnextgoto,$type);
                                    //具有else的环境
                                    $sameNodeStr = $value->name->elseStr;
                                    $checkDataResult = $this->checkdata两($firset_data, $newdata, $key996,$type,$sameNodeStr,$key);
                                    $newdata[$key]->stmts = $checkDataResult;
                                    $firset_data = [];
                                    $checkNextDataResult = $this->checkdata两($firset_data, $newdata, $value->name->oldnextgoto,$type,$sameNodeStr,$key);
                                    $attributes = array();
                                    $elseStd = new \PhpParser\Node\Stmt\Else_($checkNextDataResult,$attributes);
                                    $newdata[$key]->else = $elseStd;
                                    $newdata[$key]->name->nextgoto = $sameNodeStr;
                                }else{
                                    if(!empty($value->name->whileLabel)){
                                        $stopStr = $value->name->whileLabel;
                                    }else{
                                        $stopStr = "";
                                    }
                                    $checkDataResult = $this->checkdata两($firset_data, $newdata, $key996,$type,$stopStr,$key);
                                    $newdata[$key]->stmts = !empty($checkDataResult) 必修 $checkDataResult : $code两;
                                }
                            }else{
                                $checkDataResult = $this->checkdata二($firset_data, $newdata, $key996,$type,"",$key);
                                $newdata[$key]->stmts = !empty($checkDataResult) 选修 $checkDataResult : $code二;
                            }
                            break;
                        }
                    }
                }
            }
        }
        $this->allFindLabelStr ="";
        foreach ($newdata as $key => $value){
            if (get_class($value) == &#39;PhpParser\Node\Stmt\If_&#39;){
                $this->allFindLabelStr = $key.",";
                if(!empty($value->name->isWhile)){
                    //前提跳转跟高一句的nextgoto跳转相通
                    //前提反向的措置,并把if改成while
                    $oldName = $value->name;
                    $attributes = $value->cond->getAttributes();
                    $whileObj = new \PhpParser\Node\Stmt\While_(  $value->cond,$value->stmts,$attributes);
                    $value = $whileObj;
                    $value->name = $oldName;
                    $newdata[$key] = $value;
                    if( !empty($newdata[$key] ->stmts)){
                        $this->restoreWhile($newdata[$key] ->stmts);
                        $this->allFindLabelStr ="";
                    }
                }elseif(!empty($newdata[$key] ->stmts)){
                    $this->restoreWhile($newdata[$key] ->stmts);
                    $this->allFindLabelStr ="";
                    if(!empty($newdata[$key] ->else->stmts)){
                        $this->restoreWhile($newdata[$key] ->else->stmts);
                        $this->allFindLabelStr ="";
                    }

                }
            }
        }
//        $this->restoreWhile($newdata);
        return $newdata;
    }


//    /* 判定能否具有elseIf的环境 */
//    public function judgeElseIf(&$newdata, $sameNodeStr,$key,$startLabel,$oldnextgoto,$type){
//        $firstStr = $this->findIFLabel($sameNodeStr, $newdata);
//        $elseIfArray = array();
//        while(!empty($firstStr) && !empty($newdata[$firstStr]) && get_class($newdata[$firstStr]) == "PhpParser\Node\Stmt\If_"){
//            $firset_data = [];
//            //具有elseif的环境
//            $checkDataResult = $this->checkdata两($firset_data, $newdata, $startLabel,$type,$sameNodeStr);
//            $newdata[$key]->stmts = $checkDataResult;
//            $checkNextDataResult = $this->checkdata两($firset_data, $newdata, $oldnextgoto,$type,$sameNodeStr);
//            $attributes = array();
            $newdata[$key]->elseifs[] =
//            $elseStd = new \PhpParser\Node\Stmt\Else_($checkNextDataResult,$attributes);
//            $elseIfArray
//            $newdata[$key]->else = $elseStd;
//            $newdata[$key]->name->nextgoto = $sameNodeStr;
//        }
//        if(!empty($firstStr) && !empty($newdata[$firstStr]) && get_class($newdata[$firstStr]) == "PhpParser\Node\Stmt\If_"){
//
//        }
//    }

    public function selectSameNode($startArray, $nextArray){
        $tabelStr = "";
        if(empty($startArray) || empty($nextArray)){
            return $tabelStr;
        }
        $firstArray = array();
        $secondArray = array();
        foreach ($startArray as $key =>$value){
            if(!empty($value->name->isNode) && $value->name->isNode == 1 ){
                $firstArray[$key] = $value;
            }
        }

        foreach ($nextArray as $key =>$value){
            if(!empty($value->name->isNode) && $value->name->isNode == 1 ){
                $secondArray[$key] = $value;
            }
        }
        if(empty($firstArray) || empty($secondArray)){
            return $tabelStr;
        }
        foreach ($secondArray as $key_second =>$value_second){
            foreach ($firstArray as $key_first =>$value_first){
                if($key_second == $key_first){
                    $tabelStr = $key_second;
                    return $tabelStr;
                }
            }

        }
        return $tabelStr;
    }

    //寻觅if语句goto的第一条无效代码的label
    public function findIFLabel($findStr, $res){
        $tabelStr = "";
        foreach ($res as $keyFind => $valueFind) {
            if ($keyFind == $findStr) {
                if(get_class($valueFind) == &#39;PhpParser\Node\Stmt\Goto_&#39;){
                    $tabelStr = $this->findIFLabel($valueFind->name,$res);
                }elseif (get_class($valueFind) == &#39;PhpParser\Node\Stmt\Label&#39; && !empty($valueFind->name->nextgoto)){
                    $tabelStr = $this->findIFLabel($valueFind->name->nextgoto,$res);
                } else{
                    $tabelStr = $keyFind;
                }
                break;
            }
        }
        return $tabelStr;
    }

    public function findFirstNextLabel($findStr, $res,$rowCount){
        $tabelStr = "";
        foreach ($res as $keyFind => $valueFind) {
            if ($keyFind == $findStr) {
                if(get_class($valueFind) == &#39;PhpParser\Node\Stmt\Goto_&#39;){
                    $tabelStr = $this->findFirstNextLabel($valueFind->name,$res,$rowCount);
                }elseif(get_class($valueFind) == &#39;PhpParser\Node\Stmt\Label&#39; && empty($valueFind->stmts)){
                    $tabelStr = $this->findFirstNextLabel($valueFind->name->nextgoto,$res,$rowCount);
                }
                else{
                    if($rowCount != 0){
                        $rowCount = $rowCount - 1;
                        $tabelStr = $this->findFirstNextLabel($valueFind->name->nextgoto,$res,$rowCount);
                    }else{
                        $tabelStr = $keyFind;
                    }
//                    $tabelStr = $keyFind;
                }
                break;
            }
        }
        return $tabelStr;
    }

    public function compareNextLabel两($findStr, &$res,$compareStr,$whileLabel = ""){
        if(empty($compareStr) || empty($res)){
            return "";
        }
        STARTCOMPARE:
        $tabelStr = "";
        if(!empty($res[$findStr])){
            $valueFind = $res[$findStr];
            //断定能否入进逝世轮回
            if(!strstr($this->allFindLabel, $findStr)){
                $this->allFindLabel = $this->allFindLabel.$findStr.",";
            }else{
                return "";
            }
            if(!empty($whileLabel) && $findStr == $whileLabel){
                return "";
            }
            if(get_class($valueFind) == &#39;PhpParser\Node\Stmt\Goto_&#39;){
//                $tabelStr = $this->compareNextLabel两($valueFind->name->name,$res,$compareStr,$whileLabel);
                $findStr = $valueFind->name->name;
                goto STARTCOMPARE;
            }elseif(get_class($valueFind) == &#39;PhpParser\Node\Stmt\Label&#39; && empty($valueFind->stmts) && !empty($valueFind->name->nextgoto)){
//                $tabelStr = $this->compareNextLabel二($valueFind->name->nextgoto,$res,$compareStr,$whileLabel);
                $findStr = $valueFind->name->nextgoto;
                goto STARTCOMPARE;
            }
            else{
                if($findStr == $compareStr){
                    if( $this->checkExistWhile($this->allFindLabelStr,$res)){
                        return "";
                    }
                    $tabelStr = $findStr;
                    goto STOPCOMPARE;
                }else{
                    if(!empty($this->allFindLabel)){
                        $allLabelAry = explode(&#39;,&#39;, $this->allFindLabel);
                        if(count($allLabelAry)>480){
                            return "";
                        }
                    }
                    if(!empty($valueFind->name->nextgoto)){
//                        $tabelStr = $this->compareNextLabel二($valueFind->name->nextgoto,$res,$compareStr,$whileLabel);
                        $findStr = $valueFind->name->nextgoto;
                        goto STARTCOMPARE;
                    }
                }
            }
        }else{
            return "";
        }
        STOPCOMPARE:
        return $tabelStr;
    }


//    public function compareNextLabel二($findStr, &$res,$compareStr,$whileLabel = ""){
//        if(empty($compareStr)){
//            return "";
//        }
//        $tabelStr = "";
//        foreach ($res as $keyFind => $valueFind) {
//            if ($keyFind == $findStr) {
//                //断定可否入进逝世轮回
//                if(!strstr($this->allFindLabel, $keyFind)){
//                    $this->allFindLabel = $this->allFindLabel.$keyFind.",";
                    echo "$this->allFindLabel";
                    echo "<br>";
//                }else{
                    if(get_class($valueFind) == &#39;PhpParser\Node\Stmt\If_&#39;){
                        $tempNextgoto = $valueFind->stmts[0]->name->name;
                        $ifNodeStr = $keyFind;
                    }else{
                        $allLabelAry = explode(&#39;,&#39;, $this->allFindLabel);
                        $ifNodeStr = $allLabelAry[count($allLabelAry)-二];
                        $tempNextgoto = $res[$ifNodeStr] ->stmts[0]->name->name;
                    }
                    $res[$ifNodeStr] ->name->isWhile = &$this->existValue;
//                    $this->restoreWhile($ifNodeStr,$res);
                    $tabelStr = $this->compareNextLabel两($tempNextgoto,$res,$compareStr);
//                      return "";
//                }
//
//                if(!empty($whileLabel) && $keyFind == $whileLabel){
//                    return "";
//                }
//                if(get_class($valueFind) == &#39;PhpParser\Node\Stmt\Goto_&#39;){
//                    $tabelStr = $this->compareNextLabel两($valueFind->name->name,$res,$compareStr,$whileLabel);
//                }elseif(get_class($valueFind) == &#39;PhpParser\Node\Stmt\Label&#39; && empty($valueFind->stmts) && !empty($valueFind->name->nextgoto)){
//                    $tabelStr = $this->compareNextLabel二($valueFind->name->nextgoto,$res,$compareStr,$whileLabel);
//                }
//                else{
//                    if($keyFind == $compareStr){
//                        if( $this->checkExistWhile($this->allFindLabelStr,$res)){
//                            return "";
//                        }
//                        $tabelStr = $keyFind;
//                    }else{
//                        if(!empty($this->allFindLabel)){
//                            $allLabelAry = explode(&#39;,&#39;, $this->allFindLabel);
//                            if(count($allLabelAry)>480){
//                                return "";
//                            }
//                        }
//                        if(!empty($valueFind->name->nextgoto)){
//                            $tabelStr = $this->compareNextLabel二($valueFind->name->nextgoto,$res,$compareStr,$whileLabel);
//                        }
//                    }
//                }
//                break;
//            }
//        }
//        return $tabelStr;
//    }


    //比力后背代码可否有类似的label
    public function compareNextLabel($findStr, &$res,$compareStr,$type=0,$ifKey=""){
        if(empty($compareStr)){
            return "";
        }

        if(empty($this->allFindLabelStr)){
            if(get_class($res[$ifKey]) == &#39;PhpParser\Node\Stmt\If_&#39; && !empty($res[$ifKey]->stmts)){
                $this->allFindLabel = "";
                if(!empty($res[$ifKey]->stmts[0]->name->name)){
                    $tabelStr = $this->compareNextLabel两($res[$ifKey]->stmts[0]->name->name,$res,$ifKey);
                    if(!empty($tabelStr)){
                        if(!empty($res[$ifKey]->name->lastLabelOne) && strstr($this->allFindLabel, $res[$ifKey]->name->lastLabelOne)){
                            echo "tabelStr=".$tabelStr;
                        }else{
  //                        $res[$ifKey]->name->isWhile = &$this->existValue;
                            $res[$ifKey]->name->isInsideLoop = $tabelStr;
                        }
                    }
                }
            }
        }

        $tabelStr = "";
        foreach ($res as $keyFind => $valueFind) {
            if ($keyFind == $findStr) {
                if($keyFind == $ifKey){
                    if( $this->checkExistWhile($this->allFindLabelStr,$res)){
                        return "";
                    }
                    $tempNextgoto = $valueFind->stmts[0]->name->name;
                    $res[$keyFind] ->name->isWhile = &$this->existValue;
//                    $tabelStr = $this->compareNextLabel($tempNextgoto,$res,$compareStr,$type,$ifKey);
                    return $keyFind;
                }

                if(!empty($this->allFindLabelStr)){
                    $allLabelAry = explode(&#39;,&#39;, $this->allFindLabelStr);
                    if(count($allLabelAry)>480){
                        return "";
                    }
                }

                //鉴定能否入进逝世轮回
                if(!strstr($this->allFindLabelStr, $keyFind)){
                    $this->allFindLabelStr = $this->allFindLabelStr.$keyFind.",";
                }else{
                    if(get_class($valueFind) == &#39;PhpParser\Node\Stmt\If_&#39;){
                        $tempNextgoto = $valueFind->stmts[0]->name->name;
                        $ifNodeStr = $keyFind;
                        if($valueFind != $ifKey){
                            $tabelStr = $this->compareNextLabel($tempNextgoto,$res,$compareStr,$type,$ifKey);
                            return $tabelStr;
                        }
                    }else{
                        $allLabelAry = explode(&#39;,&#39;, $this->allFindLabelStr);
                        $ifNodeStr = $allLabelAry[count($allLabelAry)-两];
                        if(get_class( $res[$ifNodeStr]) != &#39;PhpParser\Node\Stmt\If_&#39;){
                            return "";
                        }
                    }
                    $res[$ifNodeStr] ->name->isWhile = &$this->existValue;
//                    $this->restoreWhile($ifNodeStr,$res);
//                    $tabelStr = $this->compareNextLabel($tempNextgoto,$res,$compareStr,$type,$ifKey);
                   return $keyFind;
                }

                if(get_class($valueFind) == &#39;PhpParser\Node\Stmt\If_&#39; && !empty($valueFind->stmts)){
                    $this->allFindLabel = "";
                    if(!empty($valueFind->stmts[0]->name->name)){
                        if(!empty($res[$ifKey]->name->whileLabel)){
                            $whileLabel = $res[$ifKey]->name->whileLabel;
                        }else{
                            $whileLabel = "";
                        }
                        $tabelStr = $this->compareNextLabel两($valueFind->stmts[0]->name->name,$res,$ifKey,$whileLabel);
                        if(!empty($tabelStr)){
                            if(!empty($res[$ifKey]->name->lastLabelOne) && strstr($this->allFindLabel, $res[$ifKey]->name->lastLabelOne)){
                                $tabelStr = "";
                            }else{
                                $res[$ifKey]->name->isWhile = &$this->existValue;
                                $res[$keyFind]->name->isChange = $tabelStr;
                            }
                        }
                    }
                }

                if(get_class($valueFind) == &#39;PhpParser\Node\Stmt\Goto_&#39;){
                    if(empty($res[$valueFind->name->name]) && $type == $this->foreachType){
                        $res[$ifKey]->name->isBreak = $valueFind->name->name;
                    }
                    $tabelStr = $this->compareNextLabel($valueFind->name->name,$res,$compareStr,$type,$ifKey);
                }elseif(get_class($valueFind) == &#39;PhpParser\Node\Stmt\Label&#39; && empty($valueFind->stmts) && !empty($valueFind->name->nextgoto)){
                    $tabelStr = $this->compareNextLabel($valueFind->name->nextgoto,$res,$compareStr,$type,$ifKey);
                }
                else{
                    if($keyFind == $compareStr){
                        $tabelStr = $keyFind;
                    }else{
                        if(!empty($valueFind->name->nextgoto)){
                            $tabelStr = $this->compareNextLabel($valueFind->name->nextgoto,$res,$compareStr,$type,$ifKey);
                        }
                    }
                }
                break;
            }
        }
        return $tabelStr;
    }

    //给while块内里的if语句陈设标签
    public function setWhileData($findStr,&$res,$compareStr,$stopLabel=""){
        if(empty($compareStr)){
            return "";
        }
        $tabelStr = "";
        foreach ($res as $keyFind => $valueFind) {
            if ($keyFind == $findStr) {
                //鉴定能否入进逝世轮回
                if(!strstr($this->allFindLabel, $keyFind)){
                    $this->allFindLabel = $this->allFindLabel.$keyFind.",";
                }else{
                    return "";
                }
                if(get_class($res[$keyFind]) == &#39;PhpParser\Node\Stmt\If_&#39;){
                    $res[$keyFind]->name->whileLabel = $compareStr;
                    if(!empty($valueFind->stmts[0]->name->name)){
                        $tabelStr = $this->setWhileData($valueFind->stmts[0]->name->name,$res,$compareStr,$stopLabel);
                    }
                }
                if(get_class($valueFind) == &#39;PhpParser\Node\Stmt\Goto_&#39;){
                    $tabelStr = $this->setWhileData($valueFind->name->name,$res,$compareStr,$stopLabel);
                }elseif(get_class($valueFind) == &#39;PhpParser\Node\Stmt\Label&#39; && empty($valueFind->stmts) && !empty($valueFind->name->nextgoto)){
                    $tabelStr =
                        $this->setWhileData($valueFind->name->nextgoto,$res,$compareStr,$stopLabel);
                }
                else{
                    if($keyFind == $compareStr){
                        $tabelStr = $keyFind;
                    }else{
                        if(!empty($this->allFindLabel)){
                            $allLabelAry = explode(&#39;,&#39;, $this->allFindLabel);
                            if(count($allLabelAry)>480){
                                return "";
                            }
                        }
                        if(!empty($valueFind->name->nextgoto)){
                            $tabelStr = $this->setWhileData($valueFind->name->nextgoto,$res,$compareStr,$stopLabel);
                        }
                    }
                }
                break;
            }
        }
        return $tabelStr;
    }

    //查抄可否具有while语句
    public function checkExistWhile($allFindStr,$res){
        $allLabelAry = explode(&#39;,&#39;, $allFindStr);
        foreach ($allLabelAry as $key => $value){
            if(!empty($value) && get_class($res[$value]) == "PhpParser\Node\Stmt\If_"){
                if(!empty($res[$value]->name->isWhile) && $res[$value]->name->isWhile == $this->existValue){
                    return true;
                }
            }
        }
        return false;
    }


    //查抄while语句
    public function checkWhile($whileKey,&$res,$whileNext){

        foreach ($res as $key => $value ){
            if(get_class($value) == &#39;PhpParser\Node\Stmt\If_&#39; && empty($value->name->oldIfLabel)){
                if(!empty($value->stmts) && count($value->stmts)>0){
                    $this->checkWhile($whileKey,$value->stmts,$whileNext);
                }
            }elseif(get_class($value) == &#39;PhpParser\Node\Stmt\While_&#39;){
                if(!empty($value->stmts) && count($value->stmts)>0){
                    $this->checkWhile($whileKey,$value->stmts,$whileNext);
                }
            }else {
                if(!empty($value->name->oldIfLabel) && $value->name->oldIfLabel == $whileNext){
                    $attributes = array();
                    $breakStd = new \PhpParser\Node\Stmt\Break_(null,$attributes);
                    $res[$key] = $breakStd;
                }
            }
        }
    }

    //回复复兴while语句
    public function restoreWhile(&$res){
        foreach ($res as $key => $value){
            if (get_class($value) == &#39;PhpParser\Node\Stmt\If_&#39;){
                if(empty($res[$key]->name->oldIfLabel)){
                    continue;
                }
                $ifLabel = $res[$key]->name->oldIfLabel;
                if(!strstr($this->allFindLabelStr, $ifLabel)){
                    $this->allFindLabelStr = $this->allFindLabelStr.$ifLabel.",";
//                    $failLabel = "t6X3c,IxelL,OTFhY,Ab4dP,c4iI1,wWVDk,aBDVw,cGQ二R,Hhab6,hxI8v";
//                    if(strstr($failLabel,$ifLabel)){
//                        echo $ifLabel;
//                    }
                }else{
//                    if($ifLabel == "aBDVw"){
//                        echo $ifLabel;
//                    }
//                    echo $ifLabel."反复=".$this->allFindLabelStr.";<br>";
                }
                if(!empty($value->name->isWhile)){
                    //前提跳转跟高一句的nextgoto跳转类似
                    //前提反向的处置,并把if改成while
                    $oldName = $value->name;
                    $attributes = $value->cond->getAttributes();
                    $whileObj = new \PhpParser\Node\Stmt\While_(  $value->cond,$value->stmts,$attributes);
                    $value = $whileObj;
                    $value->name = $oldName;
                    $res[$key] = $value;
                    if( !empty($res[$key] ->stmts)){
                        $this->restoreWhile($res[$key] ->stmts);
                    }
                }elseif(!empty($res[$key] ->stmts)){
                        $this->restoreWhile($res[$key] ->stmts);
                        if(!empty($res[$key] ->else->stmts)){
                            $this->restoreWhile($res[$key] ->else->stmts);
                        }
                }
            }
        }
    }

    public function getPrettyCode($prettyPrinter, $res){
        $res_code = "";
        if(!empty($res)){
            $arrayLength = count($res);
            $tempArray = array();
            $find = array("必修>\n","选修>","<必修php","<必修php");
            for($i = 0;$i < $arrayLength;$i++){
                if (get_class($res[$i]) == &#39;PhpParser\Node\Stmt\Switch_&#39;&& !empty($res[$i]->cases) && count($res[$i]->cases)>0) {
                    foreach ($res[$i]->cases as $key两 => $value两) {
                        if (!empty($value两->stmts) && count($value二->stmts)>0) {
                            echo date(&#39;h:i:s&#39;, time())."         YY/";
                            $if_code = $this->getPrettyCode($prettyPrinter, $value两->stmts);
                            if(!empty($this->parserObj)){
                                $if_code = str_ireplace( $find,"",$if_code,$count);
                                $this->replaceTip = $this->parserObj->parse($if_code);
                            }
                            $value二->stmts = $this->replaceTip;
                            $tempArray[0] = $value两;
                            $old_code = $prettyPrinter->prettyPrint($tempArray);
                            $one_code = str_ireplace( $find,"",$old_code,$count);
                            echo date(&#39;h:i:s&#39;, time())."         YY/";
                            $memoryValue = number_format(memory_get_usage());
                            echo $memoryValue . "      /";
                            echo date(&#39;h:i:s&#39;, time())."         /";
                        }
                    }
                    $tempArray[0] = $res[$i];
                    $old_code = $prettyPrinter->prettyPrint($tempArray);
                    $one_code = str_ireplace( $find,"",$old_code,$count);
                }else if(get_class($res[$i]) == &#39;PhpParser\Node\Stmt\If_&#39; && !empty($res[$i]->stmts) && count($res[$i]->stmts)>0){
                        $if_code = $this->getPrettyCode($prettyPrinter, $res[$i]->stmts);
                        if(!empty($this->parserObj)){

                            $if_code = str_ireplace( $find,"",$if_code,$count);
                            $this->replaceTip = $this->parserObj->parse($if_code);
                        }
                        $res[$i]->stmts = $this->replaceTip;
                        $tempArray[0] = $res[$i];
                        $old_code = $prettyPrinter->prettyPrint($tempArray);
//                        $one_code = str_ireplace( $this->replaceTipStr,$if_code,$old_code,$count);
                        $one_code = str_ireplace( $find,"",$old_code,$count);
                        $this->printCount = $this->printCount +1;

                }else if(get_class($res[$i]) == &#39;PhpParser\Node\Stmt\Foreach_&#39; && !empty($res[$i]->stmts) && count($res[$i]->stmts)>0){
                    $if_code = $this->getPrettyCode($prettyPrinter, $res[$i]->stmts);
                    if(!empty($this->parserObj)){
                        $if_code = str_ireplace( $find,"",$if_code,$count);
                        $this->replaceTip = $this->parserObj->parse($if_code);
                    }
                    $res[$i]->stmts = $this->replaceTip;
                    $tempArray[0] = $res[$i];
                    $old_code = $prettyPrinter->prettyPrint($tempArray);
//                        $one_code = str_ireplace( $this->replaceTipStr,$if_code,$old_code,$count);
                    $one_code = str_ireplace( $find,"",$old_code,$count);

                     $this->printCount二 = $this->printCount两 +1;
                }
                else{
                    $tempArray[0] = $res[$i];
                    $one_code = $prettyPrinter->prettyPrint($tempArray);
                    $this->printCount1 = $this->printCount1 +1;
                }
                $res_code = $res_code.$one_code;
            }
        }
        return $res_code;
    }


    public function prettyWriteCode($fileName,$prettyPrinter, $res){
        if(!empty($res)){
            $arrayLength = count($res);
            $myfile = fopen($fileName, "a+") or die("Unable to open file!");
            $tempArray = array();
            for($i = 0;$i < $arrayLength;$i++){
                $tempArray[0] = $res[$i];
                $res_code = $prettyPrinter->prettyPrint($tempArray);
                if($i == 0){
                    $res_code = "<必修php" . "\n" . $res_code;
                }
                echo "i=".$i."\n";
                fwrite($myfile, $res_code);
            }
            fclose($myfile);
        }
    }
    public function writeFile($fileName, $content)
    {
        $myfile = fopen($fileName, "w") or die("Unable to open file!");
        fwrite($myfile, $content);
        fclose($myfile);
    }
}
登录后复造

推举进修:php视频学程

以上便是来咯,您念要的goto解稀剧本它实的来咯!的具体形式,更多请存眷萤水红IT仄台另外相闭文章!

点赞(7) 打赏

评论列表 共有 0 条评论

暂无评论

微信小程序

微信扫一扫体验

立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部