SimpleSignatureMap::findFirstAction PHP Method

findFirstAction() public method

Searches the call list for a matching parameter set. Returned by reference.
public findFirstAction ( array $parameters ) : object
$parameters array Parameters to search by without wildcards.
return object Object held in the first matching slot, otherwise null.
    public function findFirstAction($parameters)
    {
        $slot = $this->findFirstSlot($parameters);
        if (isset($slot) && isset($slot['content'])) {
            return $slot['content'];
        }
        return;
    }

Usage Example

コード例 #1
0
 function testOrdering()
 {
     $map = new SimpleSignatureMap();
     $map->add(array(1, 2), new SimpleByValue("1, 2"));
     $map->add(array(1, 3), new SimpleByValue("1, 3"));
     $map->add(array(1), new SimpleByValue("1"));
     $map->add(array(1, 4), new SimpleByValue("1, 4"));
     $map->add(array(new AnythingExpectation()), new SimpleByValue("Any"));
     $map->add(array(2), new SimpleByValue("2"));
     $map->add("", new SimpleByValue("Default"));
     $map->add(array(), new SimpleByValue("None"));
     $this->assertEqual($map->findFirstAction(array(1, 2)), new SimpleByValue("1, 2"));
     $this->assertEqual($map->findFirstAction(array(1, 3)), new SimpleByValue("1, 3"));
     $this->assertEqual($map->findFirstAction(array(1, 4)), new SimpleByValue("1, 4"));
     $this->assertEqual($map->findFirstAction(array(1)), new SimpleByValue("1"));
     $this->assertEqual($map->findFirstAction(array(2)), new SimpleByValue("Any"));
     $this->assertEqual($map->findFirstAction(array(3)), new SimpleByValue("Any"));
     $this->assertEqual($map->findFirstAction(array()), new SimpleByValue("Default"));
 }
All Usage Examples Of SimpleSignatureMap::findFirstAction