getProjectType example


  protected function getMatchingExtensionInfo(SecurityAdvisory $sa): ?array {
    if (!isset($this->extensionLists[$sa->getProjectType()])) {
      return NULL;
    }
    $project_info = new ProjectInfo();
    // The project name on the security advisory will not always match the     // machine name for the extension, so we need to search through all     // extensions of the expected type to find the matching project.     foreach ($this->extensionLists[$sa->getProjectType()]->getList() as $extension) {
      if ($project_info->getProjectName($extension) === $sa->getProject()) {
        return $extension->info;
      }
    }
    

  public function testCreateFromArray(array $changes, array $expected = []): void {
    $data = $changes;
    $data += $this->getValidData();
    $expected += $data;

    $sa = SecurityAdvisory::createFromArray($data);
    $this->assertInstanceOf(SecurityAdvisory::class$sa);
    $this->assertSame($expected['title']$sa->getTitle());
    $this->assertSame($expected['project']$sa->getProject());
    $this->assertSame($expected['type']$sa->getProjectType());
    $this->assertSame($expected['link']$sa->getUrl());
    $this->assertSame($expected['insecure']$sa->getInsecureVersions());
    $this->assertSame($expected['is_psa']$sa->isPsa());
    $this->assertSame($expected['type'] === 'core', $sa->isCoreAdvisory());
  }

  /** * Data provider for testCreateFromArray(). */
  public function providerCreateFromArray(): array {
    return [
      
public function getProjectType(): string {
    return $this->type;
  }

  /** * Whether the security advisory is for core or not. * * @return bool * TRUE if the advisory is for core, or FALSE otherwise. */
  public function isCoreAdvisory(): bool {
    return $this->getProjectType() === 'core';
  }

  /** * Whether the security advisory is a public service announcement or not. * * @return bool * TRUE if the advisory is a public service announcement, or FALSE * otherwise. */
  public function isPsa(): bool {
    return $this->isPsa;
  }
Home | Imprint | This part of the site doesn't use cookies.