mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-09-24 10:27:46 +02:00
Remove trait DataExtractor
This commit is contained in:
parent
310335ecf0
commit
9729b0e99e
@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Icinga\Common;
|
||||
|
||||
trait DataExtractor
|
||||
{
|
||||
/**
|
||||
* Extract data from array to this class's properties Unknown properties (no matching setter) are ignored
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function fromArray(array $data): self
|
||||
{
|
||||
foreach ($data as $name => $value) {
|
||||
$func = 'set' . ucfirst($name);
|
||||
if (method_exists($this, $func)) {
|
||||
$this->$func($value);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this class's structure as array
|
||||
*
|
||||
* Stringifies the attrs or set to null if it doesn't have a value, when $stringify is true
|
||||
*
|
||||
* @param bool $stringify Whether, the attributes should be returned unmodified
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(bool $stringify = true): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user