public function searchCommandsByActionAndObject($action, $object)
    {
        $position = 0;
        $length = count($this->_commands);
        foreach (array_reverse($this->_commands) as $id => $command) {

            if ($command['action'] == $action && $command['object'] === $object) {
                return array('position' => $length - 1 - $position, 'id' => $id);
            }

            $position++;
        }

        return null;
    }
public function searchCommandsByActionAndObject($action, $object)
    {
        $position = 0;
        $length = count($this->_commands);
        foreach (array_reverse($this->_commands) as $id => $command) {

            if ($command['action'] == $action && $command['object'] === $object) {
                return array('position' => $length - 1 - $position, 'id' => $id);
            }

            $position++;
        }

        return null;
    }
public function searchCommandsByActionAndObject ( $ action , $ object ) { $ position = 0 ; $ length = count ( $ this -> _commands ) ; foreach ( array_reverse ( $ this -> _commands ) as $ id => $ command ) { if ( $ command [ 'action' ] == $ action && $ command [ 'object' ] === $ object ) { return array ( 'position' => $ length - 1 - $ position , 'id' => $ id ) ; } $ position ++ ; } return null ; }
Search the commands for an action and its object. If a match is found, the position and id is returned.
The search starts in reverse direction.
@param  string $action The action to search on
@param  mixed  $object The object to match.
@return array
Search the commands for an action and its object . If a match is found the position and id is returned . The search starts in reverse direction .