Webmozart\Assert\Assert::keyNotExists PHP Method

keyNotExists() public static method

public static keyNotExists ( $array, $key, $message = '' )
    public static function keyNotExists($array, $key, $message = '')
    {
        if (array_key_exists($key, $array)) {
            static::reportInvalidArgument(sprintf($message ?: 'Expected the key %s to not exist.', static::valueToString($key)));
        }
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @param ListenerInterface $listener
  */
 public function addListener(ListenerInterface $listener)
 {
     Assert::keyNotExists($this->listeners, $listener->getName(), 'Listener with name "%s" is already registered.');
     $this->listeners[$listener->getName()] = $listener;
 }
All Usage Examples Of Webmozart\Assert\Assert::keyNotExists