private function arrayHelperMethod( $fn, array $args )
    {

        $class = $this->classGet();
        $fnArguments = array( $this->collection );

        foreach( $args as $container ) {

            // validate the arguments
            if( !( $container instanceof $this ) ) {
                throw new \InvalidArgumentException("You can only `{$fn}` containers.");
            }
            $containerClass = $container->classGet();
            if( isset($class) and isset( $containerClass ) and ( $class !== $containerClass ) ) {
                throw new IncompatibleContainerException("Container -> `{$containerClass}` not compatible with `{$class}`");
            }

            $fnArguments[] = $container->collection;

        }

        $output = $this->newContainer(
            call_user_func_array(
                $fn,
                $fnArguments
            )
        );
        return $output;

    }
private function arrayHelperMethod( $fn, array $args )
    {

        $class = $this->classGet();
        $fnArguments = array( $this->collection );

        foreach( $args as $container ) {

            // validate the arguments
            if( !( $container instanceof $this ) ) {
                throw new \InvalidArgumentException("You can only `{$fn}` containers.");
            }
            $containerClass = $container->classGet();
            if( isset($class) and isset( $containerClass ) and ( $class !== $containerClass ) ) {
                throw new IncompatibleContainerException("Container -> `{$containerClass}` not compatible with `{$class}`");
            }

            $fnArguments[] = $container->collection;

        }

        $output = $this->newContainer(
            call_user_func_array(
                $fn,
                $fnArguments
            )
        );
        return $output;

    }
private function arrayHelperMethod ( $ fn , array $ args ) { $ class = $ this -> classGet ( ) ; $ fnArguments = array ( $ this -> collection ) ; foreach ( $ args as $ container ) { // validate the arguments if ( ! ( $ container instanceof $ this ) ) { throw new \ InvalidArgumentException ( "You can only `{$fn}` containers." ) ; } $ containerClass = $ container -> classGet ( ) ; if ( isset ( $ class ) and isset ( $ containerClass ) and ( $ class !== $ containerClass ) ) { throw new IncompatibleContainerException ( "Container -> `{$containerClass}` not compatible with `{$class}`" ) ; } $ fnArguments [ ] = $ container -> collection ; } $ output = $ this -> newContainer ( call_user_func_array ( $ fn , $ fnArguments ) ) ; return $ output ; }
Validation and execution helper method for intersect and diff.

@param $fn Callback like object
@return Container
Validation and execution helper method for intersect and diff .