File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -305,6 +305,23 @@ public function withAttributes(array $attributes): self
305
305
return $ metadata ;
306
306
}
307
307
308
+ /**
309
+ * Gets an attribute.
310
+ *
311
+ * @param string $key
312
+ * @param mixed $defaultValue
313
+ *
314
+ * @return mixed
315
+ */
316
+ public function getAttribute (string $ key , $ defaultValue = null )
317
+ {
318
+ if (isset ($ this ->attributes [$ key ])) {
319
+ return $ this ->attributes [$ key ];
320
+ }
321
+
322
+ return $ defaultValue ;
323
+ }
324
+
308
325
/**
309
326
* Is the property inherited from a child class?
310
327
*
@@ -330,11 +347,23 @@ public function withChildInherited(string $childInherited): self
330
347
return $ metadata ;
331
348
}
332
349
350
+ /**
351
+ * Does the property have a subresource?
352
+ *
353
+ * @return bool|null
354
+ */
333
355
public function hasSubresource ()
334
356
{
335
357
return $ this ->subresource ;
336
358
}
337
359
360
+ /**
361
+ * Returns a new instance with the given subresource flag.
362
+ *
363
+ * @param bool $subresource
364
+ *
365
+ * @return self
366
+ */
338
367
public function withSubresource (bool $ subresource = null ): self
339
368
{
340
369
$ metadata = clone $ this ;
You can’t perform that action at this time.
0 commit comments