Пример #1
0
 /**
  *
  * @param \Bpi\Sdk\Document $document
  */
 public function __construct(Document $document)
 {
     try {
         $this->document = clone $document;
         $this->document->reduceItemsByAttr('type', 'entity');
         $self = $this;
         $document->firstItem('type', 'collection')->walkProperties(function ($property) use($self) {
             $self->{$property}['name'] = $property['@value'];
         });
     } catch (Exception\EmptyList $e) {
         $this->document->clear();
     }
 }