public function return_consecutively($array_of_values, $keep_returning_last_value=false)
    {
        foreach ($this->policies as $policy) {
            foreach ($array_of_values as $value) {
                $policy->check_method_return_value($this->className, $this->methodName, $value, true);
            }
        }

        // $this->returned_values = array_merge($this->returned_values, $array_of_values);
        $this->will = function () use ($array_of_values, $keep_returning_last_value) {
            static $counter = -1;
            $counter++;
            if ($counter == count($array_of_values)) {
                if ($keep_returning_last_value) {
                    return $array_of_values[count($array_of_values)-1];
                }
            } else {
                return $array_of_values[$counter];
            }
        };
        if (!$keep_returning_last_value) {
            $this->times(count($array_of_values));
        }

        return $this;
    }
public function return_consecutively($array_of_values, $keep_returning_last_value=false)
    {
        foreach ($this->policies as $policy) {
            foreach ($array_of_values as $value) {
                $policy->check_method_return_value($this->className, $this->methodName, $value, true);
            }
        }

        // $this->returned_values = array_merge($this->returned_values, $array_of_values);
        $this->will = function () use ($array_of_values, $keep_returning_last_value) {
            static $counter = -1;
            $counter++;
            if ($counter == count($array_of_values)) {
                if ($keep_returning_last_value) {
                    return $array_of_values[count($array_of_values)-1];
                }
            } else {
                return $array_of_values[$counter];
            }
        };
        if (!$keep_returning_last_value) {
            $this->times(count($array_of_values));
        }

        return $this;
    }
public function return_consecutively ( $ array_of_values , $ keep_returning_last_value = false ) { foreach ( $ this -> policies as $ policy ) { foreach ( $ array_of_values as $ value ) { $ policy -> check_method_return_value ( $ this -> className , $ this -> methodName , $ value , true ) ; } } // $this->returned_values = array_merge($this->returned_values, $array_of_values); $ this -> will = function ( ) use ( $ array_of_values , $ keep_returning_last_value ) { static $ counter = - 1 ; $ counter ++ ; if ( $ counter == count ( $ array_of_values ) ) { if ( $ keep_returning_last_value ) { return $ array_of_values [ count ( $ array_of_values ) - 1 ] ; } } else { return $ array_of_values [ $ counter ] ; } } ; if ( ! $ keep_returning_last_value ) { $ this -> times ( count ( $ array_of_values ) ) ; } return $ this ; }
Specifies that each subsequent invocation of this method will take the subsequent value from the array as the return value.

The sequence of values to return is not affected by ordering constraints on the mock (ie, order_matters()).

<pre>
$shmock->notify()->return_consecutively(["called!", "called again!", "called a third time!"]);

$mock = $shmock->replay(); // replay is automatically called at the end of \Shmock\Shmock::create()

$mock->notify(); // called!
$mock->notify(); // called again!
$mock->notify(); // called a third time!
</pre>
@param mixed[]      $array_of_values           the sequence of values to return.
@param boolean|void $keep_returning_last_value whether to continue returning the last element in the sequence
or to fail the count expectation after every sequence element has been used. Defaults to false.
@return \Shmock\Spec
Specifies that each subsequent invocation of this method will take the subsequent value from the array as the return value .