Remove all uses of databox_field::get_instance

This commit is contained in:
Benoît Burnichon
2015-07-08 01:20:45 +02:00
parent 82f19ee55d
commit 8ee5279d58
12 changed files with 72 additions and 101 deletions

View File

@@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
use Assert\Assertion;
class databox_descriptionStructure implements IteratorAggregate, Countable
{
/** @var databox_field[] */
@@ -17,10 +19,22 @@ class databox_descriptionStructure implements IteratorAggregate, Countable
/**
* Cache array for the get element by name function
*
* @var databox_field[]
* @var array
*/
protected $cache_name_id = [];
/**
* @param databox_field[] $fields
*/
public function __construct($fields = [])
{
Assertion::allIsInstanceOf($fields, databox_field::class);
foreach ($fields as $field) {
$this->add_element($field);
}
}
/**
* @return Iterator
*/