add

@param mixed  $classes Classes to add string|array|object|closure
@param string $prefix  String to prefix all classes with
@param bool   $path    Treat as path or properties

@return ContainerClass

@access public
552591
public function add($classes, $prefix = null, $path = false)
    {
        $prefix = $this->fixString(($prefix ? $prefix : static::DEFAULT_PREFIX));

        $this->getComponents()->push(
            (object) [
                static::PREFIX_KEY => $prefix,
                static::CLASS_KEY  => $this->fixClasses($prefix, $classes, $path)
            ]
        );

        return $this;
    }
331289
public static function buildDI(array $paths, bool $resolveEnvironment = false): ContainerBuilder
    {
        $container = new ContainerBuilder;

        $loader = static::buildConfigLoader($container, $paths);

        if (class_exists(Configuration::class) && class_exists(RuntimeInstantiator::class)) {
            $container->setProxyInstantiator(new RuntimeInstantiator);
        }

        $extensions = [];
        foreach (static::DI_EXTENSIONS as $extClass) {
            if (!class_exists($extClass)) {
                throw new RuntimeException("Symfony DI Extension not found: \"${extClass}\"");
            }

            $extensions[] = new $extClass;
        }

        foreach ($extensions as $ext) {
            $container->registerExtension($ext);
        }

        $loader->load(static::PRIMARY_CONFIGURATION_FILE);

        foreach ($extensions as $ext) {
            $container->loadFromExtension($ext->getAlias());
        }

        $container->compile($resolveEnvironment);

        return $container;
    }
283667
private function addNode($node, $path, $prop)
    {
        foreach ($node as $tag => $value) {
            $prefix = implode('.', $path);

            if ($prefix !== '') {
                $prefix .= '.';
            }

            // Check for attributes
            foreach ($value->attributes() as $attribute => $val) {
                if ($this->collapseAttr) {
                    $prop->setProperty($prefix . "$tag.$attribute", (string) $val);
                } else {
                    $prop->setProperty($prefix . "$tag($attribute)", (string) $val);
                }
            }

            // Add tag
            if (count($value->children())) {
                $this->addNode($value, array_merge($path, [$tag]), $prop);
            } else {
                $val = (string) $value;

                /* Check for * and ** on 'exclude' and 'include' tag / ant seems to do this? could use FileSet here
                if ($tag == 'exclude') {
                }*/

                // When property already exists, i.e. multiple xml tag
                // <project>
                //    <exclude>file/a.php</exclude>
                //    <exclude>file/a.php</exclude>
                // </project>
                //
                // Would be come project.exclude = file/a.php,file/a.php
                $p = empty($prefix) ? $tag : $prefix . $tag;
                $prop->append($p, (string) $val, $this->delimiter);
            }
        }
    }
881093
public function add(array $updates, $class, $append = true)
    {
        $commandClass = $this->getCommandClass('update.add');
        $this->command = new $commandClass($updates, $class, $append);

        return $this->command;
    }
419308
public function addPaths(array $paths, $clearCache = true, $group = '__DEFAULT__')
	{
		array_map([$this, 'addPath'], $paths, [[$clearCache, $group]]);
	}
767848
public function addPath($path)
    {
        $trimmed = rtrim($path, '/');
        if (!in_array($trimmed, $this->paths)) {
            $this->paths[] = $trimmed;
        }
        return $this;
    }
689200
public function addMap($class, $path)
    {
        $class = static::normalizeClass($class);

        $path = static::normalizePath($path, false);

        $this->maps[$class] = $path;

        return $this;
    }
69192
public function withPath($path = __DIR__)
    {
        $before = get_declared_classes();

        $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
        foreach ($iterator as $item) {
            if (!$item->isDir() && substr($item->getPathname(), -4) == '.php') {
                require_once $item->getPathname();
            }
        }

        $after    = get_declared_classes();
        $commands = array_diff($after, $before);

        $this->withCommands($commands);

        return $this;
    }
81476
private function registerDirectory($basePath, $prefix = '') {
		$basePath = str_replace('\\', '/', $basePath);
		$basePath = rtrim($basePath, '/') . '/';
		$prefix = ($prefix ? $prefix . '_' : '' );
		$files = scandir($basePath);
		foreach ($files as $file) {
			if ($file[0] == '.') {
				continue;
			}
			$path = $basePath . $file;
			if (is_dir($path)) {
				$this->registerDirectory($path, $prefix . pathinfo($path, PATHINFO_FILENAME));
			} elseif (strtolower(pathinfo($path, PATHINFO_EXTENSION)) == 'php') {
				$name = $prefix . pathinfo($path, PATHINFO_FILENAME);
				$this->classMap[$name] = $path;
				$name = str_replace('_', '\\', $name); // register again in case it was namespaced
				$this->classMap[$name] = $path;
			}
		}
	}
346558
public function addPluginPath($path, $prepend = false)
  {
    $paths = (is_array($path)) ? $path : array($path);

    foreach ( $paths as $pluginPath )
    {
      if ( $realPluginPath = realpath( $pluginPath ) )
      {
        if ( $prepend )
        {
          array_unshift( $this->pluginPaths, $realPluginPath );
        }
        else
        {
          $this->pluginPaths[] = $realPluginPath;
        }
      }
    }

    return $this;
  }
72381
public function append($path)
    {
        if (!is_array($path)) {
            $path = $this->normalize($path);
        }

        $path = array_merge($this->paths, $path);

        $this->paths = $this->removeDots($path);

        return $this;
    }
841744
public function addPrefix($prefix, $paths)
    {
        if (!$prefix) {
            foreach ((array) $paths as $path) {
                $this->fallbackDirs[] = $path;
            }

            return;
        }
        if (isset($this->prefixes[$prefix])) {
            $this->prefixes[$prefix] = array_merge(
                $this->prefixes[$prefix],
                (array) $paths
            );
        } else {
            $this->prefixes[$prefix] = (array) $paths;
        }
    }
402045
public function addRoute(array $methods, string $path, string $handler)
  {
    $this->routeCollector->addRoute(
      $methods,
      $this->getPrefix().$path,
      $handler
    );

    return $this;
  }
215303
public  function addClassPath($path) {
        if(!is_array($path)) {
            $path = array($path);
        }
        foreach($path as $item) {
            $this->classPaths[] = $item;
        }
    }
594158
public function addPath($path)
	{
		$path = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
		$this->finder->addPath($path);

		if ($this->environment)
		{
			$this->finder->addPath($path.$this->environment);
		}

		return $this;
	}
707852
private function buildMethodName($path, $prefix = '')
    {
        $method = $prefix;
        foreach (explode('_', str_replace('/', '', $path)) as $word) {
            $method .= ucfirst($word);
        }

        return $method;
    }
578119
public function addPath($path, $prepend = false)
    {
        foreach ($this->engines as $engine) {
            $engine->addPath($path, $prepend);
        }
    }