lib/Cvss/Cvss3.php
public function setVector($vector)
    {
        if (empty($vector)) {
            throw new \InvalidArgumentException(sprintf('Cvss vector "%s" is not valid.', $vector));
        }

        if (!preg_match('/^' . self::$vectorHead . '.*/mi', $vector)) {
            throw new \InvalidArgumentException((sprintf('Cvss vector "%s" is not valid. Must start with "%s"', $vector, self::$vectorHead)));
        }

        $this->vectorInputs = self::parseVector($vector);

        $resolver = $this->getInputLevelConfiguration();
        $this->vectorLevels = $resolver->resolve($this->vectorInputs);

        $this->calculate();
    }
public function setVector($vector)
    {
        if (empty($vector)) {
            throw new \InvalidArgumentException(sprintf('Cvss vector "%s" is not valid.', $vector));
        }

        if (!preg_match('/^' . self::$vectorHead . '.*/mi', $vector)) {
            throw new \InvalidArgumentException((sprintf('Cvss vector "%s" is not valid. Must start with "%s"', $vector, self::$vectorHead)));
        }

        $this->vectorInputs = self::parseVector($vector);

        $resolver = $this->getInputLevelConfiguration();
        $this->vectorLevels = $resolver->resolve($this->vectorInputs);

        $this->calculate();
    }
public function setVector ( $ vector ) { if ( empty ( $ vector ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Cvss vector "%s" is not valid.' , $ vector ) ) ; } if ( ! preg_match ( '/^' . self :: $ vectorHead . '.*/mi' , $ vector ) ) { throw new \ InvalidArgumentException ( ( sprintf ( 'Cvss vector "%s" is not valid. Must start with "%s"' , $ vector , self :: $ vectorHead ) ) ) ; } $ this -> vectorInputs = self :: parseVector ( $ vector ) ; $ resolver = $ this -> getInputLevelConfiguration ( ) ; $ this -> vectorLevels = $ resolver -> resolve ( $ this -> vectorInputs ) ; $ this -> calculate ( ) ; }
Parse CVSS vector

@param string $vector

@throws \InvalidArgumentException
Parse CVSS vector