src/Aggregator.php
public function add(DeclarationInterface $element): Aggregator
    {
        $reflector = new \ReflectionObject($element);

        $allowed = false;
        foreach ($this->allowed as $class) {
            if ($reflector->isSubclassOf($class) || get_class($element) == $class) {
                $allowed = true;
                break;
            }
        }

        if (!$allowed) {
            $type = get_class($element);
            throw new ReactorException("Elements with type '{$type}' are not allowed");
        }

        $this->elements[] = $element;

        return $this;
    }
public function add(DeclarationInterface $element): Aggregator
    {
        $reflector = new \ReflectionObject($element);

        $allowed = false;
        foreach ($this->allowed as $class) {
            if ($reflector->isSubclassOf($class) || get_class($element) == $class) {
                $allowed = true;
                break;
            }
        }

        if (!$allowed) {
            $type = get_class($element);
            throw new ReactorException("Elements with type '{$type}' are not allowed");
        }

        $this->elements[] = $element;

        return $this;
    }
public function add ( DeclarationInterface $ element ) : Aggregator { $ reflector = new \ ReflectionObject ( $ element ) ; $ allowed = false ; foreach ( $ this -> allowed as $ class ) { if ( $ reflector -> isSubclassOf ( $ class ) || get_class ( $ element ) == $ class ) { $ allowed = true ; break ; } } if ( ! $ allowed ) { $ type = get_class ( $ element ) ; throw new ReactorException ( "Elements with type '{$type}' are not allowed" ) ; } $ this -> elements [ ] = $ element ; return $ this ; }
Add new element.

@param DeclarationInterface $element

@return self
@throws ReactorException
Add new element .