src/Compiler.php
protected function sortArgs($prototype, $args)
    {
        $keyArgs = [];
        $posArgs = [];

        // separate positional and keyword arguments
        foreach ($args as $arg) {
            list($key, $value) = $arg;

            $key = $key[1];

            if (empty($key)) {
                $posArgs[] = empty($arg[2]) ? $value : $arg;
            } else {
                $keyArgs[$key] = $value;
            }
        }

        if (! isset($prototype)) {
            return [$posArgs, $keyArgs];
        }

        // copy positional args
        $finalArgs = array_pad($posArgs, count($prototype), null);

        // overwrite positional args with keyword args
        foreach ($prototype as $i => $names) {
            foreach ((array) $names as $name) {
                if (isset($keyArgs[$name])) {
                    $finalArgs[$i] = $keyArgs[$name];
                }
            }
        }

        return [$finalArgs, $keyArgs];
    }
protected function sortArgs($prototype, $args)
    {
        $keyArgs = [];
        $posArgs = [];

        // separate positional and keyword arguments
        foreach ($args as $arg) {
            list($key, $value) = $arg;

            $key = $key[1];

            if (empty($key)) {
                $posArgs[] = empty($arg[2]) ? $value : $arg;
            } else {
                $keyArgs[$key] = $value;
            }
        }

        if (! isset($prototype)) {
            return [$posArgs, $keyArgs];
        }

        // copy positional args
        $finalArgs = array_pad($posArgs, count($prototype), null);

        // overwrite positional args with keyword args
        foreach ($prototype as $i => $names) {
            foreach ((array) $names as $name) {
                if (isset($keyArgs[$name])) {
                    $finalArgs[$i] = $keyArgs[$name];
                }
            }
        }

        return [$finalArgs, $keyArgs];
    }
protected function sortArgs ( $ prototype , $ args ) { $ keyArgs = [ ] ; $ posArgs = [ ] ; // separate positional and keyword arguments foreach ( $ args as $ arg ) { list ( $ key , $ value ) = $ arg ; $ key = $ key [ 1 ] ; if ( empty ( $ key ) ) { $ posArgs [ ] = empty ( $ arg [ 2 ] ) ? $ value : $ arg ; } else { $ keyArgs [ $ key ] = $ value ; } } if ( ! isset ( $ prototype ) ) { return [ $ posArgs , $ keyArgs ] ; } // copy positional args $ finalArgs = array_pad ( $ posArgs , count ( $ prototype ) , null ) ; // overwrite positional args with keyword args foreach ( $ prototype as $ i => $ names ) { foreach ( ( array ) $ names as $ name ) { if ( isset ( $ keyArgs [ $ name ] ) ) { $ finalArgs [ $ i ] = $ keyArgs [ $ name ] ; } } } return [ $ finalArgs , $ keyArgs ] ; }
Sorts keyword arguments

@param array $prototype
@param array $args

@return array
Sorts keyword arguments