@param string $vendor

@throws \InvalidArgumentException if $vendor is not found

@return string
509329
private function resolveSrc($vendor)
    {
        $src = null;

        /** @var $packages \Composer\Package\CompletePackage[] */
        $packages = $this->repository->getPackages();
        foreach ($packages as $package) {
            if ($vendor == $package->getName()) {
                $autoload = $package->getAutoload();
                $src = current($autoload['psr-0']);

                break;
            }
        }

        if (null === $src) {
            throw new \InvalidArgumentException(sprintf('Vendor "%s" not found', $vendor));
        }

        return $src;
    }
500481
private function getPackage($path)
    {
        $path = realpath($path) ?: $path;
        foreach (self::getVendors() as $vendorRoot) {
            if (0 === strpos($path, $vendorRoot)) {
                $relativePath = substr($path, \strlen($vendorRoot) + 1);
                $vendor = strstr($relativePath, \DIRECTORY_SEPARATOR, true);
                if (false === $vendor) {
                    throw new \RuntimeException(sprintf('Could not find directory separator "%s" in path "%s"', \DIRECTORY_SEPARATOR, $relativePath));
                }

                return rtrim($vendor.'/'.strstr(substr(
                    $relativePath,
                    \strlen($vendor) + 1
                ), \DIRECTORY_SEPARATOR, true), '/');
            }
        }

        throw new \RuntimeException(sprintf('No vendors found for path "%s"', $path));
    }
869838
public function setVendorPrefix($vendorPrefix)
    {
        if (is_string($vendorPrefix)) {
            $this->vendorPrefix = $vendorPrefix;
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($vendorPrefix). "' for argument 'vendorPrefix' given."
            );
        }
    }
1293419
public static function build(
        string $output,
        string $config,
        string $vendor,
        array  $vendors = null
    ) {
        $builder = new Builder($output, $vendor);

        try {
            $builder->build($config, $vendors);
        } catch (\Exception $e) {
            throw $e;
        } finally {
            echo $builder->getLog();
        }
    }
79497
public function getDestinationPath($package)
    {
        $packages = $this->config->getPackages();

        $namespace = isset($packages[$package]) ? $packages[$package] : null;

        if (is_null($namespace)) {
            throw new \InvalidArgumentException("Configuration not found.");
        }

        return $this->publishPath .str_replace('/', DS, "/Packages/{$namespace}");
    }
513483
public function getVendorUrl($vendor, $languageId = null)
    {
        if (!isset($languageId)) {
            $languageId = $vendor->getLanguage();
        }

        return $this->_getFullUrl($this->getVendorUri($vendor, $languageId), $languageId);
    }
117324
public function hasComposerPackage($vendor, $dev = false)
    {

        $packages = !$dev
            ? $this->composer->getRequire()
            : $this->composer->getRequireDev();

        return isset($packages[$vendor]);
    }
571951
protected function prepareVendorDirectory($installPath)
	{
		$matches = '';
		$hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
		if (!$hasVendorDirectory) {
			return;
		}

		$vendorDirectory = $matches['vendor'];
		$vendorPath = getcwd() . '/modules/' . $vendorDirectory;
		if (!file_exists($vendorPath)) {
			mkdir($vendorPath, 0755, true);
		}

		$vendorMetaDataPath = $vendorPath . '/vendormetadata.php';
		touch($vendorMetaDataPath);
	}
1219298
public function getVendorPackage($packageIdentifier, Package $searchIn = NULL) {
    $package = $searchIn ?: $this->getLocalPackage();

    $vendor = $package->getDirectory(Package::VENDOR);
    $packageRoot = $vendor->sub($packageIdentifier.'/');

    $e = NULL;
    try {
      if ($packageRoot->exists()) {
        return $this->getComposerPackageReader()->fromDirectory($packageRoot);
      }

    } catch (\Exception $e) {
    }

    throw VendorPackageInitException::fromIdentifierAndVendor($packageIdentifier, $vendor, $e);
  }
201235
public static function toString(Value $value)
    {
        if ($value instanceof BooleanValue) {
            return $value->getValue() ? 'true' : 'false';
        } elseif ($value instanceof NumberValue || $value instanceof TextValue) {
            return strval($value->getValue());
        } elseif ($value instanceof DateTimeValue) {
            return $value->getValue() !== null
                ? AdManagerDateTimes::toDateTimeString($value->getValue()) : '';
        } elseif ($value instanceof DateValue) {
            return AdManagerDates::toDateString($value->getValue());
        } elseif ($value instanceof SetValue) {
            $pqlValues = $value->getValues();
            if ($pqlValues !== null) {
                $valuesAsStrings = [];
                foreach ($pqlValues as $pqlValue) {
                    $valuesAsStrings[] = self::toString($pqlValue);
                }

                return implode(',', $valuesAsStrings);
            } else {
                return '';
            }
        } else {
            throw new InvalidArgumentException(
                sprintf('Unsupported value type [%s]', get_class($value))
            );
        }
    }
487639
protected static function name($expression)
    {
        if (trim($expression) === '') {
            throw new InvalidArgumentException('Console command definition is empty.');
        }

        if (! preg_match('/[^\s]+/', $expression, $matches)) {
            throw new InvalidArgumentException('Unable to determine command name from signature.');
        }

        return $matches[0];
    }
174213
public function getParameter(string $parameter)
    {
        if ($this->hasParameter($parameter)) {
            return $this->getParameters()[$parameter];
        }

        throw new \InvalidArgumentException(sprintf('Parameter "%s" does not exist', $parameter));
    }
939626
private static function get_vendor_dir() {
		static $vendor_dir = null;

		if ( null !== $vendor_dir ) {
			return $vendor_dir;
		}

		$paths = [
			dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) . '/bin/wp',
			dirname( dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) ) . '/bin/wp',
			dirname( dirname( __DIR__ ) ) . '/vendor/bin/wp',
		];

		foreach ( $paths as $path ) {
			if ( file_exists( $path ) && is_executable( $path ) ) {
				$vendor_dir = (string) realpath( dirname( $path ) );
				break;
			}
		}

		if ( null === $vendor_dir ) {
			// Did not detect WP-CLI binary, so make a random guess.
			$vendor_dir = '/usr/local/bin';
		}

		return $vendor_dir;
	}
1118752
public function format($value)
    {
        if (!$this->validate($value))
            throw new \InvalidArgumentException("`{$value}` is not a valid HTTP URI");

        $url = Http::createFromString($value);

        if ($url->getScheme() == '') {
            $url = $url->withScheme('http');
        }

        return (String)$url;
    }
325297
public function get(string $value)
    {
        if (!$this->has($value)) {
            throw new \InvalidArgumentException(\sprintf(
                'Value %s is not a valid key, expecting one of %s',
                $value,
                \implode(', ', \array_keys($this->values))
            ));
        }

        return $this->values[$value];
    }
486328
public static function toByteString($value)
    {
        if (self::isStringCastable($value)) {
            return (string)$value;
        } else {
            throw new \InvalidArgumentException(ErrorMessageCreator::create($value, 'ByteString (a string)'));
        }
    }
172578
private function getClass($value)
    {
        if (\is_string($value)) {
            if (!class_exists($value) && !interface_exists($value, false)) {
                throw new InvalidArgumentException(sprintf('The class or interface "%s" does not exist.', $value));
            }

            return ltrim($value, '\\');
        }

        if (!\is_object($value)) {
            throw new InvalidArgumentException(sprintf('Cannot create metadata for non-objects. Got: "%s"', \gettype($value)));
        }

        return \get_class($value);
    }