Assert\Assertion::notEmptyKey PHP Method

notEmptyKey() public static method

Assert that key exists in an array/array-accessible object and it's value is not empty.
public static notEmptyKey ( mixed $value, string | integer $key, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$key string | integer
$message string | null
$propertyPath string | null
return boolean
    public static function notEmptyKey($value, $key, $message = null, $propertyPath = null)
    {
        static::keyIsset($value, $key, $message, $propertyPath);
        static::notEmpty($value[$key], $message, $propertyPath);
        return true;
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 public function join(string $channel, array $data = [])
 {
     Assertion::notEmptyKey($data, 'socketId', "Invalid socket id");
     Assertion::notEmptyKey($data, 'userId', "Invalid user id");
     Assertion::notEmptyKey($data, 'fullName', "Invalid full name");
     return $this->pusher->presence_auth($channel, $data['socketId'], $data['userId'], ['id' => $data['userId'], 'name' => utf8_encode($data['fullName'])]);
 }
All Usage Examples Of Assert\Assertion::notEmptyKey