Check that manifest has valid name and depends

@param string $location
@param array $manifest
337165
protected function _checkManifestIsValid( $location, array $manifest )
	{
		if ( isset( $this->_extensions[$manifest['name']] ) ) {
			$location2 = $this->_extensions[$manifest['name']]['location'];
			$msg = 'Extension "%1$s" exists twice in "%2$s" and in "%3$s"';
			throw new Exception( sprintf( $msg, $manifest['name'], $location, $location2 ) );
		}

		if ( !isset( $manifest['depends'] ) || !is_array( $manifest['depends'] ) ) {
			throw new Exception( sprintf( 'Incorrect dependency configuration in manifest "%1$s"', $location ) );
		}
	}
609461
public function updateLocation(Location $location, $andFlush = true)
    {
        $this->objectManager->persist($location);
        if ($andFlush) {
            $this->objectManager->flush();
        }
    }
1286766
function createManifest(manifest, callback) {
    assert.object(manifest, 'manifest');
    assert.string(manifest.name, 'manifest.name');
    assert.string(manifest.template, 'manifest.template');
    assert.string(manifest.path, 'manifest.path');

    return (this.post('/manifests', manifest, callback));
}
640320
public function matchLocation(APILocation $location)
    {
        $parentContentType = $this->repository->sudo(
            function (Repository $repository) use ($location) {
                $parent = $repository->getLocationService()->loadLocation($location->parentLocationId);

                return $repository
                    ->getContentTypeService()
                    ->loadContentType($parent->getContentInfo()->contentTypeId);
            }
        );

        return isset($this->values[$parentContentType->identifier]);
    }
978249
public function refreshSystemUrlAliasesForLocation(Location $location): void
    {
        $this->service->refreshSystemUrlAliasesForLocation($location);

        $this->signalDispatcher->emit(
            new UpdateLocationSignal(
                [
                    'contentId' => $location->contentId,
                    'locationId' => $location->id,
                    'parentLocationId' => $location->parentLocationId,
                ]
            )
        );
    }
1350010
public function addExpiredTag($location, $expired = null)
    {
        $tag = $location instanceof ExpiredTag ? $location : new ExpiredTag($location, $expired);

        $this->tags[] = $tag;
    }
1174116
function(manifest) {
    var out = "/*\n";
    _.forEach(fields, function(n, key) {
        if (typeof manifest[key] != "undefined") {
            out += pad(n+":", 20) + manifest[key] + "\n";
        }
    });
    out += "*/\n";

    return out;
}
706303
function setVAlign($location)
    {
        if (preg_match("/\d/",$location)) {
            return;                      // Ignore numbers
        }
    
        $location = strtolower($location);
 
        if ($location == 'top') {
            $this->_text_v_align = 0;
        }
        if ($location == 'vcentre') {
            $this->_text_v_align = 1;
        }
        if ($location == 'vcenter') {
            $this->_text_v_align = 1;
        }
        if ($location == 'bottom') {
            $this->_text_v_align = 2;
        }
        if ($location == 'vjustify') {
            $this->_text_v_align = 3;
        }
        if ($location == 'vequal_space') { // For T.K.
            $this->_text_v_align = 4;
        }
    }
319263
public function matchLocation(Location $location)
    {
        $urlAliasService = $this->repository->getURLAliasService();
        $locationUrls = array_merge(
            $urlAliasService->listLocationAliases($location),
            $urlAliasService->listLocationAliases($location, false)
        );

        foreach ($this->values as $pattern => $val) {
            foreach ($locationUrls as $urlAlias) {
                if (strpos($urlAlias->path, "/$pattern") === 0) {
                    return true;
                }
            }
        }

        return false;
    }
