You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `Data::get()` method also takes a default value, which will be returned if the specified key is **not present** or its value is `null` in the array:
1006
+
1007
+
```php
1008
+
use \TypeRocket\Utility\Data;
1009
+
1010
+
$product = new \stdClass;
1011
+
$product->name = 'mic';
1012
+
$product->price = 99;
1013
+
$product->type = null;
1014
+
1015
+
Data::get($array, 'products.0.type', 10);
1016
+
// 10
1017
+
1018
+
Data::get($array, 'products.0.color', 'blue');
1019
+
// 'blue'
1020
+
1021
+
Data::get($array, 'products.1.color', 'blue');
1022
+
// 'blue'
1023
+
```
1024
+
984
1025
### Data:isJson
985
1026
986
1027
The `Data::isJson()` method returns `true` if the given value is valid `json`:
The `Data::value()` method returns the given value unless it is a `callable`. If the value is `callable`, the method calls it using the `\TypeRocket\Core\Resolver::resolveCallable()` method:
0 commit comments