private function add(
        Traversable $iterator = null,
        $message = null,
        $binary = false
    ) {
        static $count = 0;

        if ($iterator) {
            if ($message) {
                $this->putln('?', $message);
            }

            $box = $binary ? $this->box->getPhar() : $this->box;
            $baseRegex = $this->config->getBasePathRegex();
            $mapper = $this->config->getMapper();

            /** @var $file SplFileInfo */
            foreach ($iterator as $file) {
                if (0 === (++$count % 100)) {
                    gc_collect_cycles();
                }

                $relative = preg_replace($baseRegex, '', $file->getPathname());

                if (null !== ($mapped = $mapper($relative))) {
                    $relative = $mapped;
                }

                if ($this->isVerbose()) {
                    if (false === $file->isReadable()) {
                        throw new RuntimeException(
                            sprintf(
                                'The file "%s" is not readable.',
                                $file->getPathname()
                            )
                        );
                    }

                    $this->putln('+', $file);

                    if (null !== $mapped) {
                        $this->putln('>', $relative);
                    }
                }

                $box->addFile($file, $relative);
            }
        }
    }