final public function createVisitors(int $flags = 0): VisitorInterface
    {
        $flag = function (int $needle) use ($flags) {
            return ($needle & $flags) == $needle;
        };

        $errorObj = new ErrorObject;
        $container = new VisitorContainer($errorObj);

        if (!$flag(self::VISITOR_IGNORE_BASIC_VALIDATION)) {
            $container->addVisitor(new NumberVisitor($errorObj));
            $container->addVisitor(new TextVisitor($errorObj));
        }

        if (!$flag(self::VISITOR_IGNORE_MESSAGES)) {
            $container->addVisitor(new MessageVisitor($errorObj));
        }

        if (!$flag(self::VISITOR_IGNORE_DATES)) {
            $container->addVisitor(new DateVisitor($errorObj));
        }

        if (!$flag(self::VISITOR_IGNORE_ACCOUNTS)) {
            $container->addVisitor(
                new AccountVisitor(
                    $errorObj,
                    new DelegatingFactory(new AccountFactory, new BankgiroFactory),
                    new BankgiroFactory
                )
            );
        }

        if (!$flag(self::VISITOR_IGNORE_AMOUNTS)) {
            $container->addVisitor(new AmountVisitor($errorObj));
        }

        if (!$flag(self::VISITOR_IGNORE_IDS)) {
            $container->addVisitor(
                new StateIdVisitor(
                    $errorObj,
                    new OrganizationIdFactory,
                    new PersonalIdFactory(new CoordinationIdFactory(new NullIdFactory))
                )
            );
        }

        if (!$flag(self::VISITOR_IGNORE_STRICT_VALIDATION)) {
            $container->addVisitor(new PaymentVisitor($errorObj));
            $container->addVisitor(new PayeeVisitor($errorObj));
            $container->addVisitor(new CountingVisitor($errorObj));
            $container->addVisitor(new SummaryVisitor($errorObj));
        }

        return $container;
    }
final public function createVisitors(int $flags = 0): VisitorInterface
    {
        $flag = function (int $needle) use ($flags) {
            return ($needle & $flags) == $needle;
        };

        $errorObj = new ErrorObject;
        $container = new VisitorContainer($errorObj);

        if (!$flag(self::VISITOR_IGNORE_BASIC_VALIDATION)) {
            $container->addVisitor(new NumberVisitor($errorObj));
            $container->addVisitor(new TextVisitor($errorObj));
        }

        if (!$flag(self::VISITOR_IGNORE_MESSAGES)) {
            $container->addVisitor(new MessageVisitor($errorObj));
        }

        if (!$flag(self::VISITOR_IGNORE_DATES)) {
            $container->addVisitor(new DateVisitor($errorObj));
        }

        if (!$flag(self::VISITOR_IGNORE_ACCOUNTS)) {
            $container->addVisitor(
                new AccountVisitor(
                    $errorObj,
                    new DelegatingFactory(new AccountFactory, new BankgiroFactory),
                    new BankgiroFactory
                )
            );
        }

        if (!$flag(self::VISITOR_IGNORE_AMOUNTS)) {
            $container->addVisitor(new AmountVisitor($errorObj));
        }

        if (!$flag(self::VISITOR_IGNORE_IDS)) {
            $container->addVisitor(
                new StateIdVisitor(
                    $errorObj,
                    new OrganizationIdFactory,
                    new PersonalIdFactory(new CoordinationIdFactory(new NullIdFactory))
                )
            );
        }

        if (!$flag(self::VISITOR_IGNORE_STRICT_VALIDATION)) {
            $container->addVisitor(new PaymentVisitor($errorObj));
            $container->addVisitor(new PayeeVisitor($errorObj));
            $container->addVisitor(new CountingVisitor($errorObj));
            $container->addVisitor(new SummaryVisitor($errorObj));
        }

        return $container;
    }
final public function createVisitors ( int $ flags = 0 ) : VisitorInterface { $ flag = function ( int $ needle ) use ( $ flags ) { return ( $ needle & $ flags ) == $ needle ; } ; $ errorObj = new ErrorObject ; $ container = new VisitorContainer ( $ errorObj ) ; if ( ! $ flag ( self :: VISITOR_IGNORE_BASIC_VALIDATION ) ) { $ container -> addVisitor ( new NumberVisitor ( $ errorObj ) ) ; $ container -> addVisitor ( new TextVisitor ( $ errorObj ) ) ; } if ( ! $ flag ( self :: VISITOR_IGNORE_MESSAGES ) ) { $ container -> addVisitor ( new MessageVisitor ( $ errorObj ) ) ; } if ( ! $ flag ( self :: VISITOR_IGNORE_DATES ) ) { $ container -> addVisitor ( new DateVisitor ( $ errorObj ) ) ; } if ( ! $ flag ( self :: VISITOR_IGNORE_ACCOUNTS ) ) { $ container -> addVisitor ( new AccountVisitor ( $ errorObj , new DelegatingFactory ( new AccountFactory , new BankgiroFactory ) , new BankgiroFactory ) ) ; } if ( ! $ flag ( self :: VISITOR_IGNORE_AMOUNTS ) ) { $ container -> addVisitor ( new AmountVisitor ( $ errorObj ) ) ; } if ( ! $ flag ( self :: VISITOR_IGNORE_IDS ) ) { $ container -> addVisitor ( new StateIdVisitor ( $ errorObj , new OrganizationIdFactory , new PersonalIdFactory ( new CoordinationIdFactory ( new NullIdFactory ) ) ) ) ; } if ( ! $ flag ( self :: VISITOR_IGNORE_STRICT_VALIDATION ) ) { $ container -> addVisitor ( new PaymentVisitor ( $ errorObj ) ) ; $ container -> addVisitor ( new PayeeVisitor ( $ errorObj ) ) ; $ container -> addVisitor ( new CountingVisitor ( $ errorObj ) ) ; $ container -> addVisitor ( new SummaryVisitor ( $ errorObj ) ) ; } return $ container ; }
Create the standard set of visitors used when processing a parse tree
Create the standard set of visitors used when processing a parse tree