swoole / library

📚 Swoole Library
https://wiki.swoole.com/#/library
Apache License 2.0
239 stars 56 forks source link

Add ArrayObject::getOr() #62

Closed leocavalcante closed 3 years ago

leocavalcante commented 4 years ago

Based on Rust's APIs like map_or() and unwrap_or this PR provides an alternative way for get that returns a default value, instead of throwing an exception, when the key does not exists.

leocavalcante commented 4 years ago

Not sure if the PR errors was introduced by my commits, but I'm open to fix if needed.