Skip to content

Commit fd88125

Browse files
author
abluchet
committed
Missing comments on property metadata
1 parent 8a579ba commit fd88125

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/Metadata/Property/PropertyMetadata.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,23 @@ public function withAttributes(array $attributes): self
305305
return $metadata;
306306
}
307307

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+
308325
/**
309326
* Is the property inherited from a child class?
310327
*
@@ -330,11 +347,23 @@ public function withChildInherited(string $childInherited): self
330347
return $metadata;
331348
}
332349

350+
/**
351+
* Does the property have a subresource?
352+
*
353+
* @return bool|null
354+
*/
333355
public function hasSubresource()
334356
{
335357
return $this->subresource;
336358
}
337359

360+
/**
361+
* Returns a new instance with the given subresource flag.
362+
*
363+
* @param bool $subresource
364+
*
365+
* @return self
366+
*/
338367
public function withSubresource(bool $subresource = null): self
339368
{
340369
$metadata = clone $this;

0 commit comments

Comments
 (0)