public static function run($operations)
    {
        while (true) {
            $results = self::optimize($operations);
            if ($results == $operations) {
                return $results;
            }
            $operations = $results;
        }
    }
public static function run($operations)
    {
        while (true) {
            $results = self::optimize($operations);
            if ($results == $operations) {
                return $results;
            }
            $operations = $results;
        }
    }
public static function run ( $ operations ) { while ( true ) { $ results = self :: optimize ( $ operations ) ; if ( $ results == $ operations ) { return $ results ; } $ operations = $ results ; } }
Main optimization entry point. Pass in a list of Operation instances,
get out a new list of Operation instances.

Unfortunately, due to the scope of the optimization (two combinable
operations might be separated by several
hundred others), this can't be done as a peephole optimization with
checks/output implemented on
the Operations themselves; instead, the optimizer looks at each
individual operation and scans forwards in
the list to see if there are any matches, stopping at
boundaries - operations which can't  be optimized over
(RunSQL, operations on the same field/model, etc.).

The inner loop is run until the starting list is the same as the result
list, and then the result is returned.
This means that operation optimization must be stable and always return
an equal or shorter list.

@param $operations

@return mixed

@since  1.1.0

@author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>
Main optimization entry point . Pass in a list of Operation instances get out a new list of Operation instances .