Generator/Collection/ComponentCollection.php
public function getMatchingComponent($component, $requesting_component) {
    if (is_null($requesting_component)) {
      return;
    }

    if (!$component->getMergeTag()) {
      return NULL;
    }

    // We've not added $component yet (and might not), so we don't know have
    // any data about it. So we need to use the requesting component to get the
    // closest requesting root.
    $requesting_component_id = $this->getComponentKey($requesting_component);
    if (isset($this->roots[$requesting_component_id])) {
      // If the requesting component is a root, it's obviously the closest
      // requesting root. But getClosestRequestingRootComponent() would not
      // give us this, as root's closest requester is not itself.
      $closest_requesting_root_id = $requesting_component_id;
    }
    else {
      $closest_requesting_root_id = $this->getComponentKey($this->getClosestRequestingRootComponent($requesting_component));
    }

    if (isset($this->mergeTags[$closest_requesting_root_id][$component->getType()][$component->getMergeTag()])) {
      $matching_component_id = $this->mergeTags[$closest_requesting_root_id][$component->getType()][$component->getMergeTag()];
      return $this->components[$matching_component_id];
    }
  }
public function getMatchingComponent($component, $requesting_component) {
    if (is_null($requesting_component)) {
      return;
    }

    if (!$component->getMergeTag()) {
      return NULL;
    }

    // We've not added $component yet (and might not), so we don't know have
    // any data about it. So we need to use the requesting component to get the
    // closest requesting root.
    $requesting_component_id = $this->getComponentKey($requesting_component);
    if (isset($this->roots[$requesting_component_id])) {
      // If the requesting component is a root, it's obviously the closest
      // requesting root. But getClosestRequestingRootComponent() would not
      // give us this, as root's closest requester is not itself.
      $closest_requesting_root_id = $requesting_component_id;
    }
    else {
      $closest_requesting_root_id = $this->getComponentKey($this->getClosestRequestingRootComponent($requesting_component));
    }

    if (isset($this->mergeTags[$closest_requesting_root_id][$component->getType()][$component->getMergeTag()])) {
      $matching_component_id = $this->mergeTags[$closest_requesting_root_id][$component->getType()][$component->getMergeTag()];
      return $this->components[$matching_component_id];
    }
  }
public function getMatchingComponent ( $ component , $ requesting_component ) { if ( is_null ( $ requesting_component ) ) { return ; } if ( ! $ component -> getMergeTag ( ) ) { return NULL ; } // We've not added $component yet (and might not), so we don't know have // any data about it. So we need to use the requesting component to get the // closest requesting root. $ requesting_component_id = $ this -> getComponentKey ( $ requesting_component ) ; if ( isset ( $ this -> roots [ $ requesting_component_id ] ) ) { // If the requesting component is a root, it's obviously the closest // requesting root. But getClosestRequestingRootComponent() would not // give us this, as root's closest requester is not itself. $ closest_requesting_root_id = $ requesting_component_id ; } else { $ closest_requesting_root_id = $ this -> getComponentKey ( $ this -> getClosestRequestingRootComponent ( $ requesting_component ) ) ; } if ( isset ( $ this -> mergeTags [ $ closest_requesting_root_id ] [ $ component -> getType ( ) ] [ $ component -> getMergeTag ( ) ] ) ) { $ matching_component_id = $ this -> mergeTags [ $ closest_requesting_root_id ] [ $ component -> getType ( ) ] [ $ component -> getMergeTag ( ) ] ; return $ this -> components [ $ matching_component_id ] ; } }
Get the component that matches the type and merge tag, if any.

@param $component
The component to find a match for, not yet in the collection.
@param $requesting_component
The component that is requesting the component to match.

@return
Either a component that's in the collection and matches the given
component, or NULL if nothing was found.
Get the component that matches the type and merge tag if any .