/** * Add a <code>FileNameMapper</code>. * @param FileNameMapper $fileNameMapper a <code>FileNameMapper</code>. * @throws BadMethodCallException if attempting to add this * <code>ContainerMapper</code> to itself, or if the specified * <code>FileNameMapper</code> is itself a <code>ContainerMapper</code> * that contains this <code>ContainerMapper</code>. */ public function add(Mapper $fileNameMapper) { if ($this == $fileNameMapper || $fileNameMapper instanceof ContainerMapper && $fileNameMapper->contains($this)) { throw new BadMethodCallException("Circular mapper containment condition detected"); } else { $this->mappers[] = $fileNameMapper; } }