201646
function findMissing(manifest, request, host, fn) {
  request
    .post(host + '/manifest/diff')
    .send({manifest: JSON.stringify(manifest)})
    .end(function(err, res) {
      if (err) return fn(err);
      if (res.error) return fn(res.error);
      fn(null, res.body);
    });
}
1329567
private boolean isValidManifestAttribute(ManifestAttribute attr)
    {
        String name = attr.name();
        String value = attr.value();
        boolean isValid = true;

        /*
        Note, the null-check for "name" is necessary when the annotation processor is hosted inside
        of an IDE where the name attribute of the ManifestAttribute metadata can be null
        temporarily.  In order to "keep going", just report a warning and proceed.
        */
        if (name == null || name.length() == 0)
        {
            _ap.printError( _intfDecl, "manifestattribute.illegal.name.1" );
            isValid = false;
        }
        else
        {
            if (alphaNum.indexOf(name.charAt(0)) < 0)
            {
                _ap.printError( _intfDecl, "manifestattribute.illegal.name.2" );
                isValid = false;
            }
            for (int i = 1; i < name.length(); i++)
            {
                if (headerChar.indexOf(name.charAt(i)) < 0)
                {
                    _ap.printError( _intfDecl, "manifestattribute.illegal.name.3", name.charAt(i) );
                    isValid = false;
                    break;
                }
            }
        }

        /*
        Note, the null-check for "value" is necessary when the annotation processor is hosted inside
        of an IDE where the value attribute of the ManifestAttribute metadata can be null
        temporarily.  In order to "keep going", just report a warning and proceed.
        */
        if (value == null || value.length() == 0)
        {
            _ap.printError( _intfDecl, "manifestattribute.illegal.name.4" );
            isValid = false;
        }
        else
        {
            // TODO: validate string contents are valid UTF-8?
        }

        return isValid;
    }
731725
public function writeManifest($manifest)
    {
        $content = "<?php\n\nreturn " .var_export($manifest, true) .";\n";

        $this->files->put($this->manifestPath, $content);

        return array_merge(array('when' => array()), $manifest);
    }
538014
public function validate($location, Constraint $constraint)
    {
        if (null === $location) {
            $this->context->addViolation($constraint->message);

            return;
        }

        $haveUniqueRelation = new ContentHaveUniqueRelation($this->contentService);
        try {
            if (!$haveUniqueRelation->isSatisfiedBy($location->getContent())) {
                $this->context->addViolation($constraint->message);
            }
        } catch (InvalidArgumentException $e) {
            $this->context->addViolation($e->getMessage());
        } catch (UnauthorizedException $e) {
            $this->context->addViolation($e->getMessage());
        }
    }
1371992
public function addLocation($location)
    {
        $loader = new \Mustache_Loader_FilesystemLoader($location);
        if ($this->mustache->getLoader() instanceof \Mustache_Loader_CascadingLoader) {
            $this->mustache->getLoader()->addLoader( $loader);
        } else {
            $loaders = [$this->mustache->getLoader(), $loader];
            $this->mustache->setLoader(new \Mustache_Loader_CascadingLoader($loaders));
        }
        return $this;
    }
893065
def reload_manifest(self, manifest):
        
        self._logger.debug("Reloading manifest for {}.".format(manifest.get("name", "Unnamed Plugin")))
        self._manifests.remove(manifest)
        self.load_manifest(manifest["path"])
        self._logger.debug("Manifest reloaded.")
605540
function validate (rootPath) {
  var manifest;
  var webextensionManifest;

  var errors = {};

  try {
    manifest = JSON.parse(fs.readFileSync(join(rootPath, "package.json")));
  } catch (e) {
    errors.parsing = utils.getErrorMessage("COULD_NOT_PARSE") + "\n" + e.message;
    return errors;
  }

  if (!validateID(manifest)) {
    errors.id = utils.getErrorMessage("INVALID_ID");
  }

  if (!validateMain(rootPath)) {
    errors.main = utils.getErrorMessage("MAIN_DNE");
  }

  if (!validateTitle(manifest)) {
    errors.title = utils.getErrorMessage("INVALID_TITLE");
  }

  if (!validateName(manifest)) {
    errors.name = utils.getErrorMessage("INVALID_NAME");
  }

  if (!validateVersion(manifest)) {
    errors.version = utils.getErrorMessage("INVALID_VERSION");
  }

  // If both a package.json and a manifest.json files exists in the addon
  // root dir, raise an helpful error message that suggest to use web-ext instead.
  if (fs.existsSync(join(rootPath, "manifest.json"))) {
    errors.webextensionManifestFound = utils.getErrorMessage("WEBEXT_ERROR");
  }

  return errors;
}
1144294
protected function storeContext($context, $location)
    {
        $cacheFile = $location . '/cache/apidoc.data';
        if (!is_dir($dir = dirname($cacheFile))) {
            mkdir($dir, 0777, true);
        }
        file_put_contents($cacheFile, serialize($context));
    }