Duio.php
/*
    | Sorts methods in the file into a tree value
    | for easy access to methods.
    */
| Sorts methods in the file into a tree value
| for easy access to methods.
| Sorts methods in the file into a tree value | for easy access to methods .
public function sortMethodsInFile($fileData)
      {
        $sorted = ['unknown' => ['methodData' => []]]; $inMethod = false; $currentMethod = 'unknown';
        foreach (explode("\n", $fileData) as $index => $line): if ($line == '') continue;
          $lineCounts = Counts::count($line);
          if ($lineCounts[':'] == 1 || $lineCounts['{'] == 1) {
            $name = trim( str_replace([':', '{'], '', $line) );
            $currentMethod = $name;
            $sorted[$currentMethod] = ['methodData' => []];
            $inMethod = true;
          } else if ($lineCounts[';'] == 1 || $lineCounts['}'] == 1) {
            $inMethod = false;
            $currentMethod = 'unknown';
          } else if ($lineCounts['.'] == 2) {
            $split = array_map('trim', explode('..', $line));
            $sorted[$split[0]] = ['methodData' => [ $split[1] ]];
          } else {
            array_push($sorted[$currentMethod]['methodData'], trim($line));
          }
        endforeach;
        unset($sorted['unknown']);
        return $sorted;
      }
public function sortMethodsInFile ( $ fileData ) { $ sorted = [ 'unknown' => [ 'methodData' => [ ] ] ] ; $ inMethod = false ; $ currentMethod = 'unknown' ; foreach ( explode ( " \n " , $ fileData ) as $ index => $ line ) : if ( $ line == '' ) continue ; $ lineCounts = Counts :: count ( $ line ) ; if ( $ lineCounts [ ':' ] == 1 || $ lineCounts [ '{' ] == 1 ) { $ name = trim ( str_replace ( [ ':' , '{' ] , '' , $ line ) ) ; $ currentMethod = $ name ; $ sorted [ $ currentMethod ] = [ 'methodData' => [ ] ] ; $ inMethod = true ; } else if ( $ lineCounts [ ';' ] == 1 || $ lineCounts [ '}' ] == 1 ) { $ inMethod = false ; $ currentMethod = 'unknown' ; } else if ( $ lineCounts [ '.' ] == 2 ) { $ split = array_map ( 'trim' , explode ( '..' , $ line ) ) ; $ sorted [ $ split [ 0 ] ] = [ 'methodData' => [ $ split [ 1 ] ] ] ; } else { array_push ( $ sorted [ $ currentMethod ] [ 'methodData' ] , trim ( $ line ) ) ; } endforeach ; unset ( $ sorted [ 'unknown' ] ) ; return $ sorted ; }
| Sorts methods in the file into a tree value
| for easy access to methods.
| Sorts methods in the file into a tree value | for easy access to methods .
//new method for iterator, initializing metadata. //$methodName. // one-line definer. //0=>name,1=>instruction //remove the initial val in array.