Emarref\Jwt\HeaderParameter\Critical::addParameter PHP Method

addParameter() public method

public addParameter ( ParameterInterface $parameter )
$parameter ParameterInterface
    public function addParameter(ParameterInterface $parameter)
    {
        $value = $this->getValue();
        if (!in_array($parameter->getName(), $value)) {
            $value[] = $parameter->getName();
            $this->setValue($value);
        }
    }

Usage Example

Example #1
0
 public function testAddClaim()
 {
     $parameter = new Custom('foo', 'bar');
     $this->parameter->addParameter($parameter);
     $expectedValue = [self::$value[0], 'foo'];
     $this->assertSame($expectedValue, $this->parameter->getValue());
     $this->parameter->addParameter($parameter);
     $this->assertSame($expectedValue, $this->parameter->getValue(), 'Add parameter duplicates claims');
 }
All Usage Examples Of Emarref\Jwt\HeaderParameter\Critical::addParameter